@wazootech/worlds-client 0.0.0-stage → 0.8.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +146 -2
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/index.d.ts +2045 -0
- package/dist/index.js +1016 -0
- package/openapi/openapi.json +3658 -0
- package/package.json +60 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wazoo Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://docs.wazoo.dev">
|
|
3
|
+
<img src="https://wazoo.dev/assets/wazoo.svg" alt="Wazoo Worlds" width="120" />
|
|
4
|
+
</a>
|
|
5
|
+
<br /><br />
|
|
6
|
+
<em>TypeScript client for the Worlds data-plane API.</em>
|
|
7
|
+
<br /><br />
|
|
8
|
+
<a href="https://www.npmjs.com/package/@wazootech/worlds-client"><img src="https://img.shields.io/npm/v/%40wazootech%2Fworlds-client" alt="npm" /></a>
|
|
9
|
+
<a href="https://github.com/wazootech/worlds-client-ts"><img src="https://img.shields.io/badge/GitHub-black?logo=github" alt="GitHub" /></a>
|
|
10
|
+
<a href="https://deepwiki.com/wazootech/worlds-client-ts"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki" /></a>
|
|
11
|
+
</p>
|
|
2
12
|
|
|
3
|
-
|
|
13
|
+
TypeScript client for the Worlds data-plane API at `data.wazoo.dev`.
|
|
14
|
+
|
|
15
|
+
This package is generated from the canonical Worlds API OpenAPI document
|
|
16
|
+
(committed in `openapi/openapi.json`). Use it for data-plane operations against
|
|
17
|
+
a hosted or self-hosted Worlds service: world search, SPARQL, import, export,
|
|
18
|
+
reindex, world lifecycle, and data-plane API keys.
|
|
19
|
+
|
|
20
|
+
For the embeddable SDK (in-process graph operations over any backend), use
|
|
21
|
+
`@worlds/sdk`. For platform management-plane operations (users, usage, limits,
|
|
22
|
+
billing) use `@wazootech/client`.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install @wazootech/worlds-client # Node.js 22 or newer
|
|
28
|
+
bun add @wazootech/worlds-client # Bun
|
|
29
|
+
deno add npm:@wazootech/worlds-client # Deno
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Deno waits a day before it installs a new release. To get one sooner, add
|
|
33
|
+
`--minimum-dependency-age=0` to the command.
|
|
34
|
+
|
|
35
|
+
Versions up to 0.8.1 were published on JSR as `@worlds/client`. Only the name
|
|
36
|
+
and the registry changed: both import paths and every export are the same.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createClient, searchWorld } from "@wazootech/worlds-client";
|
|
42
|
+
|
|
43
|
+
const client = createClient({
|
|
44
|
+
baseUrl: "https://data.wazoo.dev",
|
|
45
|
+
auth: process.env.WORLDS_DATA_PLANE_TOKEN,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const response = await searchWorld({
|
|
49
|
+
client,
|
|
50
|
+
path: { worldId: "w_<world-uid>" },
|
|
51
|
+
body: { query: "explores" },
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(response.data?.results);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
On Deno, a call that gets its own `client` returns an error, because Deno gives
|
|
58
|
+
that option another meaning. Configure the shared client once instead, and leave
|
|
59
|
+
`client` out of each call:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { client, searchWorld } from "@wazootech/worlds-client";
|
|
63
|
+
|
|
64
|
+
client.setConfig({
|
|
65
|
+
baseUrl: "https://data.wazoo.dev",
|
|
66
|
+
auth: process.env.WORLDS_DATA_PLANE_TOKEN,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const response = await searchWorld({
|
|
70
|
+
path: { worldId: "w_<world-uid>" },
|
|
71
|
+
body: { query: "explores" },
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The OpenAPI document that the client is generated from is exported as
|
|
76
|
+
`@wazootech/worlds-client/openapi.json`.
|
|
77
|
+
|
|
78
|
+
### Provenance
|
|
79
|
+
|
|
80
|
+
A world created or updated with `provenance: true` records which API key wrote
|
|
81
|
+
each fact, and when. It is off by default, and facts written while it is off
|
|
82
|
+
never get records.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import {
|
|
86
|
+
importWorld,
|
|
87
|
+
queryWorldProvenance,
|
|
88
|
+
updateWorld,
|
|
89
|
+
} from "@wazootech/worlds-client";
|
|
90
|
+
|
|
91
|
+
const path = { worldId: "w_<world-uid>" };
|
|
92
|
+
await updateWorld({ client, path, body: { provenance: true } });
|
|
93
|
+
await importWorld({
|
|
94
|
+
client,
|
|
95
|
+
path,
|
|
96
|
+
body: { data: '<urn:car> <urn:color> "blue" .', source: "crm-sync" },
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const { data } = await queryWorldProvenance({
|
|
100
|
+
client,
|
|
101
|
+
path,
|
|
102
|
+
body: { subject: "urn:car" },
|
|
103
|
+
});
|
|
104
|
+
console.log(data?.records[0]?.writerName, data?.records[0]?.time);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
Requires [Bun](https://bun.sh) 1.4.5 or newer.
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
bun install
|
|
113
|
+
bun run ci
|
|
114
|
+
bun run build && bun run check:package
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The last line builds the npm package, installs it in an empty project, and uses
|
|
118
|
+
it on Node.js, Bun and Deno, which must all be on your PATH.
|
|
119
|
+
|
|
120
|
+
Run `bun run sync:openapi` to refresh `openapi/openapi.json`. By default it
|
|
121
|
+
reads the checked-in snapshot at `../worlds-api/openapi/openapi.json` (a sibling
|
|
122
|
+
checkout of the Worlds API repo). In CI (no sibling checkout) it falls back to
|
|
123
|
+
the committed snapshot on worlds-api `main` via raw.githubusercontent.com. Set
|
|
124
|
+
`WORLDS_API_OPENAPI_URL=https://data.wazoo.dev/openapi.json` to sync from a
|
|
125
|
+
deployed API. CI runs `bun run openapi:check` so spec drift fails the build.
|
|
126
|
+
|
|
127
|
+
Run `bun run generate` to regenerate `src/generated/` from the synced spec via
|
|
128
|
+
`@hey-api/openapi-ts`.
|
|
129
|
+
|
|
130
|
+
## Releases
|
|
131
|
+
|
|
132
|
+
Merging to `main` publishes nothing. To publish a version:
|
|
133
|
+
|
|
134
|
+
1. Bump `version` in `package.json` in a pull request (a patch, unless the
|
|
135
|
+
change breaks callers) and merge it.
|
|
136
|
+
2. Publish a GitHub release from `main` with the tag `v<version>`, such as
|
|
137
|
+
`v0.8.2`.
|
|
138
|
+
|
|
139
|
+
That runs the Publish workflow. It stops if the tag and `package.json` disagree,
|
|
140
|
+
or if the OpenAPI snapshot is out of date. Otherwise it checks the packed file on
|
|
141
|
+
Node.js, Bun and Deno and publishes that same file to npm. A version with a
|
|
142
|
+
suffix, such as `0.9.0-rc.0`, goes to the `next` tag instead of `latest`.
|
|
143
|
+
|
|
144
|
+
npm accepts the publish because this repository's `publish.yml` is the package's
|
|
145
|
+
trusted publisher, so there is no npm token to store or rotate. After publishing,
|
|
146
|
+
a second job installs the new version from npm and checks it. If only that job
|
|
147
|
+
fails, re-run it on its own.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The published package contains code from the project below. Its license is
|
|
4
|
+
reproduced as that license requires.
|
|
5
|
+
|
|
6
|
+
## Hey API (`@hey-api/openapi-ts`)
|
|
7
|
+
|
|
8
|
+
<https://github.com/hey-api/openapi-ts>
|
|
9
|
+
|
|
10
|
+
The request code in `src/generated/client/` and `src/generated/core/` is copied
|
|
11
|
+
from this project by `bun run generate`.
|
|
12
|
+
|
|
13
|
+
MIT License
|
|
14
|
+
|
|
15
|
+
Copyright (c) Hey API
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|