@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
|
@@ -16,11 +16,19 @@ function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity) {
|
|
|
16
16
|
hasEntity = true;
|
|
17
17
|
normalizedSugared = sugaredRelativeSingleEntity;
|
|
18
18
|
}
|
|
19
|
-
return useMemo(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return useMemo(
|
|
20
|
+
() => hasEntity ? QueryLanguage.desugarRelativeSingleEntity(
|
|
21
|
+
{
|
|
22
|
+
field: normalizedSugared.field,
|
|
23
|
+
isNonbearing: normalizedSugared?.isNonbearing,
|
|
24
|
+
setOnCreate: normalizedSugared?.setOnCreate
|
|
25
|
+
},
|
|
26
|
+
environment
|
|
27
|
+
) : void 0,
|
|
28
|
+
[normalizedSugared?.field, normalizedSugared?.isNonbearing, normalizedSugared?.setOnCreate, environment, hasEntity]
|
|
29
|
+
);
|
|
24
30
|
}
|
|
25
|
-
export {
|
|
31
|
+
export {
|
|
32
|
+
useDesugaredRelativeSingleEntity
|
|
33
|
+
};
|
|
26
34
|
//# sourceMappingURL=useDesugaredRelativeSingleEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDesugaredRelativeSingleEntity.js","sources":["../../../src/accessorPropagation/useDesugaredRelativeSingleEntity.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { RelativeSingleEntity, SugaredRelativeSingleEntity } from '../treeParameters'\nimport { useEnvironment } from './useEnvironment'\n\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity,\n): RelativeSingleEntity\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): RelativeSingleEntity | undefined\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): RelativeSingleEntity | undefined {\n\tconst environment = useEnvironment()\n\n\tlet normalizedSugared: SugaredRelativeSingleEntity | undefined = undefined\n\tlet hasEntity: boolean\n\n\tif (sugaredRelativeSingleEntity === undefined) {\n\t\thasEntity = false\n\t} else if (typeof sugaredRelativeSingleEntity === 'string') {\n\t\thasEntity = true\n\t\tnormalizedSugared = {\n\t\t\tfield: sugaredRelativeSingleEntity,\n\t\t}\n\t} else {\n\t\thasEntity = true\n\t\tnormalizedSugared = sugaredRelativeSingleEntity\n\t}\n\n\treturn useMemo(\n\t\t() =>\n\t\t\thasEntity\n\t\t\t\t? QueryLanguage.desugarRelativeSingleEntity(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: normalizedSugared!.field,\n\t\t\t\t\t\t\tisNonbearing: normalizedSugared?.isNonbearing,\n\t\t\t\t\t\t\tsetOnCreate: normalizedSugared?.setOnCreate,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenvironment,\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[normalizedSugared?.field, normalizedSugared?.isNonbearing, normalizedSugared?.setOnCreate, environment, hasEntity],\n\t)\n}\n\nexport { useDesugaredRelativeSingleEntity }\n"],"names":[],"mappings":";;;AAoBA,
|
|
1
|
+
{"version":3,"file":"useDesugaredRelativeSingleEntity.js","sources":["../../../src/accessorPropagation/useDesugaredRelativeSingleEntity.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { RelativeSingleEntity, SugaredRelativeSingleEntity } from '../treeParameters'\nimport { useEnvironment } from './useEnvironment'\n\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity,\n): RelativeSingleEntity\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): RelativeSingleEntity | undefined\n/**\n * @deprecated Use useEntity instead.\n */\nfunction useDesugaredRelativeSingleEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): RelativeSingleEntity | undefined {\n\tconst environment = useEnvironment()\n\n\tlet normalizedSugared: SugaredRelativeSingleEntity | undefined = undefined\n\tlet hasEntity: boolean\n\n\tif (sugaredRelativeSingleEntity === undefined) {\n\t\thasEntity = false\n\t} else if (typeof sugaredRelativeSingleEntity === 'string') {\n\t\thasEntity = true\n\t\tnormalizedSugared = {\n\t\t\tfield: sugaredRelativeSingleEntity,\n\t\t}\n\t} else {\n\t\thasEntity = true\n\t\tnormalizedSugared = sugaredRelativeSingleEntity\n\t}\n\n\treturn useMemo(\n\t\t() =>\n\t\t\thasEntity\n\t\t\t\t? QueryLanguage.desugarRelativeSingleEntity(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: normalizedSugared!.field,\n\t\t\t\t\t\t\tisNonbearing: normalizedSugared?.isNonbearing,\n\t\t\t\t\t\t\tsetOnCreate: normalizedSugared?.setOnCreate,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenvironment,\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[normalizedSugared?.field, normalizedSugared?.isNonbearing, normalizedSugared?.setOnCreate, environment, hasEntity],\n\t)\n}\n\nexport { useDesugaredRelativeSingleEntity }\n"],"names":[],"mappings":";;;AAoBA,SAAS,iCACR,6BACmC;AACnC,QAAM,cAAc;AAEpB,MAAI,oBAA6D;AAC7D,MAAA;AAEJ,MAAI,gCAAgC,QAAW;AAClC,gBAAA;AAAA,EAAA,WACF,OAAO,gCAAgC,UAAU;AAC/C,gBAAA;AACQ,wBAAA;AAAA,MACnB,OAAO;AAAA,IAAA;AAAA,EACR,OACM;AACM,gBAAA;AACQ,wBAAA;AAAA,EACrB;AAEO,SAAA;AAAA,IACN,MACC,YACG,cAAc;AAAA,MACd;AAAA,QACC,OAAO,kBAAmB;AAAA,QAC1B,cAAc,mBAAmB;AAAA,QACjC,aAAa,mBAAmB;AAAA,MACjC;AAAA,MACA;AAAA,IAEA,IAAA;AAAA,IAEJ,CAAC,mBAAmB,OAAO,mBAAmB,cAAc,mBAAmB,aAAa,aAAa,SAAS;AAAA,EAAA;AAEpH;"}
|
|
@@ -16,11 +16,19 @@ function useDesugaredRelativeSingleField(sugaredRelativeSingleField) {
|
|
|
16
16
|
hasField = true;
|
|
17
17
|
normalizedSugared = sugaredRelativeSingleField;
|
|
18
18
|
}
|
|
19
|
-
return useMemo(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return useMemo(
|
|
20
|
+
() => hasField ? QueryLanguage.desugarRelativeSingleField(
|
|
21
|
+
{
|
|
22
|
+
field: normalizedSugared.field,
|
|
23
|
+
defaultValue: normalizedSugared?.defaultValue,
|
|
24
|
+
isNonbearing: normalizedSugared?.isNonbearing
|
|
25
|
+
},
|
|
26
|
+
environment
|
|
27
|
+
) : void 0,
|
|
28
|
+
[normalizedSugared?.field, normalizedSugared?.defaultValue, normalizedSugared?.isNonbearing, environment, hasField]
|
|
29
|
+
);
|
|
24
30
|
}
|
|
25
|
-
export {
|
|
31
|
+
export {
|
|
32
|
+
useDesugaredRelativeSingleField
|
|
33
|
+
};
|
|
26
34
|
//# sourceMappingURL=useDesugaredRelativeSingleField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDesugaredRelativeSingleField.js","sources":["../../../src/accessorPropagation/useDesugaredRelativeSingleField.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { useEnvironment } from './useEnvironment'\n\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): RelativeSingleField\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): RelativeSingleField | undefined\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): RelativeSingleField | undefined {\n\tconst environment = useEnvironment()\n\n\tlet normalizedSugared: SugaredRelativeSingleField | undefined = undefined\n\tlet hasField: boolean\n\n\tif (sugaredRelativeSingleField === undefined) {\n\t\thasField = false\n\t} else if (typeof sugaredRelativeSingleField === 'string') {\n\t\thasField = true\n\t\tnormalizedSugared = {\n\t\t\tfield: sugaredRelativeSingleField,\n\t\t}\n\t} else {\n\t\thasField = true\n\t\tnormalizedSugared = sugaredRelativeSingleField\n\t}\n\n\treturn useMemo(\n\t\t() =>\n\t\t\thasField\n\t\t\t\t? QueryLanguage.desugarRelativeSingleField(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: normalizedSugared!.field,\n\t\t\t\t\t\t\tdefaultValue: normalizedSugared?.defaultValue,\n\t\t\t\t\t\t\tisNonbearing: normalizedSugared?.isNonbearing,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenvironment,\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[normalizedSugared?.field, normalizedSugared?.defaultValue, normalizedSugared?.isNonbearing, environment, hasField],\n\t)\n}\n\nexport { useDesugaredRelativeSingleField }\n"],"names":[],"mappings":";;;AAoBA,
|
|
1
|
+
{"version":3,"file":"useDesugaredRelativeSingleField.js","sources":["../../../src/accessorPropagation/useDesugaredRelativeSingleField.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { useEnvironment } from './useEnvironment'\n\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): RelativeSingleField\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): RelativeSingleField | undefined\n/**\n * @deprecated Use useField instead.\n */\nfunction useDesugaredRelativeSingleField(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): RelativeSingleField | undefined {\n\tconst environment = useEnvironment()\n\n\tlet normalizedSugared: SugaredRelativeSingleField | undefined = undefined\n\tlet hasField: boolean\n\n\tif (sugaredRelativeSingleField === undefined) {\n\t\thasField = false\n\t} else if (typeof sugaredRelativeSingleField === 'string') {\n\t\thasField = true\n\t\tnormalizedSugared = {\n\t\t\tfield: sugaredRelativeSingleField,\n\t\t}\n\t} else {\n\t\thasField = true\n\t\tnormalizedSugared = sugaredRelativeSingleField\n\t}\n\n\treturn useMemo(\n\t\t() =>\n\t\t\thasField\n\t\t\t\t? QueryLanguage.desugarRelativeSingleField(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: normalizedSugared!.field,\n\t\t\t\t\t\t\tdefaultValue: normalizedSugared?.defaultValue,\n\t\t\t\t\t\t\tisNonbearing: normalizedSugared?.isNonbearing,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenvironment,\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[normalizedSugared?.field, normalizedSugared?.defaultValue, normalizedSugared?.isNonbearing, environment, hasField],\n\t)\n}\n\nexport { useDesugaredRelativeSingleField }\n"],"names":[],"mappings":";;;AAoBA,SAAS,gCACR,4BACkC;AAClC,QAAM,cAAc;AAEpB,MAAI,oBAA4D;AAC5D,MAAA;AAEJ,MAAI,+BAA+B,QAAW;AAClC,eAAA;AAAA,EAAA,WACD,OAAO,+BAA+B,UAAU;AAC/C,eAAA;AACS,wBAAA;AAAA,MACnB,OAAO;AAAA,IAAA;AAAA,EACR,OACM;AACK,eAAA;AACS,wBAAA;AAAA,EACrB;AAEO,SAAA;AAAA,IACN,MACC,WACG,cAAc;AAAA,MACd;AAAA,QACC,OAAO,kBAAmB;AAAA,QAC1B,cAAc,mBAAmB;AAAA,QACjC,cAAc,mBAAmB;AAAA,MAClC;AAAA,MACA;AAAA,IAEA,IAAA;AAAA,IAEJ,CAAC,mBAAmB,OAAO,mBAAmB,cAAc,mBAAmB,cAAc,aAAa,QAAQ;AAAA,EAAA;AAEpH;"}
|
|
@@ -20,7 +20,10 @@ function useEntity(...entity) {
|
|
|
20
20
|
return parent.getRelativeSingleEntity(relativeSingleEntity);
|
|
21
21
|
}, [entityKey, getEntityByKey, relativeSingleEntity]);
|
|
22
22
|
if (relativeSingleEntity) {
|
|
23
|
-
useConstantLengthInvariant(
|
|
23
|
+
useConstantLengthInvariant(
|
|
24
|
+
relativeSingleEntity.hasOneRelationPath,
|
|
25
|
+
"Cannot change the length of the hasOneRelation path!"
|
|
26
|
+
);
|
|
24
27
|
const [entity2, forceUpdate] = useAccessorUpdateSubscription(getEntity, true);
|
|
25
28
|
if (relativeSingleEntity.hasOneRelationPath.length) {
|
|
26
29
|
useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate);
|
|
@@ -29,5 +32,7 @@ function useEntity(...entity) {
|
|
|
29
32
|
}
|
|
30
33
|
return void 0;
|
|
31
34
|
}
|
|
32
|
-
export {
|
|
35
|
+
export {
|
|
36
|
+
useEntity
|
|
37
|
+
};
|
|
33
38
|
//# sourceMappingURL=useEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntity.js","sources":["../../../src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.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 [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":[],"mappings":";;;;;;;AAcA,
|
|
1
|
+
{"version":3,"file":"useEntity.js","sources":["../../../src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.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 [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["entity"],"mappings":";;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxF,4BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoB,YAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAElG,WAAO,8BAA8B,iBAAiB;AAAA,EACvD;AACA,QAAM,8BAA8B,OAAO;AAGrC,QAAA,uBAAuB,iCAAiC,2BAA2B;AAEnF,QAAA,YAAY,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,wBAAwB,oBAAqB;AAAA,EACzD,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzB;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACA,SAAQ,WAAW,IAAI,8BAA8B,WAAW,IAAI;AAEvE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnD,4BAAsB,qBAAqB,mBAAmB,GAAG,OAAO,WAAW;AAAA,IACpF;AAEOA,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;"}
|
|
@@ -4,9 +4,13 @@ import { EntityKeyContext } from "./EntityKeyContext.js";
|
|
|
4
4
|
const useEntityKey = () => {
|
|
5
5
|
const entityKey = useContext(EntityKeyContext);
|
|
6
6
|
if (entityKey === void 0) {
|
|
7
|
-
throw new BindingError(
|
|
7
|
+
throw new BindingError(
|
|
8
|
+
`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> or a SubTree.`
|
|
9
|
+
);
|
|
8
10
|
}
|
|
9
11
|
return entityKey;
|
|
10
12
|
};
|
|
11
|
-
export {
|
|
13
|
+
export {
|
|
14
|
+
useEntityKey
|
|
15
|
+
};
|
|
12
16
|
//# sourceMappingURL=useEntityKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityKey.js","sources":["../../../src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '../BindingError'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;
|
|
1
|
+
{"version":3,"file":"useEntityKey.js","sources":["../../../src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '../BindingError'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;"}
|
|
@@ -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;"}
|