primitive-admin 1.1.0-alpha.9 → 1.1.0
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 +523 -109
- package/assets/skill/skills/primitive-platform/SKILL.md +289 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +372 -21
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +136 -30
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +713 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +65 -100
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.d.ts +7 -0
- package/dist/src/commands/auth-sessions.js +144 -0
- package/dist/src/commands/auth-sessions.js.map +1 -0
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +238 -108
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/blob-buckets.js +331 -0
- package/dist/src/commands/blob-buckets.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/catalog.js +63 -48
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.js +85 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/collections.js +1282 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/comparisons.js +6 -6
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +46 -0
- package/dist/src/commands/config.js +465 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/connections.d.ts +2 -0
- package/dist/src/commands/connections.js +99 -0
- package/dist/src/commands/connections.js.map +1 -0
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +266 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-type-configs.d.ts +2 -0
- package/dist/src/commands/database-type-configs.js +164 -0
- package/dist/src/commands/database-type-configs.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +471 -0
- package/dist/src/commands/database-types.js.map +1 -0
- package/dist/src/commands/databases.d.ts +65 -0
- package/dist/src/commands/databases.js +1887 -243
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +60 -0
- package/dist/src/commands/documents.js +2888 -22
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/email-templates.js +175 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/env.d.ts +23 -0
- package/dist/src/commands/env.js +395 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/feature-flags.d.ts +14 -0
- package/dist/src/commands/feature-flags.js +117 -0
- package/dist/src/commands/feature-flags.js.map +1 -0
- package/dist/src/commands/functions.d.ts +20 -0
- package/dist/src/commands/functions.js +1630 -0
- package/dist/src/commands/functions.js.map +1 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/group-type-configs.js +87 -0
- package/dist/src/commands/group-type-configs.js.map +1 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +65 -113
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +223 -0
- package/dist/src/commands/guides.js +627 -69
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +37 -0
- package/dist/src/commands/init.js +1693 -208
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +428 -187
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +4 -2
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +8 -0
- package/dist/src/commands/locks.js +175 -0
- package/dist/src/commands/locks.js.map +1 -0
- package/dist/src/commands/metadata-category-configs.d.ts +12 -0
- package/dist/src/commands/metadata-category-configs.js +113 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -0
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +288 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/prompts.js +322 -634
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +3 -0
- package/dist/src/commands/rule-sets.js +139 -148
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +30 -0
- package/dist/src/commands/scripts.js +688 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/secrets.js +109 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/sessions.d.ts +2 -0
- package/dist/src/commands/sessions.js +76 -0
- package/dist/src/commands/sessions.js.map +1 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +158 -0
- package/dist/src/commands/sync-app-settings.js +328 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +2670 -0
- package/dist/src/commands/sync.js +17144 -834
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +132 -22
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +542 -24
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +97 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +12 -11
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +31 -0
- package/dist/src/commands/webhooks.js +633 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +88 -0
- package/dist/src/commands/workflows.js +1568 -742
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/access-rule-display.d.ts +21 -0
- package/dist/src/lib/access-rule-display.js +34 -0
- package/dist/src/lib/access-rule-display.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +2550 -0
- package/dist/src/lib/api-client.js +2503 -160
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
- package/dist/src/lib/app-settings-descriptor.js +583 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/block-selector.d.ts +58 -0
- package/dist/src/lib/block-selector.js +92 -0
- package/dist/src/lib/block-selector.js.map +1 -0
- package/dist/src/lib/canonical-json.d.ts +12 -0
- package/dist/src/lib/canonical-json.js +35 -0
- package/dist/src/lib/canonical-json.js.map +1 -0
- package/dist/src/lib/channel.d.ts +30 -0
- package/dist/src/lib/channel.js +68 -0
- package/dist/src/lib/channel.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +68 -0
- package/dist/src/lib/cli-manifest.js +71 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +38 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +46 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/collection-export.d.ts +184 -0
- package/dist/src/lib/collection-export.js +252 -0
- package/dist/src/lib/collection-export.js.map +1 -0
- package/dist/src/lib/config-json-field.d.ts +28 -0
- package/dist/src/lib/config-json-field.js +56 -0
- package/dist/src/lib/config-json-field.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +127 -0
- package/dist/src/lib/config-object-descriptor.js +740 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +92 -0
- package/dist/src/lib/config-payload.js +161 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +141 -0
- package/dist/src/lib/config-surface.js +368 -0
- package/dist/src/lib/config-surface.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +71 -0
- package/dist/src/lib/config.js +71 -68
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/confirm-prompt.d.ts +83 -0
- package/dist/src/lib/confirm-prompt.js +110 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +11 -0
- package/dist/src/lib/constants.js +12 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +104 -0
- package/dist/src/lib/credentials-store.js +336 -0
- package/dist/src/lib/credentials-store.js.map +1 -0
- package/dist/src/lib/csv.d.ts +47 -0
- package/dist/src/lib/csv.js +172 -0
- package/dist/src/lib/csv.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +23 -0
- package/dist/src/lib/data-input.js +50 -0
- package/dist/src/lib/data-input.js.map +1 -0
- package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
- package/dist/src/lib/db-codegen/dbNaming.js +180 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +525 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +22 -0
- package/dist/src/lib/deprecation.js +43 -0
- package/dist/src/lib/deprecation.js.map +1 -0
- package/dist/src/lib/document-export-permissions.d.ts +30 -0
- package/dist/src/lib/document-export-permissions.js +54 -0
- package/dist/src/lib/document-export-permissions.js.map +1 -0
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest-rows.d.ts +137 -0
- package/dist/src/lib/document-ingest-rows.js +181 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +101 -0
- package/dist/src/lib/document-ingest.js +384 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/env-resolver-core.d.ts +258 -0
- package/dist/src/lib/env-resolver-core.js +447 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +99 -0
- package/dist/src/lib/env-resolver.js +153 -0
- package/dist/src/lib/env-resolver.js.map +1 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/function-bundle.d.ts +147 -0
- package/dist/src/lib/function-bundle.js +341 -0
- package/dist/src/lib/function-bundle.js.map +1 -0
- package/dist/src/lib/function-collect.d.ts +123 -0
- package/dist/src/lib/function-collect.js +610 -0
- package/dist/src/lib/function-collect.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +202 -0
- package/dist/src/lib/function-db-types.js +870 -0
- package/dist/src/lib/function-db-types.js.map +1 -0
- package/dist/src/lib/function-document-types.d.ts +144 -0
- package/dist/src/lib/function-document-types.js +370 -0
- package/dist/src/lib/function-document-types.js.map +1 -0
- package/dist/src/lib/function-grants-preflight.d.ts +64 -0
- package/dist/src/lib/function-grants-preflight.js +105 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -0
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-log-tail.d.ts +132 -0
- package/dist/src/lib/function-log-tail.js +262 -0
- package/dist/src/lib/function-log-tail.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +289 -0
- package/dist/src/lib/function-run.js +389 -0
- package/dist/src/lib/function-run.js.map +1 -0
- package/dist/src/lib/function-schema-codegen.d.ts +143 -0
- package/dist/src/lib/function-schema-codegen.js +420 -0
- package/dist/src/lib/function-schema-codegen.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +459 -0
- package/dist/src/lib/function-sync.js +1258 -0
- package/dist/src/lib/function-sync.js.map +1 -0
- package/dist/src/lib/function-trigger-listing.d.ts +27 -0
- package/dist/src/lib/function-trigger-listing.js +70 -0
- package/dist/src/lib/function-trigger-listing.js.map +1 -0
- package/dist/src/lib/function-typecheck.d.ts +86 -0
- package/dist/src/lib/function-typecheck.js +370 -0
- package/dist/src/lib/function-typecheck.js.map +1 -0
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-allowlist.d.ts +28 -0
- package/dist/src/lib/generated-allowlist.js +281 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +2936 -0
- package/dist/src/lib/generated-config-surfaces.js +10569 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-sdk-types.d.ts +12 -0
- package/dist/src/lib/generated-sdk-types.js +13 -0
- package/dist/src/lib/generated-sdk-types.js.map +1 -0
- package/dist/src/lib/generated-template-lint.d.ts +212 -0
- package/dist/src/lib/generated-template-lint.js +624 -0
- package/dist/src/lib/generated-template-lint.js.map +1 -0
- package/dist/src/lib/init-adopt.d.ts +16 -0
- package/dist/src/lib/init-adopt.js +34 -0
- package/dist/src/lib/init-adopt.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +39 -0
- package/dist/src/lib/init-assets.js +97 -0
- package/dist/src/lib/init-assets.js.map +1 -0
- package/dist/src/lib/init-client-platforms.d.ts +14 -0
- package/dist/src/lib/init-client-platforms.js +71 -0
- package/dist/src/lib/init-client-platforms.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +98 -0
- package/dist/src/lib/init-config.js +186 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
- package/dist/src/lib/init-email-redirect-uris.js +46 -0
- package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +91 -0
- package/dist/src/lib/init-ios-links.js +219 -0
- package/dist/src/lib/init-ios-links.js.map +1 -0
- package/dist/src/lib/init-plan.d.ts +80 -0
- package/dist/src/lib/init-plan.js +95 -0
- package/dist/src/lib/init-plan.js.map +1 -0
- package/dist/src/lib/init-production-env.d.ts +48 -0
- package/dist/src/lib/init-production-env.js +59 -0
- package/dist/src/lib/init-production-env.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +74 -0
- package/dist/src/lib/init-schema.js +358 -0
- package/dist/src/lib/init-schema.js.map +1 -0
- package/dist/src/lib/init-xcode.d.ts +34 -0
- package/dist/src/lib/init-xcode.js +138 -0
- package/dist/src/lib/init-xcode.js.map +1 -0
- package/dist/src/lib/integration-request-config.d.ts +30 -0
- package/dist/src/lib/integration-request-config.js +145 -0
- package/dist/src/lib/integration-request-config.js.map +1 -0
- package/dist/src/lib/integration-selector.d.ts +42 -0
- package/dist/src/lib/integration-selector.js +46 -0
- package/dist/src/lib/integration-selector.js.map +1 -0
- package/dist/src/lib/ios-app-id.d.ts +34 -0
- package/dist/src/lib/ios-app-id.js +69 -0
- package/dist/src/lib/ios-app-id.js.map +1 -0
- package/dist/src/lib/list-options.d.ts +68 -0
- package/dist/src/lib/list-options.js +89 -0
- package/dist/src/lib/list-options.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +55 -0
- package/dist/src/lib/local-state.js +167 -0
- package/dist/src/lib/local-state.js.map +1 -0
- package/dist/src/lib/local-test-cases.d.ts +63 -0
- package/dist/src/lib/local-test-cases.js +136 -0
- package/dist/src/lib/local-test-cases.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +715 -0
- package/dist/src/lib/log-inspection.js +816 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/logout-admin-session.d.ts +33 -0
- package/dist/src/lib/logout-admin-session.js +70 -0
- package/dist/src/lib/logout-admin-session.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +163 -0
- package/dist/src/lib/migration-nag.js.map +1 -0
- package/dist/src/lib/object-status-filter.d.ts +22 -0
- package/dist/src/lib/object-status-filter.js +45 -0
- package/dist/src/lib/object-status-filter.js.map +1 -0
- package/dist/src/lib/output.d.ts +124 -0
- package/dist/src/lib/output.js +219 -8
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/package-manager.d.ts +140 -0
- package/dist/src/lib/package-manager.js +305 -0
- package/dist/src/lib/package-manager.js.map +1 -0
- package/dist/src/lib/paginate.d.ts +98 -0
- package/dist/src/lib/paginate.js +112 -0
- package/dist/src/lib/paginate.js.map +1 -0
- package/dist/src/lib/platform-owned.d.ts +63 -0
- package/dist/src/lib/platform-owned.js +85 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +122 -0
- package/dist/src/lib/project-config.js +244 -0
- package/dist/src/lib/project-config.js.map +1 -0
- package/dist/src/lib/prompt-cost-format.d.ts +11 -0
- package/dist/src/lib/prompt-cost-format.js +41 -0
- package/dist/src/lib/prompt-cost-format.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +147 -0
- package/dist/src/lib/prompt-schema-codegen.js +462 -0
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/record-filter.d.ts +18 -0
- package/dist/src/lib/record-filter.js +55 -0
- package/dist/src/lib/record-filter.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +73 -0
- package/dist/src/lib/refresh-admin-credentials.js +123 -0
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
- package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
- package/dist/src/lib/resolve-init-dev-port.js +55 -0
- package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
- package/dist/src/lib/resolve-init-server.d.ts +64 -0
- package/dist/src/lib/resolve-init-server.js +77 -0
- package/dist/src/lib/resolve-init-server.js.map +1 -0
- package/dist/src/lib/resolve-owner.d.ts +19 -0
- package/dist/src/lib/resolve-owner.js +20 -0
- package/dist/src/lib/resolve-owner.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +74 -0
- package/dist/src/lib/resolve-platform.js +105 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +19 -0
- package/dist/src/lib/run-status.generated.d.ts +39 -0
- package/dist/src/lib/run-status.generated.js +66 -0
- package/dist/src/lib/run-status.generated.js.map +1 -0
- package/dist/src/lib/run-status.js +19 -0
- package/dist/src/lib/run-status.js.map +1 -0
- package/dist/src/lib/server-text-normalization.d.ts +51 -0
- package/dist/src/lib/server-text-normalization.js +90 -0
- package/dist/src/lib/server-text-normalization.js.map +1 -0
- package/dist/src/lib/server-url.d.ts +22 -0
- package/dist/src/lib/server-url.js +33 -0
- package/dist/src/lib/server-url.js.map +1 -0
- package/dist/src/lib/signing-secret-status.d.ts +81 -0
- package/dist/src/lib/signing-secret-status.js +116 -0
- package/dist/src/lib/signing-secret-status.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +71 -0
- package/dist/src/lib/skill-installer.js +441 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/snapshot-build.d.ts +50 -0
- package/dist/src/lib/snapshot-build.js +111 -0
- package/dist/src/lib/snapshot-build.js.map +1 -0
- package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
- package/dist/src/lib/snapshot-manifest-layout.js +70 -0
- package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +98 -0
- package/dist/src/lib/snapshots.js +294 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/step-run-table.d.ts +43 -0
- package/dist/src/lib/step-run-table.js +129 -0
- package/dist/src/lib/step-run-table.js.map +1 -0
- package/dist/src/lib/storage-pending-retry.d.ts +26 -0
- package/dist/src/lib/storage-pending-retry.js +42 -0
- package/dist/src/lib/storage-pending-retry.js.map +1 -0
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/banners.d.ts +24 -0
- package/dist/src/lib/swift-codegen/banners.js +25 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +926 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +139 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js +462 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +100 -0
- package/dist/src/lib/swift-codegen/generator.js +457 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +87 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +661 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-dir-selector.d.ts +21 -0
- package/dist/src/lib/sync-dir-selector.js +30 -0
- package/dist/src/lib/sync-dir-selector.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +128 -0
- package/dist/src/lib/sync-paths.js +195 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +563 -0
- package/dist/src/lib/sync-resource-types.js +1073 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/sync-selectors.d.ts +138 -0
- package/dist/src/lib/sync-selectors.js +289 -0
- package/dist/src/lib/sync-selectors.js.map +1 -0
- package/dist/src/lib/template.d.ts +170 -0
- package/dist/src/lib/template.js +484 -68
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +40 -0
- package/dist/src/lib/test-case-file-names.js +91 -0
- package/dist/src/lib/test-case-file-names.js.map +1 -0
- package/dist/src/lib/test-case-keys.d.ts +29 -0
- package/dist/src/lib/test-case-keys.js +55 -0
- package/dist/src/lib/test-case-keys.js.map +1 -0
- package/dist/src/lib/test-case-variables.d.ts +29 -0
- package/dist/src/lib/test-case-variables.js +71 -0
- package/dist/src/lib/test-case-variables.js.map +1 -0
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +123 -0
- package/dist/src/lib/toml-database-config.js +544 -0
- package/dist/src/lib/toml-database-config.js.map +1 -0
- package/dist/src/lib/toml-metadata-config.d.ts +151 -0
- package/dist/src/lib/toml-metadata-config.js +476 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +129 -0
- package/dist/src/lib/toml-params-validator.js +298 -0
- package/dist/src/lib/toml-params-validator.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
- package/dist/src/lib/toml-scalar-edit.js +283 -0
- package/dist/src/lib/toml-scalar-edit.js.map +1 -0
- package/dist/src/lib/user-selector.d.ts +24 -0
- package/dist/src/lib/user-selector.js +33 -0
- package/dist/src/lib/user-selector.js.map +1 -0
- package/dist/src/lib/version-check.d.ts +35 -0
- package/dist/src/lib/version-check.js +241 -0
- package/dist/src/lib/version-check.js.map +1 -0
- package/dist/src/lib/watch.d.ts +121 -0
- package/dist/src/lib/watch.js +169 -0
- package/dist/src/lib/watch.js.map +1 -0
- package/dist/src/lib/web-url.d.ts +40 -0
- package/dist/src/lib/web-url.js +76 -0
- package/dist/src/lib/web-url.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +209 -0
- package/dist/src/lib/webhook-deliver.js +519 -0
- package/dist/src/lib/webhook-deliver.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +110 -0
- package/dist/src/lib/workflow-apply.js +164 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generator.js +361 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-config-apply.d.ts +70 -0
- package/dist/src/lib/workflow-config-apply.js +137 -0
- package/dist/src/lib/workflow-config-apply.js.map +1 -0
- package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
- package/dist/src/lib/workflow-config-sidecar.js +96 -0
- package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
- package/dist/src/lib/workflow-defaults.d.ts +29 -0
- package/dist/src/lib/workflow-defaults.js +41 -0
- package/dist/src/lib/workflow-defaults.js.map +1 -0
- package/dist/src/lib/workflow-fragments.d.ts +64 -0
- package/dist/src/lib/workflow-fragments.js +342 -0
- package/dist/src/lib/workflow-fragments.js.map +1 -0
- package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
- package/dist/src/lib/workflow-include-preserve.js +286 -0
- package/dist/src/lib/workflow-include-preserve.js.map +1 -0
- package/dist/src/lib/workflow-payload.d.ts +98 -0
- package/dist/src/lib/workflow-payload.js +178 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +211 -0
- package/dist/src/lib/workflow-toml-validator.js +770 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/lib/workflow-usage.d.ts +196 -0
- package/dist/src/lib/workflow-usage.js +310 -0
- package/dist/src/lib/workflow-usage.js.map +1 -0
- package/dist/src/types/index.d.ts +591 -0
- package/dist/src/validators.d.ts +65 -0
- package/dist/src/validators.js +64 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +34 -9
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mark of a tail that has seen no row yet — CR3287-016.
|
|
3
|
+
*
|
|
4
|
+
* A ULID is 26 characters of Crockford base32, so this single character sorts
|
|
5
|
+
* below every one of them and above nothing: `idOf(row) <= EMPTY_TAIL_MARK`
|
|
6
|
+
* is false for every row, which is exactly "everything is new". It is a
|
|
7
|
+
* non-empty string, which is what keeps `followLoop` from reading it as an
|
|
8
|
+
* uninitialized tail.
|
|
9
|
+
*/
|
|
10
|
+
export const EMPTY_TAIL_MARK = "0";
|
|
11
|
+
/**
|
|
12
|
+
* How far below the mark the walk still looks — #3448 D3448-013.
|
|
13
|
+
*
|
|
14
|
+
* #3448 mints an invocation's id BEFORE the run and writes its record at
|
|
15
|
+
* SETTLEMENT, so a record can be inserted BELOW a mark set while it was still
|
|
16
|
+
* running: A starts, B starts and settles and is emitted, A settles. Under
|
|
17
|
+
* `stop at id <= mark` A is never shown — and A is the slow, failed and
|
|
18
|
+
* timed-out invocation an operator tails for (D3448-SO-003).
|
|
19
|
+
*
|
|
20
|
+
* The bound is the longest a REQUEST record can lag its own id: the platform's
|
|
21
|
+
* 30 s request ceiling plus the token's skew grace, rounded up to a minute.
|
|
22
|
+
* Nothing below it can still be in flight, so a row older than the window is
|
|
23
|
+
* already settled and was already emitted or already skipped.
|
|
24
|
+
*
|
|
25
|
+
* A task run's slice records carry settle-time ids of their own and are
|
|
26
|
+
* unaffected — they were never out of order.
|
|
27
|
+
*/
|
|
28
|
+
export const TAIL_OVERLAP_MS = 60_000;
|
|
29
|
+
/** Crockford base32, the alphabet a ULID's timestamp is written in. */
|
|
30
|
+
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
31
|
+
/**
|
|
32
|
+
* The id the walk stops below, given the mark.
|
|
33
|
+
*
|
|
34
|
+
* A mark this cannot read — the empty sentinel, or a fixture's short id — is
|
|
35
|
+
* its own bound: there is no instant to widen from, so the walk stops exactly
|
|
36
|
+
* where it stopped before this change, and #3287's own fixtures are unmoved.
|
|
37
|
+
*/
|
|
38
|
+
export function tailLowerBound(mark) {
|
|
39
|
+
if (mark.length !== 26)
|
|
40
|
+
return mark;
|
|
41
|
+
let at = 0;
|
|
42
|
+
for (let index = 0; index < 10; index += 1) {
|
|
43
|
+
const digit = CROCKFORD.indexOf(mark[index].toUpperCase());
|
|
44
|
+
if (digit < 0)
|
|
45
|
+
return mark;
|
|
46
|
+
at = at * 32 + digit;
|
|
47
|
+
}
|
|
48
|
+
let remaining = Math.max(0, at - TAIL_OVERLAP_MS);
|
|
49
|
+
let encoded = "";
|
|
50
|
+
for (let index = 0; index < 10; index += 1) {
|
|
51
|
+
encoded = CROCKFORD[remaining % 32] + encoded;
|
|
52
|
+
remaining = Math.floor(remaining / 32);
|
|
53
|
+
}
|
|
54
|
+
return `${encoded}${"0".repeat(16)}`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A bare mark stays a bare mark — the common case, and what an operator sees
|
|
58
|
+
* in a debug print. Anything more is JSON, which a ULID cannot start with, so
|
|
59
|
+
* the two are told apart by their first character.
|
|
60
|
+
*/
|
|
61
|
+
export function encodeTailCheckpoint(checkpoint) {
|
|
62
|
+
if (checkpoint.cursor === undefined &&
|
|
63
|
+
checkpoint.seen.length === 0 &&
|
|
64
|
+
checkpoint.floor === undefined &&
|
|
65
|
+
checkpoint.mark.length > 0) {
|
|
66
|
+
return checkpoint.mark;
|
|
67
|
+
}
|
|
68
|
+
return JSON.stringify(checkpoint);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A pre-#3448 checkpoint has no `seen` key and reads as an empty set, which is
|
|
72
|
+
* the honest answer: the tail that wrote it never looked below its mark, so it
|
|
73
|
+
* emitted nothing inside the window it needs to remember.
|
|
74
|
+
*/
|
|
75
|
+
export function decodeTailCheckpoint(token) {
|
|
76
|
+
if (token.startsWith("{")) {
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(token);
|
|
79
|
+
if (parsed && typeof parsed.mark === "string") {
|
|
80
|
+
const seen = Array.isArray(parsed.seen)
|
|
81
|
+
? parsed.seen.filter((id) => typeof id === "string")
|
|
82
|
+
: [];
|
|
83
|
+
const floor = typeof parsed.floor === "string" ? { floor: parsed.floor } : {};
|
|
84
|
+
return typeof parsed.cursor === "string"
|
|
85
|
+
? { mark: parsed.mark, cursor: parsed.cursor, seen, ...floor }
|
|
86
|
+
: { mark: parsed.mark, seen, ...floor };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// Not ours; fall through and treat it as a mark.
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { mark: token.length > 0 ? token : EMPTY_TAIL_MARK, seen: [] };
|
|
94
|
+
}
|
|
95
|
+
export function buildLogFollowSource(fetchPage, options) {
|
|
96
|
+
const { idOf, maxPagesPerTick } = options;
|
|
97
|
+
// The backlog of a walk in progress: rows newer than the mark, newest-first,
|
|
98
|
+
// collected but not yet emitted because the walk has not met the mark. Only
|
|
99
|
+
// meaningful for the mark it was collected against.
|
|
100
|
+
let pending = [];
|
|
101
|
+
let pendingMark = null;
|
|
102
|
+
return {
|
|
103
|
+
fetchAfter: async (resumeAfter) => {
|
|
104
|
+
// The bootstrap poll establishes the mark and emits nothing: a tail
|
|
105
|
+
// shows what happens FROM NOW. An empty listing is a mark too.
|
|
106
|
+
if (resumeAfter === undefined) {
|
|
107
|
+
let page = await fetchPage({});
|
|
108
|
+
const newest = page.items.length ? idOf(page.items[0]) : EMPTY_TAIL_MARK;
|
|
109
|
+
pending = [];
|
|
110
|
+
pendingMark = null;
|
|
111
|
+
// Every row that ALREADY EXISTS inside the new mark's overlap window
|
|
112
|
+
// is baseline: the tail shows what happens from now, so none of them
|
|
113
|
+
// may be re-emitted when the walk revisits the window on the next poll
|
|
114
|
+
// (#3448). One page of them is not the window — a function recording
|
|
115
|
+
// faster than a page a minute has more — so the baseline walks back
|
|
116
|
+
// through the window the same bounded way the tail itself does
|
|
117
|
+
// (CR3448-003). Reading only the first page here is what made
|
|
118
|
+
// `--follow` open with up to a minute of history on a busy function.
|
|
119
|
+
const bound = tailLowerBound(newest);
|
|
120
|
+
const seen = [];
|
|
121
|
+
let floor;
|
|
122
|
+
for (let pages = 1;; pages += 1) {
|
|
123
|
+
let reachedBound = false;
|
|
124
|
+
let oldest = null;
|
|
125
|
+
for (const row of page.items ?? []) {
|
|
126
|
+
const id = idOf(row);
|
|
127
|
+
if (id <= bound) {
|
|
128
|
+
reachedBound = true;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
seen.push(id);
|
|
132
|
+
oldest = id;
|
|
133
|
+
}
|
|
134
|
+
if (reachedBound || !page.nextCursor)
|
|
135
|
+
break;
|
|
136
|
+
if (pages >= maxPagesPerTick) {
|
|
137
|
+
// The budget ran out with the window still open. The walk stops at
|
|
138
|
+
// the oldest row the baseline saw rather than at the window's
|
|
139
|
+
// edge: below it are rows this tail never recorded, and walking
|
|
140
|
+
// over them would print them as new.
|
|
141
|
+
floor = oldest ?? undefined;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
page = await fetchPage({ cursor: page.nextCursor });
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
items: [],
|
|
148
|
+
hasMore: false,
|
|
149
|
+
resumeAfter: encodeTailCheckpoint({
|
|
150
|
+
mark: newest,
|
|
151
|
+
seen,
|
|
152
|
+
...(floor ? { floor } : {}),
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const checkpoint = decodeTailCheckpoint(resumeAfter);
|
|
157
|
+
const { mark } = checkpoint;
|
|
158
|
+
// #3448 — the walk runs back to here, not to the mark, so a record
|
|
159
|
+
// inserted below the mark while its invocation was still running is
|
|
160
|
+
// still reached. `seen` is what keeps it from being printed twice, and
|
|
161
|
+
// the baseline's floor — set only when the bootstrap could not read the
|
|
162
|
+
// whole window — is what keeps it from reaching rows no baseline saw.
|
|
163
|
+
const windowBound = tailLowerBound(mark);
|
|
164
|
+
const lowerBound = checkpoint.floor && checkpoint.floor > windowBound
|
|
165
|
+
? checkpoint.floor
|
|
166
|
+
: windowBound;
|
|
167
|
+
const seen = new Set(checkpoint.seen);
|
|
168
|
+
// Resume the walk only if the backlog held here is the one this
|
|
169
|
+
// checkpoint describes; otherwise start from the top.
|
|
170
|
+
let cursor;
|
|
171
|
+
if (checkpoint.cursor !== undefined && pendingMark === mark) {
|
|
172
|
+
cursor = checkpoint.cursor;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
pending = [];
|
|
176
|
+
pendingMark = mark;
|
|
177
|
+
}
|
|
178
|
+
// This call's rows, merged into the backlog only once the call has
|
|
179
|
+
// finished: a pager that throws mid-walk leaves the checkpoint where it
|
|
180
|
+
// was, and the retry re-reads the same pages.
|
|
181
|
+
const collected = [];
|
|
182
|
+
let reachedMark = false;
|
|
183
|
+
let pages = 0;
|
|
184
|
+
while (pages < maxPagesPerTick) {
|
|
185
|
+
const page = await fetchPage(cursor ? { cursor } : {});
|
|
186
|
+
for (const row of page.items ?? []) {
|
|
187
|
+
const id = idOf(row);
|
|
188
|
+
// At or below the bound is the end of the walk. For a mark this
|
|
189
|
+
// cannot read the bound IS the mark, so the stop is byte for byte
|
|
190
|
+
// the one #3287 wrote and its fixtures are unmoved.
|
|
191
|
+
if (id <= lowerBound) {
|
|
192
|
+
reachedMark = true;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
// Inside the overlap window: new only if this tail has not already
|
|
196
|
+
// printed it. Above the mark it always is.
|
|
197
|
+
if (id > mark || !seen.has(id))
|
|
198
|
+
collected.push(row);
|
|
199
|
+
}
|
|
200
|
+
pages += 1;
|
|
201
|
+
// No next page is the end of the listing, which is as far back as a
|
|
202
|
+
// walk can go: the mark's row has aged out, and everything is new.
|
|
203
|
+
if (reachedMark || !page.nextCursor) {
|
|
204
|
+
reachedMark = true;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
cursor = page.nextCursor;
|
|
208
|
+
}
|
|
209
|
+
if (!reachedMark) {
|
|
210
|
+
// Budget spent short of the mark: keep the backlog, carry the cursor,
|
|
211
|
+
// and say there is more — the loop calls again rather than waiting a
|
|
212
|
+
// whole tick, and nothing is emitted out of order or dropped.
|
|
213
|
+
pending.push(...collected);
|
|
214
|
+
return {
|
|
215
|
+
items: [],
|
|
216
|
+
hasMore: true,
|
|
217
|
+
resumeAfter: encodeTailCheckpoint({
|
|
218
|
+
mark,
|
|
219
|
+
cursor,
|
|
220
|
+
seen: [...seen],
|
|
221
|
+
...(checkpoint.floor ? { floor: checkpoint.floor } : {}),
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// The backlog arrived newest-first; a tail prints oldest-first.
|
|
226
|
+
const ascending = [...pending, ...collected].reverse();
|
|
227
|
+
pending = [];
|
|
228
|
+
pendingMark = null;
|
|
229
|
+
// The mark only ever moves FORWARD (#3448). A poll that emitted nothing
|
|
230
|
+
// but a late row inserted below the mark would otherwise walk the mark
|
|
231
|
+
// backwards and re-read the same window for ever.
|
|
232
|
+
let next = mark;
|
|
233
|
+
for (const row of ascending) {
|
|
234
|
+
const id = idOf(row);
|
|
235
|
+
if (id > next)
|
|
236
|
+
next = id;
|
|
237
|
+
seen.add(id);
|
|
238
|
+
}
|
|
239
|
+
// Prune to the new window: a row older than the overlap is settled, so
|
|
240
|
+
// the walk will never reach it again and remembering it costs storage
|
|
241
|
+
// in the checkpoint for nothing.
|
|
242
|
+
const nextBound = tailLowerBound(next);
|
|
243
|
+
// The floor outlives the mark only while it is still the tighter of the
|
|
244
|
+
// two: once the window has slid past it, it bounds nothing.
|
|
245
|
+
const nextFloor = checkpoint.floor && checkpoint.floor > nextBound ? checkpoint.floor : undefined;
|
|
246
|
+
// Strictly above the bound: a row AT it stops the walk, so remembering
|
|
247
|
+
// it would be state the walk can never consult.
|
|
248
|
+
const nextLowerBound = nextFloor ?? nextBound;
|
|
249
|
+
const remembered = [...seen].filter((id) => id > nextLowerBound).sort();
|
|
250
|
+
return {
|
|
251
|
+
items: ascending,
|
|
252
|
+
hasMore: false,
|
|
253
|
+
resumeAfter: encodeTailCheckpoint({
|
|
254
|
+
mark: next,
|
|
255
|
+
seen: remembered,
|
|
256
|
+
...(nextFloor ? { floor: nextFloor } : {}),
|
|
257
|
+
}),
|
|
258
|
+
};
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=function-log-tail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-log-tail.js","sourceRoot":"","sources":["../../../src/lib/function-log-tail.ts"],"names":[],"mappings":"AA4DA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,uEAAuE;AACvE,MAAM,SAAS,GAAG,kCAAk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gDAAgD;YAChD,MAAM,cAAc,GAAG,SAAS,IAAI,SAAS,CAAC;YAC9C,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC;YACxE,OAAO;gBACL,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,oBAAoB,CAAC;oBAChC,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,UAAU;oBAChB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC3C,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running a function from the CLI — the decisions, without the I/O (#3448,
|
|
3
|
+
* project `server-functions` phase 4).
|
|
4
|
+
*
|
|
5
|
+
* `functions invoke`, `functions start` and `functions runs wait` are three
|
|
6
|
+
* verbs over one route, and almost everything about them is a rule rather than
|
|
7
|
+
* a request: which flags may appear together, what `--input` means, which
|
|
8
|
+
* identity the call runs under, how long to wait between polls, which exit code
|
|
9
|
+
* a settled run earns, and what line to print beside each id so an operator
|
|
10
|
+
* knows the next command. Every one of those is decidable with no server, so
|
|
11
|
+
* every one of them lives here, where `cli-unit-tests` can pin it and a
|
|
12
|
+
* rejected checkpoint stays diagnosable (#3187's lesson).
|
|
13
|
+
*/
|
|
14
|
+
/** The verbs that run a function, for the messages that name them. */
|
|
15
|
+
export type RunVerb = "invoke" | "start";
|
|
16
|
+
/** Exit codes, one place, because three verbs share them. */
|
|
17
|
+
export declare const EXIT_OK = 0;
|
|
18
|
+
export declare const EXIT_FAILED = 1;
|
|
19
|
+
/** The wait's budget was spent with the run still in flight. */
|
|
20
|
+
export declare const EXIT_TIMED_OUT = 124;
|
|
21
|
+
/** Ctrl-C — the workflows group's convention (`workflows.ts`). */
|
|
22
|
+
export declare const EXIT_INTERRUPTED = 130;
|
|
23
|
+
export interface RunFlags {
|
|
24
|
+
input?: string;
|
|
25
|
+
user?: string;
|
|
26
|
+
as?: string;
|
|
27
|
+
timeout?: string | number;
|
|
28
|
+
contextDocId?: string;
|
|
29
|
+
runKey?: string;
|
|
30
|
+
wait?: boolean;
|
|
31
|
+
json?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type FlagResolution = {
|
|
34
|
+
ok: true;
|
|
35
|
+
/** `{}` when `--input` was absent; the parsed value otherwise. */
|
|
36
|
+
input: unknown;
|
|
37
|
+
identity: IdentityPlan;
|
|
38
|
+
/** Seconds, or null when the operator did not ask for a budget. */
|
|
39
|
+
timeoutSeconds: number | null;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
error: string;
|
|
43
|
+
};
|
|
44
|
+
/** Who the invocation runs as — D3448-009. */
|
|
45
|
+
export type IdentityPlan = {
|
|
46
|
+
kind: "self";
|
|
47
|
+
} | {
|
|
48
|
+
kind: "user";
|
|
49
|
+
userId: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "system";
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Read the flags, and refuse BEFORE any request is made.
|
|
55
|
+
*
|
|
56
|
+
* That ordering is the point (D3448-010): an operator who typed a malformed
|
|
57
|
+
* `--input` or two identities has made a mistake the platform should never see
|
|
58
|
+
* — and a refusal that arrived after the call would be a refusal for something
|
|
59
|
+
* that had already run.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveRunFlags(flags: RunFlags): FlagResolution;
|
|
62
|
+
/** The two runtimes the platform runs a function under (#3482). */
|
|
63
|
+
export type FunctionRuntime = "request" | "task";
|
|
64
|
+
/**
|
|
65
|
+
* The runtime a function run used, read from the run row — #3482, C-6.
|
|
66
|
+
*
|
|
67
|
+
* `WorkflowRun.executionMode` is the runtime under the old word, and #3482
|
|
68
|
+
* does not rename a stored column (D3482-009; phase 7 owns the rename), so the
|
|
69
|
+
* mapping lives here, once, and every surface that says "runtime" says it the
|
|
70
|
+
* same way. `sync` is the request runtime — a webhook delivery, a
|
|
71
|
+
* `workflow.call` leaf — and `durable` is the task runtime.
|
|
72
|
+
*
|
|
73
|
+
* ABSENT means the task runtime, not "unknown": every writer of a durable row
|
|
74
|
+
* has written `durable` since #3186, and the rows that predate the column are
|
|
75
|
+
* durable runs. A row that says something else entirely is not a runtime this
|
|
76
|
+
* platform has, and answering null is how a reader learns that rather than
|
|
77
|
+
* being told a word that was never true.
|
|
78
|
+
*/
|
|
79
|
+
export declare function runtimeForExecutionMode(executionMode: unknown): FunctionRuntime | null;
|
|
80
|
+
/**
|
|
81
|
+
* The RUNTIME cell of one `functions runs` row.
|
|
82
|
+
*
|
|
83
|
+
* Blank rather than guessed for a row this reader cannot place: `runs` pages
|
|
84
|
+
* one function's own runs, but the same shape reaches the CLI from surfaces
|
|
85
|
+
* that carry DSL rows too, and printing `task` for one would be a word about
|
|
86
|
+
* something that has no runtime at all.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runRuntimeCell(run: {
|
|
89
|
+
executionMode?: unknown;
|
|
90
|
+
} | null | undefined): string;
|
|
91
|
+
/**
|
|
92
|
+
* The two slice cells of one `functions runs` row — REFRESHES and RESETS.
|
|
93
|
+
*
|
|
94
|
+
* One rule for both, because they are two facts about the same record and the
|
|
95
|
+
* distinction that matters is the same for each: a row with NO slice record
|
|
96
|
+
* gets a BLANK cell, and a record that carries no count gets `0`.
|
|
97
|
+
*
|
|
98
|
+
* - blank means "there is no record" — a request invocation opens no lease,
|
|
99
|
+
* and neither did any run that predates the record's own child;
|
|
100
|
+
* - `0` means "the record says nothing happened", which for #3566 is the
|
|
101
|
+
* answer an operator needs: a fabricated zero on a row with no record would
|
|
102
|
+
* read as "the platform never reset this run", and the row cannot know that.
|
|
103
|
+
*
|
|
104
|
+
* A value that is not a whole number reads `0` rather than reaching the table:
|
|
105
|
+
* the cell is a count, and printing `NaN` or `two` in a column of numbers
|
|
106
|
+
* teaches an operator nothing.
|
|
107
|
+
*/
|
|
108
|
+
export declare function runSliceCells(run: {
|
|
109
|
+
slice?: {
|
|
110
|
+
refreshCount?: unknown;
|
|
111
|
+
resets?: unknown;
|
|
112
|
+
} | null;
|
|
113
|
+
} | null | undefined): {
|
|
114
|
+
refreshes: string;
|
|
115
|
+
resets: string;
|
|
116
|
+
};
|
|
117
|
+
/** The JS client's schedule: 400 ms doubling to a 5 s ceiling. */
|
|
118
|
+
export declare const WAIT_INITIAL_DELAY_MS = 400;
|
|
119
|
+
export declare const WAIT_MAX_DELAY_MS = 5000;
|
|
120
|
+
/** 15 minutes, the JS client's default. */
|
|
121
|
+
export declare const WAIT_DEFAULT_TIMEOUT_SECONDS = 900;
|
|
122
|
+
/**
|
|
123
|
+
* The delay before poll `attempt` (0-based).
|
|
124
|
+
*
|
|
125
|
+
* Pure and pinned, because a backoff that silently stopped backing off is a
|
|
126
|
+
* poll storm nobody notices until a long run is being asked 150 times a
|
|
127
|
+
* minute.
|
|
128
|
+
*/
|
|
129
|
+
export declare function waitDelayMs(attempt: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* A settled run's exit code — D3448-010.
|
|
132
|
+
*
|
|
133
|
+
* `completed` is 0 and everything else an operator can act on is 1. An
|
|
134
|
+
* in-flight status is null: the wait has not finished, and turning "still
|
|
135
|
+
* running" into an exit code is how a script comes to believe a run failed
|
|
136
|
+
* because it was slow.
|
|
137
|
+
*/
|
|
138
|
+
export declare function exitCodeForRunStatus(status: string | null | undefined): number | null;
|
|
139
|
+
/** A request invocation's exit code: only `completed` is success. */
|
|
140
|
+
export declare function exitCodeForInvokeStatus(status: string | null | undefined): number;
|
|
141
|
+
/** One printed line: a label, an id, and the commands that take it. */
|
|
142
|
+
export interface IdLines {
|
|
143
|
+
label: string;
|
|
144
|
+
value: string;
|
|
145
|
+
commands: string[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Every id a verb prints is followed by the diagnostics command that takes it
|
|
149
|
+
* — the issue's own requirement, and one pure function so it is pinned.
|
|
150
|
+
*
|
|
151
|
+
* An id with no next step is an id an operator has to go and look up how to
|
|
152
|
+
* use, which is the thing this issue exists to remove.
|
|
153
|
+
*/
|
|
154
|
+
export declare function invokeIdLines(args: {
|
|
155
|
+
functionId: string;
|
|
156
|
+
invocationId?: string | null;
|
|
157
|
+
}): IdLines[];
|
|
158
|
+
export declare function startIdLines(args: {
|
|
159
|
+
functionId: string;
|
|
160
|
+
runId: string;
|
|
161
|
+
}): IdLines[];
|
|
162
|
+
/** The line a wait prints when it gives up, or is interrupted. */
|
|
163
|
+
export declare function resumeCommand(functionId: string, runId: string): string;
|
|
164
|
+
/** Render one `IdLines` as the two-or-more lines an operator reads. */
|
|
165
|
+
export declare function renderIdLines(lines: IdLines[]): string[];
|
|
166
|
+
/** How the identity is reported, so an operator knows who ran it. */
|
|
167
|
+
export declare function describeIdentity(identity: {
|
|
168
|
+
kind: "self" | "user" | "system";
|
|
169
|
+
userId?: string | null;
|
|
170
|
+
appRole?: string | null;
|
|
171
|
+
byUserId?: string | null;
|
|
172
|
+
}): string;
|
|
173
|
+
/**
|
|
174
|
+
* How many EMPTY pages carrying a cursor the CLI follows before it renders.
|
|
175
|
+
*
|
|
176
|
+
* D3448-SO-006's CLI half. A filtered page holding only other runs' records
|
|
177
|
+
* comes back empty WITH a cursor, which is an intermediate page and not the
|
|
178
|
+
* end; returning on it — as `functions logs` did — reports "no logs" for a run
|
|
179
|
+
* whose records are one page further down. The server's bounded scan makes
|
|
180
|
+
* that rare; this makes it impossible to read as the end.
|
|
181
|
+
*/
|
|
182
|
+
export declare const MAX_AUTO_CONTINUE_PAGES = 5;
|
|
183
|
+
export type PageContinuation = {
|
|
184
|
+
action: "render";
|
|
185
|
+
}
|
|
186
|
+
/** Follow `cursor` and try again. */
|
|
187
|
+
| {
|
|
188
|
+
action: "continue";
|
|
189
|
+
cursor: string;
|
|
190
|
+
}
|
|
191
|
+
/** Nothing found and the budget is spent: the empty state PLUS the cursor. */
|
|
192
|
+
| {
|
|
193
|
+
action: "exhausted";
|
|
194
|
+
cursor: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* What to do with a page that came back holding nothing.
|
|
198
|
+
*
|
|
199
|
+
* A page with rows is rendered. An empty page with NO cursor is the end and is
|
|
200
|
+
* rendered too (the empty state). An empty page WITH a cursor is intermediate.
|
|
201
|
+
*/
|
|
202
|
+
export declare function decidePageContinuation(page: {
|
|
203
|
+
items?: unknown[];
|
|
204
|
+
nextCursor?: string | null;
|
|
205
|
+
}, pagesFollowed: number): PageContinuation;
|
|
206
|
+
/**
|
|
207
|
+
* `--invocation` names ONE record, so every flag that shapes a LISTING is a
|
|
208
|
+
* contradiction beside it, and `--run` is a filter a tail cannot honour (the
|
|
209
|
+
* tail walks the whole index; a run's records are a bounded set that ends).
|
|
210
|
+
*/
|
|
211
|
+
export declare function logsFlagConflict(flags: {
|
|
212
|
+
invocation?: string;
|
|
213
|
+
run?: string;
|
|
214
|
+
follow?: boolean;
|
|
215
|
+
cursor?: string;
|
|
216
|
+
limit?: unknown;
|
|
217
|
+
}): string | null;
|
|
218
|
+
/** Ten minutes — long enough for the platform's own 30 s ceiling and no more. */
|
|
219
|
+
export declare const USER_TOKEN_TTL = "10m";
|
|
220
|
+
/** The name the minted token carries, so an operator can find it if it leaks. */
|
|
221
|
+
export declare function userTokenName(verb: RunVerb, functionKey: string, at?: Date): string;
|
|
222
|
+
export interface MintedToken {
|
|
223
|
+
token: string;
|
|
224
|
+
tokenId: string;
|
|
225
|
+
}
|
|
226
|
+
export interface MintedTokenEffects {
|
|
227
|
+
mint: () => Promise<MintedToken>;
|
|
228
|
+
revoke: (tokenId: string) => Promise<void>;
|
|
229
|
+
warn: (message: string) => void;
|
|
230
|
+
/**
|
|
231
|
+
* Install a handler for the interrupt signals, and hand back a remover.
|
|
232
|
+
*
|
|
233
|
+
* Injected so the Ctrl-C path is decidable with no process to signal — the
|
|
234
|
+
* mistake CR3448-001 caught was proving it with a rejection, which is a
|
|
235
|
+
* DIFFERENT path: an interrupt reaches an unhandled process as termination,
|
|
236
|
+
* not as a throw.
|
|
237
|
+
*/
|
|
238
|
+
onInterrupt?: (handler: () => void) => () => void;
|
|
239
|
+
/** How the process ends once the credential is gone. */
|
|
240
|
+
exit?: (code: number) => void;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Mint, use, revoke — and revoke on EVERY exit path.
|
|
244
|
+
*
|
|
245
|
+
* The token is a real credential for ANOTHER USER, live for ten minutes, so
|
|
246
|
+
* "every exit path" has to include the one an operator actually takes when a
|
|
247
|
+
* call is slower than they expected: Ctrl-C. A `finally` alone does not cover
|
|
248
|
+
* it — with no handler installed, Node's default terminates the process and no
|
|
249
|
+
* `finally` in it ever runs (CR3448-001) — so the wrapper handles the signal
|
|
250
|
+
* itself, revokes, and only then exits 130.
|
|
251
|
+
*
|
|
252
|
+
* A failed revoke does NOT change the exit code — the invocation happened and
|
|
253
|
+
* its outcome is the answer — but it names the token and the command that
|
|
254
|
+
* revokes it, because an un-revoked credential an operator does not know about
|
|
255
|
+
* is worse than a warning they do (edge 32).
|
|
256
|
+
*
|
|
257
|
+
* The VALUE is never returned to the caller and never printed: `use` receives
|
|
258
|
+
* it, and nothing else does.
|
|
259
|
+
*/
|
|
260
|
+
export declare function withMintedToken<T>(effects: MintedTokenEffects, use: (token: string) => Promise<T>): Promise<T>;
|
|
261
|
+
/** What the server said, and how an operator should read it. */
|
|
262
|
+
export interface RefusalAnswer {
|
|
263
|
+
httpStatus: number;
|
|
264
|
+
retryAfterSeconds: number | null;
|
|
265
|
+
body: any;
|
|
266
|
+
}
|
|
267
|
+
export interface RefusalLines {
|
|
268
|
+
/** The headline, on stderr. */
|
|
269
|
+
message: string;
|
|
270
|
+
/** Label/value pairs printed under it. */
|
|
271
|
+
fields: Array<{
|
|
272
|
+
label: string;
|
|
273
|
+
value: string;
|
|
274
|
+
}>;
|
|
275
|
+
/** Schema-validation details, one per line. */
|
|
276
|
+
details: string[];
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Turn a refusal envelope into the lines an operator reads — #3448 D3448-010.
|
|
280
|
+
*
|
|
281
|
+
* Pure, because it carries the fact that makes handing the envelope back
|
|
282
|
+
* worth anything instead of throwing: a 429's `Retry-After`, which the server
|
|
283
|
+
* already worked out and which would be re-derived badly from an exception
|
|
284
|
+
* message.
|
|
285
|
+
*
|
|
286
|
+
* #3482 — there is no "Version mode" line any more. It named the mode a
|
|
287
|
+
* refused call's version was locked to, and no version is locked to anything.
|
|
288
|
+
*/
|
|
289
|
+
export declare function refusalLines(answer: RefusalAnswer): RefusalLines;
|