primitive-admin 1.1.0-alpha.8 → 1.1.0-alpha.80
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 +444 -106
- package/assets/skill/skills/primitive-platform/SKILL.md +811 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +373 -21
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +128 -19
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +700 -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 +54 -96
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +196 -105
- 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 +330 -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 +37 -38
- 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 +84 -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 +565 -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 +100 -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 +265 -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 +163 -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 +171 -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 +1859 -238
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +2 -0
- package/dist/src/commands/documents.js +2062 -19
- 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 +174 -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 +385 -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 +116 -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 +672 -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 +86 -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 +39 -108
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +223 -0
- package/dist/src/commands/guides.js +617 -65
- 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 +402 -182
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +13 -8
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +8 -0
- package/dist/src/commands/locks.js +160 -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 +112 -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 +281 -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 +275 -621
- 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 +137 -147
- 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 +679 -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 +108 -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 +75 -0
- package/dist/src/commands/sessions.js.map +1 -0
- package/dist/src/commands/settings.d.ts +18 -0
- package/dist/src/commands/settings.js +54 -0
- package/dist/src/commands/settings.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 +2514 -0
- package/dist/src/commands/sync.js +16106 -848
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +130 -21
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +532 -23
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +96 -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 +10 -10
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +2 -0
- package/dist/src/commands/webhooks.js +562 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +116 -0
- package/dist/src/commands/workflows.js +1638 -729
- 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 +2147 -0
- package/dist/src/lib/api-client.js +2042 -160
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-match-guard.d.ts +44 -0
- package/dist/src/lib/app-match-guard.js +72 -0
- package/dist/src/lib/app-match-guard.js.map +1 -0
- package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
- package/dist/src/lib/app-settings-descriptor.js +584 -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/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 +696 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +85 -0
- package/dist/src/lib/config-payload.js +116 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +140 -0
- package/dist/src/lib/config-surface.js +317 -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 +517 -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/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/env-resolver-core.d.ts +253 -0
- package/dist/src/lib/env-resolver-core.js +459 -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 +141 -0
- package/dist/src/lib/function-bundle.js +333 -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 +594 -0
- package/dist/src/lib/function-collect.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +187 -0
- package/dist/src/lib/function-db-types.js +782 -0
- package/dist/src/lib/function-db-types.js.map +1 -0
- package/dist/src/lib/function-document-types.d.ts +50 -0
- package/dist/src/lib/function-document-types.js +163 -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 +100 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -0
- package/dist/src/lib/function-log-tail.d.ts +83 -0
- package/dist/src/lib/function-log-tail.js +115 -0
- package/dist/src/lib/function-log-tail.js.map +1 -0
- package/dist/src/lib/function-schema-codegen.d.ts +118 -0
- package/dist/src/lib/function-schema-codegen.js +402 -0
- package/dist/src/lib/function-schema-codegen.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +263 -0
- package/dist/src/lib/function-sync.js +604 -0
- package/dist/src/lib/function-sync.js.map +1 -0
- package/dist/src/lib/function-triggers.d.ts +66 -0
- package/dist/src/lib/function-triggers.js +285 -0
- package/dist/src/lib/function-triggers.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/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 +1445 -0
- package/dist/src/lib/generated-config-surfaces.js +5836 -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/generated-workflow-model-fields.d.ts +20 -0
- package/dist/src/lib/generated-workflow-model-fields.js +53 -0
- package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
- package/dist/src/lib/google-client-secret-status.d.ts +35 -0
- package/dist/src/lib/google-client-secret-status.js +56 -0
- package/dist/src/lib/google-client-secret-status.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/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 +680 -0
- package/dist/src/lib/log-inspection.js +784 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +164 -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 +109 -0
- package/dist/src/lib/output.js +191 -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 +83 -0
- package/dist/src/lib/paginate.js +95 -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/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 +65 -0
- package/dist/src/lib/refresh-admin-credentials.js +103 -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-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 +25 -0
- package/dist/src/lib/skill-installer.js +266 -0
- package/dist/src/lib/skill-installer.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/swift-codegen/dbGenerator.d.ts +113 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +914 -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/generator.d.ts +94 -0
- package/dist/src/lib/swift-codegen/generator.js +440 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -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 +123 -0
- package/dist/src/lib/sync-paths.js +193 -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 +95 -0
- package/dist/src/lib/sync-selectors.js +228 -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/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-field-descriptor.d.ts +91 -0
- package/dist/src/lib/workflow-field-descriptor.js +153 -0
- package/dist/src/lib/workflow-field-descriptor.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 +207 -0
- package/dist/src/lib/workflow-toml-validator.js +762 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/lib/workflow-usage.d.ts +198 -0
- package/dist/src/lib/workflow-usage.js +312 -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,1445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from the canonical server modules under `src/config-surface/` — the
|
|
5
|
+
* ONE definition per configuration object (issue #2644). The server's
|
|
6
|
+
* create/update handlers and this copy read the same field surface, so the CLI's
|
|
7
|
+
* push payloads, pull serializers and TOML key validation cannot drift from what
|
|
8
|
+
* the server accepts.
|
|
9
|
+
*
|
|
10
|
+
* Regenerate with:
|
|
11
|
+
* node cli/scripts/gen-config-surfaces.mjs (runs automatically at CLI prebuild)
|
|
12
|
+
*
|
|
13
|
+
* A freshness guard (`gen-config-surfaces.mjs --check`, asserted by
|
|
14
|
+
* `cli/tests/unit/config-surface-drift-guard.test.ts`) fails if this committed
|
|
15
|
+
* copy does not match the source.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The one definition per configuration object (issue #2644).
|
|
19
|
+
*
|
|
20
|
+
* A "configuration object" is anything `primitive config` round-trips as
|
|
21
|
+
* config-as-code: workflows, prompts, integrations, webhooks, cron triggers,
|
|
22
|
+
* blob buckets, database types, rule sets, email templates, and the type
|
|
23
|
+
* configs. Every one of them used to write its field surface out by hand in at
|
|
24
|
+
* least three places — the server's create/update handler, the CLI's push
|
|
25
|
+
* payload builder, and the CLI's pull serializer — so adding a field to one and
|
|
26
|
+
* not the others failed silently: the field was simply absent, `config diff` could
|
|
27
|
+
* not see it, and a pull → push cycle cleared it server-side (#571, #807, #1081,
|
|
28
|
+
* #1172, #1177, #1972, #2635).
|
|
29
|
+
*
|
|
30
|
+
* These types describe that surface ONCE. The definitions live here on the
|
|
31
|
+
* server; the CLI vendors them at build time into
|
|
32
|
+
* `cli/src/lib/generated-config-surfaces.ts`
|
|
33
|
+
* (`cli/scripts/gen-config-surfaces.mjs`), the same server→CLI vendoring
|
|
34
|
+
* `gen-operation-def-descriptor.mjs` (#1544) already uses, so the published CLI
|
|
35
|
+
* still imports no server code at runtime.
|
|
36
|
+
*
|
|
37
|
+
* ── Scope: declarative classification and coverage ONLY ──────────────────
|
|
38
|
+
* Decision of record (#1976, 2026-07-23, carried forward at #2644's design
|
|
39
|
+
* gate): a definition records WHICH fields exist, whether each is part of the
|
|
40
|
+
* TOML surface, which modes the server accepts it in, and — for a field with
|
|
41
|
+
* real behavior — the NAME of the handler that owns that behavior. It never
|
|
42
|
+
* encodes the behavior itself, and no handler source is ever regex-scanned for
|
|
43
|
+
* field names. `pickWritableFields` replaces the key list, not the validation.
|
|
44
|
+
*
|
|
45
|
+
* ── Purity ───────────────────────────────────────────────────────────────
|
|
46
|
+
* Everything under `src/config-surface/` must stay importable by a build-time
|
|
47
|
+
* Node script with no Workers runtime: no `getAppModels`, no `withAppContext`,
|
|
48
|
+
* no `src/do-routing.ts`, no `env`. `cli/tests/unit/config-surface-drift-guard.test.ts`
|
|
49
|
+
* asserts the directory's import graph stays empty of those modules.
|
|
50
|
+
*/
|
|
51
|
+
/** Value shape of a field on the wire and in TOML. Descriptive, not a parser. */
|
|
52
|
+
export type FieldType = "string" | "number" | "boolean" | "string[]" | "json";
|
|
53
|
+
/**
|
|
54
|
+
* Why a persisted field is not part of the TOML surface. `note` is required —
|
|
55
|
+
* absence from a hand-written list is never a decision (#2644 criterion 4).
|
|
56
|
+
*/
|
|
57
|
+
export type NotExposed = {
|
|
58
|
+
kind: "server-owned";
|
|
59
|
+
note: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "structural";
|
|
62
|
+
note: string;
|
|
63
|
+
/**
|
|
64
|
+
* Which create/update modes carry this key IN THE REQUEST BODY — the same
|
|
65
|
+
* statement `ConfigField.writableOn` makes about a field, for a key that
|
|
66
|
+
* is not part of the TOML field surface.
|
|
67
|
+
*
|
|
68
|
+
* Omitted means both, the common case for a sub-tree the body always
|
|
69
|
+
* carries (`rules`, `metadataManifest`, `config`). `[]` says the key
|
|
70
|
+
* never travels in the body at all: it is in the URL path or comes from
|
|
71
|
+
* the file name, so no request schema admits it. Being structural is a
|
|
72
|
+
* statement about the TOML surface and does not by itself make a key
|
|
73
|
+
* writable — a mode whose handler never reads the key is not declared
|
|
74
|
+
* for it, or the schema would accept a key the handler drops, which is
|
|
75
|
+
* the silent 200 criterion 9 exists to end.
|
|
76
|
+
*/
|
|
77
|
+
requestModes?: readonly ("create" | "update")[];
|
|
78
|
+
} | {
|
|
79
|
+
kind: "secret";
|
|
80
|
+
note: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: "deprecated";
|
|
83
|
+
note: string;
|
|
84
|
+
};
|
|
85
|
+
export interface ConfigField {
|
|
86
|
+
/** `models.yaml` field name === the wire key on create/update. */
|
|
87
|
+
field: string;
|
|
88
|
+
/** Key inside the TOML table (often identical to `field`). */
|
|
89
|
+
tomlKey: string;
|
|
90
|
+
type: FieldType;
|
|
91
|
+
/** "whenSet" omits the key on pull when the value is empty; see #1033's `emit`. */
|
|
92
|
+
emit: "always" | "whenSet";
|
|
93
|
+
/**
|
|
94
|
+
* Modes the SERVER accepts the field in — a statement about the handler's
|
|
95
|
+
* `hasOwnProperty` branches and nothing else. `["create"]` means update
|
|
96
|
+
* genuinely rejects/ignores it (e.g. an immutable key). It is NOT a place to
|
|
97
|
+
* record CLI call ordering: `syncCallable` is accepted on both create and
|
|
98
|
+
* update (`src/admin-api.ts` `createAppWorkflow` / `updateAppWorkflow`); the
|
|
99
|
+
* CLI's create-only send is a *sequencing* invariant owned by
|
|
100
|
+
* `applyWorkflowBody` (#807 — the deferred second PATCH is itself an update
|
|
101
|
+
* call, and would break if update rejected the field).
|
|
102
|
+
*/
|
|
103
|
+
writableOn: readonly ("create" | "update")[];
|
|
104
|
+
/**
|
|
105
|
+
* Classification, not dispatch. "passthrough" = the accepted value is stored
|
|
106
|
+
* as-is. Otherwise the named handler owns validation, normalization and
|
|
107
|
+
* serialization for this field; the guard only asserts the export exists.
|
|
108
|
+
*
|
|
109
|
+
* A handler is named `"<repo-relative module path>#<exported name>"`, e.g.
|
|
110
|
+
* `"src/workflows/config/workflow-field-handlers.ts#normalizeWorkflowStatus"`.
|
|
111
|
+
* `cli/tests/unit/config-surface-drift-guard.test.ts` fails when the module or
|
|
112
|
+
* the export is missing (#2644 behavior 2b).
|
|
113
|
+
*/
|
|
114
|
+
validation: "passthrough" | {
|
|
115
|
+
handler: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* This field's declared type genuinely admits more than one TOML spelling
|
|
119
|
+
* (#2880 criterion 5).
|
|
120
|
+
*
|
|
121
|
+
* The declared type is the contract: a quoted number for a declared number
|
|
122
|
+
* is a validation error `config diff` and `config push` report identically,
|
|
123
|
+
* and neither coerces. A handful of fields are genuinely dual-encoded
|
|
124
|
+
* anyway — `temperature` and `topP` are `StringField`s the server stores as
|
|
125
|
+
* strings and returns parsed (#2869), so `"0.2"` and `0.2` describe one
|
|
126
|
+
* value — and for those the two spellings must compare EQUAL, or diff
|
|
127
|
+
* reports a `Modified` no push can clear.
|
|
128
|
+
*
|
|
129
|
+
* Recorded here rather than inferred from the type, so the carve-out is a
|
|
130
|
+
* decision with a reason attached instead of a rule that quietly widens to
|
|
131
|
+
* every number in the surface.
|
|
132
|
+
*/
|
|
133
|
+
dualEncoded?: {
|
|
134
|
+
note: string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* The value the SERVER materializes when a create omits this key (#2880
|
|
138
|
+
* DSO-002).
|
|
139
|
+
*
|
|
140
|
+
* A hand-authored file that omits an optional field the server defaults —
|
|
141
|
+
* an integration's `timeoutMs`, a cron trigger's `timezone` — creates fine
|
|
142
|
+
* and then reads `Modified` forever: the server holds the default, the file
|
|
143
|
+
* holds nothing, and push's payload builder drops the absent key so the
|
|
144
|
+
* difference can never converge. Recording the default here lets the LOCAL
|
|
145
|
+
* side of the comparison apply the same value the server did.
|
|
146
|
+
*
|
|
147
|
+
* Only for a default the server assigns on CREATE and returns on read.
|
|
148
|
+
*/
|
|
149
|
+
serverDefault?: string | number | boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface ConfigTable {
|
|
152
|
+
/** TOML path, e.g. ["workflow"] for [workflow], ["configs"] for [[configs]]. */
|
|
153
|
+
tomlPath: readonly string[];
|
|
154
|
+
repeated: boolean;
|
|
155
|
+
/** The `models.yaml` model backing this table — the coverage anchor. */
|
|
156
|
+
model: string;
|
|
157
|
+
fields: readonly ConfigField[];
|
|
158
|
+
/** Every model field not in `fields`, with its reason. Coverage is exhaustive. */
|
|
159
|
+
notExposed: Readonly<Record<string, NotExposed>>;
|
|
160
|
+
/**
|
|
161
|
+
* TOML keys accepted inside this table that are NOT part of the write field
|
|
162
|
+
* surface — an author writes them, but some other machinery consumes them.
|
|
163
|
+
* Declared here so `config push`'s unrecognized-key rejection (#2644 criterion
|
|
164
|
+
* 6) does not reject a key the CLI itself emits, and so the reason is visible
|
|
165
|
+
* rather than implied.
|
|
166
|
+
*/
|
|
167
|
+
tomlOnlyKeys: Readonly<Record<string, NotExposed>>;
|
|
168
|
+
/**
|
|
169
|
+
* Keys the create/update BODY carries that are not `models.yaml` fields at
|
|
170
|
+
* all — protocol keys such as the `expectedModifiedAt` optimistic-concurrency
|
|
171
|
+
* token. Declared here so phase 5's generated request schemas
|
|
172
|
+
* (`request-schema.ts`) accept them, with the reason visible rather than
|
|
173
|
+
* implied. Optional: most objects have none.
|
|
174
|
+
*
|
|
175
|
+
* `modes` records which handlers actually read the key, the same statement
|
|
176
|
+
* `ConfigField.writableOn` makes about a field. Omitted means both — the
|
|
177
|
+
* common case. A key the handler in this mode does not read is NOT declared
|
|
178
|
+
* for that mode: the schema would accept it and the handler would drop it,
|
|
179
|
+
* which is the silent 200 criterion 9 exists to end.
|
|
180
|
+
*/
|
|
181
|
+
requestOnlyKeys?: Readonly<Record<string, {
|
|
182
|
+
note: string;
|
|
183
|
+
modes?: readonly ("create" | "update")[];
|
|
184
|
+
}>>;
|
|
185
|
+
/**
|
|
186
|
+
* Keys the server's GET response carries that are not `models.yaml` fields —
|
|
187
|
+
* derived flags and related payloads. Declared here so `config pull`'s
|
|
188
|
+
* unrecognized-key warning (#2644 criterion 6) reports genuinely unknown keys
|
|
189
|
+
* rather than every computed one.
|
|
190
|
+
*/
|
|
191
|
+
responseOnlyKeys: Readonly<Record<string, NotExposed>>;
|
|
192
|
+
}
|
|
193
|
+
export interface ConfigObjectSurface {
|
|
194
|
+
/** Matches the CLI's `SyncResourceType.label` — e.g. "workflow", "prompt". */
|
|
195
|
+
label: string;
|
|
196
|
+
tables: readonly ConfigTable[];
|
|
197
|
+
/**
|
|
198
|
+
* Top-level TOML keys the object's FILE carries besides its field tables —
|
|
199
|
+
* the authored sub-trees that travel on their own channel (`[[steps]]`,
|
|
200
|
+
* `[requestConfig]`, `[rules]`, `[models.*]`) and the declared-access
|
|
201
|
+
* manifest's `[metadata]` / `secrets` / `vars` fragments.
|
|
202
|
+
*
|
|
203
|
+
* `tomlOnlyKeys` says which keys are accepted INSIDE a table; this says which
|
|
204
|
+
* keys are accepted at the document root. Together they make `config push`'s
|
|
205
|
+
* rejection total (design gate, 2026-08-12: push rejects everything
|
|
206
|
+
* unrecognized): without it a typo'd table header — `[integraton]` — parsed
|
|
207
|
+
* to a root key nothing checked, so the file pushed as though the real table
|
|
208
|
+
* were empty and the TOML-owned fields inside it were CLEARED server-side.
|
|
209
|
+
*
|
|
210
|
+
* Every entry carries its reason, the same rule `notExposed` follows: a table
|
|
211
|
+
* that is simply absent from this map must not read as a decision.
|
|
212
|
+
*/
|
|
213
|
+
tomlDocumentKeys: Readonly<Record<string, NotExposed>>;
|
|
214
|
+
/**
|
|
215
|
+
* Declares that this object HAS no TOML field table, with the reason —
|
|
216
|
+
* required when `tables` is empty and forbidden otherwise.
|
|
217
|
+
*
|
|
218
|
+
* `transform` is the case: a `.rhai` file's authored surface is the script
|
|
219
|
+
* body, so there is no key/value table to define. Saying so here is the same
|
|
220
|
+
* rule `notExposed` applies to a field, one level up: "absent from the
|
|
221
|
+
* registry" and "deliberately fieldless" must not look the same (#2644
|
|
222
|
+
* criterion 4).
|
|
223
|
+
*/
|
|
224
|
+
noFieldTable?: {
|
|
225
|
+
note: string;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Shared spellings used by every configuration-object definition (issue #2644).
|
|
230
|
+
*
|
|
231
|
+
* These live in one module for a mechanical reason as much as a stylistic one:
|
|
232
|
+
* `cli/scripts/gen-config-surfaces.mjs` concatenates the whole directory into a
|
|
233
|
+
* single vendored artifact, so a `const handler = …` declared per definition
|
|
234
|
+
* module would collide as a duplicate identifier the moment a second object was
|
|
235
|
+
* migrated.
|
|
236
|
+
*
|
|
237
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
238
|
+
*/
|
|
239
|
+
/** Both write modes — the common case, spelled once. */
|
|
240
|
+
export declare const BOTH: readonly ("create" | "update")[];
|
|
241
|
+
/** Create only: an immutable key or a field the update handler ignores. */
|
|
242
|
+
export declare const CREATE_ONLY: readonly ("create" | "update")[];
|
|
243
|
+
/** Update only: a field the create handler assigns itself. */
|
|
244
|
+
export declare const UPDATE_ONLY: readonly ("create" | "update")[];
|
|
245
|
+
/**
|
|
246
|
+
* Name the handler that owns a field's validation, normalization and
|
|
247
|
+
* serialization, as `"<repo-relative module>#<export>"`. Classification only —
|
|
248
|
+
* the definition never dispatches through it (#1976 decision of record); the
|
|
249
|
+
* guard asserts the export exists so a renamed handler fails the CLI unit suite
|
|
250
|
+
* instead of leaving a dangling reference (#2644 behavior 2b).
|
|
251
|
+
*/
|
|
252
|
+
export declare function handledBy(modulePath: string, exportName: string): ConfigField["validation"];
|
|
253
|
+
/**
|
|
254
|
+
* The declared-access manifest's top-level TOML keys (#1304, #1364).
|
|
255
|
+
*
|
|
256
|
+
* Five objects carry the same three-key fragment beside their field table —
|
|
257
|
+
* workflows, database types, and the group / collection / metadata-category
|
|
258
|
+
* configs — parsed by the one `parseDeclaredAccessManifestToml`. Spelling it
|
|
259
|
+
* once here keeps `config push`'s document-level rejection from disagreeing with
|
|
260
|
+
* itself object by object.
|
|
261
|
+
*/
|
|
262
|
+
export declare const DECLARED_ACCESS_MANIFEST_KEYS: Readonly<Record<string, NotExposed>>;
|
|
263
|
+
/**
|
|
264
|
+
* The accepted-key half of a configuration object's definition (issue #2644).
|
|
265
|
+
*
|
|
266
|
+
* `pickWritableFields` answers exactly one question — "is this key writable on
|
|
267
|
+
* this object in this mode" — so a server handler stops naming the keys it
|
|
268
|
+
* accepts. What a present key MEANS stays with the per-field handler the
|
|
269
|
+
* definition names (spec §Contracts, decision of record #1976): the workflow
|
|
270
|
+
* `status` enum, the non-negative-integer coercion of the queue limits,
|
|
271
|
+
* `runAs`'s caller|system check, `parseWorkflowLock`, the `capabilities` array
|
|
272
|
+
* shape and the CEL parse of `accessRule` all stay where they are. The
|
|
273
|
+
* mechanical win is that a field can no longer be *absent* from the accepted
|
|
274
|
+
* set.
|
|
275
|
+
*
|
|
276
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
277
|
+
*/
|
|
278
|
+
export type WriteMode = "create" | "update";
|
|
279
|
+
/** The field names this table accepts on the wire in `mode`, in declaration order. */
|
|
280
|
+
export declare function writableFieldNames(table: ConfigTable, mode: WriteMode): string[];
|
|
281
|
+
/**
|
|
282
|
+
* The field names the server PERSISTS for this table in `mode`: the writable
|
|
283
|
+
* fields, plus the `deprecated` classifications — "still writable, superseded
|
|
284
|
+
* by another field" is what that kind means (`types.ts`), so a superseded key
|
|
285
|
+
* a handler still honors (`accessPolicy`, `passkeyRpId`) belongs in every
|
|
286
|
+
* accepted set, and a field that is NOT writable belongs in none of them.
|
|
287
|
+
*
|
|
288
|
+
* Stated once here because three consumers need the same answer: the generated
|
|
289
|
+
* request schemas, `PUT /settings`'s write allow-list, and the guards.
|
|
290
|
+
*/
|
|
291
|
+
export declare function acceptedWriteFieldNames(table: ConfigTable, mode: WriteMode): string[];
|
|
292
|
+
/**
|
|
293
|
+
* Split a request body into the keys this table accepts in `mode` and the keys
|
|
294
|
+
* it does not.
|
|
295
|
+
*
|
|
296
|
+
* `accepted` preserves the caller's values verbatim — including an explicit
|
|
297
|
+
* `null` or `false`, which are meaningful (clear / opt-out) and must not be
|
|
298
|
+
* coalesced away. Only keys the body actually carries appear, so a handler can
|
|
299
|
+
* keep using presence (`hasOwnProperty`) to distinguish "leave unset" from
|
|
300
|
+
* "set to null".
|
|
301
|
+
*
|
|
302
|
+
* `rejected` is every other key the body carried. Today it is informational;
|
|
303
|
+
* #2644 phase 5 turns it into a 400 through the generated request schemas.
|
|
304
|
+
*/
|
|
305
|
+
export declare function pickWritableFields(body: Record<string, unknown>, table: ConfigTable, mode: WriteMode): {
|
|
306
|
+
accepted: Record<string, unknown>;
|
|
307
|
+
rejected: string[];
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* The PASSTHROUGH half of the accepted body: the keys this table declares
|
|
311
|
+
* `validation: "passthrough"`, writable in `mode`, that the body actually
|
|
312
|
+
* carries — with their values verbatim.
|
|
313
|
+
*
|
|
314
|
+
* This is what makes criterion 1 true rather than aspirational. A handler that
|
|
315
|
+
* only picked its accepted set still had to name each field again when it built
|
|
316
|
+
* the row to persist, so a scalar field added to a definition alone was
|
|
317
|
+
* accepted on the wire and then dropped on the floor. Handlers spread this into
|
|
318
|
+
* the create/update payload FIRST, so a field with real behavior still lands
|
|
319
|
+
* through its named handler (whose assignment comes after and wins), and a
|
|
320
|
+
* plain scalar needs no handler edit at all.
|
|
321
|
+
*
|
|
322
|
+
* Values are passed through untouched — including an explicit `null` or
|
|
323
|
+
* `false`, which are meaningful (clear / opt-out). "Stored as-is" is exactly
|
|
324
|
+
* what the `passthrough` classification promises.
|
|
325
|
+
*/
|
|
326
|
+
export declare function passthroughFields(body: Record<string, unknown>, table: ConfigTable, mode: WriteMode, options?: {
|
|
327
|
+
/**
|
|
328
|
+
* Fields whose PRESENCE semantics this handler owns — it decides, per
|
|
329
|
+
* value, whether the key is written at all (a falsy `displayName` that
|
|
330
|
+
* means "leave the stored name alone"). Listing one here keeps the generic
|
|
331
|
+
* copy from changing what it means.
|
|
332
|
+
*
|
|
333
|
+
* This is never a place to list a field the handler does not assign: a
|
|
334
|
+
* field named here and dropped by the handler is written nowhere, which is
|
|
335
|
+
* the silent loss the definition exists to prevent. A NEW field needs no
|
|
336
|
+
* entry — omission is what makes it flow through.
|
|
337
|
+
*/
|
|
338
|
+
handledHere?: readonly string[];
|
|
339
|
+
}): Record<string, unknown>;
|
|
340
|
+
/** `true` when the body carries `field` and this table accepts it in `mode`. */
|
|
341
|
+
export declare function hasWritableField(accepted: Record<string, unknown>, field: string): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Coverage checks over a configuration object's definition (issue #2644,
|
|
344
|
+
* criteria 2 and 4).
|
|
345
|
+
*
|
|
346
|
+
* A definition claims to describe its model's WHOLE field surface. These
|
|
347
|
+
* functions are what make that claim mean something: every `models.yaml` field
|
|
348
|
+
* is either exposed in TOML or classified `notExposed` with a reason, in both
|
|
349
|
+
* directions — a new field nobody classified, and a classification for a field
|
|
350
|
+
* that no longer exists. `cli/tests/unit/config-surface-drift-guard.test.ts`
|
|
351
|
+
* asserts them over every registered object, so coverage follows from being a
|
|
352
|
+
* configuration object rather than from someone adding a per-type guard.
|
|
353
|
+
*
|
|
354
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
355
|
+
*/
|
|
356
|
+
/**
|
|
357
|
+
* `models.yaml` field names per model — the coverage anchor, passed in rather
|
|
358
|
+
* than read here so this module stays pure (the CLI's vendored artifact carries
|
|
359
|
+
* it as `GENERATED_CONFIG_MODEL_FIELDS`).
|
|
360
|
+
*/
|
|
361
|
+
export type ModelFieldMap = Readonly<Record<string, readonly string[]>>;
|
|
362
|
+
/**
|
|
363
|
+
* Whether a value counts as unset for an `emit: "whenSet"` field, so `config pull`
|
|
364
|
+
* omits the key instead of writing a noisy empty one (and `config diff` does not
|
|
365
|
+
* report a difference that is not there).
|
|
366
|
+
*
|
|
367
|
+
* Carried over verbatim from #1033's shipped app-settings descriptor
|
|
368
|
+
* (`cli/src/lib/app-settings-descriptor.ts`): an empty array and an empty
|
|
369
|
+
* object are unset, while `false` and `0` are meaningful values and never are.
|
|
370
|
+
*/
|
|
371
|
+
export declare function isEmptyForEmit(value: unknown, type: ConfigField["type"]): boolean;
|
|
372
|
+
/**
|
|
373
|
+
* A field name whose shape says it carries a credential. Such a field must be
|
|
374
|
+
* classified explicitly — exposed with a stated reference-only contract, or
|
|
375
|
+
* `notExposed: { kind: "secret" }` — because a mechanical generalization that
|
|
376
|
+
* merely omits it would read as "not decided" (#2254, #2256).
|
|
377
|
+
*/
|
|
378
|
+
export declare const SECRETISH_FIELD: RegExp;
|
|
379
|
+
/** Model fields the table neither exposes nor classifies. Non-empty is a failure. */
|
|
380
|
+
export declare function findUnclassifiedFields(table: ConfigTable, modelFields: readonly string[]): string[];
|
|
381
|
+
/**
|
|
382
|
+
* Classifications that no longer correspond to a model field — i.e. a field
|
|
383
|
+
* removed from `models.yaml` while the definition still names it. Also a
|
|
384
|
+
* failure: a stale classification must not silently pass, or the coverage claim
|
|
385
|
+
* quietly stops meaning anything.
|
|
386
|
+
*/
|
|
387
|
+
export declare function findStaleClassifications(table: ConfigTable, modelFields: readonly string[]): string[];
|
|
388
|
+
/** The models this surface's tables project, in declaration order, deduped. */
|
|
389
|
+
export declare function surfaceModels(surface: ConfigObjectSurface): string[];
|
|
390
|
+
/**
|
|
391
|
+
* Model fields the whole surface neither exposes nor classifies. Non-empty is
|
|
392
|
+
* a failure: the CLI would silently ignore them and a pull → push cycle would
|
|
393
|
+
* clear them (#2644 criterion 2).
|
|
394
|
+
*/
|
|
395
|
+
export declare function findUnclassifiedSurfaceFields(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
|
|
396
|
+
/**
|
|
397
|
+
* Classifications naming a field the model no longer has — the other direction,
|
|
398
|
+
* and equally a failure: a stale entry quietly stops meaning anything.
|
|
399
|
+
*/
|
|
400
|
+
export declare function findStaleSurfaceClassifications(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
|
|
401
|
+
/** Fields the surface both exposes and classifies `notExposed`. Ambiguous. */
|
|
402
|
+
export declare function findDoubleClassifiedSurfaceFields(surface: ConfigObjectSurface): string[];
|
|
403
|
+
/**
|
|
404
|
+
* Secret-adjacent model fields the surface leaves undecided — neither exposed
|
|
405
|
+
* with a stated contract nor classified `notExposed` (#2254, #2256).
|
|
406
|
+
*/
|
|
407
|
+
export declare function findUnclassifiedSecretishSurfaceFields(surface: ConfigObjectSurface, modelFields: ModelFieldMap): string[];
|
|
408
|
+
/** Fields classified twice — exposed AND `notExposed`. Ambiguous, so a failure. */
|
|
409
|
+
export declare function findDoubleClassifiedFields(table: ConfigTable): string[];
|
|
410
|
+
/**
|
|
411
|
+
* `notExposed` / `tomlOnlyKeys` / `responseOnlyKeys` entries whose `note` is
|
|
412
|
+
* missing or blank. A reason is the whole point of the classification.
|
|
413
|
+
*/
|
|
414
|
+
export declare function findReasonlessClassifications(table: ConfigTable): string[];
|
|
415
|
+
/**
|
|
416
|
+
* Secret-adjacent model fields with no explicit decision — neither an exposed
|
|
417
|
+
* entry nor a `notExposed` classification. A bare omission is the failure mode
|
|
418
|
+
* this catches.
|
|
419
|
+
*/
|
|
420
|
+
export declare function findUnclassifiedSecretishFields(table: ConfigTable, modelFields: readonly string[]): string[];
|
|
421
|
+
/**
|
|
422
|
+
* Every distinct handler reference the table names, as
|
|
423
|
+
* `"<repo-relative module>#<export>"`. The guard resolves each one and fails
|
|
424
|
+
* when the module or the export is missing (#2644 behavior 2b).
|
|
425
|
+
*/
|
|
426
|
+
export declare function handlerReferences(table: ConfigTable): string[];
|
|
427
|
+
/** TOML keys this table accepts: the exposed fields plus the declared extras. */
|
|
428
|
+
export declare function acceptedTomlKeys(table: ConfigTable): Set<string>;
|
|
429
|
+
/** Top-level TOML keys this object's file accepts: its tables plus the extras. */
|
|
430
|
+
export declare function acceptedTomlDocumentKeys(surface: ConfigObjectSurface): Set<string>;
|
|
431
|
+
/**
|
|
432
|
+
* `tomlDocumentKeys` entries with no reason, and any that merely restate a
|
|
433
|
+
* field table. Both are failures: a reason is the whole point of the
|
|
434
|
+
* classification, and a duplicate would let a table's shape check be bypassed
|
|
435
|
+
* by declaring it twice.
|
|
436
|
+
*/
|
|
437
|
+
export declare function findBadDocumentKeyDeclarations(surface: ConfigObjectSurface): string[];
|
|
438
|
+
/** Root keys of `tomlData` the surface does not declare. `config push` rejects these. */
|
|
439
|
+
export declare function findUnknownTomlDocumentKeys(surface: ConfigObjectSurface, tomlData: unknown): string[];
|
|
440
|
+
export declare function findMisshapenTomlTables(surface: ConfigObjectSurface, tomlData: unknown): Array<{
|
|
441
|
+
key: string;
|
|
442
|
+
expected: "table" | "array of tables";
|
|
443
|
+
}>;
|
|
444
|
+
/**
|
|
445
|
+
* Server-response keys this table recognizes: every model field (exposed or
|
|
446
|
+
* not) plus the declared response-only keys. `config pull` warns about anything
|
|
447
|
+
* else instead of dropping it silently (#2644 criterion 6).
|
|
448
|
+
*/
|
|
449
|
+
export declare function recognizedResponseKeys(table: ConfigTable, modelFields: readonly string[]): Set<string>;
|
|
450
|
+
/**
|
|
451
|
+
* Request schemas generated from the configuration-object definitions
|
|
452
|
+
* (issue #2644, phase 5 / criterion 9).
|
|
453
|
+
*
|
|
454
|
+
* Every create/update handler in this family used to drop, in silence, any body
|
|
455
|
+
* key it did not read. A client sending `timoutMs` for `timeoutMs` got a 200 and
|
|
456
|
+
* no timeout change. These schemas close that: one per object and mode,
|
|
457
|
+
* `additionalProperties: false`, properties = the keys that object accepts on
|
|
458
|
+
* the wire in that mode, so an unknown key is a 400 naming it.
|
|
459
|
+
*
|
|
460
|
+
* **Breaking change, named**: a client that sends a stray key and gets a 200
|
|
461
|
+
* today will get a 400. The CLI never hits it — `config push` already rejects
|
|
462
|
+
* unrecognized TOML keys locally (criterion 6).
|
|
463
|
+
*
|
|
464
|
+
* ── What the schema says, and what it deliberately does not ──────────────
|
|
465
|
+
* It states the KEY SET only: each property is the empty schema, so no value is
|
|
466
|
+
* type-checked here. That is the decision of record (#1976, carried forward at
|
|
467
|
+
* #2644's design gate): the definition classifies, handlers behave. The
|
|
468
|
+
* `status` enum, the queue limits' integer coercion, `runAs`'s caller|system
|
|
469
|
+
* check, the CEL parse of `accessRule` — all stay in the handlers the
|
|
470
|
+
* definition names, with their existing messages. Adding type gates here would
|
|
471
|
+
* duplicate them and start rejecting values the handlers accept.
|
|
472
|
+
*
|
|
473
|
+
* ── Which keys are in the set ────────────────────────────────────────────
|
|
474
|
+
* Derived, not listed:
|
|
475
|
+
*
|
|
476
|
+
* - every field the definition says is writable in this mode;
|
|
477
|
+
* - every field classified `structural` — the authored sub-trees that travel
|
|
478
|
+
* on their own channel (`rules`, `steps`, `metadataManifest`, `schema`,
|
|
479
|
+
* `triggers`) but are still sent in the body — in the modes that entry
|
|
480
|
+
* declares (`requestModes`; omitted means both, `[]` means the key travels
|
|
481
|
+
* in the URL path and no schema admits it);
|
|
482
|
+
* - every field classified `deprecated` — still writable server-side, by
|
|
483
|
+
* definition of that classification;
|
|
484
|
+
* - the table's `requestOnlyKeys`, in the modes each declares: protocol keys
|
|
485
|
+
* that are not model fields at all, such as the `expectedModifiedAt`
|
|
486
|
+
* optimistic-concurrency token or a create-only alias.
|
|
487
|
+
*
|
|
488
|
+
* `server-owned` and `secret` classifications are the two the schema excludes:
|
|
489
|
+
* the first is assigned by the server, the second never travels in readable
|
|
490
|
+
* form.
|
|
491
|
+
*
|
|
492
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
493
|
+
*/
|
|
494
|
+
/**
|
|
495
|
+
* A generated request schema. Shaped for the app API's `meta.request` slot and
|
|
496
|
+
* the runtime validator it feeds (`src/app-api/request-validation.ts`), which
|
|
497
|
+
* reports an unknown key as `value.<key> is not allowed`.
|
|
498
|
+
*/
|
|
499
|
+
export interface ConfigRequestSchema {
|
|
500
|
+
type: "object";
|
|
501
|
+
properties: Record<string, Record<string, never>>;
|
|
502
|
+
additionalProperties: false;
|
|
503
|
+
/**
|
|
504
|
+
* Structural-typing escape hatch: the app API's `meta.request` slot is a
|
|
505
|
+
* `Record<string, unknown>` (`JsonSchema`), and an interface with no index
|
|
506
|
+
* signature is not assignable to one. Declaring the index here keeps the
|
|
507
|
+
* generated schema usable as a route schema without an `as any` at every
|
|
508
|
+
* call site.
|
|
509
|
+
*/
|
|
510
|
+
[key: string]: unknown;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Protocol keys every config UPDATE accepts, whichever object it is.
|
|
514
|
+
*
|
|
515
|
+
* `expectedModifiedAt` is the optimistic-concurrency token `config push` attaches
|
|
516
|
+
* to an update body when it has a baseline from the last pull; a handler that
|
|
517
|
+
* does not implement conflict detection ignores it. It is a property of the
|
|
518
|
+
* sync protocol rather than of any one object, which is why it is stated once
|
|
519
|
+
* here instead of in thirteen definitions.
|
|
520
|
+
*/
|
|
521
|
+
export declare const UPDATE_PROTOCOL_KEYS: readonly string[];
|
|
522
|
+
/** The body keys this table accepts in `mode`, in a stable order. */
|
|
523
|
+
export declare function requestSchemaKeys(table: ConfigTable, mode: "create" | "update"): string[];
|
|
524
|
+
/**
|
|
525
|
+
* The request schema for one object and mode. Generated from the definition, so
|
|
526
|
+
* a schema permitting a key the definition does not is unrepresentable: there
|
|
527
|
+
* is no place to write one.
|
|
528
|
+
*/
|
|
529
|
+
export declare function configRequestSchema(table: ConfigTable, mode: "create" | "update"): ConfigRequestSchema;
|
|
530
|
+
/**
|
|
531
|
+
* The retired-key guidance for a generated schema, keyed by body key — or
|
|
532
|
+
* `undefined` when the schema's object has none. Consumed by the app API's
|
|
533
|
+
* request validator (`src/app-api/request-validation.ts`).
|
|
534
|
+
*/
|
|
535
|
+
export declare function retiredRequestKeys(schema: object | undefined): Readonly<Record<string, string>> | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* One schema for an endpoint whose body spans MORE than one table.
|
|
538
|
+
*
|
|
539
|
+
* `POST …/prompts` is the case: it creates the prompt AND seeds its first
|
|
540
|
+
* config, so the body carries `[prompt]` fields and `[[configs]]` fields
|
|
541
|
+
* together. Both halves still come from their definitions — this only says the
|
|
542
|
+
* endpoint accepts the union, in the one place that is true.
|
|
543
|
+
*/
|
|
544
|
+
export declare function mergeRequestSchemas(...schemas: readonly ConfigRequestSchema[]): ConfigRequestSchema;
|
|
545
|
+
/**
|
|
546
|
+
* The body keys `table` does not accept in `mode` — the 400's subject.
|
|
547
|
+
*
|
|
548
|
+
* Used by the admin API, which has no request-schema middleware: its handlers
|
|
549
|
+
* call this directly so both APIs reject the same key set for the same object.
|
|
550
|
+
*/
|
|
551
|
+
export declare function unknownRequestKeys(body: unknown, table: ConfigTable, mode: "create" | "update"): string[];
|
|
552
|
+
/** The 400 message naming the unknown key(s), shared by both APIs. */
|
|
553
|
+
export declare function unknownRequestKeysMessage(keys: readonly string[]): string;
|
|
554
|
+
/**
|
|
555
|
+
* Keys deliberately RETIRED from a configuration object's write surface.
|
|
556
|
+
*
|
|
557
|
+
* A retired key is not an unknown key. The generic hint for an unrecognized
|
|
558
|
+
* TOML key — "check the spelling, or upgrade the CLI" — is exactly backwards
|
|
559
|
+
* for one this CLI removed on purpose, and the generic 400 for an unaccepted
|
|
560
|
+
* request key says only that the key is not allowed, not where the value moved
|
|
561
|
+
* to. Both surfaces need the same sentence, and neither should invent it.
|
|
562
|
+
*
|
|
563
|
+
* So the guidance lives here, next to the definitions, with one entry per
|
|
564
|
+
* retired key: the TOML wording for `config push` (which can tell the author to
|
|
565
|
+
* delete a line) and the request wording for the API handlers (which cannot).
|
|
566
|
+
*
|
|
567
|
+
* Keyed by the table's TOML path prefix (`workflow`, `cronTrigger`, …), because
|
|
568
|
+
* that is the identifier both consumers already have in hand.
|
|
569
|
+
*
|
|
570
|
+
* Pure: no models, no tenant context, no `env` (see `types.ts` §Purity).
|
|
571
|
+
*/
|
|
572
|
+
export interface RetiredConfigKey {
|
|
573
|
+
/** What `config push` says about a file that still carries the key. */
|
|
574
|
+
toml: string;
|
|
575
|
+
/** What a create/update handler says about a body that still sends it. */
|
|
576
|
+
request: string;
|
|
577
|
+
}
|
|
578
|
+
export declare const RETIRED_CONFIG_KEYS: Record<string, Record<string, RetiredConfigKey>>;
|
|
579
|
+
/** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
|
|
580
|
+
export declare function retiredConfigKey(prefix: string, key: string): RetiredConfigKey | null;
|
|
581
|
+
/**
|
|
582
|
+
* The capability grammar for server functions — #3182 phase 1, rewritten by
|
|
583
|
+
* #3279 (project `server-functions` phase 3).
|
|
584
|
+
*
|
|
585
|
+
* A function declares in its own TOML what it may CONFIGURE:
|
|
586
|
+
*
|
|
587
|
+
* capabilities = ["integration:stripe", "secret:STRIPE_KEY", "databases:delete"]
|
|
588
|
+
*
|
|
589
|
+
* ── Why the grammar is this small ────────────────────────────────────────
|
|
590
|
+
*
|
|
591
|
+
* The intent's decision (2026-09-09, "Authorization inside a function?"):
|
|
592
|
+
* function code acts as the system. The invocation gate is the authorization,
|
|
593
|
+
* and inside a function every platform call carries the app's own authority in
|
|
594
|
+
* every family. A capability is therefore never a statement about DATA — a
|
|
595
|
+
* model, a prompt, a channel, a member — because the function may reach all of
|
|
596
|
+
* it. It is declared only where it configures something:
|
|
597
|
+
*
|
|
598
|
+
* `integration:<key>` the egress allowlist — which upstream hosts the
|
|
599
|
+
* function's outbound calls may reach;
|
|
600
|
+
* `secret:<NAME>` credential least privilege — which secret VALUES may
|
|
601
|
+
* cross into the sandbox at all;
|
|
602
|
+
* the high-blast list {@link HIGH_BLAST_CAPABILITIES} — the operations
|
|
603
|
+
* whose blast radius the intent keeps opt-in.
|
|
604
|
+
*
|
|
605
|
+
* Every other string a function used to declare is RETIRED, and the grammar
|
|
606
|
+
* says so by name: an author who still writes `database:orders/Order:read`
|
|
607
|
+
* is told the model changed and what stays, not "unknown family", which would
|
|
608
|
+
* send them to check their spelling.
|
|
609
|
+
*
|
|
610
|
+
* ── Why the components have a charset ────────────────────────────────────
|
|
611
|
+
*
|
|
612
|
+
* A keyed grant's key must match `[A-Za-z0-9_-]+`, so neither `:` nor `/` can
|
|
613
|
+
* enter a component and the string is INJECTIVE — one string, one object. An
|
|
614
|
+
* integration or secret whose key carries a delimiter is simply unreachable
|
|
615
|
+
* from functions, with an error that says why (D3182-001's argument, kept).
|
|
616
|
+
*
|
|
617
|
+
* ── Why this module is pure ──────────────────────────────────────────────
|
|
618
|
+
*
|
|
619
|
+
* Capabilities are validated twice — by `config push`'s preflight, so an
|
|
620
|
+
* author sees the error against their own file, and by the server, which is
|
|
621
|
+
* authoritative because the raw admin API exists. Two enforcement points must
|
|
622
|
+
* not be two grammars, so the grammar lives here, in the dependency-free
|
|
623
|
+
* `src/config-surface/` tree the CLI vendors at build time
|
|
624
|
+
* (`cli/scripts/gen-config-surfaces.mjs`). The server imports this module; the
|
|
625
|
+
* CLI imports the generated copy; the drift guard fails if they differ.
|
|
626
|
+
*/
|
|
627
|
+
/** Every component of a grant. Injectivity depends on this. */
|
|
628
|
+
export declare const GRANT_COMPONENT_PATTERN: RegExp;
|
|
629
|
+
/** `ServerFunctionConfig.capabilities` is a StringSet with these bounds. */
|
|
630
|
+
export declare const MAX_CAPABILITY_ENTRIES = 100;
|
|
631
|
+
export declare const MAX_CAPABILITY_ENTRY_LENGTH = 200;
|
|
632
|
+
/**
|
|
633
|
+
* The two keyed families the intent keeps: one component under
|
|
634
|
+
* {@link GRANT_COMPONENT_PATTERN}, naming a single object. Every key format the
|
|
635
|
+
* platform issues fits: an integration key is `^[a-z0-9][a-z0-9-_]{2,}$` and a
|
|
636
|
+
* secret name is `^[A-Z][A-Z0-9_]{0,63}$`.
|
|
637
|
+
*/
|
|
638
|
+
export declare const KEYED_GRANT_FAMILIES: readonly ["integration", "secret"];
|
|
639
|
+
/**
|
|
640
|
+
* The high-blast-radius opt-ins — #3279, criterion 5 (CR3279-001, D3279-003).
|
|
641
|
+
*
|
|
642
|
+
* Since function code acts as the system, admission to a family is no longer
|
|
643
|
+
* an authority statement: everything the gateway lets through runs with the
|
|
644
|
+
* app's own authority. Most operations are fine that way — that is the whole
|
|
645
|
+
* decision. A short list is not, and the intent names its categories: delete a
|
|
646
|
+
* database, app or user; role changes; secret changes; resource provisioning.
|
|
647
|
+
* Those stay opt-in, so a function that can do them says so in a reviewable
|
|
648
|
+
* line of its TOML.
|
|
649
|
+
*
|
|
650
|
+
* The strings are EXACT and 1:1 with the operation id, so there is nothing to
|
|
651
|
+
* look up: `users.setRole` needs `users:setRole`. They parse with the verb as
|
|
652
|
+
* their KEY, because two exact capabilities in one family must not cover each
|
|
653
|
+
* other — `databases:create` is not permission to delete a database.
|
|
654
|
+
*
|
|
655
|
+
* The database ROLE mutations are here because they hand out persistent
|
|
656
|
+
* authority: a group grant assigns the manager role (D3279-003). App deletion
|
|
657
|
+
* and secret writes have no app-API route today; they are recorded, not gated,
|
|
658
|
+
* and the profile generator refuses to admit a future such route without a row
|
|
659
|
+
* here (`HIGH_BLAST_WATCH` in `scripts/lib/function-profile.mjs`).
|
|
660
|
+
*/
|
|
661
|
+
export declare const HIGH_BLAST_CAPABILITIES: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket"];
|
|
662
|
+
/** The exact strings, which since #3279 are exactly the high-blast list. */
|
|
663
|
+
export declare const EXACT_GRANT_STRINGS: readonly ["databases:create", "databases:delete", "databases:transferOwnership", "databases:addManager", "databases:revokePermission", "databases:grantGroupPermission", "databases:revokeGroupPermission", "users:remove", "users:setRole", "blobBuckets:createBucket", "blobBuckets:deleteBucket"];
|
|
664
|
+
export type GrantFamily = (typeof KEYED_GRANT_FAMILIES)[number] | "databases" | "users" | "blobBuckets";
|
|
665
|
+
/**
|
|
666
|
+
* The retired FAMILIES (#3279), each with the reason it is gone.
|
|
667
|
+
*
|
|
668
|
+
* The value is what the family used to authorize, phrased as what a function
|
|
669
|
+
* now reaches without it. A refusal names the authored string, says it is
|
|
670
|
+
* retired, gives this reason, tells the author to delete the entry, and lists
|
|
671
|
+
* what stays.
|
|
672
|
+
*/
|
|
673
|
+
export declare const RETIRED_GRANT_FAMILIES: Record<string, string>;
|
|
674
|
+
/** The retired EXACT strings (#3279), on the same terms. */
|
|
675
|
+
export declare const RETIRED_GRANT_STRINGS: Record<string, string>;
|
|
676
|
+
/**
|
|
677
|
+
* The retirement sentence for one authored string, or null when the string is
|
|
678
|
+
* not a retired one.
|
|
679
|
+
*
|
|
680
|
+
* Exported so the enforcement-time reader (`loadConfigGrants`) can tell a
|
|
681
|
+
* retired string on a pre-change row — tolerated, logged — from a string that
|
|
682
|
+
* was never a grant at all, which still authorizes nothing.
|
|
683
|
+
*/
|
|
684
|
+
export declare function retiredGrantRefusal(raw: string): string | null;
|
|
685
|
+
/**
|
|
686
|
+
* Any grant, in one flat shape.
|
|
687
|
+
*
|
|
688
|
+
* Flat rather than a discriminated union because this module is vendored into
|
|
689
|
+
* the CLI, which compiles with `strict: false`: a caller reads `family` and
|
|
690
|
+
* then `key`, and the fields another family would have used are simply absent.
|
|
691
|
+
*/
|
|
692
|
+
export interface FunctionGrant {
|
|
693
|
+
family: GrantFamily;
|
|
694
|
+
/**
|
|
695
|
+
* The single component of a keyed family — the integration key or the
|
|
696
|
+
* secret name — or the VERB of a high-blast string (`delete` for
|
|
697
|
+
* `databases:delete`), so that no two exact capabilities in one family read
|
|
698
|
+
* as the same grant.
|
|
699
|
+
*/
|
|
700
|
+
key: string;
|
|
701
|
+
/** The authored string, so an error or a log line can quote it. */
|
|
702
|
+
raw: string;
|
|
703
|
+
}
|
|
704
|
+
export interface ParsedFunctionGrant {
|
|
705
|
+
grant?: FunctionGrant;
|
|
706
|
+
error?: string;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* A channel name's ceiling, and the reason it has one.
|
|
710
|
+
*
|
|
711
|
+
* The name rides in a `ConnectionMapping` row's document-id slot as
|
|
712
|
+
* `ch:<appId>:<channel>` and in every grant token's claims, so an unbounded
|
|
713
|
+
* name would be an unbounded key and an unbounded credential. 200 characters
|
|
714
|
+
* is {@link MAX_CAPABILITY_ENTRY_LENGTH}, kept for continuity with the rows
|
|
715
|
+
* #3184 already wrote.
|
|
716
|
+
*/
|
|
717
|
+
export declare const MAX_CHANNEL_NAME_LENGTH = 200;
|
|
718
|
+
export interface ParsedChannelName {
|
|
719
|
+
/** The segment before the first `:`. Absent when the name is refused. */
|
|
720
|
+
namespace?: string;
|
|
721
|
+
error?: string;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* A channel NAME, and its namespace.
|
|
725
|
+
*
|
|
726
|
+
* The grammar is the grant component charset applied per segment: one or more
|
|
727
|
+
* `[A-Za-z0-9_-]+` segments joined by `:`. The `channel:<namespace>` GRANT
|
|
728
|
+
* that used to cover a name is retired (#3279); the name grammar stays because
|
|
729
|
+
* the authorize and publish routes answer 400 about a name outside it before
|
|
730
|
+
* anything else, and the connection worker keys membership by it.
|
|
731
|
+
*
|
|
732
|
+
* Refusals name the segment that failed, because "channel name is invalid" on
|
|
733
|
+
* a name like `orders:a::b` tells an author nothing they cannot already see.
|
|
734
|
+
*/
|
|
735
|
+
export declare function parseChannelName(value: unknown): ParsedChannelName;
|
|
736
|
+
/**
|
|
737
|
+
* One capability entry as a grant, or the reason it is not one.
|
|
738
|
+
*
|
|
739
|
+
* The single entry point the enforcement path and both preflights use: a
|
|
740
|
+
* caller holds one authored string and asks what it grants, without having to
|
|
741
|
+
* know which of the shapes to try. Every diagnosis is specific — a retired
|
|
742
|
+
* string gets the retirement and what stays; a near miss in a kept family gets
|
|
743
|
+
* the family's own strings; a keyed family gets its charset rule.
|
|
744
|
+
*/
|
|
745
|
+
export declare function parseFunctionGrant(entry: unknown): ParsedFunctionGrant;
|
|
746
|
+
/**
|
|
747
|
+
* One shape rather than a discriminated union: this module is vendored into
|
|
748
|
+
* the CLI, which compiles with `strict: false`, where narrowing on a boolean
|
|
749
|
+
* literal discriminant does not hold. Both callers read `ok` and then the
|
|
750
|
+
* field they want, and the unused half is empty rather than absent.
|
|
751
|
+
*/
|
|
752
|
+
export interface ParsedCapabilities {
|
|
753
|
+
ok: boolean;
|
|
754
|
+
/** Deduped, in authored order — what the config row stores. Empty when refused. */
|
|
755
|
+
capabilities: string[];
|
|
756
|
+
/** Every grant, in authored order. */
|
|
757
|
+
allGrants: FunctionGrant[];
|
|
758
|
+
/**
|
|
759
|
+
* The retired strings that were SKIPPED, in authored order — populated only
|
|
760
|
+
* under `tolerateRetired` (see {@link parseCapabilities}); a strict parse
|
|
761
|
+
* refuses them instead and leaves this empty.
|
|
762
|
+
*/
|
|
763
|
+
retired: string[];
|
|
764
|
+
/** Empty when accepted. */
|
|
765
|
+
errors: string[];
|
|
766
|
+
}
|
|
767
|
+
export interface ParseCapabilitiesOptions {
|
|
768
|
+
/**
|
|
769
|
+
* Skip retired strings instead of refusing them — #3279 edge 25.
|
|
770
|
+
*
|
|
771
|
+
* The PUSH path is strict: a file that still declares a retired grant is
|
|
772
|
+
* refused with the retirement, because a line that is accepted and ignored
|
|
773
|
+
* is a line the author believes means something. The ENFORCEMENT path is
|
|
774
|
+
* tolerant: a config version pushed before #3279 carries retired strings in
|
|
775
|
+
* a row that can never be re-pushed to fix (its envelope is immutable), and
|
|
776
|
+
* refusing it there would break every function pushed before the change.
|
|
777
|
+
* Such a row authorizes exactly what it keeps, and the skipped strings are
|
|
778
|
+
* reported in `retired` so the caller can log them.
|
|
779
|
+
*/
|
|
780
|
+
tolerateRetired?: boolean;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* A whole `capabilities` list: shape, bounds, grammar, duplicates.
|
|
784
|
+
*
|
|
785
|
+
* The model's own caps are checked HERE rather than left to the StringSet
|
|
786
|
+
* field, so an over-long entry is a named push error instead of a late model
|
|
787
|
+
* throw after the R2 object has already been written (principle 6).
|
|
788
|
+
*/
|
|
789
|
+
export declare function parseCapabilities(value: unknown, options?: ParseCapabilitiesOptions): ParsedCapabilities;
|
|
790
|
+
/**
|
|
791
|
+
* The config-tree objects an `integration:` grant may name.
|
|
792
|
+
*
|
|
793
|
+
* Only the one family whose target is CONFIG-TREE state. `secret:` is absent
|
|
794
|
+
* on purpose (D3183-002): its values are provisioned per environment, out of
|
|
795
|
+
* band, and are not part of the reviewed tree at all, so the ordinary order of
|
|
796
|
+
* work is to push the function and then provision the value. Refusing an
|
|
797
|
+
* unprovisioned name at push would break that; a missing value at CALL time is
|
|
798
|
+
* a structured runtime error instead. The high-blast strings name no object.
|
|
799
|
+
*
|
|
800
|
+
* `null` means "this enforcement point could not find out". The CLI reads the
|
|
801
|
+
* tree and, when it can, a live listing; when neither is available it defers
|
|
802
|
+
* rather than guessing, because a preflight that refused a valid tree for
|
|
803
|
+
* being offline would be worse than one that lets the server have the last
|
|
804
|
+
* word. The server never passes null — it can always read its own rows.
|
|
805
|
+
*/
|
|
806
|
+
export interface KnownGrantTargets {
|
|
807
|
+
/** Non-archived integration keys, or null when unknown. */
|
|
808
|
+
integrations: ReadonlySet<string> | null;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Grants naming an integration the app does not have.
|
|
812
|
+
*
|
|
813
|
+
* One message per offending grant, quoting the whole authored string AND the
|
|
814
|
+
* key on its own, so an operator reading the line knows both what to fix in
|
|
815
|
+
* the file and what to create in the app.
|
|
816
|
+
*
|
|
817
|
+
* The rule is here, beside the grammar, for the reason the whole module
|
|
818
|
+
* exists: `config push`'s preflight and the authoritative server check read
|
|
819
|
+
* different sources for the same facts — a `.toml` in the tree versus a row
|
|
820
|
+
* in DynamoDB — and it is the RULE that must not differ between them.
|
|
821
|
+
*/
|
|
822
|
+
export declare function validateKeyedGrantsAgainstTargets(grants: readonly FunctionGrant[], known: KnownGrantTargets): string[];
|
|
823
|
+
/**
|
|
824
|
+
* The query manifest's grammar, and the read rule it unlocks — #3187, project
|
|
825
|
+
* `server-functions` phase 5.
|
|
826
|
+
*
|
|
827
|
+
* A pushed config version may carry a MANIFEST: the queries and mutations the
|
|
828
|
+
* tree registered at module scope, collected by the CLI (`function-collect.ts`)
|
|
829
|
+
* by running the tree with `primitive-functions` aliased to a recording stub.
|
|
830
|
+
*
|
|
831
|
+
* ── What the manifest is for ─────────────────────────────────────────────
|
|
832
|
+
*
|
|
833
|
+
* Observability, and nothing else. `primitive functions get` and the admin
|
|
834
|
+
* get list what a version registered, so an operator can see it without
|
|
835
|
+
* reading the bundle (principle 8). The read rule it used to be decided from
|
|
836
|
+
* (#3187's `$caller` relaxation of `unscopedReads`) is retired by #3279:
|
|
837
|
+
* function code acts as the system, so there is no per-model grant for a
|
|
838
|
+
* binding to waive. The intent says so in as many words — "the models a
|
|
839
|
+
* function touches are collected at push as a reviewable manifest, not an
|
|
840
|
+
* authorization".
|
|
841
|
+
*
|
|
842
|
+
* It is HONEST-CODE evidence and the design doc says so: a hostile bundle can
|
|
843
|
+
* register whatever it likes, because the collector runs the tenant's own
|
|
844
|
+
* code. Nothing security-relevant at runtime reads it — parameter injection
|
|
845
|
+
* and cache verification happen in the platform-owned SDK inside the isolate,
|
|
846
|
+
* and the invocation gate remains the adversarial boundary.
|
|
847
|
+
*
|
|
848
|
+
* ── Why the grammar is here ──────────────────────────────────────────────
|
|
849
|
+
*
|
|
850
|
+
* Same reason as `function-grants.ts`: the CLI validates at push preflight so
|
|
851
|
+
* an author sees the error against their own tree, and the server validates
|
|
852
|
+
* authoritatively because the raw admin API exists. Two enforcement points,
|
|
853
|
+
* one rule, in the dependency-free tree the CLI vendors.
|
|
854
|
+
*/
|
|
855
|
+
/**
|
|
856
|
+
* The manifest encoding, versioned with the envelope that carries it.
|
|
857
|
+
*
|
|
858
|
+
* Version 2 (#3279 behavior 10) adds what a function TOUCHES beside what it
|
|
859
|
+
* registers: the deduplicated `models` its code names and the `families` of
|
|
860
|
+
* `ctx.api` and the ctx helpers it reaches, collected by a static scan of the
|
|
861
|
+
* built bundle, plus a `dynamicModels` marker for a model name the scan
|
|
862
|
+
* could not resolve — distinct from an empty list, which means "names none".
|
|
863
|
+
* A version-1 manifest still parses: it records registrations only.
|
|
864
|
+
*/
|
|
865
|
+
export declare const FUNCTION_MANIFEST_SCHEMA_VERSION = 2;
|
|
866
|
+
export declare const FUNCTION_MANIFEST_SCHEMA_VERSIONS: readonly [1, 2];
|
|
867
|
+
/** Bounds, so a manifest cannot be a way to store an unbounded blob. */
|
|
868
|
+
export declare const MAX_MANIFEST_QUERIES = 200;
|
|
869
|
+
export declare const MAX_MANIFEST_NAME_LENGTH = 120;
|
|
870
|
+
export declare const MAX_MANIFEST_MODELS = 200;
|
|
871
|
+
export declare const MAX_MANIFEST_FAMILIES = 40;
|
|
872
|
+
export interface ManifestParam {
|
|
873
|
+
type?: string;
|
|
874
|
+
/** `type: "array"` — the element type, when declared (#3281). */
|
|
875
|
+
items?: {
|
|
876
|
+
type: string;
|
|
877
|
+
};
|
|
878
|
+
caller?: boolean;
|
|
879
|
+
optional?: boolean;
|
|
880
|
+
default?: unknown;
|
|
881
|
+
}
|
|
882
|
+
/** The scalar parameter types a registration may declare, and an array's element types. */
|
|
883
|
+
export declare const QUERY_PARAM_SCALAR_TYPES: readonly ["string", "number", "boolean", "any"];
|
|
884
|
+
/**
|
|
885
|
+
* Coerce one value to a declared parameter type the way the SDK coerces a
|
|
886
|
+
* SUPPLIED value: a digit string becomes a number, `"true"`/`"false"` a
|
|
887
|
+
* boolean, an array's elements each by the `items` type. Applied to a
|
|
888
|
+
* declared `default` at registration (D3281-SO-005) so what `run` receives is
|
|
889
|
+
* what the declaration promises — here at push (the collect stub and this
|
|
890
|
+
* grammar) and in the SDK at the first load. ONE rule, spelled in the SDK's
|
|
891
|
+
* source a second time because that module is baked text; the tests hold the
|
|
892
|
+
* two together.
|
|
893
|
+
*/
|
|
894
|
+
export declare function coerceParamDefault(spec: {
|
|
895
|
+
type?: string;
|
|
896
|
+
items?: {
|
|
897
|
+
type?: string;
|
|
898
|
+
};
|
|
899
|
+
}, value: unknown): {
|
|
900
|
+
ok: true;
|
|
901
|
+
value: unknown;
|
|
902
|
+
} | {
|
|
903
|
+
ok: false;
|
|
904
|
+
reason: string;
|
|
905
|
+
};
|
|
906
|
+
export interface ManifestQuery {
|
|
907
|
+
name: string;
|
|
908
|
+
kind: "query" | "mutation";
|
|
909
|
+
models: string[];
|
|
910
|
+
params: Record<string, ManifestParam>;
|
|
911
|
+
cache: {
|
|
912
|
+
ttlMs: number;
|
|
913
|
+
} | null;
|
|
914
|
+
/** True when a `$caller` binding scopes this registration. */
|
|
915
|
+
callerScoped: boolean;
|
|
916
|
+
}
|
|
917
|
+
export interface FunctionManifest {
|
|
918
|
+
schemaVersion: number;
|
|
919
|
+
queries: ManifestQuery[];
|
|
920
|
+
/**
|
|
921
|
+
* Every model name the bundle names, deduplicated and sorted: registration
|
|
922
|
+
* declarations, literal `.model("…")` calls, and literal `modelName`/`model`
|
|
923
|
+
* arguments of the direct records and documents calls (#3279). Empty for a
|
|
924
|
+
* version-1 manifest, and for a function that names none.
|
|
925
|
+
*/
|
|
926
|
+
models: string[];
|
|
927
|
+
/** Every `ctx.api.<family>` and ctx-helper family the bundle reaches. */
|
|
928
|
+
families: string[];
|
|
929
|
+
/**
|
|
930
|
+
* The scan met a model name it could not resolve — a computed
|
|
931
|
+
* `modelName`, a `.model(variable)`. Says "and possibly more", which an
|
|
932
|
+
* empty `models` list does not.
|
|
933
|
+
*/
|
|
934
|
+
dynamicModels: boolean;
|
|
935
|
+
}
|
|
936
|
+
export interface ParsedManifest {
|
|
937
|
+
ok: boolean;
|
|
938
|
+
manifest: FunctionManifest | null;
|
|
939
|
+
errors: string[];
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Validate a manifest's grammar and normalize it.
|
|
943
|
+
*
|
|
944
|
+
* Deliberately strict about SHAPE and silent about meaning: whether the models
|
|
945
|
+
* exist, whether the queries are the ones the sandbox will really register,
|
|
946
|
+
* and whether the author meant any of it are questions this cannot answer.
|
|
947
|
+
*/
|
|
948
|
+
export declare function parseFunctionManifest(value: unknown): ParsedManifest;
|
|
949
|
+
/**
|
|
950
|
+
* The function MODE vocabulary, and the one place its two spellings meet —
|
|
951
|
+
* #3281, project `server-functions` phase 4.
|
|
952
|
+
*
|
|
953
|
+
* `mode = "request" | "task"` is what an author writes (the intent, "Mode
|
|
954
|
+
* vocabulary?", sponsor decision 2026-09-09): a request function runs inside
|
|
955
|
+
* the call and returns its result; a task function returns a run id and
|
|
956
|
+
* survives restarts. `durable = true | false` is the key the first releases
|
|
957
|
+
* taught, and it stays ACCEPTED as an alias through the transition — a tree
|
|
958
|
+
* pushed with it keeps pushing, and pulls back byte for byte — while `durable`
|
|
959
|
+
* stays the adjective for the property itself.
|
|
960
|
+
*
|
|
961
|
+
* ── Why one module ───────────────────────────────────────────────────────
|
|
962
|
+
*
|
|
963
|
+
* Two spellings for one fact is a place two readers can disagree. So the
|
|
964
|
+
* resolution is written once, here, in the dependency-free tree the CLI
|
|
965
|
+
* vendors (`cli/scripts/gen-config-surfaces.mjs`), and every door reads it:
|
|
966
|
+
* the CLI preflight and diff entity, the server's trigger derivation, the
|
|
967
|
+
* admin config-version route (payload `mode` beside payload `durable`), the
|
|
968
|
+
* invoke branch and the trigger fires. A file — or a payload — that carries
|
|
969
|
+
* both keys has to have them AGREE, or it is refused naming both; a silent
|
|
970
|
+
* winner would be the one thing worse than two spellings.
|
|
971
|
+
*
|
|
972
|
+
* The stored column is still `ServerFunctionConfig.durable` (no `models.yaml`
|
|
973
|
+
* change before phase 7's rename sweep), which is why `configMode` exists:
|
|
974
|
+
* reading the row is the other half of the same translation.
|
|
975
|
+
*/
|
|
976
|
+
export type FunctionMode = "request" | "task";
|
|
977
|
+
export declare const FUNCTION_MODES: readonly FunctionMode[];
|
|
978
|
+
/** What a declaration resolved to, or why it could not. */
|
|
979
|
+
export type DeclaredModeResolution = {
|
|
980
|
+
ok: true;
|
|
981
|
+
mode: FunctionMode;
|
|
982
|
+
/**
|
|
983
|
+
* Whether the declaration SAID anything — false when neither key was
|
|
984
|
+
* present and the default applied. The admin route's divergence check
|
|
985
|
+
* reads this: an omitted mode is no claim, so it cannot diverge.
|
|
986
|
+
*/
|
|
987
|
+
declared: boolean;
|
|
988
|
+
} | {
|
|
989
|
+
ok: false;
|
|
990
|
+
error: string;
|
|
991
|
+
};
|
|
992
|
+
/**
|
|
993
|
+
* Resolve `mode` and its alias `durable` to one mode.
|
|
994
|
+
*
|
|
995
|
+
* Absent both → `request`. `mode` must be exactly `"request"` or `"task"`;
|
|
996
|
+
* `durable` must be a boolean. Both present and disagreeing is refused naming
|
|
997
|
+
* both keys, so an author who half-migrated a file hears which line to fix.
|
|
998
|
+
*/
|
|
999
|
+
export declare function resolveDeclaredMode(input: {
|
|
1000
|
+
mode?: unknown;
|
|
1001
|
+
durable?: unknown;
|
|
1002
|
+
}): DeclaredModeResolution;
|
|
1003
|
+
/**
|
|
1004
|
+
* The mode a stored config-version row runs in.
|
|
1005
|
+
*
|
|
1006
|
+
* The column is `durable`; a row written before #3281 carries only that, and a
|
|
1007
|
+
* row written after it carries the same thing, so there is exactly one reading.
|
|
1008
|
+
*/
|
|
1009
|
+
export declare function configMode(row: {
|
|
1010
|
+
durable?: unknown;
|
|
1011
|
+
} | null | undefined): FunctionMode;
|
|
1012
|
+
/** Is this mode the durable one? The adjective, for the paths that branch on it. */
|
|
1013
|
+
export declare function isDurableMode(mode: FunctionMode): boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* The trigger blocks a function declares, derived from its authored TOML
|
|
1016
|
+
* (#3181, project `server-functions`, criterion 4).
|
|
1017
|
+
*
|
|
1018
|
+
* ── The declaration is derived, never supplied ────────────────────────────
|
|
1019
|
+
*
|
|
1020
|
+
* A config-version push carries the authored `functions/<key>.toml` bytes
|
|
1021
|
+
* inside its envelope, and `envelopeHash` covers them. If the push ALSO
|
|
1022
|
+
* carried a parsed `triggers` payload, the two could disagree: a direct API
|
|
1023
|
+
* caller could ship a public webhook trigger the authored file does not
|
|
1024
|
+
* declare, and two pushes with identical envelopes but different trigger
|
|
1025
|
+
* payloads would collapse to one version. So the server parses the envelope's
|
|
1026
|
+
* own bytes here (D3181-005) and there is no payload field to disagree with —
|
|
1027
|
+
* trigger behavior is bound to the version's identity by construction.
|
|
1028
|
+
*
|
|
1029
|
+
* ── Shape only ────────────────────────────────────────────────────────────
|
|
1030
|
+
*
|
|
1031
|
+
* This module decides what the file SAYS: the accepted key set, the required
|
|
1032
|
+
* values, and the rules that need nothing but the document (scheme `none`,
|
|
1033
|
+
* a nameless or duplicated cron entry, an entry count past the per-function
|
|
1034
|
+
* cap, a webhook or database block on a task version). Everything that needs the
|
|
1035
|
+
* app's state — whether a referenced secret exists, whether the
|
|
1036
|
+
* scheme-specific config is valid, whether the app is at its webhook or cron
|
|
1037
|
+
* cap, whether a standalone webhook holds the key — belongs to the push
|
|
1038
|
+
* boundary, which runs the SAME validators the standalone create runs
|
|
1039
|
+
* (D3181-006).
|
|
1040
|
+
*
|
|
1041
|
+
* ── One implementation, two readers (#3320) ───────────────────────────────
|
|
1042
|
+
*
|
|
1043
|
+
* The CLI checks the same rules against the author's own file before a request
|
|
1044
|
+
* is made. It used to do that from a hand-written restatement
|
|
1045
|
+
* (`cli/src/lib/function-triggers.ts`), kept in step only by a paired-fixture
|
|
1046
|
+
* test — so a rule added here with no fixture drifted silently. The rules
|
|
1047
|
+
* therefore live in `src/config-surface/`, which `cli/scripts/
|
|
1048
|
+
* gen-config-surfaces.mjs` vendors verbatim into the committed artifact
|
|
1049
|
+
* `cli/src/lib/generated-config-surfaces.ts`. There is one implementation, and
|
|
1050
|
+
* a change here that is not regenerated fails `--check` (a build failure)
|
|
1051
|
+
* rather than a fixture list that happens not to cover it.
|
|
1052
|
+
*
|
|
1053
|
+
* Reading the authored BYTES is the one thing that stayed server-side:
|
|
1054
|
+
* `deriveTriggerDeclaration` in `src/server-functions/trigger-declaration.ts`
|
|
1055
|
+
* parses them and calls `normalizeTriggerDeclaration` here. This directory
|
|
1056
|
+
* imports nothing but itself (asserted by `config-surface-drift-guard.test.ts`),
|
|
1057
|
+
* and the CLI has already parsed its own file by the time it asks.
|
|
1058
|
+
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* The resolved mode the declaration is checked against (#3281).
|
|
1061
|
+
*
|
|
1062
|
+
* The rule is per KIND, and permanent (the intent, "Sync functions write a run
|
|
1063
|
+
* row?": *Webhook and database-change triggers require request mode; HTTP and
|
|
1064
|
+
* cron allow both*). A webhook delivery and a database write are both waiting
|
|
1065
|
+
* inside a request for the function to answer; a cron fire is waiting for
|
|
1066
|
+
* nothing, so it starts a task run when the version is a task (#3334).
|
|
1067
|
+
*
|
|
1068
|
+
* The caller resolves `mode`/`durable` once, through `resolveDeclaredMode`,
|
|
1069
|
+
* and hands the answer here — this module never reads the alias itself.
|
|
1070
|
+
*/
|
|
1071
|
+
export interface TriggerModeOptions {
|
|
1072
|
+
mode?: FunctionMode;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Why a webhook cannot drive a task function, and what to do instead (#3334).
|
|
1076
|
+
*
|
|
1077
|
+
* The first clause is verbatim what it has always been, so sibling pins on the
|
|
1078
|
+
* request-mode prefix (#3281's) keep holding; everything after the dash is the
|
|
1079
|
+
* half that was missing — an author who meets this at the push door could not
|
|
1080
|
+
* previously tell whether it was a limitation or a design, nor what to write.
|
|
1081
|
+
*/
|
|
1082
|
+
export declare const WEBHOOK_ON_TASK_REFUSAL: string;
|
|
1083
|
+
/** A function's single webhook trigger, normalized. */
|
|
1084
|
+
export interface WebhookTriggerDeclaration {
|
|
1085
|
+
verificationScheme: string;
|
|
1086
|
+
signingSecret?: string;
|
|
1087
|
+
toleranceSeconds?: number;
|
|
1088
|
+
deduplicationEnabled?: boolean;
|
|
1089
|
+
deduplicationWindowMs?: number;
|
|
1090
|
+
maxBodyBytes?: number;
|
|
1091
|
+
secretGracePeriodMs?: number;
|
|
1092
|
+
/** `[function.triggers.webhook.verification]` — the row's `config`. */
|
|
1093
|
+
verification?: Record<string, unknown>;
|
|
1094
|
+
}
|
|
1095
|
+
/** One `[[function.triggers.cron]]` entry, normalized. */
|
|
1096
|
+
export interface CronTriggerDeclaration {
|
|
1097
|
+
name: string;
|
|
1098
|
+
cron: string;
|
|
1099
|
+
timezone?: string;
|
|
1100
|
+
overlapPolicy?: string;
|
|
1101
|
+
rootInput?: unknown;
|
|
1102
|
+
}
|
|
1103
|
+
/** One `[[function.triggers.database]]` entry, normalized (#3184). */
|
|
1104
|
+
export interface DatabaseTriggerDeclaration {
|
|
1105
|
+
/** The database type key whose writes fire this function. */
|
|
1106
|
+
type: string;
|
|
1107
|
+
}
|
|
1108
|
+
export interface TriggerDeclaration {
|
|
1109
|
+
webhook: WebhookTriggerDeclaration | null;
|
|
1110
|
+
cron: CronTriggerDeclaration[];
|
|
1111
|
+
databases: DatabaseTriggerDeclaration[];
|
|
1112
|
+
}
|
|
1113
|
+
export declare const EMPTY_TRIGGER_DECLARATION: TriggerDeclaration;
|
|
1114
|
+
/**
|
|
1115
|
+
* The most cron entries one function may declare.
|
|
1116
|
+
*
|
|
1117
|
+
* The per-app cap (50) is a resource ceiling; this is a per-OBJECT one, so a
|
|
1118
|
+
* single function cannot take most of an app's budget by itself. Ten is the
|
|
1119
|
+
* same order as the schedules a real function needs and leaves the app's
|
|
1120
|
+
* remaining slots for the other 40+ objects the cap is sized for.
|
|
1121
|
+
*/
|
|
1122
|
+
export declare const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
|
|
1123
|
+
/**
|
|
1124
|
+
* The most database types one function may watch (#3184, D-07).
|
|
1125
|
+
*
|
|
1126
|
+
* Per-OBJECT, like the cron cap above: a function watching more than a handful
|
|
1127
|
+
* of types is describing a fan-in the platform cannot bound per write, and
|
|
1128
|
+
* every extra type is another discovery read on somebody's write path.
|
|
1129
|
+
*/
|
|
1130
|
+
export declare const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
|
|
1131
|
+
export declare class TriggerDeclarationError extends Error {
|
|
1132
|
+
}
|
|
1133
|
+
/** Is anything at all declared? Used to skip work on the common case. */
|
|
1134
|
+
export declare function hasDeclaredTriggers(declaration: TriggerDeclaration): boolean;
|
|
1135
|
+
/**
|
|
1136
|
+
* Normalize the `triggers` table of an already-parsed `[function]` table.
|
|
1137
|
+
* Throws `TriggerDeclarationError` naming the rule that was broken.
|
|
1138
|
+
*
|
|
1139
|
+
* Split out from the parse (`deriveTriggerDeclaration`, which owns the bytes)
|
|
1140
|
+
* so the CLI's preflight can check the document it has already read, and so the
|
|
1141
|
+
* push boundary can normalize a declaration it read from a stored row without
|
|
1142
|
+
* re-parsing bytes.
|
|
1143
|
+
*/
|
|
1144
|
+
export declare function normalizeTriggerDeclaration(functionTable: any, options?: TriggerModeOptions): TriggerDeclaration;
|
|
1145
|
+
/** The stored JSON for `ServerFunctionConfig.triggers`, or null when empty. */
|
|
1146
|
+
export declare function serializeTriggerDeclaration(declaration: TriggerDeclaration): string | null;
|
|
1147
|
+
/** Read a stored `ServerFunctionConfig.triggers` value back. */
|
|
1148
|
+
export declare function parseStoredTriggerDeclaration(stored: unknown): TriggerDeclaration;
|
|
1149
|
+
/** The `CronTrigger.triggerKey` an entry owns. */
|
|
1150
|
+
export declare function cronTriggerKeyFor(functionKey: string, name: string): string;
|
|
1151
|
+
/** The entry name a `<functionKey>:<name>` trigger key carries. */
|
|
1152
|
+
export declare function cronTriggerNameFrom(functionKey: string, triggerKey: string): string;
|
|
1153
|
+
/**
|
|
1154
|
+
* The `{{secrets.KEY}}` reference SHAPE, decided from the value alone.
|
|
1155
|
+
*
|
|
1156
|
+
* Split out of `src/services/secret-templates.ts` by #3320 so the one rule that
|
|
1157
|
+
* says whether a stored value IS a whole secret reference has one
|
|
1158
|
+
* implementation on both sides of a `config push`. The CLI preflight refuses a
|
|
1159
|
+
* webhook trigger whose `signingSecret` is a literal before anything is applied,
|
|
1160
|
+
* and the server refuses the same value at the write boundary, because both run
|
|
1161
|
+
* this code — the CLI through the artifact `cli/scripts/gen-config-surfaces.mjs`
|
|
1162
|
+
* renders, the server by importing this module. A shape-only restatement in the
|
|
1163
|
+
* CLI would have been subtly different: a reference spoiled by an invisible
|
|
1164
|
+
* character (#2297) survives `String.trim()` and would have passed a preflight
|
|
1165
|
+
* the server then failed.
|
|
1166
|
+
*
|
|
1167
|
+
* Pure by construction, which is what lets it live here: no secret store is
|
|
1168
|
+
* consulted, because whether a value is a REFERENCE never depends on which keys
|
|
1169
|
+
* exist. Whether the referenced key exists is the server's question, and stays
|
|
1170
|
+
* in `secret-templates.ts` beside the rest of resolution.
|
|
1171
|
+
*
|
|
1172
|
+
* `secret-templates.ts` re-exports everything here, so every existing caller
|
|
1173
|
+
* keeps its import and the two can never be different functions.
|
|
1174
|
+
*/
|
|
1175
|
+
export declare const SECRETS_TEMPLATE_RE: RegExp;
|
|
1176
|
+
/** True when the value carries at least one `{{secrets.KEY}}` reference. */
|
|
1177
|
+
export declare function isSecretTemplate(value: string | null | undefined): boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* The value with every well-formed `{{secrets.KEY}}` reference removed — the
|
|
1180
|
+
* text that was NOT part of a reference the grammar accepts.
|
|
1181
|
+
*
|
|
1182
|
+
* This is the string the leftover-syntax rule below has to judge, and it is
|
|
1183
|
+
* always derived from the ORIGINAL stored value, never from a substituted
|
|
1184
|
+
* result. Resolution is a single `String.replace` pass that never re-scans
|
|
1185
|
+
* replacement text (`resolveMultiNamespaceTemplate`), so a brace or a
|
|
1186
|
+
* `secrets.` token coming out of a SECRET'S VALUE is inert — it is credential
|
|
1187
|
+
* material the operator stored, not config text, and testing the substituted
|
|
1188
|
+
* output would reject it (a Stripe key suffix stored as `}v2{` in an otherwise
|
|
1189
|
+
* valid `sk_live_{{secrets.SUFFIX}}` value).
|
|
1190
|
+
*/
|
|
1191
|
+
export declare function withoutSecretReferences(value: string): string;
|
|
1192
|
+
/**
|
|
1193
|
+
* True when the value holds a well-formed `{{secrets.KEY}}` reference and the
|
|
1194
|
+
* text beside it is not credential material — a reference SPOILED by an
|
|
1195
|
+
* invisible character, rather than a legacy literal that happens to contain one
|
|
1196
|
+
* (#2297, consolidating #2386).
|
|
1197
|
+
*
|
|
1198
|
+
* Such a value is a reference spoiled by an authoring mistake — pasted out of
|
|
1199
|
+
* an editor or a document that carried a zero-width character along with it —
|
|
1200
|
+
* and it must fail closed rather than resolve. Before this rule a value spelled
|
|
1201
|
+
* `<U+200B>{{secrets.KEY}}` was not a whole reference (neither `\s` nor
|
|
1202
|
+
* `String.trim()` matches U+200B), carried no leftover reference SYNTAX once
|
|
1203
|
+
* the template was removed, and so classified as a working legacy literal that
|
|
1204
|
+
* resolved to U+200B followed by the secret: an HMAC key silently one byte
|
|
1205
|
+
* wrong, and a read surface pointing the operator at the wrong remediation.
|
|
1206
|
+
*
|
|
1207
|
+
* The rule judges the REMAINDER — the value with its well-formed references
|
|
1208
|
+
* taken out — against an allowlist, which is what makes the class closed:
|
|
1209
|
+
*
|
|
1210
|
+
* - Remainder empty, or ordinary whitespace only: the value is the reference it
|
|
1211
|
+
* plainly is, padding and all, and keeps resolving (#2191).
|
|
1212
|
+
* - Remainder carries at least one credential character: a genuine mixed
|
|
1213
|
+
* literal-plus-reference value (`sk_live_{{secrets.SUFFIX}}`), which predates
|
|
1214
|
+
* reference-only and keeps resolving as shipped (#2332) — including when the
|
|
1215
|
+
* operator's own bytes contain an invisible character, because that is
|
|
1216
|
+
* credential material rather than a spoiled pointer.
|
|
1217
|
+
* - Anything else: text that is present but that we cannot recognize as
|
|
1218
|
+
* credential material. Fail closed.
|
|
1219
|
+
*
|
|
1220
|
+
* Failing closed rather than stripping the character is the deliberate choice
|
|
1221
|
+
* (sponsor decision on #2297): stripping hides the mistake, where a
|
|
1222
|
+
* `malformed-reference` names it at the moment the value is written.
|
|
1223
|
+
*
|
|
1224
|
+
* A value with NO well-formed reference is not this rule's business, and needs
|
|
1225
|
+
* no separate handling: a pure literal is credential material the platform has
|
|
1226
|
+
* no standing to judge (`whsec_<U+200B>raw`), and a MISTYPED reference —
|
|
1227
|
+
* including one spoiled inside the braces, `{{secrets.<U+200B>KEY}}` — leaves
|
|
1228
|
+
* its syntax in the remainder and is already caught by
|
|
1229
|
+
* `carriesMalformedReferenceSyntax` in `secret-templates.ts`.
|
|
1230
|
+
*
|
|
1231
|
+
* Scoped to the reference-only credential boundary, not to
|
|
1232
|
+
* `resolveSecretTemplate`: an integration proxy header is a template by design
|
|
1233
|
+
* (`Authorization: Bearer {{secrets.TOKEN}}`), so it keeps resolving exactly
|
|
1234
|
+
* what the operator wrote.
|
|
1235
|
+
*/
|
|
1236
|
+
export declare function isSpoiledSecretReference(value: string | null | undefined): boolean;
|
|
1237
|
+
/**
|
|
1238
|
+
* Matches a value that is EXACTLY one `{{secrets.KEY}}` reference and nothing
|
|
1239
|
+
* else. Anchored, and deliberately not global — `SECRETS_TEMPLATE_RE` carries
|
|
1240
|
+
* `lastIndex` state between calls.
|
|
1241
|
+
*/
|
|
1242
|
+
export declare const WHOLE_SECRET_REFERENCE_RE: RegExp;
|
|
1243
|
+
/**
|
|
1244
|
+
* True when the whole (trimmed) value is a single `{{secrets.KEY}}` reference.
|
|
1245
|
+
*
|
|
1246
|
+
* The stricter sibling of `isSecretTemplate`, for the callers that use "is a
|
|
1247
|
+
* reference" to mean "carries no secret material of its own". `isSecretTemplate`
|
|
1248
|
+
* is a *contains* test, so `"sk_live_abcd{{secrets.SUFFIX}}"` satisfies it —
|
|
1249
|
+
* which is fine where a value is a template to be resolved (an
|
|
1250
|
+
* `Authorization: Bearer {{secrets.TOKEN}}` header is exactly that), and wrong
|
|
1251
|
+
* where the value is a credential that must live entirely in the encrypted
|
|
1252
|
+
* secret store. Used by the webhook `config` credential rule and by the
|
|
1253
|
+
* redaction that backs it: a mixed value would otherwise pass the write rule
|
|
1254
|
+
* AND skip redaction, storing and echoing most of a working credential in
|
|
1255
|
+
* cleartext.
|
|
1256
|
+
*
|
|
1257
|
+
* Trimmed, so `" {{secrets.KEY}} "` is accepted as the reference it plainly is;
|
|
1258
|
+
* two references, or a reference with any literal text beside it, are not.
|
|
1259
|
+
*
|
|
1260
|
+
* Invisible text beside the reference disqualifies the value before the trim
|
|
1261
|
+
* (#2297): U+FEFF is stripped by `String.trim()` and matched by `\s`, so
|
|
1262
|
+
* without the check a byte-order mark beside the braces would be silently
|
|
1263
|
+
* accepted while its zero-width siblings were not. Rejecting here is what makes
|
|
1264
|
+
* the write gates built on this predicate (`validateWholeSecretReference`, the
|
|
1265
|
+
* webhook `config` credential rule) refuse such a value at configuration time
|
|
1266
|
+
* rather than storing a row that can only fail at use time.
|
|
1267
|
+
*/
|
|
1268
|
+
export declare function isWholeSecretReference(value: string | null | undefined): boolean;
|
|
1269
|
+
/**
|
|
1270
|
+
* The `signingSecret` rule a webhook's verification scheme carries, decided
|
|
1271
|
+
* from the declaration alone (#3320).
|
|
1272
|
+
*
|
|
1273
|
+
* `signingSecret` is reference-only (#2254): a whole `{{secrets.KEY}}`
|
|
1274
|
+
* reference naming an app secret, and nothing else. Which schemes need one,
|
|
1275
|
+
* whether one was supplied, and whether the supplied value is a reference are
|
|
1276
|
+
* all answerable from the file — so they belong in the `config push` preflight,
|
|
1277
|
+
* which aborts before anything is applied, rather than in the apply loop where
|
|
1278
|
+
* a refusal lands after sibling entities are already written.
|
|
1279
|
+
*
|
|
1280
|
+
* That is the whole reason this module exists here rather than beside the rest
|
|
1281
|
+
* of the webhook write pipeline: `src/config-surface/` is vendored verbatim
|
|
1282
|
+
* into `cli/src/lib/generated-config-surfaces.ts`, so the CLI runs the server's
|
|
1283
|
+
* rule instead of a restatement of it, and a change that is not regenerated
|
|
1284
|
+
* fails `gen-config-surfaces.mjs --check`.
|
|
1285
|
+
*
|
|
1286
|
+
* ── What is deliberately NOT here ─────────────────────────────────────────
|
|
1287
|
+
*
|
|
1288
|
+
* Everything that needs the app's state: whether the referenced secret exists,
|
|
1289
|
+
* whether the scheme's `config` is valid under this environment's JWKS policy,
|
|
1290
|
+
* the per-app row cap, a key a standalone webhook already holds. Those stay in
|
|
1291
|
+
* `src/app-api/services/webhook-settings-validation.ts`, which has `Env`. A
|
|
1292
|
+
* local copy of them would be a preflight that gives a false all-clear — and
|
|
1293
|
+
* the residue is then app-state-dependent by construction rather than by
|
|
1294
|
+
* accident of where a rule happened to live.
|
|
1295
|
+
*/
|
|
1296
|
+
/**
|
|
1297
|
+
* Schemes that don't carry an HMAC `signingSecret`. These either store no key
|
|
1298
|
+
* material at all (`none`) or store it under `AppWebhook.config` instead:
|
|
1299
|
+
* `discord` puts the application public key in `config.publicKey`, `jwt` puts
|
|
1300
|
+
* a JWKS in `config.jwt.jwks`, and `plaid` fetches keys from Plaid using the
|
|
1301
|
+
* API credentials referenced in `config.plaid`.
|
|
1302
|
+
*/
|
|
1303
|
+
export declare const SCHEMES_WITHOUT_SIGNING_SECRET: readonly string[];
|
|
1304
|
+
export declare function requiresSigningSecret(scheme: unknown): boolean;
|
|
1305
|
+
/** The coded refusals, so a client can branch without matching prose. */
|
|
1306
|
+
export declare const SIGNING_SECRET_MUST_BE_SECRET_REF = "SIGNING_SECRET_MUST_BE_SECRET_REF";
|
|
1307
|
+
export declare const SIGNING_SECRET_NOT_SUPPORTED_FOR_SCHEME = "SIGNING_SECRET_NOT_SUPPORTED_FOR_SCHEME";
|
|
1308
|
+
/**
|
|
1309
|
+
* A refusal from this rule. `plain` marks the ones the admin webhook create
|
|
1310
|
+
* answered as a bare text body rather than coded JSON — an observable
|
|
1311
|
+
* distinction, so it travels with the error rather than being flattened.
|
|
1312
|
+
*/
|
|
1313
|
+
export interface SigningSecretRuleError {
|
|
1314
|
+
message: string;
|
|
1315
|
+
code?: string;
|
|
1316
|
+
plain?: boolean;
|
|
1317
|
+
}
|
|
1318
|
+
/** The reference-only message, shared by every field that carries one. */
|
|
1319
|
+
export declare function wholeSecretReferenceMessage(label: string): string;
|
|
1320
|
+
/**
|
|
1321
|
+
* Is this value a whole `{{secrets.KEY}}` reference? Returns the refusal a
|
|
1322
|
+
* caller renders, or null.
|
|
1323
|
+
*
|
|
1324
|
+
* `isWholeSecretReference`, never `isSecretTemplate`: a *contains* test admits
|
|
1325
|
+
* `sk_live_abcd{{secrets.SUFFIX}}`, which stores most of a working credential
|
|
1326
|
+
* in cleartext.
|
|
1327
|
+
*/
|
|
1328
|
+
export declare function validateWholeSecretReference(label: string, value: unknown, code: string): SigningSecretRuleError | null;
|
|
1329
|
+
/**
|
|
1330
|
+
* The whole file-decidable `signingSecret` rule, in the order the standalone
|
|
1331
|
+
* webhook create ran it: a required secret must be present, a present one must
|
|
1332
|
+
* be a whole reference, and a scheme that carries no secret must not be given
|
|
1333
|
+
* one.
|
|
1334
|
+
*
|
|
1335
|
+
* Returns null when the declaration is acceptable — which does NOT mean the
|
|
1336
|
+
* write will succeed: the referenced key still has to exist, and that is the
|
|
1337
|
+
* server's question.
|
|
1338
|
+
*/
|
|
1339
|
+
export declare function validateSigningSecretDeclaration(input: {
|
|
1340
|
+
verificationScheme: string;
|
|
1341
|
+
signingSecret?: unknown;
|
|
1342
|
+
}): SigningSecretRuleError | null;
|
|
1343
|
+
export declare const WORKFLOW_SURFACE: ConfigObjectSurface;
|
|
1344
|
+
export declare const PROMPT_SURFACE: ConfigObjectSurface;
|
|
1345
|
+
export declare const INTEGRATION_SURFACE: ConfigObjectSurface;
|
|
1346
|
+
export declare const WEBHOOK_SURFACE: ConfigObjectSurface;
|
|
1347
|
+
export declare const CRON_TRIGGER_SURFACE: ConfigObjectSurface;
|
|
1348
|
+
export declare const BLOB_BUCKET_SURFACE: ConfigObjectSurface;
|
|
1349
|
+
/**
|
|
1350
|
+
* The `email-template` configuration object's definition (issue #2644, phase 2).
|
|
1351
|
+
*
|
|
1352
|
+
* `email-templates/<emailType>.toml` carries a single `[template]` table. The
|
|
1353
|
+
* object is an OVERRIDE of a built-in template: the detail response is
|
|
1354
|
+
* `{ emailType, hasOverride, override: {...}, default: {...} }`, and only the
|
|
1355
|
+
* `override` half is a field surface — the `default` half is what the platform
|
|
1356
|
+
* ships. Both are declared as response-only keys so `config pull`'s
|
|
1357
|
+
* unrecognized-key warning reports genuinely unknown fields rather than the
|
|
1358
|
+
* envelope.
|
|
1359
|
+
*
|
|
1360
|
+
* There is one write endpoint (`PUT …/email-templates/{emailType}`, an upsert),
|
|
1361
|
+
* so every field is writable on both modes.
|
|
1362
|
+
*/
|
|
1363
|
+
/**
|
|
1364
|
+
* Email types RETIRED by #2884, kept named rather than simply deleted.
|
|
1365
|
+
*
|
|
1366
|
+
* Email sign-in sends ONE email from the `email-sign-in` template, so
|
|
1367
|
+
* `magic-link` and `otp` are no longer rendered by any code path — which is
|
|
1368
|
+
* what makes deleting the link block from an `email-sign-in` override an
|
|
1369
|
+
* actual guarantee rather than a hope about which endpoint ran.
|
|
1370
|
+
*
|
|
1371
|
+
* A stored override for a retired type is NOT deleted: it stays listed and
|
|
1372
|
+
* readable (labelled retired, with the guidance below) so an app can find its
|
|
1373
|
+
* customization and migrate it, and deleting it still works. Everything that
|
|
1374
|
+
* would author one — the admin write/preview/test endpoints, `config create`,
|
|
1375
|
+
* a `config push --only` selector — refuses by name instead. Silent
|
|
1376
|
+
* non-rendering is the outcome all of that exists to avoid.
|
|
1377
|
+
*
|
|
1378
|
+
* It lives in the config surface, not beside the default templates, because
|
|
1379
|
+
* the CLI vendors this directory and needs the same sentence.
|
|
1380
|
+
*/
|
|
1381
|
+
export declare const RETIRED_EMAIL_TYPES: readonly ["magic-link", "otp"];
|
|
1382
|
+
export type RetiredEmailType = (typeof RETIRED_EMAIL_TYPES)[number];
|
|
1383
|
+
/** True when `emailType` is one of the retired sign-in types. */
|
|
1384
|
+
export declare function isRetiredEmailType(emailType: string): emailType is RetiredEmailType;
|
|
1385
|
+
/** What every surface says about a retired type, in one sentence. */
|
|
1386
|
+
export declare function retiredEmailTypeGuidance(emailType: string): string;
|
|
1387
|
+
export declare const EMAIL_TEMPLATE_SURFACE: ConfigObjectSurface;
|
|
1388
|
+
export declare const DATABASE_TYPE_SURFACE: ConfigObjectSurface;
|
|
1389
|
+
export declare const RULE_SET_SURFACE: ConfigObjectSurface;
|
|
1390
|
+
export declare const GROUP_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
|
|
1391
|
+
export declare const COLLECTION_TYPE_CONFIG_SURFACE: ConfigObjectSurface;
|
|
1392
|
+
export declare const METADATA_CATEGORY_CONFIG_SURFACE: ConfigObjectSurface;
|
|
1393
|
+
/**
|
|
1394
|
+
* The `transform` configuration object's definition (issue #2644, phase 3).
|
|
1395
|
+
*
|
|
1396
|
+
* Transforms are the one synced type with NO TOML field table: a transform is
|
|
1397
|
+
* `transforms/<name>.rhai`, a Rhai source file, and its whole authored surface
|
|
1398
|
+
* is the script body. `config pull` writes the active `ScriptConfig`'s body and
|
|
1399
|
+
* `config push` sends it back; there is no key/value table to define, and the
|
|
1400
|
+
* `Script` / `ScriptConfig` scalars around it (name, description, inputSchema,
|
|
1401
|
+
* limits, status) are not authorable through the sync slot today.
|
|
1402
|
+
*
|
|
1403
|
+
* The entry exists so that is a DECISION rather than an absence. Criterion 3's
|
|
1404
|
+
* registry guard reads `SYNC_RESOURCE_TYPES` and requires a surface per label;
|
|
1405
|
+
* without this module `transform` would have to sit in an exemption list, which
|
|
1406
|
+
* is precisely the "absent from a hand-written list" failure mode this epic
|
|
1407
|
+
* exists to end.
|
|
1408
|
+
*/
|
|
1409
|
+
export declare const TRANSFORM_SURFACE: ConfigObjectSurface;
|
|
1410
|
+
export declare const SERVER_FUNCTION_SURFACE: ConfigObjectSurface;
|
|
1411
|
+
export declare const TEST_CASE_SURFACE: ConfigObjectSurface;
|
|
1412
|
+
export declare const APP_SETTINGS_SURFACE: ConfigObjectSurface;
|
|
1413
|
+
/**
|
|
1414
|
+
* The configuration-object registry (issue #2644).
|
|
1415
|
+
*
|
|
1416
|
+
* `CONFIG_SURFACES` holds one entry per synced configuration object type. The
|
|
1417
|
+
* registry — not a per-type test — is what makes coverage follow from existing:
|
|
1418
|
+
* `cli/tests/unit/config-surface-drift-guard.test.ts` reads the CLI's
|
|
1419
|
+
* `SYNC_RESOURCE_TYPES` labels and fails when a label has no surface here.
|
|
1420
|
+
*
|
|
1421
|
+
* `CONFIG_SURFACES` is the write authority. `SYNC_RESOURCE_TYPES` keeps its
|
|
1422
|
+
* documented role — directory/state/prune/diff layout metadata, explicitly "not
|
|
1423
|
+
* a write framework" — and gains no write-surface fields; the two are
|
|
1424
|
+
* cross-checked, not merged.
|
|
1425
|
+
*/
|
|
1426
|
+
/**
|
|
1427
|
+
* Every configuration object whose field surface is defined here.
|
|
1428
|
+
*
|
|
1429
|
+
* One entry per `SYNC_RESOURCE_TYPES` label, plus the two surfaces that
|
|
1430
|
+
* round-trip without being a per-entity file: `app-settings` (`app.toml`) and
|
|
1431
|
+
* `test-case` (`<key>.tests/`). Nothing that syncs sits outside the registry —
|
|
1432
|
+
* `PENDING_MIGRATION`, the migration's temporary exemption list, is gone as of
|
|
1433
|
+
* phase 3, so a new synced type has nowhere to be parked and fails the registry
|
|
1434
|
+
* guard until it is defined (#2644 criterion 3).
|
|
1435
|
+
*/
|
|
1436
|
+
export declare const CONFIG_SURFACES: readonly ConfigObjectSurface[];
|
|
1437
|
+
/** The surface for a `SyncResourceType.label`, or undefined when unmigrated. */
|
|
1438
|
+
export declare function getConfigSurface(label: string): ConfigObjectSurface | undefined;
|
|
1439
|
+
/** One table of one surface, addressed by its TOML path. */
|
|
1440
|
+
export declare function getConfigTable(label: string, tomlPath: readonly string[]): ConfigTable | undefined;
|
|
1441
|
+
/**
|
|
1442
|
+
* Every field of every `models.yaml` model a configuration-object definition
|
|
1443
|
+
* names, in declaration order — the coverage guard's anchor (#2644 criterion 2).
|
|
1444
|
+
*/
|
|
1445
|
+
export declare const GENERATED_CONFIG_MODEL_FIELDS: Readonly<Record<string, readonly string[]>>;
|