primitive-admin 1.2.0-alpha.13 → 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 +220 -18
- 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 +345 -11
- 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 +912 -18
- 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 +779 -95
- package/dist/src/lib/api-client.js +369 -166
- 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 +65 -9
- package/dist/src/lib/db3-export.js +159 -22
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-index-output.d.ts +69 -3
- package/dist/src/lib/db3-index-output.js +142 -4
- 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/log-inspection.d.ts +3 -0
- package/dist/src/lib/log-inspection.js +1 -0
- package/dist/src/lib/log-inspection.js.map +1 -1
- 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/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.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)
|
|
@@ -542,6 +714,8 @@ export class ApiClient {
|
|
|
542
714
|
query.set("limit", String(params.limit));
|
|
543
715
|
if (params?.cursor)
|
|
544
716
|
query.set("cursor", params.cursor);
|
|
717
|
+
if (params?.testUsers)
|
|
718
|
+
query.set("testUsers", params.testUsers);
|
|
545
719
|
const path = query.toString()
|
|
546
720
|
? `/app/${appId}/api/users?${query.toString()}`
|
|
547
721
|
: `/app/${appId}/api/users`;
|
|
@@ -552,6 +726,8 @@ export class ApiClient {
|
|
|
552
726
|
// page boundary rather than inferring one from the cursor (#3646).
|
|
553
727
|
hasMore: result?.hasMore,
|
|
554
728
|
nextCursor: result?.nextCursor ?? null,
|
|
729
|
+
// Rows a `testUsers` filtered read examined (#5104); absent otherwise.
|
|
730
|
+
...(typeof result?.scanned === "number" ? { scanned: result.scanned } : {}),
|
|
555
731
|
};
|
|
556
732
|
}
|
|
557
733
|
/**
|
|
@@ -570,36 +746,21 @@ export class ApiClient {
|
|
|
570
746
|
async setUserAvailability(appId, userId, action) {
|
|
571
747
|
return this.put(`/admin/api/apps/${appId}/users/${userId}/${action}`, {});
|
|
572
748
|
}
|
|
573
|
-
// ============================================
|
|
574
|
-
// FEATURE FLAGS (super-admin)
|
|
575
|
-
// ============================================
|
|
576
|
-
/**
|
|
577
|
-
* #2803 — the platform's feature flags. A server-owned admin toggle with a
|
|
578
|
-
* console but, until now, no CLI: the same "one control, both surfaces" rule
|
|
579
|
-
* the carrying types get.
|
|
580
|
-
*/
|
|
581
|
-
async listFeatureFlags() {
|
|
582
|
-
return this.get(`/admin/api/flags`);
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* The flag itself, not the `{ flag }` envelope the route answers with —
|
|
586
|
-
* `feature-flags get` prints the key, the enabled state and the per-app
|
|
587
|
-
* overrides, and reading them off the envelope printed a blank row.
|
|
588
|
-
*/
|
|
589
|
-
async getFeatureFlag(flagKey) {
|
|
590
|
-
const result = await this.get(`/admin/api/flags/${flagKey}`);
|
|
591
|
-
return result?.flag ?? result;
|
|
592
|
-
}
|
|
593
|
-
/** Same envelope, same unwrap: `enable`/`disable` print the updated flag. */
|
|
594
|
-
async setFeatureFlagEnabled(flagKey, enabled) {
|
|
595
|
-
const result = await this.put(`/admin/api/flags/${flagKey}`, { enabled });
|
|
596
|
-
return result?.flag ?? result;
|
|
597
|
-
}
|
|
598
749
|
async updateUserRole(appId, userId, role) {
|
|
599
750
|
return this.put(`/app/${appId}/api/users/${userId}/role`, { role });
|
|
600
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
|
+
*/
|
|
601
758
|
async transferOwnership(appId, newOwnerEmail) {
|
|
602
|
-
|
|
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`, {});
|
|
603
764
|
}
|
|
604
765
|
async transferAdminOwnership(appId, adminId) {
|
|
605
766
|
return this.post(`/admin/api/apps/${appId}/admins/transfer-ownership`, { adminId });
|
|
@@ -635,6 +796,14 @@ export class ApiClient {
|
|
|
635
796
|
hasMore: result?.hasMore ?? nextCursor != null,
|
|
636
797
|
};
|
|
637
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
|
+
}
|
|
638
807
|
async createInvitation(appId, data) {
|
|
639
808
|
return this.post(`/app/${appId}/api/invitations`, data);
|
|
640
809
|
}
|
|
@@ -690,7 +859,7 @@ export class ApiClient {
|
|
|
690
859
|
/**
|
|
691
860
|
* An integration's named configs. Test cases pin a config by NAME so the
|
|
692
861
|
* sidecar is portable across apps (#2769); this is the map pull and push
|
|
693
|
-
* resolve that name through, the same way prompts
|
|
862
|
+
* resolve that name through, the same way prompts do.
|
|
694
863
|
*/
|
|
695
864
|
async listIntegrationConfigs(appId, integrationId) {
|
|
696
865
|
const result = await this.get(`/admin/api/apps/${appId}/integrations/${integrationId}/configs`);
|
|
@@ -784,10 +953,10 @@ export class ApiClient {
|
|
|
784
953
|
// ============================================
|
|
785
954
|
// ── Server functions (#3179) ─────────────────────────────────────────
|
|
786
955
|
//
|
|
787
|
-
// The `functions` family
|
|
788
|
-
//
|
|
789
|
-
//
|
|
790
|
-
//
|
|
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.
|
|
791
960
|
async listFunctions(appId) {
|
|
792
961
|
const result = await this.get(`/admin/api/apps/${appId}/functions`);
|
|
793
962
|
return { items: result?.items ?? [] };
|
|
@@ -1273,43 +1442,11 @@ export class ApiClient {
|
|
|
1273
1442
|
async duplicatePromptConfig(appId, promptId, configId, payload) {
|
|
1274
1443
|
return this.post(`/admin/api/apps/${appId}/prompts/${promptId}/configs/${configId}/duplicate`, payload || {});
|
|
1275
1444
|
}
|
|
1276
|
-
// ============================================
|
|
1277
|
-
// SCRIPTS — retained history (#3190)
|
|
1278
|
-
// ============================================
|
|
1279
|
-
//
|
|
1280
|
-
// Scripts retired with the Rhai runtime. A `Script` HEADER
|
|
1281
|
-
// (name/description/activeConfigId) and its versioned `ScriptConfig` rows
|
|
1282
|
-
// stay readable until their retention ends; nothing writes them.
|
|
1283
|
-
async listScripts(appId) {
|
|
1284
|
-
const result = await this.get(`/admin/api/apps/${appId}/scripts`);
|
|
1285
|
-
return { items: result?.items ?? [] };
|
|
1286
|
-
}
|
|
1287
|
-
async getScript(appId, scriptId) {
|
|
1288
|
-
return this.get(`/admin/api/apps/${appId}/scripts/${scriptId}`);
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* List a script's versioned configs (the `ScriptConfig` rows). Each config
|
|
1292
|
-
* is a distinct block version: `configId` is the stable version selector,
|
|
1293
|
-
* `contentHash` is its content identity, and `status` reports whether it is
|
|
1294
|
-
* `active`/`draft`/`archived`. The script header's `activeConfigId` names
|
|
1295
|
-
* the version that was live. Used by `scripts configs list`.
|
|
1296
|
-
*/
|
|
1297
|
-
async listScriptConfigs(appId, scriptId) {
|
|
1298
|
-
const result = await this.get(`/admin/api/apps/${appId}/scripts/${scriptId}/configs`);
|
|
1299
|
-
return { items: result?.items ?? [] };
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
* One version of a script, body included. A body the server cannot load
|
|
1303
|
-
* answers a 404 naming the version rather than an empty body.
|
|
1304
|
-
*/
|
|
1305
|
-
async getScriptConfig(appId, scriptId, configId) {
|
|
1306
|
-
return this.get(`/admin/api/apps/${appId}/scripts/${scriptId}/configs/${configId}`);
|
|
1307
|
-
}
|
|
1308
1445
|
async getPromptSchema(appId, promptId) {
|
|
1309
1446
|
return this.get(`/admin/api/apps/${appId}/prompts/${promptId}/schema`);
|
|
1310
1447
|
}
|
|
1311
1448
|
// ============================================
|
|
1312
|
-
// BLOCK TEST CASES (Prompts, Integrations
|
|
1449
|
+
// BLOCK TEST CASES (Prompts, Integrations)
|
|
1313
1450
|
// ============================================
|
|
1314
1451
|
/**
|
|
1315
1452
|
* One page of a block's test cases. The endpoint paginates (default 50, cap
|
|
@@ -1477,33 +1614,31 @@ export class ApiClient {
|
|
|
1477
1614
|
async runAllTestCases(appId, blockType, blockId, payload) {
|
|
1478
1615
|
return this.post(`/admin/api/apps/${appId}/blocks/${blockType}/${blockId}/test-all`, payload || {});
|
|
1479
1616
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
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}`);
|
|
1489
1629
|
return {
|
|
1490
1630
|
items: result?.items ?? [],
|
|
1491
1631
|
hasMore: result?.hasMore,
|
|
1492
|
-
nextCursor: result?.nextCursor ??
|
|
1632
|
+
nextCursor: result?.nextCursor ?? undefined,
|
|
1493
1633
|
};
|
|
1494
1634
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
const result = await this.get(`/admin/api/apps/${appId}/workflows/${workflowId}/configs`);
|
|
1503
|
-
return { items: result?.items ?? [] };
|
|
1504
|
-
}
|
|
1505
|
-
async getWorkflowConfig(appId, workflowId, configId) {
|
|
1506
|
-
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)}`);
|
|
1507
1642
|
}
|
|
1508
1643
|
// ============================================
|
|
1509
1644
|
// ANALYTICS
|
|
@@ -1514,14 +1649,14 @@ export class ApiClient {
|
|
|
1514
1649
|
async getAnalyticsIntegrationMetrics(appId, params) {
|
|
1515
1650
|
return this.get(`/app/${appId}/api/analytics/integrations`, params);
|
|
1516
1651
|
}
|
|
1517
|
-
async getAnalyticsOverviewDau(appId) {
|
|
1518
|
-
return this.get(`/app/${appId}/api/analytics/overview/dau
|
|
1652
|
+
async getAnalyticsOverviewDau(appId, params) {
|
|
1653
|
+
return this.get(`/app/${appId}/api/analytics/overview/dau`, params);
|
|
1519
1654
|
}
|
|
1520
|
-
async getAnalyticsOverviewWau(appId) {
|
|
1521
|
-
return this.get(`/app/${appId}/api/analytics/overview/wau
|
|
1655
|
+
async getAnalyticsOverviewWau(appId, params) {
|
|
1656
|
+
return this.get(`/app/${appId}/api/analytics/overview/wau`, params);
|
|
1522
1657
|
}
|
|
1523
|
-
async getAnalyticsOverviewMau(appId) {
|
|
1524
|
-
return this.get(`/app/${appId}/api/analytics/overview/mau
|
|
1658
|
+
async getAnalyticsOverviewMau(appId, params) {
|
|
1659
|
+
return this.get(`/app/${appId}/api/analytics/overview/mau`, params);
|
|
1525
1660
|
}
|
|
1526
1661
|
async getAnalyticsOverviewGrowth(appId, params) {
|
|
1527
1662
|
return this.get(`/app/${appId}/api/analytics/overview/growth`, params);
|
|
@@ -1532,26 +1667,53 @@ export class ApiClient {
|
|
|
1532
1667
|
async getAnalyticsRollingActive(appId, params) {
|
|
1533
1668
|
return this.get(`/app/${appId}/api/analytics/rolling-active`, params);
|
|
1534
1669
|
}
|
|
1535
|
-
async getAnalyticsCohortRetention(appId) {
|
|
1536
|
-
return this.get(`/app/${appId}/api/analytics/cohort-retention
|
|
1670
|
+
async getAnalyticsCohortRetention(appId, params) {
|
|
1671
|
+
return this.get(`/app/${appId}/api/analytics/cohort-retention`, params);
|
|
1537
1672
|
}
|
|
1538
1673
|
async getAnalyticsUserSearch(appId, params) {
|
|
1539
1674
|
return this.get(`/app/${appId}/api/analytics/users/search`, params);
|
|
1540
1675
|
}
|
|
1541
|
-
async getAnalyticsUserDetail(appId, userUlid) {
|
|
1542
|
-
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);
|
|
1543
1678
|
}
|
|
1544
|
-
async getAnalyticsUserSnapshot(appId, userUlid) {
|
|
1545
|
-
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);
|
|
1546
1681
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
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()}`);
|
|
1549
1700
|
}
|
|
1550
|
-
async
|
|
1551
|
-
return this.
|
|
1701
|
+
async getAnalyticsEvents(appId, params, filters) {
|
|
1702
|
+
return this.analyticsFilteredGet(`/app/${appId}/api/analytics/events`, params, filters);
|
|
1552
1703
|
}
|
|
1553
|
-
async
|
|
1554
|
-
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);
|
|
1555
1717
|
}
|
|
1556
1718
|
async getAnalyticsTopPrompts(appId, params) {
|
|
1557
1719
|
return this.get(`/app/${appId}/api/analytics/prompts/top`, params);
|
|
@@ -1570,7 +1732,7 @@ export class ApiClient {
|
|
|
1570
1732
|
return this.get("/admin/api/me");
|
|
1571
1733
|
}
|
|
1572
1734
|
async listAllAdmins(params) {
|
|
1573
|
-
const result = await this.get("/admin/api/admins", params);
|
|
1735
|
+
const result = await this.get("/super-admin/api/admins", params);
|
|
1574
1736
|
const nextCursor = result?.nextCursor ?? null;
|
|
1575
1737
|
const items = result?.items ?? [];
|
|
1576
1738
|
return {
|
|
@@ -1580,70 +1742,32 @@ export class ApiClient {
|
|
|
1580
1742
|
};
|
|
1581
1743
|
}
|
|
1582
1744
|
async searchAdminByEmail(email) {
|
|
1583
|
-
return this.get("/admin/api/admins/search", { email });
|
|
1745
|
+
return this.get("/super-admin/api/admins/search", { email });
|
|
1584
1746
|
}
|
|
1585
1747
|
async getAdminApps(email) {
|
|
1586
|
-
return this.get(`/admin/api/admins/${encodeURIComponent(email)}/apps`);
|
|
1748
|
+
return this.get(`/super-admin/api/admins/${encodeURIComponent(email)}/apps`);
|
|
1587
1749
|
}
|
|
1588
1750
|
async updateAdminSettings(adminId, data) {
|
|
1589
|
-
return this.patch(`/admin/api/admins/${adminId}`, data);
|
|
1751
|
+
return this.patch(`/super-admin/api/admins/${adminId}`, data);
|
|
1590
1752
|
}
|
|
1591
1753
|
async reindexAdmin(adminId) {
|
|
1592
|
-
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`, {});
|
|
1593
1759
|
}
|
|
1594
1760
|
// Admin Invitations
|
|
1595
|
-
|
|
1596
|
-
|
|
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 });
|
|
1597
1764
|
return result?.invitations ?? [];
|
|
1598
1765
|
}
|
|
1599
1766
|
async createGlobalAdminInvitation(data) {
|
|
1600
|
-
return this.post("/admin/api/admins/invitations", data);
|
|
1767
|
+
return this.post("/super-admin/api/admins/invitations", data);
|
|
1601
1768
|
}
|
|
1602
1769
|
async deleteGlobalAdminInvitation(invitationId) {
|
|
1603
|
-
return this.delete(`/admin/api/admins/invitations/${invitationId}`);
|
|
1604
|
-
}
|
|
1605
|
-
// ============================================
|
|
1606
|
-
// SUPER ADMIN: CATALOG
|
|
1607
|
-
// ============================================
|
|
1608
|
-
async listPromptCatalog(params) {
|
|
1609
|
-
const result = await this.get("/admin/api/catalog/prompts", params);
|
|
1610
|
-
return {
|
|
1611
|
-
items: result?.items ?? [],
|
|
1612
|
-
hasMore: result?.hasMore,
|
|
1613
|
-
nextCursor: result?.nextCursor ?? null,
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
async getPromptCatalogItem(catalogId) {
|
|
1617
|
-
return this.get(`/admin/api/catalog/prompts/${catalogId}`);
|
|
1618
|
-
}
|
|
1619
|
-
async createPromptCatalogItem(payload) {
|
|
1620
|
-
return this.post("/admin/api/catalog/prompts", payload);
|
|
1621
|
-
}
|
|
1622
|
-
async updatePromptCatalogItem(catalogId, payload) {
|
|
1623
|
-
return this.patch(`/admin/api/catalog/prompts/${catalogId}`, payload);
|
|
1624
|
-
}
|
|
1625
|
-
async deletePromptCatalogItem(catalogId) {
|
|
1626
|
-
return this.delete(`/admin/api/catalog/prompts/${catalogId}`);
|
|
1627
|
-
}
|
|
1628
|
-
async listIntegrationCatalog(params) {
|
|
1629
|
-
const result = await this.get("/admin/api/catalog/integrations", params);
|
|
1630
|
-
return {
|
|
1631
|
-
items: result?.items ?? [],
|
|
1632
|
-
hasMore: result?.hasMore,
|
|
1633
|
-
nextCursor: result?.nextCursor ?? null,
|
|
1634
|
-
};
|
|
1635
|
-
}
|
|
1636
|
-
async getIntegrationCatalogItem(catalogId) {
|
|
1637
|
-
return this.get(`/admin/api/catalog/integrations/${catalogId}`);
|
|
1638
|
-
}
|
|
1639
|
-
async createIntegrationCatalogItem(payload) {
|
|
1640
|
-
return this.post("/admin/api/catalog/integrations", payload);
|
|
1641
|
-
}
|
|
1642
|
-
async updateIntegrationCatalogItem(catalogId, payload) {
|
|
1643
|
-
return this.patch(`/admin/api/catalog/integrations/${catalogId}`, payload);
|
|
1644
|
-
}
|
|
1645
|
-
async deleteIntegrationCatalogItem(catalogId) {
|
|
1646
|
-
return this.delete(`/admin/api/catalog/integrations/${catalogId}`);
|
|
1770
|
+
return this.delete(`/super-admin/api/admins/invitations/${invitationId}`);
|
|
1647
1771
|
}
|
|
1648
1772
|
// ============================================
|
|
1649
1773
|
// BATCH TEST EXECUTION
|
|
@@ -1690,6 +1814,15 @@ export class ApiClient {
|
|
|
1690
1814
|
async testEmailTemplate(appId, emailType, payload) {
|
|
1691
1815
|
return this.post(`/admin/api/apps/${appId}/email-templates/${emailType}/test`, payload || {});
|
|
1692
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
|
+
}
|
|
1693
1826
|
// ============================================
|
|
1694
1827
|
// ACCESS TOKENS
|
|
1695
1828
|
// ============================================
|
|
@@ -2525,12 +2658,13 @@ export class ApiClient {
|
|
|
2525
2658
|
}
|
|
2526
2659
|
/**
|
|
2527
2660
|
* Apply an ordered multi-model create/patch/delete blob atomically (issue
|
|
2528
|
-
* #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade)
|
|
2529
|
-
*
|
|
2530
|
-
* `{ 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.
|
|
2531
2665
|
*/
|
|
2532
|
-
async
|
|
2533
|
-
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` +
|
|
2534
2668
|
this.documentFormatQuery(extra?.documentFormat), { operations });
|
|
2535
2669
|
}
|
|
2536
2670
|
// ============================================
|
|
@@ -2545,8 +2679,10 @@ export class ApiClient {
|
|
|
2545
2679
|
return this.get(`${this.db3Path(appId, db3Id)}/indexes`);
|
|
2546
2680
|
}
|
|
2547
2681
|
/**
|
|
2548
|
-
* `POST db3/:id/indexes` with `{ model, field | fields, unique?, name? }
|
|
2549
|
-
* `{
|
|
2682
|
+
* `POST db3/:id/indexes` with `{ model, field | fields, unique?, name? }`,
|
|
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.
|
|
2550
2686
|
*/
|
|
2551
2687
|
async registerDb3Index(appId, db3Id, body) {
|
|
2552
2688
|
return this.post(`${this.db3Path(appId, db3Id)}/indexes`, body);
|
|
@@ -2555,6 +2691,40 @@ export class ApiClient {
|
|
|
2555
2691
|
async dropDb3Index(appId, db3Id, name) {
|
|
2556
2692
|
return this.delete(`${this.db3Path(appId, db3Id)}/indexes/${encodeURIComponent(name)}`);
|
|
2557
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
|
+
}
|
|
2558
2728
|
/** The db3 mount of {@link queryDocumentRecords}: `GET db3/:id/records/:model`. */
|
|
2559
2729
|
async queryDb3Records(appId, db3Id, modelName, queryOptions) {
|
|
2560
2730
|
const query = {};
|
|
@@ -2582,6 +2752,14 @@ export class ApiClient {
|
|
|
2582
2752
|
async aggregateDb3Records(appId, db3Id, modelName, options) {
|
|
2583
2753
|
return this.post(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}/aggregate`, { options });
|
|
2584
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
|
+
}
|
|
2585
2763
|
/** The db3 mount of {@link saveDocumentRecord}: `POST db3/:id/records/:model`. */
|
|
2586
2764
|
async saveDb3Record(appId, db3Id, modelName, body) {
|
|
2587
2765
|
return this.post(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}`, body);
|
|
@@ -2594,9 +2772,20 @@ export class ApiClient {
|
|
|
2594
2772
|
async deleteDb3Record(appId, db3Id, modelName, recordId) {
|
|
2595
2773
|
return this.delete(`${this.db3Path(appId, db3Id)}/records/${encodeURIComponent(modelName)}/${encodeURIComponent(recordId)}`);
|
|
2596
2774
|
}
|
|
2597
|
-
/** The db3 mount of {@link
|
|
2598
|
-
async
|
|
2599
|
-
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
|
+
});
|
|
2600
2789
|
}
|
|
2601
2790
|
/** The db3 mount of {@link getDocumentSchema}: `GET db3/:id/schema`. */
|
|
2602
2791
|
async getDb3Schema(appId, db3Id) {
|
|
@@ -2726,6 +2915,20 @@ export class ApiClient {
|
|
|
2726
2915
|
const nextCursor = result?.nextCursor;
|
|
2727
2916
|
return { items: result?.items ?? [], nextCursor, hasMore: result?.hasMore ?? nextCursor != null };
|
|
2728
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
|
+
}
|
|
2729
2932
|
/** Transfer a db3 to `to` (`app` or `user:<userId>`) through the admin API (#4804). */
|
|
2730
2933
|
async transferDb3(appId, db3Id, to) {
|
|
2731
2934
|
return this.post(`/admin/api/apps/${appId}/db3/${encodeURIComponent(db3Id)}/transfer`, { to });
|