@w6w/sdk 0.6.0 → 0.9.9
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 +166 -16
- package/dist/mod.d.ts +7 -5
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +1 -0
- package/dist/mod.js.map +1 -1
- package/dist/src/client.d.ts +11 -2
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +12 -2
- 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 +40 -4
- 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/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 +43 -3
- package/dist/src/console/auth.d.ts.map +1 -1
- package/dist/src/console/auth.js +23 -4
- 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 +57 -2
- 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 +22 -7
- package/dist/src/console/mod.d.ts.map +1 -1
- package/dist/src/console/mod.js +16 -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/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/functions.d.ts +149 -1
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +145 -0
- package/dist/src/functions.js.map +1 -1
- 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 +11 -2
- package/dist/src/run.d.ts.map +1 -1
- package/dist/src/run.js +11 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-oauth-apps.js","sourceRoot":"","sources":["../../../src/console/tenant-oauth-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"tenant-oauth-apps.js","sourceRoot":"","sources":["../../../src/console/tenant-oauth-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+BAA+B;YACrC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE;YAC3B,MAAM;SACP,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,GAAG,CACP,KAAa,EACb,OAAe,EACf,KAA6B;QAE7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoC;YACtE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAA,qBAAqB,KAAK,IAAI,OAAO,EAAE;YACjD,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC;SACvB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAAe;QACzC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAChC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAA,qBAAqB,KAAK,IAAI,OAAO,EAAE;SAClD,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -72,6 +72,8 @@ export interface ApiToken {
|
|
|
72
72
|
updatedAt: string;
|
|
73
73
|
/** ISO-8601 timestamp of revocation, or `null` while active/disabled. */
|
|
74
74
|
revokedAt: string | null;
|
|
75
|
+
/** ISO-8601 timestamp of the token's last authenticated use, or `null` while unused. Optional: absent on a server build that predates this field. */
|
|
76
|
+
lastUsedAt?: string | null;
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
79
|
* `create`'s result — the token's metadata plus its plaintext secret, shown
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/console/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,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;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAA,WAAW,EAAE,SAAS;YAChC,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,OAAO,MAAM,CAAW,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAA,WAAW,EAAE,SAAS;YAChC,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,OAAO,MAAM,CAAW,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -25,6 +25,19 @@
|
|
|
25
25
|
* documented partner story exists yet either) — that promotion, if it ever
|
|
26
26
|
* happens, is a dedicated future project.
|
|
27
27
|
*
|
|
28
|
+
* **That promotion has since happened, and this namespace deliberately stayed.**
|
|
29
|
+
* At contract `0.5.0` the definition lifecycle left `outOfScope` and landed on
|
|
30
|
+
* the BASE namespace in all three lanes — `client.workflows.get`/`create`/
|
|
31
|
+
* `update`/`archive`/`delete` (`../workflows.ts`). The two surfaces now overlap
|
|
32
|
+
* on four routes, and the split is by SHAPE, not by capability: the base methods
|
|
33
|
+
* take a definition and answer the wire's own envelope, while these keep the
|
|
34
|
+
* shapes studio's components are already written against (`upsert`'s single
|
|
35
|
+
* definition-plus-precondition argument, `get`'s three-field body). New callers
|
|
36
|
+
* — and every partner — want `client.workflows.*`. What is still ONLY here is
|
|
37
|
+
* the run history: `listRuns` and `getRun` stay console-only, and
|
|
38
|
+
* `endpoints.json` names `workflows.listRuns` in `outOfScope` so that stays
|
|
39
|
+
* deliberate rather than accidental.
|
|
40
|
+
*
|
|
28
41
|
* **`list` and `run` are NOT part of this domain.** Both already exist on the
|
|
29
42
|
* BASE namespace (`client.workflows.list()`/`client.workflows.run()`,
|
|
30
43
|
* `../workflows.ts`) and studio reuses them verbatim — adding a duplicate
|
|
@@ -184,6 +197,7 @@ export declare class WorkflowsApi {
|
|
|
184
197
|
workflow: {
|
|
185
198
|
id: string;
|
|
186
199
|
name: string;
|
|
200
|
+
key: string | null;
|
|
187
201
|
};
|
|
188
202
|
scheduled: boolean;
|
|
189
203
|
updatedAt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/console/workflows.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/console/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAU,MAAM,aAAa,CAAC;AAKrE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,QAAQ;IACvB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,6DAA6D;IAC7D,KAAK,EAAE,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IACG,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAQzE;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;;;;;OAMG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAQjD;;;;;;;;;;OAUG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAO/C"}
|
|
@@ -25,6 +25,19 @@
|
|
|
25
25
|
* documented partner story exists yet either) — that promotion, if it ever
|
|
26
26
|
* happens, is a dedicated future project.
|
|
27
27
|
*
|
|
28
|
+
* **That promotion has since happened, and this namespace deliberately stayed.**
|
|
29
|
+
* At contract `0.5.0` the definition lifecycle left `outOfScope` and landed on
|
|
30
|
+
* the BASE namespace in all three lanes — `client.workflows.get`/`create`/
|
|
31
|
+
* `update`/`archive`/`delete` (`../workflows.ts`). The two surfaces now overlap
|
|
32
|
+
* on four routes, and the split is by SHAPE, not by capability: the base methods
|
|
33
|
+
* take a definition and answer the wire's own envelope, while these keep the
|
|
34
|
+
* shapes studio's components are already written against (`upsert`'s single
|
|
35
|
+
* definition-plus-precondition argument, `get`'s three-field body). New callers
|
|
36
|
+
* — and every partner — want `client.workflows.*`. What is still ONLY here is
|
|
37
|
+
* the run history: `listRuns` and `getRun` stay console-only, and
|
|
38
|
+
* `endpoints.json` names `workflows.listRuns` in `outOfScope` so that stays
|
|
39
|
+
* deliberate rather than accidental.
|
|
40
|
+
*
|
|
28
41
|
* **`list` and `run` are NOT part of this domain.** Both already exist on the
|
|
29
42
|
* BASE namespace (`client.workflows.list()`/`client.workflows.run()`,
|
|
30
43
|
* `../workflows.ts`) and studio reuses them verbatim — adding a duplicate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/console/workflows.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/console/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAkC,MAAM,EAAE,MAAM,aAAa,CAAC;AAErE,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAoExD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,YAAY;IACd,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,GAAG,CACP,EAAU;QAEV,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAElC;YACA,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAA,cAAc,EAAE,EAAE;SAC7B,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,MAAM,CACV,UAAmB,EACnB,OAAiE;QAQjE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAMlC;YACA,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;YACpC,IAAI,EAAE,UAAU;YAChB,GAAG,CAAC,OAAO,EAAE,iBAAiB;gBAC5B,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAA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
|
*/
|
|
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;
|
|
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,WAAW,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3F,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;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;A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E"}
|
package/dist/src/documents.js
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAuC,IAAI,EAAuB,MAAM,WAAW,CAAC;AAC3F,OAAO,EAA4B,MAAM,EAAE,MAAM,YAAY,CAAC;AAgE9D;;;;;;;;;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;YAC1C,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QACH,OAAO,MAAM,CAAQ,GAAG,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;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ACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAM,GAAG,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAyB;QACtE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,IAAI,CAAA,cAAc,EAAE,EAAE;YAC5B,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC1C,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAM,GAAG,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAyB;QAChD,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAChC,MAAM,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"}
|
package/dist/src/functions.d.ts
CHANGED
|
@@ -20,13 +20,25 @@
|
|
|
20
20
|
* The name is the FIRST argument, matching `workflows.run(id, opts?)` — the
|
|
21
21
|
* namespace already shaped this way — so all three runnable kinds read alike.
|
|
22
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
|
+
*
|
|
23
34
|
* ID OR KEY, one argument. The server's `/functions/{idOrKey}/invoke` accepts
|
|
24
35
|
* either, because the two shapes cannot collide: an id carries a kind prefix and
|
|
25
36
|
* therefore an underscore, and a key is kebab-case, which forbids one. So this
|
|
26
37
|
* takes no flag and no prefix to say which you meant — pass whichever you have.
|
|
27
38
|
*/
|
|
28
39
|
import type { ResolvedConfig } from "./config.ts";
|
|
29
|
-
import { type HttpResponse, type RequestOptions } from "./http.ts";
|
|
40
|
+
import { type CallOptions, type HttpResponse, type RequestOptions } from "./http.ts";
|
|
41
|
+
import { type FunctionSummary } from "./types.ts";
|
|
30
42
|
/**
|
|
31
43
|
* What this namespace needs from the client — the same narrow seam
|
|
32
44
|
* `WorkflowsApi` takes, so it is constructible in a test and this module never
|
|
@@ -52,6 +64,33 @@ export interface FunctionRunOptions {
|
|
|
52
64
|
*/
|
|
53
65
|
payload?: Record<string, unknown>;
|
|
54
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
|
+
}
|
|
55
94
|
/**
|
|
56
95
|
* The `functions` namespace on a `W6WClient`.
|
|
57
96
|
*
|
|
@@ -60,6 +99,11 @@ export interface FunctionRunOptions {
|
|
|
60
99
|
* const output = await client.functions.run("send-email", {
|
|
61
100
|
* payload: { to: "ada@example.com", subject: "Hi", html: "<p>Hello</p>" },
|
|
62
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" });
|
|
63
107
|
* ```
|
|
64
108
|
*/
|
|
65
109
|
export declare class FunctionsApi {
|
|
@@ -84,5 +128,109 @@ export declare class FunctionsApi {
|
|
|
84
128
|
* @throws {ApiError} `bad_response` when a success body carries no `output` key at all.
|
|
85
129
|
*/
|
|
86
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>;
|
|
87
235
|
}
|
|
88
236
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAAA
|
|
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,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,WAAW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AG,EAAE,MAAM,CAAA;KAAE,CAAC;IAOlF;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvC;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBxC"}
|
package/dist/src/functions.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiError } from "./errors.js";
|
|
2
2
|
import { path } from "./http.js";
|
|
3
|
+
import { mintId, unwrap } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* The `functions` namespace on a `W6WClient`.
|
|
5
6
|
*
|
|
@@ -8,6 +9,11 @@ import { path } from "./http.js";
|
|
|
8
9
|
* const output = await client.functions.run("send-email", {
|
|
9
10
|
* payload: { to: "ada@example.com", subject: "Hi", html: "<p>Hello</p>" },
|
|
10
11
|
* });
|
|
12
|
+
*
|
|
13
|
+
* // The definition lifecycle.
|
|
14
|
+
* const fns = await client.functions.list();
|
|
15
|
+
* const { function: def } = await client.functions.get(fns[0].id);
|
|
16
|
+
* await client.functions.update(fns[0].id, { ...def, description: "Send an email" });
|
|
11
17
|
* ```
|
|
12
18
|
*/
|
|
13
19
|
export class FunctionsApi {
|
|
@@ -52,5 +58,144 @@ export class FunctionsApi {
|
|
|
52
58
|
}
|
|
53
59
|
return body.output;
|
|
54
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* List the caller's Function definitions.
|
|
63
|
+
*
|
|
64
|
+
* This is how a caller discovers a `key` to pass to {@linkcode run} — the
|
|
65
|
+
* same job `workflows.list` and `connections.list` do for their own ids (D4),
|
|
66
|
+
* and the reason a read-only integration needs no other write access.
|
|
67
|
+
*
|
|
68
|
+
* Each row already carries `valid`, computed server-side; there is no second
|
|
69
|
+
* call to make to find out whether a Function is runnable.
|
|
70
|
+
*
|
|
71
|
+
* **No `project` parameter.** Unlike workflows and documents, the route reads
|
|
72
|
+
* no `?project=` at all (`admin/functions.ts`) — sending one would be
|
|
73
|
+
* inventing a parameter, which is the failure mode `endpoints.json` warns
|
|
74
|
+
* about.
|
|
75
|
+
*
|
|
76
|
+
* @param options - Optional per-call transport options (`signal` to abort).
|
|
77
|
+
* @returns The Functions, unwrapped from the `functions` envelope.
|
|
78
|
+
* @throws {ApiError} On any non-2xx.
|
|
79
|
+
*/
|
|
80
|
+
async list(options) {
|
|
81
|
+
const res = await this.#host.request({
|
|
82
|
+
method: "GET",
|
|
83
|
+
path: "/functions",
|
|
84
|
+
signal: options?.signal,
|
|
85
|
+
});
|
|
86
|
+
return unwrap(res, "functions");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fetch one Function's stored definition.
|
|
90
|
+
*
|
|
91
|
+
* Returns the whole body — `{function, valid}` — rather than splicing `valid`
|
|
92
|
+
* into the definition. See {@linkcode FunctionDetail.valid} for why that
|
|
93
|
+
* placement matters on the way back OUT of this method.
|
|
94
|
+
*
|
|
95
|
+
* @param id - The `fn_…` id, or the Function's `key`. Percent-encoded into the path.
|
|
96
|
+
* @param options - Optional per-call transport options (`signal` to abort).
|
|
97
|
+
* @returns The definition and the server's runnability verdict.
|
|
98
|
+
* @throws {ApiError} `404 unknown_function` when there is no such Function for this caller.
|
|
99
|
+
*/
|
|
100
|
+
async get(id, options) {
|
|
101
|
+
const res = await this.#host.request({
|
|
102
|
+
method: "GET",
|
|
103
|
+
path: path `/functions/${id}`,
|
|
104
|
+
signal: options?.signal,
|
|
105
|
+
});
|
|
106
|
+
return res.body;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create a Function.
|
|
110
|
+
*
|
|
111
|
+
* **The id is minted client-side when the definition does not carry one** —
|
|
112
|
+
* `POST /functions` requires `id` and never generates one, exactly as the
|
|
113
|
+
* workflow route does. `key` is NOT minted: it is the name the Function is
|
|
114
|
+
* called by, so it is the caller's to choose, and the server validates it on
|
|
115
|
+
* first save only (3–39 chars, lowercase, single hyphens, no `_`). That
|
|
116
|
+
* grammar is what keeps `/functions/{idOrKey}/invoke` unambiguous — a key
|
|
117
|
+
* containing `_` could be mistaken for an `fn_…` id.
|
|
118
|
+
*
|
|
119
|
+
* `create` and {@linkcode update} reach the SAME upsert route; posting a
|
|
120
|
+
* definition whose id already exists overwrites it.
|
|
121
|
+
*
|
|
122
|
+
* @param definition - The whole Function definition, forwarded verbatim apart from a minted `id`.
|
|
123
|
+
* @returns The new Function's id and key.
|
|
124
|
+
* @throws {ApiError} `400 invalid_function` — no `key`, no `inputs` array, or a malformed `impl`.
|
|
125
|
+
* @throws {ApiError} `409 function_conflict` — another `(tenant, subject)` already owns that id.
|
|
126
|
+
* @throws {ApiError} `409 function_key_conflict` — that `key` is already taken in this scope.
|
|
127
|
+
*/
|
|
128
|
+
async create(definition) {
|
|
129
|
+
const body = typeof definition.id === "string" && definition.id.length > 0
|
|
130
|
+
? definition
|
|
131
|
+
: { ...definition, id: mintId("fn") };
|
|
132
|
+
return await this.#save(body);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Overwrite a Function's stored definition.
|
|
136
|
+
*
|
|
137
|
+
* **A full replacement, not a patch** — the server has one write route and it
|
|
138
|
+
* stores what it is given, so read with {@linkcode get}, change what you mean
|
|
139
|
+
* to change, and send the whole thing back. There is no concurrency
|
|
140
|
+
* precondition on this route (workflows have one; Functions do not), so the
|
|
141
|
+
* write is last-write-wins.
|
|
142
|
+
*
|
|
143
|
+
* `id` comes from the FIRST ARGUMENT and is pinned into the body, overriding
|
|
144
|
+
* any `id` the definition carries — otherwise `update("fn_a", defOfB)` would
|
|
145
|
+
* quietly write to B.
|
|
146
|
+
*
|
|
147
|
+
* Do not send back the `valid` field: it is not part of the stored document,
|
|
148
|
+
* and {@linkcode get} deliberately leaves it outside the definition so that
|
|
149
|
+
* a read-modify-write round trip cannot pick it up by accident.
|
|
150
|
+
*
|
|
151
|
+
* @param id - The `fn_…` id to write to.
|
|
152
|
+
* @param definition - The whole replacement definition.
|
|
153
|
+
* @returns The Function's id and key.
|
|
154
|
+
* @throws {ApiError} `400 invalid_function` — structurally invalid body.
|
|
155
|
+
* @throws {ApiError} `409 function_conflict` — another `(tenant, subject)` owns this id.
|
|
156
|
+
* @throws {ApiError} `409 function_key_conflict` — the new `key` is already taken in this scope.
|
|
157
|
+
*/
|
|
158
|
+
async update(id, definition) {
|
|
159
|
+
return await this.#save({ ...definition, id });
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Delete a Function.
|
|
163
|
+
*
|
|
164
|
+
* Not idempotent, and deliberately so: deleting an id that is not there is
|
|
165
|
+
* `404 unknown_function`, not a silent success — the same pin
|
|
166
|
+
* `documents.delete` carries.
|
|
167
|
+
*
|
|
168
|
+
* **Nothing checks for callers first.** A Function may be referenced by an
|
|
169
|
+
* Endpoint, by a Workflow step, or by another Function's `impl` (D-8), and
|
|
170
|
+
* the server does not walk those references; they break at call time. Deleting
|
|
171
|
+
* a Function that something else calls is the caller's decision to get right.
|
|
172
|
+
*
|
|
173
|
+
* Returns nothing: the server's `{ok: true}` carries no information a caller
|
|
174
|
+
* can use (`docs/implementation.md` §5).
|
|
175
|
+
*
|
|
176
|
+
* @param id - The `fn_…` id, or the Function's `key`.
|
|
177
|
+
* @throws {ApiError} `404 unknown_function` when there is no such Function for this caller.
|
|
178
|
+
*/
|
|
179
|
+
async delete(id) {
|
|
180
|
+
await this.#host.request({ method: "DELETE", path: path `/functions/${id}` });
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The one POST both {@linkcode create} and {@linkcode update} go through.
|
|
184
|
+
*
|
|
185
|
+
* Private and shared rather than duplicated: the route answers `201` with the
|
|
186
|
+
* id and key under a `function` envelope, and two copies of that unwrap is
|
|
187
|
+
* two places for a server change to be half-applied.
|
|
188
|
+
*
|
|
189
|
+
* @param body - The complete definition, id already resolved.
|
|
190
|
+
* @returns The saved Function's id and key.
|
|
191
|
+
*/
|
|
192
|
+
async #save(body) {
|
|
193
|
+
const res = await this.#host.request({
|
|
194
|
+
method: "POST",
|
|
195
|
+
path: "/functions",
|
|
196
|
+
body,
|
|
197
|
+
});
|
|
198
|
+
return unwrap(res, "function");
|
|
199
|
+
}
|
|
55
200
|
}
|
|
56
201
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAuC,IAAI,EAAuB,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAwB,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA0DlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAY;IACd,KAAK,CAAgB;IAE9B;;OAEG;IACH,YAAY,IAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;;OAcG;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,MAAM,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE;SACzC,CAAC,CAAC;QAEH,yEAAyE;QACzE,4EAA4E;QAC5E,uEAAuE;QACvE,0EAA0E;QAC1E,yEAAyE;QACzE,0EAA0E;QAC1E,gBAAgB;QAChB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAA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