@contember/engine-content-api 2.1.0-beta.1 → 2.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +1 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -1
- package/dist/development/src/ExecutionContainer.cjs +40 -4
- package/dist/development/src/ExecutionContainer.cjs.map +1 -1
- package/dist/development/src/ExecutionContainer.js +41 -5
- package/dist/development/src/ExecutionContainer.js.map +1 -1
- package/dist/development/src/acl/EvaluatedPredicateReplacer.cjs.map +1 -1
- package/dist/development/src/acl/EvaluatedPredicateReplacer.js.map +1 -1
- package/dist/development/src/acl/PermissionFactory.cjs +29 -15
- package/dist/development/src/acl/PermissionFactory.cjs.map +1 -1
- package/dist/development/src/acl/PermissionFactory.js +29 -15
- package/dist/development/src/acl/PermissionFactory.js.map +1 -1
- package/dist/development/src/acl/PredicateFactory.cjs +33 -13
- package/dist/development/src/acl/PredicateFactory.cjs.map +1 -1
- package/dist/development/src/acl/PredicateFactory.js +33 -13
- package/dist/development/src/acl/PredicateFactory.js.map +1 -1
- package/dist/development/src/acl/PredicatesInjector.cjs +21 -18
- package/dist/development/src/acl/PredicatesInjector.cjs.map +1 -1
- package/dist/development/src/acl/PredicatesInjector.js +21 -18
- package/dist/development/src/acl/PredicatesInjector.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.cjs.map +1 -1
- package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js.map +1 -1
- package/dist/development/src/input-validation/EntityRulesResolver.cjs.map +1 -1
- package/dist/development/src/input-validation/EntityRulesResolver.js.map +1 -1
- package/dist/development/src/input-validation/JsonSchemaValidator.cjs +208 -0
- package/dist/development/src/input-validation/JsonSchemaValidator.cjs.map +1 -0
- package/dist/development/src/input-validation/JsonSchemaValidator.js +208 -0
- package/dist/development/src/input-validation/JsonSchemaValidator.js.map +1 -0
- package/dist/development/src/input-validation/QueryAstFactory.cjs.map +1 -1
- package/dist/development/src/input-validation/QueryAstFactory.js.map +1 -1
- package/dist/development/src/input-validation/ValidationContext.cjs.map +1 -1
- package/dist/development/src/input-validation/ValidationContext.js.map +1 -1
- package/dist/development/src/input-validation/ValidationDataSelector.cjs.map +1 -1
- package/dist/development/src/input-validation/ValidationDataSelector.js.map +1 -1
- package/dist/development/src/input-validation/ValidationEvaluation.cjs.map +1 -1
- package/dist/development/src/input-validation/ValidationEvaluation.js.map +1 -1
- package/dist/development/src/input-validation/dependencies/DependencyCollector.cjs.map +1 -1
- package/dist/development/src/input-validation/dependencies/DependencyCollector.js.map +1 -1
- package/dist/development/src/input-validation/dependencies/DependencyMerger.cjs.map +1 -1
- package/dist/development/src/input-validation/dependencies/DependencyMerger.js.map +1 -1
- package/dist/development/src/input-validation/preValidation/CreateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/development/src/input-validation/preValidation/CreateInputPreValidationProcessor.js.map +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs +38 -2
- package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
- package/dist/development/src/input-validation/preValidation/InputPreValidator.js +38 -2
- package/dist/development/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
- package/dist/development/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
- package/dist/development/src/inputProcessing/CreateInputVisitor.js.map +1 -1
- package/dist/development/src/inputProcessing/ObjectNode.cjs.map +1 -1
- package/dist/development/src/inputProcessing/ObjectNode.js.map +1 -1
- package/dist/development/src/inputProcessing/UniqueWhereExpander.cjs.map +1 -1
- package/dist/development/src/inputProcessing/UniqueWhereExpander.js.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/development/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaFactory.cjs.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaFactory.js.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/development/src/mapper/EventManager.cjs.map +1 -1
- package/dist/development/src/mapper/EventManager.js.map +1 -1
- package/dist/development/src/mapper/JunctionTableManager.cjs.map +1 -1
- package/dist/development/src/mapper/JunctionTableManager.js.map +1 -1
- package/dist/development/src/mapper/Mapper.cjs.map +1 -1
- package/dist/development/src/mapper/Mapper.js.map +1 -1
- package/dist/development/src/mapper/MapperFactory.cjs.map +1 -1
- package/dist/development/src/mapper/MapperFactory.js.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/development/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/development/src/mapper/Result.cjs.map +1 -1
- package/dist/development/src/mapper/Result.js.map +1 -1
- package/dist/development/src/mapper/delete/DeleteExecutor.cjs.map +1 -1
- package/dist/development/src/mapper/delete/DeleteExecutor.js.map +1 -1
- package/dist/development/src/mapper/delete/DeleteState.cjs.map +1 -1
- package/dist/development/src/mapper/delete/DeleteState.js.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilderFactory.cjs.map +1 -1
- package/dist/development/src/mapper/insert/InsertBuilderFactory.js.map +1 -1
- package/dist/development/src/mapper/insert/Inserter.cjs.map +1 -1
- package/dist/development/src/mapper/insert/Inserter.js.map +1 -1
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/select/ConditionBuilder.cjs +2 -0
- package/dist/development/src/mapper/select/ConditionBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/ConditionBuilder.js +2 -0
- package/dist/development/src/mapper/select/ConditionBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/JoinBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/JoinBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/JoinVisitor.cjs.map +1 -1
- package/dist/development/src/mapper/select/JoinVisitor.js.map +1 -1
- package/dist/development/src/mapper/select/OrderByBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/OrderByBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/OrderByHelper.cjs.map +1 -1
- package/dist/development/src/mapper/select/OrderByHelper.js.map +1 -1
- package/dist/development/src/mapper/select/RelationFetcher.cjs.map +1 -1
- package/dist/development/src/mapper/select/RelationFetcher.js.map +1 -1
- package/dist/development/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/SelectBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/SelectHydrator.cjs.map +1 -1
- package/dist/development/src/mapper/select/SelectHydrator.js.map +1 -1
- package/dist/development/src/mapper/select/WhereBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/WhereBuilder.js.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs +11 -2
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.js +11 -2
- package/dist/development/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitorFactory.cjs.map +1 -1
- package/dist/development/src/mapper/select/handlers/FieldsVisitorFactory.js.map +1 -1
- package/dist/development/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
- package/dist/development/src/mapper/select/handlers/MetaHandler.js.map +1 -1
- package/dist/development/src/mapper/select/optimizer/ConditionOptimizer.cjs.map +1 -1
- package/dist/development/src/mapper/select/optimizer/ConditionOptimizer.js.map +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
- package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilderFactory.cjs.map +1 -1
- package/dist/development/src/mapper/update/UpdateBuilderFactory.js.map +1 -1
- package/dist/development/src/mapper/update/Updater.cjs.map +1 -1
- package/dist/development/src/mapper/update/Updater.js.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -1
- package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -1
- package/dist/development/src/resolvers/GraphQlQueryAstFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
- package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/development/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/development/src/resolvers/ReadResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/development/src/resolvers/RefreshViewResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/RefreshViewResolver.js.map +1 -1
- package/dist/development/src/resolvers/ValidationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/ValidationResolver.js.map +1 -1
- package/dist/development/src/schema/ColumnTypeResolver.cjs +2 -0
- package/dist/development/src/schema/ColumnTypeResolver.cjs.map +1 -1
- package/dist/development/src/schema/ColumnTypeResolver.js +2 -0
- package/dist/development/src/schema/ColumnTypeResolver.js.map +1 -1
- package/dist/development/src/schema/ConditionTypeProvider.cjs +2 -0
- package/dist/development/src/schema/ConditionTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/ConditionTypeProvider.js +2 -0
- package/dist/development/src/schema/ConditionTypeProvider.js.map +1 -1
- package/dist/development/src/schema/CustomTypesProvider.cjs +32 -0
- package/dist/development/src/schema/CustomTypesProvider.cjs.map +1 -1
- package/dist/development/src/schema/CustomTypesProvider.js +32 -0
- package/dist/development/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/development/src/schema/EntityTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/EntityTypeProvider.js.map +1 -1
- package/dist/development/src/schema/EnumsProvider.cjs.map +1 -1
- package/dist/development/src/schema/EnumsProvider.js.map +1 -1
- package/dist/development/src/schema/FieldAccessVisitor.cjs.map +1 -1
- package/dist/development/src/schema/FieldAccessVisitor.js.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilder.cjs.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilder.js.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
- package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
- package/dist/development/src/schema/MutationProvider.cjs.map +1 -1
- package/dist/development/src/schema/MutationProvider.js.map +1 -1
- package/dist/development/src/schema/OperationExtension.cjs.map +1 -1
- package/dist/development/src/schema/OperationExtension.js.map +1 -1
- package/dist/development/src/schema/OrderByTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/OrderByTypeProvider.js.map +1 -1
- package/dist/development/src/schema/PaginatedFieldConfigFactory.cjs.map +1 -1
- package/dist/development/src/schema/PaginatedFieldConfigFactory.js.map +1 -1
- package/dist/development/src/schema/QueryProvider.cjs.map +1 -1
- package/dist/development/src/schema/QueryProvider.js.map +1 -1
- package/dist/development/src/schema/RefreshViewMutationProvider.cjs.map +1 -1
- package/dist/development/src/schema/RefreshViewMutationProvider.js.map +1 -1
- package/dist/development/src/schema/ValidationQueriesProvider.cjs.map +1 -1
- package/dist/development/src/schema/ValidationQueriesProvider.js.map +1 -1
- package/dist/development/src/schema/WhereTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/WhereTypeProvider.js.map +1 -1
- package/dist/development/src/schema/entities/FieldArgsVisitor.cjs.map +1 -1
- package/dist/development/src/schema/entities/FieldArgsVisitor.js.map +1 -1
- package/dist/development/src/schema/entities/FieldTypeVisitor.cjs.map +1 -1
- package/dist/development/src/schema/entities/FieldTypeVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/ConnectOrCreateRelationInputProvider.cjs.map +1 -1
- package/dist/development/src/schema/mutations/ConnectOrCreateRelationInputProvider.js.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationInputProvider.cjs.map +1 -1
- package/dist/development/src/schema/mutations/CreateEntityRelationInputProvider.js.map +1 -1
- package/dist/development/src/schema/mutations/EntityInputProvider.cjs.map +1 -1
- package/dist/development/src/schema/mutations/EntityInputProvider.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputProvider.cjs.map +1 -1
- package/dist/development/src/schema/mutations/UpdateEntityRelationInputProvider.js.map +1 -1
- package/dist/development/src/schema/utils.cjs.map +1 -1
- package/dist/development/src/schema/utils.js.map +1 -1
- package/dist/development/src/utils/accessor.cjs.map +1 -1
- package/dist/development/src/utils/accessor.js.map +1 -1
- package/dist/development/src/utils/paginationUtils.cjs.map +1 -1
- package/dist/development/src/utils/paginationUtils.js.map +1 -1
- package/dist/development/src/utils/singletonFactory.cjs.map +1 -1
- package/dist/development/src/utils/singletonFactory.js.map +1 -1
- package/dist/production/index.cjs +1 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -1
- package/dist/production/src/ExecutionContainer.cjs +40 -4
- package/dist/production/src/ExecutionContainer.cjs.map +1 -1
- package/dist/production/src/ExecutionContainer.js +41 -5
- package/dist/production/src/ExecutionContainer.js.map +1 -1
- package/dist/production/src/acl/EvaluatedPredicateReplacer.cjs.map +1 -1
- package/dist/production/src/acl/EvaluatedPredicateReplacer.js.map +1 -1
- package/dist/production/src/acl/PermissionFactory.cjs +29 -15
- package/dist/production/src/acl/PermissionFactory.cjs.map +1 -1
- package/dist/production/src/acl/PermissionFactory.js +29 -15
- package/dist/production/src/acl/PermissionFactory.js.map +1 -1
- package/dist/production/src/acl/PredicateFactory.cjs +33 -13
- package/dist/production/src/acl/PredicateFactory.cjs.map +1 -1
- package/dist/production/src/acl/PredicateFactory.js +33 -13
- package/dist/production/src/acl/PredicateFactory.js.map +1 -1
- package/dist/production/src/acl/PredicatesInjector.cjs +21 -18
- package/dist/production/src/acl/PredicatesInjector.cjs.map +1 -1
- package/dist/production/src/acl/PredicatesInjector.js +21 -18
- package/dist/production/src/acl/PredicatesInjector.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.cjs.map +1 -1
- package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js.map +1 -1
- package/dist/production/src/input-validation/EntityRulesResolver.cjs.map +1 -1
- package/dist/production/src/input-validation/EntityRulesResolver.js.map +1 -1
- package/dist/production/src/input-validation/JsonSchemaValidator.cjs +208 -0
- package/dist/production/src/input-validation/JsonSchemaValidator.cjs.map +1 -0
- package/dist/production/src/input-validation/JsonSchemaValidator.js +208 -0
- package/dist/production/src/input-validation/JsonSchemaValidator.js.map +1 -0
- package/dist/production/src/input-validation/QueryAstFactory.cjs.map +1 -1
- package/dist/production/src/input-validation/QueryAstFactory.js.map +1 -1
- package/dist/production/src/input-validation/ValidationContext.cjs.map +1 -1
- package/dist/production/src/input-validation/ValidationContext.js.map +1 -1
- package/dist/production/src/input-validation/ValidationDataSelector.cjs.map +1 -1
- package/dist/production/src/input-validation/ValidationDataSelector.js.map +1 -1
- package/dist/production/src/input-validation/ValidationEvaluation.cjs.map +1 -1
- package/dist/production/src/input-validation/ValidationEvaluation.js.map +1 -1
- package/dist/production/src/input-validation/dependencies/DependencyCollector.cjs.map +1 -1
- package/dist/production/src/input-validation/dependencies/DependencyCollector.js.map +1 -1
- package/dist/production/src/input-validation/dependencies/DependencyMerger.cjs.map +1 -1
- package/dist/production/src/input-validation/dependencies/DependencyMerger.js.map +1 -1
- package/dist/production/src/input-validation/preValidation/CreateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/production/src/input-validation/preValidation/CreateInputPreValidationProcessor.js.map +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs +38 -2
- package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
- package/dist/production/src/input-validation/preValidation/InputPreValidator.js +38 -2
- package/dist/production/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
- package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
- package/dist/production/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
- package/dist/production/src/inputProcessing/CreateInputVisitor.js.map +1 -1
- package/dist/production/src/inputProcessing/ObjectNode.cjs.map +1 -1
- package/dist/production/src/inputProcessing/ObjectNode.js.map +1 -1
- package/dist/production/src/inputProcessing/UniqueWhereExpander.cjs.map +1 -1
- package/dist/production/src/inputProcessing/UniqueWhereExpander.js.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
- package/dist/production/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaFactory.cjs.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaFactory.js.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
- package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
- package/dist/production/src/mapper/EventManager.cjs.map +1 -1
- package/dist/production/src/mapper/EventManager.js.map +1 -1
- package/dist/production/src/mapper/JunctionTableManager.cjs.map +1 -1
- package/dist/production/src/mapper/JunctionTableManager.js.map +1 -1
- package/dist/production/src/mapper/Mapper.cjs.map +1 -1
- package/dist/production/src/mapper/Mapper.js.map +1 -1
- package/dist/production/src/mapper/MapperFactory.cjs.map +1 -1
- package/dist/production/src/mapper/MapperFactory.js.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.cjs.map +1 -1
- package/dist/production/src/mapper/MutationProcessorHelper.js.map +1 -1
- package/dist/production/src/mapper/Result.cjs.map +1 -1
- package/dist/production/src/mapper/Result.js.map +1 -1
- package/dist/production/src/mapper/delete/DeleteExecutor.cjs.map +1 -1
- package/dist/production/src/mapper/delete/DeleteExecutor.js.map +1 -1
- package/dist/production/src/mapper/delete/DeleteState.cjs.map +1 -1
- package/dist/production/src/mapper/delete/DeleteState.js.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilder.js.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilderFactory.cjs.map +1 -1
- package/dist/production/src/mapper/insert/InsertBuilderFactory.js.map +1 -1
- package/dist/production/src/mapper/insert/Inserter.cjs.map +1 -1
- package/dist/production/src/mapper/insert/Inserter.js.map +1 -1
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/select/ConditionBuilder.cjs +2 -0
- package/dist/production/src/mapper/select/ConditionBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/ConditionBuilder.js +2 -0
- package/dist/production/src/mapper/select/ConditionBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/JoinBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/JoinBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/JoinVisitor.cjs.map +1 -1
- package/dist/production/src/mapper/select/JoinVisitor.js.map +1 -1
- package/dist/production/src/mapper/select/OrderByBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/OrderByBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/OrderByHelper.cjs.map +1 -1
- package/dist/production/src/mapper/select/OrderByHelper.js.map +1 -1
- package/dist/production/src/mapper/select/RelationFetcher.cjs.map +1 -1
- package/dist/production/src/mapper/select/RelationFetcher.js.map +1 -1
- package/dist/production/src/mapper/select/SelectBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/SelectBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/SelectHydrator.cjs.map +1 -1
- package/dist/production/src/mapper/select/SelectHydrator.js.map +1 -1
- package/dist/production/src/mapper/select/WhereBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/WhereBuilder.js.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs +11 -2
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.js +11 -2
- package/dist/production/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitorFactory.cjs.map +1 -1
- package/dist/production/src/mapper/select/handlers/FieldsVisitorFactory.js.map +1 -1
- package/dist/production/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
- package/dist/production/src/mapper/select/handlers/MetaHandler.js.map +1 -1
- package/dist/production/src/mapper/select/optimizer/ConditionOptimizer.cjs.map +1 -1
- package/dist/production/src/mapper/select/optimizer/ConditionOptimizer.js.map +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
- package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilder.js.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilderFactory.cjs.map +1 -1
- package/dist/production/src/mapper/update/UpdateBuilderFactory.js.map +1 -1
- package/dist/production/src/mapper/update/Updater.cjs.map +1 -1
- package/dist/production/src/mapper/update/Updater.js.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -1
- package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -1
- package/dist/production/src/resolvers/GraphQlQueryAstFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
- package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.cjs.map +1 -1
- package/dist/production/src/resolvers/ReadHelpers.js.map +1 -1
- package/dist/production/src/resolvers/ReadResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/ReadResolver.js.map +1 -1
- package/dist/production/src/resolvers/RefreshViewResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/RefreshViewResolver.js.map +1 -1
- package/dist/production/src/resolvers/ValidationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/ValidationResolver.js.map +1 -1
- package/dist/production/src/schema/ColumnTypeResolver.cjs +2 -0
- package/dist/production/src/schema/ColumnTypeResolver.cjs.map +1 -1
- package/dist/production/src/schema/ColumnTypeResolver.js +2 -0
- package/dist/production/src/schema/ColumnTypeResolver.js.map +1 -1
- package/dist/production/src/schema/ConditionTypeProvider.cjs +2 -0
- package/dist/production/src/schema/ConditionTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/ConditionTypeProvider.js +2 -0
- package/dist/production/src/schema/ConditionTypeProvider.js.map +1 -1
- package/dist/production/src/schema/CustomTypesProvider.cjs +32 -0
- package/dist/production/src/schema/CustomTypesProvider.cjs.map +1 -1
- package/dist/production/src/schema/CustomTypesProvider.js +32 -0
- package/dist/production/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/production/src/schema/EntityTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/EntityTypeProvider.js.map +1 -1
- package/dist/production/src/schema/EnumsProvider.cjs.map +1 -1
- package/dist/production/src/schema/EnumsProvider.js.map +1 -1
- package/dist/production/src/schema/FieldAccessVisitor.cjs.map +1 -1
- package/dist/production/src/schema/FieldAccessVisitor.js.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilder.cjs.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilder.js.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
- package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
- package/dist/production/src/schema/MutationProvider.cjs.map +1 -1
- package/dist/production/src/schema/MutationProvider.js.map +1 -1
- package/dist/production/src/schema/OperationExtension.cjs.map +1 -1
- package/dist/production/src/schema/OperationExtension.js.map +1 -1
- package/dist/production/src/schema/OrderByTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/OrderByTypeProvider.js.map +1 -1
- package/dist/production/src/schema/PaginatedFieldConfigFactory.cjs.map +1 -1
- package/dist/production/src/schema/PaginatedFieldConfigFactory.js.map +1 -1
- package/dist/production/src/schema/QueryProvider.cjs.map +1 -1
- package/dist/production/src/schema/QueryProvider.js.map +1 -1
- package/dist/production/src/schema/RefreshViewMutationProvider.cjs.map +1 -1
- package/dist/production/src/schema/RefreshViewMutationProvider.js.map +1 -1
- package/dist/production/src/schema/ValidationQueriesProvider.cjs.map +1 -1
- package/dist/production/src/schema/ValidationQueriesProvider.js.map +1 -1
- package/dist/production/src/schema/WhereTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/WhereTypeProvider.js.map +1 -1
- package/dist/production/src/schema/entities/FieldArgsVisitor.cjs.map +1 -1
- package/dist/production/src/schema/entities/FieldArgsVisitor.js.map +1 -1
- package/dist/production/src/schema/entities/FieldTypeVisitor.cjs.map +1 -1
- package/dist/production/src/schema/entities/FieldTypeVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/ConnectOrCreateRelationInputProvider.cjs.map +1 -1
- package/dist/production/src/schema/mutations/ConnectOrCreateRelationInputProvider.js.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationInputProvider.cjs.map +1 -1
- package/dist/production/src/schema/mutations/CreateEntityRelationInputProvider.js.map +1 -1
- package/dist/production/src/schema/mutations/EntityInputProvider.cjs.map +1 -1
- package/dist/production/src/schema/mutations/EntityInputProvider.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputProvider.cjs.map +1 -1
- package/dist/production/src/schema/mutations/UpdateEntityRelationInputProvider.js.map +1 -1
- package/dist/production/src/schema/utils.cjs.map +1 -1
- package/dist/production/src/schema/utils.js.map +1 -1
- package/dist/production/src/utils/accessor.cjs.map +1 -1
- package/dist/production/src/utils/accessor.js.map +1 -1
- package/dist/production/src/utils/paginationUtils.cjs.map +1 -1
- package/dist/production/src/utils/paginationUtils.js.map +1 -1
- package/dist/production/src/utils/singletonFactory.cjs.map +1 -1
- package/dist/production/src/utils/singletonFactory.js.map +1 -1
- package/dist/tests/cases/integration/graphQlRequests/insert/numericColumn.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/insert/numericColumn.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/numericFilter.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/numericFilter.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/similarQuery.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/filter/similarQuery.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/formatting/numericFormat.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/formatting/numericFormat.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/query/formatting/numericList.test.d.ts +2 -0
- package/dist/tests/cases/integration/graphQlRequests/query/formatting/numericList.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/graphQlRequests/validation/utils.d.ts +1 -1
- package/dist/tests/cases/integration/graphQlRequests/validation/utils.d.ts.map +1 -1
- package/dist/tests/cases/unit/decimalType.test.d.ts +2 -0
- package/dist/tests/cases/unit/decimalType.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/jsonSchemaValidator.test.d.ts +2 -0
- package/dist/tests/cases/unit/jsonSchemaValidator.test.d.ts.map +1 -0
- package/dist/tests/src/test.d.ts +2 -1
- package/dist/tests/src/test.d.ts.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ExecutionContainer.d.ts +31 -12
- package/dist/types/ExecutionContainer.d.ts.map +1 -1
- package/dist/types/acl/PermissionFactory.d.ts +6 -0
- package/dist/types/acl/PermissionFactory.d.ts.map +1 -1
- package/dist/types/acl/PredicateFactory.d.ts +18 -7
- package/dist/types/acl/PredicateFactory.d.ts.map +1 -1
- package/dist/types/acl/PredicatesInjector.d.ts +1 -1
- package/dist/types/acl/PredicatesInjector.d.ts.map +1 -1
- package/dist/types/acl/index.d.ts +6 -6
- package/dist/types/acl/index.d.ts.map +1 -1
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.d.ts +2 -2
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.d.ts.map +1 -1
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.d.ts +3 -3
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.d.ts.map +1 -1
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts +3 -3
- package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts.map +1 -1
- package/dist/types/extensions/hasManyToHasOneReducer/index.d.ts +3 -3
- package/dist/types/extensions/hasManyToHasOneReducer/index.d.ts.map +1 -1
- package/dist/types/extensions/index.d.ts +2 -2
- package/dist/types/extensions/index.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.d.ts +2 -2
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.d.ts +2 -2
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.d.ts +2 -2
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts +2 -2
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts.map +1 -1
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.d.ts +2 -2
- package/dist/types/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/input-validation/InputValidator.d.ts +1 -1
- package/dist/types/input-validation/InputValidator.d.ts.map +1 -1
- package/dist/types/input-validation/JsonSchemaValidator.d.ts +25 -0
- package/dist/types/input-validation/JsonSchemaValidator.d.ts.map +1 -0
- package/dist/types/input-validation/QueryAstFactory.d.ts +2 -2
- package/dist/types/input-validation/QueryAstFactory.d.ts.map +1 -1
- package/dist/types/input-validation/ValidationDataSelector.d.ts +4 -4
- package/dist/types/input-validation/ValidationDataSelector.d.ts.map +1 -1
- package/dist/types/input-validation/ValidationEvaluation.d.ts +1 -1
- package/dist/types/input-validation/ValidationEvaluation.d.ts.map +1 -1
- package/dist/types/input-validation/dependencies/DependencyMerger.d.ts +1 -1
- package/dist/types/input-validation/dependencies/DependencyMerger.d.ts.map +1 -1
- package/dist/types/input-validation/dependencies/index.d.ts +2 -2
- package/dist/types/input-validation/dependencies/index.d.ts.map +1 -1
- package/dist/types/input-validation/index.d.ts +12 -11
- package/dist/types/input-validation/index.d.ts.map +1 -1
- package/dist/types/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts +5 -5
- package/dist/types/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts.map +1 -1
- package/dist/types/input-validation/preValidation/InputPreValidator.d.ts +11 -6
- package/dist/types/input-validation/preValidation/InputPreValidator.d.ts.map +1 -1
- package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts +7 -7
- package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts.map +1 -1
- package/dist/types/input-validation/preValidation/index.d.ts +3 -3
- package/dist/types/input-validation/preValidation/index.d.ts.map +1 -1
- package/dist/types/inputProcessing/CreateInputProcessor.d.ts +2 -2
- package/dist/types/inputProcessing/CreateInputProcessor.d.ts.map +1 -1
- package/dist/types/inputProcessing/CreateInputVisitor.d.ts +2 -2
- package/dist/types/inputProcessing/CreateInputVisitor.d.ts.map +1 -1
- package/dist/types/inputProcessing/ObjectNode.d.ts +1 -1
- package/dist/types/inputProcessing/ObjectNode.d.ts.map +1 -1
- package/dist/types/inputProcessing/UniqueWhereExpander.d.ts +2 -2
- package/dist/types/inputProcessing/UniqueWhereExpander.d.ts.map +1 -1
- package/dist/types/inputProcessing/UpdateInputProcessor.d.ts +2 -2
- package/dist/types/inputProcessing/UpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts +2 -2
- package/dist/types/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
- package/dist/types/inputProcessing/index.d.ts +7 -7
- package/dist/types/inputProcessing/index.d.ts.map +1 -1
- package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts +1 -1
- package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts.map +1 -1
- package/dist/types/introspection/IntrospectionSchemaFactory.d.ts +3 -3
- package/dist/types/introspection/IntrospectionSchemaFactory.d.ts.map +1 -1
- package/dist/types/introspection/index.d.ts +4 -4
- package/dist/types/introspection/index.d.ts.map +1 -1
- package/dist/types/mapper/ErrorUtils.d.ts +1 -1
- package/dist/types/mapper/ErrorUtils.d.ts.map +1 -1
- package/dist/types/mapper/EventManager.d.ts +2 -2
- package/dist/types/mapper/EventManager.d.ts.map +1 -1
- package/dist/types/mapper/JunctionTableManager.d.ts +4 -4
- package/dist/types/mapper/JunctionTableManager.d.ts.map +1 -1
- package/dist/types/mapper/Mapper.d.ts +12 -12
- package/dist/types/mapper/Mapper.d.ts.map +1 -1
- package/dist/types/mapper/MapperFactory.d.ts +8 -8
- package/dist/types/mapper/MapperFactory.d.ts.map +1 -1
- package/dist/types/mapper/MutationProcessorHelper.d.ts +1 -1
- package/dist/types/mapper/MutationProcessorHelper.d.ts.map +1 -1
- package/dist/types/mapper/Result.d.ts +1 -1
- package/dist/types/mapper/Result.d.ts.map +1 -1
- package/dist/types/mapper/delete/DeleteExecutor.d.ts +6 -6
- package/dist/types/mapper/delete/DeleteExecutor.d.ts.map +1 -1
- package/dist/types/mapper/delete/DeleteState.d.ts +2 -2
- package/dist/types/mapper/delete/DeleteState.d.ts.map +1 -1
- package/dist/types/mapper/delete/index.d.ts +2 -2
- package/dist/types/mapper/delete/index.d.ts.map +1 -1
- package/dist/types/mapper/index.d.ts +15 -15
- package/dist/types/mapper/index.d.ts.map +1 -1
- package/dist/types/mapper/insert/InsertBuilder.d.ts +4 -4
- package/dist/types/mapper/insert/InsertBuilder.d.ts.map +1 -1
- package/dist/types/mapper/insert/InsertBuilderFactory.d.ts +3 -3
- package/dist/types/mapper/insert/InsertBuilderFactory.d.ts.map +1 -1
- package/dist/types/mapper/insert/Inserter.d.ts +5 -5
- package/dist/types/mapper/insert/Inserter.d.ts.map +1 -1
- package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts +4 -4
- package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/index.d.ts +4 -4
- package/dist/types/mapper/insert/index.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts +7 -7
- package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts +9 -9
- package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts +8 -8
- package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts +7 -7
- package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts +7 -7
- package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/select/ConditionBuilder.d.ts.map +1 -1
- package/dist/types/mapper/select/JoinBuilder.d.ts +1 -1
- package/dist/types/mapper/select/JoinBuilder.d.ts.map +1 -1
- package/dist/types/mapper/select/JoinVisitor.d.ts +1 -1
- package/dist/types/mapper/select/JoinVisitor.d.ts.map +1 -1
- package/dist/types/mapper/select/OrderByBuilder.d.ts +2 -2
- package/dist/types/mapper/select/OrderByBuilder.d.ts.map +1 -1
- package/dist/types/mapper/select/OrderByHelper.d.ts +1 -1
- package/dist/types/mapper/select/OrderByHelper.d.ts.map +1 -1
- package/dist/types/mapper/select/RelationFetcher.d.ts +7 -7
- package/dist/types/mapper/select/RelationFetcher.d.ts.map +1 -1
- package/dist/types/mapper/select/SelectBuilder.d.ts +10 -10
- package/dist/types/mapper/select/SelectBuilder.d.ts.map +1 -1
- package/dist/types/mapper/select/SelectBuilderFactory.d.ts +2 -2
- package/dist/types/mapper/select/SelectBuilderFactory.d.ts.map +1 -1
- package/dist/types/mapper/select/SelectExecutionHandler.d.ts +4 -4
- package/dist/types/mapper/select/SelectExecutionHandler.d.ts.map +1 -1
- package/dist/types/mapper/select/SelectHydrator.d.ts +1 -1
- package/dist/types/mapper/select/SelectHydrator.d.ts.map +1 -1
- package/dist/types/mapper/select/WhereBuilder.d.ts +4 -4
- package/dist/types/mapper/select/WhereBuilder.d.ts.map +1 -1
- package/dist/types/mapper/select/handlers/FieldsVisitor.d.ts +4 -4
- package/dist/types/mapper/select/handlers/FieldsVisitor.d.ts.map +1 -1
- package/dist/types/mapper/select/handlers/FieldsVisitorFactory.d.ts +5 -5
- package/dist/types/mapper/select/handlers/FieldsVisitorFactory.d.ts.map +1 -1
- package/dist/types/mapper/select/handlers/MetaHandler.d.ts +3 -3
- package/dist/types/mapper/select/handlers/MetaHandler.d.ts.map +1 -1
- package/dist/types/mapper/select/handlers/index.d.ts +3 -3
- package/dist/types/mapper/select/handlers/index.d.ts.map +1 -1
- package/dist/types/mapper/select/index.d.ts +13 -13
- package/dist/types/mapper/select/index.d.ts.map +1 -1
- package/dist/types/mapper/select/optimizer/WhereOptimizer.d.ts +1 -1
- package/dist/types/mapper/select/optimizer/WhereOptimizer.d.ts.map +1 -1
- package/dist/types/mapper/types.d.ts +1 -1
- package/dist/types/mapper/types.d.ts.map +1 -1
- package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts +5 -5
- package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/UpdateBuilder.d.ts +4 -4
- package/dist/types/mapper/update/UpdateBuilder.d.ts.map +1 -1
- package/dist/types/mapper/update/UpdateBuilderFactory.d.ts +3 -3
- package/dist/types/mapper/update/UpdateBuilderFactory.d.ts.map +1 -1
- package/dist/types/mapper/update/Updater.d.ts +5 -5
- package/dist/types/mapper/update/Updater.d.ts.map +1 -1
- package/dist/types/mapper/update/index.d.ts +4 -4
- package/dist/types/mapper/update/index.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts +12 -12
- package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts +12 -12
- package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts +12 -12
- package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.d.ts +6 -6
- package/dist/types/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.d.ts +10 -10
- package/dist/types/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.d.ts.map +1 -1
- package/dist/types/resolvers/GraphQlQueryAstFactory.d.ts +1 -1
- package/dist/types/resolvers/GraphQlQueryAstFactory.d.ts.map +1 -1
- package/dist/types/resolvers/MutationResolver.d.ts +3 -3
- package/dist/types/resolvers/MutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/ReadHelpers.d.ts +2 -2
- package/dist/types/resolvers/ReadHelpers.d.ts.map +1 -1
- package/dist/types/resolvers/ReadResolver.d.ts +4 -4
- package/dist/types/resolvers/ReadResolver.d.ts.map +1 -1
- package/dist/types/resolvers/RefreshViewResolver.d.ts +1 -1
- package/dist/types/resolvers/RefreshViewResolver.d.ts.map +1 -1
- package/dist/types/resolvers/ValidationResolver.d.ts +2 -2
- package/dist/types/resolvers/ValidationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/index.d.ts +4 -4
- package/dist/types/resolvers/index.d.ts.map +1 -1
- package/dist/types/schema/ColumnTypeResolver.d.ts +2 -2
- package/dist/types/schema/ColumnTypeResolver.d.ts.map +1 -1
- package/dist/types/schema/ConditionTypeProvider.d.ts +1 -1
- package/dist/types/schema/ConditionTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/CustomTypesProvider.d.ts +1 -0
- package/dist/types/schema/CustomTypesProvider.d.ts.map +1 -1
- package/dist/types/schema/EntityTypeProvider.d.ts +5 -5
- package/dist/types/schema/EntityTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/FieldAccessVisitor.d.ts +1 -1
- package/dist/types/schema/FieldAccessVisitor.d.ts.map +1 -1
- package/dist/types/schema/GraphQlSchemaBuilder.d.ts +6 -6
- package/dist/types/schema/GraphQlSchemaBuilder.d.ts.map +1 -1
- package/dist/types/schema/GraphQlSchemaBuilderFactory.d.ts +30 -30
- package/dist/types/schema/GraphQlSchemaBuilderFactory.d.ts.map +1 -1
- package/dist/types/schema/MutationProvider.d.ts +6 -6
- package/dist/types/schema/MutationProvider.d.ts.map +1 -1
- package/dist/types/schema/OrderByTypeProvider.d.ts +1 -1
- package/dist/types/schema/OrderByTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/PaginatedFieldConfigFactory.d.ts +3 -3
- package/dist/types/schema/PaginatedFieldConfigFactory.d.ts.map +1 -1
- package/dist/types/schema/QueryProvider.d.ts +6 -6
- package/dist/types/schema/QueryProvider.d.ts.map +1 -1
- package/dist/types/schema/RefreshViewMutationProvider.d.ts +2 -2
- package/dist/types/schema/RefreshViewMutationProvider.d.ts.map +1 -1
- package/dist/types/schema/ValidationQueriesProvider.d.ts +4 -4
- package/dist/types/schema/ValidationQueriesProvider.d.ts.map +1 -1
- package/dist/types/schema/WhereTypeProvider.d.ts +3 -3
- package/dist/types/schema/WhereTypeProvider.d.ts.map +1 -1
- package/dist/types/schema/entities/FieldArgsVisitor.d.ts +2 -2
- package/dist/types/schema/entities/FieldArgsVisitor.d.ts.map +1 -1
- package/dist/types/schema/entities/FieldTypeVisitor.d.ts +3 -3
- package/dist/types/schema/entities/FieldTypeVisitor.d.ts.map +1 -1
- package/dist/types/schema/entities/index.d.ts +2 -2
- package/dist/types/schema/entities/index.d.ts.map +1 -1
- package/dist/types/schema/index.d.ts +18 -18
- package/dist/types/schema/index.d.ts.map +1 -1
- package/dist/types/schema/mutations/ConnectOrCreateRelationInputProvider.d.ts +3 -3
- package/dist/types/schema/mutations/ConnectOrCreateRelationInputProvider.d.ts.map +1 -1
- package/dist/types/schema/mutations/CreateEntityInputFieldVisitor.d.ts +3 -3
- package/dist/types/schema/mutations/CreateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.d.ts +1 -1
- package/dist/types/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/CreateEntityRelationInputFieldVisitor.d.ts +5 -5
- package/dist/types/schema/mutations/CreateEntityRelationInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/CreateEntityRelationInputProvider.d.ts +1 -1
- package/dist/types/schema/mutations/CreateEntityRelationInputProvider.d.ts.map +1 -1
- package/dist/types/schema/mutations/EntityInputProvider.d.ts +1 -1
- package/dist/types/schema/mutations/EntityInputProvider.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts +4 -4
- package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.d.ts +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts +6 -6
- package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts.map +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationInputProvider.d.ts +1 -1
- package/dist/types/schema/mutations/UpdateEntityRelationInputProvider.d.ts.map +1 -1
- package/dist/types/schema/mutations/index.d.ts +9 -9
- package/dist/types/schema/mutations/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/accessor.d.ts +1 -1
- package/dist/types/utils/accessor.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +13 -13
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/paginationUtils.d.ts +1 -1
- package/dist/types/utils/paginationUtils.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/ExecutionContainer.ts +77 -16
- package/src/acl/EvaluatedPredicateReplacer.ts +1 -1
- package/src/acl/PermissionFactory.ts +50 -17
- package/src/acl/PredicateFactory.ts +40 -11
- package/src/acl/PredicatesInjector.ts +20 -14
- package/src/acl/index.ts +6 -6
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.ts +2 -2
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts +5 -5
- package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts +4 -4
- package/src/extensions/hasManyToHasOneReducer/index.ts +3 -3
- package/src/extensions/index.ts +2 -2
- package/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts +2 -2
- package/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts +5 -5
- package/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.ts +2 -2
- package/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts +4 -4
- package/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.ts +2 -2
- package/src/index.ts +11 -11
- package/src/input-validation/EntityRulesResolver.ts +3 -3
- package/src/input-validation/InputValidator.ts +1 -1
- package/src/input-validation/JsonSchemaValidator.ts +257 -0
- package/src/input-validation/QueryAstFactory.ts +2 -2
- package/src/input-validation/ValidationContext.ts +1 -1
- package/src/input-validation/ValidationDataSelector.ts +3 -3
- package/src/input-validation/ValidationEvaluation.ts +1 -1
- package/src/input-validation/dependencies/DependencyCollector.ts +1 -1
- package/src/input-validation/dependencies/DependencyMerger.ts +2 -2
- package/src/input-validation/dependencies/index.ts +2 -2
- package/src/input-validation/index.ts +12 -11
- package/src/input-validation/preValidation/CreateInputPreValidationProcessor.ts +4 -4
- package/src/input-validation/preValidation/InputPreValidator.ts +60 -17
- package/src/input-validation/preValidation/UpdateInputPreValidationProcessor.ts +4 -4
- package/src/input-validation/preValidation/index.ts +3 -3
- package/src/inputProcessing/CreateInputProcessor.ts +2 -2
- package/src/inputProcessing/CreateInputVisitor.ts +4 -4
- package/src/inputProcessing/ObjectNode.ts +1 -1
- package/src/inputProcessing/UniqueWhereExpander.ts +3 -3
- package/src/inputProcessing/UpdateInputProcessor.ts +2 -2
- package/src/inputProcessing/UpdateInputVisitor.ts +4 -4
- package/src/inputProcessing/index.ts +7 -7
- package/src/introspection/IntrospectionSchemaDefinitionFactory.ts +3 -3
- package/src/introspection/IntrospectionSchemaFactory.ts +4 -4
- package/src/introspection/index.ts +4 -4
- package/src/mapper/ErrorUtils.ts +2 -2
- package/src/mapper/EventManager.ts +2 -2
- package/src/mapper/JunctionTableManager.ts +6 -6
- package/src/mapper/Mapper.ts +14 -14
- package/src/mapper/MapperFactory.ts +8 -8
- package/src/mapper/MutationProcessorHelper.ts +1 -1
- package/src/mapper/Result.ts +1 -1
- package/src/mapper/delete/DeleteExecutor.ts +11 -11
- package/src/mapper/delete/DeleteState.ts +3 -3
- package/src/mapper/delete/index.ts +2 -2
- package/src/mapper/index.ts +15 -15
- package/src/mapper/insert/InsertBuilder.ts +5 -5
- package/src/mapper/insert/InsertBuilderFactory.ts +3 -3
- package/src/mapper/insert/Inserter.ts +8 -8
- package/src/mapper/insert/SqlCreateInputProcessor.ts +10 -10
- package/src/mapper/insert/index.ts +4 -4
- package/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.ts +6 -6
- package/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.ts +7 -7
- package/src/mapper/insert/relations/OneHasManyCreateInputProcessor.ts +5 -5
- package/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.ts +6 -6
- package/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.ts +7 -7
- package/src/mapper/select/ConditionBuilder.ts +3 -1
- package/src/mapper/select/JoinBuilder.ts +2 -2
- package/src/mapper/select/JoinVisitor.ts +1 -1
- package/src/mapper/select/OrderByBuilder.ts +3 -3
- package/src/mapper/select/OrderByHelper.ts +1 -1
- package/src/mapper/select/RelationFetcher.ts +9 -9
- package/src/mapper/select/SelectBuilder.ts +11 -11
- package/src/mapper/select/SelectBuilderFactory.ts +2 -2
- package/src/mapper/select/SelectExecutionHandler.ts +4 -4
- package/src/mapper/select/SelectHydrator.ts +2 -2
- package/src/mapper/select/WhereBuilder.ts +5 -5
- package/src/mapper/select/handlers/FieldsVisitor.ts +24 -8
- package/src/mapper/select/handlers/FieldsVisitorFactory.ts +5 -5
- package/src/mapper/select/handlers/MetaHandler.ts +5 -5
- package/src/mapper/select/handlers/index.ts +3 -3
- package/src/mapper/select/index.ts +13 -13
- package/src/mapper/select/optimizer/ConditionOptimizer.ts +1 -1
- package/src/mapper/select/optimizer/WhereOptimizer.ts +3 -3
- package/src/mapper/types.ts +1 -1
- package/src/mapper/update/SqlUpdateInputProcessor.ts +11 -11
- package/src/mapper/update/UpdateBuilder.ts +6 -6
- package/src/mapper/update/UpdateBuilderFactory.ts +3 -3
- package/src/mapper/update/Updater.ts +8 -8
- package/src/mapper/update/index.ts +4 -4
- package/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.ts +6 -6
- package/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.ts +7 -7
- package/src/mapper/update/relations/OneHasManyUpdateInputProcessor.ts +6 -6
- package/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.ts +6 -6
- package/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.ts +7 -7
- package/src/resolvers/GraphQlQueryAstFactory.ts +2 -2
- package/src/resolvers/MutationResolver.ts +9 -9
- package/src/resolvers/ReadHelpers.ts +5 -5
- package/src/resolvers/ReadResolver.ts +4 -4
- package/src/resolvers/RefreshViewResolver.ts +1 -1
- package/src/resolvers/ValidationResolver.ts +3 -3
- package/src/resolvers/index.ts +4 -4
- package/src/schema/ColumnTypeResolver.ts +6 -4
- package/src/schema/ConditionTypeProvider.ts +7 -4
- package/src/schema/CustomTypesProvider.ts +37 -0
- package/src/schema/EntityTypeProvider.ts +10 -10
- package/src/schema/EnumsProvider.ts +1 -1
- package/src/schema/FieldAccessVisitor.ts +1 -1
- package/src/schema/GraphQlSchemaBuilder.ts +6 -6
- package/src/schema/GraphQlSchemaBuilderFactory.ts +30 -30
- package/src/schema/MutationProvider.ts +9 -9
- package/src/schema/OperationExtension.ts +1 -1
- package/src/schema/OrderByTypeProvider.ts +4 -4
- package/src/schema/PaginatedFieldConfigFactory.ts +3 -3
- package/src/schema/QueryProvider.ts +8 -8
- package/src/schema/RefreshViewMutationProvider.ts +2 -2
- package/src/schema/ValidationQueriesProvider.ts +5 -5
- package/src/schema/WhereTypeProvider.ts +7 -7
- package/src/schema/entities/FieldArgsVisitor.ts +2 -2
- package/src/schema/entities/FieldTypeVisitor.ts +4 -4
- package/src/schema/entities/index.ts +2 -2
- package/src/schema/index.ts +18 -18
- package/src/schema/mutations/ConnectOrCreateRelationInputProvider.ts +5 -5
- package/src/schema/mutations/CreateEntityInputFieldVisitor.ts +3 -3
- package/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.ts +2 -2
- package/src/schema/mutations/CreateEntityRelationInputFieldVisitor.ts +7 -7
- package/src/schema/mutations/CreateEntityRelationInputProvider.ts +2 -2
- package/src/schema/mutations/EntityInputProvider.ts +4 -4
- package/src/schema/mutations/UpdateEntityInputFieldVisitor.ts +3 -3
- package/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.ts +1 -1
- package/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.ts +8 -8
- package/src/schema/mutations/UpdateEntityRelationInputProvider.ts +2 -2
- package/src/schema/mutations/index.ts +9 -9
- package/src/schema/utils.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/accessor.ts +2 -2
- package/src/utils/index.ts +13 -13
- package/src/utils/paginationUtils.ts +1 -1
- package/src/utils/singletonFactory.ts +1 -1
- package/tests/cases/bugs/bug-filter-or.test.ts +3 -3
- package/tests/cases/bugs/bug-update-by-nested-unique.test.ts +3 -3
- package/tests/cases/bugs/bug102.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/aclDelete.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/additionalDeleteFilter.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/cascadeDelete.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/orphanRemoval.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/restrictOnDelete.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/delete/setNullOnDelete.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/acl/setField.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/aclInsert.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/basicInsert.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/insertCustomId.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/jsonInsert.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/manyHasManyInverse/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/manyHasManyOwning/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/manyHasOne/connectOrCreate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/manyHasOne/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/numericColumn.test.ts +110 -0
- package/tests/cases/integration/graphQlRequests/insert/oneHasMany/connect.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/oneHasMany/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/oneHasOneInverse/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/oneHasOneOwning/create.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/oneHasOneOwning/empty.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/subOperationFail.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/insert/validation/toBeFixed.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/acl/isNullAcl.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/acl/orPredicate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/acl/predicateElimination.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/acl/relationAcl.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/query/acl/sameRowAndFieldPredicate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/backReferencedFilter.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/complexCondition.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/composedFilter.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/containsQuery.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/manyHasOneRelation.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/numericFilter.test.ts +92 -0
- package/tests/cases/integration/graphQlRequests/query/filter/oneHasManyRelation.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/filter/similarQuery.test.ts +72 -0
- package/tests/cases/integration/graphQlRequests/query/formatting/dateFormat.test.ts +135 -4
- package/tests/cases/integration/graphQlRequests/query/formatting/numericFormat.test.ts +68 -0
- package/tests/cases/integration/graphQlRequests/query/formatting/numericList.test.ts +41 -0
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/fragments.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/misc/aliasedType.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/misc/longAliasHash.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/misc/reducedHasMany.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/misc/transaction.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/pagination/hasManyLimit.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/pagination/paginate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/pagination/paginateAliased.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/pagination/simpleLimit.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/advanced.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyInverse.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyOwning.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/manyHasOne.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasMany.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneInverse.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneOwner.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/byRelations.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/defaultOrdering.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/randomSort.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/sorting/sortNulls.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/query/sorting/sortedHasMany.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/unique/basicQueryById.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/unique/composedUnique.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/unique/oneHasManyUnique.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/unique/uniqueWithFilter.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/query/view/view.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/acl/aclUpdate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/additionalFilter.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/basic/columnUpdate.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connectOrCreate.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/manyHasOne/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/combination.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/connectOrCreate.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasMany/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/create.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/delete.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/disconnect.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/update.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/upsert.test.ts +4 -4
- package/tests/cases/integration/graphQlRequests/update/queryPortal.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/transaction.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/update/validation/toBeFixed.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/upsert/basicUpsert.test.ts +3 -3
- package/tests/cases/integration/graphQlRequests/validation/conditions.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/nestedValidation.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/validation/optionalAssert.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/validation/required.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/validation/requiredWhen.test.ts +2 -2
- package/tests/cases/integration/graphQlRequests/validation/rules/andRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/lengthRangeRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/maxLengthRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/minLength.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/notEmptyRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/notRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/orRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/patternRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/rules/rangeRule.test.ts +1 -1
- package/tests/cases/integration/graphQlRequests/validation/utils.ts +2 -2
- package/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.ts +2 -2
- package/tests/cases/integration/graphQlSchema/schema-acl-allowed.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-predicate.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-predicate2.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-create.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-delete.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl-restricted-update.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-acl.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-aliased-type.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-basic.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-bug-66.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-column-types.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-custom-primary.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-has-many-reduction.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-new-builder.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-no-root-ops.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-read-only.gql +2 -0
- package/tests/cases/integration/graphQlSchema/schema-view-entity.gql +2 -0
- package/tests/cases/unit/aclVariablesFactory.test.ts +2 -2
- package/tests/cases/unit/conditionOptimizer.test.ts +1 -1
- package/tests/cases/unit/decimalType.test.ts +65 -0
- package/tests/cases/unit/inputPreValidator.test.ts +101 -6
- package/tests/cases/unit/inputValidation.test.ts +3 -3
- package/tests/cases/unit/jsonSchemaValidator.test.ts +115 -0
- package/tests/cases/unit/orderbyHelper.test.ts +3 -3
- package/tests/cases/unit/permissionMerger.test.ts +164 -2
- package/tests/cases/unit/predicatesFactory.test.ts +77 -2
- package/tests/cases/unit/predicatesInjector.test.ts +5 -5
- package/tests/cases/unit/uuidType.test.ts +1 -1
- package/tests/cases/unit/variableInjector.test.ts +2 -2
- package/tests/cases/unit/whereBuilder.test.ts +4 -4
- package/tests/cases/unit/whereOptimizer.test.ts +3 -3
- package/tests/src/test.ts +6 -5
- package/vitest.config.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshViewResolver.js","sources":["../../../../../packages/engine-content-api/src/resolvers/RefreshViewResolver.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { MapperFactory } from '../mapper'\nimport { wrapIdentifier } from '@contember/database'\n\nexport class RefreshViewResolver {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t) {\n\t}\n\n\tpublic async resolve(entity: string, options?: { concurrently?: boolean }): Promise<{ ok: boolean }> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst entityModel = this.schema.model.entities[entity]\n\t\tif (!entityModel) {\n\t\t\tthrow new Error(`Entity ${entity} not found`)\n\t\t}\n\t\tconst concurrently = options?.concurrently ? ' CONCURRENTLY' : ''\n\t\tawait mapper.db.query(`REFRESH MATERIALIZED VIEW${concurrently} ${wrapIdentifier(mapper.db.schema)}.${wrapIdentifier(entityModel.tableName)}`)\n\n\t\treturn { ok: true }\n\t}\n}\n"],"names":[],"mappings":";AAIO,MAAM,oBAAoB;AAAA,EAChC,YACkB,QACA,eAChB;AAFgB,SAAA,SAAA;AACA,SAAA,gBAAA;AAAA,EAElB;AAAA,EAEA,MAAa,QAAQ,QAAgB,SAAgE;AACpG,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,cAAc,KAAK,OAAO,MAAM,SAAS,MAAM;AACrD,QAAI,CAAC,aAAa;AACjB,YAAM,IAAI,MAAM,UAAU,MAAM,YAAY;AAAA,IAC7C;AACA,UAAM,eAAe,SAAS,eAAe,kBAAkB;AAC/D,UAAM,OAAO,GAAG,MAAM,4BAA4B,YAAY,IAAI,eAAe,OAAO,GAAG,MAAM,CAAC,IAAI,eAAe,YAAY,SAAS,CAAC,EAAE;AAE7I,WAAO,EAAE,IAAI,KAAA;AAAA,EACd;AACD;"}
|
|
1
|
+
{"version":3,"file":"RefreshViewResolver.js","sources":["../../../../../packages/engine-content-api/src/resolvers/RefreshViewResolver.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport { MapperFactory } from '../mapper/index.js'\nimport { wrapIdentifier } from '@contember/database'\n\nexport class RefreshViewResolver {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t) {\n\t}\n\n\tpublic async resolve(entity: string, options?: { concurrently?: boolean }): Promise<{ ok: boolean }> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst entityModel = this.schema.model.entities[entity]\n\t\tif (!entityModel) {\n\t\t\tthrow new Error(`Entity ${entity} not found`)\n\t\t}\n\t\tconst concurrently = options?.concurrently ? ' CONCURRENTLY' : ''\n\t\tawait mapper.db.query(`REFRESH MATERIALIZED VIEW${concurrently} ${wrapIdentifier(mapper.db.schema)}.${wrapIdentifier(entityModel.tableName)}`)\n\n\t\treturn { ok: true }\n\t}\n}\n"],"names":[],"mappings":";AAIO,MAAM,oBAAoB;AAAA,EAChC,YACkB,QACA,eAChB;AAFgB,SAAA,SAAA;AACA,SAAA,gBAAA;AAAA,EAElB;AAAA,EAEA,MAAa,QAAQ,QAAgB,SAAgE;AACpG,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,cAAc,KAAK,OAAO,MAAM,SAAS,MAAM;AACrD,QAAI,CAAC,aAAa;AACjB,YAAM,IAAI,MAAM,UAAU,MAAM,YAAY;AAAA,IAC7C;AACA,UAAM,eAAe,SAAS,eAAe,kBAAkB;AAC/D,UAAM,OAAO,GAAG,MAAM,4BAA4B,YAAY,IAAI,eAAe,OAAO,GAAG,MAAM,CAAC,IAAI,eAAe,YAAY,SAAS,CAAC,EAAE;AAE7I,WAAO,EAAE,IAAI,KAAA;AAAA,EACd;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationResolver.cjs","sources":["../../../../../packages/engine-content-api/src/resolvers/ValidationResolver.ts"],"sourcesContent":["import { Input, Model, Result } from '@contember/schema'\nimport { assertNever } from '../utils'\nimport { InputPreValidator, ValidationResult } from '../input-validation'\nimport { MapperFactory } from '../mapper'\n\nexport class ValidationResolver {\n\tconstructor(\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t\tprivate readonly inputValidator: InputPreValidator,\n\t) {}\n\n\tpublic async validateUpdate(entity: Model.Entity, input: Input.UpdateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateUpdate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\twhere: input.by,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t})\n\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic async validateCreate(entity: Model.Entity, input: Input.CreateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateCreate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t\toverRelation: null,\n\t\t})\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic static createValidationResponse(validationResult: ValidationResult): Result.ValidationResult {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: validationResult.map(it => ({\n\t\t\t\tmessage: it.message,\n\t\t\t\tpath: it.path.map(part => {\n\t\t\t\t\tif ('field' in part) {\n\t\t\t\t\t\treturn { __typename: '_FieldPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\tif ('index' in part) {\n\t\t\t\t\t\treturn { __typename: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AAsB,GAAG,KAAA;AAAA,UAC/C;AACA,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,iBAAOA,YAAAA,YAAgB;AAAA,QACxB,CAAC;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,EAEJ;AACD;;"}
|
|
1
|
+
{"version":3,"file":"ValidationResolver.cjs","sources":["../../../../../packages/engine-content-api/src/resolvers/ValidationResolver.ts"],"sourcesContent":["import { Input, Model, Result } from '@contember/schema'\nimport { assertNever } from '../utils/index.js'\nimport { InputPreValidator, ValidationResult } from '../input-validation/index.js'\nimport { MapperFactory } from '../mapper/index.js'\n\nexport class ValidationResolver {\n\tconstructor(\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t\tprivate readonly inputValidator: InputPreValidator,\n\t) {}\n\n\tpublic async validateUpdate(entity: Model.Entity, input: Input.UpdateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateUpdate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\twhere: input.by,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t})\n\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic async validateCreate(entity: Model.Entity, input: Input.CreateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateCreate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t\toverRelation: null,\n\t\t})\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic static createValidationResponse(validationResult: ValidationResult): Result.ValidationResult {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: validationResult.map(it => ({\n\t\t\t\tmessage: it.message,\n\t\t\t\tpath: it.path.map(part => {\n\t\t\t\t\tif ('field' in part) {\n\t\t\t\t\t\treturn { __typename: '_FieldPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\tif ('index' in part) {\n\t\t\t\t\t\treturn { __typename: '_IndexPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\treturn assertNever(part)\n\t\t\t\t}),\n\t\t\t})),\n\t\t}\n\t}\n}\n"],"names":["assertNever"],"mappings":";;;;AAKO,MAAM,mBAAmB;AAAA,EAC/B,YACkB,eACA,gBAChB;AAFgB,SAAA,gBAAA;AACA,SAAA,iBAAA;AAAA,EACf;AAAA,EAEH,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,OAAO,MAAM;AAAA,MACb,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,IAAC,CACP;AAED,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,MACN,cAAc;AAAA,IAAA,CACd;AACD,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,OAAc,yBAAyB,kBAA6D;AACnG,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,iBAAiB,IAAI,CAAA,QAAO;AAAA,QACnC,SAAS,GAAG;AAAA,QACZ,MAAM,GAAG,KAAK,IAAI,CAAA,SAAQ;AACzB,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,iBAAOA,YAAAA,YAAgB;AAAA,QACxB,CAAC;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,EAEJ;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationResolver.js","sources":["../../../../../packages/engine-content-api/src/resolvers/ValidationResolver.ts"],"sourcesContent":["import { Input, Model, Result } from '@contember/schema'\nimport { assertNever } from '../utils'\nimport { InputPreValidator, ValidationResult } from '../input-validation'\nimport { MapperFactory } from '../mapper'\n\nexport class ValidationResolver {\n\tconstructor(\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t\tprivate readonly inputValidator: InputPreValidator,\n\t) {}\n\n\tpublic async validateUpdate(entity: Model.Entity, input: Input.UpdateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateUpdate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\twhere: input.by,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t})\n\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic async validateCreate(entity: Model.Entity, input: Input.CreateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateCreate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t\toverRelation: null,\n\t\t})\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic static createValidationResponse(validationResult: ValidationResult): Result.ValidationResult {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: validationResult.map(it => ({\n\t\t\t\tmessage: it.message,\n\t\t\t\tpath: it.path.map(part => {\n\t\t\t\t\tif ('field' in part) {\n\t\t\t\t\t\treturn { __typename: '_FieldPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\tif ('index' in part) {\n\t\t\t\t\t\treturn { __typename: '_IndexPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\treturn assertNever(part)\n\t\t\t\t}),\n\t\t\t})),\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAKO,MAAM,mBAAmB;AAAA,EAC/B,YACkB,eACA,gBAChB;AAFgB,SAAA,gBAAA;AACA,SAAA,iBAAA;AAAA,EACf;AAAA,EAEH,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,OAAO,MAAM;AAAA,MACb,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,IAAC,CACP;AAED,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,MACN,cAAc;AAAA,IAAA,CACd;AACD,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,OAAc,yBAAyB,kBAA6D;AACnG,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,iBAAiB,IAAI,CAAA,QAAO;AAAA,QACnC,SAAS,GAAG;AAAA,QACZ,MAAM,GAAG,KAAK,IAAI,CAAA,SAAQ;AACzB,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,iBAAO,YAAgB;AAAA,QACxB,CAAC;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,EAEJ;AACD;"}
|
|
1
|
+
{"version":3,"file":"ValidationResolver.js","sources":["../../../../../packages/engine-content-api/src/resolvers/ValidationResolver.ts"],"sourcesContent":["import { Input, Model, Result } from '@contember/schema'\nimport { assertNever } from '../utils/index.js'\nimport { InputPreValidator, ValidationResult } from '../input-validation/index.js'\nimport { MapperFactory } from '../mapper/index.js'\n\nexport class ValidationResolver {\n\tconstructor(\n\t\tprivate readonly mapperFactory: MapperFactory,\n\t\tprivate readonly inputValidator: InputPreValidator,\n\t) {}\n\n\tpublic async validateUpdate(entity: Model.Entity, input: Input.UpdateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateUpdate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\twhere: input.by,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t})\n\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic async validateCreate(entity: Model.Entity, input: Input.CreateInput): Promise<Result.ValidationResult> {\n\t\tconst mapper = this.mapperFactory.create()\n\t\tconst validationResult = await this.inputValidator.validateCreate({\n\t\t\tmapper,\n\t\t\tentity,\n\t\t\tdata: input.data,\n\t\t\tpath: [],\n\t\t\toverRelation: null,\n\t\t})\n\t\tif (validationResult.length > 0) {\n\t\t\treturn ValidationResolver.createValidationResponse(validationResult)\n\t\t}\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tpublic static createValidationResponse(validationResult: ValidationResult): Result.ValidationResult {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: validationResult.map(it => ({\n\t\t\t\tmessage: it.message,\n\t\t\t\tpath: it.path.map(part => {\n\t\t\t\t\tif ('field' in part) {\n\t\t\t\t\t\treturn { __typename: '_FieldPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\tif ('index' in part) {\n\t\t\t\t\t\treturn { __typename: '_IndexPathFragment', ...part }\n\t\t\t\t\t}\n\t\t\t\t\treturn assertNever(part)\n\t\t\t\t}),\n\t\t\t})),\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAKO,MAAM,mBAAmB;AAAA,EAC/B,YACkB,eACA,gBAChB;AAFgB,SAAA,gBAAA;AACA,SAAA,iBAAA;AAAA,EACf;AAAA,EAEH,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,OAAO,MAAM;AAAA,MACb,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,IAAC,CACP;AAED,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,MAAa,eAAe,QAAsB,OAA4D;AAC7G,UAAM,SAAS,KAAK,cAAc,OAAA;AAClC,UAAM,mBAAmB,MAAM,KAAK,eAAe,eAAe;AAAA,MACjE;AAAA,MACA;AAAA,MACA,MAAM,MAAM;AAAA,MACZ,MAAM,CAAA;AAAA,MACN,cAAc;AAAA,IAAA,CACd;AACD,QAAI,iBAAiB,SAAS,GAAG;AAChC,aAAO,mBAAmB,yBAAyB,gBAAgB;AAAA,IACpE;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,CAAA;AAAA,IAAC;AAAA,EAEX;AAAA,EAEA,OAAc,yBAAyB,kBAA6D;AACnG,WAAO;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,iBAAiB,IAAI,CAAA,QAAO;AAAA,QACnC,SAAS,GAAG;AAAA,QACZ,MAAM,GAAG,KAAK,IAAI,CAAA,SAAQ;AACzB,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,cAAI,WAAW,MAAM;AACpB,mBAAO,EAAE,YAAY,sBAAsB,GAAG,KAAA;AAAA,UAC/C;AACA,iBAAO,YAAgB;AAAA,QACxB,CAAC;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,EAEJ;AACD;"}
|
|
@@ -71,6 +71,8 @@ class ColumnTypeResolver {
|
|
|
71
71
|
return this.customTypeProvider.uuidType;
|
|
72
72
|
case schema.Model.ColumnType.Double:
|
|
73
73
|
return graphql.GraphQLFloat;
|
|
74
|
+
case schema.Model.ColumnType.Numeric:
|
|
75
|
+
return this.customTypeProvider.decimalType;
|
|
74
76
|
case schema.Model.ColumnType.Bool:
|
|
75
77
|
return graphql.GraphQLBoolean;
|
|
76
78
|
case schema.Model.ColumnType.DateTime:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnTypeResolver.cjs","sources":["../../../../../packages/engine-content-api/src/schema/ColumnTypeResolver.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLString } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { EnumsProvider } from './EnumsProvider'\nimport { CustomTypesProvider } from './CustomTypesProvider'\nimport { ImplementationException } from '../exception'\nimport { singletonFactory } from '../utils'\n\ntype ScalarType = Exclude<Model.ColumnType, Model.ColumnType.Enum>\n\nexport type ColumnGraphQLType = GraphQLScalarType | GraphQLEnumType | GraphQLList<GraphQLNonNull<GraphQLScalarType | GraphQLEnumType>>\n\nexport class ColumnTypeResolver {\n\tprivate schema: Model.Schema\n\tprivate enumsProvider: EnumsProvider\n\n\tprivate readonly aliasedTypes = singletonFactory<{ scalar: GraphQLScalarType; base: ScalarType }, string, ScalarType>(\n\t\tthis.createAliasedType.bind(this),\n\t)\n\n\tconstructor(\n\t\tschema: Model.Schema,\n\t\tenumsProvider: EnumsProvider,\n\t\tprivate readonly customTypeProvider: CustomTypesProvider,\n\t) {\n\t\tthis.schema = schema\n\t\tthis.enumsProvider = enumsProvider\n\t}\n\n\tprivate createAliasedType(name: string, baseType: ScalarType): { scalar: GraphQLScalarType; base: ScalarType } {\n\t\tconst baseGraphqlType = this.getScalarType(baseType)\n\t\treturn {\n\t\t\tscalar: new GraphQLScalarType({\n\t\t\t\t...baseGraphqlType.toConfig(),\n\t\t\t\tname,\n\t\t\t\tdescription: null,\n\t\t\t}),\n\t\t\tbase: baseType,\n\t\t}\n\t}\n\n\tpublic getType(column: Model.AnyColumn): [type: ColumnGraphQLType, baseType: GraphQLScalarType | GraphQLEnumType] {\n\t\tconst baseType = this.getBaseType(column)\n\t\treturn [\n\t\t\tcolumn.list ? new GraphQLList(new GraphQLNonNull(baseType)) : baseType,\n\t\t\tbaseType,\n\t\t]\n\t}\n\n\tprivate getBaseType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tif (column.typeAlias) {\n\t\t\tif (column.type === Model.ColumnType.Enum) {\n\t\t\t\tthrow new Error('GraphQL type alias cannot be specified for enum type')\n\t\t\t}\n\t\t\tconst { scalar, base } = this.aliasedTypes(column.typeAlias, column.type)\n\t\t\tif (base !== column.type) {\n\t\t\t\tthrow new Error('GraphQL type alias with different base type found')\n\t\t\t}\n\t\t\treturn scalar\n\t\t}\n\t\treturn this.resolveType(column)\n\t}\n\n\tprivate resolveType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tswitch (column.type) {\n\t\t\tcase Model.ColumnType.Enum:\n\t\t\t\tif (this.enumsProvider.hasEnum(column.columnType)) {\n\t\t\t\t\treturn this.enumsProvider.getEnum(column.columnType)\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Undefined enum ${column.columnType}`)\n\t\t\tdefault:\n\t\t\t\treturn this.getScalarType(column.type)\n\t\t}\n\t}\n\n\tprivate getScalarType(type: ScalarType): GraphQLScalarType {\n\t\tswitch (type) {\n\t\t\tcase Model.ColumnType.Int:\n\t\t\t\treturn GraphQLInt\n\t\t\tcase Model.ColumnType.String:\n\t\t\t\treturn GraphQLString\n\t\t\tcase Model.ColumnType.Uuid:\n\t\t\t\treturn this.customTypeProvider.uuidType\n\t\t\tcase Model.ColumnType.Double:\n\t\t\t\treturn GraphQLFloat\n\t\t\tcase Model.ColumnType.Bool:\n\t\t\t\treturn GraphQLBoolean\n\t\t\tcase Model.ColumnType.DateTime:\n\t\t\t\treturn this.customTypeProvider.dateTimeType\n\t\t\tcase Model.ColumnType.Time:\n\t\t\t\treturn this.customTypeProvider.timeType\n\t\t\tcase Model.ColumnType.Date:\n\t\t\t\treturn this.customTypeProvider.dateType\n\t\t\tcase Model.ColumnType.Json:\n\t\t\t\treturn this.customTypeProvider.jsonType\n\t\t\tdefault:\n\t\t\t\t;(({}: never): never => {\n\t\t\t\t\tthrow new ImplementationException('Invalid column type')\n\t\t\t\t})(type)\n\t\t}\n\t}\n}\n"],"names":["schema","singletonFactory","GraphQLScalarType","GraphQLList","GraphQLNonNull","Model","GraphQLInt","GraphQLString","GraphQLFloat","GraphQLBoolean","ImplementationException"],"mappings":";;;;;;;;;;AAWO,MAAM,mBAAmB;AAAA,EAQ/B,YACCA,SACA,eACiB,oBAChB;AADgB,SAAA,qBAAA;AAVlB,kBAAA,MAAQ,QAAA;AACR,kBAAA,MAAQ,eAAA;AAER,kBAAA,MAAiB,gBAAeC,iBAAAA;AAAAA,MAC/B,KAAK,kBAAkB,KAAK,IAAI;AAAA,IAAA,CACjC;AAOC,SAAK,SAASD;AACd,SAAK,gBAAgB;AAAA,EACtB;AAAA,EAEQ,kBAAkB,MAAc,UAAuE;AAC9G,UAAM,kBAAkB,KAAK,cAAc,QAAQ;AACnD,WAAO;AAAA,MACN,QAAQ,IAAIE,QAAAA,kBAAkB;AAAA,QAC7B,GAAG,gBAAgB,SAAA;AAAA,QACnB;AAAA,QACA,aAAa;AAAA,MAAA,CACb;AAAA,MACD,MAAM;AAAA,IAAA;AAAA,EAER;AAAA,EAEO,QAAQ,QAAmG;AACjH,UAAM,WAAW,KAAK,YAAY,MAAM;AACxC,WAAO;AAAA,MACN,OAAO,OAAO,IAAIC,QAAAA,YAAY,IAAIC,QAAAA,eAAe,QAAQ,CAAC,IAAI;AAAA,MAC9D;AAAA,IAAA;AAAA,EAEF;AAAA,EAEQ,YAAY,QAA8D;AACjF,QAAI,OAAO,WAAW;AACrB,UAAI,OAAO,SAASC,aAAM,WAAW,MAAM;AAC1C,cAAM,IAAI,MAAM,sDAAsD;AAAA,MACvE;AACA,YAAM,EAAE,QAAQ,KAAA,IAAS,KAAK,aAAa,OAAO,WAAW,OAAO,IAAI;AACxE,UAAI,SAAS,OAAO,MAAM;AACzB,cAAM,IAAI,MAAM,mDAAmD;AAAA,MACpE;AACA,aAAO;AAAA,IACR;AACA,WAAO,KAAK,YAAY,MAAM;AAAA,EAC/B;AAAA,EAEQ,YAAY,QAA8D;AACjF,YAAQ,OAAO,MAAA;AAAA,MACd,KAAKA,OAAAA,MAAM,WAAW;AACrB,YAAI,KAAK,cAAc,QAAQ,OAAO,UAAU,GAAG;AAClD,iBAAO,KAAK,cAAc,QAAQ,OAAO,UAAU;AAAA,QACpD;AACA,cAAM,IAAI,MAAM,kBAAkB,OAAO,UAAU,EAAE;AAAA,MACtD;AACC,eAAO,KAAK,cAAc,OAAO,IAAI;AAAA,IAAA;AAAA,EAExC;AAAA,EAEQ,cAAc,MAAqC;AAC1D,YAAQ,MAAA;AAAA,MACP,KAAKA,OAAAA,MAAM,WAAW;AACrB,eAAOC,QAAAA;AAAAA,MACR,KAAKD,OAAAA,MAAM,WAAW;AACrB,eAAOE,QAAAA;AAAAA,MACR,KAAKF,OAAAA,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAKA,OAAAA,MAAM,WAAW;AACrB,eAAOG,QAAAA;AAAAA,MACR,KAAKH,OAAAA,MAAM,WAAW;AACrB,eAAOI,QAAAA;AAAAA,MACR,KAAKJ,OAAAA,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAKA,OAAAA,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAKA,OAAAA,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAKA,OAAAA,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC;AACE,SAAC,CAAC,CAAA,MAAqB;AACvB,gBAAM,IAAIK,UAAAA,wBAAwB,qBAAqB;AAAA,QACxD,GAAG,IAAI;AAAA,IAAA;AAAA,EAEV;AACD;;"}
|
|
1
|
+
{"version":3,"file":"ColumnTypeResolver.cjs","sources":["../../../../../packages/engine-content-api/src/schema/ColumnTypeResolver.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLString } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { EnumsProvider } from './EnumsProvider.js'\nimport { CustomTypesProvider } from './CustomTypesProvider.js'\nimport { ImplementationException } from '../exception.js'\nimport { singletonFactory } from '../utils/index.js'\n\ntype ScalarType = Exclude<Model.ColumnType, Model.ColumnType.Enum>\n\nexport type ColumnGraphQLType = GraphQLScalarType | GraphQLEnumType | GraphQLList<GraphQLNonNull<GraphQLScalarType | GraphQLEnumType>>\n\nexport class ColumnTypeResolver {\n\tprivate schema: Model.Schema\n\tprivate enumsProvider: EnumsProvider\n\n\tprivate readonly aliasedTypes = singletonFactory<{ scalar: GraphQLScalarType; base: ScalarType }, string, ScalarType>(\n\t\tthis.createAliasedType.bind(this),\n\t)\n\n\tconstructor(\n\t\tschema: Model.Schema,\n\t\tenumsProvider: EnumsProvider,\n\t\tprivate readonly customTypeProvider: CustomTypesProvider,\n\t) {\n\t\tthis.schema = schema\n\t\tthis.enumsProvider = enumsProvider\n\t}\n\n\tprivate createAliasedType(name: string, baseType: ScalarType): { scalar: GraphQLScalarType; base: ScalarType } {\n\t\tconst baseGraphqlType = this.getScalarType(baseType)\n\t\treturn {\n\t\t\tscalar: new GraphQLScalarType({\n\t\t\t\t...baseGraphqlType.toConfig(),\n\t\t\t\tname,\n\t\t\t\tdescription: null,\n\t\t\t}),\n\t\t\tbase: baseType,\n\t\t}\n\t}\n\n\tpublic getType(column: Model.AnyColumn): [type: ColumnGraphQLType, baseType: GraphQLScalarType | GraphQLEnumType] {\n\t\tconst baseType = this.getBaseType(column)\n\t\treturn [\n\t\t\tcolumn.list ? new GraphQLList(new GraphQLNonNull(baseType)) : baseType,\n\t\t\tbaseType,\n\t\t]\n\t}\n\n\tprivate getBaseType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tif (column.typeAlias) {\n\t\t\tif (column.type === Model.ColumnType.Enum) {\n\t\t\t\tthrow new Error('GraphQL type alias cannot be specified for enum type')\n\t\t\t}\n\t\t\tconst { scalar, base } = this.aliasedTypes(column.typeAlias, column.type)\n\t\t\tif (base !== column.type) {\n\t\t\t\tthrow new Error('GraphQL type alias with different base type found')\n\t\t\t}\n\t\t\treturn scalar\n\t\t}\n\t\treturn this.resolveType(column)\n\t}\n\n\tprivate resolveType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tswitch (column.type) {\n\t\t\tcase Model.ColumnType.Enum:\n\t\t\t\tif (this.enumsProvider.hasEnum(column.columnType)) {\n\t\t\t\t\treturn this.enumsProvider.getEnum(column.columnType)\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Undefined enum ${column.columnType}`)\n\t\t\tdefault:\n\t\t\t\treturn this.getScalarType(column.type)\n\t\t}\n\t}\n\n\tprivate getScalarType(type: ScalarType): GraphQLScalarType {\n\t\tswitch (type) {\n\t\t\tcase Model.ColumnType.Int:\n\t\t\t\treturn GraphQLInt\n\t\t\tcase Model.ColumnType.String:\n\t\t\t\treturn GraphQLString\n\t\t\tcase Model.ColumnType.Uuid:\n\t\t\t\treturn this.customTypeProvider.uuidType\n\t\t\tcase Model.ColumnType.Double:\n\t\t\t\treturn GraphQLFloat\n\t\t\tcase Model.ColumnType.Numeric:\n\t\t\t\treturn this.customTypeProvider.decimalType\n\t\t\tcase Model.ColumnType.Bool:\n\t\t\t\treturn GraphQLBoolean\n\t\t\tcase Model.ColumnType.DateTime:\n\t\t\t\treturn this.customTypeProvider.dateTimeType\n\t\t\tcase Model.ColumnType.Time:\n\t\t\t\treturn this.customTypeProvider.timeType\n\t\t\tcase Model.ColumnType.Date:\n\t\t\t\treturn this.customTypeProvider.dateType\n\t\t\tcase Model.ColumnType.Json:\n\t\t\t\treturn this.customTypeProvider.jsonType\n\t\t\tdefault:\n\t\t\t\t;(({}: never): never => {\n\t\t\t\t\tthrow new ImplementationException('Invalid column type')\n\t\t\t\t})(type)\n\t\t}\n\t}\n}\n"],"names":["schema","singletonFactory","GraphQLScalarType","GraphQLList","GraphQLNonNull","Model","GraphQLInt","GraphQLString","GraphQLFloat","GraphQLBoolean","ImplementationException"],"mappings":";;;;;;;;;;AAWO,MAAM,mBAAmB;AAAA,EAQ/B,YACCA,SACA,eACiB,oBAChB;AADgB,SAAA,qBAAA;AAVlB,kBAAA,MAAQ,QAAA;AACR,kBAAA,MAAQ,eAAA;AAER,kBAAA,MAAiB,gBAAeC,iBAAAA;AAAAA,MAC/B,KAAK,kBAAkB,KAAK,IAAI;AAAA,IAAA,CACjC;AAOC,SAAK,SAASD;AACd,SAAK,gBAAgB;AAAA,EACtB;AAAA,EAEQ,kBAAkB,MAAc,UAAuE;AAC9G,UAAM,kBAAkB,KAAK,cAAc,QAAQ;AACnD,WAAO;AAAA,MACN,QAAQ,IAAIE,QAAAA,kBAAkB;AAAA,QAC7B,GAAG,gBAAgB,SAAA;AAAA,QACnB;AAAA,QACA,aAAa;AAAA,MAAA,CACb;AAAA,MACD,MAAM;AAAA,IAAA;AAAA,EAER;AAAA,EAEO,QAAQ,QAAmG;AACjH,UAAM,WAAW,KAAK,YAAY,MAAM;AACxC,WAAO;AAAA,MACN,OAAO,OAAO,IAAIC,QAAAA,YAAY,IAAIC,QAAAA,eAAe,QAAQ,CAAC,IAAI;AAAA,MAC9D;AAAA,IAAA;AAAA,EAEF;AAAA,EAEQ,YAAY,QAA8D;AACjF,QAAI,OAAO,WAAW;AACrB,UAAI,OAAO,SAASC,aAAM,WAAW,MAAM;AAC1C,cAAM,IAAI,MAAM,sDAAsD;AAAA,MACvE;AACA,YAAM,EAAE,QAAQ,KAAA,IAAS,KAAK,aAAa,OAAO,WAAW,OAAO,IAAI;AACxE,UAAI,SAAS,OAAO,MAAM;AACzB,cAAM,IAAI,MAAM,mDAAmD;AAAA,MACpE;AACA,aAAO;AAAA,IACR;AACA,WAAO,KAAK,YAAY,MAAM;AAAA,EAC/B;AAAA,EAEQ,YAAY,QAA8D;AACjF,YAAQ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
+
case Model.ColumnType.Numeric:
|
|
73
|
+
return this.customTypeProvider.decimalType;
|
|
72
74
|
case Model.ColumnType.Bool:
|
|
73
75
|
return GraphQLBoolean;
|
|
74
76
|
case Model.ColumnType.DateTime:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnTypeResolver.js","sources":["../../../../../packages/engine-content-api/src/schema/ColumnTypeResolver.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLString } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { EnumsProvider } from './EnumsProvider'\nimport { CustomTypesProvider } from './CustomTypesProvider'\nimport { ImplementationException } from '../exception'\nimport { singletonFactory } from '../utils'\n\ntype ScalarType = Exclude<Model.ColumnType, Model.ColumnType.Enum>\n\nexport type ColumnGraphQLType = GraphQLScalarType | GraphQLEnumType | GraphQLList<GraphQLNonNull<GraphQLScalarType | GraphQLEnumType>>\n\nexport class ColumnTypeResolver {\n\tprivate schema: Model.Schema\n\tprivate enumsProvider: EnumsProvider\n\n\tprivate readonly aliasedTypes = singletonFactory<{ scalar: GraphQLScalarType; base: ScalarType }, string, ScalarType>(\n\t\tthis.createAliasedType.bind(this),\n\t)\n\n\tconstructor(\n\t\tschema: Model.Schema,\n\t\tenumsProvider: EnumsProvider,\n\t\tprivate readonly customTypeProvider: CustomTypesProvider,\n\t) {\n\t\tthis.schema = schema\n\t\tthis.enumsProvider = enumsProvider\n\t}\n\n\tprivate createAliasedType(name: string, baseType: ScalarType): { scalar: GraphQLScalarType; base: ScalarType } {\n\t\tconst baseGraphqlType = this.getScalarType(baseType)\n\t\treturn {\n\t\t\tscalar: new GraphQLScalarType({\n\t\t\t\t...baseGraphqlType.toConfig(),\n\t\t\t\tname,\n\t\t\t\tdescription: null,\n\t\t\t}),\n\t\t\tbase: baseType,\n\t\t}\n\t}\n\n\tpublic getType(column: Model.AnyColumn): [type: ColumnGraphQLType, baseType: GraphQLScalarType | GraphQLEnumType] {\n\t\tconst baseType = this.getBaseType(column)\n\t\treturn [\n\t\t\tcolumn.list ? new GraphQLList(new GraphQLNonNull(baseType)) : baseType,\n\t\t\tbaseType,\n\t\t]\n\t}\n\n\tprivate getBaseType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tif (column.typeAlias) {\n\t\t\tif (column.type === Model.ColumnType.Enum) {\n\t\t\t\tthrow new Error('GraphQL type alias cannot be specified for enum type')\n\t\t\t}\n\t\t\tconst { scalar, base } = this.aliasedTypes(column.typeAlias, column.type)\n\t\t\tif (base !== column.type) {\n\t\t\t\tthrow new Error('GraphQL type alias with different base type found')\n\t\t\t}\n\t\t\treturn scalar\n\t\t}\n\t\treturn this.resolveType(column)\n\t}\n\n\tprivate resolveType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tswitch (column.type) {\n\t\t\tcase Model.ColumnType.Enum:\n\t\t\t\tif (this.enumsProvider.hasEnum(column.columnType)) {\n\t\t\t\t\treturn this.enumsProvider.getEnum(column.columnType)\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Undefined enum ${column.columnType}`)\n\t\t\tdefault:\n\t\t\t\treturn this.getScalarType(column.type)\n\t\t}\n\t}\n\n\tprivate getScalarType(type: ScalarType): GraphQLScalarType {\n\t\tswitch (type) {\n\t\t\tcase Model.ColumnType.Int:\n\t\t\t\treturn GraphQLInt\n\t\t\tcase Model.ColumnType.String:\n\t\t\t\treturn GraphQLString\n\t\t\tcase Model.ColumnType.Uuid:\n\t\t\t\treturn this.customTypeProvider.uuidType\n\t\t\tcase Model.ColumnType.Double:\n\t\t\t\treturn GraphQLFloat\n\t\t\tcase Model.ColumnType.Bool:\n\t\t\t\treturn GraphQLBoolean\n\t\t\tcase Model.ColumnType.DateTime:\n\t\t\t\treturn this.customTypeProvider.dateTimeType\n\t\t\tcase Model.ColumnType.Time:\n\t\t\t\treturn this.customTypeProvider.timeType\n\t\t\tcase Model.ColumnType.Date:\n\t\t\t\treturn this.customTypeProvider.dateType\n\t\t\tcase Model.ColumnType.Json:\n\t\t\t\treturn this.customTypeProvider.jsonType\n\t\t\tdefault:\n\t\t\t\t;(({}: never): never => {\n\t\t\t\t\tthrow new ImplementationException('Invalid column type')\n\t\t\t\t})(type)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,mBAAmB;AAAA,EAQ/B,YACC,QACA,eACiB,oBAChB;AADgB,SAAA,qBAAA;AAVlB,kBAAA,MAAQ,QAAA;AACR,kBAAA,MAAQ,eAAA;AAER,kBAAA,MAAiB,gBAAe;AAAA,MAC/B,KAAK,kBAAkB,KAAK,IAAI;AAAA,IAAA,CACjC;AAOC,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACtB;AAAA,EAEQ,kBAAkB,MAAc,UAAuE;AAC9G,UAAM,kBAAkB,KAAK,cAAc,QAAQ;AACnD,WAAO;AAAA,MACN,QAAQ,IAAI,kBAAkB;AAAA,QAC7B,GAAG,gBAAgB,SAAA;AAAA,QACnB;AAAA,QACA,aAAa;AAAA,MAAA,CACb;AAAA,MACD,MAAM;AAAA,IAAA;AAAA,EAER;AAAA,EAEO,QAAQ,QAAmG;AACjH,UAAM,WAAW,KAAK,YAAY,MAAM;AACxC,WAAO;AAAA,MACN,OAAO,OAAO,IAAI,YAAY,IAAI,eAAe,QAAQ,CAAC,IAAI;AAAA,MAC9D;AAAA,IAAA;AAAA,EAEF;AAAA,EAEQ,YAAY,QAA8D;AACjF,QAAI,OAAO,WAAW;AACrB,UAAI,OAAO,SAAS,MAAM,WAAW,MAAM;AAC1C,cAAM,IAAI,MAAM,sDAAsD;AAAA,MACvE;AACA,YAAM,EAAE,QAAQ,KAAA,IAAS,KAAK,aAAa,OAAO,WAAW,OAAO,IAAI;AACxE,UAAI,SAAS,OAAO,MAAM;AACzB,cAAM,IAAI,MAAM,mDAAmD;AAAA,MACpE;AACA,aAAO;AAAA,IACR;AACA,WAAO,KAAK,YAAY,MAAM;AAAA,EAC/B;AAAA,EAEQ,YAAY,QAA8D;AACjF,YAAQ,OAAO,MAAA;AAAA,MACd,KAAK,MAAM,WAAW;AACrB,YAAI,KAAK,cAAc,QAAQ,OAAO,UAAU,GAAG;AAClD,iBAAO,KAAK,cAAc,QAAQ,OAAO,UAAU;AAAA,QACpD;AACA,cAAM,IAAI,MAAM,kBAAkB,OAAO,UAAU,EAAE;AAAA,MACtD;AACC,eAAO,KAAK,cAAc,OAAO,IAAI;AAAA,IAAA;AAAA,EAExC;AAAA,EAEQ,cAAc,MAAqC;AAC1D,YAAQ,MAAA;AAAA,MACP,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC;AACE,SAAC,CAAC,CAAA,MAAqB;AACvB,gBAAM,IAAI,wBAAwB,qBAAqB;AAAA,QACxD,GAAG,IAAI;AAAA,IAAA;AAAA,EAEV;AACD;"}
|
|
1
|
+
{"version":3,"file":"ColumnTypeResolver.js","sources":["../../../../../packages/engine-content-api/src/schema/ColumnTypeResolver.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLString } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { EnumsProvider } from './EnumsProvider.js'\nimport { CustomTypesProvider } from './CustomTypesProvider.js'\nimport { ImplementationException } from '../exception.js'\nimport { singletonFactory } from '../utils/index.js'\n\ntype ScalarType = Exclude<Model.ColumnType, Model.ColumnType.Enum>\n\nexport type ColumnGraphQLType = GraphQLScalarType | GraphQLEnumType | GraphQLList<GraphQLNonNull<GraphQLScalarType | GraphQLEnumType>>\n\nexport class ColumnTypeResolver {\n\tprivate schema: Model.Schema\n\tprivate enumsProvider: EnumsProvider\n\n\tprivate readonly aliasedTypes = singletonFactory<{ scalar: GraphQLScalarType; base: ScalarType }, string, ScalarType>(\n\t\tthis.createAliasedType.bind(this),\n\t)\n\n\tconstructor(\n\t\tschema: Model.Schema,\n\t\tenumsProvider: EnumsProvider,\n\t\tprivate readonly customTypeProvider: CustomTypesProvider,\n\t) {\n\t\tthis.schema = schema\n\t\tthis.enumsProvider = enumsProvider\n\t}\n\n\tprivate createAliasedType(name: string, baseType: ScalarType): { scalar: GraphQLScalarType; base: ScalarType } {\n\t\tconst baseGraphqlType = this.getScalarType(baseType)\n\t\treturn {\n\t\t\tscalar: new GraphQLScalarType({\n\t\t\t\t...baseGraphqlType.toConfig(),\n\t\t\t\tname,\n\t\t\t\tdescription: null,\n\t\t\t}),\n\t\t\tbase: baseType,\n\t\t}\n\t}\n\n\tpublic getType(column: Model.AnyColumn): [type: ColumnGraphQLType, baseType: GraphQLScalarType | GraphQLEnumType] {\n\t\tconst baseType = this.getBaseType(column)\n\t\treturn [\n\t\t\tcolumn.list ? new GraphQLList(new GraphQLNonNull(baseType)) : baseType,\n\t\t\tbaseType,\n\t\t]\n\t}\n\n\tprivate getBaseType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tif (column.typeAlias) {\n\t\t\tif (column.type === Model.ColumnType.Enum) {\n\t\t\t\tthrow new Error('GraphQL type alias cannot be specified for enum type')\n\t\t\t}\n\t\t\tconst { scalar, base } = this.aliasedTypes(column.typeAlias, column.type)\n\t\t\tif (base !== column.type) {\n\t\t\t\tthrow new Error('GraphQL type alias with different base type found')\n\t\t\t}\n\t\t\treturn scalar\n\t\t}\n\t\treturn this.resolveType(column)\n\t}\n\n\tprivate resolveType(column: Model.AnyColumn): GraphQLScalarType | GraphQLEnumType {\n\t\tswitch (column.type) {\n\t\t\tcase Model.ColumnType.Enum:\n\t\t\t\tif (this.enumsProvider.hasEnum(column.columnType)) {\n\t\t\t\t\treturn this.enumsProvider.getEnum(column.columnType)\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Undefined enum ${column.columnType}`)\n\t\t\tdefault:\n\t\t\t\treturn this.getScalarType(column.type)\n\t\t}\n\t}\n\n\tprivate getScalarType(type: ScalarType): GraphQLScalarType {\n\t\tswitch (type) {\n\t\t\tcase Model.ColumnType.Int:\n\t\t\t\treturn GraphQLInt\n\t\t\tcase Model.ColumnType.String:\n\t\t\t\treturn GraphQLString\n\t\t\tcase Model.ColumnType.Uuid:\n\t\t\t\treturn this.customTypeProvider.uuidType\n\t\t\tcase Model.ColumnType.Double:\n\t\t\t\treturn GraphQLFloat\n\t\t\tcase Model.ColumnType.Numeric:\n\t\t\t\treturn this.customTypeProvider.decimalType\n\t\t\tcase Model.ColumnType.Bool:\n\t\t\t\treturn GraphQLBoolean\n\t\t\tcase Model.ColumnType.DateTime:\n\t\t\t\treturn this.customTypeProvider.dateTimeType\n\t\t\tcase Model.ColumnType.Time:\n\t\t\t\treturn this.customTypeProvider.timeType\n\t\t\tcase Model.ColumnType.Date:\n\t\t\t\treturn this.customTypeProvider.dateType\n\t\t\tcase Model.ColumnType.Json:\n\t\t\t\treturn this.customTypeProvider.jsonType\n\t\t\tdefault:\n\t\t\t\t;(({}: never): never => {\n\t\t\t\t\tthrow new ImplementationException('Invalid column type')\n\t\t\t\t})(type)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,mBAAmB;AAAA,EAQ/B,YACC,QACA,eACiB,oBAChB;AADgB,SAAA,qBAAA;AAVlB,kBAAA,MAAQ,QAAA;AACR,kBAAA,MA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AAc,MAAqC;AAC1D,YAAQ,MAAA;AAAA,MACP,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO;AAAA,MACR,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC,KAAK,MAAM,WAAW;AACrB,eAAO,KAAK,mBAAmB;AAAA,MAChC;AACE,SAAC,CAAC,CAAA,MAAqB;AACvB,gBAAM,IAAI,wBAAwB,qBAAqB;AAAA,QACxD,GAAG,IAAI;AAAA,IAAA;AAAA,EAEV;AACD;"}
|
|
@@ -60,6 +60,8 @@ class ConditionTypeProvider {
|
|
|
60
60
|
conditions.containsCI = { type: graphql.GraphQLString };
|
|
61
61
|
conditions.startsWithCI = { type: graphql.GraphQLString };
|
|
62
62
|
conditions.endsWithCI = { type: graphql.GraphQLString };
|
|
63
|
+
conditions.similar = { type: graphql.GraphQLString };
|
|
64
|
+
conditions.wordSimilar = { type: graphql.GraphQLString };
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
return conditions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionTypeProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/ConditionTypeProvider.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport {\n\tGraphQLBoolean,\n\tGraphQLEnumType,\n\tGraphQLInputFieldConfigMap,\n\tGraphQLInputObjectType,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLScalarType,\n\tGraphQLString,\n} from 'graphql'\nimport { singletonFactory } from '../utils'\nimport { ColumnTypeResolver } from './ColumnTypeResolver'\nimport { GqlTypeName } from './utils'\nimport { ImplementationException } from '../exception'\n\nexport class ConditionTypeProvider {\n\tprivate conditions = singletonFactory<GraphQLInputObjectType, string, [GraphQLScalarType | GraphQLEnumType, Model.AnyColumn]>(\n\t\t(name, [type, column]) => this.createCondition(name, column, type),\n\t)\n\n\tconstructor(private readonly columnTypeResolver: ColumnTypeResolver) {}\n\n\tpublic getCondition(column: Model.AnyColumn): GraphQLInputObjectType {\n\t\tconst [graphqlType, baseType] = this.columnTypeResolver.getType(column)\n\t\tconst name = this.createName(column, baseType.name)\n\t\treturn this.conditions(name, [baseType, column])\n\t}\n\n\tprivate createName(column: Model.AnyColumn, typeName: string): string {\n\t\tconst suffix = column.type === Model.ColumnType.Enum ? 'Enum' : ''\n\t\tconst arraySuffix = column.list ? 'List' : ''\n\t\treturn GqlTypeName`${typeName}${suffix}${arraySuffix}Condition`\n\t}\n\n\tprivate createCondition(name: string, column: Model.AnyColumn, type: GraphQLScalarType | GraphQLEnumType): GraphQLInputObjectType {\n\t\tconst condition: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: name,\n\t\t\tfields: (): GraphQLInputFieldConfigMap => {\n\t\t\t\tconst conditions: GraphQLInputFieldConfigMap = {\n\t\t\t\t\tand: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tor: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tnot: { type: condition },\n\n\t\t\t\t\tnull: { type: GraphQLBoolean },\n\t\t\t\t\tisNull: { type: GraphQLBoolean },\n\t\t\t\t}\n\t\t\t\tif (column.list) {\n\t\t\t\t\tconditions.minLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.maxLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t} else {\n\t\t\t\t\tif (column.type !== Model.ColumnType.Json) {\n\t\t\t\t\t\tconditions.eq = { type }\n\t\t\t\t\t\tconditions.notEq = { type }\n\t\t\t\t\t\tconditions.in = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.notIn = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.lt = { type: type }\n\t\t\t\t\t\tconditions.lte = { type: type }\n\t\t\t\t\t\tconditions.gt = { type: type }\n\t\t\t\t\t\tconditions.gte = { type: type }\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For JSON columns, add the includes operator\n\t\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t\t}\n\t\t\t\t\tif (column.type === Model.ColumnType.String) {\n\t\t\t\t\t\tconditions.contains = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWith = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWith = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.containsCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWithCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWithCI = { type: GraphQLString }\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn conditions\n\t\t\t},\n\t\t})\n\t\treturn condition\n\t}\n}\n"],"names":["singletonFactory","Model","GqlTypeName","GraphQLInputObjectType","GraphQLList","GraphQLNonNull","GraphQLBoolean","GraphQLInt","GraphQLString"],"mappings":";;;;;;;;;;AAiBO,MAAM,sBAAsB;AAAA,EAKlC,YAA6B,oBAAwC;AAAxC,SAAA,qBAAA;AAJ7B,kBAAA,MAAQ,cAAaA,iBAAAA;AAAAA,MACpB,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,KAAK,gBAAgB,MAAM,QAAQ,IAAI;AAAA,IAAA,CAClE;AAAA,EAEsE;AAAA,EAE/D,aAAa,QAAiD;AACpE,UAAM,CAAC,aAAa,QAAQ,IAAI,KAAK,mBAAmB,QAAQ,MAAM;AACtE,UAAM,OAAO,KA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M,EAAE,KAAA;AACnB,uBAAW,KAAK,EAAE,KAAA;AAClB,uBAAW,MAAM,EAAE,KAAA;AAAA,UACpB,OAAO;AAEN,uBAAW,WAAW,EAAE,KAAA;AAAA,UACzB;AACA,cAAI,OAAO,SAASJ,aAAM,WAAW,QAAQ;AAC5C,uBAAW,WAAW,EAAE,MAAMO,sBAAA;AAC9B,uBAAW,aAAa,EAAE,MAAMA,sBAAA;AAChC,uBAAW,WAAW,EAAE,MAAMA,sBAAA;AAE9B,uBAAW,aAAa,EAAE,MAAMA,sBAAA;AAChC,uBAAW,eAAe,EAAE,MAAMA,sBAAA;AAClC,uBAAW,aAAa,EAAE,MAAMA,sBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ConditionTypeProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/ConditionTypeProvider.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport {\n\tGraphQLBoolean,\n\tGraphQLEnumType,\n\tGraphQLInputFieldConfigMap,\n\tGraphQLInputObjectType,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLScalarType,\n\tGraphQLString,\n} from 'graphql'\nimport { singletonFactory } from '../utils/index.js'\nimport { ColumnTypeResolver } from './ColumnTypeResolver.js'\nimport { GqlTypeName } from './utils.js'\nimport { ImplementationException } from '../exception.js'\n\nexport class ConditionTypeProvider {\n\tprivate conditions = singletonFactory<GraphQLInputObjectType, string, [GraphQLScalarType | GraphQLEnumType, Model.AnyColumn]>(\n\t\t(name, [type, column]) => this.createCondition(name, column, type),\n\t)\n\n\tconstructor(private readonly columnTypeResolver: ColumnTypeResolver) {}\n\n\tpublic getCondition(column: Model.AnyColumn): GraphQLInputObjectType {\n\t\tconst [graphqlType, baseType] = this.columnTypeResolver.getType(column)\n\t\tconst name = this.createName(column, baseType.name)\n\t\treturn this.conditions(name, [baseType, column])\n\t}\n\n\tprivate createName(column: Model.AnyColumn, typeName: string): string {\n\t\tconst suffix = column.type === Model.ColumnType.Enum ? 'Enum' : ''\n\t\tconst arraySuffix = column.list ? 'List' : ''\n\t\treturn GqlTypeName`${typeName}${suffix}${arraySuffix}Condition`\n\t}\n\n\tprivate createCondition(name: string, column: Model.AnyColumn, type: GraphQLScalarType | GraphQLEnumType): GraphQLInputObjectType {\n\t\tconst condition: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: name,\n\t\t\tfields: (): GraphQLInputFieldConfigMap => {\n\t\t\t\tconst conditions: GraphQLInputFieldConfigMap = {\n\t\t\t\t\tand: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tor: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tnot: { type: condition },\n\n\t\t\t\t\tnull: { type: GraphQLBoolean },\n\t\t\t\t\tisNull: { type: GraphQLBoolean },\n\t\t\t\t}\n\t\t\t\tif (column.list) {\n\t\t\t\t\tconditions.minLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.maxLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t} else {\n\t\t\t\t\tif (column.type !== Model.ColumnType.Json) {\n\t\t\t\t\t\tconditions.eq = { type }\n\t\t\t\t\t\tconditions.notEq = { type }\n\t\t\t\t\t\tconditions.in = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.notIn = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.lt = { type: type }\n\t\t\t\t\t\tconditions.lte = { type: type }\n\t\t\t\t\t\tconditions.gt = { type: type }\n\t\t\t\t\t\tconditions.gte = { type: type }\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For JSON columns, add the includes operator\n\t\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t\t}\n\t\t\t\t\tif (column.type === Model.ColumnType.String) {\n\t\t\t\t\t\tconditions.contains = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWith = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWith = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.containsCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWithCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWithCI = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.similar = { type: GraphQLString }\n\t\t\t\t\t\tconditions.wordSimilar = { type: GraphQLString }\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn conditions\n\t\t\t},\n\t\t})\n\t\treturn condition\n\t}\n}\n"],"names":["singletonFactory","Model","GqlTypeName","GraphQLInputObjectType","GraphQLList","GraphQLNonNull","GraphQLBoolean","GraphQLInt","GraphQLString"],"mappings":";;;;;;;;;;AAiBO,MAAM,sBAAsB;AAAA,EAKlC,YAA6B,oBAAwC;AAAxC,SAAA,qBAAA;AAJ7B,kBAAA,MAAQ,cAAaA,iBAAAA;AAAAA,MACpB,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,KAAK,gBAAgB,MAAM,QAAQ,IAAI;AAAA,IAAA,CAClE;AAAA,EAEsE;AAAA,EAE/D,aAAa,QAAiD;AACpE,UAAM,CAAC,aAAa,QAAQ,IAAI,KAAK,mBAAmB,QAAQ,MAAM;AACtE,UAAM,OAAO,KAAK,WAAW,QAAQ,SAAS,IAAI;AAClD,WAAO,KAAK,WAAW,MAAM,CAAC,UAAU,MAAM,CAAC;AAAA,EAChD;AAAA,EAEQ,WAAW,QAAyB,UAA0B;AACrE,UAAM,SAAS,OAAO,SAASC,OAAAA,MAAM,WAAW,OAAO,SAAS;AAChE,UAAM,cAAc,OAAO,OAAO,SAAS;AAC3C,WAAOC,MAAAA,cAAc,QAAQ,GAAG,MAAM,GAAG,WAAW;AAAA,EACrD;AAAA,EAEQ,gBAAgB,MAAc,QAAyB,MAAmE;AACjI,UAAM,YAAoC,IAAIC,+BAAuB;AAAA,MACpE;AAAA,MACA,QAAQ,MAAkC;AACzC,cAAM,aAAyC;AAAA,UAC9C,KAAK,EAAE,MAAM,IAA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AC7B,uBAAW,cAAc,EAAE,MAAMA,sBAAA;AAAA,UAClC;AAAA,QACD;AAEA,eAAO;AAAA,MACR;AAAA,IAAA,CACA;AACD,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -58,6 +58,8 @@ class ConditionTypeProvider {
|
|
|
58
58
|
conditions.containsCI = { type: GraphQLString };
|
|
59
59
|
conditions.startsWithCI = { type: GraphQLString };
|
|
60
60
|
conditions.endsWithCI = { type: GraphQLString };
|
|
61
|
+
conditions.similar = { type: GraphQLString };
|
|
62
|
+
conditions.wordSimilar = { type: GraphQLString };
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
return conditions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionTypeProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/ConditionTypeProvider.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport {\n\tGraphQLBoolean,\n\tGraphQLEnumType,\n\tGraphQLInputFieldConfigMap,\n\tGraphQLInputObjectType,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLScalarType,\n\tGraphQLString,\n} from 'graphql'\nimport { singletonFactory } from '../utils'\nimport { ColumnTypeResolver } from './ColumnTypeResolver'\nimport { GqlTypeName } from './utils'\nimport { ImplementationException } from '../exception'\n\nexport class ConditionTypeProvider {\n\tprivate conditions = singletonFactory<GraphQLInputObjectType, string, [GraphQLScalarType | GraphQLEnumType, Model.AnyColumn]>(\n\t\t(name, [type, column]) => this.createCondition(name, column, type),\n\t)\n\n\tconstructor(private readonly columnTypeResolver: ColumnTypeResolver) {}\n\n\tpublic getCondition(column: Model.AnyColumn): GraphQLInputObjectType {\n\t\tconst [graphqlType, baseType] = this.columnTypeResolver.getType(column)\n\t\tconst name = this.createName(column, baseType.name)\n\t\treturn this.conditions(name, [baseType, column])\n\t}\n\n\tprivate createName(column: Model.AnyColumn, typeName: string): string {\n\t\tconst suffix = column.type === Model.ColumnType.Enum ? 'Enum' : ''\n\t\tconst arraySuffix = column.list ? 'List' : ''\n\t\treturn GqlTypeName`${typeName}${suffix}${arraySuffix}Condition`\n\t}\n\n\tprivate createCondition(name: string, column: Model.AnyColumn, type: GraphQLScalarType | GraphQLEnumType): GraphQLInputObjectType {\n\t\tconst condition: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: name,\n\t\t\tfields: (): GraphQLInputFieldConfigMap => {\n\t\t\t\tconst conditions: GraphQLInputFieldConfigMap = {\n\t\t\t\t\tand: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tor: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tnot: { type: condition },\n\n\t\t\t\t\tnull: { type: GraphQLBoolean },\n\t\t\t\t\tisNull: { type: GraphQLBoolean },\n\t\t\t\t}\n\t\t\t\tif (column.list) {\n\t\t\t\t\tconditions.minLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.maxLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t} else {\n\t\t\t\t\tif (column.type !== Model.ColumnType.Json) {\n\t\t\t\t\t\tconditions.eq = { type }\n\t\t\t\t\t\tconditions.notEq = { type }\n\t\t\t\t\t\tconditions.in = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.notIn = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.lt = { type: type }\n\t\t\t\t\t\tconditions.lte = { type: type }\n\t\t\t\t\t\tconditions.gt = { type: type }\n\t\t\t\t\t\tconditions.gte = { type: type }\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For JSON columns, add the includes operator\n\t\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t\t}\n\t\t\t\t\tif (column.type === Model.ColumnType.String) {\n\t\t\t\t\t\tconditions.contains = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWith = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWith = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.containsCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWithCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWithCI = { type: GraphQLString }\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn conditions\n\t\t\t},\n\t\t})\n\t\treturn condition\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,sBAAsB;AAAA,EAKlC,YAA6B,oBAAwC;AAAxC,SAAA,qBAAA;AAJ7B,kBAAA,MAAQ,cAAa;AAAA,MACpB,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,KAAK,gBAAgB,MAAM,QAAQ,IAAI;AAAA,IAAA,CAClE;AAAA,EAEsE;AAAA,EAE/D,aAAa,QAAiD;AACpE,UAAM,CAAC,aAAa,QAAQ,IAAI,KAAK,mBAAmB,QAAQ,MAAM;AACtE,UAAM,OAAO,KAAK,WAAW,QAAQ,SAAS,IAAI;AAClD,WAAO,KAAK,WAAW,MAAM,CAAC,UAAU,MAAM,CAAC;AAAA,EAChD;AAAA,EAEQ,WAAW,QAAyB,UAA0B;AACrE,UAAM,SAAS,OAAO,SAAS,MAAM,WAAW,OAAO,SAAS;AAChE,UAAM,cAAc,OAAO,OAAO,SAAS;AAC3C,WAAO,cAAc,QAAQ,GAAG,MAAM,GAAG,WAAW;AAAA,EACrD;AAAA,EAEQ,gBAAgB,MAAc,QAAyB,MAAmE;AACjI,UAAM,YAAoC,IAAI,uBAAuB;AAAA,MACpE;AAAA,MACA,QAAQ,MAAkC;AACzC,cAAM,aAAyC;AAAA,UAC9C,KAAK,EAAE,MAAM,IAAI,YAAY,IAAI,eAAe,SAAS,CAAC,EAAA;AAAA,UAC1D,IAAI,EAAE,MAAM,IAAI,YAAY,IAAI,eAAe,SAAS,CAAC,EAAA;AAAA,UACzD,KAAK,EAAE,MAAM,UAAA;AAAA,UAEb,MAAM,EAAE,MAAM,eAAA;AAAA,UACd,QAAQ,EAAE,MAAM,eAAA;AAAA,QAAe;AAEhC,YAAI,OAAO,MAAM;AAChB,qBAAW,YAAY,EAAE,MAAM,WAAA;AAC/B,qBAAW,YAAY,EAAE,MAAM,WAAA;AAC/B,qBAAW,WAAW,EAAE,KAAA;AAAA,QACzB,OAAO;AACN,cAAI,OAAO,SAAS,MAAM,WAAW,MAAM;AAC1C,uBAAW,KAAK,EAAE,KAAA;AAClB,uBAAW,QAAQ,EAAE,KAAA;AACrB,uBAAW,KAAK,EAAE,MAAM,IAAI,YAAY,IAAI,eAAe,IAAI,CAAC,EAAA;AAChE,uBAAW,QAAQ,EAAE,MAAM,IAAI,YAAY,IAAI,eAAe,IAAI,CAAC,EAAA;AACnE,uBAAW,KAAK,EAAE,KAAA;AAClB,uBAAW,MAAM,EAAE,KAAA;AACnB,uBAAW,KAAK,EAAE,KAAA;AAClB,uBAAW,MAAM,EAAE,KAAA;AAAA,UACpB,OAAO;AAEN,uBAAW,WAAW,EAAE,KAAA;AAAA,UACzB;AACA,cAAI,OAAO,SAAS,MAAM,WAAW,QAAQ;AAC5C,uBAAW,WAAW,EAAE,MAAM,cAAA;AAC9B,uBAAW,aAAa,EAAE,MAAM,cAAA;AAChC,uBAAW,WAAW,EAAE,MAAM,cAAA;AAE9B,uBAAW,aAAa,EAAE,MAAM,cAAA;AAChC,uBAAW,eAAe,EAAE,MAAM,cAAA;AAClC,uBAAW,aAAa,EAAE,MAAM,cAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ConditionTypeProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/ConditionTypeProvider.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport {\n\tGraphQLBoolean,\n\tGraphQLEnumType,\n\tGraphQLInputFieldConfigMap,\n\tGraphQLInputObjectType,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLScalarType,\n\tGraphQLString,\n} from 'graphql'\nimport { singletonFactory } from '../utils/index.js'\nimport { ColumnTypeResolver } from './ColumnTypeResolver.js'\nimport { GqlTypeName } from './utils.js'\nimport { ImplementationException } from '../exception.js'\n\nexport class ConditionTypeProvider {\n\tprivate conditions = singletonFactory<GraphQLInputObjectType, string, [GraphQLScalarType | GraphQLEnumType, Model.AnyColumn]>(\n\t\t(name, [type, column]) => this.createCondition(name, column, type),\n\t)\n\n\tconstructor(private readonly columnTypeResolver: ColumnTypeResolver) {}\n\n\tpublic getCondition(column: Model.AnyColumn): GraphQLInputObjectType {\n\t\tconst [graphqlType, baseType] = this.columnTypeResolver.getType(column)\n\t\tconst name = this.createName(column, baseType.name)\n\t\treturn this.conditions(name, [baseType, column])\n\t}\n\n\tprivate createName(column: Model.AnyColumn, typeName: string): string {\n\t\tconst suffix = column.type === Model.ColumnType.Enum ? 'Enum' : ''\n\t\tconst arraySuffix = column.list ? 'List' : ''\n\t\treturn GqlTypeName`${typeName}${suffix}${arraySuffix}Condition`\n\t}\n\n\tprivate createCondition(name: string, column: Model.AnyColumn, type: GraphQLScalarType | GraphQLEnumType): GraphQLInputObjectType {\n\t\tconst condition: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: name,\n\t\t\tfields: (): GraphQLInputFieldConfigMap => {\n\t\t\t\tconst conditions: GraphQLInputFieldConfigMap = {\n\t\t\t\t\tand: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tor: { type: new GraphQLList(new GraphQLNonNull(condition)) },\n\t\t\t\t\tnot: { type: condition },\n\n\t\t\t\t\tnull: { type: GraphQLBoolean },\n\t\t\t\t\tisNull: { type: GraphQLBoolean },\n\t\t\t\t}\n\t\t\t\tif (column.list) {\n\t\t\t\t\tconditions.minLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.maxLength = { type: GraphQLInt }\n\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t} else {\n\t\t\t\t\tif (column.type !== Model.ColumnType.Json) {\n\t\t\t\t\t\tconditions.eq = { type }\n\t\t\t\t\t\tconditions.notEq = { type }\n\t\t\t\t\t\tconditions.in = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.notIn = { type: new GraphQLList(new GraphQLNonNull(type)) }\n\t\t\t\t\t\tconditions.lt = { type: type }\n\t\t\t\t\t\tconditions.lte = { type: type }\n\t\t\t\t\t\tconditions.gt = { type: type }\n\t\t\t\t\t\tconditions.gte = { type: type }\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For JSON columns, add the includes operator\n\t\t\t\t\t\tconditions.includes = { type: type }\n\t\t\t\t\t}\n\t\t\t\t\tif (column.type === Model.ColumnType.String) {\n\t\t\t\t\t\tconditions.contains = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWith = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWith = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.containsCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.startsWithCI = { type: GraphQLString }\n\t\t\t\t\t\tconditions.endsWithCI = { type: GraphQLString }\n\n\t\t\t\t\t\tconditions.similar = { type: GraphQLString }\n\t\t\t\t\t\tconditions.wordSimilar = { type: GraphQLString }\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn conditions\n\t\t\t},\n\t\t})\n\t\treturn condition\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,sBAAsB;AAAA,EAKlC,YAA6B,oBAAwC;AAAxC,SAAA,qBAAA;AAJ7B,kBAAA,MAAQ,cAAa;AAAA,MACpB,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,KAAK,gBAAgB,MAAM,QAAQ,IAAI;AAAA,IAAA,CAClE;AAAA,EAEsE;AAAA,EAE/D,aAAa,QAAiD;AACpE,UAAM,CAAC,aAAa,QAAQ,IAAI,KAAK,mBAAmB,QAAQ,MAAM;AACtE,UAAM,OAAO,KAAK,WAAW,QAAQ,SAAS,IAAI;AAClD,WAAO,KAAK,WAAW,MAAM,CAAC,UAAU,MAAM,CAAC;AAAA,EAChD;AAAA,EAEQ,WA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AAM,cAAA;AAC9B,uBAAW,aAAa,EAAE,MAAM,cAAA;AAChC,uBAAW,WAAW,EAAE,MAAM,cAAA;AAE9B,uBAAW,aAAa,EAAE,MAAM,cAAA;AAChC,uBAAW,eAAe,EAAE,MAAM,cAAA;AAClC,uBAAW,aAAa,EAAE,MAAM,cAAA;AAEhC,uBAAW,UAAU,EAAE,MAAM,cAAA;AAC7B,uBAAW,cAAc,EAAE,MAAM,cAAA;AAAA,UAClC;AAAA,QACD;AAEA,eAAO;AAAA,MACR;AAAA,IAAA,CACA;AACD,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -6,6 +6,22 @@ var __defProp = Object.defineProperty;
|
|
|
6
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
7
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
8
|
const TIME_REGEX = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(?:\.(\d+))?)?$/;
|
|
9
|
+
const DECIMAL_REGEX = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
|
10
|
+
function validateDecimal(value) {
|
|
11
|
+
if (typeof value === "number") {
|
|
12
|
+
if (!Number.isFinite(value)) {
|
|
13
|
+
throw new TypeError(`Decimal value must be a finite number, got: ${value}`);
|
|
14
|
+
}
|
|
15
|
+
return String(value);
|
|
16
|
+
}
|
|
17
|
+
if (typeof value !== "string") {
|
|
18
|
+
throw new TypeError(`Decimal value must be a string, got: ${typeof value}`);
|
|
19
|
+
}
|
|
20
|
+
if (!DECIMAL_REGEX.test(value.trim())) {
|
|
21
|
+
throw new TypeError(`Value is not a valid decimal: ${value}`);
|
|
22
|
+
}
|
|
23
|
+
return value.trim();
|
|
24
|
+
}
|
|
9
25
|
function validateTime(value) {
|
|
10
26
|
if (typeof value !== "string") {
|
|
11
27
|
throw new TypeError(`Time value must be a string, got: ${typeof value}`);
|
|
@@ -55,6 +71,22 @@ class CustomTypesProvider {
|
|
|
55
71
|
}
|
|
56
72
|
}));
|
|
57
73
|
__publicField(this, "jsonType", graphqlUtils.JSONType);
|
|
74
|
+
__publicField(this, "decimalType", new graphql.GraphQLScalarType({
|
|
75
|
+
name: "Decimal",
|
|
76
|
+
description: "Arbitrary precision decimal number, transported as a string to avoid floating-point precision loss.",
|
|
77
|
+
serialize(value) {
|
|
78
|
+
return validateDecimal(value);
|
|
79
|
+
},
|
|
80
|
+
parseValue(value) {
|
|
81
|
+
return validateDecimal(value);
|
|
82
|
+
},
|
|
83
|
+
parseLiteral(ast) {
|
|
84
|
+
if (ast.kind === graphql.Kind.STRING || ast.kind === graphql.Kind.INT || ast.kind === graphql.Kind.FLOAT) {
|
|
85
|
+
return validateDecimal(ast.value);
|
|
86
|
+
}
|
|
87
|
+
throw new TypeError(`Decimal scalar can only parse string or numeric values, got: ${ast.kind}`);
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
58
90
|
}
|
|
59
91
|
}
|
|
60
92
|
exports.CustomTypesProvider = CustomTypesProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomTypesProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/CustomTypesProvider.ts"],"sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\nimport { JSONType, UuidType } from '@contember/graphql-utils'\n\nconst TIME_REGEX = /^([01]\\d|2[0-3]):([0-5]\\d)(?::([0-5]\\d)(?:\\.(\\d+))?)?$/\n\nfunction validateTime(value: unknown): string {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Time value must be a string, got: ${typeof value}`)\n\t}\n\tconst match = TIME_REGEX.exec(value)\n\tif (!match) {\n\t\tthrow new TypeError(`Value is not a valid time: ${value}`)\n\t}\n\n\tconst hours = match[1]\n\tconst minutes = match[2]\n\tconst seconds = match[3] || '00'\n\tconst fraction = match[4] ? `.${match[4]}` : ''\n\n\treturn `${hours}:${minutes}:${seconds}${fraction}`\n}\n\nexport class CustomTypesProvider {\n\tpublic readonly uuidType: GraphQLScalarType = UuidType\n\n\t// todo: implement serialize, parseValue and parseLiteral properly\n\n\tpublic readonly dateType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Date',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\n\tpublic readonly timeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Time',\n\t\tserialize(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind !== Kind.STRING) {\n\t\t\t\tthrow new TypeError(`Time scalar can only parse string values, got: ${ast.kind}`)\n\t\t\t}\n\t\t\treturn validateTime(ast.value)\n\t\t},\n\t})\n\n\tpublic readonly dateTimeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'DateTime',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\tpublic readonly jsonType: GraphQLScalarType = JSONType\n}\n"],"names":["UuidType","GraphQLScalarType","Kind","JSONType"],"mappings":";;;;;;;AAGA,MAAM,aAAa;AAEnB,SAAS,aAAa,OAAwB;AAC7C,MAAI,OAAO,UAAU,UAAU;AAC9B,UAAM,IAAI,UAAU,qCAAqC,OAAO,KAAK,EAAE;AAAA,EACxE;AACA,QAAM,QAAQ,WAAW,KAAK,KAAK;AACnC,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,UAAU,8BAA8B,KAAK,EAAE;AAAA,EAC1D;AAEA,QAAM,QAAQ,MAAM,CAAC;AACrB,QAAM,UAAU,MAAM,CAAC;AACvB,QAAM,UAAU,MAA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Provider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/CustomTypesProvider.ts"],"sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\nimport { JSONType, UuidType } from '@contember/graphql-utils'\n\nconst TIME_REGEX = /^([01]\\d|2[0-3]):([0-5]\\d)(?::([0-5]\\d)(?:\\.(\\d+))?)?$/\n\nconst DECIMAL_REGEX = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/\n\nfunction validateDecimal(value: unknown): string {\n\t// Numeric values are transported as strings to avoid JS float precision loss.\n\t// Plain numbers are accepted for convenience but normalized to a string.\n\tif (typeof value === 'number') {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new TypeError(`Decimal value must be a finite number, got: ${value}`)\n\t\t}\n\t\treturn String(value)\n\t}\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Decimal value must be a string, got: ${typeof value}`)\n\t}\n\tif (!DECIMAL_REGEX.test(value.trim())) {\n\t\tthrow new TypeError(`Value is not a valid decimal: ${value}`)\n\t}\n\treturn value.trim()\n}\n\nfunction validateTime(value: unknown): string {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Time value must be a string, got: ${typeof value}`)\n\t}\n\tconst match = TIME_REGEX.exec(value)\n\tif (!match) {\n\t\tthrow new TypeError(`Value is not a valid time: ${value}`)\n\t}\n\n\tconst hours = match[1]\n\tconst minutes = match[2]\n\tconst seconds = match[3] || '00'\n\tconst fraction = match[4] ? `.${match[4]}` : ''\n\n\treturn `${hours}:${minutes}:${seconds}${fraction}`\n}\n\nexport class CustomTypesProvider {\n\tpublic readonly uuidType: GraphQLScalarType = UuidType\n\n\t// todo: implement serialize, parseValue and parseLiteral properly\n\n\tpublic readonly dateType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Date',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\n\tpublic readonly timeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Time',\n\t\tserialize(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind !== Kind.STRING) {\n\t\t\t\tthrow new TypeError(`Time scalar can only parse string values, got: ${ast.kind}`)\n\t\t\t}\n\t\t\treturn validateTime(ast.value)\n\t\t},\n\t})\n\n\tpublic readonly dateTimeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'DateTime',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\tpublic readonly jsonType: GraphQLScalarType = JSONType\n\n\tpublic readonly decimalType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Decimal',\n\t\tdescription: 'Arbitrary precision decimal number, transported as a string to avoid floating-point precision loss.',\n\t\tserialize(value) {\n\t\t\treturn validateDecimal(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateDecimal(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind === Kind.STRING || ast.kind === Kind.INT || ast.kind === Kind.FLOAT) {\n\t\t\t\treturn validateDecimal(ast.value)\n\t\t\t}\n\t\t\tthrow new TypeError(`Decimal scalar can only parse string or numeric values, got: ${ast.kind}`)\n\t\t},\n\t})\n}\n"],"names":["UuidType","GraphQLScalarType","Kind","JSONType"],"mappings":";;;;;;;AAGA,MAAM,aAAa;AAEnB,MAAM,gBAAgB;AAEtB,SAAS,gBAAgB,OAAwB;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC9B,QAAI,CAAC,OAAO,SAAS,KAAK,GAAG;AAC5B,YAAM,IAAI,UAAU,+CAA+C,KAAK,EAAE;AAAA,IAC3E;AACA,WAAO,OAAO,K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AAK;AAAA,MAC1B;AAAA,MACA,aAAa,KAAK;AACjB,YAAI,IAAI,SAASC,QAAAA,KAAK,QAAQ;AAC7B,gBAAM,IAAI,UAAU,kDAAkD,IAAI,IAAI,EAAE;AAAA,QACjF;AACA,eAAO,aAAa,IAAI,KAAK;AAAA,MAC9B;AAAA,IAAA,CACA,CAAA;AAED,kBAAA,MAAgB,gBAAkC,IAAID,0BAAkB;AAAA,MACvE,MAAM;AAAA,MACN,WAAW,CAAA,QAAO,OAAO,GAAG;AAAA,MAC5B,YAAY,CAAA,QAAO,OAAO,GAAG;AAAA,MAC7B,cAAc,SAAS,aAAa,KAAK;AACxC,eAAO,IAAI,SAASC,QAAAA,KAAK,SAAS,IAAI,QAAQ;AAAA,MAC/C;AAAA,IAAA,CACA,CAAA;AACD,kBAAA,MAAgB,YAA8BC,qBAAA;AAE9C,kBAAA,MAAgB,eAAiC,IAAIF,0BAAkB;AAAA,MACtE,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU,OAAO;AAChB,eAAO,gBAAgB,KAAK;AAAA,MAC7B;AAAA,MACA,WAAW,OAAO;AACjB,eAAO,gBAAgB,KAAK;AAAA,MAC7B;AAAA,MACA,aAAa,KAAK;AACjB,YAAI,IAAI,SAASC,aAAK,UAAU,IAAI,SAASA,QAAAA,KAAK,OAAO,IAAI,SAASA,QAAAA,KAAK,OAAO;AACjF,iBAAO,gBAAgB,IAAI,KAAK;AAAA,QACjC;AACA,cAAM,IAAI,UAAU,gEAAgE,IAAI,IAAI,EAAE;AAAA,MAC/F;AAAA,IAAA,CACA,CAAA;AAAA,EAAA;AACF;;"}
|
|
@@ -4,6 +4,22 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
5
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
6
|
const TIME_REGEX = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(?:\.(\d+))?)?$/;
|
|
7
|
+
const DECIMAL_REGEX = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
|
8
|
+
function validateDecimal(value) {
|
|
9
|
+
if (typeof value === "number") {
|
|
10
|
+
if (!Number.isFinite(value)) {
|
|
11
|
+
throw new TypeError(`Decimal value must be a finite number, got: ${value}`);
|
|
12
|
+
}
|
|
13
|
+
return String(value);
|
|
14
|
+
}
|
|
15
|
+
if (typeof value !== "string") {
|
|
16
|
+
throw new TypeError(`Decimal value must be a string, got: ${typeof value}`);
|
|
17
|
+
}
|
|
18
|
+
if (!DECIMAL_REGEX.test(value.trim())) {
|
|
19
|
+
throw new TypeError(`Value is not a valid decimal: ${value}`);
|
|
20
|
+
}
|
|
21
|
+
return value.trim();
|
|
22
|
+
}
|
|
7
23
|
function validateTime(value) {
|
|
8
24
|
if (typeof value !== "string") {
|
|
9
25
|
throw new TypeError(`Time value must be a string, got: ${typeof value}`);
|
|
@@ -53,6 +69,22 @@ class CustomTypesProvider {
|
|
|
53
69
|
}
|
|
54
70
|
}));
|
|
55
71
|
__publicField(this, "jsonType", JSONType);
|
|
72
|
+
__publicField(this, "decimalType", new GraphQLScalarType({
|
|
73
|
+
name: "Decimal",
|
|
74
|
+
description: "Arbitrary precision decimal number, transported as a string to avoid floating-point precision loss.",
|
|
75
|
+
serialize(value) {
|
|
76
|
+
return validateDecimal(value);
|
|
77
|
+
},
|
|
78
|
+
parseValue(value) {
|
|
79
|
+
return validateDecimal(value);
|
|
80
|
+
},
|
|
81
|
+
parseLiteral(ast) {
|
|
82
|
+
if (ast.kind === Kind.STRING || ast.kind === Kind.INT || ast.kind === Kind.FLOAT) {
|
|
83
|
+
return validateDecimal(ast.value);
|
|
84
|
+
}
|
|
85
|
+
throw new TypeError(`Decimal scalar can only parse string or numeric values, got: ${ast.kind}`);
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
56
88
|
}
|
|
57
89
|
}
|
|
58
90
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomTypesProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/CustomTypesProvider.ts"],"sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\nimport { JSONType, UuidType } from '@contember/graphql-utils'\n\nconst TIME_REGEX = /^([01]\\d|2[0-3]):([0-5]\\d)(?::([0-5]\\d)(?:\\.(\\d+))?)?$/\n\nfunction validateTime(value: unknown): string {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Time value must be a string, got: ${typeof value}`)\n\t}\n\tconst match = TIME_REGEX.exec(value)\n\tif (!match) {\n\t\tthrow new TypeError(`Value is not a valid time: ${value}`)\n\t}\n\n\tconst hours = match[1]\n\tconst minutes = match[2]\n\tconst seconds = match[3] || '00'\n\tconst fraction = match[4] ? `.${match[4]}` : ''\n\n\treturn `${hours}:${minutes}:${seconds}${fraction}`\n}\n\nexport class CustomTypesProvider {\n\tpublic readonly uuidType: GraphQLScalarType = UuidType\n\n\t// todo: implement serialize, parseValue and parseLiteral properly\n\n\tpublic readonly dateType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Date',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\n\tpublic readonly timeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Time',\n\t\tserialize(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind !== Kind.STRING) {\n\t\t\t\tthrow new TypeError(`Time scalar can only parse string values, got: ${ast.kind}`)\n\t\t\t}\n\t\t\treturn validateTime(ast.value)\n\t\t},\n\t})\n\n\tpublic readonly dateTimeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'DateTime',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\tpublic readonly jsonType: GraphQLScalarType = JSONType\n}\n"],"names":[],"mappings":";;;;;AAGA,MAAM,aAAa;AAEnB,SAAS,aAAa,OAAwB;AAC7C,MAAI,OAAO,UAAU,UAAU;AAC9B,UAAM,IAAI,UAAU,qCAAqC,OAAO,KAAK,EAAE;AAAA,EACxE;AACA,QAAM,QAAQ,WAAW,KAAK,KAAK;AACnC,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,UAAU,8BAA8B,KAAK,EAAE;AAAA,EAC1D;AAEA,QAAM,QAAQ,MAAM,CAAC;AACrB,QAAM,UAAU,MAAM,CAAC;AACvB,QAAM,UAAU,MAAM,CAAC,KAAK;AAC5B,QAAM,WAAW,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,KAAK;AAE7C,SAAO,GAAG,KAAK,IAAI,OAAO,IAAI,OAAO,GAAG,QAAQ;AACjD;AAEO,MAAM,oBAAoB;AAAA,EAA1B,cAAA;AACN,kBAAA,MAAgB,YAA8B,QAAA;AAI9C,kBAAA,MAAgB,YAA8B,IAAI,kBAAkB;AAAA,MACnE,MAAM;AAAA,MACN,WAAW,CAAA,QAAO,OAAO,GAAG;AAAA,MAC5B,YAAY,CAAA,QAAO,OAAO,GAAG;AAAA,MAC7B,cAAc,SAAS,aAAa,KAAK;AACxC,eAAO,IAAI,SAAS,KAAK,SAAS,IAAI,QAAQ;AAAA,MAC/C;AAAA,IAAA,CACA,CAAA;AAED,kBAAA,MAAgB,YAA8B,IAAI,kBAAkB;AAAA,MACnE,MAAM;AAAA,MACN,UAAU,OAAO;AAChB,eAAO,aAAa,KAAK;AAAA,MAC1B;AAAA,MACA,WAAW,OAAO;AACjB,eAAO,aAAa,KAAK;AAAA,MAC1B;AAAA,MACA,aAAa,KAAK;AACjB,YAAI,IAAI,SAAS,KAAK,QAAQ;AAC7B,gBAAM,IAAI,UAAU,kDAAkD,IAAI,IAAI,EAAE;AAAA,QACjF;AACA,eAAO,aAAa,IAAI,KAAK;AAAA,MAC9B;AAAA,IAAA,CACA,CAAA;AAED,kBAAA,MAAgB,gBAAkC,IAAI,kBAAkB;AAAA,MACvE,MAAM;AAAA,MACN,WAAW,CAAA,QAAO,OAAO,GAAG;AAAA,MAC5B,YAAY,CAAA,QAAO,OAAO,GAAG;AAAA,MAC7B,cAAc,SAAS,aAAa,KAAK;AACxC,eAAO,IAAI,SAAS,KAAK,SAAS,IAAI,QAAQ;AAAA,MAC/C;AAAA,IAAA,CACA,CAAA;AACD,kBAAA,MAAgB,YAA8B,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"CustomTypesProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/CustomTypesProvider.ts"],"sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\nimport { JSONType, UuidType } from '@contember/graphql-utils'\n\nconst TIME_REGEX = /^([01]\\d|2[0-3]):([0-5]\\d)(?::([0-5]\\d)(?:\\.(\\d+))?)?$/\n\nconst DECIMAL_REGEX = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/\n\nfunction validateDecimal(value: unknown): string {\n\t// Numeric values are transported as strings to avoid JS float precision loss.\n\t// Plain numbers are accepted for convenience but normalized to a string.\n\tif (typeof value === 'number') {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new TypeError(`Decimal value must be a finite number, got: ${value}`)\n\t\t}\n\t\treturn String(value)\n\t}\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Decimal value must be a string, got: ${typeof value}`)\n\t}\n\tif (!DECIMAL_REGEX.test(value.trim())) {\n\t\tthrow new TypeError(`Value is not a valid decimal: ${value}`)\n\t}\n\treturn value.trim()\n}\n\nfunction validateTime(value: unknown): string {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Time value must be a string, got: ${typeof value}`)\n\t}\n\tconst match = TIME_REGEX.exec(value)\n\tif (!match) {\n\t\tthrow new TypeError(`Value is not a valid time: ${value}`)\n\t}\n\n\tconst hours = match[1]\n\tconst minutes = match[2]\n\tconst seconds = match[3] || '00'\n\tconst fraction = match[4] ? `.${match[4]}` : ''\n\n\treturn `${hours}:${minutes}:${seconds}${fraction}`\n}\n\nexport class CustomTypesProvider {\n\tpublic readonly uuidType: GraphQLScalarType = UuidType\n\n\t// todo: implement serialize, parseValue and parseLiteral properly\n\n\tpublic readonly dateType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Date',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\n\tpublic readonly timeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Time',\n\t\tserialize(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateTime(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind !== Kind.STRING) {\n\t\t\t\tthrow new TypeError(`Time scalar can only parse string values, got: ${ast.kind}`)\n\t\t\t}\n\t\t\treturn validateTime(ast.value)\n\t\t},\n\t})\n\n\tpublic readonly dateTimeType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'DateTime',\n\t\tserialize: str => String(str),\n\t\tparseValue: str => String(str),\n\t\tparseLiteral: function parseLiteral(ast) {\n\t\t\treturn ast.kind === Kind.STRING ? ast.value : undefined\n\t\t},\n\t})\n\tpublic readonly jsonType: GraphQLScalarType = JSONType\n\n\tpublic readonly decimalType: GraphQLScalarType = new GraphQLScalarType({\n\t\tname: 'Decimal',\n\t\tdescription: 'Arbitrary precision decimal number, transported as a string to avoid floating-point precision loss.',\n\t\tserialize(value) {\n\t\t\treturn validateDecimal(value)\n\t\t},\n\t\tparseValue(value) {\n\t\t\treturn validateDecimal(value)\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (ast.kind === Kind.STRING || ast.kind === Kind.INT || ast.kind === Kind.FLOAT) {\n\t\t\t\treturn validateDecimal(ast.value)\n\t\t\t}\n\t\t\tthrow new TypeError(`Decimal scalar can only parse string or numeric values, got: ${ast.kind}`)\n\t\t},\n\t})\n}\n"],"names":[],"mappings":";;;;;AAGA,MAAM,aAAa;AAEnB,MAAM,gBAAgB;AAEtB,SAAS,gBAAgB,OAAwB;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC9B,QAAI,CAAC,OAAO,SAAS,KAAK,GAAG;AAC5B,YAAM,IAAI,UAAU,+CAA+C,KAAK,EAAE;AAAA,IAC3E;AACA,WAAO,OAAO,KAAK;AAAA,EACpB;AACA,MAAI,OAAO,UAAU,UAAU;AAC9B,UAAM,IAAI,UAAU,wCAAwC,OAAO,KAAK,EAAE;AAAA,EAC3E;AACA,MAAI,CAAC,cAAc,KAAK,MAAM,KAAA,CAAM,GAAG;AACtC,UAAM,IAAI,UAAU,iCAAiC,KAAK,EAAE;AAAA,EAC7D;AACA,SAAO,MAAM,KAAA;AACd;AAEA,SAAS,aAAa,OAAwB;AAC7C,MAAI,OAAO,UAAU,UAAU;AAC9B,UAAM,IAAI,UAAU,qCAAqC,OAAO,KAAK,EAAE;AAAA,EACxE;AACA,QAAM,QAAQ,WAAW,KAAK,KAAK;AACnC,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,UAAU,8BAA8B,KAAK,EAAE;AAAA,EAC1D;AAEA,QAAM,QAAQ,MAAM,CAAC;AACrB,QAAM,UAAU,MAAM,CAAC;AACvB,QAAM,UAAU,MAAM,CAAC,KAAK;AAC5B,QAAM,WAAW,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,KAAK;AAE7C,SAAO,GAAG,KAAK,IAAI,OAAO,IAAI,OAAO,GAAG,QAAQ;AACjD;AAEO,MAAM,oBAAoB;AAAA,EAA1B,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UAAU,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO;AACjF,iBAAO,gBAAgB,IAAI,KAAK;AAAA,QACjC;AACA,cAAM,IAAI,UAAU,gEAAgE,IAAI,IAAI,EAAE;AAAA,MAC/F;AAAA,IAAA,CACA,CAAA;AAAA,EAAA;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityTypeProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/EntityTypeProvider.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLObjectTypeConfig,\n\tGraphQLOutputType,\n} from 'graphql'\nimport { Acl, Input, Model } from '@contember/schema'\nimport { acceptFieldVisitor, getEntity as getEntityFromSchema } from '@contember/schema-utils'\nimport { singletonFactory } from '../utils'\nimport { ColumnTypeResolver } from './ColumnTypeResolver'\nimport { FieldArgsVisitor, FieldTypeVisitor } from './entities'\nimport { aliasAwareResolver, GqlTypeName } from './utils'\nimport { WhereTypeProvider } from './WhereTypeProvider'\nimport { Authorizator } from '../acl'\nimport { FieldAccessVisitor } from './FieldAccessVisitor'\nimport { OrderByTypeProvider } from './OrderByTypeProvider'\nimport { EntityFieldsProvider } from '../extensions'\nimport { ImplementationException } from '../exception'\n\nexport class EntityTypeProvider {\n\tprivate entities = singletonFactory(name => this.createEntity(name))\n\tprivate connections = singletonFactory(name => this.createConnection(name))\n\tprivate PageInfo = new GraphQLObjectType({\n\t\tname: 'PageInfo',\n\t\tfields: {\n\t\t\ttotalCount: { type: new GraphQLNonNull(GraphQLInt) },\n\t\t},\n\t})\n\n\tprivate fieldMeta = new GraphQLObjectType({\n\t\tname: 'FieldMeta',\n\t\tfields: {\n\t\t\t[Input.FieldMeta.readable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t\t[Input.FieldMeta.updatable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t},\n\t})\n\tprivate readonly entityFieldProviders: { [key: string]: EntityFieldsProvider } = {}\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly columnTypeResolver: ColumnTypeResolver,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t\tprivate readonly orderByTypeProvider: OrderByTypeProvider,\n\t) {\n\t}\n\n\tpublic registerEntityFieldProvider(key: string, provider: EntityFieldsProvider): void {\n\t\tthis.entityFieldProviders[key] = provider\n\t}\n\n\tpublic getEntity(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.entities(entityName)\n\t}\n\n\tpublic getConnection(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.connections(entityName)\n\t}\n\n\tprivate createEntity(entityName: string) {\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}`,\n\t\t\tfields: () => this.getEntityFields(entityName),\n\t\t} as GraphQLObjectTypeConfig<any, any>)\n\t}\n\n\tprivate getEntityFields(entityName: string) {\n\t\tconst entity = getEntityFromSchema(this.schema, entityName)\n\t\tconst accessVisitor = new FieldAccessVisitor(Acl.Operation.read, this.authorizator)\n\t\tconst accessibleFields = Object.values(entity.fields).filter(field => acceptFieldVisitor(this.schema, entity, field.name, accessVisitor))\n\t\tconst metaFields: { [field: string]: GraphQLFieldConfig<any, any> } = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tmetaFields[field.name] = {\n\t\t\t\ttype: this.fieldMeta,\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tconst metaField = {\n\t\t\ttype: new GraphQLObjectType({\n\t\t\t\tname: GqlTypeName`${entityName}Meta`,\n\t\t\t\tfields: metaFields,\n\t\t\t}),\n\t\t\tresolve: aliasAwareResolver,\n\t\t}\n\n\t\tlet fields: { [field: string]: GraphQLFieldConfig<any, any> } = {\n\t\t\t_meta: metaField,\n\t\t}\n\n\t\tfor (const field of accessibleFields) {\n\t\t\tconst fieldTypeVisitor = new FieldTypeVisitor(this.columnTypeResolver, this, this.authorizator)\n\t\t\tconst type: GraphQLOutputType = acceptFieldVisitor(this.schema, entity, field.name, fieldTypeVisitor)\n\n\t\t\tconst fieldArgsVisitor = new FieldArgsVisitor(this.whereTypeProvider, this.orderByTypeProvider)\n\t\t\tfields[field.name] = {\n\t\t\t\ttype,\n\t\t\t\targs: acceptFieldVisitor(this.schema, entity, field.name, fieldArgsVisitor),\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, provider] of Object.entries(this.entityFieldProviders)) {\n\t\t\tfields = {\n\t\t\t\t...fields,\n\t\t\t\t...provider.getFields(entity, accessibleFields),\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n\n\tprivate createConnection(entityName: string) {\n\t\tconst entityType = this.getEntity(entityName)\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}Connection`,\n\t\t\tfields: {\n\t\t\t\tpageInfo: {\n\t\t\t\t\ttype: new GraphQLNonNull(this.PageInfo),\n\t\t\t\t},\n\t\t\t\tedges: {\n\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\tname: GqlTypeName`${entityName}Edge`,\n\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\tnode: {\n\t\t\t\t\t\t\t\t\t\t\ttype: new GraphQLNonNull(entityType),\n\t\t\t\t\t\t\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n}\n"],"names":["schema","singletonFactory","GraphQLObjectType","GraphQLNonNull","GraphQLInt","Input","GraphQLBoolean","aliasAwareResolver","Acl","ImplementationException","GqlTypeName","getEntityFromSchema","FieldAccessVisitor","acceptFieldVisitor","FieldTypeVisitor","FieldArgsVisitor","GraphQLList"],"mappings":";;;;;;;;;;;;;;AAuBO,MAAM,mBAAmB;AAAA,EAmB/B,YACkBA,UACA,cACA,oBACA,mBACA,qBAChB;AALgB,SAAA,SAAAA;AACA,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,oBAAA;AACA,SAAA,sBAAA;AAvBlB,kBAAA,MAAQ,YAAWC,kCAAiB,CAAA,SAAQ,KAAK,aAAa,IAAI,CAAC,CAAA;AACnE,kBAAA,MAAQ,eAAcA,kCAAiB,CAAA,SAAQ,KAAK,iBAAiB,IAAI,CAAC,CAAA;AAC1E,kBAAA,MAAQ,YAAW,IAAIC,0BAAkB;AAAA,MACxC,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,YAAY,EAAE,MAAM,IAAIC,QAAAA,eAAeC,QAAAA,UAAU,EAAA;AAAA,MAAE;AAAA,IACpD,CACA,CAAA;AAED,kBAAA,MAAQ,aAAY,IAAIF,0BAAkB;AAAA,MACzC,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,CAACG,OAAAA,MAAM,UAAU,QAAQ,GAAG,EAAE,MAAMC,QAAAA,gBAAgB,SAASC,yBAAA;AAAA,QAC7D,CAACF,OAAAA,MAAM,UAAU,SAAS,GAAG,EAAE,MAAMC,QAAAA,gBAAgB,SAASC,MAAAA,mBAAA;AAAA,MAAmB;AAAA,IAClF,CACA,CAAA;AACD,kBAAA,MAAiB,wB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AA,gBACD,CACA;AAAA,cAAA;AAAA,YACF;AAAA,UACD;AAAA;AAAA,QACD;AAAA,MAED;AAAA,IACD,CACA;AAAA,EACF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"EntityTypeProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/EntityTypeProvider.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLObjectTypeConfig,\n\tGraphQLOutputType,\n} from 'graphql'\nimport { Acl, Input, Model } from '@contember/schema'\nimport { acceptFieldVisitor, getEntity as getEntityFromSchema } from '@contember/schema-utils'\nimport { singletonFactory } from '../utils/index.js'\nimport { ColumnTypeResolver } from './ColumnTypeResolver.js'\nimport { FieldArgsVisitor, FieldTypeVisitor } from './entities/index.js'\nimport { aliasAwareResolver, GqlTypeName } from './utils.js'\nimport { WhereTypeProvider } from './WhereTypeProvider.js'\nimport { Authorizator } from '../acl/index.js'\nimport { FieldAccessVisitor } from './FieldAccessVisitor.js'\nimport { OrderByTypeProvider } from './OrderByTypeProvider.js'\nimport { EntityFieldsProvider } from '../extensions/index.js'\nimport { ImplementationException } from '../exception.js'\n\nexport class EntityTypeProvider {\n\tprivate entities = singletonFactory(name => this.createEntity(name))\n\tprivate connections = singletonFactory(name => this.createConnection(name))\n\tprivate PageInfo = new GraphQLObjectType({\n\t\tname: 'PageInfo',\n\t\tfields: {\n\t\t\ttotalCount: { type: new GraphQLNonNull(GraphQLInt) },\n\t\t},\n\t})\n\n\tprivate fieldMeta = new GraphQLObjectType({\n\t\tname: 'FieldMeta',\n\t\tfields: {\n\t\t\t[Input.FieldMeta.readable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t\t[Input.FieldMeta.updatable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t},\n\t})\n\tprivate readonly entityFieldProviders: { [key: string]: EntityFieldsProvider } = {}\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly columnTypeResolver: ColumnTypeResolver,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t\tprivate readonly orderByTypeProvider: OrderByTypeProvider,\n\t) {\n\t}\n\n\tpublic registerEntityFieldProvider(key: string, provider: EntityFieldsProvider): void {\n\t\tthis.entityFieldProviders[key] = provider\n\t}\n\n\tpublic getEntity(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.entities(entityName)\n\t}\n\n\tpublic getConnection(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.connections(entityName)\n\t}\n\n\tprivate createEntity(entityName: string) {\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}`,\n\t\t\tfields: () => this.getEntityFields(entityName),\n\t\t} as GraphQLObjectTypeConfig<any, any>)\n\t}\n\n\tprivate getEntityFields(entityName: string) {\n\t\tconst entity = getEntityFromSchema(this.schema, entityName)\n\t\tconst accessVisitor = new FieldAccessVisitor(Acl.Operation.read, this.authorizator)\n\t\tconst accessibleFields = Object.values(entity.fields).filter(field => acceptFieldVisitor(this.schema, entity, field.name, accessVisitor))\n\t\tconst metaFields: { [field: string]: GraphQLFieldConfig<any, any> } = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tmetaFields[field.name] = {\n\t\t\t\ttype: this.fieldMeta,\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tconst metaField = {\n\t\t\ttype: new GraphQLObjectType({\n\t\t\t\tname: GqlTypeName`${entityName}Meta`,\n\t\t\t\tfields: metaFields,\n\t\t\t}),\n\t\t\tresolve: aliasAwareResolver,\n\t\t}\n\n\t\tlet fields: { [field: string]: GraphQLFieldConfig<any, any> } = {\n\t\t\t_meta: metaField,\n\t\t}\n\n\t\tfor (const field of accessibleFields) {\n\t\t\tconst fieldTypeVisitor = new FieldTypeVisitor(this.columnTypeResolver, this, this.authorizator)\n\t\t\tconst type: GraphQLOutputType = acceptFieldVisitor(this.schema, entity, field.name, fieldTypeVisitor)\n\n\t\t\tconst fieldArgsVisitor = new FieldArgsVisitor(this.whereTypeProvider, this.orderByTypeProvider)\n\t\t\tfields[field.name] = {\n\t\t\t\ttype,\n\t\t\t\targs: acceptFieldVisitor(this.schema, entity, field.name, fieldArgsVisitor),\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, provider] of Object.entries(this.entityFieldProviders)) {\n\t\t\tfields = {\n\t\t\t\t...fields,\n\t\t\t\t...provider.getFields(entity, accessibleFields),\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n\n\tprivate createConnection(entityName: string) {\n\t\tconst entityType = this.getEntity(entityName)\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}Connection`,\n\t\t\tfields: {\n\t\t\t\tpageInfo: {\n\t\t\t\t\ttype: new GraphQLNonNull(this.PageInfo),\n\t\t\t\t},\n\t\t\t\tedges: {\n\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\tname: GqlTypeName`${entityName}Edge`,\n\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\tnode: {\n\t\t\t\t\t\t\t\t\t\t\ttype: new GraphQLNonNull(entityType),\n\t\t\t\t\t\t\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n}\n"],"names":["schema","singletonFactory","GraphQLObjectType","GraphQLNonNull","GraphQLInt","Input","GraphQLBoolean","aliasAwareResolver","Acl","ImplementationException","GqlTypeName","getEntityFromSchema","FieldAccessVisitor","acceptFieldVisitor","FieldTypeVisitor","FieldArgsVisitor","GraphQLList"],"mappings":";;;;;;;;;;;;;;AAuBO,MAAM,mBAAmB;AAAA,EAmB/B,YACkBA,UACA,cACA,oBACA,mBACA,qBAChB;AALgB,SAAA,SAAAA;AACA,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,oBAAA;AACA,SAAA,sBAAA;AAvBlB,kBAAA,MAAQ,YAAWC,kCAAiB,CAAA,SAAQ,KAAK,aAAa,IAAI,CAAC,CAAA;AACnE,kBAAA,MAAQ,eAAcA,kCAAiB,CAAA,SAAQ,KAAK,iBAAiB,IAAI,CAAC,CAAA;AAC1E,kBAAA,MAAQ,YAAW,IAAIC,0BAAkB;AAAA,MACxC,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,YAAY,EAAE,MAAM,IAAIC,QAAAA,eAAeC,QAAAA,UAAU,EAAA;AAAA,MAAE;AAAA,IACpD,CACA,CAAA;AAED,kBAAA,MAAQ,aAAY,IAAIF,0BAAkB;AAAA,MACzC,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,CAACG,OAAAA,MAAM,UAAU,QAAQ,GAAG,EAAE,MAAMC,QAAAA,gBAAgB,SAASC,yBAAA;AAAA,QAC7D,CAACF,OAAAA,MAAM,UAAU,SAAS,GAAG,EAAE,MAAMC,QAAAA,gBAAgB,SAASC,MAAAA,mBAAA;AAAA,MAAmB;AAAA,IAClF,CACA,CAAA;AACD,kBAAA,MAAiB,wBAAgE,EAAC;AAAA,EASlF;AAAA,EAEO,4BAA4B,KAAa,UAAsC;AACrF,SAAK,qBAAqB,GAA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IACD,CACA;AAAA,EACF;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityTypeProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/EntityTypeProvider.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLObjectTypeConfig,\n\tGraphQLOutputType,\n} from 'graphql'\nimport { Acl, Input, Model } from '@contember/schema'\nimport { acceptFieldVisitor, getEntity as getEntityFromSchema } from '@contember/schema-utils'\nimport { singletonFactory } from '../utils'\nimport { ColumnTypeResolver } from './ColumnTypeResolver'\nimport { FieldArgsVisitor, FieldTypeVisitor } from './entities'\nimport { aliasAwareResolver, GqlTypeName } from './utils'\nimport { WhereTypeProvider } from './WhereTypeProvider'\nimport { Authorizator } from '../acl'\nimport { FieldAccessVisitor } from './FieldAccessVisitor'\nimport { OrderByTypeProvider } from './OrderByTypeProvider'\nimport { EntityFieldsProvider } from '../extensions'\nimport { ImplementationException } from '../exception'\n\nexport class EntityTypeProvider {\n\tprivate entities = singletonFactory(name => this.createEntity(name))\n\tprivate connections = singletonFactory(name => this.createConnection(name))\n\tprivate PageInfo = new GraphQLObjectType({\n\t\tname: 'PageInfo',\n\t\tfields: {\n\t\t\ttotalCount: { type: new GraphQLNonNull(GraphQLInt) },\n\t\t},\n\t})\n\n\tprivate fieldMeta = new GraphQLObjectType({\n\t\tname: 'FieldMeta',\n\t\tfields: {\n\t\t\t[Input.FieldMeta.readable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t\t[Input.FieldMeta.updatable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t},\n\t})\n\tprivate readonly entityFieldProviders: { [key: string]: EntityFieldsProvider } = {}\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly columnTypeResolver: ColumnTypeResolver,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t\tprivate readonly orderByTypeProvider: OrderByTypeProvider,\n\t) {\n\t}\n\n\tpublic registerEntityFieldProvider(key: string, provider: EntityFieldsProvider): void {\n\t\tthis.entityFieldProviders[key] = provider\n\t}\n\n\tpublic getEntity(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.entities(entityName)\n\t}\n\n\tpublic getConnection(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.connections(entityName)\n\t}\n\n\tprivate createEntity(entityName: string) {\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}`,\n\t\t\tfields: () => this.getEntityFields(entityName),\n\t\t} as GraphQLObjectTypeConfig<any, any>)\n\t}\n\n\tprivate getEntityFields(entityName: string) {\n\t\tconst entity = getEntityFromSchema(this.schema, entityName)\n\t\tconst accessVisitor = new FieldAccessVisitor(Acl.Operation.read, this.authorizator)\n\t\tconst accessibleFields = Object.values(entity.fields).filter(field => acceptFieldVisitor(this.schema, entity, field.name, accessVisitor))\n\t\tconst metaFields: { [field: string]: GraphQLFieldConfig<any, any> } = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tmetaFields[field.name] = {\n\t\t\t\ttype: this.fieldMeta,\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tconst metaField = {\n\t\t\ttype: new GraphQLObjectType({\n\t\t\t\tname: GqlTypeName`${entityName}Meta`,\n\t\t\t\tfields: metaFields,\n\t\t\t}),\n\t\t\tresolve: aliasAwareResolver,\n\t\t}\n\n\t\tlet fields: { [field: string]: GraphQLFieldConfig<any, any> } = {\n\t\t\t_meta: metaField,\n\t\t}\n\n\t\tfor (const field of accessibleFields) {\n\t\t\tconst fieldTypeVisitor = new FieldTypeVisitor(this.columnTypeResolver, this, this.authorizator)\n\t\t\tconst type: GraphQLOutputType = acceptFieldVisitor(this.schema, entity, field.name, fieldTypeVisitor)\n\n\t\t\tconst fieldArgsVisitor = new FieldArgsVisitor(this.whereTypeProvider, this.orderByTypeProvider)\n\t\t\tfields[field.name] = {\n\t\t\t\ttype,\n\t\t\t\targs: acceptFieldVisitor(this.schema, entity, field.name, fieldArgsVisitor),\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, provider] of Object.entries(this.entityFieldProviders)) {\n\t\t\tfields = {\n\t\t\t\t...fields,\n\t\t\t\t...provider.getFields(entity, accessibleFields),\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n\n\tprivate createConnection(entityName: string) {\n\t\tconst entityType = this.getEntity(entityName)\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}Connection`,\n\t\t\tfields: {\n\t\t\t\tpageInfo: {\n\t\t\t\t\ttype: new GraphQLNonNull(this.PageInfo),\n\t\t\t\t},\n\t\t\t\tedges: {\n\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\tname: GqlTypeName`${entityName}Edge`,\n\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\tnode: {\n\t\t\t\t\t\t\t\t\t\t\ttype: new GraphQLNonNull(entityType),\n\t\t\t\t\t\t\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t},\n\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OAAO,QAAQ,KAAK,oBAAoB,GAAG;AACxE,eAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAG,SAAS,UAAU,QAAQ,gBAAgB;AAAA,MAAA;AAAA,IAEhD;AACA,WAAO;AAAA,EACR;AAAA,EAEQ,iBAAiB,YAAoB;AAC5C,UAAM,aAAa,KAAK,UAAU,UAAU;AAC5C,WAAO,IAAI,kBAAkB;AAAA,MAC5B,MAAM,cAAc,UAAU;AAAA,MAC9B,QAAQ;AAAA,QACP,UAAU;AAAA,UACT,MAAM,IAAI,eAAe,KAAK,QAAQ;AAAA,QAAA;AAAA,QAEvC,OAAO;AAAA,UACN,MAAM,IAAI;AAAA,YACT,IAAI;AAAA,cACH,IAAI;AAAA,gBACH,IAAI,kBAAkB;AAAA,kBACrB,MAAM,cAAc,UAAU;AAAA,kBAC9B,QAAQ;AAAA,oBACP,MAAM;AAAA,sBACL,MAAM,IAAI,eAAe,UAAU;AAAA;AAAA,oBAAA;AAAA,kBAEpC;AAAA,gBACD,CACA;AAAA,cAAA;AAAA,YACF;AAAA,UACD;AAAA;AAAA,QACD;AAAA,MAED;AAAA,IACD,CACA;AAAA,EACF;AACD;"}
|
|
1
|
+
{"version":3,"file":"EntityTypeProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/EntityTypeProvider.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLObjectTypeConfig,\n\tGraphQLOutputType,\n} from 'graphql'\nimport { Acl, Input, Model } from '@contember/schema'\nimport { acceptFieldVisitor, getEntity as getEntityFromSchema } from '@contember/schema-utils'\nimport { singletonFactory } from '../utils/index.js'\nimport { ColumnTypeResolver } from './ColumnTypeResolver.js'\nimport { FieldArgsVisitor, FieldTypeVisitor } from './entities/index.js'\nimport { aliasAwareResolver, GqlTypeName } from './utils.js'\nimport { WhereTypeProvider } from './WhereTypeProvider.js'\nimport { Authorizator } from '../acl/index.js'\nimport { FieldAccessVisitor } from './FieldAccessVisitor.js'\nimport { OrderByTypeProvider } from './OrderByTypeProvider.js'\nimport { EntityFieldsProvider } from '../extensions/index.js'\nimport { ImplementationException } from '../exception.js'\n\nexport class EntityTypeProvider {\n\tprivate entities = singletonFactory(name => this.createEntity(name))\n\tprivate connections = singletonFactory(name => this.createConnection(name))\n\tprivate PageInfo = new GraphQLObjectType({\n\t\tname: 'PageInfo',\n\t\tfields: {\n\t\t\ttotalCount: { type: new GraphQLNonNull(GraphQLInt) },\n\t\t},\n\t})\n\n\tprivate fieldMeta = new GraphQLObjectType({\n\t\tname: 'FieldMeta',\n\t\tfields: {\n\t\t\t[Input.FieldMeta.readable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t\t[Input.FieldMeta.updatable]: { type: GraphQLBoolean, resolve: aliasAwareResolver },\n\t\t},\n\t})\n\tprivate readonly entityFieldProviders: { [key: string]: EntityFieldsProvider } = {}\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly columnTypeResolver: ColumnTypeResolver,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t\tprivate readonly orderByTypeProvider: OrderByTypeProvider,\n\t) {\n\t}\n\n\tpublic registerEntityFieldProvider(key: string, provider: EntityFieldsProvider): void {\n\t\tthis.entityFieldProviders[key] = provider\n\t}\n\n\tpublic getEntity(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.entities(entityName)\n\t}\n\n\tpublic getConnection(entityName: string): GraphQLObjectType {\n\t\tif (this.authorizator.getEntityPermission(Acl.Operation.read, entityName) === 'no') {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn this.connections(entityName)\n\t}\n\n\tprivate createEntity(entityName: string) {\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}`,\n\t\t\tfields: () => this.getEntityFields(entityName),\n\t\t} as GraphQLObjectTypeConfig<any, any>)\n\t}\n\n\tprivate getEntityFields(entityName: string) {\n\t\tconst entity = getEntityFromSchema(this.schema, entityName)\n\t\tconst accessVisitor = new FieldAccessVisitor(Acl.Operation.read, this.authorizator)\n\t\tconst accessibleFields = Object.values(entity.fields).filter(field => acceptFieldVisitor(this.schema, entity, field.name, accessVisitor))\n\t\tconst metaFields: { [field: string]: GraphQLFieldConfig<any, any> } = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tmetaFields[field.name] = {\n\t\t\t\ttype: this.fieldMeta,\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tconst metaField = {\n\t\t\ttype: new GraphQLObjectType({\n\t\t\t\tname: GqlTypeName`${entityName}Meta`,\n\t\t\t\tfields: metaFields,\n\t\t\t}),\n\t\t\tresolve: aliasAwareResolver,\n\t\t}\n\n\t\tlet fields: { [field: string]: GraphQLFieldConfig<any, any> } = {\n\t\t\t_meta: metaField,\n\t\t}\n\n\t\tfor (const field of accessibleFields) {\n\t\t\tconst fieldTypeVisitor = new FieldTypeVisitor(this.columnTypeResolver, this, this.authorizator)\n\t\t\tconst type: GraphQLOutputType = acceptFieldVisitor(this.schema, entity, field.name, fieldTypeVisitor)\n\n\t\t\tconst fieldArgsVisitor = new FieldArgsVisitor(this.whereTypeProvider, this.orderByTypeProvider)\n\t\t\tfields[field.name] = {\n\t\t\t\ttype,\n\t\t\t\targs: acceptFieldVisitor(this.schema, entity, field.name, fieldArgsVisitor),\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, provider] of Object.entries(this.entityFieldProviders)) {\n\t\t\tfields = {\n\t\t\t\t...fields,\n\t\t\t\t...provider.getFields(entity, accessibleFields),\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n\n\tprivate createConnection(entityName: string) {\n\t\tconst entityType = this.getEntity(entityName)\n\t\treturn new GraphQLObjectType({\n\t\t\tname: GqlTypeName`${entityName}Connection`,\n\t\t\tfields: {\n\t\t\t\tpageInfo: {\n\t\t\t\t\ttype: new GraphQLNonNull(this.PageInfo),\n\t\t\t\t},\n\t\t\t\tedges: {\n\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\tname: GqlTypeName`${entityName}Edge`,\n\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\tnode: {\n\t\t\t\t\t\t\t\t\t\t\ttype: new GraphQLNonNull(entityType),\n\t\t\t\t\t\t\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t// resolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n}\n"],"names":["getEntityFromSchema"],"mappings":";;;;;;;;;;;;AAuBO,MAAM,mBAAmB;AAAA,EAmB/B,YACkB,QACA,cACA,oBACA,mBACA,qBAChB;AALgB,SAAA,SAAA;AACA,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,oBAAA;AACA,SAAA,sBAAA;AAvBlB,kBAAA,MAAQ,YAAW,iBAAiB,CAAA,SAAQ,KAAK,aAAa,IAAI,CAAC,CAAA;AACnE,kBAAA,MAAQ,eAAc,iBAAiB,CAAA,SAAQ,KAAK,iBAAiB,IAAI,CAAC,CAAA;AAC1E,kBAAA,MAAQ,YAAW,IAAI,kBAAkB;AAAA,MACxC,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,YAAY,EAAE,MAAM,IAAI,eAAe,UAAU,EAAA;AAAA,MAAE;A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;AAAA,oBACP,MAAM;AAAA,sBACL,MAAM,IAAI,eAAe,UAAU;AAAA;AAAA,oBAAA;AAAA,kBAEpC;AAAA,gBACD,CACA;AAAA,cAAA;AAAA,YACF;AAAA,UACD;AAAA;AAAA,QACD;AAAA,MAED;AAAA,IACD,CACA;AAAA,EACF;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumsProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/EnumsProvider.ts"],"sourcesContent":["import { GraphQLEnumType, GraphQLEnumValueConfigMap } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { capitalizeFirstLetter, singletonFactory } from '../utils'\n\nexport class EnumsProvider {\n\tprivate schema: Model.Schema\n\n\tprivate enums = singletonFactory(name => this.createEnum(name))\n\n\tconstructor(schema: Model.Schema) {\n\t\tthis.schema = schema\n\t}\n\n\tpublic getEnum(name: string): GraphQLEnumType {\n\t\treturn this.enums(name)\n\t}\n\n\tpublic hasEnum(name: string): boolean {\n\t\treturn this.schema.enums[name] !== undefined\n\t}\n\n\tprivate createEnum(name: string): GraphQLEnumType {\n\t\tconst valuesConfig: GraphQLEnumValueConfigMap = {}\n\t\tfor (const val of this.schema.enums[name]) {\n\t\t\tvaluesConfig[val] = { value: val }\n\t\t}\n\n\t\treturn new GraphQLEnumType({\n\t\t\tname: capitalizeFirstLetter(name),\n\t\t\tvalues: valuesConfig,\n\t\t})\n\t}\n}\n"],"names":["singletonFactory","GraphQLEnumType","capitalizeFirstLetter"],"mappings":";;;;;;;;;AAIO,MAAM,cAAc;AAAA,EAK1B,YAAY,QAAsB;AAJlC,kBAAA,MAAQ,QAAA;AAER,kBAAA,MAAQ,SAAQA,kCAAiB,CAAA,SAAQ,KAAK,WAAW,IAAI,CAAC,CAAA;AAG7D,SAAK,SAAS;AAAA,EACf;AAAA,EAEO,QAAQ,MAA+B;AAC7C,WAAO,KAAK,MAAM,IAAI;AAAA,EACvB;AAAA,EAEO,QAAQ,MAAuB;AACrC,WAAO,KAAK,OAAO,MAAM,IAAI,MAAM;AAAA,EACpC;AAAA,EAEQ,WAAW,MAA+B;AACjD,UAAM,eAA0C,CAAA;AAChD,eAAW,OAAO,KAAK,OAAO,MAAM,IAAI,GAAG;AAC1C,mBAAa,GAAG,IAAI,EAAE,OAAO,IAAA;AAAA,IAC9B;AAEA,WAAO,IAAIC,QAAAA,gBAAgB;AAAA,MAC1B,MAAMC,QAAAA,sBAAsB,IAAI;AAAA,MAChC,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"EnumsProvider.cjs","sources":["../../../../../packages/engine-content-api/src/schema/EnumsProvider.ts"],"sourcesContent":["import { GraphQLEnumType, GraphQLEnumValueConfigMap } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { capitalizeFirstLetter, singletonFactory } from '../utils/index.js'\n\nexport class EnumsProvider {\n\tprivate schema: Model.Schema\n\n\tprivate enums = singletonFactory(name => this.createEnum(name))\n\n\tconstructor(schema: Model.Schema) {\n\t\tthis.schema = schema\n\t}\n\n\tpublic getEnum(name: string): GraphQLEnumType {\n\t\treturn this.enums(name)\n\t}\n\n\tpublic hasEnum(name: string): boolean {\n\t\treturn this.schema.enums[name] !== undefined\n\t}\n\n\tprivate createEnum(name: string): GraphQLEnumType {\n\t\tconst valuesConfig: GraphQLEnumValueConfigMap = {}\n\t\tfor (const val of this.schema.enums[name]) {\n\t\t\tvaluesConfig[val] = { value: val }\n\t\t}\n\n\t\treturn new GraphQLEnumType({\n\t\t\tname: capitalizeFirstLetter(name),\n\t\t\tvalues: valuesConfig,\n\t\t})\n\t}\n}\n"],"names":["singletonFactory","GraphQLEnumType","capitalizeFirstLetter"],"mappings":";;;;;;;;;AAIO,MAAM,cAAc;AAAA,EAK1B,YAAY,QAAsB;AAJlC,kBAAA,MAAQ,QAAA;AAER,kBAAA,MAAQ,SAAQA,kCAAiB,CAAA,SAAQ,KAAK,WAAW,IAAI,CAAC,CAAA;AAG7D,SAAK,SAAS;AAAA,EACf;AAAA,EAEO,QAAQ,MAA+B;AAC7C,WAAO,KAAK,MAAM,IAAI;AAAA,EACvB;AAAA,EAEO,QAAQ,MAAuB;AACrC,WAAO,KAAK,OAAO,MAAM,IAAI,MAAM;AAAA,EACpC;AAAA,EAEQ,WAAW,MAA+B;AACjD,UAAM,eAA0C,CAAA;AAChD,eAAW,OAAO,KAAK,OAAO,MAAM,IAAI,GAAG;AAC1C,mBAAa,GAAG,IAAI,EAAE,OAAO,IAAA;AAAA,IAC9B;AAEA,WAAO,IAAIC,QAAAA,gBAAgB;AAAA,MAC1B,MAAMC,QAAAA,sBAAsB,IAAI;AAAA,MAChC,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumsProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/EnumsProvider.ts"],"sourcesContent":["import { GraphQLEnumType, GraphQLEnumValueConfigMap } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { capitalizeFirstLetter, singletonFactory } from '../utils'\n\nexport class EnumsProvider {\n\tprivate schema: Model.Schema\n\n\tprivate enums = singletonFactory(name => this.createEnum(name))\n\n\tconstructor(schema: Model.Schema) {\n\t\tthis.schema = schema\n\t}\n\n\tpublic getEnum(name: string): GraphQLEnumType {\n\t\treturn this.enums(name)\n\t}\n\n\tpublic hasEnum(name: string): boolean {\n\t\treturn this.schema.enums[name] !== undefined\n\t}\n\n\tprivate createEnum(name: string): GraphQLEnumType {\n\t\tconst valuesConfig: GraphQLEnumValueConfigMap = {}\n\t\tfor (const val of this.schema.enums[name]) {\n\t\t\tvaluesConfig[val] = { value: val }\n\t\t}\n\n\t\treturn new GraphQLEnumType({\n\t\t\tname: capitalizeFirstLetter(name),\n\t\t\tvalues: valuesConfig,\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAIO,MAAM,cAAc;AAAA,EAK1B,YAAY,QAAsB;AAJlC,kBAAA,MAAQ,QAAA;AAER,kBAAA,MAAQ,SAAQ,iBAAiB,CAAA,SAAQ,KAAK,WAAW,IAAI,CAAC,CAAA;AAG7D,SAAK,SAAS;AAAA,EACf;AAAA,EAEO,QAAQ,MAA+B;AAC7C,WAAO,KAAK,MAAM,IAAI;AAAA,EACvB;AAAA,EAEO,QAAQ,MAAuB;AACrC,WAAO,KAAK,OAAO,MAAM,IAAI,MAAM;AAAA,EACpC;AAAA,EAEQ,WAAW,MAA+B;AACjD,UAAM,eAA0C,CAAA;AAChD,eAAW,OAAO,KAAK,OAAO,MAAM,IAAI,GAAG;AAC1C,mBAAa,GAAG,IAAI,EAAE,OAAO,IAAA;AAAA,IAC9B;AAEA,WAAO,IAAI,gBAAgB;AAAA,MAC1B,MAAM,sBAAsB,IAAI;AAAA,MAChC,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AACD;"}
|
|
1
|
+
{"version":3,"file":"EnumsProvider.js","sources":["../../../../../packages/engine-content-api/src/schema/EnumsProvider.ts"],"sourcesContent":["import { GraphQLEnumType, GraphQLEnumValueConfigMap } from 'graphql'\nimport { Model } from '@contember/schema'\nimport { capitalizeFirstLetter, singletonFactory } from '../utils/index.js'\n\nexport class EnumsProvider {\n\tprivate schema: Model.Schema\n\n\tprivate enums = singletonFactory(name => this.createEnum(name))\n\n\tconstructor(schema: Model.Schema) {\n\t\tthis.schema = schema\n\t}\n\n\tpublic getEnum(name: string): GraphQLEnumType {\n\t\treturn this.enums(name)\n\t}\n\n\tpublic hasEnum(name: string): boolean {\n\t\treturn this.schema.enums[name] !== undefined\n\t}\n\n\tprivate createEnum(name: string): GraphQLEnumType {\n\t\tconst valuesConfig: GraphQLEnumValueConfigMap = {}\n\t\tfor (const val of this.schema.enums[name]) {\n\t\t\tvaluesConfig[val] = { value: val }\n\t\t}\n\n\t\treturn new GraphQLEnumType({\n\t\t\tname: capitalizeFirstLetter(name),\n\t\t\tvalues: valuesConfig,\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAIO,MAAM,cAAc;AAAA,EAK1B,YAAY,QAAsB;AAJlC,kBAAA,MAAQ,QAAA;AAER,kBAAA,MAAQ,SAAQ,iBAAiB,CAAA,SAAQ,KAAK,WAAW,IAAI,CAAC,CAAA;AAG7D,SAAK,SAAS;AAAA,EACf;AAAA,EAEO,QAAQ,MAA+B;AAC7C,WAAO,KAAK,MAAM,IAAI;AAAA,EACvB;AAAA,EAEO,QAAQ,MAAuB;AACrC,WAAO,KAAK,OAAO,MAAM,IAAI,MAAM;AAAA,EACpC;AAAA,EAEQ,WAAW,MAA+B;AACjD,UAAM,eAA0C,CAAA;AAChD,eAAW,OAAO,KAAK,OAAO,MAAM,IAAI,GAAG;AAC1C,mBAAa,GAAG,IAAI,EAAE,OAAO,IAAA;AAAA,IAC9B;AAEA,WAAO,IAAI,gBAAgB;AAAA,MAC1B,MAAM,sBAAsB,IAAI;AAAA,MAChC,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldAccessVisitor.cjs","sources":["../../../../../packages/engine-content-api/src/schema/FieldAccessVisitor.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport { Authorizator } from '../acl'\n\nexport class FieldAccessVisitor implements Model.ColumnVisitor<boolean>, Model.RelationVisitor<boolean> {\n\tconstructor(\n\t\tprivate readonly operation: Acl.Operation.create | Acl.Operation.read | Acl.Operation.update,\n\t\tprivate readonly authorizator: Authorizator,\n\t) {}\n\n\tvisitColumn({ column, entity }: Model.ColumnContext) {\n\t\treturn this.authorizator.getFieldPermissions(this.operation, entity.name, column.name) !== 'no'\n\t}\n\n\tvisitRelation({ targetEntity }: Model.AnyRelationContext) {\n\t\treturn this.authorizator.getEntityPermission(this.operation, targetEntity.name) !== 'no'\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,mBAA2F;AAAA,EACvG,YACkB,WACA,cAChB;AAFgB,SAAA,YAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,YAAY,EAAE,QAAQ,UAA+B;AACpD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,OAAO,MAAM,OAAO,IAAI,MAAM;AAAA,EAC5F;AAAA,EAEA,cAAc,EAAE,gBAA0C;AACzD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,aAAa,IAAI,MAAM;AAAA,EACrF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"FieldAccessVisitor.cjs","sources":["../../../../../packages/engine-content-api/src/schema/FieldAccessVisitor.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport { Authorizator } from '../acl/index.js'\n\nexport class FieldAccessVisitor implements Model.ColumnVisitor<boolean>, Model.RelationVisitor<boolean> {\n\tconstructor(\n\t\tprivate readonly operation: Acl.Operation.create | Acl.Operation.read | Acl.Operation.update,\n\t\tprivate readonly authorizator: Authorizator,\n\t) {}\n\n\tvisitColumn({ column, entity }: Model.ColumnContext) {\n\t\treturn this.authorizator.getFieldPermissions(this.operation, entity.name, column.name) !== 'no'\n\t}\n\n\tvisitRelation({ targetEntity }: Model.AnyRelationContext) {\n\t\treturn this.authorizator.getEntityPermission(this.operation, targetEntity.name) !== 'no'\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,mBAA2F;AAAA,EACvG,YACkB,WACA,cAChB;AAFgB,SAAA,YAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,YAAY,EAAE,QAAQ,UAA+B;AACpD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,OAAO,MAAM,OAAO,IAAI,MAAM;AAAA,EAC5F;AAAA,EAEA,cAAc,EAAE,gBAA0C;AACzD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,aAAa,IAAI,MAAM;AAAA,EACrF;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldAccessVisitor.js","sources":["../../../../../packages/engine-content-api/src/schema/FieldAccessVisitor.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport { Authorizator } from '../acl'\n\nexport class FieldAccessVisitor implements Model.ColumnVisitor<boolean>, Model.RelationVisitor<boolean> {\n\tconstructor(\n\t\tprivate readonly operation: Acl.Operation.create | Acl.Operation.read | Acl.Operation.update,\n\t\tprivate readonly authorizator: Authorizator,\n\t) {}\n\n\tvisitColumn({ column, entity }: Model.ColumnContext) {\n\t\treturn this.authorizator.getFieldPermissions(this.operation, entity.name, column.name) !== 'no'\n\t}\n\n\tvisitRelation({ targetEntity }: Model.AnyRelationContext) {\n\t\treturn this.authorizator.getEntityPermission(this.operation, targetEntity.name) !== 'no'\n\t}\n}\n"],"names":[],"mappings":"AAGO,MAAM,mBAA2F;AAAA,EACvG,YACkB,WACA,cAChB;AAFgB,SAAA,YAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,YAAY,EAAE,QAAQ,UAA+B;AACpD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,OAAO,MAAM,OAAO,IAAI,MAAM;AAAA,EAC5F;AAAA,EAEA,cAAc,EAAE,gBAA0C;AACzD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,aAAa,IAAI,MAAM;AAAA,EACrF;AACD;"}
|
|
1
|
+
{"version":3,"file":"FieldAccessVisitor.js","sources":["../../../../../packages/engine-content-api/src/schema/FieldAccessVisitor.ts"],"sourcesContent":["import { Acl, Model } from '@contember/schema'\nimport { Authorizator } from '../acl/index.js'\n\nexport class FieldAccessVisitor implements Model.ColumnVisitor<boolean>, Model.RelationVisitor<boolean> {\n\tconstructor(\n\t\tprivate readonly operation: Acl.Operation.create | Acl.Operation.read | Acl.Operation.update,\n\t\tprivate readonly authorizator: Authorizator,\n\t) {}\n\n\tvisitColumn({ column, entity }: Model.ColumnContext) {\n\t\treturn this.authorizator.getFieldPermissions(this.operation, entity.name, column.name) !== 'no'\n\t}\n\n\tvisitRelation({ targetEntity }: Model.AnyRelationContext) {\n\t\treturn this.authorizator.getEntityPermission(this.operation, targetEntity.name) !== 'no'\n\t}\n}\n"],"names":[],"mappings":"AAGO,MAAM,mBAA2F;AAAA,EACvG,YACkB,WACA,cAChB;AAFgB,SAAA,YAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,YAAY,EAAE,QAAQ,UAA+B;AACpD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,OAAO,MAAM,OAAO,IAAI,MAAM;AAAA,EAC5F;AAAA,EAEA,cAAc,EAAE,gBAA0C;AACzD,WAAO,KAAK,aAAa,oBAAoB,KAAK,WAAW,aAAa,IAAI,MAAM;AAAA,EACrF;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlSchemaBuilder.cjs","sources":["../../../../../packages/engine-content-api/src/schema/GraphQlSchemaBuilder.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInputObjectType,\n\tGraphQLNamedType,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchema,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { Model } from '@contember/schema'\nimport { MutationProvider } from './MutationProvider'\nimport { QueryProvider } from './QueryProvider'\nimport { ValidationQueriesProvider } from './ValidationQueriesProvider'\nimport { Context } from '../types'\nimport { ResultSchemaTypeProvider } from './ResultSchemaTypeProvider'\nimport { RefreshViewMutationProvider } from './RefreshViewMutationProvider'\n\ntype BuildArgs = {\n\tqueries?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\tmutations?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\ttypes?: GraphQLNamedType[]\n}\n\nexport class GraphQlSchemaBuilder {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly queryProvider: QueryProvider,\n\t\tprivate readonly validationQueriesProvider: ValidationQueriesProvider,\n\t\tprivate readonly mutationProvider: MutationProvider,\n\t\tprivate readonly resultSchemaTypeProvider: ResultSchemaTypeProvider,\n\t\tprivate readonly refreshViewMutationProvider: RefreshViewMutationProvider,\n\t) {}\n\n\tpublic build(args: BuildArgs = {}): GraphQLSchema {\n\t\treturn new GraphQLSchema(this.buildConfig(args))\n\t}\n\n\tprivate buildConfig(args: BuildArgs): GraphQLSchemaConfig {\n\t\tconst queries = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.queries)\n\t\tconst mutations = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.mutations)\n\t\tfor (const entity of Object.values(this.schema.entities)) {\n\t\t\tconst queryFields = this.queryProvider.getQueries(entity)\n\t\t\tfor (const name in queryFields) {\n\t\t\t\tqueries.set(name, queryFields[name])\n\t\t\t}\n\t\t\tconst validationFields = this.validationQueriesProvider.getQueries(entity)\n\t\t\tfor (const name in validationFields) {\n\t\t\t\tqueries.set(name, validationFields[name])\n\t\t\t}\n\t\t\tconst mutationFields = this.mutationProvider.getMutations(entity)\n\t\t\tfor (const name in mutationFields) {\n\t\t\t\tmutations.set(name, mutationFields[name])\n\t\t\t}\n\t\t}\n\n\t\tif (queries.size > 0) {\n\t\t\tconst queryTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'QueryTransaction',\n\t\t\t\tfields: Object.fromEntries(queries),\n\t\t\t})\n\t\t\tqueries.set('transaction', {\n\t\t\t\ttype: queryTransactionType,\n\t\t\t\tresolve: async (parent, args, context: Context, info) => {\n\t\t\t\t\treturn context.timer(`GraphQL.query.${info.fieldName}`, () => context.executionContainer.readResolver.resolveTransaction(info))\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst queryObjectType = new GraphQLObjectType({\n\t\t\tname: 'Query',\n\t\t\tfields: () => Object.fromEntries(queries),\n\t\t})\n\t\tif (mutations.size > 0) {\n\t\t\tconst mutationTransactionOptions = new GraphQLInputObjectType({\n\t\t\t\tname: 'MutationTransactionOptions',\n\t\t\t\tfields: {\n\t\t\t\t\tdeferForeignKeyConstraints: { type: GraphQLBoolean },\n\t\t\t\t\tdeferUniqueConstraints: { type: GraphQLBoolean },\n\t\t\t\t},\n\t\t\t})\n\t\t\tconst mutationTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'MutationTransaction',\n\t\t\t\tfields: {\n\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\terrorMessage: { type: GraphQLString },\n\t\t\t\t\terrors: { type: this.resultSchemaTypeProvider.errorListResultType },\n\t\t\t\t\tvalidation: {\n\t\t\t\t\t\ttype: new GraphQLNonNull(this.resultSchemaTypeProvider.validationResultType),\n\t\t\t\t\t},\n\t\t\t\t\t...Object.fromEntries(mutations),\n\t\t\t\t\tquery: {\n\t\t\t\t\t\ttype: queryObjectType,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('transaction', {\n\t\t\t\targs: {\n\t\t\t\t\toptions: {\n\t\t\t\t\t\ttype: mutationTransactionOptions,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\tmutationTransactionType,\n\t\t\t\t),\n\t\t\t\tresolve: async (\n\t\t\t\t\tparent,\n\t\t\t\t\targs: { options?: { deferForeignKeyConstraints?: boolean; deferUniqueConstraints?: boolean } },\n\t\t\t\t\tcontext: Context,\n\t\t\t\t\tinfo,\n\t\t\t\t) => {\n\t\t\t\t\treturn context.timer(`GraphQL.mutation.${info.fieldName}`, () =>\n\t\t\t\t\t\tcontext.executionContainer.mutationResolver.resolveTransaction(info, {\n\t\t\t\t\t\t\tdeferForeignKeyConstraints: args.options?.deferForeignKeyConstraints ?? false,\n\t\t\t\t\t\t\tdeferUniqueConstraints: args.options?.deferUniqueConstraints ?? false,\n\t\t\t\t\t\t}))\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('query', {\n\t\t\t\ttype: new GraphQLNonNull(queryObjectType),\n\t\t\t\tresolve: (parent, args, context: Context, info) => context.executionContainer.readResolver.resolveQuery(info),\n\t\t\t})\n\t\t}\n\n\t\tconst refreshViewMutation = this.refreshViewMutationProvider.getMutation()\n\t\tif (refreshViewMutation) {\n\t\t\tmutations.set('refreshMaterializedView', refreshViewMutation)\n\t\t}\n\n\t\tconst infoType = new GraphQLObjectType({\n\t\t\tname: 'Info',\n\t\t\tfields: () => ({\n\t\t\t\tdescription: { type: GraphQLString },\n\t\t\t}),\n\t\t})\n\t\tqueries.set('_info', {\n\t\t\ttype: infoType,\n\t\t\tresolve: () => ({\n\t\t\t\tdescription: 'TODO',\n\t\t\t}),\n\t\t})\n\n\t\treturn {\n\t\t\tquery: queryObjectType,\n\t\t\ttypes: args.types,\n\t\t\t...(mutations.size > 0\n\t\t\t\t? {\n\t\t\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\t\t\tname: 'Mutation',\n\t\t\t\t\t\tfields: () => Object.fromEntries(mutations),\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n}\n"],"names":["GraphQLSchema","GraphQLObjectType","args","GraphQLInputObjectType","GraphQLBoolean","GraphQLNonNull","GraphQLString"],"mappings":";;;AAyBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,eACA,2BACA,kBACA,0BACA,6BAChB;AANgB,SAAA,SAAA;AACA,SAAA,gBAAA;AACA,SAAA,4BAAA;AACA,SAAA,mBAAA;AACA,SAAA,2BAAA;AACA,SAAA,8BAAA;AAAA,EACf;AAAA,EAEI,MAAM,OAAkB,IAAmB;AACjD,WAAO,IAAIA,QAAAA,cAAc,KAAK,YAAY,IAAI,CAAC;AAAA,EAChD;AAAA,EAEQ,YAAY,MAAsC;AACzD,UAAM,UAAU,IAAI,IAAmD,KAAK,OAAO;AACnF,UAAM,YAAY,IAAI,IAAmD,KAAK,SAAS;AACvF,eAAW,UAAU,OAAO,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzD,YAAM,cAAc,KAAK,cAAc,WAAW,MAAM;AACxD,iBAAW,QAAQ,aAAa;AAC/B,gBAAQ,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O;AAAA,MACP,OAAO,KAAK;AAAA,MACZ,GAAI,UAAU,OAAO,IAClB;AAAA,QACD,UAAU,IAAIL,QAAAA,kBAAkB;AAAA,UAC/B,MAAM;AAAA,UACN,QAAQ,MAAM,OAAO,YAAY,SAAS;AAAA,QAAA,CAC1C;AAAA,MAAA,IAEA,CAAA;AAAA,IAAC;AAAA,EAEN;AACD;;"}
|
|
1
|
+
{"version":3,"file":"GraphQlSchemaBuilder.cjs","sources":["../../../../../packages/engine-content-api/src/schema/GraphQlSchemaBuilder.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInputObjectType,\n\tGraphQLNamedType,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchema,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { Model } from '@contember/schema'\nimport { MutationProvider } from './MutationProvider.js'\nimport { QueryProvider } from './QueryProvider.js'\nimport { ValidationQueriesProvider } from './ValidationQueriesProvider.js'\nimport { Context } from '../types.js'\nimport { ResultSchemaTypeProvider } from './ResultSchemaTypeProvider.js'\nimport { RefreshViewMutationProvider } from './RefreshViewMutationProvider.js'\n\ntype BuildArgs = {\n\tqueries?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\tmutations?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\ttypes?: GraphQLNamedType[]\n}\n\nexport class GraphQlSchemaBuilder {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly queryProvider: QueryProvider,\n\t\tprivate readonly validationQueriesProvider: ValidationQueriesProvider,\n\t\tprivate readonly mutationProvider: MutationProvider,\n\t\tprivate readonly resultSchemaTypeProvider: ResultSchemaTypeProvider,\n\t\tprivate readonly refreshViewMutationProvider: RefreshViewMutationProvider,\n\t) {}\n\n\tpublic build(args: BuildArgs = {}): GraphQLSchema {\n\t\treturn new GraphQLSchema(this.buildConfig(args))\n\t}\n\n\tprivate buildConfig(args: BuildArgs): GraphQLSchemaConfig {\n\t\tconst queries = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.queries)\n\t\tconst mutations = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.mutations)\n\t\tfor (const entity of Object.values(this.schema.entities)) {\n\t\t\tconst queryFields = this.queryProvider.getQueries(entity)\n\t\t\tfor (const name in queryFields) {\n\t\t\t\tqueries.set(name, queryFields[name])\n\t\t\t}\n\t\t\tconst validationFields = this.validationQueriesProvider.getQueries(entity)\n\t\t\tfor (const name in validationFields) {\n\t\t\t\tqueries.set(name, validationFields[name])\n\t\t\t}\n\t\t\tconst mutationFields = this.mutationProvider.getMutations(entity)\n\t\t\tfor (const name in mutationFields) {\n\t\t\t\tmutations.set(name, mutationFields[name])\n\t\t\t}\n\t\t}\n\n\t\tif (queries.size > 0) {\n\t\t\tconst queryTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'QueryTransaction',\n\t\t\t\tfields: Object.fromEntries(queries),\n\t\t\t})\n\t\t\tqueries.set('transaction', {\n\t\t\t\ttype: queryTransactionType,\n\t\t\t\tresolve: async (parent, args, context: Context, info) => {\n\t\t\t\t\treturn context.timer(`GraphQL.query.${info.fieldName}`, () => context.executionContainer.readResolver.resolveTransaction(info))\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst queryObjectType = new GraphQLObjectType({\n\t\t\tname: 'Query',\n\t\t\tfields: () => Object.fromEntries(queries),\n\t\t})\n\t\tif (mutations.size > 0) {\n\t\t\tconst mutationTransactionOptions = new GraphQLInputObjectType({\n\t\t\t\tname: 'MutationTransactionOptions',\n\t\t\t\tfields: {\n\t\t\t\t\tdeferForeignKeyConstraints: { type: GraphQLBoolean },\n\t\t\t\t\tdeferUniqueConstraints: { type: GraphQLBoolean },\n\t\t\t\t},\n\t\t\t})\n\t\t\tconst mutationTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'MutationTransaction',\n\t\t\t\tfields: {\n\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\terrorMessage: { type: GraphQLString },\n\t\t\t\t\terrors: { type: this.resultSchemaTypeProvider.errorListResultType },\n\t\t\t\t\tvalidation: {\n\t\t\t\t\t\ttype: new GraphQLNonNull(this.resultSchemaTypeProvider.validationResultType),\n\t\t\t\t\t},\n\t\t\t\t\t...Object.fromEntries(mutations),\n\t\t\t\t\tquery: {\n\t\t\t\t\t\ttype: queryObjectType,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('transaction', {\n\t\t\t\targs: {\n\t\t\t\t\toptions: {\n\t\t\t\t\t\ttype: mutationTransactionOptions,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\tmutationTransactionType,\n\t\t\t\t),\n\t\t\t\tresolve: async (\n\t\t\t\t\tparent,\n\t\t\t\t\targs: { options?: { deferForeignKeyConstraints?: boolean; deferUniqueConstraints?: boolean } },\n\t\t\t\t\tcontext: Context,\n\t\t\t\t\tinfo,\n\t\t\t\t) => {\n\t\t\t\t\treturn context.timer(`GraphQL.mutation.${info.fieldName}`, () =>\n\t\t\t\t\t\tcontext.executionContainer.mutationResolver.resolveTransaction(info, {\n\t\t\t\t\t\t\tdeferForeignKeyConstraints: args.options?.deferForeignKeyConstraints ?? false,\n\t\t\t\t\t\t\tdeferUniqueConstraints: args.options?.deferUniqueConstraints ?? false,\n\t\t\t\t\t\t}))\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('query', {\n\t\t\t\ttype: new GraphQLNonNull(queryObjectType),\n\t\t\t\tresolve: (parent, args, context: Context, info) => context.executionContainer.readResolver.resolveQuery(info),\n\t\t\t})\n\t\t}\n\n\t\tconst refreshViewMutation = this.refreshViewMutationProvider.getMutation()\n\t\tif (refreshViewMutation) {\n\t\t\tmutations.set('refreshMaterializedView', refreshViewMutation)\n\t\t}\n\n\t\tconst infoType = new GraphQLObjectType({\n\t\t\tname: 'Info',\n\t\t\tfields: () => ({\n\t\t\t\tdescription: { type: GraphQLString },\n\t\t\t}),\n\t\t})\n\t\tqueries.set('_info', {\n\t\t\ttype: infoType,\n\t\t\tresolve: () => ({\n\t\t\t\tdescription: 'TODO',\n\t\t\t}),\n\t\t})\n\n\t\treturn {\n\t\t\tquery: queryObjectType,\n\t\t\ttypes: args.types,\n\t\t\t...(mutations.size > 0\n\t\t\t\t? {\n\t\t\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\t\t\tname: 'Mutation',\n\t\t\t\t\t\tfields: () => Object.fromEntries(mutations),\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n}\n"],"names":["GraphQLSchema","GraphQLObjectType","args","GraphQLInputObjectType","GraphQLBoolean","GraphQLNonNull","GraphQLString"],"mappings":";;;AAyBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,eACA,2BACA,kBACA,0BACA,6BAChB;AANgB,SAAA,SAAA;AACA,SAAA,gBAAA;AACA,SAAA,4BAAA;AACA,SAAA,mBAAA;AACA,SAAA,2BAAA;AACA,SAAA,8BAAA;AAAA,EACf;AAAA,EAEI,MAAM,OAAkB,IAAmB;AACjD,WAAO,IAAIA,QAAAA,cAAc,KAAK,YAAY,IAAI,CAAC;AAAA,EAChD;AAAA,EAEQ,YAAY,MAAsC;AACzD,UAAM,UAAU,IAAI,IAAmD,KAAK,OAAO;AACnF,UAAM,YAAY,IAAI,IAAmD,KAAK,SAAS;AACvF,eAAW,UAAU,OAAO,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzD,YAAM,cAAc,KAAK,cAAc,WAAW,MAAM;AACxD,iBAAW,QAAQ,aAAa;AAC/B,gBAAQ,IAAI,MAAM,YAAY,IAAI,CAAC;AAAA,MACpC;AACA,YAAM,mBAAmB,KAAK,0BAA0B,WAAW,MAAM;AACzE,iBAAW,QAAQ,kBAAkB;AACpC,gBAAQ,IAAI,MAAM,iBAAiB,IAAI,CAAC;AAAA,MACzC;AACA,YA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AAA,MAAA,IAEA,CAAA;AAAA,IAAC;AAAA,EAEN;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlSchemaBuilder.js","sources":["../../../../../packages/engine-content-api/src/schema/GraphQlSchemaBuilder.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInputObjectType,\n\tGraphQLNamedType,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchema,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { Model } from '@contember/schema'\nimport { MutationProvider } from './MutationProvider'\nimport { QueryProvider } from './QueryProvider'\nimport { ValidationQueriesProvider } from './ValidationQueriesProvider'\nimport { Context } from '../types'\nimport { ResultSchemaTypeProvider } from './ResultSchemaTypeProvider'\nimport { RefreshViewMutationProvider } from './RefreshViewMutationProvider'\n\ntype BuildArgs = {\n\tqueries?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\tmutations?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\ttypes?: GraphQLNamedType[]\n}\n\nexport class GraphQlSchemaBuilder {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly queryProvider: QueryProvider,\n\t\tprivate readonly validationQueriesProvider: ValidationQueriesProvider,\n\t\tprivate readonly mutationProvider: MutationProvider,\n\t\tprivate readonly resultSchemaTypeProvider: ResultSchemaTypeProvider,\n\t\tprivate readonly refreshViewMutationProvider: RefreshViewMutationProvider,\n\t) {}\n\n\tpublic build(args: BuildArgs = {}): GraphQLSchema {\n\t\treturn new GraphQLSchema(this.buildConfig(args))\n\t}\n\n\tprivate buildConfig(args: BuildArgs): GraphQLSchemaConfig {\n\t\tconst queries = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.queries)\n\t\tconst mutations = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.mutations)\n\t\tfor (const entity of Object.values(this.schema.entities)) {\n\t\t\tconst queryFields = this.queryProvider.getQueries(entity)\n\t\t\tfor (const name in queryFields) {\n\t\t\t\tqueries.set(name, queryFields[name])\n\t\t\t}\n\t\t\tconst validationFields = this.validationQueriesProvider.getQueries(entity)\n\t\t\tfor (const name in validationFields) {\n\t\t\t\tqueries.set(name, validationFields[name])\n\t\t\t}\n\t\t\tconst mutationFields = this.mutationProvider.getMutations(entity)\n\t\t\tfor (const name in mutationFields) {\n\t\t\t\tmutations.set(name, mutationFields[name])\n\t\t\t}\n\t\t}\n\n\t\tif (queries.size > 0) {\n\t\t\tconst queryTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'QueryTransaction',\n\t\t\t\tfields: Object.fromEntries(queries),\n\t\t\t})\n\t\t\tqueries.set('transaction', {\n\t\t\t\ttype: queryTransactionType,\n\t\t\t\tresolve: async (parent, args, context: Context, info) => {\n\t\t\t\t\treturn context.timer(`GraphQL.query.${info.fieldName}`, () => context.executionContainer.readResolver.resolveTransaction(info))\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst queryObjectType = new GraphQLObjectType({\n\t\t\tname: 'Query',\n\t\t\tfields: () => Object.fromEntries(queries),\n\t\t})\n\t\tif (mutations.size > 0) {\n\t\t\tconst mutationTransactionOptions = new GraphQLInputObjectType({\n\t\t\t\tname: 'MutationTransactionOptions',\n\t\t\t\tfields: {\n\t\t\t\t\tdeferForeignKeyConstraints: { type: GraphQLBoolean },\n\t\t\t\t\tdeferUniqueConstraints: { type: GraphQLBoolean },\n\t\t\t\t},\n\t\t\t})\n\t\t\tconst mutationTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'MutationTransaction',\n\t\t\t\tfields: {\n\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\terrorMessage: { type: GraphQLString },\n\t\t\t\t\terrors: { type: this.resultSchemaTypeProvider.errorListResultType },\n\t\t\t\t\tvalidation: {\n\t\t\t\t\t\ttype: new GraphQLNonNull(this.resultSchemaTypeProvider.validationResultType),\n\t\t\t\t\t},\n\t\t\t\t\t...Object.fromEntries(mutations),\n\t\t\t\t\tquery: {\n\t\t\t\t\t\ttype: queryObjectType,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('transaction', {\n\t\t\t\targs: {\n\t\t\t\t\toptions: {\n\t\t\t\t\t\ttype: mutationTransactionOptions,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\tmutationTransactionType,\n\t\t\t\t),\n\t\t\t\tresolve: async (\n\t\t\t\t\tparent,\n\t\t\t\t\targs: { options?: { deferForeignKeyConstraints?: boolean; deferUniqueConstraints?: boolean } },\n\t\t\t\t\tcontext: Context,\n\t\t\t\t\tinfo,\n\t\t\t\t) => {\n\t\t\t\t\treturn context.timer(`GraphQL.mutation.${info.fieldName}`, () =>\n\t\t\t\t\t\tcontext.executionContainer.mutationResolver.resolveTransaction(info, {\n\t\t\t\t\t\t\tdeferForeignKeyConstraints: args.options?.deferForeignKeyConstraints ?? false,\n\t\t\t\t\t\t\tdeferUniqueConstraints: args.options?.deferUniqueConstraints ?? false,\n\t\t\t\t\t\t}))\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('query', {\n\t\t\t\ttype: new GraphQLNonNull(queryObjectType),\n\t\t\t\tresolve: (parent, args, context: Context, info) => context.executionContainer.readResolver.resolveQuery(info),\n\t\t\t})\n\t\t}\n\n\t\tconst refreshViewMutation = this.refreshViewMutationProvider.getMutation()\n\t\tif (refreshViewMutation) {\n\t\t\tmutations.set('refreshMaterializedView', refreshViewMutation)\n\t\t}\n\n\t\tconst infoType = new GraphQLObjectType({\n\t\t\tname: 'Info',\n\t\t\tfields: () => ({\n\t\t\t\tdescription: { type: GraphQLString },\n\t\t\t}),\n\t\t})\n\t\tqueries.set('_info', {\n\t\t\ttype: infoType,\n\t\t\tresolve: () => ({\n\t\t\t\tdescription: 'TODO',\n\t\t\t}),\n\t\t})\n\n\t\treturn {\n\t\t\tquery: queryObjectType,\n\t\t\ttypes: args.types,\n\t\t\t...(mutations.size > 0\n\t\t\t\t? {\n\t\t\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\t\t\tname: 'Mutation',\n\t\t\t\t\t\tfields: () => Object.fromEntries(mutations),\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n}\n"],"names":["args"],"mappings":";AAyBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,eACA,2BACA,kBACA,0BACA,6BAChB;AANgB,SAAA,SAAA;AACA,SAAA,gBAAA;AACA,SAAA,4BAAA;AACA,SAAA,mBAAA;AACA,SAAA,2BAAA;AACA,SAAA,8BAAA;AAAA,EACf;AAAA,EAEI,MAAM,OAAkB,IAAmB;AACjD,WAAO,IAAI,cAAc,KAAK,YAAY,IAAI,CAAC;AAAA,EAChD;AAAA,EAEQ,YAAY,MAAsC;AACzD,UAAM,UAAU,IAAI,IAAmD,KAAK,OAAO;AACnF,UAAM,YAAY,IAAI,IAAmD,KAAK,SAAS;AACvF,eAAW,UAAU,OAAO,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzD,YAAM,cAAc,KAAK,cAAc,WAAW,MAAM;AACxD,iBAAW,QAAQ,aAAa;AAC/B,gBAAQ,IAAI,MAAM,YAAY,IAAI,CAAC;AAAA,MACpC;AACA,YAAM,mBAAmB,KAAK,0BAA0B,WAAW,MAAM;AACzE,iBAAW,QAAQ,kBAAkB;AACpC,gBAAQ,IAAI,MAAM,iBAAiB,IAAI,CAAC;AAAA,MACzC;AACA,YAAM,iBAAiB,KAAK,iBAAiB,aAAa,MAAM;AAChE,iBAAW,QAAQ,gBAAgB;AAClC,kBAAU,IAAI,MAAM,eAAe,IAAI,CAAC;AAAA,MACzC;AAAA,IACD;AAEA,QAAI,QAAQ,OAAO,GAAG;AACrB,YAAM,uBAAuB,IAAI,kBAAkB;AAAA,QAClD,MAAM;AAAA,QACN,QAAQ,OAAO,YAAY,OAAO;AAAA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AAmB,iBAAiB,mBAAmB,MAAM;AAAA,YACpE,4BAA4BA,MAAK,SAAS,8BAA8B;AAAA,YACxE,wBAAwBA,MAAK,SAAS,0BAA0B;AAAA,UAAA,CAChE,CAAC;AAAA,QACJ;AAAA,MAAA,CACA;AACD,gBAAU,IAAI,SAAS;AAAA,QACtB,MAAM,IAAI,eAAe,eAAe;AAAA,QACxC,SAAS,CAAC,QAAQA,OAAM,SAAkB,SAAS,QAAQ,mBAAmB,aAAa,aAAa,IAAI;AAAA,MAAA,CAC5G;AAAA,IACF;AAEA,UAAM,sBAAsB,KAAK,4BAA4B,YAAA;AAC7D,QAAI,qBAAqB;AACxB,gBAAU,IAAI,2BAA2B,mBAAmB;AAAA,IAC7D;AAEA,UAAM,WAAW,IAAI,kBAAkB;AAAA,MACtC,MAAM;AAAA,MACN,QAAQ,OAAO;AAAA,QACd,aAAa,EAAE,MAAM,cAAA;AAAA,MAAc;AAAA,IACpC,CACA;AACD,YAAQ,IAAI,SAAS;AAAA,MACpB,MAAM;AAAA,MACN,SAAS,OAAO;AAAA,QACf,aAAa;AAAA,MAAA;AAAA,IACd,CACA;AAED,WAAO;AAAA,MACN,OAAO;AAAA,MACP,OAAO,KAAK;AAAA,MACZ,GAAI,UAAU,OAAO,IAClB;AAAA,QACD,UAAU,IAAI,kBAAkB;AAAA,UAC/B,MAAM;AAAA,UACN,QAAQ,MAAM,OAAO,YAAY,SAAS;AAAA,QAAA,CAC1C;AAAA,MAAA,IAEA,CAAA;AAAA,IAAC;AAAA,EAEN;AACD;"}
|
|
1
|
+
{"version":3,"file":"GraphQlSchemaBuilder.js","sources":["../../../../../packages/engine-content-api/src/schema/GraphQlSchemaBuilder.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLFieldConfig,\n\tGraphQLInputObjectType,\n\tGraphQLNamedType,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchema,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { Model } from '@contember/schema'\nimport { MutationProvider } from './MutationProvider.js'\nimport { QueryProvider } from './QueryProvider.js'\nimport { ValidationQueriesProvider } from './ValidationQueriesProvider.js'\nimport { Context } from '../types.js'\nimport { ResultSchemaTypeProvider } from './ResultSchemaTypeProvider.js'\nimport { RefreshViewMutationProvider } from './RefreshViewMutationProvider.js'\n\ntype BuildArgs = {\n\tqueries?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\tmutations?: Map<string, GraphQLFieldConfig<any, Context, any>>\n\ttypes?: GraphQLNamedType[]\n}\n\nexport class GraphQlSchemaBuilder {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly queryProvider: QueryProvider,\n\t\tprivate readonly validationQueriesProvider: ValidationQueriesProvider,\n\t\tprivate readonly mutationProvider: MutationProvider,\n\t\tprivate readonly resultSchemaTypeProvider: ResultSchemaTypeProvider,\n\t\tprivate readonly refreshViewMutationProvider: RefreshViewMutationProvider,\n\t) {}\n\n\tpublic build(args: BuildArgs = {}): GraphQLSchema {\n\t\treturn new GraphQLSchema(this.buildConfig(args))\n\t}\n\n\tprivate buildConfig(args: BuildArgs): GraphQLSchemaConfig {\n\t\tconst queries = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.queries)\n\t\tconst mutations = new Map<string, GraphQLFieldConfig<any, Context, any>>(args.mutations)\n\t\tfor (const entity of Object.values(this.schema.entities)) {\n\t\t\tconst queryFields = this.queryProvider.getQueries(entity)\n\t\t\tfor (const name in queryFields) {\n\t\t\t\tqueries.set(name, queryFields[name])\n\t\t\t}\n\t\t\tconst validationFields = this.validationQueriesProvider.getQueries(entity)\n\t\t\tfor (const name in validationFields) {\n\t\t\t\tqueries.set(name, validationFields[name])\n\t\t\t}\n\t\t\tconst mutationFields = this.mutationProvider.getMutations(entity)\n\t\t\tfor (const name in mutationFields) {\n\t\t\t\tmutations.set(name, mutationFields[name])\n\t\t\t}\n\t\t}\n\n\t\tif (queries.size > 0) {\n\t\t\tconst queryTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'QueryTransaction',\n\t\t\t\tfields: Object.fromEntries(queries),\n\t\t\t})\n\t\t\tqueries.set('transaction', {\n\t\t\t\ttype: queryTransactionType,\n\t\t\t\tresolve: async (parent, args, context: Context, info) => {\n\t\t\t\t\treturn context.timer(`GraphQL.query.${info.fieldName}`, () => context.executionContainer.readResolver.resolveTransaction(info))\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst queryObjectType = new GraphQLObjectType({\n\t\t\tname: 'Query',\n\t\t\tfields: () => Object.fromEntries(queries),\n\t\t})\n\t\tif (mutations.size > 0) {\n\t\t\tconst mutationTransactionOptions = new GraphQLInputObjectType({\n\t\t\t\tname: 'MutationTransactionOptions',\n\t\t\t\tfields: {\n\t\t\t\t\tdeferForeignKeyConstraints: { type: GraphQLBoolean },\n\t\t\t\t\tdeferUniqueConstraints: { type: GraphQLBoolean },\n\t\t\t\t},\n\t\t\t})\n\t\t\tconst mutationTransactionType = new GraphQLObjectType({\n\t\t\t\tname: 'MutationTransaction',\n\t\t\t\tfields: {\n\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\terrorMessage: { type: GraphQLString },\n\t\t\t\t\terrors: { type: this.resultSchemaTypeProvider.errorListResultType },\n\t\t\t\t\tvalidation: {\n\t\t\t\t\t\ttype: new GraphQLNonNull(this.resultSchemaTypeProvider.validationResultType),\n\t\t\t\t\t},\n\t\t\t\t\t...Object.fromEntries(mutations),\n\t\t\t\t\tquery: {\n\t\t\t\t\t\ttype: queryObjectType,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('transaction', {\n\t\t\t\targs: {\n\t\t\t\t\toptions: {\n\t\t\t\t\t\ttype: mutationTransactionOptions,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\tmutationTransactionType,\n\t\t\t\t),\n\t\t\t\tresolve: async (\n\t\t\t\t\tparent,\n\t\t\t\t\targs: { options?: { deferForeignKeyConstraints?: boolean; deferUniqueConstraints?: boolean } },\n\t\t\t\t\tcontext: Context,\n\t\t\t\t\tinfo,\n\t\t\t\t) => {\n\t\t\t\t\treturn context.timer(`GraphQL.mutation.${info.fieldName}`, () =>\n\t\t\t\t\t\tcontext.executionContainer.mutationResolver.resolveTransaction(info, {\n\t\t\t\t\t\t\tdeferForeignKeyConstraints: args.options?.deferForeignKeyConstraints ?? false,\n\t\t\t\t\t\t\tdeferUniqueConstraints: args.options?.deferUniqueConstraints ?? false,\n\t\t\t\t\t\t}))\n\t\t\t\t},\n\t\t\t})\n\t\t\tmutations.set('query', {\n\t\t\t\ttype: new GraphQLNonNull(queryObjectType),\n\t\t\t\tresolve: (parent, args, context: Context, info) => context.executionContainer.readResolver.resolveQuery(info),\n\t\t\t})\n\t\t}\n\n\t\tconst refreshViewMutation = this.refreshViewMutationProvider.getMutation()\n\t\tif (refreshViewMutation) {\n\t\t\tmutations.set('refreshMaterializedView', refreshViewMutation)\n\t\t}\n\n\t\tconst infoType = new GraphQLObjectType({\n\t\t\tname: 'Info',\n\t\t\tfields: () => ({\n\t\t\t\tdescription: { type: GraphQLString },\n\t\t\t}),\n\t\t})\n\t\tqueries.set('_info', {\n\t\t\ttype: infoType,\n\t\t\tresolve: () => ({\n\t\t\t\tdescription: 'TODO',\n\t\t\t}),\n\t\t})\n\n\t\treturn {\n\t\t\tquery: queryObjectType,\n\t\t\ttypes: args.types,\n\t\t\t...(mutations.size > 0\n\t\t\t\t? {\n\t\t\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\t\t\tname: 'Mutation',\n\t\t\t\t\t\tfields: () => Object.fromEntries(mutations),\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n}\n"],"names":["args"],"mappings":";AAyBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,eACA,2BACA,kBACA,0BACA,6BAChB;AANgB,SAAA,SA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