primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +303 -186
- package/assets/skill/skills/primitive-platform/SKILL.md +93 -27
- package/dist/bin/primitive.js +15 -89
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +80 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.d.ts +129 -0
- package/dist/src/commands/agent-sessions.js +532 -20
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +207 -155
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +3 -0
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps-transitions.d.ts +39 -0
- package/dist/src/commands/apps-transitions.js +198 -0
- package/dist/src/commands/apps-transitions.js.map +1 -0
- package/dist/src/commands/apps.d.ts +17 -0
- package/dist/src/commands/apps.js +108 -3
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.js +2 -0
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +170 -50
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -0
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +318 -256
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/comparisons.js +2 -0
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +2 -2
- package/dist/src/commands/config.js +59 -33
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +42 -0
- package/dist/src/commands/db3-types.js +445 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +38 -0
- package/dist/src/commands/db3.js +2053 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +110 -10
- package/dist/src/commands/documents.js +1019 -748
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +74 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +8 -4
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +383 -32
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +168 -50
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +7 -5
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +509 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +129 -38
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -53
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +19 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +4 -2
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +55 -6
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -52
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rate-counters.d.ts +19 -0
- package/dist/src/commands/rate-counters.js +104 -0
- package/dist/src/commands/rate-counters.js.map +1 -0
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +2 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.d.ts +38 -0
- package/dist/src/commands/secrets.js +148 -6
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/skill.js +2 -0
- package/dist/src/commands/skill.js.map +1 -1
- package/dist/src/commands/spent-tokens.d.ts +19 -0
- package/dist/src/commands/spent-tokens.js +79 -0
- package/dist/src/commands/spent-tokens.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +58 -0
- package/dist/src/commands/sync-app-settings.js +119 -2
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +578 -546
- package/dist/src/commands/sync.js +3516 -5134
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +5 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transitions.d.ts +54 -0
- package/dist/src/commands/transitions.js +418 -0
- package/dist/src/commands/transitions.js.map +1 -0
- package/dist/src/commands/usage.d.ts +42 -0
- package/dist/src/commands/usage.js +397 -0
- package/dist/src/commands/usage.js.map +1 -0
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +951 -18
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -0
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +1976 -431
- package/dist/src/lib/api-client.js +1095 -550
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +14 -2
- package/dist/src/lib/app-settings-descriptor.js +55 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +47 -1
- package/dist/src/lib/auth-flow.js +451 -14
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +8 -14
- package/dist/src/lib/block-selector.js +8 -19
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +3 -1
- package/dist/src/lib/child-apps-local.js +9 -1
- package/dist/src/lib/child-apps-local.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -0
- package/dist/src/lib/cli-manifest.js +10 -1
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/cli-version.d.ts +14 -0
- package/dist/src/lib/cli-version.js +38 -0
- package/dist/src/lib/cli-version.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
- package/dist/src/lib/collection-export.d.ts +76 -15
- package/dist/src/lib/collection-export.js +116 -23
- package/dist/src/lib/collection-export.js.map +1 -1
- package/dist/src/lib/collection-principal.d.ts +22 -0
- package/dist/src/lib/collection-principal.js +35 -0
- package/dist/src/lib/collection-principal.js.map +1 -0
- package/dist/src/lib/command-groups.d.ts +30 -0
- package/dist/src/lib/command-groups.js +111 -0
- package/dist/src/lib/command-groups.js.map +1 -0
- package/dist/src/lib/command-status.d.ts +147 -0
- package/dist/src/lib/command-status.js +266 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +9 -22
- package/dist/src/lib/config-object-descriptor.js +113 -277
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +3 -7
- package/dist/src/lib/config-surface.js +9 -13
- package/dist/src/lib/config-surface.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/credentials-home.d.ts +7 -0
- package/dist/src/lib/credentials-home.js +45 -10
- package/dist/src/lib/credentials-home.js.map +1 -1
- package/dist/src/lib/credentials-lock.d.ts +14 -6
- package/dist/src/lib/credentials-lock.js +90 -10
- package/dist/src/lib/credentials-lock.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +142 -70
- package/dist/src/lib/credentials-store.js +420 -111
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +40 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +32 -8
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +125 -0
- package/dist/src/lib/db-type-records.js +237 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +322 -0
- package/dist/src/lib/db3-export.js +767 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +116 -0
- package/dist/src/lib/db3-index-output.js +223 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/db3-json-fields.d.ts +49 -0
- package/dist/src/lib/db3-json-fields.js +195 -0
- package/dist/src/lib/db3-json-fields.js.map +1 -0
- package/dist/src/lib/db3-type-archive.d.ts +59 -0
- package/dist/src/lib/db3-type-archive.js +95 -0
- package/dist/src/lib/db3-type-archive.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +148 -0
- package/dist/src/lib/db3-type-models.js +583 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/document-export-record-log.d.ts +7 -0
- package/dist/src/lib/document-export-record-log.js +9 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +19 -0
- package/dist/src/lib/document-ingest-artifact.js +55 -6
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +11 -1
- package/dist/src/lib/document-ingest.js +16 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +142 -0
- package/dist/src/lib/function-authorize-check.js +311 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +36 -0
- package/dist/src/lib/function-authorize-view.js +110 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +142 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +112 -12
- package/dist/src/lib/function-collect.js +601 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +65 -11
- package/dist/src/lib/function-db-types.js +326 -157
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-grants-preflight.d.ts +99 -0
- package/dist/src/lib/function-grants-preflight.js +154 -2
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +85 -0
- package/dist/src/lib/function-lint.js +442 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +13 -21
- package/dist/src/lib/function-run.js +14 -27
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +86 -22
- package/dist/src/lib/function-schema-codegen.js +194 -88
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +120 -6
- package/dist/src/lib/function-sync.js +217 -26
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +174 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-command-status.d.ts +6 -0
- package/dist/src/lib/generated-command-status.js +502 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +804 -140
- package/dist/src/lib/generated-config-surfaces.js +2491 -1806
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/hosting-build.d.ts +97 -0
- package/dist/src/lib/hosting-build.js +204 -0
- package/dist/src/lib/hosting-build.js.map +1 -0
- package/dist/src/lib/hosting-client.d.ts +167 -0
- package/dist/src/lib/hosting-client.js +340 -0
- package/dist/src/lib/hosting-client.js.map +1 -0
- package/dist/src/lib/hosting-environments.d.ts +32 -0
- package/dist/src/lib/hosting-environments.js +74 -0
- package/dist/src/lib/hosting-environments.js.map +1 -0
- package/dist/src/lib/hosting-errors.d.ts +30 -0
- package/dist/src/lib/hosting-errors.js +43 -0
- package/dist/src/lib/hosting-errors.js.map +1 -0
- package/dist/src/lib/hosting-token.d.ts +46 -0
- package/dist/src/lib/hosting-token.js +60 -0
- package/dist/src/lib/hosting-token.js.map +1 -0
- package/dist/src/lib/hosting-trust-step.d.ts +67 -0
- package/dist/src/lib/hosting-trust-step.js +279 -0
- package/dist/src/lib/hosting-trust-step.js.map +1 -0
- package/dist/src/lib/hosting-trust.d.ts +77 -0
- package/dist/src/lib/hosting-trust.js +194 -0
- package/dist/src/lib/hosting-trust.js.map +1 -0
- package/dist/src/lib/hosting-wait.d.ts +42 -0
- package/dist/src/lib/hosting-wait.js +84 -0
- package/dist/src/lib/hosting-wait.js.map +1 -0
- package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
- package/dist/src/lib/hosting-wfp-upload.js +149 -0
- package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- package/dist/src/lib/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
- package/dist/src/lib/invoker-shared-enums.js +98 -0
- package/dist/src/lib/invoker-shared-enums.js.map +1 -0
- package/dist/src/lib/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +23 -4
- package/dist/src/lib/log-inspection.js +14 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +17 -7
- package/dist/src/lib/login-scope-lines.js +33 -10
- package/dist/src/lib/login-scope-lines.js.map +1 -1
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +3 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +174 -0
- package/dist/src/lib/primitive-declaration.js +871 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +96 -100
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/prompt-schema-document.d.ts +35 -0
- package/dist/src/lib/prompt-schema-document.js +92 -0
- package/dist/src/lib/prompt-schema-document.js.map +1 -0
- package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
- package/dist/src/lib/prompt-schema-refs.js +478 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +79 -0
- package/dist/src/lib/records-verbs.js +45 -0
- package/dist/src/lib/records-verbs.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
- package/dist/src/lib/refresh-admin-credentials.js +85 -29
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/refresh-stored-login.d.ts +85 -0
- package/dist/src/lib/refresh-stored-login.js +233 -0
- package/dist/src/lib/refresh-stored-login.js.map +1 -0
- package/dist/src/lib/register-commands.d.ts +36 -0
- package/dist/src/lib/register-commands.js +37 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/row-field-rename.d.ts +18 -0
- package/dist/src/lib/row-field-rename.js +32 -0
- package/dist/src/lib/row-field-rename.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +229 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +420 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-defs-module.d.ts +29 -0
- package/dist/src/lib/schema-defs-module.js +103 -0
- package/dist/src/lib/schema-defs-module.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/scope-request.d.ts +23 -11
- package/dist/src/lib/scope-request.js +69 -31
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
- package/dist/src/lib/swift-codegen/agentGenerator.js +25 -23
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
- package/dist/src/lib/swift-codegen/banners.js +12 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
- package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
- package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +51 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +239 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +117 -31
- package/dist/src/lib/sync-resource-types.js +197 -189
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +4 -2
- package/dist/src/lib/toml-database-config.js +11 -6
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-list-edit.d.ts +33 -0
- package/dist/src/lib/toml-list-edit.js +481 -0
- package/dist/src/lib/toml-list-edit.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
- package/dist/src/lib/toml-scalar-edit.js +73 -5
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/transition-warnings.d.ts +21 -0
- package/dist/src/lib/transition-warnings.js +49 -0
- package/dist/src/lib/transition-warnings.js.map +1 -0
- package/dist/src/lib/usage-meters.d.ts +16 -0
- package/dist/src/lib/usage-meters.js +52 -0
- package/dist/src/lib/usage-meters.js.map +1 -0
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/types/index.d.ts +20 -65
- package/dist/src/validators.d.ts +7 -55
- package/dist/src/validators.js +7 -53
- package/dist/src/validators.js.map +1 -1
- package/dist/src/vite.d.ts +17 -0
- package/dist/src/vite.js +18 -0
- package/dist/src/vite.js.map +1 -0
- package/package.json +20 -9
|
@@ -24,14 +24,20 @@
|
|
|
24
24
|
* without this the bare `primitive-functions` specifier every function
|
|
25
25
|
* imports would not resolve at all, and the augmentation would have
|
|
26
26
|
* nothing to augment;
|
|
27
|
-
* - `primitive
|
|
28
|
-
* `function
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* - `primitive.d.ts` (#5544, rendered by `primitive-declaration.ts`) —
|
|
28
|
+
* every `schemas/` def, function, prompt, db3 model and user property
|
|
29
|
+
* type under one namespace per family, and the augmentations that type
|
|
30
|
+
* `defineFunction`, `ctx.prompts.run`, `ctx.db3` and `ctx.users`. It
|
|
31
|
+
* replaced four per-family files (`RETIRED_DECLARATIONS`), which are
|
|
32
|
+
* removed;
|
|
31
33
|
* - `primitive-document-types.d.ts` (#3281, rendered by
|
|
32
34
|
* `function-document-types.ts`) — the project's document models from
|
|
33
35
|
* `models/models.toml`, and the `DocumentSchemas` augmentation that types
|
|
34
|
-
* `ctx.doc(documentId).model("<Model>")`;
|
|
36
|
+
* `ctx.doc(documentId).model("<Model>")`; not written when the project has
|
|
37
|
+
* none (#5206), and dropped from an explicit tsconfig `files` list then.
|
|
38
|
+
* #5208 — inside a project it is typed from `models/models.toml` only,
|
|
39
|
+
* and the generated schema copy a pull or push once wrote beside it is
|
|
40
|
+
* removed (`plannedRemovals`);
|
|
35
41
|
* - `generated/<key>.generated.ts` (#3281, same renderer) — the per-key
|
|
36
42
|
* CLIENT invoker, carrying every verb since #3482. Excluded from
|
|
37
43
|
* the scaffolded program (it imports `js-bao-wss-client`), and written to
|
|
@@ -56,13 +62,18 @@
|
|
|
56
62
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "fs";
|
|
57
63
|
import { basename, dirname, join, relative, resolve, sep } from "path";
|
|
58
64
|
import { parseConfigToml } from "./config-toml.js";
|
|
59
|
-
import { FUNCTION_INVOKERS_DIR,
|
|
65
|
+
import { FUNCTION_INVOKERS_DIR, FunctionSchemaCodegenError, GENERATED_FILE_SUFFIX, functionSchemaSources, } from "./function-schema-codegen.js";
|
|
60
66
|
import { DOCUMENT_TYPES_DECLARATION_FILE, DOCUMENT_SCHEMA_TREE_FILE, resolveDocumentSchema, renderDocumentTypesDeclaration, } from "./function-document-types.js";
|
|
61
|
-
import { AGENT_CLIENT_FILE_SUFFIX,
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
67
|
+
import { AGENT_CLIENT_FILE_SUFFIX, promptSchemaSources, renderAgentClientFiles, } from "./prompt-schema-codegen.js";
|
|
68
|
+
import { db3TypeSources, typeEntries } from "./db-type-records.js";
|
|
69
|
+
import { primitiveDeclarationInputs, renderPrimitiveDeclaration } from "./primitive-declaration.js";
|
|
70
|
+
import { renderFunctionInvokerSet } from "./invoker-shared-enums.js";
|
|
71
|
+
import { renderSchemaDefsModule, SCHEMA_DEFS_FILE } from "./schema-defs-module.js";
|
|
72
|
+
import { PRIMITIVE_DECLARATION_FILE, PRIMITIVE_DECLARATION_SPECIFIER, RETIRED_DECLARATIONS, } from "./primitive-declaration-names.js";
|
|
65
73
|
import { SDK_TYPES_SOURCE } from "./generated-sdk-types.js";
|
|
74
|
+
import { USER_PROPERTIES_CLIENT_FILE, USER_PROPERTIES_FILE, renderUserPropertiesClientTypes, treeHasUserProperties, userPropertiesSource, } from "./user-properties/user-properties-codegen.js";
|
|
75
|
+
export { db3TypeSources } from "./db-type-records.js";
|
|
76
|
+
export { PRIMITIVE_DECLARATION_FILE, RETIRED_DECLARATIONS } from "./primitive-declaration-names.js";
|
|
66
77
|
export const DB_TYPES_DECLARATION_FILE = "primitive-db-types.d.ts";
|
|
67
78
|
export const SDK_TYPES_FILE = "primitive-functions.d.ts";
|
|
68
79
|
export const FUNCTIONS_TSCONFIG_FILE = "tsconfig.json";
|
|
@@ -76,11 +87,12 @@ export const FUNCTIONS_TSCONFIG_FILE = "tsconfig.json";
|
|
|
76
87
|
export const REGENERATED_DECLARATIONS = [
|
|
77
88
|
DB_TYPES_DECLARATION_FILE,
|
|
78
89
|
SDK_TYPES_FILE,
|
|
79
|
-
|
|
90
|
+
// #5544 — every function, prompt, schemas/ def, db3 and user property type.
|
|
91
|
+
PRIMITIVE_DECLARATION_FILE,
|
|
80
92
|
DOCUMENT_TYPES_DECLARATION_FILE,
|
|
81
|
-
// #3330 — the prompt output types, from the tree's `prompts/*.toml`.
|
|
82
|
-
PROMPT_TYPES_DECLARATION_FILE,
|
|
83
93
|
];
|
|
94
|
+
/** Every declaration codegen ever writes or once wrote. */
|
|
95
|
+
const ALL_DECLARATIONS = [...REGENERATED_DECLARATIONS, ...RETIRED_DECLARATIONS.map((retired) => retired.file)];
|
|
84
96
|
/** The scaffold's exclusion for the client invokers (#3281). */
|
|
85
97
|
export const GENERATED_EXCLUDE = `${FUNCTION_INVOKERS_DIR}/**`;
|
|
86
98
|
const HEADER = `// GENERATED by \`primitive config push\` from database-type-configs/*.toml.
|
|
@@ -94,31 +106,6 @@ const HEADER = `// GENERATED by \`primitive config push\` from database-type-con
|
|
|
94
106
|
// platform owns rather than the schema, added by the SDK's own row type, so it
|
|
95
107
|
// is not repeated per model here whether or not a model declares one.
|
|
96
108
|
`;
|
|
97
|
-
function quote(value) {
|
|
98
|
-
return JSON.stringify(value);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* A model or field name as a TYPE member key.
|
|
102
|
-
*
|
|
103
|
-
* Model and field names are whatever the TOML says — js-bao preserves them
|
|
104
|
-
* verbatim — so `Order-Item` and `first-name` are ordinary schemas and are not
|
|
105
|
-
* TypeScript identifiers. Emitting one raw makes the whole declaration a syntax
|
|
106
|
-
* error, which breaks the editor and `tsc` wiring for every OTHER type in the
|
|
107
|
-
* tree too. The client generators' own `objectPropertyKey` answers this,
|
|
108
|
-
* except that its `__proto__` case is a computed key — legal in an object
|
|
109
|
-
* literal, not in a type member — so that one is quoted instead.
|
|
110
|
-
*/
|
|
111
|
-
function memberKey(name) {
|
|
112
|
-
const key = objectPropertyKey(name);
|
|
113
|
-
return key.startsWith("[") ? quote(name) : key;
|
|
114
|
-
}
|
|
115
|
-
/** A TS string-literal union, or `string` when there is nothing to narrow to. */
|
|
116
|
-
function fieldType(type, enumValues) {
|
|
117
|
-
if (type === "string" && Array.isArray(enumValues) && enumValues.length > 0) {
|
|
118
|
-
return enumValues.map((v) => quote(v)).join(" | ");
|
|
119
|
-
}
|
|
120
|
-
return tsTypeForDbFieldType(type);
|
|
121
|
-
}
|
|
122
109
|
/**
|
|
123
110
|
* The declaration for a whole config tree's database types.
|
|
124
111
|
*
|
|
@@ -129,57 +116,12 @@ function fieldType(type, enumValues) {
|
|
|
129
116
|
export function renderDbTypesDeclaration(sources) {
|
|
130
117
|
const types = [...sources].sort((a, b) => a.databaseType < b.databaseType ? -1 : a.databaseType > b.databaseType ? 1 : 0);
|
|
131
118
|
const lines = [HEADER, "export interface PrimitiveDatabaseSchemas {"];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
tomlContent: source.tomlContent,
|
|
139
|
-
});
|
|
140
|
-
records = [...ir.records]
|
|
141
|
-
.sort((a, b) => (a.modelName < b.modelName ? -1 : 1))
|
|
142
|
-
.map((record) => {
|
|
143
|
-
const declared = new Set();
|
|
144
|
-
const members = [];
|
|
145
|
-
for (const field of record.fields) {
|
|
146
|
-
declared.add(field.name);
|
|
147
|
-
members.push(` ${memberKey(field.name)}${field.required ? "" : "?"}: ${fieldType(field.type, field.enum)};`);
|
|
148
|
-
}
|
|
149
|
-
// Server-stamped fields exist on a read row but not on one a
|
|
150
|
-
// function just built, so they are optional — the same call the
|
|
151
|
-
// client renderer makes.
|
|
152
|
-
for (const stamped of [...ir.stampedFields].sort()) {
|
|
153
|
-
if (declared.has(stamped))
|
|
154
|
-
continue;
|
|
155
|
-
declared.add(stamped);
|
|
156
|
-
members.push(` ${memberKey(stamped)}?: string;`);
|
|
157
|
-
}
|
|
158
|
-
return { modelName: record.modelName, members };
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
// A type whose TOML this renderer cannot describe contributes no models
|
|
163
|
-
// rather than failing the push: its own preflight reports the file, and
|
|
164
|
-
// an untyped handle is what a schemaless type gets anyway.
|
|
165
|
-
records = [];
|
|
166
|
-
}
|
|
167
|
-
if (records.length === 0) {
|
|
168
|
-
lines.push(` ${quote(source.databaseType)}: {};`);
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
lines.push(` ${quote(source.databaseType)}: {`);
|
|
172
|
-
for (const record of records) {
|
|
173
|
-
if (record.members.length === 0) {
|
|
174
|
-
lines.push(` ${memberKey(record.modelName)}: Record<string, unknown>;`);
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
lines.push(` ${memberKey(record.modelName)}: {`);
|
|
178
|
-
lines.push(...record.members);
|
|
179
|
-
lines.push(` };`);
|
|
180
|
-
}
|
|
181
|
-
lines.push(` };`);
|
|
182
|
-
}
|
|
119
|
+
lines.push(...typeEntries(types.map((source) => ({
|
|
120
|
+
key: source.databaseType,
|
|
121
|
+
tomlPath: source.tomlPath,
|
|
122
|
+
tomlContent: source.tomlContent,
|
|
123
|
+
table: "database",
|
|
124
|
+
})), "optional"));
|
|
183
125
|
lines.push("}");
|
|
184
126
|
lines.push("");
|
|
185
127
|
// The augmentation. Only emitted when there is something to bind: an empty
|
|
@@ -193,8 +135,14 @@ export function renderDbTypesDeclaration(sources) {
|
|
|
193
135
|
}
|
|
194
136
|
return lines.join("\n");
|
|
195
137
|
}
|
|
196
|
-
/**
|
|
197
|
-
|
|
138
|
+
/**
|
|
139
|
+
* The scaffolded compiler wiring. Written once; an author owns it after.
|
|
140
|
+
*
|
|
141
|
+
* `absent` names the regenerated declarations the tree does not get, which
|
|
142
|
+
* the scaffold leaves out of `include` (#5898).
|
|
143
|
+
*/
|
|
144
|
+
export function renderFunctionsTsconfig(absent = []) {
|
|
145
|
+
const declarations = REGENERATED_DECLARATIONS.filter((file) => !absent.includes(file));
|
|
198
146
|
return (JSON.stringify({
|
|
199
147
|
// Scaffolded by `primitive config push` (#3182). Yours to adjust — push
|
|
200
148
|
// writes it once and then leaves it alone. What it must keep doing is
|
|
@@ -221,7 +169,7 @@ export function renderFunctionsTsconfig() {
|
|
|
221
169
|
"primitive-functions": [`./${SDK_TYPES_FILE}`],
|
|
222
170
|
},
|
|
223
171
|
},
|
|
224
|
-
include: ["**/*.ts", ...
|
|
172
|
+
include: ["**/*.ts", ...declarations.map((file) => `./${file}`)],
|
|
225
173
|
// The client invokers (#3281) import `js-bao-wss-client`, which a
|
|
226
174
|
// config tree does not install: they are for the app's client code,
|
|
227
175
|
// and an editor program that swept them in would report every one of
|
|
@@ -305,6 +253,10 @@ function isGlobEntry(entry) {
|
|
|
305
253
|
function isDeclarationEntry(entry, file) {
|
|
306
254
|
return entry === `./${file}` || entry === file;
|
|
307
255
|
}
|
|
256
|
+
/** The retired declaration an entry names (#5544), or null. */
|
|
257
|
+
function retiredEntryOf(entry) {
|
|
258
|
+
return RETIRED_DECLARATIONS.find((retired) => isDeclarationEntry(entry, retired.file)) ?? null;
|
|
259
|
+
}
|
|
308
260
|
/** `"./**\/*.ts"` and `"**\/*.ts"` name the same set; read them the same way. */
|
|
309
261
|
function normalizeEntry(entry) {
|
|
310
262
|
return entry.startsWith("./") ? entry.slice(2) : entry;
|
|
@@ -351,7 +303,7 @@ function coversSubdirectories(entry) {
|
|
|
351
303
|
function isSourceEntry(entry) {
|
|
352
304
|
if (typeof entry !== "string")
|
|
353
305
|
return false;
|
|
354
|
-
if (
|
|
306
|
+
if (ALL_DECLARATIONS.some((file) => isDeclarationEntry(entry, file))) {
|
|
355
307
|
return false;
|
|
356
308
|
}
|
|
357
309
|
return isGlobEntry(entry) || entry.endsWith(".ts");
|
|
@@ -399,11 +351,17 @@ function tsconfigWiringGaps(parsed, context) {
|
|
|
399
351
|
const declarationsCovered = listed.some(coversDeclarations);
|
|
400
352
|
const reachesSubdirectories = listed.some(coversSubdirectories);
|
|
401
353
|
const exclude = Array.isArray(parsed.exclude) ? parsed.exclude : [];
|
|
354
|
+
const absent = context.absentDeclarations ?? [];
|
|
402
355
|
return {
|
|
403
356
|
mapping: !mapped.includes(`./${SDK_TYPES_FILE}`),
|
|
404
357
|
missingDeclarations: implicitlyAll || declarationsCovered
|
|
405
358
|
? []
|
|
406
|
-
: REGENERATED_DECLARATIONS.filter((file) => !listed.some((entry) => isDeclarationEntry(entry, file))),
|
|
359
|
+
: REGENERATED_DECLARATIONS.filter((file) => !absent.includes(file) && !listed.some((entry) => isDeclarationEntry(entry, file))),
|
|
360
|
+
absentFiles: files.filter((entry) => typeof entry === "string" && absent.some((file) => isDeclarationEntry(entry, file))),
|
|
361
|
+
retiredEntries: [
|
|
362
|
+
...include.filter((entry) => retiredEntryOf(entry)).map((entry) => ({ list: "include", entry: entry })),
|
|
363
|
+
...files.filter((entry) => retiredEntryOf(entry)).map((entry) => ({ list: "files", entry: entry })),
|
|
364
|
+
],
|
|
407
365
|
sources: !implicitlyAll && !declarationsCovered && !listed.some(isSourceEntry),
|
|
408
366
|
// Only a program that would SEE the directory needs the exclusion: an
|
|
409
367
|
// explicit list that reaches no subdirectory never sweeps it in.
|
|
@@ -413,7 +371,12 @@ function tsconfigWiringGaps(parsed, context) {
|
|
|
413
371
|
};
|
|
414
372
|
}
|
|
415
373
|
function hasGaps(gaps) {
|
|
416
|
-
return (gaps.mapping ||
|
|
374
|
+
return (gaps.mapping ||
|
|
375
|
+
gaps.missingDeclarations.length > 0 ||
|
|
376
|
+
gaps.sources ||
|
|
377
|
+
gaps.generatedExclusion ||
|
|
378
|
+
gaps.absentFiles.length > 0 ||
|
|
379
|
+
gaps.retiredEntries.length > 0);
|
|
417
380
|
}
|
|
418
381
|
function describeGaps(gaps) {
|
|
419
382
|
const problems = [];
|
|
@@ -433,6 +396,17 @@ function describeGaps(gaps) {
|
|
|
433
396
|
problems.push(`\`exclude\` does not cover "${GENERATED_EXCLUDE}", so the generated client ` +
|
|
434
397
|
"invokers (which import `js-bao-wss-client`) are swept into the program");
|
|
435
398
|
}
|
|
399
|
+
if (gaps.absentFiles.length > 0) {
|
|
400
|
+
problems.push(`\`files\` names ${gaps.absentFiles
|
|
401
|
+
.map((entry) => `"${entry}"`)
|
|
402
|
+
.join(", ")}, which codegen no longer writes, so the compiler reports it missing`);
|
|
403
|
+
}
|
|
404
|
+
for (const { list, entry } of gaps.retiredEntries) {
|
|
405
|
+
const retired = retiredEntryOf(entry);
|
|
406
|
+
problems.push(`\`${list}\` names "${entry}", which codegen no longer writes: its types are in ` +
|
|
407
|
+
`"./${PRIMITIVE_DECLARATION_FILE}" under ${retired.namespace}, so remove the entry` +
|
|
408
|
+
(list === "files" ? ` and list "./${PRIMITIVE_DECLARATION_FILE}"` : ""));
|
|
409
|
+
}
|
|
436
410
|
return problems;
|
|
437
411
|
}
|
|
438
412
|
/**
|
|
@@ -458,7 +432,7 @@ function describeGaps(gaps) {
|
|
|
458
432
|
*/
|
|
459
433
|
export function inspectFunctionsTsconfig(existing, context = { generatedDirExists: false }) {
|
|
460
434
|
if (existing === null) {
|
|
461
|
-
return { repaired: renderFunctionsTsconfig(), problems: [] };
|
|
435
|
+
return { repaired: renderFunctionsTsconfig(context.absentDeclarations), problems: [] };
|
|
462
436
|
}
|
|
463
437
|
let parsed;
|
|
464
438
|
let plainJson = true;
|
|
@@ -508,6 +482,20 @@ export function inspectFunctionsTsconfig(existing, context = { generatedDirExist
|
|
|
508
482
|
: [];
|
|
509
483
|
paths[SDK_MODULE_SPECIFIER] = [...mapped, `./${SDK_TYPES_FILE}`];
|
|
510
484
|
}
|
|
485
|
+
if (gaps.retiredEntries.length > 0) {
|
|
486
|
+
// #5544 — a retired declaration's entry goes; its replacement comes back
|
|
487
|
+
// through the missing-declaration repair below, and a `files` list the
|
|
488
|
+
// removal empties goes with it, the sources then coming through `include`.
|
|
489
|
+
for (const list of ["include", "files"]) {
|
|
490
|
+
if (!Array.isArray(parsed[list]))
|
|
491
|
+
continue;
|
|
492
|
+
const kept = parsed[list].filter((entry) => !retiredEntryOf(entry));
|
|
493
|
+
if (list === "files" && kept.length === 0)
|
|
494
|
+
delete parsed.files;
|
|
495
|
+
else
|
|
496
|
+
parsed[list] = kept;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
511
499
|
if (gaps.missingDeclarations.length > 0 || gaps.sources) {
|
|
512
500
|
const include = Array.isArray(parsed.include) ? parsed.include : [];
|
|
513
501
|
const added = [];
|
|
@@ -527,6 +515,15 @@ export function inspectFunctionsTsconfig(existing, context = { generatedDirExist
|
|
|
527
515
|
const exclude = Array.isArray(parsed.exclude) ? parsed.exclude : [];
|
|
528
516
|
parsed.exclude = [...exclude, GENERATED_EXCLUDE];
|
|
529
517
|
}
|
|
518
|
+
if (gaps.absentFiles.length > 0 && Array.isArray(parsed.files)) {
|
|
519
|
+
// #5206 — a root that no longer exists is dropped; an emptied list goes
|
|
520
|
+
// with it, since the sources then come through `include`.
|
|
521
|
+
const files = parsed.files.filter((entry) => !gaps.absentFiles.includes(entry));
|
|
522
|
+
if (files.length > 0)
|
|
523
|
+
parsed.files = files;
|
|
524
|
+
else
|
|
525
|
+
delete parsed.files;
|
|
526
|
+
}
|
|
530
527
|
return { repaired: JSON.stringify(parsed, null, 2) + "\n", problems: [] };
|
|
531
528
|
}
|
|
532
529
|
/**
|
|
@@ -630,37 +627,95 @@ function planAgentClientArtifacts(configDir, options) {
|
|
|
630
627
|
};
|
|
631
628
|
});
|
|
632
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* The app's client types of `user-properties.toml` (#5385), where the
|
|
632
|
+
* invokers go: client code needs them whether or not the tree has functions.
|
|
633
|
+
*/
|
|
634
|
+
function planUserPropertiesClientArtifacts(configDir, options, userProperties) {
|
|
635
|
+
if (!userProperties)
|
|
636
|
+
return [];
|
|
637
|
+
const absolute = join(functionInvokerDir(configDir, options), USER_PROPERTIES_CLIENT_FILE);
|
|
638
|
+
return [
|
|
639
|
+
{
|
|
640
|
+
relative: reportedPath(configDir, absolute),
|
|
641
|
+
absolute,
|
|
642
|
+
contents: renderUserPropertiesClientTypes(userProperties),
|
|
643
|
+
regenerated: true,
|
|
644
|
+
source: USER_PROPERTIES_FILE,
|
|
645
|
+
},
|
|
646
|
+
];
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* #5899 — `schema-defs.generated.ts`, where the invokers go, when a db3 field
|
|
650
|
+
* refs a `schemas/` object def: client code needs it whether or not the tree
|
|
651
|
+
* has functions.
|
|
652
|
+
*/
|
|
653
|
+
function planSchemaDefsClientArtifacts(configDir, options) {
|
|
654
|
+
const module = renderSchemaDefsModule({ db3: db3TypeSources(configDir), configDir });
|
|
655
|
+
if (!module)
|
|
656
|
+
return [];
|
|
657
|
+
const absolute = join(functionInvokerDir(configDir, options), module.fileName);
|
|
658
|
+
return [
|
|
659
|
+
{
|
|
660
|
+
relative: reportedPath(configDir, absolute),
|
|
661
|
+
absolute,
|
|
662
|
+
contents: module.content,
|
|
663
|
+
regenerated: true,
|
|
664
|
+
source: `the JSON field defs of ${module.sources.join(", ")}`,
|
|
665
|
+
},
|
|
666
|
+
];
|
|
667
|
+
}
|
|
633
668
|
/**
|
|
634
669
|
* What push would write, without writing it.
|
|
635
670
|
*
|
|
636
|
-
* Only the
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
* needs no compiler wiring.
|
|
671
|
+
* Only the client artifacts — the agents' (#3798, DSO-3798-005) and the user
|
|
672
|
+
* property types (#5385) — when the tree has no `functions/` directory, and
|
|
673
|
+
* nothing at all when it has none of them: the other artifacts exist to type
|
|
674
|
+
* function sources, and a tree with none needs no compiler wiring.
|
|
640
675
|
*/
|
|
641
676
|
export function planFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
642
677
|
const functionsDir = join(configDir, "functions");
|
|
643
678
|
const agentArtifacts = planAgentClientArtifacts(configDir, options);
|
|
644
|
-
if (!treeHasFunctionsDir(configDir))
|
|
645
|
-
|
|
646
|
-
|
|
679
|
+
if (!treeHasFunctionsDir(configDir)) {
|
|
680
|
+
const clientArtifacts = [
|
|
681
|
+
...planUserPropertiesClientArtifacts(configDir, options, userPropertiesSource(configDir)),
|
|
682
|
+
...planSchemaDefsClientArtifacts(configDir, options),
|
|
683
|
+
...agentArtifacts,
|
|
684
|
+
];
|
|
685
|
+
refuseSharedDestinations(clientArtifacts);
|
|
686
|
+
return clientArtifacts;
|
|
687
|
+
}
|
|
688
|
+
// #3455 — one resolution for the document declaration below.
|
|
647
689
|
const documentSchema = resolveDocumentSchema(configDir);
|
|
648
|
-
|
|
649
|
-
//
|
|
690
|
+
// #5898 — `ctx.db`'s declaration only for a tree with database types: with
|
|
691
|
+
// none it would be an empty interface, and the one an earlier run wrote goes
|
|
692
|
+
// (`retiredFunctionTypeArtifacts`). The handle stays open without it.
|
|
693
|
+
const databaseTypes = databaseTypeSources(configDir);
|
|
694
|
+
// #5544 — every function, prompt, schemas/ def, db3 and user property type
|
|
695
|
+
// in one declaration, and the per-key invokers from the same
|
|
650
696
|
// `functions/*.toml`. A malformed schema throws naming the file: the honest
|
|
651
697
|
// `unknown` is for an absent schema, and typing a broken one as anything
|
|
652
698
|
// would be a declaration that lies.
|
|
653
699
|
const functionSources = functionSchemaSources(configDir);
|
|
654
|
-
const
|
|
700
|
+
const primitiveDeclaration = renderPrimitiveDeclaration(primitiveDeclarationInputs(configDir));
|
|
655
701
|
const invokerDir = functionInvokerDir(configDir, options);
|
|
656
|
-
|
|
702
|
+
// #5896 — with the shared `schemas/` enums they use, declared once beside them.
|
|
703
|
+
const invokerSet = renderFunctionInvokerSet(configDir, functionSources);
|
|
704
|
+
const invokers = invokerSet.invokers;
|
|
705
|
+
// #5385 — the user property types, only for a tree that declares them. A
|
|
706
|
+
// file that does not parse throws naming it, like a malformed function schema.
|
|
707
|
+
const userProperties = userPropertiesSource(configDir);
|
|
657
708
|
const artifacts = [
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
709
|
+
...(databaseTypes.length > 0
|
|
710
|
+
? [
|
|
711
|
+
{
|
|
712
|
+
relative: `functions/${DB_TYPES_DECLARATION_FILE}`,
|
|
713
|
+
absolute: join(functionsDir, DB_TYPES_DECLARATION_FILE),
|
|
714
|
+
contents: renderDbTypesDeclaration(databaseTypes),
|
|
715
|
+
regenerated: true,
|
|
716
|
+
},
|
|
717
|
+
]
|
|
718
|
+
: []),
|
|
664
719
|
{
|
|
665
720
|
relative: `functions/${SDK_TYPES_FILE}`,
|
|
666
721
|
absolute: join(functionsDir, SDK_TYPES_FILE),
|
|
@@ -668,50 +723,37 @@ export function planFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
|
668
723
|
regenerated: true,
|
|
669
724
|
},
|
|
670
725
|
{
|
|
671
|
-
relative: `functions/${
|
|
672
|
-
absolute: join(functionsDir,
|
|
673
|
-
contents:
|
|
726
|
+
relative: `functions/${PRIMITIVE_DECLARATION_FILE}`,
|
|
727
|
+
absolute: join(functionsDir, PRIMITIVE_DECLARATION_FILE),
|
|
728
|
+
contents: primitiveDeclaration,
|
|
674
729
|
regenerated: true,
|
|
675
730
|
},
|
|
676
731
|
// #3281 — the document handle's declaration, from the project's
|
|
677
|
-
// `models/models.toml
|
|
732
|
+
// `models/models.toml`.
|
|
678
733
|
//
|
|
679
734
|
// #3455 (D3455-009) — through the SAME resolution push and diff use, so a
|
|
680
735
|
// tree pulled into a project with no `models/models.toml` is typed from
|
|
681
736
|
// the schema its active version was pushed with rather than losing its
|
|
682
737
|
// types the moment it is pulled.
|
|
683
|
-
{
|
|
684
|
-
relative: `functions/${DOCUMENT_TYPES_DECLARATION_FILE}`,
|
|
685
|
-
absolute: join(functionsDir, DOCUMENT_TYPES_DECLARATION_FILE),
|
|
686
|
-
contents: renderDocumentTypesDeclaration(documentSchema.declarationSource),
|
|
687
|
-
regenerated: true,
|
|
688
|
-
},
|
|
689
|
-
// #3330 — `ctx.prompts.run`'s output types, from this tree's
|
|
690
|
-
// `prompts/*.toml` (open when the tree declares none).
|
|
691
|
-
{
|
|
692
|
-
relative: `functions/${PROMPT_TYPES_DECLARATION_FILE}`,
|
|
693
|
-
absolute: join(functionsDir, PROMPT_TYPES_DECLARATION_FILE),
|
|
694
|
-
contents: renderPromptSchemasDeclaration(promptSchemaSources(configDir)),
|
|
695
|
-
regenerated: true,
|
|
696
|
-
},
|
|
697
|
-
// #3455 (D3455-009) — the project's document schema, copied into the tree
|
|
698
|
-
// so a fresh `config pull` into a project that has no `models/models.toml`
|
|
699
|
-
// still rebuilds the same envelope and reads Synced.
|
|
700
738
|
//
|
|
701
|
-
//
|
|
702
|
-
//
|
|
703
|
-
// (
|
|
704
|
-
|
|
705
|
-
...(documentSchema.origin === "project" && documentSchema.source
|
|
739
|
+
// #5206 — none when no schema file resolves: an app with no documents
|
|
740
|
+
// gets no document declaration, and the one an earlier run wrote goes
|
|
741
|
+
// (`retiredFunctionTypeArtifacts`). The handle stays open without it.
|
|
742
|
+
...(documentSchema.declarationSource
|
|
706
743
|
? [
|
|
707
744
|
{
|
|
708
|
-
relative: `functions/${
|
|
709
|
-
absolute: join(functionsDir,
|
|
710
|
-
contents: documentSchema.
|
|
745
|
+
relative: `functions/${DOCUMENT_TYPES_DECLARATION_FILE}`,
|
|
746
|
+
absolute: join(functionsDir, DOCUMENT_TYPES_DECLARATION_FILE),
|
|
747
|
+
contents: renderDocumentTypesDeclaration(documentSchema.declarationSource),
|
|
711
748
|
regenerated: true,
|
|
712
749
|
},
|
|
713
750
|
]
|
|
714
751
|
: []),
|
|
752
|
+
// #5208 — the generated schema copy (D3455-009) is never planned: inside
|
|
753
|
+
// a project `models/models.toml` is the only document schema, so a copy
|
|
754
|
+
// there is a planned removal; outside one, a copy is itself the
|
|
755
|
+
// resolution (rule 2), and rewriting a file from itself would be a second
|
|
756
|
+
// source of truth.
|
|
715
757
|
...invokers.map((invoker) => {
|
|
716
758
|
const absolute = join(invokerDir, invoker.fileName);
|
|
717
759
|
return {
|
|
@@ -719,8 +761,28 @@ export function planFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
|
719
761
|
absolute,
|
|
720
762
|
contents: invoker.content,
|
|
721
763
|
regenerated: true,
|
|
764
|
+
source: `function ${invoker.fileName.slice(0, -GENERATED_FILE_SUFFIX.length)}`,
|
|
722
765
|
};
|
|
723
766
|
}),
|
|
767
|
+
// #5896 — after the invokers, so a function keyed `shared-enums` is the
|
|
768
|
+
// one a refusal names first.
|
|
769
|
+
...(invokerSet.sharedEnums
|
|
770
|
+
? [
|
|
771
|
+
{
|
|
772
|
+
relative: reportedPath(configDir, join(invokerDir, invokerSet.sharedEnums.fileName)),
|
|
773
|
+
absolute: join(invokerDir, invokerSet.sharedEnums.fileName),
|
|
774
|
+
contents: invokerSet.sharedEnums.content,
|
|
775
|
+
regenerated: true,
|
|
776
|
+
source: `the shared enums of ${invokerSet.sharedEnums.sources.join(", ")}`,
|
|
777
|
+
},
|
|
778
|
+
]
|
|
779
|
+
: []),
|
|
780
|
+
// #5385 — `UserProperties` and `ClientUserProperties` for the app's client
|
|
781
|
+
// code (beside the invokers); the functions' are in `primitive.d.ts`.
|
|
782
|
+
...planUserPropertiesClientArtifacts(configDir, options, userProperties),
|
|
783
|
+
// #5899 — after the invokers, so a function keyed `schema-defs` is the one
|
|
784
|
+
// a refusal names first.
|
|
785
|
+
...planSchemaDefsClientArtifacts(configDir, options),
|
|
724
786
|
// #3798 — each agent's client-side types, beside the invokers and owned
|
|
725
787
|
// by the same plan (so the orphan sweep keeps them while the agent does).
|
|
726
788
|
...agentArtifacts,
|
|
@@ -747,8 +809,27 @@ export function planFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
|
747
809
|
regenerated: false,
|
|
748
810
|
});
|
|
749
811
|
}
|
|
812
|
+
refuseSharedDestinations(artifacts);
|
|
750
813
|
return artifacts;
|
|
751
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Refuse a plan in which two artifacts name one file (#5385): a function
|
|
817
|
+
* keyed `user-properties` writes its invoker where the user property client
|
|
818
|
+
* types go, and either would silently overwrite the other. Judged on the
|
|
819
|
+
* absolute paths, so a `-o` directory is judged as written.
|
|
820
|
+
*/
|
|
821
|
+
function refuseSharedDestinations(artifacts) {
|
|
822
|
+
const byPath = new Map();
|
|
823
|
+
for (const artifact of artifacts) {
|
|
824
|
+
const prior = byPath.get(artifact.absolute);
|
|
825
|
+
if (prior) {
|
|
826
|
+
throw new FunctionSchemaCodegenError(`${artifact.relative} would be generated twice — from ${prior.source ?? prior.relative} and from ` +
|
|
827
|
+
`${artifact.source ?? artifact.relative} — and one would overwrite the other. Rename the function ` +
|
|
828
|
+
"(its key names its generated file) so the two differ.");
|
|
829
|
+
}
|
|
830
|
+
byPath.set(artifact.absolute, artifact);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
752
833
|
/**
|
|
753
834
|
* The tsconfig wiring push could not repair, phrased for the author.
|
|
754
835
|
*
|
|
@@ -777,13 +858,21 @@ export function functionTypeWiringProblems(configDir, options = {}) {
|
|
|
777
858
|
/**
|
|
778
859
|
* What the inspection knows about the directory: whether `generated/` will
|
|
779
860
|
* exist beside the tsconfig once this plan is written (it exists now, or this
|
|
780
|
-
* plan writes an invoker into the default location)
|
|
861
|
+
* plan writes an invoker into the default location), and which declarations
|
|
862
|
+
* the plan leaves out (#5206, #5898).
|
|
781
863
|
*/
|
|
782
864
|
function tsconfigContext(configDir, options) {
|
|
783
865
|
const defaultDir = join(configDir, "functions", FUNCTION_INVOKERS_DIR);
|
|
866
|
+
const userProperties = treeHasUserProperties(configDir);
|
|
784
867
|
const writesThere = functionInvokerDir(configDir, options) === defaultDir &&
|
|
785
|
-
functionSchemaSources(configDir).length > 0;
|
|
786
|
-
return {
|
|
868
|
+
(functionSchemaSources(configDir).length > 0 || userProperties);
|
|
869
|
+
return {
|
|
870
|
+
generatedDirExists: existsSync(defaultDir) || writesThere,
|
|
871
|
+
absentDeclarations: [
|
|
872
|
+
...(databaseTypeSources(configDir).length > 0 ? [] : [DB_TYPES_DECLARATION_FILE]),
|
|
873
|
+
...(resolveDocumentSchema(configDir).declarationSource ? [] : [DOCUMENT_TYPES_DECLARATION_FILE]),
|
|
874
|
+
],
|
|
875
|
+
};
|
|
787
876
|
}
|
|
788
877
|
/**
|
|
789
878
|
* Invokers in the plan's directory that the plan no longer writes — a
|
|
@@ -797,20 +886,92 @@ function orphanedInvokers(configDir, planned, options) {
|
|
|
797
886
|
const keep = new Set(planned.map((a) => a.absolute));
|
|
798
887
|
// #3798 (CSO-3798-003) — with no `functions/` at all, an agent's client
|
|
799
888
|
// artifact is the only thing a run could have written here (an `-o`
|
|
800
|
-
// directory the functions run never owned before), so only those are swept
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
889
|
+
// directory the functions run never owned before), so only those are swept
|
|
890
|
+
// — and (#5385) the user property client types.
|
|
891
|
+
const owned = existsSync(join(configDir, "functions"))
|
|
892
|
+
? (f) => f.endsWith(GENERATED_FILE_SUFFIX)
|
|
893
|
+
: (f) => f.endsWith(AGENT_CLIENT_FILE_SUFFIX) || f === USER_PROPERTIES_CLIENT_FILE || f === SCHEMA_DEFS_FILE;
|
|
804
894
|
return readdirSync(dir)
|
|
805
|
-
.filter(
|
|
895
|
+
.filter(owned)
|
|
806
896
|
.map((f) => join(dir, f))
|
|
807
897
|
.filter((absolute) => !keep.has(absolute));
|
|
808
898
|
}
|
|
809
|
-
/**
|
|
810
|
-
|
|
899
|
+
/**
|
|
900
|
+
* Declarations a plan may leave out: the database declaration exists only
|
|
901
|
+
* while the tree has database types (#5898), and the document declaration
|
|
902
|
+
* only while a document schema resolves (#5206).
|
|
903
|
+
*/
|
|
904
|
+
const OPTIONAL_DECLARATIONS = [DB_TYPES_DECLARATION_FILE, DOCUMENT_TYPES_DECLARATION_FILE];
|
|
905
|
+
/**
|
|
906
|
+
* The generated files on disk that `planned` no longer writes: a database
|
|
907
|
+
* or document declaration an earlier run wrote, once the tree's database
|
|
908
|
+
* types (#5898) or document schema (#5206) are gone, the four declarations `primitive.d.ts` replaced (#5544), and,
|
|
909
|
+
* inside a project, the generated schema copy no resolution there reads
|
|
910
|
+
* (#5208).
|
|
911
|
+
*/
|
|
912
|
+
export function retiredFunctionTypeArtifacts(configDir, planned) {
|
|
913
|
+
if (!treeHasFunctionsDir(configDir))
|
|
914
|
+
return [];
|
|
915
|
+
const keep = new Set(planned.map((a) => a.absolute));
|
|
916
|
+
const staleCopy = resolveDocumentSchema(configDir).staleTreeCopy;
|
|
917
|
+
return [
|
|
918
|
+
...OPTIONAL_DECLARATIONS.map((file) => join(configDir, "functions", file)),
|
|
919
|
+
...RETIRED_DECLARATIONS.map((retired) => join(configDir, "functions", retired.file)),
|
|
920
|
+
...(staleCopy ? [staleCopy] : []),
|
|
921
|
+
].filter((absolute) => !keep.has(absolute) && existsSync(absolute));
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Every file a write of `planned` removes, as absolute paths (#5208): the
|
|
925
|
+
* invokers of removed functions, and the retired generated files. The one
|
|
926
|
+
* list the write, `--check`, the dry-run typechecker and the removal lines
|
|
927
|
+
* all read, so they cannot disagree about what goes.
|
|
928
|
+
*/
|
|
929
|
+
export function plannedRemovals(configDir, planned, options = {}) {
|
|
930
|
+
return [
|
|
931
|
+
...orphanedInvokers(configDir, planned, options),
|
|
932
|
+
...retiredFunctionTypeArtifacts(configDir, planned),
|
|
933
|
+
];
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* The line a command prints for a file a write removed (#5208), given its
|
|
937
|
+
* tree-relative path. The schema copy's names where the document schema
|
|
938
|
+
* lives and how to get it back; it never sends the author to the copy.
|
|
939
|
+
*/
|
|
940
|
+
export function functionTypeRemovalLine(relative) {
|
|
941
|
+
if (relative.endsWith(`/${DOCUMENT_SCHEMA_TREE_FILE}`)) {
|
|
942
|
+
return (`Removed ${relative}: inside a project the document schema is models/models.toml, and this ` +
|
|
943
|
+
"generated file is no longer read. To keep the schema, restore models/models.toml from version " +
|
|
944
|
+
"control (the generated file was committed beside your functions); the running version keeps " +
|
|
945
|
+
"the schema until a push without it.");
|
|
946
|
+
}
|
|
947
|
+
if (relative.endsWith(`/${DOCUMENT_TYPES_DECLARATION_FILE}`)) {
|
|
948
|
+
return `Removed ${relative}: no document schema resolves, so ctx.doc's models are untyped.`;
|
|
949
|
+
}
|
|
950
|
+
if (relative.endsWith(`/${DB_TYPES_DECLARATION_FILE}`)) {
|
|
951
|
+
return `Removed ${relative}: the tree has no database-type-configs/*.toml, so ctx.db's models are untyped.`;
|
|
952
|
+
}
|
|
953
|
+
// #5544 — a declaration `primitive.d.ts` replaced names where its types went.
|
|
954
|
+
const retired = RETIRED_DECLARATIONS.find((entry) => relative.endsWith(`/${entry.file}`));
|
|
955
|
+
if (retired) {
|
|
956
|
+
return (`Removed ${relative}: its types are in functions/${PRIMITIVE_DECLARATION_FILE} under ${retired.namespace}; ` +
|
|
957
|
+
`import type { ${retired.namespace} } from "${PRIMITIVE_DECLARATION_SPECIFIER}".`);
|
|
958
|
+
}
|
|
959
|
+
// #5385 — the user property client types go with user-properties.toml.
|
|
960
|
+
if (relative.endsWith(`/${USER_PROPERTIES_CLIENT_FILE}`)) {
|
|
961
|
+
return `Removed ${relative}: the tree has no ${USER_PROPERTIES_FILE}, so UserProperties declares no field.`;
|
|
962
|
+
}
|
|
963
|
+
// #5899 — the JSON field defs go with the last db3 field that refs an object def.
|
|
964
|
+
if (relative.endsWith(`/${SCHEMA_DEFS_FILE}`) || relative === SCHEMA_DEFS_FILE) {
|
|
965
|
+
return `Removed ${relative}: no db3 field refs a schemas/ object def any more.`;
|
|
966
|
+
}
|
|
967
|
+
return `Removed ${relative}: no function declares it any more.`;
|
|
968
|
+
}
|
|
969
|
+
/** Write them, and report what was written and what was removed. */
|
|
970
|
+
export function applyFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
811
971
|
// No early return for an empty plan (CSO-3798-003): removing a tree's last
|
|
812
972
|
// agent (or its last function) plans nothing, and its artifacts still go.
|
|
813
973
|
const artifacts = planFunctionTypeArtifacts(configDir, sdkTypes, options);
|
|
974
|
+
const removals = plannedRemovals(configDir, artifacts, options);
|
|
814
975
|
const written = [];
|
|
815
976
|
for (const artifact of artifacts) {
|
|
816
977
|
const exists = existsSync(artifact.absolute);
|
|
@@ -825,10 +986,18 @@ export function writeFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
|
825
986
|
// A removed function's invoker goes with it (#3281): a stale generated file
|
|
826
987
|
// an app still imports is a compile error naming a function that no longer
|
|
827
988
|
// exists, which is the right failure, but one left behind forever is not.
|
|
828
|
-
|
|
829
|
-
|
|
989
|
+
const removed = [];
|
|
990
|
+
for (const absolute of removals) {
|
|
991
|
+
if (!existsSync(absolute))
|
|
992
|
+
continue;
|
|
993
|
+
rmSync(absolute, { force: true });
|
|
994
|
+
removed.push(reportedPath(configDir, absolute));
|
|
830
995
|
}
|
|
831
|
-
return written;
|
|
996
|
+
return { written, removed };
|
|
997
|
+
}
|
|
998
|
+
/** Write them, and report the tree-relative paths that changed on disk. */
|
|
999
|
+
export function writeFunctionTypeArtifacts(configDir, sdkTypes, options = {}) {
|
|
1000
|
+
return applyFunctionTypeArtifacts(configDir, sdkTypes, options).written;
|
|
832
1001
|
}
|
|
833
1002
|
/**
|
|
834
1003
|
* The artifacts a `--check` run would rewrite: the freshness answer for CI and
|
|
@@ -851,8 +1020,8 @@ export function staleFunctionTypeArtifacts(configDir, options = {}) {
|
|
|
851
1020
|
stale.push(artifact.relative);
|
|
852
1021
|
}
|
|
853
1022
|
}
|
|
854
|
-
for (const
|
|
855
|
-
stale.push(reportedPath(configDir,
|
|
1023
|
+
for (const removal of plannedRemovals(configDir, planned, options)) {
|
|
1024
|
+
stale.push(reportedPath(configDir, removal));
|
|
856
1025
|
}
|
|
857
1026
|
return stale;
|
|
858
1027
|
}
|