@opensaas/stack-core 0.43.0 → 0.44.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2720 -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 +966 -614
- 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 +540 -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 +282 -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 +135 -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 +457 -677
- 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 +221 -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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throw from a custom or plugin MCP tool handler to return `message` to the
|
|
3
|
+
* client verbatim. Any other error is redacted and logged server-side.
|
|
4
|
+
*/
|
|
5
|
+
export declare class McpToolError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tool-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-error.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throw from a custom or plugin MCP tool handler to return `message` to the
|
|
3
|
+
* client verbatim. Any other error is redacted and logged server-side.
|
|
4
|
+
*/
|
|
5
|
+
export class McpToolError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'McpToolError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=tool-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-error.js","sourceRoot":"","sources":["../../src/mcp/tool-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC5B,CAAC;CACF"}
|
package/dist/mcp/types.d.ts
CHANGED
|
@@ -11,7 +11,8 @@ export type McpSession = {
|
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Session provider function type
|
|
14
|
-
* Auth packages should implement this interface to integrate with MCP
|
|
14
|
+
* Auth packages should implement this interface to integrate with MCP. It receives
|
|
15
|
+
* a clone of the incoming request so a provider can check its method and URL.
|
|
15
16
|
*/
|
|
16
|
-
export type McpSessionProvider = (
|
|
17
|
+
export type McpSessionProvider = (req: Request) => Promise<McpSession | null>;
|
|
17
18
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/mcp/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,CAAA;IAEhB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,CAAA;IAEhB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OpenSaasConfig } from '../config/types.js';
|
|
2
|
+
import type { AccessContext, Session } from '../access/types.js';
|
|
3
|
+
export type ForeignKeyVisibility = (listKey: string, fieldName: string) => boolean;
|
|
4
|
+
/** Which owning relationship fields this session may name a foreign-key column of; a hidden one is left for the engine to refuse exactly as an unknown key. */
|
|
5
|
+
export declare function foreignKeyVisibility(config: OpenSaasConfig, session: Session | null, context: AccessContext): Promise<ForeignKeyVisibility>;
|
|
6
|
+
/**
|
|
7
|
+
* Walk a `where` predicate, coercing every `id` it can reach to its list's
|
|
8
|
+
* own id type: the top level, every AND/OR/NOT branch, and — against the
|
|
9
|
+
* RELATED list's id strategy, since that predicate filters the related
|
|
10
|
+
* list's own rows — every relation quantifier's nested predicate.
|
|
11
|
+
*
|
|
12
|
+
* `null` means a malformed id was found somewhere in the tree. Per #1368
|
|
13
|
+
* that refuses the WHOLE request rather than coercing that leaf to "matches
|
|
14
|
+
* nothing": under `NOT`, "matches nothing" inverts to "matches everything",
|
|
15
|
+
* which would widen the result set — the one direction a denial must never
|
|
16
|
+
* move in. Refusing at the root, before any query runs, closes that off
|
|
17
|
+
* for every position at once rather than needing a per-position rule.
|
|
18
|
+
*/
|
|
19
|
+
export declare function coerceWhereIds(where: Record<string, unknown>, config: OpenSaasConfig, listKey: string, visible?: ForeignKeyVisibility): Record<string, unknown> | null;
|
|
20
|
+
/**
|
|
21
|
+
* The refusal a malformed id gets wherever it can appear. Shape is all the
|
|
22
|
+
* id boundary can check, and this reads the same as a missing or
|
|
23
|
+
* inaccessible row (ADR-0048, Silent failure) — `query`, `update` and
|
|
24
|
+
* `delete` all give it, so a malformed id can never distinguish itself from
|
|
25
|
+
* an ordinary access denial.
|
|
26
|
+
*/
|
|
27
|
+
export declare function idBoundaryRefusal(operationLabel: string): string;
|
|
28
|
+
//# sourceMappingURL=where-id-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"where-id-boundary.d.ts","sourceRoot":"","sources":["../../src/mcp/where-id-boundary.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAahE,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;AAIlF,+JAA+J;AAC/J,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAU/B;AA4FD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAA4C,GACpD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAiDhC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// The id boundary coercion (`parseListId`, ADR-0048), walked across every
|
|
2
|
+
// position a `where` predicate can carry an `id`: the top level, every
|
|
3
|
+
// AND/OR/NOT branch at any depth, and every relation quantifier's own nested
|
|
4
|
+
// predicate. Nothing here decides vocabulary legality — `whereArgument` and
|
|
5
|
+
// the engine's own `resolveWhere` still own that — this only turns a wire id
|
|
6
|
+
// into the type its list's primary key actually carries, wherever one
|
|
7
|
+
// appears (issue #1368).
|
|
8
|
+
import { classifyRowIndependentRead } from '../access/field-access.js';
|
|
9
|
+
import { isRelationshipField } from '../fields/index.js';
|
|
10
|
+
import { ownsForeignKey } from './field-schema.js';
|
|
11
|
+
import { listIdColumn, parseListId } from '../contract/id-boundary.js';
|
|
12
|
+
import { RELATION_QUANTIFIERS } from '../secured/operators.js';
|
|
13
|
+
const LOGICAL_OPERATORS = new Set(['AND', 'OR', 'NOT']);
|
|
14
|
+
function isPlainObject(value) {
|
|
15
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
const allForeignKeysVisible = () => true;
|
|
18
|
+
/** Which owning relationship fields this session may name a foreign-key column of; a hidden one is left for the engine to refuse exactly as an unknown key. */
|
|
19
|
+
export async function foreignKeyVisibility(config, session, context) {
|
|
20
|
+
const hidden = new Set();
|
|
21
|
+
for (const [listKey, listConfig] of Object.entries(config.lists)) {
|
|
22
|
+
for (const [fieldName, fieldConfig] of Object.entries(listConfig.fields)) {
|
|
23
|
+
if (!isRelationshipField(fieldConfig) || fieldConfig.access === undefined)
|
|
24
|
+
continue;
|
|
25
|
+
const answer = await classifyRowIndependentRead(fieldConfig.access, { session, context });
|
|
26
|
+
if (answer !== 'allow')
|
|
27
|
+
hidden.add(`${listKey}.${fieldName}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return (listKey, fieldName) => !hidden.has(`${listKey}.${fieldName}`);
|
|
31
|
+
}
|
|
32
|
+
const ID_VALUE_OPERATORS = new Set(['equals', 'not', 'lt', 'lte', 'gt', 'gte']);
|
|
33
|
+
/** One `id` key's condition — a bare value, `in`/`notIn`, or a scalar operator object. `null` means it names a value the column cannot hold. `nullable` admits a literal `null` (a foreign-key column). */
|
|
34
|
+
function coerceIdCondition(raw, config, listKey, nullable = false) {
|
|
35
|
+
const parse = (value) => {
|
|
36
|
+
if (nullable && value === null)
|
|
37
|
+
return null;
|
|
38
|
+
const parsed = parseListId(config, listKey, value);
|
|
39
|
+
return parsed.ok ? parsed.value : undefined;
|
|
40
|
+
};
|
|
41
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
42
|
+
const parsed = parse(raw);
|
|
43
|
+
return parsed === undefined ? null : parsed;
|
|
44
|
+
}
|
|
45
|
+
const operators = {};
|
|
46
|
+
for (const [operator, value] of Object.entries(raw)) {
|
|
47
|
+
if (operator === 'in' || operator === 'notIn') {
|
|
48
|
+
if (!Array.isArray(value))
|
|
49
|
+
return null;
|
|
50
|
+
const ids = [];
|
|
51
|
+
for (const entry of value) {
|
|
52
|
+
const parsedId = parse(entry);
|
|
53
|
+
if (parsedId === undefined)
|
|
54
|
+
return null;
|
|
55
|
+
ids.push(parsedId);
|
|
56
|
+
}
|
|
57
|
+
operators[operator] = ids;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (operator === 'contains') {
|
|
61
|
+
const strategy = listIdColumn(config, listKey)?.strategy;
|
|
62
|
+
if (strategy !== 'cuid2' && strategy !== 'cuid')
|
|
63
|
+
return null;
|
|
64
|
+
operators[operator] = value;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (!ID_VALUE_OPERATORS.has(operator)) {
|
|
68
|
+
operators[operator] = value;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const parsedId = parse(value);
|
|
72
|
+
if (parsedId === undefined)
|
|
73
|
+
return null;
|
|
74
|
+
operators[operator] = parsedId;
|
|
75
|
+
}
|
|
76
|
+
return operators;
|
|
77
|
+
}
|
|
78
|
+
/** The related list a foreign-key column (`authorId`) points at, when `key` names one this list owns. */
|
|
79
|
+
function foreignKeyRelation(config, listKey, key, visible) {
|
|
80
|
+
if (!key.endsWith('Id') || Object.hasOwn(config.lists[listKey]?.fields ?? {}, key))
|
|
81
|
+
return undefined;
|
|
82
|
+
const fieldName = key.slice(0, -2);
|
|
83
|
+
const fieldConfig = config.lists[listKey]?.fields[fieldName];
|
|
84
|
+
if (!isRelationshipField(fieldConfig))
|
|
85
|
+
return undefined;
|
|
86
|
+
if (!visible(listKey, fieldName))
|
|
87
|
+
return undefined;
|
|
88
|
+
if (!ownsForeignKey(listKey, fieldName, fieldConfig, config))
|
|
89
|
+
return undefined;
|
|
90
|
+
return fieldConfig.ref.split('.')[0];
|
|
91
|
+
}
|
|
92
|
+
/** AND/OR/NOT's own value: one predicate, or a list of them (the same normalisation `whereArgument`'s `branches` applies). */
|
|
93
|
+
function coerceBranches(raw, config, listKey, visible) {
|
|
94
|
+
if (isPlainObject(raw))
|
|
95
|
+
return coerceWhereIds(raw, config, listKey, visible);
|
|
96
|
+
if (!Array.isArray(raw))
|
|
97
|
+
return raw;
|
|
98
|
+
const coerced = [];
|
|
99
|
+
for (const branch of raw) {
|
|
100
|
+
if (!isPlainObject(branch)) {
|
|
101
|
+
coerced.push(branch);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const result = coerceWhereIds(branch, config, listKey, visible);
|
|
105
|
+
if (result === null)
|
|
106
|
+
return null;
|
|
107
|
+
coerced.push(result);
|
|
108
|
+
}
|
|
109
|
+
return coerced;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Walk a `where` predicate, coercing every `id` it can reach to its list's
|
|
113
|
+
* own id type: the top level, every AND/OR/NOT branch, and — against the
|
|
114
|
+
* RELATED list's id strategy, since that predicate filters the related
|
|
115
|
+
* list's own rows — every relation quantifier's nested predicate.
|
|
116
|
+
*
|
|
117
|
+
* `null` means a malformed id was found somewhere in the tree. Per #1368
|
|
118
|
+
* that refuses the WHOLE request rather than coercing that leaf to "matches
|
|
119
|
+
* nothing": under `NOT`, "matches nothing" inverts to "matches everything",
|
|
120
|
+
* which would widen the result set — the one direction a denial must never
|
|
121
|
+
* move in. Refusing at the root, before any query runs, closes that off
|
|
122
|
+
* for every position at once rather than needing a per-position rule.
|
|
123
|
+
*/
|
|
124
|
+
export function coerceWhereIds(where, config, listKey, visible = allForeignKeysVisible) {
|
|
125
|
+
const listConfig = config.lists[listKey];
|
|
126
|
+
if (!listConfig)
|
|
127
|
+
return where;
|
|
128
|
+
const result = { ...where };
|
|
129
|
+
for (const [key, value] of Object.entries(where)) {
|
|
130
|
+
if (LOGICAL_OPERATORS.has(key)) {
|
|
131
|
+
const coerced = coerceBranches(value, config, listKey, visible);
|
|
132
|
+
if (coerced === null)
|
|
133
|
+
return null;
|
|
134
|
+
result[key] = coerced;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (key === 'id') {
|
|
138
|
+
const coerced = coerceIdCondition(value, config, listKey);
|
|
139
|
+
if (coerced === null)
|
|
140
|
+
return null;
|
|
141
|
+
result[key] = coerced;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const foreignKeyOwner = foreignKeyRelation(config, listKey, key, visible);
|
|
145
|
+
if (foreignKeyOwner !== undefined) {
|
|
146
|
+
if (value === null)
|
|
147
|
+
continue;
|
|
148
|
+
const coerced = coerceIdCondition(value, config, foreignKeyOwner, true);
|
|
149
|
+
if (coerced === null)
|
|
150
|
+
return null;
|
|
151
|
+
result[key] = coerced;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const fieldConfig = listConfig.fields[key];
|
|
155
|
+
if (!isRelationshipField(fieldConfig) || !isPlainObject(value))
|
|
156
|
+
continue;
|
|
157
|
+
const relatedListKey = fieldConfig.ref.split('.')[0];
|
|
158
|
+
const nested = { ...value };
|
|
159
|
+
let changed = false;
|
|
160
|
+
for (const quantifier of RELATION_QUANTIFIERS) {
|
|
161
|
+
if (!Object.hasOwn(value, quantifier))
|
|
162
|
+
continue;
|
|
163
|
+
const nestedWhere = value[quantifier];
|
|
164
|
+
if (!isPlainObject(nestedWhere))
|
|
165
|
+
continue;
|
|
166
|
+
const coerced = coerceWhereIds(nestedWhere, config, relatedListKey, visible);
|
|
167
|
+
if (coerced === null)
|
|
168
|
+
return null;
|
|
169
|
+
nested[quantifier] = coerced;
|
|
170
|
+
changed = true;
|
|
171
|
+
}
|
|
172
|
+
if (changed)
|
|
173
|
+
result[key] = nested;
|
|
174
|
+
}
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The refusal a malformed id gets wherever it can appear. Shape is all the
|
|
179
|
+
* id boundary can check, and this reads the same as a missing or
|
|
180
|
+
* inaccessible row (ADR-0048, Silent failure) — `query`, `update` and
|
|
181
|
+
* `delete` all give it, so a malformed id can never distinguish itself from
|
|
182
|
+
* an ordinary access denial.
|
|
183
|
+
*/
|
|
184
|
+
export function idBoundaryRefusal(operationLabel) {
|
|
185
|
+
return `Failed to ${operationLabel}. Access denied or record not found.`;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=where-id-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"where-id-boundary.js","sourceRoot":"","sources":["../../src/mcp/where-id-boundary.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,yBAAyB;AAIzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAoB,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAE9D,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AAE5E,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAID,MAAM,qBAAqB,GAAyB,GAAG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AU,IAAI,oBAAoB,EAAE,CAAC;YAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC;gBAAE,SAAQ;YAC/C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAA;YACrC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;gBAAE,SAAQ;YACzC,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;YAC5E,IAAI,OAAO,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAA;YACjC,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAA;YAC5B,OAAO,GAAG,IAAI,CAAA;QAChB,CAAC;QACD,IAAI,OAAO;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;IACnC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,cAAsB;IACtD,OAAO,aAAa,cAAc,sCAAsC,CAAA;AAC1E,CAAC"}
|
package/dist/origin.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Which declared surface is executing. The store carries this and nothing
|
|
4
|
+
* else — no session, no list key, no operation. Scoping a query to a session
|
|
5
|
+
* stays an ordinary rebind of the secured context (ADR-0012); the tripwire
|
|
6
|
+
* holds no policy (ADR-0038).
|
|
7
|
+
*/
|
|
8
|
+
export type QueryOrigin = 'engine' | 'unsafe';
|
|
9
|
+
/**
|
|
10
|
+
* The async-context store the executing surface enters and the tripwire
|
|
11
|
+
* reads. Exported for surfaces that need the store directly — the Unsafe
|
|
12
|
+
* surface's ORM proxy and the recording middleware — but a surface that only
|
|
13
|
+
* needs to mark an execution should use {@link withOrigin} or
|
|
14
|
+
* {@link preserveOrigin}, which enter it correctly.
|
|
15
|
+
*/
|
|
16
|
+
export declare const originStore: AsyncLocalStorage<QueryOrigin>;
|
|
17
|
+
/** The origin of the current async context, or `undefined` outside any scope. */
|
|
18
|
+
export declare function currentOrigin(): QueryOrigin | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Thrown by {@link originTripwire} when a plan reaches `beforeCompile` with
|
|
21
|
+
* no origin in scope — a query issued through neither the secured surface nor
|
|
22
|
+
* the Unsafe surface.
|
|
23
|
+
*
|
|
24
|
+
* Fails closed in every environment: there is no warn mode and no dev-only
|
|
25
|
+
* mode (ADR-0022, ADR-0038, ADR-0059). Thrown from `beforeCompile`, so a
|
|
26
|
+
* refusal on a follow-up statement rolls back the ORM's implicit transaction,
|
|
27
|
+
* and the error reaches the caller unwrapped — handle it like any other
|
|
28
|
+
* engine error.
|
|
29
|
+
*/
|
|
30
|
+
export declare class UnmarkedQueryError extends Error {
|
|
31
|
+
/** The plan's lane (`orm`, `dsl`, `raw`), as Prisma reports it. */
|
|
32
|
+
lane: string;
|
|
33
|
+
/** The AST kind of the refused plan (`select`, `insert`, …). */
|
|
34
|
+
kind: string;
|
|
35
|
+
constructor(lane: string, kind: string);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Run `execute` inside `origin`, awaiting it in scope.
|
|
39
|
+
*
|
|
40
|
+
* The `await` is inside the scope on purpose: a terminal that returned a lazy
|
|
41
|
+
* result from here would close the scope before the query ran (ADR-0059).
|
|
42
|
+
* This is the helper for a surface that materialises — every engine terminal.
|
|
43
|
+
* A surface that hands a lazy result back uses {@link preserveOrigin}.
|
|
44
|
+
*
|
|
45
|
+
* The scope must wrap the ORM call and nothing else. Hooks run outside it by
|
|
46
|
+
* construction, so a hook's own read has to reach a declared surface and mark
|
|
47
|
+
* itself; running a hook inside the engine's scope would silently bless it.
|
|
48
|
+
*
|
|
49
|
+
* `execute` returns a `PromiseLike<T>`, not a `Promise<T>`: an ORM read
|
|
50
|
+
* terminal returns `AsyncIterableResult`, which has `then` but no `catch`,
|
|
51
|
+
* `finally` or `Symbol.toStringTag`. `withOrigin` still returns a real
|
|
52
|
+
* `Promise<T>`.
|
|
53
|
+
*
|
|
54
|
+
* A driver error raised under the `engine` origin is replaced by its
|
|
55
|
+
* stack-owned counterpart here (ADR-0042). Normalising at the stamp rather
|
|
56
|
+
* than at each terminal is what makes the guarantee structural: an engine
|
|
57
|
+
* terminal is spelled as a call to this function, so a terminal added later
|
|
58
|
+
* cannot leak a raw driver error by forgetting to wrap itself. The `unsafe`
|
|
59
|
+
* origin is left alone, which is the whole of the Unsafe surface's exclusion.
|
|
60
|
+
*/
|
|
61
|
+
export declare function withOrigin<T>(origin: QueryOrigin, execute: () => PromiseLike<T>): Promise<T>;
|
|
62
|
+
/**
|
|
63
|
+
* The consumed surface of Prisma's `AsyncIterableResult` — what a lazy result
|
|
64
|
+
* offers a caller, and everything {@link preserveOrigin} re-enters the scope
|
|
65
|
+
* around.
|
|
66
|
+
*/
|
|
67
|
+
export interface LazyQueryResult<Row> extends AsyncIterable<Row>, PromiseLike<Row[]> {
|
|
68
|
+
[Symbol.asyncIterator](): AsyncIterator<Row>;
|
|
69
|
+
toArray(): Promise<Row[]>;
|
|
70
|
+
first(): Promise<Row | null>;
|
|
71
|
+
firstOrThrow(): Promise<Row>;
|
|
72
|
+
then<TResult1 = Row[], TResult2 = never>(onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Wrap a lazy result so every way of consuming it re-enters `origin`.
|
|
76
|
+
*
|
|
77
|
+
* The four terminals that return Prisma's `AsyncIterableResult` execute at the
|
|
78
|
+
* first `then`/`next` rather than at the call, so a surface that must hand the
|
|
79
|
+
* result back — the Unsafe surface's `query()`, the ORM-lane proxy — cannot
|
|
80
|
+
* simply return it from inside a scope: the scope closes first and the query
|
|
81
|
+
* is refused. Each of `then`, `toArray`, `first`, `firstOrThrow` and the async
|
|
82
|
+
* iterator's `next` therefore enters the scope around the underlying call, so
|
|
83
|
+
* the query executes marked whenever and wherever the caller consumes it.
|
|
84
|
+
* Laziness and streaming are unchanged (ADR-0056, ADR-0059).
|
|
85
|
+
*
|
|
86
|
+
* The scope covers the underlying execution only. Callbacks the caller passes
|
|
87
|
+
* to `then` run under the caller's own origin — `undefined` when the caller is
|
|
88
|
+
* outside any scope — so a continuation is never blessed by the wrapper.
|
|
89
|
+
*
|
|
90
|
+
* Known limits: {@link LazyQueryResult} mirrors `AsyncIterableResult` as
|
|
91
|
+
* published in Prisma `8.0.0-rc.8`, whose whole public surface is the five
|
|
92
|
+
* members declared here. The wrapper returns an object literal, so
|
|
93
|
+
* `instanceof AsyncIterableResult` is false downstream, and a member added in
|
|
94
|
+
* a later release is dropped silently rather than flagged by the compiler —
|
|
95
|
+
* re-check this shape when the pinned ORM version moves.
|
|
96
|
+
*/
|
|
97
|
+
export declare function preserveOrigin<Row>(origin: QueryOrigin, result: LazyQueryResult<Row>): LazyQueryResult<Row>;
|
|
98
|
+
/**
|
|
99
|
+
* The part of a draft plan the tripwire reads: its lane and its AST kind,
|
|
100
|
+
* both only to name what was refused. Prisma's `DraftPlan` satisfies this
|
|
101
|
+
* structurally; the narrower shape is what makes the decision callable — and
|
|
102
|
+
* testable — without a whole middleware context.
|
|
103
|
+
*/
|
|
104
|
+
export interface DraftPlanIdentity {
|
|
105
|
+
readonly meta: {
|
|
106
|
+
readonly lane: string;
|
|
107
|
+
};
|
|
108
|
+
readonly ast: {
|
|
109
|
+
readonly kind: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The tripwire's whole decision: throw {@link UnmarkedQueryError} when no
|
|
114
|
+
* origin is in scope, and otherwise do nothing. Either present value passes —
|
|
115
|
+
* only an absent mark is rejected (ADR-0038) — and there is no warn mode and
|
|
116
|
+
* no dev-only mode (ADR-0022, ADR-0059).
|
|
117
|
+
*/
|
|
118
|
+
export declare function refuseUnmarkedQuery(draft: DraftPlanIdentity): void;
|
|
119
|
+
/**
|
|
120
|
+
* The stack-owned tripwire: refuses any plan compiled with no origin in scope.
|
|
121
|
+
*
|
|
122
|
+
* Registered as the client's `beforeCompile` middleware by the generated
|
|
123
|
+
* context and by the test harness, both of which install this same value.
|
|
124
|
+
* It reads the origin and nothing else — it carries no policy and no session
|
|
125
|
+
* (ADR-0038). It never rewrites the plan.
|
|
126
|
+
*
|
|
127
|
+
* Known limits, against Prisma `8.0.0-rc.8`: a prepared statement runs
|
|
128
|
+
* `beforeCompile` once at `prepare()` and zero times per execution, so neither
|
|
129
|
+
* surface exposes `prepare()` or `runtime()` as one of its own members; an
|
|
130
|
+
* already-compiled `ExecutionPlan` handed to `runtime()` bypasses the
|
|
131
|
+
* middleware chain entirely. Both are addressed by keeping those entry points
|
|
132
|
+
* off each surface's own members, not here (ADR-0059) — narrower than
|
|
133
|
+
* "unreachable": a collection either surface's ORM lane hands back also
|
|
134
|
+
* carries its own `ctx.runtime`, reachable by naming it directly. See the
|
|
135
|
+
* `Known limits` block on `UnsafeSurface` in `./unsafe.js` for what that path
|
|
136
|
+
* does and does not open up.
|
|
137
|
+
*
|
|
138
|
+
* `beforeCompile` declares only the part of the draft it reads and ignores the
|
|
139
|
+
* middleware context, which is what lets a test drive the installed value
|
|
140
|
+
* itself rather than the decision it delegates to.
|
|
141
|
+
*/
|
|
142
|
+
export declare const originTripwire: {
|
|
143
|
+
name: string;
|
|
144
|
+
familyId: "sql";
|
|
145
|
+
beforeCompile(draft: DraftPlanIdentity): Promise<undefined>;
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAKpD;;;;;GAKG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CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACtF,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;CACpC;AAaD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAChC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,GAC3B,eAAe,CAAC,GAAG,CAAC,CAyBtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAIlE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,cAAc;;;yBAGE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAI1C,CAAA"}
|
package/dist/origin.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// The Engine stamp: the ambient origin a declared surface enters around the
|
|
2
|
+
// query it executes, the tripwire that refuses any plan compiled without one,
|
|
3
|
+
// and the refusal error. One module, installed identically by the generated
|
|
4
|
+
// context and by the test harness. See ADR-0059.
|
|
5
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
+
import { classifyDriverError } from './lib/database-errors.js';
|
|
7
|
+
import { processGlobal } from './lib/process-global.js';
|
|
8
|
+
/**
|
|
9
|
+
* The async-context store the executing surface enters and the tripwire
|
|
10
|
+
* reads. Exported for surfaces that need the store directly — the Unsafe
|
|
11
|
+
* surface's ORM proxy and the recording middleware — but a surface that only
|
|
12
|
+
* needs to mark an execution should use {@link withOrigin} or
|
|
13
|
+
* {@link preserveOrigin}, which enter it correctly.
|
|
14
|
+
*/
|
|
15
|
+
export const originStore = sharedOriginStore();
|
|
16
|
+
/**
|
|
17
|
+
* One store per process, not per module instance. The generated context
|
|
18
|
+
* caches one client — and its tripwire — for every bundle, so a store held in
|
|
19
|
+
* module scope would be entered by one layer's Unsafe surface and read by the
|
|
20
|
+
* other layer's tripwire, which refuses the query as unmarked. See
|
|
21
|
+
* `lib/process-global.ts`.
|
|
22
|
+
*/
|
|
23
|
+
function sharedOriginStore() {
|
|
24
|
+
return processGlobal('originStore', (value) => value instanceof AsyncLocalStorage, () => new AsyncLocalStorage());
|
|
25
|
+
}
|
|
26
|
+
/** The origin of the current async context, or `undefined` outside any scope. */
|
|
27
|
+
export function currentOrigin() {
|
|
28
|
+
return originStore.getStore();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Thrown by {@link originTripwire} when a plan reaches `beforeCompile` with
|
|
32
|
+
* no origin in scope — a query issued through neither the secured surface nor
|
|
33
|
+
* the Unsafe surface.
|
|
34
|
+
*
|
|
35
|
+
* Fails closed in every environment: there is no warn mode and no dev-only
|
|
36
|
+
* mode (ADR-0022, ADR-0038, ADR-0059). Thrown from `beforeCompile`, so a
|
|
37
|
+
* refusal on a follow-up statement rolls back the ORM's implicit transaction,
|
|
38
|
+
* and the error reaches the caller unwrapped — handle it like any other
|
|
39
|
+
* engine error.
|
|
40
|
+
*/
|
|
41
|
+
export class UnmarkedQueryError extends Error {
|
|
42
|
+
/** The plan's lane (`orm`, `dsl`, `raw`), as Prisma reports it. */
|
|
43
|
+
lane;
|
|
44
|
+
/** The AST kind of the refused plan (`select`, `insert`, …). */
|
|
45
|
+
kind;
|
|
46
|
+
constructor(lane, kind) {
|
|
47
|
+
super(`Refused to execute an unmarked ${lane}/${kind} query: it reached the database through ` +
|
|
48
|
+
`neither the secured surface (context.db) nor the Unsafe surface. Every query the stack ` +
|
|
49
|
+
`executes is marked with its origin; a query bearing no mark belongs to no declared ` +
|
|
50
|
+
`surface and cannot be shown to have passed access control, so it is refused rather ` +
|
|
51
|
+
`than run unscoped. Route the query through context.db, or through the Unsafe surface ` +
|
|
52
|
+
`if the bypass is intended.`);
|
|
53
|
+
this.name = 'UnmarkedQueryError';
|
|
54
|
+
this.lane = lane;
|
|
55
|
+
this.kind = kind;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Run `execute` inside `origin`, awaiting it in scope.
|
|
60
|
+
*
|
|
61
|
+
* The `await` is inside the scope on purpose: a terminal that returned a lazy
|
|
62
|
+
* result from here would close the scope before the query ran (ADR-0059).
|
|
63
|
+
* This is the helper for a surface that materialises — every engine terminal.
|
|
64
|
+
* A surface that hands a lazy result back uses {@link preserveOrigin}.
|
|
65
|
+
*
|
|
66
|
+
* The scope must wrap the ORM call and nothing else. Hooks run outside it by
|
|
67
|
+
* construction, so a hook's own read has to reach a declared surface and mark
|
|
68
|
+
* itself; running a hook inside the engine's scope would silently bless it.
|
|
69
|
+
*
|
|
70
|
+
* `execute` returns a `PromiseLike<T>`, not a `Promise<T>`: an ORM read
|
|
71
|
+
* terminal returns `AsyncIterableResult`, which has `then` but no `catch`,
|
|
72
|
+
* `finally` or `Symbol.toStringTag`. `withOrigin` still returns a real
|
|
73
|
+
* `Promise<T>`.
|
|
74
|
+
*
|
|
75
|
+
* A driver error raised under the `engine` origin is replaced by its
|
|
76
|
+
* stack-owned counterpart here (ADR-0042). Normalising at the stamp rather
|
|
77
|
+
* than at each terminal is what makes the guarantee structural: an engine
|
|
78
|
+
* terminal is spelled as a call to this function, so a terminal added later
|
|
79
|
+
* cannot leak a raw driver error by forgetting to wrap itself. The `unsafe`
|
|
80
|
+
* origin is left alone, which is the whole of the Unsafe surface's exclusion.
|
|
81
|
+
*/
|
|
82
|
+
export function withOrigin(origin, execute) {
|
|
83
|
+
return originStore.run(origin, async () => {
|
|
84
|
+
if (origin !== 'engine')
|
|
85
|
+
return await execute();
|
|
86
|
+
try {
|
|
87
|
+
return await execute();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw classifyDriverError(error) ?? error;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function inCallerScope(caller, callback) {
|
|
95
|
+
if (callback === undefined || callback === null)
|
|
96
|
+
return callback;
|
|
97
|
+
return (...args) => caller === undefined
|
|
98
|
+
? originStore.exit(() => callback(...args))
|
|
99
|
+
: originStore.run(caller, () => callback(...args));
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Wrap a lazy result so every way of consuming it re-enters `origin`.
|
|
103
|
+
*
|
|
104
|
+
* The four terminals that return Prisma's `AsyncIterableResult` execute at the
|
|
105
|
+
* first `then`/`next` rather than at the call, so a surface that must hand the
|
|
106
|
+
* result back — the Unsafe surface's `query()`, the ORM-lane proxy — cannot
|
|
107
|
+
* simply return it from inside a scope: the scope closes first and the query
|
|
108
|
+
* is refused. Each of `then`, `toArray`, `first`, `firstOrThrow` and the async
|
|
109
|
+
* iterator's `next` therefore enters the scope around the underlying call, so
|
|
110
|
+
* the query executes marked whenever and wherever the caller consumes it.
|
|
111
|
+
* Laziness and streaming are unchanged (ADR-0056, ADR-0059).
|
|
112
|
+
*
|
|
113
|
+
* The scope covers the underlying execution only. Callbacks the caller passes
|
|
114
|
+
* to `then` run under the caller's own origin — `undefined` when the caller is
|
|
115
|
+
* outside any scope — so a continuation is never blessed by the wrapper.
|
|
116
|
+
*
|
|
117
|
+
* Known limits: {@link LazyQueryResult} mirrors `AsyncIterableResult` as
|
|
118
|
+
* published in Prisma `8.0.0-rc.8`, whose whole public surface is the five
|
|
119
|
+
* members declared here. The wrapper returns an object literal, so
|
|
120
|
+
* `instanceof AsyncIterableResult` is false downstream, and a member added in
|
|
121
|
+
* a later release is dropped silently rather than flagged by the compiler —
|
|
122
|
+
* re-check this shape when the pinned ORM version moves.
|
|
123
|
+
*/
|
|
124
|
+
export function preserveOrigin(origin, result) {
|
|
125
|
+
const enter = (call) => originStore.run(origin, call);
|
|
126
|
+
return {
|
|
127
|
+
[Symbol.asyncIterator]() {
|
|
128
|
+
const iterator = enter(() => result[Symbol.asyncIterator]());
|
|
129
|
+
const scoped = {
|
|
130
|
+
next: (...args) => enter(() => iterator.next(...args)),
|
|
131
|
+
};
|
|
132
|
+
const onReturn = iterator.return;
|
|
133
|
+
if (onReturn)
|
|
134
|
+
scoped.return = (value) => enter(() => onReturn.call(iterator, value));
|
|
135
|
+
const onThrow = iterator.throw;
|
|
136
|
+
if (onThrow)
|
|
137
|
+
scoped.throw = (reason) => enter(() => onThrow.call(iterator, reason));
|
|
138
|
+
return scoped;
|
|
139
|
+
},
|
|
140
|
+
toArray: () => enter(() => result.toArray()),
|
|
141
|
+
first: () => enter(() => result.first()),
|
|
142
|
+
firstOrThrow: () => enter(() => result.firstOrThrow()),
|
|
143
|
+
then: (onfulfilled, onrejected) => {
|
|
144
|
+
const caller = originStore.getStore();
|
|
145
|
+
return enter(() => result.then(inCallerScope(caller, onfulfilled), inCallerScope(caller, onrejected)));
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The tripwire's whole decision: throw {@link UnmarkedQueryError} when no
|
|
151
|
+
* origin is in scope, and otherwise do nothing. Either present value passes —
|
|
152
|
+
* only an absent mark is rejected (ADR-0038) — and there is no warn mode and
|
|
153
|
+
* no dev-only mode (ADR-0022, ADR-0059).
|
|
154
|
+
*/
|
|
155
|
+
export function refuseUnmarkedQuery(draft) {
|
|
156
|
+
if (originStore.getStore() === undefined) {
|
|
157
|
+
throw new UnmarkedQueryError(draft.meta.lane, draft.ast.kind);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The stack-owned tripwire: refuses any plan compiled with no origin in scope.
|
|
162
|
+
*
|
|
163
|
+
* Registered as the client's `beforeCompile` middleware by the generated
|
|
164
|
+
* context and by the test harness, both of which install this same value.
|
|
165
|
+
* It reads the origin and nothing else — it carries no policy and no session
|
|
166
|
+
* (ADR-0038). It never rewrites the plan.
|
|
167
|
+
*
|
|
168
|
+
* Known limits, against Prisma `8.0.0-rc.8`: a prepared statement runs
|
|
169
|
+
* `beforeCompile` once at `prepare()` and zero times per execution, so neither
|
|
170
|
+
* surface exposes `prepare()` or `runtime()` as one of its own members; an
|
|
171
|
+
* already-compiled `ExecutionPlan` handed to `runtime()` bypasses the
|
|
172
|
+
* middleware chain entirely. Both are addressed by keeping those entry points
|
|
173
|
+
* off each surface's own members, not here (ADR-0059) — narrower than
|
|
174
|
+
* "unreachable": a collection either surface's ORM lane hands back also
|
|
175
|
+
* carries its own `ctx.runtime`, reachable by naming it directly. See the
|
|
176
|
+
* `Known limits` block on `UnsafeSurface` in `./unsafe.js` for what that path
|
|
177
|
+
* does and does not open up.
|
|
178
|
+
*
|
|
179
|
+
* `beforeCompile` declares only the part of the draft it reads and ignores the
|
|
180
|
+
* middleware context, which is what lets a test drive the installed value
|
|
181
|
+
* itself rather than the decision it delegates to.
|
|
182
|
+
*/
|
|
183
|
+
export const originTripwire = {
|
|
184
|
+
name: 'opensaas-origin-tripwire',
|
|
185
|
+
familyId: 'sql',
|
|
186
|
+
async beforeCompile(draft) {
|
|
187
|
+
refuseUnmarkedQuery(draft);
|
|
188
|
+
return undefined;
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=origin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,iDAAiD;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAUvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,EAAE,CA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