@contember/engine-content-api 1.2.0-alpha.8 → 1.2.0-beta.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/dist/src/acl/EvaluatedPredicateReplacer.d.ts +2 -3
- package/dist/src/acl/EvaluatedPredicateReplacer.d.ts.map +1 -1
- package/dist/src/acl/EvaluatedPredicateReplacer.js +5 -14
- package/dist/src/acl/EvaluatedPredicateReplacer.js.map +1 -1
- package/dist/src/acl/PermissionFactory.d.ts.map +1 -1
- package/dist/src/acl/PermissionFactory.js +15 -11
- package/dist/src/acl/PermissionFactory.js.map +1 -1
- package/dist/src/acl/PredicateFactory.d.ts +9 -3
- package/dist/src/acl/PredicateFactory.d.ts.map +1 -1
- package/dist/src/acl/PredicateFactory.js +47 -36
- package/dist/src/acl/PredicateFactory.js.map +1 -1
- package/dist/src/acl/PredicatesInjector.d.ts +1 -1
- package/dist/src/acl/PredicatesInjector.d.ts.map +1 -1
- package/dist/src/acl/PredicatesInjector.js +13 -18
- package/dist/src/acl/PredicatesInjector.js.map +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.d.ts +0 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.d.ts.map +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +26 -23
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts.map +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +1 -1
- package/dist/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.d.ts +5 -4
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.d.ts.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js +11 -14
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.d.ts.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +18 -14
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts +3 -3
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +3 -3
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.d.ts +5 -4
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.d.ts.map +1 -1
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js +11 -15
- package/dist/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js.map +1 -1
- package/dist/src/input-validation/ColumnValueResolver.d.ts +4 -3
- package/dist/src/input-validation/ColumnValueResolver.d.ts.map +1 -1
- package/dist/src/input-validation/ColumnValueResolver.js.map +1 -1
- package/dist/src/input-validation/EntityRulesResolver.js +4 -4
- package/dist/src/input-validation/EntityRulesResolver.js.map +1 -1
- package/dist/src/input-validation/QueryAstFactory.js +1 -1
- package/dist/src/input-validation/QueryAstFactory.js.map +1 -1
- package/dist/src/input-validation/ValidationDataSelector.js +1 -1
- package/dist/src/input-validation/ValidationDataSelector.js.map +1 -1
- package/dist/src/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts +7 -8
- package/dist/src/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts.map +1 -1
- package/dist/src/input-validation/preValidation/CreateInputPreValidationProcessor.js.map +1 -1
- package/dist/src/input-validation/preValidation/InputPreValidator.js +4 -4
- package/dist/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/src/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts +7 -8
- package/dist/src/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts.map +1 -1
- package/dist/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
- package/dist/src/inputProcessing/CreateInputProcessor.d.ts +8 -9
- package/dist/src/inputProcessing/CreateInputProcessor.d.ts.map +1 -1
- package/dist/src/inputProcessing/CreateInputVisitor.d.ts +7 -7
- package/dist/src/inputProcessing/CreateInputVisitor.d.ts.map +1 -1
- package/dist/src/inputProcessing/CreateInputVisitor.js +15 -46
- package/dist/src/inputProcessing/CreateInputVisitor.js.map +1 -1
- package/dist/src/inputProcessing/UpdateInputProcessor.d.ts +8 -9
- package/dist/src/inputProcessing/UpdateInputProcessor.d.ts.map +1 -1
- package/dist/src/inputProcessing/UpdateInputVisitor.d.ts +7 -7
- package/dist/src/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
- package/dist/src/inputProcessing/UpdateInputVisitor.js +13 -28
- package/dist/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/src/inputProcessing/index.d.ts +0 -1
- package/dist/src/inputProcessing/index.d.ts.map +1 -1
- package/dist/src/inputProcessing/index.js +0 -1
- package/dist/src/inputProcessing/index.js.map +1 -1
- package/dist/src/introspection/IntrospectionSchemaFactory.js +7 -7
- package/dist/src/introspection/IntrospectionSchemaFactory.js.map +1 -1
- package/dist/src/mapper/ErrorUtils.d.ts.map +1 -1
- package/dist/src/mapper/ErrorUtils.js +2 -2
- package/dist/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/src/mapper/JunctionTableManager.js.map +1 -1
- package/dist/src/mapper/Mapper.d.ts +6 -6
- package/dist/src/mapper/Mapper.d.ts.map +1 -1
- package/dist/src/mapper/Mapper.js +26 -21
- package/dist/src/mapper/Mapper.js.map +1 -1
- package/dist/src/mapper/MapperContainer.d.ts.map +1 -1
- package/dist/src/mapper/MapperContainer.js +4 -4
- package/dist/src/mapper/MapperContainer.js.map +1 -1
- package/dist/src/mapper/Result.d.ts.map +1 -1
- package/dist/src/mapper/Result.js +2 -4
- package/dist/src/mapper/Result.js.map +1 -1
- package/dist/src/mapper/delete/DeleteExecutor.js +6 -6
- package/dist/src/mapper/delete/DeleteExecutor.js.map +1 -1
- package/dist/src/mapper/insert/InsertBuilder.d.ts +1 -1
- package/dist/src/mapper/insert/InsertBuilder.d.ts.map +1 -1
- package/dist/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/src/mapper/insert/SqlCreateInputProcessor.d.ts +4 -2
- package/dist/src/mapper/insert/SqlCreateInputProcessor.d.ts.map +1 -1
- package/dist/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
- package/dist/src/mapper/select/JoinVisitor.d.ts +6 -6
- package/dist/src/mapper/select/JoinVisitor.d.ts.map +1 -1
- package/dist/src/mapper/select/JoinVisitor.js +6 -6
- package/dist/src/mapper/select/JoinVisitor.js.map +1 -1
- package/dist/src/mapper/select/Path.d.ts +1 -0
- package/dist/src/mapper/select/Path.d.ts.map +1 -1
- package/dist/src/mapper/select/Path.js +4 -1
- package/dist/src/mapper/select/Path.js.map +1 -1
- package/dist/src/mapper/select/RelationFetcher.d.ts +11 -19
- package/dist/src/mapper/select/RelationFetcher.d.ts.map +1 -1
- package/dist/src/mapper/select/RelationFetcher.js +34 -25
- package/dist/src/mapper/select/RelationFetcher.js.map +1 -1
- package/dist/src/mapper/select/SelectBuilder.d.ts +4 -1
- package/dist/src/mapper/select/SelectBuilder.d.ts.map +1 -1
- package/dist/src/mapper/select/SelectBuilder.js +52 -12
- package/dist/src/mapper/select/SelectBuilder.js.map +1 -1
- package/dist/src/mapper/select/SelectBuilderFactory.d.ts +2 -1
- package/dist/src/mapper/select/SelectBuilderFactory.d.ts.map +1 -1
- package/dist/src/mapper/select/SelectExecutionHandler.d.ts +16 -4
- package/dist/src/mapper/select/SelectExecutionHandler.d.ts.map +1 -1
- package/dist/src/mapper/select/SelectHydrator.d.ts +3 -2
- package/dist/src/mapper/select/SelectHydrator.d.ts.map +1 -1
- package/dist/src/mapper/select/SelectHydrator.js +6 -9
- package/dist/src/mapper/select/SelectHydrator.js.map +1 -1
- package/dist/src/mapper/select/WhereBuilder.d.ts +8 -4
- package/dist/src/mapper/select/WhereBuilder.d.ts.map +1 -1
- package/dist/src/mapper/select/WhereBuilder.js +137 -35
- package/dist/src/mapper/select/WhereBuilder.js.map +1 -1
- package/dist/src/mapper/select/handlers/FieldsVisitor.d.ts +10 -8
- package/dist/src/mapper/select/handlers/FieldsVisitor.d.ts.map +1 -1
- package/dist/src/mapper/select/handlers/FieldsVisitor.js +129 -94
- package/dist/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
- package/dist/src/mapper/select/handlers/FieldsVisitorFactory.d.ts.map +1 -1
- package/dist/src/mapper/select/handlers/FieldsVisitorFactory.js +1 -1
- package/dist/src/mapper/select/handlers/FieldsVisitorFactory.js.map +1 -1
- package/dist/src/mapper/select/handlers/MetaHandler.d.ts.map +1 -1
- package/dist/src/mapper/select/handlers/MetaHandler.js +6 -11
- package/dist/src/mapper/select/handlers/MetaHandler.js.map +1 -1
- package/dist/src/mapper/select/optimizer/ConditionOptimizer.d.ts.map +1 -1
- package/dist/src/mapper/select/optimizer/ConditionOptimizer.js +6 -0
- package/dist/src/mapper/select/optimizer/ConditionOptimizer.js.map +1 -1
- package/dist/src/mapper/select/optimizer/WhereOptimizer.d.ts +9 -1
- package/dist/src/mapper/select/optimizer/WhereOptimizer.d.ts.map +1 -1
- package/dist/src/mapper/select/optimizer/WhereOptimizer.js +127 -13
- package/dist/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
- package/dist/src/mapper/select/optimizer/WhereReplacer.d.ts +3 -0
- package/dist/src/mapper/select/optimizer/WhereReplacer.d.ts.map +1 -0
- package/dist/src/mapper/select/optimizer/WhereReplacer.js +46 -0
- package/dist/src/mapper/select/optimizer/WhereReplacer.js.map +1 -0
- package/dist/src/mapper/select/optimizer/helpers.d.ts +1 -1
- package/dist/src/mapper/select/optimizer/helpers.d.ts.map +1 -1
- package/dist/src/mapper/select/optimizer/helpers.js +8 -1
- package/dist/src/mapper/select/optimizer/helpers.js.map +1 -1
- package/dist/src/mapper/update/SqlUpdateInputProcessor.d.ts +2 -3
- package/dist/src/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
- package/dist/src/mapper/update/SqlUpdateInputProcessor.js +3 -4
- package/dist/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/src/mapper/update/UpdateBuilder.js +3 -3
- package/dist/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/src/resolvers/ExecutionContainerFactory.d.ts +1 -1
- package/dist/src/resolvers/ExecutionContainerFactory.d.ts.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.d.ts +1 -2
- package/dist/src/resolvers/GraphQlQueryAstFactory.d.ts.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.js +2 -2
- package/dist/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
- package/dist/src/resolvers/MutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/MutationResolver.js +13 -2
- package/dist/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/src/resolvers/ReadHelpers.js +3 -3
- package/dist/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/src/resolvers/ReadResolver.js +2 -2
- package/dist/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/src/schema/EnumsProvider.d.ts.map +1 -1
- package/dist/src/schema/EnumsProvider.js +1 -2
- package/dist/src/schema/EnumsProvider.js.map +1 -1
- package/dist/src/schema/FieldAccessVisitor.d.ts +2 -2
- package/dist/src/schema/FieldAccessVisitor.d.ts.map +1 -1
- package/dist/src/schema/FieldAccessVisitor.js +2 -2
- package/dist/src/schema/FieldAccessVisitor.js.map +1 -1
- package/dist/src/schema/OrderByTypeProvider.d.ts +1 -1
- package/dist/src/schema/OrderByTypeProvider.d.ts.map +1 -1
- package/dist/src/schema/OrderByTypeProvider.js +2 -2
- package/dist/src/schema/OrderByTypeProvider.js.map +1 -1
- package/dist/src/schema/WhereTypeProvider.d.ts +1 -2
- package/dist/src/schema/WhereTypeProvider.d.ts.map +1 -1
- package/dist/src/schema/WhereTypeProvider.js +4 -4
- package/dist/src/schema/WhereTypeProvider.js.map +1 -1
- package/dist/src/schema/entities/FieldArgsVisitor.d.ts +4 -5
- package/dist/src/schema/entities/FieldArgsVisitor.d.ts.map +1 -1
- package/dist/src/schema/entities/FieldArgsVisitor.js +3 -3
- package/dist/src/schema/entities/FieldArgsVisitor.js.map +1 -1
- package/dist/src/schema/entities/FieldTypeVisitor.d.ts +3 -3
- package/dist/src/schema/entities/FieldTypeVisitor.d.ts.map +1 -1
- package/dist/src/schema/entities/FieldTypeVisitor.js +3 -3
- package/dist/src/schema/entities/FieldTypeVisitor.js.map +1 -1
- package/dist/src/schema/mutations/CreateEntityInputFieldVisitor.d.ts +3 -3
- package/dist/src/schema/mutations/CreateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/CreateEntityInputFieldVisitor.js +3 -3
- package/dist/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
- package/dist/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.d.ts +6 -6
- package/dist/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js +6 -6
- package/dist/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/src/schema/mutations/CreateEntityRelationInputFieldVisitor.d.ts +3 -3
- package/dist/src/schema/mutations/CreateEntityRelationInputFieldVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js +5 -5
- package/dist/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityInputFieldVisitor.d.ts +10 -4
- package/dist/src/schema/mutations/UpdateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityInputFieldVisitor.js +3 -3
- package/dist/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.d.ts +6 -6
- package/dist/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js +6 -6
- package/dist/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts +2 -2
- package/dist/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts.map +1 -1
- package/dist/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +2 -2
- package/dist/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/src/schema/utils.d.ts +1 -1
- package/dist/src/schema/utils.d.ts.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/object.d.ts.map +1 -1
- package/dist/src/utils/object.js +3 -4
- package/dist/src/utils/object.js.map +1 -1
- package/dist/src/utils/uniqueWhereFields.js +3 -3
- package/dist/src/utils/uniqueWhereFields.js.map +1 -1
- package/dist/tests/cases/bugs/bug102.test.js +6 -6
- package/dist/tests/cases/bugs/bug102.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/aclDelete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/aclDelete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/additionalDeleteFilter.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/additionalDeleteFilter.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/cascadeDelete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/cascadeDelete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/deleteById.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/deleteById.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/orphanRemoval.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/orphanRemoval.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/delete/setNullOnDelete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/delete/setNullOnDelete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.js +51 -4
- package/dist/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.js +26 -25
- package/dist/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.js +9 -6
- package/dist/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.js +109 -0
- package/dist/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.js.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.js +17 -15
- package/dist/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/filter/oneHasManyRelation.test.js +4 -5
- package/dist/tests/cases/integration/graphQlRequests/query/filter/oneHasManyRelation.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.js +9 -13
- package/dist/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/query/unique/oneHasManyUnique.test.js +5 -3
- package/dist/tests/cases/integration/graphQlRequests/query/unique/oneHasManyUnique.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/delete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/delete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/delete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/delete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/delete.test.js +10 -10
- package/dist/tests/cases/integration/graphQlRequests/update/manyHasOne/delete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/combination.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/combination.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/delete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/delete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/delete.test.js +5 -5
- package/dist/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/delete.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.js +4 -4
- package/dist/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.js.map +1 -1
- package/dist/tests/cases/integration/graphQlSchema/model.js.map +1 -1
- package/dist/tests/cases/unit/conditionOptimizer.test.js +5 -0
- package/dist/tests/cases/unit/conditionOptimizer.test.js.map +1 -1
- package/dist/tests/cases/unit/permissionMerger.test.js +2 -0
- package/dist/tests/cases/unit/permissionMerger.test.js.map +1 -1
- package/dist/tests/cases/unit/predicatesFactory.test.js +7 -1
- package/dist/tests/cases/unit/predicatesFactory.test.js.map +1 -1
- package/dist/tests/cases/unit/predicatesInjector.test.js +105 -0
- package/dist/tests/cases/unit/predicatesInjector.test.js.map +1 -1
- package/dist/tests/cases/unit/whereBuilder.test.d.ts +2 -0
- package/dist/tests/cases/unit/whereBuilder.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/whereBuilder.test.js +131 -0
- package/dist/tests/cases/unit/whereBuilder.test.js.map +1 -0
- package/dist/tests/cases/unit/whereOptimizer.test.js +187 -0
- package/dist/tests/cases/unit/whereOptimizer.test.js.map +1 -1
- package/dist/tests/src/test.js +2 -2
- package/dist/tests/src/test.js.map +1 -1
- package/dist/tests/src/testGraphql.d.ts.map +1 -1
- package/dist/tests/src/testGraphql.js +9 -5
- package/dist/tests/src/testGraphql.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -11
- package/src/acl/EvaluatedPredicateReplacer.ts +9 -15
- package/src/acl/PermissionFactory.ts +18 -13
- package/src/acl/PredicateFactory.ts +64 -40
- package/src/acl/PredicatesInjector.ts +18 -17
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts +21 -28
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts +1 -6
- package/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts +10 -28
- package/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts +11 -8
- package/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts +4 -22
- package/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.ts +10 -29
- package/src/input-validation/ColumnValueResolver.ts +2 -3
- package/src/input-validation/EntityRulesResolver.ts +4 -4
- package/src/input-validation/QueryAstFactory.ts +1 -1
- package/src/input-validation/ValidationDataSelector.ts +1 -1
- package/src/input-validation/preValidation/CreateInputPreValidationProcessor.ts +7 -8
- package/src/input-validation/preValidation/InputPreValidator.ts +4 -4
- package/src/input-validation/preValidation/UpdateInputPreValidationProcessor.ts +7 -8
- package/src/inputProcessing/CreateInputProcessor.ts +8 -9
- package/src/inputProcessing/CreateInputVisitor.ts +27 -89
- package/src/inputProcessing/UpdateInputProcessor.ts +8 -9
- package/src/inputProcessing/UpdateInputVisitor.ts +25 -71
- package/src/inputProcessing/index.ts +0 -1
- package/src/introspection/IntrospectionSchemaFactory.ts +7 -7
- package/src/mapper/ErrorUtils.ts +2 -2
- package/src/mapper/JunctionTableManager.ts +3 -3
- package/src/mapper/Mapper.ts +34 -31
- package/src/mapper/MapperContainer.ts +7 -5
- package/src/mapper/Result.ts +2 -4
- package/src/mapper/delete/DeleteExecutor.ts +6 -6
- package/src/mapper/insert/InsertBuilder.ts +2 -2
- package/src/mapper/insert/SqlCreateInputProcessor.ts +3 -3
- package/src/mapper/select/JoinVisitor.ts +6 -33
- package/src/mapper/select/Path.ts +4 -1
- package/src/mapper/select/RelationFetcher.ts +49 -50
- package/src/mapper/select/SelectBuilder.ts +71 -13
- package/src/mapper/select/SelectBuilderFactory.ts +2 -1
- package/src/mapper/select/SelectExecutionHandler.ts +16 -8
- package/src/mapper/select/SelectHydrator.ts +15 -11
- package/src/mapper/select/WhereBuilder.ts +168 -61
- package/src/mapper/select/handlers/FieldsVisitor.ts +80 -111
- package/src/mapper/select/handlers/FieldsVisitorFactory.ts +1 -0
- package/src/mapper/select/handlers/MetaHandler.ts +6 -17
- package/src/mapper/select/optimizer/ConditionOptimizer.ts +6 -0
- package/src/mapper/select/optimizer/WhereOptimizer.ts +148 -21
- package/src/mapper/select/optimizer/WhereReplacer.ts +39 -0
- package/src/mapper/select/optimizer/helpers.ts +7 -3
- package/src/mapper/update/SqlUpdateInputProcessor.ts +4 -10
- package/src/mapper/update/UpdateBuilder.ts +3 -3
- package/src/resolvers/ExecutionContainerFactory.ts +1 -1
- package/src/resolvers/GraphQlQueryAstFactory.ts +5 -4
- package/src/resolvers/MutationResolver.ts +14 -4
- package/src/resolvers/ReadHelpers.ts +3 -3
- package/src/resolvers/ReadResolver.ts +2 -2
- package/src/schema/EnumsProvider.ts +2 -4
- package/src/schema/FieldAccessVisitor.ts +2 -2
- package/src/schema/OrderByTypeProvider.ts +10 -3
- package/src/schema/WhereTypeProvider.ts +5 -6
- package/src/schema/entities/FieldArgsVisitor.ts +4 -5
- package/src/schema/entities/FieldTypeVisitor.ts +3 -3
- package/src/schema/mutations/CreateEntityInputFieldVisitor.ts +3 -6
- package/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.ts +6 -20
- package/src/schema/mutations/CreateEntityRelationInputFieldVisitor.ts +6 -20
- package/src/schema/mutations/UpdateEntityInputFieldVisitor.ts +3 -6
- package/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.ts +6 -20
- package/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.ts +9 -14
- package/src/schema/utils.ts +1 -1
- package/src/tsconfig.json +6 -6
- package/src/utils/object.ts +6 -6
- package/src/utils/uniqueWhereFields.ts +3 -3
- package/tests/cases/bugs/bug102.test.ts +6 -6
- package/tests/cases/integration/graphQlRequests/delete/aclDelete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/delete/additionalDeleteFilter.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/delete/cascadeDelete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/delete/orphanRemoval.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/delete/setNullOnDelete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +54 -4
- package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +26 -25
- package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +9 -6
- package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +104 -0
- package/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.ts +17 -15
- package/tests/cases/integration/graphQlRequests/query/filter/oneHasManyRelation.test.ts +4 -5
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +9 -13
- package/tests/cases/integration/graphQlRequests/query/unique/oneHasManyUnique.test.ts +5 -3
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/delete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/delete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/delete.test.ts +10 -10
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/combination.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/delete.test.ts +5 -5
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/delete.test.ts +5 -5
- package/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.ts +2 -3
- package/tests/cases/unit/conditionOptimizer.test.ts +6 -0
- package/tests/cases/unit/permissionMerger.test.ts +2 -0
- package/tests/cases/unit/predicatesFactory.test.ts +8 -2
- package/tests/cases/unit/predicatesInjector.test.ts +97 -2
- package/tests/cases/unit/whereBuilder.test.ts +148 -0
- package/tests/cases/unit/whereOptimizer.test.ts +215 -0
- package/tests/src/test.ts +2 -2
- package/tests/src/testGraphql.ts +9 -5
- package/dist/src/inputProcessing/InputContext.d.ts +0 -43
- package/dist/src/inputProcessing/InputContext.d.ts.map +0 -1
- package/dist/src/inputProcessing/InputContext.js +0 -3
- package/dist/src/inputProcessing/InputContext.js.map +0 -1
- package/src/inputProcessing/InputContext.ts +0 -49
|
@@ -15,7 +15,7 @@ export class CreateEntityInputFieldVisitor implements
|
|
|
15
15
|
private readonly createEntityRelationInputProvider: CreateEntityRelationInputProvider,
|
|
16
16
|
) {}
|
|
17
17
|
|
|
18
|
-
public visitColumn(entity
|
|
18
|
+
public visitColumn({ entity, column }: Model.ColumnContext): GraphQLInputFieldConfig | undefined {
|
|
19
19
|
if (entity.primary === column.name && !this.authorizator.isCustomPrimaryAllowed(entity.name)) {
|
|
20
20
|
return undefined
|
|
21
21
|
}
|
|
@@ -28,10 +28,7 @@ export class CreateEntityInputFieldVisitor implements
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public visitHasOne(
|
|
32
|
-
entity: Model.Entity,
|
|
33
|
-
relation: Model.Relation & Model.NullableRelation,
|
|
34
|
-
): GraphQLInputFieldConfig | undefined {
|
|
31
|
+
public visitHasOne({ entity, relation }: Model.AnyHasOneRelationContext): GraphQLInputFieldConfig | undefined {
|
|
35
32
|
const type = this.createEntityRelationInputProvider.getCreateEntityRelationInput(entity.name, relation.name)
|
|
36
33
|
if (type === undefined) {
|
|
37
34
|
return undefined
|
|
@@ -41,7 +38,7 @@ export class CreateEntityInputFieldVisitor implements
|
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
public visitHasMany(entity
|
|
41
|
+
public visitHasMany({ entity, relation }: Model.AnyHasManyRelationContext): GraphQLInputFieldConfig | undefined {
|
|
45
42
|
const type = this.createEntityRelationInputProvider.getCreateEntityRelationInput(entity.name, relation.name)
|
|
46
43
|
if (type === undefined) {
|
|
47
44
|
return undefined
|
|
@@ -12,32 +12,23 @@ export class CreateEntityRelationAllowedOperationsVisitor implements
|
|
|
12
12
|
throw new ImplementationException('CreateEntityRelationAllowedOperationsVisitor: Not applicable for a column')
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public visitManyHasManyInverse({
|
|
15
|
+
public visitManyHasManyInverse({ targetEntity, targetRelation }: Model.ManyHasManyInverseContext) {
|
|
16
16
|
return this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
public visitManyHasManyOwning(
|
|
20
|
-
entity: Model.Entity,
|
|
21
|
-
relation: Model.ManyHasManyOwningRelation,
|
|
22
|
-
targetEntity: Model.Entity,
|
|
23
|
-
) {
|
|
19
|
+
public visitManyHasManyOwning({ entity, targetEntity, relation }: Model.ManyHasManyOwningContext) {
|
|
24
20
|
return this.getAllowedOperations(targetEntity, entity, relation)
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
public visitOneHasMany({
|
|
23
|
+
public visitOneHasMany({ targetEntity, targetRelation }: Model.OneHasManyContext) {
|
|
28
24
|
return this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
public visitManyHasOne(
|
|
27
|
+
public visitManyHasOne({ targetEntity, entity, relation }: Model.ManyHasOneContext) {
|
|
32
28
|
return this.getAllowedOperations(targetEntity, entity, relation)
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
public visitOneHasOneInverse(
|
|
36
|
-
{},
|
|
37
|
-
relation: Model.OneHasOneInverseRelation,
|
|
38
|
-
targetEntity: Model.Entity,
|
|
39
|
-
targetRelation: Model.OneHasOneOwningRelation,
|
|
40
|
-
) {
|
|
31
|
+
public visitOneHasOneInverse({ targetEntity, targetRelation, relation }: Model.OneHasOneInverseContext) {
|
|
41
32
|
const operations = this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
42
33
|
if (relation.nullable || targetRelation.nullable) {
|
|
43
34
|
return operations
|
|
@@ -45,12 +36,7 @@ export class CreateEntityRelationAllowedOperationsVisitor implements
|
|
|
45
36
|
return operations.filter(it => it === Input.CreateRelationOperation.create)
|
|
46
37
|
}
|
|
47
38
|
|
|
48
|
-
public visitOneHasOneOwning(
|
|
49
|
-
entity: Model.Entity,
|
|
50
|
-
relation: Model.OneHasOneOwningRelation,
|
|
51
|
-
targetEntity: Model.Entity,
|
|
52
|
-
targetRelation: Model.OneHasOneInverseRelation | null,
|
|
53
|
-
) {
|
|
39
|
+
public visitOneHasOneOwning({ targetEntity, entity, relation, targetRelation }: Model.OneHasOneOwningContext) {
|
|
54
40
|
const operations = this.getAllowedOperations(targetEntity, entity, relation)
|
|
55
41
|
if (!targetRelation || targetRelation.nullable || relation.nullable) {
|
|
56
42
|
return operations
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { GraphQLInputObjectType, GraphQLString } from 'graphql'
|
|
1
|
+
import { GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLString } from 'graphql'
|
|
2
2
|
import { Input, Model } from '@contember/schema'
|
|
3
3
|
import { GqlTypeName } from '../utils'
|
|
4
4
|
import { WhereTypeProvider } from '../WhereTypeProvider'
|
|
5
5
|
import { Accessor, Interface } from '../../utils'
|
|
6
6
|
import { EntityInputProvider, EntityInputType } from './EntityInputProvider'
|
|
7
|
-
import { GraphQLInputFieldConfigMap } from 'graphql/type/definition'
|
|
8
7
|
import { CreateEntityRelationAllowedOperationsVisitor } from './CreateEntityRelationAllowedOperationsVisitor'
|
|
9
8
|
import { acceptFieldVisitor } from '@contember/schema-utils'
|
|
10
9
|
import { ImplementationException } from '../../exception'
|
|
@@ -26,29 +25,16 @@ export class CreateEntityRelationInputFieldVisitor implements
|
|
|
26
25
|
throw new ImplementationException('CreateEntityRelationInputFieldVisitor: Not applicable for a column')
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
public visitHasOne(
|
|
30
|
-
|
|
31
|
-
relation: Model.Relation & Model.NullableRelation,
|
|
32
|
-
targetEntity: Model.Entity,
|
|
33
|
-
targetRelation: Model.Relation | null,
|
|
34
|
-
): GraphQLInputObjectType | undefined {
|
|
35
|
-
return this.createInputObject(entity, relation, targetEntity, targetRelation, false)
|
|
28
|
+
public visitHasOne(context: Model.ManyHasOneContext): GraphQLInputObjectType | undefined {
|
|
29
|
+
return this.createInputObject(context, false)
|
|
36
30
|
}
|
|
37
31
|
|
|
38
|
-
public visitHasMany(
|
|
39
|
-
|
|
40
|
-
relation: Model.Relation,
|
|
41
|
-
targetEntity: Model.Entity,
|
|
42
|
-
targetRelation: Model.Relation | null,
|
|
43
|
-
): GraphQLInputObjectType | undefined {
|
|
44
|
-
return this.createInputObject(entity, relation, targetEntity, targetRelation, true)
|
|
32
|
+
public visitHasMany(context: Model.OneHasManyContext): GraphQLInputObjectType | undefined {
|
|
33
|
+
return this.createInputObject(context, true)
|
|
45
34
|
}
|
|
46
35
|
|
|
47
36
|
public createInputObject(
|
|
48
|
-
entity: Model.
|
|
49
|
-
relation: Model.Relation,
|
|
50
|
-
targetEntity: Model.Entity,
|
|
51
|
-
targetRelation: Model.Relation | null,
|
|
37
|
+
{ entity, relation, targetEntity, targetRelation }: Model.AnyRelationContext,
|
|
52
38
|
withAliasField: boolean,
|
|
53
39
|
): GraphQLInputObjectType | undefined {
|
|
54
40
|
const targetName = targetRelation ? targetRelation.name : undefined
|
|
@@ -14,7 +14,7 @@ export class UpdateEntityInputFieldVisitor implements
|
|
|
14
14
|
private readonly updateEntityRelationInputProvider: UpdateEntityRelationInputProvider,
|
|
15
15
|
) {}
|
|
16
16
|
|
|
17
|
-
public visitColumn(entity
|
|
17
|
+
public visitColumn({ entity, column }: Model.ColumnContext) {
|
|
18
18
|
if (entity.primary === column.name) {
|
|
19
19
|
return undefined
|
|
20
20
|
}
|
|
@@ -27,10 +27,7 @@ export class UpdateEntityInputFieldVisitor implements
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
public visitHasOne(
|
|
31
|
-
entity: Model.Entity,
|
|
32
|
-
relation: Model.Relation & Model.NullableRelation,
|
|
33
|
-
): GraphQLInputFieldConfig | undefined {
|
|
30
|
+
public visitHasOne({ entity, relation }: Model.AnyHasOneRelationContext) {
|
|
34
31
|
const type = this.updateEntityRelationInputProvider.getUpdateEntityRelationInput(entity.name, relation.name)
|
|
35
32
|
if (type === undefined) {
|
|
36
33
|
return undefined
|
|
@@ -40,7 +37,7 @@ export class UpdateEntityInputFieldVisitor implements
|
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
public visitHasMany(entity
|
|
40
|
+
public visitHasMany({ entity, relation }: Model.AnyHasManyRelationContext) {
|
|
44
41
|
const type = this.updateEntityRelationInputProvider.getUpdateEntityRelationInput(entity.name, relation.name)
|
|
45
42
|
if (type === undefined) {
|
|
46
43
|
return undefined
|
|
@@ -11,23 +11,19 @@ export class UpdateEntityRelationAllowedOperationsVisitor implements
|
|
|
11
11
|
throw new Error('UpdateEntityRelationAllowedOperationsVisitor: Not applicable for a column')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
public visitManyHasManyInverse({
|
|
14
|
+
public visitManyHasManyInverse({ targetEntity, targetRelation }: Model.ManyHasManyInverseContext) {
|
|
15
15
|
return this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
public visitManyHasManyOwning(
|
|
19
|
-
entity: Model.Entity,
|
|
20
|
-
relation: Model.ManyHasManyOwningRelation,
|
|
21
|
-
targetEntity: Model.Entity,
|
|
22
|
-
) {
|
|
18
|
+
public visitManyHasManyOwning({ entity, targetEntity, relation }: Model.ManyHasManyOwningContext) {
|
|
23
19
|
return this.getAllowedOperations(targetEntity, entity, relation)
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
public visitOneHasMany({
|
|
22
|
+
public visitOneHasMany({ targetRelation, targetEntity }: Model.OneHasManyContext) {
|
|
27
23
|
return this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
public visitManyHasOne(
|
|
26
|
+
public visitManyHasOne({ targetEntity, relation, entity }: Model.ManyHasOneContext) {
|
|
31
27
|
const operations = this.getAllowedOperations(targetEntity, entity, relation)
|
|
32
28
|
if (relation.nullable) {
|
|
33
29
|
return operations
|
|
@@ -39,12 +35,7 @@ export class UpdateEntityRelationAllowedOperationsVisitor implements
|
|
|
39
35
|
return operations.filter(it => !forbiddenOperations.includes(it))
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
public visitOneHasOneInverse(
|
|
43
|
-
{},
|
|
44
|
-
relation: Model.OneHasOneInverseRelation,
|
|
45
|
-
targetEntity: Model.Entity,
|
|
46
|
-
targetRelation: Model.OneHasOneOwningRelation,
|
|
47
|
-
) {
|
|
38
|
+
public visitOneHasOneInverse({ relation, targetEntity, targetRelation }: Model.OneHasOneInverseContext) {
|
|
48
39
|
const operations = this.getAllowedOperations(targetEntity, targetEntity, targetRelation)
|
|
49
40
|
if (relation.nullable || targetRelation.nullable) {
|
|
50
41
|
return operations
|
|
@@ -52,12 +43,7 @@ export class UpdateEntityRelationAllowedOperationsVisitor implements
|
|
|
52
43
|
return operations.filter(it => it === Input.UpdateRelationOperation.update)
|
|
53
44
|
}
|
|
54
45
|
|
|
55
|
-
public visitOneHasOneOwning(
|
|
56
|
-
entity: Model.Entity,
|
|
57
|
-
relation: Model.OneHasOneOwningRelation,
|
|
58
|
-
targetEntity: Model.Entity,
|
|
59
|
-
targetRelation: Model.OneHasOneInverseRelation | null,
|
|
60
|
-
) {
|
|
46
|
+
public visitOneHasOneOwning({ targetEntity, entity, relation, targetRelation }: Model.OneHasOneOwningContext) {
|
|
61
47
|
const operations = this.getAllowedOperations(targetEntity, entity, relation)
|
|
62
48
|
if (relation.nullable || !targetRelation || targetRelation.nullable) {
|
|
63
49
|
return operations
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
GraphQLBoolean,
|
|
3
|
+
GraphQLInputFieldConfig,
|
|
4
|
+
GraphQLInputFieldConfigMap,
|
|
5
|
+
GraphQLInputObjectType,
|
|
6
|
+
GraphQLString,
|
|
7
|
+
} from 'graphql'
|
|
2
8
|
import { Acl, Input, Model } from '@contember/schema'
|
|
3
9
|
import { GqlTypeName } from '../utils'
|
|
4
10
|
import { WhereTypeProvider } from '../WhereTypeProvider'
|
|
5
11
|
import { Accessor, filterObject } from '../../utils'
|
|
6
12
|
import { EntityInputProvider, EntityInputType } from './EntityInputProvider'
|
|
7
|
-
import { GraphQLInputFieldConfig, GraphQLInputFieldConfigMap } from 'graphql/type/definition'
|
|
8
13
|
import { acceptFieldVisitor } from '@contember/schema-utils'
|
|
9
14
|
import { UpdateEntityRelationAllowedOperationsVisitor } from './UpdateEntityRelationAllowedOperationsVisitor'
|
|
10
15
|
import { Authorizator } from '../../acl'
|
|
@@ -27,12 +32,7 @@ export class UpdateEntityRelationInputFieldVisitor implements
|
|
|
27
32
|
throw new Error('UpdateEntityRelationInputFieldVisitor: Not applicable for a column')
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
public visitHasOne(
|
|
31
|
-
entity: Model.Entity,
|
|
32
|
-
relation: Model.Relation & Model.NullableRelation,
|
|
33
|
-
targetEntity: Model.Entity,
|
|
34
|
-
targetRelation: Model.Relation | null,
|
|
35
|
-
): GraphQLInputObjectType | undefined {
|
|
35
|
+
public visitHasOne({ targetRelation, targetEntity, relation, entity }: Model.AnyHasOneRelationContext) {
|
|
36
36
|
const withoutRelation = targetRelation ? targetRelation.name : undefined
|
|
37
37
|
|
|
38
38
|
const whereInput = this.createWhereInput(targetEntity)
|
|
@@ -84,12 +84,7 @@ export class UpdateEntityRelationInputFieldVisitor implements
|
|
|
84
84
|
})
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
public visitHasMany(
|
|
88
|
-
entity: Model.Entity,
|
|
89
|
-
relation: Model.Relation,
|
|
90
|
-
targetEntity: Model.Entity,
|
|
91
|
-
targetRelation: Model.Relation | null,
|
|
92
|
-
): GraphQLInputObjectType | undefined {
|
|
87
|
+
public visitHasMany({ entity, relation, targetEntity, targetRelation }: Model.AnyHasManyRelationContext) {
|
|
93
88
|
const withoutRelation = targetRelation ? targetRelation.name : undefined
|
|
94
89
|
|
|
95
90
|
const whereInput = this.createWhereInput(targetEntity)
|
package/src/schema/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { capitalizeFirstLetter } from '../utils'
|
|
2
|
-
import { GraphQLFieldResolver } from 'graphql
|
|
2
|
+
import { GraphQLFieldResolver } from 'graphql'
|
|
3
3
|
|
|
4
4
|
export const GqlTypeName = (strings: TemplateStringsArray, ...values: string[]) => {
|
|
5
5
|
return strings.reduce((combined, string, i) => {
|
package/src/tsconfig.json
CHANGED
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
"path": "../../database/src"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "../../
|
|
12
|
+
"path": "../../dic/src"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"path": "../../
|
|
15
|
+
"path": "../../graphql-utils/src"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "../../
|
|
18
|
+
"path": "../../logger/src"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
"path": "../../schema
|
|
21
|
+
"path": "../../schema/src"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "../../
|
|
24
|
+
"path": "../../schema-definition/src"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
"path": "../../
|
|
27
|
+
"path": "../../schema-utils/src"
|
|
28
28
|
}
|
|
29
29
|
]
|
|
30
30
|
}
|
package/src/utils/object.ts
CHANGED
|
@@ -9,18 +9,18 @@ function filterObject<Input extends {}, Result extends { [Key in keyof Input]: I
|
|
|
9
9
|
object: Input,
|
|
10
10
|
callback: TypeGuard<Input, Result> | Filter<Input>,
|
|
11
11
|
): Result {
|
|
12
|
-
return (Object.entries(object)
|
|
13
|
-
.filter(
|
|
14
|
-
|
|
15
|
-
)
|
|
16
|
-
.reduce((result: Result, [key, value]: [string, any]) => ({ ...(result as any), [key]: value }), {} as Result)
|
|
12
|
+
return Object.fromEntries(Object.entries(object)
|
|
13
|
+
.filter(([key, value]) => (callback as any)(key, value, object)),
|
|
14
|
+
) as Result
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
function mapObject<Input, Result>(
|
|
20
18
|
input: { [key: string]: Input },
|
|
21
19
|
callback: (value: Input, key: string) => Result,
|
|
22
20
|
): { [key: string]: Result } {
|
|
23
|
-
return Object.
|
|
21
|
+
return Object.fromEntries(
|
|
22
|
+
Object.entries(input).map(([key, value]) => [key, callback(value, key)]),
|
|
23
|
+
)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { filterObject, mapObject }
|
|
@@ -8,10 +8,10 @@ export const getFieldsForUniqueWhere = (schema: Model.Schema, entity: Model.Enti
|
|
|
8
8
|
visitColumn: () => undefined,
|
|
9
9
|
visitManyHasManyInverse: () => undefined,
|
|
10
10
|
visitManyHasManyOwning: () => undefined,
|
|
11
|
-
visitOneHasMany: ({
|
|
11
|
+
visitOneHasMany: ({ relation }) => [relation.name],
|
|
12
12
|
visitManyHasOne: () => undefined,
|
|
13
|
-
visitOneHasOneInverse: ({
|
|
14
|
-
visitOneHasOneOwning: ({
|
|
13
|
+
visitOneHasOneInverse: ({ relation }) => [relation.name],
|
|
14
|
+
visitOneHasOneOwning: ({ relation }) => [relation.name],
|
|
15
15
|
}),
|
|
16
16
|
).filter((it): it is [string] => !!it)
|
|
17
17
|
|
|
@@ -48,12 +48,12 @@ test('Filter by has many with additional join', async () => {
|
|
|
48
48
|
executes: [
|
|
49
49
|
{
|
|
50
50
|
sql: SQL`
|
|
51
|
-
select "root_"."id" as "root_id", "root_"."short_name" as "root_shortName", "root_"."id" as "root_id"
|
|
52
|
-
from "public"."person" as "root_"
|
|
53
|
-
where exists (select 1
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
select "root_"."id" as "root_id", "root_"."short_name" as "root_shortName", "root_"."id" as "root_id"
|
|
52
|
+
from "public"."person" as "root_"
|
|
53
|
+
where exists (select 1
|
|
54
|
+
from "public"."person_locale" as "root_locales"
|
|
55
|
+
left join "public"."language" as "root_locales_locale" on "root_locales"."locale_id" = "root_locales_locale"."id"
|
|
56
|
+
where "root_"."id" = "root_locales"."person_id" and "root_locales_locale"."slug" = ? and not("root_locales"."url_slug" is null))`,
|
|
57
57
|
response: { rows: [{ root_id: testUuid(1), root_shortName: 'John' }] },
|
|
58
58
|
parameters: ['cs'],
|
|
59
59
|
},
|
|
@@ -50,12 +50,12 @@ test('delete post with acl', async () => {
|
|
|
50
50
|
],
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
|
+
{
|
|
54
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
55
|
+
parameters: [testUuid(1)],
|
|
56
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
57
|
+
},
|
|
53
58
|
...sqlDeferred([
|
|
54
|
-
{
|
|
55
|
-
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
56
|
-
parameters: [testUuid(1)],
|
|
57
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
58
|
-
},
|
|
59
59
|
{
|
|
60
60
|
sql: SQL`delete from "public"."post"
|
|
61
61
|
where "id" in (select "root_"."id"
|
|
@@ -34,12 +34,12 @@ test('delete post with additional filter', async () => {
|
|
|
34
34
|
],
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
+
{
|
|
38
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
39
|
+
parameters: [testUuid(1)],
|
|
40
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
41
|
+
},
|
|
37
42
|
...sqlDeferred([
|
|
38
|
-
{
|
|
39
|
-
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
40
|
-
parameters: [testUuid(1)],
|
|
41
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
42
|
-
},
|
|
43
43
|
{
|
|
44
44
|
sql: SQL`delete from "public"."post"
|
|
45
45
|
where "id" in (select "root_"."id"
|
|
@@ -39,12 +39,12 @@ test('delete author with posts and locales cascade delete', async () => {
|
|
|
39
39
|
],
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
sql: SQL`select "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?`,
|
|
44
|
+
parameters: [testUuid(1)],
|
|
45
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
46
|
+
},
|
|
42
47
|
...sqlDeferred([
|
|
43
|
-
{
|
|
44
|
-
sql: SQL`select "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?`,
|
|
45
|
-
parameters: [testUuid(1)],
|
|
46
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
47
|
-
},
|
|
48
48
|
{
|
|
49
49
|
sql: SQL`delete from "public"."author"
|
|
50
50
|
where "id" in (select "root_"."id"
|
|
@@ -57,12 +57,12 @@ test('delete post by id', async () => {
|
|
|
57
57
|
],
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
62
|
+
parameters: [testUuid(1)],
|
|
63
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
64
|
+
},
|
|
60
65
|
...sqlDeferred([
|
|
61
|
-
{
|
|
62
|
-
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
63
|
-
parameters: [testUuid(1)],
|
|
64
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
65
|
-
},
|
|
66
66
|
{
|
|
67
67
|
sql: SQL`delete from "public"."post"
|
|
68
68
|
where "id" in (select "root_"."id"
|
|
@@ -33,12 +33,12 @@ test('delete post and orphaned content', async () => {
|
|
|
33
33
|
],
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
38
|
+
parameters: [testUuid(1)],
|
|
39
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
40
|
+
},
|
|
36
41
|
...sqlDeferred([
|
|
37
|
-
{
|
|
38
|
-
sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
|
|
39
|
-
parameters: [testUuid(1)],
|
|
40
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
41
|
-
},
|
|
42
42
|
{
|
|
43
43
|
sql: SQL`delete from "public"."post"
|
|
44
44
|
where "id" in (select "root_"."id"
|
|
@@ -36,12 +36,12 @@ test('delete author and set null on posts', async () => {
|
|
|
36
36
|
],
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
sql: SQL`select "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?`,
|
|
41
|
+
parameters: [testUuid(1)],
|
|
42
|
+
response: { rows: [{ id: testUuid(1) }] },
|
|
43
|
+
},
|
|
39
44
|
...sqlDeferred([
|
|
40
|
-
{
|
|
41
|
-
sql: SQL`select "root_"."id" from "public"."author" as "root_" where "root_"."id" = ?`,
|
|
42
|
-
parameters: [testUuid(1)],
|
|
43
|
-
response: { rows: [{ id: testUuid(1) }] },
|
|
44
|
-
},
|
|
45
45
|
{
|
|
46
46
|
sql: SQL`delete from "public"."author"
|
|
47
47
|
where "id" in (select "root_"."id"
|
package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts
CHANGED
|
@@ -41,16 +41,18 @@ test('different predicate on row and field level', async () => {
|
|
|
41
41
|
executes: [
|
|
42
42
|
{
|
|
43
43
|
sql: SQL`
|
|
44
|
-
select
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
select
|
|
45
|
+
"root_"."id" as "root_id",
|
|
46
|
+
"root_"."username" = ? as "root___predicate_authorPredicate",
|
|
47
|
+
"root_"."username" as "root_username"
|
|
48
|
+
from "public"."author" as "root_" where not("root_"."username" is null)
|
|
48
49
|
`,
|
|
49
50
|
parameters: ['johndoe'],
|
|
50
51
|
response: {
|
|
51
52
|
rows: [
|
|
52
53
|
{
|
|
53
54
|
root_id: testUuid(1),
|
|
55
|
+
root___predicate_authorPredicate: true,
|
|
54
56
|
root_username: 'johndoe',
|
|
55
57
|
},
|
|
56
58
|
],
|
|
@@ -71,3 +73,51 @@ test('different predicate on row and field level', async () => {
|
|
|
71
73
|
})
|
|
72
74
|
|
|
73
75
|
|
|
76
|
+
|
|
77
|
+
test('different predicate on row and field level - false', async () => {
|
|
78
|
+
await execute({
|
|
79
|
+
schema: schema,
|
|
80
|
+
permissions: permissions,
|
|
81
|
+
variables: {},
|
|
82
|
+
query: GQL`
|
|
83
|
+
query {
|
|
84
|
+
listAuthor {
|
|
85
|
+
id
|
|
86
|
+
username
|
|
87
|
+
}
|
|
88
|
+
}`,
|
|
89
|
+
executes: [
|
|
90
|
+
{
|
|
91
|
+
sql: SQL`
|
|
92
|
+
select
|
|
93
|
+
"root_"."id" as "root_id",
|
|
94
|
+
"root_"."username" = ? as "root___predicate_authorPredicate",
|
|
95
|
+
"root_"."username" as "root_username"
|
|
96
|
+
from "public"."author" as "root_" where not("root_"."username" is null)
|
|
97
|
+
`,
|
|
98
|
+
parameters: ['johndoe'],
|
|
99
|
+
response: {
|
|
100
|
+
rows: [
|
|
101
|
+
{
|
|
102
|
+
root_id: testUuid(1),
|
|
103
|
+
root___predicate_authorPredicate: false,
|
|
104
|
+
root_username: 'johndoe',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
return: {
|
|
111
|
+
data: {
|
|
112
|
+
listAuthor: [
|
|
113
|
+
{
|
|
114
|
+
id: testUuid(1),
|
|
115
|
+
username: null,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
|
|
@@ -63,26 +63,23 @@ test('querying id and title', async () => {
|
|
|
63
63
|
}`,
|
|
64
64
|
executes: [
|
|
65
65
|
{
|
|
66
|
-
sql: SQL`
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
parameters: ['cs', 'cs'],
|
|
66
|
+
sql: SQL`SELECT
|
|
67
|
+
"root_"."id" AS "root_id",
|
|
68
|
+
"root_"."locale" IN (?) AS "root___predicate_localePredicate",
|
|
69
|
+
"root_"."title" AS "root_title"
|
|
70
|
+
FROM "public"."post_locale" AS "root_"`,
|
|
71
|
+
parameters: ['cs'],
|
|
73
72
|
response: {
|
|
74
73
|
rows: [
|
|
75
74
|
{
|
|
76
75
|
root_id: testUuid(1),
|
|
77
76
|
root_title: null,
|
|
78
|
-
|
|
79
|
-
root__meta_title_updatable: false,
|
|
77
|
+
root___predicate_localePredicate: false,
|
|
80
78
|
},
|
|
81
79
|
{
|
|
82
80
|
root_id: testUuid(2),
|
|
83
81
|
root_title: 'bar',
|
|
84
|
-
|
|
85
|
-
root__meta_title_updatable: false,
|
|
82
|
+
root___predicate_localePredicate: true,
|
|
86
83
|
},
|
|
87
84
|
],
|
|
88
85
|
},
|
|
@@ -134,8 +131,9 @@ test('querying with extra where', async () => {
|
|
|
134
131
|
executes: [
|
|
135
132
|
{
|
|
136
133
|
sql: SQL`select
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
"root_"."id" as "root_id",
|
|
135
|
+
"root_"."locale" in (?) as "root___predicate_localePredicate",
|
|
136
|
+
"root_"."title" as "root_title"
|
|
139
137
|
from "public"."post_locale" as "root_"
|
|
140
138
|
where "root_"."title" = ? and "root_"."locale" in (?)`,
|
|
141
139
|
parameters: ['cs', 'foo', 'cs'],
|
|
@@ -144,7 +142,7 @@ test('querying with extra where', async () => {
|
|
|
144
142
|
{
|
|
145
143
|
root_id: testUuid(1),
|
|
146
144
|
root_title: 'foo',
|
|
147
|
-
|
|
145
|
+
root___predicate_localePredicate: true,
|
|
148
146
|
},
|
|
149
147
|
],
|
|
150
148
|
},
|
|
@@ -217,10 +215,11 @@ test('not defined acl variable', async () => {
|
|
|
217
215
|
}`,
|
|
218
216
|
executes: [
|
|
219
217
|
{
|
|
220
|
-
sql: SQL`
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
sql: SQL`
|
|
219
|
+
select "root_"."id" as "root_id",
|
|
220
|
+
false as "root___predicate_localePredicate",
|
|
221
|
+
"root_"."title" as "root_title"
|
|
222
|
+
from "public"."post_locale" as "root_"`,
|
|
224
223
|
parameters: [],
|
|
225
224
|
response: {
|
|
226
225
|
rows: [],
|
|
@@ -270,23 +269,25 @@ test('querying on nested field', async () => {
|
|
|
270
269
|
},
|
|
271
270
|
},
|
|
272
271
|
{
|
|
273
|
-
sql: SQL`
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
272
|
+
sql: SQL`
|
|
273
|
+
select "root_"."post_id" as "__grouping_key",
|
|
274
|
+
"root_"."id" as "root_id",
|
|
275
|
+
"root_"."locale" in (?) as "root___predicate_localePredicate",
|
|
276
|
+
"root_"."title" as "root_title"
|
|
277
|
+
from "public"."post_locale" as "root_" where "root_"."post_id" in (?, ?)`,
|
|
279
278
|
parameters: ['cs', testUuid(1), testUuid(2)],
|
|
280
279
|
response: {
|
|
281
280
|
rows: [
|
|
282
281
|
{
|
|
283
282
|
__grouping_key: testUuid(1),
|
|
284
283
|
root_id: testUuid(3),
|
|
285
|
-
|
|
284
|
+
root___predicate_localePredicate: false,
|
|
285
|
+
root_title: 'foo',
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
__grouping_key: testUuid(2),
|
|
289
289
|
root_id: testUuid(4),
|
|
290
|
+
root___predicate_localePredicate: true,
|
|
290
291
|
root_title: 'bar',
|
|
291
292
|
},
|
|
292
293
|
],
|