@w6w/sdk 0.5.0 → 0.9.8
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/README.md +185 -32
- package/dist/mod.d.ts +10 -4
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +3 -0
- package/dist/mod.js.map +1 -1
- package/dist/src/client.d.ts +37 -5
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +40 -5
- package/dist/src/client.js.map +1 -1
- package/dist/src/config.d.ts +83 -6
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +41 -5
- package/dist/src/config.js.map +1 -1
- package/dist/src/connections.d.ts +3 -2
- package/dist/src/connections.d.ts.map +1 -1
- package/dist/src/connections.js +7 -2
- package/dist/src/connections.js.map +1 -1
- package/dist/src/console/aliases.d.ts +137 -0
- package/dist/src/console/aliases.d.ts.map +1 -0
- package/dist/src/console/aliases.js +113 -0
- package/dist/src/console/aliases.js.map +1 -0
- package/dist/src/console/api-calls.d.ts +4 -3
- package/dist/src/console/api-calls.d.ts.map +1 -1
- package/dist/src/console/api-calls.js +4 -3
- package/dist/src/console/api-calls.js.map +1 -1
- package/dist/src/console/apps.d.ts +181 -8
- package/dist/src/console/apps.d.ts.map +1 -1
- package/dist/src/console/apps.js +67 -12
- package/dist/src/console/apps.js.map +1 -1
- package/dist/src/console/auth.d.ts +245 -7
- package/dist/src/console/auth.d.ts.map +1 -1
- package/dist/src/console/auth.js +177 -8
- package/dist/src/console/auth.js.map +1 -1
- package/dist/src/console/commerce.d.ts +428 -0
- package/dist/src/console/commerce.d.ts.map +1 -0
- package/dist/src/console/commerce.js +220 -0
- package/dist/src/console/commerce.js.map +1 -0
- package/dist/src/console/dashboard.d.ts +8 -0
- package/dist/src/console/dashboard.d.ts.map +1 -1
- package/dist/src/console/dashboard.js.map +1 -1
- package/dist/src/console/endpoints.d.ts +79 -6
- package/dist/src/console/endpoints.d.ts.map +1 -1
- package/dist/src/console/endpoints.js.map +1 -1
- package/dist/src/console/functions.d.ts +35 -4
- package/dist/src/console/functions.d.ts.map +1 -1
- package/dist/src/console/functions.js +13 -0
- package/dist/src/console/functions.js.map +1 -1
- package/dist/src/console/mod.d.ts +32 -7
- package/dist/src/console/mod.d.ts.map +1 -1
- package/dist/src/console/mod.js +26 -1
- package/dist/src/console/mod.js.map +1 -1
- package/dist/src/console/otp.d.ts +127 -0
- package/dist/src/console/otp.d.ts.map +1 -0
- package/dist/src/console/otp.js +118 -0
- package/dist/src/console/otp.js.map +1 -0
- package/dist/src/console/passkeys.d.ts +246 -0
- package/dist/src/console/passkeys.d.ts.map +1 -0
- package/dist/src/console/passkeys.js +192 -0
- package/dist/src/console/passkeys.js.map +1 -0
- package/dist/src/console/reliability.d.ts +101 -6
- package/dist/src/console/reliability.d.ts.map +1 -1
- package/dist/src/console/reliability.js +16 -5
- package/dist/src/console/reliability.js.map +1 -1
- package/dist/src/console/step-tests.d.ts +7 -1
- package/dist/src/console/step-tests.d.ts.map +1 -1
- package/dist/src/console/step-tests.js +1 -1
- package/dist/src/console/step-tests.js.map +1 -1
- package/dist/src/console/subscriptions.d.ts +38 -16
- package/dist/src/console/subscriptions.d.ts.map +1 -1
- package/dist/src/console/subscriptions.js +7 -13
- package/dist/src/console/subscriptions.js.map +1 -1
- package/dist/src/console/tenant-login-flags.d.ts +106 -0
- package/dist/src/console/tenant-login-flags.d.ts.map +1 -0
- package/dist/src/console/tenant-login-flags.js +113 -0
- package/dist/src/console/tenant-login-flags.js.map +1 -0
- package/dist/src/console/tenant-oauth-apps.d.ts +75 -14
- package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -1
- package/dist/src/console/tenant-oauth-apps.js +37 -11
- package/dist/src/console/tenant-oauth-apps.js.map +1 -1
- package/dist/src/console/tokens.d.ts +2 -0
- package/dist/src/console/tokens.d.ts.map +1 -1
- package/dist/src/console/tokens.js.map +1 -1
- package/dist/src/console/workflows.d.ts +14 -0
- package/dist/src/console/workflows.d.ts.map +1 -1
- package/dist/src/console/workflows.js +13 -0
- package/dist/src/console/workflows.js.map +1 -1
- package/dist/src/documents.d.ts +9 -5
- package/dist/src/documents.d.ts.map +1 -1
- package/dist/src/documents.js +6 -3
- package/dist/src/documents.js.map +1 -1
- package/dist/src/endpoints.d.ts +75 -0
- package/dist/src/endpoints.d.ts.map +1 -0
- package/dist/src/endpoints.js +47 -0
- package/dist/src/endpoints.js.map +1 -0
- package/dist/src/functions.d.ts +236 -0
- package/dist/src/functions.d.ts.map +1 -0
- package/dist/src/functions.js +201 -0
- package/dist/src/functions.js.map +1 -0
- package/dist/src/http.d.ts +58 -10
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +82 -11
- package/dist/src/http.js.map +1 -1
- package/dist/src/me.d.ts +3 -2
- package/dist/src/me.d.ts.map +1 -1
- package/dist/src/me.js +7 -2
- package/dist/src/me.js.map +1 -1
- package/dist/src/run.d.ts +19 -5
- package/dist/src/run.d.ts.map +1 -1
- package/dist/src/run.js +14 -4
- package/dist/src/run.js.map +1 -1
- package/dist/src/server/mod.d.ts +100 -0
- package/dist/src/server/mod.d.ts.map +1 -0
- package/dist/src/server/mod.js +121 -0
- package/dist/src/server/mod.js.map +1 -0
- package/dist/src/team.d.ts +204 -0
- package/dist/src/team.d.ts.map +1 -0
- package/dist/src/team.js +161 -0
- package/dist/src/team.js.map +1 -0
- package/dist/src/types.d.ts +143 -10
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +27 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/vars.d.ts +5 -3
- package/dist/src/vars.d.ts.map +1 -1
- package/dist/src/vars.js +14 -4
- package/dist/src/vars.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflows.d.ts +261 -9
- package/dist/src/workflows.d.ts.map +1 -1
- package/dist/src/workflows.js +246 -7
- package/dist/src/workflows.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@ The package is authored as runtime-neutral TypeScript against Web standards (`fe
|
|
|
10
10
|
`URL`, `AbortController`), so the same build runs under Node 18+, Deno and Bun.
|
|
11
11
|
|
|
12
12
|
- **License:** MIT (see [LICENSE](./LICENSE)).
|
|
13
|
-
- **Version:** `0.
|
|
13
|
+
- **Version:** `0.9.8`.
|
|
14
|
+
- **Guides:** [docs.w6w.io/clients/node](https://docs.w6w.io/clients/node/), with a
|
|
15
|
+
[full reference](https://docs.w6w.io/clients/node/reference/).
|
|
14
16
|
|
|
15
17
|
## Install
|
|
16
18
|
|
|
@@ -26,18 +28,18 @@ JSR (the TypeScript source, published verbatim):
|
|
|
26
28
|
deno add jsr:@w6w/sdk
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
Both registries publish the **same version at the same time** — `@w6w/sdk`, `@w6w/cli`
|
|
30
|
-
Python `w6w` package share one version number and are released together. A given version
|
|
31
|
-
same set of operations in every language.
|
|
31
|
+
Both registries publish the **same version at the same time** — `@w6w/sdk`, `@w6w/cli`, `@w6w/react`
|
|
32
|
+
and the Python `w6w` package share one version number and are released together. A given version
|
|
33
|
+
means the same set of operations in every language.
|
|
32
34
|
|
|
33
35
|
## Quick start
|
|
34
36
|
|
|
35
37
|
```ts
|
|
36
|
-
import {
|
|
38
|
+
import { isActionRun, isFunctionRun, isWorkflowRun, W6WClient } from "@w6w/sdk";
|
|
37
39
|
|
|
38
40
|
const client = new W6WClient(); // reads W6W_BASE_URL and W6W_TOKEN
|
|
39
41
|
|
|
40
|
-
// Who am I
|
|
42
|
+
// Who am I? (`me.versions.wrapper` is this SDK's version.)
|
|
41
43
|
const me = await client.me();
|
|
42
44
|
|
|
43
45
|
// What can I run? `run` is addressed by a `conn_…` / `fn_…` / `ep_…` / `wf_…`
|
|
@@ -48,9 +50,9 @@ const workflows = await client.workflows.list();
|
|
|
48
50
|
|
|
49
51
|
### Run a connection action
|
|
50
52
|
|
|
51
|
-
A `conn_…` id resolves to an app action. `run` returns a `kind`-tagged envelope —
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
A `conn_…` id resolves to an app action. `run` returns a `kind`-tagged envelope — narrow it with
|
|
54
|
+
`isActionRun` / `isFunctionRun` / `isWorkflowRun` before reading a field, since the three arms use
|
|
55
|
+
different fields (`output` for an action or a function, `runId`+`status` for a workflow):
|
|
54
56
|
|
|
55
57
|
```ts
|
|
56
58
|
const env = await client.run({
|
|
@@ -59,7 +61,7 @@ const env = await client.run({
|
|
|
59
61
|
payload: { channel: "#general", text: "Hello from @w6w/sdk" },
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
if (isActionRun(env)) console.log(env.
|
|
64
|
+
if (isActionRun(env)) console.log(env.output); // the action's return value
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
### Run a function or an endpoint
|
|
@@ -68,7 +70,10 @@ if (isActionRun(env)) console.log(env.value); // the action's return value
|
|
|
68
70
|
operation:
|
|
69
71
|
|
|
70
72
|
```ts
|
|
71
|
-
const env = await client.run({
|
|
73
|
+
const env = await client.run({
|
|
74
|
+
urn: "fn_normalize_address",
|
|
75
|
+
payload: { address: "1 Infinite Loop" },
|
|
76
|
+
});
|
|
72
77
|
if (isFunctionRun(env)) console.log(env.output);
|
|
73
78
|
```
|
|
74
79
|
|
|
@@ -106,14 +111,65 @@ const v = await client.vars.create({ name: "sender_email", type: "string", value
|
|
|
106
111
|
await client.vars.update(v.id, { value: "c@d.e" });
|
|
107
112
|
```
|
|
108
113
|
|
|
114
|
+
Documents belong to a project: pass `{ project: "prj_…" }` as the last argument, or set `project` on
|
|
115
|
+
the client. Without either, your account's default project is used. Vars belong to the account.
|
|
116
|
+
|
|
117
|
+
### Functions, Endpoints and workflow definitions
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
// Run by key or id. `functions.run` returns the Function's output directly.
|
|
121
|
+
const out = await client.functions.run("send-welcome-email", { payload: { to: "a@example.com" } });
|
|
122
|
+
const res = await client.endpoints.run("signup", { payload: { email: "a@example.com" } });
|
|
123
|
+
|
|
124
|
+
// Cancel a run. The answer is the run's status at that moment.
|
|
125
|
+
await client.workflows.cancel("run_01H…");
|
|
126
|
+
|
|
127
|
+
// Read, edit and save a definition, refusing to overwrite someone else's save.
|
|
128
|
+
const { workflow, updatedAt } = await client.workflows.get("wf_01H…");
|
|
129
|
+
await client.workflows.update("wf_01H…", { ...workflow, description: "Sends the welcome email" }, {
|
|
130
|
+
ifUnmodifiedSince: updatedAt,
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`functions.list/get/create/update/delete` and `workflows.create/archive/delete` complete the
|
|
135
|
+
lifecycle. A Function or workflow must be archived before it can be deleted
|
|
136
|
+
(`409 function_not_archived` / `409 workflow_not_archived`).
|
|
137
|
+
|
|
138
|
+
### Team
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
const members = await client.team.members();
|
|
142
|
+
const { redemptionLink } = await client.team.invite({ email: "dev@example.com", role: "member" });
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Reading the roster and open invites works for any member. `invite`, `revokeInvite`, `setRole` and
|
|
146
|
+
`removeMember` need the `owner` or `admin` role.
|
|
147
|
+
|
|
148
|
+
### A route the SDK doesn't wrap
|
|
149
|
+
|
|
150
|
+
`client.request()` sends any request with the client's own base URL, token and headers, and raises
|
|
151
|
+
the same `ApiError`. Build the path with the `path` tag, which percent-encodes each value:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { path } from "@w6w/sdk";
|
|
155
|
+
|
|
156
|
+
const { status, body } = await client.request<{ run: { status: string } }>({
|
|
157
|
+
method: "GET",
|
|
158
|
+
path: path`/runs/${runId}`,
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Every call also takes an `AbortSignal` as `signal`; an aborted call raises `ApiError` with `status`
|
|
163
|
+
`0` and code `cancelled`.
|
|
164
|
+
|
|
109
165
|
## Configuration
|
|
110
166
|
|
|
111
167
|
Two environment variables, both read only at client construction:
|
|
112
168
|
|
|
113
|
-
| Variable | Meaning
|
|
114
|
-
| -------------- |
|
|
169
|
+
| Variable | Meaning | Required |
|
|
170
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
115
171
|
| `W6W_BASE_URL` | The **origin** of your w6w server, e.g. `https://api.example.com`. The API is served at the root of that host, so nothing is appended. | Yes |
|
|
116
|
-
| `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request.
|
|
172
|
+
| `W6W_TOKEN` | The bearer token, sent as `Authorization: Bearer <token>` on every request. | Yes |
|
|
117
173
|
|
|
118
174
|
Explicit constructor arguments always win over the environment, and credentials are **instance
|
|
119
175
|
state**: two clients in one process can hold different tokens and point at different servers with no
|
|
@@ -130,18 +186,63 @@ const client = new W6WClient();
|
|
|
130
186
|
const other = new W6WClient({ baseUrl: "https://api.example.com", token: "…" });
|
|
131
187
|
```
|
|
132
188
|
|
|
189
|
+
### The four options a host embedding w6w needs
|
|
190
|
+
|
|
191
|
+
Both variables stay plain strings. These four constructor options cover the cases a host — a partner
|
|
192
|
+
embedding w6w inside its own product, a backend juggling tenants — actually runs into, and none of
|
|
193
|
+
them has an environment-variable spelling:
|
|
194
|
+
|
|
195
|
+
| Option | Meaning |
|
|
196
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------- |
|
|
197
|
+
| `token` | A bearer token, **or a supplier function** called per request (see below). |
|
|
198
|
+
| `refreshOnUnauthorized` | Opt in to a single recovery retry when a request fails `401` / `unauthorized`. `false` by default. |
|
|
199
|
+
| `onUnauthorized` | Called with the terminal `401` `ApiError`, at most once per call. |
|
|
200
|
+
| `headers` | Default headers sent with every request. |
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
const client = new W6WClient({
|
|
204
|
+
baseUrl: "https://api.example.com",
|
|
205
|
+
// Called (and awaited) per request — never cached from construction.
|
|
206
|
+
token: () => readTenantToken(),
|
|
207
|
+
refreshOnUnauthorized: true, // one retry when the server answers 401
|
|
208
|
+
onUnauthorized: (err) => redirectToLogin(err), // …and what to do when that did not help
|
|
209
|
+
headers: { "X-W6W-Tenant": tenantId }, // your own gateway/authorizer header
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**A token supplier is how a host mints or rotates a credential out of band.** `token` takes a
|
|
214
|
+
`string` — sent verbatim on every call, exactly as before — or a `TokenProvider` function returning
|
|
215
|
+
one, which is called **per request** rather than resolved once at construction, so a token that
|
|
216
|
+
changes between calls is picked up without rebuilding the client. Requests in flight
|
|
217
|
+
**concurrently** on one client share ONE supplier call (and its result); nothing is cached once it
|
|
218
|
+
settles, so memoize the supplier yourself if minting is expensive. A nullish or blank result is
|
|
219
|
+
treated exactly like a missing static token: a `ConfigError` naming `W6W_TOKEN`, never a request
|
|
220
|
+
sent with no credential.
|
|
221
|
+
|
|
222
|
+
**`refreshOnUnauthorized` opts in to one recovery.** Off by default, and the behaviour before the
|
|
223
|
+
option existed. When a request fails `401` with `{code: "unauthorized"}` and `token` is a function,
|
|
224
|
+
the supplier is called once more with `{forceRefresh: true}` and, if that yields a usable value, the
|
|
225
|
+
**same** request is re-sent once. Nothing else is ever retried — not a second time, not another
|
|
226
|
+
status, and never a `requireAuth: false` request. `onUnauthorized` receives the terminal `401` error
|
|
227
|
+
— after a failed recovery, or immediately when recovery is off or the token is a plain string — at
|
|
228
|
+
most once per call, and never on success.
|
|
229
|
+
|
|
230
|
+
**`headers` is the base every per-request `headers` option builds on.** A per-request header with
|
|
231
|
+
the same name wins, and neither can displace the `authorization` bearer or the `content-type` the
|
|
232
|
+
client sets for a JSON body.
|
|
233
|
+
|
|
133
234
|
### `W6W_BASE_URL` is an origin
|
|
134
235
|
|
|
135
|
-
The API is served at the **root** of its own host — `https://api.example.com/vars`, not
|
|
136
|
-
|
|
137
|
-
|
|
236
|
+
The API is served at the **root** of its own host — `https://api.example.com/vars`, not `…/api/vars`
|
|
237
|
+
— so the client appends **nothing**. Trailing slashes never matter, and any path you configure is
|
|
238
|
+
preserved verbatim, because it is indistinguishable from a real gateway prefix:
|
|
138
239
|
|
|
139
|
-
| `W6W_BASE_URL`
|
|
140
|
-
|
|
|
141
|
-
| `https://api.example.com`
|
|
142
|
-
| `https://api.example.com/`
|
|
143
|
-
| `https://api.example.com///`
|
|
144
|
-
| `https://api.example.com/gw`
|
|
240
|
+
| `W6W_BASE_URL` | Requests go to |
|
|
241
|
+
| ---------------------------- | ------------------------------ |
|
|
242
|
+
| `https://api.example.com` | `https://api.example.com/…` |
|
|
243
|
+
| `https://api.example.com/` | `https://api.example.com/…` |
|
|
244
|
+
| `https://api.example.com///` | `https://api.example.com/…` |
|
|
245
|
+
| `https://api.example.com/gw` | `https://api.example.com/gw/…` |
|
|
145
246
|
|
|
146
247
|
> **Breaking in `0.2.0`.** The client used to append `/api`. If your `W6W_BASE_URL` ends in `/api`
|
|
147
248
|
> because of that, **drop the suffix** — the path is now preserved rather than deduplicated, so a
|
|
@@ -160,6 +261,10 @@ Sent as `Authorization: Bearer <token>` on **every** request — there are no an
|
|
|
160
261
|
this API. A client with no token can still be constructed (so tools that only print help or a
|
|
161
262
|
version work offline); the configuration error naming `W6W_TOKEN` surfaces on the first request.
|
|
162
263
|
|
|
264
|
+
The variable is a plain string only. A credential that has to change between requests is spelled in
|
|
265
|
+
the constructor — `token: () => …`, [above](#the-four-options-a-host-embedding-w6w-needs) — never in
|
|
266
|
+
the environment.
|
|
267
|
+
|
|
163
268
|
## Errors
|
|
164
269
|
|
|
165
270
|
Two error types, and the difference between them is diagnostic:
|
|
@@ -175,23 +280,71 @@ Classify by `status`, and by a **prefix** of `code` (`unknown_*`, `invalid_*`, `
|
|
|
175
280
|
by an exhaustive list of codes, which the server extends freely. Note that a `424` means the target
|
|
176
281
|
app or its upstream vendor failed, not that w6w did; it is passed through untouched.
|
|
177
282
|
|
|
178
|
-
Nothing is retried, no token is refreshed, and a `401` has no side effect beyond the raised error
|
|
283
|
+
Nothing is retried, no token is refreshed, and a `401` has no side effect beyond the raised error —
|
|
284
|
+
unless you opted in with `refreshOnUnauthorized`, which retries the failed request exactly once (see
|
|
285
|
+
[the four options a host embedding w6w needs](#the-four-options-a-host-embedding-w6w-needs)).
|
|
286
|
+
|
|
287
|
+
## Embedding for enterprise tenants
|
|
288
|
+
|
|
289
|
+
If you are a partner embedding w6w inside your OWN product, your backend mints a short-lived,
|
|
290
|
+
per-user w6w token with one call — `exchangeToken`, from a **separate** entry point,
|
|
291
|
+
`@w6w/sdk/server`, never from `@w6w/sdk` itself:
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
import { exchangeToken } from "@w6w/sdk/server";
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
This is a backend-only function: it takes your tenant's `clientId`/`clientSecret`, which must never
|
|
298
|
+
reach a browser or a mobile client. A typical route on your OWN backend — never called directly from
|
|
299
|
+
your frontend — looks like this:
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
// Your backend, e.g. POST /api/w6w-token
|
|
303
|
+
app.post("/api/w6w-token", async (req, res) => {
|
|
304
|
+
const session = await readPartnerSession(req); // YOUR auth, not w6w's
|
|
305
|
+
|
|
306
|
+
// Exchange trusts whatever `account` it is given — w6w has no way to verify
|
|
307
|
+
// it against your own data, so YOU derive it from YOUR OWN membership data,
|
|
308
|
+
// never from an unauthenticated client input (a query param, a request body
|
|
309
|
+
// field a browser could set).
|
|
310
|
+
const account = await yourOwnMembershipLookup(session.userId);
|
|
311
|
+
|
|
312
|
+
const { token, expiresIn } = await exchangeToken({
|
|
313
|
+
baseUrl: process.env.W6W_BASE_URL!,
|
|
314
|
+
clientId: process.env.W6W_TENANT_CLIENT_ID!,
|
|
315
|
+
clientSecret: process.env.W6W_TENANT_CLIENT_SECRET!, // never sent to the browser
|
|
316
|
+
subject: session.userId,
|
|
317
|
+
account,
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
res.json({ token, expiresAt: Date.now() + expiresIn * 1000 });
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Your frontend calls `/api/w6w-token`, gets `{ token, expiresAt }`, and uses `token` as `W6W_TOKEN`/a
|
|
325
|
+
bearer for the rest of the session — the tenant secret itself never leaves your backend. Credentials
|
|
326
|
+
travel only as an HTTP `Authorization: Basic base64(clientId:clientSecret)` header — never in the
|
|
327
|
+
request body, the URL or a query string — and every malformed input (a blank
|
|
328
|
+
`clientId`/`clientSecret`/`subject`, a `clientId` containing `:`, a non-latin-1
|
|
329
|
+
`clientId`/`clientSecret`) raises a local `ConfigError` before any network call. The
|
|
330
|
+
[embedding guide](https://docs.w6w.io/clients/node/embedding/) walks through token caching and
|
|
331
|
+
refresh end to end; [`../docs/sdk-surface.md`](../docs/sdk-surface.md) "Server-only subpath —
|
|
332
|
+
`@w6w/sdk/server`" pins the contract in both languages.
|
|
179
333
|
|
|
180
334
|
## The surface
|
|
181
335
|
|
|
182
336
|
What operations exist is not decided in this repo. It is defined by the shared machine-readable
|
|
183
|
-
contract **`endpoints.json`**, which
|
|
184
|
-
conformance test reads directly — the same file, never a vendored
|
|
185
|
-
wrapper is a failing test, not a preference.
|
|
337
|
+
contract **`endpoints.json`**, which every contract lane (this SDK, the CLI and the Python client)
|
|
338
|
+
implements and which each one's conformance test reads directly — the same file, never a vendored
|
|
339
|
+
copy. An operation missing from a wrapper is a failing test, not a preference.
|
|
186
340
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`404`. The marker records **server** readiness, not wrapper completeness.
|
|
341
|
+
An operation marked `planned` in that contract is implemented and unit-tested here ahead of its
|
|
342
|
+
server route. The marker records **server** readiness, not wrapper completeness.
|
|
190
343
|
|
|
191
344
|
## Versioning
|
|
192
345
|
|
|
193
|
-
The version is a shared fact across all
|
|
194
|
-
|
|
346
|
+
The version is a shared fact across all four packages, so a release may go out for this package even
|
|
347
|
+
when nothing in it changed — a divergent version is far more expensive than an empty release.
|
|
195
348
|
|
|
196
349
|
Below `1.0.0`, **breaking changes may land in a minor bump.** That grace ends at `1.0.0`; do not
|
|
197
350
|
plan around it.
|
package/dist/mod.d.ts
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
export { VERSION } from "./src/version.ts";
|
|
18
18
|
export { W6WClient } from "./src/client.ts";
|
|
19
19
|
export { ApiError, ConfigError } from "./src/errors.ts";
|
|
20
|
-
export { BASE_PATH, type FetchLike, joinBaseUrl, type ResolvedConfig, type W6WClientOptions, } from "./src/config.ts";
|
|
21
|
-
export type { HttpMethod, HttpResponse, QueryParams, RequestOptions } from "./src/http.ts";
|
|
20
|
+
export { BASE_PATH, type FetchLike, joinBaseUrl, type ResolvedConfig, type TokenProvider, type W6WClientOptions, } from "./src/config.ts";
|
|
21
|
+
export type { CallOptions, HttpMethod, HttpResponse, QueryParams, RequestOptions, } from "./src/http.ts";
|
|
22
22
|
export { path } from "./src/http.ts";
|
|
23
23
|
export { DocumentsApi } from "./src/documents.ts";
|
|
24
24
|
export type { DocumentCreateInput, DocumentOptions, DocumentPatch, DocumentsHost, } from "./src/documents.ts";
|
|
@@ -29,9 +29,15 @@ export type { MeHost } from "./src/me.ts";
|
|
|
29
29
|
export { ConnectionsApi } from "./src/connections.ts";
|
|
30
30
|
export type { ConnectionsHost } from "./src/connections.ts";
|
|
31
31
|
export { WorkflowsApi } from "./src/workflows.ts";
|
|
32
|
-
export
|
|
32
|
+
export { FunctionsApi } from "./src/functions.ts";
|
|
33
|
+
export type { FunctionDefinition, FunctionDetail, FunctionRunOptions, FunctionsHost, } from "./src/functions.ts";
|
|
34
|
+
export { EndpointsApi } from "./src/endpoints.ts";
|
|
35
|
+
export type { EndpointRunOptions, EndpointsHost } from "./src/endpoints.ts";
|
|
36
|
+
export { TeamApi } from "./src/team.ts";
|
|
37
|
+
export type { TeamHost, TeamInvite, TeamInviteInput, TeamInviteWithLink, TeamMember, } from "./src/team.ts";
|
|
38
|
+
export type { WorkflowDefinition, WorkflowDetail, WorkflowListOptions, WorkflowRunOptions, WorkflowRunResult, WorkflowSaveResult, WorkflowsHost, WorkflowWriteOptions, } from "./src/workflows.ts";
|
|
33
39
|
export { runUrn } from "./src/run.ts";
|
|
34
40
|
export type { RunHost, RunInput } from "./src/run.ts";
|
|
35
41
|
export { isActionRun, isFunctionRun, isTerminalRunStatus, isWorkflowRun } from "./src/types.ts";
|
|
36
|
-
export type { ActionRunEnvelope, ConnectionState, ConnectionSummary, Doc, DocFormat, FunctionRunEnvelope, Me, RunEnvelope, RunResult, RunStatus, StepError, UnknownRunEnvelope, Var, VarType, WorkflowRunEnvelope, WorkflowStatus, WorkflowSummary, } from "./src/types.ts";
|
|
42
|
+
export type { ActionRunEnvelope, ConnectionAppMeta, ConnectionState, ConnectionSummary, Doc, DocFormat, FunctionRunEnvelope, FunctionSummary, InvocationFrame, Me, RunEnvelope, RunResult, RunStatus, StepError, UnknownRunEnvelope, Var, VarType, WorkflowRunEnvelope, WorkflowStatus, WorkflowSummary, } from "./src/types.ts";
|
|
37
43
|
//# sourceMappingURL=mod.d.ts.map
|
package/dist/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,SAAS,EACT,KAAK,SAAS,EACd,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAi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GACX,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAOtD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhG,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,GAAG,EACH,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,EAAE,EACF,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
|
package/dist/mod.js
CHANGED
|
@@ -38,6 +38,9 @@ export { VarsApi } from "./src/vars.js";
|
|
|
38
38
|
export { fetchMe } from "./src/me.js";
|
|
39
39
|
export { ConnectionsApi } from "./src/connections.js";
|
|
40
40
|
export { WorkflowsApi } from "./src/workflows.js";
|
|
41
|
+
export { FunctionsApi } from "./src/functions.js";
|
|
42
|
+
export { EndpointsApi } from "./src/endpoints.js";
|
|
43
|
+
export { TeamApi } from "./src/team.js";
|
|
41
44
|
// Execution (T2.1.5): the URN-addressed `run`. `client.run(input)` is a method
|
|
42
45
|
// on the client, so what is exported is its host interface, its input type and
|
|
43
46
|
// the standalone function the client delegates to.
|
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,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OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,uEAAuE;AACvE,wEAAwE;AACxE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -18,10 +18,13 @@ import { type ResolvedConfig, type W6WClientOptions } from "./config.ts";
|
|
|
18
18
|
import { ConnectionsApi } from "./connections.ts";
|
|
19
19
|
import { ConsoleApi } from "./console/mod.ts";
|
|
20
20
|
import { DocumentsApi } from "./documents.ts";
|
|
21
|
-
import { type HttpResponse, type RequestOptions } from "./http.ts";
|
|
21
|
+
import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
|
|
22
22
|
import { type RunInput } from "./run.ts";
|
|
23
|
+
import { TeamApi } from "./team.ts";
|
|
23
24
|
import type { Me, RunEnvelope } from "./types.ts";
|
|
24
25
|
import { VarsApi } from "./vars.ts";
|
|
26
|
+
import { EndpointsApi } from "./endpoints.ts";
|
|
27
|
+
import { FunctionsApi } from "./functions.ts";
|
|
25
28
|
import { WorkflowsApi } from "./workflows.ts";
|
|
26
29
|
/**
|
|
27
30
|
* A client for the w6w HTTP API.
|
|
@@ -78,9 +81,28 @@ export declare class W6WClient {
|
|
|
78
81
|
* `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
|
|
79
82
|
*/
|
|
80
83
|
readonly workflows: WorkflowsApi;
|
|
84
|
+
/**
|
|
85
|
+
* Run a Function by the name you gave it: `functions.run("send-email", {payload})`.
|
|
86
|
+
*
|
|
87
|
+
* The name is the first argument and may be the Function's KEY or its `fn_…`
|
|
88
|
+
* id — the server takes either in one slot, because the two shapes cannot
|
|
89
|
+
* collide. Returns the Function's output directly; the kind is already
|
|
90
|
+
* settled by the method name, so there is no envelope to unwrap.
|
|
91
|
+
*/
|
|
92
|
+
readonly functions: FunctionsApi;
|
|
93
|
+
/**
|
|
94
|
+
* Run an Endpoint by the key you gave it: `endpoints.run("send-email", {payload})`.
|
|
95
|
+
*
|
|
96
|
+
* Same name-first shape as `functions.run`, but this one returns the
|
|
97
|
+
* `kind`-discriminated envelope: an Endpoint dispatches to an app action, a
|
|
98
|
+
* Function or a Workflow, and only the response says which answered.
|
|
99
|
+
*/
|
|
100
|
+
readonly endpoints: EndpointsApi;
|
|
81
101
|
/**
|
|
82
102
|
* Console-only namespaces: `console.reliability.list`, `console.auth.*`
|
|
83
|
-
* (`login`, `signup`, `checkAccountSlug`, `createAccount`
|
|
103
|
+
* (`login`, `signup`, `checkAccountSlug`, `createAccount`, `getMe`,
|
|
104
|
+
* `getProfile`, `updateProfile`, `requestContactChange`,
|
|
105
|
+
* `confirmContactChange`, `removeContact`, `promoteContact`, `setPassword`),
|
|
84
106
|
* `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
|
|
85
107
|
* `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
|
|
86
108
|
* `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
|
|
@@ -96,8 +118,10 @@ export declare class W6WClient {
|
|
|
96
118
|
* `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
|
|
97
119
|
* `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
|
|
98
120
|
* `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
|
|
99
|
-
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`)
|
|
100
|
-
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`)
|
|
121
|
+
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`),
|
|
122
|
+
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`) and
|
|
123
|
+
* `console.passkeys.*` (`registrationOptions`, `registrationVerify`,
|
|
124
|
+
* `authenticationOptions`, `authenticationVerify`, `list`, `revoke`).
|
|
101
125
|
* Studio-internal and unstable — not part of the published partner
|
|
102
126
|
* contract, excluded from `endpoints.json` and from this package's root
|
|
103
127
|
* barrel (`docs/console.md`, HITL-1). Reached only through
|
|
@@ -105,6 +129,13 @@ export declare class W6WClient {
|
|
|
105
129
|
* exactly like `vars` and `connections`.
|
|
106
130
|
*/
|
|
107
131
|
readonly console: ConsoleApi;
|
|
132
|
+
/**
|
|
133
|
+
* The caller's account team: `members`, `invite`, `invites`, `revokeInvite`,
|
|
134
|
+
* `setRole`, `removeMember`. Not project-scoped — team membership is
|
|
135
|
+
* account-wide — and constructed with the transport only, exactly like
|
|
136
|
+
* `vars` and `connections`.
|
|
137
|
+
*/
|
|
138
|
+
readonly team: TeamApi;
|
|
108
139
|
/**
|
|
109
140
|
* @param options - Explicit configuration; anything omitted falls back to the environment.
|
|
110
141
|
* @throws {ConfigError} When no base URL is configured, or the host has no `fetch`.
|
|
@@ -120,11 +151,12 @@ export declare class W6WClient {
|
|
|
120
151
|
* `versions.wrapper`, this package's own version, which is filled in and
|
|
121
152
|
* never overwrites a key the server supplied.
|
|
122
153
|
*
|
|
154
|
+
* @param options - Optional per-call transport options (`signal` to abort).
|
|
123
155
|
* @returns The caller's identity.
|
|
124
156
|
* @throws {ConfigError} When no token is configured.
|
|
125
157
|
* @throws {ApiError} On any non-2xx, e.g. a `401` when the token is rejected.
|
|
126
158
|
*/
|
|
127
|
-
me(): Promise<Me>;
|
|
159
|
+
me(options?: CallOptions): Promise<Me>;
|
|
128
160
|
/**
|
|
129
161
|
* Run whatever a URN addresses — a connection action, a function, an endpoint
|
|
130
162
|
* or a workflow — and get back the kind-tagged envelope.
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,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,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAErC;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAIvB;;;OAGG;gBACS,OAAO,GAAE,gBAAqB;IAgC1C;;;;;;;;;;;;;;OAcG;IACH,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAAE,CAAC;IAItC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1C;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAG9D"}
|
package/dist/src/client.js
CHANGED
|
@@ -22,7 +22,10 @@ import { ConfigError } from "./errors.js";
|
|
|
22
22
|
import { request } from "./http.js";
|
|
23
23
|
import { fetchMe } from "./me.js";
|
|
24
24
|
import { runUrn } from "./run.js";
|
|
25
|
+
import { TeamApi } from "./team.js";
|
|
25
26
|
import { VarsApi } from "./vars.js";
|
|
27
|
+
import { EndpointsApi } from "./endpoints.js";
|
|
28
|
+
import { FunctionsApi } from "./functions.js";
|
|
26
29
|
import { WorkflowsApi } from "./workflows.js";
|
|
27
30
|
/**
|
|
28
31
|
* A client for the w6w HTTP API.
|
|
@@ -78,9 +81,28 @@ export class W6WClient {
|
|
|
78
81
|
* `@w6w/trigger` step and read downstream as `steps.<triggerId>.output.<key>`.
|
|
79
82
|
*/
|
|
80
83
|
workflows;
|
|
84
|
+
/**
|
|
85
|
+
* Run a Function by the name you gave it: `functions.run("send-email", {payload})`.
|
|
86
|
+
*
|
|
87
|
+
* The name is the first argument and may be the Function's KEY or its `fn_…`
|
|
88
|
+
* id — the server takes either in one slot, because the two shapes cannot
|
|
89
|
+
* collide. Returns the Function's output directly; the kind is already
|
|
90
|
+
* settled by the method name, so there is no envelope to unwrap.
|
|
91
|
+
*/
|
|
92
|
+
functions;
|
|
93
|
+
/**
|
|
94
|
+
* Run an Endpoint by the key you gave it: `endpoints.run("send-email", {payload})`.
|
|
95
|
+
*
|
|
96
|
+
* Same name-first shape as `functions.run`, but this one returns the
|
|
97
|
+
* `kind`-discriminated envelope: an Endpoint dispatches to an app action, a
|
|
98
|
+
* Function or a Workflow, and only the response says which answered.
|
|
99
|
+
*/
|
|
100
|
+
endpoints;
|
|
81
101
|
/**
|
|
82
102
|
* Console-only namespaces: `console.reliability.list`, `console.auth.*`
|
|
83
|
-
* (`login`, `signup`, `checkAccountSlug`, `createAccount`
|
|
103
|
+
* (`login`, `signup`, `checkAccountSlug`, `createAccount`, `getMe`,
|
|
104
|
+
* `getProfile`, `updateProfile`, `requestContactChange`,
|
|
105
|
+
* `confirmContactChange`, `removeContact`, `promoteContact`, `setPassword`),
|
|
84
106
|
* `console.dashboard.stats`, `console.projects.*` (`list`, `create`,
|
|
85
107
|
* `delete`), `console.schedules.*` (`get`, `upsert`, `delete`),
|
|
86
108
|
* `console.apps.*` (`list`, `get`, `getAuth`, `getActions`, `getTriggers`,
|
|
@@ -96,8 +118,10 @@ export class W6WClient {
|
|
|
96
118
|
* `disable`, `enable`, `revoke`), `console.functions.*` (`list`, `get`,
|
|
97
119
|
* `upsert`), `console.endpoints.*` (`list`, `get`, `upsert`, `invoke`),
|
|
98
120
|
* `console.subscriptions.*` (`list`, `listForWorkflow`, `get`, `create`,
|
|
99
|
-
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`)
|
|
100
|
-
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`)
|
|
121
|
+
* `delete`, `listEvents`, `requeueEvent`), `console.apiCalls.*` (`list`),
|
|
122
|
+
* `console.tenantOAuthApps.*` (`list`, `put`, `remove`) and
|
|
123
|
+
* `console.passkeys.*` (`registrationOptions`, `registrationVerify`,
|
|
124
|
+
* `authenticationOptions`, `authenticationVerify`, `list`, `revoke`).
|
|
101
125
|
* Studio-internal and unstable — not part of the published partner
|
|
102
126
|
* contract, excluded from `endpoints.json` and from this package's root
|
|
103
127
|
* barrel (`docs/console.md`, HITL-1). Reached only through
|
|
@@ -105,6 +129,13 @@ export class W6WClient {
|
|
|
105
129
|
* exactly like `vars` and `connections`.
|
|
106
130
|
*/
|
|
107
131
|
console;
|
|
132
|
+
/**
|
|
133
|
+
* The caller's account team: `members`, `invite`, `invites`, `revokeInvite`,
|
|
134
|
+
* `setRole`, `removeMember`. Not project-scoped — team membership is
|
|
135
|
+
* account-wide — and constructed with the transport only, exactly like
|
|
136
|
+
* `vars` and `connections`.
|
|
137
|
+
*/
|
|
138
|
+
team;
|
|
108
139
|
#fetch;
|
|
109
140
|
/**
|
|
110
141
|
* @param options - Explicit configuration; anything omitted falls back to the environment.
|
|
@@ -134,7 +165,10 @@ export class W6WClient {
|
|
|
134
165
|
this.vars = new VarsApi(this);
|
|
135
166
|
this.connections = new ConnectionsApi(this);
|
|
136
167
|
this.workflows = new WorkflowsApi(this);
|
|
168
|
+
this.functions = new FunctionsApi(this);
|
|
169
|
+
this.endpoints = new EndpointsApi(this);
|
|
137
170
|
this.console = new ConsoleApi(this);
|
|
171
|
+
this.team = new TeamApi(this);
|
|
138
172
|
}
|
|
139
173
|
/**
|
|
140
174
|
* Who this client's credential says you are, plus the versions of the
|
|
@@ -146,12 +180,13 @@ export class W6WClient {
|
|
|
146
180
|
* `versions.wrapper`, this package's own version, which is filled in and
|
|
147
181
|
* never overwrites a key the server supplied.
|
|
148
182
|
*
|
|
183
|
+
* @param options - Optional per-call transport options (`signal` to abort).
|
|
149
184
|
* @returns The caller's identity.
|
|
150
185
|
* @throws {ConfigError} When no token is configured.
|
|
151
186
|
* @throws {ApiError} On any non-2xx, e.g. a `401` when the token is rejected.
|
|
152
187
|
*/
|
|
153
|
-
me() {
|
|
154
|
-
return fetchMe(this);
|
|
188
|
+
me(options) {
|
|
189
|
+
return fetchMe(this, options);
|
|
155
190
|
}
|
|
156
191
|
/**
|
|
157
192
|
* Run whatever a URN addresses — a connection action, a function, an endpoint
|
package/dist/src/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAuC,OAAO,EAAuB,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAiB,MAAM,EAAE,MAAM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