@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.
Files changed (132) hide show
  1. package/README.md +185 -32
  2. package/dist/mod.d.ts +10 -4
  3. package/dist/mod.d.ts.map +1 -1
  4. package/dist/mod.js +3 -0
  5. package/dist/mod.js.map +1 -1
  6. package/dist/src/client.d.ts +37 -5
  7. package/dist/src/client.d.ts.map +1 -1
  8. package/dist/src/client.js +40 -5
  9. package/dist/src/client.js.map +1 -1
  10. package/dist/src/config.d.ts +83 -6
  11. package/dist/src/config.d.ts.map +1 -1
  12. package/dist/src/config.js +41 -5
  13. package/dist/src/config.js.map +1 -1
  14. package/dist/src/connections.d.ts +3 -2
  15. package/dist/src/connections.d.ts.map +1 -1
  16. package/dist/src/connections.js +7 -2
  17. package/dist/src/connections.js.map +1 -1
  18. package/dist/src/console/aliases.d.ts +137 -0
  19. package/dist/src/console/aliases.d.ts.map +1 -0
  20. package/dist/src/console/aliases.js +113 -0
  21. package/dist/src/console/aliases.js.map +1 -0
  22. package/dist/src/console/api-calls.d.ts +4 -3
  23. package/dist/src/console/api-calls.d.ts.map +1 -1
  24. package/dist/src/console/api-calls.js +4 -3
  25. package/dist/src/console/api-calls.js.map +1 -1
  26. package/dist/src/console/apps.d.ts +181 -8
  27. package/dist/src/console/apps.d.ts.map +1 -1
  28. package/dist/src/console/apps.js +67 -12
  29. package/dist/src/console/apps.js.map +1 -1
  30. package/dist/src/console/auth.d.ts +245 -7
  31. package/dist/src/console/auth.d.ts.map +1 -1
  32. package/dist/src/console/auth.js +177 -8
  33. package/dist/src/console/auth.js.map +1 -1
  34. package/dist/src/console/commerce.d.ts +428 -0
  35. package/dist/src/console/commerce.d.ts.map +1 -0
  36. package/dist/src/console/commerce.js +220 -0
  37. package/dist/src/console/commerce.js.map +1 -0
  38. package/dist/src/console/dashboard.d.ts +8 -0
  39. package/dist/src/console/dashboard.d.ts.map +1 -1
  40. package/dist/src/console/dashboard.js.map +1 -1
  41. package/dist/src/console/endpoints.d.ts +79 -6
  42. package/dist/src/console/endpoints.d.ts.map +1 -1
  43. package/dist/src/console/endpoints.js.map +1 -1
  44. package/dist/src/console/functions.d.ts +35 -4
  45. package/dist/src/console/functions.d.ts.map +1 -1
  46. package/dist/src/console/functions.js +13 -0
  47. package/dist/src/console/functions.js.map +1 -1
  48. package/dist/src/console/mod.d.ts +32 -7
  49. package/dist/src/console/mod.d.ts.map +1 -1
  50. package/dist/src/console/mod.js +26 -1
  51. package/dist/src/console/mod.js.map +1 -1
  52. package/dist/src/console/otp.d.ts +127 -0
  53. package/dist/src/console/otp.d.ts.map +1 -0
  54. package/dist/src/console/otp.js +118 -0
  55. package/dist/src/console/otp.js.map +1 -0
  56. package/dist/src/console/passkeys.d.ts +246 -0
  57. package/dist/src/console/passkeys.d.ts.map +1 -0
  58. package/dist/src/console/passkeys.js +192 -0
  59. package/dist/src/console/passkeys.js.map +1 -0
  60. package/dist/src/console/reliability.d.ts +101 -6
  61. package/dist/src/console/reliability.d.ts.map +1 -1
  62. package/dist/src/console/reliability.js +16 -5
  63. package/dist/src/console/reliability.js.map +1 -1
  64. package/dist/src/console/step-tests.d.ts +7 -1
  65. package/dist/src/console/step-tests.d.ts.map +1 -1
  66. package/dist/src/console/step-tests.js +1 -1
  67. package/dist/src/console/step-tests.js.map +1 -1
  68. package/dist/src/console/subscriptions.d.ts +38 -16
  69. package/dist/src/console/subscriptions.d.ts.map +1 -1
  70. package/dist/src/console/subscriptions.js +7 -13
  71. package/dist/src/console/subscriptions.js.map +1 -1
  72. package/dist/src/console/tenant-login-flags.d.ts +106 -0
  73. package/dist/src/console/tenant-login-flags.d.ts.map +1 -0
  74. package/dist/src/console/tenant-login-flags.js +113 -0
  75. package/dist/src/console/tenant-login-flags.js.map +1 -0
  76. package/dist/src/console/tenant-oauth-apps.d.ts +75 -14
  77. package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -1
  78. package/dist/src/console/tenant-oauth-apps.js +37 -11
  79. package/dist/src/console/tenant-oauth-apps.js.map +1 -1
  80. package/dist/src/console/tokens.d.ts +2 -0
  81. package/dist/src/console/tokens.d.ts.map +1 -1
  82. package/dist/src/console/tokens.js.map +1 -1
  83. package/dist/src/console/workflows.d.ts +14 -0
  84. package/dist/src/console/workflows.d.ts.map +1 -1
  85. package/dist/src/console/workflows.js +13 -0
  86. package/dist/src/console/workflows.js.map +1 -1
  87. package/dist/src/documents.d.ts +9 -5
  88. package/dist/src/documents.d.ts.map +1 -1
  89. package/dist/src/documents.js +6 -3
  90. package/dist/src/documents.js.map +1 -1
  91. package/dist/src/endpoints.d.ts +75 -0
  92. package/dist/src/endpoints.d.ts.map +1 -0
  93. package/dist/src/endpoints.js +47 -0
  94. package/dist/src/endpoints.js.map +1 -0
  95. package/dist/src/functions.d.ts +236 -0
  96. package/dist/src/functions.d.ts.map +1 -0
  97. package/dist/src/functions.js +201 -0
  98. package/dist/src/functions.js.map +1 -0
  99. package/dist/src/http.d.ts +58 -10
  100. package/dist/src/http.d.ts.map +1 -1
  101. package/dist/src/http.js +82 -11
  102. package/dist/src/http.js.map +1 -1
  103. package/dist/src/me.d.ts +3 -2
  104. package/dist/src/me.d.ts.map +1 -1
  105. package/dist/src/me.js +7 -2
  106. package/dist/src/me.js.map +1 -1
  107. package/dist/src/run.d.ts +19 -5
  108. package/dist/src/run.d.ts.map +1 -1
  109. package/dist/src/run.js +14 -4
  110. package/dist/src/run.js.map +1 -1
  111. package/dist/src/server/mod.d.ts +100 -0
  112. package/dist/src/server/mod.d.ts.map +1 -0
  113. package/dist/src/server/mod.js +121 -0
  114. package/dist/src/server/mod.js.map +1 -0
  115. package/dist/src/team.d.ts +204 -0
  116. package/dist/src/team.d.ts.map +1 -0
  117. package/dist/src/team.js +161 -0
  118. package/dist/src/team.js.map +1 -0
  119. package/dist/src/types.d.ts +143 -10
  120. package/dist/src/types.d.ts.map +1 -1
  121. package/dist/src/types.js +27 -0
  122. package/dist/src/types.js.map +1 -1
  123. package/dist/src/vars.d.ts +5 -3
  124. package/dist/src/vars.d.ts.map +1 -1
  125. package/dist/src/vars.js +14 -4
  126. package/dist/src/vars.js.map +1 -1
  127. package/dist/src/version.js +1 -1
  128. package/dist/src/workflows.d.ts +261 -9
  129. package/dist/src/workflows.d.ts.map +1 -1
  130. package/dist/src/workflows.js +246 -7
  131. package/dist/src/workflows.js.map +1 -1
  132. package/package.json +5 -1
