primitive-admin 1.2.0-alpha.14 → 1.2.0-alpha.15
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 +102 -78
- package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
- package/dist/bin/primitive.js +11 -82
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +79 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.js +2 -0
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +183 -12
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +2 -0
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps.js +19 -2
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.js +11 -1
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/collections.js +13 -0
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +40 -9
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.js +2 -0
- package/dist/src/commands/db3-types.js.map +1 -1
- package/dist/src/commands/db3.d.ts +12 -0
- package/dist/src/commands/db3.js +343 -24
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.d.ts +52 -12
- package/dist/src/commands/documents.js +120 -29
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +72 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/functions.js +47 -10
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +18 -3
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/init.js +7 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +80 -47
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.js +2 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +41 -0
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +73 -47
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.js +2 -0
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/secrets.js +45 -3
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +243 -12
- package/dist/src/commands/sync.js +1474 -314
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +879 -16
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +748 -95
- package/dist/src/lib/api-client.js +356 -158
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +9 -15
- package/dist/src/lib/block-selector.js +9 -20
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +8 -0
- package/dist/src/lib/cli-manifest.js +10 -1
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/cli-version.d.ts +14 -0
- package/dist/src/lib/cli-version.js +38 -0
- package/dist/src/lib/cli-version.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
- package/dist/src/lib/command-status.d.ts +110 -0
- package/dist/src/lib/command-status.js +184 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +6 -0
- package/dist/src/lib/config-object-descriptor.js +71 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +11 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +11 -5
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +95 -0
- package/dist/src/lib/db-type-records.js +219 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +51 -14
- package/dist/src/lib/db3-export.js +135 -27
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-index-output.d.ts +68 -3
- package/dist/src/lib/db3-index-output.js +139 -3
- package/dist/src/lib/db3-index-output.js.map +1 -1
- package/dist/src/lib/db3-type-models.d.ts +39 -7
- package/dist/src/lib/db3-type-models.js +138 -27
- package/dist/src/lib/db3-type-models.js.map +1 -1
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +1 -1
- package/dist/src/lib/function-authorize-check.js +2 -1
- package/dist/src/lib/function-authorize-check.js.map +1 -1
- package/dist/src/lib/function-authorize-view.js +4 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +106 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +2 -0
- package/dist/src/lib/function-collect.js +36 -7
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +57 -40
- package/dist/src/lib/function-db-types.js +246 -285
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +1 -1
- package/dist/src/lib/function-run.js +1 -1
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +58 -18
- package/dist/src/lib/function-schema-codegen.js +85 -74
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +38 -4
- package/dist/src/lib/function-sync.js +83 -14
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +171 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +211 -11
- package/dist/src/lib/generated-config-surfaces.js +579 -69
- 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/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +1 -1
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +143 -0
- package/dist/src/lib/primitive-declaration.js +658 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +82 -98
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/prompt-schema-document.d.ts +35 -0
- package/dist/src/lib/prompt-schema-document.js +92 -0
- package/dist/src/lib/prompt-schema-document.js.map +1 -0
- package/dist/src/lib/prompt-schema-refs.d.ts +164 -0
- package/dist/src/lib/prompt-schema-refs.js +452 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +12 -2
- package/dist/src/lib/records-verbs.js +7 -2
- package/dist/src/lib/records-verbs.js.map +1 -1
- package/dist/src/lib/register-commands.d.ts +28 -0
- package/dist/src/lib/register-commands.js +101 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +221 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +209 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +379 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
- package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +35 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +128 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
- package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
- package/dist/src/lib/swift-codegen/banners.js +12 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
- package/dist/src/lib/swift-codegen/functionGenerator.js +167 -50
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
- package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +120 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +37 -5
- package/dist/src/lib/sync-resource-types.js +53 -5
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +2 -1
- package/dist/src/lib/toml-database-config.js +4 -3
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-scalar-edit.js +6 -4
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/types/index.d.ts +13 -34
- package/package.json +5 -3
|
@@ -2,8 +2,11 @@ import { loadCredentials, saveCredentials, isTokenExpiringSoon, } from "./config
|
|
|
2
2
|
import { getCurrentEnvNameSafe, getProjectConfig } from "./env-resolver.js";
|
|
3
3
|
import { pinRefusalHint } from "./pin-refusal-hint.js";
|
|
4
4
|
import { fetchWithTLS } from "./fetch.js";
|
|
5
|
+
import { CLI_VERSION_HEADER, cliVersionHeaderValue } from "./cli-version.js";
|
|
5
6
|
import { paginateAll, normalizeCliListEnvelope } from "./paginate.js";
|
|
6
7
|
import { RefreshError, refreshAdminCredentials, } from "./refresh-admin-credentials.js";
|
|
8
|
+
/** The `X-Primitive-CLI-Version` value, read from the package file once per process. */
|
|
9
|
+
let cliVersion;
|
|
7
10
|
/**
|
|
8
11
|
* Page size the admin per-user inventories are asked for (#3399).
|
|
9
12
|
*
|
|
@@ -239,6 +242,8 @@ export class ApiClient {
|
|
|
239
242
|
Authorization: `Bearer ${accessToken}`,
|
|
240
243
|
"Content-Type": "application/json",
|
|
241
244
|
...(options.headers || {}),
|
|
245
|
+
// #5532 — every request names the CLI version that sent it.
|
|
246
|
+
[CLI_VERSION_HEADER]: (cliVersion ??= cliVersionHeaderValue()),
|
|
242
247
|
};
|
|
243
248
|
// Include globalAdminAppId if available (required for admin API calls)
|
|
244
249
|
if (credentials.globalAdminAppId) {
|
|
@@ -516,6 +521,15 @@ export class ApiClient {
|
|
|
516
521
|
async addUserByEmail(appId, data) {
|
|
517
522
|
return this.post(`/admin/api/apps/${appId}/users/add-by-email`, data);
|
|
518
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Invite an email to the app as a console admin
|
|
526
|
+
* (`POST /admin/api/apps/:appId/users/invite`): the invitation, with its
|
|
527
|
+
* `inviteToken` and the `initialProperties` it gives the invitee at
|
|
528
|
+
* acceptance (filling only what they have not set).
|
|
529
|
+
*/
|
|
530
|
+
async inviteUser(appId, data) {
|
|
531
|
+
return this.post(`/admin/api/apps/${appId}/users/invite`, data);
|
|
532
|
+
}
|
|
519
533
|
/**
|
|
520
534
|
* Set a member's display name and/or avatar URL
|
|
521
535
|
* (`PATCH /admin/api/apps/:appId/users/:userId/profile`). An omitted field
|
|
@@ -530,6 +544,164 @@ export class ApiClient {
|
|
|
530
544
|
async rebuildUserSearchText(appId) {
|
|
531
545
|
return this.post(`/admin/api/apps/${appId}/users/rebuild-search-text`, {});
|
|
532
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* One page of an app's users from the user index
|
|
549
|
+
* (`POST /admin/api/apps/:appId/users/query`): the records-query filter and
|
|
550
|
+
* sort over base fields and `properties.<name>`, at most 1,000 per page.
|
|
551
|
+
*/
|
|
552
|
+
async queryUsers(appId, body) {
|
|
553
|
+
return this.post(`/admin/api/apps/${appId}/users/query`, body);
|
|
554
|
+
}
|
|
555
|
+
/** How many of an app's users match (`POST /admin/api/apps/:appId/users/count`). */
|
|
556
|
+
async countUsers(appId, body) {
|
|
557
|
+
return this.post(`/admin/api/apps/${appId}/users/count`, body);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* The state of an app's user index (`GET /admin/api/apps/:appId/users/index`):
|
|
561
|
+
* the generation, each shard with its bound and counts, superseded
|
|
562
|
+
* generations, a rebuild in progress, queued applies, the last apply and
|
|
563
|
+
* reconciliation, the limits and whether the shard ceiling is reached.
|
|
564
|
+
*/
|
|
565
|
+
async getUserIndexStatus(appId) {
|
|
566
|
+
return this.get(`/admin/api/apps/${appId}/users/index`);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Start a report of which user metadata categories still hold rows on the
|
|
570
|
+
* app's current members (`POST /admin/api/apps/:appId/users/metadata-report`).
|
|
571
|
+
*/
|
|
572
|
+
async startUserMetadataReport(appId) {
|
|
573
|
+
return this.post(`/admin/api/apps/${appId}/users/metadata-report`, {});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Read a user metadata report run, or the app's newest when `runId` is
|
|
577
|
+
* absent (`GET /admin/api/apps/:appId/users/metadata-report`).
|
|
578
|
+
*/
|
|
579
|
+
async getUserMetadataReport(appId, runId) {
|
|
580
|
+
const query = runId ? `?runId=${encodeURIComponent(runId)}` : "";
|
|
581
|
+
return this.get(`/admin/api/apps/${appId}/users/metadata-report${query}`);
|
|
582
|
+
}
|
|
583
|
+
/** Start building the next generation of an app's user index (`POST /admin/api/apps/:appId/users/index/rebuild`). */
|
|
584
|
+
async rebuildUserIndex(appId) {
|
|
585
|
+
return this.post(`/admin/api/apps/${appId}/users/index/rebuild`, {});
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Run one revalidation slice of an app's user index now
|
|
589
|
+
* (`POST /admin/api/apps/:appId/users/index/reconcile`), answered when it is
|
|
590
|
+
* done; `started: false` while the app is being deleted.
|
|
591
|
+
*/
|
|
592
|
+
async reconcileUserIndex(appId) {
|
|
593
|
+
return this.post(`/admin/api/apps/${appId}/users/index/reconcile`, {});
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Start (or find) a walk over an app's users with the admin as its starter
|
|
597
|
+
* (`POST /admin/api/apps/:appId/users/walks`); `existing` says the key named
|
|
598
|
+
* a walk that already existed.
|
|
599
|
+
*/
|
|
600
|
+
async startUserWalk(appId, body) {
|
|
601
|
+
return this.post(`/admin/api/apps/${appId}/users/walks`, body);
|
|
602
|
+
}
|
|
603
|
+
/** A users walk by its run id (`GET /admin/api/apps/:appId/users/walks/:runId`). */
|
|
604
|
+
async getUserWalk(appId, runId) {
|
|
605
|
+
return this.get(`/admin/api/apps/${appId}/users/walks/${encodeURIComponent(runId)}`);
|
|
606
|
+
}
|
|
607
|
+
/** Stop a users walk (`POST /admin/api/apps/:appId/users/walks/:runId/terminate`); batches in flight finish. */
|
|
608
|
+
async terminateUserWalk(appId, runId) {
|
|
609
|
+
return this.post(`/admin/api/apps/${appId}/users/walks/${encodeURIComponent(runId)}/terminate`, {});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* An app's user index limit overrides and the limits in effect, with the
|
|
613
|
+
* property caps beside them (`GET /admin/api/apps/:appId/users/index/limits`).
|
|
614
|
+
*/
|
|
615
|
+
async getUserIndexLimits(appId) {
|
|
616
|
+
return this.get(`/admin/api/apps/${appId}/users/index/limits`);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Set (a positive integer) or clear (`null`) an app's user index limit
|
|
620
|
+
* overrides (`PATCH /admin/api/apps/:appId/users/index/limits`).
|
|
621
|
+
*/
|
|
622
|
+
async patchUserIndexLimits(appId, body) {
|
|
623
|
+
return this.patch(`/admin/api/apps/${appId}/users/index/limits`, body);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* An app's user properties schema (`GET /admin/api/apps/:appId/users/properties`):
|
|
627
|
+
* the active version, a push being validated, the removed fields and the caps.
|
|
628
|
+
* While a push validates, this read also resumes its walk.
|
|
629
|
+
*/
|
|
630
|
+
async getUserProperties(appId) {
|
|
631
|
+
return this.get(`/admin/api/apps/${appId}/users/properties`);
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Push the text of `user-properties.toml` (`PUT /admin/api/apps/:appId/users/properties`):
|
|
635
|
+
* 200 `published` or `unchanged`, 400 when refused; `dryRun` judges it and
|
|
636
|
+
* writes nothing.
|
|
637
|
+
*/
|
|
638
|
+
async pushUserProperties(appId, body, options = {}) {
|
|
639
|
+
return this.put(`/admin/api/apps/${appId}/users/properties${options.dryRun ? "?dryRun=true" : ""}`, body);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* The current version of each of an app's `schemas/` files
|
|
643
|
+
* (`GET /admin/api/apps/:appId/schemas`); a tombstoned file only with
|
|
644
|
+
* `includeTombstoned`.
|
|
645
|
+
*/
|
|
646
|
+
async listSchemaFiles(appId, options = {}) {
|
|
647
|
+
return this.get(`/admin/api/apps/${appId}/schemas${options.includeTombstoned ? "?includeTombstoned=true" : ""}`);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* One version of a `schemas/` file, the current one unless `version` names
|
|
651
|
+
* another (`GET /admin/api/apps/:appId/schemas/:file`); 404
|
|
652
|
+
* `SCHEMA_FILE_NOT_FOUND` or `SCHEMA_VERSION_NOT_FOUND`.
|
|
653
|
+
*/
|
|
654
|
+
async getSchemaFile(appId, file, options = {}) {
|
|
655
|
+
const query = options.version !== undefined ? `?version=${encodeURIComponent(String(options.version))}` : "";
|
|
656
|
+
return this.get(`/admin/api/apps/${appId}/schemas/${encodeURIComponent(file)}${query}`);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Push the text of `schemas/<file>.toml` with its compiled defs
|
|
660
|
+
* (`PUT /admin/api/apps/:appId/schemas/:file`): `created` or `unchanged`;
|
|
661
|
+
* 409 `CONFLICT` when the current version is not `expectedVersion`.
|
|
662
|
+
*/
|
|
663
|
+
async pushSchemaFile(appId, file, body) {
|
|
664
|
+
return this.put(`/admin/api/apps/${appId}/schemas/${encodeURIComponent(file)}`, body);
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Write a tombstone version of a `schemas/` file (`PUT
|
|
668
|
+
* /admin/api/apps/:appId/schemas/:file` with `{ tombstone: true }`), pinned
|
|
669
|
+
* to `expectedVersion` when given.
|
|
670
|
+
*/
|
|
671
|
+
async tombstoneSchemaFile(appId, file, expectedVersion) {
|
|
672
|
+
return this.put(`/admin/api/apps/${appId}/schemas/${encodeURIComponent(file)}`, {
|
|
673
|
+
tombstone: true,
|
|
674
|
+
...(expectedVersion !== undefined ? { expectedVersion } : {}),
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* The source of every live `schemas/` file, or of `files` only
|
|
679
|
+
* (`POST /admin/api/apps/:appId/schemas/pull`); a named file with no live
|
|
680
|
+
* version is listed under `missing`.
|
|
681
|
+
*/
|
|
682
|
+
async pullSchemaFiles(appId, files) {
|
|
683
|
+
return this.post(`/admin/api/apps/${appId}/schemas/pull`, files ? { files } : {});
|
|
684
|
+
}
|
|
685
|
+
/** One member with their properties (`GET /admin/api/apps/:appId/users/:userId`); 404 `USER_NOT_FOUND` for a user who is no member. */
|
|
686
|
+
async getAppUser(appId, userId) {
|
|
687
|
+
return this.get(`/admin/api/apps/${appId}/users/${userId}`);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The member who holds a unique property value or a unique constraint's
|
|
691
|
+
* values (`POST /admin/api/apps/:appId/users/get-by`): `{ user }`, null when
|
|
692
|
+
* no member holds it.
|
|
693
|
+
*/
|
|
694
|
+
async getAppUserBy(appId, selector) {
|
|
695
|
+
return this.post(`/admin/api/apps/${appId}/users/get-by`, selector);
|
|
696
|
+
}
|
|
697
|
+
/** Apply a property write to one member (`PATCH /admin/api/apps/:appId/users/:userId/properties`); answers the member after it. */
|
|
698
|
+
async setAppUserProperties(appId, userId, body) {
|
|
699
|
+
return this.patch(`/admin/api/apps/${appId}/users/${userId}/properties`, body);
|
|
700
|
+
}
|
|
701
|
+
/** An aggregate over an app's users (`POST /admin/api/apps/:appId/users/aggregate`). */
|
|
702
|
+
async aggregateUsers(appId, body) {
|
|
703
|
+
return this.post(`/admin/api/apps/${appId}/users/aggregate`, body);
|
|
704
|
+
}
|
|
533
705
|
async listUsers(appId, params) {
|
|
534
706
|
const query = new URLSearchParams();
|
|
535
707
|
if (params?.name)
|
|
@@ -574,36 +746,21 @@ export class ApiClient {
|
|
|
574
746
|
async setUserAvailability(appId, userId, action) {
|
|
575
747
|
return this.put(`/admin/api/apps/${appId}/users/${userId}/${action}`, {});
|
|
576
748
|
}
|
|
577
|
-
// ============================================
|
|
578
|
-
// FEATURE FLAGS (super-admin)
|
|
579
|
-
// ============================================
|
|
580
|
-
/**
|
|
581
|
-
* #2803 — the platform's feature flags. A server-owned admin toggle with a
|
|
582
|
-
* console but, until now, no CLI: the same "one control, both surfaces" rule
|
|
583
|
-
* the carrying types get.
|
|
584
|
-
*/
|
|
585
|
-
async listFeatureFlags() {
|
|
586
|
-
return this.get(`/admin/api/flags`);
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* The flag itself, not the `{ flag }` envelope the route answers with —
|
|
590
|
-
* `feature-flags get` prints the key, the enabled state and the per-app
|
|
591
|
-
* overrides, and reading them off the envelope printed a blank row.
|
|
592
|
-
*/
|
|
593
|
-
async getFeatureFlag(flagKey) {
|
|
594
|
-
const result = await this.get(`/admin/api/flags/${flagKey}`);
|
|
595
|
-
return result?.flag ?? result;
|
|
596
|
-
}
|
|
597
|
-
/** Same envelope, same unwrap: `enable`/`disable` print the updated flag. */
|
|
598
|
-
async setFeatureFlagEnabled(flagKey, enabled) {
|
|
599
|
-
const result = await this.put(`/admin/api/flags/${flagKey}`, { enabled });
|
|
600
|
-
return result?.flag ?? result;
|
|
601
|
-
}
|
|
602
749
|
async updateUserRole(appId, userId, role) {
|
|
603
750
|
return this.put(`/app/${appId}/api/users/${userId}/role`, { role });
|
|
604
751
|
}
|
|
752
|
+
/**
|
|
753
|
+
* Make the app user with `newOwnerEmail` the app's owner; the previous
|
|
754
|
+
* owner becomes an admin. The email resolves to a userId through
|
|
755
|
+
* {@link lookupUserByEmail}, and an email no user of the app has rejects
|
|
756
|
+
* with a message naming it.
|
|
757
|
+
*/
|
|
605
758
|
async transferOwnership(appId, newOwnerEmail) {
|
|
606
|
-
|
|
759
|
+
const lookup = await this.lookupUserByEmail(appId, newOwnerEmail);
|
|
760
|
+
if (!lookup.exists || !lookup.user?.userId) {
|
|
761
|
+
throw new Error(`No user with email ${newOwnerEmail} in app ${appId}`);
|
|
762
|
+
}
|
|
763
|
+
return this.post(`/admin/api/apps/${appId}/users/${lookup.user.userId}/transfer-ownership`, {});
|
|
607
764
|
}
|
|
608
765
|
async transferAdminOwnership(appId, adminId) {
|
|
609
766
|
return this.post(`/admin/api/apps/${appId}/admins/transfer-ownership`, { adminId });
|
|
@@ -639,6 +796,14 @@ export class ApiClient {
|
|
|
639
796
|
hasMore: result?.hasMore ?? nextCursor != null,
|
|
640
797
|
};
|
|
641
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* `GET /app/{appId}/api/invitations/{invitationId}` — one invitation with
|
|
801
|
+
* its `inviteToken` (the bearer credential an accept link carries) and its
|
|
802
|
+
* `status`. Readable by an app admin/owner or the inviter.
|
|
803
|
+
*/
|
|
804
|
+
async getInvitation(appId, invitationId) {
|
|
805
|
+
return this.get(`/app/${appId}/api/invitations/${encodeURIComponent(invitationId)}`);
|
|
806
|
+
}
|
|
642
807
|
async createInvitation(appId, data) {
|
|
643
808
|
return this.post(`/app/${appId}/api/invitations`, data);
|
|
644
809
|
}
|
|
@@ -694,7 +859,7 @@ export class ApiClient {
|
|
|
694
859
|
/**
|
|
695
860
|
* An integration's named configs. Test cases pin a config by NAME so the
|
|
696
861
|
* sidecar is portable across apps (#2769); this is the map pull and push
|
|
697
|
-
* resolve that name through, the same way prompts
|
|
862
|
+
* resolve that name through, the same way prompts do.
|
|
698
863
|
*/
|
|
699
864
|
async listIntegrationConfigs(appId, integrationId) {
|
|
700
865
|
const result = await this.get(`/admin/api/apps/${appId}/integrations/${integrationId}/configs`);
|
|
@@ -788,10 +953,10 @@ export class ApiClient {
|
|
|
788
953
|
// ============================================
|
|
789
954
|
// ── Server functions (#3179) ─────────────────────────────────────────
|
|
790
955
|
//
|
|
791
|
-
// The `functions` family
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
//
|
|
956
|
+
// The `functions` family is a header with the gate and the entry, and
|
|
957
|
+
// append-only immutable config versions carrying the authored TOML bytes,
|
|
958
|
+
// the sources and the built bundle. The listing drains server-side, so it
|
|
959
|
+
// has no cursor.
|
|
795
960
|
async listFunctions(appId) {
|
|
796
961
|
const result = await this.get(`/admin/api/apps/${appId}/functions`);
|
|
797
962
|
return { items: result?.items ?? [] };
|
|
@@ -1277,43 +1442,11 @@ export class ApiClient {
|
|
|
1277
1442
|
async duplicatePromptConfig(appId, promptId, configId, payload) {
|
|
1278
1443
|
return this.post(`/admin/api/apps/${appId}/prompts/${promptId}/configs/${configId}/duplicate`, payload || {});
|
|
1279
1444
|
}
|
|
1280
|
-
// ============================================
|
|
1281
|
-
// SCRIPTS — retained history (#3190)
|
|
1282
|
-
// ============================================
|
|
1283
|
-
//
|
|
1284
|
-
// Scripts retired with the Rhai runtime. A `Script` HEADER
|
|
1285
|
-
// (name/description/activeConfigId) and its versioned `ScriptConfig` rows
|
|
1286
|
-
// stay readable until their retention ends; nothing writes them.
|
|
1287
|
-
async listScripts(appId) {
|
|
1288
|
-
const result = await this.get(`/admin/api/apps/${appId}/scripts`);
|
|
1289
|
-
return { items: result?.items ?? [] };
|
|
1290
|
-
}
|
|
1291
|
-
async getScript(appId, scriptId) {
|
|
1292
|
-
return this.get(`/admin/api/apps/${appId}/scripts/${scriptId}`);
|
|
1293
|
-
}
|
|
1294
|
-
/**
|
|
1295
|
-
* List a script's versioned configs (the `ScriptConfig` rows). Each config
|
|
1296
|
-
* is a distinct block version: `configId` is the stable version selector,
|
|
1297
|
-
* `contentHash` is its content identity, and `status` reports whether it is
|
|
1298
|
-
* `active`/`draft`/`archived`. The script header's `activeConfigId` names
|
|
1299
|
-
* the version that was live. Used by `scripts configs list`.
|
|
1300
|
-
*/
|
|
1301
|
-
async listScriptConfigs(appId, scriptId) {
|
|
1302
|
-
const result = await this.get(`/admin/api/apps/${appId}/scripts/${scriptId}/configs`);
|
|
1303
|
-
return { items: result?.items ?? [] };
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* One version of a script, body included. A body the server cannot load
|
|
1307
|
-
* answers a 404 naming the version rather than an empty body.
|
|
1308
|
-
*/
|
|
1309
|
-
async getScriptConfig(appId, scriptId, configId) {
|
|
1310
|
-
return this.get(`/admin/api/apps/${appId}/scripts/${scriptId}/configs/${configId}`);
|
|
1311
|
-
}
|
|
1312
1445
|
async getPromptSchema(appId, promptId) {
|
|
1313
1446
|
return this.get(`/admin/api/apps/${appId}/prompts/${promptId}/schema`);
|
|
1314
1447
|
}
|
|
1315
1448
|
// ============================================
|
|
1316
|
-
// BLOCK TEST CASES (Prompts, Integrations
|
|
1449
|
+
// BLOCK TEST CASES (Prompts, Integrations)
|
|
1317
1450
|
// ============================================
|
|
1318
1451
|
/**
|
|
1319
1452
|
* One page of a block's test cases. The endpoint paginates (default 50, cap
|
|
@@ -1481,33 +1614,31 @@ export class ApiClient {
|
|
|
1481
1614
|
async runAllTestCases(appId, blockType, blockId, payload) {
|
|
1482
1615
|
return this.post(`/admin/api/apps/${appId}/blocks/${blockType}/${blockId}/test-all`, payload || {});
|
|
1483
1616
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* One page of a block's test runs, newest first. The endpoint paginates
|
|
1619
|
+
* (default 50, cap 100) and reports `nextCursor`.
|
|
1620
|
+
*/
|
|
1621
|
+
async listTestRuns(appId, blockType, blockId, params = {}) {
|
|
1622
|
+
const query = new URLSearchParams();
|
|
1623
|
+
if (params.limit !== undefined)
|
|
1624
|
+
query.set("limit", String(params.limit));
|
|
1625
|
+
if (params.cursor)
|
|
1626
|
+
query.set("cursor", params.cursor);
|
|
1627
|
+
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
1628
|
+
const result = await this.get(`/admin/api/apps/${appId}/blocks/${blockType}/${blockId}/runs${suffix}`);
|
|
1493
1629
|
return {
|
|
1494
1630
|
items: result?.items ?? [],
|
|
1495
1631
|
hasMore: result?.hasMore,
|
|
1496
|
-
nextCursor: result?.nextCursor ??
|
|
1632
|
+
nextCursor: result?.nextCursor ?? undefined,
|
|
1497
1633
|
};
|
|
1498
1634
|
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
const result = await this.get(`/admin/api/apps/${appId}/workflows/${workflowId}/configs`);
|
|
1507
|
-
return { items: result?.items ?? [] };
|
|
1508
|
-
}
|
|
1509
|
-
async getWorkflowConfig(appId, workflowId, configId) {
|
|
1510
|
-
return this.get(`/admin/api/apps/${appId}/workflows/${workflowId}/configs/${configId}`);
|
|
1635
|
+
/**
|
|
1636
|
+
* One of a block's test runs: the object `listTestRuns` lists for it. The
|
|
1637
|
+
* run id travels as one path segment, so a `/`, `?` or `#` in it can never
|
|
1638
|
+
* reach the listing or the query.
|
|
1639
|
+
*/
|
|
1640
|
+
async getTestRun(appId, blockType, blockId, runId) {
|
|
1641
|
+
return this.get(`/admin/api/apps/${appId}/blocks/${blockType}/${blockId}/runs/${encodeURIComponent(runId)}`);
|
|
1511
1642
|
}
|
|
1512
1643
|
// ============================================
|
|
1513
1644
|
// ANALYTICS
|
|
@@ -1542,20 +1673,47 @@ export class ApiClient {
|
|
|
1542
1673
|
async getAnalyticsUserSearch(appId, params) {
|
|
1543
1674
|
return this.get(`/app/${appId}/api/analytics/users/search`, params);
|
|
1544
1675
|
}
|
|
1545
|
-
async getAnalyticsUserDetail(appId, userUlid) {
|
|
1546
|
-
return this.get(`/app/${appId}/api/analytics/users/${userUlid}/detail
|
|
1676
|
+
async getAnalyticsUserDetail(appId, userUlid, params) {
|
|
1677
|
+
return this.get(`/app/${appId}/api/analytics/users/${userUlid}/detail`, params);
|
|
1547
1678
|
}
|
|
1548
|
-
async getAnalyticsUserSnapshot(appId, userUlid) {
|
|
1549
|
-
return this.get(`/app/${appId}/api/analytics/users/${userUlid}/snapshot
|
|
1679
|
+
async getAnalyticsUserSnapshot(appId, userUlid, params) {
|
|
1680
|
+
return this.get(`/app/${appId}/api/analytics/users/${userUlid}/snapshot`, params);
|
|
1550
1681
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1682
|
+
/**
|
|
1683
|
+
* #5251 — `path` with `params` set as `get` sets them, then one appended
|
|
1684
|
+
* `filter[<field>][<operator>]` entry per filter, in order. `get`'s record
|
|
1685
|
+
* cannot hold two entries under one key; the server ANDs them all.
|
|
1686
|
+
*/
|
|
1687
|
+
analyticsFilteredGet(path, params, filters) {
|
|
1688
|
+
if (!filters || filters.length === 0)
|
|
1689
|
+
return this.get(path, params);
|
|
1690
|
+
const query = new URLSearchParams();
|
|
1691
|
+
for (const [key, value] of Object.entries(params ?? {})) {
|
|
1692
|
+
if (value !== undefined && value !== null) {
|
|
1693
|
+
query.set(key, String(value));
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
for (const filter of filters) {
|
|
1697
|
+
query.append(`filter[${filter.field}][${filter.operator}]`, filter.value);
|
|
1698
|
+
}
|
|
1699
|
+
return this.get(`${path}?${query.toString()}`);
|
|
1553
1700
|
}
|
|
1554
|
-
async
|
|
1555
|
-
return this.
|
|
1701
|
+
async getAnalyticsEvents(appId, params, filters) {
|
|
1702
|
+
return this.analyticsFilteredGet(`/app/${appId}/api/analytics/events`, params, filters);
|
|
1556
1703
|
}
|
|
1557
|
-
async
|
|
1558
|
-
return this.
|
|
1704
|
+
async getAnalyticsEventsGrouped(appId, params, filters) {
|
|
1705
|
+
return this.analyticsFilteredGet(`/app/${appId}/api/analytics/events/grouped`, params, filters);
|
|
1706
|
+
}
|
|
1707
|
+
async getAnalyticsErrorsGroups(appId, params, filters) {
|
|
1708
|
+
return this.analyticsFilteredGet(`/app/${appId}/api/analytics/errors/groups`, params, filters);
|
|
1709
|
+
}
|
|
1710
|
+
/** The app's db3 query shapes that read the most rows (#5244). */
|
|
1711
|
+
async getAnalyticsDb3Queries(appId, params) {
|
|
1712
|
+
return this.get(`/app/${appId}/api/analytics/db3/queries`, params);
|
|
1713
|
+
}
|
|
1714
|
+
/** The app's request wall time and DynamoDB round trips per endpoint and function (#5244). */
|
|
1715
|
+
async getAnalyticsRequests(appId, params) {
|
|
1716
|
+
return this.get(`/app/${appId}/api/analytics/requests`, params);
|
|
1559
1717
|
}
|
|
1560
1718
|
async getAnalyticsTopPrompts(appId, params) {
|
|
1561
1719
|
return this.get(`/app/${appId}/api/analytics/prompts/top`, params);
|
|
@@ -1574,7 +1732,7 @@ export class ApiClient {
|
|
|
1574
1732
|
return this.get("/admin/api/me");
|
|
1575
1733
|
}
|
|
1576
1734
|
async listAllAdmins(params) {
|
|
1577
|
-
const result = await this.get("/admin/api/admins", params);
|
|
1735
|
+
const result = await this.get("/super-admin/api/admins", params);
|
|
1578
1736
|
const nextCursor = result?.nextCursor ?? null;
|
|
1579
1737
|
const items = result?.items ?? [];
|
|
1580
1738
|
return {
|
|
@@ -1584,70 +1742,32 @@ export class ApiClient {
|
|
|
1584
1742
|
};
|
|
1585
1743
|
}
|
|
1586
1744
|
async searchAdminByEmail(email) {
|
|
1587
|
-
return this.get("/admin/api/admins/search", { email });
|
|
1745
|
+
return this.get("/super-admin/api/admins/search", { email });
|
|
1588
1746
|
}
|
|
1589
1747
|
async getAdminApps(email) {
|
|
1590
|
-
return this.get(`/admin/api/admins/${encodeURIComponent(email)}/apps`);
|
|
1748
|
+
return this.get(`/super-admin/api/admins/${encodeURIComponent(email)}/apps`);
|
|
1591
1749
|
}
|
|
1592
1750
|
async updateAdminSettings(adminId, data) {
|
|
1593
|
-
return this.patch(`/admin/api/admins/${adminId}`, data);
|
|
1751
|
+
return this.patch(`/super-admin/api/admins/${adminId}`, data);
|
|
1594
1752
|
}
|
|
1595
1753
|
async reindexAdmin(adminId) {
|
|
1596
|
-
return this.post(`/admin/api/admins/${adminId}/reindex`, {});
|
|
1754
|
+
return this.post(`/super-admin/api/admins/${adminId}/reindex`, {});
|
|
1755
|
+
}
|
|
1756
|
+
/** `reindexAdmin` with the route's answer, for callers that print it. */
|
|
1757
|
+
async reindexAdminWithResult(adminId) {
|
|
1758
|
+
return this.post(`/super-admin/api/admins/${adminId}/reindex`, {});
|
|
1597
1759
|
}
|
|
1598
1760
|
// Admin Invitations
|
|
1599
|
-
|
|
1600
|
-
|
|
1761
|
+
/** One address's pending admin invitations; the route requires the address. */
|
|
1762
|
+
async listAllAdminInvitations(email) {
|
|
1763
|
+
const result = await this.get("/super-admin/api/admins/invitations", { email });
|
|
1601
1764
|
return result?.invitations ?? [];
|
|
1602
1765
|
}
|
|
1603
1766
|
async createGlobalAdminInvitation(data) {
|
|
1604
|
-
return this.post("/admin/api/admins/invitations", data);
|
|
1767
|
+
return this.post("/super-admin/api/admins/invitations", data);
|
|
1605
1768
|
}
|
|
1606
1769
|
async deleteGlobalAdminInvitation(invitationId) {
|
|
1607
|
-
return this.delete(`/admin/api/admins/invitations/${invitationId}`);
|
|
1608
|
-
}
|
|
1609
|
-
// ============================================
|
|
1610
|
-
// SUPER ADMIN: CATALOG
|
|
1611
|
-
// ============================================
|
|
1612
|
-
async listPromptCatalog(params) {
|
|
1613
|
-
const result = await this.get("/admin/api/catalog/prompts", params);
|
|
1614
|
-
return {
|
|
1615
|
-
items: result?.items ?? [],
|
|
1616
|
-
hasMore: result?.hasMore,
|
|
1617
|
-
nextCursor: result?.nextCursor ?? null,
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
async getPromptCatalogItem(catalogId) {
|
|
1621
|
-
return this.get(`/admin/api/catalog/prompts/${catalogId}`);
|
|
1622
|
-
}
|
|
1623
|
-
async createPromptCatalogItem(payload) {
|
|
1624
|
-
return this.post("/admin/api/catalog/prompts", payload);
|
|
1625
|
-
}
|
|
1626
|
-
async updatePromptCatalogItem(catalogId, payload) {
|
|
1627
|
-
return this.patch(`/admin/api/catalog/prompts/${catalogId}`, payload);
|
|
1628
|
-
}
|
|
1629
|
-
async deletePromptCatalogItem(catalogId) {
|
|
1630
|
-
return this.delete(`/admin/api/catalog/prompts/${catalogId}`);
|
|
1631
|
-
}
|
|
1632
|
-
async listIntegrationCatalog(params) {
|
|
1633
|
-
const result = await this.get("/admin/api/catalog/integrations", params);
|
|
1634
|
-
return {
|
|
1635
|
-
items: result?.items ?? [],
|
|
1636
|
-
hasMore: result?.hasMore,
|
|
1637
|
-
nextCursor: result?.nextCursor ?? null,
|
|
1638
|
-
};
|
|
1639
|
-
}
|
|
1640
|
-
async getIntegrationCatalogItem(catalogId) {
|
|
1641
|
-
return this.get(`/admin/api/catalog/integrations/${catalogId}`);
|
|
1642
|
-
}
|
|
1643
|
-
async createIntegrationCatalogItem(payload) {
|
|
1644
|
-
return this.post("/admin/api/catalog/integrations", payload);
|
|
1645
|
-
}
|
|
1646
|
-
async updateIntegrationCatalogItem(catalogId, payload) {
|
|
1647
|
-
return this.patch(`/admin/api/catalog/integrations/${catalogId}`, payload);
|
|
1648
|
-
}
|
|
1649
|
-
async deleteIntegrationCatalogItem(catalogId) {
|
|
1650
|
-
return this.delete(`/admin/api/catalog/integrations/${catalogId}`);
|
|
1770
|
+
return this.delete(`/super-admin/api/admins/invitations/${invitationId}`);
|
|
1651
1771
|
}
|
|
1652
1772
|
// ============================================
|
|
1653
1773
|
// BATCH TEST EXECUTION
|
|
@@ -1694,6 +1814,15 @@ export class ApiClient {
|
|
|
1694
1814
|
async testEmailTemplate(appId, emailType, payload) {
|
|
1695
1815
|
return this.post(`/admin/api/apps/${appId}/email-templates/${emailType}/test`, payload || {});
|
|
1696
1816
|
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Render the saved template (or the built-in default) for an email type
|
|
1819
|
+
* without sending it. `variables` override the type's sample values. The
|
|
1820
|
+
* app id and the type are each encoded as one path segment, so no value of
|
|
1821
|
+
* either can select another route.
|
|
1822
|
+
*/
|
|
1823
|
+
async previewEmailTemplate(appId, emailType, payload) {
|
|
1824
|
+
return this.post(`/admin/api/apps/${encodeURIComponent(appId)}/email-templates/${encodeURIComponent(emailType)}/preview`, payload || {});
|
|
1825
|
+
}
|
|
1697
1826
|
// ============================================
|
|
1698
1827
|
// ACCESS TOKENS
|
|
1699
1828
|
// ============================================
|
|
@@ -2529,12 +2658,13 @@ export class ApiClient {
|
|
|
2529
2658
|
}
|
|
2530
2659
|
/**
|
|
2531
2660
|
* Apply an ordered multi-model create/patch/delete blob atomically (issue
|
|
2532
|
-
* #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade)
|
|
2533
|
-
*
|
|
2534
|
-
* `{ applied, added,
|
|
2661
|
+
* #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade): `POST
|
|
2662
|
+
* records/batch`, at most 100 operations. All-or-nothing: a validation
|
|
2663
|
+
* failure commits nothing. Returns the facade's `{ applied, added,
|
|
2664
|
+
* updated, deleted }`, and on a db3 `reads` when the batch carried reads.
|
|
2535
2665
|
*/
|
|
2536
|
-
async
|
|
2537
|
-
return this.post(`/app/${appId}/api/documents/${documentId}/records/
|
|
2666
|
+
async batchDocumentRecords(appId, documentId, operations, extra) {
|
|
2667
|
+
return this.post(`/app/${appId}/api/documents/${documentId}/records/batch` +
|
|
2538
2668
|
this.documentFormatQuery(extra?.documentFormat), { operations });
|
|
2539
2669
|
}
|
|
2540
2670
|
// ============================================
|
|
@@ -2550,8 +2680,9 @@ export class ApiClient {
|
|
|
2550
2680
|
}
|
|
2551
2681
|
/**
|
|
2552
2682
|
* `POST db3/:id/indexes` with `{ model, field | fields, unique?, name? }`,
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2683
|
+
* `{ model, field, members: true }` for a member index, or `{ model, field
|
|
2684
|
+
* | fields, kind: "text", on, text? }` for a text index → `{ index }`. The
|
|
2685
|
+
* route applies the registration rules.
|
|
2555
2686
|
*/
|
|
2556
2687
|
async registerDb3Index(appId, db3Id, body) {
|
|
2557
2688
|
return this.post(`${this.db3Path(appId, db3Id)}/indexes`, body);
|
|
@@ -2560,6 +2691,40 @@ export class ApiClient {
|
|
|
2560
2691
|
async dropDb3Index(appId, db3Id, name) {
|
|
2561
2692
|
return this.delete(`${this.db3Path(appId, db3Id)}/indexes/${encodeURIComponent(name)}`);
|
|
2562
2693
|
}
|
|
2694
|
+
/**
|
|
2695
|
+
* `GET db3/:id/indexes/:name/model` (#5229): a vector index's shared model,
|
|
2696
|
+
* its bytes as uploaded and the `X-Index-Model-*` headers it was uploaded
|
|
2697
|
+
* with.
|
|
2698
|
+
*/
|
|
2699
|
+
async fetchDb3IndexModel(appId, db3Id, name) {
|
|
2700
|
+
const credentials = await this.ensureAuthenticated();
|
|
2701
|
+
const url = `${credentials.serverUrl}${this.db3Path(appId, db3Id)}/indexes/${encodeURIComponent(name)}/model`;
|
|
2702
|
+
const headers = { Authorization: `Bearer ${credentials.accessToken}` };
|
|
2703
|
+
if (credentials.globalAdminAppId)
|
|
2704
|
+
headers["X-Global-Admin-App-Id"] = credentials.globalAdminAppId;
|
|
2705
|
+
const response = await fetchWithTLS(url, { method: "GET", headers });
|
|
2706
|
+
if (!response.ok) {
|
|
2707
|
+
const text = await response.text();
|
|
2708
|
+
const parsed = parseErrorResponse(response, text, url);
|
|
2709
|
+
throw new ApiError(parsed.message, response.status, parsed.code, parsed.details);
|
|
2710
|
+
}
|
|
2711
|
+
const header = (key) => response.headers.get(`X-Index-Model-${key}`) ?? "";
|
|
2712
|
+
return {
|
|
2713
|
+
data: Buffer.from(await response.arrayBuffer()),
|
|
2714
|
+
generation: Number(header("Generation")),
|
|
2715
|
+
revision: Number(header("Revision")),
|
|
2716
|
+
rows: Number(header("Rows")),
|
|
2717
|
+
trainedAt: header("Trained-At"),
|
|
2718
|
+
format: header("Format"),
|
|
2719
|
+
};
|
|
2720
|
+
}
|
|
2721
|
+
/**
|
|
2722
|
+
* `DELETE db3/:id/indexes/:name/model` (#5229) → `{ ok, name, revision }`:
|
|
2723
|
+
* the model (or an upload under way) gone, `revision` the index's new one.
|
|
2724
|
+
*/
|
|
2725
|
+
async deleteDb3IndexModel(appId, db3Id, name) {
|
|
2726
|
+
return this.delete(`${this.db3Path(appId, db3Id)}/indexes/${encodeURIComponent(name)}/model`);
|
|
2727
|
+
}
|
|
2563
2728
|
/** The db3 mount of {@link queryDocumentRecords}: `GET db3/:id/records/:model`. */
|
|
2564
2729
|
async queryDb3Records(appId, db3Id, modelName, queryOptions) {
|
|
2565
2730
|
const query = {};
|
|
@@ -2587,6 +2752,14 @@ export class ApiClient {
|
|
|
2587
2752
|
async aggregateDb3Records(appId, db3Id, modelName, options) {
|
|
2588
2753
|
return this.post(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}/aggregate`, { options });
|
|
2589
2754
|
}
|
|
2755
|
+
/**
|
|
2756
|
+
* `POST db3/:id/records/:model/explain` (#5240): run a query, count or
|
|
2757
|
+
* aggregate on the server, forced onto `index` (or off indexes, `"none"`)
|
|
2758
|
+
* when given, and answer how it read.
|
|
2759
|
+
*/
|
|
2760
|
+
async explainDb3Read(appId, db3Id, modelName, body) {
|
|
2761
|
+
return this.post(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}/explain`, body);
|
|
2762
|
+
}
|
|
2590
2763
|
/** The db3 mount of {@link saveDocumentRecord}: `POST db3/:id/records/:model`. */
|
|
2591
2764
|
async saveDb3Record(appId, db3Id, modelName, body) {
|
|
2592
2765
|
return this.post(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}`, body);
|
|
@@ -2599,9 +2772,20 @@ export class ApiClient {
|
|
|
2599
2772
|
async deleteDb3Record(appId, db3Id, modelName, recordId) {
|
|
2600
2773
|
return this.delete(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}/${encodeURIComponent(recordId)}`);
|
|
2601
2774
|
}
|
|
2602
|
-
/** The db3 mount of {@link
|
|
2603
|
-
async
|
|
2604
|
-
return this.post(`${this.db3Path(appId, db3Id)}/records/
|
|
2775
|
+
/** The db3 mount of {@link batchDocumentRecords}: `POST db3/:id/records/batch`. */
|
|
2776
|
+
async batchDb3Records(appId, db3Id, operations) {
|
|
2777
|
+
return this.post(`${this.db3Path(appId, db3Id)}/records/batch`, { operations });
|
|
2778
|
+
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Several reads of a db3 in one request (#5243): `POST db3/:id/records/batch-read`,
|
|
2781
|
+
* each answered at its index from one state of the db3. `atomic: false`
|
|
2782
|
+
* answers a refused read in its place rather than refusing the request.
|
|
2783
|
+
*/
|
|
2784
|
+
async batchReadDb3Records(appId, db3Id, operations, options = {}) {
|
|
2785
|
+
return this.post(`${this.db3Path(appId, db3Id)}/records/batch-read`, {
|
|
2786
|
+
operations,
|
|
2787
|
+
...(options.atomic === false ? { atomic: false } : {}),
|
|
2788
|
+
});
|
|
2605
2789
|
}
|
|
2606
2790
|
/** The db3 mount of {@link getDocumentSchema}: `GET db3/:id/schema`. */
|
|
2607
2791
|
async getDb3Schema(appId, db3Id) {
|
|
@@ -2731,6 +2915,20 @@ export class ApiClient {
|
|
|
2731
2915
|
const nextCursor = result?.nextCursor;
|
|
2732
2916
|
return { items: result?.items ?? [], nextCursor, hasMore: result?.hasMore ?? nextCursor != null };
|
|
2733
2917
|
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Every db3 a member reaches through the admin API (#5253): held, shared
|
|
2920
|
+
* with them, then app access, each row with its `via`; `via` narrows to
|
|
2921
|
+
* some of the three ways.
|
|
2922
|
+
*/
|
|
2923
|
+
async listDb3ForUser(appId, userId, params) {
|
|
2924
|
+
const result = await this.get(`/admin/api/apps/${appId}/users/${encodeURIComponent(userId)}/db3`, {
|
|
2925
|
+
...(params?.via ? { via: params.via.join(",") } : {}),
|
|
2926
|
+
...(params?.limit !== undefined ? { limit: params.limit } : {}),
|
|
2927
|
+
...(params?.cursor ? { cursor: params.cursor } : {}),
|
|
2928
|
+
});
|
|
2929
|
+
const nextCursor = result?.nextCursor;
|
|
2930
|
+
return { items: result?.items ?? [], nextCursor, hasMore: result?.hasMore ?? nextCursor != null };
|
|
2931
|
+
}
|
|
2734
2932
|
/** Transfer a db3 to `to` (`app` or `user:<userId>`) through the admin API (#4804). */
|
|
2735
2933
|
async transferDb3(appId, db3Id, to) {
|
|
2736
2934
|
return this.post(`/admin/api/apps/${appId}/db3/${encodeURIComponent(db3Id)}/transfer`, { to });
|