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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A db3 JSON field's object def, as the push preflight and `functions codegen`
|
|
3
|
+
* hold it to what the clients can check (#5899).
|
|
4
|
+
*
|
|
5
|
+
* A field whose `ref` names a `schemas/` object def is stored as canonical
|
|
6
|
+
* JSON text, and the web and Swift clients validate a value against the def's
|
|
7
|
+
* compiled schema before it is stored. Each client implements the keywords of
|
|
8
|
+
* {@link DB3_JSON_KEYWORDS} and no other, so a def a db3 field refs may use
|
|
9
|
+
* only those; the same def used by no db3 field is held to nothing here.
|
|
10
|
+
*/
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
import { parseConfigToml } from "./config-toml.js";
|
|
13
|
+
import { readDb3TypesDir, resolveDb3TypeModels } from "./db3-type-models.js";
|
|
14
|
+
import { loadSchemaFamilyIndex } from "./schema-family-index.js";
|
|
15
|
+
/**
|
|
16
|
+
* The keywords both client validators implement, with the meaning the server's
|
|
17
|
+
* validator gives each: the structural keywords, the bounds, and the
|
|
18
|
+
* annotations, which no validator reads. `additionalProperties` is a boolean
|
|
19
|
+
* and `items` one schema; `oneOf` is the enum-tagged union the dialect allows.
|
|
20
|
+
*/
|
|
21
|
+
export const DB3_JSON_KEYWORDS = Object.freeze([
|
|
22
|
+
"type",
|
|
23
|
+
"enum",
|
|
24
|
+
"properties",
|
|
25
|
+
"required",
|
|
26
|
+
"additionalProperties",
|
|
27
|
+
"items",
|
|
28
|
+
"oneOf",
|
|
29
|
+
"minimum",
|
|
30
|
+
"maximum",
|
|
31
|
+
"minLength",
|
|
32
|
+
"maxLength",
|
|
33
|
+
"pattern",
|
|
34
|
+
"minItems",
|
|
35
|
+
"maxItems",
|
|
36
|
+
"title",
|
|
37
|
+
"description",
|
|
38
|
+
"default",
|
|
39
|
+
"format",
|
|
40
|
+
"examples",
|
|
41
|
+
"$comment",
|
|
42
|
+
"deprecated",
|
|
43
|
+
"readOnly",
|
|
44
|
+
"writeOnly",
|
|
45
|
+
]);
|
|
46
|
+
const ALLOWED = new Set(DB3_JSON_KEYWORDS);
|
|
47
|
+
const isTable = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48
|
+
/**
|
|
49
|
+
* The first keyword of a compiled schema the client validators do not
|
|
50
|
+
* implement, as a phrase (`uniqueItems (at properties.tags)`), or null. A node's
|
|
51
|
+
* own keywords are read before the nodes below it.
|
|
52
|
+
*/
|
|
53
|
+
export function db3JsonKeywordProblem(schema, at = []) {
|
|
54
|
+
if (!isTable(schema))
|
|
55
|
+
return null;
|
|
56
|
+
const where = at.length === 0 ? "at the root" : `at ${at.join(".")}`;
|
|
57
|
+
for (const key of Object.keys(schema)) {
|
|
58
|
+
if (!ALLOWED.has(key))
|
|
59
|
+
return `${key} (${where})`;
|
|
60
|
+
if (key === "additionalProperties" && typeof schema[key] !== "boolean")
|
|
61
|
+
return `additionalProperties (a schema, ${where})`;
|
|
62
|
+
if (key === "items" && !isTable(schema[key]))
|
|
63
|
+
return `items (a list of schemas, ${where})`;
|
|
64
|
+
}
|
|
65
|
+
if (isTable(schema.properties)) {
|
|
66
|
+
for (const [name, child] of Object.entries(schema.properties)) {
|
|
67
|
+
const found = db3JsonKeywordProblem(child, [...at, "properties", name]);
|
|
68
|
+
if (found)
|
|
69
|
+
return found;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (isTable(schema.items)) {
|
|
73
|
+
const found = db3JsonKeywordProblem(schema.items, [...at, "items"]);
|
|
74
|
+
if (found)
|
|
75
|
+
return found;
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(schema.oneOf)) {
|
|
78
|
+
for (const [index, member] of schema.oneOf.entries()) {
|
|
79
|
+
const found = db3JsonKeywordProblem(member, [...at, "oneOf", String(index)]);
|
|
80
|
+
if (found)
|
|
81
|
+
return found;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether `pattern` holds a backreference (`\1`, `\k<name>`) outside a character
|
|
88
|
+
* class. ECMAScript resets a group's capture on each repetition of its
|
|
89
|
+
* quantifier and matches a backreference to a group that took no part as
|
|
90
|
+
* empty; ICU, under the Swift client's validator, keeps the earlier capture and
|
|
91
|
+
* fails it, so the two clients would answer the same value differently. Every
|
|
92
|
+
* pattern is compiled with the `u` flag, under which `\<digit>` and `\k` mean
|
|
93
|
+
* nothing else.
|
|
94
|
+
*/
|
|
95
|
+
export function patternHasBackreference(pattern) {
|
|
96
|
+
let inClass = false;
|
|
97
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
98
|
+
const c = pattern[i];
|
|
99
|
+
if (c === "\\") {
|
|
100
|
+
const next = pattern[i + 1];
|
|
101
|
+
if (!inClass && next !== undefined && (/[1-9]/.test(next) || next === "k"))
|
|
102
|
+
return true;
|
|
103
|
+
i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (inClass) {
|
|
107
|
+
if (c === "]")
|
|
108
|
+
inClass = false;
|
|
109
|
+
}
|
|
110
|
+
else if (c === "[") {
|
|
111
|
+
inClass = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The first `pattern` of a compiled schema holding a backreference, as a
|
|
118
|
+
* phrase (`a backreference in pattern (at properties.code)`), or null.
|
|
119
|
+
*/
|
|
120
|
+
export function db3JsonPatternProblem(schema, at = []) {
|
|
121
|
+
if (!isTable(schema))
|
|
122
|
+
return null;
|
|
123
|
+
if (typeof schema.pattern === "string" && patternHasBackreference(schema.pattern)) {
|
|
124
|
+
return `a backreference in pattern (${at.length === 0 ? "at the root" : `at ${at.join(".")}`})`;
|
|
125
|
+
}
|
|
126
|
+
const children = [
|
|
127
|
+
...(isTable(schema.properties) ? Object.entries(schema.properties).map(([name, child]) => [child, ["properties", name]]) : []),
|
|
128
|
+
...(isTable(schema.items) ? [[schema.items, ["items"]]] : []),
|
|
129
|
+
...(Array.isArray(schema.oneOf) ? schema.oneOf.map((member, index) => [member, ["oneOf", String(index)]]) : []),
|
|
130
|
+
];
|
|
131
|
+
for (const [child, step] of children) {
|
|
132
|
+
const found = db3JsonPatternProblem(child, [...at, ...step]);
|
|
133
|
+
if (found)
|
|
134
|
+
return found;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Each JSON field of the tree's `db3-types/` whose def uses a keyword outside
|
|
140
|
+
* {@link DB3_JSON_KEYWORDS}, named at the file that declares the field. A def
|
|
141
|
+
* whose file does not compile is left to the `schemas/` preflight.
|
|
142
|
+
*/
|
|
143
|
+
export function db3JsonDefRefusals(configDir) {
|
|
144
|
+
const db3Dir = join(configDir, "db3-types");
|
|
145
|
+
const { jsonFields } = resolveDb3TypeModels(db3Dir);
|
|
146
|
+
if (jsonFields.size === 0)
|
|
147
|
+
return [];
|
|
148
|
+
const compiled = new Map();
|
|
149
|
+
for (const local of loadSchemaFamilyIndex(configDir).locals) {
|
|
150
|
+
const compile = local.compile;
|
|
151
|
+
if (compile && compile.ok)
|
|
152
|
+
compiled.set(local.file, compile.defs);
|
|
153
|
+
}
|
|
154
|
+
const contents = readDb3TypesDir(db3Dir);
|
|
155
|
+
const refusals = [];
|
|
156
|
+
for (const [file, models] of jsonFields) {
|
|
157
|
+
let parsed;
|
|
158
|
+
try {
|
|
159
|
+
parsed = parseConfigToml(contents.get(file) ?? "");
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
for (const [model, fields] of models) {
|
|
165
|
+
for (const [field, def] of fields) {
|
|
166
|
+
// A model the file names through `[type] models` is reported where it is declared.
|
|
167
|
+
const raw = parsed?.models?.[model]?.fields?.[field];
|
|
168
|
+
if (!isTable(raw) || !("ref" in raw))
|
|
169
|
+
continue;
|
|
170
|
+
const defs = compiled.get(def.file);
|
|
171
|
+
if (!defs || !Object.prototype.hasOwnProperty.call(defs, def.name))
|
|
172
|
+
continue;
|
|
173
|
+
const at = `db3-types/${file}: [models.${model}.fields.${field}] ref ${JSON.stringify(raw.ref)}: schemas/${def.file}.toml#${def.name} uses`;
|
|
174
|
+
const problem = db3JsonKeywordProblem(defs[def.name]);
|
|
175
|
+
if (problem) {
|
|
176
|
+
refusals.push({
|
|
177
|
+
file,
|
|
178
|
+
message: `${at} ${problem}, which the client validators do not implement; a def a db3 field refs may use only ${DB3_JSON_KEYWORDS.join(", ")}.`,
|
|
179
|
+
});
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const backreference = db3JsonPatternProblem(defs[def.name]);
|
|
183
|
+
if (backreference) {
|
|
184
|
+
refusals.push({
|
|
185
|
+
file,
|
|
186
|
+
message: `${at} ${backreference}, which JavaScript and the Swift client's regular expressions evaluate differently; ` +
|
|
187
|
+
"a def a db3 field refs may not use a backreference (\\1 or \\k<name>) in a pattern.",
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return refusals;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=db3-json-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db3-json-fields.js","sourceRoot":"","sources":["../../../src/lib/db3-json-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7C,MAAM;IACN,MAAM;IACN,YAAY;IACZ,UAAU;IACV,sBAAsB;IACtB,OAAO;IACP,OAAO;IACP,SAAS;IACT,SAAS;IACT,WAAW;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,OAAO;IACP,aAAa;IACb,SAAS;IACT,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;IACZ,UAAU;IACV,WAAW;CACH,CAAC,CAAC;AAEZ,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAEhE,MAAM,OAAO,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE3I;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qBACxF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure parts of `primitive db3-types archive|unarchive` (#6020): which
|
|
3
|
+
* file declares a type, how its `archived` key is edited, and what a failed
|
|
4
|
+
* push means for the file.
|
|
5
|
+
*
|
|
6
|
+
* The commands edit `[type] archived` in the type's `db3-types/` file and
|
|
7
|
+
* push that one type through `config push`. A push the server refused with
|
|
8
|
+
* an answer (any 4xx) stored nothing, so the file is put back. A push that
|
|
9
|
+
* ended without such an answer (no answer at all, an unreadable one, a 5xx)
|
|
10
|
+
* may have been stored, so the server is read before the file is touched.
|
|
11
|
+
*/
|
|
12
|
+
import type { Db3TypePushReport } from "../commands/sync.js";
|
|
13
|
+
/** What a failed push means: `refused` (nothing stored) or `unknown` (perhaps stored). */
|
|
14
|
+
export type ArchivePushFailureKind = "refused" | "unknown";
|
|
15
|
+
/**
|
|
16
|
+
* Classify a failed push: an error carrying an HTTP status from 400 to 499
|
|
17
|
+
* is the server's answer, which stored nothing (`refused`); any other
|
|
18
|
+
* failure — no status (the connection failed, the body could not be read),
|
|
19
|
+
* a 5xx — may follow a stored write (`unknown`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function archivePushFailureKind(err: unknown): ArchivePushFailureKind;
|
|
22
|
+
/** The `db3-types/` file that declares `type`: by its `[type] name`, else by its file name. */
|
|
23
|
+
export declare function findDb3TypeFile(db3TypesDir: string, type: string): {
|
|
24
|
+
file: string;
|
|
25
|
+
filePath: string;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* The file's text with `[type] archived` set to the asked state: `archived =
|
|
29
|
+
* true` written in place (comments and key order kept), or the line removed,
|
|
30
|
+
* every other byte unchanged.
|
|
31
|
+
*/
|
|
32
|
+
export declare function withArchivedKey(text: string, archived: boolean): string;
|
|
33
|
+
/**
|
|
34
|
+
* A copy of a parsed `db3-types/` document without `[type] archived`, for
|
|
35
|
+
* comparing everything else the file holds with the server. The copy keeps
|
|
36
|
+
* each TOML date its kind (`cloneTomlValue`, not `structuredClone`): a local
|
|
37
|
+
* date default read back as a plain `Date` compares as a change.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withoutArchivedKey<T>(document: T): T;
|
|
40
|
+
/** A push failure as the commands print it. */
|
|
41
|
+
export type ArchivePushFailure = {
|
|
42
|
+
message: string;
|
|
43
|
+
code?: string;
|
|
44
|
+
statusCode?: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* What a `config push` run that did not report `applied` means for the file.
|
|
48
|
+
* Only an answer that settles it is `refused`: a 4xx from the server, or a
|
|
49
|
+
* gate decline before any request. Everything else is `unknown`, the write
|
|
50
|
+
* may have been stored, and the server is read before the file is touched:
|
|
51
|
+
* a 5xx or a failure with no status, a `skipped` report, and no report at
|
|
52
|
+
* all (the child can end after its `PUT` and before writing the report, and
|
|
53
|
+
* a report that cannot be written is ignored). `pushOutput` is the tail of
|
|
54
|
+
* the push's own output, quoted when there is no report.
|
|
55
|
+
*/
|
|
56
|
+
export declare function archivePushOutcome(report: Db3TypePushReport | null, type: string, pushOutput: string): {
|
|
57
|
+
kind: ArchivePushFailureKind;
|
|
58
|
+
failure: ArchivePushFailure | null;
|
|
59
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure parts of `primitive db3-types archive|unarchive` (#6020): which
|
|
3
|
+
* file declares a type, how its `archived` key is edited, and what a failed
|
|
4
|
+
* push means for the file.
|
|
5
|
+
*
|
|
6
|
+
* The commands edit `[type] archived` in the type's `db3-types/` file and
|
|
7
|
+
* push that one type through `config push`. A push the server refused with
|
|
8
|
+
* an answer (any 4xx) stored nothing, so the file is put back. A push that
|
|
9
|
+
* ended without such an answer (no answer at all, an unreadable one, a 5xx)
|
|
10
|
+
* may have been stored, so the server is read before the file is touched.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
13
|
+
import { basename, join } from "path";
|
|
14
|
+
import { parseRawToml } from "./config-toml.js";
|
|
15
|
+
import { cloneTomlValue } from "./db3-type-models.js";
|
|
16
|
+
import { removeTomlScalar, setTomlScalar } from "./toml-scalar-edit.js";
|
|
17
|
+
/**
|
|
18
|
+
* Classify a failed push: an error carrying an HTTP status from 400 to 499
|
|
19
|
+
* is the server's answer, which stored nothing (`refused`); any other
|
|
20
|
+
* failure — no status (the connection failed, the body could not be read),
|
|
21
|
+
* a 5xx — may follow a stored write (`unknown`).
|
|
22
|
+
*/
|
|
23
|
+
export function archivePushFailureKind(err) {
|
|
24
|
+
const status = err?.statusCode;
|
|
25
|
+
return typeof status === "number" && status >= 400 && status <= 499 ? "refused" : "unknown";
|
|
26
|
+
}
|
|
27
|
+
/** The `db3-types/` file that declares `type`: by its `[type] name`, else by its file name. */
|
|
28
|
+
export function findDb3TypeFile(db3TypesDir, type) {
|
|
29
|
+
if (!existsSync(db3TypesDir))
|
|
30
|
+
return null;
|
|
31
|
+
const files = readdirSync(db3TypesDir).filter((f) => f.endsWith(".toml")).sort();
|
|
32
|
+
let byName = null;
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
try {
|
|
35
|
+
const parsed = parseRawToml(readFileSync(join(db3TypesDir, file), "utf-8"));
|
|
36
|
+
const declared = parsed?.type?.name;
|
|
37
|
+
if (declared === type)
|
|
38
|
+
return { file, filePath: join(db3TypesDir, file) };
|
|
39
|
+
if (declared === undefined && basename(file, ".toml") === type)
|
|
40
|
+
byName = file;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
if (basename(file, ".toml") === type)
|
|
44
|
+
byName = file;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return byName ? { file: byName, filePath: join(db3TypesDir, byName) } : null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The file's text with `[type] archived` set to the asked state: `archived =
|
|
51
|
+
* true` written in place (comments and key order kept), or the line removed,
|
|
52
|
+
* every other byte unchanged.
|
|
53
|
+
*/
|
|
54
|
+
export function withArchivedKey(text, archived) {
|
|
55
|
+
return archived ? setTomlScalar(text, "type.archived", true) : removeTomlScalar(text, "type.archived");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A copy of a parsed `db3-types/` document without `[type] archived`, for
|
|
59
|
+
* comparing everything else the file holds with the server. The copy keeps
|
|
60
|
+
* each TOML date its kind (`cloneTomlValue`, not `structuredClone`): a local
|
|
61
|
+
* date default read back as a plain `Date` compares as a change.
|
|
62
|
+
*/
|
|
63
|
+
export function withoutArchivedKey(document) {
|
|
64
|
+
const copy = cloneTomlValue(document);
|
|
65
|
+
if (copy?.type && typeof copy.type === "object")
|
|
66
|
+
delete copy.type.archived;
|
|
67
|
+
return copy;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* What a `config push` run that did not report `applied` means for the file.
|
|
71
|
+
* Only an answer that settles it is `refused`: a 4xx from the server, or a
|
|
72
|
+
* gate decline before any request. Everything else is `unknown`, the write
|
|
73
|
+
* may have been stored, and the server is read before the file is touched:
|
|
74
|
+
* a 5xx or a failure with no status, a `skipped` report, and no report at
|
|
75
|
+
* all (the child can end after its `PUT` and before writing the report, and
|
|
76
|
+
* a report that cannot be written is ignored). `pushOutput` is the tail of
|
|
77
|
+
* the push's own output, quoted when there is no report.
|
|
78
|
+
*/
|
|
79
|
+
export function archivePushOutcome(report, type, pushOutput) {
|
|
80
|
+
if (report?.outcome === "failed")
|
|
81
|
+
return { kind: archivePushFailureKind(report.failure), failure: report.failure };
|
|
82
|
+
if (report?.outcome === "declined") {
|
|
83
|
+
return {
|
|
84
|
+
kind: "refused",
|
|
85
|
+
failure: {
|
|
86
|
+
message: `config push declined the type (${report.action}): the server's row moved since this tree last read it. ` +
|
|
87
|
+
`Run \`primitive config pull --only db3-type/${type}\`, then run this command again`,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (report?.outcome === "skipped")
|
|
92
|
+
return { kind: "unknown", failure: null };
|
|
93
|
+
return { kind: "unknown", failure: { message: `config push ended without reporting the type:\n${pushOutput}` } };
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=db3-type-archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db3-type-archive.js","sourceRoot":"","sources":["../../../src/lib/db3-type-archive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAKxE;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,MAAM,MAAM,GAAI,GAAmD,EAAE,UAAU,CAAC;IAChF,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,IAAY;IAC/D,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjF,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,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QAAQ,CAAC;IAC3E,OAAO,IAAI,CAAC;AACd,CAAC;AAKD;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAgC,EAChC,IAAY,EACZ,UAAkB;IAElB,IAAI,MAAM,EAAE,OAAO,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IACnH,IAAI,MAAM,EAAE,OAAO,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,OAAO,EACL,kCAAkC,MAAM,CAAC,MAAM,0DAA0D;oBACzG,+CAA+C,IAAI,iCAAiC;aACvF;SACF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,EAAE,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,kDAAkD,UAAU,EAAE,EAAE,EAAE,CAAC;AACnH,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model declared once in `db3-types/`, named by each type that holds it.
|
|
3
|
+
*
|
|
4
|
+
* `[type] models = ["securities"]` in `db3-types/household.toml` names a model
|
|
5
|
+
* declared under `[models.securities]` in another file of the same directory.
|
|
6
|
+
* A directory where some file names a shared model is one model namespace: a
|
|
7
|
+
* model declared the same way in two files is one declaration (the first file
|
|
8
|
+
* by name wins); declared differently, the files are refused naming the model
|
|
9
|
+
* and what differs. A reference to a model no file declares, or to one the
|
|
10
|
+
* file declares itself, is refused too. A directory that names no shared model
|
|
11
|
+
* is read as it always was: each type declares its own models, and two types
|
|
12
|
+
* may hold differently shaped models of one name.
|
|
13
|
+
*
|
|
14
|
+
* The resolved document is the file's own `[models.*]` plus each referenced
|
|
15
|
+
* declaration copied verbatim, with `type.models` removed. Every CLI reader of
|
|
16
|
+
* a type file reads it, so the server receives one whole `schema` per type and
|
|
17
|
+
* never sees the key.
|
|
18
|
+
*
|
|
19
|
+
* A field may also `ref` a shared enum in the `schemas/` directory beside
|
|
20
|
+
* `db3-types/` (#5545): the resolved document holds `type = "string"` and the
|
|
21
|
+
* enum's values where the `ref` was, in every declaration that carries it.
|
|
22
|
+
* In a file with a `[type]` table it may `ref` an object def there too
|
|
23
|
+
* (#5899): a JSON field, stored as canonical JSON text, whose resolved field
|
|
24
|
+
* is `type = "string"` with only `required` beside it. The def is answered
|
|
25
|
+
* beside the document (`jsonFields`), for the generators only.
|
|
26
|
+
*/
|
|
27
|
+
import { type SharedEnumKeys, type SharedEnumRef, type SharedObjectRef } from "js-bao";
|
|
28
|
+
/** One refusal: the sentence, and the files (by name in `db3-types/`) it is about. */
|
|
29
|
+
export interface Db3TypeModelsRefusal {
|
|
30
|
+
files: string[];
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* #5896 — the shared enum each field's `ref` named, by model then field. Codegen only: the expanded document, which
|
|
35
|
+
* push sends, carries no trace of it.
|
|
36
|
+
*/
|
|
37
|
+
export type Db3EnumRefs = Map<string, Map<string, SharedEnumRef>>;
|
|
38
|
+
/** #5899 — the object def each JSON field's `ref` named, by model then field. Codegen only, as `Db3EnumRefs` is. */
|
|
39
|
+
export type Db3JsonFields = Map<string, Map<string, SharedObjectRef>>;
|
|
40
|
+
export interface Db3TypeModelsResolution {
|
|
41
|
+
/** Per file name, the resolved document. A refused file is absent. */
|
|
42
|
+
documents: Map<string, any>;
|
|
43
|
+
refusals: Db3TypeModelsRefusal[];
|
|
44
|
+
/** The files that name at least one shared model, or whose fields ref a shared enum. */
|
|
45
|
+
referencing: Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* #5896 — per resolved file that holds one, each model field that refs a shared enum, with its def; a model the file
|
|
48
|
+
* names through `[type] models` brings the declaring file's.
|
|
49
|
+
*/
|
|
50
|
+
enumRefs: Map<string, Db3EnumRefs>;
|
|
51
|
+
/** #5899 — per resolved file that holds one, each JSON field with its object def, gathered as `enumRefs` is. */
|
|
52
|
+
jsonFields: Map<string, Db3JsonFields>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What a field's shared-enum `ref` resolves against (#5545): the `schemas/`
|
|
56
|
+
* files by stem (`null` when the directory is missing), and the other
|
|
57
|
+
* families' keys by tree stem, as the schema family index names them.
|
|
58
|
+
*/
|
|
59
|
+
export interface Db3TypeContext {
|
|
60
|
+
schemas: Map<string, string> | null;
|
|
61
|
+
keys: SharedEnumKeys;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A deep copy of a parsed TOML value that keeps each date and time its kind.
|
|
65
|
+
* `structuredClone` turns smol-toml's `TomlDate` into a plain `Date`, which
|
|
66
|
+
* writes back as an offset date-time: a shared `default = 2020-01-01` would
|
|
67
|
+
* come out of the referencing type as `2020-01-01T00:00:00.000Z`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function cloneTomlValue<T>(value: T): T;
|
|
70
|
+
/**
|
|
71
|
+
* The shared-enum context of a config tree: `schemas/`, and the keys of
|
|
72
|
+
* `functions/` (declaration files), `prompts/`, and the db3 types of
|
|
73
|
+
* `db3-types/` (`[type] name`) and `database-type-configs/`
|
|
74
|
+
* (`[type] databaseType`), each else by stem. The tree only: a type the
|
|
75
|
+
* server holds and the tree does not is no key here. `db3Types` stands in
|
|
76
|
+
* for the `db3-types/` files on disk (a pull's prospective directory).
|
|
77
|
+
*/
|
|
78
|
+
export declare function readDb3TypeContext(configDir: string, db3Types?: Map<string, string>): Db3TypeContext;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve every file of a `db3-types/` directory, given as parsed documents
|
|
81
|
+
* keyed by file name. Files are read in name order.
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveDb3TypeModelsFrom(parsedFiles: Map<string, any>, context?: Db3TypeContext | (() => Db3TypeContext)): Db3TypeModelsResolution;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a directory given as file contents (the pull's prospective
|
|
86
|
+
* `db3-types/`), field refs against `context`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolveAgainst(prospective: Map<string, string>, context?: Db3TypeContext | (() => Db3TypeContext)): Db3TypeModelsResolution;
|
|
89
|
+
/** The `*.toml` files of a `db3-types/` directory, by name, with their contents. */
|
|
90
|
+
export declare function readDb3TypesDir(db3TypesDir: string): Map<string, string>;
|
|
91
|
+
/** Resolve every file of the `db3-types/` directory on disk, field refs against its tree. */
|
|
92
|
+
export declare function resolveDb3TypeModels(db3TypesDir: string): Db3TypeModelsResolution;
|
|
93
|
+
/**
|
|
94
|
+
* The resolved document of one file of `db3TypesDir`, read as `parsed`. A file
|
|
95
|
+
* naming no shared model and no shared enum, or one the resolution refuses
|
|
96
|
+
* (the preflight reports it), is returned as given.
|
|
97
|
+
*/
|
|
98
|
+
export declare function resolveDb3TypeDocument(db3TypesDir: string, file: string, parsed: any): any;
|
|
99
|
+
/**
|
|
100
|
+
* #5899 — each field of a `database-type-configs/` file whose `ref` names an
|
|
101
|
+
* object def: a JSON field belongs to a db3 type in `db3-types/`, which is the
|
|
102
|
+
* only directory whose refs the CLI expands.
|
|
103
|
+
*/
|
|
104
|
+
export declare function databaseTypeConfigJsonRefusals(configDir: string): Db3TypeModelsRefusal[];
|
|
105
|
+
/** The pull's decision for the reference-form files of `db3-types/`. */
|
|
106
|
+
export interface Db3TypePullPlan {
|
|
107
|
+
/** Local reference-form files whose resolved document reads as the server row: left as they are. */
|
|
108
|
+
keep: Set<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Local reference-form files that do not: written in the full form the
|
|
111
|
+
* server holds, even where the unresolved file would read the same.
|
|
112
|
+
*/
|
|
113
|
+
rewrite: Set<string>;
|
|
114
|
+
/** Notes to print: a rewrite that leaves two differing declarations of one model. */
|
|
115
|
+
notes: string[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Plan `config pull` for the local reference-form files of `db3-types/`.
|
|
119
|
+
*
|
|
120
|
+
* Decided before anything is written, against the prospective directory: the
|
|
121
|
+
* server content of every type the pull writes plus the local content of
|
|
122
|
+
* every other file, less the files the pull's prune removes. The
|
|
123
|
+
* reference-form files are resolved there together,
|
|
124
|
+
* each with its own local content, and kept when each reads the same as its
|
|
125
|
+
* server row (`same`); a file that does not is written in the full form the
|
|
126
|
+
* server holds, and the rest are judged again without it. A rewrite that
|
|
127
|
+
* leaves the tree with two differing declarations of one model is named in a
|
|
128
|
+
* note.
|
|
129
|
+
*/
|
|
130
|
+
export declare function planDb3TypePull(input: {
|
|
131
|
+
/** The local `db3-types/` files, by name. */
|
|
132
|
+
local: Map<string, string>;
|
|
133
|
+
/** The server content of each type this pull writes, by file name. */
|
|
134
|
+
server: Map<string, string>;
|
|
135
|
+
/** Whether a local document reads the same as the server content. */
|
|
136
|
+
same: (serverContent: string, localDocument: any) => boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Local files the pull's prune removes (managed types gone from the
|
|
139
|
+
* server): a declaration they hold is not in the directory the pull leaves.
|
|
140
|
+
*/
|
|
141
|
+
removed?: Iterable<string>;
|
|
142
|
+
/**
|
|
143
|
+
* #5545 — what a field's shared-enum ref resolves against: the tree as the
|
|
144
|
+
* pull leaves it. A function is given the `db3-types/` files the pull leaves,
|
|
145
|
+
* so a type it adds or removes counts as a db3 key.
|
|
146
|
+
*/
|
|
147
|
+
context?: Db3TypeContext | ((db3Types: Map<string, string>) => Db3TypeContext);
|
|
148
|
+
}): Db3TypePullPlan;
|