primitive-admin 1.2.0-alpha.8 → 1.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +258 -186
- package/assets/skill/skills/primitive-platform/SKILL.md +103 -29
- package/dist/bin/primitive.js +15 -89
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +80 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.d.ts +129 -0
- package/dist/src/commands/agent-sessions.js +532 -20
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +207 -155
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.d.ts +1 -1
- package/dist/src/commands/apps-children.js +56 -145
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps-transitions.d.ts +39 -0
- package/dist/src/commands/apps-transitions.js +198 -0
- package/dist/src/commands/apps-transitions.js.map +1 -0
- package/dist/src/commands/apps.d.ts +17 -0
- package/dist/src/commands/apps.js +108 -3
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.js +2 -0
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +138 -44
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -0
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +318 -256
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/comparisons.js +2 -0
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +2 -2
- package/dist/src/commands/config.js +59 -33
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/database-types.js +13 -313
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +15 -0
- package/dist/src/commands/db3-types.js +159 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +24 -0
- package/dist/src/commands/db3.js +1444 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +110 -10
- package/dist/src/commands/documents.js +1012 -748
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +74 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +8 -4
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +376 -30
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +168 -50
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +7 -5
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +346 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +129 -38
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -53
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.js +9 -6
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +19 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +4 -2
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +41 -0
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -52
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rate-counters.d.ts +19 -0
- package/dist/src/commands/rate-counters.js +104 -0
- package/dist/src/commands/rate-counters.js.map +1 -0
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +2 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.js +47 -3
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/settings.d.ts +12 -9
- package/dist/src/commands/settings.js +31 -79
- package/dist/src/commands/settings.js.map +1 -1
- package/dist/src/commands/skill.js +2 -0
- package/dist/src/commands/skill.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +519 -554
- package/dist/src/commands/sync.js +3010 -4909
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +5 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transitions.d.ts +54 -0
- package/dist/src/commands/transitions.js +418 -0
- package/dist/src/commands/transitions.js.map +1 -0
- package/dist/src/commands/usage.d.ts +18 -0
- package/dist/src/commands/usage.js +343 -0
- package/dist/src/commands/usage.js.map +1 -0
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +911 -18
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -0
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +1830 -429
- package/dist/src/lib/api-client.js +1025 -546
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
- package/dist/src/lib/app-settings-descriptor.js +6 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +34 -1
- package/dist/src/lib/auth-flow.js +429 -13
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +8 -14
- package/dist/src/lib/block-selector.js +8 -19
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +3 -47
- package/dist/src/lib/child-apps-local.js +11 -73
- package/dist/src/lib/child-apps-local.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -0
- package/dist/src/lib/cli-manifest.js +10 -1
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/cli-version.d.ts +14 -0
- package/dist/src/lib/cli-version.js +38 -0
- package/dist/src/lib/cli-version.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
- package/dist/src/lib/collection-export.d.ts +76 -15
- package/dist/src/lib/collection-export.js +116 -23
- package/dist/src/lib/collection-export.js.map +1 -1
- package/dist/src/lib/collection-principal.d.ts +22 -0
- package/dist/src/lib/collection-principal.js +35 -0
- package/dist/src/lib/collection-principal.js.map +1 -0
- package/dist/src/lib/command-groups.d.ts +30 -0
- package/dist/src/lib/command-groups.js +109 -0
- package/dist/src/lib/command-groups.js.map +1 -0
- package/dist/src/lib/command-status.d.ts +147 -0
- package/dist/src/lib/command-status.js +266 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +9 -22
- package/dist/src/lib/config-object-descriptor.js +107 -276
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +3 -7
- package/dist/src/lib/config-surface.js +9 -13
- package/dist/src/lib/config-surface.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/credentials-home.d.ts +7 -0
- package/dist/src/lib/credentials-home.js +45 -10
- package/dist/src/lib/credentials-home.js.map +1 -1
- package/dist/src/lib/credentials-lock.d.ts +14 -6
- package/dist/src/lib/credentials-lock.js +90 -10
- package/dist/src/lib/credentials-lock.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +123 -70
- package/dist/src/lib/credentials-store.js +358 -113
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +38 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +29 -7
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +106 -0
- package/dist/src/lib/db-type-records.js +224 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +287 -0
- package/dist/src/lib/db3-export.js +647 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +116 -0
- package/dist/src/lib/db3-index-output.js +223 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +134 -0
- package/dist/src/lib/db3-type-models.js +452 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/document-ingest-artifact.d.ts +13 -0
- package/dist/src/lib/document-ingest-artifact.js +36 -6
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +11 -1
- package/dist/src/lib/document-ingest.js +16 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +142 -0
- package/dist/src/lib/function-authorize-check.js +311 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +27 -0
- package/dist/src/lib/function-authorize-view.js +88 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +142 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +90 -12
- package/dist/src/lib/function-collect.js +482 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +65 -11
- package/dist/src/lib/function-db-types.js +297 -157
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +57 -0
- package/dist/src/lib/function-lint.js +234 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +13 -21
- package/dist/src/lib/function-run.js +14 -27
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +86 -22
- package/dist/src/lib/function-schema-codegen.js +194 -88
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +109 -6
- package/dist/src/lib/function-sync.js +179 -26
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-triggers.d.ts +15 -3
- package/dist/src/lib/function-triggers.js +72 -10
- package/dist/src/lib/function-triggers.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +174 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-command-status.d.ts +6 -0
- package/dist/src/lib/generated-command-status.js +469 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +586 -152
- package/dist/src/lib/generated-config-surfaces.js +1919 -1883
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/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/hosting-build.d.ts +97 -0
- package/dist/src/lib/hosting-build.js +204 -0
- package/dist/src/lib/hosting-build.js.map +1 -0
- package/dist/src/lib/hosting-client.d.ts +167 -0
- package/dist/src/lib/hosting-client.js +340 -0
- package/dist/src/lib/hosting-client.js.map +1 -0
- package/dist/src/lib/hosting-environments.d.ts +32 -0
- package/dist/src/lib/hosting-environments.js +74 -0
- package/dist/src/lib/hosting-environments.js.map +1 -0
- package/dist/src/lib/hosting-errors.d.ts +30 -0
- package/dist/src/lib/hosting-errors.js +43 -0
- package/dist/src/lib/hosting-errors.js.map +1 -0
- package/dist/src/lib/hosting-token.d.ts +46 -0
- package/dist/src/lib/hosting-token.js +60 -0
- package/dist/src/lib/hosting-token.js.map +1 -0
- package/dist/src/lib/hosting-wait.d.ts +42 -0
- package/dist/src/lib/hosting-wait.js +84 -0
- package/dist/src/lib/hosting-wait.js.map +1 -0
- package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
- package/dist/src/lib/hosting-wfp-upload.js +149 -0
- package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- package/dist/src/lib/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
- package/dist/src/lib/invoker-shared-enums.js +98 -0
- package/dist/src/lib/invoker-shared-enums.js.map +1 -0
- package/dist/src/lib/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +23 -4
- package/dist/src/lib/log-inspection.js +14 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +17 -7
- package/dist/src/lib/login-scope-lines.js +33 -10
- package/dist/src/lib/login-scope-lines.js.map +1 -1
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +3 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +174 -0
- package/dist/src/lib/primitive-declaration.js +792 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +46 -15
- package/dist/src/lib/prompt-schema-codegen.js +142 -108
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/prompt-schema-document.d.ts +35 -0
- package/dist/src/lib/prompt-schema-document.js +92 -0
- package/dist/src/lib/prompt-schema-document.js.map +1 -0
- package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
- package/dist/src/lib/prompt-schema-refs.js +478 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +79 -0
- package/dist/src/lib/records-verbs.js +45 -0
- package/dist/src/lib/records-verbs.js.map +1 -0
- package/dist/src/lib/register-commands.d.ts +36 -0
- package/dist/src/lib/register-commands.js +37 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/scope-request.d.ts +23 -11
- package/dist/src/lib/scope-request.js +69 -31
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +8 -3
- package/dist/src/lib/swift-codegen/agentGenerator.js +76 -22
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
- package/dist/src/lib/swift-codegen/banners.js +12 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
- package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
- package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +117 -31
- package/dist/src/lib/sync-resource-types.js +197 -189
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +4 -2
- package/dist/src/lib/toml-database-config.js +11 -6
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-scalar-edit.js +6 -4
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/transition-warnings.d.ts +21 -0
- package/dist/src/lib/transition-warnings.js +49 -0
- package/dist/src/lib/transition-warnings.js.map +1 -0
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/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/types/index.d.ts +20 -65
- package/dist/src/validators.d.ts +7 -55
- package/dist/src/validators.js +7 -53
- package/dist/src/validators.js.map +1 -1
- package/dist/src/vite.d.ts +17 -0
- package/dist/src/vite.js +18 -0
- package/dist/src/vite.js.map +1 -0
- package/package.json +20 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-trigger-listing.js","sourceRoot":"","sources":["../../../src/lib/function-trigger-listing.ts"],"names":[],"mappings":"A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AC/B,QAAQ,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,EAAE,IAAI,KAAK,EAAE,QAAQ,IAAI,KAAK,EAAE;gBAC5D,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,IAAI;gBAC7B,UAAU,EAAE,KAAK,EAAE,UAAU,IAAI,IAAI;gBACrC,UAAU,EAAE,KAAK,EAAE,eAAe,IAAI,IAAI;aAC3C,CAAC,CAAC;QACL,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC;gBACR,WAAW;gBACX,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;gBAC/B,QAAQ,EAAE,GAAG;gBACb,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,IAAI;gBAC7B,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,KAAK,EAAE,eAAe,IAAI,IAAI;aAC3C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
* cap, whether a standalone webhook holds the key. A local copy of those would
|
|
22
22
|
* be a preflight that can give a false all-clear.
|
|
23
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* The resolved mode the declaration is checked against (#3281): the caller
|
|
26
|
+
* resolves `mode`/`durable` once through the vendored `resolveDeclaredMode`
|
|
27
|
+
* and hands the answer here, so this copy never reads the alias itself.
|
|
28
|
+
*/
|
|
29
|
+
export interface TriggerModeOptions {
|
|
30
|
+
mode?: "request" | "task";
|
|
31
|
+
}
|
|
24
32
|
export interface WebhookTriggerDeclaration {
|
|
25
33
|
verificationScheme: string;
|
|
26
34
|
signingSecret?: string;
|
|
@@ -38,17 +46,21 @@ export interface CronTriggerDeclaration {
|
|
|
38
46
|
overlapPolicy?: string;
|
|
39
47
|
rootInput?: unknown;
|
|
40
48
|
}
|
|
49
|
+
/** One `[[function.triggers.database]]` entry, normalized (#3184). */
|
|
50
|
+
export interface DatabaseTriggerDeclaration {
|
|
51
|
+
type: string;
|
|
52
|
+
}
|
|
41
53
|
export interface TriggerDeclaration {
|
|
42
54
|
webhook: WebhookTriggerDeclaration | null;
|
|
43
55
|
cron: CronTriggerDeclaration[];
|
|
56
|
+
databases: DatabaseTriggerDeclaration[];
|
|
44
57
|
}
|
|
45
58
|
export declare const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
|
|
59
|
+
export declare const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
|
|
46
60
|
export declare class TriggerDeclarationError extends Error {
|
|
47
61
|
}
|
|
48
62
|
/**
|
|
49
63
|
* Normalize (and check) the `triggers` table of a parsed `[function]` table.
|
|
50
64
|
* Returns null when nothing is declared, so a caller can skip the work.
|
|
51
65
|
*/
|
|
52
|
-
export declare function normalizeFunctionTriggers(functionTable: any, options?:
|
|
53
|
-
durable?: boolean;
|
|
54
|
-
}): TriggerDeclaration | null;
|
|
66
|
+
export declare function normalizeFunctionTriggers(functionTable: any, options?: TriggerModeOptions): TriggerDeclaration | null;
|
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
* be a preflight that can give a false all-clear.
|
|
23
23
|
*/
|
|
24
24
|
export const MAX_CRON_TRIGGERS_PER_FUNCTION = 10;
|
|
25
|
+
export const MAX_DATABASE_TRIGGERS_PER_FUNCTION = 5;
|
|
25
26
|
const CRON_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
27
|
+
/** The charset the grant grammar already uses for a database type key. */
|
|
28
|
+
const DATABASE_TYPE_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
29
|
+
const DATABASE_KEYS = ["type"];
|
|
26
30
|
const WEBHOOK_KEYS = [
|
|
27
31
|
"verificationScheme",
|
|
28
32
|
"signingSecret",
|
|
@@ -49,16 +53,72 @@ export function normalizeFunctionTriggers(functionTable, options = {}) {
|
|
|
49
53
|
throw new TriggerDeclarationError("[function.triggers] must be a table declaring `webhook` and/or `cron`");
|
|
50
54
|
}
|
|
51
55
|
for (const key of Object.keys(triggers)) {
|
|
52
|
-
if (key !== "webhook" && key !== "cron") {
|
|
56
|
+
if (key !== "webhook" && key !== "cron" && key !== "database") {
|
|
53
57
|
throw new TriggerDeclarationError(`unknown trigger kind '${key}' under [function.triggers]: the kinds are ` +
|
|
54
|
-
"`webhook` and `
|
|
58
|
+
"`webhook`, `cron` and `database`");
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
const webhook = normalizeWebhook(triggers.webhook, options);
|
|
58
62
|
const cron = normalizeCron(triggers.cron, options);
|
|
59
|
-
|
|
63
|
+
const databases = normalizeDatabases(triggers.database, options);
|
|
64
|
+
if (!webhook && cron.length === 0 && databases.length === 0)
|
|
60
65
|
return null;
|
|
61
|
-
return { webhook, cron };
|
|
66
|
+
return { webhook, cron, databases };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `[[function.triggers.database]]` — one accepted key, `type` (#3184).
|
|
70
|
+
*
|
|
71
|
+
* Sync mode only, permanently: a database-change fire runs inside the write
|
|
72
|
+
* request with no run row, and there is no durable shape for that.
|
|
73
|
+
*/
|
|
74
|
+
function normalizeDatabases(raw, options) {
|
|
75
|
+
if (raw === undefined || raw === null)
|
|
76
|
+
return [];
|
|
77
|
+
const entries = Array.isArray(raw) ? raw : [raw];
|
|
78
|
+
if (entries.length === 0)
|
|
79
|
+
return [];
|
|
80
|
+
if (options.mode === "task") {
|
|
81
|
+
throw new TriggerDeclarationError("database triggers require request mode: set `mode = \"request\"` (or " +
|
|
82
|
+
"remove `mode = \"task\"`), or remove the [[function.triggers.database]] " +
|
|
83
|
+
"entries");
|
|
84
|
+
}
|
|
85
|
+
if (entries.length > MAX_DATABASE_TRIGGERS_PER_FUNCTION) {
|
|
86
|
+
throw new TriggerDeclarationError(`a function may watch at most ${MAX_DATABASE_TRIGGERS_PER_FUNCTION} database ` +
|
|
87
|
+
`types, and this one declares ${entries.length}`);
|
|
88
|
+
}
|
|
89
|
+
const seen = new Set();
|
|
90
|
+
const normalized = [];
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
93
|
+
throw new TriggerDeclarationError("each [[function.triggers.database]] entry must be a table");
|
|
94
|
+
}
|
|
95
|
+
const table = entry;
|
|
96
|
+
for (const key of Object.keys(table)) {
|
|
97
|
+
if (!DATABASE_KEYS.includes(key)) {
|
|
98
|
+
throw new TriggerDeclarationError(`unknown key '${key}' in a [[function.triggers.database]] entry: the ` +
|
|
99
|
+
`only accepted key is ${DATABASE_KEYS.join(", ")}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const type = String(table.type ?? "").trim();
|
|
103
|
+
if (!type) {
|
|
104
|
+
throw new TriggerDeclarationError("each [[function.triggers.database]] entry needs a `type`: it names the " +
|
|
105
|
+
"database type whose writes fire the function");
|
|
106
|
+
}
|
|
107
|
+
if (!DATABASE_TYPE_PATTERN.test(type)) {
|
|
108
|
+
throw new TriggerDeclarationError(`database trigger type '${type}' must contain only letters, digits, ` +
|
|
109
|
+
"'-' or '_'");
|
|
110
|
+
}
|
|
111
|
+
if (seen.has(type)) {
|
|
112
|
+
throw new TriggerDeclarationError(`duplicate database trigger type '${type}': a function fires once per ` +
|
|
113
|
+
"write request, so each type is declared once");
|
|
114
|
+
}
|
|
115
|
+
seen.add(type);
|
|
116
|
+
normalized.push({ type });
|
|
117
|
+
}
|
|
118
|
+
// Sorted, matching the server, so `config diff` compares the same canonical
|
|
119
|
+
// shape whichever order the file lists its blocks in.
|
|
120
|
+
normalized.sort((a, b) => a.type.localeCompare(b.type));
|
|
121
|
+
return normalized;
|
|
62
122
|
}
|
|
63
123
|
function normalizeWebhook(raw, options) {
|
|
64
124
|
if (raw === undefined || raw === null)
|
|
@@ -77,9 +137,9 @@ function normalizeWebhook(raw, options) {
|
|
|
77
137
|
`are ${WEBHOOK_KEYS.join(", ")}`);
|
|
78
138
|
}
|
|
79
139
|
}
|
|
80
|
-
if (options.
|
|
81
|
-
throw new TriggerDeclarationError("webhook triggers require
|
|
82
|
-
"[function.triggers.webhook]");
|
|
140
|
+
if (options.mode === "task") {
|
|
141
|
+
throw new TriggerDeclarationError("webhook triggers require request mode: set `mode = \"request\"` (or " +
|
|
142
|
+
"remove `mode = \"task\"`), or remove [function.triggers.webhook]");
|
|
83
143
|
}
|
|
84
144
|
const scheme = String(table.verificationScheme ?? "").trim();
|
|
85
145
|
if (!scheme) {
|
|
@@ -130,9 +190,11 @@ function normalizeCron(raw, options) {
|
|
|
130
190
|
const entries = Array.isArray(raw) ? raw : [raw];
|
|
131
191
|
if (entries.length === 0)
|
|
132
192
|
return [];
|
|
133
|
-
if (options.
|
|
134
|
-
throw new TriggerDeclarationError("cron triggers require
|
|
135
|
-
"
|
|
193
|
+
if (options.mode === "task") {
|
|
194
|
+
throw new TriggerDeclarationError("cron triggers require request mode: set `mode = \"request\"` (or " +
|
|
195
|
+
"remove `mode = \"task\"`), or remove the [[function.triggers.cron]] " +
|
|
196
|
+
"entries — a cron trigger on a task function is not available in this " +
|
|
197
|
+
"release");
|
|
136
198
|
}
|
|
137
199
|
if (entries.length > MAX_CRON_TRIGGERS_PER_FUNCTION) {
|
|
138
200
|
throw new TriggerDeclarationError(`a function may declare at most ${MAX_CRON_TRIGGERS_PER_FUNCTION} cron ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-triggers.js","sourceRoot":"","sources":["../../../src/lib/function-triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"function-triggers.js","sourceRoot":"","sources":["../../../src/lib/function-triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAyCH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,M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K,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAY,CAAC;QAC9B,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -71,6 +71,18 @@
|
|
|
71
71
|
* Every other option stays the functions tsconfig's: shared code runs in
|
|
72
72
|
* the same Worker. `primitive-functions` imported from a shared file is
|
|
73
73
|
* always the generated declaration, whatever its tsconfig maps.
|
|
74
|
+
*
|
|
75
|
+
* ── The advisory pass (#5547) ────────────────────────────────────────────
|
|
76
|
+
*
|
|
77
|
+
* The SDK reads a db3 model's filter and sort types through an empty switch
|
|
78
|
+
* interface, `Db3FilterTyping`, so the program above (and the author's editor,
|
|
79
|
+
* and their `tsc`) types every `ctx.db3` handle open, as it always has. For one
|
|
80
|
+
* release a mismatch the typed handle would refuse is a warning, not a
|
|
81
|
+
* refusal: `advise` judges a function `check` passed with a second program —
|
|
82
|
+
* the same roots plus one in-memory declaration that fills the switch, never
|
|
83
|
+
* written to disk — and answers what the typed handle adds. The second program
|
|
84
|
+
* is rebuilt whenever the first is, so a root a later function adds is in both,
|
|
85
|
+
* and the two share parsed files, so nothing is parsed twice.
|
|
74
86
|
*/
|
|
75
87
|
/** The flag that skips the check, named wherever the refusal is read. */
|
|
76
88
|
export declare const TYPECHECK_SKIP_FLAG = "--no-typecheck";
|
|
@@ -80,6 +92,40 @@ export interface FunctionTypecheckFailure {
|
|
|
80
92
|
/** The whole refusal, as `config push` reports it against the function. */
|
|
81
93
|
message: string;
|
|
82
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* The module declaration that fills `Db3FilterTyping`, which holds every typed
|
|
97
|
+
* `ctx.db3` handle to its model's declared filter and sort.
|
|
98
|
+
*/
|
|
99
|
+
export declare const DB3_FILTER_TYPING_AUGMENTATION = "declare module \"primitive-functions\" { interface Db3FilterTyping { enforced: true } }";
|
|
100
|
+
/**
|
|
101
|
+
* The opt-in file an author adds under `functions/` to make the typed handles
|
|
102
|
+
* errors now. The first line makes the file a module: without it the
|
|
103
|
+
* declaration is an ambient module that hides the SDK's exports.
|
|
104
|
+
*/
|
|
105
|
+
export declare const DB3_FILTER_TYPING_OPT_IN = "export {};\ndeclare module \"primitive-functions\" { interface Db3FilterTyping { enforced: true } }";
|
|
106
|
+
/** The advisory pass's in-memory declaration, as if under `functions/`; never written. */
|
|
107
|
+
export declare const DB3_FILTER_ADVISORY_DECLARATION = ".db3-filter-typing.advisory.d.ts";
|
|
108
|
+
/** The most advisory lines a push sends for one function. */
|
|
109
|
+
export declare const DB3_FILTER_ADVISORY_LINE_CAP = 50;
|
|
110
|
+
/** The most characters of one advisory line a push sends. */
|
|
111
|
+
export declare const DB3_FILTER_ADVISORY_LINE_MAX = 512;
|
|
112
|
+
/** The first line of a function's advisory warning. */
|
|
113
|
+
export declare const DB3_FILTER_ADVISORY_LINE: (functionKey: string) => string;
|
|
114
|
+
/** What the advisory warning tells the author after the compiler's lines, followed by the opt-in file. */
|
|
115
|
+
export declare const DB3_FILTER_ADVISORY_GUIDANCE: string;
|
|
116
|
+
/** What the typed `ctx.db3` handles add to a function that typechecks. */
|
|
117
|
+
export interface FunctionTypecheckAdvisory {
|
|
118
|
+
/** The compiler's own lines, `functions/`-relative, as `check` spells them. */
|
|
119
|
+
diagnostics: string;
|
|
120
|
+
/** The whole warning, as `config push` prints it against the function. */
|
|
121
|
+
message: string;
|
|
122
|
+
/**
|
|
123
|
+
* One line per diagnostic, its message chain on that line, each cut to
|
|
124
|
+
* `DB3_FILTER_ADVISORY_LINE_MAX` characters, at most
|
|
125
|
+
* `DB3_FILTER_ADVISORY_LINE_CAP` of them: what the push sends the server.
|
|
126
|
+
*/
|
|
127
|
+
lines: string[];
|
|
128
|
+
}
|
|
83
129
|
export interface FunctionTypechecker {
|
|
84
130
|
/**
|
|
85
131
|
* The diagnostics for one function's sources, or null when they typecheck.
|
|
@@ -90,6 +136,12 @@ export interface FunctionTypechecker {
|
|
|
90
136
|
* tree root.
|
|
91
137
|
*/
|
|
92
138
|
check(functionKey: string, sources: readonly string[], sharedSources?: readonly string[]): FunctionTypecheckFailure | null;
|
|
139
|
+
/**
|
|
140
|
+
* What the typed `ctx.db3` handles refuse in one function's sources, or
|
|
141
|
+
* null: nothing, or a tree that declares no db3 type. Asked after `check`
|
|
142
|
+
* answered null for the same function, with the same arguments.
|
|
143
|
+
*/
|
|
144
|
+
advise(functionKey: string, sources: readonly string[], sharedSources?: readonly string[]): FunctionTypecheckAdvisory | null;
|
|
93
145
|
}
|
|
94
146
|
export interface FunctionTypecheckSetup {
|
|
95
147
|
/** null when there is nothing to check, or no compiler to check it with. */
|
|
@@ -71,15 +71,51 @@
|
|
|
71
71
|
* Every other option stays the functions tsconfig's: shared code runs in
|
|
72
72
|
* the same Worker. `primitive-functions` imported from a shared file is
|
|
73
73
|
* always the generated declaration, whatever its tsconfig maps.
|
|
74
|
+
*
|
|
75
|
+
* ── The advisory pass (#5547) ────────────────────────────────────────────
|
|
76
|
+
*
|
|
77
|
+
* The SDK reads a db3 model's filter and sort types through an empty switch
|
|
78
|
+
* interface, `Db3FilterTyping`, so the program above (and the author's editor,
|
|
79
|
+
* and their `tsc`) types every `ctx.db3` handle open, as it always has. For one
|
|
80
|
+
* release a mismatch the typed handle would refuse is a warning, not a
|
|
81
|
+
* refusal: `advise` judges a function `check` passed with a second program —
|
|
82
|
+
* the same roots plus one in-memory declaration that fills the switch, never
|
|
83
|
+
* written to disk — and answers what the typed handle adds. The second program
|
|
84
|
+
* is rebuilt whenever the first is, so a root a later function adds is in both,
|
|
85
|
+
* and the two share parsed files, so nothing is parsed twice.
|
|
74
86
|
*/
|
|
75
87
|
import { createRequire } from "module";
|
|
76
88
|
import { existsSync, realpathSync } from "fs";
|
|
77
89
|
import { dirname, join, relative, resolve, sep } from "path";
|
|
78
|
-
import { FUNCTIONS_TSCONFIG_FILE, SDK_MODULE_SPECIFIER, SDK_TYPES_FILE, planFunctionTypeArtifacts, renderFunctionsTsconfig, } from "./function-db-types.js";
|
|
90
|
+
import { FUNCTIONS_TSCONFIG_FILE, SDK_MODULE_SPECIFIER, SDK_TYPES_FILE, planFunctionTypeArtifacts, plannedRemovals, renderFunctionsTsconfig, } from "./function-db-types.js";
|
|
79
91
|
import { FunctionSchemaCodegenError } from "./function-schema-codegen.js";
|
|
92
|
+
import { db3TypeSources } from "./db-type-records.js";
|
|
80
93
|
import { isInsideDirectory, resolveFunctionSourceRoots, } from "./function-source-roots.js";
|
|
81
94
|
/** The flag that skips the check, named wherever the refusal is read. */
|
|
82
95
|
export const TYPECHECK_SKIP_FLAG = "--no-typecheck";
|
|
96
|
+
/**
|
|
97
|
+
* The module declaration that fills `Db3FilterTyping`, which holds every typed
|
|
98
|
+
* `ctx.db3` handle to its model's declared filter and sort.
|
|
99
|
+
*/
|
|
100
|
+
export const DB3_FILTER_TYPING_AUGMENTATION = 'declare module "primitive-functions" { interface Db3FilterTyping { enforced: true } }';
|
|
101
|
+
/**
|
|
102
|
+
* The opt-in file an author adds under `functions/` to make the typed handles
|
|
103
|
+
* errors now. The first line makes the file a module: without it the
|
|
104
|
+
* declaration is an ambient module that hides the SDK's exports.
|
|
105
|
+
*/
|
|
106
|
+
export const DB3_FILTER_TYPING_OPT_IN = `export {};\n${DB3_FILTER_TYPING_AUGMENTATION}`;
|
|
107
|
+
/** The advisory pass's in-memory declaration, as if under `functions/`; never written. */
|
|
108
|
+
export const DB3_FILTER_ADVISORY_DECLARATION = ".db3-filter-typing.advisory.d.ts";
|
|
109
|
+
/** The most advisory lines a push sends for one function. */
|
|
110
|
+
export const DB3_FILTER_ADVISORY_LINE_CAP = 50;
|
|
111
|
+
/** The most characters of one advisory line a push sends. */
|
|
112
|
+
export const DB3_FILTER_ADVISORY_LINE_MAX = 512;
|
|
113
|
+
/** The first line of a function's advisory warning. */
|
|
114
|
+
export const DB3_FILTER_ADVISORY_LINE = (functionKey) => `function '${functionKey}' has db3 filter or sort diagnostics a later release refuses at push:`;
|
|
115
|
+
/** What the advisory warning tells the author after the compiler's lines, followed by the opt-in file. */
|
|
116
|
+
export const DB3_FILTER_ADVISORY_GUIDANCE = "A declared field takes only the operators and values its kind takes " +
|
|
117
|
+
"(Db3.<Model>Filter and Db3.<Model>Sort in functions/primitive.d.ts). " +
|
|
118
|
+
"The push continues. To make these errors now, add a file under functions/ holding:";
|
|
83
119
|
/** The real path, or the spelling itself when it cannot be resolved. */
|
|
84
120
|
function realOrSelf(path) {
|
|
85
121
|
try {
|
|
@@ -178,10 +214,20 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
178
214
|
// — what is on disk is by definition the stale set this fix exists to
|
|
179
215
|
// distrust — so say so once and check nothing (SO3331-001).
|
|
180
216
|
const overlay = new Map();
|
|
217
|
+
// #5206 — a declaration the plan no longer writes is removed by this push,
|
|
218
|
+
// so the copy an earlier run left on disk is not read either. #5208 — every
|
|
219
|
+
// planned removal is masked, so a `--dry-run` checks the program the real
|
|
220
|
+
// push checks after its write: absent to reads, existence checks and
|
|
221
|
+
// directory listings alike, while it is still on disk.
|
|
222
|
+
let retired = new Set();
|
|
181
223
|
try {
|
|
182
|
-
|
|
224
|
+
const planned = planFunctionTypeArtifacts(configDir);
|
|
225
|
+
for (const artifact of planned) {
|
|
183
226
|
overlay.set(resolve(artifact.absolute), artifact.contents);
|
|
184
227
|
}
|
|
228
|
+
// Both spellings: module resolution reads a file at its real path, so a
|
|
229
|
+
// tree reached through a symlink is masked there too.
|
|
230
|
+
retired = new Set(plannedRemovals(configDir, planned).flatMap((path) => [resolve(path), realOrSelf(resolve(path))]));
|
|
185
231
|
}
|
|
186
232
|
catch (err) {
|
|
187
233
|
if (!(err instanceof FunctionSchemaCodegenError))
|
|
@@ -198,9 +244,12 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
198
244
|
const planned = overlay.get(resolve(path));
|
|
199
245
|
if (planned !== undefined)
|
|
200
246
|
return planned;
|
|
247
|
+
if (retired.has(resolve(path)))
|
|
248
|
+
return undefined;
|
|
201
249
|
return ts.sys.readFile(path);
|
|
202
250
|
};
|
|
203
|
-
const fileExists = (path) => overlay.has(resolve(path)) || ts.sys.fileExists(path);
|
|
251
|
+
const fileExists = (path) => overlay.has(resolve(path)) || (!retired.has(resolve(path)) && ts.sys.fileExists(path));
|
|
252
|
+
const readDirectory = (...args) => ts.sys.readDirectory(...args).filter((path) => !retired.has(resolve(path)));
|
|
204
253
|
const tsconfigPath = join(functionsDir, FUNCTIONS_TSCONFIG_FILE);
|
|
205
254
|
// The plan writes a tsconfig only when one is missing or its wiring is; an
|
|
206
255
|
// author's own file is read from disk. A tree with neither is checked against
|
|
@@ -227,7 +276,7 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
227
276
|
}
|
|
228
277
|
const parseHost = {
|
|
229
278
|
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
230
|
-
readDirectory
|
|
279
|
+
readDirectory,
|
|
231
280
|
fileExists,
|
|
232
281
|
readFile,
|
|
233
282
|
};
|
|
@@ -449,25 +498,40 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
449
498
|
}
|
|
450
499
|
return files;
|
|
451
500
|
};
|
|
452
|
-
const roots = new Set((parsed.fileNames ?? []).map((file) => resolve(file)));
|
|
501
|
+
const roots = new Set((parsed.fileNames ?? []).map((file) => resolve(file)).filter((file) => !retired.has(file)));
|
|
453
502
|
// Every generated declaration is a root whether or not the tsconfig's globs
|
|
454
503
|
// would have found it on disk — the augmentations are the point of the check.
|
|
455
504
|
for (const [path] of overlay) {
|
|
456
505
|
if (path.endsWith(".d.ts"))
|
|
457
506
|
roots.add(path);
|
|
458
507
|
}
|
|
508
|
+
// Parsed files, shared by every program this checker builds: the main one
|
|
509
|
+
// after a root is added, and the advisory one (#5547). Both compile with the
|
|
510
|
+
// same options, so a file parses once whichever program asks first.
|
|
511
|
+
const parsedFiles = new Map();
|
|
512
|
+
const parsedKey = (fileName, languageVersion) => `${resolve(fileName)}\0${typeof languageVersion === "object" && languageVersion !== null
|
|
513
|
+
? `${languageVersion.languageVersion}:${languageVersion.impliedNodeFormat}`
|
|
514
|
+
: languageVersion}`;
|
|
459
515
|
let program = null;
|
|
460
|
-
|
|
516
|
+
/** Bumped whenever the main program is rebuilt, so the advisory one follows. */
|
|
517
|
+
let generation = 0;
|
|
518
|
+
const buildProgram = (virtual = new Map()) => {
|
|
461
519
|
const host = ts.createCompilerHost(parsed.options, true);
|
|
462
520
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
463
|
-
host.readFile = readFile;
|
|
464
|
-
host.fileExists = fileExists;
|
|
521
|
+
host.readFile = (path) => virtual.get(resolve(path)) ?? readFile(path);
|
|
522
|
+
host.fileExists = (path) => virtual.has(resolve(path)) || fileExists(path);
|
|
465
523
|
host.getSourceFile = (fileName, languageVersion, onError, shouldCreate) => {
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
524
|
+
const key = parsedKey(fileName, languageVersion);
|
|
525
|
+
const cached = shouldCreate ? undefined : parsedFiles.get(key);
|
|
526
|
+
if (cached !== undefined)
|
|
527
|
+
return cached;
|
|
528
|
+
const planned = virtual.get(resolve(fileName)) ?? overlay.get(resolve(fileName));
|
|
529
|
+
const sourceFile = planned !== undefined
|
|
530
|
+
? ts.createSourceFile(fileName, planned, languageVersion, true)
|
|
531
|
+
: getSourceFile(fileName, languageVersion, onError, shouldCreate);
|
|
532
|
+
if (sourceFile)
|
|
533
|
+
parsedFiles.set(key, sourceFile);
|
|
534
|
+
return sourceFile;
|
|
471
535
|
};
|
|
472
536
|
// The program resolves by the same per-file rule as the graph walk, so
|
|
473
537
|
// the two cannot disagree about which file an import names. Each literal
|
|
@@ -480,55 +544,77 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
480
544
|
}));
|
|
481
545
|
};
|
|
482
546
|
return ts.createProgram({
|
|
483
|
-
rootNames: [...roots],
|
|
547
|
+
rootNames: [...roots, ...virtual.keys()],
|
|
484
548
|
options: parsed.options,
|
|
485
549
|
host,
|
|
486
550
|
});
|
|
487
551
|
};
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
552
|
+
// #5547 — the advisory program: the same roots, plus the declaration that
|
|
553
|
+
// fills `Db3FilterTyping`. A tree with no db3 type has no typed handle to
|
|
554
|
+
// judge, so it never builds one.
|
|
555
|
+
const declaresDb3Type = db3TypeSources(configDir).length > 0;
|
|
556
|
+
const advisoryDeclaration = new Map([
|
|
557
|
+
[resolve(functionsDir, DB3_FILTER_ADVISORY_DECLARATION), `${DB3_FILTER_TYPING_OPT_IN}\n`],
|
|
558
|
+
]);
|
|
559
|
+
let advisoryProgram = null;
|
|
560
|
+
let advisoryGeneration = -1;
|
|
561
|
+
/**
|
|
562
|
+
* A function's checked files, added to the roots when the tsconfig's
|
|
563
|
+
* `include` misses one: this is code the push is about to ship. A root
|
|
564
|
+
* added marks the main program stale.
|
|
565
|
+
*/
|
|
566
|
+
const functionFiles = (sources, sharedSources) => {
|
|
567
|
+
const paths = typeGraph([
|
|
568
|
+
...sources.map((source) => resolve(configDir, source)),
|
|
569
|
+
// What the bundle shipped from declared directories, seeded by its
|
|
570
|
+
// real path: the graph alone misses an implementation behind a
|
|
571
|
+
// package's declaration export. A package file a shared file reached
|
|
572
|
+
// by a relative import is still a dependency, never checked.
|
|
573
|
+
...sharedSources
|
|
574
|
+
.map((source) => resolve(realTreeRoot, source))
|
|
575
|
+
.filter(isCheckedSource),
|
|
576
|
+
]);
|
|
577
|
+
for (const path of paths) {
|
|
578
|
+
if (!roots.has(path)) {
|
|
579
|
+
roots.add(path);
|
|
580
|
+
program = null;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (program === null) {
|
|
584
|
+
program = buildProgram();
|
|
585
|
+
generation++;
|
|
586
|
+
}
|
|
587
|
+
return paths;
|
|
588
|
+
};
|
|
589
|
+
/** The diagnostics a program reports for a function's files, third-party module ones left out. */
|
|
590
|
+
const diagnosticsOf = (target, paths) => {
|
|
591
|
+
const diagnostics = [];
|
|
592
|
+
for (const path of paths) {
|
|
593
|
+
const sourceFile = target.getSourceFile(path);
|
|
594
|
+
if (!sourceFile) {
|
|
595
|
+
// A file gone since the build: the compiler's own "not found".
|
|
596
|
+
for (const diagnostic of target.getOptionsDiagnostics()) {
|
|
597
|
+
const text = ts.flattenDiagnosticMessageText(diagnostic.messageText, " ");
|
|
598
|
+
if (!diagnostic.file && text.includes(path))
|
|
599
|
+
diagnostics.push(diagnostic);
|
|
507
600
|
}
|
|
601
|
+
continue;
|
|
508
602
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
if (!sourceFile) {
|
|
515
|
-
// A file gone since the build: the compiler's own "not found".
|
|
516
|
-
for (const diagnostic of program.getOptionsDiagnostics()) {
|
|
517
|
-
const text = ts.flattenDiagnosticMessageText(diagnostic.messageText, " ");
|
|
518
|
-
if (!diagnostic.file && text.includes(path))
|
|
519
|
-
diagnostics.push(diagnostic);
|
|
520
|
-
}
|
|
603
|
+
for (const diagnostic of [
|
|
604
|
+
...target.getSyntacticDiagnostics(sourceFile),
|
|
605
|
+
...target.getSemanticDiagnostics(sourceFile),
|
|
606
|
+
]) {
|
|
607
|
+
if (isThirdPartyModuleDiagnostic(ts, diagnostic, isInstalledPackage))
|
|
521
608
|
continue;
|
|
522
|
-
|
|
523
|
-
for (const diagnostic of [
|
|
524
|
-
...program.getSyntacticDiagnostics(sourceFile),
|
|
525
|
-
...program.getSemanticDiagnostics(sourceFile),
|
|
526
|
-
]) {
|
|
527
|
-
if (isThirdPartyModuleDiagnostic(ts, diagnostic, isInstalledPackage))
|
|
528
|
-
continue;
|
|
529
|
-
diagnostics.push(diagnostic);
|
|
530
|
-
}
|
|
609
|
+
diagnostics.push(diagnostic);
|
|
531
610
|
}
|
|
611
|
+
}
|
|
612
|
+
return diagnostics;
|
|
613
|
+
};
|
|
614
|
+
const checker = {
|
|
615
|
+
check(functionKey, sources, sharedSources = []) {
|
|
616
|
+
const paths = functionFiles(sources, sharedSources);
|
|
617
|
+
const diagnostics = diagnosticsOf(program, paths);
|
|
532
618
|
if (diagnostics.length === 0)
|
|
533
619
|
return null;
|
|
534
620
|
const formatted = ts
|
|
@@ -542,10 +628,44 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
542
628
|
.split("\n")
|
|
543
629
|
.map((line) => ` ${line}`)
|
|
544
630
|
.join("\n") +
|
|
631
|
+
"\n The declarations type each `ctx.api` call's body and answer from the " +
|
|
632
|
+
"platform's API spec, so a body key or an answer field the spec does not " +
|
|
633
|
+
"declare is refused." +
|
|
545
634
|
"\n Reproduce with `tsc -p functions/tsconfig.json --noEmit`; " +
|
|
546
635
|
`push with ${TYPECHECK_SKIP_FLAG} to ship it unchecked.`,
|
|
547
636
|
};
|
|
548
637
|
},
|
|
638
|
+
advise(functionKey, sources, sharedSources = []) {
|
|
639
|
+
if (!declaresDb3Type)
|
|
640
|
+
return null;
|
|
641
|
+
const paths = functionFiles(sources, sharedSources);
|
|
642
|
+
if (advisoryProgram === null || advisoryGeneration !== generation) {
|
|
643
|
+
advisoryProgram = buildProgram(advisoryDeclaration);
|
|
644
|
+
advisoryGeneration = generation;
|
|
645
|
+
}
|
|
646
|
+
const diagnostics = diagnosticsOf(advisoryProgram, paths);
|
|
647
|
+
if (diagnostics.length === 0)
|
|
648
|
+
return null;
|
|
649
|
+
const formatted = ts
|
|
650
|
+
.formatDiagnostics(diagnostics, formatHost)
|
|
651
|
+
.replace(/\n+$/, "");
|
|
652
|
+
const lines = diagnostics
|
|
653
|
+
.slice(0, DB3_FILTER_ADVISORY_LINE_CAP)
|
|
654
|
+
.map((diagnostic) => ts
|
|
655
|
+
.formatDiagnostics([{ ...diagnostic, messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, " ") }], formatHost)
|
|
656
|
+
.replace(/\s+$/, "")
|
|
657
|
+
.slice(0, DB3_FILTER_ADVISORY_LINE_MAX));
|
|
658
|
+
return {
|
|
659
|
+
diagnostics: formatted,
|
|
660
|
+
message: [
|
|
661
|
+
DB3_FILTER_ADVISORY_LINE(functionKey),
|
|
662
|
+
...formatted.split("\n").map((line) => ` ${line}`),
|
|
663
|
+
` ${DB3_FILTER_ADVISORY_GUIDANCE}`,
|
|
664
|
+
...DB3_FILTER_TYPING_OPT_IN.split("\n").map((line) => ` ${line}`),
|
|
665
|
+
].join("\n"),
|
|
666
|
+
lines,
|
|
667
|
+
};
|
|
668
|
+
},
|
|
549
669
|
};
|
|
550
670
|
return { checker, warnings };
|
|
551
671
|
}
|