@@ -122,6 +122,16 @@ export interface Me {
122
122
  * would be a server change that the wrapper version-bumps with.
123
123
  */
124
124
  export type ConnectionState = "pending" | "connected" | "needs_refresh" | "broken" | "revoked";
125
+ /** The display metadata of a connection's app, inlined on each {@link ConnectionSummary}. */
126
+ export interface ConnectionAppMeta {
127
+ displayName: string;
128
+ /** Light-theme icon, a `data:image/svg+xml;base64,…` URI. */
129
+ iconSvg?: string;
130
+ /** Dark-theme icon, a `data:image/svg+xml;base64,…` URI. */
131
+ iconSvgDark?: string;
132
+ brandColor?: string;
133
+ brandColorDark?: string;
134
+ }
125
135
  /**
126
136
  * A connection, as the list route projects it.
127
137
  *
@@ -141,8 +151,10 @@ export interface ConnectionSummary {
141
151
  appId: string;
142
152
  /** Which of the app's auth methods this connection uses. */
143
153
  authKey: string;
144
- /** The subject that owns the connection. */
145
- owner: string;
154
+ /** The tenant that owns the connection. */
155
+ tenant: string;
156
+ /** The subject (the partner's user id) that owns the connection. */
157
+ subject: string;
146
158
  /** Human-chosen label. */
147
159
  displayName: string;
148
160
  /** Lifecycle state. */
@@ -157,6 +169,11 @@ export interface ConnectionSummary {
157
169
  createdAt: string;
158
170
  /** ISO-8601 timestamp. */
159
171
  updatedAt: string;
172
+ /**
173
+ * The connection's app, inlined so a list needs no second fetch for names and icons.
174
+ * `null` means the server found no app row; absent means an older server.
175
+ */
176
+ app?: ConnectionAppMeta | null;
160
177
  }
161
178
  /** Lifecycle state of a workflow: an editable draft, a published live one, or archived. */
162
179
  export type WorkflowStatus = "draft" | "active" | "archived";
@@ -170,6 +187,8 @@ export type WorkflowStatus = "draft" | "active" | "archived";
170
187
  export interface WorkflowSummary {
171
188
  /** Server-issued id, `wf_…`. This is the handle a URN addresses. */
172
189
  id: string;
190
+ /** The callable key, or `null` when this workflow has none yet — the normal state for every workflow that predates keys. */
191
+ key: string | null;
173
192
  /** Stable slug, e.g. `"welcome-email"`. */
174
193
  name: string;
175
194
  /** Human-readable label. */
@@ -185,6 +204,36 @@ export interface WorkflowSummary {
185
204
  /** ISO-8601 timestamp. */
186
205
  updatedAt: string;
187
206
  }
207
+ /**
208
+ * A Function definition, as the list route projects it.
209
+ *
210
+ * `key` is the name the Function is CALLED by — `client.functions.run(key)` —
211
+ * and `displayName` is the label a human reads; the server falls back to the
212
+ * key when no display name was set, so `displayName` is never empty and never a
213
+ * substitute for `key`.
214
+ *
215
+ * There is no `status` here, and no lifecycle to have one: a Function is either
216
+ * runnable or not, which is what {@linkcode FunctionSummary.valid} answers.
217
+ */
218
+ export interface FunctionSummary {
219
+ /** Server-issued id, `fn_…`. */
220
+ id: string;
221
+ /** The callable name, e.g. `"send-email"`. Kebab-case, never contains `_`. */
222
+ key: string;
223
+ /** Human-readable label; falls back to `key` server-side. */
224
+ displayName: string;
225
+ /** Free-text description; `""` when unset. */
226
+ description: string;
227
+ /** ISO-8601 timestamp. */
228
+ updatedAt: string;
229
+ /**
230
+ * Whether this Function can actually be run — server-computed, from the same
231
+ * single predicate the invoke path guards with (`db/repos/functions.ts`'s
232
+ * `isFunctionValid`). A draft with no `impl` is `false`, and running it is
233
+ * `422 function_incomplete`.
234
+ */
235
+ valid: boolean;
236
+ }
188
237
  /**
189
238
  * Lifecycle state of a run.
190
239
  *
@@ -228,14 +277,67 @@ export interface RunResult {
228
277
  /** Per-step failures, when the server reports them. */
229
278
  stepErrors?: StepError[];
230
279
  }
280
+ /**
281
+ * The invocation FRAME every `RunEnvelope` arm carries — the platform's own
282
+ * record of the attempt, as opposed to whatever the target returned.
283
+ *
284
+ * Added by the server on 2026-08-20 and purely ADDITIVE: no existing field was
285
+ * renamed, removed or re-typed, so code written against the three-arm shape
286
+ * keeps compiling and keeps working.
287
+ *
288
+ * Every field is OPTIONAL here, and that is deliberate rather than lazy: an
289
+ * installed SDK talks to whichever server version is deployed, and a required
290
+ * field would make this type a lie against any server older than the change.
291
+ * Treat an absent `invocationId` as "this server does not record invocations
292
+ * yet", never as an error.
293
+ */
294
+ export interface InvocationFrame {
295
+ /**
296
+ * This attempt's id, `inv_…`. Resolves through `GET /invocations/{id}` to the
297
+ * stored inputs, output, error and timing.
298
+ *
299
+ * NOT the same thing as {@linkcode WorkflowRunEnvelope.runId}, and neither
300
+ * replaces the other: this names the CALL, `runId` names the queued workflow
301
+ * RUN that a call may have started. On the workflow arm both can be present
302
+ * and they mean different things.
303
+ */
304
+ invocationId?: string;
305
+ /**
306
+ * The PLATFORM's verdict on the attempt — `"succeeded"`, `"failed"` or, on
307
+ * the workflow arm, `"queued"`.
308
+ *
309
+ * Not to be confused with any status the target reported inside its own
310
+ * payload: a SendGrid send whose `output` reads `{statusCode: 202}` is
311
+ * SendGrid describing its own request, not this platform describing the call.
312
+ */
313
+ status?: "succeeded" | "failed" | "queued" | string;
314
+ /** When the attempt started, ISO-8601. */
315
+ startedAt?: string;
316
+ /** When it reached a terminal state, ISO-8601. */
317
+ finishedAt?: string;
318
+ /** Wall-clock duration in milliseconds. */
319
+ durationMs?: number;
320
+ }
231
321
  /** `run` resolved a `conn_…` URN and executed an app action. HTTP `200`. */
232
- export interface ActionRunEnvelope {
322
+ export interface ActionRunEnvelope extends InvocationFrame {
233
323
  kind: "action";
234
- /** The action's return value. Opaque pass-through. */
324
+ /**
325
+ * The action's return value. Opaque pass-through.
326
+ *
327
+ * @deprecated Read {@linkcode ActionRunEnvelope.output} instead — it is the
328
+ * one payload field every arm agrees on. `value` carries the identical value
329
+ * and is not going away without a major bump, but new code should not reach
330
+ * for a name that only one arm has.
331
+ */
235
332
  value: unknown;
333
+ /**
334
+ * The action's return value, under the name every arm shares. Optional
335
+ * because a server older than 2026-08-20 sends only `value`.
336
+ */
337
+ output?: unknown;
236
338
  }
237
339
  /** `run` resolved a `fn_…` / `ep_…` URN and executed it. HTTP `200`. */
238
- export interface FunctionRunEnvelope {
340
+ export interface FunctionRunEnvelope extends InvocationFrame {
239
341
  kind: "function";
240
342
  /** The function's output. Opaque pass-through. */
241
343
  output: unknown;
@@ -246,9 +348,14 @@ export interface FunctionRunEnvelope {
246
348
  * `202` is **success**: the run is queued, and `runId` is how the caller follows
247
349
  * it. There is no `?wait=` on this operation — use `workflows.run` for that (D4).
248
350
  */
249
- export interface WorkflowRunEnvelope {
351
+ export interface WorkflowRunEnvelope extends InvocationFrame {
250
352
  kind: "workflow";
251
- /** Server-issued run handle. */
353
+ /**
354
+ * Server-issued run handle — the QUEUED RUN, not the call that queued it.
355
+ * Follow it with `workflows.getRun`. See
356
+ * {@linkcode InvocationFrame.invocationId} for the other id and why they are
357
+ * not the same.
358
+ */
252
359
  runId: string;
253
360
  /** Where the run has got to; `"queued"` immediately after dispatch. */
254
361
  status: RunStatus;
@@ -269,9 +376,13 @@ export type UnknownRunEnvelope = {
269
376
  /**
270
377
  * What `client.run()` returns: three known arms plus an open one.
271
378
  *
272
- * `value` (action) and `output` (function) are **deliberately different names**
273
- * for the two synchronous arms and are never normalised into one field — the
274
- * discrimination is the point (D3).
379
+ * `value` (action) and `output` (function) were **deliberately different names**
380
+ * for the two synchronous arms, and the guards below still discriminate on
381
+ * `kind` rather than on which field is present. Since 2026-08-20 the server
382
+ * also sends `output` on the action arm, carrying the same value as `value` —
383
+ * so `output` is now the field name every arm shares and the one new code
384
+ * should read. `value` is kept, unchanged, for every caller written before
385
+ * that (D3).
275
386
  *
276
387
  * **The union is open, and narrowing on `kind` alone does not work.** Because
277
388
  * the fourth arm admits any `kind: string`, a bare `env.kind === "workflow"`
@@ -359,4 +470,26 @@ export declare function isTerminalRunStatus(status: RunStatus): boolean;
359
470
  * key, or the key is `null`.
360
471
  */
361
472
  export declare function unwrap<T>(res: HttpResponse<unknown>, key: string): T;
473
+ /**
474
+ * Mint a client-side id for a definition the caller is creating.
475
+ *
476
+ * **Both `POST /workflows` and `POST /functions` REQUIRE an `id` in the body
477
+ * and never generate one** (`admin/workflows.ts`'s and `admin/functions.ts`'s
478
+ * `validateDefinition`: "`id` is required."). The id is synthetic and never
479
+ * user-facing — the display name is what a user sees and edits — so a caller
480
+ * writing `create({name: "…", steps: […]})` should not have to know that, and
481
+ * every consumer that does know it has ended up writing the same four lines
482
+ * (studio's `newWorkflowId`/`newFunctionId`, `WorkflowsPage.tsx:141` and
483
+ * `FunctionsPage.tsx:49`). This is that function, once.
484
+ *
485
+ * `crypto.randomUUID` is present on every runtime this package supports (Node
486
+ * 19+, Deno, Bun, browsers) but is guarded anyway, byte-for-byte as studio
487
+ * guards it: the fallback keeps `create` working on an older Node rather than
488
+ * throwing a `TypeError` from inside the SDK, and the ids only need to be
489
+ * unique per scope, not unguessable — the server owns ownership, not the id.
490
+ *
491
+ * @param prefix - The kind prefix, without its underscore: `"wf"` or `"fn"`.
492
+ * @returns A new id of the form `wf_…` / `fn_…`.
493
+ */
494
+ export declare function mintId(prefix: string): string;
362
495
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,GAAG;IAClB,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;I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E,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,IAAI,EAAE,UAAU,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,MAAM,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,IAAI,iBAAiB,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,IAAI,mBAAmB,CAE1E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,IAAI,mBAAmB,CAE1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAcpE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK7C"}
package/dist/src/types.js CHANGED
@@ -106,4 +106,31 @@ export function unwrap(res, key) {
106
106
  }
107
107
  throw new ApiError(res.status, "bad_response", `Server returned a ${res.status} with no "${key}" in the response body.`, body);
108
108
  }
109
+ /**
110
+ * Mint a client-side id for a definition the caller is creating.
111
+ *
112
+ * **Both `POST /workflows` and `POST /functions` REQUIRE an `id` in the body
113
+ * and never generate one** (`admin/workflows.ts`'s and `admin/functions.ts`'s
114
+ * `validateDefinition`: "`id` is required."). The id is synthetic and never
115
+ * user-facing — the display name is what a user sees and edits — so a caller
116
+ * writing `create({name: "…", steps: […]})` should not have to know that, and
117
+ * every consumer that does know it has ended up writing the same four lines
118
+ * (studio's `newWorkflowId`/`newFunctionId`, `WorkflowsPage.tsx:141` and
119
+ * `FunctionsPage.tsx:49`). This is that function, once.
120
+ *
121
+ * `crypto.randomUUID` is present on every runtime this package supports (Node
122
+ * 19+, Deno, Bun, browsers) but is guarded anyway, byte-for-byte as studio
123
+ * guards it: the fallback keeps `create` working on an older Node rather than
124
+ * throwing a `TypeError` from inside the SDK, and the ids only need to be
125
+ * unique per scope, not unguessable — the server owns ownership, not the id.
126
+ *
127
+ * @param prefix - The kind prefix, without its underscore: `"wf"` or `"fn"`.
128
+ * @returns A new id of the form `wf_…` / `fn_…`.
129
+ */
130
+ export function mintId(prefix) {
131
+ const uuid = typeof crypto !== "undefined" && "randomUUID" in crypto
132
+ ? crypto.randomUUID()
133
+ : Math.floor(Math.random() * 1e16).toString(36);
134
+ return `${prefix}_${uuid}`;
135
+ }
109
136
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqSvC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,GAAgB;IAC1C,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgB;IAC5C,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC;AACjC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from "./http.ts";
24
+ import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
25
25
  import { type Var, type VarType } from "./types.ts";
26
26
  /**
27
27
  * The slice of `W6WClient` this namespace needs: the transport, and nothing
@@ -86,18 +86,20 @@ export declare class VarsApi {
86
86
  /**
87
87
  * List the caller's variables.
88
88
  *
89
+ * @param options - Optional per-call transport options (`signal` to abort).
89
90
  * @returns The variables, unwrapped from the `vars` envelope.
90
91
  * @throws {ApiError} On any non-2xx.
91
92
  */
92
- list(): Promise<Var[]>;
93
+ list(options?: CallOptions): Promise<Var[]>;
93
94
  /**
94
95
  * Fetch one variable by its server-issued id.
95
96
  *
96
97
  * @param id - The `var_…` id.
98
+ * @param options - Optional per-call transport options (`signal` to abort).
97
99
  * @returns The variable.
98
100
  * @throws {ApiError} `404 unknown_var` when there is no such id.
99
101
  */
100
- get(id: string): Promise<Var>;
102
+ get(id: string, options?: CallOptions): Promise<Var>;
101
103
  /**
102
104
  * Fetch one variable by the `name` its author chose.
103
105
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vars.d.ts","sourceRoot":"","sources":["../../src/vars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAU,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAC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export class VarsApi {
44
44
  /**
45
45
  * List the caller's variables.
46
46
  *
47
+ * @param options - Optional per-call transport options (`signal` to abort).
47
48
  * @returns The variables, unwrapped from the `vars` envelope.
48
49
  * @throws {ApiError} On any non-2xx.
49
50
  */
50
- async list() {
51
- const res = await this.#host.request({ method: "GET", path: "/vars" });
51
+ async list(options) {
52
+ const res = await this.#host.request({
53
+ method: "GET",
54
+ path: "/vars",
55
+ signal: options?.signal,
56
+ });
52
57
  return unwrap(res, "vars");
53
58
  }
54
59
  /**
55
60
  * Fetch one variable by its server-issued id.
56
61
  *
57
62
  * @param id - The `var_…` id.
63
+ * @param options - Optional per-call transport options (`signal` to abort).
58
64
  * @returns The variable.
59
65
  * @throws {ApiError} `404 unknown_var` when there is no such id.
60
66
  */
61
- async get(id) {
62
- const res = await this.#host.request({ method: "GET", path: path `/vars/${id}` });
67
+ async get(id, options) {
68
+ const res = await this.#host.request({
69
+ method: "GET",
70
+ path: path `/vars/${id}`,
71
+ signal: options?.signal,
72
+ });
63
73
  // The singular envelope key is `var` — a reserved word in TypeScript, so it
64
74
  // is read as a property and never destructured into a binding.
65
75
  return unwrap(res, "var");
@@ -1 +1 @@
1
- {"version":3,"file":"vars.js","sourceRoot":"","sources":["../../src/vars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,MAAM,EAA0B,MAAM,YAAY,CAAC;AAiD5D;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IACT,KAAK,CAAW;IAEzB;;OAEG;IACH,YAAY,IAAc;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAA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IAAI,EAAE,IAAI,CAAA,SAAS,EAAE,EAAE;YACvB,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAM,GAAG,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAA,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACnF,CAAC;CACF"}
@@ -10,5 +10,5 @@
10
10
  * this file as TypeScript source and rejects inferred public types ("no slow
11
11
  * types").
12
12
  */
13
- export const VERSION = "0.5.0";
13
+ export const VERSION = "0.9.8";
14
14
  //# sourceMappingURL=version.js.map