shrub/pkg/npm/api
gregorytoprak b84ef07f07 npm: fix compatibility with create-urbit-app
The version of babel/webpack/everything bundled with CRA is limited
in its ES features. Reducing to ES2017 let it work by default.
2021-06-16 17:24:40 -04:00
..
contacts npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
graph interface: added thread reducer and basic thread view 2021-05-14 15:12:12 -05:00
groups npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
hark Merge remote-tracking branch 'origin/release/next-userspace' into release/2021-5-27 2021-05-17 16:07:09 +10:00
invite api: brought to parity with livenet 2021-02-24 19:54:00 -08:00
lib interface: threading works for complex graph structures 2021-05-18 18:04:27 -05:00
metadata Merge remote-tracking branch 'origin/release/next-userspace' into release/2021-5-27 2021-05-17 16:07:09 +10:00
s3 npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
settings interface, npm/api: type checking, round 2 2021-04-28 17:18:30 -04:00
.eslintrc.js added NPM packages 2021-01-26 21:45:18 -08:00
index.ts npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
package-lock.json pkg/npm: update package-lock.json 2021-05-18 16:53:01 -04:00
package.json npm: build ts -> js files before publishing 2021-06-16 17:16:15 -04:00
README.md npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
tsconfig.json npm: fix compatibility with create-urbit-app 2021-06-16 17:24:40 -04:00

Urbit API in JavaScript

This package simplifies the process of working with Urbit's APIs into fluent, typed functions organized by app. Pairs well with @urbit/http-api. Compare:

Without:

import UrbitInterface from '@urbit/http-api';
const api: UrbitInterface = useApi();
api.poke({
  app: 'settings-store',
  mark: 'settings-event',
  json: {
    'put-entry': {
      'bucket-key': bucket,
      'entry-key': key,
      'value': value
    }
  }
});

With:

import UrbitInterface from '@urbit/http-api';
import { settings } from '@urbit/api';
const api: UrbitInterface = useApi();
api.poke(setings.putEntry(bucket, key, value));

You may import single functions

import { putEntry } from '@urbit/api';

or whole apps:

import { settings } from '@urbit/api';

This package also provides types and utilities for working with Urbit's internal data structures, such as Nouns, Das, Tas, and so forth.

This package was originally developed as part of Tlon's Landscape client and therefore the best reference material exists there.