@antasphere/chassis-sdk 0.0.0-stage → 1.0.1
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/LICENSE +82 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +521 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -3
- package/src/index.ts +822 -0
- package/test/defaults.test.ts +14 -0
- package/test/demo-redeem.test.ts +56 -0
- package/test/download-headers.test.ts +72 -0
- package/test/extra-headers.test.ts +48 -0
- package/test/route-coverage.test.ts +174 -0
- package/test/timeout.test.ts +80 -0
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin typed client over /api/v1. Isomorphic: in the dashboard it rides the
|
|
3
|
+
* same-origin session cookie; in Node/CLI contexts pass an API key.
|
|
4
|
+
*/
|
|
5
|
+
export class PlatformApiError extends Error {
|
|
6
|
+
status;
|
|
7
|
+
code;
|
|
8
|
+
details;
|
|
9
|
+
constructor(status, code, message, details) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.details = details;
|
|
14
|
+
this.name = 'PlatformApiError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function idempotencyHeader(opts) {
|
|
18
|
+
return opts.idempotencyKey ? { 'idempotency-key': opts.idempotencyKey } : undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Default deadline for the JSON API calls (ms). */
|
|
21
|
+
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
22
|
+
/** Default deadline for the streaming download calls (ms). */
|
|
23
|
+
export const DEFAULT_DOWNLOAD_TIMEOUT_MS = 600_000;
|
|
24
|
+
export class ChassisClient {
|
|
25
|
+
baseUrl;
|
|
26
|
+
apiKey;
|
|
27
|
+
workspaceId;
|
|
28
|
+
fetchImpl;
|
|
29
|
+
timeoutMs;
|
|
30
|
+
downloadTimeoutMs;
|
|
31
|
+
extraHeaders;
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
this.baseUrl = options.baseUrl?.replace(/\/$/, '') ?? '';
|
|
34
|
+
this.apiKey = options.apiKey;
|
|
35
|
+
this.workspaceId = options.workspaceId;
|
|
36
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
37
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
38
|
+
this.downloadTimeoutMs = options.downloadTimeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS;
|
|
39
|
+
this.extraHeaders = { ...options.headers };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The abort signal every call carries. `fetch` never times out on its
|
|
43
|
+
* own, so a silent peer (or a hostile one holding the socket open) would
|
|
44
|
+
* otherwise hang the caller indefinitely.
|
|
45
|
+
*/
|
|
46
|
+
signal(kind) {
|
|
47
|
+
const ms = kind === 'download' ? this.downloadTimeoutMs : this.timeoutMs;
|
|
48
|
+
return ms > 0 ? AbortSignal.timeout(ms) : undefined;
|
|
49
|
+
}
|
|
50
|
+
/** Set (or clear) the active workspace all subsequent requests target. */
|
|
51
|
+
setWorkspace(workspaceId) {
|
|
52
|
+
this.workspaceId = workspaceId ?? undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Base headers shared by every call: the caller's own, then credential + active workspace. */
|
|
55
|
+
baseHeaders() {
|
|
56
|
+
const headers = { ...this.extraHeaders };
|
|
57
|
+
if (this.apiKey)
|
|
58
|
+
headers['authorization'] = `Bearer ${this.apiKey}`;
|
|
59
|
+
if (this.workspaceId)
|
|
60
|
+
headers['x-workspace-id'] = this.workspaceId;
|
|
61
|
+
return headers;
|
|
62
|
+
}
|
|
63
|
+
async parse(res) {
|
|
64
|
+
if (res.status === 204)
|
|
65
|
+
return undefined;
|
|
66
|
+
const json = (await res.json().catch(() => null));
|
|
67
|
+
if (!res.ok) {
|
|
68
|
+
const errBody = (json ?? {});
|
|
69
|
+
throw new PlatformApiError(res.status, errBody.error?.code ?? 'unknown_error', errBody.error?.message ?? `Request failed with ${res.status}`, errBody.error?.details);
|
|
70
|
+
}
|
|
71
|
+
return json;
|
|
72
|
+
}
|
|
73
|
+
/** Append cursor-pagination params to a list path. */
|
|
74
|
+
pathWithQuery(base, params, extra = {}) {
|
|
75
|
+
const query = new URLSearchParams();
|
|
76
|
+
if (params.cursor)
|
|
77
|
+
query.set('cursor', params.cursor);
|
|
78
|
+
if (params.limit !== undefined)
|
|
79
|
+
query.set('limit', String(params.limit));
|
|
80
|
+
for (const [key, value] of Object.entries(extra))
|
|
81
|
+
if (value !== undefined)
|
|
82
|
+
query.set(key, value);
|
|
83
|
+
const qs = query.toString();
|
|
84
|
+
return qs ? `${base}?${qs}` : base;
|
|
85
|
+
}
|
|
86
|
+
async request(method, path, body, extraHeaders) {
|
|
87
|
+
const headers = { ...this.baseHeaders(), ...extraHeaders };
|
|
88
|
+
if (body !== undefined)
|
|
89
|
+
headers['content-type'] = 'application/json';
|
|
90
|
+
const res = await this.fetchImpl(`${this.baseUrl}/api/v1${path}`, {
|
|
91
|
+
method,
|
|
92
|
+
headers,
|
|
93
|
+
credentials: 'same-origin',
|
|
94
|
+
signal: this.signal('api'),
|
|
95
|
+
// Always see live state: /instance flips setupRequired the moment the
|
|
96
|
+
// wizard completes but is served with public max-age for CLI/MCP
|
|
97
|
+
// discovery — the browser HTTP cache must not answer for the app.
|
|
98
|
+
// (`cache` is a browser-only field; cast keeps this isomorphic under a
|
|
99
|
+
// Node lib where RequestInit omits it.)
|
|
100
|
+
cache: 'no-store',
|
|
101
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {})
|
|
102
|
+
});
|
|
103
|
+
return this.parse(res);
|
|
104
|
+
}
|
|
105
|
+
instance() {
|
|
106
|
+
return this.request('GET', '/instance');
|
|
107
|
+
}
|
|
108
|
+
setup(req) {
|
|
109
|
+
return this.request('POST', '/setup', req);
|
|
110
|
+
}
|
|
111
|
+
me() {
|
|
112
|
+
return this.request('GET', '/me');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* CLOUD EDITION only (404 on oss); sessions only (machines 403): record
|
|
116
|
+
* the explicit first-run-welcome dismissal — flips /me's
|
|
117
|
+
* `firstRunPending` to false, permanently. Idempotent.
|
|
118
|
+
*/
|
|
119
|
+
dismissOnboarding() {
|
|
120
|
+
return this.request('POST', '/me/onboarding/dismiss');
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Choose the workspace a request naming none resolves to, or clear the
|
|
124
|
+
* choice with `null` (the oldest active membership answers again). The
|
|
125
|
+
* person's own setting, open to their keys under the write scope; a key
|
|
126
|
+
* pinned to one workspace answers 403 `key_pinned`. On the cloud edition
|
|
127
|
+
* the default is set on the account site: 403 `hub_managed` with
|
|
128
|
+
* `details.manageUrl`. 404 for a workspace the caller is no active member of.
|
|
129
|
+
*/
|
|
130
|
+
setDefaultWorkspace(workspaceId) {
|
|
131
|
+
return this.request('PUT', '/me/default-workspace', { workspaceId });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Create ANOTHER workspace with the caller as its owner. Sessions only
|
|
135
|
+
* (API keys and OAuth bearers answer 403); offer it only while `/me`'s
|
|
136
|
+
* `canCreateWorkspace` is true. Self-hosted creates it locally under the
|
|
137
|
+
* operator's per-person cap; cloud creates the organization at Antasphere
|
|
138
|
+
* as the caller. Either way `workspace.id` is the id to pass as
|
|
139
|
+
* `X-Workspace-Id` (`setWorkspace`). Refusals (403 unless noted):
|
|
140
|
+
* `session_required`, `guest_forbidden`, `workspace_creation_disabled`,
|
|
141
|
+
* `workspace_limit_reached`, `hub_link_required`, `hub_unavailable`,
|
|
142
|
+
* `hub_refused`, 401 `hub_grant_expired`, 401 `hub_reauth_required` (both
|
|
143
|
+
* healed by signing in again), 400 `validation_error`, 429 `rate_limited`.
|
|
144
|
+
*/
|
|
145
|
+
createWorkspace(name, opts = {}) {
|
|
146
|
+
const { look, ...rest } = opts;
|
|
147
|
+
return this.request('POST', '/workspaces', look ? { name, look } : { name }, idempotencyHeader(rest));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* PATCH /workspace — the ACTIVE workspace's name and look (owner/admin,
|
|
151
|
+
* sessions only). A rename of a hub-origin workspace answers 403
|
|
152
|
+
* `hub_managed` with `details.manageUrl`; its look is accepted.
|
|
153
|
+
*/
|
|
154
|
+
updateWorkspace(body) {
|
|
155
|
+
return this.request('PATCH', '/workspace', body);
|
|
156
|
+
}
|
|
157
|
+
/** Better Auth session probe — null when signed out. */
|
|
158
|
+
async session() {
|
|
159
|
+
return this.request('GET', '/auth/get-session');
|
|
160
|
+
}
|
|
161
|
+
signInEmail(email, password) {
|
|
162
|
+
return this.request('POST', '/auth/sign-in/email', { email, password });
|
|
163
|
+
}
|
|
164
|
+
signOut() {
|
|
165
|
+
return this.request('POST', '/auth/sign-out', {});
|
|
166
|
+
}
|
|
167
|
+
// ── CLI auth (browserless email-OTP → API key) ────────────────────────────
|
|
168
|
+
/** Public: email a sign-in code. Generic success — silent about account existence. */
|
|
169
|
+
cliAuthRequest(req) {
|
|
170
|
+
return this.request('POST', '/cli/auth/request', req);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Public: verify the code and mint an API key (the tool's read + write
|
|
174
|
+
* scopes). The returned `key` appears only here.
|
|
175
|
+
*/
|
|
176
|
+
cliAuthComplete(req) {
|
|
177
|
+
return this.request('POST', '/cli/auth/complete', req);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Revoke the PRESENTING API key (CLI logout). Self-revocation only: the
|
|
181
|
+
* route names no key, so the credential can kill exactly itself. Requires
|
|
182
|
+
* an API-key credential with the tool's write scope (sessions and OAuth
|
|
183
|
+
* bearers are refused — the dashboard is their key-management surface).
|
|
184
|
+
*/
|
|
185
|
+
cliAuthRevoke() {
|
|
186
|
+
return this.request('DELETE', '/cli/auth/key');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Public, CLOUD EDITION only (404 on oss): exchange a hub-minted 120 s
|
|
190
|
+
* connect JWT (the hub's /sso/tool-token response) for an API key
|
|
191
|
+
* bound to the projected workspace — same grant and one-shot response
|
|
192
|
+
* shape as cliAuthComplete. Each token works exactly once (jti).
|
|
193
|
+
*/
|
|
194
|
+
ssoCliConnect(req) {
|
|
195
|
+
return this.request('POST', '/sso/cli-connect', req);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* CLOUD EDITION only (404 on oss); sessions only (machines 403 — the
|
|
199
|
+
* path is unlisted in the scope allowlist): single logout. The server
|
|
200
|
+
* revokes the local session and clears the SSO hint cookie in this very
|
|
201
|
+
* response; `url` is the hub end-session URL the browser must then VISIT
|
|
202
|
+
* to end the hub anchor session (null = local signout only — go straight
|
|
203
|
+
* to /login?signed_out=1).
|
|
204
|
+
*/
|
|
205
|
+
ssoLogout() {
|
|
206
|
+
return this.request('POST', '/sso/logout');
|
|
207
|
+
}
|
|
208
|
+
// ── Members ───────────────────────────────────────────────────────────────
|
|
209
|
+
members(params = {}) {
|
|
210
|
+
return this.request('GET', this.pathWithQuery('/members', params));
|
|
211
|
+
}
|
|
212
|
+
updateMember(id, patch) {
|
|
213
|
+
return this.request('PATCH', `/members/${encodeURIComponent(id)}`, patch);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Admin: delete a member's account (GDPR erasure). Sessions only — the
|
|
217
|
+
* endpoint is unlisted in the machine scope allowlist, so API keys 403.
|
|
218
|
+
* Files the member uploaded stay with the workspace.
|
|
219
|
+
*/
|
|
220
|
+
deleteMember(id) {
|
|
221
|
+
return this.request('DELETE', `/members/${encodeURIComponent(id)}`);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Remove a member from the workspace (admin+, sessions only): the
|
|
225
|
+
* membership is switched off and their project grants and team seats are
|
|
226
|
+
* deleted; the account stays. Invited back, the person starts with none.
|
|
227
|
+
* Refused `hub_managed` on a hub-origin workspace (removal is the hub's).
|
|
228
|
+
*/
|
|
229
|
+
removeMember(id) {
|
|
230
|
+
return this.request('POST', `/members/${encodeURIComponent(id)}/remove`);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Owner: mint a one-time password reset link for a member (SMTP-free
|
|
234
|
+
* recovery). Refused for a per-resource guest and for anyone who also belongs
|
|
235
|
+
* to another workspace — the minted credential is global (PRDCT-1354).
|
|
236
|
+
*/
|
|
237
|
+
createMemberResetLink(id, opts = {}) {
|
|
238
|
+
return this.request('POST', `/members/${encodeURIComponent(id)}/reset-link`, undefined, idempotencyHeader(opts));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Owner: mint a one-time email change link for a member (SMTP-free email
|
|
242
|
+
* change). ⚠️ The link updates the email AND signs the member in — share
|
|
243
|
+
* it with the target member only. Same refusals as the reset link (guest
|
|
244
|
+
* targets, cross-workspace targets), plus the cloud edition closure.
|
|
245
|
+
*/
|
|
246
|
+
createMemberChangeEmailLink(id, req, opts = {}) {
|
|
247
|
+
return this.request('POST', `/members/${encodeURIComponent(id)}/change-email-link`, req, idempotencyHeader(opts));
|
|
248
|
+
}
|
|
249
|
+
// ── Projects ──────────────────────────────────────────────────────────────
|
|
250
|
+
// A project is a subgroup of the workspace with its own members and three
|
|
251
|
+
// roles (viewer, editor, manager). A project the caller cannot read answers
|
|
252
|
+
// 404; an archived one answers 409 `project_archived` to every change but
|
|
253
|
+
// `unarchiveProject`. A project is never deleted.
|
|
254
|
+
/** The caller's projects (every project for a workspace owner or admin). `archived`: `false` by default. */
|
|
255
|
+
projects(params = {}) {
|
|
256
|
+
return this.request('GET', this.pathWithQuery('/projects', params, { archived: params.archived }));
|
|
257
|
+
}
|
|
258
|
+
/** The caller becomes the project's first manager. */
|
|
259
|
+
createProject(req, opts = {}) {
|
|
260
|
+
return this.request('POST', '/projects', req, idempotencyHeader(opts));
|
|
261
|
+
}
|
|
262
|
+
project(id) {
|
|
263
|
+
return this.request('GET', `/projects/${encodeURIComponent(id)}`);
|
|
264
|
+
}
|
|
265
|
+
updateProject(id, patch) {
|
|
266
|
+
return this.request('PATCH', `/projects/${encodeURIComponent(id)}`, patch);
|
|
267
|
+
}
|
|
268
|
+
archiveProject(id) {
|
|
269
|
+
return this.request('POST', `/projects/${encodeURIComponent(id)}/archive`);
|
|
270
|
+
}
|
|
271
|
+
unarchiveProject(id) {
|
|
272
|
+
return this.request('POST', `/projects/${encodeURIComponent(id)}/unarchive`);
|
|
273
|
+
}
|
|
274
|
+
projectMembers(id, params = {}) {
|
|
275
|
+
return this.request('GET', this.pathWithQuery(`/projects/${encodeURIComponent(id)}/members`, params));
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Adds one of the workspace's own active members, by user id or by email,
|
|
279
|
+
* or one of its teams by `teamId`: exactly one of the three. A team entry
|
|
280
|
+
* gives every member of the team the role.
|
|
281
|
+
*/
|
|
282
|
+
addProjectMember(id, req, opts = {}) {
|
|
283
|
+
return this.request('POST', `/projects/${encodeURIComponent(id)}/members`, req, idempotencyHeader(opts));
|
|
284
|
+
}
|
|
285
|
+
setProjectMemberRole(id, userId, role) {
|
|
286
|
+
return this.request('PATCH', `/projects/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`, { role });
|
|
287
|
+
}
|
|
288
|
+
/** A manager removes anyone; any member removes themselves. */
|
|
289
|
+
removeProjectMember(id, userId) {
|
|
290
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`);
|
|
291
|
+
}
|
|
292
|
+
/** Changes the role a team holds on a project (manager). */
|
|
293
|
+
setProjectTeamRole(projectId, teamId, role) {
|
|
294
|
+
return this.request('PATCH', `/projects/${encodeURIComponent(projectId)}/teams/${encodeURIComponent(teamId)}`, { role });
|
|
295
|
+
}
|
|
296
|
+
/** Removes a team from a project (manager); its people keep their own entries. */
|
|
297
|
+
removeProjectTeam(projectId, teamId) {
|
|
298
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(projectId)}/teams/${encodeURIComponent(teamId)}`);
|
|
299
|
+
}
|
|
300
|
+
// ── Teams ─────────────────────────────────────────────────────────────────
|
|
301
|
+
// A team is a named group of the workspace's own members, on both editions.
|
|
302
|
+
// Every non-guest member reads them; owners and admins shape them. In a
|
|
303
|
+
// workspace managed by the account site every write answers 403
|
|
304
|
+
// `hub_managed` with `details.manageUrl`.
|
|
305
|
+
/** The workspace's teams, newest first. */
|
|
306
|
+
teams(params = {}) {
|
|
307
|
+
return this.request('GET', this.pathWithQuery('/teams', params));
|
|
308
|
+
}
|
|
309
|
+
team(id) {
|
|
310
|
+
return this.request('GET', `/teams/${encodeURIComponent(id)}`);
|
|
311
|
+
}
|
|
312
|
+
/** Owner or admin. The slug is derived from the name when absent. */
|
|
313
|
+
createTeam(req, opts = {}) {
|
|
314
|
+
return this.request('POST', '/teams', req, idempotencyHeader(opts));
|
|
315
|
+
}
|
|
316
|
+
updateTeam(id, patch) {
|
|
317
|
+
return this.request('PATCH', `/teams/${encodeURIComponent(id)}`, patch);
|
|
318
|
+
}
|
|
319
|
+
/** The memberships stay; answers the team's final snapshot. */
|
|
320
|
+
deleteTeam(id) {
|
|
321
|
+
return this.request('DELETE', `/teams/${encodeURIComponent(id)}`);
|
|
322
|
+
}
|
|
323
|
+
teamMembers(id, params = {}) {
|
|
324
|
+
return this.request('GET', this.pathWithQuery(`/teams/${encodeURIComponent(id)}/members`, params));
|
|
325
|
+
}
|
|
326
|
+
/** Seats one of the workspace's own active members, by user id or by email. */
|
|
327
|
+
addTeamMember(id, req, opts = {}) {
|
|
328
|
+
return this.request('POST', `/teams/${encodeURIComponent(id)}/members`, req, idempotencyHeader(opts));
|
|
329
|
+
}
|
|
330
|
+
/** Unseats a member; the workspace membership stays. */
|
|
331
|
+
removeTeamMember(id, userId) {
|
|
332
|
+
return this.request('DELETE', `/teams/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`);
|
|
333
|
+
}
|
|
334
|
+
// ── Demo passes ───────────────────────────────────────────────────────────
|
|
335
|
+
// A link that signs one member in without a password, for a demonstration.
|
|
336
|
+
// The routes exist only while `instance().demoSignIn` is true (a self-hosted
|
|
337
|
+
// instance whose operator turned DEMO_SIGN_IN on); otherwise they answer
|
|
338
|
+
// 404 like any unknown path. Owner and session only: an admin or a member
|
|
339
|
+
// gets 403 `forbidden`, an API key 403 before the route.
|
|
340
|
+
/** Owner: the workspace's passes, newest first. Never carries a secret. */
|
|
341
|
+
demoPasses() {
|
|
342
|
+
return this.request('GET', '/demo/passes');
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Owner: mint a pass for a member by address. The `secret` and the `url`
|
|
346
|
+
* (`<instance>/demo#pass=…&to=…`) appear in this answer only. Refusals, in
|
|
347
|
+
* this order: 404 `no_such_member`, 403 `owner_target`,
|
|
348
|
+
* `demo_address_required`, `two_factor_enrolled`, `guest_target`,
|
|
349
|
+
* `cross_workspace_target`, then 400 `invalid_demo_path` or
|
|
350
|
+
* `validation_error` (a lifetime outside 1 to 10080 minutes).
|
|
351
|
+
*/
|
|
352
|
+
mintDemoPass(req) {
|
|
353
|
+
return this.request('POST', '/demo/passes', req);
|
|
354
|
+
}
|
|
355
|
+
/** Owner: revoke a pass; revoking a revoked pass answers it again. */
|
|
356
|
+
revokeDemoPass(id) {
|
|
357
|
+
return this.request('DELETE', `/demo/passes/${encodeURIComponent(id)}`);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Anyone holding a pass's secret: sign in as its person. Served by the
|
|
361
|
+
* sign-in library (like `signInEmail`, no route contract), which sets the
|
|
362
|
+
* session cookie on this very answer; in a browser, call it same-origin.
|
|
363
|
+
* Every refusal of a pass is one 401 `invalid_demo_pass`, whatever the
|
|
364
|
+
* reason; 429 `rate_limited` past 20 REFUSED tries in 15 minutes from one address.
|
|
365
|
+
*/
|
|
366
|
+
redeemDemoPass(secret) {
|
|
367
|
+
return this.request('POST', '/auth/demo/redeem', { pass: secret });
|
|
368
|
+
}
|
|
369
|
+
// ── Break-glass (superadmin recovery, ADR 010) ────────────────────────────
|
|
370
|
+
/**
|
|
371
|
+
* Superadmin: make the caller (or a named existing user) an ACTIVE OWNER
|
|
372
|
+
* of the workspace — creating, reactivating, or promoting the membership.
|
|
373
|
+
* Adds an owner, never removes one. Sessions only: the endpoint is
|
|
374
|
+
* unlisted in the machine scope allowlist (API keys/tokens 403), and the
|
|
375
|
+
* calling session's VERIFIED email must be on SUPERADMIN_EMAILS.
|
|
376
|
+
*/
|
|
377
|
+
breakGlassClaimOwnership(req = {}) {
|
|
378
|
+
return this.request('POST', '/admin/break-glass/claim-ownership', req);
|
|
379
|
+
}
|
|
380
|
+
/** Superadmin: clear a locked-out user's 2FA (sessions only, audited). */
|
|
381
|
+
breakGlassResetTwoFactor(req) {
|
|
382
|
+
return this.request('POST', '/admin/break-glass/reset-2fa', req);
|
|
383
|
+
}
|
|
384
|
+
// ── API keys ──────────────────────────────────────────────────────────────
|
|
385
|
+
apiKeys(params = {}) {
|
|
386
|
+
return this.request('GET', this.pathWithQuery('/api-keys', params));
|
|
387
|
+
}
|
|
388
|
+
/** The returned `key` is the full secret — shown once, never retrievable. */
|
|
389
|
+
createApiKey(req, opts = {}) {
|
|
390
|
+
return this.request('POST', '/api-keys', req, idempotencyHeader(opts));
|
|
391
|
+
}
|
|
392
|
+
revokeApiKey(id) {
|
|
393
|
+
return this.request('DELETE', `/api-keys/${encodeURIComponent(id)}`);
|
|
394
|
+
}
|
|
395
|
+
// ── Invitations ───────────────────────────────────────────────────────────
|
|
396
|
+
invitations(params = {}) {
|
|
397
|
+
return this.request('GET', this.pathWithQuery('/invitations', params));
|
|
398
|
+
}
|
|
399
|
+
/** `acceptUrl` is always returned — email delivery is best-effort on top. */
|
|
400
|
+
createInvitation(req, opts = {}) {
|
|
401
|
+
return this.request('POST', '/invitations', req, idempotencyHeader(opts));
|
|
402
|
+
}
|
|
403
|
+
revokeInvitation(id) {
|
|
404
|
+
return this.request('DELETE', `/invitations/${encodeURIComponent(id)}`);
|
|
405
|
+
}
|
|
406
|
+
/** Public: resolves an invitation token for the acceptance page. */
|
|
407
|
+
lookupInvitation(token) {
|
|
408
|
+
return this.request('GET', `/invitations/lookup?token=${encodeURIComponent(token)}`);
|
|
409
|
+
}
|
|
410
|
+
/** Public: accepts an invitation (creates the account when needed). */
|
|
411
|
+
acceptInvitation(req) {
|
|
412
|
+
return this.request('POST', '/invitations/accept', req);
|
|
413
|
+
}
|
|
414
|
+
// ── Audit ─────────────────────────────────────────────────────────────────
|
|
415
|
+
audit(params = {}) {
|
|
416
|
+
const query = new URLSearchParams();
|
|
417
|
+
if (params.cursor)
|
|
418
|
+
query.set('cursor', params.cursor);
|
|
419
|
+
if (params.limit !== undefined)
|
|
420
|
+
query.set('limit', String(params.limit));
|
|
421
|
+
if (params.q)
|
|
422
|
+
query.set('q', params.q);
|
|
423
|
+
if (params.action?.length)
|
|
424
|
+
query.set('action', params.action.join(','));
|
|
425
|
+
if (params.actorVia?.length)
|
|
426
|
+
query.set('actorVia', params.actorVia.join(','));
|
|
427
|
+
if (params.actor)
|
|
428
|
+
query.set('actor', params.actor);
|
|
429
|
+
if (params.resourceType)
|
|
430
|
+
query.set('resourceType', params.resourceType);
|
|
431
|
+
if (params.resourceId)
|
|
432
|
+
query.set('resourceId', params.resourceId);
|
|
433
|
+
if (params.from)
|
|
434
|
+
query.set('from', params.from);
|
|
435
|
+
if (params.to)
|
|
436
|
+
query.set('to', params.to);
|
|
437
|
+
const qs = query.toString();
|
|
438
|
+
return this.request('GET', qs ? `/audit?${qs}` : '/audit');
|
|
439
|
+
}
|
|
440
|
+
// ── Files ─────────────────────────────────────────────────────────────────
|
|
441
|
+
files(params = {}) {
|
|
442
|
+
return this.request('GET', this.pathWithQuery('/files', params));
|
|
443
|
+
}
|
|
444
|
+
/** Uploads raw bytes; the filename travels as a query param. */
|
|
445
|
+
async uploadFile(name, body, contentType) {
|
|
446
|
+
const type = contentType ??
|
|
447
|
+
(typeof Blob !== 'undefined' && body instanceof Blob && body.type
|
|
448
|
+
? body.type
|
|
449
|
+
: 'application/octet-stream');
|
|
450
|
+
const headers = { ...this.baseHeaders(), 'content-type': type };
|
|
451
|
+
const res = await this.fetchImpl(`${this.baseUrl}/api/v1/files?name=${encodeURIComponent(name)}`, {
|
|
452
|
+
method: 'POST',
|
|
453
|
+
headers,
|
|
454
|
+
credentials: 'same-origin',
|
|
455
|
+
signal: this.signal('download'),
|
|
456
|
+
body: body
|
|
457
|
+
});
|
|
458
|
+
return this.parse(res);
|
|
459
|
+
}
|
|
460
|
+
deleteFile(id) {
|
|
461
|
+
return this.request('DELETE', `/files/${encodeURIComponent(id)}`);
|
|
462
|
+
}
|
|
463
|
+
file(id) {
|
|
464
|
+
return this.request('GET', `/files/${encodeURIComponent(id)}`);
|
|
465
|
+
}
|
|
466
|
+
/** URL of the streamed (Range-capable) content endpoint for a file. */
|
|
467
|
+
fileContentUrl(id) {
|
|
468
|
+
return `${this.baseUrl}/api/v1/files/${encodeURIComponent(id)}/content`;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Downloads a file's bytes with the client's own headers (credential and
|
|
472
|
+
* active workspace). Raw Response so callers can stream it; a non-2xx
|
|
473
|
+
* answer throws PlatformApiError like every other method. A browser anchor
|
|
474
|
+
* on `fileContentUrl` cannot carry `X-Workspace-Id` (PRDCT-2426).
|
|
475
|
+
*/
|
|
476
|
+
async downloadFileContent(id) {
|
|
477
|
+
return this.rawDownload(this.fileContentUrl(id));
|
|
478
|
+
}
|
|
479
|
+
/** The shared body of the streamed-download methods (the asset download's shape). */
|
|
480
|
+
async rawDownload(url) {
|
|
481
|
+
const headers = this.baseHeaders();
|
|
482
|
+
const res = await this.fetchImpl(url, {
|
|
483
|
+
method: 'GET',
|
|
484
|
+
headers,
|
|
485
|
+
credentials: 'same-origin',
|
|
486
|
+
signal: this.signal('download'),
|
|
487
|
+
// Browser-only field; cast keeps this isomorphic under a Node lib.
|
|
488
|
+
cache: 'no-store'
|
|
489
|
+
});
|
|
490
|
+
if (!res.ok) {
|
|
491
|
+
await this.parse(res); // throws PlatformApiError with the wire shape
|
|
492
|
+
}
|
|
493
|
+
return res;
|
|
494
|
+
}
|
|
495
|
+
// ── Workspace export ──────────────────────────────────────────────────────
|
|
496
|
+
/** URL of the workspace export endpoint (admin+; keys need the tool's export scope). */
|
|
497
|
+
workspaceExportUrl() {
|
|
498
|
+
return `${this.baseUrl}/api/v1/workspace/export`;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Downloads the full workspace export. Returns the raw Response so callers
|
|
502
|
+
* can stream the zip (exports can be large — never buffer by default);
|
|
503
|
+
* a non-2xx answer throws PlatformApiError like every other method.
|
|
504
|
+
*/
|
|
505
|
+
async downloadExport() {
|
|
506
|
+
const headers = this.baseHeaders();
|
|
507
|
+
const res = await this.fetchImpl(this.workspaceExportUrl(), {
|
|
508
|
+
method: 'GET',
|
|
509
|
+
headers,
|
|
510
|
+
credentials: 'same-origin',
|
|
511
|
+
signal: this.signal('download'),
|
|
512
|
+
// Browser-only field; cast keeps this isomorphic under a Node lib.
|
|
513
|
+
cache: 'no-store'
|
|
514
|
+
});
|
|
515
|
+
if (!res.ok) {
|
|
516
|
+
await this.parse(res); // throws PlatformApiError with the wire shape
|
|
517
|
+
}
|
|
518
|
+
return res;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4EA;;;GAGG;AAEH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB;IACA;IAEA;IAJlB,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe,EACC,OAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QA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,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YACpC,MAAM,EAAE,KAAK;YACb,OAAO;YACP,WAAW,EAAE,aAAa;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,mEAAmE;YACnE,KAAK,EAAE,UAAU;SACH,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,8CAA8C;QACvE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,6EAA6E;IAE7E,wFAAwF;IACxF,kBAAkB;QAChB,OAAO,GAAG,IAAI,CAAC,OAAO,0BAA0B,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,OAAO,GAA2B,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE;YAC1D,MAAM,EAAE,KAAK;YACb,OAAO;YACP,WAAW,EAAE,aAAa;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,mEAAmE;YACnE,KAAK,EAAE,UAAU;SACH,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,8CAA8C;QACvE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antasphere/chassis-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/antasphere/chassis.git",
|
|
8
|
+
"directory": "packages/chassis-sdk"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"test",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@antasphere/chassis-contract": "1.0.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"vitest": "^3.2.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.json",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
35
|
+
"lint": "eslint src test",
|
|
36
|
+
"test": "vitest run --passWithNoTests"
|
|
37
|
+
}
|
|
6
38
|
}
|