@contember/binding 1.0.0-rc.9 → 1.0.3
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 +0 -1
- package/dist/development/BindingError.js.map +1 -1
- package/dist/development/accessorPropagation/AccessorProvider.js +3 -5
- package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.js +2 -4
- package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsProvider.js +2 -4
- package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyContext.js +1 -3
- package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyProvider.js +2 -4
- package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +2 -4
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdContext.js +1 -3
- package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdProvider.js +2 -4
- package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +2 -4
- package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/development/accessorPropagation/useBindingOperations.js +2 -4
- package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +3 -5
- package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +3 -5
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +3 -5
- package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/development/accessorPropagation/useEntity.js +7 -9
- package/dist/development/accessorPropagation/useEntity.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityKey.js +3 -5
- package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityList.js +7 -9
- package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTree.js +4 -6
- package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +2 -4
- package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTree.js +4 -6
- package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +2 -4
- package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/development/accessorPropagation/useEnvironment.js +2 -4
- package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/development/accessorPropagation/useField.js +7 -9
- package/dist/development/accessorPropagation/useField.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityByKey.js +1 -3
- package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js +4 -6
- package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetEntitySubTree.js +4 -6
- package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useGetTreeFilters.js +1 -3
- package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/development/accessorPropagation/useHasEntity.js +2 -4
- package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/development/accessorPropagation/usePersist.js +1 -3
- package/dist/development/accessorPropagation/usePersist.js.map +1 -1
- package/dist/development/accessorPropagation/useTreeRootId.js +2 -4
- package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -11
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/addEntityAtIndex.js +2 -4
- package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/development/accessorSorting/errors.js +1 -3
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorSorting/moveEntity.js +1 -3
- package/dist/development/accessorSorting/moveEntity.js.map +1 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js +0 -1
- package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/development/accessorSorting/sortEntities.js +0 -1
- package/dist/development/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/accessorSorting/useSortedEntities.js +6 -8
- package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +4 -6
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/DirtinessContext.js +1 -3
- package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/development/accessorTree/MutationStateContext.js +1 -3
- package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js +0 -1
- package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +22 -17
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js +0 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/development/accessorTree/metadataToRequestError.js +0 -1
- package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js +5 -7
- package/dist/development/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/accessorTree/useDirtinessState.js +2 -4
- package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/development/accessorTree/useMutationState.js +2 -4
- package/dist/development/accessorTree/useMutationState.js.map +1 -1
- package/dist/development/accessors/EntityAccessor.js +5 -7
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/accessors/EntityListAccessor.js +1 -3
- package/dist/development/accessors/EntityListAccessor.js.map +1 -1
- package/dist/development/accessors/ErrorAccessor.js +0 -1
- package/dist/development/accessors/ErrorAccessor.js.map +1 -1
- package/dist/development/accessors/FieldAccessor.js +3 -5
- package/dist/development/accessors/FieldAccessor.js.map +1 -1
- package/dist/development/accessors/TreeRootAccessor.js +0 -1
- package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/development/bindingTypes.js +0 -1
- package/dist/development/bindingTypes.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +15 -11
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/Config.js +18 -12
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.js +71 -51
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/DirtinessTracker.js +10 -3
- package/dist/development/core/DirtinessTracker.js.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.js +3 -5
- package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/development/core/EventManager.js +20 -16
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/IncrementalMarkerBuilder.js +14 -8
- package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/development/core/MarkerComparator.js +6 -8
- package/dist/development/core/MarkerComparator.js.map +1 -1
- package/dist/development/core/MarkerMerger.js +17 -15
- package/dist/development/core/MarkerMerger.js.map +1 -1
- package/dist/development/core/MarkerTreeGenerator.js +18 -13
- package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +13 -15
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/QueryGenerator.js +9 -11
- package/dist/development/core/QueryGenerator.js.map +1 -1
- package/dist/development/core/RealmKeyGenerator.js +10 -6
- package/dist/development/core/RealmKeyGenerator.js.map +1 -1
- package/dist/development/core/RequestResponseNormalizer.js +7 -9
- package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/development/core/StateInitializer.js +28 -26
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js +6 -8
- package/dist/development/core/TreeAugmenter.js.map +1 -1
- package/dist/development/core/TreeFilterGenerator.js +8 -8
- package/dist/development/core/TreeFilterGenerator.js.map +1 -1
- package/dist/development/core/TreeParameterMerger.js +2 -4
- package/dist/development/core/TreeParameterMerger.js.map +1 -1
- package/dist/development/core/TreeStore.js +19 -15
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/VariableInputTransformer.js +2 -4
- package/dist/development/core/VariableInputTransformer.js.map +1 -1
- package/dist/development/core/exceptions/ErrorLocator.js +10 -6
- package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/development/core/exceptions/LocalizedBindingError.js +1 -3
- package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/development/core/exceptions/MarkerSugarer.js +7 -9
- package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js +0 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js +1 -3
- package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.js +13 -14
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/FieldOperations.js +10 -12
- package/dist/development/core/operations/FieldOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +12 -14
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.js +4 -6
- package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js +2 -4
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/core/requestAliases/mutationOperationSubTreeType.js +0 -1
- package/dist/development/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
- package/dist/development/core/requestAliases/mutationOperationType.js +0 -1
- package/dist/development/core/requestAliases/mutationOperationType.js.map +1 -1
- package/dist/development/core/schema/Schema.js +0 -1
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/core/schema/SchemaLoader.js +9 -5
- package/dist/development/core/schema/SchemaLoader.js.map +1 -1
- package/dist/development/core/schema/SchemaPreprocessor.js +0 -1
- package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/development/core/schema/SchemaValidator.js +9 -11
- package/dist/development/core/schema/SchemaValidator.js.map +1 -1
- package/dist/development/core/state/StateIterator.js +2 -4
- package/dist/development/core/state/StateIterator.js.map +1 -1
- package/dist/development/core/state/getEntityMarker.js +0 -1
- package/dist/development/core/state/getEntityMarker.js.map +1 -1
- package/dist/development/core/utils/getCombinedSignal.js +0 -1
- package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/development/coreComponents/Component.js +2 -4
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/DataBindingProvider.js +3 -5
- package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/coreComponents/Entity.js +3 -5
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.js +3 -5
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +12 -14
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +14 -16
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.js +5 -7
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.js +8 -10
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.js +8 -10
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +3 -5
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/dao/Environment.js +7 -2
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/VariableFieldValue.js +0 -1
- package/dist/development/dao/VariableFieldValue.js.map +1 -1
- package/dist/development/entityEvents/useDerivedField.js +4 -6
- package/dist/development/entityEvents/useDerivedField.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforePersist.js +1 -3
- package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/development/entityEvents/useEntityBeforeUpdate.js +1 -3
- package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/development/entityEvents/useEntityEvent.js +3 -5
- package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistError.js +1 -3
- package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/development/entityEvents/useEntityPersistSuccess.js +1 -3
- package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/development/entityEvents/useOnConnectionUpdate.js +1 -3
- package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js +8 -4
- package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +1 -3
- package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +2 -4
- package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +9 -11
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/EntityView.js +2 -4
- package/dist/development/helperComponents/EntityView.js.map +1 -1
- package/dist/development/helperComponents/FieldView.js +7 -9
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +2 -4
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +3 -5
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/index.js +101 -101
- package/dist/development/index.js.map +1 -1
- package/dist/development/markers/EntityFieldMarkersContainer.js +5 -7
- package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +0 -1
- package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js +8 -4
- package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js +8 -4
- package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/development/markers/FieldMarker.js +8 -4
- package/dist/development/markers/FieldMarker.js.map +1 -1
- package/dist/development/markers/HasManyRelationMarker.js +9 -5
- package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/development/markers/HasOneRelationMarker.js +8 -4
- package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/development/markers/MarkerTreeRoot.js +0 -1
- package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/development/markers/ParentEntityMarker.js +0 -1
- package/dist/development/markers/ParentEntityMarker.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js +1 -3
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/queryLanguage/CacheStore.js +10 -4
- package/dist/development/queryLanguage/CacheStore.js.map +1 -1
- package/dist/development/queryLanguage/MarkerFactory.js +11 -13
- package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js +561 -548
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +32 -27
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguageError.js +0 -1
- package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/development/queryLanguage/tokenList.js +6 -3
- package/dist/development/queryLanguage/tokenList.js.map +1 -1
- package/dist/development/structures/BijectiveIndexedMap.js +14 -9
- package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/development/structures/LRUCache.js +7 -2
- package/dist/development/structures/LRUCache.js.map +1 -1
- package/dist/development/structures/WeakIdCache.js +11 -4
- package/dist/development/structures/WeakIdCache.js.map +1 -1
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +1 -3
- package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/development/treeParameters/EntityCreationParameters.js +0 -1
- package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/development/treeParameters/EntityListPreferences.js +0 -1
- package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/development/treeParameters/EventListenersStore.js +0 -1
- package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/development/treeParameters/LeafField.js +0 -1
- package/dist/development/treeParameters/LeafField.js.map +1 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js +0 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/development/treeParameters/Relation.js +0 -1
- package/dist/development/treeParameters/Relation.js.map +1 -1
- package/dist/development/utils/Hashing.js +0 -1
- package/dist/development/utils/Hashing.js.map +1 -1
- package/dist/development/utils/assert.js +1 -3
- package/dist/development/utils/assert.js.map +1 -1
- package/dist/development/utils/assertNever.js +2 -4
- package/dist/development/utils/assertNever.js.map +1 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +0 -1
- package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/development/utils/isEmptyObject.js +0 -1
- package/dist/development/utils/isEmptyObject.js.map +1 -1
- package/dist/development/utils/ucfirst.js +0 -1
- package/dist/development/utils/ucfirst.js.map +1 -1
- package/dist/production/BindingError.js.map +1 -1
- package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/production/accessorPropagation/useEntity.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
- package/dist/production/accessorPropagation/useField.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
- package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/production/accessorPropagation/usePersist.js.map +1 -1
- package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorSorting/moveEntity.js.map +1 -1
- package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/production/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
- package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
- package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/production/accessorTree/useMutationState.js.map +1 -1
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js.map +1 -1
- package/dist/production/accessors/ErrorAccessor.js.map +1 -1
- package/dist/production/accessors/FieldAccessor.js.map +1 -1
- package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
- package/dist/production/bindingTypes.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.js +18 -3
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/DirtinessTracker.js.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/production/core/MarkerComparator.js.map +1 -1
- package/dist/production/core/MarkerMerger.js.map +1 -1
- package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/QueryGenerator.js.map +1 -1
- package/dist/production/core/RealmKeyGenerator.js.map +1 -1
- package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/production/core/StateInitializer.js +1 -3
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js.map +1 -1
- package/dist/production/core/TreeFilterGenerator.js.map +1 -1
- package/dist/production/core/TreeParameterMerger.js.map +1 -1
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/VariableInputTransformer.js.map +1 -1
- package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
- package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/FieldOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
- package/dist/production/core/requestAliases/mutationOperationType.js.map +1 -1
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/core/schema/SchemaLoader.js.map +1 -1
- package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/production/core/state/StateIterator.js.map +1 -1
- package/dist/production/core/state/getEntityMarker.js.map +1 -1
- package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/coreComponents/Entity.js.map +1 -1
- package/dist/production/coreComponents/EntityList.js.map +1 -1
- package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/coreComponents/Field.js.map +1 -1
- package/dist/production/coreComponents/HasMany.js.map +1 -1
- package/dist/production/coreComponents/HasOne.js.map +1 -1
- package/dist/production/coreComponents/ParentEntity.js.map +1 -1
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/VariableFieldValue.js.map +1 -1
- package/dist/production/entityEvents/useDerivedField.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
- package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
- package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
- package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
- package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/helperComponents/EntityView.js.map +1 -1
- package/dist/production/helperComponents/FieldView.js.map +1 -1
- package/dist/production/helperComponents/StaticRender.js.map +1 -1
- package/dist/production/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/index.js +1 -1
- package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
- package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/production/markers/FieldMarker.js.map +1 -1
- package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
- package/dist/production/markers/ParentEntityMarker.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/queryLanguage/CacheStore.js.map +1 -1
- package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js +9 -1
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
- package/dist/production/queryLanguage/tokenList.js +5 -0
- package/dist/production/queryLanguage/tokenList.js.map +1 -1
- package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/production/structures/LRUCache.js.map +1 -1
- package/dist/production/structures/WeakIdCache.js.map +1 -1
- package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
- package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/production/treeParameters/LeafField.js.map +1 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/production/treeParameters/Relation.js.map +1 -1
- package/dist/production/utils/Hashing.js.map +1 -1
- package/dist/production/utils/assert.js.map +1 -1
- package/dist/production/utils/assertNever.js +1 -1
- package/dist/production/utils/assertNever.js.map +1 -1
- package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
- package/dist/production/utils/isEmptyObject.js.map +1 -1
- package/dist/production/utils/ucfirst.js.map +1 -1
- package/dist/types/accessorTree/MutationRequestResponse.d.ts +4 -0
- package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/QueryRequestResponse.d.ts +4 -0
- package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/RequestError.d.ts +9 -1
- package/dist/types/accessorTree/RequestError.d.ts.map +1 -1
- package/dist/types/core/DataBinding.d.ts +1 -0
- package/dist/types/core/DataBinding.d.ts.map +1 -1
- package/dist/types/core/StateInitializer.d.ts.map +1 -1
- package/dist/types/queryLanguage/Parser.d.ts +1 -0
- package/dist/types/queryLanguage/Parser.d.ts.map +1 -1
- package/dist/types/queryLanguage/tokenList.d.ts +1 -0
- package/dist/types/queryLanguage/tokenList.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/accessorTree/MutationRequestResponse.ts +1 -0
- package/src/accessorTree/QueryRequestResponse.ts +1 -0
- package/src/accessorTree/RequestError.ts +7 -1
- package/src/core/DataBinding.ts +22 -2
- package/src/core/StateInitializer.ts +1 -3
- package/src/queryLanguage/Parser.ts +12 -1
- package/src/queryLanguage/tokenList.ts +6 -0
- package/src/tsconfig.json +1 -1
- package/src/utils/assertNever.ts +1 -1
|
@@ -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'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst getAccessor = useCallback(() => getSubTree(parameters), [getSubTree, parameters])\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":";;;;
|
|
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'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst getAccessor = useCallback(() => getSubTree(parameters), [getSubTree, parameters])\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":";;;;AAOa,MAAA,uBAAuB,CACnC,wBACwB;AACxB,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,mBAAmB;AAC/D,QAAA,cAAc,YAAY,MAAM,WAAW,UAAU,GAAG,CAAC,YAAY,UAAU,CAAC;AAMtF,SAAO,8BAA8B,WAAW;AACjD;;"}
|
|
@@ -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":";;
|
|
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,wCACN,qBAC+E;AAC/E,4BAA0B,OAAO,mBAAmB;AAEhD,MAAA,OAAO,wBAAwB,UAAU;AACrC,WAAA;AAAA,EACR;AAIC,4BAAA,oBAAoB,YACpB,6DACD;AAIC,4BAAA,OAAO,oBAAoB,UAC3B,2DACD;AAEA,MAAI,oBAAoB,YAAY;AACnC,UAAM,YAAW,oBAAoB;AAEjC,QAAA,OAAO,cAAa,UAAU;AAEjC,aAAO,QACN,MAAO;AAAA,QACN,YAAY;AAAA,QACZ,UAAA;AAAA,MAAA,IAED,CAAC,SAAQ,CACV;AAAA,IACD;AAEA,WAAO,QACN,MAAO;AAAA,MACN,YAAY;AAAA,MACZ,UAAU,EAAE,YAAY,UAAS,WAAW;AAAA,IAE7C,IAAA,CAAC,UAAS,UAAU,CACrB;AAAA,EACD;AACA,QAAM,WAAW,oBAAoB;AAEjC,MAAA,OAAO,aAAa,UAAU;AAEjC,WAAO,QACN,MAAO;AAAA,MACN;AAAA,MACA,SAAS,oBAAoB;AAAA,MAC7B,QAAQ,oBAAoB;AAAA,MAC5B,OAAO,oBAAoB;AAAA,IAAA,IAE5B,CAAC,UAAU,oBAAoB,OAAO,oBAAoB,QAAQ,oBAAoB,OAAO,CAC9F;AAAA,EACD;AAEA,SAAO,QACN,MAAO;AAAA,IACN,UAAU;AAAA,MACT,YAAY,SAAS;AAAA,MACrB,QAAQ,SAAS;AAAA,IAClB;AAAA,IACA,SAAS,oBAAoB;AAAA,IAC7B,QAAQ,oBAAoB;AAAA,IAC5B,OAAO,oBAAoB;AAAA,EAAA,IAE5B;AAAA,IACC,SAAS;AAAA,IACT,SAAS;AAAA,IACT,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,EAAA,CAEtB;AACD;;"}
|
|
@@ -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'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst getAccessor = useCallback(() => getSubTree(parameters), [getSubTree, parameters])\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":";;;;
|
|
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'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst getAccessor = useCallback(() => getSubTree(parameters), [getSubTree, parameters])\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":";;;;AAOa,MAAA,mBAAmB,CAC/B,0BACoB;AACpB,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,qBAAqB;AAC7D,QAAA,cAAc,YAAY,MAAM,WAAW,UAAU,GAAG,CAAC,YAAY,UAAU,CAAC;AAKtF,SAAO,8BAA8B,WAAW;AACjD;;"}
|
|
@@ -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":";;
|
|
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,oCACN,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,UAAM,UAAS,sBAAsB;AAEjC,QAAA,OAAO,YAAW,UAAU;AAE/B,aAAO,QACN,MAAO;AAAA,QACN,YAAY;AAAA,QACZ,QAAQ;AAAA,MAAA,IAET,CAAC,OAAM,CACR;AAAA,IACD;AAEA,WAAO,QACN,MAAO;AAAA,MACN,YAAY;AAAA,MACZ,QAAQ,EAAE,YAAY,QAAO,WAAW;AAAA,IAEzC,IAAA,CAAC,QAAO,UAAU,CACnB;AAAA,EACD;AAEA,QAAM,SAAS,sBAAsB;AAEjC,MAAA,OAAO,WAAW,UAAU;AAE/B,WAAO,QAAQ,MAAO,GAAE,OAAmB,IAAA,CAAC,MAAM,CAAC;AAAA,EACpD;AAEA,SAAO,QACN,MAAO;AAAA,IACN,QAAQ;AAAA,MACP,YAAY,OAAO;AAAA,MACnB,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,IACf;AAAA,EAAA,IAED,CAAC,OAAO,YAAY,OAAO,QAAQ,OAAO,KAAK,CAChD;AACD;;"}
|
|
@@ -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":";;
|
|
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 +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,kBACC,4BACmC;
|
|
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,kBACC,4BACmC;AAC7B,QAAA,sBAAsB,gCAAgC,0BAA0B;AAErF,4BAAA,CAAC,CAAC,qBACF,yEACD;AAEA,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;AAGvB,+BAAA,oBAAoB,oBACpB,sDACD;AAEA,UAAM,CAAC,OAAO,eAAe,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":";
|
|
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 +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":";;;;
|
|
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;AAEnB,SAAO,YACN,CACC,sBACG,WACC,qBAAqB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,IAAI,WAAW,GACtG,CAAC,aAAa,sBAAsB,UAAU,CAC/C;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '../accessors'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAc;AACd,QAAA,mBAAmB,qBAAuB,EAAA;AAChD,QAAM,aAAa;AAEnB,SAAO,YACN,CACC,sBACG,WACC,iBAAiB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,IAAI,WAAW,GAClG,CAAC,aAAa,kBAAkB,UAAU,CAC3C;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTreeFilters.js","sources":["../../../src/accessorPropagation/useGetTreeFilters.ts"],"sourcesContent":["import type { TreeFilter } from '@contember/client'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetTreeFilters = (): (() => TreeFilter[]) => useBindingOperations().getTreeFilters\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"useGetTreeFilters.js","sources":["../../../src/accessorPropagation/useGetTreeFilters.ts"],"sourcesContent":["import type { TreeFilter } from '@contember/client'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const useGetTreeFilters = (): (() => TreeFilter[]) => useBindingOperations().getTreeFilters\n"],"names":[],"mappings":";AAGa,MAAA,oBAAoB,MAA4B,uBAAuB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHasEntity.js","sources":["../../../src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useHasEntity.js","sources":["../../../src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":[],"mappings":";;AAGO,MAAM,eAAe,MAAe;AACnC,SAAA,WAAW,gBAAgB,MAAM;AACzC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePersist.js","sources":["../../../src/accessorPropagation/usePersist.ts"],"sourcesContent":["import type { Persist } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const usePersist = (): Persist => useBindingOperations().persist\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"usePersist.js","sources":["../../../src/accessorPropagation/usePersist.ts"],"sourcesContent":["import type { Persist } from '../accessors'\nimport { useBindingOperations } from './useBindingOperations'\n\nexport const usePersist = (): Persist => useBindingOperations().persist\n"],"names":[],"mappings":";AAGa,MAAA,aAAa,MAAe,uBAAuB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeRootId.js","sources":["../../../src/accessorPropagation/useTreeRootId.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { TreeRootId } from '../treeParameters'\nimport { TreeRootIdContext } from './TreeRootIdContext'\n\nexport const useTreeRootId = (): TreeRootId | undefined => useContext(TreeRootIdContext)\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useTreeRootId.js","sources":["../../../src/accessorPropagation/useTreeRootId.ts"],"sourcesContent":["import { useContext } from 'react'\nimport type { TreeRootId } from '../treeParameters'\nimport { TreeRootIdContext } from './TreeRootIdContext'\n\nexport const useTreeRootId = (): TreeRootId | undefined => useContext(TreeRootIdContext)\n"],"names":[],"mappings":";;AAIa,MAAA,gBAAgB,MAA8B,WAAW,iBAAiB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetOrderFieldOnCreate.js","sources":["../../../src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { CrudQueryBuilder, Input } from '@contember/client'\nimport { GraphQlLiteral } from '@contember/client'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\t\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: new GraphQlLiteral(order),\n\t\t\t\t\t} as Input.OrderBy<CrudQueryBuilder.OrderDirection>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getRelativeSingleField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getRelativeSingleField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SetOrderFieldOnCreate.js","sources":["../../../src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { CrudQueryBuilder, Input } from '@contember/client'\nimport { GraphQlLiteral } from '@contember/client'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\t\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: new GraphQlLiteral(order),\n\t\t\t\t\t} as Input.OrderBy<CrudQueryBuilder.OrderDirection>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getRelativeSingleField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getRelativeSingleField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAsBa,MAAA,wBAAwB,UACpC,MAAM,MACN,CAAC,EAAE,YAAY,oBAAoB,UAAU,gBAAgB;AAC5D,QAAM,sBAAsB,cAAc,2BAA2B,YAAY,WAAW;AACtF,QAAA,aAAa,CAAC,UAA0C;AAAA,IAC7D,oBAAoB,mBAClB,IAAI,CAAY,aAAA,SAAS,KAAK,EAC9B,YACA,CAAC,aAAa,iBAAkB;AAAA,OAC9B,eAAe;AAAA,IAAA,IAEjB;AAAA,OACE,oBAAoB,QAAQ,IAAI,eAAe,KAAK;AAAA,IAAA,CAEvD;AAAA,EAAA;AAGF,MAAI,uBAAuB,QAAW;AACrC,UAAM,MAAkC;AAAA,MACvC,UAAU;AAAA,MACV,kBAAkB;AAAA,MAClB,OAAO;AAAA,MACP,SAAS,WAAW,MAAM;AAAA,IAAA;AAE3B,yDAEGA,8BAAA,eAAA;AAAA,MACA;AAAA,MACA,YAAU;AAAA,MACV,iBAAiB,CAAC,aAAa,sBAAsB;AAC9C,cAAA,cAAc,kBAAkB,qBAAqB,GAAG;AACxD,cAAA,WAAW,MAAM,KAAK,WAAW;AACjC,cAAA,sBAAqB,CAAC,SAAS,SAClC,IACU,UAAA,GAAG,uBAA+B,mBAAmB,EAAE,SAAS,KAAK;AAClF,oBAAA,EAAc,uBAA+B,mBAAmB,EAAE,YAAY,mBAAkB;AAAA,MACjG;AAAA,IAAA,GAECA,8BAAA,cAAA;AAAA,MAAa,OAAO;AAAA,IAAA,CAAY,CAClC,GACCA,8BAAA,mBAAA;AAAA,SAAsB;AAAA,IAAA,GACrBA,8BAAA,cAAA;AAAA,MAAa,OAAO;AAAA,IAAY,CAAA,CAClC,CACD;AAAA,EAEF;AACA,uDAEGA,8BAAA,OAAA;AAAA,IAAM,OAAO;AAAA,IAAqB,cAAc;AAAA,IAAoB,cAAY;AAAA,EAAA,CAAC,GACjFA,8BAAA,mBAAA;AAAA,IACA,UAAU;AAAA,IACV,kBAAiB;AAAA,IACjB,SAAS,WAAW,KAAK;AAAA,IACzB,iBAAiB,CAAC,aAAa,sBAAsB;AAGpD,UAAI,eAAmC;AACvC,uBAAiB,YAAY,GAAG,qBAAqB,oBAAoB,CAAgB,iBAAA;AACxF,uBAAe,aAAe,EAAA;AAAA,MAAA,CAC9B;AACD,sBAAgB,kBAAkB,eAAe,YAAY,EAAE,aAAa;AAAA,IAC7E;AAAA,EAAA,GAECA,8BAAA,cAAA;AAAA,IAAa,OAAO;AAAA,EAAY,CAAA,CAClC,CACD;AAEF,GACA,uBACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addEntityAtIndex.js","sources":["../../../src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getRelativeSingleField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"addEntityAtIndex.js","sources":["../../../src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getRelativeSingleField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":[],"mappings":";;AAKO,MAAM,mBAAmB,CAC/B,YACA,iBACA,OACA,eACI;AACJ,QAAM,iBAAiB,aAAa,MAAM,KAAK,UAAU,GAAG,eAAe;AAEhE,aAAA,gBAAgB,CAAC,eAAe,YAAY;AACtD,QAAI,aAAa;AAEX,UAAA,gBAAgB,WAAW,uBAA+B,eAAe;AAE/E,kBAAc,YAAY,KAAK;AAC/B,iBAAa,cAAc;AAEZ,mBAAA,OAAO,OAAO,GAAG,UAAU;AAC1C,wBAAoB,iBAAiB,cAAc;AAEnD,iBAAa,eAAe,OAAO;AAAA,EAAA,CACnC;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { EntityListAccessor } from '../accessors'\nimport { BindingError } from '../BindingError'\nimport type { FieldName } from '../treeParameters'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n\nexport const throwNonWritableError = (target: FieldName | EntityListAccessor) => {\n\tif (target instanceof EntityListAccessor) {\n\t\tthrow new BindingError(`Trying to add a new entity to a list that is not writable.`)\n\t}\n\tthrow new BindingError(`Trying to interactively sort by the '${target}' field but it is not writable.`)\n}\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { EntityListAccessor } from '../accessors'\nimport { BindingError } from '../BindingError'\nimport type { FieldName } from '../treeParameters'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n\nexport const throwNonWritableError = (target: FieldName | EntityListAccessor) => {\n\tif (target instanceof EntityListAccessor) {\n\t\tthrow new BindingError(`Trying to add a new entity to a list that is not writable.`)\n\t}\n\tthrow new BindingError(`Trying to interactively sort by the '${target}' field but it is not writable.`)\n}\n"],"names":[],"mappings":";AAKa,MAAA,iBAAiB,CAAC,iBAAuC;AAC/D,QAAA,IAAI,aACT,kBAAkB,+GAEnB;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveEntity.js","sources":["../../../src/accessorSorting/moveEntity.ts"],"sourcesContent":["import type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { sortEntities } from './sortEntities'\n\nexport const moveEntity = (\n\tentityList: EntityListAccessor,\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n) => {\n\tmoveEntityInArray(Array.from(entityList), entityList.getAccessor, sortByField, oldIndex, newIndex)\n}\n\nexport const moveEntityInArray = (\n\tentities: EntityAccessor[],\n\tgetAccessor: EntityListAccessor.GetEntityListAccessor,\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n): EntityAccessor[] => {\n\tconst sorted = sortEntities(entities, sortByField)\n\tconst order = computeEntityOrder(sorted, sortByField, oldIndex, newIndex)\n\n\tgetAccessor().batchUpdates((getAccessor, { getEntityByKey }) => {\n\t\tfor (const [entityKey, newOrderValue] of order) {\n\t\t\tconst targetEntity = getEntityByKey(entityKey)\n\t\t\tconst orderField = targetEntity.getRelativeSingleField<number>(sortByField)\n\n\t\t\torderField.updateValue(newOrderValue)\n\t\t}\n\t})\n\treturn sorted\n}\n\ntype EntityOrder = Map<string, number>\n\nconst computeEntityOrder = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n): EntityOrder => {\n\tconst order: EntityOrder = new Map()\n\n\tfor (let i = 0, len = entities.length; i < len; i++) {\n\t\tconst entity = entities[i]\n\t\tconst orderField = entity.getRelativeSingleField<number>(sortByField)\n\n\t\tlet targetValue\n\n\t\tif (i === oldIndex) {\n\t\t\ttargetValue = newIndex\n\t\t} else if (newIndex > oldIndex && oldIndex < i && i <= newIndex) {\n\t\t\ttargetValue = i - 1\n\t\t} else if (newIndex < oldIndex && newIndex <= i && i < oldIndex) {\n\t\t\ttargetValue = i + 1\n\t\t} else {\n\t\t\ttargetValue = i\n\t\t}\n\n\t\tif (typeof orderField.value !== 'number' || orderField.value !== targetValue) {\n\t\t\torder.set(entity.key, targetValue)\n\t\t}\n\t}\n\treturn order\n}\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"moveEntity.js","sources":["../../../src/accessorSorting/moveEntity.ts"],"sourcesContent":["import type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { sortEntities } from './sortEntities'\n\nexport const moveEntity = (\n\tentityList: EntityListAccessor,\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n) => {\n\tmoveEntityInArray(Array.from(entityList), entityList.getAccessor, sortByField, oldIndex, newIndex)\n}\n\nexport const moveEntityInArray = (\n\tentities: EntityAccessor[],\n\tgetAccessor: EntityListAccessor.GetEntityListAccessor,\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n): EntityAccessor[] => {\n\tconst sorted = sortEntities(entities, sortByField)\n\tconst order = computeEntityOrder(sorted, sortByField, oldIndex, newIndex)\n\n\tgetAccessor().batchUpdates((getAccessor, { getEntityByKey }) => {\n\t\tfor (const [entityKey, newOrderValue] of order) {\n\t\t\tconst targetEntity = getEntityByKey(entityKey)\n\t\t\tconst orderField = targetEntity.getRelativeSingleField<number>(sortByField)\n\n\t\t\torderField.updateValue(newOrderValue)\n\t\t}\n\t})\n\treturn sorted\n}\n\ntype EntityOrder = Map<string, number>\n\nconst computeEntityOrder = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField,\n\toldIndex: number,\n\tnewIndex: number,\n): EntityOrder => {\n\tconst order: EntityOrder = new Map()\n\n\tfor (let i = 0, len = entities.length; i < len; i++) {\n\t\tconst entity = entities[i]\n\t\tconst orderField = entity.getRelativeSingleField<number>(sortByField)\n\n\t\tlet targetValue\n\n\t\tif (i === oldIndex) {\n\t\t\ttargetValue = newIndex\n\t\t} else if (newIndex > oldIndex && oldIndex < i && i <= newIndex) {\n\t\t\ttargetValue = i - 1\n\t\t} else if (newIndex < oldIndex && newIndex <= i && i < oldIndex) {\n\t\t\ttargetValue = i + 1\n\t\t} else {\n\t\t\ttargetValue = i\n\t\t}\n\n\t\tif (typeof orderField.value !== 'number' || orderField.value !== targetValue) {\n\t\t\torder.set(entity.key, targetValue)\n\t\t}\n\t}\n\treturn order\n}\n"],"names":[],"mappings":";AAIO,MAAM,aAAa,CACzB,YACA,aACA,UACA,aACI;AACc,oBAAA,MAAM,KAAK,UAAU,GAAG,WAAW,aAAa,aAAa,UAAU,QAAQ;AAClG;AAEO,MAAM,oBAAoB,CAChC,UACA,aACA,aACA,UACA,aACsB;AAChB,QAAA,SAAS,aAAa,UAAU,WAAW;AACjD,QAAM,QAAQ,mBAAmB,QAAQ,aAAa,UAAU,QAAQ;AAExE,cAAc,EAAA,aAAa,CAAC,cAAa,EAAE,qBAAqB;AACpD,eAAA,CAAC,WAAW,kBAAkB,OAAO;AACzC,YAAA,eAAe,eAAe,SAAS;AACvC,YAAA,aAAa,aAAa,uBAA+B,WAAW;AAE1E,iBAAW,YAAY,aAAa;AAAA,IACrC;AAAA,EAAA,CACA;AACM,SAAA;AACR;AAIA,MAAM,qBAAqB,CAC1B,UACA,aACA,UACA,aACiB;AACX,QAAA,4BAAyB;AAE/B,WAAS,IAAI,GAAG,MAAM,SAAS,QAAQ,IAAI,KAAK,KAAK;AACpD,UAAM,SAAS,SAAS;AAClB,UAAA,aAAa,OAAO,uBAA+B,WAAW;AAEhE,QAAA;AAEJ,QAAI,MAAM,UAAU;AACL,oBAAA;AAAA,IAAA,WACJ,WAAW,YAAY,WAAW,KAAK,KAAK,UAAU;AAChE,oBAAc,IAAI;AAAA,IAAA,WACR,WAAW,YAAY,YAAY,KAAK,IAAI,UAAU;AAChE,oBAAc,IAAI;AAAA,IAAA,OACZ;AACQ,oBAAA;AAAA,IACf;AAEA,QAAI,OAAO,WAAW,UAAU,YAAY,WAAW,UAAU,aAAa;AACvE,YAAA,IAAI,OAAO,KAAK,WAAW;AAAA,IAClC;AAAA,EACD;AACO,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repairEntitiesOrder.js","sources":["../../../src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getRelativeSingleField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repairEntitiesOrder.js","sources":["../../../src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getRelativeSingleField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAGa,MAAA,sBAAsB,CAAC,iBAAsC,mBAAqC;AAC9G,WAAS,IAAI,GAAG,MAAM,eAAe,QAAQ,IAAI,KAAK,KAAK;AAC1D,UAAM,SAAS,eAAe;AACxB,UAAA,aAAa,OAAO,uBAAuB,eAAe;AAE5D,QAAA,WAAW,UAAU,GAAG;AAG3B,iBAAW,YAAY,CAAC;AAAA,IACzB;AAAA,EACD;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\tif (typeof aField.value === 'number' && typeof bField.value === 'number') {\n\t\t\treturn aField.value - bField.value\n\t\t}\n\t\treturn 0\n\t})\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport type { RelativeSingleField } from '../treeParameters'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\tif (typeof aField.value === 'number' && typeof bField.value === 'number') {\n\t\t\treturn aField.value - bField.value\n\t\t}\n\t\treturn 0\n\t})\n}\n"],"names":[],"mappings":"AAGa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,QAAI,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,UAAU;AAClE,aAAA,OAAO,QAAQ,OAAO;AAAA,IAC9B;AACO,WAAA;AAAA,EAAA,CACP;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSortedEntities.js","sources":["../../../src/accessorSorting/useSortedEntities.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useDesugaredRelativeSingleField } from '../accessorPropagation'\nimport type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { SugaredFieldProps } from '../helperComponents'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { addEntityAtIndex } from './addEntityAtIndex'\nimport { throwNoopError } from './errors'\nimport { moveEntity } from './moveEntity'\nimport type { SortedEntities } from './SortedEntities'\nimport { sortEntities } from './sortEntities'\n\nconst addNewAtIndexImplementation = (\n\tcallbackName: keyof SortedEntities,\n\tentityList: EntityListAccessor,\n\tdesugaredSortableByField: RelativeSingleField | undefined,\n\tsortedEntitiesCount: number,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tif (!desugaredSortableByField) {\n\t\tif (index === sortedEntitiesCount) {\n\t\t\treturn entityList.createNewEntity(preprocess)\n\t\t}\n\t\treturn throwNoopError(callbackName)\n\t}\n\taddEntityAtIndex(entityList, desugaredSortableByField, index, preprocess)\n}\n\nexport const useSortedEntities = (\n\tentityList: EntityListAccessor,\n\tsortableByField: SugaredFieldProps['field'] | undefined,\n): SortedEntities => {\n\tconst desugaredSortableByField = useDesugaredRelativeSingleField(sortableByField)\n\tconst sortedEntities = useMemo(() => {\n\t\treturn sortEntities(Array.from(entityList), desugaredSortableByField)\n\t}, [desugaredSortableByField, entityList])\n\n\tconst addNewAtIndex = useCallback<SortedEntities['addNewAtIndex']>(\n\t\t(index: number, preprocess?: EntityAccessor.BatchUpdatesHandler) => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'addNewAtIndex',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tindex,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst prependNew = useCallback<SortedEntities['prependNew']>(\n\t\tpreprocess => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'prependNew',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\t0,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst appendNew = useCallback<SortedEntities['appendNew']>(\n\t\tpreprocess => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'appendNew',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst normalizedMoveEntity = useCallback<SortedEntities['moveEntity']>(\n\t\t(oldIndex, newIndex) => {\n\t\t\tif (!desugaredSortableByField) {\n\t\t\t\treturn throwNoopError('moveEntity')\n\t\t\t}\n\t\t\tmoveEntity(entityList, desugaredSortableByField, oldIndex, newIndex)\n\t\t},\n\t\t[desugaredSortableByField, entityList],\n\t)\n\n\t// This wasn't such a great idea…\n\t// useEffect(() => {\n\t// \tif (!desugaredSortableByField) {\n\t// \t\treturn\n\t// \t}\n\t// \trepairEntitiesOrder(desugaredSortableByField, entityList, sortedEntities)\n\t// }, [desugaredSortableByField, entityList, sortedEntities])\n\n\treturn useMemo<SortedEntities>(\n\t\t() => ({\n\t\t\tentities: sortedEntities,\n\t\t\taddNewAtIndex,\n\t\t\tappendNew,\n\t\t\tprependNew,\n\t\t\tmoveEntity: normalizedMoveEntity,\n\t\t}),\n\t\t[sortedEntities, addNewAtIndex, appendNew, prependNew, normalizedMoveEntity],\n\t)\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,8BAA8B,CACnC,cACA,YACA,0BACA,qBACA,OACA,eACI;
|
|
1
|
+
{"version":3,"file":"useSortedEntities.js","sources":["../../../src/accessorSorting/useSortedEntities.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useDesugaredRelativeSingleField } from '../accessorPropagation'\nimport type { EntityAccessor, EntityListAccessor } from '../accessors'\nimport type { SugaredFieldProps } from '../helperComponents'\nimport type { RelativeSingleField } from '../treeParameters'\nimport { addEntityAtIndex } from './addEntityAtIndex'\nimport { throwNoopError } from './errors'\nimport { moveEntity } from './moveEntity'\nimport type { SortedEntities } from './SortedEntities'\nimport { sortEntities } from './sortEntities'\n\nconst addNewAtIndexImplementation = (\n\tcallbackName: keyof SortedEntities,\n\tentityList: EntityListAccessor,\n\tdesugaredSortableByField: RelativeSingleField | undefined,\n\tsortedEntitiesCount: number,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tif (!desugaredSortableByField) {\n\t\tif (index === sortedEntitiesCount) {\n\t\t\treturn entityList.createNewEntity(preprocess)\n\t\t}\n\t\treturn throwNoopError(callbackName)\n\t}\n\taddEntityAtIndex(entityList, desugaredSortableByField, index, preprocess)\n}\n\nexport const useSortedEntities = (\n\tentityList: EntityListAccessor,\n\tsortableByField: SugaredFieldProps['field'] | undefined,\n): SortedEntities => {\n\tconst desugaredSortableByField = useDesugaredRelativeSingleField(sortableByField)\n\tconst sortedEntities = useMemo(() => {\n\t\treturn sortEntities(Array.from(entityList), desugaredSortableByField)\n\t}, [desugaredSortableByField, entityList])\n\n\tconst addNewAtIndex = useCallback<SortedEntities['addNewAtIndex']>(\n\t\t(index: number, preprocess?: EntityAccessor.BatchUpdatesHandler) => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'addNewAtIndex',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tindex,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst prependNew = useCallback<SortedEntities['prependNew']>(\n\t\tpreprocess => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'prependNew',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\t0,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst appendNew = useCallback<SortedEntities['appendNew']>(\n\t\tpreprocess => {\n\t\t\taddNewAtIndexImplementation(\n\t\t\t\t'appendNew',\n\t\t\t\tentityList,\n\t\t\t\tdesugaredSortableByField,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tsortedEntities.length,\n\t\t\t\tpreprocess,\n\t\t\t)\n\t\t},\n\t\t[desugaredSortableByField, entityList, sortedEntities.length],\n\t)\n\tconst normalizedMoveEntity = useCallback<SortedEntities['moveEntity']>(\n\t\t(oldIndex, newIndex) => {\n\t\t\tif (!desugaredSortableByField) {\n\t\t\t\treturn throwNoopError('moveEntity')\n\t\t\t}\n\t\t\tmoveEntity(entityList, desugaredSortableByField, oldIndex, newIndex)\n\t\t},\n\t\t[desugaredSortableByField, entityList],\n\t)\n\n\t// This wasn't such a great idea…\n\t// useEffect(() => {\n\t// \tif (!desugaredSortableByField) {\n\t// \t\treturn\n\t// \t}\n\t// \trepairEntitiesOrder(desugaredSortableByField, entityList, sortedEntities)\n\t// }, [desugaredSortableByField, entityList, sortedEntities])\n\n\treturn useMemo<SortedEntities>(\n\t\t() => ({\n\t\t\tentities: sortedEntities,\n\t\t\taddNewAtIndex,\n\t\t\tappendNew,\n\t\t\tprependNew,\n\t\t\tmoveEntity: normalizedMoveEntity,\n\t\t}),\n\t\t[sortedEntities, addNewAtIndex, appendNew, prependNew, normalizedMoveEntity],\n\t)\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,8BAA8B,CACnC,cACA,YACA,0BACA,qBACA,OACA,eACI;AACJ,MAAI,CAAC,0BAA0B;AAC9B,QAAI,UAAU,qBAAqB;AAC3B,aAAA,WAAW,gBAAgB,UAAU;AAAA,IAC7C;AACA,WAAO,eAAe,YAAY;AAAA,EACnC;AACiB,mBAAA,YAAY,0BAA0B,OAAO,UAAU;AACzE;AAEa,MAAA,oBAAoB,CAChC,YACA,oBACoB;AACd,QAAA,2BAA2B,gCAAgC,eAAe;AAC1E,QAAA,iBAAiB,QAAQ,MAAM;AACpC,WAAO,aAAa,MAAM,KAAK,UAAU,GAAG,wBAAwB;AAAA,EAAA,GAClE,CAAC,0BAA0B,UAAU,CAAC;AAEzC,QAAM,gBAAgB,YACrB,CAAC,OAAe,eAAoD;AACnE,gCACC,iBACA,YACA,0BACA,eAAe,QACf,OACA,UACD;AAAA,KAED,CAAC,0BAA0B,YAAY,eAAe,MAAM,CAC7D;AACM,QAAA,aAAa,YAClB,CAAc,eAAA;AACb,gCACC,cACA,YACA,0BACA,eAAe,QACf,GACA,UACD;AAAA,KAED,CAAC,0BAA0B,YAAY,eAAe,MAAM,CAC7D;AACM,QAAA,YAAY,YACjB,CAAc,eAAA;AACb,gCACC,aACA,YACA,0BACA,eAAe,QACf,eAAe,QACf,UACD;AAAA,KAED,CAAC,0BAA0B,YAAY,eAAe,MAAM,CAC7D;AACA,QAAM,uBAAuB,YAC5B,CAAC,UAAU,aAAa;AACvB,QAAI,CAAC,0BAA0B;AAC9B,aAAO,eAAe,YAAY;AAAA,IACnC;AACW,eAAA,YAAY,0BAA0B,UAAU,QAAQ;AAAA,EAAA,GAEpE,CAAC,0BAA0B,UAAU,CACtC;AAUA,SAAO,QACN,MAAO;AAAA,IACN,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EAAA,IAEb,CAAC,gBAAgB,eAAe,WAAW,YAAY,oBAAoB,CAC5E;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\nexport function AccessorTree({ state, children }: AccessorTreeProps) {\n\t// It is *CRUCIAL* that both branches differ only in props, not structurally. Otherwise there would be far too many\n\t// remounts.\n\tif (state.name === 'initialized') {\n\t\treturn (\n\t\t\t<DirtinessContext.Provider value={state.data.hasUnpersistedChanges}>\n\t\t\t\t<MutationStateContext.Provider value={state.data.isMutating}>\n\t\t\t\t\t<BindingOperationsProvider bindingOperations={state.data.bindingOperations}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t</MutationStateContext.Provider>\n\t\t\t</DirtinessContext.Provider>\n\t\t)\n\t}\n\treturn (\n\t\t<DirtinessContext.Provider value={false}>\n\t\t\t<MutationStateContext.Provider value={false}>\n\t\t\t\t<BindingOperationsProvider bindingOperations={undefined}>{children}</BindingOperationsProvider>\n\t\t\t</MutationStateContext.Provider>\n\t\t</DirtinessContext.Provider>\n\t)\n}\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\nexport function AccessorTree({ state, children }: AccessorTreeProps) {\n\t// It is *CRUCIAL* that both branches differ only in props, not structurally. Otherwise there would be far too many\n\t// remounts.\n\tif (state.name === 'initialized') {\n\t\treturn (\n\t\t\t<DirtinessContext.Provider value={state.data.hasUnpersistedChanges}>\n\t\t\t\t<MutationStateContext.Provider value={state.data.isMutating}>\n\t\t\t\t\t<BindingOperationsProvider bindingOperations={state.data.bindingOperations}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t</MutationStateContext.Provider>\n\t\t\t</DirtinessContext.Provider>\n\t\t)\n\t}\n\treturn (\n\t\t<DirtinessContext.Provider value={false}>\n\t\t\t<MutationStateContext.Provider value={false}>\n\t\t\t\t<BindingOperationsProvider bindingOperations={undefined}>{children}</BindingOperationsProvider>\n\t\t\t</MutationStateContext.Provider>\n\t\t</DirtinessContext.Provider>\n\t)\n}\nAccessorTree.displayName = 'AccessorTree'\n"],"names":["_jsx"],"mappings":";;;;AAW6B,sBAAA,EAAE,OAAO,YAA+B;AAGhE,MAAA,MAAM,SAAS,eAAe;AAEhC,WAAAA,8BAAC,iBAAiB,UAAjB;AAAA,MAA0B,OAAO,MAAM,KAAK;AAAA,IAAA,GAC5CA,8BAAC,qBAAqB,UAArB;AAAA,MAA8B,OAAO,MAAM,KAAK;AAAA,IAAA,GAC/CA,8BAAA,2BAAA;AAAA,MAA0B,mBAAmB,MAAM,KAAK;AAAA,IAAA,GACvD,QACF,CACD,CACD;AAAA,EAEF;AAEC,SAAAA,8BAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,EAAA,GACjCA,8BAAC,qBAAqB,UAArB;AAAA,IAA8B,OAAO;AAAA,EAAA,GACpCA,8BAAA,2BAAA;AAAA,IAA0B,mBAAmB;AAAA,EAAA,GAAY,QAAS,CACpE,CACD;AAEF;AACA,aAAa,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirtinessContext.js","sources":["../../../src/accessorTree/DirtinessContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const DirtinessContext = createContext<boolean>(false)\nDirtinessContext.displayName = 'DirtinessContext'\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DirtinessContext.js","sources":["../../../src/accessorTree/DirtinessContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const DirtinessContext = createContext<boolean>(false)\nDirtinessContext.displayName = 'DirtinessContext'\n"],"names":[],"mappings":";AAEa,MAAA,mBAAmB,cAAuB,KAAK;AAC5D,iBAAiB,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationStateContext.js","sources":["../../../src/accessorTree/MutationStateContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const MutationStateContext = createContext<boolean>(false)\nMutationStateContext.displayName = 'MutationStateContext'\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"MutationStateContext.js","sources":["../../../src/accessorTree/MutationStateContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const MutationStateContext = createContext<boolean>(false)\nMutationStateContext.displayName = 'MutationStateContext'\n"],"names":[],"mappings":";AAEa,MAAA,uBAAuB,cAAuB,KAAK;AAChE,qBAAqB,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NormalizedPersistedData.js","sources":["../../../src/accessorTree/NormalizedPersistedData.ts"],"sourcesContent":["import type { EntityId, PlaceholderName, Scalar } from '../treeParameters'\nimport type { ServerGeneratedUuid } from './RuntimeId'\n\n// HasMany relations are encoded as sets of entity ids.\n// HasOne relations are encoded as BoxedSingleEntityId just to make them different from actual strings.\n//\t\tNot sure whether that is a reasonable precaution or just pure overhead.\nexport type EntityFieldPersistedData = Scalar | ServerGeneratedUuid | EntityListPersistedData\n\nexport type SingleEntityPersistedData = Map<PlaceholderName, EntityFieldPersistedData>\n\nexport type EntityListPersistedData = Set<EntityId>\n\nexport type PersistedEntityDataStore = Map<EntityId, SingleEntityPersistedData>\n\n// The key is the subTree placeholder name\nexport type SubTreeDataStore = Map<PlaceholderName, ServerGeneratedUuid | EntityListPersistedData>\n\nexport class NormalizedPersistedData {\n\tpublic constructor(\n\t\tpublic readonly subTreeDataStore: SubTreeDataStore,\n\t\tpublic readonly persistedEntityDataStore: PersistedEntityDataStore,\n\t) {}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NormalizedPersistedData.js","sources":["../../../src/accessorTree/NormalizedPersistedData.ts"],"sourcesContent":["import type { EntityId, PlaceholderName, Scalar } from '../treeParameters'\nimport type { ServerGeneratedUuid } from './RuntimeId'\n\n// HasMany relations are encoded as sets of entity ids.\n// HasOne relations are encoded as BoxedSingleEntityId just to make them different from actual strings.\n//\t\tNot sure whether that is a reasonable precaution or just pure overhead.\nexport type EntityFieldPersistedData = Scalar | ServerGeneratedUuid | EntityListPersistedData\n\nexport type SingleEntityPersistedData = Map<PlaceholderName, EntityFieldPersistedData>\n\nexport type EntityListPersistedData = Set<EntityId>\n\nexport type PersistedEntityDataStore = Map<EntityId, SingleEntityPersistedData>\n\n// The key is the subTree placeholder name\nexport type SubTreeDataStore = Map<PlaceholderName, ServerGeneratedUuid | EntityListPersistedData>\n\nexport class NormalizedPersistedData {\n\tpublic constructor(\n\t\tpublic readonly subTreeDataStore: SubTreeDataStore,\n\t\tpublic readonly persistedEntityDataStore: PersistedEntityDataStore,\n\t) {}\n}\n"],"names":[],"mappings":"AAiBO,MAAM,wBAAwB;AAAA,EAC7B,YACU,kBACA,0BACf;AAFe,SAAA,mBAAA;AACA,SAAA,2BAAA;AAAA,EACd;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeId.js","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: string\n}\n\nexport class ServerGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: string) {}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: string): boolean {\n\t\treturn UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n}\n\nexport type RuntimeId = ServerGeneratedUuid | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"RuntimeId.js","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: string\n}\n\nexport class ServerGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: string) {}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: string): boolean {\n\t\treturn UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n}\n\nexport type RuntimeId = ServerGeneratedUuid | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,oBAA6C;AAAA,EAIlD,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAAA,MAHxC,iBAAuB;AAC1B,WAAA;AAAA,EACR;AAED;AAEO,MAAM,oBAA6C;AAAA,EAIlD,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAAA,MAHxC,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAED;AAEO,wCAAwD;AAAA,EAWvD,cAAc;AAPL;AAQT,UAAA,iCAAiC,uCACtC,0BAAyB,aAC1B;AAGA,SAAK,QAAQ,oBAAoB,kCAAkC,0BAAyB,YAAY;AAAA,EACzG;AAAA,MAjBW,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAAA,SAmBc,eAAe,WAA4B;AACjD,WAAA,0BAAyB,aAAa,KAAK,SAAS;AAAA,EAC5D;AACD;AAzBO;AAMS,cANT,0BAMS,eAAqB,OAAA;AACnC,MAAI,OAAO;AACX,SAAO,MAAM;AAAA;AAYC,cApBT,0BAoBS,iBAAgB;AAChB,cArBT,0BAqBS,gBAAe,IAAI,OAAO,yBAAyB,0BAAyB,sBAAsB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessorTreeStateReducer.js","sources":["../../../src/accessorTree/accessorTreeStateReducer.ts"],"sourcesContent":["import type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateAction } from './AccessorTreeStateAction'\n\nexport const accessorTreeStateReducer = (\n\tpreviousState: AccessorTreeState,\n\taction: AccessorTreeStateAction,\n): AccessorTreeState => {\n\tswitch (action.type) {\n\t\tcase 'setData':\n\t\t\tif (previousState.name === 'error') {\n\t\t\t\treturn previousState\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tname: 'initialized',\n\t\t\t\tdata: action.data,\n\t\t\t}\n\t\tcase 'failWithError':\n\t\t\treturn {\n\t\t\t\tname: 'error',\n\t\t\t\terror: action.error,\n\t\t\t}\n\t\tcase 'reset':\n\t\t\treturn {\n\t\t\t\tname: 'initializing',\n\t\t\t}\n\t}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accessorTreeStateReducer.js","sources":["../../../src/accessorTree/accessorTreeStateReducer.ts"],"sourcesContent":["import type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateAction } from './AccessorTreeStateAction'\n\nexport const accessorTreeStateReducer = (\n\tpreviousState: AccessorTreeState,\n\taction: AccessorTreeStateAction,\n): AccessorTreeState => {\n\tswitch (action.type) {\n\t\tcase 'setData':\n\t\t\tif (previousState.name === 'error') {\n\t\t\t\treturn previousState\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tname: 'initialized',\n\t\t\t\tdata: action.data,\n\t\t\t}\n\t\tcase 'failWithError':\n\t\t\treturn {\n\t\t\t\tname: 'error',\n\t\t\t\terror: action.error,\n\t\t\t}\n\t\tcase 'reset':\n\t\t\treturn {\n\t\t\t\tname: 'initializing',\n\t\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAGa,MAAA,2BAA2B,CACvC,eACA,WACuB;AACvB,UAAQ,OAAO;AAAA,SACT;AACA,UAAA,cAAc,SAAS,SAAS;AAC5B,eAAA;AAAA,MACR;AACO,aAAA;AAAA,QACN,MAAM;AAAA,QACN,MAAM,OAAO;AAAA,MAAA;AAAA,SAEV;AACG,aAAA;AAAA,QACN,MAAM;AAAA,QACN,OAAO,OAAO;AAAA,MAAA;AAAA,SAEX;AACG,aAAA;AAAA,QACN,MAAM;AAAA,MAAA;AAAA;AAGV;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadataToRequestError.js","sources":["../../../src/accessorTree/metadataToRequestError.ts"],"sourcesContent":["import type { GraphQlClientFailedRequestMetadata } from '@contember/client'\nimport type { RequestError } from './RequestError'\n\nexport const metadataToRequestError = (metadata: GraphQlClientFailedRequestMetadata): RequestError => {\n\tif (metadata.status === 401) {\n\t\treturn {\n\t\t\ttype: 'unauthorized',\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'networkError',\n\t\tmetadata: metadata,\n\t}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadataToRequestError.js","sources":["../../../src/accessorTree/metadataToRequestError.ts"],"sourcesContent":["import type { GraphQlClientFailedRequestMetadata } from '@contember/client'\nimport type { RequestError } from './RequestError'\n\nexport const metadataToRequestError = (metadata: GraphQlClientFailedRequestMetadata): RequestError => {\n\tif (metadata.status === 401) {\n\t\treturn {\n\t\t\ttype: 'unauthorized',\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'networkError',\n\t\tmetadata: metadata,\n\t}\n}\n"],"names":[],"mappings":"AAGa,MAAA,yBAAyB,CAAC,aAA+D;AACjG,MAAA,SAAS,WAAW,KAAK;AACrB,WAAA;AAAA,MACN,MAAM;AAAA,IAAA;AAAA,EAER;AACO,SAAA;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EAAA;AAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.js","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '../accessors'\nimport { DataBinding } from '../core'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport type { RequestError } from './RequestError'\n\nconst initialState: AccessorTreeState = {\n\tname: 'initializing',\n}\n\nexport const useDataBinding = ({\n\tnodeTree,\n\trefreshOnEnvironmentChange = true,\n\trefreshOnPersist = false,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, initialState)\n\n\tconst isFirstRenderRef = useRef(true)\n\tconst isMountedRef = useRef(true)\n\n\tconst onUpdate = useCallback((accessor: TreeRootAccessor) => {\n\t\tif (!isMountedRef.current) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({\n\t\t\ttype: 'setData',\n\t\t\tdata: accessor,\n\t\t})\n\t}, [])\n\tconst onError = useCallback((error: RequestError) => {\n\t\tif (!isMountedRef.current) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({\n\t\t\ttype: 'failWithError',\n\t\t\terror,\n\t\t})\n\t}, [])\n\n\tconst createDataBinding = useCallback(\n\t\t() => {\n\t\t\tconst create = (): DataBinding => new DataBinding(contentClient, systemClient, tenantClient, environment, onUpdate, onError, () => {\n\t\t\t\tif (!isMountedRef.current || !refreshOnPersist) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdispatch({ type: 'reset' })\n\t\t\t\tsetDataBinding(create())\n\t\t\t})\n\t\t\treturn create()\n\t\t},\n\t\t[contentClient, systemClient, tenantClient, environment, onUpdate, onError, refreshOnPersist],\n\t)\n\n\tconst [dataBinding, setDataBinding] = useState(() => createDataBinding())\n\n\tuseEffect(() => {\n\t\tif (state.name !== 'initializing') {\n\t\t\t// Ideally, this condition shouldn't be necessary. However, people are nowhere near careful and diligent\n\t\t\t// enough to maintain the contract that a change in referential identity of the children passed to\n\t\t\t// DataBindingProvider will result in a new DataBinding instance (which typically involves a new query).\n\t\t\t// To make their lives a bit easier, we do this.\n\t\t\treturn\n\t\t}\n\t\tdataBinding.extendTree(nodeTree)\n\t}, [nodeTree, dataBinding, state.name])\n\n\tuseEffect(() => {\n\t\tif (isFirstRenderRef.current || !refreshOnEnvironmentChange) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({ type: 'reset' })\n\t\t// This essentially just reacts to new environments.\n\t\tsetDataBinding(createDataBinding())\n\t}, [createDataBinding, refreshOnEnvironmentChange])\n\n\tuseEffect(() => {\n\t\tisFirstRenderRef.current = false\n\n\t\treturn () => {\n\t\t\tisMountedRef.current = false\n\t\t}\n\t}, [])\n\n\treturn state\n}\n"],"names":[],"mappings":";;;;;AAcA,MAAM,eAAkC;AAAA,EACvC,MAAM;
|
|
1
|
+
{"version":3,"file":"useDataBinding.js","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '../accessors'\nimport { DataBinding } from '../core'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport type { RequestError } from './RequestError'\n\nconst initialState: AccessorTreeState = {\n\tname: 'initializing',\n}\n\nexport const useDataBinding = ({\n\tnodeTree,\n\trefreshOnEnvironmentChange = true,\n\trefreshOnPersist = false,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, initialState)\n\n\tconst isFirstRenderRef = useRef(true)\n\tconst isMountedRef = useRef(true)\n\n\tconst onUpdate = useCallback((accessor: TreeRootAccessor) => {\n\t\tif (!isMountedRef.current) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({\n\t\t\ttype: 'setData',\n\t\t\tdata: accessor,\n\t\t})\n\t}, [])\n\tconst onError = useCallback((error: RequestError) => {\n\t\tif (!isMountedRef.current) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({\n\t\t\ttype: 'failWithError',\n\t\t\terror,\n\t\t})\n\t}, [])\n\n\tconst createDataBinding = useCallback(\n\t\t() => {\n\t\t\tconst create = (): DataBinding => new DataBinding(contentClient, systemClient, tenantClient, environment, onUpdate, onError, () => {\n\t\t\t\tif (!isMountedRef.current || !refreshOnPersist) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdispatch({ type: 'reset' })\n\t\t\t\tsetDataBinding(create())\n\t\t\t})\n\t\t\treturn create()\n\t\t},\n\t\t[contentClient, systemClient, tenantClient, environment, onUpdate, onError, refreshOnPersist],\n\t)\n\n\tconst [dataBinding, setDataBinding] = useState(() => createDataBinding())\n\n\tuseEffect(() => {\n\t\tif (state.name !== 'initializing') {\n\t\t\t// Ideally, this condition shouldn't be necessary. However, people are nowhere near careful and diligent\n\t\t\t// enough to maintain the contract that a change in referential identity of the children passed to\n\t\t\t// DataBindingProvider will result in a new DataBinding instance (which typically involves a new query).\n\t\t\t// To make their lives a bit easier, we do this.\n\t\t\treturn\n\t\t}\n\t\tdataBinding.extendTree(nodeTree)\n\t}, [nodeTree, dataBinding, state.name])\n\n\tuseEffect(() => {\n\t\tif (isFirstRenderRef.current || !refreshOnEnvironmentChange) {\n\t\t\treturn\n\t\t}\n\t\tdispatch({ type: 'reset' })\n\t\t// This essentially just reacts to new environments.\n\t\tsetDataBinding(createDataBinding())\n\t}, [createDataBinding, refreshOnEnvironmentChange])\n\n\tuseEffect(() => {\n\t\tisFirstRenderRef.current = false\n\n\t\treturn () => {\n\t\t\tisMountedRef.current = false\n\t\t}\n\t}, [])\n\n\treturn state\n}\n"],"names":[],"mappings":";;;;;AAcA,MAAM,eAAkC;AAAA,EACvC,MAAM;AACP;AAEO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA,6BAA6B;AAAA,EAC7B,mBAAmB;AAAA,MAC+B;AAClD,QAAM,gBAAgB;AACtB,QAAM,eAAe;AACrB,QAAM,eAAe;AACrB,QAAM,cAAc;AAEpB,QAAM,CAAC,OAAO,YAAY,WAAW,0BAA0B,YAAY;AAErE,QAAA,mBAAmB,OAAO,IAAI;AAC9B,QAAA,eAAe,OAAO,IAAI;AAE1B,QAAA,WAAW,YAAY,CAAC,aAA+B;AACxD,QAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,IACD;AACS,aAAA;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,IAAA,CACN;AAAA,EACF,GAAG,CAAE,CAAA;AACC,QAAA,UAAU,YAAY,CAAC,UAAwB;AAChD,QAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,IACD;AACS,aAAA;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IAAA,CACA;AAAA,EACF,GAAG,CAAE,CAAA;AAEC,QAAA,oBAAoB,YACzB,MAAM;AACC,UAAA,SAAS,MAAmB,IAAI,YAAY,eAAe,cAAc,cAAc,aAAa,UAAU,SAAS,MAAM;AAClI,UAAI,CAAC,aAAa,WAAW,CAAC,kBAAkB;AAC/C;AAAA,MACD;AACS,eAAA,EAAE,MAAM,QAAA,CAAS;AAC1B,qBAAe,QAAQ;AAAA,IAAA,CACvB;AACD,WAAO,OAAO;AAAA,EAAA,GAEf,CAAC,eAAe,cAAc,cAAc,aAAa,UAAU,SAAS,gBAAgB,CAC7F;AAEA,QAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM,mBAAmB;AAExE,YAAU,MAAM;AACX,QAAA,MAAM,SAAS,gBAAgB;AAKlC;AAAA,IACD;AACA,gBAAY,WAAW,QAAQ;AAAA,KAC7B,CAAC,UAAU,aAAa,MAAM,IAAI,CAAC;AAEtC,YAAU,MAAM;AACX,QAAA,iBAAiB,WAAW,CAAC,4BAA4B;AAC5D;AAAA,IACD;AACS,aAAA,EAAE,MAAM,QAAA,CAAS;AAE1B,mBAAe,mBAAmB;AAAA,EAAA,GAChC,CAAC,mBAAmB,0BAA0B,CAAC;AAElD,YAAU,MAAM;AACf,qBAAiB,UAAU;AAE3B,WAAO,MAAM;AACZ,mBAAa,UAAU;AAAA,IAAA;AAAA,EAEzB,GAAG,CAAE,CAAA;AAEE,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDirtinessState.js","sources":["../../../src/accessorTree/useDirtinessState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { DirtinessContext } from './DirtinessContext'\n\nexport const useDirtinessState = () => useContext(DirtinessContext)\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useDirtinessState.js","sources":["../../../src/accessorTree/useDirtinessState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { DirtinessContext } from './DirtinessContext'\n\nexport const useDirtinessState = () => useContext(DirtinessContext)\n"],"names":[],"mappings":";;AAGa,MAAA,oBAAoB,MAAM,WAAW,gBAAgB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.js","sources":["../../../src/accessorTree/useMutationState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport const useMutationState = () => useContext(MutationStateContext)\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useMutationState.js","sources":["../../../src/accessorTree/useMutationState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport const useMutationState = () => useContext(MutationStateContext)\n"],"names":[],"mappings":";;AAGa,MAAA,mBAAmB,MAAM,WAAW,oBAAoB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityAccessor.js","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, ServerGeneratedUuid, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {}\n\n\tpublic get idOnServer(): string | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.stateKey, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.stateKey, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.stateKey)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\tpublic getKeyConnectedOnServer(entity: SugaredRelativeSingleEntity | string): string | null {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity(entity, this.environment)\n\t\tconst lastHasOne = desugared.hasOneRelationPath[desugared.hasOneRelationPath.length - 1]\n\t\tconst lastHasOnePlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(lastHasOne)\n\n\t\tlet containingAccessor: EntityAccessor = this\n\n\t\tif (desugared.hasOneRelationPath.length > 1) {\n\t\t\tcontainingAccessor = this.getRelativeSingleEntity({\n\t\t\t\thasOneRelationPath: desugared.hasOneRelationPath.slice(0, -1),\n\t\t\t})\n\t\t}\n\t\treturn containingAccessor.getPersistedKeyByPlaceholder(lastHasOnePlaceholder)\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleEntity(field).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getFieldPlaceholder(field.field),\n\t\t) as unknown as FieldAccessor<Value>\n\t}\n\n\tpublic getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\trelativeTo = relativeTo.getAccessorByPlaceholder(\n\t\t\t\tPlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation),\n\t\t\t) as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor {\n\t\treturn this.getRelativeSingleEntity(entityList).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation),\n\t\t) as EntityListAccessor\n\t}\n\n\tprivate getAccessorByPlaceholder(placeholderName: FieldName): EntityAccessor.NestedAccessor {\n\t\tconst record = this.fieldData.get(placeholderName)\n\t\tif (record === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor: unknown field placeholder '${placeholderName} on ${this.name}'. Unless this is just a typo, this is ` +\n\t\t\t\t\t`typically caused by one of the following:\\n` +\n\t\t\t\t\t`\\t• Trying to access a field that has not been registered during static render, and thus lacks a marker and an accessor.\\n` +\n\t\t\t\t\t`\\t• Misusing an EntityAccessor getter. If you used one of the getRelative[…] family, please make sure all ` +\n\t\t\t\t\t`parameters match the marker tree exactly.` +\n\t\t\t\t\t`\\n\\nFor more information, please consult the documentation.\\n\\n`,\n\t\t\t)\n\t\t}\n\t\treturn record.getAccessor()\n\t}\n\n\tprivate getPersistedKeyByPlaceholder(placeholderName: string): string | null {\n\t\tif (this.dataFromServer === undefined) {\n\t\t\treturn null\n\t\t}\n\t\tconst key = this.dataFromServer.get(placeholderName)\n\n\t\tif (key instanceof ServerGeneratedUuid) {\n\t\t\treturn key.value\n\t\t}\n\t\tif (key === null) {\n\t\t\t// TODO this also returns null and fails to throw when placeholderName points to a regular scalar field that\n\t\t\t// \thappens to be also null.\n\t\t\treturn null\n\t\t}\n\n\t\t// From now on, we're past the happy path, way into error land.\n\t\tif (key === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: unknown placeholder '${placeholderName}'. Unless this is just ` +\n\t\t\t\t\t`a typo, this typically happens when a has-one relation hasn't been registered during static render.`,\n\t\t\t)\n\t\t}\n\t\tif (key instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a has-many relation, ` +\n\t\t\t\t\t`not a has-one. This method is meant exclusively for has-one relations.`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(\n\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a scalar field, not a` +\n\t\t\t\t`has-one relation. This method is meant exclusively for has-one relations.`,\n\t\t)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListenerMap\n}\n\nexport { EntityAccessor }\n"],"names":[],"mappings":";;;;;AA6BA,qBAA0C;AAAA,EAClC,YACW,UACA,YACA,WACD,KACA,MACC,WACA,gBACD,uBACA,QACA,aACA,aACf;;;;;;;;;;;;;MAES,aAAiC;WACpC,KAAK,UAAU,iBAAiB,KAAK,UAAU,QAAQ;AAAA;AAAA,MAMpD,KAAe;WAClB,KAAK,UAAU;AAAA;AAAA,MAGZ,iBAA0B;WAC7B,KAAK,UAAU;AAAA;AAAA,EAKhB,SAAS,OAAiD;WACzD,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe;AAAA;AAAA,EAGtE,iBACN,OACA,UACa;WACN,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,aAAa,gBAA0D;SACxE,WAAW,aAAa,KAAK,UAAU;AAAA;AAAA,EAGtC,qBAAqB,OAAkB,iBAAuC;SAC/E,WAAW,qBAAqB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGrD,wBAAwB,OAAkB,uBAAkE;SAC7G,WAAW,wBAAwB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,eAAqB;SACtB,WAAW,aAAa,KAAK;AAAA;AAAA,EAK5B,aAAa,iBAAuD;SACrE,aAAa,iBAAe;YAC1B,UAAU,MAAM,QAAQ,mBAAmB,kBAAkB,OAAO,QAAQ;iBAEvE,CAAC,OAAO,UAAU,SAAS;sBACvB,SAAS,OAAO,YAAY;AAAA;AAAA;AAAA;AAAA,EAStC,SACN,OACuB;WAChB,KAAK,uBAA8B,cAAc,2BAA2B,OAAO,KAAK;AAAA;AAAA,EAGzF,UAAU,QAA8D;WACvE,KAAK,wBAAwB,cAAc,4BAA4B,QAAQ,KAAK;AAAA;AAAA,EAGrF,cAAc,YAAoE;WACjF,KAAK,sBAAsB,cAAc,0BAA0B,YAAY,KAAK;AAAA;AAAA,EAGrF,wBAAwB,QAA6D;UACrF,YAAY,cAAc,4BAA4B,QAAQ,KAAK;UACnE,aAAa,UAAU,mBAAmB,UAAU,mBAAmB,SAAS;UAChF,wBAAwB,qBAAqB,6BAA6B;QAE5E,qBAAqC;QAErC,UAAU,mBAAmB,SAAS,GAAG;2BACvB,KAAK,wBAAwB;AAAA,QACjD,oBAAoB,UAAU,mBAAmB,MAAM,GAAG;AAAA;AAAA;WAGrD,mBAAmB,6BAA6B;AAAA;AAAA,EAQjD,uBAA8D,OAAkD;WAC/G,KAAK,wBAAwB,OAAO,yBAC1C,qBAAqB,oBAAoB,MAAM;AAAA;AAAA,EAI1C,wBAAwB,sBAA4D;QACtF,aAA6B;eAEtB,kBAAkB,qBAAqB,oBAAoB;mBACxD,WAAW,yBACvB,qBAAqB,6BAA6B;AAAA;WAG7C;AAAA;AAAA,EAGD,sBAAsB,YAAoD;WACzE,KAAK,wBAAwB,YAAY,yBAC/C,qBAAqB,8BAA8B,WAAW;AAAA;AAAA,EAIxD,yBAAyB,iBAA2D;UACrF,SAAS,KAAK,UAAU,IAAI;QAC9B,WAAW,QAAW;YACnB,IAAI,aACT,8CAA8C,sBAAsB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;WAQpE,OAAO;AAAA;AAAA,EAGP,6BAA6B,iBAAwC;QACxE,KAAK,mBAAmB,QAAW;aAC/B;AAAA;UAEF,MAAM,KAAK,eAAe,IAAI;QAEhC,eAAe,qBAAqB;aAChC,IAAI;AAAA;QAER,QAAQ,MAAM;aAGV;AAAA;QAIJ,QAAQ,QAAW;YAChB,IAAI,aACT,gEAAgE;AAAA;QAI9D,eAAe,KAAK;YACjB,IAAI,aACT,4DAA4D;AAAA;UAIxD,IAAI,aACT,4DAA4D;AAAA;AAAA;;"}
|
|
1
|
+
{"version":3,"file":"EntityAccessor.js","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, ServerGeneratedUuid, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {}\n\n\tpublic get idOnServer(): string | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.stateKey, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.stateKey, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.stateKey)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\tpublic getKeyConnectedOnServer(entity: SugaredRelativeSingleEntity | string): string | null {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity(entity, this.environment)\n\t\tconst lastHasOne = desugared.hasOneRelationPath[desugared.hasOneRelationPath.length - 1]\n\t\tconst lastHasOnePlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(lastHasOne)\n\n\t\tlet containingAccessor: EntityAccessor = this\n\n\t\tif (desugared.hasOneRelationPath.length > 1) {\n\t\t\tcontainingAccessor = this.getRelativeSingleEntity({\n\t\t\t\thasOneRelationPath: desugared.hasOneRelationPath.slice(0, -1),\n\t\t\t})\n\t\t}\n\t\treturn containingAccessor.getPersistedKeyByPlaceholder(lastHasOnePlaceholder)\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleEntity(field).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getFieldPlaceholder(field.field),\n\t\t) as unknown as FieldAccessor<Value>\n\t}\n\n\tpublic getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\trelativeTo = relativeTo.getAccessorByPlaceholder(\n\t\t\t\tPlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation),\n\t\t\t) as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor {\n\t\treturn this.getRelativeSingleEntity(entityList).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation),\n\t\t) as EntityListAccessor\n\t}\n\n\tprivate getAccessorByPlaceholder(placeholderName: FieldName): EntityAccessor.NestedAccessor {\n\t\tconst record = this.fieldData.get(placeholderName)\n\t\tif (record === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor: unknown field placeholder '${placeholderName} on ${this.name}'. Unless this is just a typo, this is ` +\n\t\t\t\t\t`typically caused by one of the following:\\n` +\n\t\t\t\t\t`\\t• Trying to access a field that has not been registered during static render, and thus lacks a marker and an accessor.\\n` +\n\t\t\t\t\t`\\t• Misusing an EntityAccessor getter. If you used one of the getRelative[…] family, please make sure all ` +\n\t\t\t\t\t`parameters match the marker tree exactly.` +\n\t\t\t\t\t`\\n\\nFor more information, please consult the documentation.\\n\\n`,\n\t\t\t)\n\t\t}\n\t\treturn record.getAccessor()\n\t}\n\n\tprivate getPersistedKeyByPlaceholder(placeholderName: string): string | null {\n\t\tif (this.dataFromServer === undefined) {\n\t\t\treturn null\n\t\t}\n\t\tconst key = this.dataFromServer.get(placeholderName)\n\n\t\tif (key instanceof ServerGeneratedUuid) {\n\t\t\treturn key.value\n\t\t}\n\t\tif (key === null) {\n\t\t\t// TODO this also returns null and fails to throw when placeholderName points to a regular scalar field that\n\t\t\t// \thappens to be also null.\n\t\t\treturn null\n\t\t}\n\n\t\t// From now on, we're past the happy path, way into error land.\n\t\tif (key === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: unknown placeholder '${placeholderName}'. Unless this is just ` +\n\t\t\t\t\t`a typo, this typically happens when a has-one relation hasn't been registered during static render.`,\n\t\t\t)\n\t\t}\n\t\tif (key instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a has-many relation, ` +\n\t\t\t\t\t`not a has-one. This method is meant exclusively for has-one relations.`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(\n\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a scalar field, not a` +\n\t\t\t\t`has-one relation. This method is meant exclusively for has-one relations.`,\n\t\t)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListenerMap\n}\n\nexport { EntityAccessor }\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,eAAoC;AAAA,EAClC,YACW,UACA,YACA,WACD,KACA,MACC,WACA,gBACD,uBACA,QACA,aACA,aACf;AAXgB,SAAA,WAAA;AACA,SAAA,aAAA;AACA,SAAA,YAAA;AACD,SAAA,MAAA;AACA,SAAA,OAAA;AACC,SAAA,YAAA;AACA,SAAA,iBAAA;AACD,SAAA,wBAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AACA,SAAA,cAAA;AAAA,EACd;AAAA,MAEQ,aAAiC;AAC3C,WAAO,KAAK,UAAU,iBAAiB,KAAK,UAAU,QAAQ;AAAA,EAC/D;AAAA,MAKW,KAAe;AACzB,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,MAEW,iBAA0B;AACpC,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,EAIO,SAAS,OAAiD;AACzD,WAAA,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe,KAAK,CAAC;AAAA,EACnF;AAAA,EAEO,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO,QAAQ;AAAA,EACvE;AAAA,EAEO,aAAa,gBAA0D;AAC7E,SAAK,WAAW,aAAa,KAAK,UAAU,cAAc;AAAA,EAC3D;AAAA,EAEO,qBAAqB,OAAkB,iBAAuC;AACpF,SAAK,WAAW,qBAAqB,KAAK,UAAU,OAAO,eAAe;AAAA,EAC3E;AAAA,EAEO,wBAAwB,OAAkB,uBAAkE;AAClH,SAAK,WAAW,wBAAwB,KAAK,UAAU,OAAO,qBAAqB;AAAA,EACpF;AAAA,EAEO,eAAqB;AACtB,SAAA,WAAW,aAAa,KAAK,QAAQ;AAAA,EAC3C;AAAA,EAIO,aAAa,iBAAuD;AAC1E,SAAK,aAAa,CAAe,gBAAA;AAC1B,YAAA,UAAU,MAAM,QAAQ,eAAe,IAAI,kBAAkB,OAAO,QAAQ,eAAe;AAEtF,iBAAA,CAAC,OAAO,UAAU,SAAS;AACrC,oBAAA,EAAc,SAAS,KAAK,EAAE,YAAY,KAAK;AAAA,MAChD;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAMO,SACN,OACuB;AACvB,WAAO,KAAK,uBAA8B,cAAc,2BAA2B,OAAO,KAAK,WAAW,CAAC;AAAA,EAC5G;AAAA,EAEO,UAAU,QAA8D;AAC9E,WAAO,KAAK,wBAAwB,cAAc,4BAA4B,QAAQ,KAAK,WAAW,CAAC;AAAA,EACxG;AAAA,EAEO,cAAc,YAAoE;AACxF,WAAO,KAAK,sBAAsB,cAAc,0BAA0B,YAAY,KAAK,WAAW,CAAC;AAAA,EACxG;AAAA,EAEO,wBAAwB,QAA6D;AAC3F,UAAM,YAAY,cAAc,4BAA4B,QAAQ,KAAK,WAAW;AACpF,UAAM,aAAa,UAAU,mBAAmB,UAAU,mBAAmB,SAAS;AAChF,UAAA,wBAAwB,qBAAqB,6BAA6B,UAAU;AAE1F,QAAI,qBAAqC;AAErC,QAAA,UAAU,mBAAmB,SAAS,GAAG;AAC5C,2BAAqB,KAAK,wBAAwB;AAAA,QACjD,oBAAoB,UAAU,mBAAmB,MAAM,GAAG,EAAE;AAAA,MAAA,CAC5D;AAAA,IACF;AACO,WAAA,mBAAmB,6BAA6B,qBAAqB;AAAA,EAC7E;AAAA,EAOO,uBAA8D,OAAkD;AAC/G,WAAA,KAAK,wBAAwB,KAAK,EAAE,yBAC1C,qBAAqB,oBAAoB,MAAM,KAAK,CACrD;AAAA,EACD;AAAA,EAEO,wBAAwB,sBAA4D;AAC1F,QAAI,aAA6B;AAEtB,eAAA,kBAAkB,qBAAqB,oBAAoB;AACrE,mBAAa,WAAW,yBACvB,qBAAqB,6BAA6B,cAAc,CACjE;AAAA,IACD;AACO,WAAA;AAAA,EACR;AAAA,EAEO,sBAAsB,YAAoD;AACzE,WAAA,KAAK,wBAAwB,UAAU,EAAE,yBAC/C,qBAAqB,8BAA8B,WAAW,eAAe,CAC9E;AAAA,EACD;AAAA,EAEQ,yBAAyB,iBAA2D;AAC3F,UAAM,SAAS,KAAK,UAAU,IAAI,eAAe;AACjD,QAAI,WAAW,QAAW;AACzB,YAAM,IAAI,aACT,8CAA8C,sBAAsB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAM1E;AAAA,IACD;AACA,WAAO,OAAO;EACf;AAAA,EAEQ,6BAA6B,iBAAwC;AACxE,QAAA,KAAK,mBAAmB,QAAW;AAC/B,aAAA;AAAA,IACR;AACA,UAAM,MAAM,KAAK,eAAe,IAAI,eAAe;AAEnD,QAAI,eAAe,qBAAqB;AACvC,aAAO,IAAI;AAAA,IACZ;AACA,QAAI,QAAQ,MAAM;AAGV,aAAA;AAAA,IACR;AAGA,QAAI,QAAQ,QAAW;AAChB,YAAA,IAAI,aACT,gEAAgE,2IAEjE;AAAA,IACD;AACA,QAAI,eAAe,KAAK;AACjB,YAAA,IAAI,aACT,4DAA4D,wHAE7D;AAAA,IACD;AACM,UAAA,IAAI,aACT,4DAA4D,2HAE7D;AAAA,EACD;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListAccessor.js","sources":["../../../src/accessors/EntityListAccessor.ts"],"sourcesContent":["import type { ListOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport type { EntityId, EntityRealmKey } from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityAccessor } from './EntityAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityListState } from '../core/state'\nimport { RuntimeId } from '../accessorTree'\n\nclass EntityListAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityListState,\n\t\tprivate readonly operations: ListOperations,\n\t\tprivate readonly _children: ReadonlyMap<EntityId, { getAccessor: EntityAccessor.GetEntityAccessor }>,\n\t\tprivate readonly _idsPersistedOnServer: ReadonlySet<string>,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityListAccessor.GetEntityListAccessor,\n\t) {}\n\n\t/**\n\t * Returns all entity keys that are on the list.\n\t * **KEYS ARE NOT IDS!**\n\t * @see EntityAccessor.key\n\t */\n\tpublic *keys(): IterableIterator<EntityRealmKey> {\n\t\tfor (const accessor of this) {\n\t\t\tyield accessor.key\n\t\t}\n\t}\n\n\tpublic *ids(): IterableIterator<EntityId> {\n\t\treturn this._children.keys()\n\t}\n\n\t/**\n\t * This will only contain the ids that the server knows about. Not necessarily the ids that have been added on\n\t * the list since the last server query.\n\t */\n\tpublic get idsPersistedOnServer(): Set<string> {\n\t\treturn new Set(this._idsPersistedOnServer)\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<EntityAccessor> {\n\t\tfor (const { getAccessor } of this._children.values()) {\n\t\t\tyield getAccessor()\n\t\t}\n\t}\n\n\tpublic hasEntityId(id: EntityId): boolean {\n\t\treturn this._children.has(id)\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.length === 0\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._children.size\n\t}\n\n\tpublic hasEntityOnServer(entityOrItsId: EntityAccessor | EntityId): boolean {\n\t\tif (typeof entityOrItsId === 'string') {\n\t\t\treturn this.idsPersistedOnServer.has(entityOrItsId)\n\t\t}\n\t\tconst idOnServer = entityOrItsId.idOnServer\n\t\tif (idOnServer === undefined) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.idsPersistedOnServer.has(idOnServer)\n\t}\n\n\tpublic deleteAll(): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst list = getAccessor()\n\t\t\tfor (const entity of list) {\n\t\t\t\tentity.deleteEntity()\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectAll(): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst list = getAccessor()\n\t\t\tfor (const entity of list) {\n\t\t\t\tlist.disconnectEntity(entity)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\treturn this.operations.addChildEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityListAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntity(entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntity(this.stateKey, entityToConnect)\n\t}\n\n\tpublic createNewEntity(initialize?: EntityAccessor.BatchUpdatesHandler): RuntimeId {\n\t\treturn this.operations.createNewEntity(this.stateKey, initialize)\n\t}\n\tpublic disconnectEntity(childEntity: EntityAccessor, options: { noPersist?: boolean } = {}): void {\n\t\tthis.operations.disconnectEntity(this.stateKey, childEntity, options)\n\t}\n\tpublic getChildEntityById(id: EntityId): EntityAccessor {\n\t\treturn this.operations.getChildEntityById(this.stateKey, id)\n\t}\n}\n\nnamespace EntityListAccessor {\n\texport type GetEntityListAccessor = () => EntityListAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityListAccessor, options: BatchUpdatesOptions) => void\n\n\texport type UpdateListener = (accessor: EntityListAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport type ChildEventListenerMap = {\n\t\t[EventType in keyof Pick<EntityAccessor.EntityEventListenerMap, 'beforeUpdate' | 'initialize' | 'update'> &\n\t\t\tstring as `child${Capitalize<EventType>}`]: EntityAccessor.EntityEventListenerMap[EventType]\n\t}\n\n\texport interface RuntimeEntityListEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityListEventListenerMap extends RuntimeEntityListEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityListEventType = keyof EntityListEventListenerMap\n}\n\nexport { EntityListAccessor }\n"],"names":[],"mappings":";AAaA,
|
|
1
|
+
{"version":3,"file":"EntityListAccessor.js","sources":["../../../src/accessors/EntityListAccessor.ts"],"sourcesContent":["import type { ListOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport type { EntityId, EntityRealmKey } from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityAccessor } from './EntityAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityListState } from '../core/state'\nimport { RuntimeId } from '../accessorTree'\n\nclass EntityListAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityListState,\n\t\tprivate readonly operations: ListOperations,\n\t\tprivate readonly _children: ReadonlyMap<EntityId, { getAccessor: EntityAccessor.GetEntityAccessor }>,\n\t\tprivate readonly _idsPersistedOnServer: ReadonlySet<string>,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityListAccessor.GetEntityListAccessor,\n\t) {}\n\n\t/**\n\t * Returns all entity keys that are on the list.\n\t * **KEYS ARE NOT IDS!**\n\t * @see EntityAccessor.key\n\t */\n\tpublic *keys(): IterableIterator<EntityRealmKey> {\n\t\tfor (const accessor of this) {\n\t\t\tyield accessor.key\n\t\t}\n\t}\n\n\tpublic *ids(): IterableIterator<EntityId> {\n\t\treturn this._children.keys()\n\t}\n\n\t/**\n\t * This will only contain the ids that the server knows about. Not necessarily the ids that have been added on\n\t * the list since the last server query.\n\t */\n\tpublic get idsPersistedOnServer(): Set<string> {\n\t\treturn new Set(this._idsPersistedOnServer)\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<EntityAccessor> {\n\t\tfor (const { getAccessor } of this._children.values()) {\n\t\t\tyield getAccessor()\n\t\t}\n\t}\n\n\tpublic hasEntityId(id: EntityId): boolean {\n\t\treturn this._children.has(id)\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.length === 0\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._children.size\n\t}\n\n\tpublic hasEntityOnServer(entityOrItsId: EntityAccessor | EntityId): boolean {\n\t\tif (typeof entityOrItsId === 'string') {\n\t\t\treturn this.idsPersistedOnServer.has(entityOrItsId)\n\t\t}\n\t\tconst idOnServer = entityOrItsId.idOnServer\n\t\tif (idOnServer === undefined) {\n\t\t\treturn false\n\t\t}\n\t\treturn this.idsPersistedOnServer.has(idOnServer)\n\t}\n\n\tpublic deleteAll(): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst list = getAccessor()\n\t\t\tfor (const entity of list) {\n\t\t\t\tentity.deleteEntity()\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectAll(): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst list = getAccessor()\n\t\t\tfor (const entity of list) {\n\t\t\t\tlist.disconnectEntity(entity)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\treturn this.operations.addChildEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityListAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntity(entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntity(this.stateKey, entityToConnect)\n\t}\n\n\tpublic createNewEntity(initialize?: EntityAccessor.BatchUpdatesHandler): RuntimeId {\n\t\treturn this.operations.createNewEntity(this.stateKey, initialize)\n\t}\n\tpublic disconnectEntity(childEntity: EntityAccessor, options: { noPersist?: boolean } = {}): void {\n\t\tthis.operations.disconnectEntity(this.stateKey, childEntity, options)\n\t}\n\tpublic getChildEntityById(id: EntityId): EntityAccessor {\n\t\treturn this.operations.getChildEntityById(this.stateKey, id)\n\t}\n}\n\nnamespace EntityListAccessor {\n\texport type GetEntityListAccessor = () => EntityListAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityListAccessor, options: BatchUpdatesOptions) => void\n\n\texport type UpdateListener = (accessor: EntityListAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityListAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport type ChildEventListenerMap = {\n\t\t[EventType in keyof Pick<EntityAccessor.EntityEventListenerMap, 'beforeUpdate' | 'initialize' | 'update'> &\n\t\t\tstring as `child${Capitalize<EventType>}`]: EntityAccessor.EntityEventListenerMap[EventType]\n\t}\n\n\texport interface RuntimeEntityListEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityListEventListenerMap extends RuntimeEntityListEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityListEventType = keyof EntityListEventListenerMap\n}\n\nexport { EntityListAccessor }\n"],"names":[],"mappings":";AAaA,MAAM,mBAAwC;AAAA,EACtC,YACW,UACA,YACA,WACA,uBACD,uBACA,QACA,aACA,aACf;AARgB,SAAA,WAAA;AACA,SAAA,aAAA;AACA,SAAA,YAAA;AACA,SAAA,wBAAA;AACD,SAAA,wBAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AACA,SAAA,cAAA;AAAA,EACd;AAAA,GAOK,OAAyC;AAChD,eAAW,YAAY,MAAM;AAC5B,YAAM,SAAS;AAAA,IAChB;AAAA,EACD;AAAA,GAEQ,MAAkC;AAClC,WAAA,KAAK,UAAU;EACvB;AAAA,MAMW,uBAAoC;AACvC,WAAA,IAAI,IAAI,KAAK,qBAAqB;AAAA,EAC1C;AAAA,IAES,OAAO,YAA8C;AAC7D,eAAW,EAAE,iBAAiB,KAAK,UAAU,UAAU;AACtD,YAAM,YAAY;AAAA,IACnB;AAAA,EACD;AAAA,EAEO,YAAY,IAAuB;AAClC,WAAA,KAAK,UAAU,IAAI,EAAE;AAAA,EAC7B;AAAA,EAEO,UAAmB;AACzB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,MAEW,SAAiB;AAC3B,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,EAEO,kBAAkB,eAAmD;AACvE,QAAA,OAAO,kBAAkB,UAAU;AAC/B,aAAA,KAAK,qBAAqB,IAAI,aAAa;AAAA,IACnD;AACA,UAAM,aAAa,cAAc;AACjC,QAAI,eAAe,QAAW;AACtB,aAAA;AAAA,IACR;AACO,WAAA,KAAK,qBAAqB,IAAI,UAAU;AAAA,EAChD;AAAA,EAEO,YAAkB;AACxB,SAAK,aAAa,CAAe,gBAAA;AAChC,YAAM,OAAO;AACb,iBAAW,UAAU,MAAM;AAC1B,eAAO,aAAa;AAAA,MACrB;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAEO,gBAAsB;AAC5B,SAAK,aAAa,CAAe,gBAAA;AAChC,YAAM,OAAO;AACb,iBAAW,UAAU,MAAM;AAC1B,aAAK,iBAAiB,MAAM;AAAA,MAC7B;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAEO,SAAS,OAAiD;AACzD,WAAA,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe,KAAK,CAAC;AAAA,EACnF;AAAA,EAEO,iBACN,OACA,UACC;AACD,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO,QAAQ;AAAA,EACvE;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,WAAO,KAAK,WAAW,sBAAsB,KAAK,UAAU,OAAO,QAAQ;AAAA,EAC5E;AAAA,EAEO,aAAa,gBAA8D;AACjF,SAAK,WAAW,aAAa,KAAK,UAAU,cAAc;AAAA,EAC3D;AAAA,EAEO,cAAc,iBAAuC;AAC3D,SAAK,WAAW,cAAc,KAAK,UAAU,eAAe;AAAA,EAC7D;AAAA,EAEO,gBAAgB,YAA4D;AAClF,WAAO,KAAK,WAAW,gBAAgB,KAAK,UAAU,UAAU;AAAA,EACjE;AAAA,EACO,iBAAiB,aAA6B,UAAmC,IAAU;AACjG,SAAK,WAAW,iBAAiB,KAAK,UAAU,aAAa,OAAO;AAAA,EACrE;AAAA,EACO,mBAAmB,IAA8B;AACvD,WAAO,KAAK,WAAW,mBAAmB,KAAK,UAAU,EAAE;AAAA,EAC5D;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorAccessor.js","sources":["../../../src/accessors/ErrorAccessor.ts"],"sourcesContent":["import type { Result } from '@contember/client'\n\nclass ErrorAccessor {\n\tpublic constructor(\n\t\tpublic readonly errors: ErrorAccessor.Error[],\n\t) {\n\t}\n}\n\nnamespace ErrorAccessor {\n\texport type ErrorId = number\n\texport type Error = ExecutionError | ValidationError\n\texport type ErrorsById = Map<ErrorId, Error>\n\n\texport type ExecutionErrors = ExecutionError[]\n\n\texport interface ExecutionError {\n\t\ttype: 'execution'\n\t\tcode: Result.ExecutionErrorType\n\t\tdeveloperMessage: string | null\n\t}\n\n\texport type ValidationErrors = ValidationError[]\n\n\texport interface ValidationError {\n\t\ttype: 'validation'\n\t\tcode: WellKnownErrorCode | string | undefined\n\t\tmessage: string\n\t}\n\n\texport type WellKnownErrorCode = 'fieldRequired'\n\n\texport const normalizeError = (error: Error | string): Error => typeof error === 'string' ? {\n\t\ttype: 'validation',\n\t\tmessage: error,\n\t\tcode: undefined,\n\t} : error\n}\nexport { ErrorAccessor }\n"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"ErrorAccessor.js","sources":["../../../src/accessors/ErrorAccessor.ts"],"sourcesContent":["import type { Result } from '@contember/client'\n\nclass ErrorAccessor {\n\tpublic constructor(\n\t\tpublic readonly errors: ErrorAccessor.Error[],\n\t) {\n\t}\n}\n\nnamespace ErrorAccessor {\n\texport type ErrorId = number\n\texport type Error = ExecutionError | ValidationError\n\texport type ErrorsById = Map<ErrorId, Error>\n\n\texport type ExecutionErrors = ExecutionError[]\n\n\texport interface ExecutionError {\n\t\ttype: 'execution'\n\t\tcode: Result.ExecutionErrorType\n\t\tdeveloperMessage: string | null\n\t}\n\n\texport type ValidationErrors = ValidationError[]\n\n\texport interface ValidationError {\n\t\ttype: 'validation'\n\t\tcode: WellKnownErrorCode | string | undefined\n\t\tmessage: string\n\t}\n\n\texport type WellKnownErrorCode = 'fieldRequired'\n\n\texport const normalizeError = (error: Error | string): Error => typeof error === 'string' ? {\n\t\ttype: 'validation',\n\t\tmessage: error,\n\t\tcode: undefined,\n\t} : error\n}\nexport { ErrorAccessor }\n"],"names":[],"mappings":"AAEA,MAAM,cAAc;AAAA,EACZ,YACU,QACf;AADe,SAAA,SAAA;AAAA,EAEjB;AACD;AAEA,AAAA,EAAU,mBAAV;AAuBc,iBAAiB,iBAAA,CAAC,UAAiC,OAAO,UAAU,WAAW;AAAA,IAC3F,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,EACH,IAAA;AAAA,GA3BK,iBAAA,iBAAA,CAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport type { FieldState } from '../core/state'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { SchemaColumn } from '../core/schema/SchemaColumn'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t\tpublic readonly schema: SchemaColumn,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;AASA,
|
|
1
|
+
{"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport type { FieldState } from '../core/state'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { SchemaColumn } from '../core/schema/SchemaColumn'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t\tpublic readonly schema: SchemaColumn,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;AASA,MAAM,cAA0E;AAAA,EAC/E,YACkB,UACA,YACD,WACA,OACA,eACA,cACA,QACA,uBACC,UACD,aACA,QACf;AAXgB,SAAA,WAAA;AACA,SAAA,aAAA;AACD,SAAA,YAAA;AACA,SAAA,QAAA;AACA,SAAA,gBAAA;AACA,SAAA,eAAA;AACA,SAAA,SAAA;AACA,SAAA,wBAAA;AACC,SAAA,WAAA;AACD,SAAA,cAAA;AACA,SAAA,SAAA;AAAA,EACd;AAAA,EAEI,SAAS,OAAiD;AACzD,WAAA,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe,KAAK,CAAC;AAAA,EACnF;AAAA,EAEO,cAAoB;AACrB,SAAA,WAAW,YAAY,KAAK,QAAQ;AAAA,EAC1C;AAAA,EAEO,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO,QAAQ;AAAA,EACvE;AAAA,EAEO,YAAY,UAAwB,SAA6C;AACvF,SAAK,WAAW,YAAY,KAAK,UAAU,UAAU,OAAO;AAAA,EAC7D;AAAA,EAEO,SAAS,WAAmC;AAClD,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,EAEO,YAAY,OAAe;AACjC,WAAO,KAAK,UAAU,IAAI,KAAK,KAAK;AAAA,EACrC;AAAA,MAEW,YAAY;AACf,WAAA,KAAK,YAAY,cAAc,SAAS;AAAA,EAChD;AAAA,MAEW,gBAAgB;AACtB,QAAA,KAAK,iBAAiB,QAAW;AACpC,aAAO,KAAK;AAAA,IACb;AACA,WAAO,KAAK,UAAU,OAAO,KAAK,eAAe,KAAK;AAAA,EACvD;AAAA,MAIW,aAAkC;AACrC,WAAA,IAAI,oBAAoB,KAAK,WAAkD;AAAA,EACvF;AAAA,MAEW,SAA0B;AAC7B,WAAA,IAAI,gBAAgB,KAAK,WAAkD;AAAA,EACnF;AACD;AACA,AAAA,EAAU,mBAAV;AACc,iBAAY,YAAA;AAAA,GADhB,iBAAA,iBAAA,CAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRootAccessor.js","sources":["../../../src/accessors/TreeRootAccessor.ts"],"sourcesContent":["import type { BindingOperations } from './BindingOperations'\n\n// This allows us to have several parallel sub-trees without one having to be the main tree\n// and all the other ones subordinate.\nexport class TreeRootAccessor {\n\t/**\n\t * Whenever an update occurs, a new instance of this class is created.\n\t */\n\tpublic constructor(\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly isMutating: boolean,\n\t\tpublic readonly bindingOperations: BindingOperations,\n\t) {}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeRootAccessor.js","sources":["../../../src/accessors/TreeRootAccessor.ts"],"sourcesContent":["import type { BindingOperations } from './BindingOperations'\n\n// This allows us to have several parallel sub-trees without one having to be the main tree\n// and all the other ones subordinate.\nexport class TreeRootAccessor {\n\t/**\n\t * Whenever an update occurs, a new instance of this class is created.\n\t */\n\tpublic constructor(\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly isMutating: boolean,\n\t\tpublic readonly bindingOperations: BindingOperations,\n\t) {}\n}\n"],"names":[],"mappings":"AAIO,MAAM,iBAAiB;AAAA,EAItB,YACU,uBACA,YACA,mBACf;AAHe,SAAA,wBAAA;AACA,SAAA,aAAA;AACA,SAAA,oBAAA;AAAA,EACd;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindingTypes.js","sources":["../../src/bindingTypes.ts"],"sourcesContent":["export const PRIMARY_KEY_NAME = 'id'\nexport const TYPENAME_KEY_NAME = '__typename'\nexport const NIL_UUID = '00000000-0000-0000-0000-000000000000'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bindingTypes.js","sources":["../../src/bindingTypes.ts"],"sourcesContent":["export const PRIMARY_KEY_NAME = 'id'\nexport const TYPENAME_KEY_NAME = '__typename'\nexport const NIL_UUID = '00000000-0000-0000-0000-000000000000'\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,MAAM,WAAW;;"}
|