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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `config push`'s local check of a function's capabilities — #3182,
|
|
3
|
+
* project `server-functions` phase 1, rewritten by #3279.
|
|
4
|
+
*
|
|
5
|
+
* The server is authoritative (the raw admin route exists, and it derives the
|
|
6
|
+
* capabilities from the TOML inside the envelope). This is the other
|
|
7
|
+
* enforcement point: an author who writes a retired grant string, or an
|
|
8
|
+
* `integration:` naming an integration the tree does not declare, should see
|
|
9
|
+
* it against their own file, in the front-loaded preflight pass, with nothing
|
|
10
|
+
* applied — not as a server refusal partway through a push that has already
|
|
11
|
+
* created three other things.
|
|
12
|
+
*
|
|
13
|
+
* The GRAMMAR is not restated here. It is the vendored `function-grants.ts` —
|
|
14
|
+
* the same module the server imports — so the two checks cannot drift into
|
|
15
|
+
* two rules. Since #3279 that grammar keeps three kinds (`integration:<key>`,
|
|
16
|
+
* `secret:<NAME>`, the high-blast opt-ins) and refuses everything it retired
|
|
17
|
+
* with the retirement, so a file still declaring a `database:` grant is
|
|
18
|
+
* told what changed rather than "unknown family".
|
|
19
|
+
*
|
|
20
|
+
* ── What "the app has this integration" means locally ────────────────────
|
|
21
|
+
*
|
|
22
|
+
* The tree is the intent: an integration declared in `integrations/` will
|
|
23
|
+
* exist after this push (objects are applied before functions). One that
|
|
24
|
+
* exists only on the server is real too, so the caller merges the live
|
|
25
|
+
* listing in when it could fetch one. When neither is available the target
|
|
26
|
+
* check is SKIPPED rather than guessed — the server will still refuse, and a
|
|
27
|
+
* preflight that refuses a valid tree because it could not reach the network
|
|
28
|
+
* would be worse than one that defers.
|
|
29
|
+
*/
|
|
30
|
+
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
31
|
+
import { basename, join } from "path";
|
|
32
|
+
import { parseConfigToml } from "./config-toml.js";
|
|
33
|
+
import { parseCapabilities, validateKeyedGrantsAgainstTargets, } from "./generated-config-surfaces.js";
|
|
34
|
+
/** The set, read from the tree's `integrations/`. */
|
|
35
|
+
export function configObjectKeysFromTree(configDir) {
|
|
36
|
+
return {
|
|
37
|
+
integrations: keysFromDir(configDir, "integrations", "integration"),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* One directory's object keys.
|
|
42
|
+
*
|
|
43
|
+
* The key is the `[<table>].key` the file declares, falling back to the file
|
|
44
|
+
* name — the same precedence the push path resolves an object's identity by.
|
|
45
|
+
*
|
|
46
|
+
* Every `.toml` in the directory counts. The generated document-schema copy is
|
|
47
|
+
* a rule about `functions/` and is not one here (CR3455-003) — dropping an
|
|
48
|
+
* object by a foreign directory's rule would refuse a grant on a target the
|
|
49
|
+
* tree really declares.
|
|
50
|
+
*/
|
|
51
|
+
function keysFromDir(configDir, dirName, table) {
|
|
52
|
+
const keys = new Set();
|
|
53
|
+
const dir = join(configDir, dirName);
|
|
54
|
+
if (!existsSync(dir))
|
|
55
|
+
return keys;
|
|
56
|
+
for (const file of readdirSync(dir).filter((f) => f.endsWith(".toml"))) {
|
|
57
|
+
let data;
|
|
58
|
+
try {
|
|
59
|
+
data = parseConfigToml(readFileSync(join(dir, file), "utf-8"));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// A file that does not parse is reported by its own preflight.
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
keys.add(String(data?.[table]?.key || basename(file, ".toml")));
|
|
66
|
+
}
|
|
67
|
+
return keys;
|
|
68
|
+
}
|
|
69
|
+
/** The server's keys, then the tree's — the tree is what this push applies. */
|
|
70
|
+
export function mergeKnownGrantTargets(fromServer, fromTree) {
|
|
71
|
+
return {
|
|
72
|
+
integrations: new Set([...fromServer.integrations, ...fromTree.integrations]),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Everything wrong with one function file's capabilities, as push-ready lines.
|
|
77
|
+
*
|
|
78
|
+
* Each message names the file, because the preflight pass reports every file's
|
|
79
|
+
* errors together and "unknown integration 'stripe'" on its own does not say
|
|
80
|
+
* which function asked for it.
|
|
81
|
+
*/
|
|
82
|
+
export function functionGrantErrors(input) {
|
|
83
|
+
const { filePath, tomlData, knownTargets } = input;
|
|
84
|
+
const table = tomlData?.function ?? {};
|
|
85
|
+
const where = `${filePath}:`;
|
|
86
|
+
const messages = [];
|
|
87
|
+
const parsed = parseCapabilities(table.capabilities);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
for (const error of parsed.errors)
|
|
90
|
+
messages.push(`${where} ${error}`);
|
|
91
|
+
return messages;
|
|
92
|
+
}
|
|
93
|
+
// #3183 — `integration:` names a config-tree object, so the same "does this
|
|
94
|
+
// app have it" question applies. The rule is the shared one; what is
|
|
95
|
+
// CLI-side is reading the tree for it.
|
|
96
|
+
if (knownTargets) {
|
|
97
|
+
for (const error of validateKeyedGrantsAgainstTargets(parsed.allGrants, {
|
|
98
|
+
integrations: knownTargets.integrations,
|
|
99
|
+
})) {
|
|
100
|
+
messages.push(`${where} ${error}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return messages;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=function-grants-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-grants-preflight.js","sourceRoot":"","sources":["../../../src/lib/function-grants-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AAcxC,qDAAqD;AACrD,MAAM,UAAU,wBAAwB,CACtC,SAAiB;IAEjB,OAAO;QACL,YAAY,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC;KACpE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAClB,SAAiB,EACjB,OAAe,EACf,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACvE,IAAI,IAAS,CAAC;QACd,IAAI,CAAC;YACH,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACjE,CAAC;QAAC,MAAM,CAAC;YACP,+DAA+D;YAC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KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One invocation's captured console output, in the order it was printed —
|
|
3
|
+
* #3453 (D3453-005).
|
|
4
|
+
*
|
|
5
|
+
* `primitive functions logs --run <run-id>` used to print the same one-row-per
|
|
6
|
+
* record table the listing prints, so the LINES — the thing an operator opened
|
|
7
|
+
* the logs for — were only reachable through `--json`. This renders them, under
|
|
8
|
+
* the step that wrote them.
|
|
9
|
+
*
|
|
10
|
+
* Pure, and separate from the command, for the reason `function-log-row.ts`
|
|
11
|
+
* gives: a rendering rule that lives inside an action can only be tested by
|
|
12
|
+
* spawning the CLI, and this one has enough cases (two orderings, a header that
|
|
13
|
+
* changes, a throw, a pre-change record) that spawning for each would be the
|
|
14
|
+
* wrong trade.
|
|
15
|
+
*/
|
|
16
|
+
/** The marker a truncated record ends with, so loss is never silent. */
|
|
17
|
+
export declare const TRUNCATION_MARKER = "\u2026 truncated: the platform's per-record cap dropped later lines";
|
|
18
|
+
/**
|
|
19
|
+
* What an EMPTY record whose attempt ended in the engine says — #3564,
|
|
20
|
+
* criterion 2 (D3564-007).
|
|
21
|
+
*
|
|
22
|
+
* The filing's own complaint: the invocation log held no console output for
|
|
23
|
+
* these attempts, with `truncated`, `logsUnavailable` and `contentSuppressed`
|
|
24
|
+
* all unset, so the silence read as "logs lost" when it meant "the handler
|
|
25
|
+
* printed nothing before the engine took the isolate away". This renderer
|
|
26
|
+
* printed nothing at all for such a record, which is the reading the filing
|
|
27
|
+
* asks to be able to make.
|
|
28
|
+
*
|
|
29
|
+
* Two facts, never collapsed into one: the first half says the attempt ended
|
|
30
|
+
* in the engine, and the SECOND half is chosen by the drain's own flags. A
|
|
31
|
+
* drain that failed — which `DrainedLogs.unavailable` names isolate eviction
|
|
32
|
+
* as a cause of — is reported as unavailable rather than as an empty handler,
|
|
33
|
+
* because those are opposite statements and this is precisely the case where
|
|
34
|
+
* guessing would be wrong.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ENGINE_END_PREFIX = "ended in the engine";
|
|
37
|
+
/**
|
|
38
|
+
* One record's console output, ready to print under its `functionLogLine`.
|
|
39
|
+
*
|
|
40
|
+
* A header is emitted whenever the label CHANGES, so two lines from one body
|
|
41
|
+
* sit under one header and a body re-entered after another step gets its own.
|
|
42
|
+
* A `thrown` entry — the wrapper's own record of a body that failed — takes a
|
|
43
|
+
* `!` in the gutter rather than an extra column, so the columns stay aligned.
|
|
44
|
+
*
|
|
45
|
+
* A record with NO lines whose attempt ended in the engine says so instead of
|
|
46
|
+
* printing nothing (#3564, {@link ENGINE_END_PREFIX}). The derivation is by
|
|
47
|
+
* the record's own `endedIn`, which the platform derived from its stored code
|
|
48
|
+
* — never by re-reading its message here, so a record written before this
|
|
49
|
+
* child renders exactly as it rendered then (edge 32).
|
|
50
|
+
*/
|
|
51
|
+
export declare function renderInvocationLines(record: any): string[];
|
|
52
|
+
/** What `logs --run` was able to read before it renders anything. */
|
|
53
|
+
export interface RunLogsInput {
|
|
54
|
+
/** The filtered page, NEWEST first, as the listing route answers it. */
|
|
55
|
+
records: any[];
|
|
56
|
+
/** The run's step rows, or null when the read failed. */
|
|
57
|
+
trace: any[] | null;
|
|
58
|
+
/** The trace read's failure, if it had one. */
|
|
59
|
+
traceError?: string | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The whole of `logs --run`'s human output — #3453 (D3453-005).
|
|
63
|
+
*
|
|
64
|
+
* Returned rather than printed so every one of its rules is decidable without
|
|
65
|
+
* a server (#3187's lesson): which runs get a table, what a failed trace read
|
|
66
|
+
* costs, and the order the records come out in. The command does the two I/O
|
|
67
|
+
* reads and prints what comes back.
|
|
68
|
+
*
|
|
69
|
+
* Records are reversed because the listing answers newest first and a run is
|
|
70
|
+
* read forwards — an operator following what happened wants the first
|
|
71
|
+
* invocation at the top.
|
|
72
|
+
*/
|
|
73
|
+
export declare function renderRunLogs(input: RunLogsInput): {
|
|
74
|
+
lines: string[];
|
|
75
|
+
warning: string | null;
|
|
76
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One invocation's captured console output, in the order it was printed —
|
|
3
|
+
* #3453 (D3453-005).
|
|
4
|
+
*
|
|
5
|
+
* `primitive functions logs --run <run-id>` used to print the same one-row-per
|
|
6
|
+
* record table the listing prints, so the LINES — the thing an operator opened
|
|
7
|
+
* the logs for — were only reachable through `--json`. This renders them, under
|
|
8
|
+
* the step that wrote them.
|
|
9
|
+
*
|
|
10
|
+
* Pure, and separate from the command, for the reason `function-log-row.ts`
|
|
11
|
+
* gives: a rendering rule that lives inside an action can only be tested by
|
|
12
|
+
* spawning the CLI, and this one has enough cases (two orderings, a header that
|
|
13
|
+
* changes, a throw, a pre-change record) that spawning for each would be the
|
|
14
|
+
* wrong trade.
|
|
15
|
+
*/
|
|
16
|
+
import { functionLogLine } from "./function-log-row.js";
|
|
17
|
+
import { renderStepRunTable } from "./step-run-table.js";
|
|
18
|
+
/** The marker a truncated record ends with, so loss is never silent. */
|
|
19
|
+
export const TRUNCATION_MARKER = "… truncated: the platform's per-record cap dropped later lines";
|
|
20
|
+
/**
|
|
21
|
+
* What an EMPTY record whose attempt ended in the engine says — #3564,
|
|
22
|
+
* criterion 2 (D3564-007).
|
|
23
|
+
*
|
|
24
|
+
* The filing's own complaint: the invocation log held no console output for
|
|
25
|
+
* these attempts, with `truncated`, `logsUnavailable` and `contentSuppressed`
|
|
26
|
+
* all unset, so the silence read as "logs lost" when it meant "the handler
|
|
27
|
+
* printed nothing before the engine took the isolate away". This renderer
|
|
28
|
+
* printed nothing at all for such a record, which is the reading the filing
|
|
29
|
+
* asks to be able to make.
|
|
30
|
+
*
|
|
31
|
+
* Two facts, never collapsed into one: the first half says the attempt ended
|
|
32
|
+
* in the engine, and the SECOND half is chosen by the drain's own flags. A
|
|
33
|
+
* drain that failed — which `DrainedLogs.unavailable` names isolate eviction
|
|
34
|
+
* as a cause of — is reported as unavailable rather than as an empty handler,
|
|
35
|
+
* because those are opposite statements and this is precisely the case where
|
|
36
|
+
* guessing would be wrong.
|
|
37
|
+
*/
|
|
38
|
+
export const ENGINE_END_PREFIX = "ended in the engine";
|
|
39
|
+
function engineEndLine(record) {
|
|
40
|
+
const why = record?.logsUnavailable === true
|
|
41
|
+
? "logs unavailable"
|
|
42
|
+
: record?.contentSuppressed === true
|
|
43
|
+
? "output suppressed"
|
|
44
|
+
: "no handler output";
|
|
45
|
+
return `${ENGINE_END_PREFIX} — ${why}`;
|
|
46
|
+
}
|
|
47
|
+
const INDENT = " ";
|
|
48
|
+
/**
|
|
49
|
+
* Put one record's two arrays back into CAPTURE order.
|
|
50
|
+
*
|
|
51
|
+
* The writer persists `stdout` and `stderr` as two arrays filtered by stream
|
|
52
|
+
* and `t` is a millisecond offset, so `console.error("first")` followed by
|
|
53
|
+
* `console.log("second")` in the same millisecond has no surviving order in
|
|
54
|
+
* the record itself: merging by `t` prints them backwards. `n` is stamped at
|
|
55
|
+
* capture, in one buffer, and is what restores it.
|
|
56
|
+
*
|
|
57
|
+
* A record written before #3453 carries no `n` at all, and one entry having it
|
|
58
|
+
* while another does not is not a state any writer produces — so the fallback
|
|
59
|
+
* is chosen for the WHOLE record rather than per entry. Interleaving two
|
|
60
|
+
* orders would put entries in an order neither of them claims.
|
|
61
|
+
*
|
|
62
|
+
* The `t` fallback sorts stably with stdout first on a tie, which is the order
|
|
63
|
+
* the two arrays already sit in.
|
|
64
|
+
*/
|
|
65
|
+
function inCaptureOrder(record) {
|
|
66
|
+
const stdout = Array.isArray(record?.stdout) ? record.stdout : [];
|
|
67
|
+
const stderr = Array.isArray(record?.stderr) ? record.stderr : [];
|
|
68
|
+
const merged = [...stdout, ...stderr];
|
|
69
|
+
const everyEntryNumbered = merged.length > 0 && merged.every((entry) => Number.isFinite(entry?.n));
|
|
70
|
+
const key = everyEntryNumbered
|
|
71
|
+
? (entry) => Number(entry.n)
|
|
72
|
+
: (entry) => Number(entry.t ?? 0);
|
|
73
|
+
// `Array.prototype.sort` is stable, so equal keys keep the order above —
|
|
74
|
+
// stdout before stderr.
|
|
75
|
+
return merged.slice().sort((a, b) => key(a) - key(b));
|
|
76
|
+
}
|
|
77
|
+
/** `step <name> #<occurrence> attempt <n>`, or null between steps. */
|
|
78
|
+
function headerFor(entry) {
|
|
79
|
+
if (!entry?.step || typeof entry.step.name !== "string")
|
|
80
|
+
return null;
|
|
81
|
+
return `step ${entry.step.name} #${entry.step.occurrence ?? 0} attempt ${entry.attempt ?? 1}`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One record's console output, ready to print under its `functionLogLine`.
|
|
85
|
+
*
|
|
86
|
+
* A header is emitted whenever the label CHANGES, so two lines from one body
|
|
87
|
+
* sit under one header and a body re-entered after another step gets its own.
|
|
88
|
+
* A `thrown` entry — the wrapper's own record of a body that failed — takes a
|
|
89
|
+
* `!` in the gutter rather than an extra column, so the columns stay aligned.
|
|
90
|
+
*
|
|
91
|
+
* A record with NO lines whose attempt ended in the engine says so instead of
|
|
92
|
+
* printing nothing (#3564, {@link ENGINE_END_PREFIX}). The derivation is by
|
|
93
|
+
* the record's own `endedIn`, which the platform derived from its stored code
|
|
94
|
+
* — never by re-reading its message here, so a record written before this
|
|
95
|
+
* child renders exactly as it rendered then (edge 32).
|
|
96
|
+
*/
|
|
97
|
+
export function renderInvocationLines(record) {
|
|
98
|
+
const out = [];
|
|
99
|
+
let currentHeader = null;
|
|
100
|
+
let headerEmitted = false;
|
|
101
|
+
const entries = inCaptureOrder(record);
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
const header = headerFor(entry);
|
|
104
|
+
if (header !== currentHeader) {
|
|
105
|
+
currentHeader = header;
|
|
106
|
+
headerEmitted = false;
|
|
107
|
+
}
|
|
108
|
+
if (header && !headerEmitted) {
|
|
109
|
+
out.push(`${INDENT}${header}`);
|
|
110
|
+
headerEmitted = true;
|
|
111
|
+
}
|
|
112
|
+
const indent = header ? INDENT.repeat(2) : INDENT;
|
|
113
|
+
const gutter = entry?.thrown === true ? `${indent.slice(0, -2)}! ` : indent;
|
|
114
|
+
const stream = entry?.s === "err" ? "err" : "out";
|
|
115
|
+
out.push(`${gutter}+${Number(entry?.t ?? 0)}ms ${stream} ${String(entry?.line ?? "")}`);
|
|
116
|
+
}
|
|
117
|
+
// #3564 — the empty record, explained. Only when the record really has no
|
|
118
|
+
// lines: one that printed something says more than the sentence does, and a
|
|
119
|
+
// reader who can see the output does not need to be told there is some.
|
|
120
|
+
if (entries.length === 0 && record?.endedIn === "engine") {
|
|
121
|
+
out.push(`${INDENT}${engineEndLine(record)}`);
|
|
122
|
+
}
|
|
123
|
+
// Said out loud, because the alternative is output that looks complete after
|
|
124
|
+
// the cap dropped the later lines or the throw entry. The record persists the
|
|
125
|
+
// boolean and not the count (F-3453-009), so the marker cannot name one.
|
|
126
|
+
if (record?.truncated === true)
|
|
127
|
+
out.push(`${INDENT}${TRUNCATION_MARKER}`);
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The whole of `logs --run`'s human output — #3453 (D3453-005).
|
|
132
|
+
*
|
|
133
|
+
* Returned rather than printed so every one of its rules is decidable without
|
|
134
|
+
* a server (#3187's lesson): which runs get a table, what a failed trace read
|
|
135
|
+
* costs, and the order the records come out in. The command does the two I/O
|
|
136
|
+
* reads and prints what comes back.
|
|
137
|
+
*
|
|
138
|
+
* Records are reversed because the listing answers newest first and a run is
|
|
139
|
+
* read forwards — an operator following what happened wants the first
|
|
140
|
+
* invocation at the top.
|
|
141
|
+
*/
|
|
142
|
+
export function renderRunLogs(input) {
|
|
143
|
+
const lines = [];
|
|
144
|
+
// A trace this reader could not fetch is not a reason to withhold the
|
|
145
|
+
// output: the lines say more than the failure does.
|
|
146
|
+
const warning = input.traceError
|
|
147
|
+
? `Could not read the step trace: ${input.traceError}`
|
|
148
|
+
: null;
|
|
149
|
+
// A request invocation has no step rows at all, and an empty table would
|
|
150
|
+
// say there were steps and none ran.
|
|
151
|
+
if (input.trace && input.trace.length > 0) {
|
|
152
|
+
lines.push(renderStepRunTable(input.trace), "");
|
|
153
|
+
}
|
|
154
|
+
for (const record of [...(input.records ?? [])].reverse()) {
|
|
155
|
+
lines.push(functionLogLine(record));
|
|
156
|
+
lines.push(...renderInvocationLines(record));
|
|
157
|
+
}
|
|
158
|
+
return { lines, warning };
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=function-log-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-log-lines.js","sourceRoot":"","sources":["../../../src/lib/function-log-lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAczD,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAC5B,gEAAgE,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,SAAS,aAAa,CAAC,MAAW;IAChC,MAAM,GAAG,GACP,MAAM,EAAE,eAAe,KAAK,IAAI;QAC9B,CAAC,CAAC,kBAAkB;QACpB,CAAC,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI;YAClC,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,mBAAmB,CAAC;IAC5B,OAAO,GAAG,iBAAiB,MAAM,GAAG,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,cAAc,CAAC,MAAW;IACjC,MAAM,MAAM,GAAoB,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,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|
|
3
|
+
*
|
|
4
|
+
* Extracted from `commands/functions.ts` by #3462 so the VERSION it added has
|
|
5
|
+
* somewhere to be tested. The one-shot table, the `--invocation` point read and
|
|
6
|
+
* the `--follow` tail all render the same facts in the same order, and three
|
|
7
|
+
* copies of that order in one command file is three chances for them to drift;
|
|
8
|
+
* a tail line that dropped a column would be a difference nobody could see
|
|
9
|
+
* without two terminals.
|
|
10
|
+
*/
|
|
11
|
+
/** The columns the one-shot and `--invocation` tables share, in order. */
|
|
12
|
+
export declare const FUNCTION_LOG_COLUMNS: readonly ["TIME", "STATUS", "TRIGGER", "RUNTIME", "VERSION", "RUN/INVOCATION ID", "CODE", "ERROR"];
|
|
13
|
+
/**
|
|
14
|
+
* The FIRST error line only — #3287.
|
|
15
|
+
*
|
|
16
|
+
* A stack is eight kilobytes and a table row is one line, so the row says what
|
|
17
|
+
* happened and `--json` carries the rest.
|
|
18
|
+
*/
|
|
19
|
+
export declare function firstErrorLine(row: any): string;
|
|
20
|
+
/** The cells one record contributes to a table row. */
|
|
21
|
+
export declare function functionLogCells(row: any): Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* The same record as one line, for `--follow`.
|
|
24
|
+
*
|
|
25
|
+
* Same facts in the same order as the table's columns, so a reader who switches
|
|
26
|
+
* between them is reading the same thing. An absent value contributes nothing
|
|
27
|
+
* rather than an empty gap, because a tail line has no columns to keep aligned.
|
|
28
|
+
*/
|
|
29
|
+
export declare function functionLogLine(row: any): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One invocation, as a human reads it — the columns and the tail line.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `commands/functions.ts` by #3462 so the VERSION it added has
|
|
5
|
+
* somewhere to be tested. The one-shot table, the `--invocation` point read and
|
|
6
|
+
* the `--follow` tail all render the same facts in the same order, and three
|
|
7
|
+
* copies of that order in one command file is three chances for them to drift;
|
|
8
|
+
* a tail line that dropped a column would be a difference nobody could see
|
|
9
|
+
* without two terminals.
|
|
10
|
+
*/
|
|
11
|
+
/** The columns the one-shot and `--invocation` tables share, in order. */
|
|
12
|
+
export const FUNCTION_LOG_COLUMNS = [
|
|
13
|
+
"TIME",
|
|
14
|
+
"STATUS",
|
|
15
|
+
"TRIGGER",
|
|
16
|
+
// #3482 — which RUNTIME the platform ran this invocation under, beside the
|
|
17
|
+
// DOOR that fired it. `ctx.trigger.kind` says which door; this says whether
|
|
18
|
+
// the platform ran the code inside the request or as a task run, which is
|
|
19
|
+
// what `assertRuntime` tests for and what the two budgets differ by. Blank
|
|
20
|
+
// for a record written before the column existed.
|
|
21
|
+
"RUNTIME",
|
|
22
|
+
// #3462 — WHICH version this invocation executed. The record has carried
|
|
23
|
+
// `configId` since #3287 and nothing rendered it.
|
|
24
|
+
"VERSION",
|
|
25
|
+
"RUN/INVOCATION ID",
|
|
26
|
+
"CODE",
|
|
27
|
+
"ERROR",
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* The FIRST error line only — #3287.
|
|
31
|
+
*
|
|
32
|
+
* A stack is eight kilobytes and a table row is one line, so the row says what
|
|
33
|
+
* happened and `--json` carries the rest.
|
|
34
|
+
*/
|
|
35
|
+
export function firstErrorLine(row) {
|
|
36
|
+
const message = String(row?.errorMessage ?? "").trim();
|
|
37
|
+
if (message)
|
|
38
|
+
return message.split("\n")[0];
|
|
39
|
+
const stderr = Array.isArray(row?.stderr) ? row.stderr : [];
|
|
40
|
+
return stderr.length > 0 ? String(stderr[0].line ?? "") : "";
|
|
41
|
+
}
|
|
42
|
+
/** The cells one record contributes to a table row. */
|
|
43
|
+
export function functionLogCells(row) {
|
|
44
|
+
return {
|
|
45
|
+
startedAt: row?.startedAt ?? "",
|
|
46
|
+
status: row?.status ?? "",
|
|
47
|
+
trigger: row?.trigger?.kind ?? "",
|
|
48
|
+
runtime: row?.runtime ?? "",
|
|
49
|
+
configId: row?.configId ?? "",
|
|
50
|
+
// A trigger fire and a task run name their run; a request invocation's key
|
|
51
|
+
// is its own id.
|
|
52
|
+
runOrInvocation: row?.runId || row?.invocationId || "",
|
|
53
|
+
errorCode: row?.errorCode ?? "",
|
|
54
|
+
firstError: firstErrorLine(row),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The same record as one line, for `--follow`.
|
|
59
|
+
*
|
|
60
|
+
* Same facts in the same order as the table's columns, so a reader who switches
|
|
61
|
+
* between them is reading the same thing. An absent value contributes nothing
|
|
62
|
+
* rather than an empty gap, because a tail line has no columns to keep aligned.
|
|
63
|
+
*/
|
|
64
|
+
export function functionLogLine(row) {
|
|
65
|
+
const cells = functionLogCells(row);
|
|
66
|
+
const runtime = cells.runtime ? ` ${cells.runtime}` : "";
|
|
67
|
+
const version = cells.configId ? ` ${cells.configId}` : "";
|
|
68
|
+
const code = cells.errorCode ? ` ${cells.errorCode}` : "";
|
|
69
|
+
const detail = cells.firstError ? ` ${cells.firstError}` : "";
|
|
70
|
+
return (`${cells.startedAt} ${cells.status} ${cells.trigger}${runtime}${version} ` +
|
|
71
|
+
`${cells.runOrInvocation}${code}${detail}`);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=function-log-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-log-row.js","sourceRoot":"","sources":["../../../src/lib/function-log-row.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,QAAQ;IACR,SAAS;IACT,2EAA2E;IAC3E,4EAA4E;IAC5E,0EAA0E;IAC1E,2EAA2E;IAC3E,kDAAkD;IAClD,SAAS;IACT,yEAAyE;IACzE,kDAAkD;IAClD,SAAS;IACT,mBAAmB;IACnB,MAAM;IACN,OAAO;CACC,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,YA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AO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,OAAO,CACL,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,IAAI;QAC7E,GAAG,KAAK,CAAC,eAAe,GAAG,IAAI,GAAG,MAAM,EAAE,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { FollowSource } from "./watch.js";
|
|
2
|
+
/**
|
|
3
|
+
* The tail's backlog walk — #3287, CR3287-007, CR3287-016, CR3287-017.
|
|
4
|
+
*
|
|
5
|
+
* `primitive functions logs --follow` polls a listing that answers NEWEST
|
|
6
|
+
* first, and `followLoop` carries one opaque checkpoint. The naive source
|
|
7
|
+
* reads one page and advances the mark to the newest row on it — which is
|
|
8
|
+
* correct only while fewer than one page of invocations arrive between two
|
|
9
|
+
* polls. A function at its admitted rate can record far more than that in two
|
|
10
|
+
* seconds, and every row the tail skipped past would be gone for good: the
|
|
11
|
+
* mark moved over them, so no later tick can reach back.
|
|
12
|
+
*
|
|
13
|
+
* So a call walks BACKWARD, page by page, until it meets the mark, and emits
|
|
14
|
+
* everything it collected oldest-first. The walk is bounded per call, and a
|
|
15
|
+
* call whose budget runs out before it meets the mark does NOT skip the gap
|
|
16
|
+
* (CR3287-017): it keeps what it collected, hands back a checkpoint carrying
|
|
17
|
+
* the page cursor it stopped at, and the next call resumes from there. The
|
|
18
|
+
* mark advances only once the whole backlog between it and the walk's top has
|
|
19
|
+
* been collected, so no row is passed over, and the rows are still printed in
|
|
20
|
+
* the order they were written.
|
|
21
|
+
*
|
|
22
|
+
* The one thing that means holding across calls is the collected-but-unemitted
|
|
23
|
+
* backlog, which lives in this closure rather than in the checkpoint: a page
|
|
24
|
+
* of inspection items is not a string to round-trip. The checkpoint is still
|
|
25
|
+
* the only thing `followLoop` carries, and it is self-describing: a bare mark
|
|
26
|
+
* means "walk from the top to here", a mark with a cursor means "a walk is in
|
|
27
|
+
* progress, continue it".
|
|
28
|
+
*
|
|
29
|
+
* An EMPTY listing is an initialized tail, not an uninitialized one
|
|
30
|
+
* (CR3287-016). `followLoop` reads an empty checkpoint as "bootstrap again",
|
|
31
|
+
* so a tail started before a function's first invocation would swallow that
|
|
32
|
+
* invocation as its baseline — the first failure the operator was waiting
|
|
33
|
+
* for. The mark for "nothing yet" is a sentinel that sorts below every ULID.
|
|
34
|
+
*
|
|
35
|
+
* It lives here rather than inside the command because the walk is the part
|
|
36
|
+
* with a bug in it, and a bug in paging is decidable without a server.
|
|
37
|
+
*/
|
|
38
|
+
/** One page of the listing, as the route answers it. */
|
|
39
|
+
export interface LogPage<T> {
|
|
40
|
+
items: T[];
|
|
41
|
+
nextCursor?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LogPager<T> {
|
|
44
|
+
(args: {
|
|
45
|
+
cursor?: string;
|
|
46
|
+
}): Promise<LogPage<T>>;
|
|
47
|
+
}
|
|
48
|
+
export interface LogTailOptions<T> {
|
|
49
|
+
/** The row's ULID — string order IS creation order. */
|
|
50
|
+
idOf: (row: T) => string;
|
|
51
|
+
/**
|
|
52
|
+
* How many pages one CALL will walk toward the mark. `followLoop` calls
|
|
53
|
+
* again within the same tick while the checkpoint says a walk is still in
|
|
54
|
+
* progress, up to its own page bound, then waits for the next tick.
|
|
55
|
+
*/
|
|
56
|
+
maxPagesPerTick: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The mark of a tail that has seen no row yet — CR3287-016.
|
|
60
|
+
*
|
|
61
|
+
* A ULID is 26 characters of Crockford base32, so this single character sorts
|
|
62
|
+
* below every one of them and above nothing: `idOf(row) <= EMPTY_TAIL_MARK`
|
|
63
|
+
* is false for every row, which is exactly "everything is new". It is a
|
|
64
|
+
* non-empty string, which is what keeps `followLoop` from reading it as an
|
|
65
|
+
* uninitialized tail.
|
|
66
|
+
*/
|
|
67
|
+
export declare const EMPTY_TAIL_MARK = "0";
|
|
68
|
+
/**
|
|
69
|
+
* How far below the mark the walk still looks — #3448 D3448-013.
|
|
70
|
+
*
|
|
71
|
+
* #3448 mints an invocation's id BEFORE the run and writes its record at
|
|
72
|
+
* SETTLEMENT, so a record can be inserted BELOW a mark set while it was still
|
|
73
|
+
* running: A starts, B starts and settles and is emitted, A settles. Under
|
|
74
|
+
* `stop at id <= mark` A is never shown — and A is the slow, failed and
|
|
75
|
+
* timed-out invocation an operator tails for (D3448-SO-003).
|
|
76
|
+
*
|
|
77
|
+
* The bound is the longest a REQUEST record can lag its own id: the platform's
|
|
78
|
+
* 30 s request ceiling plus the token's skew grace, rounded up to a minute.
|
|
79
|
+
* Nothing below it can still be in flight, so a row older than the window is
|
|
80
|
+
* already settled and was already emitted or already skipped.
|
|
81
|
+
*
|
|
82
|
+
* A task run's slice records carry settle-time ids of their own and are
|
|
83
|
+
* unaffected — they were never out of order.
|
|
84
|
+
*/
|
|
85
|
+
export declare const TAIL_OVERLAP_MS = 60000;
|
|
86
|
+
/**
|
|
87
|
+
* The id the walk stops below, given the mark.
|
|
88
|
+
*
|
|
89
|
+
* A mark this cannot read — the empty sentinel, or a fixture's short id — is
|
|
90
|
+
* its own bound: there is no instant to widen from, so the walk stops exactly
|
|
91
|
+
* where it stopped before this change, and #3287's own fixtures are unmoved.
|
|
92
|
+
*/
|
|
93
|
+
export declare function tailLowerBound(mark: string): string;
|
|
94
|
+
/** What the checkpoint string carries. */
|
|
95
|
+
interface TailCheckpoint {
|
|
96
|
+
/** The newest id already emitted (or the empty sentinel). */
|
|
97
|
+
mark: string;
|
|
98
|
+
/** Set while a walk toward `mark` is in progress: the page to resume at. */
|
|
99
|
+
cursor?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The ids already emitted that still lie inside the overlap window — #3448.
|
|
102
|
+
*
|
|
103
|
+
* The walk now revisits rows at or below the mark, and this is what makes a
|
|
104
|
+
* row in the overlap emitted ONCE. It is pruned as the window slides, so it
|
|
105
|
+
* is bounded by what a minute can hold rather than by the tail's lifetime.
|
|
106
|
+
*/
|
|
107
|
+
seen: string[];
|
|
108
|
+
/**
|
|
109
|
+
* The oldest id the bootstrap managed to read, when it could not reach the
|
|
110
|
+
* whole overlap window inside its page budget — CR3448-003.
|
|
111
|
+
*
|
|
112
|
+
* The walk must not go below it: rows under it existed BEFORE the tail
|
|
113
|
+
* started and the baseline never recorded them, so reaching them would print
|
|
114
|
+
* history as if it were arriving. It is dropped as soon as the mark has
|
|
115
|
+
* moved far enough that the window itself is the tighter bound.
|
|
116
|
+
*/
|
|
117
|
+
floor?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A bare mark stays a bare mark — the common case, and what an operator sees
|
|
121
|
+
* in a debug print. Anything more is JSON, which a ULID cannot start with, so
|
|
122
|
+
* the two are told apart by their first character.
|
|
123
|
+
*/
|
|
124
|
+
export declare function encodeTailCheckpoint(checkpoint: TailCheckpoint): string;
|
|
125
|
+
/**
|
|
126
|
+
* A pre-#3448 checkpoint has no `seen` key and reads as an empty set, which is
|
|
127
|
+
* the honest answer: the tail that wrote it never looked below its mark, so it
|
|
128
|
+
* emitted nothing inside the window it needs to remember.
|
|
129
|
+
*/
|
|
130
|
+
export declare function decodeTailCheckpoint(token: string): TailCheckpoint;
|
|
131
|
+
export declare function buildLogFollowSource<T>(fetchPage: LogPager<T>, options: LogTailOptions<T>): FollowSource<T>;
|
|
132
|
+
export {};
|