mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
02545a7309
Before this change, `term/lib` was importing the Poke type from the `http-api` package. This was causing the rollup build output to place the `term` exported types in a separate path (`dist/api/term`). By switching to the relative import, it is now exported at the expected path (`dist/term`). This fixes imports in consuming projects (e.g., `import { Belt, pokeTask, pokeBelt } from '@urbit/api/term';`). Also, remove the extraneous `Scry` import. |
||
---|---|---|
.. | ||
contacts | ||
docket | ||
graph | ||
groups | ||
hark | ||
hood | ||
invite | ||
lib | ||
metadata | ||
s3 | ||
settings | ||
term | ||
.babelrc | ||
.eslintrc.js | ||
.gitignore | ||
deps.d.ts | ||
index.ts | ||
package-lock.json | ||
package.json | ||
README.md | ||
rollup.config.ts | ||
tsconfig.json |
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.