primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +303 -186
- package/assets/skill/skills/primitive-platform/SKILL.md +93 -27
- package/dist/bin/primitive.js +15 -89
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +80 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.d.ts +129 -0
- package/dist/src/commands/agent-sessions.js +532 -20
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +207 -155
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +3 -0
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps-transitions.d.ts +39 -0
- package/dist/src/commands/apps-transitions.js +198 -0
- package/dist/src/commands/apps-transitions.js.map +1 -0
- package/dist/src/commands/apps.d.ts +17 -0
- package/dist/src/commands/apps.js +108 -3
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.js +2 -0
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +170 -50
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -0
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +318 -256
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/comparisons.js +2 -0
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +2 -2
- package/dist/src/commands/config.js +59 -33
- 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.d.ts +42 -0
- package/dist/src/commands/db3-types.js +445 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +38 -0
- package/dist/src/commands/db3.js +2053 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +110 -10
- package/dist/src/commands/documents.js +1019 -748
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +74 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +8 -4
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +383 -32
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +168 -50
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +7 -5
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +509 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +129 -38
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -53
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +19 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +4 -2
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +55 -6
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -52
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rate-counters.d.ts +19 -0
- package/dist/src/commands/rate-counters.js +104 -0
- package/dist/src/commands/rate-counters.js.map +1 -0
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +2 -1
- 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/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.d.ts +38 -0
- package/dist/src/commands/secrets.js +148 -6
- 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/skill.js +2 -0
- package/dist/src/commands/skill.js.map +1 -1
- package/dist/src/commands/spent-tokens.d.ts +19 -0
- package/dist/src/commands/spent-tokens.js +79 -0
- package/dist/src/commands/spent-tokens.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +58 -0
- package/dist/src/commands/sync-app-settings.js +119 -2
- package/dist/src/commands/sync-app-settings.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 +578 -546
- package/dist/src/commands/sync.js +3516 -5134
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +5 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transitions.d.ts +54 -0
- package/dist/src/commands/transitions.js +418 -0
- package/dist/src/commands/transitions.js.map +1 -0
- package/dist/src/commands/usage.d.ts +42 -0
- package/dist/src/commands/usage.js +397 -0
- package/dist/src/commands/usage.js.map +1 -0
- 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 +951 -18
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -0
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.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 +1976 -431
- package/dist/src/lib/api-client.js +1095 -550
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +14 -2
- package/dist/src/lib/app-settings-descriptor.js +55 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +47 -1
- package/dist/src/lib/auth-flow.js +451 -14
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +8 -14
- package/dist/src/lib/block-selector.js +8 -19
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +3 -1
- package/dist/src/lib/child-apps-local.js +9 -1
- package/dist/src/lib/child-apps-local.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -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/collection-export.d.ts +76 -15
- package/dist/src/lib/collection-export.js +116 -23
- package/dist/src/lib/collection-export.js.map +1 -1
- package/dist/src/lib/collection-principal.d.ts +22 -0
- package/dist/src/lib/collection-principal.js +35 -0
- package/dist/src/lib/collection-principal.js.map +1 -0
- package/dist/src/lib/command-groups.d.ts +30 -0
- package/dist/src/lib/command-groups.js +111 -0
- package/dist/src/lib/command-groups.js.map +1 -0
- package/dist/src/lib/command-status.d.ts +147 -0
- package/dist/src/lib/command-status.js +266 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +9 -22
- package/dist/src/lib/config-object-descriptor.js +113 -277
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +3 -7
- package/dist/src/lib/config-surface.js +9 -13
- package/dist/src/lib/config-surface.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/credentials-home.d.ts +7 -0
- package/dist/src/lib/credentials-home.js +45 -10
- package/dist/src/lib/credentials-home.js.map +1 -1
- package/dist/src/lib/credentials-lock.d.ts +14 -6
- package/dist/src/lib/credentials-lock.js +90 -10
- package/dist/src/lib/credentials-lock.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +142 -70
- package/dist/src/lib/credentials-store.js +420 -111
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- 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 +40 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +32 -8
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +125 -0
- package/dist/src/lib/db-type-records.js +237 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +322 -0
- package/dist/src/lib/db3-export.js +767 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +116 -0
- package/dist/src/lib/db3-index-output.js +223 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/db3-json-fields.d.ts +49 -0
- package/dist/src/lib/db3-json-fields.js +195 -0
- package/dist/src/lib/db3-json-fields.js.map +1 -0
- package/dist/src/lib/db3-type-archive.d.ts +59 -0
- package/dist/src/lib/db3-type-archive.js +95 -0
- package/dist/src/lib/db3-type-archive.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +148 -0
- package/dist/src/lib/db3-type-models.js +583 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/document-export-record-log.d.ts +7 -0
- package/dist/src/lib/document-export-record-log.js +9 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +19 -0
- package/dist/src/lib/document-ingest-artifact.js +55 -6
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +11 -1
- package/dist/src/lib/document-ingest.js +16 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- 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 +142 -0
- package/dist/src/lib/function-authorize-check.js +311 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +36 -0
- package/dist/src/lib/function-authorize-view.js +110 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +142 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +112 -12
- package/dist/src/lib/function-collect.js +601 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +65 -11
- package/dist/src/lib/function-db-types.js +326 -157
- 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-grants-preflight.d.ts +99 -0
- package/dist/src/lib/function-grants-preflight.js +154 -2
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +85 -0
- package/dist/src/lib/function-lint.js +442 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +13 -21
- package/dist/src/lib/function-run.js +14 -27
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +86 -22
- package/dist/src/lib/function-schema-codegen.js +194 -88
- 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 +120 -6
- package/dist/src/lib/function-sync.js +217 -26
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +174 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.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-command-status.d.ts +6 -0
- package/dist/src/lib/generated-command-status.js +502 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +804 -140
- package/dist/src/lib/generated-config-surfaces.js +2491 -1806
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/hosting-build.d.ts +97 -0
- package/dist/src/lib/hosting-build.js +204 -0
- package/dist/src/lib/hosting-build.js.map +1 -0
- package/dist/src/lib/hosting-client.d.ts +167 -0
- package/dist/src/lib/hosting-client.js +340 -0
- package/dist/src/lib/hosting-client.js.map +1 -0
- package/dist/src/lib/hosting-environments.d.ts +32 -0
- package/dist/src/lib/hosting-environments.js +74 -0
- package/dist/src/lib/hosting-environments.js.map +1 -0
- package/dist/src/lib/hosting-errors.d.ts +30 -0
- package/dist/src/lib/hosting-errors.js +43 -0
- package/dist/src/lib/hosting-errors.js.map +1 -0
- package/dist/src/lib/hosting-token.d.ts +46 -0
- package/dist/src/lib/hosting-token.js +60 -0
- package/dist/src/lib/hosting-token.js.map +1 -0
- package/dist/src/lib/hosting-trust-step.d.ts +67 -0
- package/dist/src/lib/hosting-trust-step.js +279 -0
- package/dist/src/lib/hosting-trust-step.js.map +1 -0
- package/dist/src/lib/hosting-trust.d.ts +77 -0
- package/dist/src/lib/hosting-trust.js +194 -0
- package/dist/src/lib/hosting-trust.js.map +1 -0
- package/dist/src/lib/hosting-wait.d.ts +42 -0
- package/dist/src/lib/hosting-wait.js +84 -0
- package/dist/src/lib/hosting-wait.js.map +1 -0
- package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
- package/dist/src/lib/hosting-wfp-upload.js +149 -0
- package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.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/invoker-shared-enums.d.ts +35 -0
- package/dist/src/lib/invoker-shared-enums.js +98 -0
- package/dist/src/lib/invoker-shared-enums.js.map +1 -0
- package/dist/src/lib/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +23 -4
- package/dist/src/lib/log-inspection.js +14 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +17 -7
- package/dist/src/lib/login-scope-lines.js +33 -10
- package/dist/src/lib/login-scope-lines.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/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +3 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- 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 +174 -0
- package/dist/src/lib/primitive-declaration.js +871 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +96 -100
- 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 +173 -0
- package/dist/src/lib/prompt-schema-refs.js +478 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +79 -0
- package/dist/src/lib/records-verbs.js +45 -0
- package/dist/src/lib/records-verbs.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
- package/dist/src/lib/refresh-admin-credentials.js +85 -29
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/refresh-stored-login.d.ts +85 -0
- package/dist/src/lib/refresh-stored-login.js +233 -0
- package/dist/src/lib/refresh-stored-login.js.map +1 -0
- package/dist/src/lib/register-commands.d.ts +36 -0
- package/dist/src/lib/register-commands.js +37 -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/row-field-rename.d.ts +18 -0
- package/dist/src/lib/row-field-rename.js +32 -0
- package/dist/src/lib/row-field-rename.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- 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 +227 -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 +229 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +420 -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 +258 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- 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/generated-schema-shape.d.ts +27 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.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/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.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 +109 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-defs-module.d.ts +29 -0
- package/dist/src/lib/schema-defs-module.js +103 -0
- package/dist/src/lib/schema-defs-module.js.map +1 -0
- package/dist/src/lib/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/scope-request.d.ts +23 -11
- package/dist/src/lib/scope-request.js +69 -31
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.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 +25 -23
- 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 +169 -51
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
- package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +51 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +239 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.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 +117 -31
- package/dist/src/lib/sync-resource-types.js +197 -189
- 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/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.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 +4 -2
- package/dist/src/lib/toml-database-config.js +11 -6
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-list-edit.d.ts +33 -0
- package/dist/src/lib/toml-list-edit.js +481 -0
- package/dist/src/lib/toml-list-edit.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
- package/dist/src/lib/toml-scalar-edit.js +73 -5
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/transition-warnings.d.ts +21 -0
- package/dist/src/lib/transition-warnings.js +49 -0
- package/dist/src/lib/transition-warnings.js.map +1 -0
- package/dist/src/lib/usage-meters.d.ts +16 -0
- package/dist/src/lib/usage-meters.js +52 -0
- package/dist/src/lib/usage-meters.js.map +1 -0
- package/dist/src/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/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.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 +20 -65
- package/dist/src/validators.d.ts +7 -55
- package/dist/src/validators.js +7 -53
- package/dist/src/validators.js.map +1 -1
- package/dist/src/vite.d.ts +17 -0
- package/dist/src/vite.js +18 -0
- package/dist/src/vite.js.map +1 -0
- package/package.json +20 -9
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refresh from the stored login, and hand off a separate login.
|
|
3
|
+
*
|
|
4
|
+
* A CLI login made by this CLI rotates its refresh token: every refresh
|
|
5
|
+
* replaces it, and presenting a replaced one ends the login. Several
|
|
6
|
+
* processes share one stored login (a long-running command beside short
|
|
7
|
+
* ones), so a process never refreshes from the copy it loaded at start: it
|
|
8
|
+
* reads the stored login again first, and uses it when it is the same session.
|
|
9
|
+
* When another process has already refreshed and the stored access token is
|
|
10
|
+
* still good, it is adopted and no request is made.
|
|
11
|
+
*
|
|
12
|
+
* The credentials lock is not held across the request; the server's grace for
|
|
13
|
+
* the immediate predecessor covers processes that overlap.
|
|
14
|
+
*
|
|
15
|
+
* `primitive token --refresh` on a rotating login hands off a separate login
|
|
16
|
+
* (`handoff: true` on the refresh), so the printed token never shares a
|
|
17
|
+
* rotating session with the stored one.
|
|
18
|
+
*/
|
|
19
|
+
import { loadCredentials, saveCredentials } from "./config.js";
|
|
20
|
+
import { CredentialsLockedError } from "./credentials-lock.js";
|
|
21
|
+
import { fetchWithTLS } from "./fetch.js";
|
|
22
|
+
import { RefreshError, credentialsFromRefreshResponse, postAdminRefresh, refreshAdminCredentials, } from "./refresh-admin-credentials.js";
|
|
23
|
+
/** Saves of a rotated login made before the command fails on a held lock. */
|
|
24
|
+
export const LOCK_SAVE_ATTEMPTS = 3;
|
|
25
|
+
/** How a stored access token near expiry is judged: under five minutes left. */
|
|
26
|
+
const EXPIRING_SOON_MS = 5 * 60 * 1000;
|
|
27
|
+
/** Re-reads of the stored login after the server answers "not the current token". */
|
|
28
|
+
const HANDOFF_REREADS = 3;
|
|
29
|
+
const HANDOFF_REREAD_DELAY_MS = 500;
|
|
30
|
+
function claimsOf(token) {
|
|
31
|
+
if (!token)
|
|
32
|
+
return null;
|
|
33
|
+
try {
|
|
34
|
+
const payload = token.split(".")[1];
|
|
35
|
+
if (!payload)
|
|
36
|
+
return null;
|
|
37
|
+
return JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** The session a login belongs to: its tokens' `sid`, or null. */
|
|
44
|
+
export function sessionIdOf(credentials) {
|
|
45
|
+
for (const token of [credentials.refreshToken, credentials.accessToken]) {
|
|
46
|
+
const sid = claimsOf(token)?.sid;
|
|
47
|
+
if (typeof sid === "string" && sid)
|
|
48
|
+
return sid;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/** The generation a rotating login's refresh token carries (`rg`), or undefined. */
|
|
53
|
+
export function refreshGenerationOf(refreshToken) {
|
|
54
|
+
const rg = claimsOf(refreshToken)?.rg;
|
|
55
|
+
return typeof rg === "number" ? rg : undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Choose what a process about to refresh `inMemory` uses, given the login
|
|
59
|
+
* stored now. The stored login is used only when it is the same session: its
|
|
60
|
+
* refresh token is the newest, and when its access token is not near expiry
|
|
61
|
+
* it is adopted with no request. A missing stored login, or one of another
|
|
62
|
+
* session, leaves the process refreshing its own. Pure.
|
|
63
|
+
*/
|
|
64
|
+
export function chooseRefreshSource(inMemory, stored, now = Date.now()) {
|
|
65
|
+
if (!stored || stored.source === "env" || !stored.refreshToken) {
|
|
66
|
+
return { action: "refresh", credentials: inMemory };
|
|
67
|
+
}
|
|
68
|
+
const sid = sessionIdOf(inMemory);
|
|
69
|
+
if (!sid || sessionIdOf(stored) !== sid) {
|
|
70
|
+
return { action: "refresh", credentials: inMemory };
|
|
71
|
+
}
|
|
72
|
+
const expiresAt = stored.expiresAt ? new Date(stored.expiresAt).getTime() : NaN;
|
|
73
|
+
if (Number.isFinite(expiresAt) && expiresAt - now >= EXPIRING_SOON_MS) {
|
|
74
|
+
return { action: "adopt", credentials: stored };
|
|
75
|
+
}
|
|
76
|
+
return { action: "refresh", credentials: stored };
|
|
77
|
+
}
|
|
78
|
+
/** The stored login `load` returns, or null when it is missing or cannot be read. */
|
|
79
|
+
export function readStoredLoginSafely(load) {
|
|
80
|
+
try {
|
|
81
|
+
return load() ?? null;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Run `save`, retrying while the credentials lock is held by another process:
|
|
89
|
+
* `attempts` lock waits in all (each waits as long as the lock does). Any
|
|
90
|
+
* other failure is not retried.
|
|
91
|
+
*/
|
|
92
|
+
export function saveWithLockRetry(save, attempts = LOCK_SAVE_ATTEMPTS) {
|
|
93
|
+
for (let attempt = 1;; attempt++) {
|
|
94
|
+
try {
|
|
95
|
+
save();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
if (!(err instanceof CredentialsLockedError) || attempt >= attempts)
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Refresh `inMemory` from the stored login: read it again, adopt it or
|
|
106
|
+
* refresh from its token (see `chooseRefreshSource`), and save the result.
|
|
107
|
+
* Credentials from `PRIMITIVE_TOKEN` are returned as they are: never re-read
|
|
108
|
+
* from a file and never refreshed. Throws `RefreshError` as
|
|
109
|
+
* `refreshAdminCredentials` does.
|
|
110
|
+
*/
|
|
111
|
+
export async function refreshFromStoredLogin(inMemory, access = {}) {
|
|
112
|
+
if (inMemory.source === "env")
|
|
113
|
+
return inMemory;
|
|
114
|
+
const load = access.load ?? loadCredentials;
|
|
115
|
+
const save = access.save ?? saveCredentials;
|
|
116
|
+
const choice = chooseRefreshSource(inMemory, readStoredLoginSafely(load));
|
|
117
|
+
if (choice.action === "adopt")
|
|
118
|
+
return choice.credentials;
|
|
119
|
+
const refreshed = await refreshAdminCredentials(choice.credentials);
|
|
120
|
+
saveWithLockRetry(() => save(refreshed));
|
|
121
|
+
return refreshed;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The handed-off login a refresh answer carries. Throws when the answer has
|
|
125
|
+
* none: a server that does not hand off answered a request that asked it to.
|
|
126
|
+
*/
|
|
127
|
+
export function handoffFromRefreshResponse(body) {
|
|
128
|
+
const handoff = body?.handoff;
|
|
129
|
+
if (!handoff ||
|
|
130
|
+
typeof handoff.refreshToken !== "string" ||
|
|
131
|
+
!handoff.refreshToken ||
|
|
132
|
+
typeof handoff.sessionId !== "string" ||
|
|
133
|
+
!handoff.sessionId) {
|
|
134
|
+
throw new Error("The server did not hand off a separate login, so no refresh token was printed. Run 'primitive token --refresh' again.");
|
|
135
|
+
}
|
|
136
|
+
return { refreshToken: handoff.refreshToken, sessionId: handoff.sessionId };
|
|
137
|
+
}
|
|
138
|
+
/** The message for a hand-off another command's refresh beat. */
|
|
139
|
+
const HANDOFF_RACED_MESSAGE = "Another command refreshed this login at the same moment, so no token was handed off. Run 'primitive token --refresh' again.";
|
|
140
|
+
async function storedTokenChangedFrom(source, load, sleep) {
|
|
141
|
+
for (let read = 1; read <= HANDOFF_REREADS; read++) {
|
|
142
|
+
const stored = readStoredLoginSafely(load);
|
|
143
|
+
if (stored?.refreshToken &&
|
|
144
|
+
stored.refreshToken !== source.refreshToken &&
|
|
145
|
+
sessionIdOf(stored) === sessionIdOf(source)) {
|
|
146
|
+
return stored;
|
|
147
|
+
}
|
|
148
|
+
if (read < HANDOFF_REREADS)
|
|
149
|
+
await sleep(HANDOFF_REREAD_DELAY_MS);
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
/** End a handed-off login nobody will hold, through logout. Best effort. */
|
|
154
|
+
async function endHandedOffLogin(source, refreshToken) {
|
|
155
|
+
const headers = { "Content-Type": "application/json" };
|
|
156
|
+
if (source.globalAdminAppId)
|
|
157
|
+
headers["X-Global-Admin-App-Id"] = source.globalAdminAppId;
|
|
158
|
+
try {
|
|
159
|
+
await fetchWithTLS(`${source.serverUrl}/admin/api/auth/logout`, {
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers,
|
|
162
|
+
body: JSON.stringify({ refreshToken }),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Best effort: the next refresh of the stored login ends it anyway.
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Hand off a separate login from the rotating login `credentials`, save the
|
|
171
|
+
* stored login's rotated token, and only then return the handed-off one.
|
|
172
|
+
*
|
|
173
|
+
* - Answered "not the current token" (another command just refreshed): the
|
|
174
|
+
* stored login is read again, up to three times half a second apart, and
|
|
175
|
+
* the hand-off retried once if its token changed.
|
|
176
|
+
* - A transport failure: one ordinary refresh with the same token is made
|
|
177
|
+
* and saved, so the stored login is current again while the server's grace
|
|
178
|
+
* lasts; the hand-off is not retried.
|
|
179
|
+
* - The rotated login cannot be saved: the handed-off login is ended and the
|
|
180
|
+
* error says the stored login may be ended by the next command.
|
|
181
|
+
*/
|
|
182
|
+
export async function handOffStoredLogin(credentials, access = {}) {
|
|
183
|
+
const load = access.load ?? loadCredentials;
|
|
184
|
+
const save = access.save ?? saveCredentials;
|
|
185
|
+
const sleep = access.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
186
|
+
let source = credentials;
|
|
187
|
+
for (let attempt = 1;; attempt++) {
|
|
188
|
+
let data;
|
|
189
|
+
try {
|
|
190
|
+
data = await postAdminRefresh(source, { refreshToken: source.refreshToken, handoff: true });
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
if (err instanceof RefreshError && err.code === "HANDOFF_NEEDS_CURRENT_TOKEN") {
|
|
194
|
+
const changed = attempt === 1 ? await storedTokenChangedFrom(source, load, sleep) : null;
|
|
195
|
+
if (changed) {
|
|
196
|
+
source = changed;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
throw new RefreshError(HANDOFF_RACED_MESSAGE, "unauthorized", err.statusCode, err, err.code);
|
|
200
|
+
}
|
|
201
|
+
if (err instanceof RefreshError && err.kind === "network") {
|
|
202
|
+
try {
|
|
203
|
+
const refreshed = await refreshAdminCredentials(source);
|
|
204
|
+
saveWithLockRetry(() => save(refreshed));
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Unreachable still: the stored login is unchanged.
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
throw err;
|
|
211
|
+
}
|
|
212
|
+
const rotated = credentialsFromRefreshResponse(source, data, 200);
|
|
213
|
+
let handoff;
|
|
214
|
+
try {
|
|
215
|
+
handoff = handoffFromRefreshResponse(data);
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
// The refresh itself happened: keep its token.
|
|
219
|
+
saveWithLockRetry(() => save(rotated));
|
|
220
|
+
throw err;
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
saveWithLockRetry(() => save(rotated));
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
await endHandedOffLogin(source, handoff.refreshToken);
|
|
227
|
+
throw new Error(`Could not save the refreshed login (${err?.message || String(err)}), so no token was printed and the handed-off login was ended. ` +
|
|
228
|
+
"The stored login may be ended by the next command; if it is, run 'primitive login'.");
|
|
229
|
+
}
|
|
230
|
+
return handoff;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=refresh-stored-login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-stored-login.js","sourceRoot":"","sources":["../../../src/lib/refresh-stored-login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AAGxC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvC,qFAAqF;AACrF,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,SAAS,QAAQ,CAAC,KAAyB;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,KAAK,CAAC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A0B,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,+CAA+C;YAC/C,iBAAiB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACvC,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,IAAI,CAAC;YACH,iBAAiB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;YACtD,MAAM,IAAI,KAAK,CACb,uCAAuC,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,iEAAiE;gBACjI,qFAAqF,CACxF,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `primitive` CLI's command tree, as the bin runs it.
|
|
3
|
+
*
|
|
4
|
+
* `cli/bin/primitive.ts` builds its tree through `registerAllCommands`, and so
|
|
5
|
+
* does anything that needs the whole tree without running the bin. It
|
|
6
|
+
* registers every group (`registerCommandGroups`, command-groups.ts), gives
|
|
7
|
+
* every command its row of the generated status table
|
|
8
|
+
* (`generated-command-status.ts`, written by `pnpm api-status --write`), and
|
|
9
|
+
* on a production build prunes the experimental commands. Registering a
|
|
10
|
+
* group in command-groups.ts, rather than in the bin, is what keeps the two
|
|
11
|
+
* trees the same.
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from "commander";
|
|
14
|
+
/** What {@link registerAllCommands} accepts. */
|
|
15
|
+
export interface RegisterAllCommandsOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the tree includes experimental commands. Defaults to this build's
|
|
18
|
+
* flag (`EXPERIMENTAL_APIS`, false only in a `PRIMITIVE_EXPERIMENTAL_APIS=0`
|
|
19
|
+
* build). When false, every command whose status is experimental is pruned
|
|
20
|
+
* and `config pull|diff|push` leave the experimental families alone.
|
|
21
|
+
*/
|
|
22
|
+
experimental?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Register every command group on `program` and give each command its status
|
|
26
|
+
* from the generated table. A production build (`experimental` false) throws
|
|
27
|
+
* when a registered command has no row, then prunes the experimental
|
|
28
|
+
* commands; a full build leaves a command with no row on its declared status.
|
|
29
|
+
*
|
|
30
|
+
* @param program The root commander `Command`.
|
|
31
|
+
* @param options Whether to include experimental commands.
|
|
32
|
+
* @returns The same `program`, with every group registered.
|
|
33
|
+
* @throws On a production build, when the status table has no row for a
|
|
34
|
+
* registered command (run `pnpm api-status --write`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerAllCommands(program: Command, options?: RegisterAllCommandsOptions): Command;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `primitive` CLI's command tree, as the bin runs it.
|
|
3
|
+
*
|
|
4
|
+
* `cli/bin/primitive.ts` builds its tree through `registerAllCommands`, and so
|
|
5
|
+
* does anything that needs the whole tree without running the bin. It
|
|
6
|
+
* registers every group (`registerCommandGroups`, command-groups.ts), gives
|
|
7
|
+
* every command its row of the generated status table
|
|
8
|
+
* (`generated-command-status.ts`, written by `pnpm api-status --write`), and
|
|
9
|
+
* on a production build prunes the experimental commands. Registering a
|
|
10
|
+
* group in command-groups.ts, rather than in the bin, is what keeps the two
|
|
11
|
+
* trees the same.
|
|
12
|
+
*/
|
|
13
|
+
import { applyCommandStatusTable, pruneExperimentalCommands } from "./command-status.js";
|
|
14
|
+
import { registerCommandGroups } from "./command-groups.js";
|
|
15
|
+
import { COMMAND_STATUS } from "./generated-command-status.js";
|
|
16
|
+
import { EXPERIMENTAL_APIS } from "./generated-build-flags.js";
|
|
17
|
+
/**
|
|
18
|
+
* Register every command group on `program` and give each command its status
|
|
19
|
+
* from the generated table. A production build (`experimental` false) throws
|
|
20
|
+
* when a registered command has no row, then prunes the experimental
|
|
21
|
+
* commands; a full build leaves a command with no row on its declared status.
|
|
22
|
+
*
|
|
23
|
+
* @param program The root commander `Command`.
|
|
24
|
+
* @param options Whether to include experimental commands.
|
|
25
|
+
* @returns The same `program`, with every group registered.
|
|
26
|
+
* @throws On a production build, when the status table has no row for a
|
|
27
|
+
* registered command (run `pnpm api-status --write`).
|
|
28
|
+
*/
|
|
29
|
+
export function registerAllCommands(program, options = {}) {
|
|
30
|
+
const experimental = options.experimental ?? EXPERIMENTAL_APIS;
|
|
31
|
+
registerCommandGroups(program, { experimental });
|
|
32
|
+
applyCommandStatusTable(program, COMMAND_STATUS, { strict: !experimental });
|
|
33
|
+
if (!experimental)
|
|
34
|
+
pruneExperimentalCommands(program);
|
|
35
|
+
return program;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=register-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-commands.js","sourceRoot":"","sources":["../../../src/lib/register-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAa/D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,UAAsC,EAAE;IAC5F,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,iBAAiB,CAAC;IAC/D,qBAAqB,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IACjD,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC,YAAY;QAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports of the declarations `functions/primitive.d.ts` replaced (#5544,
|
|
3
|
+
* project `unified-schemas` phase 10).
|
|
4
|
+
*
|
|
5
|
+
* Codegen no longer writes `primitive-function-types.d.ts`,
|
|
6
|
+
* `primitive-prompt-types.d.ts`, `primitive-db3-types.d.ts` or
|
|
7
|
+
* `primitive-user-properties.d.ts`, and removes the copies an earlier push
|
|
8
|
+
* left. A function source still importing one would fail at its first
|
|
9
|
+
* typecheck with a generic "Cannot find module", or not at all under
|
|
10
|
+
* `--no-typecheck` (a type-only import is erased). So `buildFunctionBundle`
|
|
11
|
+
* refuses it by name, the way it refuses the retired SDK specifier: this
|
|
12
|
+
* module says which specifiers are retired, finds them in an authored source,
|
|
13
|
+
* and words the refusal.
|
|
14
|
+
*
|
|
15
|
+
* A specifier is retired when it is relative and its base name, with any
|
|
16
|
+
* `.js`, `.ts` or `.d.ts` suffix removed, is a retired declaration's stem —
|
|
17
|
+
* `./primitive-function-types`, `../functions/primitive-prompt-types.js`.
|
|
18
|
+
* `./primitive`, `primitive-functions` and a tree file that merely shares a
|
|
19
|
+
* prefix (`./primitive-function-types-extra.ts`) are not.
|
|
20
|
+
*
|
|
21
|
+
* The scan is anchored at the start of a line, as the SDK one is, so prose
|
|
22
|
+
* naming a retired file — a comment, a doc line, a string — refuses nothing.
|
|
23
|
+
* `import("…")` is the one form read mid-line: a type position spells it
|
|
24
|
+
* there (`type T = import("./x").Y`).
|
|
25
|
+
*/
|
|
26
|
+
import { type RetiredDeclaration } from "./primitive-declaration-names.js";
|
|
27
|
+
/** One retired import an authored source makes. */
|
|
28
|
+
export interface RetiredImport {
|
|
29
|
+
/** The specifier as written. */
|
|
30
|
+
specifier: string;
|
|
31
|
+
retired: RetiredDeclaration;
|
|
32
|
+
/** The names its import or export clause lists, in order; empty when it lists none. */
|
|
33
|
+
names: string[];
|
|
34
|
+
}
|
|
35
|
+
/** The retired declaration a specifier names, or null; see the module note. */
|
|
36
|
+
export declare function retiredDeclarationStem(specifier: string): RetiredDeclaration | null;
|
|
37
|
+
/** Every module specifier a source names, with the names its clause lists, in source order. */
|
|
38
|
+
export declare function scanImportSpecifiers(source: string): Array<{
|
|
39
|
+
specifier: string;
|
|
40
|
+
names: string[];
|
|
41
|
+
index: number;
|
|
42
|
+
typeOnly: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
/** Every retired import a source makes, in source order. */
|
|
45
|
+
export declare function scanRetiredImports(source: string): RetiredImport[];
|
|
46
|
+
/**
|
|
47
|
+
* The refusal for one retired import of `file` (tree-relative), in the
|
|
48
|
+
* function `functionKey`'s build: the replacement specifier, the namespace and
|
|
49
|
+
* an example name — the name the import listed, or one the namespace holds. A
|
|
50
|
+
* top-level `Primitive*` name keeps its spelling in `primitive.d.ts`, so only
|
|
51
|
+
* the specifier changes.
|
|
52
|
+
*/
|
|
53
|
+
export declare function retiredImportRefusal(functionKey: string, file: string, found: RetiredImport): string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports of the declarations `functions/primitive.d.ts` replaced (#5544,
|
|
3
|
+
* project `unified-schemas` phase 10).
|
|
4
|
+
*
|
|
5
|
+
* Codegen no longer writes `primitive-function-types.d.ts`,
|
|
6
|
+
* `primitive-prompt-types.d.ts`, `primitive-db3-types.d.ts` or
|
|
7
|
+
* `primitive-user-properties.d.ts`, and removes the copies an earlier push
|
|
8
|
+
* left. A function source still importing one would fail at its first
|
|
9
|
+
* typecheck with a generic "Cannot find module", or not at all under
|
|
10
|
+
* `--no-typecheck` (a type-only import is erased). So `buildFunctionBundle`
|
|
11
|
+
* refuses it by name, the way it refuses the retired SDK specifier: this
|
|
12
|
+
* module says which specifiers are retired, finds them in an authored source,
|
|
13
|
+
* and words the refusal.
|
|
14
|
+
*
|
|
15
|
+
* A specifier is retired when it is relative and its base name, with any
|
|
16
|
+
* `.js`, `.ts` or `.d.ts` suffix removed, is a retired declaration's stem —
|
|
17
|
+
* `./primitive-function-types`, `../functions/primitive-prompt-types.js`.
|
|
18
|
+
* `./primitive`, `primitive-functions` and a tree file that merely shares a
|
|
19
|
+
* prefix (`./primitive-function-types-extra.ts`) are not.
|
|
20
|
+
*
|
|
21
|
+
* The scan is anchored at the start of a line, as the SDK one is, so prose
|
|
22
|
+
* naming a retired file — a comment, a doc line, a string — refuses nothing.
|
|
23
|
+
* `import("…")` is the one form read mid-line: a type position spells it
|
|
24
|
+
* there (`type T = import("./x").Y`).
|
|
25
|
+
*/
|
|
26
|
+
import { basename } from "path";
|
|
27
|
+
import { workflowTypeBaseName } from "./schema-codegen/naming.js";
|
|
28
|
+
import { PRIMITIVE_DECLARATION_SPECIFIER, RETIRED_DECLARATIONS, } from "./primitive-declaration-names.js";
|
|
29
|
+
/** The retired declaration a specifier names, or null; see the module note. */
|
|
30
|
+
export function retiredDeclarationStem(specifier) {
|
|
31
|
+
if (!specifier.startsWith("./") && !specifier.startsWith("../"))
|
|
32
|
+
return null;
|
|
33
|
+
const stem = basename(specifier).replace(/\.d\.ts$|\.ts$|\.js$/, "");
|
|
34
|
+
return RETIRED_DECLARATIONS.find((retired) => retired.file === `${stem}.d.ts`) ?? null;
|
|
35
|
+
}
|
|
36
|
+
/** The names of an import or export clause (`{ A, type B as C }` → `A`, `B`). */
|
|
37
|
+
function clauseNames(clause) {
|
|
38
|
+
const braces = /\{([^}]*)\}/.exec(clause);
|
|
39
|
+
if (!braces)
|
|
40
|
+
return [];
|
|
41
|
+
return braces[1]
|
|
42
|
+
.split(",")
|
|
43
|
+
.map((part) => part.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0].trim())
|
|
44
|
+
.filter((name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The import and export forms that name a module, each anchored at the start
|
|
48
|
+
* of a line: a clause and its `from` (on one line or ending a multi-line
|
|
49
|
+
* clause), a bare side-effect import, and a triple-slash reference.
|
|
50
|
+
*/
|
|
51
|
+
const FROM_FORM = /^[ \t]*(?:import|export)\b([^;'"]*?)\bfrom[ \t]*(['"])([^'"\n]+)\2/gm;
|
|
52
|
+
const BARE_FORM = /^[ \t]*import[ \t]*(['"])([^'"\n]+)\1/gm;
|
|
53
|
+
const REFERENCE_FORM = /^[ \t]*\/\/\/[ \t]*<reference[ \t]+path[ \t]*=[ \t]*(['"])([^'"\n]+)\1/gm;
|
|
54
|
+
const DYNAMIC_FORM = /\bimport[ \t]*\([ \t]*(['"])([^'"\n]+)\1[ \t]*\)/g;
|
|
55
|
+
/** Whether the line holding `index` is a comment line (`//`, `*`, `/*`). */
|
|
56
|
+
function onCommentLine(source, index) {
|
|
57
|
+
const start = source.lastIndexOf("\n", index - 1) + 1;
|
|
58
|
+
return /^[ \t]*(\/\/|\*|\/\*)/.test(source.slice(start, index + 1));
|
|
59
|
+
}
|
|
60
|
+
/** Every module specifier a source names, with the names its clause lists, in source order. */
|
|
61
|
+
export function scanImportSpecifiers(source) {
|
|
62
|
+
const found = [];
|
|
63
|
+
// A clause holds no `;` and no quote, so a `from` past the end of a
|
|
64
|
+
// statement is never read as this one's.
|
|
65
|
+
for (const match of source.matchAll(FROM_FORM)) {
|
|
66
|
+
found.push({ specifier: match[3], names: clauseNames(match[1]), index: match.index, typeOnly: /^\s*type\b/.test(match[1]) });
|
|
67
|
+
}
|
|
68
|
+
for (const match of source.matchAll(BARE_FORM))
|
|
69
|
+
found.push({ specifier: match[2], names: [], index: match.index, typeOnly: false });
|
|
70
|
+
for (const match of source.matchAll(REFERENCE_FORM))
|
|
71
|
+
found.push({ specifier: match[2], names: [], index: match.index, typeOnly: true });
|
|
72
|
+
for (const match of source.matchAll(DYNAMIC_FORM)) {
|
|
73
|
+
if (onCommentLine(source, match.index))
|
|
74
|
+
continue;
|
|
75
|
+
found.push({ specifier: match[2], names: [], index: match.index, typeOnly: false });
|
|
76
|
+
}
|
|
77
|
+
return found.sort((a, b) => a.index - b.index);
|
|
78
|
+
}
|
|
79
|
+
/** Every retired import a source makes, in source order. */
|
|
80
|
+
export function scanRetiredImports(source) {
|
|
81
|
+
const found = [];
|
|
82
|
+
for (const { specifier, names } of scanImportSpecifiers(source)) {
|
|
83
|
+
const retired = retiredDeclarationStem(specifier);
|
|
84
|
+
if (retired)
|
|
85
|
+
found.push({ specifier, retired, names });
|
|
86
|
+
}
|
|
87
|
+
return found;
|
|
88
|
+
}
|
|
89
|
+
/** A name of the namespace to give as the example when the import names none. */
|
|
90
|
+
function fallbackExample(namespace, functionKey) {
|
|
91
|
+
switch (namespace) {
|
|
92
|
+
case "Functions":
|
|
93
|
+
return `${workflowTypeBaseName(functionKey)}Input`;
|
|
94
|
+
case "Prompts":
|
|
95
|
+
return "<Key>PromptOutput";
|
|
96
|
+
case "Db3":
|
|
97
|
+
return "<Model>";
|
|
98
|
+
case "UserProperties":
|
|
99
|
+
return "UserProperties";
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The refusal for one retired import of `file` (tree-relative), in the
|
|
104
|
+
* function `functionKey`'s build: the replacement specifier, the namespace and
|
|
105
|
+
* an example name — the name the import listed, or one the namespace holds. A
|
|
106
|
+
* top-level `Primitive*` name keeps its spelling in `primitive.d.ts`, so only
|
|
107
|
+
* the specifier changes.
|
|
108
|
+
*/
|
|
109
|
+
export function retiredImportRefusal(functionKey, file, found) {
|
|
110
|
+
const head = `function '${functionKey}': ${file} imports "${found.specifier}", which codegen no longer writes.`;
|
|
111
|
+
const first = found.names[0];
|
|
112
|
+
if (first && /^Primitive/.test(first)) {
|
|
113
|
+
return `${head} Import type { ${first} } from "${PRIMITIVE_DECLARATION_SPECIFIER}": the name is unchanged.`;
|
|
114
|
+
}
|
|
115
|
+
const namespace = found.retired.namespace;
|
|
116
|
+
const example = first ?? fallbackExample(namespace, functionKey);
|
|
117
|
+
return (`${head} Import type { ${namespace} } from "${PRIMITIVE_DECLARATION_SPECIFIER}" and write ` +
|
|
118
|
+
`${namespace}.<Name> (for example ${namespace}.${example}).`);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=retired-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retired-imports.js","sourceRoot":"","sources":["../../../src/lib/retired-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,+BAA+B,EAC/B,oBAAoB,GAErB,MAAM,kCAAkC,CAAC;AAW1C,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACrE,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC;AACzF,CAAC;AAED,iFAAiF;AACjF,SAAS,WAAW,CAAC,MAAc;IACjC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,MAAM,CAAC,CAAC,CAAC;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO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ACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,SAAS,eAAe,CAAC,SAA0C,EAAE,WAAmB;IACtF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,WAAW;YACd,OAAO,GAAG,oBAAoB,CAAC,WAAW,CAAC,OAAO,CAAC;QACrD,KAAK,SAAS;YACZ,OAAO,mBAAmB,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,SAAS,CAAC;QACnB,KAAK,gBAAgB;YACnB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB,EAAE,IAAY,EAAE,KAAoB;IAC1F,MAAM,IAAI,GAAG,aAAa,WAAW,MAAM,IAAI,aAAa,KAAK,CAAC,SAAS,oCAAoC,CAAC;IAChH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,kBAAkB,KAAK,YAAY,+BAA+B,2BAA2B,CAAC;IAC9G,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,IAAI,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjE,OAAO,CACL,GAAG,IAAI,kBAAkB,SAAS,YAAY,+BAA+B,cAAc;QAC3F,GAAG,SAAS,wBAAwB,SAAS,IAAI,OAAO,IAAI,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renaming a row's field keys, model by model: what `db3 export` does to a
|
|
3
|
+
* renamed field's stored name (to its current name) and `db3 import` does
|
|
4
|
+
* back (current name to stored name).
|
|
5
|
+
*/
|
|
6
|
+
/** Per model, each field key to rename and the name it takes. */
|
|
7
|
+
export type RowFieldRenames = Record<string, Record<string, string>>;
|
|
8
|
+
/** The renames for `model`, or `null` when there are none. */
|
|
9
|
+
export declare function renamesFor(renames: RowFieldRenames | undefined, model: string): Record<string, string> | null;
|
|
10
|
+
/**
|
|
11
|
+
* `fields` with each key `names` lists renamed, every other key kept, each
|
|
12
|
+
* as an own property. A row that would hold one field under two names is
|
|
13
|
+
* refused, naming both and the record, rather than losing either value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renameRowFields(fields: Record<string, unknown>, names: Record<string, string>, where: {
|
|
16
|
+
model: string;
|
|
17
|
+
id: string;
|
|
18
|
+
}): Record<string, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renaming a row's field keys, model by model: what `db3 export` does to a
|
|
3
|
+
* renamed field's stored name (to its current name) and `db3 import` does
|
|
4
|
+
* back (current name to stored name).
|
|
5
|
+
*/
|
|
6
|
+
/** The renames for `model`, or `null` when there are none. */
|
|
7
|
+
export function renamesFor(renames, model) {
|
|
8
|
+
if (!renames || !Object.prototype.hasOwnProperty.call(renames, model))
|
|
9
|
+
return null;
|
|
10
|
+
const names = renames[model];
|
|
11
|
+
return names && Object.keys(names).length ? names : null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `fields` with each key `names` lists renamed, every other key kept, each
|
|
15
|
+
* as an own property. A row that would hold one field under two names is
|
|
16
|
+
* refused, naming both and the record, rather than losing either value.
|
|
17
|
+
*/
|
|
18
|
+
export function renameRowFields(fields, names, where) {
|
|
19
|
+
const out = {};
|
|
20
|
+
const from = new Map();
|
|
21
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
22
|
+
const to = Object.prototype.hasOwnProperty.call(names, key) ? names[key] : key;
|
|
23
|
+
const earlier = from.get(to);
|
|
24
|
+
if (earlier !== undefined) {
|
|
25
|
+
throw new Error(`Record ${where.model} ${where.id} holds the field as both ${earlier} and ${key}, which name one field (${to}); nothing was written.`);
|
|
26
|
+
}
|
|
27
|
+
from.set(to, key);
|
|
28
|
+
Object.defineProperty(out, to, { value, enumerable: true, writable: true, configurable: true });
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=row-field-rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-field-rename.js","sourceRoot":"","sources":["../../../src/lib/row-field-rename.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,OAAoC,EAAE,KAAa;IAC5E,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA+B,EAC/B,KAA6B,EAC7B,KAAoC;IAEpC,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,UAAU,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,4BAA4B,OAAO,QAAQ,GAAG,2BAA2B,EAAE,yBAAyB,CACtI,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAClB,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Those spellings no longer reach a client.
|
|
9
9
|
*
|
|
10
10
|
* #2636 — the vocabulary itself is no longer copied by hand: it is GENERATED
|
|
11
|
-
* from the server's `src/
|
|
11
|
+
* from the server's `src/function-runs/run-status.ts` into
|
|
12
12
|
* `run-status.generated.ts` (`pnpm gen:run-status`) and re-exported here, so a
|
|
13
13
|
* future status is a one-site edit plus regeneration rather than four
|
|
14
14
|
* hand-edits that a lagging copy turns into a hung poll loop. This module stays
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* GENERATED FILE — do not edit by hand.
|
|
3
3
|
*
|
|
4
4
|
* The canonical workflow-run status vocabulary, as the CLI sees it.
|
|
5
|
-
* Generated from the server's `src/
|
|
5
|
+
* Generated from the server's `src/function-runs/run-status.ts` by
|
|
6
6
|
* `scripts/gen-run-status-mirrors.mjs` (`pnpm gen:run-status`), because
|
|
7
7
|
* the CLI is a separately built package and cannot import worker
|
|
8
8
|
* source. A stale copy is worse than a missing feature: a poll loop whose
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* colours, help text) live in `cli/src/lib/run-status.ts`, which re-exports
|
|
15
15
|
* everything below.
|
|
16
16
|
*/
|
|
17
|
-
export declare const RUN_STATUSES: readonly ["queued", "running", "apply_pending", "apply_claimed", "completed", "failed", "terminated", "missing", "skipped"];
|
|
17
|
+
export declare const RUN_STATUSES: readonly ["queued", "running", "apply_pending", "apply_claimed", "completed", "failed", "terminated", "missing", "skipped", "denied"];
|
|
18
18
|
export type RunStatus = (typeof RUN_STATUSES)[number];
|
|
19
19
|
/** Comma-separated list for help text and error messages. */
|
|
20
20
|
export declare const RUN_STATUS_LIST: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* GENERATED FILE — do not edit by hand.
|
|
3
3
|
*
|
|
4
4
|
* The canonical workflow-run status vocabulary, as the CLI sees it.
|
|
5
|
-
* Generated from the server's `src/
|
|
5
|
+
* Generated from the server's `src/function-runs/run-status.ts` by
|
|
6
6
|
* `scripts/gen-run-status-mirrors.mjs` (`pnpm gen:run-status`), because
|
|
7
7
|
* the CLI is a separately built package and cannot import worker
|
|
8
8
|
* source. A stale copy is worse than a missing feature: a poll loop whose
|
|
@@ -24,6 +24,7 @@ export const RUN_STATUSES = [
|
|
|
24
24
|
"terminated",
|
|
25
25
|
"missing",
|
|
26
26
|
"skipped",
|
|
27
|
+
"denied",
|
|
27
28
|
];
|
|
28
29
|
/** Comma-separated list for help text and error messages. */
|
|
29
30
|
export const RUN_STATUS_LIST = RUN_STATUSES.join(", ");
|
|
@@ -33,6 +34,7 @@ export const TERMINAL_RUN_STATUSES = new Set([
|
|
|
33
34
|
"failed",
|
|
34
35
|
"terminated",
|
|
35
36
|
"skipped",
|
|
37
|
+
"denied",
|
|
36
38
|
]);
|
|
37
39
|
/**
|
|
38
40
|
* Apply-flow states: the run finished executing but is parked waiting for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-status.generated.js","sourceRoot":"","sources":["../../../src/lib/run-status.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,eAAe;IACf,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;
|
|
1
|
+
{"version":3,"file":"run-status.generated.js","sourceRoot":"","sources":["../../../src/lib/run-status.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,eAAe;IACf,eAAe;IACf,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;IACT,QAAQ;CACA,CAAC;AAIX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEvD,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAS;IACxE,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAS;IACrE,eAAe;IACf,eAAe;CAChB,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAS;IACzE,QAAQ;IACR,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS;IACvE,GAAG,qBAAqB;IACxB,GAAG,kBAAkB;IACrB,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAK,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjF,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Those spellings no longer reach a client.
|
|
9
9
|
*
|
|
10
10
|
* #2636 — the vocabulary itself is no longer copied by hand: it is GENERATED
|
|
11
|
-
* from the server's `src/
|
|
11
|
+
* from the server's `src/function-runs/run-status.ts` into
|
|
12
12
|
* `run-status.generated.ts` (`pnpm gen:run-status`) and re-exported here, so a
|
|
13
13
|
* future status is a one-site edit plus regeneration rather than four
|
|
14
14
|
* hand-edits that a lagging copy turns into a hung poll loop. This module stays
|