@opensaas/stack-core 0.43.0 → 0.44.0-alpha.2
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/CHANGELOG.md +2753 -0
- package/README.md +182 -115
- package/dist/.build-hash +1 -0
- package/dist/access/declared-dependencies.d.ts +102 -88
- package/dist/access/declared-dependencies.d.ts.map +1 -1
- package/dist/access/declared-dependencies.js +83 -71
- package/dist/access/declared-dependencies.js.map +1 -1
- package/dist/access/depth-limits.d.ts +4 -0
- package/dist/access/depth-limits.d.ts.map +1 -1
- package/dist/access/depth-limits.js +4 -0
- package/dist/access/depth-limits.js.map +1 -1
- package/dist/access/engine.d.ts +68 -20
- package/dist/access/engine.d.ts.map +1 -1
- package/dist/access/engine.js +151 -37
- package/dist/access/engine.js.map +1 -1
- package/dist/access/errors.d.ts +33 -48
- package/dist/access/errors.d.ts.map +1 -1
- package/dist/access/errors.js +73 -63
- package/dist/access/errors.js.map +1 -1
- package/dist/access/field-access.d.ts +76 -5
- package/dist/access/field-access.d.ts.map +1 -1
- package/dist/access/field-access.js +235 -61
- package/dist/access/field-access.js.map +1 -1
- package/dist/access/field-visibility.d.ts +50 -4
- package/dist/access/field-visibility.d.ts.map +1 -1
- package/dist/access/field-visibility.js +143 -160
- package/dist/access/field-visibility.js.map +1 -1
- package/dist/access/index.d.ts +5 -12
- package/dist/access/index.d.ts.map +1 -1
- package/dist/access/index.js +6 -19
- package/dist/access/index.js.map +1 -1
- package/dist/access/orm-client.d.ts +19 -0
- package/dist/access/orm-client.d.ts.map +1 -0
- package/dist/access/orm-client.js +37 -0
- package/dist/access/orm-client.js.map +1 -0
- package/dist/access/query-validation.d.ts +7 -129
- package/dist/access/query-validation.d.ts.map +1 -1
- package/dist/access/query-validation.js +12 -314
- package/dist/access/query-validation.js.map +1 -1
- package/dist/access/system-fields.d.ts +2 -0
- package/dist/access/system-fields.d.ts.map +1 -0
- package/dist/access/system-fields.js +7 -0
- package/dist/access/system-fields.js.map +1 -0
- package/dist/access/transaction-registry.d.ts +25 -2
- package/dist/access/transaction-registry.d.ts.map +1 -1
- package/dist/access/transaction-registry.js +34 -17
- package/dist/access/transaction-registry.js.map +1 -1
- package/dist/access/types.d.ts +217 -131
- package/dist/access/types.d.ts.map +1 -1
- package/dist/config/field-kind.d.ts +66 -0
- package/dist/config/field-kind.d.ts.map +1 -0
- package/dist/config/field-kind.js +63 -0
- package/dist/config/field-kind.js.map +1 -0
- package/dist/config/hook-only-fields.d.ts +3 -0
- package/dist/config/hook-only-fields.d.ts.map +1 -0
- package/dist/config/hook-only-fields.js +17 -0
- package/dist/config/hook-only-fields.js.map +1 -0
- package/dist/config/index.d.ts +3 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +6 -3
- package/dist/config/index.js.map +1 -1
- package/dist/config/mcp-tool-names.d.ts +3 -0
- package/dist/config/mcp-tool-names.d.ts.map +1 -0
- package/dist/config/mcp-tool-names.js +25 -0
- package/dist/config/mcp-tool-names.js.map +1 -0
- package/dist/config/nav-count.d.ts.map +1 -1
- package/dist/config/nav-count.js +4 -4
- package/dist/config/nav-count.js.map +1 -1
- package/dist/config/plugin-engine.d.ts +8 -2
- package/dist/config/plugin-engine.d.ts.map +1 -1
- package/dist/config/plugin-engine.js +102 -38
- package/dist/config/plugin-engine.js.map +1 -1
- package/dist/config/types.d.ts +1035 -611
- package/dist/config/types.d.ts.map +1 -1
- package/dist/context/apply-defaults.d.ts +18 -1
- package/dist/context/apply-defaults.d.ts.map +1 -1
- package/dist/context/apply-defaults.js +30 -4
- package/dist/context/apply-defaults.js.map +1 -1
- package/dist/context/engine-context.d.ts +73 -0
- package/dist/context/engine-context.d.ts.map +1 -0
- package/dist/context/engine-context.js +67 -0
- package/dist/context/engine-context.js.map +1 -0
- package/dist/context/hook-pipeline.d.ts +9 -2
- package/dist/context/hook-pipeline.d.ts.map +1 -1
- package/dist/context/hook-pipeline.js +5 -4
- package/dist/context/hook-pipeline.js.map +1 -1
- package/dist/context/index.d.ts +98 -89
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +917 -722
- package/dist/context/index.js.map +1 -1
- package/dist/context/junction.d.ts +59 -0
- package/dist/context/junction.d.ts.map +1 -0
- package/dist/context/junction.js +126 -0
- package/dist/context/junction.js.map +1 -0
- package/dist/context/plugin-field-read.d.ts +33 -0
- package/dist/context/plugin-field-read.d.ts.map +1 -0
- package/dist/context/plugin-field-read.js +41 -0
- package/dist/context/plugin-field-read.js.map +1 -0
- package/dist/context/plugin-field-write.d.ts +104 -0
- package/dist/context/plugin-field-write.d.ts.map +1 -0
- package/dist/context/plugin-field-write.js +184 -0
- package/dist/context/plugin-field-write.js.map +1 -0
- package/dist/context/relationship-input.d.ts +146 -0
- package/dist/context/relationship-input.d.ts.map +1 -0
- package/dist/context/relationship-input.js +453 -0
- package/dist/context/relationship-input.js.map +1 -0
- package/dist/context/transaction-boundary.d.ts +54 -28
- package/dist/context/transaction-boundary.d.ts.map +1 -1
- package/dist/context/transaction-boundary.js +87 -169
- package/dist/context/transaction-boundary.js.map +1 -1
- package/dist/context/write-pipeline.d.ts +33 -51
- package/dist/context/write-pipeline.d.ts.map +1 -1
- package/dist/context/write-pipeline.js +372 -185
- package/dist/context/write-pipeline.js.map +1 -1
- package/dist/contract/dependencies.d.ts +88 -0
- package/dist/contract/dependencies.d.ts.map +1 -0
- package/dist/contract/dependencies.js +237 -0
- package/dist/contract/dependencies.js.map +1 -0
- package/dist/contract/derive.d.ts +49 -0
- package/dist/contract/derive.d.ts.map +1 -0
- package/dist/contract/derive.js +629 -0
- package/dist/contract/derive.js.map +1 -0
- package/dist/contract/fixtures/contract-configs.d.ts +64 -0
- package/dist/contract/fixtures/contract-configs.d.ts.map +1 -0
- package/dist/contract/fixtures/contract-configs.js +345 -0
- package/dist/contract/fixtures/contract-configs.js.map +1 -0
- package/dist/contract/id-boundary.d.ts +53 -0
- package/dist/contract/id-boundary.d.ts.map +1 -0
- package/dist/contract/id-boundary.js +76 -0
- package/dist/contract/id-boundary.js.map +1 -0
- package/dist/contract/index.d.ts +8 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +11 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/prisma.d.ts +58 -0
- package/dist/contract/prisma.d.ts.map +1 -0
- package/dist/contract/prisma.js +294 -0
- package/dist/contract/prisma.js.map +1 -0
- package/dist/contract/relation-graph.d.ts +70 -0
- package/dist/contract/relation-graph.d.ts.map +1 -0
- package/dist/contract/relation-graph.js +113 -0
- package/dist/contract/relation-graph.js.map +1 -0
- package/dist/contract/types.d.ts +153 -0
- package/dist/contract/types.d.ts.map +1 -0
- package/dist/contract/types.js +2 -0
- package/dist/contract/types.js.map +1 -0
- package/dist/db/client.d.ts +55 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +73 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/dev-database.d.ts +124 -0
- package/dist/db/dev-database.d.ts.map +1 -0
- package/dist/db/dev-database.js +291 -0
- package/dist/db/dev-database.js.map +1 -0
- package/dist/db/password-front.d.ts +10 -0
- package/dist/db/password-front.d.ts.map +1 -0
- package/dist/db/password-front.js +147 -0
- package/dist/db/password-front.js.map +1 -0
- package/dist/db/process-identity.d.ts +36 -0
- package/dist/db/process-identity.d.ts.map +1 -0
- package/dist/db/process-identity.js +114 -0
- package/dist/db/process-identity.js.map +1 -0
- package/dist/db/state-file.d.ts +54 -0
- package/dist/db/state-file.d.ts.map +1 -0
- package/dist/db/state-file.js +91 -0
- package/dist/db/state-file.js.map +1 -0
- package/dist/db/url.d.ts +89 -0
- package/dist/db/url.d.ts.map +1 -0
- package/dist/db/url.js +118 -0
- package/dist/db/url.js.map +1 -0
- package/dist/extend.d.ts +13 -2
- package/dist/extend.d.ts.map +1 -1
- package/dist/extend.js +24 -1
- package/dist/extend.js.map +1 -1
- package/dist/fields/index.d.ts +87 -42
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +462 -678
- package/dist/fields/index.js.map +1 -1
- package/dist/filter/collect.d.ts +3 -4
- package/dist/filter/collect.d.ts.map +1 -1
- package/dist/filter/collect.js +2 -2
- package/dist/filter/collect.js.map +1 -1
- package/dist/filter/index.d.ts +1 -2
- package/dist/filter/index.d.ts.map +1 -1
- package/dist/filter/index.js +0 -1
- package/dist/filter/index.js.map +1 -1
- package/dist/filter/map.d.ts +12 -5
- package/dist/filter/map.d.ts.map +1 -1
- package/dist/filter/map.js +47 -19
- package/dist/filter/map.js.map +1 -1
- package/dist/filter/types.d.ts +10 -24
- package/dist/filter/types.d.ts.map +1 -1
- package/dist/filter/types.js +2 -11
- package/dist/filter/types.js.map +1 -1
- package/dist/hooks/index.d.ts +22 -31
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +33 -37
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/transition-guard.d.ts +61 -0
- package/dist/hooks/transition-guard.d.ts.map +1 -0
- package/dist/hooks/transition-guard.js +93 -0
- package/dist/hooks/transition-guard.js.map +1 -0
- package/dist/index.d.ts +52 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -51
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +4 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +16 -0
- package/dist/internal.js.map +1 -1
- package/dist/lib/case-utils.d.ts +0 -1
- package/dist/lib/case-utils.d.ts.map +1 -1
- package/dist/lib/case-utils.js +0 -3
- package/dist/lib/case-utils.js.map +1 -1
- package/dist/lib/client-safe-error.d.ts +9 -0
- package/dist/lib/client-safe-error.d.ts.map +1 -0
- package/dist/lib/client-safe-error.js +23 -0
- package/dist/lib/client-safe-error.js.map +1 -0
- package/dist/lib/database-errors.d.ts +78 -0
- package/dist/lib/database-errors.d.ts.map +1 -0
- package/dist/lib/database-errors.js +148 -0
- package/dist/lib/database-errors.js.map +1 -0
- package/dist/lib/null-prototype-registry.d.ts +9 -0
- package/dist/lib/null-prototype-registry.d.ts.map +1 -0
- package/dist/lib/null-prototype-registry.js +11 -0
- package/dist/lib/null-prototype-registry.js.map +1 -0
- package/dist/lib/prisma-errors.d.ts +30 -32
- package/dist/lib/prisma-errors.d.ts.map +1 -1
- package/dist/lib/prisma-errors.js +86 -46
- package/dist/lib/prisma-errors.js.map +1 -1
- package/dist/lib/process-global.d.ts +23 -0
- package/dist/lib/process-global.d.ts.map +1 -0
- package/dist/lib/process-global.js +33 -0
- package/dist/lib/process-global.js.map +1 -0
- package/dist/lib/warn-once.d.ts +7 -0
- package/dist/lib/warn-once.d.ts.map +1 -0
- package/dist/lib/warn-once.js +13 -0
- package/dist/lib/warn-once.js.map +1 -0
- package/dist/mcp/advertise.d.ts +16 -0
- package/dist/mcp/advertise.d.ts.map +1 -0
- package/dist/mcp/advertise.js +25 -0
- package/dist/mcp/advertise.js.map +1 -0
- package/dist/mcp/arguments.d.ts +10 -0
- package/dist/mcp/arguments.d.ts.map +1 -0
- package/dist/mcp/arguments.js +143 -0
- package/dist/mcp/arguments.js.map +1 -0
- package/dist/mcp/field-schema.d.ts +50 -5
- package/dist/mcp/field-schema.d.ts.map +1 -1
- package/dist/mcp/field-schema.js +137 -14
- package/dist/mcp/field-schema.js.map +1 -1
- package/dist/mcp/handler.d.ts +16 -5
- package/dist/mcp/handler.d.ts.map +1 -1
- package/dist/mcp/handler.js +404 -126
- package/dist/mcp/handler.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/projection.d.ts +42 -34
- package/dist/mcp/projection.d.ts.map +1 -1
- package/dist/mcp/projection.js +246 -200
- package/dist/mcp/projection.js.map +1 -1
- package/dist/mcp/tool-error.d.ts +8 -0
- package/dist/mcp/tool-error.d.ts.map +1 -0
- package/dist/mcp/tool-error.js +11 -0
- package/dist/mcp/tool-error.js.map +1 -0
- package/dist/mcp/types.d.ts +3 -2
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/where-id-boundary.d.ts +28 -0
- package/dist/mcp/where-id-boundary.d.ts.map +1 -0
- package/dist/mcp/where-id-boundary.js +187 -0
- package/dist/mcp/where-id-boundary.js.map +1 -0
- package/dist/origin.d.ts +147 -0
- package/dist/origin.d.ts.map +1 -0
- package/dist/origin.js +191 -0
- package/dist/origin.js.map +1 -0
- package/dist/query/relationship-options.d.ts +35 -6
- package/dist/query/relationship-options.d.ts.map +1 -1
- package/dist/query/relationship-options.js +33 -23
- package/dist/query/relationship-options.js.map +1 -1
- package/dist/secured/aggregate.d.ts +32 -0
- package/dist/secured/aggregate.d.ts.map +1 -0
- package/dist/secured/aggregate.js +31 -0
- package/dist/secured/aggregate.js.map +1 -0
- package/dist/secured/include.d.ts +320 -0
- package/dist/secured/include.d.ts.map +1 -0
- package/dist/secured/include.js +650 -0
- package/dist/secured/include.js.map +1 -0
- package/dist/secured/lock.d.ts +127 -0
- package/dist/secured/lock.d.ts.map +1 -0
- package/dist/secured/lock.js +275 -0
- package/dist/secured/lock.js.map +1 -0
- package/dist/secured/lower.d.ts +82 -0
- package/dist/secured/lower.d.ts.map +1 -0
- package/dist/secured/lower.js +162 -0
- package/dist/secured/lower.js.map +1 -0
- package/dist/secured/operators.d.ts +7 -0
- package/dist/secured/operators.d.ts.map +1 -0
- package/dist/secured/operators.js +18 -0
- package/dist/secured/operators.js.map +1 -0
- package/dist/secured/read.d.ts +208 -0
- package/dist/secured/read.d.ts.map +1 -0
- package/dist/secured/read.js +1245 -0
- package/dist/secured/read.js.map +1 -0
- package/dist/secured/select.d.ts +87 -0
- package/dist/secured/select.d.ts.map +1 -0
- package/dist/secured/select.js +250 -0
- package/dist/secured/select.js.map +1 -0
- package/dist/secured/vector.d.ts +58 -0
- package/dist/secured/vector.d.ts.map +1 -0
- package/dist/secured/vector.js +113 -0
- package/dist/secured/vector.js.map +1 -0
- package/dist/secured/vocabulary.d.ts +227 -0
- package/dist/secured/vocabulary.d.ts.map +1 -0
- package/dist/secured/vocabulary.js +578 -0
- package/dist/secured/vocabulary.js.map +1 -0
- package/dist/secured/write.d.ts +58 -0
- package/dist/secured/write.d.ts.map +1 -0
- package/dist/secured/write.js +87 -0
- package/dist/secured/write.js.map +1 -0
- package/dist/testing/context.d.ts +236 -0
- package/dist/testing/context.d.ts.map +1 -0
- package/dist/testing/context.js +457 -0
- package/dist/testing/context.js.map +1 -0
- package/dist/testing/escape.d.ts +83 -0
- package/dist/testing/escape.d.ts.map +1 -0
- package/dist/testing/escape.js +148 -0
- package/dist/testing/escape.js.map +1 -0
- package/dist/testing/extensions.d.ts +48 -0
- package/dist/testing/extensions.d.ts.map +1 -0
- package/dist/testing/extensions.js +107 -0
- package/dist/testing/extensions.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +11 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/plans.d.ts +64 -0
- package/dist/testing/plans.d.ts.map +1 -0
- package/dist/testing/plans.js +47 -0
- package/dist/testing/plans.js.map +1 -0
- package/dist/types/context.d.ts +110 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +2 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/contract.d.ts +198 -0
- package/dist/types/contract.d.ts.map +1 -0
- package/dist/types/contract.js +2 -0
- package/dist/types/contract.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/inputs.d.ts +83 -0
- package/dist/types/inputs.d.ts.map +1 -0
- package/dist/types/inputs.js +2 -0
- package/dist/types/inputs.js.map +1 -0
- package/dist/types/rows.d.ts +76 -0
- package/dist/types/rows.d.ts.map +1 -0
- package/dist/types/rows.js +2 -0
- package/dist/types/rows.js.map +1 -0
- package/dist/types/secured-list.d.ts +396 -0
- package/dist/types/secured-list.d.ts.map +1 -0
- package/dist/types/secured-list.js +2 -0
- package/dist/types/secured-list.js.map +1 -0
- package/dist/unsafe.d.ts +162 -0
- package/dist/unsafe.d.ts.map +1 -0
- package/dist/unsafe.js +177 -0
- package/dist/unsafe.js.map +1 -0
- package/dist/validation/config-refusal.d.ts +16 -0
- package/dist/validation/config-refusal.d.ts.map +1 -0
- package/dist/validation/config-refusal.js +2 -0
- package/dist/validation/config-refusal.js.map +1 -0
- package/dist/validation/database-config.d.ts +19 -0
- package/dist/validation/database-config.d.ts.map +1 -0
- package/dist/validation/database-config.js +237 -0
- package/dist/validation/database-config.js.map +1 -0
- package/dist/validation/default-value.d.ts +21 -0
- package/dist/validation/default-value.d.ts.map +1 -0
- package/dist/validation/default-value.js +72 -0
- package/dist/validation/default-value.js.map +1 -0
- package/dist/validation/extension-packs.d.ts +11 -0
- package/dist/validation/extension-packs.d.ts.map +1 -0
- package/dist/validation/extension-packs.js +53 -0
- package/dist/validation/extension-packs.js.map +1 -0
- package/dist/validation/field-config.d.ts +35 -21
- package/dist/validation/field-config.d.ts.map +1 -1
- package/dist/validation/field-config.js +51 -41
- package/dist/validation/field-config.js.map +1 -1
- package/dist/validation/field-names.d.ts +15 -0
- package/dist/validation/field-names.d.ts.map +1 -0
- package/dist/validation/field-names.js +155 -0
- package/dist/validation/field-names.js.map +1 -0
- package/dist/validation/identifier-names.d.ts +4 -0
- package/dist/validation/identifier-names.d.ts.map +1 -0
- package/dist/validation/identifier-names.js +39 -0
- package/dist/validation/identifier-names.js.map +1 -0
- package/dist/validation/needs-closure.d.ts +20 -30
- package/dist/validation/needs-closure.d.ts.map +1 -1
- package/dist/validation/needs-closure.js +29 -105
- package/dist/validation/needs-closure.js.map +1 -1
- package/dist/validation/relations.d.ts +17 -0
- package/dist/validation/relations.d.ts.map +1 -0
- package/dist/validation/relations.js +268 -0
- package/dist/validation/relations.js.map +1 -0
- package/dist/validation/schema.d.ts.map +1 -1
- package/dist/validation/schema.js +1 -3
- package/dist/validation/schema.js.map +1 -1
- package/dist/where/like.d.ts +32 -0
- package/dist/where/like.d.ts.map +1 -0
- package/dist/where/like.js +42 -0
- package/dist/where/like.js.map +1 -0
- package/package.json +70 -8
- package/.turbo/turbo-build.log +0 -4
- package/CLAUDE.md +0 -609
- package/dist/access/access-filter.d.ts +0 -241
- package/dist/access/access-filter.d.ts.map +0 -1
- package/dist/access/access-filter.js +0 -692
- package/dist/access/access-filter.js.map +0 -1
- package/dist/access/access-filter.test.d.ts +0 -2
- package/dist/access/access-filter.test.d.ts.map +0 -1
- package/dist/access/access-filter.test.js +0 -1256
- package/dist/access/access-filter.test.js.map +0 -1
- package/dist/access/declared-dependencies.test.d.ts +0 -2
- package/dist/access/declared-dependencies.test.d.ts.map +0 -1
- package/dist/access/declared-dependencies.test.js +0 -226
- package/dist/access/declared-dependencies.test.js.map +0 -1
- package/dist/access/denied-relation-visibility.test.d.ts +0 -2
- package/dist/access/denied-relation-visibility.test.d.ts.map +0 -1
- package/dist/access/denied-relation-visibility.test.js +0 -114
- package/dist/access/denied-relation-visibility.test.js.map +0 -1
- package/dist/access/engine.test.d.ts +0 -2
- package/dist/access/engine.test.d.ts.map +0 -1
- package/dist/access/engine.test.js +0 -56
- package/dist/access/engine.test.js.map +0 -1
- package/dist/access/field-access.test.d.ts +0 -2
- package/dist/access/field-access.test.d.ts.map +0 -1
- package/dist/access/field-access.test.js +0 -635
- package/dist/access/field-access.test.js.map +0 -1
- package/dist/access/multi-column-read-write.test.d.ts +0 -2
- package/dist/access/multi-column-read-write.test.d.ts.map +0 -1
- package/dist/access/multi-column-read-write.test.js +0 -183
- package/dist/access/multi-column-read-write.test.js.map +0 -1
- package/dist/access/relationship-count.d.ts +0 -98
- package/dist/access/relationship-count.d.ts.map +0 -1
- package/dist/access/relationship-count.js +0 -262
- package/dist/access/relationship-count.js.map +0 -1
- package/dist/access/relationship-count.test.d.ts +0 -2
- package/dist/access/relationship-count.test.d.ts.map +0 -1
- package/dist/access/relationship-count.test.js +0 -247
- package/dist/access/relationship-count.test.js.map +0 -1
- package/dist/access/relationship-label-filter.d.ts +0 -45
- package/dist/access/relationship-label-filter.d.ts.map +0 -1
- package/dist/access/relationship-label-filter.js +0 -22
- package/dist/access/relationship-label-filter.js.map +0 -1
- package/dist/access/relationship-label-filter.test.d.ts +0 -2
- package/dist/access/relationship-label-filter.test.d.ts.map +0 -1
- package/dist/access/relationship-label-filter.test.js +0 -89
- package/dist/access/relationship-label-filter.test.js.map +0 -1
- package/dist/access/synthetic-include-read.test.d.ts +0 -2
- package/dist/access/synthetic-include-read.test.d.ts.map +0 -1
- package/dist/access/synthetic-include-read.test.js +0 -121
- package/dist/access/synthetic-include-read.test.js.map +0 -1
- package/dist/context/nested-operations.d.ts +0 -74
- package/dist/context/nested-operations.d.ts.map +0 -1
- package/dist/context/nested-operations.js +0 -847
- package/dist/context/nested-operations.js.map +0 -1
- package/dist/fields/calendar-day.test.d.ts +0 -2
- package/dist/fields/calendar-day.test.d.ts.map +0 -1
- package/dist/fields/calendar-day.test.js +0 -246
- package/dist/fields/calendar-day.test.js.map +0 -1
- package/dist/fields/format-prisma-default.d.ts +0 -35
- package/dist/fields/format-prisma-default.d.ts.map +0 -1
- package/dist/fields/format-prisma-default.js +0 -49
- package/dist/fields/format-prisma-default.js.map +0 -1
- package/dist/fields/format-prisma-default.test.d.ts +0 -2
- package/dist/fields/format-prisma-default.test.d.ts.map +0 -1
- package/dist/fields/format-prisma-default.test.js +0 -54
- package/dist/fields/format-prisma-default.test.js.map +0 -1
- package/dist/fields/relationship-foreign-key.test.d.ts +0 -2
- package/dist/fields/relationship-foreign-key.test.d.ts.map +0 -1
- package/dist/fields/relationship-foreign-key.test.js +0 -18
- package/dist/fields/relationship-foreign-key.test.js.map +0 -1
- package/dist/fields/select.test.d.ts +0 -2
- package/dist/fields/select.test.d.ts.map +0 -1
- package/dist/fields/select.test.js +0 -279
- package/dist/fields/select.test.js.map +0 -1
- package/dist/fields/text-keystone-compat.test.d.ts +0 -2
- package/dist/fields/text-keystone-compat.test.d.ts.map +0 -1
- package/dist/fields/text-keystone-compat.test.js +0 -93
- package/dist/fields/text-keystone-compat.test.js.map +0 -1
- package/dist/filter/filter.test.d.ts +0 -2
- package/dist/filter/filter.test.d.ts.map +0 -1
- package/dist/filter/filter.test.js +0 -431
- package/dist/filter/filter.test.js.map +0 -1
- package/dist/filter/serialize.test.d.ts +0 -2
- package/dist/filter/serialize.test.d.ts.map +0 -1
- package/dist/filter/serialize.test.js +0 -83
- package/dist/filter/serialize.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -33
- package/dist/index.test.js.map +0 -1
- package/dist/lib/case-utils.test.d.ts +0 -2
- package/dist/lib/case-utils.test.d.ts.map +0 -1
- package/dist/lib/case-utils.test.js +0 -123
- package/dist/lib/case-utils.test.js.map +0 -1
- package/dist/query/index.d.ts +0 -127
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js +0 -179
- package/dist/query/index.js.map +0 -1
- package/dist/query/index.test.d.ts +0 -2
- package/dist/query/index.test.d.ts.map +0 -1
- package/dist/query/index.test.js +0 -632
- package/dist/query/index.test.js.map +0 -1
- package/dist/query/relationship-options.test.d.ts +0 -2
- package/dist/query/relationship-options.test.d.ts.map +0 -1
- package/dist/query/relationship-options.test.js +0 -150
- package/dist/query/relationship-options.test.js.map +0 -1
- package/dist/validation/field-config.test.d.ts +0 -2
- package/dist/validation/field-config.test.d.ts.map +0 -1
- package/dist/validation/field-config.test.js +0 -159
- package/dist/validation/field-config.test.js.map +0 -1
- package/dist/validation/schema.test.d.ts +0 -2
- package/dist/validation/schema.test.d.ts.map +0 -1
- package/dist/validation/schema.test.js +0 -409
- package/dist/validation/schema.test.js.map +0 -1
- package/docs/type-distribution-fix.md +0 -136
- package/src/access/access-filter.test.ts +0 -1919
- package/src/access/access-filter.ts +0 -1041
- package/src/access/declared-dependencies.test.ts +0 -277
- package/src/access/declared-dependencies.ts +0 -220
- package/src/access/denied-relation-visibility.test.ts +0 -173
- package/src/access/depth-limits.ts +0 -27
- package/src/access/engine.test.ts +0 -67
- package/src/access/engine.ts +0 -193
- package/src/access/errors.ts +0 -242
- package/src/access/field-access.test.ts +0 -792
- package/src/access/field-access.ts +0 -353
- package/src/access/field-transforms.ts +0 -68
- package/src/access/field-visibility.ts +0 -569
- package/src/access/index.ts +0 -82
- package/src/access/multi-column-read-write.test.ts +0 -305
- package/src/access/query-validation.ts +0 -486
- package/src/access/relationship-count.test.ts +0 -344
- package/src/access/relationship-count.ts +0 -346
- package/src/access/relationship-label-filter.test.ts +0 -128
- package/src/access/relationship-label-filter.ts +0 -63
- package/src/access/synthetic-include-read.test.ts +0 -179
- package/src/access/transaction-registry.ts +0 -58
- package/src/access/types.ts +0 -391
- package/src/config/index.ts +0 -177
- package/src/config/label.ts +0 -51
- package/src/config/nav-count.ts +0 -77
- package/src/config/plugin-engine.ts +0 -261
- package/src/config/types.ts +0 -3270
- package/src/context/apply-defaults.ts +0 -47
- package/src/context/hook-pipeline.ts +0 -137
- package/src/context/index.ts +0 -1737
- package/src/context/nested-operations.ts +0 -1470
- package/src/context/transaction-boundary.ts +0 -485
- package/src/context/write-pipeline.ts +0 -732
- package/src/extend.ts +0 -28
- package/src/fields/calendar-day.test.ts +0 -291
- package/src/fields/format-prisma-default.test.ts +0 -64
- package/src/fields/format-prisma-default.ts +0 -64
- package/src/fields/index.ts +0 -1901
- package/src/fields/relationship-foreign-key.test.ts +0 -29
- package/src/fields/select.test.ts +0 -336
- package/src/fields/text-keystone-compat.test.ts +0 -126
- package/src/filter/collect.ts +0 -108
- package/src/filter/filter.test.ts +0 -538
- package/src/filter/index.ts +0 -26
- package/src/filter/map.ts +0 -63
- package/src/filter/parse.ts +0 -99
- package/src/filter/serialize.test.ts +0 -115
- package/src/filter/serialize.ts +0 -73
- package/src/filter/types.ts +0 -120
- package/src/hooks/index.ts +0 -752
- package/src/index.test.ts +0 -50
- package/src/index.ts +0 -192
- package/src/internal.ts +0 -61
- package/src/lib/case-utils.test.ts +0 -159
- package/src/lib/case-utils.ts +0 -68
- package/src/lib/prisma-errors.ts +0 -86
- package/src/mcp/constants.ts +0 -24
- package/src/mcp/field-schema.ts +0 -84
- package/src/mcp/handler.ts +0 -633
- package/src/mcp/index.ts +0 -7
- package/src/mcp/projection.ts +0 -497
- package/src/mcp/types.ts +0 -18
- package/src/query/index.test.ts +0 -830
- package/src/query/index.ts +0 -352
- package/src/query/relationship-options.test.ts +0 -194
- package/src/query/relationship-options.ts +0 -78
- package/src/utils/password.ts +0 -80
- package/src/validation/field-config.test.ts +0 -199
- package/src/validation/field-config.ts +0 -139
- package/src/validation/needs-closure.ts +0 -188
- package/src/validation/schema.test.ts +0 -487
- package/src/validation/schema.ts +0 -51
- package/tests/access-relationships.test.ts +0 -646
- package/tests/access.test.ts +0 -590
- package/tests/apply-defaults.test.ts +0 -119
- package/tests/bare-read-scalars.test.ts +0 -147
- package/tests/computed-field-selective-evaluation.test.ts +0 -418
- package/tests/config.test.ts +0 -242
- package/tests/context.test.ts +0 -3146
- package/tests/default-value-create.test.ts +0 -299
- package/tests/field-hooks.test.ts +0 -410
- package/tests/field-types.test.ts +0 -1291
- package/tests/hook-context-secured.test.ts +0 -424
- package/tests/hook-pipeline.test.ts +0 -233
- package/tests/hooks.test.ts +0 -481
- package/tests/interactive-transaction.test.ts +0 -444
- package/tests/label.test.ts +0 -135
- package/tests/mcp-fields-projection-access.test.ts +0 -250
- package/tests/mcp-handler.test.ts +0 -1411
- package/tests/multi-column-validation-ordering.test.ts +0 -305
- package/tests/nav-count.test.ts +0 -189
- package/tests/needs-declared-dependencies.test.ts +0 -503
- package/tests/nested-access-and-hooks.test.ts +0 -2566
- package/tests/nested-operation-registry.test.ts +0 -317
- package/tests/nested-write-hooks.test.ts +0 -864
- package/tests/nested-write-synthetic-relation.test.ts +0 -437
- package/tests/password-type-distribution.test.ts +0 -154
- package/tests/password-types.test.ts +0 -174
- package/tests/password.test.ts +0 -263
- package/tests/plugin-engine.test.ts +0 -1155
- package/tests/prisma-errors.test.ts +0 -141
- package/tests/resolve-chain.test.ts +0 -411
- package/tests/singleton.test.ts +0 -421
- package/tests/sudo.test.ts +0 -676
- package/tests/to-one-include-access-filter.test.ts +0 -172
- package/tests/transaction-boundary-hooks.test.ts +0 -710
- package/tests/transaction-boundary-outermost.test.ts +0 -530
- package/tests/virtual-fields.test.ts +0 -421
- package/tests/with-session.test.ts +0 -243
- package/tests/write-pipeline.test.ts +0 -617
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -69
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAK/D,YAAY,EACV,cAAc,EACd,2BAA2B,EAC3B,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EAIvB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAG1B,YAAY,EACV,aAAa,EACb,WAAW,EACX,OAAO,EACP,aAAa,EACb,YAAY,EAIZ,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,mBAAmB,CAAA;AAG1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8
|
// Internal plumbing lives on '@opensaas/stack-core/internal' (unstable).
|
|
9
9
|
// ───────────────────────────────────────────────────────────────
|
|
10
10
|
// Config builders
|
|
11
|
-
export { config, list } from './config/index.js';
|
|
11
|
+
export { config, list, getPluginData } from './config/index.js';
|
|
12
|
+
// The Unsafe surface (ADR-0056, ADR-0059)
|
|
13
|
+
export { createUnsafeSurface, createUnsafeTransactionSurface, unavailableUnsafeSurface, UnsafeSurfaceUnavailableError, } from './unsafe.js';
|
|
14
|
+
// The access-filter builder — supported API (ADR-0038, ADR-0057). Evaluate a
|
|
15
|
+
// list's operation-level rule, fold its result into the caller's `where`, and
|
|
16
|
+
// gate a create. A package that reads outside `context.db` — a vector search
|
|
17
|
+
// issuing its own SQL, a plugin composing a filter — calls these rather than
|
|
18
|
+
// carrying a copy. They scope ROWS only: field-level `read` access and
|
|
19
|
+
// `resolveOutput` run inside `context.db`, so a caller here is responsible for
|
|
20
|
+
// field visibility itself.
|
|
21
|
+
export { checkAccess, checkCreateAccess, mergeFilters } from './access/index.js';
|
|
12
22
|
// Context factory
|
|
13
23
|
export { getContext } from './context/index.js';
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
export { TransactionOrmHandleError, TransactionRolledBackError, TransactionUnavailableError, } from './context/index.js';
|
|
25
|
+
// Thrown when a session handed to `getContext`/`withSession`/`createTestContext`
|
|
26
|
+
// holds `undefined` for one of its own keys — the shape `{ userId: undefined }`
|
|
27
|
+
// a caller builds from an unguarded optional identifier, which `session ?? null`
|
|
28
|
+
// cannot distinguish from a real signed-in session (#1397).
|
|
29
|
+
export { InvalidSessionError } from './context/index.js';
|
|
30
|
+
export { requireOrmHandle, OrmHandleUnresolvableError } from './context/index.js';
|
|
31
|
+
export { resolveJunctionEdge } from './context/junction.js';
|
|
32
|
+
// The engine's face of an app-facing context, for a component or plugin that
|
|
33
|
+
// holds the generated `Context` and needs `AccessContext` — two faces of one
|
|
34
|
+
// request, and neither type is assignable to the other.
|
|
35
|
+
export { engineContextOf, EngineContextUnavailableError } from './context/engine-context.js';
|
|
36
|
+
// The secured read surface: the composed query value `context.db.<List>` is,
|
|
37
|
+
// and the closed Where vocabulary it takes (ADR-0041, ADR-0055).
|
|
38
|
+
export { SecuredCollectionMissingError } from './secured/read.js';
|
|
39
|
+
// Thrown when an Access Filter that scopes by a relation expands into itself,
|
|
40
|
+
// directly or through another list's filter. Loud rather than truncated: a
|
|
41
|
+
// truncated Access Filter is a widened read (#1147).
|
|
42
|
+
export { AccessFilterRecursionError, ACCESS_FILTER_MAX_DEPTH } from './secured/read.js';
|
|
43
|
+
// Thrown when an include refinement callback returns something other than the
|
|
44
|
+
// refinement it was handed — dropping it would run the include unscoped by
|
|
45
|
+
// everything the caller wrote (#1148).
|
|
46
|
+
export { InvalidRefinementError } from './secured/read.js';
|
|
47
|
+
// Thrown when one read names the same relation twice (#1148).
|
|
48
|
+
export { DuplicateIncludeError } from './secured/read.js';
|
|
49
|
+
// Thrown when `.select()` names a relation — reachable so a caller can tell it
|
|
50
|
+
// apart from any other `ValidationError` (#1149).
|
|
51
|
+
export { RelationSelectError } from './secured/read.js';
|
|
52
|
+
// The vector-search terminal: how many rows it returns by default, and the
|
|
53
|
+
// `{ item, score }` wrapper that is ADR-0041's one exception to exactness.
|
|
54
|
+
export { NEAREST_DEFAULT_LIMIT, VectorDecodeError } from './secured/read.js';
|
|
55
|
+
// The row lock's own refusals and its key bound: a list whose table has no
|
|
56
|
+
// single-column primary key, a lock composed outside a transaction, a lock
|
|
57
|
+
// inside one whose client cannot compose the statement, and the cost limit on
|
|
58
|
+
// how many keys one terminal binds (ADR-0047, ADR-0062).
|
|
59
|
+
export { ROW_LOCK_MAX_KEYS, RowLockIdentityError, RowLockKeyLimitExceededError, RowLockLaneUnavailableError, RowLockUnavailableError, } from './secured/read.js';
|
|
60
|
+
// The secured write surface: the collection the Write Pipeline drives, and the
|
|
61
|
+
// payload shape it refuses (ADR-0050).
|
|
62
|
+
export { WriteCollectionMissingError } from './secured/write.js';
|
|
63
|
+
export { ConflictingRelationInputError, MalformedForeignKeyInputError, MalformedRelationInputError, NestedRelationInputError, NonOwningRelationInputError, RelationTargetMissingError, } from './context/relationship-input.js';
|
|
64
|
+
// Why an `afterTransaction` bracket reports `rolled-back` for a write whose
|
|
65
|
+
// transaction committed: the predicate matched no row. Reachable so a
|
|
66
|
+
// compensator can tell that apart from a real rollback.
|
|
67
|
+
export { WriteMatchedNothingError } from './context/transaction-boundary.js';
|
|
68
|
+
// Naming utilities (documented public helpers; used for URLs)
|
|
69
|
+
export { getUrlKey, getListKeyFromUrl, resolveListKeyFromUrl } from './lib/case-utils.js';
|
|
16
70
|
// Label seam — resolves the field that represents a row as a single label
|
|
17
71
|
// (projection) and reads it off a row (render). Used by the admin UI for
|
|
18
72
|
// relationship cells, dropdown options, and page headings.
|
|
@@ -22,12 +76,11 @@ export { getLabelFieldName, getItemLabel } from './config/label.js';
|
|
|
22
76
|
export { resolveNavCounts, isListQueryStaticallyDenied } from './config/nav-count.js';
|
|
23
77
|
// Validation error surfaced by write operations
|
|
24
78
|
export { ValidationError } from './hooks/index.js';
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
export { uniqueConstraintOf } from './lib/prisma-errors.js';
|
|
79
|
+
export { transitionGuard } from './hooks/transition-guard.js';
|
|
80
|
+
// The stack-owned database errors every engine terminal raises in place of the
|
|
81
|
+
// driver's own, and their predicates (ADR-0042). The Unsafe surface is excluded
|
|
82
|
+
// and yields the driver's error unchanged.
|
|
83
|
+
export { DatabaseError, SerializationFailure, UniqueConstraintViolation, isSerializationFailure, isUniqueConstraintViolation, } from './lib/database-errors.js';
|
|
31
84
|
// Thrown by a read when a caller-supplied `include` names a relation nested
|
|
32
85
|
// deeper than the Access Filter can scope (see ADR-0022). Distinct from
|
|
33
86
|
// `ValidationError` — this is the engine refusing to return unscoped data, not
|
|
@@ -51,58 +104,59 @@ export { InvalidFieldAccessResultError } from './access/index.js';
|
|
|
51
104
|
// create: there is no existing row and no way to test it against input data,
|
|
52
105
|
// so it is refused loudly rather than silently treated as a full allow.
|
|
53
106
|
export { InvalidCreateAccessResultError } from './access/index.js';
|
|
54
|
-
// Thrown by
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
107
|
+
// Thrown by `mergeFilters` when an access rule returns a filter carrying an
|
|
108
|
+
// `undefined` condition — the shape `({ session }) => ({ authorId:
|
|
109
|
+
// session?.userId })` yields for an anonymous caller. Dropping it would widen
|
|
110
|
+
// the read to every row, so it is refused (see #1147, ADR-0022, ADR-0055).
|
|
111
|
+
export { UndefinedAccessFilterError, VacuousAccessFilterError } from './access/index.js';
|
|
112
|
+
/** @deprecated Never thrown; kept so existing imports compile. */
|
|
60
113
|
export { RelationFilterAccessDeniedError } from './access/index.js';
|
|
61
|
-
// Thrown by a non-sudo write whose payload carries a nested `set`,
|
|
62
|
-
// `updateMany` or `deleteMany` under a relationship key (see #1384). These
|
|
63
|
-
// three kinds were a pass-through straight to Prisma with no target-list
|
|
64
|
-
// access check and no hooks; `sudo()` still accepts them unchanged. Author
|
|
65
|
-
// the writes against the target list directly instead (`context.db.<list>`,
|
|
66
|
-
// wrapped in `context.transaction` when they must land atomically).
|
|
67
|
-
export { NestedRelationInputError } from './context/nested-operations.js';
|
|
68
114
|
// Field self-containment validation — checks each field implements the
|
|
69
|
-
// generation contract (
|
|
70
|
-
//
|
|
115
|
+
// generation contract (getContractField / getZodSchema, plus outputType where
|
|
116
|
+
// the field has no single column to be typed from) so a misimplemented field fails early
|
|
71
117
|
// with a clear per-field message instead of deep inside generation.
|
|
72
118
|
export { validateFieldConfig, validateConfigFields } from './validation/field-config.js';
|
|
73
|
-
// Declared-dependency validation (`needs`, ADR-0025) —
|
|
74
|
-
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
|
|
119
|
+
// Declared-dependency validation (`needs`, ADR-0025, ADR-0051) — a config that fails it must not generate.
|
|
120
|
+
export { validateNeedsDeclarations } from './validation/needs-closure.js';
|
|
121
|
+
// Config-surface refusals (ADR-0040, ADR-0048, ADR-0049, ADR-0064) — the
|
|
122
|
+
// declarations the Prisma 8 contract cannot carry, each refused naming the
|
|
123
|
+
// list, the entry and the fix rather than silently dropped.
|
|
124
|
+
export { validateRelations } from './validation/relations.js';
|
|
125
|
+
export { validateDatabaseConfig } from './validation/database-config.js';
|
|
126
|
+
export { validateExtensionPacks } from './validation/extension-packs.js';
|
|
127
|
+
export { validateFieldNames } from './validation/field-names.js';
|
|
128
|
+
export { validateDefaultValues } from './validation/default-value.js';
|
|
129
|
+
// The stack's database URL lookup — the single place a connection string is
|
|
130
|
+
// chosen, emitted into `prisma.config.ts` and the generated context. The Dev
|
|
131
|
+
// database it can resolve to lives on `@opensaas/stack-core/dev-database`, so
|
|
132
|
+
// the root stays free of PGlite.
|
|
133
|
+
export { resolveDatabaseUrl, findDatabaseUrl, DatabaseUrlUnresolvedError } from './db/url.js';
|
|
134
|
+
// Contract derivation (ADR-0057) — `deriveContract(config)` is the data the
|
|
135
|
+
// generator renders into the Contract module; `assertRelationGraphAgrees`
|
|
136
|
+
// checks an emitted contract against it. The Prisma builder feed lives on
|
|
137
|
+
// `@opensaas/stack-core/contract` so the root stays free of `@prisma/orm-postgres`.
|
|
138
|
+
export { deriveContract, resolveListTimestamps } from './contract/derive.js';
|
|
139
|
+
export { listIdColumn, parseListId, } from './contract/id-boundary.js';
|
|
140
|
+
export { assertRelationGraphAgrees, RelationGraphDivergenceError, } from './contract/relation-graph.js';
|
|
141
|
+
// The two tables the generator emits into the bundle beside the four
|
|
142
|
+
// generated files (ADR-0051, ADR-0042). `deriveDependencyTable` is the one
|
|
143
|
+
// computation behind both the runtime table and the generated `Remainder`'s
|
|
144
|
+
// `needs` type; the engine reads the emitted result through the generated
|
|
145
|
+
// context rather than walking the config on every read.
|
|
146
|
+
export { deriveConstraintMap, deriveDependencyTable, deriveGeneratedTables, } from './contract/dependencies.js';
|
|
86
147
|
// Relationship-options read primitive — bounded, projected fetch for
|
|
87
148
|
// relationship editors. Backs the `relationshipOptions` context.serverAction
|
|
88
149
|
// op; also callable directly wherever a full context is already in hand.
|
|
89
|
-
export { getRelationshipOptions } from './query/relationship-options.js';
|
|
150
|
+
export { getRelationshipOptions, isRelationshipLabelReadable, } from './query/relationship-options.js';
|
|
90
151
|
// Filter engine (ADR-0017) — the admin UI's Filter builder. The pure seam
|
|
91
152
|
// (`parseFilterQuery`, `buildFilterWhere`) plus config-aware helpers that
|
|
92
153
|
// collect each field's Filter spec and compose a list's server-side `where`.
|
|
93
154
|
// The produced fragment is ANDed with the access filter through the secured
|
|
94
155
|
// context, so the filter can only ever narrow visibility.
|
|
95
|
-
export { parseFilterQuery, serializeFilterQuery, buildFilterWhere, collectFilterSpecs, buildListFilterWhere, collectFilterSuggestions,
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
export {
|
|
101
|
-
// To-one relationship label filter helpers for the admin list view (#749).
|
|
102
|
-
// `resolveRelationshipLabelFilters` is now a pass-through: the engine itself
|
|
103
|
-
// scopes every relation filter in `where` (`buildAccessScopedWhere`, #916),
|
|
104
|
-
// including the `{ is: {...} } }` shape a label filter produces, so this no
|
|
105
|
-
// longer needs its own access fold. Kept exported, unchanged in shape, for
|
|
106
|
-
// API compatibility — see `relationship-label-filter.ts`'s doc comment.
|
|
107
|
-
export { resolveRelationshipLabelFilters, isToOneRelationshipField, } from './access/relationship-label-filter.js';
|
|
156
|
+
export { parseFilterQuery, serializeFilterQuery, buildFilterWhere, collectFilterSpecs, buildListFilterWhere, collectFilterSuggestions, } from './filter/index.js';
|
|
157
|
+
// Which fields carry a to-many relationship count. The counts themselves are
|
|
158
|
+
// the secured read's reducers (`.count()` / `.combine()`), which scope by the
|
|
159
|
+
// related list's own `query` access; no consumer builds a `_count` select of
|
|
160
|
+
// its own (#1255).
|
|
161
|
+
export { isToManyRelationshipField } from './fields/index.js';
|
|
108
162
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,8CAA8C;AAC9C,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,gEAAgE;AAChE,6DAA6D;AAC7D,yEAAyE;AACzE,kEAAkE;AAElE,kBAAkB;AAClB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,8CAA8C;AAC9C,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,gEAAgE;AAChE,6DAA6D;AAC7D,yEAAyE;AACzE,kEAAkE;AAElE,kBAAkB;AAClB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAqD/D,0CAA0C;AAC1C,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,aAAa,CAAA;AAGpB,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,+EAA+E;AAC/E,2BAA2B;AAC3B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhF,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAA;AAC3B,iFAAiF;AACjF,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CAAA;AAUnC,qEAAqE;AACrE,6EAA6E;AAC7E,yEAAyE;AACzE,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAA;AAGxC,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,4EAA4E;AAC5E,0DAA0D;AAC1D,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAA;AAW1B,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,mBAAmB;AACnB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export type { ServerActionProps } from './context/index.js';
|
|
2
|
-
export type {
|
|
3
|
-
export type { Fragment, FieldSelection, ResultOf } from './query/index.js';
|
|
2
|
+
export type { OrmClient, OrmModelDelegate, OrmOperationArgs, OrmRow, AccessControlledDB, AccessControlledDelegate, StorageUtils, } from './access/types.js';
|
|
4
3
|
export { hashPassword, comparePassword, isHashedPassword, HashedPassword, } from './utils/password.js';
|
|
5
4
|
export { pascalToCamel, pascalToKebab, kebabToPascal, kebabToCamel } from './lib/case-utils.js';
|
|
6
5
|
export { validateWithZod, generateZodSchema } from './validation/schema.js';
|
|
7
6
|
export { checkFieldAccess } from './access/index.js';
|
|
8
7
|
export { isFieldReadableForPredicate } from './access/index.js';
|
|
9
8
|
export type { DatabaseConfig, SessionConfig, ThemeConfig, ThemePreset, ThemeColors, ThemeFonts, ThemeShadows, FileMetadata, ImageMetadata, ImageTransformationResult, } from './config/index.js';
|
|
9
|
+
export { LIKE_ESCAPE_CHARACTER, escapeLikeLiteral, likeEqualsPattern, likeContainsPattern, likeStartsWithPattern, likeEndsWithPattern, } from './where/like.js';
|
|
10
|
+
export { findDatabaseConnection, connectionStringFault } from './db/url.js';
|
|
11
|
+
export { processGlobal, processGlobalKey } from './lib/process-global.js';
|
|
10
12
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EACV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAG/F,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAK3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAKpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAG/D,YAAY,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,GAC1B,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAMxB,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAS3E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/internal.js
CHANGED
|
@@ -21,4 +21,20 @@ export { checkFieldAccess } from './access/index.js';
|
|
|
21
21
|
// keep the admin list view's sort validation in lockstep with the engine: a
|
|
22
22
|
// field the session cannot read cannot seed an `orderBy` either.
|
|
23
23
|
export { isFieldReadableForPredicate } from './access/index.js';
|
|
24
|
+
// The engine's LIKE-pattern escaping, shared with the packages that lower a
|
|
25
|
+
// substring predicate to `like`/`ilike` (ADR-0055, ADR-0060). One escaper.
|
|
26
|
+
export { LIKE_ESCAPE_CHARACTER, escapeLikeLiteral, likeEqualsPattern, likeContainsPattern, likeStartsWithPattern, likeEndsWithPattern, } from './where/like.js';
|
|
27
|
+
// The lookup's provenance, which `opensaas dev` reads to tell the Database
|
|
28
|
+
// escape (a URL in the environment) from a Dev database it should start for
|
|
29
|
+
// the project itself (ADR-0063). The public accessor, `findDatabaseUrl`,
|
|
30
|
+
// reports the URL alone.
|
|
31
|
+
export { findDatabaseConnection, connectionStringFault } from './db/url.js';
|
|
32
|
+
// The process-wide singleton registry a bundler-duplicated module has to
|
|
33
|
+
// share a value through — used by the origin store, the engine face, and the
|
|
34
|
+
// generated context's client singleton (ADR-0070). `processGlobalKey` is
|
|
35
|
+
// exported alongside it for a caller that needs to address the published
|
|
36
|
+
// slot directly rather than through `processGlobal` itself — a test harness
|
|
37
|
+
// resetting the client singleton between sequentially-generated projects in
|
|
38
|
+
// one process, say.
|
|
39
|
+
export { processGlobal, processGlobalKey } from './lib/process-global.js';
|
|
24
40
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,gCAAgC;AAChC,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,yDAAyD;AACzD,kEAAkE;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,gCAAgC;AAChC,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,yDAAyD;AACzD,kEAAkE;AAclE,4FAA4F;AAC5F,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAA;AAE5B,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAE/F,oDAAoD;AACpD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE3E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,8EAA8E;AAC9E,4EAA4E;AAC5E,iEAAiE;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAgB/D,4EAA4E;AAC5E,2EAA2E;AAC3E,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAExB,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,yBAAyB;AACzB,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE3E,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/lib/case-utils.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export declare function pascalToCamel(str: string): string;
|
|
|
11
11
|
export declare function pascalToKebab(str: string): string;
|
|
12
12
|
export declare function kebabToPascal(str: string): string;
|
|
13
13
|
export declare function kebabToCamel(str: string): string;
|
|
14
|
-
export declare function getDbKey(listKey: string): string;
|
|
15
14
|
export declare function getUrlKey(listKey: string): string;
|
|
16
15
|
export declare function getListKeyFromUrl(urlSegment: string): string;
|
|
17
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case-utils.d.ts","sourceRoot":"","sources":["../../src/lib/case-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"case-utils.d.ts","sourceRoot":"","sources":["../../src/lib/case-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAUhG"}
|
package/dist/lib/case-utils.js
CHANGED
|
@@ -24,9 +24,6 @@ export function kebabToPascal(str) {
|
|
|
24
24
|
export function kebabToCamel(str) {
|
|
25
25
|
return str.replace(/-([a-z])/g, (match, p1) => p1.toUpperCase());
|
|
26
26
|
}
|
|
27
|
-
export function getDbKey(listKey) {
|
|
28
|
-
return pascalToCamel(listKey);
|
|
29
|
-
}
|
|
30
27
|
export function getUrlKey(listKey) {
|
|
31
28
|
return pascalToKebab(listKey);
|
|
32
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case-utils.js","sourceRoot":"","sources":["../../src/lib/case-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QACnD,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAA;IAC/D,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAA;AACb,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,G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AAC,OAAO,CAAC,CAAA;AAC/B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,OAAO,aAAa,CAAC,UAAU,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB,EAAE,QAAkB;IAC1E,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC,CAAA;IAE/E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,uBAAuB,UAAU,gBAAgB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,wEAAwE,CACrK,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `error` may reach a client verbatim: a validation failure, a
|
|
3
|
+
* stack-owned database error, or one of the engine's own refusals. Anything
|
|
4
|
+
* else — a throwing access rule, a hook bug, a third-party SDK error — carries
|
|
5
|
+
* internal detail and must be logged server-side and replaced with a generic
|
|
6
|
+
* message. A hook that wants a message shown throws `ValidationError`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isClientSafeError(error: unknown): error is Error;
|
|
9
|
+
//# sourceMappingURL=client-safe-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-safe-error.d.ts","sourceRoot":"","sources":["../../src/lib/client-safe-error.ts"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAYhE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AccessScopeDepthExceededError, ResolveOutputCycleError } from '../access/errors.js';
|
|
2
|
+
import { ConflictingRelationInputError, MalformedForeignKeyInputError, MalformedRelationInputError, NestedRelationInputError, NonOwningRelationInputError, } from '../context/relationship-input.js';
|
|
3
|
+
import { ValidationError } from '../hooks/index.js';
|
|
4
|
+
import { DatabaseError } from './database-errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Whether `error` may reach a client verbatim: a validation failure, a
|
|
7
|
+
* stack-owned database error, or one of the engine's own refusals. Anything
|
|
8
|
+
* else — a throwing access rule, a hook bug, a third-party SDK error — carries
|
|
9
|
+
* internal detail and must be logged server-side and replaced with a generic
|
|
10
|
+
* message. A hook that wants a message shown throws `ValidationError`.
|
|
11
|
+
*/
|
|
12
|
+
export function isClientSafeError(error) {
|
|
13
|
+
return (error instanceof ValidationError ||
|
|
14
|
+
error instanceof DatabaseError ||
|
|
15
|
+
error instanceof NonOwningRelationInputError ||
|
|
16
|
+
error instanceof MalformedRelationInputError ||
|
|
17
|
+
error instanceof NestedRelationInputError ||
|
|
18
|
+
error instanceof ConflictingRelationInputError ||
|
|
19
|
+
error instanceof MalformedForeignKeyInputError ||
|
|
20
|
+
error instanceof AccessScopeDepthExceededError ||
|
|
21
|
+
error instanceof ResolveOutputCycleError);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=client-safe-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-safe-error.js","sourceRoot":"","sources":["../../src/lib/client-safe-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,KAAK,YAAY,eAAe;QAChC,KAAK,YAAY,aAAa;QAC9B,KAAK,YAAY,2BAA2B;QAC5C,KAAK,YAAY,2BAA2B;QAC5C,KAAK,YAAY,wBAAwB;QACzC,KAAK,YAAY,6BAA6B;QAC9C,KAAK,YAAY,6BAA6B;QAC9C,KAAK,YAAY,6BAA6B;QAC9C,KAAK,YAAY,uBAAuB,CACzC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A database failure the stack owns, raised in place of the driver's own error
|
|
3
|
+
* by every engine terminal (ADR-0042). Carries a message safe to show a user
|
|
4
|
+
* and, where the failure names columns, one message per field. The driver's own
|
|
5
|
+
* text is never the message — it is on {@link Error.cause}, for a server-side
|
|
6
|
+
* log.
|
|
7
|
+
*
|
|
8
|
+
* The Unsafe surface is deliberately excluded: a query issued through it
|
|
9
|
+
* rejects with the driver's own error, consistent with its bypassing
|
|
10
|
+
* everything else.
|
|
11
|
+
*/
|
|
12
|
+
export declare class DatabaseError extends Error {
|
|
13
|
+
/** One user-facing message per field the failure names. Empty when it names none. */
|
|
14
|
+
fieldErrors: Record<string, string>;
|
|
15
|
+
constructor(message: string, fieldErrors?: Record<string, string>, options?: ErrorOptions);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A transaction that could not be serialised against a concurrent one
|
|
19
|
+
* (SQLSTATE `40001`).
|
|
20
|
+
*
|
|
21
|
+
* Retrying is the caller's decision and the caller's loop: the stack ships no
|
|
22
|
+
* retry helper, and a loop that catches broadly rather than on
|
|
23
|
+
* {@link isSerializationFailure} will re-apply a transaction that already
|
|
24
|
+
* committed (ADR-0028).
|
|
25
|
+
*/
|
|
26
|
+
export declare class SerializationFailure extends DatabaseError {
|
|
27
|
+
constructor(message: string, options?: ErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A write that collided with a unique constraint (SQLSTATE `23505`).
|
|
31
|
+
*
|
|
32
|
+
* {@link fields} and {@link fieldErrors} are populated when the violated
|
|
33
|
+
* constraint is one the generator emitted, resolved through the generated
|
|
34
|
+
* constraint map. A constraint managed by hand in the database is not in that
|
|
35
|
+
* map, so it carries the generic message and no fields — the map's limit,
|
|
36
|
+
* stated rather than hidden.
|
|
37
|
+
*/
|
|
38
|
+
export declare class UniqueConstraintViolation extends DatabaseError {
|
|
39
|
+
/** The physical constraint name the driver reported, when it reported one. */
|
|
40
|
+
readonly constraintName: string | undefined;
|
|
41
|
+
/** The list the constraint is on, when the constraint map resolved it. */
|
|
42
|
+
readonly list: string | undefined;
|
|
43
|
+
/** The OpenSaas field keys the constraint covers, empty when unresolved. */
|
|
44
|
+
readonly fields: readonly string[];
|
|
45
|
+
constructor(message: string, detail?: {
|
|
46
|
+
readonly constraintName?: string | undefined;
|
|
47
|
+
readonly list?: string | undefined;
|
|
48
|
+
readonly fields?: readonly string[];
|
|
49
|
+
readonly fieldErrors?: Record<string, string>;
|
|
50
|
+
}, options?: ErrorOptions);
|
|
51
|
+
}
|
|
52
|
+
/** Whether `error` is a serialization failure raised through the secured surface. */
|
|
53
|
+
export declare function isSerializationFailure(error: unknown): error is SerializationFailure;
|
|
54
|
+
/** Whether `error` is a unique-constraint violation raised through the secured surface. */
|
|
55
|
+
export declare function isUniqueConstraintViolation(error: unknown): error is UniqueConstraintViolation;
|
|
56
|
+
/** The generic message a unique violation carries when no field could be resolved. */
|
|
57
|
+
export declare const GENERIC_UNIQUE_VIOLATION_MESSAGE = "A record with this value already exists";
|
|
58
|
+
/** The message a serialization failure carries. */
|
|
59
|
+
export declare const SERIALIZATION_FAILURE_MESSAGE = "This operation conflicted with another and was rolled back";
|
|
60
|
+
/**
|
|
61
|
+
* The message an unclassified driver failure carries. The driver's own text
|
|
62
|
+
* names columns, tables and constraint names, and a {@link DatabaseError}'s
|
|
63
|
+
* message is what a server action hands a client, so the driver's text stays on
|
|
64
|
+
* {@link Error.cause} for a server-side log rather than travelling to a browser.
|
|
65
|
+
*/
|
|
66
|
+
export declare const GENERIC_DATABASE_ERROR_MESSAGE = "The database refused this operation";
|
|
67
|
+
/**
|
|
68
|
+
* The stack-owned error for a driver query error, or `undefined` when `error`
|
|
69
|
+
* neither is one nor wraps one — a hook's own throw, a validation failure, or
|
|
70
|
+
* an error this module has already classified.
|
|
71
|
+
*
|
|
72
|
+
* Field resolution is NOT done here: the violated constraint's fields come
|
|
73
|
+
* from the generated constraint map, which is reached through the config the
|
|
74
|
+
* terminal does not hold. `normalizeDatabaseError` performs that second step
|
|
75
|
+
* where the config is in scope.
|
|
76
|
+
*/
|
|
77
|
+
export declare function classifyDriverError(error: unknown): DatabaseError | undefined;
|
|
78
|
+
//# sourceMappingURL=database-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-errors.d.ts","sourceRoot":"","sources":["../../src/lib/database-errors.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,qFAAqF;IAC9E,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE1C,YAAY,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAI5F;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,aAAa;IAC1D,8EAA8E;IAC9E,SAAgB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;IAClD,0EAA0E;IAC1E,SAAgB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,4EAA4E;IAC5E,SAAgB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAEzC,YACE,OAAO,EAAE,MAAM,EACf,MAAM,GAAE;QACN,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KACzC,EACN,OAAO,CAAC,EAAE,YAAY,EAOvB;CACF;AAED,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAEpF;AAED,2FAA2F;AAC3F,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,yBAAyB,CAE9F;AAED,sFAAsF;AACtF,eAAO,MAAM,gCAAgC,4CAA4C,CAAA;AAEzF,mDAAmD;AACnD,eAAO,MAAM,6BAA6B,+DACoB,CAAA;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,wCAAwC,CAAA;AA8BnF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAmB7E"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// The stack-owned database errors and the driver classification that produces
|
|
2
|
+
// them (ADR-0042). A leaf module on purpose: the Engine stamp imports it, so a
|
|
3
|
+
// runtime import from here would put these classes behind a cycle with the
|
|
4
|
+
// surfaces that raise them.
|
|
5
|
+
/** SQLSTATE a driver reports for a unique-constraint or primary-key violation. */
|
|
6
|
+
const UNIQUE_VIOLATION_SQLSTATE = '23505';
|
|
7
|
+
/** SQLSTATE a driver reports for a serialization failure. */
|
|
8
|
+
const SERIALIZATION_FAILURE_SQLSTATE = '40001';
|
|
9
|
+
function isDriverQueryError(error) {
|
|
10
|
+
if (!(error instanceof Error) || !('kind' in error))
|
|
11
|
+
return false;
|
|
12
|
+
const candidate = error;
|
|
13
|
+
return candidate.kind === 'sql_query';
|
|
14
|
+
}
|
|
15
|
+
function asString(value) {
|
|
16
|
+
return typeof value === 'string' ? value : undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A database failure the stack owns, raised in place of the driver's own error
|
|
20
|
+
* by every engine terminal (ADR-0042). Carries a message safe to show a user
|
|
21
|
+
* and, where the failure names columns, one message per field. The driver's own
|
|
22
|
+
* text is never the message — it is on {@link Error.cause}, for a server-side
|
|
23
|
+
* log.
|
|
24
|
+
*
|
|
25
|
+
* The Unsafe surface is deliberately excluded: a query issued through it
|
|
26
|
+
* rejects with the driver's own error, consistent with its bypassing
|
|
27
|
+
* everything else.
|
|
28
|
+
*/
|
|
29
|
+
export class DatabaseError extends Error {
|
|
30
|
+
/** One user-facing message per field the failure names. Empty when it names none. */
|
|
31
|
+
fieldErrors;
|
|
32
|
+
constructor(message, fieldErrors = {}, options) {
|
|
33
|
+
super(message, options);
|
|
34
|
+
this.name = 'DatabaseError';
|
|
35
|
+
this.fieldErrors = fieldErrors;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A transaction that could not be serialised against a concurrent one
|
|
40
|
+
* (SQLSTATE `40001`).
|
|
41
|
+
*
|
|
42
|
+
* Retrying is the caller's decision and the caller's loop: the stack ships no
|
|
43
|
+
* retry helper, and a loop that catches broadly rather than on
|
|
44
|
+
* {@link isSerializationFailure} will re-apply a transaction that already
|
|
45
|
+
* committed (ADR-0028).
|
|
46
|
+
*/
|
|
47
|
+
export class SerializationFailure extends DatabaseError {
|
|
48
|
+
constructor(message, options) {
|
|
49
|
+
super(message, {}, options);
|
|
50
|
+
this.name = 'SerializationFailure';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A write that collided with a unique constraint (SQLSTATE `23505`).
|
|
55
|
+
*
|
|
56
|
+
* {@link fields} and {@link fieldErrors} are populated when the violated
|
|
57
|
+
* constraint is one the generator emitted, resolved through the generated
|
|
58
|
+
* constraint map. A constraint managed by hand in the database is not in that
|
|
59
|
+
* map, so it carries the generic message and no fields — the map's limit,
|
|
60
|
+
* stated rather than hidden.
|
|
61
|
+
*/
|
|
62
|
+
export class UniqueConstraintViolation extends DatabaseError {
|
|
63
|
+
/** The physical constraint name the driver reported, when it reported one. */
|
|
64
|
+
constraintName;
|
|
65
|
+
/** The list the constraint is on, when the constraint map resolved it. */
|
|
66
|
+
list;
|
|
67
|
+
/** The OpenSaas field keys the constraint covers, empty when unresolved. */
|
|
68
|
+
fields;
|
|
69
|
+
constructor(message, detail = {}, options) {
|
|
70
|
+
super(message, detail.fieldErrors ?? {}, options);
|
|
71
|
+
this.name = 'UniqueConstraintViolation';
|
|
72
|
+
this.constraintName = detail.constraintName;
|
|
73
|
+
this.list = detail.list;
|
|
74
|
+
this.fields = detail.fields ?? [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Whether `error` is a serialization failure raised through the secured surface. */
|
|
78
|
+
export function isSerializationFailure(error) {
|
|
79
|
+
return error instanceof SerializationFailure;
|
|
80
|
+
}
|
|
81
|
+
/** Whether `error` is a unique-constraint violation raised through the secured surface. */
|
|
82
|
+
export function isUniqueConstraintViolation(error) {
|
|
83
|
+
return error instanceof UniqueConstraintViolation;
|
|
84
|
+
}
|
|
85
|
+
/** The generic message a unique violation carries when no field could be resolved. */
|
|
86
|
+
export const GENERIC_UNIQUE_VIOLATION_MESSAGE = 'A record with this value already exists';
|
|
87
|
+
/** The message a serialization failure carries. */
|
|
88
|
+
export const SERIALIZATION_FAILURE_MESSAGE = 'This operation conflicted with another and was rolled back';
|
|
89
|
+
/**
|
|
90
|
+
* The message an unclassified driver failure carries. The driver's own text
|
|
91
|
+
* names columns, tables and constraint names, and a {@link DatabaseError}'s
|
|
92
|
+
* message is what a server action hands a client, so the driver's text stays on
|
|
93
|
+
* {@link Error.cause} for a server-side log rather than travelling to a browser.
|
|
94
|
+
*/
|
|
95
|
+
export const GENERIC_DATABASE_ERROR_MESSAGE = 'The database refused this operation';
|
|
96
|
+
/**
|
|
97
|
+
* How far down a `cause` chain the driver's own error is looked for.
|
|
98
|
+
*
|
|
99
|
+
* Prisma 8 reports a failure raised at `COMMIT` as
|
|
100
|
+
* `RuntimeError: Transaction commit failed` whose `cause` is the
|
|
101
|
+
* `SqlQueryError` — the failure a `DEFERRABLE INITIALLY DEFERRED` constraint
|
|
102
|
+
* produces by design. Verified at `8.0.0-rc.8`, where the wrapping is one
|
|
103
|
+
* level deep; the small budget is headroom, not a claim about deeper nesting.
|
|
104
|
+
*/
|
|
105
|
+
const CAUSE_DEPTH = 4;
|
|
106
|
+
// The walk stops at a DatabaseError rather than descending past it: an
|
|
107
|
+
// application that catches a stack error and rethrows its own with
|
|
108
|
+
// `{ cause }` — the standard Node idiom — has decided what its caller sees,
|
|
109
|
+
// and reaching through that decision to re-raise the driver failure would
|
|
110
|
+
// replace the application's error with the stack's. Prisma's own commit
|
|
111
|
+
// wrapper carries no DatabaseError, so the COMMIT case is unaffected.
|
|
112
|
+
function driverErrorWithin(error) {
|
|
113
|
+
let candidate = error;
|
|
114
|
+
for (let depth = 0; depth <= CAUSE_DEPTH; depth++) {
|
|
115
|
+
if (candidate instanceof DatabaseError)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (isDriverQueryError(candidate))
|
|
118
|
+
return candidate;
|
|
119
|
+
if (!(candidate instanceof Error))
|
|
120
|
+
return undefined;
|
|
121
|
+
candidate = candidate.cause;
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The stack-owned error for a driver query error, or `undefined` when `error`
|
|
127
|
+
* neither is one nor wraps one — a hook's own throw, a validation failure, or
|
|
128
|
+
* an error this module has already classified.
|
|
129
|
+
*
|
|
130
|
+
* Field resolution is NOT done here: the violated constraint's fields come
|
|
131
|
+
* from the generated constraint map, which is reached through the config the
|
|
132
|
+
* terminal does not hold. `normalizeDatabaseError` performs that second step
|
|
133
|
+
* where the config is in scope.
|
|
134
|
+
*/
|
|
135
|
+
export function classifyDriverError(error) {
|
|
136
|
+
const driver = driverErrorWithin(error);
|
|
137
|
+
if (driver === undefined)
|
|
138
|
+
return undefined;
|
|
139
|
+
const sqlState = asString(driver.sqlState);
|
|
140
|
+
if (sqlState === SERIALIZATION_FAILURE_SQLSTATE) {
|
|
141
|
+
return new SerializationFailure(SERIALIZATION_FAILURE_MESSAGE, { cause: error });
|
|
142
|
+
}
|
|
143
|
+
if (sqlState === UNIQUE_VIOLATION_SQLSTATE) {
|
|
144
|
+
return new UniqueConstraintViolation(GENERIC_UNIQUE_VIOLATION_MESSAGE, { constraintName: asString(driver.constraint) }, { cause: error });
|
|
145
|
+
}
|
|
146
|
+
return new DatabaseError(GENERIC_DATABASE_ERROR_MESSAGE, {}, { cause: error });
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=database-errors.js.map
|