primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +258 -186
- package/assets/skill/skills/primitive-platform/SKILL.md +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 +138 -44
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -0
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +318 -256
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/comparisons.js +2 -0
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +2 -2
- package/dist/src/commands/config.js +59 -33
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.d.ts +15 -0
- package/dist/src/commands/db3-types.js +159 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +24 -0
- package/dist/src/commands/db3.js +1444 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +110 -10
- package/dist/src/commands/documents.js +1012 -748
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +74 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +8 -4
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +376 -30
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +168 -50
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +7 -5
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +346 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +129 -38
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -53
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +19 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +4 -2
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +41 -0
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -52
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rate-counters.d.ts +19 -0
- package/dist/src/commands/rate-counters.js +104 -0
- package/dist/src/commands/rate-counters.js.map +1 -0
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +2 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.js +47 -3
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/skill.js +2 -0
- package/dist/src/commands/skill.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +518 -546
- package/dist/src/commands/sync.js +3010 -4877
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +5 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transitions.d.ts +54 -0
- package/dist/src/commands/transitions.js +418 -0
- package/dist/src/commands/transitions.js.map +1 -0
- package/dist/src/commands/usage.d.ts +18 -0
- package/dist/src/commands/usage.js +343 -0
- package/dist/src/commands/usage.js.map +1 -0
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +911 -18
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -0
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +1818 -438
- package/dist/src/lib/api-client.js +965 -544
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
- package/dist/src/lib/app-settings-descriptor.js +6 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +34 -1
- package/dist/src/lib/auth-flow.js +429 -13
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +8 -14
- package/dist/src/lib/block-selector.js +8 -19
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +3 -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 +109 -0
- package/dist/src/lib/command-groups.js.map +1 -0
- package/dist/src/lib/command-status.d.ts +147 -0
- package/dist/src/lib/command-status.js +266 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +9 -22
- package/dist/src/lib/config-object-descriptor.js +107 -276
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +3 -7
- package/dist/src/lib/config-surface.js +9 -13
- package/dist/src/lib/config-surface.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/credentials-home.d.ts +7 -0
- package/dist/src/lib/credentials-home.js +45 -10
- package/dist/src/lib/credentials-home.js.map +1 -1
- package/dist/src/lib/credentials-lock.d.ts +14 -6
- package/dist/src/lib/credentials-lock.js +90 -10
- package/dist/src/lib/credentials-lock.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +123 -70
- package/dist/src/lib/credentials-store.js +358 -113
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +38 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +29 -7
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +106 -0
- package/dist/src/lib/db-type-records.js +224 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +287 -0
- package/dist/src/lib/db3-export.js +647 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +116 -0
- package/dist/src/lib/db3-index-output.js +223 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +134 -0
- package/dist/src/lib/db3-type-models.js +452 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/document-ingest-artifact.d.ts +13 -0
- package/dist/src/lib/document-ingest-artifact.js +36 -6
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +11 -1
- package/dist/src/lib/document-ingest.js +16 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +142 -0
- package/dist/src/lib/function-authorize-check.js +311 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +27 -0
- package/dist/src/lib/function-authorize-view.js +88 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +142 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +90 -12
- package/dist/src/lib/function-collect.js +482 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +65 -11
- package/dist/src/lib/function-db-types.js +297 -157
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +57 -0
- package/dist/src/lib/function-lint.js +234 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +13 -21
- package/dist/src/lib/function-run.js +14 -27
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +86 -22
- package/dist/src/lib/function-schema-codegen.js +194 -88
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +109 -6
- package/dist/src/lib/function-sync.js +179 -26
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +174 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-command-status.d.ts +6 -0
- package/dist/src/lib/generated-command-status.js +469 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +538 -141
- package/dist/src/lib/generated-config-surfaces.js +1772 -1854
- 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-wait.d.ts +42 -0
- package/dist/src/lib/hosting-wait.js +84 -0
- package/dist/src/lib/hosting-wait.js.map +1 -0
- package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
- package/dist/src/lib/hosting-wfp-upload.js +149 -0
- package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- package/dist/src/lib/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
- package/dist/src/lib/invoker-shared-enums.js +98 -0
- package/dist/src/lib/invoker-shared-enums.js.map +1 -0
- package/dist/src/lib/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +23 -4
- package/dist/src/lib/log-inspection.js +14 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +17 -7
- package/dist/src/lib/login-scope-lines.js +33 -10
- package/dist/src/lib/login-scope-lines.js.map +1 -1
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +3 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +174 -0
- package/dist/src/lib/primitive-declaration.js +792 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +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/register-commands.d.ts +36 -0
- package/dist/src/lib/register-commands.js +37 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/scope-request.d.ts +23 -11
- package/dist/src/lib/scope-request.js +69 -31
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +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 +45 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +117 -31
- package/dist/src/lib/sync-resource-types.js +197 -189
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +4 -2
- package/dist/src/lib/toml-database-config.js +11 -6
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-scalar-edit.js +6 -4
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/transition-warnings.d.ts +21 -0
- package/dist/src/lib/transition-warnings.js +49 -0
- package/dist/src/lib/transition-warnings.js.map +1 -0
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compiled space (#5544, project `unified-schemas` phase 10): every type
|
|
3
|
+
* name the generated declarations emit, across the five namespaces of
|
|
4
|
+
* `functions/primitive.d.ts` (`Schemas`, `Functions`, `Prompts`, `Db3`,
|
|
5
|
+
* `UserProperties`) and the shared Swift file.
|
|
6
|
+
*
|
|
7
|
+
* A name one party produces is emitted short. Every party to a name two or
|
|
8
|
+
* more parties produce becomes `<Namespace>_<PascalKey>_<Name>`, in both
|
|
9
|
+
* languages: a collision in either language's normalization renames the
|
|
10
|
+
* parties in both, so a reader types the same name in TypeScript and Swift.
|
|
11
|
+
* TypeScript renames inside its namespace too, though the namespace alone
|
|
12
|
+
* would keep two `Money`s apart there, because Swift has no namespaces.
|
|
13
|
+
*
|
|
14
|
+
* A party is a source: a `schemas/` file, a function, a prompt, a db3 model
|
|
15
|
+
* (two db3 types declaring one model identically are one party, by the
|
|
16
|
+
* caller's `identity`), the user properties. A name still produced twice after
|
|
17
|
+
* the rename is reported in `collisions`, with both sources, for the caller
|
|
18
|
+
* to refuse in its own error class.
|
|
19
|
+
*/
|
|
20
|
+
import { pascalCase } from "../db-codegen/dbNaming.js";
|
|
21
|
+
/** The party a name belongs to: its namespace and key, or its identity when it has one. */
|
|
22
|
+
function partyOf(name) {
|
|
23
|
+
return name.identity !== undefined
|
|
24
|
+
? `${name.namespace}\u0000identity\u0000${name.identity}`
|
|
25
|
+
: `${name.namespace}\u0000${name.key}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `<Namespace>_<PascalKey>_<Name>`: the key's alphanumerics PascalCased, the
|
|
29
|
+
* same in both languages. A party one identity joins is named by its first key.
|
|
30
|
+
*/
|
|
31
|
+
function renamed(name, partyKey) {
|
|
32
|
+
return `${name.namespace}_${pascalCase(partyKey)}_${name.suffix}`;
|
|
33
|
+
}
|
|
34
|
+
/** Compute the compiled space; see the module note. Deterministic for any order of `names`. */
|
|
35
|
+
export function compiledSpace(names) {
|
|
36
|
+
const sorted = [...names].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
37
|
+
// Names sharing a short name in either language are joined; a group with two
|
|
38
|
+
// or more parties is a collision, and every name in it is renamed.
|
|
39
|
+
const parent = sorted.map((_, i) => i);
|
|
40
|
+
const find = (i) => (parent[i] === i ? i : (parent[i] = find(parent[i])));
|
|
41
|
+
const join = (a, b) => {
|
|
42
|
+
const ra = find(a);
|
|
43
|
+
const rb = find(b);
|
|
44
|
+
if (ra !== rb)
|
|
45
|
+
parent[Math.max(ra, rb)] = Math.min(ra, rb);
|
|
46
|
+
};
|
|
47
|
+
for (const language of ["ts", "swift"]) {
|
|
48
|
+
const first = new Map();
|
|
49
|
+
sorted.forEach((name, i) => {
|
|
50
|
+
const at = first.get(name.short[language]);
|
|
51
|
+
if (at === undefined)
|
|
52
|
+
first.set(name.short[language], i);
|
|
53
|
+
else
|
|
54
|
+
join(at, i);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const parties = new Map();
|
|
58
|
+
sorted.forEach((name, i) => {
|
|
59
|
+
const root = find(i);
|
|
60
|
+
if (!parties.has(root))
|
|
61
|
+
parties.set(root, new Set());
|
|
62
|
+
parties.get(root).add(partyOf(name));
|
|
63
|
+
});
|
|
64
|
+
const partyKey = new Map();
|
|
65
|
+
for (const name of sorted) {
|
|
66
|
+
const party = partyOf(name);
|
|
67
|
+
const known = partyKey.get(party);
|
|
68
|
+
if (known === undefined || name.key < known)
|
|
69
|
+
partyKey.set(party, name.key);
|
|
70
|
+
}
|
|
71
|
+
const ts = new Map();
|
|
72
|
+
const swift = new Map();
|
|
73
|
+
const renamedIds = new Set();
|
|
74
|
+
sorted.forEach((name, i) => {
|
|
75
|
+
if (parties.get(find(i)).size > 1) {
|
|
76
|
+
const emitted = renamed(name, partyKey.get(partyOf(name)));
|
|
77
|
+
renamedIds.add(name.id);
|
|
78
|
+
ts.set(name.id, emitted);
|
|
79
|
+
swift.set(name.id, emitted);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
ts.set(name.id, name.short.ts);
|
|
83
|
+
swift.set(name.id, name.short.swift);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const survivors = (emitted) => {
|
|
87
|
+
const byName = new Map();
|
|
88
|
+
const out = [];
|
|
89
|
+
for (const name of sorted) {
|
|
90
|
+
const emittedName = emitted.get(name.id);
|
|
91
|
+
const prior = byName.get(emittedName);
|
|
92
|
+
if (prior && partyOf(prior) !== partyOf(name)) {
|
|
93
|
+
out.push({ name: emittedName, sources: [prior.source, name.source] });
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (!prior)
|
|
97
|
+
byName.set(emittedName, name);
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
};
|
|
101
|
+
return { ts, swift, renamed: renamedIds, collisions: { ts: survivors(ts), swift: survivors(swift) } };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=compiledSpace.js.map
|
|
@@ -0,0 +1 @@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onical server module
|
|
5
|
+
* `src/function-runs/db3-bridge.ts` — the SAME interpretation the server
|
|
6
|
+
* applies to a function's schemas. The CLI cannot import server `src/`
|
|
7
|
+
* at runtime, so the CLI imports this committed copy instead.
|
|
8
|
+
*
|
|
9
|
+
* Regenerate with:
|
|
10
|
+
* node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
|
|
11
|
+
*
|
|
12
|
+
* A CI freshness guard
|
|
13
|
+
* (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
|
|
14
|
+
* `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
|
|
15
|
+
* this committed copy does not match the source — see issue #1442 / #998.
|
|
16
|
+
*/
|
|
17
|
+
/** The two projections of a db3 model, in the order messages list them. */
|
|
18
|
+
export declare const DB3_PROJECTIONS: readonly ["row", "declared"];
|
|
19
|
+
/** A projection of a db3 model. */
|
|
20
|
+
export type Db3Projection = (typeof DB3_PROJECTIONS)[number];
|
|
21
|
+
/** A db3 type as the bridge reads it. */
|
|
22
|
+
export interface Db3BridgeType {
|
|
23
|
+
/** The type's name, as a ref spells it. */
|
|
24
|
+
name: string;
|
|
25
|
+
/** The parsed `[models.*]` tables. */
|
|
26
|
+
models: unknown;
|
|
27
|
+
/** The type's `timestamps`: the create and update stamp names, and the models they are limited to. */
|
|
28
|
+
timestamps?: {
|
|
29
|
+
create?: unknown;
|
|
30
|
+
update?: unknown;
|
|
31
|
+
models?: unknown;
|
|
32
|
+
} | null;
|
|
33
|
+
/** The type's `autoPopulatedFields`, by field name. */
|
|
34
|
+
autoPopulatedFields?: Readonly<Record<string, unknown>> | null;
|
|
35
|
+
}
|
|
36
|
+
/** A projected model, or why the model cannot be bridged. */
|
|
37
|
+
export type Db3ProjectionResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
schema: Record<string, unknown>;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
reason: string;
|
|
43
|
+
};
|
|
44
|
+
/** A db3 type as a family index holds it: both projections of every model it can bridge. */
|
|
45
|
+
export interface Db3TypeProjections {
|
|
46
|
+
/** The models the type declares, in declaration order. */
|
|
47
|
+
models: string[];
|
|
48
|
+
/** Each bridged model's projections, keyed `<model>/row` and `<model>/declared`. */
|
|
49
|
+
defs: Record<string, unknown>;
|
|
50
|
+
/** Why a model cannot be bridged, by model. */
|
|
51
|
+
modelErrors?: Record<string, string>;
|
|
52
|
+
/** Why the type cannot be bridged at all. */
|
|
53
|
+
error?: string;
|
|
54
|
+
}
|
|
55
|
+
/** A marker the bridge writes, read back. */
|
|
56
|
+
export interface Db3ProjectionMarker {
|
|
57
|
+
type: string;
|
|
58
|
+
model: string;
|
|
59
|
+
projection: Db3Projection;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The marker a projection carries: the projection's explicit ref,
|
|
63
|
+
* `db3:<type>#/$defs/<model>/<projection>`, the model pointer-escaped.
|
|
64
|
+
*/
|
|
65
|
+
export declare function db3ProjectionMarker(type: string, model: string, projection: Db3Projection): string;
|
|
66
|
+
/** A `$comment` read as a projection marker, or null when it is not one. */
|
|
67
|
+
export declare function parseDb3ProjectionMarker(comment: unknown): Db3ProjectionMarker | null;
|
|
68
|
+
/** The models a type declares, in declaration order; empty when its `models` is not a table. */
|
|
69
|
+
export declare function db3ModelNames(type: Db3BridgeType): string[];
|
|
70
|
+
/**
|
|
71
|
+
* One projection of one model of `type`. Refuses a model the type does not
|
|
72
|
+
* declare (listing the ones it does), a model that is not a table, and a
|
|
73
|
+
* field the field grammar refuses (naming the field and the grammar's reason).
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* db3ModelProjection({ name: "workspace", models: { tasks: { fields: { title: { type: "string", required: true } } } } }, "tasks", "declared");
|
|
77
|
+
* // → { ok: true, schema: { type: "object", properties: { title: { type: "string" } }, required: ["title"],
|
|
78
|
+
* // additionalProperties: false, $comment: "db3:workspace#/$defs/tasks/declared" } }
|
|
79
|
+
*/
|
|
80
|
+
export declare function db3ModelProjection(type: Db3BridgeType, model: string, projection: Db3Projection): Db3ProjectionResult;
|
|
81
|
+
/**
|
|
82
|
+
* Both projections of every model of `type`, as a family index's db3 slot
|
|
83
|
+
* holds them. A model that cannot be bridged keeps its reason, so a ref to it
|
|
84
|
+
* is refused naming it; a type whose `models` is not a table has none.
|
|
85
|
+
*/
|
|
86
|
+
export declare function db3TypeProjections(type: Db3BridgeType): Db3TypeProjections;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from the canonical server module
|
|
5
|
+
* `src/function-runs/db3-bridge.ts` — the SAME interpretation the server
|
|
6
|
+
* applies to a function's schemas. The CLI cannot import server `src/`
|
|
7
|
+
* at runtime, so the CLI imports this committed copy instead.
|
|
8
|
+
*
|
|
9
|
+
* Regenerate with:
|
|
10
|
+
* node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
|
|
11
|
+
*
|
|
12
|
+
* A CI freshness guard
|
|
13
|
+
* (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
|
|
14
|
+
* `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
|
|
15
|
+
* this committed copy does not match the source — see issue #1442 / #998.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The db3 bridge: a db3 type's model as a JSON Schema a function, prompt or
|
|
19
|
+
* agent schema can `ref`.
|
|
20
|
+
*
|
|
21
|
+
* A model has two projections:
|
|
22
|
+
*
|
|
23
|
+
* - **declared**: the fields the model declares, in declaration order, with
|
|
24
|
+
* the storage keys stripped (`FIELD_KEYS` rows with `storage: true`), and
|
|
25
|
+
* `additionalProperties: false`. A field is required when it says
|
|
26
|
+
* `required = true` and is neither auto-assigned, stamped nor defaulted,
|
|
27
|
+
* because the room fills those itself.
|
|
28
|
+
* - **row**: the declared fields plus `id` and the type's stamps (each
|
|
29
|
+
* timestamp in the model's scope, a required `number` unless the model
|
|
30
|
+
* declares it; each auto-populated field, an optional `string`), open.
|
|
31
|
+
* Auto-assigned and stamped fields are required: the room writes them on
|
|
32
|
+
* every row. A defaulted field is optional, as in declared: the room
|
|
33
|
+
* applies a default only when a row is created and no read fills one, so
|
|
34
|
+
* a stored row may lack it.
|
|
35
|
+
*
|
|
36
|
+
* Every field maps as `primitive.d.ts`'s `Db3` namespace renders it: `string`,
|
|
37
|
+
* `id` and `date` to strings, `stringset` to an array of strings, `vector` to
|
|
38
|
+
* its stored base64 string, `enum` to `enum`. Each projection's root carries its
|
|
39
|
+
* marker in `$comment` (`db3:<type>#/$defs/<model>/<projection>`), which the
|
|
40
|
+
* validator names in its messages and the generated hovers render.
|
|
41
|
+
*
|
|
42
|
+
* Field tables are read through the shared field grammar's model context, so
|
|
43
|
+
* a model the db3 loader reads is one the bridge reads identically. A key the
|
|
44
|
+
* model context does not know is ignored, as the room's reader ignores it.
|
|
45
|
+
*
|
|
46
|
+
* Pure, importing only the field grammar, so the CLI vendors it
|
|
47
|
+
* (`cli/scripts/gen-schema-descriptor.mjs`) and the server and the CLI bridge
|
|
48
|
+
* a type to the same bytes.
|
|
49
|
+
*/
|
|
50
|
+
import { fieldProblemMessage, readFieldTable } from "./generated-field-grammar.js";
|
|
51
|
+
/** The two projections of a db3 model, in the order messages list them. */
|
|
52
|
+
export const DB3_PROJECTIONS = Object.freeze(["row", "declared"]);
|
|
53
|
+
const isTable = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
|
|
54
|
+
/** Set `key` as an own data property, so a field named `__proto__` stays a field. */
|
|
55
|
+
function setOwn(target, key, value) {
|
|
56
|
+
Object.defineProperty(target, key, { value, enumerable: true, writable: true, configurable: true });
|
|
57
|
+
}
|
|
58
|
+
function pointerSegment(segment) {
|
|
59
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The marker a projection carries: the projection's explicit ref,
|
|
63
|
+
* `db3:<type>#/$defs/<model>/<projection>`, the model pointer-escaped.
|
|
64
|
+
*/
|
|
65
|
+
export function db3ProjectionMarker(type, model, projection) {
|
|
66
|
+
return `db3:${type}#/$defs/${pointerSegment(model)}/${projection}`;
|
|
67
|
+
}
|
|
68
|
+
/** A `$comment` read as a projection marker, or null when it is not one. */
|
|
69
|
+
export function parseDb3ProjectionMarker(comment) {
|
|
70
|
+
if (typeof comment !== "string" || !comment.startsWith("db3:"))
|
|
71
|
+
return null;
|
|
72
|
+
const hash = comment.indexOf("#/$defs/");
|
|
73
|
+
if (hash <= "db3:".length)
|
|
74
|
+
return null;
|
|
75
|
+
const rest = comment.slice(hash + "#/$defs/".length);
|
|
76
|
+
const slash = rest.lastIndexOf("/");
|
|
77
|
+
if (slash <= 0)
|
|
78
|
+
return null;
|
|
79
|
+
const projection = rest.slice(slash + 1);
|
|
80
|
+
if (projection !== "row" && projection !== "declared")
|
|
81
|
+
return null;
|
|
82
|
+
const model = rest
|
|
83
|
+
.slice(0, slash)
|
|
84
|
+
.split("/")
|
|
85
|
+
.map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"))
|
|
86
|
+
.join("/");
|
|
87
|
+
return { type: comment.slice("db3:".length, hash), model, projection };
|
|
88
|
+
}
|
|
89
|
+
/** The models a type declares, in declaration order; empty when its `models` is not a table. */
|
|
90
|
+
export function db3ModelNames(type) {
|
|
91
|
+
return isTable(type.models) ? Object.keys(type.models) : [];
|
|
92
|
+
}
|
|
93
|
+
/** The type's timestamp names, and whether `model` is in their scope. */
|
|
94
|
+
function timestampsFor(type, model) {
|
|
95
|
+
const stamps = isTable(type.timestamps) ? type.timestamps : {};
|
|
96
|
+
const names = [stamps.create, stamps.update].filter((name) => typeof name === "string" && name !== "");
|
|
97
|
+
const scope = Array.isArray(stamps.models) ? stamps.models.filter((name) => typeof name === "string") : null;
|
|
98
|
+
return { names: [...new Set(names)], inScope: scope === null || scope.includes(model) };
|
|
99
|
+
}
|
|
100
|
+
const positiveInteger = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
101
|
+
/** One declared field as JSON Schema. */
|
|
102
|
+
function fieldSchema(decl) {
|
|
103
|
+
const schema = {};
|
|
104
|
+
switch (decl.type) {
|
|
105
|
+
case "number":
|
|
106
|
+
schema.type = "number";
|
|
107
|
+
break;
|
|
108
|
+
case "boolean":
|
|
109
|
+
schema.type = "boolean";
|
|
110
|
+
break;
|
|
111
|
+
case "stringset": {
|
|
112
|
+
const items = { type: "string" };
|
|
113
|
+
if (positiveInteger(decl.maxLength))
|
|
114
|
+
items.maxLength = decl.maxLength;
|
|
115
|
+
schema.type = "array";
|
|
116
|
+
schema.items = items;
|
|
117
|
+
if (positiveInteger(decl.maxCount))
|
|
118
|
+
schema.maxItems = decl.maxCount;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case "vector":
|
|
122
|
+
schema.type = "string";
|
|
123
|
+
schema.description = `A vector of ${decl.dims} × ${decl.element}, as its stored base64`;
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
schema.type = "string";
|
|
127
|
+
if (decl.enum)
|
|
128
|
+
schema.enum = [...decl.enum];
|
|
129
|
+
if (positiveInteger(decl.maxLength))
|
|
130
|
+
schema.maxLength = decl.maxLength;
|
|
131
|
+
}
|
|
132
|
+
if (decl.default !== undefined)
|
|
133
|
+
schema.default = decl.default;
|
|
134
|
+
return schema;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* One projection of one model of `type`. Refuses a model the type does not
|
|
138
|
+
* declare (listing the ones it does), a model that is not a table, and a
|
|
139
|
+
* field the field grammar refuses (naming the field and the grammar's reason).
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* db3ModelProjection({ name: "workspace", models: { tasks: { fields: { title: { type: "string", required: true } } } } }, "tasks", "declared");
|
|
143
|
+
* // → { ok: true, schema: { type: "object", properties: { title: { type: "string" } }, required: ["title"],
|
|
144
|
+
* // additionalProperties: false, $comment: "db3:workspace#/$defs/tasks/declared" } }
|
|
145
|
+
*/
|
|
146
|
+
export function db3ModelProjection(type, model, projection) {
|
|
147
|
+
const models = db3ModelNames(type);
|
|
148
|
+
if (!models.includes(model)) {
|
|
149
|
+
const declared = models.length > 0 ? `it declares ${models.join(", ")}` : "it declares no models";
|
|
150
|
+
return { ok: false, reason: `db3 type ${type.name} declares no model ${model} (${declared})` };
|
|
151
|
+
}
|
|
152
|
+
const table = type.models[model];
|
|
153
|
+
if (!isTable(table))
|
|
154
|
+
return { ok: false, reason: `model ${model} is not a table` };
|
|
155
|
+
const fields = table.fields === undefined ? {} : table.fields;
|
|
156
|
+
if (!isTable(fields))
|
|
157
|
+
return { ok: false, reason: `the fields of model ${model} are not a table` };
|
|
158
|
+
const stamps = timestampsFor(type, model);
|
|
159
|
+
const stampedInScope = new Set(stamps.inScope ? stamps.names : []);
|
|
160
|
+
const properties = {};
|
|
161
|
+
const required = [];
|
|
162
|
+
const row = projection === "row";
|
|
163
|
+
if (row && !Object.prototype.hasOwnProperty.call(fields, "id")) {
|
|
164
|
+
setOwn(properties, "id", { type: "string" });
|
|
165
|
+
required.push("id");
|
|
166
|
+
}
|
|
167
|
+
for (const [name, raw] of Object.entries(fields)) {
|
|
168
|
+
const { decl, problems } = readFieldTable(raw, "model");
|
|
169
|
+
const problem = problems.find((found) => found.code !== "unknown-key");
|
|
170
|
+
if (!decl || problem)
|
|
171
|
+
return { ok: false, reason: `field ${name}: ${problem ? fieldProblemMessage(problem) : "it declares no type"}` };
|
|
172
|
+
setOwn(properties, name, fieldSchema(decl));
|
|
173
|
+
// The room writes an auto-assigned or stamped field on every row. A
|
|
174
|
+
// default it applies only on create, and no read fills one, so a stored
|
|
175
|
+
// row may lack a defaulted field: optional in both projections (#5894).
|
|
176
|
+
const written = decl.autoAssign === true || decl.autoStamp !== undefined || stampedInScope.has(name);
|
|
177
|
+
const defaulted = decl.default !== undefined;
|
|
178
|
+
if (row ? written || name === "id" || (decl.required === true && !defaulted) : decl.required === true && !written && !defaulted)
|
|
179
|
+
required.push(name);
|
|
180
|
+
}
|
|
181
|
+
if (row) {
|
|
182
|
+
const autoPopulated = isTable(type.autoPopulatedFields) ? Object.keys(type.autoPopulatedFields) : [];
|
|
183
|
+
for (const name of [...new Set([...stamps.names, ...autoPopulated])].sort()) {
|
|
184
|
+
if (Object.prototype.hasOwnProperty.call(properties, name))
|
|
185
|
+
continue;
|
|
186
|
+
if (stampedInScope.has(name)) {
|
|
187
|
+
setOwn(properties, name, { type: "number" });
|
|
188
|
+
required.push(name);
|
|
189
|
+
}
|
|
190
|
+
else if (autoPopulated.includes(name)) {
|
|
191
|
+
setOwn(properties, name, { type: "string" });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const schema = { type: "object", properties };
|
|
196
|
+
if (required.length > 0)
|
|
197
|
+
schema.required = required;
|
|
198
|
+
if (!row)
|
|
199
|
+
schema.additionalProperties = false;
|
|
200
|
+
schema.$comment = db3ProjectionMarker(type.name, model, projection);
|
|
201
|
+
// Plain JSON, as a stored schema is: a TOML date default becomes its ISO string.
|
|
202
|
+
return { ok: true, schema: JSON.parse(JSON.stringify(schema)) };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Both projections of every model of `type`, as a family index's db3 slot
|
|
206
|
+
* holds them. A model that cannot be bridged keeps its reason, so a ref to it
|
|
207
|
+
* is refused naming it; a type whose `models` is not a table has none.
|
|
208
|
+
*/
|
|
209
|
+
export function db3TypeProjections(type) {
|
|
210
|
+
if (!isTable(type.models))
|
|
211
|
+
return { models: [], defs: {}, error: "it declares no models" };
|
|
212
|
+
const models = db3ModelNames(type);
|
|
213
|
+
const defs = {};
|
|
214
|
+
const modelErrors = {};
|
|
215
|
+
for (const model of models) {
|
|
216
|
+
const row = db3ModelProjection(type, model, "row");
|
|
217
|
+
const declared = db3ModelProjection(type, model, "declared");
|
|
218
|
+
if ("reason" in row || "reason" in declared) {
|
|
219
|
+
setOwn(modelErrors, model, "reason" in row ? row.reason : declared.reason);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
setOwn(defs, `${model}/row`, row.schema);
|
|
223
|
+
setOwn(defs, `${model}/declared`, declared.schema);
|
|
224
|
+
}
|
|
225
|
+
return { models, defs, ...(Object.keys(modelErrors).length > 0 ? { modelErrors } : {}) };
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=generated-db3-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-db3-bridge.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/generated-db3-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAkB,MAAM,8BAA8B,CAAC;AAEnG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,UAAU,CAAU,CAAC,CAAC;AAuC3E,MAAM,OAAO,GAAG,CAAC,KAAc,EAAoC,EAAE,CACnE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC;AAEnG,qFAAqF;AACrF,SAAS,MAAM,CAAC,MAA+B,EAAE,GAAW,EAAE,KAAc;IAC1E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACtG,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,C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,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from the canonical server module
|
|
5
|
+
* `src/function-runs/db3-query-capabilities.ts` — the SAME interpretation the server
|
|
6
|
+
* applies to a function's schemas. The CLI cannot import server `src/`
|
|
7
|
+
* at runtime, so the CLI imports this committed copy instead.
|
|
8
|
+
*
|
|
9
|
+
* Regenerate with:
|
|
10
|
+
* node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
|
|
11
|
+
*
|
|
12
|
+
* A CI freshness guard
|
|
13
|
+
* (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
|
|
14
|
+
* `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
|
|
15
|
+
* this committed copy does not match the source — see issue #1442 / #998.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The db3 query capability manifest: which filter operators, and which
|
|
19
|
+
* values, each declared db3 field kind takes.
|
|
20
|
+
*
|
|
21
|
+
* It states what `JsonQueryTranslator`'s schema-aware mode accepts under the
|
|
22
|
+
* room's options (`ROOM_TRANSLATOR_OPTIONS`: set arrays read from `_data`, so
|
|
23
|
+
* `$all` and `$size` are answered on every kind). The room itself builds its
|
|
24
|
+
* translator with no schema and never refuses a filter by kind; the generated
|
|
25
|
+
* `Db3.<Model>Filter` types read this table, so they are narrower than the
|
|
26
|
+
* room on purpose and constrain declared fields only.
|
|
27
|
+
*
|
|
28
|
+
* Two places the types differ from the translator, both recorded here:
|
|
29
|
+
*
|
|
30
|
+
* - a `date` field's string is not parsed at the type level (wider: any
|
|
31
|
+
* string typechecks, the translator refuses one `Date.parse` cannot read);
|
|
32
|
+
* - a `stringset` or `vector` field's `"scalar"` value is a string, number,
|
|
33
|
+
* boolean or `Date` (narrower: the translator passes an object under
|
|
34
|
+
* `$eq`, which SQLite cannot bind).
|
|
35
|
+
*
|
|
36
|
+
* `tests/unit/workflows/db3-query-capabilities-5546.test.ts` derives the
|
|
37
|
+
* table from the real translator and fails when either side moves.
|
|
38
|
+
*
|
|
39
|
+
* Pure, importing nothing, so the CLI vendors it
|
|
40
|
+
* (`cli/scripts/gen-schema-descriptor.mjs`).
|
|
41
|
+
*/
|
|
42
|
+
/** The db3 field kinds, in the field grammar's order (`FIELD_TYPES`). */
|
|
43
|
+
export declare const DB3_FIELD_KINDS: readonly ["string", "number", "boolean", "date", "id", "stringset", "vector"];
|
|
44
|
+
/** A db3 field kind: a field's TOML `type`. */
|
|
45
|
+
export type Db3FieldKind = (typeof DB3_FIELD_KINDS)[number];
|
|
46
|
+
/**
|
|
47
|
+
* The value an operator takes:
|
|
48
|
+
*
|
|
49
|
+
* - `field`: one value of the field's kind (`DB3_QUERY_VALUE_KINDS`), or `null`;
|
|
50
|
+
* - `field-list`: an array of those, `null` members included;
|
|
51
|
+
* - `boolean`, `string`: a value of that type;
|
|
52
|
+
* - `string-list`: an array of strings;
|
|
53
|
+
* - `size`: a number, or `{ $eq, $ne, $gt, $gte, $lt, $lte }` with numbers.
|
|
54
|
+
*/
|
|
55
|
+
export type Db3QueryOperatorValue = "field" | "field-list" | "boolean" | "string" | "string-list" | "size";
|
|
56
|
+
/** One field operator the translator knows. */
|
|
57
|
+
export interface Db3QueryOperator {
|
|
58
|
+
operator: string;
|
|
59
|
+
/** The kinds the operator applies to: every kind, or the listed ones. */
|
|
60
|
+
kinds: "all" | readonly Db3FieldKind[];
|
|
61
|
+
value: Db3QueryOperatorValue;
|
|
62
|
+
/** `substring`: at most one operator of the group per field. */
|
|
63
|
+
exclusive?: "substring";
|
|
64
|
+
}
|
|
65
|
+
/** Every field operator, in the order the docs table lists them. */
|
|
66
|
+
export declare const DB3_QUERY_OPERATORS: readonly Db3QueryOperator[];
|
|
67
|
+
/**
|
|
68
|
+
* The value of a field's kind under equality, as a member of `$in`/`$nin` and
|
|
69
|
+
* under a range operator: a string, a number, a boolean, a date (a `Date` or a
|
|
70
|
+
* string), or any scalar. `null` is accepted for every kind.
|
|
71
|
+
*/
|
|
72
|
+
export type Db3QueryValueKind = "string" | "number" | "boolean" | "date" | "scalar";
|
|
73
|
+
/** Each kind's value. */
|
|
74
|
+
export declare const DB3_QUERY_VALUE_KINDS: Readonly<Record<Db3FieldKind, Db3QueryValueKind>>;
|
|
75
|
+
/** What one kind takes: its value and its operators, in `DB3_QUERY_OPERATORS` order. */
|
|
76
|
+
export interface Db3KindCapabilities {
|
|
77
|
+
value: Db3QueryValueKind;
|
|
78
|
+
operators: readonly string[];
|
|
79
|
+
}
|
|
80
|
+
/** The per-kind view of the two tables above. */
|
|
81
|
+
export declare const DB3_QUERY_CAPABILITIES: Readonly<Record<Db3FieldKind, Db3KindCapabilities>>;
|
|
82
|
+
/** The logical operators: arrays of filters, at any depth. */
|
|
83
|
+
export declare const DB3_QUERY_LOGICAL_OPERATORS: readonly ["$and", "$or"];
|
|
84
|
+
/** The operators a filter takes at its top level only: text search and nearest neighbours. */
|
|
85
|
+
export declare const DB3_QUERY_TOP_LEVEL_OPERATORS: readonly ["$search", "$near"];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from the canonical server module
|
|
5
|
+
* `src/function-runs/db3-query-capabilities.ts` — the SAME interpretation the server
|
|
6
|
+
* applies to a function's schemas. The CLI cannot import server `src/`
|
|
7
|
+
* at runtime, so the CLI imports this committed copy instead.
|
|
8
|
+
*
|
|
9
|
+
* Regenerate with:
|
|
10
|
+
* node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
|
|
11
|
+
*
|
|
12
|
+
* A CI freshness guard
|
|
13
|
+
* (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
|
|
14
|
+
* `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
|
|
15
|
+
* this committed copy does not match the source — see issue #1442 / #998.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The db3 query capability manifest: which filter operators, and which
|
|
19
|
+
* values, each declared db3 field kind takes.
|
|
20
|
+
*
|
|
21
|
+
* It states what `JsonQueryTranslator`'s schema-aware mode accepts under the
|
|
22
|
+
* room's options (`ROOM_TRANSLATOR_OPTIONS`: set arrays read from `_data`, so
|
|
23
|
+
* `$all` and `$size` are answered on every kind). The room itself builds its
|
|
24
|
+
* translator with no schema and never refuses a filter by kind; the generated
|
|
25
|
+
* `Db3.<Model>Filter` types read this table, so they are narrower than the
|
|
26
|
+
* room on purpose and constrain declared fields only.
|
|
27
|
+
*
|
|
28
|
+
* Two places the types differ from the translator, both recorded here:
|
|
29
|
+
*
|
|
30
|
+
* - a `date` field's string is not parsed at the type level (wider: any
|
|
31
|
+
* string typechecks, the translator refuses one `Date.parse` cannot read);
|
|
32
|
+
* - a `stringset` or `vector` field's `"scalar"` value is a string, number,
|
|
33
|
+
* boolean or `Date` (narrower: the translator passes an object under
|
|
34
|
+
* `$eq`, which SQLite cannot bind).
|
|
35
|
+
*
|
|
36
|
+
* `tests/unit/workflows/db3-query-capabilities-5546.test.ts` derives the
|
|
37
|
+
* table from the real translator and fails when either side moves.
|
|
38
|
+
*
|
|
39
|
+
* Pure, importing nothing, so the CLI vendors it
|
|
40
|
+
* (`cli/scripts/gen-schema-descriptor.mjs`).
|
|
41
|
+
*/
|
|
42
|
+
/** The db3 field kinds, in the field grammar's order (`FIELD_TYPES`). */
|
|
43
|
+
export const DB3_FIELD_KINDS = Object.freeze(["string", "number", "boolean", "date", "id", "stringset", "vector"]);
|
|
44
|
+
const RANGE_KINDS = Object.freeze(["id", "string", "number", "date"]);
|
|
45
|
+
const SUBSTRING_KINDS = Object.freeze(["string", "stringset"]);
|
|
46
|
+
/** Every field operator, in the order the docs table lists them. */
|
|
47
|
+
export const DB3_QUERY_OPERATORS = Object.freeze([
|
|
48
|
+
{ operator: "$eq", kinds: "all", value: "field" },
|
|
49
|
+
{ operator: "$ne", kinds: "all", value: "field" },
|
|
50
|
+
{ operator: "$in", kinds: "all", value: "field-list" },
|
|
51
|
+
{ operator: "$nin", kinds: "all", value: "field-list" },
|
|
52
|
+
{ operator: "$exists", kinds: "all", value: "boolean" },
|
|
53
|
+
{ operator: "$gt", kinds: RANGE_KINDS, value: "field" },
|
|
54
|
+
{ operator: "$gte", kinds: RANGE_KINDS, value: "field" },
|
|
55
|
+
{ operator: "$lt", kinds: RANGE_KINDS, value: "field" },
|
|
56
|
+
{ operator: "$lte", kinds: RANGE_KINDS, value: "field" },
|
|
57
|
+
{ operator: "$startsWith", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
|
|
58
|
+
{ operator: "$endsWith", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
|
|
59
|
+
{ operator: "$containsText", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
|
|
60
|
+
{ operator: "$contains", kinds: ["stringset"], value: "string" },
|
|
61
|
+
{ operator: "$all", kinds: "all", value: "string-list" },
|
|
62
|
+
{ operator: "$size", kinds: "all", value: "size" },
|
|
63
|
+
]);
|
|
64
|
+
/** Each kind's value. */
|
|
65
|
+
export const DB3_QUERY_VALUE_KINDS = Object.freeze({
|
|
66
|
+
string: "string",
|
|
67
|
+
number: "number",
|
|
68
|
+
boolean: "boolean",
|
|
69
|
+
date: "date",
|
|
70
|
+
id: "string",
|
|
71
|
+
stringset: "scalar",
|
|
72
|
+
vector: "scalar",
|
|
73
|
+
});
|
|
74
|
+
/** The per-kind view of the two tables above. */
|
|
75
|
+
export const DB3_QUERY_CAPABILITIES = Object.freeze(Object.fromEntries(DB3_FIELD_KINDS.map((kind) => [
|
|
76
|
+
kind,
|
|
77
|
+
Object.freeze({
|
|
78
|
+
value: DB3_QUERY_VALUE_KINDS[kind],
|
|
79
|
+
operators: Object.freeze(DB3_QUERY_OPERATORS.filter((row) => row.kinds === "all" || row.kinds.includes(kind)).map((row) => row.operator)),
|
|
80
|
+
}),
|
|
81
|
+
])));
|
|
82
|
+
/** The logical operators: arrays of filters, at any depth. */
|
|
83
|
+
export const DB3_QUERY_LOGICAL_OPERATORS = Object.freeze(["$and", "$or"]);
|
|
84
|
+
/** The operators a filter takes at its top level only: text search and nearest neighbours. */
|
|
85
|
+
export const DB3_QUERY_TOP_LEVEL_OPERATORS = Object.freeze(["$search", "$near"]);
|
|
86
|
+
//# sourceMappingURL=generated-db3-query-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-db3-query-capabilities.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/generated-db3-query-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC,CAAC;AA0B5H,MAAM,WAAW,GAA4B,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC,CAAC;AACxG,MAAM,eAAe,GAA4B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAU,CAAC,CAAC;AAEjG,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC5E,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EA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