@contember/binding 1.1.0-alpha.9 → 1.1.0-beta.2
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 +3 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/development/accessorTree/DirtinessContext.js +3 -1
- package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/development/accessorTree/MutationStateContext.js +3 -1
- package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +8 -2
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js +10 -5
- package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/development/accessorTree/metadataToRequestError.js +3 -1
- package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/development/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js +63 -53
- 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 +146 -148
- 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 +3 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/production/accessorTree/DirtinessContext.js +3 -1
- package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/production/accessorTree/MutationStateContext.js +3 -1
- package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +8 -2
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js +10 -5
- package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/production/accessorTree/metadataToRequestError.js +3 -1
- package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/production/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js +63 -53
- 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 +146 -148
- 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 +7 -3
- package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +2 -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/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 +11 -4
- package/src/accessorTree/AccessorTreeStateAction.ts +3 -1
- 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 +6 -3
- 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 +136 -162
- 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
|
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import * as ReactDOM from "react-dom";
|
|
8
8
|
import { BindingError } from "../BindingError.js";
|
|
9
|
-
import { getEntityMarker } from "./state/getEntityMarker.js";
|
|
10
9
|
import { StateIterator } from "./state/StateIterator.js";
|
|
10
|
+
import { getEntityMarker } from "./state/getEntityMarker.js";
|
|
11
11
|
import { assertNever } from "../utils/assertNever.js";
|
|
12
12
|
class EventManager {
|
|
13
13
|
constructor(asyncBatchUpdatesOptions, batchUpdatesOptions, config, dirtinessTracker, onUpdate, treeStore) {
|
|
@@ -80,7 +80,9 @@ class EventManager {
|
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (this.isFrozenWhileUpdating) {
|
|
83
|
-
throw new BindingError(
|
|
83
|
+
throw new BindingError(
|
|
84
|
+
`Trying to perform an update while the whole accessor tree is already updating. This is most likely caused by updating the accessor tree while rendering or from within the 'update' event handler, which is a no-op. If you wish to mutate the tree in reaction to other changes, use the 'beforeUpdate' event.`
|
|
85
|
+
);
|
|
84
86
|
}
|
|
85
87
|
const newMetadata = this.getNewUpdateMetadata();
|
|
86
88
|
if (!this.shouldFlushUpdates(newMetadata)) {
|
|
@@ -321,7 +323,9 @@ class EventManager {
|
|
|
321
323
|
}
|
|
322
324
|
this.triggerOnInitialize();
|
|
323
325
|
}
|
|
324
|
-
throw new BindingError(
|
|
326
|
+
throw new BindingError(
|
|
327
|
+
`Maximum stabilization limit of updates caused by 'beforeUpdate' exceeded. This likely means there is an infinite feedback loop in your code.`
|
|
328
|
+
);
|
|
325
329
|
});
|
|
326
330
|
}
|
|
327
331
|
triggerOnInitialize() {
|
|
@@ -400,5 +404,7 @@ class EventManager {
|
|
|
400
404
|
}
|
|
401
405
|
}
|
|
402
406
|
__publicField(EventManager, "NO_CHANGES_DIFFERENCE", 0);
|
|
403
|
-
export {
|
|
407
|
+
export {
|
|
408
|
+
EventManager
|
|
409
|
+
};
|
|
404
410
|
//# sourceMappingURL=EventManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventManager.js","sources":["../../../src/core/EventManager.ts"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nimport type {\n\tAsyncBatchUpdatesOptions,\n\tBatchUpdatesOptions,\n\tEntityAccessor,\n\tEntityListAccessor,\n\tFieldAccessor,\n\tPersistErrorOptions,\n\tPersistSuccessOptions,\n} from '../accessors'\nimport type { SuccessfulPersistResult } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { PlaceholderName } from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { Config } from './Config'\nimport type { DirtinessTracker } from './DirtinessTracker'\nimport {\n\tEntityListState,\n\tEntityRealmState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n\tStateINode,\n\tStateIterator,\n\tStateNode,\n} from './state'\nimport type { TreeStore } from './TreeStore'\nimport type { UpdateMetadata } from './UpdateMetadata'\nimport type { EventListenersStore } from '../treeParameters'\n\nexport class EventManager {\n\tpublic static readonly NO_CHANGES_DIFFERENCE = 0\n\n\tprivate transactionDepth = 0\n\tprivate isFrozenWhileUpdating = false\n\n\t// This should ideally not exists as it should be synonymous to `this.ongoingPersistOperation !== undefined`\n\t// but it makes persist-related promise juggling significantly more straightforward.\n\tprivate isMutating: boolean = false\n\tprivate ongoingPersistOperation: Promise<SuccessfulPersistResult> | undefined = undefined\n\n\tprivate previousMetadata: UpdateMetadata | undefined = undefined\n\n\tprivate newlyInitializedWithListeners: Set<EntityListState | EntityRealmState | FieldState> = new Set()\n\tprivate pendingWithBeforeUpdate: Set<StateNode> = new Set()\n\tprivate rootsWithPendingUpdates: Set<RootStateNode> = new Set()\n\n\tpublic constructor(\n\t\tprivate readonly asyncBatchUpdatesOptions: AsyncBatchUpdatesOptions,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly dirtinessTracker: DirtinessTracker,\n\t\tprivate readonly onUpdate: (metadata: UpdateMetadata) => void,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic async persistOperation(operation: () => Promise<SuccessfulPersistResult>): Promise<SuccessfulPersistResult> {\n\t\tif (this.transactionDepth > 0) {\n\t\t\tthrow new BindingError(`Cannot trigger a persist whilst batching updates!`)\n\t\t}\n\t\tconst ongoingOperation = this.ongoingPersistOperation\n\t\tif (ongoingOperation !== undefined) {\n\t\t\treturn await ongoingOperation\n\t\t}\n\t\treturn await (this.ongoingPersistOperation = new Promise<SuccessfulPersistResult>(async (resolve, reject) => {\n\t\t\tthis.isMutating = true\n\t\t\tthis.flushUpdates() // Let the world know that we're mutating\n\n\t\t\ttry {\n\t\t\t\tresolve(await this.asyncOperation(operation))\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('PersistError', e)\n\t\t\t\treject(e)\n\t\t\t} finally {\n\t\t\t\tthis.ongoingPersistOperation = undefined\n\t\t\t\tthis.isMutating = false\n\t\t\t\tthis.flushUpdates()\n\t\t\t}\n\t\t}))\n\t}\n\n\tpublic syncTransaction<T>(transaction: () => T) {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic syncOperation<T>(operation: () => T) {\n\t\tconst result = this.syncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tpublic async asyncTransaction<T>(transaction: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn await transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic async asyncOperation<T>(operation: () => Promise<T>): Promise<T> {\n\t\tconst result = await this.asyncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tprivate flushUpdates() {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn\n\t\t}\n\n\t\tif (this.isFrozenWhileUpdating) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Trying to perform an update while the whole accessor tree is already updating. This is most likely caused ` +\n\t\t\t\t\t`by updating the accessor tree while rendering or from within the 'update' event handler, which is a no-op. ` +\n\t\t\t\t\t`If you wish to mutate the tree in reaction to other changes, use the 'beforeUpdate' event.`,\n\t\t\t)\n\t\t}\n\n\t\tconst newMetadata = this.getNewUpdateMetadata()\n\n\t\tif (!this.shouldFlushUpdates(newMetadata)) {\n\t\t\treturn\n\t\t}\n\n\t\tReactDOM.unstable_batchedUpdates(() => {\n\t\t\tthis.isFrozenWhileUpdating = true\n\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\tthis.onUpdate(newMetadata)\n\t\t\tthis.flushPendingAccessorUpdates(Array.from(this.rootsWithPendingUpdates))\n\n\t\t\tthis.rootsWithPendingUpdates.clear()\n\t\t\tthis.isFrozenWhileUpdating = false\n\t\t\tthis.previousMetadata = newMetadata\n\t\t})\n\t}\n\n\tprivate getNewUpdateMetadata(): UpdateMetadata {\n\t\treturn {\n\t\t\tisMutating: this.isMutating,\n\t\t}\n\t}\n\n\tprivate shouldFlushUpdates(newMetadata: UpdateMetadata): boolean {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn false\n\t\t}\n\t\tif (this.previousMetadata === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tif (this.rootsWithPendingUpdates.size) {\n\t\t\treturn true\n\t\t}\n\t\tfor (const key in newMetadata) {\n\t\t\tconst fromPrevious = this.previousMetadata[key as keyof UpdateMetadata]\n\t\t\tconst fromNew = newMetadata[key as keyof UpdateMetadata]\n\n\t\t\tif (!Object.is(fromPrevious, fromNew)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tpublic registerNewlyInitialized(newlyInitialized: StateNode) {\n\t\tconst initializeListeners = this.getEventListeners(newlyInitialized, { type: 'initialize' })\n\n\t\tif (initializeListeners === undefined) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.newlyInitializedWithListeners.add(newlyInitialized)\n\n\t\tif (this.transactionDepth === 0) {\n\t\t\tthis.triggerOnInitialize()\n\t\t}\n\t}\n\n\tpublic registerUpdatedConnection(parentState: EntityRealmState, placeholderName: PlaceholderName) {\n\t\tif (parentState.fieldsWithPendingConnectionUpdates === undefined) {\n\t\t\tparentState.fieldsWithPendingConnectionUpdates = new Set()\n\t\t}\n\n\t\tconst marker = getEntityMarker(parentState)\n\t\tplaceholders: for (const [fieldName, placeholdersByField] of marker.fields.placeholders) {\n\t\t\tif (typeof placeholdersByField === 'string') {\n\t\t\t\tif (placeholdersByField === placeholderName) {\n\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const placeholderByFieldName of placeholdersByField) {\n\t\t\t\t\tif (placeholderByFieldName === placeholderName) {\n\t\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t\t\tcontinue placeholders\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic registerJustUpdated(justUpdated: StateNode, changesDelta: number) {\n\t\tconst beforeUpdateListeners = this.getEventListeners(justUpdated, { type: 'beforeUpdate' })\n\t\tif (beforeUpdateListeners !== undefined) {\n\t\t\tthis.pendingWithBeforeUpdate.add(justUpdated)\n\t\t}\n\t\tjustUpdated.accessor = undefined\n\n\t\tswitch (justUpdated.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList': {\n\t\t\t\tjustUpdated.unpersistedChangesCount += changesDelta\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (justUpdated.unpersistedChangesCount < 0) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`We have *JUST* reached a completely invalid state. From now on, anything can (and likely will) ` +\n\t\t\t\t\t\t\t\t`go wrong. This is definitely a bug. Please try to report whatever led to this situation.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst parent = justUpdated.blueprint.parent\n\n\t\t\t\tif (parent === undefined) {\n\t\t\t\t\tthis.rootsWithPendingUpdates.add(justUpdated)\n\t\t\t\t\tthis.dirtinessTracker.increaseBy(changesDelta)\n\t\t\t\t} else {\n\t\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t\t}\n\t\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\t\tthis.registerJustUpdated(parent, changesDelta)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'field': {\n\t\t\t\tconst parent = justUpdated.parent\n\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t}\n\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\tthis.registerJustUpdated(justUpdated.parent, changesDelta)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate flushPendingAccessorUpdates(rootStates: Array<StateINode>) {\n\t\t// It is *CRUCIAL* that this is a BFS so that we update the components in top-down order.\n\t\tconst agenda: StateNode[] = rootStates\n\n\t\tfor (const state of agenda) {\n\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\tconst updateListeners =\n\t\t\t\tstate.type === 'field'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t\t: this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\n\t\t\tif (updateListeners !== undefined) {\n\t\t\t\tfor (const handler of updateListeners) {\n\t\t\t\t\t// TS can't quite handle the polymorphism here but this is fine.\n\t\t\t\t\thandler()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (state.type === 'entityRealm' && state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\tfor (const updatedField of state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'connectionUpdate', key: updatedField })\n\t\t\t\t\tif (!listeners) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener(state.getAccessor())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch (state.type) {\n\t\t\t\tcase 'entityRealm':\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tif (state.childrenWithPendingUpdates !== undefined) {\n\t\t\t\t\t\tfor (const childState of state.childrenWithPendingUpdates) {\n\t\t\t\t\t\t\tagenda.push(childState)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.childrenWithPendingUpdates.clear()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'field':\n\t\t\t\t\t// Do nothing\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(state)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async triggerAsyncMutatingEvent(eventType: 'beforePersist', options: AsyncBatchUpdatesOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(eventType: 'persistSuccess', options: PersistSuccessOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(\n\t\teventType: 'beforePersist' | 'persistSuccess',\n\t\toptions: AsyncBatchUpdatesOptions | PersistSuccessOptions,\n\t): Promise<void> {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\t// TODO if an entity from here (or its parent) gets deleted, we need to remove stale handlers from here.\n\t\t\tconst callbackQueue: Array<\n\t\t\t\t[\n\t\t\t\t\t// The typings could be nicer but TS…\n\t\t\t\t\tStateINode,\n\t\t\t\t\t(\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\tconst listeners = this.getEventListeners(iNode, { type: eventType }) ?? []\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tcallbackQueue.push([iNode, listener])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (\n\t\t\t\tlet waterfallDepth = 0;\n\t\t\t\twaterfallDepth < this.config.getValue(`${eventType}SettleLimit` as const);\n\t\t\t\twaterfallDepth++\n\t\t\t) {\n\t\t\t\tconst promiseReturns: Array<\n\t\t\t\t\tPromise<\n\t\t\t\t\t\t| void\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t>\n\t\t\t\t> = []\n\t\t\t\tconst correspondingStates: Array<StateINode> = []\n\n\t\t\t\tif (callbackQueue.length === 0) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tfor (const [state, callback] of callbackQueue) {\n\t\t\t\t\tcorrespondingStates.push(state)\n\t\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\t\tlet validateChanges = false\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = callback(state.getAccessor as any, options as any) // TS can't quite handle this but this is sound.\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tvalidateChanges = true\n\t\t\t\t\t\t\tpromiseReturns.push(result)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpromiseReturns.push(Promise.resolve(result))\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tpromiseReturns.push(Promise.reject(e))\n\t\t\t\t\t}\n\t\t\t\t\tif (validateChanges) {\n\t\t\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO timeout\n\n\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\tconst newCallbacks = await Promise.allSettled(promiseReturns)\n\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\n\t\t\t\tcallbackQueue.length = 0 // Empties the queue\n\n\t\t\t\t// TODO we're drifting away from the original depth-first order. Let's see if that's ever even an issue.\n\t\t\t\tfor (const newlyInitialized of this.newlyInitializedWithListeners) {\n\t\t\t\t\tif (newlyInitialized.type === 'field') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst beforePersistHandlers = this.getEventListeners(newlyInitialized, { type: eventType })\n\t\t\t\t\tif (beforePersistHandlers) {\n\t\t\t\t\t\tfor (const listener of beforePersistHandlers) {\n\t\t\t\t\t\t\tcallbackQueue.push([newlyInitialized, listener])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\t\tthis.handleRejections(eventType, newCallbacks)\n\n\t\t\t\tfor (let i = 0; i < newCallbacks.length; i++) {\n\t\t\t\t\tconst result = newCallbacks[i]\n\t\t\t\t\tconst correspondingState = correspondingStates[i]\n\n\t\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\t\tif (typeof result.value === 'function') {\n\t\t\t\t\t\t\tcallbackQueue.push([correspondingState, result.value])\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Otherwise do nothing. This is just a handler that albeit async, doesn't appear to\n\t\t\t\t\t\t// interact with data binding.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tif (callbackQueue.length) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Exceeded the ${eventType} settle limit. Your code likely contains a deadlock. ` +\n\t\t\t\t\t\t\t`If that's not the case, raise the settle limit from DataBindingProvider.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate triggerBeforeFlushEvents() {\n\t\tthis.syncTransaction(() => {\n\t\t\tconst settleLimit = this.config.getValue('beforeUpdateSettleLimit')\n\n\t\t\tfor (let attemptNumber = 0; attemptNumber < settleLimit; attemptNumber++) {\n\t\t\t\tif (!this.pendingWithBeforeUpdate.size) {\n\t\t\t\t\tthis.triggerOnInitialize()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst withBeforeUpdate = this.pendingWithBeforeUpdate\n\t\t\t\tthis.pendingWithBeforeUpdate = new Set()\n\n\t\t\t\tfor (const state of withBeforeUpdate) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'beforeUpdate' })\n\t\t\t\t\tif (listeners === undefined) {\n\t\t\t\t\t\t// This can happen if the listener has unsubscribed since we added it to the set.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tswitch (state.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\t(listener as FieldAccessor.BeforeUpdateListener)(state.getAccessor())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\tstate.getAccessor().batchUpdates(listener as any)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(state)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerOnInitialize()\n\t\t\t}\n\t\t\tthrow new BindingError(\n\t\t\t\t`Maximum stabilization limit of updates caused by 'beforeUpdate' exceeded. ` +\n\t\t\t\t\t`This likely means there is an infinite feedback loop in your code.`,\n\t\t\t)\n\t\t})\n\t}\n\n\tprivate triggerOnInitialize() {\n\t\tthis.syncTransaction(() => {\n\t\t\tfor (const state of this.newlyInitializedWithListeners) {\n\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\tconst listeners =\n\t\t\t\t\tstate.type === 'field'\n\t\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t\t: this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (state.type === 'entityRealm') {\n\t\t\t\t\tstate.entity.hasIdSetInStone = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.newlyInitializedWithListeners.clear()\n\t\t})\n\t}\n\n\tpublic async triggerOnPersistError(options: PersistErrorOptions) {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\tconst handlerPromises: Array<Promise<void>> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\t\tconst dispatchers =\n\t\t\t\t\t\tiNode.type === 'entityRealm'\n\t\t\t\t\t\t\t? this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\t\t\t: this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\tif (dispatchers === undefined) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of dispatchers ?? []) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst result = listener()\n\t\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\t\thandlerPromises.push(result)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thandlerPromises.push(Promise.resolve(result))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\thandlerPromises.push(Promise.reject(e))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO timeout\n\t\t\tconst handlerResults = await Promise.allSettled(handlerPromises)\n\t\t\tthis.handleRejections('persistError', handlerResults)\n\t\t})\n\t}\n\n\tpublic async triggerOnBeforePersist() {\n\t\treturn this.triggerAsyncMutatingEvent('beforePersist', this.asyncBatchUpdatesOptions)\n\t}\n\n\tpublic async triggerOnPersistSuccess(options: PersistSuccessOptions) {\n\t\treturn this.triggerAsyncMutatingEvent('persistSuccess', options)\n\t}\n\n\tpublic getEventListeners<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends\n\t\t\tExclude<State['eventListeners'], undefined> extends EventListenersStore<infer Keys, infer Map> ? [Keys, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(state: State, event: { type: EventType; key?: string }): Set<Exclude<EventListenerTypes[1][EventType], undefined>> | undefined {\n\t\tif (!state.eventListeners) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn (state.eventListeners as EventListenersStore<EventType, EventListenerTypes[1]>).get(event) as Set<\n\t\t\tExclude<EventListenerTypes[1][EventType], undefined>\n\t\t>\n\t}\n\n\tpublic getEventDispatchers<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends\n\t\t\tExclude<State['eventListeners'], undefined> extends EventListenersStore<infer Keys, infer Map> ? [Keys, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(\n\t\tstate: State,\n\t\tevent: { type: EventType; key?: string },\n\t\tlistenerArgs: Parameters<Exclude<EventListenerTypes[1][EventType], undefined>>,\n\t): Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>> | undefined {\n\t\tconst eventListeners = this.getEventListeners(state, event)\n\t\tif (eventListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn Array.from(eventListeners.values(), listener => {\n\t\t\treturn () => listener(...listenerArgs)\n\t\t}) as Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>>\n\t}\n\n\tprivate handleRejections(handler: string, promises: PromiseSettledResult<any>[]) {\n\t\tconst rejections = promises.filter((it): it is PromiseRejectedResult => it.status === 'rejected')\n\t\tif (rejections.length === 0) {\n\t\t\treturn\n\t\t}\n\t\trejections.forEach(it => console.error(it.reason))\n\t\tif (import.meta.env.DEV) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`A ${handler} handler returned a promise that rejected. ` +\n\t\t\t\t\t`This is a no-op that will fail silently in production.`,\n\t\t\t)\n\t\t}\n\t}\n\n\n\tprivate validateWithoutChanges(initialCount: number, eventType: string): void {\n\t\tconst changesCountAfter = this.dirtinessTracker.getTotalTouchCount()\n\t\tif (import.meta.env.DEV) {\n\t\t\tif (initialCount !== changesCountAfter) {\n\t\t\t\t// This isn't bulletproof. They could e.g. undo a change and make another one which would\n\t\t\t\t// slip through this detection. But for most cases, it should be good enough and not too expensive.\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`A ${eventType} event handler cannot be asynchronous and alter the accessor tree at the same time. ` +\n\t\t\t\t\t`To achieve this, prepare your data asynchronously but only touch the tree from a returned callback.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA8BO,MAAM,aAAa;AAAA,EAiBlB,YACW,0BACA,qBACA,QACA,kBACA,UACA,WAChB;AArBM,4CAAmB;AACnB,iDAAwB;AAIxB,sCAAsB;AACtB;AAEA;AAEA,6EAA0F;AAC1F,uEAA8C;AAC9C,uEAAkD;AAGxC,SAAA,2BAAA;AACA,SAAA,sBAAA;AACA,SAAA,SAAA;AACA,SAAA,mBAAA;AACA,SAAA,WAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,QAEU,iBAAiB,WAAqF;AAC9G,QAAA,KAAK,mBAAmB,GAAG;AACxB,YAAA,IAAI,aAAa,mDAAmD;AAAA,IAC3E;AACA,UAAM,mBAAmB,KAAK;AAC9B,QAAI,qBAAqB,QAAW;AACnC,aAAO,MAAM;AAAA,IACd;AAC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AAA,MAAM,SAAS,GAAG,YAAY;AAAA,IAAA,CACrC;AAAA,EACF;AAAA,EAEQ,iBAAiB,SAAiB,UAAuC;AAChF,UAAM,aAAa,SAAS,OAAO,CAAC,OAAoC,GAAG,WAAW,UAAU;AAC5F,QAAA,WAAW,WAAW,GAAG;AAC5B;AAAA,IACD;AACA,eAAW,QAAQ,CAAM,OAAA,QAAQ,MAAM,GAAG,MAAM,CAAC;AAAA,EAOlD;AAAA,EAGQ,uBAAuB,cAAsB,WAAyB;AACnD,SAAK,iBAAiB,mBAAmB;AAAA,EAWpE;AACD;AA1iBwB,cADjB,cACiB,yBAAwB;;"}
|
|
1
|
+
{"version":3,"file":"EventManager.js","sources":["../../../src/core/EventManager.ts"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nimport type {\n\tAsyncBatchUpdatesOptions,\n\tBatchUpdatesOptions,\n\tEntityAccessor,\n\tEntityListAccessor,\n\tFieldAccessor,\n\tPersistErrorOptions,\n\tPersistSuccessOptions,\n} from '../accessors'\nimport type { SuccessfulPersistResult } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { PlaceholderName } from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { Config } from './Config'\nimport type { DirtinessTracker } from './DirtinessTracker'\nimport {\n\tEntityListState,\n\tEntityRealmState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n\tStateINode,\n\tStateIterator,\n\tStateNode,\n} from './state'\nimport type { TreeStore } from './TreeStore'\nimport type { UpdateMetadata } from './UpdateMetadata'\nimport type { EventListenersStore } from '../treeParameters'\n\nexport class EventManager {\n\tpublic static readonly NO_CHANGES_DIFFERENCE = 0\n\n\tprivate transactionDepth = 0\n\tprivate isFrozenWhileUpdating = false\n\n\t// This should ideally not exists as it should be synonymous to `this.ongoingPersistOperation !== undefined`\n\t// but it makes persist-related promise juggling significantly more straightforward.\n\tprivate isMutating: boolean = false\n\tprivate ongoingPersistOperation: Promise<SuccessfulPersistResult> | undefined = undefined\n\n\tprivate previousMetadata: UpdateMetadata | undefined = undefined\n\n\tprivate newlyInitializedWithListeners: Set<EntityListState | EntityRealmState | FieldState> = new Set()\n\tprivate pendingWithBeforeUpdate: Set<StateNode> = new Set()\n\tprivate rootsWithPendingUpdates: Set<RootStateNode> = new Set()\n\n\tpublic constructor(\n\t\tprivate readonly asyncBatchUpdatesOptions: AsyncBatchUpdatesOptions,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly dirtinessTracker: DirtinessTracker,\n\t\tprivate readonly onUpdate: (metadata: UpdateMetadata) => void,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic async persistOperation(operation: () => Promise<SuccessfulPersistResult>): Promise<SuccessfulPersistResult> {\n\t\tif (this.transactionDepth > 0) {\n\t\t\tthrow new BindingError(`Cannot trigger a persist whilst batching updates!`)\n\t\t}\n\t\tconst ongoingOperation = this.ongoingPersistOperation\n\t\tif (ongoingOperation !== undefined) {\n\t\t\treturn await ongoingOperation\n\t\t}\n\t\treturn await (this.ongoingPersistOperation = new Promise<SuccessfulPersistResult>(async (resolve, reject) => {\n\t\t\tthis.isMutating = true\n\t\t\tthis.flushUpdates() // Let the world know that we're mutating\n\n\t\t\ttry {\n\t\t\t\tresolve(await this.asyncOperation(operation))\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('PersistError', e)\n\t\t\t\treject(e)\n\t\t\t} finally {\n\t\t\t\tthis.ongoingPersistOperation = undefined\n\t\t\t\tthis.isMutating = false\n\t\t\t\tthis.flushUpdates()\n\t\t\t}\n\t\t}))\n\t}\n\n\tpublic syncTransaction<T>(transaction: () => T) {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic syncOperation<T>(operation: () => T) {\n\t\tconst result = this.syncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tpublic async asyncTransaction<T>(transaction: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn await transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic async asyncOperation<T>(operation: () => Promise<T>): Promise<T> {\n\t\tconst result = await this.asyncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tprivate flushUpdates() {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn\n\t\t}\n\n\t\tif (this.isFrozenWhileUpdating) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Trying to perform an update while the whole accessor tree is already updating. This is most likely caused ` +\n\t\t\t\t\t`by updating the accessor tree while rendering or from within the 'update' event handler, which is a no-op. ` +\n\t\t\t\t\t`If you wish to mutate the tree in reaction to other changes, use the 'beforeUpdate' event.`,\n\t\t\t)\n\t\t}\n\n\t\tconst newMetadata = this.getNewUpdateMetadata()\n\n\t\tif (!this.shouldFlushUpdates(newMetadata)) {\n\t\t\treturn\n\t\t}\n\n\t\tReactDOM.unstable_batchedUpdates(() => {\n\t\t\tthis.isFrozenWhileUpdating = true\n\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\tthis.onUpdate(newMetadata)\n\t\t\tthis.flushPendingAccessorUpdates(Array.from(this.rootsWithPendingUpdates))\n\n\t\t\tthis.rootsWithPendingUpdates.clear()\n\t\t\tthis.isFrozenWhileUpdating = false\n\t\t\tthis.previousMetadata = newMetadata\n\t\t})\n\t}\n\n\tprivate getNewUpdateMetadata(): UpdateMetadata {\n\t\treturn {\n\t\t\tisMutating: this.isMutating,\n\t\t}\n\t}\n\n\tprivate shouldFlushUpdates(newMetadata: UpdateMetadata): boolean {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn false\n\t\t}\n\t\tif (this.previousMetadata === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tif (this.rootsWithPendingUpdates.size) {\n\t\t\treturn true\n\t\t}\n\t\tfor (const key in newMetadata) {\n\t\t\tconst fromPrevious = this.previousMetadata[key as keyof UpdateMetadata]\n\t\t\tconst fromNew = newMetadata[key as keyof UpdateMetadata]\n\n\t\t\tif (!Object.is(fromPrevious, fromNew)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tpublic registerNewlyInitialized(newlyInitialized: StateNode) {\n\t\tconst initializeListeners = this.getEventListeners(newlyInitialized, { type: 'initialize' })\n\n\t\tif (initializeListeners === undefined) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.newlyInitializedWithListeners.add(newlyInitialized)\n\n\t\tif (this.transactionDepth === 0) {\n\t\t\tthis.triggerOnInitialize()\n\t\t}\n\t}\n\n\tpublic registerUpdatedConnection(parentState: EntityRealmState, placeholderName: PlaceholderName) {\n\t\tif (parentState.fieldsWithPendingConnectionUpdates === undefined) {\n\t\t\tparentState.fieldsWithPendingConnectionUpdates = new Set()\n\t\t}\n\n\t\tconst marker = getEntityMarker(parentState)\n\t\tplaceholders: for (const [fieldName, placeholdersByField] of marker.fields.placeholders) {\n\t\t\tif (typeof placeholdersByField === 'string') {\n\t\t\t\tif (placeholdersByField === placeholderName) {\n\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const placeholderByFieldName of placeholdersByField) {\n\t\t\t\t\tif (placeholderByFieldName === placeholderName) {\n\t\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t\t\tcontinue placeholders\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic registerJustUpdated(justUpdated: StateNode, changesDelta: number) {\n\t\tconst beforeUpdateListeners = this.getEventListeners(justUpdated, { type: 'beforeUpdate' })\n\t\tif (beforeUpdateListeners !== undefined) {\n\t\t\tthis.pendingWithBeforeUpdate.add(justUpdated)\n\t\t}\n\t\tjustUpdated.accessor = undefined\n\n\t\tswitch (justUpdated.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList': {\n\t\t\t\tjustUpdated.unpersistedChangesCount += changesDelta\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (justUpdated.unpersistedChangesCount < 0) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`We have *JUST* reached a completely invalid state. From now on, anything can (and likely will) ` +\n\t\t\t\t\t\t\t\t`go wrong. This is definitely a bug. Please try to report whatever led to this situation.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst parent = justUpdated.blueprint.parent\n\n\t\t\t\tif (parent === undefined) {\n\t\t\t\t\tthis.rootsWithPendingUpdates.add(justUpdated)\n\t\t\t\t\tthis.dirtinessTracker.increaseBy(changesDelta)\n\t\t\t\t} else {\n\t\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t\t}\n\t\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\t\tthis.registerJustUpdated(parent, changesDelta)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'field': {\n\t\t\t\tconst parent = justUpdated.parent\n\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t}\n\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\tthis.registerJustUpdated(justUpdated.parent, changesDelta)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate flushPendingAccessorUpdates(rootStates: Array<StateINode>) {\n\t\t// It is *CRUCIAL* that this is a BFS so that we update the components in top-down order.\n\t\tconst agenda: StateNode[] = rootStates\n\n\t\tfor (const state of agenda) {\n\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\tconst updateListeners =\n\t\t\t\tstate.type === 'field'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t\t: this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\n\t\t\tif (updateListeners !== undefined) {\n\t\t\t\tfor (const handler of updateListeners) {\n\t\t\t\t\t// TS can't quite handle the polymorphism here but this is fine.\n\t\t\t\t\thandler()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (state.type === 'entityRealm' && state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\tfor (const updatedField of state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'connectionUpdate', key: updatedField })\n\t\t\t\t\tif (!listeners) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener(state.getAccessor())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch (state.type) {\n\t\t\t\tcase 'entityRealm':\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tif (state.childrenWithPendingUpdates !== undefined) {\n\t\t\t\t\t\tfor (const childState of state.childrenWithPendingUpdates) {\n\t\t\t\t\t\t\tagenda.push(childState)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.childrenWithPendingUpdates.clear()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'field':\n\t\t\t\t\t// Do nothing\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(state)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async triggerAsyncMutatingEvent(eventType: 'beforePersist', options: AsyncBatchUpdatesOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(eventType: 'persistSuccess', options: PersistSuccessOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(\n\t\teventType: 'beforePersist' | 'persistSuccess',\n\t\toptions: AsyncBatchUpdatesOptions | PersistSuccessOptions,\n\t): Promise<void> {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\t// TODO if an entity from here (or its parent) gets deleted, we need to remove stale handlers from here.\n\t\t\tconst callbackQueue: Array<\n\t\t\t\t[\n\t\t\t\t\t// The typings could be nicer but TS…\n\t\t\t\t\tStateINode,\n\t\t\t\t\t(\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\tconst listeners = this.getEventListeners(iNode, { type: eventType }) ?? []\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tcallbackQueue.push([iNode, listener])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (\n\t\t\t\tlet waterfallDepth = 0;\n\t\t\t\twaterfallDepth < this.config.getValue(`${eventType}SettleLimit` as const);\n\t\t\t\twaterfallDepth++\n\t\t\t) {\n\t\t\t\tconst promiseReturns: Array<\n\t\t\t\t\tPromise<\n\t\t\t\t\t\t| void\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t>\n\t\t\t\t> = []\n\t\t\t\tconst correspondingStates: Array<StateINode> = []\n\n\t\t\t\tif (callbackQueue.length === 0) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tfor (const [state, callback] of callbackQueue) {\n\t\t\t\t\tcorrespondingStates.push(state)\n\t\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\t\tlet validateChanges = false\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = callback(state.getAccessor as any, options as any) // TS can't quite handle this but this is sound.\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tvalidateChanges = true\n\t\t\t\t\t\t\tpromiseReturns.push(result)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpromiseReturns.push(Promise.resolve(result))\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tpromiseReturns.push(Promise.reject(e))\n\t\t\t\t\t}\n\t\t\t\t\tif (validateChanges) {\n\t\t\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO timeout\n\n\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\tconst newCallbacks = await Promise.allSettled(promiseReturns)\n\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\n\t\t\t\tcallbackQueue.length = 0 // Empties the queue\n\n\t\t\t\t// TODO we're drifting away from the original depth-first order. Let's see if that's ever even an issue.\n\t\t\t\tfor (const newlyInitialized of this.newlyInitializedWithListeners) {\n\t\t\t\t\tif (newlyInitialized.type === 'field') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst beforePersistHandlers = this.getEventListeners(newlyInitialized, { type: eventType })\n\t\t\t\t\tif (beforePersistHandlers) {\n\t\t\t\t\t\tfor (const listener of beforePersistHandlers) {\n\t\t\t\t\t\t\tcallbackQueue.push([newlyInitialized, listener])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\t\tthis.handleRejections(eventType, newCallbacks)\n\n\t\t\t\tfor (let i = 0; i < newCallbacks.length; i++) {\n\t\t\t\t\tconst result = newCallbacks[i]\n\t\t\t\t\tconst correspondingState = correspondingStates[i]\n\n\t\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\t\tif (typeof result.value === 'function') {\n\t\t\t\t\t\t\tcallbackQueue.push([correspondingState, result.value])\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Otherwise do nothing. This is just a handler that albeit async, doesn't appear to\n\t\t\t\t\t\t// interact with data binding.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tif (callbackQueue.length) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Exceeded the ${eventType} settle limit. Your code likely contains a deadlock. ` +\n\t\t\t\t\t\t\t`If that's not the case, raise the settle limit from DataBindingProvider.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate triggerBeforeFlushEvents() {\n\t\tthis.syncTransaction(() => {\n\t\t\tconst settleLimit = this.config.getValue('beforeUpdateSettleLimit')\n\n\t\t\tfor (let attemptNumber = 0; attemptNumber < settleLimit; attemptNumber++) {\n\t\t\t\tif (!this.pendingWithBeforeUpdate.size) {\n\t\t\t\t\tthis.triggerOnInitialize()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst withBeforeUpdate = this.pendingWithBeforeUpdate\n\t\t\t\tthis.pendingWithBeforeUpdate = new Set()\n\n\t\t\t\tfor (const state of withBeforeUpdate) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'beforeUpdate' })\n\t\t\t\t\tif (listeners === undefined) {\n\t\t\t\t\t\t// This can happen if the listener has unsubscribed since we added it to the set.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tswitch (state.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\t(listener as FieldAccessor.BeforeUpdateListener)(state.getAccessor())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\tstate.getAccessor().batchUpdates(listener as any)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(state)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerOnInitialize()\n\t\t\t}\n\t\t\tthrow new BindingError(\n\t\t\t\t`Maximum stabilization limit of updates caused by 'beforeUpdate' exceeded. ` +\n\t\t\t\t\t`This likely means there is an infinite feedback loop in your code.`,\n\t\t\t)\n\t\t})\n\t}\n\n\tprivate triggerOnInitialize() {\n\t\tthis.syncTransaction(() => {\n\t\t\tfor (const state of this.newlyInitializedWithListeners) {\n\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\tconst listeners =\n\t\t\t\t\tstate.type === 'field'\n\t\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t\t: this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (state.type === 'entityRealm') {\n\t\t\t\t\tstate.entity.hasIdSetInStone = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.newlyInitializedWithListeners.clear()\n\t\t})\n\t}\n\n\tpublic async triggerOnPersistError(options: PersistErrorOptions) {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\tconst handlerPromises: Array<Promise<void>> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\t\tconst dispatchers =\n\t\t\t\t\t\tiNode.type === 'entityRealm'\n\t\t\t\t\t\t\t? this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\t\t\t: this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\tif (dispatchers === undefined) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of dispatchers ?? []) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst result = listener()\n\t\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\t\thandlerPromises.push(result)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thandlerPromises.push(Promise.resolve(result))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\thandlerPromises.push(Promise.reject(e))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO timeout\n\t\t\tconst handlerResults = await Promise.allSettled(handlerPromises)\n\t\t\tthis.handleRejections('persistError', handlerResults)\n\t\t})\n\t}\n\n\tpublic async triggerOnBeforePersist() {\n\t\treturn this.triggerAsyncMutatingEvent('beforePersist', this.asyncBatchUpdatesOptions)\n\t}\n\n\tpublic async triggerOnPersistSuccess(options: PersistSuccessOptions) {\n\t\treturn this.triggerAsyncMutatingEvent('persistSuccess', options)\n\t}\n\n\tpublic getEventListeners<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends\n\t\t\tExclude<State['eventListeners'], undefined> extends EventListenersStore<infer Keys, infer Map> ? [Keys, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(state: State, event: { type: EventType; key?: string }): Set<Exclude<EventListenerTypes[1][EventType], undefined>> | undefined {\n\t\tif (!state.eventListeners) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn (state.eventListeners as EventListenersStore<EventType, EventListenerTypes[1]>).get(event) as Set<\n\t\t\tExclude<EventListenerTypes[1][EventType], undefined>\n\t\t>\n\t}\n\n\tpublic getEventDispatchers<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends\n\t\t\tExclude<State['eventListeners'], undefined> extends EventListenersStore<infer Keys, infer Map> ? [Keys, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(\n\t\tstate: State,\n\t\tevent: { type: EventType; key?: string },\n\t\tlistenerArgs: Parameters<Exclude<EventListenerTypes[1][EventType], undefined>>,\n\t): Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>> | undefined {\n\t\tconst eventListeners = this.getEventListeners(state, event)\n\t\tif (eventListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn Array.from(eventListeners.values(), listener => {\n\t\t\treturn () => listener(...listenerArgs)\n\t\t}) as Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>>\n\t}\n\n\tprivate handleRejections(handler: string, promises: PromiseSettledResult<any>[]) {\n\t\tconst rejections = promises.filter((it): it is PromiseRejectedResult => it.status === 'rejected')\n\t\tif (rejections.length === 0) {\n\t\t\treturn\n\t\t}\n\t\trejections.forEach(it => console.error(it.reason))\n\t\tif (import.meta.env.DEV) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`A ${handler} handler returned a promise that rejected. ` +\n\t\t\t\t\t`This is a no-op that will fail silently in production.`,\n\t\t\t)\n\t\t}\n\t}\n\n\n\tprivate validateWithoutChanges(initialCount: number, eventType: string): void {\n\t\tconst changesCountAfter = this.dirtinessTracker.getTotalTouchCount()\n\t\tif (import.meta.env.DEV) {\n\t\t\tif (initialCount !== changesCountAfter) {\n\t\t\t\t// This isn't bulletproof. They could e.g. undo a change and make another one which would\n\t\t\t\t// slip through this detection. But for most cases, it should be good enough and not too expensive.\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`A ${eventType} event handler cannot be asynchronous and alter the accessor tree at the same time. ` +\n\t\t\t\t\t`To achieve this, prepare your data asynchronously but only touch the tree from a returned callback.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["changesCountBefore"],"mappings":";;;;;;;;;;;AA8BO,MAAM,aAAa;AAAA,EAiBlB,YACW,0BACA,qBACA,QACA,kBACA,UACA,WAChB;AArBM,4CAAmB;AACnB,iDAAwB;AAIxB,sCAAsB;AACtB;AAEA;AAEA,6EAA0F;AAC1F,uEAA8C;AAC9C,uEAAkD;AAGxC,SAAA,2BAAA;AACA,SAAA,sBAAA;AACA,SAAA,SAAA;AACA,SAAA,mBAAA;AACA,SAAA,WAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEH,MAAa,iBAAiB,WAAqF;AAC9G,QAAA,KAAK,mBAAmB,GAAG;AACxB,YAAA,IAAI,aAAa,mDAAmD;AAAA,IAC3E;AACA,UAAM,mBAAmB,KAAK;AAC9B,QAAI,qBAAqB,QAAW;AACnC,aAAO,MAAM;AAAA,IACd;AACA,WAAO,OAAO,KAAK,0BAA0B,IAAI,QAAiC,OAAO,SAAS,WAAW;AAC5G,WAAK,aAAa;AAClB,WAAK,aAAa;AAEd,UAAA;AACH,gBAAQ,MAAM,KAAK,eAAe,SAAS,CAAC;AAAA,eACpC;AACA,gBAAA,MAAM,gBAAgB,CAAC;AAC/B,eAAO,CAAC;AAAA,MAAA,UACP;AACD,aAAK,0BAA0B;AAC/B,aAAK,aAAa;AAClB,aAAK,aAAa;AAAA,MACnB;AAAA,IACA,CAAA;AAAA,EACF;AAAA,EAEO,gBAAmB,aAAsB;AAC3C,QAAA;AACE,WAAA;AACL,aAAO,YAAY;AAAA,IAAA,UAClB;AACI,WAAA;AAAA,IACN;AAAA,EACD;AAAA,EACO,cAAiB,WAAoB;AACrC,UAAA,SAAS,KAAK,gBAAgB,SAAS;AAC7C,SAAK,aAAa;AACX,WAAA;AAAA,EACR;AAAA,EAEA,MAAa,iBAAoB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.js";
|
|
8
8
|
import { TreeParameterMerger } from "./TreeParameterMerger.js";
|
|
9
|
-
import { EntityFieldsWithHoistablesMarker } from "../markers/EntityFieldsWithHoistablesMarker.js";
|
|
10
9
|
import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
|
|
11
10
|
import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
|
|
11
|
+
import { EntityFieldsWithHoistablesMarker } from "../markers/EntityFieldsWithHoistablesMarker.js";
|
|
12
12
|
class IncrementalMarkerBuilder {
|
|
13
13
|
constructor() {
|
|
14
|
-
__publicField(this, "accumulator", new EntityFieldMarkersContainer(
|
|
14
|
+
__publicField(this, "accumulator", new EntityFieldMarkersContainer(
|
|
15
|
+
false,
|
|
16
|
+
/* @__PURE__ */ new Map(),
|
|
17
|
+
/* @__PURE__ */ new Map()
|
|
18
|
+
));
|
|
15
19
|
}
|
|
16
20
|
mutateIn(addition) {
|
|
17
21
|
if (addition instanceof EntityFieldMarkersContainer) {
|
|
18
22
|
if (this.accumulator instanceof EntityFieldMarkersContainer) {
|
|
19
23
|
this.accumulator = MarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition);
|
|
20
24
|
} else {
|
|
21
|
-
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
25
|
+
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
26
|
+
MarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition),
|
|
27
|
+
this.accumulator.subTrees,
|
|
28
|
+
this.accumulator.parentReference
|
|
29
|
+
);
|
|
22
30
|
}
|
|
23
31
|
} else if (addition instanceof EntityFieldsWithHoistablesMarker) {
|
|
24
32
|
if (this.accumulator instanceof EntityFieldMarkersContainer) {
|
|
25
|
-
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
33
|
+
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
34
|
+
MarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition.fields),
|
|
35
|
+
addition.subTrees,
|
|
36
|
+
addition.parentReference
|
|
37
|
+
);
|
|
26
38
|
} else {
|
|
27
|
-
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
39
|
+
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
40
|
+
MarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition.fields),
|
|
41
|
+
MarkerMerger.mergeSubTreeMarkers(this.accumulator.subTrees, addition.subTrees),
|
|
42
|
+
TreeParameterMerger.mergeParentEntityParameters(this.accumulator.parentReference, addition.parentReference)
|
|
43
|
+
);
|
|
28
44
|
}
|
|
29
45
|
} else {
|
|
30
46
|
if (this.accumulator instanceof EntityFieldMarkersContainer) {
|
|
31
|
-
this.accumulator = MarkerMerger.mergeEntityFieldsContainers(
|
|
47
|
+
this.accumulator = MarkerMerger.mergeEntityFieldsContainers(
|
|
48
|
+
this.accumulator,
|
|
49
|
+
MarkerFactory.createEntityFieldMarkersContainer(addition)
|
|
50
|
+
);
|
|
32
51
|
} else {
|
|
33
|
-
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
52
|
+
this.accumulator = new EntityFieldsWithHoistablesMarker(
|
|
53
|
+
MarkerMerger.mergeEntityFieldsContainers(
|
|
54
|
+
this.accumulator.fields,
|
|
55
|
+
MarkerFactory.createEntityFieldMarkersContainer(addition)
|
|
56
|
+
),
|
|
57
|
+
this.accumulator.subTrees,
|
|
58
|
+
this.accumulator.parentReference
|
|
59
|
+
);
|
|
34
60
|
}
|
|
35
61
|
}
|
|
36
62
|
}
|
|
@@ -38,5 +64,7 @@ class IncrementalMarkerBuilder {
|
|
|
38
64
|
return this.accumulator;
|
|
39
65
|
}
|
|
40
66
|
}
|
|
41
|
-
export {
|
|
67
|
+
export {
|
|
68
|
+
IncrementalMarkerBuilder
|
|
69
|
+
};
|
|
42
70
|
//# sourceMappingURL=IncrementalMarkerBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalMarkerBuilder.js","sources":["../../../src/core/IncrementalMarkerBuilder.ts"],"sourcesContent":["import { EntityFieldMarker, EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport { MarkerMerger } from './MarkerMerger'\nimport { TreeParameterMerger } from './TreeParameterMerger'\n\nexport class IncrementalMarkerBuilder {\n\tprivate accumulator: EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer = new EntityFieldMarkersContainer(\n\t\tfalse,\n\t\tnew Map(),\n\t\tnew Map(),\n\t)\n\n\tpublic mutateIn(addition: EntityFieldMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker) {\n\t\tif (addition instanceof EntityFieldMarkersContainer) {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = MarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition),\n\t\t\t\t\tthis.accumulator.subTrees,\n\t\t\t\t\tthis.accumulator.parentReference,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (addition instanceof EntityFieldsWithHoistablesMarker) {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition.fields),\n\t\t\t\t\taddition.subTrees,\n\t\t\t\t\taddition.parentReference,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition.fields),\n\t\t\t\t\tMarkerMerger.mergeSubTreeMarkers(this.accumulator.subTrees, addition.subTrees),\n\t\t\t\t\tTreeParameterMerger.mergeParentEntityParameters(this.accumulator.parentReference, addition.parentReference),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = MarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\tthis.accumulator,\n\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\t\tthis.accumulator.fields,\n\t\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t\t),\n\t\t\t\t\tthis.accumulator.subTrees,\n\t\t\t\t\tthis.accumulator.parentReference,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getFinalMarker() {\n\t\treturn this.accumulator\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAKO,MAAM,yBAAyB;AAAA,EAA/B;AACE,uCAA8E,IAAI,
|
|
1
|
+
{"version":3,"file":"IncrementalMarkerBuilder.js","sources":["../../../src/core/IncrementalMarkerBuilder.ts"],"sourcesContent":["import { EntityFieldMarker, EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport { MarkerMerger } from './MarkerMerger'\nimport { TreeParameterMerger } from './TreeParameterMerger'\n\nexport class IncrementalMarkerBuilder {\n\tprivate accumulator: EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer = new EntityFieldMarkersContainer(\n\t\tfalse,\n\t\tnew Map(),\n\t\tnew Map(),\n\t)\n\n\tpublic mutateIn(addition: EntityFieldMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker) {\n\t\tif (addition instanceof EntityFieldMarkersContainer) {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = MarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition),\n\t\t\t\t\tthis.accumulator.subTrees,\n\t\t\t\t\tthis.accumulator.parentReference,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (addition instanceof EntityFieldsWithHoistablesMarker) {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator, addition.fields),\n\t\t\t\t\taddition.subTrees,\n\t\t\t\t\taddition.parentReference,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(this.accumulator.fields, addition.fields),\n\t\t\t\t\tMarkerMerger.mergeSubTreeMarkers(this.accumulator.subTrees, addition.subTrees),\n\t\t\t\t\tTreeParameterMerger.mergeParentEntityParameters(this.accumulator.parentReference, addition.parentReference),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.accumulator instanceof EntityFieldMarkersContainer) {\n\t\t\t\tthis.accumulator = MarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\tthis.accumulator,\n\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.accumulator = new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\t\tthis.accumulator.fields,\n\t\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t\t),\n\t\t\t\t\tthis.accumulator.subTrees,\n\t\t\t\t\tthis.accumulator.parentReference,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getFinalMarker() {\n\t\treturn this.accumulator\n\t}\n}\n"],"names":[],"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ACD;AAAA,EACD;AAAA,EAEO,iBAAiB;AACvB,WAAO,KAAK;AAAA,EACb;AACD;"}
|
|
@@ -31,7 +31,10 @@ class MarkerComparator {
|
|
|
31
31
|
candidateMarker
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
|
-
throw new LocalizedBindingError(
|
|
34
|
+
throw new LocalizedBindingError(
|
|
35
|
+
`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. Check that all relation parameters are the same.`,
|
|
36
|
+
[candidateMarker]
|
|
37
|
+
);
|
|
35
38
|
}
|
|
36
39
|
assertNever();
|
|
37
40
|
}
|
|
@@ -69,5 +72,7 @@ class MarkerComparator {
|
|
|
69
72
|
return true;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
export {
|
|
75
|
+
export {
|
|
76
|
+
MarkerComparator
|
|
77
|
+
};
|
|
73
78
|
//# sourceMappingURL=MarkerComparator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerComparator.js","sources":["../../../src/core/MarkerComparator.ts"],"sourcesContent":["import { PRIMARY_KEY_NAME, TYPENAME_KEY_NAME } from '../bindingTypes'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { assertNever } from '../utils'\nimport { LocalizedBindingError } from './exceptions'\n\nexport class MarkerComparator {\n\tpublic static isSubTreeSubsetOf(\n\t\tcandidate: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t\tsuperset: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): boolean {\n\t\tif (candidate.placeholderName !== superset.placeholderName) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.isSubsetOf(candidate.fields, superset.fields)\n\t}\n\n\tpublic static assertEntityMarkersSubsetOf(\n\t\tcandidate: EntityFieldMarkersContainer,\n\t\tsuperset: EntityFieldMarkersContainer,\n\t) {\n\t\tthis.assertSubsetOf(candidate, superset)\n\t}\n\n\tprivate static assertSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer) {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\t\tif (candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new LocalizedBindingError(`The field '${candidateMarker.fieldName}' is missing.`, [candidateMarker])\n\t\t\t\t}\n\t\t\t\tif (candidateMarker instanceof HasOneRelationMarker || candidateMarker instanceof HasManyRelationMarker) {\n\t\t\t\t\tconst differentPlaceholders = superset.placeholders.get(candidateMarker.parameters.field)\n\n\t\t\t\t\tif (differentPlaceholders === undefined) {\n\t\t\t\t\t\tthrow new LocalizedBindingError(`The relation '${candidateMarker.parameters.field}' is missing.`, [\n\t\t\t\t\t\t\tcandidateMarker,\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\t// TODO be more specific\n\t\t\t\t\tthrow new LocalizedBindingError(\n\t\t\t\t\t\t`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. ` +\n\t\t\t\t\t\t\t`Check that all relation parameters are the same.`,\n\t\t\t\t\t\t[candidateMarker],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tassertNever(candidateMarker)\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t(candidateMarker instanceof HasOneRelationMarker && fromSuperset instanceof HasOneRelationMarker) ||\n\t\t\t\t\t(candidateMarker instanceof HasManyRelationMarker && fromSuperset instanceof HasManyRelationMarker)\n\t\t\t\t) {\n\t\t\t\t\tthis.assertSubsetOf(candidateMarker.fields, fromSuperset.fields)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof LocalizedBindingError) {\n\t\t\t\t\tthrow e.nestedIn(candidateMarker)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static isSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer): boolean {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (\n\t\t\t\t\tcandidateMarker instanceof FieldMarker &&\n\t\t\t\t\t(candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME)\n\t\t\t\t) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker || fromSuperset instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!this.isSubsetOf(candidateMarker.fields, fromSuperset.fields)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t//private static assertAreMarkersSubsetOf(): {}\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,iBAAiB;AAAA,
|
|
1
|
+
{"version":3,"file":"MarkerComparator.js","sources":["../../../src/core/MarkerComparator.ts"],"sourcesContent":["import { PRIMARY_KEY_NAME, TYPENAME_KEY_NAME } from '../bindingTypes'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { assertNever } from '../utils'\nimport { LocalizedBindingError } from './exceptions'\n\nexport class MarkerComparator {\n\tpublic static isSubTreeSubsetOf(\n\t\tcandidate: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t\tsuperset: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): boolean {\n\t\tif (candidate.placeholderName !== superset.placeholderName) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.isSubsetOf(candidate.fields, superset.fields)\n\t}\n\n\tpublic static assertEntityMarkersSubsetOf(\n\t\tcandidate: EntityFieldMarkersContainer,\n\t\tsuperset: EntityFieldMarkersContainer,\n\t) {\n\t\tthis.assertSubsetOf(candidate, superset)\n\t}\n\n\tprivate static assertSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer) {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\t\tif (candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new LocalizedBindingError(`The field '${candidateMarker.fieldName}' is missing.`, [candidateMarker])\n\t\t\t\t}\n\t\t\t\tif (candidateMarker instanceof HasOneRelationMarker || candidateMarker instanceof HasManyRelationMarker) {\n\t\t\t\t\tconst differentPlaceholders = superset.placeholders.get(candidateMarker.parameters.field)\n\n\t\t\t\t\tif (differentPlaceholders === undefined) {\n\t\t\t\t\t\tthrow new LocalizedBindingError(`The relation '${candidateMarker.parameters.field}' is missing.`, [\n\t\t\t\t\t\t\tcandidateMarker,\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\t// TODO be more specific\n\t\t\t\t\tthrow new LocalizedBindingError(\n\t\t\t\t\t\t`The relation '${candidateMarker.parameters.field}' exists but its parameters don't match exactly. ` +\n\t\t\t\t\t\t\t`Check that all relation parameters are the same.`,\n\t\t\t\t\t\t[candidateMarker],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tassertNever(candidateMarker)\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t(candidateMarker instanceof HasOneRelationMarker && fromSuperset instanceof HasOneRelationMarker) ||\n\t\t\t\t\t(candidateMarker instanceof HasManyRelationMarker && fromSuperset instanceof HasManyRelationMarker)\n\t\t\t\t) {\n\t\t\t\t\tthis.assertSubsetOf(candidateMarker.fields, fromSuperset.fields)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof LocalizedBindingError) {\n\t\t\t\t\tthrow e.nestedIn(candidateMarker)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static isSubsetOf(candidate: EntityFieldMarkersContainer, superset: EntityFieldMarkersContainer): boolean {\n\t\tfor (const [placeholderName, candidateMarker] of candidate.markers) {\n\t\t\tconst fromSuperset = superset.markers.get(placeholderName)\n\n\t\t\tif (fromSuperset === undefined) {\n\t\t\t\tif (\n\t\t\t\t\tcandidateMarker instanceof FieldMarker &&\n\t\t\t\t\t(candidateMarker.fieldName === PRIMARY_KEY_NAME || candidateMarker.fieldName === TYPENAME_KEY_NAME)\n\t\t\t\t) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (candidateMarker instanceof FieldMarker || fromSuperset instanceof FieldMarker) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!this.isSubsetOf(candidateMarker.fields, fromSuperset.fields)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t//private static assertAreMarkersSubsetOf(): {}\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,iBAAiB;AAAA,EAC7B,OAAc,kBACb,WACA,UACU;AACN,QAAA,UAAU,oBAAoB,SAAS,iBAAiB;AACpD,aAAA;AAAA,IACR;AACA,WAAO,KAAK,WAAW,UAAU,QAAQ,SAA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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":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AAA,IACR;AACO,WAAA,IAAI,wBACV,oBAAoB,qDAAqD,SAAS,YAAY,MAAM,UAAU,GAC9G,KAAK,4BAA4B,SAAS,QAAQ,MAAM,MAAM,GAC9D,KAAK,kBAAkB,SAAS,aAAa,MAAM,WAAW,CAC/D;AAAA,EACD;AAAA,SAEc,kBAAkB,UAAuB,OAAoB;AAC1E,QAAI,aAAa,OAAO;AAChB,aAAA;AAAA,IACR;AACA,QAAI,SAAS,iBAAiB,MAAM,gBAAgB,SAAS,cAAc;AAEnE,aAAA;AAAA,IACR;AAEO,WAAA;AAAA,EACR;AAAA,SAEc,oBAAoB,UAAgF;AACjH,UAAM,aAAa,IAAI,YAAY,kBAAkB,QAAW,IAAI;AAE9D,UAAA,cAAc,IAAI,4BACvB,2BACI,IAAI,CAAC,CAAC,WAAW,iBAAiB,UAAU,CAAC,CAAC,GAC9C,oBAAA,IAAI,CAAC,CAAC,kBAAkB,WAAW,eAAe,CAAC,CAAC,CACzD;AACA,WAAO,WAAW,KAAK,4BAA4B,UAAU,WAAW,IAAI;AAAA,EAC7E;AAAA,SAEc,kBAAkB,UAAuB,OAAiC;AAChF,WAAA,SAAS,MAAM,KAAK;AAAA,EAC5B;AAAA,SAEe,0BAA0B,WAA6B;AAC/D,UAAA,IAAI,aAAa,kDAAkD,aAAa;AAAA,EACvF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"MarkerMerger.js","sources":["../../../src/core/MarkerMerger.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport type { Environment } from '../dao'\nimport {\n\tEntityFieldMarkers,\n\tEntityFieldMarkersContainer,\n\tEntityFieldPlaceholders,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n\tMeaningfulMarker,\n\tSubTreeMarkers,\n} from '../markers'\nimport type { Alias, FieldName, PlaceholderName } from '../treeParameters'\nimport { assertNever } from '../utils'\nimport { TreeParameterMerger } from './TreeParameterMerger'\n\nexport class MarkerMerger {\n\t// This method assumes their placeholder names are the same\n\tpublic static mergeMarkers(original: MeaningfulMarker, fresh: MeaningfulMarker): MeaningfulMarker {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original instanceof FieldMarker) {\n\t\t\tif (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.mergeFieldMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker || fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.fieldName)\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('Merging fields and sub trees is an undefined operation.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasOneRelationMarker) {\n\t\t\tif (fresh instanceof HasOneRelationMarker) {\n\t\t\t\treturn this.mergeHasOneRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasManyRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof HasManyRelationMarker) {\n\t\t\tif (fresh instanceof HasManyRelationMarker) {\n\t\t\t\treturn this.mergeHasManyRelationMarkers(original, fresh)\n\t\t\t} else if (fresh instanceof FieldMarker) {\n\t\t\t\treturn this.rejectRelationScalarCombo(original.parameters.field)\n\t\t\t} else if (fresh instanceof HasOneRelationMarker) {\n\t\t\t\tthrow new BindingError() // TODO not implemented\n\t\t\t} else if (fresh instanceof EntitySubTreeMarker || fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\tthrow new BindingError('MarkerTreeGenerator merging: SubTreeMarkers can only be merged with other sub trees.')\n\t\t\t}\n\t\t\tassertNever(fresh)\n\t\t} else if (original instanceof EntitySubTreeMarker) {\n\t\t\tif (fresh instanceof EntitySubTreeMarker) {\n\t\t\t\treturn this.mergeEntitySubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntitySubTreeMarker can only be merged with other entity sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (original instanceof EntityListSubTreeMarker) {\n\t\t\tif (fresh instanceof EntityListSubTreeMarker) {\n\t\t\t\treturn this.mergeEntityListSubTreeMarkers(original, fresh)\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t'MarkerTreeGenerator merging: EntityListSubTreeMarker can only be merged with other list sub trees.',\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tassertNever(original)\n\t}\n\n\tpublic static mergeMarkerTreeRoots(original: MarkerTreeRoot, fresh: MarkerTreeRoot): MarkerTreeRoot {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new MarkerTreeRoot(\n\t\t\tthis.mergeEntityFields(original.subTrees, fresh.subTrees),\n\t\t\tthis.mergeSubTreePlaceholdersByAliases(original.placeholdersByAliases, fresh.placeholdersByAliases),\n\t\t)\n\t}\n\n\tpublic static mergeSubTreeMarkers(\n\t\toriginal: SubTreeMarkers | undefined,\n\t\tfresh: SubTreeMarkers | undefined,\n\t): SubTreeMarkers | undefined {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original === undefined) {\n\t\t\treturn fresh\n\t\t}\n\t\tif (fresh === undefined) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal = new Map(original)\n\n\t\tfor (const [placeholderName, fromFresh] of fresh) {\n\t\t\tconst fromOriginal = newOriginal.get(placeholderName)\n\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tfromOriginal === undefined\n\t\t\t\t\t? fromFresh\n\t\t\t\t\t: fromOriginal instanceof EntityListSubTreeMarker\n\t\t\t\t\t? MarkerMerger.mergeEntityListSubTreeMarkers(fromOriginal, fromFresh as EntityListSubTreeMarker)\n\t\t\t\t\t: MarkerMerger.mergeEntitySubTreeMarkers(fromOriginal, fromFresh as EntitySubTreeMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeSubTreePlaceholdersByAliases(\n\t\toriginal: Map<Alias, PlaceholderName>,\n\t\tfresh: Map<Alias, PlaceholderName>,\n\t) {\n\t\tconst newOriginalAliases = new Map(original)\n\t\tfor (const [alias, placeholder] of fresh) {\n\t\t\tconst fromOriginal = newOriginalAliases.get(alias)\n\t\t\tif (fromOriginal === undefined) {\n\t\t\t\tnewOriginalAliases.set(alias, placeholder)\n\t\t\t} else if (fromOriginal === placeholder) {\n\t\t\t\t// Do nothing\n\t\t\t} else {\n\t\t\t\tthrow new BindingError(`Illegal subTree alias '${alias}' points to distinct subTrees.`)\n\t\t\t}\n\t\t}\n\t\treturn newOriginalAliases\n\t}\n\n\tpublic static mergeEntityFields(original: SubTreeMarkers, fresh: SubTreeMarkers): SubTreeMarkers\n\tpublic static mergeEntityFields(original: EntityFieldMarkers, fresh: EntityFieldMarkers): EntityFieldMarkers\n\tpublic static mergeEntityFields(\n\t\toriginal: Map<PlaceholderName, MeaningfulMarker>,\n\t\tfresh: Map<PlaceholderName, MeaningfulMarker>,\n\t): Map<PlaceholderName, MeaningfulMarker> {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: Map<PlaceholderName, MeaningfulMarker> = new Map(original)\n\t\tfor (const [placeholderName, freshMarker] of fresh) {\n\t\t\tconst markerFromOriginal = newOriginal.get(placeholderName)\n\t\t\tnewOriginal.set(\n\t\t\t\tplaceholderName,\n\t\t\t\tmarkerFromOriginal === undefined ? freshMarker : this.mergeMarkers(markerFromOriginal, freshMarker),\n\t\t\t)\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldPlaceholders(\n\t\toriginal: EntityFieldPlaceholders,\n\t\tfresh: EntityFieldPlaceholders,\n\t): EntityFieldPlaceholders {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tconst newOriginal: EntityFieldPlaceholders = new Map(original)\n\t\tfor (const [fieldName, freshPlaceholders] of fresh) {\n\t\t\tconst placeholderFromOriginal = newOriginal.get(fieldName)\n\n\t\t\tif (placeholderFromOriginal === undefined) {\n\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t} else if (placeholderFromOriginal instanceof Set) {\n\t\t\t\tconst combinedSet = new Set(placeholderFromOriginal)\n\t\t\t\tif (freshPlaceholders instanceof Set) {\n\t\t\t\t\tfor (const freshPlaceholder of freshPlaceholders) {\n\t\t\t\t\t\tcombinedSet.add(freshPlaceholder)\n\t\t\t\t\t}\n\t\t\t\t} else if (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tcombinedSet.add(freshPlaceholders)\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t} else if (typeof placeholderFromOriginal === 'string') {\n\t\t\t\tif (typeof freshPlaceholders === 'string') {\n\t\t\t\t\tif (placeholderFromOriginal === freshPlaceholders) {\n\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOriginal.set(fieldName, new Set([placeholderFromOriginal, freshPlaceholders]))\n\t\t\t\t\t}\n\t\t\t\t} else if (freshPlaceholders instanceof Set) {\n\t\t\t\t\tif (freshPlaceholders.has(placeholderFromOriginal)) {\n\t\t\t\t\t\tnewOriginal.set(fieldName, freshPlaceholders)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst combinedSet = new Set(freshPlaceholders)\n\t\t\t\t\t\tcombinedSet.add(placeholderFromOriginal)\n\t\t\t\t\t\tnewOriginal.set(fieldName, combinedSet)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(freshPlaceholders)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tassertNever(placeholderFromOriginal)\n\t\t\t}\n\t\t}\n\t\treturn newOriginal\n\t}\n\n\tpublic static mergeEntityFieldsContainers(\n\t\toriginal: EntityFieldMarkersContainer,\n\t\tfresh: EntityFieldMarkersContainer,\n\t): EntityFieldMarkersContainer {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityFieldMarkersContainer(\n\t\t\toriginal.hasAtLeastOneBearingField || fresh.hasAtLeastOneBearingField,\n\t\t\tthis.mergeEntityFields(original.markers, fresh.markers),\n\t\t\tthis.mergeEntityFieldPlaceholders(original.placeholders, fresh.placeholders),\n\t\t)\n\t}\n\n\tpublic static mergeHasOneRelationMarkers(original: HasOneRelationMarker, fresh: HasOneRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasOneRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasOneRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeHasManyRelationMarkers(original: HasManyRelationMarker, fresh: HasManyRelationMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new HasManyRelationMarker(\n\t\t\tTreeParameterMerger.mergeHasManyRelationsWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntitySubTreeMarkers(original: EntitySubTreeMarker, fresh: EntitySubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntitySubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntitySubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeEntityListSubTreeMarkers(original: EntityListSubTreeMarker, fresh: EntityListSubTreeMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\treturn new EntityListSubTreeMarker(\n\t\t\tTreeParameterMerger.mergeEntityListSubTreeParametersWithSamePlaceholders(original.parameters, fresh.parameters),\n\t\t\tthis.mergeEntityFieldsContainers(original.fields, fresh.fields),\n\t\t\tthis.mergeEnvironments(original.environment, fresh.environment),\n\t\t)\n\t}\n\n\tpublic static mergeFieldMarkers(original: FieldMarker, fresh: FieldMarker) {\n\t\tif (original === fresh) {\n\t\t\treturn original\n\t\t}\n\t\tif (original.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,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;AAAA,IAAA,WACP,oBAAoB,uBAAuB;AACrD,UAAI,iBAAiB,uBAAuB;AACpC,eAAA,KAAK,4BAA4B,UAAU,KAAK;AAAA,MAAA,WAC7C,iBAAiB,aAAa;AACxC,eAAO,KAAK,0BAA0B,SAAS,WAAW,KAAK;AAAA,MAAA,WACrD,iBAAiB,sBAAsB;AACjD,cAAM,I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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
|