@contember/binding 1.1.0-alpha.8 → 1.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +66 -2
- 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 +50 -22
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js +4 -4
- 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 +14 -3
- 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 +11 -2
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js +63 -51
- 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 +35 -14
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/accessors/EntityListAccessor.js +13 -11
- 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 +9 -7
- 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 +4 -4
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.js +149 -151
- 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 +22 -8
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/IncrementalMarkerBuilder.js +36 -8
- 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 +60 -17
- 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 +127 -28
- 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 +91 -34
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js +26 -5
- 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 +23 -18
- 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 +47 -16
- 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 +30 -4
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/core/schema/SchemaLoader.js +15 -13
- 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 +8 -3
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/DataBindingProvider.js +14 -9
- 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 +26 -10
- 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 +26 -2
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/TreeNodeEnvironmentFactory.js +14 -14
- 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 -4
- package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +3 -4
- 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 -104
- package/dist/development/index.js.map +1 -1
- 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 +117 -25
- 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 +73 -20
- 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 +53 -2
- 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 +29 -22
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js +4 -4
- 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 +14 -3
- 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 +11 -2
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js +63 -51
- 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 +35 -14
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js +13 -11
- 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 +9 -7
- 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 +4 -4
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.js +149 -151
- 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 +10 -4
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/IncrementalMarkerBuilder.js +36 -8
- 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 +60 -17
- 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 +127 -28
- 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 +91 -34
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js +26 -5
- 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 +23 -18
- 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 +47 -16
- 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 +30 -4
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/core/schema/SchemaLoader.js +15 -13
- 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 +8 -3
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/coreComponents/DataBindingProvider.js +9 -9
- 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 +12 -9
- 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 +26 -2
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/TreeNodeEnvironmentFactory.js +14 -14
- 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 -4
- package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +3 -4
- 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 -104
- package/dist/production/index.js.map +1 -1
- 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 +117 -25
- 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 +73 -20
- 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/accessorPropagation/BindingOperationsContext.d.ts +1 -1
- package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EntityKeyContext.d.ts +1 -1
- package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts +13 -2
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +1 -1
- package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntityListSubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useEntityListSubTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useExtendTree.d.ts +1 -1
- package/dist/types/accessorPropagation/useExtendTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts.map +1 -1
- package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +1 -1
- package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -1
- package/dist/types/accessorSorting/addEntityAtIndex.d.ts +1 -1
- package/dist/types/accessorSorting/addEntityAtIndex.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeState.d.ts +8 -0
- package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +6 -0
- package/dist/types/accessorTree/AccessorTreeStateAction.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +2 -2
- package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -1
- package/dist/types/accessorTree/DirtinessContext.d.ts +1 -1
- package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -1
- package/dist/types/accessorTree/MutationRequestResponse.d.ts +5 -5
- package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/MutationStateContext.d.ts +1 -1
- package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -1
- package/dist/types/accessorTree/PersistResult.d.ts +1 -4
- package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
- package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +1 -1
- package/dist/types/accessorTree/useAccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/useDataBinding.d.ts +1 -1
- package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
- package/dist/types/accessors/BindingConfig.d.ts +0 -2
- package/dist/types/accessors/BindingConfig.d.ts.map +1 -1
- package/dist/types/accessors/EntityAccessor.d.ts +4 -2
- package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
- package/dist/types/accessors/EntityListAccessor.d.ts +2 -2
- package/dist/types/accessors/EntityListAccessor.d.ts.map +1 -1
- package/dist/types/accessors/FieldAccessor.d.ts +2 -2
- package/dist/types/accessors/FieldAccessor.d.ts.map +1 -1
- package/dist/types/accessors/PersistErrorOptions.d.ts +0 -2
- package/dist/types/accessors/PersistErrorOptions.d.ts.map +1 -1
- package/dist/types/core/Config.d.ts.map +1 -1
- package/dist/types/core/DataBinding.d.ts +11 -4
- package/dist/types/core/DataBinding.d.ts.map +1 -1
- package/dist/types/core/MarkerMerger.d.ts.map +1 -1
- package/dist/types/core/MutationGenerator.d.ts.map +1 -1
- package/dist/types/core/StateInitializer.d.ts.map +1 -1
- package/dist/types/core/TreeAugmenter.d.ts +2 -1
- package/dist/types/core/TreeAugmenter.d.ts.map +1 -1
- package/dist/types/core/TreeStore.d.ts +2 -3
- package/dist/types/core/TreeStore.d.ts.map +1 -1
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/schema/Schema.d.ts +13 -3
- package/dist/types/core/schema/Schema.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaColumn.d.ts +1 -1
- package/dist/types/core/schema/SchemaColumn.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaLoader.d.ts +2 -1
- package/dist/types/core/schema/SchemaLoader.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaRelation.d.ts +1 -1
- package/dist/types/core/schema/SchemaRelation.d.ts.map +1 -1
- package/dist/types/coreComponents/Component.d.ts +9 -4
- package/dist/types/coreComponents/Component.d.ts.map +1 -1
- package/dist/types/coreComponents/DataBindingProvider.d.ts +2 -6
- package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
- package/dist/types/coreComponents/Entity.d.ts +1 -1
- package/dist/types/coreComponents/Entity.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/ParentEntity.d.ts +1 -1
- package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
- package/dist/types/dao/Environment.d.ts +10 -2
- package/dist/types/dao/Environment.d.ts.map +1 -1
- package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -1
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +1 -1
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +1 -1
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +1 -1
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +1 -1
- package/dist/types/helperComponents/DeferredSubTrees.d.ts +1 -1
- package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
- package/dist/types/helperComponents/If.d.ts +1 -1
- package/dist/types/helperComponents/If.d.ts.map +1 -1
- package/dist/types/helperComponents/StaticRender.d.ts +1 -1
- package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
- package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts.map +1 -1
- package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/accessorPropagation/EnvironmentContext.tsx +44 -0
- package/src/accessorTree/AccessorTree.tsx +12 -18
- package/src/accessorTree/AccessorTreeState.ts +12 -1
- package/src/accessorTree/AccessorTreeStateAction.ts +7 -1
- package/src/accessorTree/AccessorTreeStateContext.ts +1 -3
- package/src/accessorTree/AccessorTreeStateOptions.ts +2 -2
- package/src/accessorTree/MutationRequestResponse.ts +9 -3
- package/src/accessorTree/PersistResult.ts +1 -5
- package/src/accessorTree/accessorTreeStateReducer.ts +10 -1
- package/src/accessorTree/useAccessorTreeState.ts +8 -1
- package/src/accessorTree/useDataBinding.ts +65 -59
- package/src/accessors/BindingConfig.ts +0 -2
- package/src/accessors/EntityAccessor.ts +20 -7
- package/src/accessors/EntityListAccessor.ts +9 -9
- package/src/accessors/FieldAccessor.ts +5 -5
- package/src/accessors/PersistErrorOptions.ts +0 -2
- package/src/core/Config.ts +0 -2
- package/src/core/DataBinding.ts +142 -168
- package/src/core/MarkerMerger.ts +7 -5
- package/src/core/MutationGenerator.ts +8 -4
- package/src/core/StateInitializer.ts +3 -12
- package/src/core/TreeAugmenter.ts +4 -1
- package/src/core/TreeStore.ts +4 -17
- package/src/core/factories/createBatchUpdatesOptions.ts +1 -1
- package/src/core/index.ts +1 -0
- package/src/core/operations/EntityOperations.ts +1 -1
- package/src/core/schema/Schema.ts +38 -4
- package/src/core/schema/SchemaColumn.ts +1 -1
- package/src/core/schema/SchemaLoader.ts +13 -11
- package/src/core/schema/SchemaRelation.ts +1 -1
- package/src/coreComponents/Component.tsx +20 -7
- package/src/coreComponents/DataBindingProvider.tsx +4 -11
- package/src/coreComponents/EntityListSubTree.tsx +2 -3
- package/src/dao/Environment.ts +34 -3
- package/src/dao/TreeNodeEnvironmentFactory.ts +6 -11
- package/src/helperComponents/DeferredSubTrees.tsx +2 -1
- package/src/helperComponents/helpers/FilterEvaluator.ts +1 -3
- package/src/helperComponents/helpers/FilterFieldsCollector.ts +0 -3
- package/src/typings/react-fix.d.ts +12 -0
- package/src/accessorPropagation/EnvironmentContext.ts +0 -5
|
@@ -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;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BindingError } from "../BindingError.js";
|
|
2
2
|
import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
|
|
3
3
|
import { TreeParameterMerger } from "./TreeParameterMerger.js";
|
|
4
|
+
import { MarkerTreeRoot } from "../markers/MarkerTreeRoot.js";
|
|
4
5
|
import { FieldMarker } from "../markers/FieldMarker.js";
|
|
5
6
|
import { HasOneRelationMarker } from "../markers/HasOneRelationMarker.js";
|
|
6
7
|
import { HasManyRelationMarker } from "../markers/HasManyRelationMarker.js";
|
|
7
8
|
import { EntitySubTreeMarker } from "../markers/EntitySubTreeMarker.js";
|
|
8
9
|
import { EntityListSubTreeMarker } from "../markers/EntityListSubTreeMarker.js";
|
|
9
|
-
import { MarkerTreeRoot } from "../markers/MarkerTreeRoot.js";
|
|
10
|
-
import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
|
|
11
10
|
import { assertNever } from "../utils/assertNever.js";
|
|
11
|
+
import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
|
|
12
12
|
class MarkerMerger {
|
|
13
13
|
static mergeMarkers(original, fresh) {
|
|
14
14
|
if (original === fresh) {
|
|
@@ -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,44 +170,72 @@ 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) {
|
|
188
221
|
return original;
|
|
189
222
|
}
|
|
190
|
-
if (original.
|
|
191
|
-
|
|
223
|
+
if (original.defaultValue !== void 0 && fresh.defaultValue !== void 0 && original.defaultValue !== fresh.defaultValue) {
|
|
224
|
+
throw new BindingError(`MarkerTreeGenerator merging: multiple fields "${original.fieldName}" with different defaultValue found: ${JSON.stringify([original.defaultValue, fresh.defaultValue])}, `);
|
|
192
225
|
}
|
|
193
|
-
return
|
|
226
|
+
return new FieldMarker(
|
|
227
|
+
original.fieldName,
|
|
228
|
+
original.defaultValue ?? fresh.defaultValue,
|
|
229
|
+
original.isNonbearing && fresh.isNonbearing
|
|
230
|
+
);
|
|
194
231
|
}
|
|
195
232
|
static mergeInSystemFields(original) {
|
|
196
233
|
const primaryKey = new FieldMarker(PRIMARY_KEY_NAME, void 0, true);
|
|
197
|
-
const freshFields = new EntityFieldMarkersContainer(
|
|
234
|
+
const freshFields = new EntityFieldMarkersContainer(
|
|
235
|
+
false,
|
|
236
|
+
/* @__PURE__ */ new Map([[primaryKey.placeholderName, primaryKey]]),
|
|
237
|
+
/* @__PURE__ */ new Map([[PRIMARY_KEY_NAME, primaryKey.placeholderName]])
|
|
238
|
+
);
|
|
198
239
|
return original ? this.mergeEntityFieldsContainers(original, freshFields) : freshFields;
|
|
199
240
|
}
|
|
200
241
|
static mergeEnvironments(original, fresh) {
|
|
@@ -204,5 +245,7 @@ class MarkerMerger {
|
|
|
204
245
|
throw new BindingError(`Cannot combine a relation with a scalar field '${fieldName}'.`);
|
|
205
246
|
}
|
|
206
247
|
}
|
|
207
|
-
export {
|
|
248
|
+
export {
|
|
249
|
+
MarkerMerger
|
|
250
|
+
};
|
|
208
251
|
//# 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,WACP,oBAAoB,sBAAsB;AACpD,UAAI,iBAAiB,sBAAsB;AACnC,eAAA,KAAK,2BAA2B,UAAU,KAAK;AAAA,MAAA,WAC5C,iBAAiB,aAAa;AACxC,eAAO,KAAK,0BAA0B,SAAS,WAAW,KAAK;AAAA,MAAA,WACrD,iBAAiB,uBAAuB;AAClD,cAAM,IAAI,aAAa;AAAA,MACb,WAAA,iBAAiB,uBAAuB,iBAAiB,yBAAyB;AACtF,cAAA,IAAI,aAAa,sFAAsF;AAAA,MAC9G;AACA,kBAAiB;A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Ee,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.defaultValue !== undefined && fresh.defaultValue !== undefined && original.defaultValue !== fresh.defaultValue) {\n\t\t\tthrow new BindingError(`MarkerTreeGenerator merging: multiple fields \"${original.fieldName}\" with different defaultValue found: ${JSON.stringify([original.defaultValue, fresh.defaultValue])}, `)\n\t\t}\n\t\treturn new FieldMarker(\n\t\t\toriginal.fieldName,\n\t\t\toriginal.defaultValue ?? fresh.defaultValue,\n\t\t\toriginal.isNonbearing && fresh.isNonbearing,\n\t\t)\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,iBAAiB,yBAAyB;AACtF,cAAA,IAAI,aAAa,yDAAyD;AAAA,MACjF;AACA,kBAAiB;AAAA,IAAA,WACP,oBAAoB,sBAAsB;AACpD,UAAI,iBAAiB,sBAAsB;AACnC,eAAA,KAAK,2BAA2B,UAAU,K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uB,OAAoB;AAC1E,QAAI,aAAa,OAAO;AAChB,aAAA;AAAA,IACR;AACI,QAAA,SAAS,iBAAiB,UAAa,MAAM,iBAAiB,UAAa,SAAS,iBAAiB,MAAM,cAAc;AAC5H,YAAM,IAAI,aAAa,iDAAiD,SAAS,iDAAiD,KAAK,UAAU,CAAC,SAAS,cAAc,MAAM,YAAY,CAAC,KAAK;AAAA,IAClM;AACA,WAAO,IAAI;AAAA,MACV,SAAS;AAAA,MACT,SAAS,gBAAgB,MAAM;AAAA,MAC/B,SAAS,gBAAgB,MAAM;AAAA,IAAA;AAAA,EAEjC;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;"}
|
|
@@ -26,13 +26,21 @@ class MutationGenerator {
|
|
|
26
26
|
let builder = new CrudQueryBuilder.CrudQueryBuilder();
|
|
27
27
|
const operations = [];
|
|
28
28
|
const processedPlaceholdersByEntity = /* @__PURE__ */ new Map();
|
|
29
|
+
const processedDeletes = /* @__PURE__ */ new Set();
|
|
29
30
|
for (const [treeRootId, rootStates] of this.treeStore.subTreeStatesByRoot.entries()) {
|
|
30
31
|
for (const [placeholderName, subTreeState] of Array.from(rootStates.entries()).reverse()) {
|
|
31
32
|
if (subTreeState.unpersistedChangesCount <= 0) {
|
|
32
33
|
continue;
|
|
33
34
|
}
|
|
34
35
|
if (subTreeState.type === "entityRealm") {
|
|
35
|
-
const subMutation = this.addSubMutation(
|
|
36
|
+
const subMutation = this.addSubMutation(
|
|
37
|
+
processedPlaceholdersByEntity,
|
|
38
|
+
placeholderName,
|
|
39
|
+
"single",
|
|
40
|
+
subTreeState.entity.id.value,
|
|
41
|
+
subTreeState,
|
|
42
|
+
builder
|
|
43
|
+
);
|
|
36
44
|
if (subMutation) {
|
|
37
45
|
builder = subMutation[0];
|
|
38
46
|
operations.push(subMutation[1]);
|
|
@@ -42,7 +50,14 @@ class MutationGenerator {
|
|
|
42
50
|
if (childState.type === "entityRealmStub") {
|
|
43
51
|
continue;
|
|
44
52
|
}
|
|
45
|
-
const subMutation = this.addSubMutation(
|
|
53
|
+
const subMutation = this.addSubMutation(
|
|
54
|
+
processedPlaceholdersByEntity,
|
|
55
|
+
placeholderName,
|
|
56
|
+
"list",
|
|
57
|
+
childState.entity.id.value,
|
|
58
|
+
childState,
|
|
59
|
+
builder
|
|
60
|
+
);
|
|
46
61
|
if (subMutation) {
|
|
47
62
|
builder = subMutation[0];
|
|
48
63
|
operations.push(subMutation[1]);
|
|
@@ -54,8 +69,18 @@ class MutationGenerator {
|
|
|
54
69
|
continue;
|
|
55
70
|
}
|
|
56
71
|
if (removalType === "delete") {
|
|
72
|
+
const key = `${subTreeState.entityName}#${removedId}`;
|
|
73
|
+
if (processedDeletes.has(key)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
processedDeletes.add(key);
|
|
57
77
|
const alias = this.createAlias();
|
|
58
|
-
builder = this.addDeleteMutation(
|
|
78
|
+
builder = this.addDeleteMutation(
|
|
79
|
+
subTreeState.entityName,
|
|
80
|
+
removedId,
|
|
81
|
+
alias,
|
|
82
|
+
builder
|
|
83
|
+
);
|
|
59
84
|
operations.push({ alias, subTreePlaceholder: placeholderName, subTreeType: "list", type: "delete", id: removedId });
|
|
60
85
|
} else {
|
|
61
86
|
assertNever(removalType);
|
|
@@ -80,7 +105,12 @@ class MutationGenerator {
|
|
|
80
105
|
const fieldMarkers = getEntityMarker(realmState).fields.markers;
|
|
81
106
|
const alias = this.createAlias();
|
|
82
107
|
if (realmState.entity.isScheduledForDeletion) {
|
|
83
|
-
const builder2 = this.addDeleteMutation(
|
|
108
|
+
const builder2 = this.addDeleteMutation(
|
|
109
|
+
realmState.entity.entityName,
|
|
110
|
+
entityId,
|
|
111
|
+
alias,
|
|
112
|
+
queryBuilder
|
|
113
|
+
);
|
|
84
114
|
return [
|
|
85
115
|
builder2,
|
|
86
116
|
{
|
|
@@ -92,7 +122,14 @@ class MutationGenerator {
|
|
|
92
122
|
}
|
|
93
123
|
];
|
|
94
124
|
} else if (!realmState.entity.id.existsOnServer) {
|
|
95
|
-
const builder2 = this.addCreateMutation(
|
|
125
|
+
const builder2 = this.addCreateMutation(
|
|
126
|
+
processedPlaceholdersByEntity,
|
|
127
|
+
realmState,
|
|
128
|
+
alias,
|
|
129
|
+
this.getNodeFragmentName(subTreePlaceholder, subTreeType, realmState),
|
|
130
|
+
queryBuilder,
|
|
131
|
+
fieldMarkers
|
|
132
|
+
);
|
|
96
133
|
if (!builder2) {
|
|
97
134
|
return void 0;
|
|
98
135
|
}
|
|
@@ -108,7 +145,14 @@ class MutationGenerator {
|
|
|
108
145
|
}
|
|
109
146
|
];
|
|
110
147
|
}
|
|
111
|
-
const builder = this.addUpdateMutation(
|
|
148
|
+
const builder = this.addUpdateMutation(
|
|
149
|
+
processedPlaceholdersByEntity,
|
|
150
|
+
realmState,
|
|
151
|
+
alias,
|
|
152
|
+
this.getNodeFragmentName(subTreePlaceholder, subTreeType, realmState),
|
|
153
|
+
queryBuilder,
|
|
154
|
+
fieldMarkers
|
|
155
|
+
);
|
|
112
156
|
if (!builder) {
|
|
113
157
|
return void 0;
|
|
114
158
|
}
|
|
@@ -131,10 +175,18 @@ class MutationGenerator {
|
|
|
131
175
|
return `${realmState.entity.entityName}_${subTreePlaceholder}`;
|
|
132
176
|
}
|
|
133
177
|
addDeleteMutation(entityName, deletedId, alias, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder()) {
|
|
134
|
-
return queryBuilder.delete(
|
|
178
|
+
return queryBuilder.delete(
|
|
179
|
+
entityName,
|
|
180
|
+
(builder) => builder.ok().node((builder2) => builder2.column(PRIMARY_KEY_NAME)).by({ [PRIMARY_KEY_NAME]: deletedId }).errors().errorMessage(),
|
|
181
|
+
alias
|
|
182
|
+
);
|
|
135
183
|
}
|
|
136
184
|
addUpdateMutation(processedPlaceholdersByEntity, entityRealm, alias, nodeFragmentName, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder(), fieldMarkers) {
|
|
137
|
-
const updateBuilder = this.registerUpdateMutationPart(
|
|
185
|
+
const updateBuilder = this.registerUpdateMutationPart(
|
|
186
|
+
processedPlaceholdersByEntity,
|
|
187
|
+
entityRealm,
|
|
188
|
+
new CrudQueryBuilder.WriteDataBuilder()
|
|
189
|
+
);
|
|
138
190
|
if (updateBuilder.data === void 0 || isEmptyObject(updateBuilder.data)) {
|
|
139
191
|
return void 0;
|
|
140
192
|
}
|
|
@@ -142,24 +194,42 @@ class MutationGenerator {
|
|
|
142
194
|
if (!runtimeId.existsOnServer) {
|
|
143
195
|
return void 0;
|
|
144
196
|
}
|
|
145
|
-
const readBuilder = QueryGenerator.registerQueryPart(
|
|
197
|
+
const readBuilder = QueryGenerator.registerQueryPart(
|
|
198
|
+
fieldMarkers,
|
|
199
|
+
CrudQueryBuilder.ReadBuilder.instantiate()
|
|
200
|
+
);
|
|
146
201
|
if (nodeFragmentName) {
|
|
147
202
|
queryBuilder = queryBuilder.fragment(nodeFragmentName, entityRealm.entity.entityName, readBuilder);
|
|
148
203
|
}
|
|
149
|
-
return queryBuilder.update(
|
|
204
|
+
return queryBuilder.update(
|
|
205
|
+
entityRealm.entity.entityName,
|
|
206
|
+
(builder) => builder.node(nodeFragmentName ? (builder2) => builder2.applyFragment(nodeFragmentName) : readBuilder).data(updateBuilder).by({ [PRIMARY_KEY_NAME]: runtimeId.value }).ok().validation().errors().errorMessage(),
|
|
207
|
+
alias
|
|
208
|
+
);
|
|
150
209
|
}
|
|
151
210
|
addCreateMutation(processedPlaceholdersByEntity, entityRealm, alias, nodeFragmentName, queryBuilder = new CrudQueryBuilder.CrudQueryBuilder(), fieldMarkers) {
|
|
152
|
-
const createBuilder = this.registerCreateMutationPart(
|
|
211
|
+
const createBuilder = this.registerCreateMutationPart(
|
|
212
|
+
processedPlaceholdersByEntity,
|
|
213
|
+
entityRealm,
|
|
214
|
+
new CrudQueryBuilder.WriteDataBuilder()
|
|
215
|
+
);
|
|
153
216
|
if (createBuilder.data === void 0 || isEmptyObject(createBuilder.data)) {
|
|
154
217
|
return void 0;
|
|
155
218
|
}
|
|
156
|
-
const readBuilder = QueryGenerator.registerQueryPart(
|
|
219
|
+
const readBuilder = QueryGenerator.registerQueryPart(
|
|
220
|
+
fieldMarkers,
|
|
221
|
+
CrudQueryBuilder.ReadBuilder.instantiate()
|
|
222
|
+
);
|
|
157
223
|
if (nodeFragmentName) {
|
|
158
224
|
queryBuilder = queryBuilder.fragment(nodeFragmentName, entityRealm.entity.entityName, readBuilder);
|
|
159
225
|
}
|
|
160
|
-
return queryBuilder.create(
|
|
161
|
-
|
|
162
|
-
|
|
226
|
+
return queryBuilder.create(
|
|
227
|
+
entityRealm.entity.entityName,
|
|
228
|
+
(builder) => {
|
|
229
|
+
return builder.node(nodeFragmentName ? (builder2) => builder2.applyFragment(nodeFragmentName) : readBuilder).data(createBuilder).ok().validation().errors().errorMessage();
|
|
230
|
+
},
|
|
231
|
+
alias
|
|
232
|
+
);
|
|
163
233
|
}
|
|
164
234
|
registerCreateMutationPart(processedPlaceholdersByEntity, currentState, builder = new CrudQueryBuilder.WriteDataBuilder()) {
|
|
165
235
|
let processedPlaceholders = processedPlaceholdersByEntity.get(currentState.entity);
|
|
@@ -247,11 +317,21 @@ class MutationGenerator {
|
|
|
247
317
|
break;
|
|
248
318
|
}
|
|
249
319
|
case "hasOne": {
|
|
250
|
-
builder = this.registerCreateEntityPart(
|
|
320
|
+
builder = this.registerCreateEntityPart(
|
|
321
|
+
processedPlaceholdersByEntity,
|
|
322
|
+
field.fieldState,
|
|
323
|
+
field.marker,
|
|
324
|
+
builder
|
|
325
|
+
);
|
|
251
326
|
break;
|
|
252
327
|
}
|
|
253
328
|
case "hasMany": {
|
|
254
|
-
builder = this.registerCreateEntityListPart(
|
|
329
|
+
builder = this.registerCreateEntityListPart(
|
|
330
|
+
processedPlaceholdersByEntity,
|
|
331
|
+
field.fieldState,
|
|
332
|
+
field.marker,
|
|
333
|
+
builder
|
|
334
|
+
);
|
|
255
335
|
break;
|
|
256
336
|
}
|
|
257
337
|
default:
|
|
@@ -356,7 +436,9 @@ class MutationGenerator {
|
|
|
356
436
|
if (fieldState.type === "entityRealmStub") {
|
|
357
437
|
return builder2;
|
|
358
438
|
}
|
|
359
|
-
return builder2.update(
|
|
439
|
+
return builder2.update(
|
|
440
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, fieldState, builder3)
|
|
441
|
+
);
|
|
360
442
|
}
|
|
361
443
|
const plannedDeletion = currentState.plannedHasOneDeletions?.get(placeholderName);
|
|
362
444
|
if (plannedDeletion !== void 0) {
|
|
@@ -367,7 +449,9 @@ class MutationGenerator {
|
|
|
367
449
|
[PRIMARY_KEY_NAME]: runtimeId.value
|
|
368
450
|
});
|
|
369
451
|
}
|
|
370
|
-
const subBuilder2 = builder2.create(
|
|
452
|
+
const subBuilder2 = builder2.create(
|
|
453
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, fieldState)
|
|
454
|
+
);
|
|
371
455
|
if (isEmptyObject(subBuilder2.data)) {
|
|
372
456
|
return builder2.disconnect();
|
|
373
457
|
}
|
|
@@ -392,7 +476,11 @@ class MutationGenerator {
|
|
|
392
476
|
if (fieldState.type === "entityRealmStub") {
|
|
393
477
|
return builder2;
|
|
394
478
|
}
|
|
395
|
-
return builder2.update(
|
|
479
|
+
return builder2.update(
|
|
480
|
+
reducedBy,
|
|
481
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, fieldState, builder3),
|
|
482
|
+
alias
|
|
483
|
+
);
|
|
396
484
|
}
|
|
397
485
|
const plannedDeletion = currentState.plannedHasOneDeletions?.get(placeholderName);
|
|
398
486
|
if (plannedDeletion !== void 0) {
|
|
@@ -401,7 +489,9 @@ class MutationGenerator {
|
|
|
401
489
|
if (runtimeId.existsOnServer) {
|
|
402
490
|
return builder2.disconnect(reducedBy, alias).connect({ [PRIMARY_KEY_NAME]: runtimeId.value }, alias);
|
|
403
491
|
}
|
|
404
|
-
const subBuilder = builder2.create(
|
|
492
|
+
const subBuilder = builder2.create(
|
|
493
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, fieldState)
|
|
494
|
+
);
|
|
405
495
|
if (isEmptyObject(subBuilder.data)) {
|
|
406
496
|
return builder2.disconnect(reducedBy, alias);
|
|
407
497
|
}
|
|
@@ -434,13 +524,20 @@ class MutationGenerator {
|
|
|
434
524
|
if (runtimeId.existsOnServer) {
|
|
435
525
|
if (persistedEntityIds.has(runtimeId.value)) {
|
|
436
526
|
if (childState.type !== "entityRealmStub") {
|
|
437
|
-
builder2 = builder2.update(
|
|
527
|
+
builder2 = builder2.update(
|
|
528
|
+
{ [PRIMARY_KEY_NAME]: runtimeId.value },
|
|
529
|
+
(builder3) => this.registerUpdateMutationPart(processedPlaceholdersByEntity, childState, builder3),
|
|
530
|
+
alias
|
|
531
|
+
);
|
|
438
532
|
}
|
|
439
533
|
} else {
|
|
440
534
|
builder2 = builder2.connect({ [PRIMARY_KEY_NAME]: runtimeId.value }, alias);
|
|
441
535
|
}
|
|
442
536
|
} else {
|
|
443
|
-
builder2 = builder2.create(
|
|
537
|
+
builder2 = builder2.create(
|
|
538
|
+
this.registerCreateMutationPart(processedPlaceholdersByEntity, childState),
|
|
539
|
+
alias
|
|
540
|
+
);
|
|
444
541
|
}
|
|
445
542
|
}
|
|
446
543
|
if (fieldState.plannedRemovals) {
|
|
@@ -469,15 +566,17 @@ class MutationGenerator {
|
|
|
469
566
|
if (typeof value !== "string") {
|
|
470
567
|
return value;
|
|
471
568
|
}
|
|
472
|
-
const fieldSchema = this.treeStore.schema.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
569
|
+
const fieldSchema = this.treeStore.schema.getEntityColumn(
|
|
570
|
+
fieldState.parent.entity.entityName,
|
|
571
|
+
fieldState.fieldMarker.fieldName
|
|
572
|
+
);
|
|
476
573
|
return fieldSchema.enumName === null ? value : new GraphQlBuilder.GraphQlLiteral(value);
|
|
477
574
|
}
|
|
478
575
|
createAlias() {
|
|
479
576
|
return `op_${this.aliasCounter++}`;
|
|
480
577
|
}
|
|
481
578
|
}
|
|
482
|
-
export {
|
|
579
|
+
export {
|
|
580
|
+
MutationGenerator
|
|
581
|
+
};
|
|
483
582
|
//# sourceMappingURL=MutationGenerator.js.map
|