@contember/binding 1.1.0-alpha.12 → 1.1.0-alpha.14
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/BindingError.js +4 -1
- package/dist/development/BindingError.js.map +1 -1
- package/dist/development/accessorPropagation/AccessorProvider.js +20 -7
- package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.js +7 -2
- package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsProvider.js +13 -5
- package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyContext.js +3 -1
- package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyProvider.js +13 -5
- package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +55 -17
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdContext.js +3 -1
- package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdProvider.js +13 -5
- package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/development/accessorPropagation/useBindingOperations.js +3 -1
- package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/development/accessorPropagation/useEntity.js +7 -2
- package/dist/development/accessorPropagation/useEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityKey.js +6 -2
- package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityList.js +11 -3
- package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTree.js +7 -2
- package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTree.js +7 -2
- package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +27 -16
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEnvironment.js +3 -1
- package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.js +7 -2
- package/dist/development/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/development/accessorPropagation/useField.js +11 -3
- package/dist/development/accessorPropagation/useField.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityByKey.js +3 -1
- package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js +7 -2
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntitySubTree.js +7 -2
- package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetTreeFilters.js +3 -1
- package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/development/accessorPropagation/useHasEntity.js +3 -1
- package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/development/accessorPropagation/usePersist.js +3 -1
- package/dist/development/accessorPropagation/usePersist.js.map +1 -1
- package/dist/development/accessorPropagation/useTreeRootId.js +3 -1
- package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +84 -44
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/addEntityAtIndex.js +3 -1
- package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/development/accessorSorting/errors.js +6 -2
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorSorting/moveEntity.js +4 -1
- package/dist/development/accessorSorting/moveEntity.js.map +1 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js +3 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/development/accessorSorting/sortEntities.js +3 -1
- package/dist/development/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/accessorSorting/useSortedEntities.js +61 -23
- package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +45 -14
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js +3 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/development/accessorTree/DirtinessContext.js +3 -1
- package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/development/accessorTree/MutationStateContext.js +3 -1
- package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +8 -2
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js +3 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/development/accessorTree/metadataToRequestError.js +3 -1
- package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/development/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js +3 -1
- package/dist/development/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/accessorTree/useDirtinessState.js +3 -1
- package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/development/accessorTree/useMutationState.js +3 -1
- package/dist/development/accessorTree/useMutationState.js.map +1 -1
- package/dist/development/accessors/EntityAccessor.js +16 -6
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/accessors/EntityListAccessor.js +3 -1
- package/dist/development/accessors/EntityListAccessor.js.map +1 -1
- package/dist/development/accessors/ErrorAccessor.js +3 -1
- package/dist/development/accessors/ErrorAccessor.js.map +1 -1
- package/dist/development/accessors/FieldAccessor.js +3 -1
- package/dist/development/accessors/FieldAccessor.js.map +1 -1
- package/dist/development/accessors/TreeRootAccessor.js +3 -1
- package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/development/bindingTypes.js +5 -1
- package/dist/development/bindingTypes.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +3 -1
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/Config.js +3 -1
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.js +42 -14
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/DirtinessTracker.js +3 -1
- package/dist/development/core/DirtinessTracker.js.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.js +12 -4
- package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/development/core/EventManager.js +21 -7
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/IncrementalMarkerBuilder.js +35 -7
- package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/development/core/MarkerComparator.js +7 -2
- package/dist/development/core/MarkerComparator.js.map +1 -1
- package/dist/development/core/MarkerMerger.js +51 -12
- package/dist/development/core/MarkerMerger.js.map +1 -1
- package/dist/development/core/MarkerTreeGenerator.js +11 -3
- package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +121 -25
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/QueryGenerator.js +40 -9
- package/dist/development/core/QueryGenerator.js.map +1 -1
- package/dist/development/core/RealmKeyGenerator.js +12 -3
- package/dist/development/core/RealmKeyGenerator.js.map +1 -1
- package/dist/development/core/RequestResponseNormalizer.js +3 -1
- package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/development/core/StateInitializer.js +89 -23
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js +21 -4
- package/dist/development/core/TreeAugmenter.js.map +1 -1
- package/dist/development/core/TreeFilterGenerator.js +8 -2
- package/dist/development/core/TreeFilterGenerator.js.map +1 -1
- package/dist/development/core/TreeParameterMerger.js +25 -7
- package/dist/development/core/TreeParameterMerger.js.map +1 -1
- package/dist/development/core/TreeStore.js +20 -4
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/VariableInputTransformer.js +3 -1
- package/dist/development/core/VariableInputTransformer.js.map +1 -1
- package/dist/development/core/exceptions/ErrorLocator.js +11 -3
- package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/development/core/exceptions/LocalizedBindingError.js +3 -1
- package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/development/core/exceptions/MarkerSugarer.js +8 -2
- package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js +3 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js +3 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.js +45 -14
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/FieldOperations.js +22 -8
- package/dist/development/core/operations/FieldOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +22 -9
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.js +6 -2
- package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js +3 -1
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/core/schema/Schema.js +3 -1
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/core/schema/SchemaLoader.js +3 -1
- package/dist/development/core/schema/SchemaLoader.js.map +1 -1
- package/dist/development/core/schema/SchemaPreprocessor.js +3 -1
- package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/development/core/state/StateIterator.js +3 -1
- package/dist/development/core/state/StateIterator.js.map +1 -1
- package/dist/development/core/state/getEntityMarker.js +3 -1
- package/dist/development/core/state/getEntityMarker.js.map +1 -1
- package/dist/development/core/utils/getCombinedSignal.js +3 -1
- package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/development/coreComponents/Component.js +3 -1
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/DataBindingProvider.js +13 -4
- package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/coreComponents/Entity.js +16 -6
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.js +21 -9
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +26 -9
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +37 -14
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.js +10 -4
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.js +25 -9
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.js +25 -9
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +7 -3
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/dao/Environment.js +3 -1
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/TreeNodeEnvironmentFactory.js +10 -3
- package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/development/dao/VariableFieldValue.js +3 -1
- package/dist/development/dao/VariableFieldValue.js.map +1 -1
- package/dist/development/entityEvents/useDerivedField.js +25 -17
- package/dist/development/entityEvents/useDerivedField.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforePersist.js +3 -1
- package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforeUpdate.js +3 -1
- package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/development/entityEvents/useEntityEvent.js +16 -8
- package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistError.js +3 -1
- package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistSuccess.js +3 -1
- package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/development/entityEvents/useOnConnectionUpdate.js +3 -1
- package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +46 -13
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/EntityView.js +7 -3
- package/dist/development/helperComponents/EntityView.js.map +1 -1
- package/dist/development/helperComponents/FieldView.js +22 -8
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/If.js +57 -19
- package/dist/development/helperComponents/If.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +9 -3
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +17 -6
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js +3 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +3 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/development/helperComponents/helpers/evaluateCondition.js +3 -1
- package/dist/development/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/development/index.js +225 -106
- package/dist/development/markers/EntityFieldMarkersContainer.js +3 -1
- package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +3 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js +3 -1
- package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js +3 -1
- package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/development/markers/FieldMarker.js +3 -1
- package/dist/development/markers/FieldMarker.js.map +1 -1
- package/dist/development/markers/HasManyRelationMarker.js +3 -1
- package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/development/markers/HasOneRelationMarker.js +3 -1
- package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/development/markers/MarkerTreeRoot.js +3 -1
- package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/development/markers/ParentEntityMarker.js +3 -1
- package/dist/development/markers/ParentEntityMarker.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js +3 -1
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/queryLanguage/CacheStore.js +3 -1
- package/dist/development/queryLanguage/CacheStore.js.map +1 -1
- package/dist/development/queryLanguage/MarkerFactory.js +115 -23
- package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js +114 -79
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +72 -19
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguageError.js +3 -1
- package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/development/queryLanguage/tokenList.js +5 -1
- package/dist/development/queryLanguage/tokenList.js.map +1 -1
- package/dist/development/structures/BijectiveIndexedMap.js +3 -1
- package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/development/structures/LRUCache.js +3 -1
- package/dist/development/structures/LRUCache.js.map +1 -1
- package/dist/development/structures/WeakIdCache.js +3 -1
- package/dist/development/structures/WeakIdCache.js.map +1 -1
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/development/treeParameters/EntityCreationParameters.js +3 -1
- package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/development/treeParameters/EntityListPreferences.js +3 -1
- package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/development/treeParameters/EventListenersStore.js +3 -1
- package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/development/treeParameters/LeafField.js +3 -1
- package/dist/development/treeParameters/LeafField.js.map +1 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js +3 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/development/treeParameters/Relation.js +3 -1
- package/dist/development/treeParameters/Relation.js.map +1 -1
- package/dist/development/utils/Hashing.js +3 -1
- package/dist/development/utils/Hashing.js.map +1 -1
- package/dist/development/utils/assert.js +3 -1
- package/dist/development/utils/assert.js.map +1 -1
- package/dist/development/utils/assertNever.js +6 -2
- package/dist/development/utils/assertNever.js.map +1 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +3 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/development/utils/isEmptyObject.js +3 -1
- package/dist/development/utils/isEmptyObject.js.map +1 -1
- package/dist/development/utils/ucfirst.js +3 -1
- package/dist/development/utils/ucfirst.js.map +1 -1
- package/dist/production/BindingError.js +4 -1
- package/dist/production/BindingError.js.map +1 -1
- package/dist/production/accessorPropagation/AccessorProvider.js +11 -7
- package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.js +7 -2
- package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsProvider.js +8 -5
- package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyContext.js +3 -1
- package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyProvider.js +8 -5
- package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js +42 -17
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdContext.js +3 -1
- package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdProvider.js +8 -5
- package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
- package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/production/accessorPropagation/useBindingOperations.js +3 -1
- package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
- package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/production/accessorPropagation/useEntity.js +7 -2
- package/dist/production/accessorPropagation/useEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityKey.js +6 -2
- package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityList.js +11 -3
- package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTree.js +7 -2
- package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
- package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTree.js +7 -2
- package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTreeParameters.js +27 -16
- package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEnvironment.js +3 -1
- package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.js +7 -2
- package/dist/production/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/production/accessorPropagation/useField.js +11 -3
- package/dist/production/accessorPropagation/useField.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityByKey.js +3 -1
- package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityListSubTree.js +7 -2
- package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntitySubTree.js +7 -2
- package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetTreeFilters.js +3 -1
- package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/production/accessorPropagation/useHasEntity.js +3 -1
- package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/production/accessorPropagation/usePersist.js +3 -1
- package/dist/production/accessorPropagation/usePersist.js.map +1 -1
- package/dist/production/accessorPropagation/useTreeRootId.js +3 -1
- package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +55 -44
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/accessorSorting/addEntityAtIndex.js +3 -1
- package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/production/accessorSorting/errors.js +6 -2
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorSorting/moveEntity.js +4 -1
- package/dist/production/accessorSorting/moveEntity.js.map +1 -1
- package/dist/production/accessorSorting/repairEntitiesOrder.js +3 -1
- package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/production/accessorSorting/sortEntities.js +3 -1
- package/dist/production/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/accessorSorting/useSortedEntities.js +61 -23
- package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/production/accessorTree/AccessorTree.js +24 -14
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js +3 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/production/accessorTree/DirtinessContext.js +3 -1
- package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/production/accessorTree/MutationStateContext.js +3 -1
- package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +8 -2
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js +3 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/production/accessorTree/metadataToRequestError.js +3 -1
- package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/production/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js +3 -1
- package/dist/production/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/accessorTree/useDirtinessState.js +3 -1
- package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/production/accessorTree/useMutationState.js +3 -1
- package/dist/production/accessorTree/useMutationState.js.map +1 -1
- package/dist/production/accessors/EntityAccessor.js +16 -6
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js +3 -1
- package/dist/production/accessors/EntityListAccessor.js.map +1 -1
- package/dist/production/accessors/ErrorAccessor.js +3 -1
- package/dist/production/accessors/ErrorAccessor.js.map +1 -1
- package/dist/production/accessors/FieldAccessor.js +3 -1
- package/dist/production/accessors/FieldAccessor.js.map +1 -1
- package/dist/production/accessors/TreeRootAccessor.js +3 -1
- package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/production/bindingTypes.js +5 -1
- package/dist/production/bindingTypes.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.js +3 -1
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/Config.js +3 -1
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.js +42 -14
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/DirtinessTracker.js +3 -1
- package/dist/production/core/DirtinessTracker.js.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.js +12 -4
- package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/production/core/EventManager.js +9 -3
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/IncrementalMarkerBuilder.js +35 -7
- package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/production/core/MarkerComparator.js +7 -2
- package/dist/production/core/MarkerComparator.js.map +1 -1
- package/dist/production/core/MarkerMerger.js +51 -12
- package/dist/production/core/MarkerMerger.js.map +1 -1
- package/dist/production/core/MarkerTreeGenerator.js +11 -3
- package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/core/MutationGenerator.js +121 -25
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/QueryGenerator.js +40 -9
- package/dist/production/core/QueryGenerator.js.map +1 -1
- package/dist/production/core/RealmKeyGenerator.js +12 -3
- package/dist/production/core/RealmKeyGenerator.js.map +1 -1
- package/dist/production/core/RequestResponseNormalizer.js +3 -1
- package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/production/core/StateInitializer.js +89 -23
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js +21 -4
- package/dist/production/core/TreeAugmenter.js.map +1 -1
- package/dist/production/core/TreeFilterGenerator.js +8 -2
- package/dist/production/core/TreeFilterGenerator.js.map +1 -1
- package/dist/production/core/TreeParameterMerger.js +25 -7
- package/dist/production/core/TreeParameterMerger.js.map +1 -1
- package/dist/production/core/TreeStore.js +20 -4
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/VariableInputTransformer.js +3 -1
- package/dist/production/core/VariableInputTransformer.js.map +1 -1
- package/dist/production/core/exceptions/ErrorLocator.js +11 -3
- package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/production/core/exceptions/LocalizedBindingError.js +3 -1
- package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/production/core/exceptions/MarkerSugarer.js +8 -2
- package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js +3 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js +3 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.js +45 -14
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/FieldOperations.js +11 -3
- package/dist/production/core/operations/FieldOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js +22 -9
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.js +6 -2
- package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js +3 -1
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/core/schema/Schema.js +3 -1
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/core/schema/SchemaLoader.js +3 -1
- package/dist/production/core/schema/SchemaLoader.js.map +1 -1
- package/dist/production/core/schema/SchemaPreprocessor.js +3 -1
- package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/production/core/state/StateIterator.js +3 -1
- package/dist/production/core/state/StateIterator.js.map +1 -1
- package/dist/production/core/state/getEntityMarker.js +3 -1
- package/dist/production/core/state/getEntityMarker.js.map +1 -1
- package/dist/production/core/utils/getCombinedSignal.js +3 -1
- package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/production/coreComponents/Component.js +3 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/coreComponents/DataBindingProvider.js +8 -4
- package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/coreComponents/Entity.js +11 -6
- package/dist/production/coreComponents/Entity.js.map +1 -1
- package/dist/production/coreComponents/EntityList.js +16 -9
- package/dist/production/coreComponents/EntityList.js.map +1 -1
- package/dist/production/coreComponents/EntityListSubTree.js +12 -8
- package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/coreComponents/EntitySubTree.js +19 -13
- package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/coreComponents/Field.js +10 -4
- package/dist/production/coreComponents/Field.js.map +1 -1
- package/dist/production/coreComponents/HasMany.js +11 -8
- package/dist/production/coreComponents/HasMany.js.map +1 -1
- package/dist/production/coreComponents/HasOne.js +11 -8
- package/dist/production/coreComponents/HasOne.js.map +1 -1
- package/dist/production/coreComponents/ParentEntity.js +7 -3
- package/dist/production/coreComponents/ParentEntity.js.map +1 -1
- package/dist/production/dao/Environment.js +3 -1
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/TreeNodeEnvironmentFactory.js +10 -3
- package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/production/dao/VariableFieldValue.js +3 -1
- package/dist/production/dao/VariableFieldValue.js.map +1 -1
- package/dist/production/entityEvents/useDerivedField.js +25 -17
- package/dist/production/entityEvents/useDerivedField.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforePersist.js +3 -1
- package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforeUpdate.js +3 -1
- package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/production/entityEvents/useEntityEvent.js +16 -8
- package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistError.js +3 -1
- package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistSuccess.js +3 -1
- package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/production/entityEvents/useOnConnectionUpdate.js +3 -1
- package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/production/helperComponents/DeferredSubTrees.js +37 -13
- package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/helperComponents/EntityView.js +7 -3
- package/dist/production/helperComponents/EntityView.js.map +1 -1
- package/dist/production/helperComponents/FieldView.js +17 -8
- package/dist/production/helperComponents/FieldView.js.map +1 -1
- package/dist/production/helperComponents/If.js +44 -19
- package/dist/production/helperComponents/If.js.map +1 -1
- package/dist/production/helperComponents/StaticRender.js +9 -3
- package/dist/production/helperComponents/StaticRender.js.map +1 -1
- package/dist/production/helperComponents/SugaredField.js +6 -4
- package/dist/production/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js +3 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +3 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/production/helperComponents/helpers/evaluateCondition.js +3 -1
- package/dist/production/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/production/index.js +225 -106
- package/dist/production/markers/EntityFieldMarkersContainer.js +3 -1
- package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/production/markers/EntityFieldsWithHoistablesMarker.js +3 -1
- package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js +3 -1
- package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js +3 -1
- package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/production/markers/FieldMarker.js +3 -1
- package/dist/production/markers/FieldMarker.js.map +1 -1
- package/dist/production/markers/HasManyRelationMarker.js +3 -1
- package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/production/markers/HasOneRelationMarker.js +3 -1
- package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/production/markers/MarkerTreeRoot.js +3 -1
- package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/production/markers/ParentEntityMarker.js +3 -1
- package/dist/production/markers/ParentEntityMarker.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js +3 -1
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/queryLanguage/CacheStore.js +3 -1
- package/dist/production/queryLanguage/CacheStore.js.map +1 -1
- package/dist/production/queryLanguage/MarkerFactory.js +115 -23
- package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js +114 -79
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js +72 -19
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguageError.js +3 -1
- package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/production/queryLanguage/tokenList.js +5 -1
- package/dist/production/queryLanguage/tokenList.js.map +1 -1
- package/dist/production/structures/BijectiveIndexedMap.js +3 -1
- package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/production/structures/LRUCache.js +3 -1
- package/dist/production/structures/LRUCache.js.map +1 -1
- package/dist/production/structures/WeakIdCache.js +3 -1
- package/dist/production/structures/WeakIdCache.js.map +1 -1
- package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
- package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/production/treeParameters/EntityCreationParameters.js +3 -1
- package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/production/treeParameters/EntityListPreferences.js +3 -1
- package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/production/treeParameters/EventListenersStore.js +3 -1
- package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/production/treeParameters/LeafField.js +3 -1
- package/dist/production/treeParameters/LeafField.js.map +1 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js +3 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/production/treeParameters/Relation.js +3 -1
- package/dist/production/treeParameters/Relation.js.map +1 -1
- package/dist/production/utils/Hashing.js +3 -1
- package/dist/production/utils/Hashing.js.map +1 -1
- package/dist/production/utils/assert.js +3 -1
- package/dist/production/utils/assert.js.map +1 -1
- package/dist/production/utils/assertNever.js +6 -2
- package/dist/production/utils/assertNever.js.map +1 -1
- package/dist/production/utils/generateEnumerabilityPreventingEntropy.js +3 -1
- package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/production/utils/isEmptyObject.js +3 -1
- package/dist/production/utils/isEmptyObject.js.map +1 -1
- package/dist/production/utils/ucfirst.js +3 -1
- package/dist/production/utils/ucfirst.js.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -31,7 +31,10 @@ class MarkerComparator {
|
|
|
31
31
|
candidateMarker
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
|
-
throw new LocalizedBindingError(
|
|
34
|
+
throw new LocalizedBindingError(
|
|
35
|
+
`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. Check that all relation parameters are the same.`,
|
|
36
|
+
[candidateMarker]
|
|
37
|
+
);
|
|
35
38
|
}
|
|
36
39
|
assertNever();
|
|
37
40
|
}
|
|
@@ -69,5 +72,7 @@ class MarkerComparator {
|
|
|
69
72
|
return true;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
export {
|
|
75
|
+
export {
|
|
76
|
+
MarkerComparator
|
|
77
|
+
};
|
|
73
78
|
//# sourceMappingURL=MarkerComparator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerComparator.js","sources":["../../../src/core/MarkerComparator.ts"],"sourcesContent":["import { PRIMARY_KEY_NAME, TYPENAME_KEY_NAME } from '../bindingTypes'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { assertNever } from '../utils'\nimport { LocalizedBindingError } from './exceptions'\n\nexport class MarkerComparator {\n\tpublic static isSubTreeSubsetOf(\n\t\tcandidate: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t\tsuperset: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): boolean {\n\t\tif (candidate.placeholderName !== superset.placeholderName) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.isSubsetOf(candidate.fields, superset.fields)\n\t}\n\n\tpublic static assertEntityMarkersSubsetOf(\n\t\tcandidate: EntityFieldMarkersContainer,\n\t\tsuperset: EntityFieldMarkersContainer,\n\t) {\n\t\tthis.assertSubsetOf(candidate, superset)\n\t}\n\n\tprivate static assertSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer) {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\t\tif (candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new LocalizedBindingError(`The field '${candidateMarker.fieldName}' is missing.`, [candidateMarker])\n\t\t\t\t}\n\t\t\t\tif (candidateMarker instanceof HasOneRelationMarker || candidateMarker instanceof HasManyRelationMarker) {\n\t\t\t\t\tconst differentPlaceholders = superset.placeholders.get(candidateMarker.parameters.field)\n\n\t\t\t\t\tif (differentPlaceholders === undefined) {\n\t\t\t\t\t\tthrow new LocalizedBindingError(`The relation '${candidateMarker.parameters.field}' is missing.`, [\n\t\t\t\t\t\t\tcandidateMarker,\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\t// TODO be more specific\n\t\t\t\t\tthrow new LocalizedBindingError(\n\t\t\t\t\t\t`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. ` +\n\t\t\t\t\t\t\t`Check that all relation parameters are the same.`,\n\t\t\t\t\t\t[candidateMarker],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tassertNever(candidateMarker)\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t(candidateMarker instanceof HasOneRelationMarker && fromSuperset instanceof HasOneRelationMarker) ||\n\t\t\t\t\t(candidateMarker instanceof HasManyRelationMarker && fromSuperset instanceof HasManyRelationMarker)\n\t\t\t\t) {\n\t\t\t\t\tthis.assertSubsetOf(candidateMarker.fields, fromSuperset.fields)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof LocalizedBindingError) {\n\t\t\t\t\tthrow e.nestedIn(candidateMarker)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static isSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer): boolean {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (\n\t\t\t\t\tcandidateMarker instanceof FieldMarker &&\n\t\t\t\t\t(candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME)\n\t\t\t\t) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker || fromSuperset instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!this.isSubsetOf(candidateMarker.fields, fromSuperset.fields)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t//private static assertAreMarkersSubsetOf(): {}\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,iBAAiB;AAAA,
|
|
1
|
+
{"version":3,"file":"MarkerComparator.js","sources":["../../../src/core/MarkerComparator.ts"],"sourcesContent":["import { PRIMARY_KEY_NAME, TYPENAME_KEY_NAME } from '../bindingTypes'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { assertNever } from '../utils'\nimport { LocalizedBindingError } from './exceptions'\n\nexport class MarkerComparator {\n\tpublic static isSubTreeSubsetOf(\n\t\tcandidate: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t\tsuperset: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): boolean {\n\t\tif (candidate.placeholderName !== superset.placeholderName) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.isSubsetOf(candidate.fields, superset.fields)\n\t}\n\n\tpublic static assertEntityMarkersSubsetOf(\n\t\tcandidate: EntityFieldMarkersContainer,\n\t\tsuperset: EntityFieldMarkersContainer,\n\t) {\n\t\tthis.assertSubsetOf(candidate, superset)\n\t}\n\n\tprivate static assertSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer) {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\t\tif (candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new LocalizedBindingError(`The field '${candidateMarker.fieldName}' is missing.`, [candidateMarker])\n\t\t\t\t}\n\t\t\t\tif (candidateMarker instanceof HasOneRelationMarker || candidateMarker instanceof HasManyRelationMarker) {\n\t\t\t\t\tconst differentPlaceholders = superset.placeholders.get(candidateMarker.parameters.field)\n\n\t\t\t\t\tif (differentPlaceholders === undefined) {\n\t\t\t\t\t\tthrow new LocalizedBindingError(`The relation '${candidateMarker.parameters.field}' is missing.`, [\n\t\t\t\t\t\t\tcandidateMarker,\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\t// TODO be more specific\n\t\t\t\t\tthrow new LocalizedBindingError(\n\t\t\t\t\t\t`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. ` +\n\t\t\t\t\t\t\t`Check that all relation parameters are the same.`,\n\t\t\t\t\t\t[candidateMarker],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tassertNever(candidateMarker)\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t(candidateMarker instanceof HasOneRelationMarker && fromSuperset instanceof HasOneRelationMarker) ||\n\t\t\t\t\t(candidateMarker instanceof HasManyRelationMarker && fromSuperset instanceof HasManyRelationMarker)\n\t\t\t\t) {\n\t\t\t\t\tthis.assertSubsetOf(candidateMarker.fields, fromSuperset.fields)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof LocalizedBindingError) {\n\t\t\t\t\tthrow e.nestedIn(candidateMarker)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static isSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer): boolean {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (\n\t\t\t\t\tcandidateMarker instanceof FieldMarker &&\n\t\t\t\t\t(candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME)\n\t\t\t\t) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker || fromSuperset instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!this.isSubsetOf(candidateMarker.fields, fromSuperset.fields)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t//private static assertAreMarkersSubsetOf(): {}\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,iBAAiB;AAAA,EAC7B,OAAc,kBACb,WACA,UACU;AACN,QAAA,UAAU,oBAAoB,SAAS,iBAAiB;AACpD,aAAA;AAAA,IACR;AACA,WAAO,KAAK,WAAW,UAAU,QAAQ,SAAS,MAAM;AAAA,EACzD;AAAA,EAEA,OAAc,4BACb,WACA,UACC;AACI,SAAA,eAAe,WAAW,QAAQ;AAAA,EACxC;AAAA,EAEA,OAAe,eAAe,WAAwC,UAAuC;AAC5G,eAAW,CAAC,iBAAiB,eAAe,KAAK,UAAU,SAAS;AACnE,YAAM,eAAe,SAAS,QAAQ,IAAI,eAAe;AAEzD,UAAI,iBAAiB,QAAW;AAC/B,YAAI,2BAA2B,aAAa;AAC3C,cAAI,gBAAgB,cAAc,oBAAoB,gBAAgB,cAAc,mBAAmB;AACtG;AAAA,UACD;AACA,gBAAM,IAAI,sBAAsB,cAAc,gBAAgB,0BAA0B,CAAC,eAAe,CAAC;AAAA,QAC1G;AACI,YAAA,2BAA2B,wBAAwB,2BAA2B,uBAAuB;AACxG,gBAAM,wBAAwB,SAAS,aAAa,IAAI,gBAAgB,WAAW,KAAK;AAExF,cAAI,0BAA0B,QAAW;AACxC,kBAAM,IAAI,sBAAsB,iBAAiB,gBAAgB,WAAW,sBAAsB;AAAA,cACjG;AAAA,YAAA,CACA;AAAA,UACF;AAEA,gBAAM,IAAI;AAAA,YACT,iBAAiB,gBAAgB,WAAW;AAAA,YAE5C,CAAC,eAAe;AAAA,UAAA;AAAA,QAElB;AACA,oBAA2B;AAAA,MAC5B;AACA,UAAI,2BAA2B,aAAa;AAC3C;AAAA,MACD;AACI,UAAA;AACH,YACE,2BAA2B,wBAAwB,wBAAwB,wBAC3E,2BAA2B,yBAAyB,wBAAwB,uBAC5E;AACD,eAAK,eAAe,gBAAgB,QAAQ,aAAa,MAAM;AAAA,QAChE;AAAA,eACQ;AACR,YAAI,aAAa,uBAAuB;AACjC,gBAAA,EAAE,SAAS,eAAe;AAAA,QACjC;AACM,cAAA;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAAA,EAEA,OAAe,WAAW,WAAwC,UAAgD;AACjH,eAAW,CAAC,iBAAiB,eAAe,KAAK,UAAU,SAAS;AACnE,YAAM,eAAe,SAAS,QAAQ,IAAI,eAAe;AAEzD,UAAI,iBAAiB,QAAW;AAC/B,YACC,2BAA2B,gBAC1B,gBAAgB,cAAc,oBAAoB,gBAAgB,cAAc,oBAChF;AACD;AAAA,QACD;AACO,eAAA;AAAA,MACR;AACI,UAAA,2BAA2B,eAAe,wBAAwB,aAAa;AAClF;AAAA,MACD;AACA,UAAI,CAAC,KAAK,WAAW,gBAAgB,QAAQ,aAAa,MAAM,GAAG;AAC3D,eAAA;AAAA,MACR;AAAA,IACD;AACO,WAAA;AAAA,EACR;AAGD;"}
|
|
@@ -49,13 +49,17 @@ class MarkerMerger {
|
|
|
49
49
|
if (fresh instanceof EntitySubTreeMarker) {
|
|
50
50
|
return this.mergeEntitySubTreeMarkers(original, fresh);
|
|
51
51
|
} else {
|
|
52
|
-
throw new BindingError(
|
|
52
|
+
throw new BindingError(
|
|
53
|
+
"MarkerTreeGenerator merging: EntitySubTreeMarker can only be merged with other entity sub trees."
|
|
54
|
+
);
|
|
53
55
|
}
|
|
54
56
|
} else if (original instanceof EntityListSubTreeMarker) {
|
|
55
57
|
if (fresh instanceof EntityListSubTreeMarker) {
|
|
56
58
|
return this.mergeEntityListSubTreeMarkers(original, fresh);
|
|
57
59
|
} else {
|
|
58
|
-
throw new BindingError(
|
|
60
|
+
throw new BindingError(
|
|
61
|
+
"MarkerTreeGenerator merging: EntityListSubTreeMarker can only be merged with other list sub trees."
|
|
62
|
+
);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
assertNever();
|
|
@@ -64,7 +68,10 @@ class MarkerMerger {
|
|
|
64
68
|
if (original === fresh) {
|
|
65
69
|
return original;
|
|
66
70
|
}
|
|
67
|
-
return new MarkerTreeRoot(
|
|
71
|
+
return new MarkerTreeRoot(
|
|
72
|
+
this.mergeEntityFields(original.subTrees, fresh.subTrees),
|
|
73
|
+
this.mergeSubTreePlaceholdersByAliases(original.placeholdersByAliases, fresh.placeholdersByAliases)
|
|
74
|
+
);
|
|
68
75
|
}
|
|
69
76
|
static mergeSubTreeMarkers(original, fresh) {
|
|
70
77
|
if (original === fresh) {
|
|
@@ -79,7 +86,10 @@ class MarkerMerger {
|
|
|
79
86
|
const newOriginal = new Map(original);
|
|
80
87
|
for (const [placeholderName, fromFresh] of fresh) {
|
|
81
88
|
const fromOriginal = newOriginal.get(placeholderName);
|
|
82
|
-
newOriginal.set(
|
|
89
|
+
newOriginal.set(
|
|
90
|
+
placeholderName,
|
|
91
|
+
fromOriginal === void 0 ? fromFresh : fromOriginal instanceof EntityListSubTreeMarker ? MarkerMerger.mergeEntityListSubTreeMarkers(fromOriginal, fromFresh) : MarkerMerger.mergeEntitySubTreeMarkers(fromOriginal, fromFresh)
|
|
92
|
+
);
|
|
83
93
|
}
|
|
84
94
|
return newOriginal;
|
|
85
95
|
}
|
|
@@ -104,7 +114,10 @@ class MarkerMerger {
|
|
|
104
114
|
const newOriginal = new Map(original);
|
|
105
115
|
for (const [placeholderName, freshMarker] of fresh) {
|
|
106
116
|
const markerFromOriginal = newOriginal.get(placeholderName);
|
|
107
|
-
newOriginal.set(
|
|
117
|
+
newOriginal.set(
|
|
118
|
+
placeholderName,
|
|
119
|
+
markerFromOriginal === void 0 ? freshMarker : this.mergeMarkers(markerFromOriginal, freshMarker)
|
|
120
|
+
);
|
|
108
121
|
}
|
|
109
122
|
return newOriginal;
|
|
110
123
|
}
|
|
@@ -157,31 +170,51 @@ class MarkerMerger {
|
|
|
157
170
|
if (original === fresh) {
|
|
158
171
|
return original;
|
|
159
172
|
}
|
|
160
|
-
return new EntityFieldMarkersContainer(
|
|
173
|
+
return new EntityFieldMarkersContainer(
|
|
174
|
+
original.hasAtLeastOneBearingField || fresh.hasAtLeastOneBearingField,
|
|
175
|
+
this.mergeEntityFields(original.markers, fresh.markers),
|
|
176
|
+
this.mergeEntityFieldPlaceholders(original.placeholders, fresh.placeholders)
|
|
177
|
+
);
|
|
161
178
|
}
|
|
162
179
|
static mergeHasOneRelationMarkers(original, fresh) {
|
|
163
180
|
if (original === fresh) {
|
|
164
181
|
return original;
|
|
165
182
|
}
|
|
166
|
-
return new HasOneRelationMarker(
|
|
183
|
+
return new HasOneRelationMarker(
|
|
184
|
+
TreeParameterMerger.mergeHasOneRelationsWithSamePlaceholders(original.parameters, fresh.parameters),
|
|
185
|
+
this.mergeEntityFieldsContainers(original.fields, fresh.fields),
|
|
186
|
+
this.mergeEnvironments(original.environment, fresh.environment)
|
|
187
|
+
);
|
|
167
188
|
}
|
|
168
189
|
static mergeHasManyRelationMarkers(original, fresh) {
|
|
169
190
|
if (original === fresh) {
|
|
170
191
|
return original;
|
|
171
192
|
}
|
|
172
|
-
return new HasManyRelationMarker(
|
|
193
|
+
return new HasManyRelationMarker(
|
|
194
|
+
TreeParameterMerger.mergeHasManyRelationsWithSamePlaceholders(original.parameters, fresh.parameters),
|
|
195
|
+
this.mergeEntityFieldsContainers(original.fields, fresh.fields),
|
|
196
|
+
this.mergeEnvironments(original.environment, fresh.environment)
|
|
197
|
+
);
|
|
173
198
|
}
|
|
174
199
|
static mergeEntitySubTreeMarkers(original, fresh) {
|
|
175
200
|
if (original === fresh) {
|
|
176
201
|
return original;
|
|
177
202
|
}
|
|
178
|
-
return new EntitySubTreeMarker(
|
|
203
|
+
return new EntitySubTreeMarker(
|
|
204
|
+
TreeParameterMerger.mergeEntitySubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),
|
|
205
|
+
this.mergeEntityFieldsContainers(original.fields, fresh.fields),
|
|
206
|
+
this.mergeEnvironments(original.environment, fresh.environment)
|
|
207
|
+
);
|
|
179
208
|
}
|
|
180
209
|
static mergeEntityListSubTreeMarkers(original, fresh) {
|
|
181
210
|
if (original === fresh) {
|
|
182
211
|
return original;
|
|
183
212
|
}
|
|
184
|
-
return new EntityListSubTreeMarker(
|
|
213
|
+
return new EntityListSubTreeMarker(
|
|
214
|
+
TreeParameterMerger.mergeEntityListSubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),
|
|
215
|
+
this.mergeEntityFieldsContainers(original.fields, fresh.fields),
|
|
216
|
+
this.mergeEnvironments(original.environment, fresh.environment)
|
|
217
|
+
);
|
|
185
218
|
}
|
|
186
219
|
static mergeFieldMarkers(original, fresh) {
|
|
187
220
|
if (original === fresh) {
|
|
@@ -194,7 +227,11 @@ class MarkerMerger {
|
|
|
194
227
|
}
|
|
195
228
|
static mergeInSystemFields(original) {
|
|
196
229
|
const primaryKey = new FieldMarker(PRIMARY_KEY_NAME, void 0, true);
|
|
197
|
-
const freshFields = new EntityFieldMarkersContainer(
|
|
230
|
+
const freshFields = new EntityFieldMarkersContainer(
|
|
231
|
+
false,
|
|
232
|
+
/* @__PURE__ */ new Map([[primaryKey.placeholderName, primaryKey]]),
|
|
233
|
+
/* @__PURE__ */ new Map([[PRIMARY_KEY_NAME, primaryKey.placeholderName]])
|
|
234
|
+
);
|
|
198
235
|
return original ? this.mergeEntityFieldsContainers(original, freshFields) : freshFields;
|
|
199
236
|
}
|
|
200
237
|
static mergeEnvironments(original, fresh) {
|
|
@@ -204,5 +241,7 @@ class MarkerMerger {
|
|
|
204
241
|
throw new BindingError(`Cannot combine a relation with a scalar field '${fieldName}'.`);
|
|
205
242
|
}
|
|
206
243
|
}
|
|
207
|
-
export {
|
|
244
|
+
export {
|
|
245
|
+
MarkerMerger
|
|
246
|
+
};
|
|
208
247
|
//# sourceMappingURL=MarkerMerger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerMerger.js","sources":["../../../src/core/MarkerMerger.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport type { Environment } from '../dao'\nimport {\n\tEntityFieldMarkers,\n\tEntityFieldMarkersContainer,\n\tEntityFieldPlaceholders,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n\tMeaningfulMarker,\n\tSubTreeMarkers,\n} from '../markers'\nimport type { Alias, FieldName, PlaceholderName } from '../treeParameters'\nimport { assertNever } from '../utils'\nimport { TreeParameterMerger } from './TreeParameterMerger'\n\nexport class MarkerMerger {\n\t// This method assumes their placeholder names are the same\n\tpublic static mergeMarkers(original: MeaningfulMarker, fresh: MeaningfulMarker): MeaningfulMarker {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original instanceof FieldMarker) {\n\t\t\tif (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.mergeFieldMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker || fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.fieldName)\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('Merging fields and sub trees is an undefined operation.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasOneRelationMarker) {\n\t\t\tif (fresh instanceof HasOneRelationMarker) {\n\t\t\t\treturn this.mergeHasOneRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasManyRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasManyRelationMarker) {\n\t\t\tif (fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.mergeHasManyRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof EntitySubTreeMarker) {\n\t\t\tif (fresh instanceof EntitySubTreeMarker) {\n\t\t\t\treturn this.mergeEntitySubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntitySubTreeMarker can only be merged with other entity sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (original instanceof EntityListSubTreeMarker) {\n\t\t\tif (fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\treturn this.mergeEntityListSubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntityListSubTreeMarker can only be merged with other list sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tassertNever(original)\n\t}\n\n\tpublic static mergeMarkerTreeRoots(original: MarkerTreeRoot, fresh: MarkerTreeRoot): MarkerTreeRoot {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new MarkerTreeRoot(\n\t\t\tthis.mergeEntityFields(original.subTrees, fresh.subTrees),\n\t\t\tthis.mergeSubTreePlaceholdersByAliases(original.placeholdersByAliases, fresh.placeholdersByAliases),\n\t\t)\n\t}\n\n\tpublic static mergeSubTreeMarkers(\n\t\toriginal: SubTreeMarkers | undefined,\n\t\tfresh: SubTreeMarkers | undefined,\n\t): SubTreeMarkers | undefined {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original === undefined) {\n\t\t\treturn fresh\n\t\t}\n\t\tif (fresh === undefined) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal = new Map(original)\n\n\t\tfor (const [placeholderName, fromFresh] of fresh) {\n\t\t\tconst fromOriginal = newOriginal.get(placeholderName)\n\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tfromOriginal === undefined\n\t\t\t\t\t? fromFresh\n\t\t\t\t\t: fromOriginal instanceof EntityListSubTreeMarker\n\t\t\t\t\t? MarkerMerger.mergeEntityListSubTreeMarkers(fromOriginal, fromFresh as EntityListSubTreeMarker)\n\t\t\t\t\t: MarkerMerger.mergeEntitySubTreeMarkers(fromOriginal, fromFresh as EntitySubTreeMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeSubTreePlaceholdersByAliases(\n\t\toriginal: Map<Alias, PlaceholderName>,\n\t\tfresh: Map<Alias, PlaceholderName>,\n\t) {\n\t\tconst newOriginalAliases = new Map(original)\n\t\tfor (const [alias, placeholder] of fresh) {\n\t\t\tconst fromOriginal = newOriginalAliases.get(alias)\n\t\t\tif (fromOriginal === undefined) {\n\t\t\t\tnewOriginalAliases.set(alias, placeholder)\n\t\t\t} else if (fromOriginal === placeholder) {\n\t\t\t\t// Do nothing\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(`Illegal subTree alias '${alias}' points to distinct subTrees.`)\n\t\t\t}\n\t\t}\n\t\treturn newOriginalAliases\n\t}\n\n\tpublic static mergeEntityFields(original: SubTreeMarkers, fresh: SubTreeMarkers): SubTreeMarkers\n\tpublic static mergeEntityFields(original: EntityFieldMarkers, fresh: EntityFieldMarkers): EntityFieldMarkers\n\tpublic static mergeEntityFields(\n\t\toriginal: Map<PlaceholderName, MeaningfulMarker>,\n\t\tfresh: Map<PlaceholderName, MeaningfulMarker>,\n\t): Map<PlaceholderName, MeaningfulMarker> {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: Map<PlaceholderName, MeaningfulMarker> = new Map(original)\n\t\tfor (const [placeholderName, freshMarker] of fresh) {\n\t\t\tconst markerFromOriginal = newOriginal.get(placeholderName)\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tmarkerFromOriginal === undefined ? freshMarker : this.mergeMarkers(markerFromOriginal, freshMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldPlaceholders(\n\t\toriginal: EntityFieldPlaceholders,\n\t\tfresh: EntityFieldPlaceholders,\n\t): EntityFieldPlaceholders {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: EntityFieldPlaceholders = new Map(original)\n\t\tfor (const [fieldName, freshPlaceholders] of fresh) {\n\t\t\tconst placeholderFromOriginal = newOriginal.get(fieldName)\n\n\t\t\tif (placeholderFromOriginal === undefined) {\n\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t} else if (placeholderFromOriginal instanceof Set) {\n\t\t\t\tconst combinedSet = new Set(placeholderFromOriginal)\n\t\t\t\tif (freshPlaceholders instanceof Set) {\n\t\t\t\t\tfor (const freshPlaceholder of freshPlaceholders) {\n\t\t\t\t\t\tcombinedSet.add(freshPlaceholder)\n\t\t\t\t\t}\n\t\t\t\t} else if (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tcombinedSet.add(freshPlaceholders)\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t} else if (typeof placeholderFromOriginal === 'string') {\n\t\t\t\tif (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tif (placeholderFromOriginal === freshPlaceholders) {\n\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOriginal.set(fieldName, new Set([placeholderFromOriginal, freshPlaceholders]))\n\t\t\t\t\t}\n\t\t\t\t} else if (freshPlaceholders instanceof Set) {\n\t\t\t\t\tif (freshPlaceholders.has(placeholderFromOriginal)) {\n\t\t\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst combinedSet = new Set(freshPlaceholders)\n\t\t\t\t\t\tcombinedSet.add(placeholderFromOriginal)\n\t\t\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tassertNever(placeholderFromOriginal)\n\t\t\t}\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldsContainers(\n\t\toriginal: EntityFieldMarkersContainer,\n\t\tfresh: EntityFieldMarkersContainer,\n\t): EntityFieldMarkersContainer {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityFieldMarkersContainer(\n\t\t\toriginal.hasAtLeastOneBearingField || fresh.hasAtLeastOneBearingField,\n\t\t\tthis.mergeEntityFields(original.markers, fresh.markers),\n\t\t\tthis.mergeEntityFieldPlaceholders(original.placeholders, fresh.placeholders),\n\t\t)\n\t}\n\n\tpublic static mergeHasOneRelationMarkers(original: HasOneRelationMarker, fresh: HasOneRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasOneRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasOneRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeHasManyRelationMarkers(original: HasManyRelationMarker, fresh: HasManyRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasManyRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasManyRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntitySubTreeMarkers(original: EntitySubTreeMarker, fresh: EntitySubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntitySubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntitySubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntityListSubTreeMarkers(original: EntityListSubTreeMarker, fresh: EntityListSubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityListSubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntityListSubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeFieldMarkers(original: FieldMarker, fresh: FieldMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original.isNonbearing !== fresh.isNonbearing && original.isNonbearing) {\n\t\t\t// If only one isNonbearing, then the whole field is bearing\n\t\t\treturn fresh\n\t\t}\n\t\t// TODO warn in case of defaultValue differences\n\t\treturn original\n\t}\n\n\tpublic static mergeInSystemFields(original: EntityFieldMarkersContainer | undefined): EntityFieldMarkersContainer {\n\t\tconst primaryKey = new FieldMarker(PRIMARY_KEY_NAME, undefined, true)\n\t\t// We could potentially share this instance for all fields. Maybe sometime later.\n\t\tconst freshFields = new EntityFieldMarkersContainer(\n\t\t\tfalse,\n\t\t\tnew Map([[primaryKey.placeholderName, primaryKey]]),\n\t\t\tnew Map([[PRIMARY_KEY_NAME, primaryKey.placeholderName]]),\n\t\t)\n\t\treturn original ? this.mergeEntityFieldsContainers(original, freshFields) : freshFields\n\t}\n\n\tpublic static mergeEnvironments(original: Environment, fresh: Environment): Environment {\n\t\treturn original.merge(fresh)\n\t}\n\n\tprivate static rejectRelationScalarCombo(fieldName: FieldName): never {\n\t\tthrow new BindingError(`Cannot combine a relation with a scalar field '${fieldName}'.`)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAoBO,MAAM,aAAa;AAAA,SAEX,aAAa,UAA4B,OAA2C;AACjG,QAAI,aAAa,OAAO;AAChB,aAAA;AAAA,IACR;AACA,QAAI,oBAAoB,aAAa;AACpC,UAAI,iBAAiB,aAAa;AAC1B,eAAA,KAAK,kBAAkB,UAAU,KAAK;AAAA,MACnC,WAAA,iBAAiB,wBAAwB,iBAAiB,uBAAuB;AACpF,eAAA,KAAK,0BAA0B,SAAS,SAAS;AAAA,MAC9C,WAAA,iBAAiB,uBAAuB,iBAAiB,yBAAyB;AACtF,cAAA,IAAI,aAAa,yDAAyD;AAAA,MACjF;AACA,kBAAiB;AAAA,IAAA,WAC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AAY,kBAAkB,QAAW,IAAI;AAE9D,UAAA,cAAc,IAAI,4BACvB,2BACI,IAAI,CAAC,CAAC,WAAW,iBAAiB,UAAU,CAAC,CAAC,GAC9C,oBAAA,IAAI,CAAC,CAAC,kBAAkB,WAAW,eAAe,CAAC,CAAC,CACzD;AACA,WAAO,WAAW,KAAK,4BAA4B,UAAU,WAAW,IAAI;AAAA,EAC7E;AAAA,SAEc,kBAAkB,UAAuB,OAAiC;AAChF,WAAA,SAAS,MAAM,KAAK;AAAA,EAC5B;AAAA,SAEe,0BAA0B,WAA6B;AAC/D,UAAA,IAAI,aAAa,kDAAkD,aAAa;AAAA,EACvF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"MarkerMerger.js","sources":["../../../src/core/MarkerMerger.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport type { Environment } from '../dao'\nimport {\n\tEntityFieldMarkers,\n\tEntityFieldMarkersContainer,\n\tEntityFieldPlaceholders,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n\tMeaningfulMarker,\n\tSubTreeMarkers,\n} from '../markers'\nimport type { Alias, FieldName, PlaceholderName } from '../treeParameters'\nimport { assertNever } from '../utils'\nimport { TreeParameterMerger } from './TreeParameterMerger'\n\nexport class MarkerMerger {\n\t// This method assumes their placeholder names are the same\n\tpublic static mergeMarkers(original: MeaningfulMarker, fresh: MeaningfulMarker): MeaningfulMarker {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original instanceof FieldMarker) {\n\t\t\tif (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.mergeFieldMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker || fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.fieldName)\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('Merging fields and sub trees is an undefined operation.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasOneRelationMarker) {\n\t\t\tif (fresh instanceof HasOneRelationMarker) {\n\t\t\t\treturn this.mergeHasOneRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasManyRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasManyRelationMarker) {\n\t\t\tif (fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.mergeHasManyRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof EntitySubTreeMarker) {\n\t\t\tif (fresh instanceof EntitySubTreeMarker) {\n\t\t\t\treturn this.mergeEntitySubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntitySubTreeMarker can only be merged with other entity sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (original instanceof EntityListSubTreeMarker) {\n\t\t\tif (fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\treturn this.mergeEntityListSubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntityListSubTreeMarker can only be merged with other list sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tassertNever(original)\n\t}\n\n\tpublic static mergeMarkerTreeRoots(original: MarkerTreeRoot, fresh: MarkerTreeRoot): MarkerTreeRoot {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new MarkerTreeRoot(\n\t\t\tthis.mergeEntityFields(original.subTrees, fresh.subTrees),\n\t\t\tthis.mergeSubTreePlaceholdersByAliases(original.placeholdersByAliases, fresh.placeholdersByAliases),\n\t\t)\n\t}\n\n\tpublic static mergeSubTreeMarkers(\n\t\toriginal: SubTreeMarkers | undefined,\n\t\tfresh: SubTreeMarkers | undefined,\n\t): SubTreeMarkers | undefined {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original === undefined) {\n\t\t\treturn fresh\n\t\t}\n\t\tif (fresh === undefined) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal = new Map(original)\n\n\t\tfor (const [placeholderName, fromFresh] of fresh) {\n\t\t\tconst fromOriginal = newOriginal.get(placeholderName)\n\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tfromOriginal === undefined\n\t\t\t\t\t? fromFresh\n\t\t\t\t\t: fromOriginal instanceof EntityListSubTreeMarker\n\t\t\t\t\t? MarkerMerger.mergeEntityListSubTreeMarkers(fromOriginal, fromFresh as EntityListSubTreeMarker)\n\t\t\t\t\t: MarkerMerger.mergeEntitySubTreeMarkers(fromOriginal, fromFresh as EntitySubTreeMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeSubTreePlaceholdersByAliases(\n\t\toriginal: Map<Alias, PlaceholderName>,\n\t\tfresh: Map<Alias, PlaceholderName>,\n\t) {\n\t\tconst newOriginalAliases = new Map(original)\n\t\tfor (const [alias, placeholder] of fresh) {\n\t\t\tconst fromOriginal = newOriginalAliases.get(alias)\n\t\t\tif (fromOriginal === undefined) {\n\t\t\t\tnewOriginalAliases.set(alias, placeholder)\n\t\t\t} else if (fromOriginal === placeholder) {\n\t\t\t\t// Do nothing\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(`Illegal subTree alias '${alias}' points to distinct subTrees.`)\n\t\t\t}\n\t\t}\n\t\treturn newOriginalAliases\n\t}\n\n\tpublic static mergeEntityFields(original: SubTreeMarkers, fresh: SubTreeMarkers): SubTreeMarkers\n\tpublic static mergeEntityFields(original: EntityFieldMarkers, fresh: EntityFieldMarkers): EntityFieldMarkers\n\tpublic static mergeEntityFields(\n\t\toriginal: Map<PlaceholderName, MeaningfulMarker>,\n\t\tfresh: Map<PlaceholderName, MeaningfulMarker>,\n\t): Map<PlaceholderName, MeaningfulMarker> {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: Map<PlaceholderName, MeaningfulMarker> = new Map(original)\n\t\tfor (const [placeholderName, freshMarker] of fresh) {\n\t\t\tconst markerFromOriginal = newOriginal.get(placeholderName)\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tmarkerFromOriginal === undefined ? freshMarker : this.mergeMarkers(markerFromOriginal, freshMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldPlaceholders(\n\t\toriginal: EntityFieldPlaceholders,\n\t\tfresh: EntityFieldPlaceholders,\n\t): EntityFieldPlaceholders {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: EntityFieldPlaceholders = new Map(original)\n\t\tfor (const [fieldName, freshPlaceholders] of fresh) {\n\t\t\tconst placeholderFromOriginal = newOriginal.get(fieldName)\n\n\t\t\tif (placeholderFromOriginal === undefined) {\n\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t} else if (placeholderFromOriginal instanceof Set) {\n\t\t\t\tconst combinedSet = new Set(placeholderFromOriginal)\n\t\t\t\tif (freshPlaceholders instanceof Set) {\n\t\t\t\t\tfor (const freshPlaceholder of freshPlaceholders) {\n\t\t\t\t\t\tcombinedSet.add(freshPlaceholder)\n\t\t\t\t\t}\n\t\t\t\t} else if (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tcombinedSet.add(freshPlaceholders)\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t} else if (typeof placeholderFromOriginal === 'string') {\n\t\t\t\tif (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tif (placeholderFromOriginal === freshPlaceholders) {\n\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOriginal.set(fieldName, new Set([placeholderFromOriginal, freshPlaceholders]))\n\t\t\t\t\t}\n\t\t\t\t} else if (freshPlaceholders instanceof Set) {\n\t\t\t\t\tif (freshPlaceholders.has(placeholderFromOriginal)) {\n\t\t\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst combinedSet = new Set(freshPlaceholders)\n\t\t\t\t\t\tcombinedSet.add(placeholderFromOriginal)\n\t\t\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tassertNever(placeholderFromOriginal)\n\t\t\t}\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldsContainers(\n\t\toriginal: EntityFieldMarkersContainer,\n\t\tfresh: EntityFieldMarkersContainer,\n\t): EntityFieldMarkersContainer {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityFieldMarkersContainer(\n\t\t\toriginal.hasAtLeastOneBearingField || fresh.hasAtLeastOneBearingField,\n\t\t\tthis.mergeEntityFields(original.markers, fresh.markers),\n\t\t\tthis.mergeEntityFieldPlaceholders(original.placeholders, fresh.placeholders),\n\t\t)\n\t}\n\n\tpublic static mergeHasOneRelationMarkers(original: HasOneRelationMarker, fresh: HasOneRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasOneRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasOneRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeHasManyRelationMarkers(original: HasManyRelationMarker, fresh: HasManyRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasManyRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasManyRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntitySubTreeMarkers(original: EntitySubTreeMarker, fresh: EntitySubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntitySubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntitySubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntityListSubTreeMarkers(original: EntityListSubTreeMarker, fresh: EntityListSubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityListSubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntityListSubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeFieldMarkers(original: FieldMarker, fresh: FieldMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original.isNonbearing !== fresh.isNonbearing && original.isNonbearing) {\n\t\t\t// If only one isNonbearing, then the whole field is bearing\n\t\t\treturn fresh\n\t\t}\n\t\t// TODO warn in case of defaultValue differences\n\t\treturn original\n\t}\n\n\tpublic static mergeInSystemFields(original: EntityFieldMarkersContainer | undefined): EntityFieldMarkersContainer {\n\t\tconst primaryKey = new FieldMarker(PRIMARY_KEY_NAME, undefined, true)\n\t\t// We could potentially share this instance for all fields. Maybe sometime later.\n\t\tconst freshFields = new EntityFieldMarkersContainer(\n\t\t\tfalse,\n\t\t\tnew Map([[primaryKey.placeholderName, primaryKey]]),\n\t\t\tnew Map([[PRIMARY_KEY_NAME, primaryKey.placeholderName]]),\n\t\t)\n\t\treturn original ? this.mergeEntityFieldsContainers(original, freshFields) : freshFields\n\t}\n\n\tpublic static mergeEnvironments(original: Environment, fresh: Environment): Environment {\n\t\treturn original.merge(fresh)\n\t}\n\n\tprivate static rejectRelationScalarCombo(fieldName: FieldName): never {\n\t\tthrow new BindingError(`Cannot combine a relation with a scalar field '${fieldName}'.`)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAoBO,MAAM,aAAa;AAAA,EAEzB,OAAc,aAAa,UAA4B,OAA2C;AACjG,QAAI,aAAa,OAAO;AAChB,aAAA;AAAA,IACR;AACA,QAAI,oBAAoB,aAAa;AACpC,UAAI,iBAAiB,aAAa;AAC1B,eAAA,KAAK,kBAAkB,UAAU,KAAK;AAAA,MACnC,WAAA,iBAAiB,wBAAwB,iBAAiB,uBAAuB;AACpF,eAAA,KAAK,0BAA0B,SAAS,SAAS;AAAA,MAC9C,WAAA,iBAAiB,uBAAuB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MAAM,UAAU;AAAA,MAC9G,KAAK,4BAA4B,SAAS,QAAQ,MAAM,MAAM;AAAA,MAC9D,KAAK,kBAAkB,SAAS,aAAa,MAAM,WAAW;AAAA,IAAA;AAAA,EAEhE;AAAA,EAEA,OAAc,kBAAkB,UAAuB,OAAoB;AAC1E,QAAI,aAAa,OAAO;AAChB,aAAA;AAAA,IACR;AACA,QAAI,SAAS,iBAAiB,MAAM,gBAAgB,SAAS,cAAc;AAEnE,aAAA;AAAA,IACR;AAEO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,oBAAoB,UAAgF;AACjH,UAAM,aAAa,IAAI,YAAY,kBAAkB,QAAW,IAAI;AAEpE,UAAM,cAAc,IAAI;AAAA,MACvB;AAAA,MACA,oBAAI,IAAI,CAAC,CAAC,WAAW,iBAAiB,UAAU,CAAC,CAAC;AAAA,MAClD,oBAAI,IAAI,CAAC,CAAC,kBAAkB,WAAW,eAAe,CAAC,CAAC;AAAA,IAAA;AAEzD,WAAO,WAAW,KAAK,4BAA4B,UAAU,WAAW,IAAI;AAAA,EAC7E;AAAA,EAEA,OAAc,kBAAkB,UAAuB,OAAiC;AAChF,WAAA,SAAS,MAAM,KAAK;AAAA,EAC5B;AAAA,EAEA,OAAe,0BAA0B,WAA6B;AAC/D,UAAA,IAAI,aAAa,kDAAkD,aAAa;AAAA,EACvF;AACD;"}
|
|
@@ -49,7 +49,9 @@ const _MarkerTreeGenerator = class {
|
|
|
49
49
|
if (existingPlaceholder === placeholderName) {
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
throw new BindingError(
|
|
52
|
+
throw new BindingError(
|
|
53
|
+
`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`
|
|
54
|
+
);
|
|
53
55
|
}
|
|
54
56
|
placeholders.set(alias, placeholderName);
|
|
55
57
|
}
|
|
@@ -72,7 +74,11 @@ const _MarkerTreeGenerator = class {
|
|
|
72
74
|
}
|
|
73
75
|
static initializeChildrenAnalyzer() {
|
|
74
76
|
const fieldMarkerLeaf = new Leaf("generateLeafMarker");
|
|
75
|
-
const branchMarkerBranchNode = new BranchNode(
|
|
77
|
+
const branchMarkerBranchNode = new BranchNode(
|
|
78
|
+
"generateBranchMarker",
|
|
79
|
+
this.mapNodeResultToEntityFields,
|
|
80
|
+
{ childrenAreOptional: true }
|
|
81
|
+
);
|
|
76
82
|
return new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {
|
|
77
83
|
staticRenderFactoryName: "staticRender",
|
|
78
84
|
renderPropsErrorMessage: `Render props (functions as React component children) are not supported within the schema. You have likely used a bare custom component as opposed to wrapping in with \`Component\` from the \`@contember/admin\` package. Please refer to the documentation.`,
|
|
@@ -83,5 +89,7 @@ const _MarkerTreeGenerator = class {
|
|
|
83
89
|
};
|
|
84
90
|
let MarkerTreeGenerator = _MarkerTreeGenerator;
|
|
85
91
|
__publicField(MarkerTreeGenerator, "childrenAnalyzer", _MarkerTreeGenerator.initializeChildrenAnalyzer());
|
|
86
|
-
export {
|
|
92
|
+
export {
|
|
93
|
+
MarkerTreeGenerator
|
|
94
|
+
};
|
|
87
95
|
//# sourceMappingURL=MarkerTreeGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBO,
|
|
1
|
+
{"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBO,MAAM,uBAAN,MAA0B;AAAA,EAGzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AACjC,UAAM,YAAY,qBAAoB,iBAAiB,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEpG,QAAA,UAAU,WAAW,GAAG;AAC3B,aAAO,IAAI,eAAe,oBAAI,IAAO,GAAA,oBAAI,IAAK,CAAA;AAAA,IAC/C;AAEM,UAAA,mBAAmB,qBAAoB,4BAA4B,SAAS;AAElF,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC;AAAA,UAAA;AAAA,QAEvC;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAAA,EAEA,OAAe,4BACd,QACiE;AAC3D,UAAA,UAAU,IAAI;AAEpB,QAAI,CAAC,QAAQ;AACZ,aAAO,QAAQ;IAChB;AAEA,QAAI,CAAC,MAAM,QAAQ,MAAM,GAAG;AAC3B,cAAQ,SAAS,MAAM;AACvB,aAAO,QAAQ;IAChB;AAEA,eAAW,UAAU,QAAQ;AAC5B,cAAQ,SAAS,MAAM;AAAA,IACxB;AAEA,WAAO,QAAQ;EAChB;AAAA,EAEA,OAAe,6BAAqF;AAC7F,UAAA,kBAAkB,IAAI,KAAuB,oBAAoB;AAEvE,UAAM,yBAAyB,IAAI;AAAA,MAClC;AAAA,MACA,KAAK;AAAA,MACL,EAAE,qBAAqB,KAAK;AAAA,IAAA;AAG7B,WAAO,IAAI,iBAAiB,CAAC,eAAe,GAAG,CAAC,sBAAsB,GAAG;AAAA,MACxE,yBAAyB;AAAA,MACzB,yBACC;AAAA,MAGD,mBAAmB;AAAA,MACnB,0BAA0B;AAAA,IAAA,CAC1B;AAAA,EACF;AACD;AAnGO,IAAM,sBAAN;AACN,cADY,qBACG,oBAAmB,qBAAoB;"}
|
|
@@ -32,7 +32,14 @@ class MutationGenerator {
|
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
if (subTreeState.type === "entityRealm") {
|
|
35
|
-
const subMutation = this.addSubMutation(
|
|
35
|
+
const subMutation = this.addSubMutation(
|
|
36
|
+
processedPlaceholdersByEntity,
|
|
37
|
+
placeholderName,
|
|
38
|
+
"single",
|
|
39
|
+
subTreeState.entity.id.value,
|
|
40
|
+
subTreeState,
|
|
41
|
+
builder
|
|
42
|
+
);
|
|
36
43
|
if (subMutation) {
|
|
37
44
|
builder = subMutation[0];
|
|
38
45
|
operations.push(subMutation[1]);
|
|
@@ -42,7 +49,14 @@ class MutationGenerator {
|
|
|
42
49
|
if (childState.type === "entityRealmStub") {
|
|
43
50
|
continue;
|
|
44
51
|
}
|
|
45
|
-
const subMutation = this.addSubMutation(
|
|
52
|
+
const subMutation = this.addSubMutation(
|
|
53
|
+
processedPlaceholdersByEntity,
|
|
54
|
+
placeholderName,
|
|
55
|
+
"list",
|
|
56
|
+
childState.entity.id.value,
|
|
57
|
+
childState,
|
|
58
|
+
builder
|
|
59
|
+
);
|
|
46
60
|
if (subMutation) {
|
|
47
61
|
builder = subMutation[0];
|
|
48
62
|
operations.push(subMutation[1]);
|
|
@@ -55,7 +69,12 @@ class MutationGenerator {
|
|
|
55
69
|
}
|
|
56
70
|
if (removalType === "delete") {
|
|
57
71
|
const alias = this.createAlias();
|
|
58
|
-
builder = this.addDeleteMutation(
|
|
72
|
+
builder = this.addDeleteMutation(
|
|
73
|
+
subTreeState.entityName,
|
|
74
|
+
removedId,
|
|
75
|
+
alias,
|
|
76
|
+
builder
|
|
77
|
+
);
|
|
59
78
|
operations.push({ alias, subTreePlaceholder: placeholderName, subTreeType: "list", type: "delete", id: removedId });
|
|
60
79
|
} else {
|
|
61
80
|
assertNever(removalType);
|
|
@@ -80,7 +99,12 @@ class MutationGenerator {
|
|
|
80
99
|
const fieldMarkers = getEntityMarker(realmState).fields.markers;
|
|
81
100
|
const alias = this.createAlias();
|
|
82
101
|
if (realmState.entity.isScheduledForDeletion) {
|
|
83
|
-
const builder2 = this.addDeleteMutation(
|
|
102
|
+
const builder2 = this.addDeleteMutation(
|
|
103
|
+
realmState.entity.entityName,
|
|
104
|
+
entityId,
|
|
105
|
+
alias,
|
|
106
|
+
queryBuilder
|
|
107
|
+
);
|
|
84
108
|
return [
|
|
85
109
|
builder2,
|
|
86
110
|
{
|
|
@@ -92,7 +116,14 @@ class MutationGenerator {
|
|
|
92
116
|
}
|
|
93
117
|
];
|
|
94
118
|
} else if (!realmState.entity.id.existsOnServer) {
|
|
95
|
-
const builder2 = this.addCreateMutation(
|
|
119
|
+
const builder2 = this.addCreateMutation(
|
|
120
|
+
processedPlaceholdersByEntity,
|
|
121
|
+
realmState,
|
|
122
|
+
alias,
|
|
123
|
+
this.getNodeFragmentName(subTreePlaceholder, subTreeType, realmState),
|
|
124
|
+
queryBuilder,
|
|
125
|
+
fieldMarkers
|
|
126
|
+
);
|
|
96
127
|
if (!builder2) {
|
|
97
128
|
return void 0;
|
|
98
129
|
}
|
|
@@ -108,7 +139,14 @@ class MutationGenerator {
|
|
|
108
139
|
}
|
|
109
140
|
];
|
|
110
141
|
}
|
|
111
|
-
const builder = this.addUpdateMutation(
|
|
142
|
+
const builder = this.addUpdateMutation(
|
|
143
|
+
processedPlaceholdersByEntity,
|
|
144
|
+
realmState,
|
|
145
|
+
alias,
|
|
146
|
+
this.getNodeFragmentName(subTreePlaceholder, subTreeType, realmState),
|
|
147
|
+
queryBuilder,
|
|
148
|
+
fieldMarkers
|
|
149
|
+
);
|
|
112
150
|
if (!builder) {
|
|
113
151
|
return void 0;
|
|
114
152
|
}
|
|
@@ -131,10 +169,18 @@ class MutationGenerator {
|
|
|
131
169
|
return `${realmState.entity.entityName}_${subTreePlaceholder}`;
|
|
132
170
|
}
|
|
133
171
|
addDeleteMutation(entityName, deletedId, alias, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder()) {
|
|
134
|
-
return queryBuilder.delete(
|
|
172
|
+
return queryBuilder.delete(
|
|
173
|
+
entityName,
|
|
174
|
+
(builder) => builder.ok().node((builder2) => builder2.column(PRIMARY_KEY_NAME)).by({ [PRIMARY_KEY_NAME]: deletedId }).errors().errorMessage(),
|
|
175
|
+
alias
|
|
176
|
+
);
|
|
135
177
|
}
|
|
136
178
|
addUpdateMutation(processedPlaceholdersByEntity, entityRealm, alias, nodeFragmentName, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder(), fieldMarkers) {
|
|
137
|
-
const updateBuilder = this.registerUpdateMutationPart(
|
|
179
|
+
const updateBuilder = this.registerUpdateMutationPart(
|
|
180
|
+
processedPlaceholdersByEntity,
|
|
181
|
+
entityRealm,
|
|
182
|
+
new CrudQueryBuilder.WriteDataBuilder()
|
|
183
|
+
);
|
|
138
184
|
if (updateBuilder.data === void 0 || isEmptyObject(updateBuilder.data)) {
|
|
139
185
|
return void 0;
|
|
140
186
|
}
|
|
@@ -142,24 +188,42 @@ class MutationGenerator {
|
|
|
142
188
|
if (!runtimeId.existsOnServer) {
|
|
143
189
|
return void 0;
|
|
144
190
|
}
|
|
145
|
-
const readBuilder = QueryGenerator.registerQueryPart(
|
|
191
|
+
const readBuilder = QueryGenerator.registerQueryPart(
|
|
192
|
+
fieldMarkers,
|
|
193
|
+
CrudQueryBuilder.ReadBuilder.instantiate()
|
|
194
|
+
);
|
|
146
195
|
if (nodeFragmentName) {
|
|
147
196
|
queryBuilder = queryBuilder.fragment(nodeFragmentName, entityRealm.entity.entityName, readBuilder);
|
|
148
197
|
}
|
|
149
|
-
return queryBuilder.update(
|
|
198
|
+
return queryBuilder.update(
|
|
199
|
+
entityRealm.entity.entityName,
|
|
200
|
+
(builder) => builder.node(nodeFragmentName ? (builder2) => builder2.applyFragment(nodeFragmentName) : readBuilder).data(updateBuilder).by({ [PRIMARY_KEY_NAME]: runtimeId.value }).ok().validation().errors().errorMessage(),
|
|
201
|
+
alias
|
|
202
|
+
);
|
|
150
203
|
}
|
|
151
204
|
addCreateMutation(processedPlaceholdersByEntity, entityRealm, alias, nodeFragmentName, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder(), fieldMarkers) {
|
|
152
|
-
const createBuilder = this.registerCreateMutationPart(
|
|
205
|
+
const createBuilder = this.registerCreateMutationPart(
|
|
206
|
+
processedPlaceholdersByEntity,
|
|
207
|
+
entityRealm,
|
|
208
|
+
new CrudQueryBuilder.WriteDataBuilder()
|
|
209
|
+
);
|
|
153
210
|
if (createBuilder.data === void 0 || isEmptyObject(createBuilder.data)) {
|
|
154
211
|
return void 0;
|
|
155
212
|
}
|
|
156
|
-
const readBuilder = QueryGenerator.registerQueryPart(
|
|
213
|
+
const readBuilder = QueryGenerator.registerQueryPart(
|
|
214
|
+
fieldMarkers,
|
|
215
|
+
CrudQueryBuilder.ReadBuilder.instantiate()
|
|
216
|
+
);
|
|
157
217
|
if (nodeFragmentName) {
|
|
158
218
|
queryBuilder = queryBuilder.fragment(nodeFragmentName, entityRealm.entity.entityName, readBuilder);
|
|
159
219
|
}
|
|
160
|
-
return queryBuilder.create(
|
|
161
|
-
|
|
162
|
-
|
|
220
|
+
return queryBuilder.create(
|
|
221
|
+
entityRealm.entity.entityName,
|
|
222
|
+
(builder) => {
|
|
223
|
+
return builder.node(nodeFragmentName ? (builder2) => builder2.applyFragment(nodeFragmentName) : readBuilder).data(createBuilder).ok().validation().errors().errorMessage();
|
|
224
|
+
},
|
|
225
|
+
alias
|
|
226
|
+
);
|
|
163
227
|
}
|
|
164
228
|
registerCreateMutationPart(processedPlaceholdersByEntity, currentState, builder = new CrudQueryBuilder.WriteDataBuilder()) {
|
|
165
229
|
let processedPlaceholders = processedPlaceholdersByEntity.get(currentState.entity);
|
|
@@ -247,11 +311,21 @@ class MutationGenerator {
|
|
|
247
311
|
break;
|
|
248
312
|
}
|
|
249
313
|
case "hasOne": {
|
|
250
|
-
builder = this.registerCreateEntityPart(
|
|
314
|
+
builder = this.registerCreateEntityPart(
|
|
315
|
+
processedPlaceholdersByEntity,
|
|
316
|
+
field.fieldState,
|
|
317
|
+
field.marker,
|
|
318
|
+
builder
|
|
319
|
+
);
|
|
251
320
|
break;
|
|
252
321
|
}
|
|
253
322
|
case "hasMany": {
|
|
254
|
-
builder = this.registerCreateEntityListPart(
|
|
323
|
+
builder = this.registerCreateEntityListPart(
|
|
324
|
+
processedPlaceholdersByEntity,
|
|
325
|
+
field.fieldState,
|
|
326
|
+
field.marker,
|
|
327
|
+
builder
|
|
328
|
+
);
|
|
255
329
|
break;
|
|
256
330
|
}
|
|
257
331
|
default:
|
|
@@ -356,7 +430,9 @@ class MutationGenerator {
|
|
|
356
430
|
if (fieldState.type === "entityRealmStub") {
|
|
357
431
|
return builder2;
|
|
358
432
|
}
|
|
359
|
-
return builder2.update(
|
|
433
|
+
return builder2.update(
|
|
434
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, fieldState, builder3)
|
|
435
|
+
);
|
|
360
436
|
}
|
|
361
437
|
const plannedDeletion = currentState.plannedHasOneDeletions?.get(placeholderName);
|
|
362
438
|
if (plannedDeletion !== void 0) {
|
|
@@ -367,7 +443,9 @@ class MutationGenerator {
|
|
|
367
443
|
[PRIMARY_KEY_NAME]: runtimeId.value
|
|
368
444
|
});
|
|
369
445
|
}
|
|
370
|
-
const subBuilder2 = builder2.create(
|
|
446
|
+
const subBuilder2 = builder2.create(
|
|
447
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, fieldState)
|
|
448
|
+
);
|
|
371
449
|
if (isEmptyObject(subBuilder2.data)) {
|
|
372
450
|
return builder2.disconnect();
|
|
373
451
|
}
|
|
@@ -392,7 +470,11 @@ class MutationGenerator {
|
|
|
392
470
|
if (fieldState.type === "entityRealmStub") {
|
|
393
471
|
return builder2;
|
|
394
472
|
}
|
|
395
|
-
return builder2.update(
|
|
473
|
+
return builder2.update(
|
|
474
|
+
reducedBy,
|
|
475
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, fieldState, builder3),
|
|
476
|
+
alias
|
|
477
|
+
);
|
|
396
478
|
}
|
|
397
479
|
const plannedDeletion = currentState.plannedHasOneDeletions?.get(placeholderName);
|
|
398
480
|
if (plannedDeletion !== void 0) {
|
|
@@ -401,7 +483,9 @@ class MutationGenerator {
|
|
|
401
483
|
if (runtimeId.existsOnServer) {
|
|
402
484
|
return builder2.disconnect(reducedBy, alias).connect({ [PRIMARY_KEY_NAME]: runtimeId.value }, alias);
|
|
403
485
|
}
|
|
404
|
-
const subBuilder = builder2.create(
|
|
486
|
+
const subBuilder = builder2.create(
|
|
487
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, fieldState)
|
|
488
|
+
);
|
|
405
489
|
if (isEmptyObject(subBuilder.data)) {
|
|
406
490
|
return builder2.disconnect(reducedBy, alias);
|
|
407
491
|
}
|
|
@@ -434,13 +518,20 @@ class MutationGenerator {
|
|
|
434
518
|
if (runtimeId.existsOnServer) {
|
|
435
519
|
if (persistedEntityIds.has(runtimeId.value)) {
|
|
436
520
|
if (childState.type !== "entityRealmStub") {
|
|
437
|
-
builder2 = builder2.update(
|
|
521
|
+
builder2 = builder2.update(
|
|
522
|
+
{ [PRIMARY_KEY_NAME]: runtimeId.value },
|
|
523
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, childState, builder3),
|
|
524
|
+
alias
|
|
525
|
+
);
|
|
438
526
|
}
|
|
439
527
|
} else {
|
|
440
528
|
builder2 = builder2.connect({ [PRIMARY_KEY_NAME]: runtimeId.value }, alias);
|
|
441
529
|
}
|
|
442
530
|
} else {
|
|
443
|
-
builder2 = builder2.create(
|
|
531
|
+
builder2 = builder2.create(
|
|
532
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, childState),
|
|
533
|
+
alias
|
|
534
|
+
);
|
|
444
535
|
}
|
|
445
536
|
}
|
|
446
537
|
if (fieldState.plannedRemovals) {
|
|
@@ -469,12 +560,17 @@ class MutationGenerator {
|
|
|
469
560
|
if (typeof value !== "string") {
|
|
470
561
|
return value;
|
|
471
562
|
}
|
|
472
|
-
const fieldSchema = this.treeStore.schema.getEntityColumn(
|
|
563
|
+
const fieldSchema = this.treeStore.schema.getEntityColumn(
|
|
564
|
+
fieldState.parent.entity.entityName,
|
|
565
|
+
fieldState.fieldMarker.fieldName
|
|
566
|
+
);
|
|
473
567
|
return fieldSchema.enumName === null ? value : new GraphQlBuilder.GraphQlLiteral(value);
|
|
474
568
|
}
|
|
475
569
|
createAlias() {
|
|
476
570
|
return `op_${this.aliasCounter++}`;
|
|
477
571
|
}
|
|
478
572
|
}
|
|
479
|
-
export {
|
|
573
|
+
export {
|
|
574
|
+
MutationGenerator
|
|
575
|
+
};
|
|
480
576
|
//# sourceMappingURL=MutationGenerator.js.map
|