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
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { Option } from "commander";
|
|
1
2
|
import { ApiClient } from "../lib/api-client.js";
|
|
3
|
+
import { subcommandStatus } from "../lib/command-status.js";
|
|
2
4
|
import { resolveAppId } from "../lib/config.js";
|
|
3
5
|
import { error, info, formatTable, formatId, formatDate, formatNumber, formatPercent, formatDuration, json, heading, result as printResult, dim, } from "../lib/output.js";
|
|
4
6
|
import { buildActivityEnvelope } from "../lib/log-inspection.js";
|
|
7
|
+
// #5105 — `--test-users`, one flag and one value list with `users list`.
|
|
8
|
+
import { analyticsTestUsersOption, printTestUsersLine, testUsersParam, } from "../lib/test-users.js";
|
|
9
|
+
// #5251 — `--where`, one filter grammar for every filtered analytics read, and
|
|
10
|
+
// `--fresh` on every reader, and the anonymous user's segment.
|
|
11
|
+
import { ANONYMOUS_USER_SEGMENT, ERROR_FILTER_FIELDS, EVENT_FILTER_FIELDS, analyticsFreshOption, filtersArg, freshParam, whereFilters, whereOption, } from "../lib/analytics-query.js";
|
|
12
|
+
// #5244 — the db3 query and request readers' cells.
|
|
13
|
+
import { DB3_QUERIES_ORDER_BY, db3QueryCaller, formatFigure, requestFunction, } from "../lib/worker-perf-format.js";
|
|
5
14
|
// #3787 — per-prompt cost cells, with the cost-unknown and partial-window rules.
|
|
6
15
|
import { formatAvgCostCell, formatCostCell, } from "../lib/prompt-cost-format.js";
|
|
7
16
|
/** Format a value that is already a percentage (e.g. 33.3 → "33.3%") */
|
|
@@ -21,13 +30,20 @@ export function registerAnalyticsCommands(program) {
|
|
|
21
30
|
.addHelpText("after", `
|
|
22
31
|
Examples:
|
|
23
32
|
$ primitive analytics overview
|
|
33
|
+
$ primitive analytics overview --test-users include
|
|
34
|
+
$ primitive analytics overview --fresh
|
|
24
35
|
$ primitive analytics daily-active --window-days 14
|
|
25
36
|
$ primitive analytics top-users --limit 20
|
|
26
37
|
$ primitive analytics user-search --query user@example.com
|
|
27
38
|
$ primitive analytics user-detail <user-ulid>
|
|
39
|
+
$ primitive analytics user-detail --anonymous
|
|
28
40
|
$ primitive analytics events --window-days 7 --page 0
|
|
41
|
+
$ primitive analytics events --where action=login --where country!=US
|
|
29
42
|
$ primitive analytics events-grouped --group-by feature
|
|
30
43
|
$ primitive analytics errors-groups --window-days 14 --limit 100
|
|
44
|
+
$ primitive analytics errors-groups --where source!=integration
|
|
45
|
+
$ primitive analytics db3-queries --order-by rows-per-returned
|
|
46
|
+
$ primitive analytics requests --window-days 30
|
|
31
47
|
$ primitive analytics cohort-retention
|
|
32
48
|
$ primitive analytics prompts --window-days 14
|
|
33
49
|
`);
|
|
@@ -38,17 +54,24 @@ Examples:
|
|
|
38
54
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
39
55
|
.option("--app <app-id>", "App ID")
|
|
40
56
|
.option("--window-days <n>", "Growth window in days", "28")
|
|
57
|
+
.addOption(analyticsTestUsersOption("exclude"))
|
|
58
|
+
.addOption(analyticsFreshOption())
|
|
41
59
|
.option("--json", "Output as JSON")
|
|
42
60
|
.action(async (appId, options) => {
|
|
43
61
|
const resolvedAppId = resolveAppId(appId, options);
|
|
44
62
|
const client = new ApiClient();
|
|
45
63
|
try {
|
|
64
|
+
const testUsers = {
|
|
65
|
+
...testUsersParam(options.testUsers),
|
|
66
|
+
...freshParam(options.fresh),
|
|
67
|
+
};
|
|
46
68
|
const [dau, wau, mau, growth] = await Promise.all([
|
|
47
|
-
client.getAnalyticsOverviewDau(resolvedAppId),
|
|
48
|
-
client.getAnalyticsOverviewWau(resolvedAppId),
|
|
49
|
-
client.getAnalyticsOverviewMau(resolvedAppId),
|
|
69
|
+
client.getAnalyticsOverviewDau(resolvedAppId, testUsers),
|
|
70
|
+
client.getAnalyticsOverviewWau(resolvedAppId, testUsers),
|
|
71
|
+
client.getAnalyticsOverviewMau(resolvedAppId, testUsers),
|
|
50
72
|
client.getAnalyticsOverviewGrowth(resolvedAppId, {
|
|
51
73
|
windowDays: parseInt(options.windowDays),
|
|
74
|
+
...testUsers,
|
|
52
75
|
}),
|
|
53
76
|
]);
|
|
54
77
|
if (options.json) {
|
|
@@ -56,6 +79,7 @@ Examples:
|
|
|
56
79
|
return;
|
|
57
80
|
}
|
|
58
81
|
heading("Active Users");
|
|
82
|
+
printTestUsersLine(dau.testUsers);
|
|
59
83
|
console.log();
|
|
60
84
|
const formatDelta = (d) => d > 0 ? `+${(d * 100).toFixed(1)}%` : d === 0 ? "0%" : `${(d * 100).toFixed(1)}%`;
|
|
61
85
|
console.log(formatTable([
|
|
@@ -91,6 +115,8 @@ Examples:
|
|
|
91
115
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
92
116
|
.option("--app <app-id>", "App ID")
|
|
93
117
|
.option("--window-days <n>", "Time window in days (7-90)", "28")
|
|
118
|
+
.addOption(analyticsTestUsersOption("exclude"))
|
|
119
|
+
.addOption(analyticsFreshOption())
|
|
94
120
|
.option("--json", "Output as JSON")
|
|
95
121
|
.action(async (appId, options) => {
|
|
96
122
|
const resolvedAppId = resolveAppId(appId, options);
|
|
@@ -98,12 +124,15 @@ Examples:
|
|
|
98
124
|
try {
|
|
99
125
|
const result = await client.getAnalyticsDailyActive(resolvedAppId, {
|
|
100
126
|
windowDays: parseInt(options.windowDays),
|
|
127
|
+
...testUsersParam(options.testUsers),
|
|
128
|
+
...freshParam(options.fresh),
|
|
101
129
|
});
|
|
102
130
|
if (options.json) {
|
|
103
131
|
json(result);
|
|
104
132
|
return;
|
|
105
133
|
}
|
|
106
134
|
heading(`Daily Active Users (${result.window_days} days)`);
|
|
135
|
+
printTestUsersLine(result.testUsers);
|
|
107
136
|
console.log();
|
|
108
137
|
if (!result.rows || result.rows.length === 0) {
|
|
109
138
|
info("No data found.");
|
|
@@ -126,6 +155,8 @@ Examples:
|
|
|
126
155
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
127
156
|
.option("--app <app-id>", "App ID")
|
|
128
157
|
.option("--window-days <n>", "Rolling window size in days (1-28)", "7")
|
|
158
|
+
.addOption(analyticsTestUsersOption("exclude"))
|
|
159
|
+
.addOption(analyticsFreshOption())
|
|
129
160
|
.option("--json", "Output as JSON")
|
|
130
161
|
.action(async (appId, options) => {
|
|
131
162
|
const resolvedAppId = resolveAppId(appId, options);
|
|
@@ -133,12 +164,15 @@ Examples:
|
|
|
133
164
|
try {
|
|
134
165
|
const result = await client.getAnalyticsRollingActive(resolvedAppId, {
|
|
135
166
|
windowDays: parseInt(options.windowDays),
|
|
167
|
+
...testUsersParam(options.testUsers),
|
|
168
|
+
...freshParam(options.fresh),
|
|
136
169
|
});
|
|
137
170
|
if (options.json) {
|
|
138
171
|
json(result);
|
|
139
172
|
return;
|
|
140
173
|
}
|
|
141
174
|
heading(`Rolling Active Users (${result.window_days}-day window)`);
|
|
175
|
+
printTestUsersLine(result.testUsers);
|
|
142
176
|
console.log();
|
|
143
177
|
if (!result.rows || result.rows.length === 0) {
|
|
144
178
|
info("No data found.");
|
|
@@ -160,17 +194,23 @@ Examples:
|
|
|
160
194
|
.description("Weekly cohort retention matrix")
|
|
161
195
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
162
196
|
.option("--app <app-id>", "App ID")
|
|
197
|
+
.addOption(analyticsTestUsersOption("exclude"))
|
|
198
|
+
.addOption(analyticsFreshOption())
|
|
163
199
|
.option("--json", "Output as JSON")
|
|
164
200
|
.action(async (appId, options) => {
|
|
165
201
|
const resolvedAppId = resolveAppId(appId, options);
|
|
166
202
|
const client = new ApiClient();
|
|
167
203
|
try {
|
|
168
|
-
const result = await client.getAnalyticsCohortRetention(resolvedAppId
|
|
204
|
+
const result = await client.getAnalyticsCohortRetention(resolvedAppId, {
|
|
205
|
+
...testUsersParam(options.testUsers),
|
|
206
|
+
...freshParam(options.fresh),
|
|
207
|
+
});
|
|
169
208
|
if (options.json) {
|
|
170
209
|
json(result);
|
|
171
210
|
return;
|
|
172
211
|
}
|
|
173
212
|
heading("Cohort Retention");
|
|
213
|
+
printTestUsersLine(result.testUsers);
|
|
174
214
|
console.log();
|
|
175
215
|
if (!result.rows || result.rows.length === 0) {
|
|
176
216
|
info("No cohort data found.");
|
|
@@ -222,6 +262,8 @@ Examples:
|
|
|
222
262
|
.option("--app <app-id>", "App ID")
|
|
223
263
|
.option("--window-days <n>", "Time window in days", "30")
|
|
224
264
|
.option("--limit <n>", "Number of users to show", "10")
|
|
265
|
+
.addOption(analyticsTestUsersOption("exclude"))
|
|
266
|
+
.addOption(analyticsFreshOption())
|
|
225
267
|
.option("--json", "Output as JSON")
|
|
226
268
|
.action(async (appId, options) => {
|
|
227
269
|
const resolvedAppId = resolveAppId(appId, options);
|
|
@@ -230,12 +272,15 @@ Examples:
|
|
|
230
272
|
const result = await client.getAnalyticsTopUsers(resolvedAppId, {
|
|
231
273
|
windowDays: parseInt(options.windowDays),
|
|
232
274
|
limit: parseInt(options.limit),
|
|
275
|
+
...testUsersParam(options.testUsers),
|
|
276
|
+
...freshParam(options.fresh),
|
|
233
277
|
});
|
|
234
278
|
if (options.json) {
|
|
235
279
|
json(result);
|
|
236
280
|
return;
|
|
237
281
|
}
|
|
238
282
|
heading(`Top Users (${result.windowDays} days)`);
|
|
283
|
+
printTestUsersLine(result.testUsers);
|
|
239
284
|
console.log();
|
|
240
285
|
if (!result.results || result.results.length === 0) {
|
|
241
286
|
info("No user activity found.");
|
|
@@ -268,14 +313,18 @@ Examples:
|
|
|
268
313
|
.option("--signup-end-day <day>", "End of an inclusive signup range (YYYY-MM-DD)")
|
|
269
314
|
.option("--offset <n>", "Row offset; page a busy day until the result is not truncated")
|
|
270
315
|
.option("--limit <n>", "Max results", "25")
|
|
316
|
+
.addOption(analyticsTestUsersOption("exclude for a listing or a signup filter, include for --query"))
|
|
317
|
+
.addOption(analyticsFreshOption())
|
|
271
318
|
.option("--json", "Output as JSON")
|
|
272
319
|
.action(async (appId, options) => {
|
|
273
320
|
const resolvedAppId = resolveAppId(appId, options);
|
|
274
321
|
const client = new ApiClient();
|
|
275
322
|
const hasSignupFilter = Boolean(options.signupDay || options.signupStartDay || options.signupEndDay);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
323
|
+
// #5105 — `--test-users` alone lists the most recently active users,
|
|
324
|
+
// filtered: asked for explicitly, it says which users to list.
|
|
325
|
+
if (!options.query && !hasSignupFilter && !options.testUsers) {
|
|
326
|
+
error("Give --query, a signup filter (--signup-day, or " +
|
|
327
|
+
"--signup-start-day with --signup-end-day), or --test-users.");
|
|
279
328
|
process.exit(1);
|
|
280
329
|
return;
|
|
281
330
|
}
|
|
@@ -292,6 +341,8 @@ Examples:
|
|
|
292
341
|
...(options.offset !== undefined
|
|
293
342
|
? { offset: parseInt(options.offset) }
|
|
294
343
|
: {}),
|
|
344
|
+
...testUsersParam(options.testUsers),
|
|
345
|
+
...freshParam(options.fresh),
|
|
295
346
|
});
|
|
296
347
|
if (options.json) {
|
|
297
348
|
json(result);
|
|
@@ -299,7 +350,10 @@ Examples:
|
|
|
299
350
|
}
|
|
300
351
|
heading(hasSignupFilter
|
|
301
352
|
? `Signups: ${result.signupStartDay ?? ""} to ${result.signupEndDay ?? ""}`
|
|
302
|
-
:
|
|
353
|
+
: options.query
|
|
354
|
+
? `User Search: "${result.query}"`
|
|
355
|
+
: "Recently Active Users");
|
|
356
|
+
printTestUsersLine(result.testUsers);
|
|
303
357
|
console.log();
|
|
304
358
|
if (!result.results || result.results.length === 0) {
|
|
305
359
|
info("No users found.");
|
|
@@ -339,22 +393,45 @@ Examples:
|
|
|
339
393
|
analytics
|
|
340
394
|
.command("user-detail")
|
|
341
395
|
.description("Detailed activity for a single user")
|
|
342
|
-
.argument("
|
|
396
|
+
.argument("[user-ulid]", "User ULID (omit with --anonymous)")
|
|
343
397
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
344
398
|
.option("--app <app-id>", "App ID")
|
|
399
|
+
.option("--anonymous", "Activity with no signed-in user; the one optional argument is then the app ID")
|
|
400
|
+
.addOption(analyticsFreshOption())
|
|
345
401
|
.option("--json", "Output as JSON")
|
|
346
402
|
.action(async (userUlid, appId, options) => {
|
|
403
|
+
// #5251 — with --anonymous there is no user to name, so the one
|
|
404
|
+
// positional is the app, as on every other reader.
|
|
405
|
+
if (options.anonymous) {
|
|
406
|
+
if (appId !== undefined) {
|
|
407
|
+
error("--anonymous takes at most one argument, the app ID.");
|
|
408
|
+
process.exit(1);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
appId = userUlid;
|
|
412
|
+
userUlid = ANONYMOUS_USER_SEGMENT;
|
|
413
|
+
}
|
|
414
|
+
else if (!userUlid) {
|
|
415
|
+
error("Give a user ULID, or --anonymous for anonymous activity.");
|
|
416
|
+
process.exit(1);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
347
419
|
const resolvedAppId = resolveAppId(appId, options);
|
|
348
420
|
const client = new ApiClient();
|
|
349
421
|
try {
|
|
350
|
-
const result = await client.getAnalyticsUserDetail(resolvedAppId, userUlid);
|
|
422
|
+
const result = await client.getAnalyticsUserDetail(resolvedAppId, userUlid, freshParam(options.fresh));
|
|
351
423
|
if (options.json) {
|
|
352
424
|
json(result);
|
|
353
425
|
return;
|
|
354
426
|
}
|
|
355
427
|
heading("User Detail");
|
|
356
428
|
console.log();
|
|
357
|
-
|
|
429
|
+
if (options.anonymous) {
|
|
430
|
+
printResult("User", "anonymous");
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
printResult("ULID", result.user.user_ulid);
|
|
434
|
+
}
|
|
358
435
|
if (result.user.email)
|
|
359
436
|
printResult("Email", result.user.email);
|
|
360
437
|
if (result.user.name)
|
|
@@ -397,12 +474,13 @@ Examples:
|
|
|
397
474
|
.argument("<user-ulid>", "User ULID")
|
|
398
475
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
399
476
|
.option("--app <app-id>", "App ID")
|
|
477
|
+
.addOption(analyticsFreshOption())
|
|
400
478
|
.option("--json", "Output as JSON")
|
|
401
479
|
.action(async (userUlid, appId, options) => {
|
|
402
480
|
const resolvedAppId = resolveAppId(appId, options);
|
|
403
481
|
const client = new ApiClient();
|
|
404
482
|
try {
|
|
405
|
-
const result = await client.getAnalyticsUserSnapshot(resolvedAppId, userUlid);
|
|
483
|
+
const result = await client.getAnalyticsUserSnapshot(resolvedAppId, userUlid, freshParam(options.fresh));
|
|
406
484
|
if (options.json) {
|
|
407
485
|
json(result);
|
|
408
486
|
return;
|
|
@@ -431,19 +509,25 @@ Examples:
|
|
|
431
509
|
.option("--window-days <n>", "Time window in days", "7")
|
|
432
510
|
.option("--page <n>", "Page number (0-based)", "0")
|
|
433
511
|
.option("--user-id <id>", "Filter to a single user's events")
|
|
512
|
+
.addOption(whereOption(EVENT_FILTER_FIELDS))
|
|
513
|
+
.addOption(analyticsTestUsersOption("include"))
|
|
514
|
+
.addOption(analyticsFreshOption())
|
|
434
515
|
.option("--json", "Output as JSON")
|
|
435
516
|
.action(async (appId, options) => {
|
|
436
517
|
const resolvedAppId = resolveAppId(appId, options);
|
|
437
518
|
const client = new ApiClient();
|
|
438
519
|
try {
|
|
520
|
+
const filters = whereFilters(options.where, EVENT_FILTER_FIELDS);
|
|
439
521
|
const result = await client.getAnalyticsEvents(resolvedAppId, {
|
|
440
522
|
windowDays: parseInt(options.windowDays),
|
|
441
523
|
page: parseInt(options.page),
|
|
442
524
|
// The events feed filters by user via the bracketed
|
|
443
|
-
// `filter[user][is]` syntax the analytics route already parses —
|
|
444
|
-
// a raw query param (behavior 11).
|
|
525
|
+
// `filter[user][is]` syntax the analytics route already parses —
|
|
526
|
+
// not a raw query param (behavior 11).
|
|
445
527
|
...(options.userId ? { "filter[user][is]": options.userId } : {}),
|
|
446
|
-
|
|
528
|
+
...testUsersParam(options.testUsers),
|
|
529
|
+
...freshParam(options.fresh),
|
|
530
|
+
}, ...filtersArg(filters));
|
|
447
531
|
if (options.json) {
|
|
448
532
|
// Normalize the offset-paged response to the shared activity
|
|
449
533
|
// envelope: `{page_size, rows}` → `{pageSize, items}` with the
|
|
@@ -453,6 +537,7 @@ Examples:
|
|
|
453
537
|
return;
|
|
454
538
|
}
|
|
455
539
|
heading(`Events (page ${result.page}, ${result.total_rows} total)`);
|
|
540
|
+
printTestUsersLine(result.testUsers);
|
|
456
541
|
console.log();
|
|
457
542
|
if (!result.rows || result.rows.length === 0) {
|
|
458
543
|
info("No events found.");
|
|
@@ -493,20 +578,27 @@ Examples:
|
|
|
493
578
|
.option("--app <app-id>", "App ID")
|
|
494
579
|
.option("--group-by <dim>", "Dimension: action, feature, route, country, deviceType, plan, day", "action")
|
|
495
580
|
.option("--window-days <n>", "Time window in days", "7")
|
|
581
|
+
.addOption(whereOption(EVENT_FILTER_FIELDS))
|
|
582
|
+
.addOption(analyticsTestUsersOption("include"))
|
|
583
|
+
.addOption(analyticsFreshOption())
|
|
496
584
|
.option("--json", "Output as JSON")
|
|
497
585
|
.action(async (appId, options) => {
|
|
498
586
|
const resolvedAppId = resolveAppId(appId, options);
|
|
499
587
|
const client = new ApiClient();
|
|
500
588
|
try {
|
|
589
|
+
const filters = whereFilters(options.where, EVENT_FILTER_FIELDS);
|
|
501
590
|
const result = await client.getAnalyticsEventsGrouped(resolvedAppId, {
|
|
502
591
|
groupBy: options.groupBy,
|
|
503
592
|
windowDays: parseInt(options.windowDays),
|
|
504
|
-
|
|
593
|
+
...testUsersParam(options.testUsers),
|
|
594
|
+
...freshParam(options.fresh),
|
|
595
|
+
}, ...filtersArg(filters));
|
|
505
596
|
if (options.json) {
|
|
506
597
|
json(result);
|
|
507
598
|
return;
|
|
508
599
|
}
|
|
509
600
|
heading(`Events by ${result.group_by}`);
|
|
601
|
+
printTestUsersLine(result.testUsers);
|
|
510
602
|
console.log();
|
|
511
603
|
if (!result.rows || result.rows.length === 0) {
|
|
512
604
|
info("No events found.");
|
|
@@ -533,16 +625,21 @@ Examples:
|
|
|
533
625
|
.option("--limit <n>", "Max error groups to return", "50")
|
|
534
626
|
.option("--status-class <class>", "Filter by status class: 4xx, 5xx, transport")
|
|
535
627
|
.option("--source <source>", "Filter by source: workflow_run, workflow_step, integration, " +
|
|
536
|
-
"function_invocation, function_run")
|
|
628
|
+
"function_invocation, function_run, analytics_relay")
|
|
629
|
+
// Its own registration: the #3660 test reads `--source`'s help up to `)`.
|
|
630
|
+
.addOption(whereOption(ERROR_FILTER_FIELDS))
|
|
537
631
|
.option("--verbose", "Also print each group's exemplar (a raw sample of the failure) and where it came from")
|
|
632
|
+
.addOption(analyticsFreshOption())
|
|
538
633
|
.option("--json", "Output as JSON")
|
|
539
634
|
.action(async (appId, options) => {
|
|
540
635
|
const resolvedAppId = resolveAppId(appId, options);
|
|
541
636
|
const client = new ApiClient();
|
|
542
637
|
try {
|
|
638
|
+
const filters = whereFilters(options.where, ERROR_FILTER_FIELDS);
|
|
543
639
|
const params = {
|
|
544
640
|
windowDays: parseInt(options.windowDays),
|
|
545
641
|
limit: parseInt(options.limit),
|
|
642
|
+
...freshParam(options.fresh),
|
|
546
643
|
};
|
|
547
644
|
if (options.statusClass) {
|
|
548
645
|
params["filter[statusClass][is]"] = options.statusClass;
|
|
@@ -550,7 +647,7 @@ Examples:
|
|
|
550
647
|
if (options.source) {
|
|
551
648
|
params["filter[source][is]"] = options.source;
|
|
552
649
|
}
|
|
553
|
-
const result = await client.getAnalyticsErrorsGroups(resolvedAppId, params);
|
|
650
|
+
const result = await client.getAnalyticsErrorsGroups(resolvedAppId, params, ...filtersArg(filters));
|
|
554
651
|
if (options.json) {
|
|
555
652
|
json(result);
|
|
556
653
|
return;
|
|
@@ -604,6 +701,104 @@ Examples:
|
|
|
604
701
|
process.exit(1);
|
|
605
702
|
}
|
|
606
703
|
});
|
|
704
|
+
// ── Database Queries (#5244) ─────────────────────────────────────
|
|
705
|
+
analytics
|
|
706
|
+
.command("db3-queries")
|
|
707
|
+
.description("List the db3 query shapes that read the most rows, per endpoint and server function")
|
|
708
|
+
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
709
|
+
.option("--app <app-id>", "App ID")
|
|
710
|
+
.option("--window-days <n>", "Time window in days (1-90)", "7")
|
|
711
|
+
.option("--limit <n>", "Max rows to return (1-200)", "50")
|
|
712
|
+
.addOption(new Option("--order-by <order>", "Rank by rows read in total, or per row returned")
|
|
713
|
+
.choices(Object.keys(DB3_QUERIES_ORDER_BY))
|
|
714
|
+
.default("rows-read"))
|
|
715
|
+
.addOption(analyticsFreshOption())
|
|
716
|
+
.option("--json", "Output as JSON")
|
|
717
|
+
.action(async (appId, options) => {
|
|
718
|
+
const resolvedAppId = resolveAppId(appId, options);
|
|
719
|
+
const client = new ApiClient();
|
|
720
|
+
try {
|
|
721
|
+
const result = await client.getAnalyticsDb3Queries(resolvedAppId, {
|
|
722
|
+
windowDays: parseInt(options.windowDays),
|
|
723
|
+
limit: parseInt(options.limit),
|
|
724
|
+
orderBy: DB3_QUERIES_ORDER_BY[options.orderBy],
|
|
725
|
+
...freshParam(options.fresh),
|
|
726
|
+
});
|
|
727
|
+
if (options.json) {
|
|
728
|
+
json(result);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
heading(`Database queries (last ${result.window_days} days, by ${options.orderBy})`);
|
|
732
|
+
console.log();
|
|
733
|
+
if (!result.rows || result.rows.length === 0) {
|
|
734
|
+
info("No db3 server reads recorded in this window.");
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
console.log(formatTable(result.rows.map((row) => ({ ...row, caller: db3QueryCaller(row) })), [
|
|
738
|
+
{ header: "TYPE", key: "type" },
|
|
739
|
+
{ header: "MODEL", key: "model" },
|
|
740
|
+
{ header: "OP", key: "op" },
|
|
741
|
+
{ header: "FILTER", key: "filter" },
|
|
742
|
+
{ header: "SORT", key: "sort" },
|
|
743
|
+
{ header: "CALLER", key: "caller" },
|
|
744
|
+
{ header: "CALLS", key: "calls", align: "right", format: formatFigure },
|
|
745
|
+
{ header: "ROWS READ", key: "rows_read", align: "right", format: formatFigure },
|
|
746
|
+
{ header: "PER CALL", key: "rows_read_per_call", align: "right", format: formatFigure },
|
|
747
|
+
{ header: "PER RETURNED", key: "rows_read_per_returned", align: "right", format: formatFigure },
|
|
748
|
+
{ header: "SCANNED", key: "scanned_calls", align: "right", format: formatFigure },
|
|
749
|
+
]));
|
|
750
|
+
}
|
|
751
|
+
catch (err) {
|
|
752
|
+
error(err.message);
|
|
753
|
+
process.exit(1);
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
analytics
|
|
757
|
+
.command("requests")
|
|
758
|
+
.description("List request wall time and DynamoDB round trips per endpoint and server function")
|
|
759
|
+
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
760
|
+
.option("--app <app-id>", "App ID")
|
|
761
|
+
.option("--window-days <n>", "Time window in days (1-90)", "7")
|
|
762
|
+
.option("--limit <n>", "Max rows to return (1-200)", "50")
|
|
763
|
+
.addOption(analyticsFreshOption())
|
|
764
|
+
.option("--json", "Output as JSON")
|
|
765
|
+
.action(async (appId, options) => {
|
|
766
|
+
const resolvedAppId = resolveAppId(appId, options);
|
|
767
|
+
const client = new ApiClient();
|
|
768
|
+
try {
|
|
769
|
+
const result = await client.getAnalyticsRequests(resolvedAppId, {
|
|
770
|
+
windowDays: parseInt(options.windowDays),
|
|
771
|
+
limit: parseInt(options.limit),
|
|
772
|
+
...freshParam(options.fresh),
|
|
773
|
+
});
|
|
774
|
+
if (options.json) {
|
|
775
|
+
json(result);
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
heading(`Requests (last ${result.window_days} days)`);
|
|
779
|
+
console.log();
|
|
780
|
+
if (!result.rows || result.rows.length === 0) {
|
|
781
|
+
info("No requests recorded in this window.");
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
console.log(formatTable(result.rows.map((row) => ({ ...row, endpoint: `${row.method} ${row.path}`, function: requestFunction(row) })), [
|
|
785
|
+
{ header: "ENDPOINT", key: "endpoint" },
|
|
786
|
+
{ header: "FUNCTION", key: "function" },
|
|
787
|
+
{ header: "REQUESTS", key: "requests", align: "right", format: formatFigure },
|
|
788
|
+
{ header: "P50", key: "wall_ms_p50", align: "right", format: formatFigure },
|
|
789
|
+
{ header: "P95", key: "wall_ms_p95", align: "right", format: formatFigure },
|
|
790
|
+
{ header: "DYNAMO CALLS", key: "dynamo_calls_per_request", align: "right", format: formatFigure },
|
|
791
|
+
{ header: "DYNAMO MS", key: "dynamo_ms_per_request", align: "right", format: formatFigure },
|
|
792
|
+
{ header: "COLD", key: "cold_starts", align: "right", format: formatFigure },
|
|
793
|
+
]));
|
|
794
|
+
console.log();
|
|
795
|
+
info("P50, P95 and DYNAMO MS are milliseconds per request; DYNAMO CALLS is calls per request.");
|
|
796
|
+
}
|
|
797
|
+
catch (err) {
|
|
798
|
+
error(err.message);
|
|
799
|
+
process.exit(1);
|
|
800
|
+
}
|
|
801
|
+
});
|
|
607
802
|
// ── Integration Metrics ──────────────────────────────────────────
|
|
608
803
|
analytics
|
|
609
804
|
.command("integrations")
|
|
@@ -611,6 +806,7 @@ Examples:
|
|
|
611
806
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
612
807
|
.option("--app <app-id>", "App ID")
|
|
613
808
|
.option("--window-days <n>", "Time window in days", "30")
|
|
809
|
+
.addOption(analyticsFreshOption())
|
|
614
810
|
.option("--json", "Output as JSON")
|
|
615
811
|
.action(async (appId, options) => {
|
|
616
812
|
const resolvedAppId = resolveAppId(appId, options);
|
|
@@ -618,6 +814,7 @@ Examples:
|
|
|
618
814
|
try {
|
|
619
815
|
const result = await client.getAnalyticsIntegrationMetrics(resolvedAppId, {
|
|
620
816
|
windowDays: parseInt(options.windowDays),
|
|
817
|
+
...freshParam(options.fresh),
|
|
621
818
|
});
|
|
622
819
|
if (options.json) {
|
|
623
820
|
json(result);
|
|
@@ -651,6 +848,7 @@ Examples:
|
|
|
651
848
|
.option("--app <app-id>", "App ID")
|
|
652
849
|
.option("--window-days <n>", "Time window in days", "30")
|
|
653
850
|
.option("--limit <n>", "Number of prompts to show", "10")
|
|
851
|
+
.addOption(analyticsFreshOption())
|
|
654
852
|
.option("--json", "Output as JSON")
|
|
655
853
|
.action(async (appId, options) => {
|
|
656
854
|
const resolvedAppId = resolveAppId(appId, options);
|
|
@@ -659,6 +857,7 @@ Examples:
|
|
|
659
857
|
const result = await client.getAnalyticsTopPrompts(resolvedAppId, {
|
|
660
858
|
windowDays: parseInt(options.windowDays),
|
|
661
859
|
limit: parseInt(options.limit),
|
|
860
|
+
...freshParam(options.fresh),
|
|
662
861
|
});
|
|
663
862
|
if (options.json) {
|
|
664
863
|
json(result);
|
|
@@ -693,5 +892,8 @@ Examples:
|
|
|
693
892
|
process.exit(1);
|
|
694
893
|
}
|
|
695
894
|
});
|
|
895
|
+
// The two WORKER_PERF readers are beta routes; the other readers are production.
|
|
896
|
+
subcommandStatus(analytics, "db3-queries", { stability: "beta" });
|
|
897
|
+
subcommandStatus(analytics, "requests", { stability: "beta" });
|
|
696
898
|
}
|
|
697
899
|
//# sourceMappingURL=analytics.js.map
|