@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
@@ -21,7 +21,7 @@
21
21
  * @module
22
22
  */
23
23
  import type { ResolvedConfig } from "./config.ts";
24
- import { type HttpResponse, type RequestOptions } from "./http.ts";
24
+ import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
25
25
  import { type Doc, type DocFormat } from "./types.ts";
26
26
  /**
27
27
  * The slice of `W6WClient` this namespace needs: the transport, plus
@@ -41,8 +41,12 @@ export interface DocumentsHost {
41
41
  * `project` overrides the client's default for this one call. Omitted
42
42
  * everywhere, the server resolves the account's default project; an unknown id
43
43
  * is `400 unknown_project`.
44
+ *
45
+ * Extends {@linkcode CallOptions}, so every document read also takes an
46
+ * optional `signal` (R-7) — forwarded by `list`/`get`/`getByKey`; carried on
47
+ * the mutation methods' options by type only, with no new behaviour there.
44
48
  */
45
- export interface DocumentOptions {
49
+ export interface DocumentOptions extends CallOptions {
46
50
  /** Project id to scope this call to. */
47
51
  project?: string;
48
52
  }
@@ -96,7 +100,7 @@ export declare class DocumentsApi {
96
100
  /**
97
101
  * List the caller's documents.
98
102
  *
99
- * @param options - Optional per-call project scope.
103
+ * @param options - Optional per-call project scope and/or `signal` to abort.
100
104
  * @returns The documents, unwrapped from the `documents` envelope.
101
105
  * @throws {ApiError} On any non-2xx, e.g. `400 unknown_project`.
102
106
  */
@@ -105,7 +109,7 @@ export declare class DocumentsApi {
105
109
  * Fetch one document by its server-issued id.
106
110
  *
107
111
  * @param id - The `doc_…` id.
108
- * @param options - Optional per-call project scope.
112
+ * @param options - Optional per-call project scope and/or `signal` to abort.
109
113
  * @returns The document.
110
114
  * @throws {ApiError} `404 unknown_document` when there is no such id.
111
115
  */
@@ -125,7 +129,7 @@ export declare class DocumentsApi {
125
129
  * unreadable through this client.
126
130
  *
127
131
  * @param key - The document key, sent encoded and otherwise untouched.
128
- * @param options - Optional per-call project scope.
132
+ * @param options - Optional per-call project scope and/or `signal` to abort.
129
133
  * @returns The document.
130
134
  * @throws {ApiError} `404 unknown_document` when there is no such key.
131
135
  */
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAU,MAAM,YAAY,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,iBAAiB;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,OAAO,CAAC,E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AUpE;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAkBjF;;;;;;;;;;OAUG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAcvF;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAOnE"}
@@ -51,7 +51,7 @@ export class DocumentsApi {
51
51
  /**
52
52
  * List the caller's documents.
53
53
  *
54
- * @param options - Optional per-call project scope.
54
+ * @param options - Optional per-call project scope and/or `signal` to abort.
55
55
  * @returns The documents, unwrapped from the `documents` envelope.
56
56
  * @throws {ApiError} On any non-2xx, e.g. `400 unknown_project`.
57
57
  */
@@ -60,6 +60,7 @@ export class DocumentsApi {
60
60
  method: "GET",
61
61
  path: "/documents",
62
62
  query: { project: this.#project(options) },
63
+ signal: options?.signal,
63
64
  });
64
65
  return unwrap(res, "documents");
65
66
  }
@@ -67,7 +68,7 @@ export class DocumentsApi {
67
68
  * Fetch one document by its server-issued id.
68
69
  *
69
70
  * @param id - The `doc_…` id.
70
- * @param options - Optional per-call project scope.
71
+ * @param options - Optional per-call project scope and/or `signal` to abort.
71
72
  * @returns The document.
72
73
  * @throws {ApiError} `404 unknown_document` when there is no such id.
73
74
  */
@@ -76,6 +77,7 @@ export class DocumentsApi {
76
77
  method: "GET",
77
78
  path: path `/documents/${id}`,
78
79
  query: { project: this.#project(options) },
80
+ signal: options?.signal,
79
81
  });
80
82
  return unwrap(res, "document");
81
83
  }
@@ -94,7 +96,7 @@ export class DocumentsApi {
94
96
  * unreadable through this client.
95
97
  *
96
98
  * @param key - The document key, sent encoded and otherwise untouched.
97
- * @param options - Optional per-call project scope.
99
+ * @param options - Optional per-call project scope and/or `signal` to abort.
98
100
  * @returns The document.
99
101
  * @throws {ApiError} `404 unknown_document` when there is no such key.
100
102
  */
@@ -103,6 +105,7 @@ export class DocumentsApi {
103
105
  method: "GET",
104
106
  path: path `/documents/by-key/${key}`,
105
107
  query: { project: this.#project(options) },
108
+ signal: options?.signal,
106
109
  });
107
110
  return unwrap(res, "document");
108
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAqB,IAAI,EAAuB,MAAM,WAAW,CAAC;AACzE,OAAO,EAA4B,MAAM,EAAE,MAAM,YAAY,CAAC;AA4D9D;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACd,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAyB;QAChC,OAAO,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;IACpE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CAAC,OAAyB;QAClC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;SAC3C,CAAC,CAAC;QACH,OAAO,MAAM,CAAQ,GAAG,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU,EAAE,OAAyB;QAC7C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MA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EAAE,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAA,cAAc,EAAE,EAAE;YAC5B,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;SAC3C,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `client.endpoints.*` — run an Endpoint by the key you gave it.
3
+ *
4
+ * An Endpoint is a callable entry point that dispatches to whatever it targets:
5
+ * an app action, a Function, or a Workflow. Before this namespace existed,
6
+ * calling one meant `client.run({ urn: "ep_…" })` — an opaque id, buried inside
7
+ * an object, for an Endpoint the user named `send-email`. Now:
8
+ *
9
+ * ```ts
10
+ * await client.endpoints.run("send-email", { payload: { to, subject } });
11
+ * ```
12
+ *
13
+ * The name is the FIRST argument, matching `workflows.run` and `functions.run`,
14
+ * so all three runnable kinds read alike.
15
+ *
16
+ * ID OR KEY, one argument: `/endpoints/{idOrKey}/invoke` accepts either, because
17
+ * an id carries a kind prefix (and so an underscore) while a key is kebab-case
18
+ * (which forbids one). No flag, no prefix — pass whichever you have.
19
+ *
20
+ * UNLIKE `functions.run`, THIS RETURNS AN ENVELOPE, and that asymmetry is the
21
+ * honest one: a Function's kind is settled by the method name, but an Endpoint
22
+ * dispatches to one of three things and the caller genuinely does not know which
23
+ * answered. The `kind` discriminant is information here, not ceremony — and the
24
+ * Workflow arm is asynchronous (`202`, a `runId`) where the other two are not.
25
+ */
26
+ import type { ResolvedConfig } from "./config.ts";
27
+ import { type HttpResponse, type RequestOptions } from "./http.ts";
28
+ import type { RunEnvelope } from "./types.ts";
29
+ /**
30
+ * What this namespace needs from the client — the same narrow seam
31
+ * `WorkflowsApi` and `FunctionsApi` take.
32
+ */
33
+ export interface EndpointsHost {
34
+ /** The resolved configuration. */
35
+ readonly config: ResolvedConfig;
36
+ /** Perform one request. */
37
+ request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
38
+ }
39
+ /** Per-call options for `endpoints.run`. */
40
+ export interface EndpointRunOptions {
41
+ /**
42
+ * The Endpoint's input, by input key.
43
+ *
44
+ * Named `payload` for the same reason as `functions.run`: one word across
45
+ * every runnable kind, even though the wire spells this one `input`.
46
+ */
47
+ payload?: Record<string, unknown>;
48
+ }
49
+ /**
50
+ * The `endpoints` namespace on a `W6WClient`.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const envelope = await client.endpoints.run("send-email", { payload: { to } });
55
+ * if (envelope.kind === "workflow") console.log(envelope.runId); // async arm
56
+ * ```
57
+ */
58
+ export declare class EndpointsApi {
59
+ #private;
60
+ /**
61
+ * @param host - The client this namespace issues requests through.
62
+ */
63
+ constructor(host: EndpointsHost);
64
+ /**
65
+ * Run one Endpoint; the envelope's `kind` says which arm answered.
66
+ *
67
+ * @param name - The Endpoint's key (`"send-email"`) or its `ep_…` id. Percent-encoded into the path.
68
+ * @param options - `payload`, the Endpoint's input.
69
+ * @returns The `kind`-discriminated envelope, returned exactly as it arrived.
70
+ * @throws {ApiError} `404 unknown_endpoint` when no Endpoint of that name exists for the caller.
71
+ * @throws {ApiError} `bad_response` when a success body carries no string `kind`.
72
+ */
73
+ run(name: string, options?: EndpointRunOptions): Promise<RunEnvelope>;
74
+ }
75
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;;IAGvB;;OAEG;gBACS,IAAI,EAAE,aAAa;IAI/B;;;;;;;;OAQG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;CAyB5E"}
@@ -0,0 +1,47 @@
1
+ import { ApiError } from "./errors.js";
2
+ import { path } from "./http.js";
3
+ /**
4
+ * The `endpoints` namespace on a `W6WClient`.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const envelope = await client.endpoints.run("send-email", { payload: { to } });
9
+ * if (envelope.kind === "workflow") console.log(envelope.runId); // async arm
10
+ * ```
11
+ */
12
+ export class EndpointsApi {
13
+ #host;
14
+ /**
15
+ * @param host - The client this namespace issues requests through.
16
+ */
17
+ constructor(host) {
18
+ this.#host = host;
19
+ }
20
+ /**
21
+ * Run one Endpoint; the envelope's `kind` says which arm answered.
22
+ *
23
+ * @param name - The Endpoint's key (`"send-email"`) or its `ep_…` id. Percent-encoded into the path.
24
+ * @param options - `payload`, the Endpoint's input.
25
+ * @returns The `kind`-discriminated envelope, returned exactly as it arrived.
26
+ * @throws {ApiError} `404 unknown_endpoint` when no Endpoint of that name exists for the caller.
27
+ * @throws {ApiError} `bad_response` when a success body carries no string `kind`.
28
+ */
29
+ async run(name, options) {
30
+ const res = await this.#host.request({
31
+ method: "POST",
32
+ path: path `/endpoints/${name}/invoke`,
33
+ body: { input: options?.payload ?? {} },
34
+ });
35
+ const body = res.body;
36
+ // The same guard `run.ts` applies, for the same reason: an object-only
37
+ // check lets `{}` and `[]` through and hands back an envelope whose `kind`
38
+ // is `undefined` at runtime — a lie the compiler cannot catch.
39
+ if (typeof body !== "object" || body === null ||
40
+ typeof body.kind !== "string") {
41
+ throw new ApiError(res.status, "bad_response", `Server returned a ${res.status} with no "kind" in the response body.`, body);
42
+ }
43
+ // Returned as it arrived — an unknown `kind` reaches the caller intact.
44
+ return body;
45
+ }
46
+ }
47
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/endpoints.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAqB,IAAI,EAAuB,MAAM,WAAW,CAAC;AAyBzE;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IACd,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,OAA4B;QAClD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAA,cAAc,IAAI,SAAS;YACrC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE;SACxC,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,uEAAuE;QACvE,2EAA2E;QAC3E,+DAA+D;QAC/D,IACE,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YACzC,OAAQ,IAA2B,CAAC,IAAI,KAAK,QAAQ,EACrD,CAAC;YACD,MAAM,IAAI,QAAQ,CAChB,GAAG,CAAC,MAAM,EACV,cAAc,EACd,qBAAqB,GAAG,CAAC,MAAM,uCAAuC,EACtE,IAAI,CACL,CAAC;QACJ,CAAC;QACD,wEAAwE;QACxE,OAAO,IAAmB,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * `client.functions.*` — run a Function by the name you gave it.
3
+ *
4
+ * A Function is a canonical, vendor-stable interface bound to one swappable app
5
+ * Action. Before this namespace existed, calling one meant the URN operation:
6
+ *
7
+ * ```ts
8
+ * await client.run({ urn: "fn_a9b39917-cd4e-4eea-ab89-c3d079684193", payload });
9
+ * ```
10
+ *
11
+ * — an opaque id, buried inside an object, for a Function the user named
12
+ * `send-email`. `client.run` is still the right tool when the caller is
13
+ * *dispatching* something whose kind it does not know; it is the wrong tool for
14
+ * "call my send-email Function", which is what this is:
15
+ *
16
+ * ```ts
17
+ * await client.functions.run("send-email", { payload: { to, subject, html } });
18
+ * ```
19
+ *
20
+ * The name is the FIRST argument, matching `workflows.run(id, opts?)` — the
21
+ * namespace already shaped this way — so all three runnable kinds read alike.
22
+ *
23
+ * ── The rest of the namespace ──
24
+ * `list`, `get`, `create`, `update` and `delete` complete the definition
25
+ * lifecycle, mirroring `client.workflows.*` op for op with two differences the
26
+ * server dictates, not this package: there is no `?project=` anywhere on this
27
+ * domain, and there is no archive step before `delete`.
28
+ *
29
+ * The server has ONE write route (`POST /functions`, an upsert), so `create`
30
+ * and `update` are the same request shaped differently — `create` mints the
31
+ * required `id`, `update` pins the one you addressed — and `update` is a full
32
+ * replacement rather than a patch.
33
+ *
34
+ * ID OR KEY, one argument. The server's `/functions/{idOrKey}/invoke` accepts
35
+ * either, because the two shapes cannot collide: an id carries a kind prefix and
36
+ * therefore an underscore, and a key is kebab-case, which forbids one. So this
37
+ * takes no flag and no prefix to say which you meant — pass whichever you have.
38
+ */
39
+ import type { ResolvedConfig } from "./config.ts";
40
+ import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
41
+ import { type FunctionSummary } from "./types.ts";
42
+ /**
43
+ * What this namespace needs from the client — the same narrow seam
44
+ * `WorkflowsApi` takes, so it is constructible in a test and this module never
45
+ * imports the client back.
46
+ */
47
+ export interface FunctionsHost {
48
+ /** The resolved configuration. */
49
+ readonly config: ResolvedConfig;
50
+ /** Perform one request. */
51
+ request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
52
+ }
53
+ /** Per-call options for `functions.run`. */
54
+ export interface FunctionRunOptions {
55
+ /**
56
+ * The Function's canonical inputs, by input key.
57
+ *
58
+ * Named `payload` rather than `inputs` so every runnable kind in this SDK
59
+ * takes the same word — the wire spells it `inputs` for a Function and
60
+ * `input` for an Endpoint, and reconciling that is exactly the job of a
61
+ * wrapper. Defaults to `{}` rather than being omitted: the server's parameter
62
+ * schemas are written against an object, and `{}` says "no input" where an
63
+ * absent key says "I forgot".
64
+ */
65
+ payload?: Record<string, unknown>;
66
+ }
67
+ /**
68
+ * A Function definition — kept OPAQUE, for the same reason `WorkflowDefinition`
69
+ * (`./workflows.ts`) is.
70
+ *
71
+ * The interesting field is `impl`, and it is a union the server extends: an app
72
+ * Action today, another Function or a Workflow since D-8 (`rfcs/function.md`).
73
+ * A wrapper that modelled it would reject an arm a newer server accepts, and
74
+ * the whole point of a Function is that `impl` is the part you swap. Callers
75
+ * bind to `inputs`/`output`; this package carries the definition, it does not
76
+ * interpret it.
77
+ *
78
+ * The one field read here is `id`, in {@linkcode FunctionsApi.create}.
79
+ */
80
+ export type FunctionDefinition = Record<string, unknown>;
81
+ /** What `functions.get` returns: the stored definition, plus the server's own verdict on it. */
82
+ export interface FunctionDetail {
83
+ /** The stored definition, verbatim. */
84
+ function: FunctionDefinition;
85
+ /**
86
+ * Whether the Function can be run — **a top-level sibling, never a field
87
+ * inside `function`**, and this method keeps it there rather than splicing
88
+ * it in. It is computed per request, it is not part of the stored document
89
+ * (`rfcs/function.md`), and folding it into the definition would put it in
90
+ * the object a caller sends back to {@linkcode FunctionsApi.update}.
91
+ */
92
+ valid: boolean;
93
+ }
94
+ /**
95
+ * The `functions` namespace on a `W6WClient`.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const output = await client.functions.run("send-email", {
100
+ * payload: { to: "ada@example.com", subject: "Hi", html: "<p>Hello</p>" },
101
+ * });
102
+ *
103
+ * // The definition lifecycle.
104
+ * const fns = await client.functions.list();
105
+ * const { function: def } = await client.functions.get(fns[0].id);
106
+ * await client.functions.update(fns[0].id, { ...def, description: "Send an email" });
107
+ * ```
108
+ */
109
+ export declare class FunctionsApi {
110
+ #private;
111
+ /**
112
+ * @param host - The client this namespace issues requests through.
113
+ */
114
+ constructor(host: FunctionsHost);
115
+ /**
116
+ * Run one Function and return its output.
117
+ *
118
+ * Returns the Function's OUTPUT, not an envelope. `client.run` returns a
119
+ * `kind`-discriminated envelope because the caller does not know what the URN
120
+ * will resolve to; here the kind is in the method name, so the discriminant
121
+ * would be a field the caller has to unwrap to learn nothing.
122
+ *
123
+ * @param name - The Function's key (`"send-email"`) or its `fn_…` id. Percent-encoded into the path.
124
+ * @param options - `payload`, the Function's canonical inputs.
125
+ * @returns The Function's output, unwrapped from the `output` envelope.
126
+ * @throws {ApiError} `404 unknown_function` when no Function of that name exists for the caller.
127
+ * @throws {ApiError} `422 function_incomplete` when the Function has no runnable `impl`.
128
+ * @throws {ApiError} `bad_response` when a success body carries no `output` key at all.
129
+ */
130
+ run(name: string, options?: FunctionRunOptions): Promise<unknown>;
131
+ /**
132
+ * List the caller's Function definitions.
133
+ *
134
+ * This is how a caller discovers a `key` to pass to {@linkcode run} — the
135
+ * same job `workflows.list` and `connections.list` do for their own ids (D4),
136
+ * and the reason a read-only integration needs no other write access.
137
+ *
138
+ * Each row already carries `valid`, computed server-side; there is no second
139
+ * call to make to find out whether a Function is runnable.
140
+ *
141
+ * **No `project` parameter.** Unlike workflows and documents, the route reads
142
+ * no `?project=` at all (`admin/functions.ts`) — sending one would be
143
+ * inventing a parameter, which is the failure mode `endpoints.json` warns
144
+ * about.
145
+ *
146
+ * @param options - Optional per-call transport options (`signal` to abort).
147
+ * @returns The Functions, unwrapped from the `functions` envelope.
148
+ * @throws {ApiError} On any non-2xx.
149
+ */
150
+ list(options?: CallOptions): Promise<FunctionSummary[]>;
151
+ /**
152
+ * Fetch one Function's stored definition.
153
+ *
154
+ * Returns the whole body — `{function, valid}` — rather than splicing `valid`
155
+ * into the definition. See {@linkcode FunctionDetail.valid} for why that
156
+ * placement matters on the way back OUT of this method.
157
+ *
158
+ * @param id - The `fn_…` id, or the Function's `key`. Percent-encoded into the path.
159
+ * @param options - Optional per-call transport options (`signal` to abort).
160
+ * @returns The definition and the server's runnability verdict.
161
+ * @throws {ApiError} `404 unknown_function` when there is no such Function for this caller.
162
+ */
163
+ get(id: string, options?: CallOptions): Promise<FunctionDetail>;
164
+ /**
165
+ * Create a Function.
166
+ *
167
+ * **The id is minted client-side when the definition does not carry one** —
168
+ * `POST /functions` requires `id` and never generates one, exactly as the
169
+ * workflow route does. `key` is NOT minted: it is the name the Function is
170
+ * called by, so it is the caller's to choose, and the server validates it on
171
+ * first save only (3–39 chars, lowercase, single hyphens, no `_`). That
172
+ * grammar is what keeps `/functions/{idOrKey}/invoke` unambiguous — a key
173
+ * containing `_` could be mistaken for an `fn_…` id.
174
+ *
175
+ * `create` and {@linkcode update} reach the SAME upsert route; posting a
176
+ * definition whose id already exists overwrites it.
177
+ *
178
+ * @param definition - The whole Function definition, forwarded verbatim apart from a minted `id`.
179
+ * @returns The new Function's id and key.
180
+ * @throws {ApiError} `400 invalid_function` — no `key`, no `inputs` array, or a malformed `impl`.
181
+ * @throws {ApiError} `409 function_conflict` — another `(tenant, subject)` already owns that id.
182
+ * @throws {ApiError} `409 function_key_conflict` — that `key` is already taken in this scope.
183
+ */
184
+ create(definition: FunctionDefinition): Promise<{
185
+ id: string;
186
+ key: string;
187
+ }>;
188
+ /**
189
+ * Overwrite a Function's stored definition.
190
+ *
191
+ * **A full replacement, not a patch** — the server has one write route and it
192
+ * stores what it is given, so read with {@linkcode get}, change what you mean
193
+ * to change, and send the whole thing back. There is no concurrency
194
+ * precondition on this route (workflows have one; Functions do not), so the
195
+ * write is last-write-wins.
196
+ *
197
+ * `id` comes from the FIRST ARGUMENT and is pinned into the body, overriding
198
+ * any `id` the definition carries — otherwise `update("fn_a", defOfB)` would
199
+ * quietly write to B.
200
+ *
201
+ * Do not send back the `valid` field: it is not part of the stored document,
202
+ * and {@linkcode get} deliberately leaves it outside the definition so that
203
+ * a read-modify-write round trip cannot pick it up by accident.
204
+ *
205
+ * @param id - The `fn_…` id to write to.
206
+ * @param definition - The whole replacement definition.
207
+ * @returns The Function's id and key.
208
+ * @throws {ApiError} `400 invalid_function` — structurally invalid body.
209
+ * @throws {ApiError} `409 function_conflict` — another `(tenant, subject)` owns this id.
210
+ * @throws {ApiError} `409 function_key_conflict` — the new `key` is already taken in this scope.
211
+ */
212
+ update(id: string, definition: FunctionDefinition): Promise<{
213
+ id: string;
214
+ key: string;
215
+ }>;
216
+ /**
217
+ * Delete a Function.
218
+ *
219
+ * Not idempotent, and deliberately so: deleting an id that is not there is
220
+ * `404 unknown_function`, not a silent success — the same pin
221
+ * `documents.delete` carries.
222
+ *
223
+ * **Nothing checks for callers first.** A Function may be referenced by an
224
+ * Endpoint, by a Workflow step, or by another Function's `impl` (D-8), and
225
+ * the server does not walk those references; they break at call time. Deleting
226
+ * a Function that something else calls is the caller's decision to get right.
227
+ *
228
+ * Returns nothing: the server's `{ok: true}` carries no information a caller
229
+ * can use (`docs/implementation.md` §5).
230
+ *
231
+ * @param id - The `fn_…` id, or the Function's `key`.
232
+ * @throws {ApiError} `404 unknown_function` when there is no such Function for this caller.
233
+ */
234
+ delete(id: string): Promise<void>;
235
+ }
236
+ //# sourceMappingURL=functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,KAAK,WAAW,EAAE,KAA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