@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":"step-tests.js","sourceRoot":"","sources":["../../../src/console/step-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"step-tests.js","sourceRoot":"","sources":["../../../src/console/step-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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zC,CAAC;CACF"}
|
|
@@ -26,16 +26,13 @@
|
|
|
26
26
|
* `console.apps`'s/`console.functions`' identical treatment of their own
|
|
27
27
|
* zero-caller methods.
|
|
28
28
|
*
|
|
29
|
-
* **`webhookUrl` is
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* config value genuinely distinct from studio's own
|
|
33
|
-
* (`internal-triggers.ts:123-127`, `config.ts:27,259`).
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* independently) — this is a deliberate, verified omission, not an
|
|
37
|
-
* oversight: whatever extra field the server sends is silently ignored,
|
|
38
|
-
* exactly as today.
|
|
29
|
+
* **`webhookUrl` is modeled.** For a subscription whose `appId ===
|
|
30
|
+
* "@w6w/webhook"`, the server enriches the response with a `webhookUrl`
|
|
31
|
+
* field — produced by `withUrl` in `server/packages/api/admin/triggers.ts:74`
|
|
32
|
+
* — computed from a config value genuinely distinct from studio's own
|
|
33
|
+
* `apiBaseUrl()` (`internal-triggers.ts:123-127`, `config.ts:27,259`).
|
|
34
|
+
* Present only for `appId === "@w6w/webhook"`; absent for every other
|
|
35
|
+
* subscription.
|
|
39
36
|
*
|
|
40
37
|
* Subscriptions are account-level, never scoped by `project` — so
|
|
41
38
|
* `SubscriptionsHost` needs only the transport, mirroring `VarsHost`/
|
|
@@ -54,11 +51,18 @@ export interface SubscriptionsHost {
|
|
|
54
51
|
/** Perform one request. */
|
|
55
52
|
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
56
53
|
}
|
|
54
|
+
/** How a trigger's events arrive: pushed to a webhook, or fetched by a poll. */
|
|
55
|
+
export type TriggerType = "webhook" | "poll";
|
|
56
|
+
/**
|
|
57
|
+
* Where a subscription is in its registration lifecycle. Only `registered`
|
|
58
|
+
* subscriptions receive events.
|
|
59
|
+
*/
|
|
60
|
+
export type SubscriptionStatus = "pending" | "registered" | "failed" | "destroying";
|
|
57
61
|
/**
|
|
58
62
|
* A (trigger → workflow) binding. Field-for-field per
|
|
59
63
|
* `packages/studio/src/api/types.ts:72-83` — this module does not redesign
|
|
60
|
-
* the shape, only gives it a second home.
|
|
61
|
-
*
|
|
64
|
+
* the shape, only gives it a second home. Also carries `webhookUrl` — see
|
|
65
|
+
* this module's header.
|
|
62
66
|
*/
|
|
63
67
|
export interface Subscription {
|
|
64
68
|
id: string;
|
|
@@ -71,6 +75,25 @@ export interface Subscription {
|
|
|
71
75
|
enabled: boolean;
|
|
72
76
|
createdAt: string;
|
|
73
77
|
updatedAt: string;
|
|
78
|
+
/** How events arrive. */
|
|
79
|
+
type: TriggerType;
|
|
80
|
+
/** Registration lifecycle state. */
|
|
81
|
+
status: SubscriptionStatus;
|
|
82
|
+
/** Poll interval in ms; `null` for a webhook subscription. */
|
|
83
|
+
intervalMs: number | null;
|
|
84
|
+
/** Principal ids (workflow, connection, …) this subscription depends on. */
|
|
85
|
+
dependencies: string[];
|
|
86
|
+
/** When the next poll is due; `null` when not a poll or not yet scheduled. */
|
|
87
|
+
nextCheckAt: string | null;
|
|
88
|
+
/** The last registration failure, if any; `null` otherwise. */
|
|
89
|
+
lastError: {
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
|
+
} | null;
|
|
93
|
+
/** When registration last succeeded; `null` if it never has. */
|
|
94
|
+
registeredAt: string | null;
|
|
95
|
+
/** Present only for `appId === "@w6w/webhook"` — the server's own computed receive URL. */
|
|
96
|
+
webhookUrl?: string;
|
|
74
97
|
}
|
|
75
98
|
/**
|
|
76
99
|
* The body of `create`, forwarded verbatim as the whole POST body.
|
|
@@ -80,9 +103,11 @@ export interface SubscriptionCreateInput {
|
|
|
80
103
|
workflowId: string;
|
|
81
104
|
connectionId?: string | null;
|
|
82
105
|
params?: Record<string, unknown>;
|
|
106
|
+
/** Poll interval in ms (integer). Poll triggers only — the server defaults it to its floor. */
|
|
107
|
+
intervalMs?: number;
|
|
83
108
|
}
|
|
84
109
|
/** The lifecycle a delivered trigger event can be in. */
|
|
85
|
-
export type TriggerEventStatus = "received" | "dispatching" | "dispatched" | "failed";
|
|
110
|
+
export type TriggerEventStatus = "received" | "dispatching" | "dispatched" | "failed" | "ignored";
|
|
86
111
|
/**
|
|
87
112
|
* Metadata-only view of a delivered trigger event. Field-for-field per
|
|
88
113
|
* `packages/studio/src/api/types.ts:85-96`.
|
|
@@ -124,9 +149,6 @@ export declare class SubscriptionsApi {
|
|
|
124
149
|
/**
|
|
125
150
|
* List the subscriptions bound to one workflow.
|
|
126
151
|
*
|
|
127
|
-
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
128
|
-
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
129
|
-
*
|
|
130
152
|
* @param workflowId - The `wf_…` id.
|
|
131
153
|
* @returns The subscriptions, unwrapped from the `subscriptions` envelope.
|
|
132
154
|
* @throws {ApiError} On any non-2xx.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/console/subscriptions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/console/subscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAG1E;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,gFAAgF;AAChF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEpF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B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MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAgB;;IAG3B;;OAEG;gBACS,IAAI,EAAE,iBAAiB;IAInC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAQrC;;;;;;OAMG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAQlE;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAQ5C;;;;;;;;OAQG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,YAAY,CAAC;IASxB;;;;;;;;;;OAUG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvC;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAQ5D;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMnD"}
|
|
@@ -26,16 +26,13 @@
|
|
|
26
26
|
* `console.apps`'s/`console.functions`' identical treatment of their own
|
|
27
27
|
* zero-caller methods.
|
|
28
28
|
*
|
|
29
|
-
* **`webhookUrl` is
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* config value genuinely distinct from studio's own
|
|
33
|
-
* (`internal-triggers.ts:123-127`, `config.ts:27,259`).
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* independently) — this is a deliberate, verified omission, not an
|
|
37
|
-
* oversight: whatever extra field the server sends is silently ignored,
|
|
38
|
-
* exactly as today.
|
|
29
|
+
* **`webhookUrl` is modeled.** For a subscription whose `appId ===
|
|
30
|
+
* "@w6w/webhook"`, the server enriches the response with a `webhookUrl`
|
|
31
|
+
* field — produced by `withUrl` in `server/packages/api/admin/triggers.ts:74`
|
|
32
|
+
* — computed from a config value genuinely distinct from studio's own
|
|
33
|
+
* `apiBaseUrl()` (`internal-triggers.ts:123-127`, `config.ts:27,259`).
|
|
34
|
+
* Present only for `appId === "@w6w/webhook"`; absent for every other
|
|
35
|
+
* subscription.
|
|
39
36
|
*
|
|
40
37
|
* Subscriptions are account-level, never scoped by `project` — so
|
|
41
38
|
* `SubscriptionsHost` needs only the transport, mirroring `VarsHost`/
|
|
@@ -81,9 +78,6 @@ export class SubscriptionsApi {
|
|
|
81
78
|
/**
|
|
82
79
|
* List the subscriptions bound to one workflow.
|
|
83
80
|
*
|
|
84
|
-
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
85
|
-
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
86
|
-
*
|
|
87
81
|
* @param workflowId - The `wf_…` id.
|
|
88
82
|
* @returns The subscriptions, unwrapped from the `subscriptions` envelope.
|
|
89
83
|
* @throws {ApiError} On any non-2xx.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/console/subscriptions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/console/subscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,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AAE,KAAK;SACZ,CAAC,CAAC;QACH,OAAO,MAAM,CAAe,GAAG,EAAE,cAAc,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAChC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAA,kBAAkB,EAAE,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAC5C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAA,kBAAkB,EAAE,SAAS;SACxC,CAAC,CAAC;QACH,OAAO,MAAM,CAAwB,GAAG,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,YAAY,CAAC,OAAe;QAChC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAA,mBAAmB,OAAO,UAAU;SAC/C,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.tenantLoginFlags.*` — a tenant administrator's own
|
|
3
|
+
* password/OTP sign-in toggles (T2.1.3).
|
|
4
|
+
*
|
|
5
|
+
* **Studio-internal, not the published partner contract.** This namespace
|
|
6
|
+
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
7
|
+
* `endpoints.json` and from the root barrel (`mod.ts`) — see `docs/console.md`.
|
|
8
|
+
* `@w6w/sdk`'s instance-state mechanism pin still applies here exactly as it
|
|
9
|
+
* does to every other namespace (`docs/implementation.md` §MECHANISM PIN —
|
|
10
|
+
* instance state, never globals): this class holds no state of its own beyond
|
|
11
|
+
* the injected host, so two clients in one process never share a credential.
|
|
12
|
+
*
|
|
13
|
+
* **The tenant is never a parameter here** — mirrors `console.tenantOAuthApps`
|
|
14
|
+
* exactly: both routes are scoped by the caller's own credential (the tenant
|
|
15
|
+
* claim on the bearer) plus a server-side `requireTenantAdmin` check
|
|
16
|
+
* (T2.1.1's wire pin), never by an id this client sends.
|
|
17
|
+
*
|
|
18
|
+
* **`put`'s body is built by OMISSION, key by key — absence means "leave
|
|
19
|
+
* whatever is stored alone".** T2.1.1's wire pin states it directly: "absent
|
|
20
|
+
* means preserve, `null` is refused." Unlike
|
|
21
|
+
* `console.tenantOAuthApps.SetTenantOAuthAppInput`, neither field here ever
|
|
22
|
+
* accepts `null` — both are plain optional booleans — so {@linkcode toSetBody}
|
|
23
|
+
* is the simpler of the two omission builders, but the discipline (never
|
|
24
|
+
* `JSON.stringify`'s own `undefined`-dropping behaviour, an explicit
|
|
25
|
+
* allowlist of exactly two keys) is the same one for the same reason: a
|
|
26
|
+
* caller-widened input type must not be able to smuggle a third key onto the
|
|
27
|
+
* wire from here.
|
|
28
|
+
*
|
|
29
|
+
* **The one refusal this domain can produce, `409 no_fallback_login`, is not
|
|
30
|
+
* caught here.** Disabling password with OTP off (or vice versa) would leave
|
|
31
|
+
* the tenant with no way in at all; the server refuses it and this method
|
|
32
|
+
* propagates the `ApiError` unchanged, exactly like every other write in this
|
|
33
|
+
* package — the caller (`packages/studio/src/pages/TenantSettingsPage.tsx`)
|
|
34
|
+
* is what turns the code into a sentence.
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import { type HttpResponse, type RequestOptions } from "../http.ts";
|
|
39
|
+
/**
|
|
40
|
+
* The slice of `W6WClient` this namespace needs: the transport, and nothing
|
|
41
|
+
* else. Structural rather than a concrete client type, so the namespace stays
|
|
42
|
+
* independently constructible in a test and this module never imports the
|
|
43
|
+
* client back — mirrors `TenantOAuthAppsHost` in `./tenant-oauth-apps.ts`.
|
|
44
|
+
*/
|
|
45
|
+
export interface TenantLoginFlagsHost {
|
|
46
|
+
/** Perform one request. */
|
|
47
|
+
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
48
|
+
}
|
|
49
|
+
/** The tenant's current sign-in configuration — `GET`/`PUT /tenant/login-flags` (T2.1.1's wire pin). */
|
|
50
|
+
export interface TenantLoginFlags {
|
|
51
|
+
/** Whether email one-time-code sign-in is turned on for this tenant. */
|
|
52
|
+
otpEnabled: boolean;
|
|
53
|
+
/** Whether password sign-in is turned OFF for this tenant. */
|
|
54
|
+
passwordDisabled: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The body `put` sends — built by OMISSION, key by key. Both fields are
|
|
58
|
+
* optional; an omitted field is left untouched server-side. See this
|
|
59
|
+
* module's header for why neither ever carries `null` (unlike
|
|
60
|
+
* `console.tenantOAuthApps.SetTenantOAuthAppInput`).
|
|
61
|
+
*/
|
|
62
|
+
export interface SetTenantLoginFlagsInput {
|
|
63
|
+
otpEnabled?: boolean;
|
|
64
|
+
passwordDisabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The `console.tenantLoginFlags` namespace on a `W6WClient` — the caller's
|
|
68
|
+
* own tenant, never a tenant of its choosing.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const flags = await client.console.tenantLoginFlags.get();
|
|
73
|
+
* await client.console.tenantLoginFlags.put({ otpEnabled: true });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class TenantLoginFlagsApi {
|
|
77
|
+
#private;
|
|
78
|
+
/**
|
|
79
|
+
* @param host - The client this namespace issues requests through.
|
|
80
|
+
*/
|
|
81
|
+
constructor(host: TenantLoginFlagsHost);
|
|
82
|
+
/**
|
|
83
|
+
* The caller's tenant's current sign-in flags.
|
|
84
|
+
*
|
|
85
|
+
* AUTHENTICATED, `requireTenantAdmin` — the default `requireAuth` applies.
|
|
86
|
+
*
|
|
87
|
+
* @returns `{ otpEnabled, passwordDisabled }`.
|
|
88
|
+
* @throws {ApiError} `403` when the caller does not administer its tenant.
|
|
89
|
+
*/
|
|
90
|
+
get(): Promise<TenantLoginFlags>;
|
|
91
|
+
/**
|
|
92
|
+
* Update the caller's tenant's sign-in flags, sending **only the fields
|
|
93
|
+
* `input` sets**.
|
|
94
|
+
*
|
|
95
|
+
* AUTHENTICATED, `requireTenantAdmin` — the default `requireAuth` applies.
|
|
96
|
+
*
|
|
97
|
+
* @param input - The flags to set; an omitted field is left untouched server-side.
|
|
98
|
+
* @returns The stored flags after the update.
|
|
99
|
+
* @throws {ApiError} `403` when the caller does not administer its tenant;
|
|
100
|
+
* `400 invalid_body` for a non-boolean present value; `409
|
|
101
|
+
* no_fallback_login` when the change would leave the tenant with no way
|
|
102
|
+
* in — NOT caught here, propagated unchanged (see this module's header).
|
|
103
|
+
*/
|
|
104
|
+
put(input: SetTenantLoginFlagsInput): Promise<TenantLoginFlags>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=tenant-login-flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-login-flags.d.ts","sourceRoot":"","sources":["../../../src/console/tenant-login-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,wGAAwG;AACxG,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAoBD;;;;;;;;;GASG;AACH,qBAAa,mBAAmB;;IAG9B;;OAEG;gBACS,IAAI,EAAE,oBAAoB;IAItC;;;;;;;OAOG;IACG,GAAG,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAQtC;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAQtE"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.tenantLoginFlags.*` — a tenant administrator's own
|
|
3
|
+
* password/OTP sign-in toggles (T2.1.3).
|
|
4
|
+
*
|
|
5
|
+
* **Studio-internal, not the published partner contract.** This namespace
|
|
6
|
+
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
7
|
+
* `endpoints.json` and from the root barrel (`mod.ts`) — see `docs/console.md`.
|
|
8
|
+
* `@w6w/sdk`'s instance-state mechanism pin still applies here exactly as it
|
|
9
|
+
* does to every other namespace (`docs/implementation.md` §MECHANISM PIN —
|
|
10
|
+
* instance state, never globals): this class holds no state of its own beyond
|
|
11
|
+
* the injected host, so two clients in one process never share a credential.
|
|
12
|
+
*
|
|
13
|
+
* **The tenant is never a parameter here** — mirrors `console.tenantOAuthApps`
|
|
14
|
+
* exactly: both routes are scoped by the caller's own credential (the tenant
|
|
15
|
+
* claim on the bearer) plus a server-side `requireTenantAdmin` check
|
|
16
|
+
* (T2.1.1's wire pin), never by an id this client sends.
|
|
17
|
+
*
|
|
18
|
+
* **`put`'s body is built by OMISSION, key by key — absence means "leave
|
|
19
|
+
* whatever is stored alone".** T2.1.1's wire pin states it directly: "absent
|
|
20
|
+
* means preserve, `null` is refused." Unlike
|
|
21
|
+
* `console.tenantOAuthApps.SetTenantOAuthAppInput`, neither field here ever
|
|
22
|
+
* accepts `null` — both are plain optional booleans — so {@linkcode toSetBody}
|
|
23
|
+
* is the simpler of the two omission builders, but the discipline (never
|
|
24
|
+
* `JSON.stringify`'s own `undefined`-dropping behaviour, an explicit
|
|
25
|
+
* allowlist of exactly two keys) is the same one for the same reason: a
|
|
26
|
+
* caller-widened input type must not be able to smuggle a third key onto the
|
|
27
|
+
* wire from here.
|
|
28
|
+
*
|
|
29
|
+
* **The one refusal this domain can produce, `409 no_fallback_login`, is not
|
|
30
|
+
* caught here.** Disabling password with OTP off (or vice versa) would leave
|
|
31
|
+
* the tenant with no way in at all; the server refuses it and this method
|
|
32
|
+
* propagates the `ApiError` unchanged, exactly like every other write in this
|
|
33
|
+
* package — the caller (`packages/studio/src/pages/TenantSettingsPage.tsx`)
|
|
34
|
+
* is what turns the code into a sentence.
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import {} from "../http.js";
|
|
39
|
+
/**
|
|
40
|
+
* Serialise {@linkcode SetTenantLoginFlagsInput} for the wire: **only the
|
|
41
|
+
* keys actually present.** Written as explicit `!== undefined` tests rather
|
|
42
|
+
* than a spread, mirroring `./tenant-oauth-apps.ts`'s `toSetBody` — it keeps
|
|
43
|
+
* `undefined` off the wire without relying on `JSON.stringify` to drop it,
|
|
44
|
+
* and it is an allowlist: a caller that widens the input type cannot get a
|
|
45
|
+
* third key onto the wire from here.
|
|
46
|
+
*
|
|
47
|
+
* @param input - The caller's partial update.
|
|
48
|
+
* @returns A body carrying exactly the keys `input` set.
|
|
49
|
+
*/
|
|
50
|
+
function toSetBody(input) {
|
|
51
|
+
const body = {};
|
|
52
|
+
if (input.otpEnabled !== undefined)
|
|
53
|
+
body.otpEnabled = input.otpEnabled;
|
|
54
|
+
if (input.passwordDisabled !== undefined)
|
|
55
|
+
body.passwordDisabled = input.passwordDisabled;
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The `console.tenantLoginFlags` namespace on a `W6WClient` — the caller's
|
|
60
|
+
* own tenant, never a tenant of its choosing.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const flags = await client.console.tenantLoginFlags.get();
|
|
65
|
+
* await client.console.tenantLoginFlags.put({ otpEnabled: true });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export class TenantLoginFlagsApi {
|
|
69
|
+
#host;
|
|
70
|
+
/**
|
|
71
|
+
* @param host - The client this namespace issues requests through.
|
|
72
|
+
*/
|
|
73
|
+
constructor(host) {
|
|
74
|
+
this.#host = host;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The caller's tenant's current sign-in flags.
|
|
78
|
+
*
|
|
79
|
+
* AUTHENTICATED, `requireTenantAdmin` — the default `requireAuth` applies.
|
|
80
|
+
*
|
|
81
|
+
* @returns `{ otpEnabled, passwordDisabled }`.
|
|
82
|
+
* @throws {ApiError} `403` when the caller does not administer its tenant.
|
|
83
|
+
*/
|
|
84
|
+
async get() {
|
|
85
|
+
const res = await this.#host.request({
|
|
86
|
+
method: "GET",
|
|
87
|
+
path: "/tenant/login-flags",
|
|
88
|
+
});
|
|
89
|
+
return res.body.flags;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Update the caller's tenant's sign-in flags, sending **only the fields
|
|
93
|
+
* `input` sets**.
|
|
94
|
+
*
|
|
95
|
+
* AUTHENTICATED, `requireTenantAdmin` — the default `requireAuth` applies.
|
|
96
|
+
*
|
|
97
|
+
* @param input - The flags to set; an omitted field is left untouched server-side.
|
|
98
|
+
* @returns The stored flags after the update.
|
|
99
|
+
* @throws {ApiError} `403` when the caller does not administer its tenant;
|
|
100
|
+
* `400 invalid_body` for a non-boolean present value; `409
|
|
101
|
+
* no_fallback_login` when the change would leave the tenant with no way
|
|
102
|
+
* in — NOT caught here, propagated unchanged (see this module's header).
|
|
103
|
+
*/
|
|
104
|
+
async put(input) {
|
|
105
|
+
const res = await this.#host.request({
|
|
106
|
+
method: "PUT",
|
|
107
|
+
path: "/tenant/login-flags",
|
|
108
|
+
body: toSetBody(input),
|
|
109
|
+
});
|
|
110
|
+
return res.body.flags;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=tenant-login-flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-login-flags.js","sourceRoot":"","sources":["../../../src/console/tenant-login-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAA0C,MAAM,YAAY,CAAC;AAgCpE;;;;;;;;;;GAUG;AACH,SAAS,SAAS,CAAC,KAA+B;IAChD,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACvE,IAAI,KAAK,CAAC,gBAAgB,KAAK,SAAS;QAAE,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACzF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,mBAAmB;IACrB,KAAK,CAAuB;IAErC;;OAEG;IACH,YAAY,IAA0B;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAA8B;YAChE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB;SAC5B,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,GAAG,CAAC,KAA+B;QACvC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAA8B;YAChE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC;SACvB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `client.console.tenantOAuthApps.*` — a tenant administrator's own OAuth
|
|
3
|
-
* client overrides (list, upsert, remove)
|
|
4
|
-
* to.
|
|
3
|
+
* client overrides (list, upsert, remove) and the candidate apps they can still
|
|
4
|
+
* configure (`listCandidates`), for the apps their tenant connects to.
|
|
5
5
|
*
|
|
6
6
|
* **Studio-internal, not the published partner contract.** This namespace
|
|
7
7
|
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* instance state, never globals): this class holds no state of its own beyond
|
|
12
12
|
* the injected host, so two clients in one process never share a credential.
|
|
13
13
|
*
|
|
14
|
-
* **The tenant is never a parameter here.** These
|
|
14
|
+
* **The tenant is never a parameter here.** These four routes are scoped by
|
|
15
15
|
* the caller's own credential (the tenant claim on the bearer) plus a
|
|
16
16
|
* server-side tenant-admin check — unlike the operator family
|
|
17
17
|
* (`GET/PUT/DELETE /tenants/:id/oauth-app…`, `api/admin/tenants.ts:307-309`),
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*
|
|
30
30
|
* **Response shapes are flat, no envelope key to peel with `unwrap()`** —
|
|
31
31
|
* mirroring `console/auth.ts:29-32` for this whole family. `list` returns the
|
|
32
|
-
* whole body deliberately,
|
|
33
|
-
*
|
|
32
|
+
* whole body deliberately, so the response is exactly what the server sent
|
|
33
|
+
* (each row carries the server-derived `callbackUrl`: the same URL for every app, never assembled client-side); `put` reaches one level in
|
|
34
34
|
* for `body.config`, which is the shape the server answers with (W4).
|
|
35
35
|
*
|
|
36
36
|
* **Wire shapes are planner pins, not reverse-engineered from a merged route.**
|
|
@@ -76,6 +76,11 @@ export interface TenantOAuthAppSummary {
|
|
|
76
76
|
* {@linkcode SetTenantOAuthAppInput} carries no `redirectUri` key.
|
|
77
77
|
*/
|
|
78
78
|
redirectUri: string | null;
|
|
79
|
+
/**
|
|
80
|
+
* This row's OAuth callback URL, derived SERVER-SIDE and specific to this
|
|
81
|
+
* app and auth method. Display it; never assemble it. Absent from an older server.
|
|
82
|
+
*/
|
|
83
|
+
callbackUrl?: string;
|
|
79
84
|
/** Provider-specific extras (scopes, audience, …). `{}` when none. */
|
|
80
85
|
extra: Record<string, unknown>;
|
|
81
86
|
/** Whether a client secret is stored. **Never the secret itself.** */
|
|
@@ -87,8 +92,6 @@ export interface TenantOAuthAppSummary {
|
|
|
87
92
|
export interface TenantOAuthAppsResponse {
|
|
88
93
|
/** Every override this tenant has, in the server's order. */
|
|
89
94
|
configs: TenantOAuthAppSummary[];
|
|
90
|
-
/** This host's OAuth callback, derived SERVER-SIDE. Display it; never assemble it. */
|
|
91
|
-
callbackUrl: string;
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
97
|
* The body `put` sends (W4) — **built by OMISSION, key by key.**
|
|
@@ -111,7 +114,7 @@ export interface TenantOAuthAppsResponse {
|
|
|
111
114
|
* the user did not touch, never send `""`.
|
|
112
115
|
*
|
|
113
116
|
* **No `redirectUri` and no `force`.** Neither exists on this surface — the
|
|
114
|
-
* callback URL is derived server-side (
|
|
117
|
+
* callback URL is derived server-side (each row's `callbackUrl`) and the operator's
|
|
115
118
|
* `?force` affordance is not offered to a tenant admin (W4). A field the SDK
|
|
116
119
|
* declares is a field a form will fill, so neither is declared, and
|
|
117
120
|
* {@linkcode toSetBody} additionally refuses to forward either at runtime.
|
|
@@ -130,14 +133,55 @@ export interface SetTenantOAuthAppInput {
|
|
|
130
133
|
/** Whether to switch the override off. */
|
|
131
134
|
disabled?: boolean;
|
|
132
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* One app a tenant administrator may register an OAuth client for — the picker
|
|
138
|
+
* subset `GET /tenant/oauth-apps/candidates` answers with. Flat; carries no
|
|
139
|
+
* OAuth configuration and no secret.
|
|
140
|
+
*/
|
|
141
|
+
export interface TenantOAuthCandidate {
|
|
142
|
+
id: string;
|
|
143
|
+
displayName: string;
|
|
144
|
+
version: string;
|
|
145
|
+
description: string;
|
|
146
|
+
categories?: string[];
|
|
147
|
+
/** Omitted by the server when larger than 8192 UTF-8 bytes. */
|
|
148
|
+
iconSvg?: string;
|
|
149
|
+
/** Omitted by the server when larger than 8192 UTF-8 bytes. */
|
|
150
|
+
iconSvgDark?: string;
|
|
151
|
+
brandColor?: string;
|
|
152
|
+
brandColorDark?: string;
|
|
153
|
+
owner: {
|
|
154
|
+
tenant: string;
|
|
155
|
+
subject: string;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** One page of candidates. `nextCursor` is ABSENT (not `null`) on the last page. */
|
|
159
|
+
export interface TenantOAuthCandidatesPage {
|
|
160
|
+
apps: TenantOAuthCandidate[];
|
|
161
|
+
nextCursor?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Options for {@linkcode TenantOAuthAppsApi.listCandidates}. Each member is
|
|
165
|
+
* sent under its own wire name; an omitted member is absent from the request.
|
|
166
|
+
*/
|
|
167
|
+
export interface ListTenantOAuthCandidatesOptions {
|
|
168
|
+
/** Case-insensitive substring filter; the server trims it and rejects more than 200 characters. */
|
|
169
|
+
q?: string;
|
|
170
|
+
/** Page size, 1..200; the server defaults to 50. */
|
|
171
|
+
limit?: number;
|
|
172
|
+
/** Opaque cursor from a previous page's `nextCursor`. */
|
|
173
|
+
cursor?: string;
|
|
174
|
+
/** Aborts the request; an abort rejects with `ApiError` `code: "cancelled"`. */
|
|
175
|
+
signal?: AbortSignal;
|
|
176
|
+
}
|
|
133
177
|
/**
|
|
134
178
|
* The `console.tenantOAuthApps` namespace on a `W6WClient` — the caller's own
|
|
135
179
|
* tenant, never a tenant of its choosing.
|
|
136
180
|
*
|
|
137
181
|
* @example
|
|
138
182
|
* ```ts
|
|
139
|
-
* const { configs
|
|
140
|
-
* // Register `callbackUrl` with the provider — never assemble it client-side.
|
|
183
|
+
* const { configs } = await client.console.tenantOAuthApps.list();
|
|
184
|
+
* // Register each row's `callbackUrl` with the provider — never assemble it client-side.
|
|
141
185
|
* await client.console.tenantOAuthApps.put("sendgrid", "oauth2", { clientId: "abc" });
|
|
142
186
|
* await client.console.tenantOAuthApps.remove("sendgrid", "oauth2");
|
|
143
187
|
* ```
|
|
@@ -149,15 +193,32 @@ export declare class TenantOAuthAppsApi {
|
|
|
149
193
|
*/
|
|
150
194
|
constructor(host: TenantOAuthAppsHost);
|
|
151
195
|
/**
|
|
152
|
-
* List the caller's tenant's OAuth overrides
|
|
196
|
+
* List the caller's tenant's OAuth overrides; each row carries its own
|
|
197
|
+
* server-derived `callbackUrl`.
|
|
153
198
|
*
|
|
154
|
-
* Returns the body VERBATIM rather than unwrapping `configs
|
|
155
|
-
*
|
|
199
|
+
* Returns the body VERBATIM rather than unwrapping `configs`, so the
|
|
200
|
+
* response stays exactly what the server sent.
|
|
156
201
|
*
|
|
157
|
-
* @returns Every override for this tenant
|
|
202
|
+
* @returns Every override for this tenant.
|
|
158
203
|
* @throws {ApiError} `403` when the caller does not administer its tenant.
|
|
159
204
|
*/
|
|
160
205
|
list(): Promise<TenantOAuthAppsResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Page through the apps this tenant could still register an OAuth client
|
|
208
|
+
* for (`GET /tenant/oauth-apps/candidates`).
|
|
209
|
+
*
|
|
210
|
+
* Returns the body VERBATIM. Every app eligible for the whole walk, with an
|
|
211
|
+
* unchanged display name, appears exactly once; an app whose eligibility or
|
|
212
|
+
* display name changes mid-walk may be missed or repeated, so restart with
|
|
213
|
+
* no cursor after a registration or removal.
|
|
214
|
+
*
|
|
215
|
+
* @param options - Optional `q`, `limit`, `cursor` and `signal`.
|
|
216
|
+
* @returns One page: `{apps, nextCursor}`; `nextCursor` is absent on the last page.
|
|
217
|
+
* @throws {ApiError} `400 invalid_query`/`invalid_cursor` on a bad parameter;
|
|
218
|
+
* `403` when the caller does not administer its tenant; `code: "cancelled"`
|
|
219
|
+
* when `options.signal` was aborted.
|
|
220
|
+
*/
|
|
221
|
+
listCandidates(options?: ListTenantOAuthCandidatesOptions): Promise<TenantOAuthCandidatesPage>;
|
|
161
222
|
/**
|
|
162
223
|
* Create or update one override, sending **only the fields `input` sets**.
|
|
163
224
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-oauth-apps.d.ts","sourceRoot":"","sources":["../../../src/console/tenant-oauth-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,sEAAsE;IACtE,eAAe,EAAE,OAAO,CAAC;IACzB,oFAAoF;IACpF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,6DAA6D;IAC7D,OAAO,EAA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WG;IACG,GAAG,CACP,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IASjC;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `client.console.tenantOAuthApps.*` — a tenant administrator's own OAuth
|
|
3
|
-
* client overrides (list, upsert, remove)
|
|
4
|
-
* to.
|
|
3
|
+
* client overrides (list, upsert, remove) and the candidate apps they can still
|
|
4
|
+
* configure (`listCandidates`), for the apps their tenant connects to.
|
|
5
5
|
*
|
|
6
6
|
* **Studio-internal, not the published partner contract.** This namespace
|
|
7
7
|
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* instance state, never globals): this class holds no state of its own beyond
|
|
12
12
|
* the injected host, so two clients in one process never share a credential.
|
|
13
13
|
*
|
|
14
|
-
* **The tenant is never a parameter here.** These
|
|
14
|
+
* **The tenant is never a parameter here.** These four routes are scoped by
|
|
15
15
|
* the caller's own credential (the tenant claim on the bearer) plus a
|
|
16
16
|
* server-side tenant-admin check — unlike the operator family
|
|
17
17
|
* (`GET/PUT/DELETE /tenants/:id/oauth-app…`, `api/admin/tenants.ts:307-309`),
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*
|
|
30
30
|
* **Response shapes are flat, no envelope key to peel with `unwrap()`** —
|
|
31
31
|
* mirroring `console/auth.ts:29-32` for this whole family. `list` returns the
|
|
32
|
-
* whole body deliberately,
|
|
33
|
-
*
|
|
32
|
+
* whole body deliberately, so the response is exactly what the server sent
|
|
33
|
+
* (each row carries the server-derived `callbackUrl`: the same URL for every app, never assembled client-side); `put` reaches one level in
|
|
34
34
|
* for `body.config`, which is the shape the server answers with (W4).
|
|
35
35
|
*
|
|
36
36
|
* **Wire shapes are planner pins, not reverse-engineered from a merged route.**
|
|
@@ -80,8 +80,8 @@ function toSetBody(input) {
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```ts
|
|
83
|
-
* const { configs
|
|
84
|
-
* // Register `callbackUrl` with the provider — never assemble it client-side.
|
|
83
|
+
* const { configs } = await client.console.tenantOAuthApps.list();
|
|
84
|
+
* // Register each row's `callbackUrl` with the provider — never assemble it client-side.
|
|
85
85
|
* await client.console.tenantOAuthApps.put("sendgrid", "oauth2", { clientId: "abc" });
|
|
86
86
|
* await client.console.tenantOAuthApps.remove("sendgrid", "oauth2");
|
|
87
87
|
* ```
|
|
@@ -95,12 +95,13 @@ export class TenantOAuthAppsApi {
|
|
|
95
95
|
this.#host = host;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* List the caller's tenant's OAuth overrides
|
|
98
|
+
* List the caller's tenant's OAuth overrides; each row carries its own
|
|
99
|
+
* server-derived `callbackUrl`.
|
|
99
100
|
*
|
|
100
|
-
* Returns the body VERBATIM rather than unwrapping `configs
|
|
101
|
-
*
|
|
101
|
+
* Returns the body VERBATIM rather than unwrapping `configs`, so the
|
|
102
|
+
* response stays exactly what the server sent.
|
|
102
103
|
*
|
|
103
|
-
* @returns Every override for this tenant
|
|
104
|
+
* @returns Every override for this tenant.
|
|
104
105
|
* @throws {ApiError} `403` when the caller does not administer its tenant.
|
|
105
106
|
*/
|
|
106
107
|
async list() {
|
|
@@ -110,6 +111,31 @@ export class TenantOAuthAppsApi {
|
|
|
110
111
|
});
|
|
111
112
|
return res.body;
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Page through the apps this tenant could still register an OAuth client
|
|
116
|
+
* for (`GET /tenant/oauth-apps/candidates`).
|
|
117
|
+
*
|
|
118
|
+
* Returns the body VERBATIM. Every app eligible for the whole walk, with an
|
|
119
|
+
* unchanged display name, appears exactly once; an app whose eligibility or
|
|
120
|
+
* display name changes mid-walk may be missed or repeated, so restart with
|
|
121
|
+
* no cursor after a registration or removal.
|
|
122
|
+
*
|
|
123
|
+
* @param options - Optional `q`, `limit`, `cursor` and `signal`.
|
|
124
|
+
* @returns One page: `{apps, nextCursor}`; `nextCursor` is absent on the last page.
|
|
125
|
+
* @throws {ApiError} `400 invalid_query`/`invalid_cursor` on a bad parameter;
|
|
126
|
+
* `403` when the caller does not administer its tenant; `code: "cancelled"`
|
|
127
|
+
* when `options.signal` was aborted.
|
|
128
|
+
*/
|
|
129
|
+
async listCandidates(options = {}) {
|
|
130
|
+
const { signal, q, limit, cursor } = options;
|
|
131
|
+
const res = await this.#host.request({
|
|
132
|
+
method: "GET",
|
|
133
|
+
path: "/tenant/oauth-apps/candidates",
|
|
134
|
+
query: { q, limit, cursor },
|
|
135
|
+
signal,
|
|
136
|
+
});
|
|
137
|
+
return res.body;
|
|
138
|
+
}
|
|
113
139
|
/**
|
|
114
140
|
* Create or update one override, sending **only the fields `input` sets**.
|
|
115
141
|
*
|