@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,650 @@
|
|
|
1
|
+
// Include refinements: the caller's include tree, resolved into a plan whose
|
|
2
|
+
// every key the config declares and whose every level carries the related
|
|
3
|
+
// list's Access Filter as a refinement `where`. Nothing here imports the ORM —
|
|
4
|
+
// the plan meets a collection in `read.ts`. See ADR-0043, ADR-0044, ADR-0051,
|
|
5
|
+
// ADR-0058, ADR-0061 and ADR-0064.
|
|
6
|
+
//
|
|
7
|
+
// Known limits
|
|
8
|
+
//
|
|
9
|
+
// - The pre-query omission is observable. A relation the caller may not read
|
|
10
|
+
// comes back absent while an undeclared one is refused, so relation NAMES
|
|
11
|
+
// can be enumerated by a caller who can already read the list. Relation
|
|
12
|
+
// names are configuration rather than data, and closing it would mean either
|
|
13
|
+
// fetching every denied relation or varying the refusal by session — see
|
|
14
|
+
// {@link isOmittedBeforeQuery}.
|
|
15
|
+
import { getRelatedListConfig, resolveSyntheticReverseRelation } from '../access/engine.js';
|
|
16
|
+
import { classifyRowIndependentRead } from '../access/field-access.js';
|
|
17
|
+
import { resolveDeclaredDependencies } from '../access/declared-dependencies.js';
|
|
18
|
+
import { resolveQueryField } from '../access/query-validation.js';
|
|
19
|
+
import { READ_INCLUDE_MAX_DEPTH } from '../access/depth-limits.js';
|
|
20
|
+
import { AccessScopeDepthExceededError } from '../access/errors.js';
|
|
21
|
+
import { resolveOrderBy, resolveRelatedAccessPlan, assertWhereWithinLimits, resolveWhere, unqueryableKey, } from './vocabulary.js';
|
|
22
|
+
import { readsTheRow, resolveProjection, UNPROJECTED } from './select.js';
|
|
23
|
+
/**
|
|
24
|
+
* Thrown when a refinement callback returns something this engine did not
|
|
25
|
+
* hand it — most often a callback that composed a value and then forgot to
|
|
26
|
+
* return it. Loud rather than silent: dropping the refinement would run the
|
|
27
|
+
* include unscoped by everything the caller wrote.
|
|
28
|
+
*/
|
|
29
|
+
export class InvalidRefinementError extends Error {
|
|
30
|
+
relation;
|
|
31
|
+
constructor(relation) {
|
|
32
|
+
super(`The refinement for include("${relation}") did not return a refinement. A refinement ` +
|
|
33
|
+
`callback must return the value it composed — \`(rows) => rows.where(...)\` — rather ` +
|
|
34
|
+
`than composing one and returning something else.`);
|
|
35
|
+
this.relation = relation;
|
|
36
|
+
this.name = 'InvalidRefinementError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Thrown when one read names the same relation twice. Neither answer the two
|
|
41
|
+
* requests could be given is safe to pick silently: merging them would AND a
|
|
42
|
+
* refinement the caller wrote for one branch into the other, and letting one
|
|
43
|
+
* win would drop the other's `where` — an include running unscoped by
|
|
44
|
+
* something the caller asked for. Refused instead, naming the relation.
|
|
45
|
+
*/
|
|
46
|
+
export class DuplicateIncludeError extends Error {
|
|
47
|
+
listName;
|
|
48
|
+
relation;
|
|
49
|
+
constructor(listName, relation) {
|
|
50
|
+
super(`Cannot include "${listName}.${relation}" twice in one read. Compose the two refinements ` +
|
|
51
|
+
`into a single include("${relation}", …) rather than naming the relation again — the ` +
|
|
52
|
+
`engine refuses the pair rather than choosing which one applies.`);
|
|
53
|
+
this.listName = listName;
|
|
54
|
+
this.relation = relation;
|
|
55
|
+
this.name = 'DuplicateIncludeError';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Thrown when a reduction is asked of a relation that has no rows to reduce —
|
|
60
|
+
* a to-one. Denial by arity, the same rule ADR-0058 states for what a relation
|
|
61
|
+
* reads as: a to-one is one row or `null`, and counting it would answer a
|
|
62
|
+
* question about the relationship's existence rather than about rows.
|
|
63
|
+
*/
|
|
64
|
+
export class ReducedToOneIncludeError extends Error {
|
|
65
|
+
listName;
|
|
66
|
+
relation;
|
|
67
|
+
constructor(listName, relation) {
|
|
68
|
+
super(`Cannot count "${listName}.${relation}": it is a to-one relation, which reads as one row ` +
|
|
69
|
+
`or null rather than as rows to count. Include it and test the result for null instead.`);
|
|
70
|
+
this.listName = listName;
|
|
71
|
+
this.relation = relation;
|
|
72
|
+
this.name = 'ReducedToOneIncludeError';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Thrown when a refinement that is reduced to a count also composed something
|
|
77
|
+
* a count cannot honour. Refused rather than dropped: silently ignoring a
|
|
78
|
+
* `limit` the caller wrote would answer a different question than the one they
|
|
79
|
+
* asked.
|
|
80
|
+
*/
|
|
81
|
+
export class UnreducibleRefinementError extends Error {
|
|
82
|
+
listName;
|
|
83
|
+
relation;
|
|
84
|
+
member;
|
|
85
|
+
constructor(listName, relation, member) {
|
|
86
|
+
super(`Cannot count "${listName}.${relation}" through a refinement that also calls ` +
|
|
87
|
+
`"${member}()" — a count honours where() alone. Drop the ${member}(), or include the ` +
|
|
88
|
+
`rows instead of counting them.`);
|
|
89
|
+
this.listName = listName;
|
|
90
|
+
this.relation = relation;
|
|
91
|
+
this.member = member;
|
|
92
|
+
this.name = 'UnreducibleRefinementError';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Thrown when a count is asked through a synthetic back-relation whose source
|
|
97
|
+
* field's `read` rule depends on the row. A count cannot apply a per-row rule,
|
|
98
|
+
* so answering it would reveal links the rows branch hides (#1910).
|
|
99
|
+
*/
|
|
100
|
+
export class RowDependentReductionError extends Error {
|
|
101
|
+
listName;
|
|
102
|
+
relation;
|
|
103
|
+
constructor(listName, relation) {
|
|
104
|
+
super(`Cannot count "${listName}.${relation}" for this session. ` + `Include the rows instead.`);
|
|
105
|
+
this.listName = listName;
|
|
106
|
+
this.relation = relation;
|
|
107
|
+
this.name = 'RowDependentReductionError';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Thrown when a window or an order is asked through a synthetic back-relation
|
|
112
|
+
* whose source field's `read` rule depends on the row. The window is cut before
|
|
113
|
+
* the per-row rule strips rows, so a short page would reveal hidden links (#1970).
|
|
114
|
+
*/
|
|
115
|
+
export class RowDependentPagingError extends Error {
|
|
116
|
+
listName;
|
|
117
|
+
relation;
|
|
118
|
+
member;
|
|
119
|
+
constructor(listName, relation, member) {
|
|
120
|
+
super(`Cannot ${member} "${listName}.${relation}" for this session: its source field's read rule ` +
|
|
121
|
+
`depends on the row. Drop the ${member} and page the returned rows instead.`);
|
|
122
|
+
this.listName = listName;
|
|
123
|
+
this.relation = relation;
|
|
124
|
+
this.member = member;
|
|
125
|
+
this.name = 'RowDependentPagingError';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Thrown when a `combine` branch is not a reduction this engine handed out —
|
|
130
|
+
* a branch that named rows rather than a count, or a nested `combine`.
|
|
131
|
+
*/
|
|
132
|
+
export class InvalidCombineBranchError extends Error {
|
|
133
|
+
relation;
|
|
134
|
+
key;
|
|
135
|
+
constructor(relation, key) {
|
|
136
|
+
super(`The combine branch "${key}" on include("${relation}") is not a branch the refinement ` +
|
|
137
|
+
`produced. Every branch must be the rows or a count it composed — \`(rows) => ` +
|
|
138
|
+
`rows.combine({ ${key}: rows.where(…).count() })\`.`);
|
|
139
|
+
this.relation = relation;
|
|
140
|
+
this.key = key;
|
|
141
|
+
this.name = 'InvalidCombineBranchError';
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Thrown when a `combine` names the relation's rows under more than one key.
|
|
146
|
+
* Field Visibility decides a relation's fate once, against one value — see
|
|
147
|
+
* `maskReductions` in `read.ts` — so a second rows branch would return rows no
|
|
148
|
+
* access decision was made about.
|
|
149
|
+
*/
|
|
150
|
+
export class MultipleCombineRowBranchesError extends Error {
|
|
151
|
+
relation;
|
|
152
|
+
keys;
|
|
153
|
+
constructor(relation, keys) {
|
|
154
|
+
super(`The combine on include("${relation}") names the relation's rows under ` +
|
|
155
|
+
`${keys.map((key) => `"${key}"`).join(' and ')}. At most one branch may be the rows ` +
|
|
156
|
+
`themselves; every other branch is a count.`);
|
|
157
|
+
this.relation = relation;
|
|
158
|
+
this.keys = keys;
|
|
159
|
+
this.name = 'MultipleCombineRowBranchesError';
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Thrown when a `combine` branch key collides with one of the engine's own
|
|
164
|
+
* reserved keys ({@link DECLARED_ROWS_BRANCH_KEY}, {@link DECLARED_COUNT_BRANCH_KEY}) —
|
|
165
|
+
* the internal branches a reduced-and-declared relation rides its declared
|
|
166
|
+
* dependency's rows through (see `IncludePlan.declaredRows` and #1357). A
|
|
167
|
+
* collision can only mean a caller wrote the reserved string itself, so it is
|
|
168
|
+
* refused rather than silently shadowed.
|
|
169
|
+
*/
|
|
170
|
+
export class ReservedCombineKeyError extends Error {
|
|
171
|
+
relation;
|
|
172
|
+
key;
|
|
173
|
+
constructor(relation, key) {
|
|
174
|
+
super(`Cannot combine("${relation}", …) with a branch named "${key}" — that name is reserved for ` +
|
|
175
|
+
`this engine's own declared-dependency widening. Choose a different branch name.`);
|
|
176
|
+
this.relation = relation;
|
|
177
|
+
this.key = key;
|
|
178
|
+
this.name = 'ReservedCombineKeyError';
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The `combine()` branch key an internal declared-dependency rows fetch rides
|
|
183
|
+
* under, on a relation that is reduced without a rows branch of its own (see
|
|
184
|
+
* `IncludePlan.declaredRows`, `read.ts`'s `refine`/`maskReductions`/
|
|
185
|
+
* `restoreReductions`, and #1357). Not reachable by a caller-authored
|
|
186
|
+
* `combine()` spec — {@link ReservedCombineKeyError} refuses a caller key that
|
|
187
|
+
* collides with it — so its presence in a raw DB result always means this
|
|
188
|
+
* engine added it.
|
|
189
|
+
*/
|
|
190
|
+
export const DECLARED_ROWS_BRANCH_KEY = '__opensaas_declared_rows__';
|
|
191
|
+
/**
|
|
192
|
+
* The `combine()` branch key a bare `.count()` reduce's own count rides under,
|
|
193
|
+
* once {@link DECLARED_ROWS_BRANCH_KEY} forces the query onto `combine()`
|
|
194
|
+
* instead of a bare `count()`. `restoreReductions` unwraps it back to the
|
|
195
|
+
* plain number a `.count()` caller expects.
|
|
196
|
+
*/
|
|
197
|
+
export const DECLARED_COUNT_BRANCH_KEY = '__opensaas_declared_count__';
|
|
198
|
+
const RESERVED_COMBINE_KEYS = new Set([
|
|
199
|
+
DECLARED_ROWS_BRANCH_KEY,
|
|
200
|
+
DECLARED_COUNT_BRANCH_KEY,
|
|
201
|
+
]);
|
|
202
|
+
/** The key a resolved reduce's own rows branch sits under, if it composed one. */
|
|
203
|
+
function rowsBranchKeyOf(reduce) {
|
|
204
|
+
if (reduce.kind !== 'combine')
|
|
205
|
+
return undefined;
|
|
206
|
+
for (const branch of reduce.branches) {
|
|
207
|
+
if (branch.kind === 'rows')
|
|
208
|
+
return branch.key;
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
function isOrderList(order) {
|
|
213
|
+
return Array.isArray(order);
|
|
214
|
+
}
|
|
215
|
+
/** `orderBy` takes one sort or several; both spellings compose the same list. */
|
|
216
|
+
export function orderList(order) {
|
|
217
|
+
return isOrderList(order) ? order : [order];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The request behind a refinement value. A `WeakMap` rather than a property so
|
|
221
|
+
* the refinement stays as opaque as the wrapper it belongs to (ADR-0041): a
|
|
222
|
+
* caller holding one can reach nothing but the methods above.
|
|
223
|
+
*/
|
|
224
|
+
const requests = new WeakMap();
|
|
225
|
+
/** The request behind a reduction value, held for the same reason. */
|
|
226
|
+
const reductions = new WeakMap();
|
|
227
|
+
function reduction(request) {
|
|
228
|
+
const value = { reduction: 'relation' };
|
|
229
|
+
reductions.set(value, request);
|
|
230
|
+
return value;
|
|
231
|
+
}
|
|
232
|
+
function isReduction(value) {
|
|
233
|
+
return typeof value === 'object' && value !== null && 'reduction' in value;
|
|
234
|
+
}
|
|
235
|
+
function branchesOf(name, spec) {
|
|
236
|
+
const branches = Object.entries(spec).map(([key, value]) => {
|
|
237
|
+
if (RESERVED_COMBINE_KEYS.has(key))
|
|
238
|
+
throw new ReservedCombineKeyError(name, key);
|
|
239
|
+
if (isReduction(value)) {
|
|
240
|
+
const composed = reductions.get(value);
|
|
241
|
+
if (composed === undefined || composed.reduce?.kind !== 'count') {
|
|
242
|
+
throw new InvalidCombineBranchError(name, key);
|
|
243
|
+
}
|
|
244
|
+
return { key, kind: 'count', request: composed };
|
|
245
|
+
}
|
|
246
|
+
const composed = requests.get(value);
|
|
247
|
+
if (composed === undefined)
|
|
248
|
+
throw new InvalidCombineBranchError(name, key);
|
|
249
|
+
return { key, kind: 'rows', request: composed };
|
|
250
|
+
});
|
|
251
|
+
const rows = branches.filter((branch) => branch.kind === 'rows').map((branch) => branch.key);
|
|
252
|
+
if (rows.length > 1)
|
|
253
|
+
throw new MultipleCombineRowBranchesError(name, rows);
|
|
254
|
+
return branches;
|
|
255
|
+
}
|
|
256
|
+
function refinement(request) {
|
|
257
|
+
const value = {
|
|
258
|
+
where: (predicate) => refinement({ ...request, predicates: [...request.predicates, predicate] }),
|
|
259
|
+
orderBy: (order) => refinement({ ...request, orders: [...request.orders, ...orderList(order)] }),
|
|
260
|
+
limit: (count) => refinement({ ...request, limit: count }),
|
|
261
|
+
offset: (count) => refinement({ ...request, offset: count }),
|
|
262
|
+
select: (...fields) => refinement({ ...request, fields }),
|
|
263
|
+
include: (name, refine) => refinement({
|
|
264
|
+
...request,
|
|
265
|
+
includes: [...request.includes, buildIncludeRequest(name, refine)],
|
|
266
|
+
}),
|
|
267
|
+
count: () => reduction({ ...request, reduce: { kind: 'count' } }),
|
|
268
|
+
combine: (spec) => reduction({
|
|
269
|
+
...request,
|
|
270
|
+
reduce: { kind: 'combine', branches: branchesOf(request.name, spec) },
|
|
271
|
+
}),
|
|
272
|
+
};
|
|
273
|
+
requests.set(value, request);
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
/** Run a caller's refinement callback and recover the request it composed. */
|
|
277
|
+
export function buildIncludeRequest(name, refine) {
|
|
278
|
+
const base = { name, predicates: [], orders: [], includes: [] };
|
|
279
|
+
if (refine === undefined)
|
|
280
|
+
return base;
|
|
281
|
+
const result = refine(refinement(base));
|
|
282
|
+
const composed = isReduction(result) ? reductions.get(result) : requests.get(result);
|
|
283
|
+
if (composed === undefined)
|
|
284
|
+
throw new InvalidRefinementError(name);
|
|
285
|
+
return composed;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The foreign key the contract gives this relation, asked of the field itself
|
|
289
|
+
* rather than re-derived here. Neither half is a function of the field's name
|
|
290
|
+
* alone: `db: { foreignKey: { map } }` renames the physical column, and the
|
|
291
|
+
* non-owning side of a one-to-one owns no column at all.
|
|
292
|
+
*/
|
|
293
|
+
export function foreignKeyOf(name, fieldConfig, ctx) {
|
|
294
|
+
const descriptor = fieldConfig.getContractField?.(name, ctx.listName, ctx.config);
|
|
295
|
+
if (descriptor === undefined || descriptor.kind !== 'relation')
|
|
296
|
+
return undefined;
|
|
297
|
+
return descriptor.foreignKey;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Every to-one relationship field on this list that owns a foreign-key
|
|
301
|
+
* column — whether or not this read included or declared it.
|
|
302
|
+
*
|
|
303
|
+
* The foreign key is on the row unconditionally (ADR-0043): Prisma returns it
|
|
304
|
+
* regardless of `include`. `resolveInclude` only ever resolves a relation this
|
|
305
|
+
* read actually named or declared, so a to-one nobody asked for has no
|
|
306
|
+
* {@link IncludePlan} entry and nothing narrows its column — the gap issue
|
|
307
|
+
* #1243 closes. `narrowUnincludedForeignKeys` (`read.ts`) is what actually
|
|
308
|
+
* does that narrowing; this is the enumeration it walks.
|
|
309
|
+
*/
|
|
310
|
+
export function foreignKeyOwningRelations(ctx) {
|
|
311
|
+
const owners = [];
|
|
312
|
+
for (const [name, fieldConfig] of Object.entries(ctx.listConfig.fields)) {
|
|
313
|
+
if (fieldConfig.type !== 'relationship' || !('ref' in fieldConfig) || !fieldConfig.ref)
|
|
314
|
+
continue;
|
|
315
|
+
if ('many' in fieldConfig && fieldConfig.many === true)
|
|
316
|
+
continue;
|
|
317
|
+
const foreignKey = foreignKeyOf(name, fieldConfig, ctx);
|
|
318
|
+
if (foreignKey === undefined)
|
|
319
|
+
continue;
|
|
320
|
+
owners.push({
|
|
321
|
+
relation: name,
|
|
322
|
+
fieldConfig,
|
|
323
|
+
ref: fieldConfig.ref,
|
|
324
|
+
foreignKey: foreignKey.name,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return owners;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Resolve an include key against the list config. A synthetic back-relation
|
|
331
|
+
* (`from_<SourceList>_<field>`, what a list-only `ref` puts on the target
|
|
332
|
+
* list) resolves to the declared field it stands for, so it is scoped by the
|
|
333
|
+
* source list's `query` access exactly as a declared relation would be
|
|
334
|
+
* (ADR-0061). Anything else — an undeclared key, a scalar, the foreign-key
|
|
335
|
+
* column a to-one implies — is refused with the message an undeclared key
|
|
336
|
+
* gets, so this refusal carries no more than the key's own name back: a
|
|
337
|
+
* read-gated relation resolves here exactly as a readable one does, and the
|
|
338
|
+
* omission that follows is the only thing that separates them (ADR-0031, and
|
|
339
|
+
* the `Known limits` note above).
|
|
340
|
+
*/
|
|
341
|
+
function resolveIncludeTarget(name, ctx) {
|
|
342
|
+
const resolved = resolveQueryField(name, ctx.listConfig.fields);
|
|
343
|
+
if (resolved?.isRelationship === true) {
|
|
344
|
+
const related = getRelatedListConfig(resolved.fieldConfig.ref, ctx.config);
|
|
345
|
+
if (!related)
|
|
346
|
+
throw unqueryableKey(ctx.listName, name);
|
|
347
|
+
return {
|
|
348
|
+
relatedListName: related.listName,
|
|
349
|
+
relatedListConfig: related.listConfig,
|
|
350
|
+
arity: resolved.fieldConfig.many === true ? 'many' : 'one',
|
|
351
|
+
fieldConfig: resolved.fieldConfig,
|
|
352
|
+
readGate: resolved.fieldConfig,
|
|
353
|
+
foreignKey: foreignKeyOf(name, resolved.fieldConfig, ctx),
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
if (resolved === undefined) {
|
|
357
|
+
const synthetic = resolveSyntheticReverseRelation(name, ctx.listName, ctx.config);
|
|
358
|
+
if (synthetic) {
|
|
359
|
+
return {
|
|
360
|
+
relatedListName: synthetic.sourceListName,
|
|
361
|
+
relatedListConfig: synthetic.sourceListConfig,
|
|
362
|
+
arity: 'many',
|
|
363
|
+
fieldConfig: undefined,
|
|
364
|
+
readGate: synthetic.sourceFieldConfig,
|
|
365
|
+
foreignKey: undefined,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
throw unqueryableKey(ctx.listName, name);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Whether this relation is left out of the include before the query runs
|
|
373
|
+
* (ADR-0044). Only a **row-independent** denial omits: a rule that reaches
|
|
374
|
+
* into `item` cannot be answered without one, so the relation is fetched and
|
|
375
|
+
* Field Visibility decides. A relation in a live declared dependency set is
|
|
376
|
+
* exempt — the declaring field's hook is entitled to it, and Field Visibility
|
|
377
|
+
* strips it from the caller's result afterwards (ADR-0051).
|
|
378
|
+
*
|
|
379
|
+
* This is an optimisation that can only narrow. Field Visibility re-checks
|
|
380
|
+
* every relation it is handed regardless, so a missed omission is a wasted
|
|
381
|
+
* join and never a leak.
|
|
382
|
+
*
|
|
383
|
+
* It is, however, observable — see the `Known limits` note at the top of this
|
|
384
|
+
* module. ADR-0031's indistinguishable refusal covers the KEY resolution
|
|
385
|
+
* above, which answers identically for a readable and a read-denied relation;
|
|
386
|
+
* it does not extend to the omission, whose whole purpose is to leave the
|
|
387
|
+
* relation out.
|
|
388
|
+
*/
|
|
389
|
+
async function isOmittedBeforeQuery(name, target, ctx) {
|
|
390
|
+
if (!ctx.checkFieldRead)
|
|
391
|
+
return false;
|
|
392
|
+
if (target.readGate?.access === undefined)
|
|
393
|
+
return false;
|
|
394
|
+
const answer = await classifyRowIndependentRead(target.readGate.access, {
|
|
395
|
+
session: ctx.session,
|
|
396
|
+
context: ctx.context,
|
|
397
|
+
});
|
|
398
|
+
if (answer !== 'deny')
|
|
399
|
+
return false;
|
|
400
|
+
return !resolveDeclaredDependencies(ctx.config, ctx.listName).relations.has(name);
|
|
401
|
+
}
|
|
402
|
+
async function resolveProjectionForTarget(shape, target, related, parent) {
|
|
403
|
+
const projection = await resolveProjection(shape.fields, shape.includes.map((nested) => nested.name), related);
|
|
404
|
+
if (target.fieldConfig !== undefined || projection.columns === undefined)
|
|
405
|
+
return projection;
|
|
406
|
+
if (!(await readsTheRow(target.readGate, parent)))
|
|
407
|
+
return projection;
|
|
408
|
+
return { columns: undefined, caller: projection.caller };
|
|
409
|
+
}
|
|
410
|
+
async function resolveInclude(request, ctx, depth, declared, liveDeclaredDependency = false) {
|
|
411
|
+
const target = resolveIncludeTarget(request.name, ctx);
|
|
412
|
+
const related = {
|
|
413
|
+
...ctx,
|
|
414
|
+
listName: target.relatedListName,
|
|
415
|
+
listConfig: target.relatedListConfig,
|
|
416
|
+
};
|
|
417
|
+
// Resolved before the omission is decided, so a refinement naming a key the
|
|
418
|
+
// related list does not declare is refused whether or not this session may
|
|
419
|
+
// see the relation. Deciding the omission first would make the presence of
|
|
420
|
+
// the refusal itself say which relations are readable (ADR-0031).
|
|
421
|
+
const predicates = [];
|
|
422
|
+
for (const predicate of request.predicates) {
|
|
423
|
+
assertWhereWithinLimits(predicate);
|
|
424
|
+
predicates.push(await resolveWhere(predicate, related));
|
|
425
|
+
}
|
|
426
|
+
const orders = await resolveOrderBy(request.orders, related);
|
|
427
|
+
// A declared branch returns to nobody, so nothing on it computes and
|
|
428
|
+
// nothing on it declares (ADR-0051) — the widening stops here rather than
|
|
429
|
+
// recursing, and the branch is read at its full stored width because that
|
|
430
|
+
// is what the declaring hook was promised.
|
|
431
|
+
const shape = rowsBranchOf(request) ?? request;
|
|
432
|
+
const projection = declared
|
|
433
|
+
? UNPROJECTED
|
|
434
|
+
: await resolveProjectionForTarget(shape, target, related, ctx);
|
|
435
|
+
const includes = declared
|
|
436
|
+
? []
|
|
437
|
+
: await resolveIncludes(shape.includes, related, depth + 1, projection.caller);
|
|
438
|
+
if (await isOmittedBeforeQuery(request.name, target, ctx))
|
|
439
|
+
return null;
|
|
440
|
+
const access = await resolveRelatedAccessPlan({ listName: target.relatedListName, listConfig: target.relatedListConfig }, ctx);
|
|
441
|
+
if (access.kind !== 'true')
|
|
442
|
+
predicates.push(access);
|
|
443
|
+
const shapedMember = pagingMemberOf(request);
|
|
444
|
+
if (shapedMember !== undefined &&
|
|
445
|
+
hasNoReduction(request) &&
|
|
446
|
+
(await isRowDependentSyntheticRead(target, ctx))) {
|
|
447
|
+
throw new RowDependentPagingError(ctx.listName, request.name, shapedMember);
|
|
448
|
+
}
|
|
449
|
+
const reduce = request.reduce
|
|
450
|
+
? await resolveReduce(request, target, ctx, related, access)
|
|
451
|
+
: undefined;
|
|
452
|
+
// A relation that is both reduced and a live declared dependency of a
|
|
453
|
+
// sibling computed field must satisfy both: the reduction's own value for
|
|
454
|
+
// the caller, and real rows for the declaring hook's `needs` (#1357). A
|
|
455
|
+
// `combine` rows branch is the caller's own view, so it never stands in.
|
|
456
|
+
const declaredRows = !declared && liveDeclaredDependency && reduce !== undefined
|
|
457
|
+
? access.kind !== 'true'
|
|
458
|
+
? [access]
|
|
459
|
+
: []
|
|
460
|
+
: undefined;
|
|
461
|
+
const callerShaped = request.predicates.length > 0 ||
|
|
462
|
+
request.limit !== undefined ||
|
|
463
|
+
request.offset !== undefined ||
|
|
464
|
+
shape.fields !== undefined ||
|
|
465
|
+
shape.includes.length > 0 ||
|
|
466
|
+
orders.length > 0;
|
|
467
|
+
const declaredFetch = !declared && liveDeclaredDependency && callerShaped && reduce === undefined
|
|
468
|
+
? access.kind !== 'true'
|
|
469
|
+
? [access]
|
|
470
|
+
: []
|
|
471
|
+
: undefined;
|
|
472
|
+
return {
|
|
473
|
+
relation: request.name,
|
|
474
|
+
relatedListName: target.relatedListName,
|
|
475
|
+
arity: target.arity,
|
|
476
|
+
...(target.foreignKey ? { foreignKey: target.foreignKey.name } : {}),
|
|
477
|
+
predicates,
|
|
478
|
+
callerRefined: request.predicates.length > 0,
|
|
479
|
+
callerShaped,
|
|
480
|
+
...(declaredFetch ? { declaredFetch } : {}),
|
|
481
|
+
orders,
|
|
482
|
+
limit: request.limit,
|
|
483
|
+
offset: request.offset,
|
|
484
|
+
includes,
|
|
485
|
+
projection,
|
|
486
|
+
declared,
|
|
487
|
+
...(reduce ? { reduce } : {}),
|
|
488
|
+
...(declaredRows ? { declaredRows } : {}),
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* The request whose `select` and nested includes decide what one relation's
|
|
493
|
+
* value looks like. For a `combine` that is its rows branch: the rest of the
|
|
494
|
+
* engine — the projection, the widening, Field Visibility, the foreign-key
|
|
495
|
+
* pass — then sees the combined relation exactly as it sees an ordinary one.
|
|
496
|
+
*/
|
|
497
|
+
function rowsBranchOf(request) {
|
|
498
|
+
if (request.reduce?.kind !== 'combine')
|
|
499
|
+
return undefined;
|
|
500
|
+
return request.reduce.branches.find((branch) => branch.kind === 'rows')?.request;
|
|
501
|
+
}
|
|
502
|
+
function hasNoReduction(request) {
|
|
503
|
+
return request.reduce === undefined;
|
|
504
|
+
}
|
|
505
|
+
function pagingMemberOf(request) {
|
|
506
|
+
if (request.limit !== undefined)
|
|
507
|
+
return 'limit';
|
|
508
|
+
if (request.offset !== undefined)
|
|
509
|
+
return 'offset';
|
|
510
|
+
if (request.orders.length > 0)
|
|
511
|
+
return 'orderBy';
|
|
512
|
+
return undefined;
|
|
513
|
+
}
|
|
514
|
+
async function isRowDependentSyntheticRead(target, ctx) {
|
|
515
|
+
if (!ctx.checkFieldRead ||
|
|
516
|
+
target.fieldConfig !== undefined ||
|
|
517
|
+
target.readGate?.access === undefined) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
const answer = await classifyRowIndependentRead(target.readGate.access, {
|
|
521
|
+
session: ctx.session,
|
|
522
|
+
context: ctx.context,
|
|
523
|
+
});
|
|
524
|
+
return answer === 'row-dependent';
|
|
525
|
+
}
|
|
526
|
+
/** Refuse what a count cannot honour, naming the member the caller wrote. */
|
|
527
|
+
function checkReducible(request, listName) {
|
|
528
|
+
const member = request.orders.length > 0
|
|
529
|
+
? 'orderBy'
|
|
530
|
+
: request.limit !== undefined
|
|
531
|
+
? 'limit'
|
|
532
|
+
: request.offset !== undefined
|
|
533
|
+
? 'offset'
|
|
534
|
+
: request.includes.length > 0
|
|
535
|
+
? 'include'
|
|
536
|
+
: request.fields !== undefined
|
|
537
|
+
? 'select'
|
|
538
|
+
: undefined;
|
|
539
|
+
if (member !== undefined)
|
|
540
|
+
throw new UnreducibleRefinementError(listName, request.name, member);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Resolve a reduction over an already-resolved relation.
|
|
544
|
+
*
|
|
545
|
+
* Every branch is resolved against the related list's own context and carries
|
|
546
|
+
* the related list's `query` access itself, so a branch is scoped by what the
|
|
547
|
+
* session may see rather than by whatever a sibling branch composed — which is
|
|
548
|
+
* what makes `combine`'s subqueries independent (ADR-0041).
|
|
549
|
+
*/
|
|
550
|
+
async function resolveReduce(request, target, ctx, related, access) {
|
|
551
|
+
const reduce = request.reduce;
|
|
552
|
+
if (reduce === undefined)
|
|
553
|
+
throw new InvalidRefinementError(request.name);
|
|
554
|
+
if (target.arity !== 'many') {
|
|
555
|
+
throw new ReducedToOneIncludeError(ctx.listName, request.name);
|
|
556
|
+
}
|
|
557
|
+
if (ctx.checkFieldRead &&
|
|
558
|
+
target.fieldConfig === undefined &&
|
|
559
|
+
target.readGate?.access !== undefined) {
|
|
560
|
+
const answer = await classifyRowIndependentRead(target.readGate.access, {
|
|
561
|
+
session: ctx.session,
|
|
562
|
+
context: ctx.context,
|
|
563
|
+
});
|
|
564
|
+
if (answer === 'row-dependent')
|
|
565
|
+
throw new RowDependentReductionError(ctx.listName, request.name);
|
|
566
|
+
}
|
|
567
|
+
checkReducible(request, ctx.listName);
|
|
568
|
+
if (reduce.kind === 'count')
|
|
569
|
+
return { kind: 'count' };
|
|
570
|
+
const branches = [];
|
|
571
|
+
for (const branch of reduce.branches) {
|
|
572
|
+
if (branch.kind === 'count')
|
|
573
|
+
checkReducible(branch.request, ctx.listName);
|
|
574
|
+
const predicates = [];
|
|
575
|
+
for (const predicate of branch.request.predicates) {
|
|
576
|
+
assertWhereWithinLimits(predicate);
|
|
577
|
+
predicates.push(await resolveWhere(predicate, related));
|
|
578
|
+
}
|
|
579
|
+
if (access.kind !== 'true')
|
|
580
|
+
predicates.push(access);
|
|
581
|
+
if (branch.kind === 'count') {
|
|
582
|
+
branches.push({ key: branch.key, kind: 'count', predicates });
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
branches.push({
|
|
586
|
+
key: branch.key,
|
|
587
|
+
kind: 'rows',
|
|
588
|
+
predicates,
|
|
589
|
+
orders: await resolveOrderBy(branch.request.orders, related),
|
|
590
|
+
limit: branch.request.limit,
|
|
591
|
+
offset: branch.request.offset,
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
return { kind: 'combine', branches };
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Resolve one level of the caller's include tree.
|
|
598
|
+
*
|
|
599
|
+
* `depth` counts the levels of that tree and nothing else. The engine's own
|
|
600
|
+
* widening for a declared dependency set does not descend through here, so it
|
|
601
|
+
* cannot push a legal read over the cap — a caller must never be refused for
|
|
602
|
+
* field configuration they cannot see (ADR-0043, ADR-0051). This is also not
|
|
603
|
+
* the Access Filter's own recursion bound: that one bounds how far a relation
|
|
604
|
+
* key inside an access rule expands and lives in `vocabulary.ts`.
|
|
605
|
+
*
|
|
606
|
+
* The cap is checked per branch rather than once for the level, so the error
|
|
607
|
+
* names the branch whose own resolution reached it rather than whichever
|
|
608
|
+
* sibling happened to be composed first.
|
|
609
|
+
*/
|
|
610
|
+
export async function resolveIncludes(requests, ctx, depth, selected) {
|
|
611
|
+
const plans = [];
|
|
612
|
+
const named = new Set();
|
|
613
|
+
const declaredNames = new Set(declaredRelations(ctx, selected));
|
|
614
|
+
for (const request of requests) {
|
|
615
|
+
if (named.has(request.name))
|
|
616
|
+
throw new DuplicateIncludeError(ctx.listName, request.name);
|
|
617
|
+
named.add(request.name);
|
|
618
|
+
if (depth >= READ_INCLUDE_MAX_DEPTH) {
|
|
619
|
+
throw new AccessScopeDepthExceededError(ctx.listName, request.name, depth);
|
|
620
|
+
}
|
|
621
|
+
const plan = await resolveInclude(request, ctx, depth, false, declaredNames.has(request.name));
|
|
622
|
+
if (plan !== null)
|
|
623
|
+
plans.push(plan);
|
|
624
|
+
}
|
|
625
|
+
for (const name of declaredNames) {
|
|
626
|
+
if (named.has(name))
|
|
627
|
+
continue;
|
|
628
|
+
named.add(name);
|
|
629
|
+
const plan = await resolveInclude({ name, predicates: [], orders: [], includes: [] }, ctx, depth, true);
|
|
630
|
+
if (plan !== null)
|
|
631
|
+
plans.push(plan);
|
|
632
|
+
}
|
|
633
|
+
return plans;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* The relations the computed fields this level returns declared (ADR-0025,
|
|
637
|
+
* ADR-0051), minus anything that is not a relationship field of this list —
|
|
638
|
+
* a `needs` entry naming a stored column is already on the row, and one
|
|
639
|
+
* naming nothing is `validateNeedsDeclarations`' refusal rather than an
|
|
640
|
+
* include this engine invents.
|
|
641
|
+
*/
|
|
642
|
+
function declaredRelations(ctx, selected) {
|
|
643
|
+
return [...resolveDeclaredDependencies(ctx.config, ctx.listName, selected).relations].filter((name) => {
|
|
644
|
+
const fieldConfig = Object.hasOwn(ctx.listConfig.fields, name)
|
|
645
|
+
? ctx.listConfig.fields[name]
|
|
646
|
+
: undefined;
|
|
647
|
+
return fieldConfig?.type === 'relationship' && 'ref' in fieldConfig && !!fieldConfig.ref;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
//# sourceMappingURL=include.js.map
|