@w6w/sdk 0.3.0 → 0.5.0
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 +5 -5
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +2 -2
- package/dist/src/client.d.ts +34 -6
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +34 -5
- package/dist/src/client.js.map +1 -1
- package/dist/src/config.d.ts +2 -2
- package/dist/src/config.js +2 -2
- package/dist/src/connections.d.ts +2 -2
- package/dist/src/connections.js +1 -1
- package/dist/src/console/api-calls.d.ts +80 -0
- package/dist/src/console/api-calls.d.ts.map +1 -0
- package/dist/src/console/api-calls.js +69 -0
- package/dist/src/console/api-calls.js.map +1 -0
- package/dist/src/console/apps.d.ts +689 -0
- package/dist/src/console/apps.d.ts.map +1 -0
- package/dist/src/console/apps.js +402 -0
- package/dist/src/console/apps.js.map +1 -0
- package/dist/src/console/auth.d.ts +241 -0
- package/dist/src/console/auth.d.ts.map +1 -0
- package/dist/src/console/auth.js +173 -0
- package/dist/src/console/auth.js.map +1 -0
- package/dist/src/console/connections.d.ts +188 -0
- package/dist/src/console/connections.d.ts.map +1 -0
- package/dist/src/console/connections.js +182 -0
- package/dist/src/console/connections.js.map +1 -0
- package/dist/src/console/dashboard.d.ts +102 -0
- package/dist/src/console/dashboard.d.ts.map +1 -0
- package/dist/src/console/dashboard.js +59 -0
- package/dist/src/console/dashboard.js.map +1 -0
- package/dist/src/console/endpoints.d.ts +264 -0
- package/dist/src/console/endpoints.d.ts.map +1 -0
- package/dist/src/console/endpoints.js +164 -0
- package/dist/src/console/endpoints.js.map +1 -0
- package/dist/src/console/functions.d.ts +165 -0
- package/dist/src/console/functions.d.ts.map +1 -0
- package/dist/src/console/functions.js +117 -0
- package/dist/src/console/functions.js.map +1 -0
- package/dist/src/console/mod.d.ts +131 -0
- package/dist/src/console/mod.d.ts.map +1 -0
- package/dist/src/console/mod.js +121 -0
- package/dist/src/console/mod.js.map +1 -0
- package/dist/src/console/projects.d.ts +107 -0
- package/dist/src/console/projects.d.ts.map +1 -0
- package/dist/src/console/projects.js +97 -0
- package/dist/src/console/projects.js.map +1 -0
- package/dist/src/console/reliability.d.ts +149 -0
- package/dist/src/console/reliability.d.ts.map +1 -0
- package/dist/src/console/reliability.js +56 -0
- package/dist/src/console/reliability.js.map +1 -0
- package/dist/src/console/saved-tests.d.ts +198 -0
- package/dist/src/console/saved-tests.d.ts.map +1 -0
- package/dist/src/console/saved-tests.js +172 -0
- package/dist/src/console/saved-tests.js.map +1 -0
- package/dist/src/console/schedules.d.ts +127 -0
- package/dist/src/console/schedules.d.ts.map +1 -0
- package/dist/src/console/schedules.js +118 -0
- package/dist/src/console/schedules.js.map +1 -0
- package/dist/src/console/step-tests.d.ts +159 -0
- package/dist/src/console/step-tests.d.ts.map +1 -0
- package/dist/src/console/step-tests.js +129 -0
- package/dist/src/console/step-tests.js.map +1 -0
- package/dist/src/console/subscriptions.d.ts +199 -0
- package/dist/src/console/subscriptions.d.ts.map +1 -0
- package/dist/src/console/subscriptions.js +191 -0
- package/dist/src/console/subscriptions.js.map +1 -0
- package/dist/src/console/tenant-oauth-apps.d.ts +188 -0
- package/dist/src/console/tenant-oauth-apps.d.ts.map +1 -0
- package/dist/src/console/tenant-oauth-apps.js +152 -0
- package/dist/src/console/tenant-oauth-apps.js.map +1 -0
- package/dist/src/console/tokens.d.ts +159 -0
- package/dist/src/console/tokens.d.ts.map +1 -0
- package/dist/src/console/tokens.js +145 -0
- package/dist/src/console/tokens.js.map +1 -0
- package/dist/src/console/vault.d.ts +188 -0
- package/dist/src/console/vault.d.ts.map +1 -0
- package/dist/src/console/vault.js +164 -0
- package/dist/src/console/vault.js.map +1 -0
- package/dist/src/console/workflows.d.ts +243 -0
- package/dist/src/console/workflows.d.ts.map +1 -0
- package/dist/src/console/workflows.js +205 -0
- package/dist/src/console/workflows.js.map +1 -0
- package/dist/src/documents.d.ts +2 -2
- package/dist/src/documents.js +1 -1
- package/dist/src/http.d.ts +32 -2
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +11 -2
- package/dist/src/http.js.map +1 -1
- package/dist/src/me.d.ts +2 -2
- package/dist/src/me.js +1 -1
- package/dist/src/run.d.ts +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/vars.d.ts +2 -2
- package/dist/src/vars.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/workflows.d.ts +2 -2
- package/dist/src/workflows.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/console/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAQ,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAG1E;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/B;AAED,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,MA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OASG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GACjD,OAAO,CAAC,cAAc,CAAC;IAa1B;;;;;;;;;;OAUG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAStF;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IAa3E;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAO1D"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.apps.*` — the app catalog (install, inspect, invoke,
|
|
3
|
+
* per-installation OAuth config), relocated from the studio's own API
|
|
4
|
+
* client.
|
|
5
|
+
*
|
|
6
|
+
* **Studio-internal, not the published partner contract.** This namespace
|
|
7
|
+
* lives under the `console` subpath export (`@w6w/sdk/console`), excluded from
|
|
8
|
+
* `endpoints.json` and from the root barrel (`mod.ts`) — see `docs/console.md`
|
|
9
|
+
* and HITL-1 in this task's contract. `@w6w/sdk`'s instance-state mechanism
|
|
10
|
+
* pin still applies here exactly as it does to every other namespace
|
|
11
|
+
* (`docs/implementation.md` §MECHANISM PIN — instance state, never globals):
|
|
12
|
+
* this class holds no state of its own beyond the injected host, so two
|
|
13
|
+
* clients in one process never share a credential.
|
|
14
|
+
*
|
|
15
|
+
* **The largest single domain in this project** — 16 methods, relocated from
|
|
16
|
+
* `packages/studio/src/api/client.ts`'s single `// Apps` comment block
|
|
17
|
+
* (`client.ts:235-393` on the studio base tree). Method names below are
|
|
18
|
+
* SHORTENED (dropping the `App`/`Apps` prefix `client.ts`'s flat method names
|
|
19
|
+
* carry) to match `console.projects`'s/`console.schedules`'s own short-verb
|
|
20
|
+
* convention — a naming-only change: every wire call (method/path/body/query)
|
|
21
|
+
* is unchanged.
|
|
22
|
+
*
|
|
23
|
+
* **`listApiCalls` is deliberately NOT modeled here** — it lives under the
|
|
24
|
+
* same `client.ts` comment block but has no named apps-domain consumer (its
|
|
25
|
+
* only caller is reliability's drill-down page); it groups with a future
|
|
26
|
+
* `reliability`+`api-calls` sub-project instead. See this task's contract
|
|
27
|
+
* Requirement and `plan.md`'s FINDINGS DISPOSITION.
|
|
28
|
+
*
|
|
29
|
+
* **Two live server routes with zero client-side coverage ever are also
|
|
30
|
+
* excluded**: `DELETE /apps/:id/versions/:version` and
|
|
31
|
+
* `PATCH /apps/:id/lifecycle` — both `requireOperator`-gated, neither was ever
|
|
32
|
+
* wrapped in `client.ts` at all (not just zero callers). `requireOperator`
|
|
33
|
+
* otherwise has no bearing on this file: access control is unaffected by this
|
|
34
|
+
* relocation — every route reachable through `console.*` (this domain
|
|
35
|
+
* included) requires only an authenticated principal client-side, and the
|
|
36
|
+
* console/partner split is a naming and export-surface fence, not an
|
|
37
|
+
* authorization boundary. The methods below that DO happen to hit a
|
|
38
|
+
* `requireOperator` route server-side (`listOAuthConfig`,
|
|
39
|
+
* `upsertOAuthConfig`, `deleteOAuthConfig`, `preview`, `refresh`) still send
|
|
40
|
+
* the request the same way as every other method here; a non-operator caller
|
|
41
|
+
* simply gets a `403` back from the server like any other `ApiError`.
|
|
42
|
+
*
|
|
43
|
+
* **Four methods are HITL-4 dead code** — `getHealth`, `listOAuthConfig`,
|
|
44
|
+
* `upsertOAuthConfig`, `deleteOAuthConfig` have zero call sites anywhere in
|
|
45
|
+
* studio or `@w6w/ui`. They are still built to full type fidelity (real
|
|
46
|
+
* implementation, JSDoc, `@throws`) for SDK/wrapper coverage; only the test
|
|
47
|
+
* bar for them is deliberately lighter.
|
|
48
|
+
*
|
|
49
|
+
* **`delete`'s return value is a deliberate asymmetry** vs. `projects.delete`
|
|
50
|
+
* and `schedules.delete` in this same package: those two discard the server's
|
|
51
|
+
* uninformative `{ok: true}` and resolve `void`. This app-catalog delete does
|
|
52
|
+
* NOT — the server answers `{removed: number}`, a genuinely informative count
|
|
53
|
+
* (`apps-catalog.ts:646-651`), and this method preserves it instead of
|
|
54
|
+
* "fixing" it to match the other two.
|
|
55
|
+
*
|
|
56
|
+
* None of these 16 methods take a `project` scoping parameter — apps operate
|
|
57
|
+
* at the account/global level — so `AppsHost` needs only the transport,
|
|
58
|
+
* mirroring `VarsHost`/`ProjectsHost`, not `DocumentsHost`.
|
|
59
|
+
*
|
|
60
|
+
* @module
|
|
61
|
+
*/
|
|
62
|
+
import { path } from "../http.js";
|
|
63
|
+
import { unwrap } from "../types.js";
|
|
64
|
+
/**
|
|
65
|
+
* The `console.apps` namespace on a `W6WClient`.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const apps = await client.console.apps.list();
|
|
70
|
+
* const detail = await client.console.apps.get(apps[0].id);
|
|
71
|
+
* const result = await client.console.apps.invoke(detail.app.id as string, "send", { to: "a@b.com" });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export class AppsApi {
|
|
75
|
+
#host;
|
|
76
|
+
/**
|
|
77
|
+
* @param host - The client this namespace issues requests through.
|
|
78
|
+
*/
|
|
79
|
+
constructor(host) {
|
|
80
|
+
this.#host = host;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* List every registered app the caller can see.
|
|
84
|
+
*
|
|
85
|
+
* Every consumer treats this as the complete catalog with no "load more"
|
|
86
|
+
* UI, so this method fetches every page itself — a bare `GET /apps` only
|
|
87
|
+
* returns the server's default page and would silently hide anything past
|
|
88
|
+
* it. Capped at 20 pages (~4000 apps at the 200-per-page size) as a runaway
|
|
89
|
+
* backstop, not an expected limit; relocated verbatim from
|
|
90
|
+
* `client.ts:244-256`.
|
|
91
|
+
*
|
|
92
|
+
* @returns Every app summary across all pages, in the order the server sent them.
|
|
93
|
+
* @throws {ApiError} On any non-2xx.
|
|
94
|
+
*/
|
|
95
|
+
async list() {
|
|
96
|
+
const apps = [];
|
|
97
|
+
let cursor;
|
|
98
|
+
for (let page = 0; page < 20; page++) {
|
|
99
|
+
const res = await this.#host.request({
|
|
100
|
+
method: "GET",
|
|
101
|
+
path: "/apps",
|
|
102
|
+
query: { limit: 200, cursor },
|
|
103
|
+
});
|
|
104
|
+
apps.push(...res.body.apps);
|
|
105
|
+
if (!res.body.nextCursor)
|
|
106
|
+
break;
|
|
107
|
+
cursor = res.body.nextCursor;
|
|
108
|
+
}
|
|
109
|
+
return apps;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fetch one registered app's detail (latest manifest + actions + overlay).
|
|
113
|
+
*
|
|
114
|
+
* @param id - The app id.
|
|
115
|
+
* @returns The whole response body — no envelope key to peel.
|
|
116
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
117
|
+
*/
|
|
118
|
+
async get(id) {
|
|
119
|
+
const res = await this.#host.request({
|
|
120
|
+
method: "GET",
|
|
121
|
+
path: path `/apps/${id}`,
|
|
122
|
+
});
|
|
123
|
+
return res.body;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* List an app's auth methods, annotated with `available` and any
|
|
127
|
+
* `requiresHostConfig` fields.
|
|
128
|
+
*
|
|
129
|
+
* @param id - The app id.
|
|
130
|
+
* @returns The auth methods, unwrapped from the `auths` envelope.
|
|
131
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
132
|
+
*/
|
|
133
|
+
async getAuth(id) {
|
|
134
|
+
const res = await this.#host.request({
|
|
135
|
+
method: "GET",
|
|
136
|
+
path: path `/apps/${id}/auths`,
|
|
137
|
+
});
|
|
138
|
+
return unwrap(res, "auths");
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Fetch an app's declared actions.
|
|
142
|
+
*
|
|
143
|
+
* Sourced from the app detail's `actions` array — a separate call from
|
|
144
|
+
* {@linkcode get}, relocated verbatim from `client.ts:268-271` rather than
|
|
145
|
+
* refactored to call `get` internally.
|
|
146
|
+
*
|
|
147
|
+
* @param id - The app id.
|
|
148
|
+
* @returns The declared actions; `[]` when the app declares none.
|
|
149
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
150
|
+
*/
|
|
151
|
+
async getActions(id) {
|
|
152
|
+
const res = await this.#host.request({
|
|
153
|
+
method: "GET",
|
|
154
|
+
path: path `/apps/${id}`,
|
|
155
|
+
});
|
|
156
|
+
return res.body.actions ?? [];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* List an app's declared triggers.
|
|
160
|
+
*
|
|
161
|
+
* @param id - The app id.
|
|
162
|
+
* @returns The declared triggers, unwrapped from the `triggers` envelope.
|
|
163
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
164
|
+
*/
|
|
165
|
+
async getTriggers(id) {
|
|
166
|
+
const res = await this.#host.request({
|
|
167
|
+
method: "GET",
|
|
168
|
+
path: path `/apps/${id}/triggers`,
|
|
169
|
+
});
|
|
170
|
+
return unwrap(res, "triggers");
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Fetch an app's declared health-check metadata.
|
|
174
|
+
*
|
|
175
|
+
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
176
|
+
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
177
|
+
* Sourced from the app detail's `health` array — a separate call from
|
|
178
|
+
* {@linkcode get}, relocated verbatim from `client.ts:278-281` rather than
|
|
179
|
+
* refactored to call `get` internally.
|
|
180
|
+
*
|
|
181
|
+
* @param id - The app id.
|
|
182
|
+
* @returns The declared health checks; `[]` when the app declares none.
|
|
183
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
184
|
+
*/
|
|
185
|
+
async getHealth(id) {
|
|
186
|
+
const res = await this.#host.request({
|
|
187
|
+
method: "GET",
|
|
188
|
+
path: path `/apps/${id}`,
|
|
189
|
+
});
|
|
190
|
+
return res.body.health ?? [];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Run an app's PUBLIC health checks and return the live verdict.
|
|
194
|
+
*
|
|
195
|
+
* @param id - The app id.
|
|
196
|
+
* @returns The whole response body — no envelope key to peel.
|
|
197
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
198
|
+
*/
|
|
199
|
+
async getHealthStatus(id) {
|
|
200
|
+
const res = await this.#host.request({
|
|
201
|
+
method: "GET",
|
|
202
|
+
path: path `/apps/${id}/health`,
|
|
203
|
+
});
|
|
204
|
+
return res.body;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* List every stored per-installation OAuth config summary for an app (no secrets).
|
|
208
|
+
*
|
|
209
|
+
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
210
|
+
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
211
|
+
*
|
|
212
|
+
* @param appId - The app id.
|
|
213
|
+
* @returns The configs, unwrapped from the `configs` envelope.
|
|
214
|
+
* @throws {ApiError} `404 unknown_app` when there is no such id.
|
|
215
|
+
*/
|
|
216
|
+
async listOAuthConfig(appId) {
|
|
217
|
+
const res = await this.#host.request({
|
|
218
|
+
method: "GET",
|
|
219
|
+
path: path `/apps/${appId}/oauth-config`,
|
|
220
|
+
});
|
|
221
|
+
return unwrap(res, "configs");
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Upsert the OAuth client credentials for one (app, auth method).
|
|
225
|
+
*
|
|
226
|
+
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
227
|
+
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
228
|
+
*
|
|
229
|
+
* @param appId - The app id.
|
|
230
|
+
* @param authKey - The oauth2 auth method's key, as declared by the app's manifest.
|
|
231
|
+
* @param body - The client credentials, forwarded verbatim.
|
|
232
|
+
* @returns The stored config summary (the server answers `201`).
|
|
233
|
+
* @throws {ApiError} `404 unknown_app`/`unknown_auth`; `400 invalid_auth_type`/`invalid_body`.
|
|
234
|
+
*/
|
|
235
|
+
async upsertOAuthConfig(appId, authKey, body) {
|
|
236
|
+
const res = await this.#host.request({
|
|
237
|
+
method: "PUT",
|
|
238
|
+
path: path `/apps/${appId}/oauth-config/${authKey}`,
|
|
239
|
+
body,
|
|
240
|
+
});
|
|
241
|
+
return unwrap(res, "config");
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Remove the stored OAuth client credentials for one (app, auth method).
|
|
245
|
+
*
|
|
246
|
+
* **Dead code (HITL-4)** — zero call sites anywhere in studio or
|
|
247
|
+
* `@w6w/ui`. Built for SDK completeness only; see this module's header.
|
|
248
|
+
* Returns nothing: the server's `{ok: true}` carries no information a
|
|
249
|
+
* caller can use, mirroring `documents.ts`'s/`projects.ts`'s established
|
|
250
|
+
* delete convention.
|
|
251
|
+
*
|
|
252
|
+
* @param appId - The app id.
|
|
253
|
+
* @param authKey - The oauth2 auth method's key.
|
|
254
|
+
* @throws {ApiError} `404 unknown_oauth_config` when there is no such config.
|
|
255
|
+
*/
|
|
256
|
+
async deleteOAuthConfig(appId, authKey) {
|
|
257
|
+
await this.#host.request({
|
|
258
|
+
method: "DELETE",
|
|
259
|
+
path: path `/apps/${appId}/oauth-config/${authKey}`,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Kick off an OAuth 2.0 flow: the server builds the provider's authorize
|
|
264
|
+
* URL for the caller to open.
|
|
265
|
+
*
|
|
266
|
+
* No studio-page caller, but this method's shape must exactly match
|
|
267
|
+
* `W6WApi.startAppOAuthFlow`'s signature on the `@w6w/ui` facade
|
|
268
|
+
* (`packages/ui/src/provider.tsx:110-114`), which calls it.
|
|
269
|
+
*
|
|
270
|
+
* @param appId - The app id.
|
|
271
|
+
* @param authKey - The oauth2 auth method's key, as declared by the app's manifest.
|
|
272
|
+
* @param body - Optional display name for the resulting connection; omitted fields are left to the server.
|
|
273
|
+
* @returns The whole response body — no envelope key to peel.
|
|
274
|
+
* @throws {ApiError} `404 unknown_app`/`unknown_auth`; `400 invalid_auth_type`; `409 oauth_not_configured`.
|
|
275
|
+
*/
|
|
276
|
+
async startOAuthFlow(appId, authKey, body = {}) {
|
|
277
|
+
const res = await this.#host.request({
|
|
278
|
+
method: "POST",
|
|
279
|
+
path: path `/apps/${appId}/oauth-config/${authKey}/authorize-url`,
|
|
280
|
+
body,
|
|
281
|
+
});
|
|
282
|
+
return res.body;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Peek what installing a source ref would touch, without persisting
|
|
286
|
+
* anything. Distinguishes a single-app ref from a pack ref, and (for a
|
|
287
|
+
* pack) previews each entry for a checkbox picker.
|
|
288
|
+
*
|
|
289
|
+
* @param source - A source ref (e.g. `github:org/repo`, `file:./local-app`).
|
|
290
|
+
* @param opts - `refresh: true` busts the sources cache — needed for a
|
|
291
|
+
* moving GitHub pointer (`@main`, `@HEAD`, or no `@ref`) whenever the
|
|
292
|
+
* remote has advanced since the last fetch.
|
|
293
|
+
* @returns The whole response body — a `kind`-discriminated union, no envelope key to peel.
|
|
294
|
+
* @throws {ApiError} `400 invalid_source` and whatever the source resolution itself raises.
|
|
295
|
+
*/
|
|
296
|
+
async preview(source, opts = {}) {
|
|
297
|
+
const res = await this.#host.request({
|
|
298
|
+
method: "POST",
|
|
299
|
+
path: "/apps/preview",
|
|
300
|
+
body: { source, ...(opts.refresh ? { refresh: true } : {}) },
|
|
301
|
+
});
|
|
302
|
+
return res.body;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Install a single app or a pack from a source ref.
|
|
306
|
+
*
|
|
307
|
+
* @param source - A source ref (e.g. `github:org/repo`, `file:./local-app`).
|
|
308
|
+
* @param opts - `paths` (pack refs only) limits which entries are
|
|
309
|
+
* installed — omitted, every entry is installed. `refresh: true` busts the
|
|
310
|
+
* sources cache (see {@linkcode preview}).
|
|
311
|
+
* @returns The whole response body — a `kind`-discriminated union, no envelope key to peel.
|
|
312
|
+
* @throws {ApiError} `400 invalid_source`; `403 user_import_disabled`/`local_import_forbidden` for a non-operator.
|
|
313
|
+
*/
|
|
314
|
+
async import(source, opts = {}) {
|
|
315
|
+
const res = await this.#host.request({
|
|
316
|
+
method: "POST",
|
|
317
|
+
path: "/apps/import",
|
|
318
|
+
body: {
|
|
319
|
+
source,
|
|
320
|
+
...(opts.paths ? { paths: opts.paths } : {}),
|
|
321
|
+
...(opts.refresh ? { refresh: true } : {}),
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
return res.body;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Re-resolve an already-registered app from its recorded source ref and
|
|
328
|
+
* re-register it (operator-only server-side — non-operators get a `403`).
|
|
329
|
+
*
|
|
330
|
+
* @param id - The app id.
|
|
331
|
+
* @param opts - `force: true` busts the sources cache ("Reload"); the
|
|
332
|
+
* server ignores unknown fields, so `force` is harmless until server-side
|
|
333
|
+
* handling for it lands.
|
|
334
|
+
* @returns The whole response body — no envelope key to peel.
|
|
335
|
+
* @throws {ApiError} `404 unknown_app`; `403` for a non-operator.
|
|
336
|
+
*/
|
|
337
|
+
async refresh(id, opts = {}) {
|
|
338
|
+
const res = await this.#host.request({
|
|
339
|
+
method: "POST",
|
|
340
|
+
path: path `/apps/${id}/refresh`,
|
|
341
|
+
body: opts.force ? { force: true } : {},
|
|
342
|
+
});
|
|
343
|
+
return res.body;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Invoke one of an app's actions.
|
|
347
|
+
*
|
|
348
|
+
* This method's shape must exactly match `W6WApi.invokeAction`'s signature on
|
|
349
|
+
* the `@w6w/ui` facade (`packages/ui/src/provider.tsx`). It now models the
|
|
350
|
+
* WHOLE of that `opts` — `project` and `state` included.
|
|
351
|
+
*
|
|
352
|
+
* **They are not decoration, and modelling only `connectionId` was a live
|
|
353
|
+
* bug.** `params` may contain unresolved `ExprValue` envelopes, which the
|
|
354
|
+
* server resolves against an ambient scope built from exactly these two
|
|
355
|
+
* fields (`invoke.ts` → `buildAmbientScope`): `state` seeds
|
|
356
|
+
* `steps.<id>.output` and `trigger.event`, `project` chooses which project's
|
|
357
|
+
* vars and documents are in scope. Dropped, every
|
|
358
|
+
* `{{ steps.<id>.output.<field> }}` in a step test resolves to the empty
|
|
359
|
+
* string and the action fails on a required param it was visibly given — the
|
|
360
|
+
* editor's own preview resolves locally and shows the right value, so the
|
|
361
|
+
* failure reads as an app bug rather than a lost field.
|
|
362
|
+
*
|
|
363
|
+
* @param appId - The app id.
|
|
364
|
+
* @param actionKey - The action's key, as declared by the app's manifest.
|
|
365
|
+
* @param params - The action's parameters, forwarded verbatim.
|
|
366
|
+
* @param opts - `connectionId` to run with (omitted, the server picks);
|
|
367
|
+
* `project` to scope vars/documents to; `state` to resolve upstream
|
|
368
|
+
* references against.
|
|
369
|
+
* @returns The whole response body — no envelope key to peel.
|
|
370
|
+
* @throws {ApiError} On any non-2xx, including an action's own failure (`424`).
|
|
371
|
+
*/
|
|
372
|
+
async invoke(appId, actionKey, params, opts = {}) {
|
|
373
|
+
const res = await this.#host.request({
|
|
374
|
+
method: "POST",
|
|
375
|
+
path: path `/apps/${appId}/actions/${actionKey}/invoke`,
|
|
376
|
+
body: { params, ...opts },
|
|
377
|
+
});
|
|
378
|
+
return res.body;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Unregister an app (all versions by default).
|
|
382
|
+
*
|
|
383
|
+
* **Returns the server's real value, unlike `projects.delete`/`schedules.delete`
|
|
384
|
+
* in this same package** — the server answers `{removed: number}`, a
|
|
385
|
+
* genuinely informative count (`apps-catalog.ts:646-651`), and this method
|
|
386
|
+
* preserves it rather than discarding it to `void`. This is the one
|
|
387
|
+
* deliberate asymmetry vs. this package's other two `delete` conventions;
|
|
388
|
+
* see this module's header.
|
|
389
|
+
*
|
|
390
|
+
* @param appId - The app id.
|
|
391
|
+
* @returns `{removed}` — how many versions were unregistered.
|
|
392
|
+
* @throws {ApiError} `404 unknown_app`; `403 forbidden` when a non-operator does not own the app.
|
|
393
|
+
*/
|
|
394
|
+
async delete(appId) {
|
|
395
|
+
const res = await this.#host.request({
|
|
396
|
+
method: "DELETE",
|
|
397
|
+
path: path `/apps/${appId}`,
|
|
398
|
+
});
|
|
399
|
+
return res.body;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/console/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,EAAqB,IAAI,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiYrC;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IACT,KAAK,CAAW;IAEzB;;OAEG;IACH,YAAY,IAAc;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,GAAiB,EAAE,CAAC;QAC9B,IAAI,MAA0B,CAAC;QAC/B,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KA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;;;;;OAaG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAsB;YACxD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAA,SAAS,KAAK,EAAE;SAC3B,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.console.auth.*` — self-serve login and signup, relocated from the
|
|
3
|
+
* studio's own API client.
|
|
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
|
+
* and HITL-1 in this task's contract. `@w6w/sdk`'s instance-state mechanism
|
|
9
|
+
* pin still applies here exactly as it does to every other namespace
|
|
10
|
+
* (`docs/implementation.md` §MECHANISM PIN — instance state, never globals):
|
|
11
|
+
* this class holds no state of its own beyond the injected host, so two
|
|
12
|
+
* clients in one process never share a credential.
|
|
13
|
+
*
|
|
14
|
+
* **The public/authenticated split is per-method, not per-file.** `login`,
|
|
15
|
+
* `signup` and `checkAccountSlug` are registered server-side ABOVE
|
|
16
|
+
* `app.use("*", authGuard)` (`packages/server/packages/api/data/signup.ts:23-41`
|
|
17
|
+
* and `id/auth.ts:22-55`) and must never read a principal — any bearer a
|
|
18
|
+
* caller sends is inert on these three routes, so each passes
|
|
19
|
+
* `requireAuth: false` and the transport never even attempts to attach one
|
|
20
|
+
* (`../http.ts`, HITL-9). `createAccount` is the authenticated counterpart
|
|
21
|
+
* (`id/signup.ts:33-78`) and uses the default, unconditional `requireAuth`.
|
|
22
|
+
* `login` is how a caller gets a token in the first place — without
|
|
23
|
+
* `requireAuth: false` it could never be called by a tokenless client, since
|
|
24
|
+
* `requireToken` would raise before the request ever reached `fetch`.
|
|
25
|
+
*
|
|
26
|
+
* **`getMe` IS modeled here now — that changed, and this is why.** This file
|
|
27
|
+
* previously said it was deliberately not modeled, because `client.me()`
|
|
28
|
+
* (`../me.ts`, base surface) covered `GET /auth/me` exactly. It no longer does.
|
|
29
|
+
* The route answers additively with a **studio-internal capability field**,
|
|
30
|
+
* `tenantAdmin` (`plan-B.md` § WIRE PINS W1/W9), and the published `Me`
|
|
31
|
+
* (`../types.ts:104-123`) deliberately does not carry it: `Me` is part of the
|
|
32
|
+
* published partner contract — `endpoints.json` names it as the `me`
|
|
33
|
+
* operation's `returns` — so declaring a field there would be a
|
|
34
|
+
* publish-in-lockstep change across every language wrapper (CLAUDE.md), for
|
|
35
|
+
* what is a studio-only authorization hint. The console surface is exactly the
|
|
36
|
+
* place a studio-only projection belongs, so the capability is typed on
|
|
37
|
+
* {@linkcode ConsoleMe} instead, and `client.me()` stays untouched and keeps
|
|
38
|
+
* returning the published shape. Both read the same route; they differ only in
|
|
39
|
+
* what they promise about the body.
|
|
40
|
+
*
|
|
41
|
+
* **Response shapes are flat, no envelope key**, mirroring
|
|
42
|
+
* `console/reliability.ts`'s own pattern (verified against the server route
|
|
43
|
+
* handlers, not assumed) — every method here returns `res.body` directly and
|
|
44
|
+
* never calls this package's `unwrap()` helper.
|
|
45
|
+
*
|
|
46
|
+
* @module
|
|
47
|
+
*/
|
|
48
|
+
import type { HttpResponse, RequestOptions } from "../http.ts";
|
|
49
|
+
/**
|
|
50
|
+
* The slice of `W6WClient` this namespace needs: the transport, and nothing
|
|
51
|
+
* else. Structural rather than a concrete client type, so the namespace stays
|
|
52
|
+
* independently constructible in a test and this module never imports the
|
|
53
|
+
* client back — mirrors `ReliabilityHost` in `./reliability.ts`.
|
|
54
|
+
*/
|
|
55
|
+
export interface AuthHost {
|
|
56
|
+
/** Perform one request. */
|
|
57
|
+
request<T>(options: RequestOptions): Promise<HttpResponse<T>>;
|
|
58
|
+
}
|
|
59
|
+
/** The authenticated user, as `POST /auth/login` returns it (`id/auth.ts:49-53`). */
|
|
60
|
+
export interface User {
|
|
61
|
+
username: string;
|
|
62
|
+
}
|
|
63
|
+
/** `POST /auth/login` → 200 (`id/auth.ts:49-53`). */
|
|
64
|
+
export interface LoginResponse {
|
|
65
|
+
token: string;
|
|
66
|
+
user: User;
|
|
67
|
+
expiresIn: number;
|
|
68
|
+
}
|
|
69
|
+
/** The signed-up user, as `POST /auth/signup` returns it (`data/signup.ts:147-152`). */
|
|
70
|
+
export interface SignupUser {
|
|
71
|
+
id: string;
|
|
72
|
+
email: string;
|
|
73
|
+
displayName: string;
|
|
74
|
+
/** Derived server-side from `email_verified_at`; signup never waits on it. */
|
|
75
|
+
emailVerified: boolean;
|
|
76
|
+
tenant: string;
|
|
77
|
+
}
|
|
78
|
+
/** An account, as the signup family returns it (`data/signup.ts` / `id/signup.ts`). */
|
|
79
|
+
export interface AccountWire {
|
|
80
|
+
id: string;
|
|
81
|
+
tenant: string;
|
|
82
|
+
name: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
status: string;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
|
+
}
|
|
88
|
+
/** The body `signup` sends. `inviteToken` is accepted server-side (`data/signup.ts:129-134`)
|
|
89
|
+
* even though the studio's own client never sends it — modeled here for a future caller. */
|
|
90
|
+
export interface SignupInput {
|
|
91
|
+
email: string;
|
|
92
|
+
password: string;
|
|
93
|
+
displayName?: string;
|
|
94
|
+
inviteToken?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `POST /auth/signup` → 201 (`data/signup.ts:147-152`). `account` is the
|
|
98
|
+
* invite's account, else `null` — a signup with no `inviteToken` always gets
|
|
99
|
+
* `null` here.
|
|
100
|
+
*/
|
|
101
|
+
export interface SignupResponse {
|
|
102
|
+
token: string;
|
|
103
|
+
expiresIn: number;
|
|
104
|
+
user: SignupUser;
|
|
105
|
+
account: AccountWire | null;
|
|
106
|
+
}
|
|
107
|
+
/** `GET /auth/signup/slug-available?name=` → 200 (`data/signup.ts:170`). */
|
|
108
|
+
export interface SlugAvailabilityResponse {
|
|
109
|
+
slug: string;
|
|
110
|
+
available: boolean;
|
|
111
|
+
suggestions: string[];
|
|
112
|
+
}
|
|
113
|
+
/** `POST /accounts` → 201 (`id/signup.ts:69-73`). The token re-issues the session
|
|
114
|
+
* with the new account's claim on it. */
|
|
115
|
+
export interface CreateAccountResponse {
|
|
116
|
+
account: AccountWire;
|
|
117
|
+
token: string;
|
|
118
|
+
expiresIn: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* `GET /auth/me` as the console reads it (W1/W9) — a **superset** of the
|
|
122
|
+
* published `Me` (`../types.ts:104-123`), carrying the studio-internal
|
|
123
|
+
* capability field that shape deliberately does not declare. See this module's
|
|
124
|
+
* header for why the field lives here and not there.
|
|
125
|
+
*
|
|
126
|
+
* The published contract already requires clients to tolerate unknown keys on
|
|
127
|
+
* this route, so widening it server-side broke no partner; this type simply
|
|
128
|
+
* names one of those keys for the one client that acts on it.
|
|
129
|
+
*/
|
|
130
|
+
export interface ConsoleMe {
|
|
131
|
+
/** Tenant the caller belongs to. */
|
|
132
|
+
tenant: string;
|
|
133
|
+
/** The authenticated subject (a user or a machine principal). */
|
|
134
|
+
subject: string;
|
|
135
|
+
/** Account the caller is acting in. */
|
|
136
|
+
account: string;
|
|
137
|
+
/** The caller's role within that account. */
|
|
138
|
+
role: string;
|
|
139
|
+
/** The base callable URLs are rendered against. Present on this host; do not derive URLs from it. */
|
|
140
|
+
invokeBaseUrl?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Server-decided: may this caller administer its tenant? Studio-internal;
|
|
143
|
+
* not on the published `Me`.
|
|
144
|
+
*
|
|
145
|
+
* **Required, not optional, on purpose.** A client forced to branch on
|
|
146
|
+
* `undefined` is a client that will branch wrong; an older server that omits
|
|
147
|
+
* the key yields `undefined` at runtime, which is falsy, so every
|
|
148
|
+
* `if (me.tenantAdmin)` fails CLOSED — the capability is denied, never
|
|
149
|
+
* accidentally granted.
|
|
150
|
+
*/
|
|
151
|
+
tenantAdmin: boolean;
|
|
152
|
+
/** Component versions, as the published `Me` documents them. Optional and open. */
|
|
153
|
+
versions?: Record<string, string>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The `console.auth` namespace on a `W6WClient`.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* const { token } = await client.console.auth.login("user", "pass");
|
|
161
|
+
* const me = await client.console.auth.getMe();
|
|
162
|
+
* if (me.tenantAdmin) { // tenant-admin surface
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare class AuthApi {
|
|
167
|
+
#private;
|
|
168
|
+
/**
|
|
169
|
+
* @param host - The client this namespace issues requests through.
|
|
170
|
+
*/
|
|
171
|
+
constructor(host: AuthHost);
|
|
172
|
+
/**
|
|
173
|
+
* Authenticate with the configured credential and mint a session token.
|
|
174
|
+
*
|
|
175
|
+
* PUBLIC — sends no bearer, even on a client that already holds one
|
|
176
|
+
* (`requireAuth: false`).
|
|
177
|
+
*
|
|
178
|
+
* @param username - The account username.
|
|
179
|
+
* @param password - The account password.
|
|
180
|
+
* @returns The token, the caller's identity, and the token's lifetime.
|
|
181
|
+
* @throws {ApiError} On any non-2xx, e.g. `401` for invalid credentials.
|
|
182
|
+
*/
|
|
183
|
+
login(username: string, password: string): Promise<LoginResponse>;
|
|
184
|
+
/**
|
|
185
|
+
* Self-serve signup: creates the user and mints a `role: "user"` session.
|
|
186
|
+
*
|
|
187
|
+
* PUBLIC — sends no bearer, even on a client that already holds one
|
|
188
|
+
* (`requireAuth: false`).
|
|
189
|
+
*
|
|
190
|
+
* @param input - Email, password, and the optional displayName/inviteToken.
|
|
191
|
+
* @returns The token, its lifetime, the created user, and the invite's account (else `null`).
|
|
192
|
+
* @throws {ApiError} On any non-2xx, e.g. `409` when the email is taken.
|
|
193
|
+
*/
|
|
194
|
+
signup(input: SignupInput): Promise<SignupResponse>;
|
|
195
|
+
/**
|
|
196
|
+
* Check whether an account slug is free, and get free alternatives if not.
|
|
197
|
+
*
|
|
198
|
+
* PUBLIC — sends no bearer, even on a client that already holds one
|
|
199
|
+
* (`requireAuth: false`). Advisory only: the unique index decides at create
|
|
200
|
+
* time, so a `409` from `createAccount` is a normal outcome, not a
|
|
201
|
+
* contradiction of what this returned.
|
|
202
|
+
*
|
|
203
|
+
* @param name - The slug (or candidate name) to check.
|
|
204
|
+
* @returns The server's normalization of `name`, whether it is available, and up to five alternatives.
|
|
205
|
+
* @throws {ApiError} On any non-2xx.
|
|
206
|
+
*/
|
|
207
|
+
checkAccountSlug(name: string): Promise<SlugAvailabilityResponse>;
|
|
208
|
+
/**
|
|
209
|
+
* Create an account for the caller and re-issue the session with its claim.
|
|
210
|
+
*
|
|
211
|
+
* AUTHENTICATED — the default `requireAuth` applies. NOTE the returned
|
|
212
|
+
* token is minted `role: "user"` unconditionally (`id/auth.ts:112`), so
|
|
213
|
+
* adopting it downgrades an operator; this method never writes the session
|
|
214
|
+
* itself, the caller decides.
|
|
215
|
+
*
|
|
216
|
+
* @param name - The account's display name.
|
|
217
|
+
* @param slug - The account's slug.
|
|
218
|
+
* @returns The created account, a re-issued token carrying its claim, and the token's lifetime.
|
|
219
|
+
* @throws {ApiError} On any non-2xx, e.g. `409` when the slug is taken.
|
|
220
|
+
*/
|
|
221
|
+
createAccount(name: string, slug: string): Promise<CreateAccountResponse>;
|
|
222
|
+
/**
|
|
223
|
+
* Read the caller's identity **and its tenant-admin capability**.
|
|
224
|
+
*
|
|
225
|
+
* AUTHENTICATED — the default `requireAuth` applies, unlike `login`,
|
|
226
|
+
* `signup` and `checkAccountSlug`. `/auth/me` reads the principal, so a
|
|
227
|
+
* request without a bearer is a `401`, and a tokenless client raises
|
|
228
|
+
* `ConfigError` before `fetch` is ever called.
|
|
229
|
+
*
|
|
230
|
+
* Same route as the base surface's `client.me()`; this one promises the
|
|
231
|
+
* console projection ({@linkcode ConsoleMe}) instead of the published `Me`.
|
|
232
|
+
* Unlike `client.me()` it does **not** fill in a `versions.wrapper` entry
|
|
233
|
+
* from this package's own `VERSION` (`../me.ts` does that): what this returns
|
|
234
|
+
* is the server's body, verbatim.
|
|
235
|
+
*
|
|
236
|
+
* @returns The caller's identity, plus `tenantAdmin`.
|
|
237
|
+
* @throws {ApiError} On any non-2xx, e.g. `401` when the bearer is missing or expired.
|
|
238
|
+
*/
|
|
239
|
+
getMe(): Promise<ConsoleMe>;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=auth.d.ts.map
|