@contember/engine-content-api 2.2.0-alpha.18 → 2.2.0-alpha.19
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/dist/development/index.cjs +3 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +4 -1
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/ExecutionContainer.cjs +1 -0
- package/dist/development/src/ExecutionContainer.cjs.map +1 -1
- package/dist/development/src/ExecutionContainer.js +1 -0
- package/dist/development/src/ExecutionContainer.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +2 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +2 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +5 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +5 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +2 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +2 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +4 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +4 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs +24 -3
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js +24 -3
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs +52 -2
- package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.js +52 -2
- package/dist/development/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.cjs +10 -0
- package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.js +10 -0
- package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/development/src/mapper/Mapper.cjs +37 -1
- package/dist/development/src/mapper/Mapper.cjs.map +1 -1
- package/dist/development/src/mapper/Mapper.js +38 -2
- package/dist/development/src/mapper/Mapper.js.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.cjs +12 -0
- package/dist/development/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.js +13 -1
- package/dist/development/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/development/src/mapper/Result.cjs +1 -0
- package/dist/development/src/mapper/Result.cjs.map +1 -1
- package/dist/development/src/mapper/Result.js +1 -0
- package/dist/development/src/mapper/Result.js.map +1 -1
- package/dist/development/src/mapper/delete/DeleteExecutor.cjs +1 -1
- package/dist/development/src/mapper/delete/DeleteExecutor.js +1 -1
- package/dist/development/src/mapper/select/handlers/MetaHandler.cjs +1 -1
- package/dist/development/src/mapper/select/handlers/MetaHandler.js +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs +2 -2
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereReplacer.cjs +3 -3
- package/dist/development/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereReplacer.js +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs +6 -3
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js +7 -4
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/Updater.cjs +1 -1
- package/dist/development/src/mapper/update/Updater.js +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +6 -0
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +6 -0
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +6 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +6 -0
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/SetManyRelationHelper.cjs +123 -0
- package/dist/development/src/mapper/update/relations/SetManyRelationHelper.cjs.map +1 -0
- package/dist/development/src/mapper/update/relations/SetManyRelationHelper.js +123 -0
- package/dist/development/src/mapper/update/relations/SetManyRelationHelper.js.map +1 -0
- package/dist/development/src/resolvers/MutationResolver.cjs +4 -1
- package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/MutationResolver.js +4 -1
- package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.cjs +2 -1
- package/dist/development/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.js +2 -1
- package/dist/development/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/development/src/schema/CustomTypesProvider.cjs +35 -14
- package/dist/development/src/schema/CustomTypesProvider.cjs.map +1 -1
- package/dist/development/src/schema/CustomTypesProvider.js +36 -15
- package/dist/development/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/development/src/schema/EntityTypeProvider.cjs +8 -5
- package/dist/development/src/schema/EntityTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/EntityTypeProvider.js +8 -5
- package/dist/development/src/schema/EntityTypeProvider.js.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js +1 -1
- package/dist/development/src/schema/MutationProvider.cjs +4 -0
- package/dist/development/src/schema/MutationProvider.cjs.map +1 -1
- package/dist/development/src/schema/MutationProvider.js +4 -0
- package/dist/development/src/schema/MutationProvider.js.map +1 -1
- package/dist/development/src/schema/OrderByTypeProvider.cjs +8 -2
- package/dist/development/src/schema/OrderByTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/OrderByTypeProvider.js +9 -3
- package/dist/development/src/schema/OrderByTypeProvider.js.map +1 -1
- package/dist/development/src/schema/QueryProvider.cjs +3 -0
- package/dist/development/src/schema/QueryProvider.cjs.map +1 -1
- package/dist/development/src/schema/QueryProvider.js +3 -0
- package/dist/development/src/schema/QueryProvider.js.map +1 -1
- package/dist/development/src/schema/ValidationQueriesProvider.cjs +2 -0
- package/dist/development/src/schema/ValidationQueriesProvider.cjs.map +1 -1
- package/dist/development/src/schema/ValidationQueriesProvider.js +2 -0
- package/dist/development/src/schema/ValidationQueriesProvider.js.map +1 -1
- package/dist/development/src/schema/WhereTypeProvider.cjs +17 -5
- package/dist/development/src/schema/WhereTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/WhereTypeProvider.js +18 -6
- package/dist/development/src/schema/WhereTypeProvider.js.map +1 -1
- package/dist/development/src/schema/calendarDate.cjs +21 -0
- package/dist/development/src/schema/calendarDate.cjs.map +1 -0
- package/dist/development/src/schema/calendarDate.js +21 -0
- package/dist/development/src/schema/calendarDate.js.map +1 -0
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs +11 -3
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js +11 -3
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs +11 -3
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js +11 -3
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +39 -2
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +40 -3
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/utils.cjs +10 -0
- package/dist/development/src/schema/utils.cjs.map +1 -1
- package/dist/development/src/schema/utils.js +11 -1
- package/dist/development/src/schema/utils.js.map +1 -1
- package/dist/production/index.cjs +3 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +4 -1
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/ExecutionContainer.cjs +1 -0
- package/dist/production/src/ExecutionContainer.cjs.map +1 -1
- package/dist/production/src/ExecutionContainer.js +1 -0
- package/dist/production/src/ExecutionContainer.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +2 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +2 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +5 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +5 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +2 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +2 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +4 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +4 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs +24 -3
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js +24 -3
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs +52 -2
- package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.js +52 -2
- package/dist/production/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.cjs +10 -0
- package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.js +10 -0
- package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/production/src/mapper/Mapper.cjs +37 -1
- package/dist/production/src/mapper/Mapper.cjs.map +1 -1
- package/dist/production/src/mapper/Mapper.js +38 -2
- package/dist/production/src/mapper/Mapper.js.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.cjs +12 -0
- package/dist/production/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.js +13 -1
- package/dist/production/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/production/src/mapper/Result.cjs +1 -0
- package/dist/production/src/mapper/Result.cjs.map +1 -1
- package/dist/production/src/mapper/Result.js +1 -0
- package/dist/production/src/mapper/Result.js.map +1 -1
- package/dist/production/src/mapper/delete/DeleteExecutor.cjs +1 -1
- package/dist/production/src/mapper/delete/DeleteExecutor.js +1 -1
- package/dist/production/src/mapper/select/handlers/MetaHandler.cjs +1 -1
- package/dist/production/src/mapper/select/handlers/MetaHandler.js +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs +2 -2
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereReplacer.cjs +3 -3
- package/dist/production/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereReplacer.js +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs +6 -3
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js +7 -4
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/Updater.cjs +1 -1
- package/dist/production/src/mapper/update/Updater.js +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +6 -0
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +6 -0
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +6 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +6 -0
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/SetManyRelationHelper.cjs +123 -0
- package/dist/production/src/mapper/update/relations/SetManyRelationHelper.cjs.map +1 -0
- package/dist/production/src/mapper/update/relations/SetManyRelationHelper.js +123 -0
- package/dist/production/src/mapper/update/relations/SetManyRelationHelper.js.map +1 -0
- package/dist/production/src/resolvers/MutationResolver.cjs +4 -1
- package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/MutationResolver.js +4 -1
- package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.cjs +2 -1
- package/dist/production/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.js +2 -1
- package/dist/production/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/production/src/schema/CustomTypesProvider.cjs +35 -14
- package/dist/production/src/schema/CustomTypesProvider.cjs.map +1 -1
- package/dist/production/src/schema/CustomTypesProvider.js +36 -15
- package/dist/production/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/production/src/schema/EntityTypeProvider.cjs +8 -5
- package/dist/production/src/schema/EntityTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/EntityTypeProvider.js +8 -5
- package/dist/production/src/schema/EntityTypeProvider.js.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js +1 -1
- package/dist/production/src/schema/MutationProvider.cjs +4 -0
- package/dist/production/src/schema/MutationProvider.cjs.map +1 -1
- package/dist/production/src/schema/MutationProvider.js +4 -0
- package/dist/production/src/schema/MutationProvider.js.map +1 -1
- package/dist/production/src/schema/OrderByTypeProvider.cjs +8 -2
- package/dist/production/src/schema/OrderByTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/OrderByTypeProvider.js +9 -3
- package/dist/production/src/schema/OrderByTypeProvider.js.map +1 -1
- package/dist/production/src/schema/QueryProvider.cjs +3 -0
- package/dist/production/src/schema/QueryProvider.cjs.map +1 -1
- package/dist/production/src/schema/QueryProvider.js +3 -0
- package/dist/production/src/schema/QueryProvider.js.map +1 -1
- package/dist/production/src/schema/ValidationQueriesProvider.cjs +2 -0
- package/dist/production/src/schema/ValidationQueriesProvider.cjs.map +1 -1
- package/dist/production/src/schema/ValidationQueriesProvider.js +2 -0
- package/dist/production/src/schema/ValidationQueriesProvider.js.map +1 -1
- package/dist/production/src/schema/WhereTypeProvider.cjs +17 -5
- package/dist/production/src/schema/WhereTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/WhereTypeProvider.js +18 -6
- package/dist/production/src/schema/WhereTypeProvider.js.map +1 -1
- package/dist/production/src/schema/calendarDate.cjs +21 -0
- package/dist/production/src/schema/calendarDate.cjs.map +1 -0
- package/dist/production/src/schema/calendarDate.js +21 -0
- package/dist/production/src/schema/calendarDate.js.map +1 -0
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs +11 -3
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js +11 -3
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs +11 -3
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js +11 -3
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +39 -2
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +40 -3
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/utils.cjs +10 -0
- package/dist/production/src/schema/utils.cjs.map +1 -1
- package/dist/production/src/schema/utils.js +11 -1
- package/dist/production/src/schema/utils.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/checkViolationError.test.d.ts +2 -0
- package/dist/tests/cases/unit/checkViolationError.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/dateType.test.d.ts +2 -0
- package/dist/tests/cases/unit/dateType.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts.map +1 -1
- package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts +6 -0
- package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts.map +1 -1
- package/dist/types/inputProcessing/UpdateInputProcessor.d.ts +7 -0
- package/dist/types/inputProcessing/UpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts +2 -0
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
- package/dist/types/mapper/ErrorUtils.d.ts.map +1 -1
- package/dist/types/mapper/Mapper.d.ts +5 -0
- package/dist/types/mapper/Mapper.d.ts.map +1 -1
- package/dist/types/mapper/MutationProcessorHelper.d.ts +3 -0
- package/dist/types/mapper/MutationProcessorHelper.d.ts.map +1 -1
- package/dist/types/mapper/Result.d.ts +2 -1
- package/dist/types/mapper/Result.d.ts.map +1 -1
- package/dist/types/mapper/types.d.ts +8 -1
- package/dist/types/mapper/types.d.ts.map +1 -1
- package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts +5 -0
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts +5 -0
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/SetManyRelationHelper.d.ts +67 -0
- package/dist/types/mapper/update/relations/SetManyRelationHelper.d.ts.map +1 -0
- package/dist/types/resolvers/MutationResolver.d.ts.map +1 -1
- package/dist/types/schema/CustomTypesProvider.d.ts.map +1 -1
- package/dist/types/schema/EntityTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/MutationProvider.d.ts.map +1 -1
- package/dist/types/schema/OrderByTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/QueryProvider.d.ts.map +1 -1
- package/dist/types/schema/ValidationQueriesProvider.d.ts.map +1 -1
- package/dist/types/schema/WhereTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/calendarDate.d.ts +6 -0
- package/dist/types/schema/calendarDate.d.ts.map +1 -0
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/index.d.ts.map +1 -1
- package/dist/types/schema/mutations/CreateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts +3 -0
- package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts +1 -0
- package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/utils.d.ts +7 -0
- package/dist/types/schema/utils.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts +3 -0
- package/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts +9 -7
- package/src/input-validation/preValidation/UpdateInputPreValidationProcessor.ts +29 -0
- package/src/inputProcessing/UpdateInputProcessor.ts +6 -0
- package/src/inputProcessing/UpdateInputVisitor.ts +64 -2
- package/src/mapper/ErrorUtils.ts +11 -0
- package/src/mapper/Mapper.ts +61 -1
- package/src/mapper/MutationProcessorHelper.ts +14 -0
- package/src/mapper/Result.ts +1 -0
- package/src/mapper/select/optimizer/WhereOptimizer.ts +1 -1
- package/src/mapper/select/optimizer/WhereReplacer.ts +1 -1
- package/src/mapper/types.ts +16 -1
- package/src/mapper/update/SqlUpdateInputProcessor.ts +4 -1
- package/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.ts +9 -0
- package/src/mapper/update/relations/OneHasManyUpdateInputProcessor.ts +9 -0
- package/src/mapper/update/relations/SetManyRelationHelper.ts +199 -0
- package/src/resolvers/MutationResolver.ts +2 -0
- package/src/schema/CustomTypesProvider.ts +40 -15
- package/src/schema/EntityTypeProvider.ts +8 -4
- package/src/schema/MutationProvider.ts +4 -0
- package/src/schema/OrderByTypeProvider.ts +9 -3
- package/src/schema/QueryProvider.ts +3 -0
- package/src/schema/ValidationQueriesProvider.ts +2 -0
- package/src/schema/WhereTypeProvider.ts +18 -6
- package/src/schema/calendarDate.ts +26 -0
- package/src/schema/index.ts +1 -0
- package/src/schema/mutations/CreateEntityInputFieldVisitor.ts +10 -2
- package/src/schema/mutations/UpdateEntityInputFieldVisitor.ts +10 -2
- package/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.ts +66 -7
- package/src/schema/utils.ts +14 -0
- package/src/tsconfig.json +2 -1
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.ts +219 -0
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.ts +479 -0
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.ts +948 -0
- package/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.ts +102 -1
- package/tests/cases/integration/graphQlSchema/schema-acl-allowed.gql +17 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-create-only.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-create.gql +14 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-delete.gql +11 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-read.gql +254 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-update.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-acl.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-aliased-type.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-array.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-basic.gql +50 -0
- package/tests/cases/integration/graphQlSchema/schema-bug-66.gql +17 -0
- package/tests/cases/integration/graphQlSchema/schema-column-types.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-custom-primary.gql +50 -0
- package/tests/cases/integration/graphQlSchema/schema-deprecation.gql +962 -0
- package/tests/cases/integration/graphQlSchema/schema-description.gql +992 -0
- package/tests/cases/integration/graphQlSchema/schema-has-many-reduction.gql +17 -0
- package/tests/cases/integration/graphQlSchema/schema-mixed-root-through.gql +1 -0
- package/tests/cases/integration/graphQlSchema/schema-new-builder.gql +50 -0
- package/tests/cases/integration/graphQlSchema/schema-no-root-ops.gql +1 -0
- package/tests/cases/unit/checkViolationError.test.ts +49 -0
- package/tests/cases/unit/dateType.test.ts +46 -0
- package/tests/cases/unit/decimalType.test.ts +2 -2
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { test } from 'bun:test'
|
|
2
|
+
import { Acl } from '@contember/schema'
|
|
3
|
+
import { execute, failedTransaction, sqlTransaction } from '../../../../../src/test.js'
|
|
4
|
+
import { GQL, SQL } from '../../../../../src/tags.js'
|
|
5
|
+
import { testUuid } from '../../../../../src/testUuid.js'
|
|
6
|
+
import { postWithCategories } from './schema.js'
|
|
7
|
+
|
|
8
|
+
test('set with default orphanStrategy (disconnect) - junction', async () => {
|
|
9
|
+
await execute({
|
|
10
|
+
schema: postWithCategories,
|
|
11
|
+
query: GQL`mutation {
|
|
12
|
+
updatePost(
|
|
13
|
+
by: {id: "${testUuid(2)}"},
|
|
14
|
+
data: {categories: {set: [{connect: {id: "${testUuid(1)}"}}]}}
|
|
15
|
+
) {
|
|
16
|
+
ok
|
|
17
|
+
}
|
|
18
|
+
}`,
|
|
19
|
+
executes: [
|
|
20
|
+
...sqlTransaction([
|
|
21
|
+
{
|
|
22
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
23
|
+
parameters: [testUuid(2)],
|
|
24
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
28
|
+
parameters: [testUuid(2)],
|
|
29
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
33
|
+
parameters: [testUuid(1)],
|
|
34
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
35
|
+
},
|
|
36
|
+
// orphan (id=3) is disconnected from the junction
|
|
37
|
+
{
|
|
38
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
39
|
+
parameters: [testUuid(3)],
|
|
40
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
sql: SQL`delete from "public"."post_categories"
|
|
44
|
+
where "post_id" = ? and "category_id" = ?`,
|
|
45
|
+
parameters: [testUuid(2), testUuid(3)],
|
|
46
|
+
response: { rowCount: 1 },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
|
|
50
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
51
|
+
response: { rowCount: 1 },
|
|
52
|
+
},
|
|
53
|
+
]),
|
|
54
|
+
],
|
|
55
|
+
return: {
|
|
56
|
+
data: {
|
|
57
|
+
updatePost: {
|
|
58
|
+
ok: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test('set with orphanStrategy delete - junction', async () => {
|
|
66
|
+
await execute({
|
|
67
|
+
schema: postWithCategories,
|
|
68
|
+
query: GQL`mutation {
|
|
69
|
+
updatePost(
|
|
70
|
+
by: {id: "${testUuid(2)}"},
|
|
71
|
+
data: {categories: {orphanStrategy: delete, set: [{connect: {id: "${testUuid(1)}"}}]}}
|
|
72
|
+
) {
|
|
73
|
+
ok
|
|
74
|
+
}
|
|
75
|
+
}`,
|
|
76
|
+
executes: [
|
|
77
|
+
...sqlTransaction([
|
|
78
|
+
{
|
|
79
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
80
|
+
parameters: [testUuid(2)],
|
|
81
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
85
|
+
parameters: [testUuid(2)],
|
|
86
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
90
|
+
parameters: [testUuid(1)],
|
|
91
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
92
|
+
},
|
|
93
|
+
// orphan (id=3) is deleted
|
|
94
|
+
{
|
|
95
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
96
|
+
parameters: [testUuid(3)],
|
|
97
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
sql: SQL`select "root_"."id" as "id", true as "allowed" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
101
|
+
parameters: [testUuid(3)],
|
|
102
|
+
response: { rows: [{ id: testUuid(3), allowed: true }] },
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
sql: SQL`delete from "public"."category" where "id" in (?)`,
|
|
106
|
+
parameters: [testUuid(3)],
|
|
107
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
|
|
111
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
112
|
+
response: { rowCount: 1 },
|
|
113
|
+
},
|
|
114
|
+
]),
|
|
115
|
+
],
|
|
116
|
+
return: {
|
|
117
|
+
data: {
|
|
118
|
+
updatePost: {
|
|
119
|
+
ok: true,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
test('empty set clears the whole collection - junction', async () => {
|
|
127
|
+
await execute({
|
|
128
|
+
schema: postWithCategories,
|
|
129
|
+
query: GQL`mutation {
|
|
130
|
+
updatePost(
|
|
131
|
+
by: {id: "${testUuid(2)}"},
|
|
132
|
+
data: {categories: {set: []}}
|
|
133
|
+
) {
|
|
134
|
+
ok
|
|
135
|
+
}
|
|
136
|
+
}`,
|
|
137
|
+
executes: [
|
|
138
|
+
...sqlTransaction([
|
|
139
|
+
{
|
|
140
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
141
|
+
parameters: [testUuid(2)],
|
|
142
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
143
|
+
},
|
|
144
|
+
// no desired members - every junction row is an orphan
|
|
145
|
+
{
|
|
146
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
147
|
+
parameters: [testUuid(2)],
|
|
148
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
149
|
+
},
|
|
150
|
+
// orphan (id=1) disconnected
|
|
151
|
+
{
|
|
152
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
153
|
+
parameters: [testUuid(1)],
|
|
154
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
sql: SQL`delete from "public"."post_categories"
|
|
158
|
+
where "post_id" = ? and "category_id" = ?`,
|
|
159
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
160
|
+
response: { rowCount: 1 },
|
|
161
|
+
},
|
|
162
|
+
// orphan (id=3) disconnected
|
|
163
|
+
{
|
|
164
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
165
|
+
parameters: [testUuid(3)],
|
|
166
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
sql: SQL`delete from "public"."post_categories"
|
|
170
|
+
where "post_id" = ? and "category_id" = ?`,
|
|
171
|
+
parameters: [testUuid(2), testUuid(3)],
|
|
172
|
+
response: { rowCount: 1 },
|
|
173
|
+
},
|
|
174
|
+
]),
|
|
175
|
+
],
|
|
176
|
+
return: {
|
|
177
|
+
data: {
|
|
178
|
+
updatePost: {
|
|
179
|
+
ok: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
test('set with a connectOrCreate item (existing target) - junction', async () => {
|
|
187
|
+
await execute({
|
|
188
|
+
schema: postWithCategories,
|
|
189
|
+
query: GQL`mutation {
|
|
190
|
+
updatePost(
|
|
191
|
+
by: {id: "${testUuid(2)}"},
|
|
192
|
+
data: {categories: {set: [{connectOrCreate: {connect: {id: "${testUuid(1)}"}, create: {name: "Ipsum"}}}]}}
|
|
193
|
+
) {
|
|
194
|
+
ok
|
|
195
|
+
}
|
|
196
|
+
}`,
|
|
197
|
+
executes: [
|
|
198
|
+
...sqlTransaction([
|
|
199
|
+
{
|
|
200
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
201
|
+
parameters: [testUuid(2)],
|
|
202
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
203
|
+
},
|
|
204
|
+
// snapshot the members up front - orphans are members from *before* the operation
|
|
205
|
+
{
|
|
206
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
207
|
+
parameters: [testUuid(2)],
|
|
208
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
209
|
+
},
|
|
210
|
+
// the set helper resolves the connectOrCreate target up-front to mark it desired
|
|
211
|
+
{
|
|
212
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
213
|
+
parameters: [testUuid(1)],
|
|
214
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
218
|
+
parameters: [testUuid(3)],
|
|
219
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
sql: SQL`delete from "public"."post_categories"
|
|
223
|
+
where "post_id" = ? and "category_id" = ?`,
|
|
224
|
+
parameters: [testUuid(2), testUuid(3)],
|
|
225
|
+
response: { rowCount: 1 },
|
|
226
|
+
},
|
|
227
|
+
// connectOrCreate processor resolves the target again and connects it
|
|
228
|
+
{
|
|
229
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
230
|
+
parameters: [testUuid(1)],
|
|
231
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
|
|
235
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
236
|
+
response: { rowCount: 1 },
|
|
237
|
+
},
|
|
238
|
+
]),
|
|
239
|
+
],
|
|
240
|
+
return: {
|
|
241
|
+
data: {
|
|
242
|
+
updatePost: {
|
|
243
|
+
ok: true,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
// The orphan-candidate set is fetched through the target entity's ACL read predicate, so a current
|
|
251
|
+
// member the role cannot read is invisible to the diff and therefore never orphaned, while a readable
|
|
252
|
+
// omitted member is orphaned as usual. This mirrors the oneHasMany behavior.
|
|
253
|
+
const restrictedReadPermissions: Acl.Permissions = {
|
|
254
|
+
Post: {
|
|
255
|
+
predicates: {},
|
|
256
|
+
operations: {
|
|
257
|
+
read: {
|
|
258
|
+
id: true,
|
|
259
|
+
},
|
|
260
|
+
update: {
|
|
261
|
+
id: true,
|
|
262
|
+
categories: true,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
Category: {
|
|
267
|
+
predicates: {
|
|
268
|
+
category_read_predicate: {
|
|
269
|
+
name: { eq: 'visible' },
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
operations: {
|
|
273
|
+
read: {
|
|
274
|
+
id: 'category_read_predicate',
|
|
275
|
+
},
|
|
276
|
+
update: {
|
|
277
|
+
posts: true,
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
test('set applies the target read predicate when computing orphans - junction', async () => {
|
|
284
|
+
await execute({
|
|
285
|
+
schema: postWithCategories,
|
|
286
|
+
permissions: restrictedReadPermissions,
|
|
287
|
+
variables: {},
|
|
288
|
+
query: GQL`mutation {
|
|
289
|
+
updatePost(
|
|
290
|
+
by: {id: "${testUuid(2)}"},
|
|
291
|
+
data: {categories: {set: [{connect: {id: "${testUuid(1)}"}}]}}
|
|
292
|
+
) {
|
|
293
|
+
ok
|
|
294
|
+
}
|
|
295
|
+
}`,
|
|
296
|
+
executes: [
|
|
297
|
+
...sqlTransaction([
|
|
298
|
+
{
|
|
299
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
300
|
+
parameters: [testUuid(2)],
|
|
301
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
302
|
+
},
|
|
303
|
+
// snapshot the members up front - orphans are members from *before* the operation
|
|
304
|
+
// snapshot the members up front - orphans are members from *before* the operation
|
|
305
|
+
// snapshot the members up front - orphans are members from *before* the operation
|
|
306
|
+
{
|
|
307
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_"
|
|
308
|
+
inner join "public"."category" as "root_" on "junction_"."category_id" = "root_"."id"
|
|
309
|
+
where "junction_"."post_id" = ? and "root_"."name" = ?`,
|
|
310
|
+
parameters: [testUuid(2), 'visible'],
|
|
311
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
312
|
+
},
|
|
313
|
+
// resolving the connect target applies Category's read predicate
|
|
314
|
+
{
|
|
315
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ? and "root_"."name" = ?`,
|
|
316
|
+
parameters: [testUuid(1), 'visible'],
|
|
317
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
318
|
+
},
|
|
319
|
+
// the readable omitted member (id=3) is disconnected from the junction
|
|
320
|
+
{
|
|
321
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ? and "root_"."name" = ?`,
|
|
322
|
+
parameters: [testUuid(3), 'visible'],
|
|
323
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
sql: SQL`delete from "public"."post_categories"
|
|
327
|
+
where "post_id" = ? and "category_id" = ?`,
|
|
328
|
+
parameters: [testUuid(2), testUuid(3)],
|
|
329
|
+
response: { rowCount: 1 },
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
|
|
333
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
334
|
+
response: { rowCount: 1 },
|
|
335
|
+
},
|
|
336
|
+
]),
|
|
337
|
+
],
|
|
338
|
+
return: {
|
|
339
|
+
data: {
|
|
340
|
+
updatePost: {
|
|
341
|
+
ok: true,
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
})
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
test('set with orphanStrategy delete is rejected when delete is ACL-denied - junction', async () => {
|
|
349
|
+
await execute({
|
|
350
|
+
schema: postWithCategories,
|
|
351
|
+
query: GQL`mutation {
|
|
352
|
+
updatePost(
|
|
353
|
+
by: {id: "${testUuid(2)}"},
|
|
354
|
+
data: {categories: {orphanStrategy: delete, set: [{connect: {id: "${testUuid(1)}"}}]}}
|
|
355
|
+
) {
|
|
356
|
+
ok
|
|
357
|
+
}
|
|
358
|
+
}`,
|
|
359
|
+
executes: [
|
|
360
|
+
...failedTransaction([
|
|
361
|
+
{
|
|
362
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
363
|
+
parameters: [testUuid(2)],
|
|
364
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
368
|
+
parameters: [testUuid(2)],
|
|
369
|
+
response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
373
|
+
parameters: [testUuid(1)],
|
|
374
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
375
|
+
},
|
|
376
|
+
// orphan (id=3): delete is attempted, but the ACL predicate denies it
|
|
377
|
+
{
|
|
378
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
379
|
+
parameters: [testUuid(3)],
|
|
380
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
sql: SQL`select "root_"."id" as "id", true as "allowed" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
384
|
+
parameters: [testUuid(3)],
|
|
385
|
+
response: { rows: [{ id: testUuid(3), allowed: false }] },
|
|
386
|
+
},
|
|
387
|
+
]),
|
|
388
|
+
],
|
|
389
|
+
return: {
|
|
390
|
+
data: {
|
|
391
|
+
updatePost: {
|
|
392
|
+
ok: false,
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
})
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
// The manyHasMany connectOrCreate processor returns junction results only, so the created primary
|
|
400
|
+
// cannot be recovered from the step result. The pre-operation snapshot is what keeps the freshly
|
|
401
|
+
// created record out of the orphan set.
|
|
402
|
+
test('set with a connectOrCreate item that creates - junction', async () => {
|
|
403
|
+
await execute({
|
|
404
|
+
schema: postWithCategories,
|
|
405
|
+
query: GQL`mutation {
|
|
406
|
+
updatePost(
|
|
407
|
+
by: {id: "${testUuid(2)}"},
|
|
408
|
+
data: {categories: {orphanStrategy: delete, set: [{connectOrCreate: {connect: {id: "${testUuid(10)}"}, create: {name: "Ipsum"}}}]}}
|
|
409
|
+
) {
|
|
410
|
+
ok
|
|
411
|
+
}
|
|
412
|
+
}`,
|
|
413
|
+
executes: [
|
|
414
|
+
...sqlTransaction([
|
|
415
|
+
{
|
|
416
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
417
|
+
parameters: [testUuid(2)],
|
|
418
|
+
response: { rows: [{ id: testUuid(2) }] },
|
|
419
|
+
},
|
|
420
|
+
// snapshot the members up front - orphans are members from *before* the operation
|
|
421
|
+
{
|
|
422
|
+
sql: SQL`select "junction_"."category_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."post_id" = ?`,
|
|
423
|
+
parameters: [testUuid(2)],
|
|
424
|
+
response: { rows: [{ primary_: testUuid(3) }] },
|
|
425
|
+
},
|
|
426
|
+
// the set helper resolves the connectOrCreate target up-front - it does not exist
|
|
427
|
+
{
|
|
428
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
429
|
+
parameters: [testUuid(10)],
|
|
430
|
+
response: { rows: [] },
|
|
431
|
+
},
|
|
432
|
+
// only the pre-existing member (id=3) is deleted; the created category is never orphaned
|
|
433
|
+
{
|
|
434
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
435
|
+
parameters: [testUuid(3)],
|
|
436
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
sql: SQL`select "root_"."id" as "id", true as "allowed" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
440
|
+
parameters: [testUuid(3)],
|
|
441
|
+
response: { rows: [{ id: testUuid(3), allowed: true }] },
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
sql: SQL`delete from "public"."category" where "id" in (?)`,
|
|
445
|
+
parameters: [testUuid(3)],
|
|
446
|
+
response: { rows: [{ id: testUuid(3) }] },
|
|
447
|
+
},
|
|
448
|
+
// connectOrCreate processor resolves the target again and creates it
|
|
449
|
+
{
|
|
450
|
+
sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
|
|
451
|
+
parameters: [testUuid(10)],
|
|
452
|
+
response: { rows: [] },
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
sql: SQL`with "root_" as
|
|
456
|
+
(select ? :: uuid as "id", ? :: text as "name")
|
|
457
|
+
insert into "public"."category" ("id", "name")
|
|
458
|
+
select "root_"."id", "root_"."name"
|
|
459
|
+
from "root_"
|
|
460
|
+
returning "id"`,
|
|
461
|
+
parameters: [testUuid(1), 'Ipsum'],
|
|
462
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
|
|
466
|
+
parameters: [testUuid(2), testUuid(1)],
|
|
467
|
+
response: { rowCount: 1 },
|
|
468
|
+
},
|
|
469
|
+
]),
|
|
470
|
+
],
|
|
471
|
+
return: {
|
|
472
|
+
data: {
|
|
473
|
+
updatePost: {
|
|
474
|
+
ok: true,
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
})
|
|
479
|
+
})
|