@contember/binding 1.1.0-alpha.12 → 1.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/BindingError.js +4 -1
- package/dist/development/BindingError.js.map +1 -1
- package/dist/development/accessorPropagation/AccessorProvider.js +20 -7
- package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.js +7 -2
- package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsProvider.js +13 -5
- package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyContext.js +3 -1
- package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyProvider.js +13 -5
- package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +55 -17
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdContext.js +3 -1
- package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdProvider.js +13 -5
- package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/development/accessorPropagation/useBindingOperations.js +3 -1
- package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/development/accessorPropagation/useEntity.js +7 -2
- package/dist/development/accessorPropagation/useEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityKey.js +6 -2
- package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityList.js +11 -3
- package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTree.js +7 -2
- package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTree.js +7 -2
- package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +27 -16
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEnvironment.js +3 -1
- package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.js +7 -2
- package/dist/development/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/development/accessorPropagation/useField.js +11 -3
- package/dist/development/accessorPropagation/useField.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityByKey.js +3 -1
- package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js +7 -2
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntitySubTree.js +7 -2
- package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetTreeFilters.js +3 -1
- package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/development/accessorPropagation/useHasEntity.js +3 -1
- package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/development/accessorPropagation/usePersist.js +3 -1
- package/dist/development/accessorPropagation/usePersist.js.map +1 -1
- package/dist/development/accessorPropagation/useTreeRootId.js +3 -1
- package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +84 -44
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/addEntityAtIndex.js +3 -1
- package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/development/accessorSorting/errors.js +6 -2
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorSorting/moveEntity.js +4 -1
- package/dist/development/accessorSorting/moveEntity.js.map +1 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js +3 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/development/accessorSorting/sortEntities.js +3 -1
- package/dist/development/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/accessorSorting/useSortedEntities.js +61 -23
- package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +45 -14
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js +3 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/development/accessorTree/DirtinessContext.js +3 -1
- package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/development/accessorTree/MutationStateContext.js +3 -1
- package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +8 -2
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js +3 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/development/accessorTree/metadataToRequestError.js +3 -1
- package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/development/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js +3 -1
- package/dist/development/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/accessorTree/useDirtinessState.js +3 -1
- package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/development/accessorTree/useMutationState.js +3 -1
- package/dist/development/accessorTree/useMutationState.js.map +1 -1
- package/dist/development/accessors/EntityAccessor.js +16 -6
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/accessors/EntityListAccessor.js +3 -1
- package/dist/development/accessors/EntityListAccessor.js.map +1 -1
- package/dist/development/accessors/ErrorAccessor.js +3 -1
- package/dist/development/accessors/ErrorAccessor.js.map +1 -1
- package/dist/development/accessors/FieldAccessor.js +3 -1
- package/dist/development/accessors/FieldAccessor.js.map +1 -1
- package/dist/development/accessors/TreeRootAccessor.js +3 -1
- package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/development/bindingTypes.js +5 -1
- package/dist/development/bindingTypes.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +3 -1
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/Config.js +3 -1
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.js +42 -14
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/DirtinessTracker.js +3 -1
- package/dist/development/core/DirtinessTracker.js.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.js +12 -4
- package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/development/core/EventManager.js +21 -7
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/IncrementalMarkerBuilder.js +35 -7
- package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/development/core/MarkerComparator.js +7 -2
- package/dist/development/core/MarkerComparator.js.map +1 -1
- package/dist/development/core/MarkerMerger.js +51 -12
- package/dist/development/core/MarkerMerger.js.map +1 -1
- package/dist/development/core/MarkerTreeGenerator.js +11 -3
- package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +121 -25
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/QueryGenerator.js +40 -9
- package/dist/development/core/QueryGenerator.js.map +1 -1
- package/dist/development/core/RealmKeyGenerator.js +12 -3
- package/dist/development/core/RealmKeyGenerator.js.map +1 -1
- package/dist/development/core/RequestResponseNormalizer.js +3 -1
- package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/development/core/StateInitializer.js +89 -23
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js +21 -4
- package/dist/development/core/TreeAugmenter.js.map +1 -1
- package/dist/development/core/TreeFilterGenerator.js +8 -2
- package/dist/development/core/TreeFilterGenerator.js.map +1 -1
- package/dist/development/core/TreeParameterMerger.js +25 -7
- package/dist/development/core/TreeParameterMerger.js.map +1 -1
- package/dist/development/core/TreeStore.js +20 -4
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/VariableInputTransformer.js +3 -1
- package/dist/development/core/VariableInputTransformer.js.map +1 -1
- package/dist/development/core/exceptions/ErrorLocator.js +11 -3
- package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/development/core/exceptions/LocalizedBindingError.js +3 -1
- package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/development/core/exceptions/MarkerSugarer.js +8 -2
- package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js +3 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js +3 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.js +45 -14
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/FieldOperations.js +22 -8
- package/dist/development/core/operations/FieldOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +22 -9
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.js +6 -2
- package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js +3 -1
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/core/schema/Schema.js +3 -1
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/core/schema/SchemaLoader.js +3 -1
- package/dist/development/core/schema/SchemaLoader.js.map +1 -1
- package/dist/development/core/schema/SchemaPreprocessor.js +3 -1
- package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/development/core/state/StateIterator.js +3 -1
- package/dist/development/core/state/StateIterator.js.map +1 -1
- package/dist/development/core/state/getEntityMarker.js +3 -1
- package/dist/development/core/state/getEntityMarker.js.map +1 -1
- package/dist/development/core/utils/getCombinedSignal.js +3 -1
- package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/development/coreComponents/Component.js +3 -1
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/DataBindingProvider.js +13 -4
- package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/coreComponents/Entity.js +16 -6
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.js +21 -9
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +26 -9
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +37 -14
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.js +10 -4
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.js +25 -9
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.js +25 -9
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +7 -3
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/dao/Environment.js +3 -1
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/TreeNodeEnvironmentFactory.js +10 -3
- package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/development/dao/VariableFieldValue.js +3 -1
- package/dist/development/dao/VariableFieldValue.js.map +1 -1
- package/dist/development/entityEvents/useDerivedField.js +25 -17
- package/dist/development/entityEvents/useDerivedField.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforePersist.js +3 -1
- package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforeUpdate.js +3 -1
- package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/development/entityEvents/useEntityEvent.js +16 -8
- package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistError.js +3 -1
- package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistSuccess.js +3 -1
- package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/development/entityEvents/useOnConnectionUpdate.js +3 -1
- package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +46 -13
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/EntityView.js +7 -3
- package/dist/development/helperComponents/EntityView.js.map +1 -1
- package/dist/development/helperComponents/FieldView.js +22 -8
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/If.js +57 -19
- package/dist/development/helperComponents/If.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +9 -3
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +17 -6
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js +3 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +3 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/development/helperComponents/helpers/evaluateCondition.js +3 -1
- package/dist/development/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/development/index.js +225 -106
- package/dist/development/markers/EntityFieldMarkersContainer.js +3 -1
- package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +3 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js +3 -1
- package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js +3 -1
- package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/development/markers/FieldMarker.js +3 -1
- package/dist/development/markers/FieldMarker.js.map +1 -1
- package/dist/development/markers/HasManyRelationMarker.js +3 -1
- package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/development/markers/HasOneRelationMarker.js +3 -1
- package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/development/markers/MarkerTreeRoot.js +3 -1
- package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/development/markers/ParentEntityMarker.js +3 -1
- package/dist/development/markers/ParentEntityMarker.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js +3 -1
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/queryLanguage/CacheStore.js +3 -1
- package/dist/development/queryLanguage/CacheStore.js.map +1 -1
- package/dist/development/queryLanguage/MarkerFactory.js +115 -23
- package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js +114 -79
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +72 -19
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguageError.js +3 -1
- package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/development/queryLanguage/tokenList.js +5 -1
- package/dist/development/queryLanguage/tokenList.js.map +1 -1
- package/dist/development/structures/BijectiveIndexedMap.js +3 -1
- package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/development/structures/LRUCache.js +3 -1
- package/dist/development/structures/LRUCache.js.map +1 -1
- package/dist/development/structures/WeakIdCache.js +3 -1
- package/dist/development/structures/WeakIdCache.js.map +1 -1
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/development/treeParameters/EntityCreationParameters.js +3 -1
- package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/development/treeParameters/EntityListPreferences.js +3 -1
- package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/development/treeParameters/EventListenersStore.js +3 -1
- package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/development/treeParameters/LeafField.js +3 -1
- package/dist/development/treeParameters/LeafField.js.map +1 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js +3 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/development/treeParameters/Relation.js +3 -1
- package/dist/development/treeParameters/Relation.js.map +1 -1
- package/dist/development/utils/Hashing.js +3 -1
- package/dist/development/utils/Hashing.js.map +1 -1
- package/dist/development/utils/assert.js +3 -1
- package/dist/development/utils/assert.js.map +1 -1
- package/dist/development/utils/assertNever.js +6 -2
- package/dist/development/utils/assertNever.js.map +1 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +3 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/development/utils/isEmptyObject.js +3 -1
- package/dist/development/utils/isEmptyObject.js.map +1 -1
- package/dist/development/utils/ucfirst.js +3 -1
- package/dist/development/utils/ucfirst.js.map +1 -1
- package/dist/production/BindingError.js +4 -1
- package/dist/production/BindingError.js.map +1 -1
- package/dist/production/accessorPropagation/AccessorProvider.js +11 -7
- package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.js +7 -2
- package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsProvider.js +8 -5
- package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyContext.js +3 -1
- package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyProvider.js +8 -5
- package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js +42 -17
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdContext.js +3 -1
- package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdProvider.js +8 -5
- package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
- package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/production/accessorPropagation/useBindingOperations.js +3 -1
- package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
- package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/production/accessorPropagation/useEntity.js +7 -2
- package/dist/production/accessorPropagation/useEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityKey.js +6 -2
- package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityList.js +11 -3
- package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTree.js +7 -2
- package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
- package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTree.js +7 -2
- package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTreeParameters.js +27 -16
- package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEnvironment.js +3 -1
- package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.js +7 -2
- package/dist/production/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/production/accessorPropagation/useField.js +11 -3
- package/dist/production/accessorPropagation/useField.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityByKey.js +3 -1
- package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityListSubTree.js +7 -2
- package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntitySubTree.js +7 -2
- package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetTreeFilters.js +3 -1
- package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/production/accessorPropagation/useHasEntity.js +3 -1
- package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/production/accessorPropagation/usePersist.js +3 -1
- package/dist/production/accessorPropagation/usePersist.js.map +1 -1
- package/dist/production/accessorPropagation/useTreeRootId.js +3 -1
- package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +55 -44
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/accessorSorting/addEntityAtIndex.js +3 -1
- package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/production/accessorSorting/errors.js +6 -2
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorSorting/moveEntity.js +4 -1
- package/dist/production/accessorSorting/moveEntity.js.map +1 -1
- package/dist/production/accessorSorting/repairEntitiesOrder.js +3 -1
- package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/production/accessorSorting/sortEntities.js +3 -1
- package/dist/production/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/accessorSorting/useSortedEntities.js +61 -23
- package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/production/accessorTree/AccessorTree.js +24 -14
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js +3 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js.map +1 -1
- package/dist/production/accessorTree/DirtinessContext.js +3 -1
- package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/production/accessorTree/MutationStateContext.js +3 -1
- package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js +3 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +8 -2
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js +3 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/production/accessorTree/metadataToRequestError.js +3 -1
- package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/production/accessorTree/useAccessorTreeState.js +3 -1
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js +3 -1
- package/dist/production/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/accessorTree/useDirtinessState.js +3 -1
- package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/production/accessorTree/useMutationState.js +3 -1
- package/dist/production/accessorTree/useMutationState.js.map +1 -1
- package/dist/production/accessors/EntityAccessor.js +16 -6
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js +3 -1
- package/dist/production/accessors/EntityListAccessor.js.map +1 -1
- package/dist/production/accessors/ErrorAccessor.js +3 -1
- package/dist/production/accessors/ErrorAccessor.js.map +1 -1
- package/dist/production/accessors/FieldAccessor.js +3 -1
- package/dist/production/accessors/FieldAccessor.js.map +1 -1
- package/dist/production/accessors/TreeRootAccessor.js +3 -1
- package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/production/bindingTypes.js +5 -1
- package/dist/production/bindingTypes.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.js +3 -1
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/Config.js +3 -1
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.js +42 -14
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/DirtinessTracker.js +3 -1
- package/dist/production/core/DirtinessTracker.js.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.js +12 -4
- package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/production/core/EventManager.js +9 -3
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/IncrementalMarkerBuilder.js +35 -7
- package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/production/core/MarkerComparator.js +7 -2
- package/dist/production/core/MarkerComparator.js.map +1 -1
- package/dist/production/core/MarkerMerger.js +51 -12
- package/dist/production/core/MarkerMerger.js.map +1 -1
- package/dist/production/core/MarkerTreeGenerator.js +11 -3
- package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/core/MutationGenerator.js +121 -25
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/QueryGenerator.js +40 -9
- package/dist/production/core/QueryGenerator.js.map +1 -1
- package/dist/production/core/RealmKeyGenerator.js +12 -3
- package/dist/production/core/RealmKeyGenerator.js.map +1 -1
- package/dist/production/core/RequestResponseNormalizer.js +3 -1
- package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/production/core/StateInitializer.js +89 -23
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js +21 -4
- package/dist/production/core/TreeAugmenter.js.map +1 -1
- package/dist/production/core/TreeFilterGenerator.js +8 -2
- package/dist/production/core/TreeFilterGenerator.js.map +1 -1
- package/dist/production/core/TreeParameterMerger.js +25 -7
- package/dist/production/core/TreeParameterMerger.js.map +1 -1
- package/dist/production/core/TreeStore.js +20 -4
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/VariableInputTransformer.js +3 -1
- package/dist/production/core/VariableInputTransformer.js.map +1 -1
- package/dist/production/core/exceptions/ErrorLocator.js +11 -3
- package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/production/core/exceptions/LocalizedBindingError.js +3 -1
- package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/production/core/exceptions/MarkerSugarer.js +8 -2
- package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js +3 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js +3 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.js +45 -14
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/FieldOperations.js +11 -3
- package/dist/production/core/operations/FieldOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js +22 -9
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.js +6 -2
- package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js +3 -1
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/core/schema/Schema.js +3 -1
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/core/schema/SchemaLoader.js +3 -1
- package/dist/production/core/schema/SchemaLoader.js.map +1 -1
- package/dist/production/core/schema/SchemaPreprocessor.js +3 -1
- package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/production/core/state/StateIterator.js +3 -1
- package/dist/production/core/state/StateIterator.js.map +1 -1
- package/dist/production/core/state/getEntityMarker.js +3 -1
- package/dist/production/core/state/getEntityMarker.js.map +1 -1
- package/dist/production/core/utils/getCombinedSignal.js +3 -1
- package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/production/coreComponents/Component.js +3 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/coreComponents/DataBindingProvider.js +8 -4
- package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/coreComponents/Entity.js +11 -6
- package/dist/production/coreComponents/Entity.js.map +1 -1
- package/dist/production/coreComponents/EntityList.js +16 -9
- package/dist/production/coreComponents/EntityList.js.map +1 -1
- package/dist/production/coreComponents/EntityListSubTree.js +12 -8
- package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/coreComponents/EntitySubTree.js +19 -13
- package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/coreComponents/Field.js +10 -4
- package/dist/production/coreComponents/Field.js.map +1 -1
- package/dist/production/coreComponents/HasMany.js +11 -8
- package/dist/production/coreComponents/HasMany.js.map +1 -1
- package/dist/production/coreComponents/HasOne.js +11 -8
- package/dist/production/coreComponents/HasOne.js.map +1 -1
- package/dist/production/coreComponents/ParentEntity.js +7 -3
- package/dist/production/coreComponents/ParentEntity.js.map +1 -1
- package/dist/production/dao/Environment.js +3 -1
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/TreeNodeEnvironmentFactory.js +10 -3
- package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/production/dao/VariableFieldValue.js +3 -1
- package/dist/production/dao/VariableFieldValue.js.map +1 -1
- package/dist/production/entityEvents/useDerivedField.js +25 -17
- package/dist/production/entityEvents/useDerivedField.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforePersist.js +3 -1
- package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforeUpdate.js +3 -1
- package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/production/entityEvents/useEntityEvent.js +16 -8
- package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistError.js +3 -1
- package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistSuccess.js +3 -1
- package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/production/entityEvents/useOnConnectionUpdate.js +3 -1
- package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
- package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/production/helperComponents/DeferredSubTrees.js +37 -13
- package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/helperComponents/EntityView.js +7 -3
- package/dist/production/helperComponents/EntityView.js.map +1 -1
- package/dist/production/helperComponents/FieldView.js +17 -8
- package/dist/production/helperComponents/FieldView.js.map +1 -1
- package/dist/production/helperComponents/If.js +44 -19
- package/dist/production/helperComponents/If.js.map +1 -1
- package/dist/production/helperComponents/StaticRender.js +9 -3
- package/dist/production/helperComponents/StaticRender.js.map +1 -1
- package/dist/production/helperComponents/SugaredField.js +6 -4
- package/dist/production/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js +3 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +3 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/production/helperComponents/helpers/evaluateCondition.js +3 -1
- package/dist/production/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/production/index.js +225 -106
- package/dist/production/markers/EntityFieldMarkersContainer.js +3 -1
- package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/production/markers/EntityFieldsWithHoistablesMarker.js +3 -1
- package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js +3 -1
- package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js +3 -1
- package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/production/markers/FieldMarker.js +3 -1
- package/dist/production/markers/FieldMarker.js.map +1 -1
- package/dist/production/markers/HasManyRelationMarker.js +3 -1
- package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/production/markers/HasOneRelationMarker.js +3 -1
- package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/production/markers/MarkerTreeRoot.js +3 -1
- package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/production/markers/ParentEntityMarker.js +3 -1
- package/dist/production/markers/ParentEntityMarker.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js +3 -1
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/queryLanguage/CacheStore.js +3 -1
- package/dist/production/queryLanguage/CacheStore.js.map +1 -1
- package/dist/production/queryLanguage/MarkerFactory.js +115 -23
- package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js +114 -79
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js +72 -19
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguageError.js +3 -1
- package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/production/queryLanguage/tokenList.js +5 -1
- package/dist/production/queryLanguage/tokenList.js.map +1 -1
- package/dist/production/structures/BijectiveIndexedMap.js +3 -1
- package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/production/structures/LRUCache.js +3 -1
- package/dist/production/structures/LRUCache.js.map +1 -1
- package/dist/production/structures/WeakIdCache.js +3 -1
- package/dist/production/structures/WeakIdCache.js.map +1 -1
- package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
- package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/production/treeParameters/EntityCreationParameters.js +3 -1
- package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/production/treeParameters/EntityListPreferences.js +3 -1
- package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/production/treeParameters/EventListenersStore.js +3 -1
- package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/production/treeParameters/LeafField.js +3 -1
- package/dist/production/treeParameters/LeafField.js.map +1 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js +3 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/production/treeParameters/Relation.js +3 -1
- package/dist/production/treeParameters/Relation.js.map +1 -1
- package/dist/production/utils/Hashing.js +3 -1
- package/dist/production/utils/Hashing.js.map +1 -1
- package/dist/production/utils/assert.js +3 -1
- package/dist/production/utils/assert.js.map +1 -1
- package/dist/production/utils/assertNever.js +6 -2
- package/dist/production/utils/assertNever.js.map +1 -1
- package/dist/production/utils/generateEnumerabilityPreventingEntropy.js +3 -1
- package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/production/utils/isEmptyObject.js +3 -1
- package/dist/production/utils/isEmptyObject.js.map +1 -1
- package/dist/production/utils/ucfirst.js +3 -1
- package/dist/production/utils/ucfirst.js.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -7,7 +7,10 @@ import { useGetEntityByKey } from "./useGetEntityByKey.js";
|
|
|
7
7
|
import { useOnConnectionUpdate } from "../entityEvents/useOnConnectionUpdate.js";
|
|
8
8
|
function useEntityList(sugaredRelativeEntityList) {
|
|
9
9
|
const relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList);
|
|
10
|
-
useConstantValueInvariant(
|
|
10
|
+
useConstantValueInvariant(
|
|
11
|
+
!!relativeEntityList,
|
|
12
|
+
"useEntityList: cannot alternate between providing and omitting the argument."
|
|
13
|
+
);
|
|
11
14
|
const entityKey = useEntityKey();
|
|
12
15
|
const getEntityByKey = useGetEntityByKey();
|
|
13
16
|
const getEntityList = useCallback(() => {
|
|
@@ -15,7 +18,10 @@ function useEntityList(sugaredRelativeEntityList) {
|
|
|
15
18
|
return parent.getRelativeEntityList(relativeEntityList);
|
|
16
19
|
}, [entityKey, getEntityByKey, relativeEntityList]);
|
|
17
20
|
if (relativeEntityList) {
|
|
18
|
-
useConstantLengthInvariant(
|
|
21
|
+
useConstantLengthInvariant(
|
|
22
|
+
relativeEntityList.hasOneRelationPath,
|
|
23
|
+
"Cannot change the length of the hasOneRelation path!"
|
|
24
|
+
);
|
|
19
25
|
const [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true);
|
|
20
26
|
if (relativeEntityList.hasOneRelationPath.length) {
|
|
21
27
|
useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate);
|
|
@@ -24,5 +30,7 @@ function useEntityList(sugaredRelativeEntityList) {
|
|
|
24
30
|
}
|
|
25
31
|
return void 0;
|
|
26
32
|
}
|
|
27
|
-
export {
|
|
33
|
+
export {
|
|
34
|
+
useEntityList
|
|
35
|
+
};
|
|
28
36
|
//# sourceMappingURL=useEntityList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityList.js","sources":["../../../src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityListAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":[],"mappings":";;;;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"useEntityList.js","sources":["../../../src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityListAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":[],"mappings":";;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqB,+BAA+B,yBAAyB;AACnF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,gBAAgB,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,sBAAsB,kBAAmB;AAAA,EACrD,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvB;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,WAAW,IAAI,8BAA8B,eAAe,IAAI;AAE/E,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjD,4BAAsB,mBAAmB,mBAAmB,GAAG,OAAO,WAAW;AAAA,IAClF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;"}
|
|
@@ -7,8 +7,13 @@ const useEntityListSubTree = (qualifiedEntityList, ...treeId) => {
|
|
|
7
7
|
const parameters = useEntityListSubTreeParameters(qualifiedEntityList);
|
|
8
8
|
const hasTreeId = treeId.length > 0;
|
|
9
9
|
const treeIdVal = treeId[0];
|
|
10
|
-
const getAccessor = useCallback(
|
|
10
|
+
const getAccessor = useCallback(
|
|
11
|
+
() => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
|
|
12
|
+
[getSubTree, hasTreeId, parameters, treeIdVal]
|
|
13
|
+
);
|
|
11
14
|
return useAccessorUpdateSubscription(getAccessor);
|
|
12
15
|
};
|
|
13
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
useEntityListSubTree
|
|
18
|
+
};
|
|
14
19
|
//# sourceMappingURL=useEntityListSubTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityListSubTree.js","sources":["../../../src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '../treeParameters'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAClC,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"useEntityListSubTree.js","sources":["../../../src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '../treeParameters'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAClC,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAO9C,SAAO,8BAA8B,WAAW;AACjD;"}
|
|
@@ -5,45 +5,65 @@ function useEntityListSubTreeParameters(qualifiedEntityList) {
|
|
|
5
5
|
if (typeof qualifiedEntityList === "string") {
|
|
6
6
|
return qualifiedEntityList;
|
|
7
7
|
}
|
|
8
|
-
useConstantValueInvariant(
|
|
9
|
-
|
|
8
|
+
useConstantValueInvariant(
|
|
9
|
+
qualifiedEntityList.isCreating,
|
|
10
|
+
`EntityListSubTree: cannot alternate the 'isCreating' value.`
|
|
11
|
+
);
|
|
12
|
+
useConstantValueInvariant(
|
|
13
|
+
typeof qualifiedEntityList.entities,
|
|
14
|
+
`EntityListSubTree: cannot alternate the 'entities' value.`
|
|
15
|
+
);
|
|
10
16
|
if (qualifiedEntityList.isCreating) {
|
|
11
17
|
const entities2 = qualifiedEntityList.entities;
|
|
12
18
|
if (typeof entities2 === "string") {
|
|
13
|
-
return useMemo(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
return useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
isCreating: true,
|
|
22
|
+
entities: entities2
|
|
23
|
+
}),
|
|
24
|
+
[entities2]
|
|
25
|
+
);
|
|
17
26
|
}
|
|
18
|
-
return useMemo(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
return useMemo(
|
|
28
|
+
() => ({
|
|
29
|
+
isCreating: true,
|
|
30
|
+
entities: { entityName: entities2.entityName }
|
|
31
|
+
}),
|
|
32
|
+
[entities2.entityName]
|
|
33
|
+
);
|
|
22
34
|
}
|
|
23
35
|
const entities = qualifiedEntityList.entities;
|
|
24
36
|
if (typeof entities === "string") {
|
|
25
|
-
return useMemo(
|
|
26
|
-
|
|
37
|
+
return useMemo(
|
|
38
|
+
() => ({
|
|
39
|
+
entities,
|
|
40
|
+
orderBy: qualifiedEntityList.orderBy,
|
|
41
|
+
offset: qualifiedEntityList.offset,
|
|
42
|
+
limit: qualifiedEntityList.limit
|
|
43
|
+
}),
|
|
44
|
+
[entities, qualifiedEntityList.limit, qualifiedEntityList.offset, qualifiedEntityList.orderBy]
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return useMemo(
|
|
48
|
+
() => ({
|
|
49
|
+
entities: {
|
|
50
|
+
entityName: entities.entityName,
|
|
51
|
+
filter: entities.filter
|
|
52
|
+
},
|
|
27
53
|
orderBy: qualifiedEntityList.orderBy,
|
|
28
54
|
offset: qualifiedEntityList.offset,
|
|
29
55
|
limit: qualifiedEntityList.limit
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
limit: qualifiedEntityList.limit
|
|
40
|
-
}), [
|
|
41
|
-
entities.entityName,
|
|
42
|
-
entities.filter,
|
|
43
|
-
qualifiedEntityList.limit,
|
|
44
|
-
qualifiedEntityList.offset,
|
|
45
|
-
qualifiedEntityList.orderBy
|
|
46
|
-
]);
|
|
56
|
+
}),
|
|
57
|
+
[
|
|
58
|
+
entities.entityName,
|
|
59
|
+
entities.filter,
|
|
60
|
+
qualifiedEntityList.limit,
|
|
61
|
+
qualifiedEntityList.offset,
|
|
62
|
+
qualifiedEntityList.orderBy
|
|
63
|
+
]
|
|
64
|
+
);
|
|
47
65
|
}
|
|
48
|
-
export {
|
|
66
|
+
export {
|
|
67
|
+
useEntityListSubTreeParameters
|
|
68
|
+
};
|
|
49
69
|
//# sourceMappingURL=useEntityListSubTreeParameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityListSubTreeParameters.js","sources":["../../../src/accessorPropagation/useEntityListSubTreeParameters.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useMemo } from 'react'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '../treeParameters'\n\nexport function useEntityListSubTreeParameters(alias: Alias): Alias\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityListOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList {\n\tuseConstantValueInvariant(typeof qualifiedEntityList)\n\n\tif (typeof qualifiedEntityList === 'string') {\n\t\treturn qualifiedEntityList\n\t}\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(\n\t\tqualifiedEntityList.isCreating,\n\t\t`EntityListSubTree: cannot alternate the 'isCreating' value.`,\n\t)\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(\n\t\ttypeof qualifiedEntityList.entities,\n\t\t`EntityListSubTree: cannot alternate the 'entities' value.`,\n\t)\n\n\tif (qualifiedEntityList.isCreating) {\n\t\tconst entities = qualifiedEntityList.entities\n\n\t\tif (typeof entities === 'string') {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\treturn useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tisCreating: true,\n\t\t\t\t\tentities,\n\t\t\t\t}),\n\t\t\t\t[entities],\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tisCreating: true,\n\t\t\t\tentities: { entityName: entities.entityName },\n\t\t\t}),\n\t\t\t[entities.entityName],\n\t\t)\n\t}\n\tconst entities = qualifiedEntityList.entities\n\n\tif (typeof entities === 'string') {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tentities: entities,\n\t\t\t\torderBy: qualifiedEntityList.orderBy,\n\t\t\t\toffset: qualifiedEntityList.offset,\n\t\t\t\tlimit: qualifiedEntityList.limit,\n\t\t\t}),\n\t\t\t[entities, qualifiedEntityList.limit, qualifiedEntityList.offset, qualifiedEntityList.orderBy],\n\t\t)\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\treturn useMemo(\n\t\t() => ({\n\t\t\tentities: {\n\t\t\t\tentityName: entities.entityName,\n\t\t\t\tfilter: entities.filter,\n\t\t\t},\n\t\t\torderBy: qualifiedEntityList.orderBy,\n\t\t\toffset: qualifiedEntityList.offset,\n\t\t\tlimit: qualifiedEntityList.limit,\n\t\t}),\n\t\t[\n\t\t\tentities.entityName,\n\t\t\tentities.filter,\n\t\t\tqualifiedEntityList.limit,\n\t\t\tqualifiedEntityList.offset,\n\t\t\tqualifiedEntityList.orderBy,\n\t\t],\n\t)\n}\n"],"names":[],"mappings":";;AAWO,
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeParameters.js","sources":["../../../src/accessorPropagation/useEntityListSubTreeParameters.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useMemo } from 'react'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '../treeParameters'\n\nexport function useEntityListSubTreeParameters(alias: Alias): Alias\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityListOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList\nexport function useEntityListSubTreeParameters(\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList {\n\tuseConstantValueInvariant(typeof qualifiedEntityList)\n\n\tif (typeof qualifiedEntityList === 'string') {\n\t\treturn qualifiedEntityList\n\t}\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(\n\t\tqualifiedEntityList.isCreating,\n\t\t`EntityListSubTree: cannot alternate the 'isCreating' value.`,\n\t)\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(\n\t\ttypeof qualifiedEntityList.entities,\n\t\t`EntityListSubTree: cannot alternate the 'entities' value.`,\n\t)\n\n\tif (qualifiedEntityList.isCreating) {\n\t\tconst entities = qualifiedEntityList.entities\n\n\t\tif (typeof entities === 'string') {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\treturn useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tisCreating: true,\n\t\t\t\t\tentities,\n\t\t\t\t}),\n\t\t\t\t[entities],\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tisCreating: true,\n\t\t\t\tentities: { entityName: entities.entityName },\n\t\t\t}),\n\t\t\t[entities.entityName],\n\t\t)\n\t}\n\tconst entities = qualifiedEntityList.entities\n\n\tif (typeof entities === 'string') {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tentities: entities,\n\t\t\t\torderBy: qualifiedEntityList.orderBy,\n\t\t\t\toffset: qualifiedEntityList.offset,\n\t\t\t\tlimit: qualifiedEntityList.limit,\n\t\t\t}),\n\t\t\t[entities, qualifiedEntityList.limit, qualifiedEntityList.offset, qualifiedEntityList.orderBy],\n\t\t)\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\treturn useMemo(\n\t\t() => ({\n\t\t\tentities: {\n\t\t\t\tentityName: entities.entityName,\n\t\t\t\tfilter: entities.filter,\n\t\t\t},\n\t\t\torderBy: qualifiedEntityList.orderBy,\n\t\t\toffset: qualifiedEntityList.offset,\n\t\t\tlimit: qualifiedEntityList.limit,\n\t\t}),\n\t\t[\n\t\t\tentities.entityName,\n\t\t\tentities.filter,\n\t\t\tqualifiedEntityList.limit,\n\t\t\tqualifiedEntityList.offset,\n\t\t\tqualifiedEntityList.orderBy,\n\t\t],\n\t)\n}\n"],"names":["entities"],"mappings":";;AAWO,SAAS,+BACf,qBAC+E;AAC/E,4BAA0B,OAAO,mBAAmB;AAEhD,MAAA,OAAO,wBAAwB,UAAU;AACrC,WAAA;AAAA,EACR;AAGA;AAAA,IACC,oBAAoB;AAAA,IACpB;AAAA,EAAA;AAID;AAAA,IACC,OAAO,oBAAoB;AAAA,IAC3B;AAAA,EAAA;AAGD,MAAI,oBAAoB,YAAY;AACnC,UAAMA,YAAW,oBAAoB;AAEjC,QAAA,OAAOA,cAAa,UAAU;AAE1B,aAAA;AAAA,QACN,OAAO;AAAA,UACN,YAAY;AAAA,UACZ,UAAAA;AAAAA,QAAA;AAAA,QAED,CAACA,SAAQ;AAAA,MAAA;AAAA,IAEX;AAEO,WAAA;AAAA,MACN,OAAO;AAAA,QACN,YAAY;AAAA,QACZ,UAAU,EAAE,YAAYA,UAAS,WAAW;AAAA,MAAA;AAAA,MAE7C,CAACA,UAAS,UAAU;AAAA,IAAA;AAAA,EAEtB;AACA,QAAM,WAAW,oBAAoB;AAEjC,MAAA,OAAO,aAAa,UAAU;AAE1B,WAAA;AAAA,MACN,OAAO;AAAA,QACN;AAAA,QACA,SAAS,oBAAoB;AAAA,QAC7B,QAAQ,oBAAoB;AAAA,QAC5B,OAAO,oBAAoB;AAAA,MAAA;AAAA,MAE5B,CAAC,UAAU,oBAAoB,OAAO,oBAAoB,QAAQ,oBAAoB,OAAO;AAAA,IAAA;AAAA,EAE/F;AAEO,SAAA;AAAA,IACN,OAAO;AAAA,MACN,UAAU;AAAA,QACT,YAAY,SAAS;AAAA,QACrB,QAAQ,SAAS;AAAA,MAClB;AAAA,MACA,SAAS,oBAAoB;AAAA,MAC7B,QAAQ,oBAAoB;AAAA,MAC5B,OAAO,oBAAoB;AAAA,IAAA;AAAA,IAE5B;AAAA,MACC,SAAS;AAAA,MACT,SAAS;AAAA,MACT,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,IACrB;AAAA,EAAA;AAEF;"}
|
|
@@ -7,8 +7,13 @@ const useEntitySubTree = (qualifiedSingleEntity, ...treeId) => {
|
|
|
7
7
|
const parameters = useEntitySubTreeParameters(qualifiedSingleEntity);
|
|
8
8
|
const hasTreeId = treeId.length > 0;
|
|
9
9
|
const treeIdVal = treeId[0];
|
|
10
|
-
const getAccessor = useCallback(
|
|
10
|
+
const getAccessor = useCallback(
|
|
11
|
+
() => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
|
|
12
|
+
[getSubTree, hasTreeId, parameters, treeIdVal]
|
|
13
|
+
);
|
|
11
14
|
return useAccessorUpdateSubscription(getAccessor);
|
|
12
15
|
};
|
|
13
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
useEntitySubTree
|
|
18
|
+
};
|
|
14
19
|
//# sourceMappingURL=useEntitySubTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntitySubTree.js","sources":["../../../src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\nimport { TreeRootId } from '../treeParameters'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAClC,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"useEntitySubTree.js","sources":["../../../src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\nimport { TreeRootId } from '../treeParameters'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAClC,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAM9C,SAAO,8BAA8B,WAAW;AACjD;"}
|
|
@@ -10,27 +10,38 @@ function useEntitySubTreeParameters(qualifiedSingleEntity) {
|
|
|
10
10
|
if (qualifiedSingleEntity.isCreating) {
|
|
11
11
|
const entity2 = qualifiedSingleEntity.entity;
|
|
12
12
|
if (typeof entity2 === "string") {
|
|
13
|
-
return useMemo(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
isCreating: true,
|
|
16
|
+
entity: entity2
|
|
17
|
+
}),
|
|
18
|
+
[entity2]
|
|
19
|
+
);
|
|
17
20
|
}
|
|
18
|
-
return useMemo(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
return useMemo(
|
|
22
|
+
() => ({
|
|
23
|
+
isCreating: true,
|
|
24
|
+
entity: { entityName: entity2.entityName }
|
|
25
|
+
}),
|
|
26
|
+
[entity2.entityName]
|
|
27
|
+
);
|
|
22
28
|
}
|
|
23
29
|
const entity = qualifiedSingleEntity.entity;
|
|
24
30
|
if (typeof entity === "string") {
|
|
25
31
|
return useMemo(() => ({ entity }), [entity]);
|
|
26
32
|
}
|
|
27
|
-
return useMemo(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
return useMemo(
|
|
34
|
+
() => ({
|
|
35
|
+
entity: {
|
|
36
|
+
entityName: entity.entityName,
|
|
37
|
+
filter: entity.filter,
|
|
38
|
+
where: entity.where
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
[entity.entityName, entity.filter, entity.where]
|
|
42
|
+
);
|
|
34
43
|
}
|
|
35
|
-
export {
|
|
44
|
+
export {
|
|
45
|
+
useEntitySubTreeParameters
|
|
46
|
+
};
|
|
36
47
|
//# sourceMappingURL=useEntitySubTreeParameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntitySubTreeParameters.js","sources":["../../../src/accessorPropagation/useEntitySubTreeParameters.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useMemo } from 'react'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '../treeParameters'\n\nexport function useEntitySubTreeParameters(alias: Alias): Alias\nexport function useEntitySubTreeParameters(\n\tqualifiedEntity: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity\nexport function useEntitySubTreeParameters(\n\tqualifiedSingleEntityOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity\nexport function useEntitySubTreeParameters(\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity {\n\tuseConstantValueInvariant(typeof qualifiedSingleEntity)\n\n\tif (typeof qualifiedSingleEntity === 'string') {\n\t\treturn qualifiedSingleEntity\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(qualifiedSingleEntity.isCreating, `EntitySubTree: cannot alternate the 'isCreating' value.`)\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(typeof qualifiedSingleEntity.entity, `EntitySubTree: cannot alternate the 'entity' value.`)\n\n\tif (qualifiedSingleEntity.isCreating) {\n\t\tconst entity = qualifiedSingleEntity.entity\n\n\t\tif (typeof entity === 'string') {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\treturn useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tisCreating: true,\n\t\t\t\t\tentity: entity,\n\t\t\t\t}),\n\t\t\t\t[entity],\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tisCreating: true,\n\t\t\t\tentity: { entityName: entity.entityName },\n\t\t\t}),\n\t\t\t[entity.entityName],\n\t\t)\n\t}\n\n\tconst entity = qualifiedSingleEntity.entity\n\n\tif (typeof entity === 'string') {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(() => ({ entity: entity }), [entity])\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\treturn useMemo(\n\t\t() => ({\n\t\t\tentity: {\n\t\t\t\tentityName: entity.entityName,\n\t\t\t\tfilter: entity.filter,\n\t\t\t\twhere: entity.where,\n\t\t\t},\n\t\t}),\n\t\t[entity.entityName, entity.filter, entity.where],\n\t)\n}\n"],"names":[],"mappings":";;AAWO,
|
|
1
|
+
{"version":3,"file":"useEntitySubTreeParameters.js","sources":["../../../src/accessorPropagation/useEntitySubTreeParameters.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useMemo } from 'react'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '../treeParameters'\n\nexport function useEntitySubTreeParameters(alias: Alias): Alias\nexport function useEntitySubTreeParameters(\n\tqualifiedEntity: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity\nexport function useEntitySubTreeParameters(\n\tqualifiedSingleEntityOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity\nexport function useEntitySubTreeParameters(\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity {\n\tuseConstantValueInvariant(typeof qualifiedSingleEntity)\n\n\tif (typeof qualifiedSingleEntity === 'string') {\n\t\treturn qualifiedSingleEntity\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(qualifiedSingleEntity.isCreating, `EntitySubTree: cannot alternate the 'isCreating' value.`)\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tuseConstantValueInvariant(typeof qualifiedSingleEntity.entity, `EntitySubTree: cannot alternate the 'entity' value.`)\n\n\tif (qualifiedSingleEntity.isCreating) {\n\t\tconst entity = qualifiedSingleEntity.entity\n\n\t\tif (typeof entity === 'string') {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\treturn useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\tisCreating: true,\n\t\t\t\t\tentity: entity,\n\t\t\t\t}),\n\t\t\t\t[entity],\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(\n\t\t\t() => ({\n\t\t\t\tisCreating: true,\n\t\t\t\tentity: { entityName: entity.entityName },\n\t\t\t}),\n\t\t\t[entity.entityName],\n\t\t)\n\t}\n\n\tconst entity = qualifiedSingleEntity.entity\n\n\tif (typeof entity === 'string') {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useMemo(() => ({ entity: entity }), [entity])\n\t}\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\treturn useMemo(\n\t\t() => ({\n\t\t\tentity: {\n\t\t\t\tentityName: entity.entityName,\n\t\t\t\tfilter: entity.filter,\n\t\t\t\twhere: entity.where,\n\t\t\t},\n\t\t}),\n\t\t[entity.entityName, entity.filter, entity.where],\n\t)\n}\n"],"names":["entity"],"mappings":";;AAWO,SAAS,2BACf,uBACmF;AACnF,4BAA0B,OAAO,qBAAqB;AAElD,MAAA,OAAO,0BAA0B,UAAU;AACvC,WAAA;AAAA,EACR;AAE0B,4BAAA,sBAAsB,YAAY,yDAAyD;AAG3F,4BAAA,OAAO,sBAAsB,QAAQ,qDAAqD;AAEpH,MAAI,sBAAsB,YAAY;AACrC,UAAMA,UAAS,sBAAsB;AAEjC,QAAA,OAAOA,YAAW,UAAU;AAExB,aAAA;AAAA,QACN,OAAO;AAAA,UACN,YAAY;AAAA,UACZ,QAAQA;AAAAA,QAAA;AAAA,QAET,CAACA,OAAM;AAAA,MAAA;AAAA,IAET;AAEO,WAAA;AAAA,MACN,OAAO;AAAA,QACN,YAAY;AAAA,QACZ,QAAQ,EAAE,YAAYA,QAAO,WAAW;AAAA,MAAA;AAAA,MAEzC,CAACA,QAAO,UAAU;AAAA,IAAA;AAAA,EAEpB;AAEA,QAAM,SAAS,sBAAsB;AAEjC,MAAA,OAAO,WAAW,UAAU;AAE/B,WAAO,QAAQ,OAAO,EAAE,OAAmB,IAAA,CAAC,MAAM,CAAC;AAAA,EACpD;AAEO,SAAA;AAAA,IACN,OAAO;AAAA,MACN,QAAQ;AAAA,QACP,YAAY,OAAO;AAAA,QACnB,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,MACf;AAAA,IAAA;AAAA,IAED,CAAC,OAAO,YAAY,OAAO,QAAQ,OAAO,KAAK;AAAA,EAAA;AAEjD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEnvironment.js","sources":["../../../src/accessorPropagation/useEnvironment.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { Environment } from '../dao'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport const useEnvironment = (): Environment => {\n\treturn useContext(EnvironmentContext)\n}\n"],"names":[],"mappings":";;AAIO,MAAM,iBAAiB,MAAmB;AAChD,SAAO,WAAW,kBAAkB;AACrC
|
|
1
|
+
{"version":3,"file":"useEnvironment.js","sources":["../../../src/accessorPropagation/useEnvironment.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { Environment } from '../dao'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport const useEnvironment = (): Environment => {\n\treturn useContext(EnvironmentContext)\n}\n"],"names":[],"mappings":";;AAIO,MAAM,iBAAiB,MAAmB;AAChD,SAAO,WAAW,kBAAkB;AACrC;"}
|
|
@@ -10,7 +10,10 @@ const useExtendTree = () => {
|
|
|
10
10
|
const environment = useEnvironment();
|
|
11
11
|
return useCallback(async (newFragment, options) => {
|
|
12
12
|
try {
|
|
13
|
-
const newTreeRootId = await extendTree(
|
|
13
|
+
const newTreeRootId = await extendTree(
|
|
14
|
+
newFragment,
|
|
15
|
+
{ environment, ...options, signal: abort() }
|
|
16
|
+
);
|
|
14
17
|
if (!isMountedRef.current) {
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
@@ -23,5 +26,7 @@ const useExtendTree = () => {
|
|
|
23
26
|
}
|
|
24
27
|
}, [abort, environment, extendTree, isMountedRef]);
|
|
25
28
|
};
|
|
26
|
-
export {
|
|
29
|
+
export {
|
|
30
|
+
useExtendTree
|
|
31
|
+
};
|
|
27
32
|
//# sourceMappingURL=useExtendTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExtendTree.js","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '../treeParameters'\nimport { ExtendTreeOptions } from '../accessors'\nimport { DataBindingExtendAborted } from '../core'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQ;AACR,QAAA,EAAE,eAAe;AACvB,QAAM,eAAe;AACrB,QAAM,cAAc;AACb,SAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;
|
|
1
|
+
{"version":3,"file":"useExtendTree.js","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '../treeParameters'\nimport { ExtendTreeOptions } from '../accessors'\nimport { DataBindingExtendAborted } from '../core'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQ;AACR,QAAA,EAAE,eAAe;AACvB,QAAM,eAAe;AACrB,QAAM,cAAc;AACb,SAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;AACH,YAAM,gBAAgB,MAAM;AAAA,QAAW;AAAA,QACtC,EAAE,aAAa,GAAG,SAAS,QAAQ,QAAQ;AAAA,MAAA;AAExC,UAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,MACD;AACO,aAAA;AAAA,aACC;AACR,UAAI,MAAM,0BAA0B;AACnC;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,KACE,CAAC,OAAO,aAAa,YAAY,YAAY,CAAC;AAClD;"}
|
|
@@ -7,7 +7,10 @@ import { useGetEntityByKey } from "./useGetEntityByKey.js";
|
|
|
7
7
|
import { useOnConnectionUpdate } from "../entityEvents/useOnConnectionUpdate.js";
|
|
8
8
|
function useField(sugaredRelativeSingleField) {
|
|
9
9
|
const relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField);
|
|
10
|
-
useConstantValueInvariant(
|
|
10
|
+
useConstantValueInvariant(
|
|
11
|
+
!!relativeSingleField,
|
|
12
|
+
"useField: cannot alternate between providing and omitting the argument."
|
|
13
|
+
);
|
|
11
14
|
const entityKey = useEntityKey();
|
|
12
15
|
const getEntityByKey = useGetEntityByKey();
|
|
13
16
|
const getField = useCallback(() => {
|
|
@@ -15,7 +18,10 @@ function useField(sugaredRelativeSingleField) {
|
|
|
15
18
|
return parent.getRelativeSingleField(relativeSingleField);
|
|
16
19
|
}, [entityKey, getEntityByKey, relativeSingleField]);
|
|
17
20
|
if (relativeSingleField) {
|
|
18
|
-
useConstantLengthInvariant(
|
|
21
|
+
useConstantLengthInvariant(
|
|
22
|
+
relativeSingleField.hasOneRelationPath,
|
|
23
|
+
"Cannot change the length of the hasOneRelation path!"
|
|
24
|
+
);
|
|
19
25
|
const [field, forceUpdate] = useAccessorUpdateSubscription(getField, true);
|
|
20
26
|
if (relativeSingleField.hasOneRelationPath.length) {
|
|
21
27
|
useOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate);
|
|
@@ -24,5 +30,7 @@ function useField(sugaredRelativeSingleField) {
|
|
|
24
30
|
}
|
|
25
31
|
return void 0;
|
|
26
32
|
}
|
|
27
|
-
export {
|
|
33
|
+
export {
|
|
34
|
+
useField
|
|
35
|
+
};
|
|
28
36
|
//# sourceMappingURL=useField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField.js","sources":["../../../src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, forceUpdate] = useAccessorUpdateSubscription<Value>(getField, true)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":[],"mappings":";;;;;;;AAeA,
|
|
1
|
+
{"version":3,"file":"useField.js","sources":["../../../src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, forceUpdate] = useAccessorUpdateSubscription<Value>(getField, true)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":[],"mappings":";;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsB,gCAAgC,0BAA0B;AACtF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,WAAW,YAAY,MAAM;AAC5B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,uBAA8B,mBAAoB;AAAA,EAC9D,GAAA,CAAC,WAAW,gBAAgB,mBAAmB,CAAC;AAEnD,MAAI,qBAAqB;AAExB;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,IAAA;AAGD,UAAM,CAAC,OAAO,WAAW,IAAI,8BAAqC,UAAU,IAAI;AAE5E,QAAA,oBAAoB,mBAAmB,QAAQ;AAElD,4BAAsB,oBAAoB,mBAAmB,GAAG,OAAO,WAAW;AAAA,IACnF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntityByKey.js","sources":["../../../src/accessorPropagation/useGetEntityByKey.ts"],"sourcesContent":["import type { GetEntityByKey } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetEntityByKey = (): GetEntityByKey => useBindingOperations().getEntityByKey\n"],"names":[],"mappings":";AAGa,MAAA,oBAAoB,MAAsB,uBAAuB
|
|
1
|
+
{"version":3,"file":"useGetEntityByKey.js","sources":["../../../src/accessorPropagation/useGetEntityByKey.ts"],"sourcesContent":["import type { GetEntityByKey } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetEntityByKey = (): GetEntityByKey => useBindingOperations().getEntityByKey\n"],"names":[],"mappings":";AAGa,MAAA,oBAAoB,MAAsB,uBAAuB;"}
|
|
@@ -6,7 +6,12 @@ const useGetEntityListSubTree = () => {
|
|
|
6
6
|
const environment = useEnvironment();
|
|
7
7
|
const getEntityListSubTree = useBindingOperations().getEntityListSubTree;
|
|
8
8
|
const treeRootId = useTreeRootId();
|
|
9
|
-
return useCallback(
|
|
9
|
+
return useCallback(
|
|
10
|
+
(parametersOrAlias, ...treeId) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),
|
|
11
|
+
[environment, getEntityListSubTree, treeRootId]
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useGetEntityListSubTree
|
|
10
16
|
};
|
|
11
|
-
export { useGetEntityListSubTree };
|
|
12
17
|
//# sourceMappingURL=useGetEntityListSubTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntityListSubTree.js","sources":["../../../src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAc;AACd,QAAA,uBAAuB,qBAAuB,EAAA;AACpD,QAAM,aAAa;
|
|
1
|
+
{"version":3,"file":"useGetEntityListSubTree.js","sources":["../../../src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAc;AACd,QAAA,uBAAuB,qBAAuB,EAAA;AACpD,QAAM,aAAa;AAEZ,SAAA;AAAA,IACN,CACC,sBACG,WACC,qBAAqB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,IAAI,WAAW;AAAA,IACtG,CAAC,aAAa,sBAAsB,UAAU;AAAA,EAAA;AAEhD;"}
|
|
@@ -6,7 +6,12 @@ const useGetEntitySubTree = () => {
|
|
|
6
6
|
const environment = useEnvironment();
|
|
7
7
|
const getEntitySubTree = useBindingOperations().getEntitySubTree;
|
|
8
8
|
const treeRootId = useTreeRootId();
|
|
9
|
-
return useCallback(
|
|
9
|
+
return useCallback(
|
|
10
|
+
(parametersOrAlias, ...treeId) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),
|
|
11
|
+
[environment, getEntitySubTree, treeRootId]
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useGetEntitySubTree
|
|
10
16
|
};
|
|
11
|
-
export { useGetEntitySubTree };
|
|
12
17
|
//# sourceMappingURL=useGetEntitySubTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAc;AACd,QAAA,mBAAmB,qBAAuB,EAAA;AAChD,QAAM,aAAa;
|
|
1
|
+
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAc;AACd,QAAA,mBAAmB,qBAAuB,EAAA;AAChD,QAAM,aAAa;AAEZ,SAAA;AAAA,IACN,CACC,sBACG,WACC,iBAAiB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,IAAI,WAAW;AAAA,IAClG,CAAC,aAAa,kBAAkB,UAAU;AAAA,EAAA;AAE5C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTreeFilters.js","sources":["../../../src/accessorPropagation/useGetTreeFilters.ts"],"sourcesContent":["import type { TreeFilter } from '@contember/client'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetTreeFilters = (): (() => TreeFilter[]) => useBindingOperations().getTreeFilters\n"],"names":[],"mappings":";AAGa,MAAA,oBAAoB,MAA4B,uBAAuB
|
|
1
|
+
{"version":3,"file":"useGetTreeFilters.js","sources":["../../../src/accessorPropagation/useGetTreeFilters.ts"],"sourcesContent":["import type { TreeFilter } from '@contember/client'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetTreeFilters = (): (() => TreeFilter[]) => useBindingOperations().getTreeFilters\n"],"names":[],"mappings":";AAGa,MAAA,oBAAoB,MAA4B,uBAAuB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHasEntity.js","sources":["../../../src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":[],"mappings":";;AAGO,MAAM,eAAe,MAAe;AACnC,SAAA,WAAW,gBAAgB,MAAM;AACzC
|
|
1
|
+
{"version":3,"file":"useHasEntity.js","sources":["../../../src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":[],"mappings":";;AAGO,MAAM,eAAe,MAAe;AACnC,SAAA,WAAW,gBAAgB,MAAM;AACzC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersist.js","sources":["../../../src/accessorPropagation/usePersist.ts"],"sourcesContent":["import type { Persist } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const usePersist = (): Persist => useBindingOperations().persist\n"],"names":[],"mappings":";AAGa,MAAA,aAAa,MAAe,uBAAuB
|
|
1
|
+
{"version":3,"file":"usePersist.js","sources":["../../../src/accessorPropagation/usePersist.ts"],"sourcesContent":["import type { Persist } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const usePersist = (): Persist => useBindingOperations().persist\n"],"names":[],"mappings":";AAGa,MAAA,aAAa,MAAe,uBAAuB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeRootId.js","sources":["../../../src/accessorPropagation/useTreeRootId.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { TreeRootId } from '../treeParameters'\nimport { TreeRootIdContext } from './TreeRootIdContext'\n\nexport const useTreeRootId = (): TreeRootId | undefined => useContext(TreeRootIdContext)\n"],"names":[],"mappings":";;AAIa,MAAA,gBAAgB,MAA8B,WAAW,iBAAiB
|
|
1
|
+
{"version":3,"file":"useTreeRootId.js","sources":["../../../src/accessorPropagation/useTreeRootId.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { TreeRootId } from '../treeParameters'\nimport { TreeRootIdContext } from './TreeRootIdContext'\n\nexport const useTreeRootId = (): TreeRootId | undefined => useContext(TreeRootIdContext)\n"],"names":[],"mappings":";;AAIa,MAAA,gBAAgB,MAA8B,WAAW,iBAAiB;"}
|