primitive-admin 1.3.0-alpha.0 → 1.3.0-alpha.2
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 +45 -0
- package/dist/src/commands/admins.js +91 -0
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/auth-passkeys.d.ts +7 -0
- package/dist/src/commands/auth-passkeys.js +99 -0
- package/dist/src/commands/auth-passkeys.js.map +1 -0
- package/dist/src/commands/auth-sessions.js +7 -28
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +32 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +27 -0
- package/dist/src/commands/db3-types.js +288 -2
- package/dist/src/commands/db3-types.js.map +1 -1
- package/dist/src/commands/db3.d.ts +16 -2
- package/dist/src/commands/db3.js +614 -5
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.js +7 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +8 -3
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/hosting.js +177 -14
- package/dist/src/commands/hosting.js.map +1 -1
- package/dist/src/commands/metadata.js +14 -6
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/secrets.d.ts +38 -0
- package/dist/src/commands/secrets.js +102 -4
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/spent-tokens.d.ts +19 -0
- package/dist/src/commands/spent-tokens.js +79 -0
- package/dist/src/commands/spent-tokens.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +145 -0
- package/dist/src/commands/sync-app-settings.js +341 -8
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +62 -15
- package/dist/src/commands/sync.js +437 -48
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/usage.d.ts +24 -0
- package/dist/src/commands/usage.js +54 -0
- package/dist/src/commands/usage.js.map +1 -1
- package/dist/src/commands/users.js +41 -1
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/lib/admin-login-tables.d.ts +31 -0
- package/dist/src/lib/admin-login-tables.js +75 -0
- package/dist/src/lib/admin-login-tables.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +241 -0
- package/dist/src/lib/api-client.js +203 -10
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +42 -3
- package/dist/src/lib/app-settings-descriptor.js +114 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-flow.d.ts +13 -0
- package/dist/src/lib/auth-flow.js +23 -2
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/command-groups.js +2 -0
- package/dist/src/lib/command-groups.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +6 -1
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +19 -0
- package/dist/src/lib/credentials-store.js +66 -2
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +2 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +3 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +20 -1
- package/dist/src/lib/db-type-records.js +17 -4
- package/dist/src/lib/db-type-records.js.map +1 -1
- package/dist/src/lib/db3-export.d.ts +43 -8
- package/dist/src/lib/db3-export.js +133 -13
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-json-fields.d.ts +49 -0
- package/dist/src/lib/db3-json-fields.js +195 -0
- package/dist/src/lib/db3-json-fields.js.map +1 -0
- package/dist/src/lib/db3-type-archive.d.ts +59 -0
- package/dist/src/lib/db3-type-archive.js +95 -0
- package/dist/src/lib/db3-type-archive.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +15 -1
- package/dist/src/lib/db3-type-models.js +147 -16
- package/dist/src/lib/db3-type-models.js.map +1 -1
- package/dist/src/lib/document-export-record-log.d.ts +7 -0
- package/dist/src/lib/document-export-record-log.js +9 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +6 -0
- package/dist/src/lib/document-ingest-artifact.js +20 -1
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/function-authorize-check.js +5 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -1
- package/dist/src/lib/function-authorize-view.d.ts +9 -0
- package/dist/src/lib/function-authorize-view.js +27 -4
- package/dist/src/lib/function-authorize-view.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +28 -0
- package/dist/src/lib/function-collect.js +129 -2
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.js +31 -2
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-grants-preflight.d.ts +99 -0
- package/dist/src/lib/function-grants-preflight.js +154 -2
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +29 -1
- package/dist/src/lib/function-lint.js +208 -0
- package/dist/src/lib/function-lint.js.map +1 -1
- package/dist/src/lib/function-sync.d.ts +73 -0
- package/dist/src/lib/function-sync.js +107 -2
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/generated-command-status.js +46 -8
- package/dist/src/lib/generated-command-status.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +351 -9
- package/dist/src/lib/generated-config-surfaces.js +1009 -24
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/hosting-trust-step.d.ts +67 -0
- package/dist/src/lib/hosting-trust-step.js +279 -0
- package/dist/src/lib/hosting-trust-step.js.map +1 -0
- package/dist/src/lib/hosting-trust.d.ts +77 -0
- package/dist/src/lib/hosting-trust.js +194 -0
- package/dist/src/lib/hosting-trust.js.map +1 -0
- package/dist/src/lib/primitive-declaration.js +89 -10
- package/dist/src/lib/primitive-declaration.js.map +1 -1
- package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
- package/dist/src/lib/refresh-admin-credentials.js +85 -29
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/refresh-stored-login.d.ts +85 -0
- package/dist/src/lib/refresh-stored-login.js +233 -0
- package/dist/src/lib/refresh-stored-login.js.map +1 -0
- package/dist/src/lib/row-field-rename.d.ts +18 -0
- package/dist/src/lib/row-field-rename.js +32 -0
- package/dist/src/lib/row-field-rename.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +13 -2
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +24 -1
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -1
- package/dist/src/lib/schema-defs-module.d.ts +29 -0
- package/dist/src/lib/schema-defs-module.js +103 -0
- package/dist/src/lib/schema-defs-module.js.map +1 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +6 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +74 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -1
- package/dist/src/lib/toml-list-edit.d.ts +33 -0
- package/dist/src/lib/toml-list-edit.js +481 -0
- package/dist/src/lib/toml-list-edit.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
- package/dist/src/lib/toml-scalar-edit.js +67 -1
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/usage-meters.d.ts +16 -0
- package/dist/src/lib/usage-meters.js +52 -0
- package/dist/src/lib/usage-meters.js.map +1 -0
- package/dist/src/types/index.d.ts +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin login v2 (#5979) — the tables `primitive auth sessions list` and
|
|
3
|
+
* `primitive admins auth-events` print, and the auth-events selector check.
|
|
4
|
+
*
|
|
5
|
+
* Pure: no request is made here, so the commands' output rules are tested
|
|
6
|
+
* directly and their requests only against the live server.
|
|
7
|
+
*/
|
|
8
|
+
import { formatDate } from "./output.js";
|
|
9
|
+
/** The most of a session's user agent the table shows; `--json` carries it whole. */
|
|
10
|
+
export const USER_AGENT_COLUMN_WIDTH = 48;
|
|
11
|
+
const text = (v) => (typeof v === "string" && v ? v : "—");
|
|
12
|
+
/** A user agent cut to the table's column, ending in an ellipsis when cut. */
|
|
13
|
+
export function truncateUserAgent(value) {
|
|
14
|
+
if (typeof value !== "string" || !value)
|
|
15
|
+
return "—";
|
|
16
|
+
return value.length > USER_AGENT_COLUMN_WIDTH ? `${value.slice(0, USER_AGENT_COLUMN_WIDTH - 1)}…` : value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The columns of `primitive auth sessions list`. The login columns appear
|
|
20
|
+
* only when a row on the page was signed in by the browser login v2, so a
|
|
21
|
+
* page of older sessions prints the table it always did.
|
|
22
|
+
*/
|
|
23
|
+
export function sessionTableColumns(rows) {
|
|
24
|
+
const loginColumns = rows.some((row) => typeof row.authMethod === "string" && row.authMethod)
|
|
25
|
+
? [
|
|
26
|
+
{ header: "METHOD", key: "authMethod", format: text },
|
|
27
|
+
{ header: "SIGNED IN", key: "authenticatedAt", format: formatDate },
|
|
28
|
+
{ header: "IP", key: "ip", format: text },
|
|
29
|
+
{ header: "USER AGENT", key: "userAgent", format: truncateUserAgent },
|
|
30
|
+
]
|
|
31
|
+
: [];
|
|
32
|
+
return [
|
|
33
|
+
{ header: "SESSION", key: "sessionId" },
|
|
34
|
+
{ header: "KIND", key: "kind" },
|
|
35
|
+
{ header: "NAME", key: "name", format: text },
|
|
36
|
+
{
|
|
37
|
+
header: "SCOPE",
|
|
38
|
+
key: "scope",
|
|
39
|
+
format: (v) => (Array.isArray(v) ? v.join(",") : String(v ?? "full")),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
header: "APPS",
|
|
43
|
+
key: "apps",
|
|
44
|
+
format: (v) => (Array.isArray(v) && v.length > 0 ? v.join(",") : "—"),
|
|
45
|
+
},
|
|
46
|
+
{ header: "STATUS", key: "status" },
|
|
47
|
+
{ header: "CREATED", key: "createdAt", format: formatDate },
|
|
48
|
+
{ header: "LAST REFRESH", key: "lastRefreshAt", format: formatDate },
|
|
49
|
+
{ header: "EXPIRES", key: "expiresAt", format: formatDate },
|
|
50
|
+
...loginColumns,
|
|
51
|
+
{ header: "CURRENT", key: "current", format: (v) => (v ? "yes" : "") },
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/** The columns of `primitive admins auth-events`. LOGIN is the login's attempt key. */
|
|
55
|
+
export const AUTH_EVENT_COLUMNS = [
|
|
56
|
+
{ header: "TIME", key: "createdAt", format: formatDate },
|
|
57
|
+
{ header: "TYPE", key: "type" },
|
|
58
|
+
{ header: "METHOD", key: "method", format: text },
|
|
59
|
+
{ header: "IP", key: "ip", format: text },
|
|
60
|
+
{ header: "REASON", key: "reason", format: text },
|
|
61
|
+
{ header: "ACTOR", key: "actorAdminId", format: text },
|
|
62
|
+
{ header: "LOGIN", key: "attemptKey", format: text },
|
|
63
|
+
];
|
|
64
|
+
/** The refusal printed when `admins auth-events` names neither or both selectors. */
|
|
65
|
+
export const AUTH_EVENTS_SELECTOR_ERROR = "Name exactly one of <admin-id> and --email.";
|
|
66
|
+
/**
|
|
67
|
+
* Which events `admins auth-events` asks for: the admin id or the address,
|
|
68
|
+
* exactly one of them, or null when it names neither or both.
|
|
69
|
+
*/
|
|
70
|
+
export function authEventsSelector(adminId, email) {
|
|
71
|
+
if (Boolean(adminId) === Boolean(email))
|
|
72
|
+
return null;
|
|
73
|
+
return adminId ? { adminId } : { email: email };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=admin-login-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-login-tables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C,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;KAChF,CAAC;AACJ,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE;IACxD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE;IAC/B,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IACjD,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACzC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IACjD,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE;IACtD,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE;CACrD,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,0BAA0B,GAAG,6CAA6C,CAAC;AAExF;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA2B,EAC3B,KAAyB;IAEzB,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAe,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -41,6 +41,16 @@ export interface FunctionVersionInputFields {
|
|
|
41
41
|
input?: string[] | null;
|
|
42
42
|
/** #5840 — whether this version opens to signed-out callers. */
|
|
43
43
|
signedOut?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* #5844 — the version's `[function] public` options, as push stored them;
|
|
46
|
+
* `null` when it stores none.
|
|
47
|
+
*/
|
|
48
|
+
publicOptions?: {
|
|
49
|
+
cacheSeconds?: number;
|
|
50
|
+
cors?: "*";
|
|
51
|
+
turnstile?: true;
|
|
52
|
+
rate?: "low" | "medium" | "high";
|
|
53
|
+
} | null;
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
46
56
|
* The live version's `authorize` flag and `input` list as the function get
|
|
@@ -325,6 +335,15 @@ export interface RateCounterState {
|
|
|
325
335
|
key: string;
|
|
326
336
|
counters: RateCounterWindow[];
|
|
327
337
|
}
|
|
338
|
+
/** A single-use token's one use, as `GET /admin/api/apps/:appId/spent-tokens/:tokenId` answers it. */
|
|
339
|
+
export interface SpentTokenState {
|
|
340
|
+
tokenId: string;
|
|
341
|
+
/** What kind of token it is, e.g. `"db3-blob-upload"`. */
|
|
342
|
+
purpose: string;
|
|
343
|
+
usedAt: string;
|
|
344
|
+
/** The token's expiry; the row may be removed after it. */
|
|
345
|
+
expiresAt: string | null;
|
|
346
|
+
}
|
|
328
347
|
/** The active user properties schema, as `GET users/properties` answers it. */
|
|
329
348
|
export interface UserPropertiesActive {
|
|
330
349
|
version: number;
|
|
@@ -1381,6 +1400,58 @@ export interface DatabaseBatchOperation {
|
|
|
1381
1400
|
*/
|
|
1382
1401
|
condition?: Record<string, any>;
|
|
1383
1402
|
}
|
|
1403
|
+
/** One place in an app's configuration that names a secret key (#5845). */
|
|
1404
|
+
export interface AppSecretReference {
|
|
1405
|
+
kind: "function-capability" | "cel-rule" | "integration" | "webhook-trigger" | "google-client";
|
|
1406
|
+
id: string;
|
|
1407
|
+
name: string;
|
|
1408
|
+
field: string;
|
|
1409
|
+
}
|
|
1410
|
+
/** What `GET …/secrets/by-key/{key}/references` answers (#5845). */
|
|
1411
|
+
export interface AppSecretReferences {
|
|
1412
|
+
key: string;
|
|
1413
|
+
reserved: boolean;
|
|
1414
|
+
stored: boolean;
|
|
1415
|
+
references: AppSecretReference[];
|
|
1416
|
+
truncated: boolean;
|
|
1417
|
+
}
|
|
1418
|
+
/** One of the caller's admin passkeys, as `GET /admin/api/auth/passkeys` lists it (#5978). */
|
|
1419
|
+
export interface AdminPasskeySummary {
|
|
1420
|
+
passkeyId: string;
|
|
1421
|
+
/** The login app's host the passkey is registered with. */
|
|
1422
|
+
rpId: string;
|
|
1423
|
+
deviceName: string | null;
|
|
1424
|
+
createdAt: string | null;
|
|
1425
|
+
lastUsedAt: string | null;
|
|
1426
|
+
}
|
|
1427
|
+
/** One admin sign-in audit event, as `GET /super-admin/api/auth-events` lists it; `null` for an absent field. */
|
|
1428
|
+
export interface AdminAuthEventItem {
|
|
1429
|
+
eventId: string;
|
|
1430
|
+
type: string;
|
|
1431
|
+
createdAt: string | null;
|
|
1432
|
+
adminId: string | null;
|
|
1433
|
+
email: string | null;
|
|
1434
|
+
method: string | null;
|
|
1435
|
+
ip: string | null;
|
|
1436
|
+
userAgent: string | null;
|
|
1437
|
+
/** The login's hashed attempt key, as the server logs it (`attempt=`). */
|
|
1438
|
+
attemptKey: string | null;
|
|
1439
|
+
sessionId: string | null;
|
|
1440
|
+
reason: string | null;
|
|
1441
|
+
passkeyId: string | null;
|
|
1442
|
+
actorAdminId: string | null;
|
|
1443
|
+
}
|
|
1444
|
+
/** What a sign-in reset answers (#5978). */
|
|
1445
|
+
export interface AdminSignInReset {
|
|
1446
|
+
adminId: string;
|
|
1447
|
+
/** Passkey rows this reset deleted. */
|
|
1448
|
+
passkeysRemoved: number;
|
|
1449
|
+
/** Whether a bound Google account was cleared. */
|
|
1450
|
+
googleSubjectCleared: boolean;
|
|
1451
|
+
resetAt: string;
|
|
1452
|
+
/** False when some passkey rows were left; they can no longer sign in, and a second reset removes them. */
|
|
1453
|
+
cleanupComplete: boolean;
|
|
1454
|
+
}
|
|
1384
1455
|
export declare class ApiClient {
|
|
1385
1456
|
/**
|
|
1386
1457
|
* Loaded on first use (`ensureAuthenticated`), never in a constructor.
|
|
@@ -1403,6 +1474,8 @@ export declare class ApiClient {
|
|
|
1403
1474
|
private ensureAuthenticated;
|
|
1404
1475
|
private refreshToken;
|
|
1405
1476
|
request<T = any>(path: string, options?: RequestInit): Promise<T>;
|
|
1477
|
+
/** The HTTP status of the last request `request` answered without throwing. */
|
|
1478
|
+
private lastStatus;
|
|
1406
1479
|
/**
|
|
1407
1480
|
* Whether a 403 should be retried with the stored step-up: it names
|
|
1408
1481
|
* `admin` among the missing scopes, or it is a protected app's refusal of
|
|
@@ -1655,6 +1728,8 @@ export declare class ApiClient {
|
|
|
1655
1728
|
getUserWalk(appId: string, runId: string): Promise<UserWalkAnswer>;
|
|
1656
1729
|
/** A rate counter's state by key (`GET /admin/api/apps/:appId/rate-counters/:key`). */
|
|
1657
1730
|
getRateCounter(appId: string, key: string): Promise<RateCounterState>;
|
|
1731
|
+
/** A spent token of the app by id (`GET /admin/api/apps/:appId/spent-tokens/:tokenId`); 404 when it has not been used. */
|
|
1732
|
+
getSpentToken(appId: string, tokenId: string): Promise<SpentTokenState>;
|
|
1658
1733
|
/** Stop a users walk (`POST /admin/api/apps/:appId/users/walks/:runId/terminate`); batches in flight finish. */
|
|
1659
1734
|
terminateUserWalk(appId: string, runId: string): Promise<UserWalkAnswer & {
|
|
1660
1735
|
terminated: boolean;
|
|
@@ -1833,6 +1908,25 @@ export declare class ApiClient {
|
|
|
1833
1908
|
* its `inviteToken` (the bearer credential an accept link carries) and its
|
|
1834
1909
|
* `status`. Readable by an app admin/owner or the inviter.
|
|
1835
1910
|
*/
|
|
1911
|
+
/**
|
|
1912
|
+
* What an invitation shows before anyone signs in (#5848), by its token.
|
|
1913
|
+
* The route reads no credential.
|
|
1914
|
+
*/
|
|
1915
|
+
previewInvitation(appId: string, inviteToken: string): Promise<{
|
|
1916
|
+
appName: string;
|
|
1917
|
+
appIconUrl: string | null;
|
|
1918
|
+
inviterName: string | null;
|
|
1919
|
+
role: string;
|
|
1920
|
+
shared: Array<{
|
|
1921
|
+
kind: "db3" | "group" | "collection";
|
|
1922
|
+
title: string;
|
|
1923
|
+
level: string;
|
|
1924
|
+
}>;
|
|
1925
|
+
sharedTruncated: boolean;
|
|
1926
|
+
maskedEmail: string;
|
|
1927
|
+
status: "pending" | "expired" | "accepted";
|
|
1928
|
+
expiresAt: string | null;
|
|
1929
|
+
}>;
|
|
1836
1930
|
getInvitation(appId: string, invitationId: string): Promise<{
|
|
1837
1931
|
invitationId: string;
|
|
1838
1932
|
email: string;
|
|
@@ -1929,6 +2023,12 @@ export declare class ApiClient {
|
|
|
1929
2023
|
summary?: string;
|
|
1930
2024
|
}): Promise<any>;
|
|
1931
2025
|
deleteAppSecret(appId: string, secretId: string): Promise<any>;
|
|
2026
|
+
/**
|
|
2027
|
+
* What in the app's configuration names a secret key (#5845, beta): `{ key,
|
|
2028
|
+
* reserved, stored, references: [{ kind, id, name, field }], truncated }`.
|
|
2029
|
+
* Answers for any key, stored or not; never a value.
|
|
2030
|
+
*/
|
|
2031
|
+
getAppSecretReferences(appId: string, key: string): Promise<AppSecretReferences>;
|
|
1932
2032
|
listAppConfigVars(appId: string): Promise<any[]>;
|
|
1933
2033
|
upsertAppConfigVar(appId: string, key: string, payload: {
|
|
1934
2034
|
value: string;
|
|
@@ -2226,6 +2326,45 @@ export declare class ApiClient {
|
|
|
2226
2326
|
sessionId: string;
|
|
2227
2327
|
revokedAt: string;
|
|
2228
2328
|
}>;
|
|
2329
|
+
/** The caller's admin passkeys under every relying party, newest first (#5978). */
|
|
2330
|
+
listAdminPasskeys(): Promise<{
|
|
2331
|
+
items: AdminPasskeySummary[];
|
|
2332
|
+
hasMore: boolean;
|
|
2333
|
+
}>;
|
|
2334
|
+
/**
|
|
2335
|
+
* One page of an admin's, or an address's, sign-in audit events, newest
|
|
2336
|
+
* first (super-admin). Exactly one of `adminId` and `email` is sent.
|
|
2337
|
+
*/
|
|
2338
|
+
listAdminAuthEvents(params: {
|
|
2339
|
+
adminId?: string;
|
|
2340
|
+
email?: string;
|
|
2341
|
+
limit?: number;
|
|
2342
|
+
cursor?: string;
|
|
2343
|
+
}): Promise<{
|
|
2344
|
+
items: AdminAuthEventItem[];
|
|
2345
|
+
hasMore: boolean;
|
|
2346
|
+
nextCursor: string | null;
|
|
2347
|
+
}>;
|
|
2348
|
+
/** Delete one of the caller's admin passkeys (#5978). */
|
|
2349
|
+
deleteAdminPasskey(passkeyId: string): Promise<{
|
|
2350
|
+
passkeyId: string;
|
|
2351
|
+
deleted: boolean;
|
|
2352
|
+
}>;
|
|
2353
|
+
/**
|
|
2354
|
+
* Reset another admin's sign-in (#5978, super-admin): clear their passkeys
|
|
2355
|
+
* and bound Google account. The route needs an unpinned `admin` step-up,
|
|
2356
|
+
* so a usable stored one is sent first; otherwise the login is, and the
|
|
2357
|
+
* server's refusal names the step-up command.
|
|
2358
|
+
*/
|
|
2359
|
+
resetAdminSignIn(adminId: string): Promise<AdminSignInReset>;
|
|
2360
|
+
/**
|
|
2361
|
+
* Send one request with the stored step-up when it can act on a platform
|
|
2362
|
+
* route that needs `admin`: unexpired, holding `admin`, and unpinned.
|
|
2363
|
+
* Answers `{ sent: false }` when there is no such step-up, or when the
|
|
2364
|
+
* server answered it 401 (it is dropped); the caller then sends the login.
|
|
2365
|
+
* Any other refusal throws as `request` would.
|
|
2366
|
+
*/
|
|
2367
|
+
private sendWithAdminStepUp;
|
|
2229
2368
|
listLocks(appId: string): Promise<{
|
|
2230
2369
|
locks: any[];
|
|
2231
2370
|
}>;
|
|
@@ -3601,6 +3740,21 @@ export declare class ApiClient {
|
|
|
3601
3740
|
record: unknown;
|
|
3602
3741
|
values: Record<string, number>;
|
|
3603
3742
|
}>;
|
|
3743
|
+
/**
|
|
3744
|
+
* `POST db3/:id/records/:model/clear` (#5994): empty one model in one
|
|
3745
|
+
* operation; `{ ok, model, rows, lsn, epoch, dropped, cost }`.
|
|
3746
|
+
*/
|
|
3747
|
+
clearDb3Model(appId: string, db3Id: string, modelName: string, body?: {
|
|
3748
|
+
drop?: boolean;
|
|
3749
|
+
}): Promise<{
|
|
3750
|
+
ok: boolean;
|
|
3751
|
+
model: string;
|
|
3752
|
+
rows: number;
|
|
3753
|
+
lsn: number | null;
|
|
3754
|
+
epoch: number | null;
|
|
3755
|
+
dropped: boolean;
|
|
3756
|
+
cost?: unknown;
|
|
3757
|
+
}>;
|
|
3604
3758
|
/** `GET db3/:id/sync` (#4799): `{ id, sync }`. */
|
|
3605
3759
|
getDb3Sync(appId: string, db3Id: string): Promise<{
|
|
3606
3760
|
id: string;
|
|
@@ -3623,6 +3777,89 @@ export declare class ApiClient {
|
|
|
3623
3777
|
level: string | null;
|
|
3624
3778
|
changed: boolean;
|
|
3625
3779
|
}>;
|
|
3780
|
+
/**
|
|
3781
|
+
* `PUT db3/:id/public-access` (#5842): mark the db3 public at `reader`, or
|
|
3782
|
+
* clear it with null; `signedOutAccess` is the app's setting, which decides
|
|
3783
|
+
* whether the value is honoured yet.
|
|
3784
|
+
*/
|
|
3785
|
+
setDb3PublicAccess(appId: string, db3Id: string, level: "reader" | null): Promise<{
|
|
3786
|
+
id: string;
|
|
3787
|
+
level: "reader" | null;
|
|
3788
|
+
changed: boolean;
|
|
3789
|
+
signedOutAccess: boolean;
|
|
3790
|
+
}>;
|
|
3791
|
+
/** `GET db3/:id/link-access`: `{ documentId, linkAccess, … }`, `linkAccess` null when off. */
|
|
3792
|
+
getDb3LinkAccess(appId: string, db3Id: string): Promise<{
|
|
3793
|
+
documentId: string;
|
|
3794
|
+
linkAccess: string | null;
|
|
3795
|
+
[key: string]: unknown;
|
|
3796
|
+
}>;
|
|
3797
|
+
/** `PUT db3/:id/link-access`: let anyone in the app with the id open the db3 at `level`. */
|
|
3798
|
+
setDb3LinkAccess(appId: string, db3Id: string, level: "reader" | "read-write"): Promise<any>;
|
|
3799
|
+
/** `DELETE db3/:id/link-access`: turn the db3's link access off. */
|
|
3800
|
+
clearDb3LinkAccess(appId: string, db3Id: string): Promise<any>;
|
|
3801
|
+
/** `GET db3/:id/permissions`: the db3's user grants, a bare array of `{ userId, email, name, permission, grantedAt }`. */
|
|
3802
|
+
listDb3Permissions(appId: string, db3Id: string): Promise<any[]>;
|
|
3803
|
+
/**
|
|
3804
|
+
* `PUT db3/:id/permissions`: grant one user, named by `userId` or `email`,
|
|
3805
|
+
* a level; `sendEmail` tells them, with `documentUrl` and `note` in the email.
|
|
3806
|
+
*/
|
|
3807
|
+
grantDb3Permission(appId: string, db3Id: string, entry: {
|
|
3808
|
+
userId?: string;
|
|
3809
|
+
email?: string;
|
|
3810
|
+
permission: string;
|
|
3811
|
+
}, email?: {
|
|
3812
|
+
sendEmail?: boolean;
|
|
3813
|
+
documentUrl?: string;
|
|
3814
|
+
note?: string;
|
|
3815
|
+
}): Promise<any>;
|
|
3816
|
+
/** `DELETE db3/:id/permissions/:userId`, or `DELETE db3/:id/permissions?email=` for an email: revoke one user's grant. */
|
|
3817
|
+
revokeDb3Permission(appId: string, db3Id: string, target: {
|
|
3818
|
+
userId?: string;
|
|
3819
|
+
email?: string;
|
|
3820
|
+
}): Promise<any>;
|
|
3821
|
+
/** `GET db3/:id/group-permissions`: the db3's group grants, a bare array; `includeSystem` adds system groups'. */
|
|
3822
|
+
listDb3GroupPermissions(appId: string, db3Id: string, options?: {
|
|
3823
|
+
includeSystem?: boolean;
|
|
3824
|
+
}): Promise<any[]>;
|
|
3825
|
+
/** `POST db3/:id/group-permissions`: grant a group, named by its id, a level. */
|
|
3826
|
+
grantDb3GroupPermission(appId: string, db3Id: string, groupId: string, permission: string): Promise<any>;
|
|
3827
|
+
/** `DELETE db3/:id/group-permissions/:groupId`: revoke a group's grant. */
|
|
3828
|
+
revokeDb3GroupPermission(appId: string, db3Id: string, groupId: string): Promise<any>;
|
|
3829
|
+
/** `GET db3/:id/pending-invitations`: `{ items }`, the grants waiting for an address to join the app. */
|
|
3830
|
+
listDb3PendingInvitations(appId: string, db3Id: string): Promise<{
|
|
3831
|
+
items: any[];
|
|
3832
|
+
}>;
|
|
3833
|
+
/** `DELETE db3/:id/pending-invitations/:invitationId`: cancel a pending invitation's grants on this db3. */
|
|
3834
|
+
revokeDb3PendingInvitation(appId: string, db3Id: string, invitationId: string): Promise<any>;
|
|
3835
|
+
/** `GET db3/:id/access-requests`: the pending access requests, a bare array. */
|
|
3836
|
+
listDb3AccessRequests(appId: string, db3Id: string): Promise<any[]>;
|
|
3837
|
+
/**
|
|
3838
|
+
* `POST db3/:id/access-requests`: the signed-in caller asks for access.
|
|
3839
|
+
* `created` is true when the request is new (201) and false when the
|
|
3840
|
+
* caller's pending request was updated (200).
|
|
3841
|
+
*/
|
|
3842
|
+
createDb3AccessRequest(appId: string, db3Id: string, body: {
|
|
3843
|
+
permission: string;
|
|
3844
|
+
message?: string;
|
|
3845
|
+
documentUrl?: string;
|
|
3846
|
+
reviewUrl?: string;
|
|
3847
|
+
sendEmail?: boolean;
|
|
3848
|
+
}): Promise<{
|
|
3849
|
+
answer: any;
|
|
3850
|
+
created: boolean;
|
|
3851
|
+
}>;
|
|
3852
|
+
/** `POST db3/:id/access-requests/:requestId/approve`: grant the requested level, or `permission`. */
|
|
3853
|
+
approveDb3AccessRequest(appId: string, db3Id: string, requestId: string, body?: {
|
|
3854
|
+
permission?: string;
|
|
3855
|
+
documentUrl?: string;
|
|
3856
|
+
}): Promise<any>;
|
|
3857
|
+
/** `POST db3/:id/access-requests/:requestId/deny`: deny the request. */
|
|
3858
|
+
denyDb3AccessRequest(appId: string, db3Id: string, requestId: string, body?: {
|
|
3859
|
+
documentUrl?: string;
|
|
3860
|
+
}): Promise<any>;
|
|
3861
|
+
/** `POST db3/:id/validate-access` with `{ userId }`: a named user's effective access to the db3. */
|
|
3862
|
+
validateDb3AccessForUser(appId: string, db3Id: string, userId: string): Promise<any>;
|
|
3626
3863
|
/** One custodian's db3s through the admin API (#4800): `custodian` is `app` or `user:<userId>`. */
|
|
3627
3864
|
listDb3ByCustodian(appId: string, custodian: string, params?: {
|
|
3628
3865
|
limit?: number;
|
|
@@ -3681,6 +3918,10 @@ export declare class ApiClient {
|
|
|
3681
3918
|
schema?: string | null;
|
|
3682
3919
|
metadataManifest?: any;
|
|
3683
3920
|
expectedModifiedAt?: string;
|
|
3921
|
+
/** #6020 — `true` archives the type, `false` or `null` unarchives it; omitted keeps it. */
|
|
3922
|
+
archived?: boolean | null;
|
|
3923
|
+
/** #5998 — who creates db3s of the type: `"admins"`, or `"members"`/`null` for every member; omitted keeps it. */
|
|
3924
|
+
create?: "admins" | "members" | null;
|
|
3684
3925
|
}, options?: {
|
|
3685
3926
|
dryRun?: boolean;
|
|
3686
3927
|
allowFieldRemoval?: boolean;
|