@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
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
import type { Session, AccessContext } from './types.js'
|
|
2
|
-
import type { OpenSaasConfig, FieldConfig, ListConfig } from '../config/types.js'
|
|
3
|
-
import { getRelatedListConfig, resolveSyntheticReverseRelation } from './engine.js'
|
|
4
|
-
import { checkFieldAccess } from './field-access.js'
|
|
5
|
-
import { RESOLVE_CHAIN_MAX_LENGTH } from './depth-limits.js'
|
|
6
|
-
import { ResolveOutputCycleError } from './errors.js'
|
|
7
|
-
import type { DeclaredOnlyTree } from './declared-dependencies.js'
|
|
8
|
-
import { emptyDeclaredOnlyTree } from './declared-dependencies.js'
|
|
9
|
-
import type { FieldSelectionScope } from '../query/index.js'
|
|
10
|
-
import type { ToOneAccessVisibilityTree, CountAccessDenialTree } from './access-filter.js'
|
|
11
|
-
import {
|
|
12
|
-
emptyToOneAccessVisibilityTree,
|
|
13
|
-
isToOneRelationship,
|
|
14
|
-
emptyCountAccessDenialTree,
|
|
15
|
-
} from './access-filter.js'
|
|
16
|
-
// NOTE: `context/index.ts` imports `filterReadableFields` from this module
|
|
17
|
-
// (via the `access/index.ts` barrel) — this is an intentional cyclic
|
|
18
|
-
// dependency, the same shape and for the same reason as the one documented in
|
|
19
|
-
// `context/write-pipeline.ts`. `buildDbDelegate` is only INVOKED when a
|
|
20
|
-
// `resolveOutput` hook actually runs (never during module evaluation), so by
|
|
21
|
-
// the time it runs the export is fully initialised.
|
|
22
|
-
import { buildDbDelegate } from '../context/index.js'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Field Visibility — phase 2 of the two-phase read (post-query).
|
|
26
|
-
*
|
|
27
|
-
* This module runs after the database query against the returned rows. It
|
|
28
|
-
* strips fields the session cannot read (via the canonical `checkFieldAccess`
|
|
29
|
-
* evaluator in `field-access.ts`), runs `resolveOutput` hooks, and computes
|
|
30
|
-
* virtual fields. None of this can move into phase 1: virtual fields are
|
|
31
|
-
* computed in JavaScript and field access can depend on the fetched row.
|
|
32
|
-
*
|
|
33
|
-
* A computed field — any field carrying a `resolveOutput` hook, virtual or
|
|
34
|
-
* not — is produced only where the read is going to return it (ADR-0027). A
|
|
35
|
-
* fragment `query`'s own field selection is the only thing that restricts a
|
|
36
|
-
* level this way; a bare or `include`-based read, and any relation reached
|
|
37
|
-
* purely to satisfy a `needs` declaration, still compute every field, as
|
|
38
|
-
* before. A field the read is not going to return does no work at all —
|
|
39
|
-
* neither its read-access evaluation nor its hook. The projection-aware skip
|
|
40
|
-
* below shows this rule at each of the two places it applies.
|
|
41
|
-
*
|
|
42
|
-
* Phase 1 (pre-query row/relation scoping) lives in `access-filter.ts`. See
|
|
43
|
-
* `docs/adr/0001-access-control-is-a-two-phase-read.md` and the access-control
|
|
44
|
-
* glossary in `CONTEXT.md`.
|
|
45
|
-
*
|
|
46
|
-
* **To-one relation nulling (issue #974).** A to-one relation whose related
|
|
47
|
-
* list's `query` access resolves to a filter cannot be scoped by Prisma's own
|
|
48
|
-
* `where` (it only accepts one on a to-many include — see the "To-one
|
|
49
|
-
* relations" section of `access-filter.ts`'s module doc), so
|
|
50
|
-
* `buildAccessScopedInclude` fetches it unscoped and hands this module a
|
|
51
|
-
* `ToOneAccessVisibilityTree` — already resolved, via one batched existence
|
|
52
|
-
* check per relation across the whole read, by
|
|
53
|
-
* `resolveToOneAccessVisibility`. This module is where that resolution
|
|
54
|
-
* actually becomes the caller-visible `null`: a `kind: 'denied'` key is
|
|
55
|
-
* forced to `null` even though it was never fetched at all (the key is
|
|
56
|
-
* absent from `workingItem`), and a `kind: 'visible'` key's fetched row is
|
|
57
|
-
* nulled out unless its id survived the existence check — in both branches,
|
|
58
|
-
* before any field-level access check or `resolveOutput` hook runs, so the
|
|
59
|
-
* rest of the pipeline sees exactly what a denied to-one read has always
|
|
60
|
-
* meant elsewhere: `null`, never a thrown error.
|
|
61
|
-
*
|
|
62
|
-
* **A denied to-many relation is forced to `[]`, the same way (issue
|
|
63
|
-
* #1103).** `buildAccessScopedInclude` drops a to-many relation from
|
|
64
|
-
* `include` on the same outright `query` denial as a to-one one, and records
|
|
65
|
-
* the same `kind: 'denied'` entry for it. The key is therefore just as absent
|
|
66
|
-
* from `workingItem` as a denied to-one key, and the fix is the same fixup
|
|
67
|
-
* loop — it now forces the key present using the field's own declared
|
|
68
|
-
* arity: `null` for a to-one relation (unchanged), `[]` for a to-many one,
|
|
69
|
-
* rather than leaving a to-many key silently missing where the fragment
|
|
70
|
-
* API's `ResultOf` type (`query/index.ts`) promises an array.
|
|
71
|
-
*
|
|
72
|
-
* **`_count` denial injection (issue #1087).** A caller-supplied `_count.select`
|
|
73
|
-
* key whose related list denies `query` access outright is omitted from the
|
|
74
|
-
* select `buildAccessScopedInclude` sends to Prisma — there is no way to ask
|
|
75
|
-
* Prisma for a guaranteed `0`, and no query is needed to know one (unlike the
|
|
76
|
-
* to-one existence check above). This module is where that becomes the
|
|
77
|
-
* caller-visible `0`: every key in a `CountAccessDenialTree` at this level is
|
|
78
|
-
* written into `filtered._count` as `0`, whether or not `_count` came back
|
|
79
|
-
* from the database at all — a count is a session-relative value, and `0` is
|
|
80
|
-
* what "no visible rows" means for it, never an absent key.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
type ResolveOutputHookRuntime = (args: {
|
|
84
|
-
operation: 'query'
|
|
85
|
-
value: unknown
|
|
86
|
-
item: Record<string, unknown>
|
|
87
|
-
listKey: string
|
|
88
|
-
fieldName: string
|
|
89
|
-
context: AccessContext
|
|
90
|
-
}) => unknown | Promise<unknown>
|
|
91
|
-
|
|
92
|
-
type FieldVisibilityArgs = {
|
|
93
|
-
session: Session | null
|
|
94
|
-
context: AccessContext & { _isSudo?: boolean }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Derive the context passed to a single `resolveOutput` hook invocation: a
|
|
99
|
-
* NEW context object whose `_resolveOutputChain` extends the caller's chain
|
|
100
|
-
* with this hook's own `(list, field)` link. The chain is never mutated in
|
|
101
|
-
* place — this is what lets concurrent hook invocations (e.g. sibling rows in
|
|
102
|
-
* a to-many relation, filtered via `Promise.all`) each see their own chain
|
|
103
|
-
* rather than racing on one shared value (ADR-0023).
|
|
104
|
-
*
|
|
105
|
-
* A plain `{ ...context, _resolveOutputChain }` spread is not enough on its
|
|
106
|
-
* own: `context.db`'s operations capture their `context` at construction
|
|
107
|
-
* (see `populateDbDelegate`), so a hook that calls `context.db.x.findMany(…)`
|
|
108
|
-
* would otherwise reach the ORIGINAL closures — bound to the ORIGINAL
|
|
109
|
-
* context — and its read would silently fall back to the un-extended chain,
|
|
110
|
-
* defeating the cycle guard entirely. Rebuilding `db` via `buildDbDelegate`
|
|
111
|
-
* against the derived context is what makes a hook-issued read's own nested
|
|
112
|
-
* hooks actually observe the extended chain.
|
|
113
|
-
*
|
|
114
|
-
* `config` is required to rebuild `db`; callers that cannot supply one (e.g. a
|
|
115
|
-
* narrow unit test exercising field access in isolation) still get a correct
|
|
116
|
-
* chain for THIS hook's own cycle/cap check, but a read that hook issues
|
|
117
|
-
* would not carry the chain any further — those callers are not exercising
|
|
118
|
-
* the read pipeline, so there is nothing for it to reach.
|
|
119
|
-
*/
|
|
120
|
-
function deriveResolveOutputContext(
|
|
121
|
-
context: AccessContext & { _isSudo?: boolean },
|
|
122
|
-
link: { listKey: string; fieldKey: string },
|
|
123
|
-
config: OpenSaasConfig | undefined,
|
|
124
|
-
): AccessContext & { _isSudo?: boolean } {
|
|
125
|
-
const derived: AccessContext & { _isSudo?: boolean } = {
|
|
126
|
-
...context,
|
|
127
|
-
_resolveOutputChain: [...context._resolveOutputChain, link],
|
|
128
|
-
}
|
|
129
|
-
if (config) {
|
|
130
|
-
derived.db = buildDbDelegate(config, context.prisma, derived)
|
|
131
|
-
}
|
|
132
|
-
return derived
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The core Field Visibility step for a single field: check read access and, if
|
|
137
|
-
* granted, produce the output value by running any `resolveOutput` hook.
|
|
138
|
-
*
|
|
139
|
-
* This is the single place the "check read access → skip if denied →
|
|
140
|
-
* resolveOutput" sequence lives. Both the regular-field branch and the
|
|
141
|
-
* virtual-field branch of `filterReadableFields` call it, so the sequence is
|
|
142
|
-
* never duplicated. Returns `{ readable: false }` when the field must be omitted
|
|
143
|
-
* from the result.
|
|
144
|
-
*
|
|
145
|
-
* `accessItem` is the row used to evaluate field access; `hookItem` is the
|
|
146
|
-
* object passed to the hook as `item`. For a stored field, both are
|
|
147
|
-
* `workingItem` (the row's own stored/fetched columns). For a virtual field,
|
|
148
|
-
* `hookItem` is `computedFieldItem` instead — the same stored columns with
|
|
149
|
-
* every skipped-or-denied key removed — so it never sees another computed
|
|
150
|
-
* field's resolved value (ADR-0027).
|
|
151
|
-
*/
|
|
152
|
-
async function resolveReadableFieldValue(params: {
|
|
153
|
-
fieldConfig: FieldConfig | undefined
|
|
154
|
-
fieldName: string
|
|
155
|
-
value: unknown
|
|
156
|
-
accessItem: Record<string, unknown>
|
|
157
|
-
hookItem: Record<string, unknown>
|
|
158
|
-
listKey: string | undefined
|
|
159
|
-
args: FieldVisibilityArgs
|
|
160
|
-
config: OpenSaasConfig | undefined
|
|
161
|
-
}): Promise<{ readable: false } | { readable: true; value: unknown }> {
|
|
162
|
-
const { fieldConfig, fieldName, value, accessItem, hookItem, listKey, args, config } = params
|
|
163
|
-
|
|
164
|
-
const canRead = await checkFieldAccess(fieldConfig?.access, 'read', {
|
|
165
|
-
...args,
|
|
166
|
-
item: accessItem,
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
if (!canRead) {
|
|
170
|
-
return { readable: false }
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (fieldConfig?.hooks?.resolveOutput && listKey) {
|
|
174
|
-
// The hook is erased to this runtime shape here; at the actual call it
|
|
175
|
-
// receives the value typed for its own field.
|
|
176
|
-
const hook = fieldConfig.hooks.resolveOutput as unknown as ResolveOutputHookRuntime
|
|
177
|
-
const link = { listKey, fieldKey: fieldName }
|
|
178
|
-
const chain = args.context._resolveOutputChain
|
|
179
|
-
|
|
180
|
-
// Cycle guard: a hook that would re-enter a (list, field) pair already on
|
|
181
|
-
// its own chain cannot terminate — refuse loudly rather than recurse
|
|
182
|
-
// until the process runs out of memory (issue #844, ADR-0023).
|
|
183
|
-
const alreadyOnChain = chain.some(
|
|
184
|
-
(entry) => entry.listKey === link.listKey && entry.fieldKey === link.fieldKey,
|
|
185
|
-
)
|
|
186
|
-
if (alreadyOnChain) {
|
|
187
|
-
throw new ResolveOutputCycleError([...chain, link])
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Cost cap: a chain this long is refused only as a cost limit, never a
|
|
191
|
-
// correctness one — an acyclic chain that works today can legitimately
|
|
192
|
-
// reach this. Omit the field and warn instead of throwing.
|
|
193
|
-
if (chain.length >= RESOLVE_CHAIN_MAX_LENGTH) {
|
|
194
|
-
const path = [...chain, link].map((entry) => `${entry.listKey}.${entry.fieldKey}`).join(' → ')
|
|
195
|
-
console.warn(
|
|
196
|
-
`resolveOutput: omitting "${listKey}.${fieldName}" — its resolve chain exceeded ` +
|
|
197
|
-
`RESOLVE_CHAIN_MAX_LENGTH (${RESOLVE_CHAIN_MAX_LENGTH}): ${path}. This is a cost limit, ` +
|
|
198
|
-
`not an access denial.`,
|
|
199
|
-
)
|
|
200
|
-
return { readable: false }
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const resolved = await Promise.resolve(
|
|
204
|
-
hook({
|
|
205
|
-
value,
|
|
206
|
-
operation: 'query',
|
|
207
|
-
fieldName,
|
|
208
|
-
listKey,
|
|
209
|
-
item: hookItem,
|
|
210
|
-
context: deriveResolveOutputContext(args.context, link, config),
|
|
211
|
-
}),
|
|
212
|
-
)
|
|
213
|
-
return { readable: true, value: resolved }
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return { readable: true, value }
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export async function filterReadableFields<T extends Record<string, unknown>>(
|
|
220
|
-
item: T,
|
|
221
|
-
fieldConfigs: Record<string, FieldConfig>,
|
|
222
|
-
args: {
|
|
223
|
-
session: Session | null
|
|
224
|
-
context: AccessContext & { _isSudo?: boolean }
|
|
225
|
-
},
|
|
226
|
-
config?: OpenSaasConfig,
|
|
227
|
-
depth: number = 0,
|
|
228
|
-
listKey?: string,
|
|
229
|
-
// Relation keys added purely to satisfy a field's `needs` (ADR-0025) at
|
|
230
|
-
// THIS level, and the same tree for each nested relation reached via a
|
|
231
|
-
// caller-named branch. Stripped from `filtered` right before it is
|
|
232
|
-
// returned — after resolveOutput has had a chance to read them — so a
|
|
233
|
-
// declared dependency never widens what the caller receives.
|
|
234
|
-
declaredOnly: DeclaredOnlyTree = emptyDeclaredOnlyTree(),
|
|
235
|
-
// The fragment scope this level was reached under (ADR-0027, see module doc
|
|
236
|
-
// above), and the same tree one level down for each nested relation.
|
|
237
|
-
selection?: FieldSelectionScope,
|
|
238
|
-
// Resolved to-one existence checks at THIS level (issue #974, see module
|
|
239
|
-
// doc above), and the same tree one level down for each nested relation —
|
|
240
|
-
// regardless of that relation's own arity, since a filtered to-one can sit
|
|
241
|
-
// beneath a to-many hop.
|
|
242
|
-
toOneVisibility: ToOneAccessVisibilityTree = emptyToOneAccessVisibilityTree(),
|
|
243
|
-
// `_count.select` keys denied outright at THIS level (issue #1087, see
|
|
244
|
-
// module doc above), and the same tree one level down for each nested
|
|
245
|
-
// relation whose own nested include named a further `_count`.
|
|
246
|
-
countDenials: CountAccessDenialTree = emptyCountAccessDenialTree(),
|
|
247
|
-
): Promise<Partial<T>> {
|
|
248
|
-
const filtered: Record<string, unknown> = {}
|
|
249
|
-
|
|
250
|
-
// Multi-column fields (e.g. storage image()/file() in Keystone-parity mode)
|
|
251
|
-
// back several physical columns rather than one. Before the per-field pass,
|
|
252
|
-
// assemble each such field's logical value from its raw columns and remove the
|
|
253
|
-
// raw columns from the working row, so only the assembled value is exposed
|
|
254
|
-
// (the raw per-part columns never leak). The assembled value then flows
|
|
255
|
-
// through the normal read-access + resolveOutput path under the field's own
|
|
256
|
-
// key. See ADR-0006.
|
|
257
|
-
const workingItem: Record<string, unknown> = { ...item }
|
|
258
|
-
for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
|
|
259
|
-
if (!fieldConfig.assembleColumns || !fieldConfig.getColumnNames) continue
|
|
260
|
-
const columnNames = fieldConfig.getColumnNames(fieldName)
|
|
261
|
-
// Only assemble when the raw columns are present in the row (i.e. they were
|
|
262
|
-
// selected); otherwise leave the field absent from the result.
|
|
263
|
-
const hasAnyColumn = columnNames.some((name) => name in workingItem)
|
|
264
|
-
if (!hasAnyColumn) continue
|
|
265
|
-
const assembled = fieldConfig.assembleColumns(fieldName, workingItem)
|
|
266
|
-
for (const name of columnNames) {
|
|
267
|
-
delete workingItem[name]
|
|
268
|
-
}
|
|
269
|
-
workingItem[fieldName] = assembled
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Keys denied by field-level read access during the pass below — as opposed
|
|
273
|
-
// to a key merely skipped by `selection` or held back only for
|
|
274
|
-
// `declaredOnly` stripping. Tracked separately because a denied key must
|
|
275
|
-
// stay invisible to a computed field's hook (below), while a declared-only
|
|
276
|
-
// key must stay VISIBLE to one — that is the entire point of declaring it
|
|
277
|
-
// (ADR-0025) — even though `selection` above skipped adding it to
|
|
278
|
-
// `filtered` because the caller's fragment never asked for it.
|
|
279
|
-
const accessDeniedKeys = new Set<string>()
|
|
280
|
-
|
|
281
|
-
// Process existing fields from the database result
|
|
282
|
-
for (const [fieldName, value] of Object.entries(workingItem)) {
|
|
283
|
-
const fieldConfig = fieldConfigs[fieldName]
|
|
284
|
-
|
|
285
|
-
if (['id', 'createdAt', 'updatedAt'].includes(fieldName)) {
|
|
286
|
-
filtered[fieldName] = value
|
|
287
|
-
continue
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Projection-aware skip (ADR-0027, see module doc above): a field this
|
|
291
|
-
// level's fragment did not select gets no read-access check, no
|
|
292
|
-
// resolveOutput, and no recursion into a relation — none of that work
|
|
293
|
-
// happens for a value the read isn't going to return.
|
|
294
|
-
if (selection?.fields && !selection.fields.has(fieldName)) {
|
|
295
|
-
continue
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Row/relation-level access is already scoped at the DB level via
|
|
299
|
-
// buildAccessScopedInclude; this only handles field-level access (hiding
|
|
300
|
-
// sensitive fields).
|
|
301
|
-
//
|
|
302
|
-
// Deliberately uncapped: the row/relation scoping in access-filter.ts bounds
|
|
303
|
-
// what gets FETCHED (a caller include past its depth cap is now a denial,
|
|
304
|
-
// not a passthrough — see ADR-0022), so by the time a result reaches this
|
|
305
|
-
// function it is already a finite, acyclic tree whose depth was decided at
|
|
306
|
-
// the pre-query phase. Capping recursion again here independently of that
|
|
307
|
-
// cap used to let a relation be scoped correctly at the DB level while
|
|
308
|
-
// still returning with unfiltered fields past this function's own,
|
|
309
|
-
// separately-tracked limit (issue #830).
|
|
310
|
-
const isDeclaredRelationshipField =
|
|
311
|
-
fieldConfig?.type === 'relationship' && 'ref' in fieldConfig && !!fieldConfig.ref
|
|
312
|
-
// A synthetic back-relation (#1082) — no declared field of its own on
|
|
313
|
-
// this list, so resolved by name against the owning list's relationship
|
|
314
|
-
// field instead. `undefined` (not `fieldConfig`) is the signal it's
|
|
315
|
-
// worth trying: a declared-but-non-relationship field (e.g. a scalar or
|
|
316
|
-
// virtual) must fall through to the generic path below, unchanged.
|
|
317
|
-
const synthetic =
|
|
318
|
-
!isDeclaredRelationshipField && fieldConfig === undefined && config && listKey
|
|
319
|
-
? resolveSyntheticReverseRelation(fieldName, listKey, config)
|
|
320
|
-
: null
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
config &&
|
|
324
|
-
(isDeclaredRelationshipField || synthetic) &&
|
|
325
|
-
value !== null &&
|
|
326
|
-
value !== undefined
|
|
327
|
-
) {
|
|
328
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ListConfig must accept any TypeInfo
|
|
329
|
-
let relatedConfig: { listName: string; listConfig: ListConfig<any> } | null = null
|
|
330
|
-
|
|
331
|
-
if (isDeclaredRelationshipField) {
|
|
332
|
-
const canRead = await checkFieldAccess(fieldConfig?.access, 'read', {
|
|
333
|
-
...args,
|
|
334
|
-
item: workingItem,
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
if (!canRead) {
|
|
338
|
-
accessDeniedKeys.add(fieldName)
|
|
339
|
-
continue
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
relatedConfig = getRelatedListConfig(fieldConfig.ref as string, config)
|
|
343
|
-
} else if (synthetic) {
|
|
344
|
-
// No declared field means no field-level `read` gate of its own to
|
|
345
|
-
// check here — the owning list's OWN field-level access is enforced
|
|
346
|
-
// by the recursive `filterReadableFields` call below, exactly as it
|
|
347
|
-
// would be for a declared relationship's related rows.
|
|
348
|
-
relatedConfig = {
|
|
349
|
-
listName: synthetic.sourceListName,
|
|
350
|
-
listConfig: synthetic.sourceListConfig,
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
// The declared-only tree for whatever THIS relation's own list computes,
|
|
354
|
-
// e.g. a field on the related list that declares its own `needs`. Falls
|
|
355
|
-
// back to an empty tree when this relation isn't declaration-related at
|
|
356
|
-
// all — the common case.
|
|
357
|
-
const nestedDeclaredOnly = declaredOnly.nested[fieldName] ?? emptyDeclaredOnlyTree()
|
|
358
|
-
// This relation's own fragment scope, if the caller's fragment named it
|
|
359
|
-
// with a nested Fragment/RelationSelector. `undefined` (a bare `true`
|
|
360
|
-
// selector, or no `selection` at all) means the nested list computes
|
|
361
|
-
// unrestricted — matching what naming a relation without narrowing it
|
|
362
|
-
// further has always meant.
|
|
363
|
-
const nestedSelection = selection?.nested[fieldName]
|
|
364
|
-
// This relation's own resolved to-one visibility, if
|
|
365
|
-
// `buildAccessScopedInclude` flagged anything beneath it (issue #974).
|
|
366
|
-
// Falls back to empty — the common case for a relation with no
|
|
367
|
-
// filtered to-one anywhere in its own nested include.
|
|
368
|
-
const nestedToOneVisibility =
|
|
369
|
-
toOneVisibility.nested[fieldName] ?? emptyToOneAccessVisibilityTree()
|
|
370
|
-
// This key's OWN to-one existence check, if `fieldName` itself is a
|
|
371
|
-
// filtered to-one relation (as opposed to one further down its tree).
|
|
372
|
-
const toOneEntry = toOneVisibility.filters[fieldName]
|
|
373
|
-
// This relation's own denied `_count` keys, if `buildAccessScopedInclude`
|
|
374
|
-
// flagged any beneath it (issue #1087). Falls back to empty — the
|
|
375
|
-
// common case for a relation with no denied `_count` anywhere in its
|
|
376
|
-
// own nested include.
|
|
377
|
-
const nestedCountDenials = countDenials.nested[fieldName] ?? emptyCountAccessDenialTree()
|
|
378
|
-
|
|
379
|
-
if (relatedConfig) {
|
|
380
|
-
if (Array.isArray(value)) {
|
|
381
|
-
filtered[fieldName] = await Promise.all(
|
|
382
|
-
value.map((relatedItem) =>
|
|
383
|
-
filterReadableFields(
|
|
384
|
-
relatedItem,
|
|
385
|
-
relatedConfig.listConfig.fields,
|
|
386
|
-
args,
|
|
387
|
-
config,
|
|
388
|
-
depth + 1,
|
|
389
|
-
relatedConfig.listName,
|
|
390
|
-
nestedDeclaredOnly,
|
|
391
|
-
nestedSelection,
|
|
392
|
-
nestedToOneVisibility,
|
|
393
|
-
nestedCountDenials,
|
|
394
|
-
),
|
|
395
|
-
),
|
|
396
|
-
)
|
|
397
|
-
} else if (typeof value === 'object') {
|
|
398
|
-
const relatedId = (value as Record<string, unknown>).id
|
|
399
|
-
const isVisible =
|
|
400
|
-
!toOneEntry || toOneEntry.kind !== 'visible' || toOneEntry.ids.has(String(relatedId))
|
|
401
|
-
|
|
402
|
-
filtered[fieldName] = isVisible
|
|
403
|
-
? await filterReadableFields(
|
|
404
|
-
value as Record<string, unknown>,
|
|
405
|
-
relatedConfig.listConfig.fields,
|
|
406
|
-
args,
|
|
407
|
-
config,
|
|
408
|
-
depth + 1,
|
|
409
|
-
relatedConfig.listName,
|
|
410
|
-
nestedDeclaredOnly,
|
|
411
|
-
nestedSelection,
|
|
412
|
-
nestedToOneVisibility,
|
|
413
|
-
nestedCountDenials,
|
|
414
|
-
)
|
|
415
|
-
: null
|
|
416
|
-
}
|
|
417
|
-
} else {
|
|
418
|
-
filtered[fieldName] = value
|
|
419
|
-
}
|
|
420
|
-
continue
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// Non-relationship field, or a relationship field whose value is not
|
|
424
|
-
// includable (null/undefined) — falls through to the shared helper.
|
|
425
|
-
const result = await resolveReadableFieldValue({
|
|
426
|
-
fieldConfig,
|
|
427
|
-
fieldName,
|
|
428
|
-
value,
|
|
429
|
-
accessItem: workingItem,
|
|
430
|
-
hookItem: workingItem,
|
|
431
|
-
listKey,
|
|
432
|
-
args,
|
|
433
|
-
config,
|
|
434
|
-
})
|
|
435
|
-
|
|
436
|
-
if (result.readable) {
|
|
437
|
-
filtered[fieldName] = result.value
|
|
438
|
-
} else {
|
|
439
|
-
accessDeniedKeys.add(fieldName)
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// Relations `buildAccessScopedInclude` denied outright (to-one: issue #974,
|
|
444
|
-
// to-many: issue #1103) were never asked of Prisma at all, so `fieldName`
|
|
445
|
-
// has no entry in `workingItem` and the loop above never visits it. Force
|
|
446
|
-
// it present here — matching what a denied read means everywhere else in
|
|
447
|
-
// the context — rather than leaving the key silently absent: `null` for a
|
|
448
|
-
// to-one relation, `[]` for a to-many one. A synthetic back-relation
|
|
449
|
-
// (`fieldConfig` undefined — #1082) is always to-many, the same arity
|
|
450
|
-
// `buildAccessScopedInclude` assumes for it.
|
|
451
|
-
for (const [fieldName, entry] of Object.entries(toOneVisibility.filters)) {
|
|
452
|
-
if (entry.kind !== 'denied') continue
|
|
453
|
-
if (fieldName in filtered || fieldName in workingItem) continue
|
|
454
|
-
if (selection?.fields && !selection.fields.has(fieldName)) continue
|
|
455
|
-
|
|
456
|
-
const fieldConfig = fieldConfigs[fieldName]
|
|
457
|
-
const canRead = await checkFieldAccess(fieldConfig?.access, 'read', {
|
|
458
|
-
...args,
|
|
459
|
-
item: workingItem,
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
if (!canRead) {
|
|
463
|
-
accessDeniedKeys.add(fieldName)
|
|
464
|
-
continue
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
const isToMany = !fieldConfig || !isToOneRelationship(fieldConfig)
|
|
468
|
-
filtered[fieldName] = isToMany ? [] : null
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// `_count.select` keys `buildAccessScopedInclude` denied outright (issue
|
|
472
|
-
// #1087) were omitted from the select sent to Prisma, so `_count` may be
|
|
473
|
-
// absent from `workingItem` entirely, or present but missing exactly these
|
|
474
|
-
// keys. Write each denied key in as `0` — matching what a denied count has
|
|
475
|
-
// always meant for the admin list view's own scoped counts — unless a
|
|
476
|
-
// fragment's own selection excluded `_count` altogether, in which case
|
|
477
|
-
// there is nothing to inject it into.
|
|
478
|
-
if (countDenials.keys.size > 0 && !(selection?.fields && !selection.fields.has('_count'))) {
|
|
479
|
-
const existingCount =
|
|
480
|
-
filtered._count && typeof filtered._count === 'object'
|
|
481
|
-
? (filtered._count as Record<string, unknown>)
|
|
482
|
-
: {}
|
|
483
|
-
const mergedCount = { ...existingCount }
|
|
484
|
-
for (const key of countDenials.keys) {
|
|
485
|
-
mergedCount[key] = 0
|
|
486
|
-
}
|
|
487
|
-
filtered._count = mergedCount
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// The item a virtual field's hook sees: stored columns and fetched
|
|
491
|
-
// relations (from `workingItem`, never a resolved value — no hook's output
|
|
492
|
-
// is ever written back into `workingItem`). A key is visible here if it
|
|
493
|
-
// either survived into `filtered` (selected and allowed) OR exists only to
|
|
494
|
-
// satisfy a `needs` declaration (`declaredOnly` — that IS the point of
|
|
495
|
-
// declaring it: fetched for a hook, never for the caller, ADR-0025).
|
|
496
|
-
// Everything else — field-level denied, or skipped by `selection` and
|
|
497
|
-
// declared by no one — is deleted. A computed field reaches for exactly its
|
|
498
|
-
// own declared dependencies and nothing another field's hook produced
|
|
499
|
-
// (ADR-0027): reaching for a sibling that was denied or skipped-and-
|
|
500
|
-
// undeclared finds nothing there, the same as reaching for one never
|
|
501
|
-
// declared at all, and reaching for a sibling that DID survive finds its
|
|
502
|
-
// raw stored form, never another hook's resolved value — a virtual field
|
|
503
|
-
// computed earlier in declaration order is exactly as invisible as one
|
|
504
|
-
// computed later.
|
|
505
|
-
const computedFieldItem: Record<string, unknown> = { ...workingItem }
|
|
506
|
-
for (const key of Object.keys(workingItem)) {
|
|
507
|
-
if (['id', 'createdAt', 'updatedAt'].includes(key)) continue
|
|
508
|
-
if (accessDeniedKeys.has(key)) {
|
|
509
|
-
delete computedFieldItem[key]
|
|
510
|
-
continue
|
|
511
|
-
}
|
|
512
|
-
if (key in filtered) continue
|
|
513
|
-
if (declaredOnly.keys.has(key)) continue
|
|
514
|
-
delete computedFieldItem[key]
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
|
|
518
|
-
if (fieldName in filtered) {
|
|
519
|
-
continue
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (!fieldConfig.virtual) {
|
|
523
|
-
continue
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// Projection-aware skip (ADR-0027): same rule as the stored-field pass
|
|
527
|
-
// above — a fragment that does not select this virtual field does no
|
|
528
|
-
// work for it at all.
|
|
529
|
-
if (selection?.fields && !selection.fields.has(fieldName)) {
|
|
530
|
-
continue
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// A virtual field with no resolveOutput hook can never produce a value
|
|
534
|
-
// on ANY read — there is nothing to compute, so there is nothing to do,
|
|
535
|
-
// including evaluating its read access (ADR-0027 reconciles the
|
|
536
|
-
// access-only evaluation this branch used to preserve: a field that
|
|
537
|
-
// never has output has no side effect worth preserving access for).
|
|
538
|
-
if (!(fieldConfig.hooks?.resolveOutput && listKey)) {
|
|
539
|
-
continue
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
const result = await resolveReadableFieldValue({
|
|
543
|
-
fieldConfig,
|
|
544
|
-
fieldName,
|
|
545
|
-
value: undefined, // Virtual fields don't have a database value
|
|
546
|
-
accessItem: workingItem,
|
|
547
|
-
hookItem: computedFieldItem,
|
|
548
|
-
listKey,
|
|
549
|
-
args,
|
|
550
|
-
config,
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
if (result.readable) {
|
|
554
|
-
filtered[fieldName] = result.value
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
// Strip relations that were fetched ONLY to satisfy a `needs` declaration
|
|
559
|
-
// (ADR-0025), now that every resolveOutput hook at this level has had the
|
|
560
|
-
// chance to see them (via `computedFieldItem`, never `filtered` itself — a
|
|
561
|
-
// declared dependency is read from stored columns, not from another
|
|
562
|
-
// field's resolved output). A declared dependency is private plumbing, not
|
|
563
|
-
// an implicit `include`: it never widens what the caller receives.
|
|
564
|
-
for (const key of declaredOnly.keys) {
|
|
565
|
-
delete filtered[key]
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return filtered as Partial<T>
|
|
569
|
-
}
|
package/src/access/index.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
AccessControl,
|
|
3
|
-
FieldAccess,
|
|
4
|
-
Session,
|
|
5
|
-
AccessContext,
|
|
6
|
-
PrismaFilter,
|
|
7
|
-
AccessControlledDB,
|
|
8
|
-
PrismaClientLike,
|
|
9
|
-
StorageUtils,
|
|
10
|
-
AugmentedFindMany,
|
|
11
|
-
AugmentedFindUnique,
|
|
12
|
-
FindManyQueryArgs,
|
|
13
|
-
} from './types.js'
|
|
14
|
-
// Operation-level access primitives and shared ref-parsing helper.
|
|
15
|
-
export {
|
|
16
|
-
checkAccess,
|
|
17
|
-
checkCreateAccess,
|
|
18
|
-
mergeFilters,
|
|
19
|
-
isBoolean,
|
|
20
|
-
isPrismaFilter,
|
|
21
|
-
getRelatedListConfig,
|
|
22
|
-
resolveSyntheticReverseRelation,
|
|
23
|
-
listSyntheticReverseRelationNames,
|
|
24
|
-
} from './engine.js'
|
|
25
|
-
export type { SyntheticReverseRelation } from './engine.js'
|
|
26
|
-
// Canonical field-level access evaluation (shared by read and write paths).
|
|
27
|
-
export {
|
|
28
|
-
checkFieldAccess,
|
|
29
|
-
filterWritableFields,
|
|
30
|
-
isFieldReadableForPredicate,
|
|
31
|
-
} from './field-access.js'
|
|
32
|
-
// Read-path key validation — the `findMany`/`count` counterpart to the write
|
|
33
|
-
// path's #564 undeclared-key reject.
|
|
34
|
-
export { validateQueryKeys } from './query-validation.js'
|
|
35
|
-
// Read-path field-level access on `where`/`orderBy` keys — a field the
|
|
36
|
-
// session cannot read cannot be named in a predicate either (#915).
|
|
37
|
-
export { validateQueryFieldReadAccess } from './query-validation.js'
|
|
38
|
-
// Phase 1 — Access Filter (pre-query row/relation scoping).
|
|
39
|
-
export {
|
|
40
|
-
buildAccessScopedInclude,
|
|
41
|
-
buildAccessScopedWhere,
|
|
42
|
-
stripVirtualFieldsFromInclude,
|
|
43
|
-
resolveToOneAccessVisibility,
|
|
44
|
-
emptyToOneAccessFilterTree,
|
|
45
|
-
emptyToOneAccessVisibilityTree,
|
|
46
|
-
emptyCountAccessDenialTree,
|
|
47
|
-
} from './access-filter.js'
|
|
48
|
-
export type {
|
|
49
|
-
ToOneAccessFilterTree,
|
|
50
|
-
ToOneAccessFilterEntry,
|
|
51
|
-
ToOneAccessVisibilityTree,
|
|
52
|
-
ToOneVisibility,
|
|
53
|
-
CountAccessDenialTree,
|
|
54
|
-
} from './access-filter.js'
|
|
55
|
-
// Access-scoped to-many relationship counts (admin list view, issue #732)
|
|
56
|
-
// and the shared per-relation resolver `_count` scoping (issue #1087) reuses.
|
|
57
|
-
export { isToManyRelationshipField, resolveCountAccessEntryForList } from './relationship-count.js'
|
|
58
|
-
export type { CountAccessEntry } from './relationship-count.js'
|
|
59
|
-
// Phase 2 — Field Visibility (post-query field stripping + resolveOutput).
|
|
60
|
-
export { filterReadableFields } from './field-visibility.js'
|
|
61
|
-
// Declared Dependencies — folding `needs` into an include without widening
|
|
62
|
-
// the result (ADR-0025).
|
|
63
|
-
export {
|
|
64
|
-
foldDeclaredDependencies,
|
|
65
|
-
getDeclaredRelationNames,
|
|
66
|
-
emptyDeclaredOnlyTree,
|
|
67
|
-
} from './declared-dependencies.js'
|
|
68
|
-
export type { DeclaredOnlyTree } from './declared-dependencies.js'
|
|
69
|
-
// Thrown when a caller include reaches past the depth the Access Filter can scope.
|
|
70
|
-
export { AccessScopeDepthExceededError } from './errors.js'
|
|
71
|
-
// Thrown when a resolveOutput hook's own resolve chain cycles back into itself.
|
|
72
|
-
export { ResolveOutputCycleError } from './errors.js'
|
|
73
|
-
// Thrown when a field-level access control function returns a non-boolean result.
|
|
74
|
-
export { InvalidFieldAccessResultError } from './errors.js'
|
|
75
|
-
// Thrown when operation-level `create` access control returns a non-boolean result (#1009).
|
|
76
|
-
export { InvalidCreateAccessResultError } from './errors.js'
|
|
77
|
-
// Thrown when a relation filter's related list denies query access outright (#916).
|
|
78
|
-
export { RelationFilterAccessDeniedError } from './errors.js'
|
|
79
|
-
// Thrown when a caller `include` names a key that is neither declared, synthetic, nor `_count` (#1082).
|
|
80
|
-
export { UndeclaredIncludeKeyError } from './errors.js'
|
|
81
|
-
// Thrown when a caller `_count.select` names a key that is not a countable to-many relation (#1087).
|
|
82
|
-
export { UndeclaredCountKeyError } from './errors.js'
|