@contember/binding-legacy 2.1.0-alpha.36 → 2.1.0-alpha.39
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/index.cjs +34 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +28 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/accessorTree/NormalizedPersistedData.cjs +10 -0
- package/dist/development/src/accessorTree/NormalizedPersistedData.cjs.map +1 -0
- package/dist/development/src/accessorTree/NormalizedPersistedData.js +10 -0
- package/dist/development/src/accessorTree/NormalizedPersistedData.js.map +1 -0
- package/dist/development/src/accessors/EntityAccessorImpl.cjs +179 -0
- package/dist/development/src/accessors/EntityAccessorImpl.cjs.map +1 -0
- package/dist/development/src/accessors/EntityAccessorImpl.js +179 -0
- package/dist/development/src/accessors/EntityAccessorImpl.js.map +1 -0
- package/dist/development/src/accessors/EntityListAccessorImpl.cjs +112 -0
- package/dist/development/src/accessors/EntityListAccessorImpl.cjs.map +1 -0
- package/dist/development/src/accessors/EntityListAccessorImpl.js +112 -0
- package/dist/development/src/accessors/EntityListAccessorImpl.js.map +1 -0
- package/dist/development/src/accessors/FieldAccessorImpl.cjs +54 -0
- package/dist/development/src/accessors/FieldAccessorImpl.cjs.map +1 -0
- package/dist/development/src/accessors/FieldAccessorImpl.js +54 -0
- package/dist/development/src/accessors/FieldAccessorImpl.js.map +1 -0
- package/dist/development/src/core/AccessorErrorManager.cjs +200 -0
- package/dist/development/src/core/AccessorErrorManager.cjs.map +1 -0
- package/dist/development/src/core/AccessorErrorManager.js +200 -0
- package/dist/development/src/core/AccessorErrorManager.js.map +1 -0
- package/dist/development/src/core/Config.cjs +29 -0
- package/dist/development/src/core/Config.cjs.map +1 -0
- package/dist/development/src/core/Config.js +29 -0
- package/dist/development/src/core/Config.js.map +1 -0
- package/dist/development/src/core/DataBinding.cjs +357 -0
- package/dist/development/src/core/DataBinding.cjs.map +1 -0
- package/dist/development/src/core/DataBinding.js +357 -0
- package/dist/development/src/core/DataBinding.js.map +1 -0
- package/dist/development/src/core/DirtinessTracker.cjs +26 -0
- package/dist/development/src/core/DirtinessTracker.cjs.map +1 -0
- package/dist/development/src/core/DirtinessTracker.js +26 -0
- package/dist/development/src/core/DirtinessTracker.js.map +1 -0
- package/dist/development/src/core/ErrorsPreprocessor.cjs +180 -0
- package/dist/development/src/core/ErrorsPreprocessor.cjs.map +1 -0
- package/dist/development/src/core/ErrorsPreprocessor.js +180 -0
- package/dist/development/src/core/ErrorsPreprocessor.js.map +1 -0
- package/dist/development/src/core/EventManager.cjs +439 -0
- package/dist/development/src/core/EventManager.cjs.map +1 -0
- package/dist/development/src/core/EventManager.js +439 -0
- package/dist/development/src/core/EventManager.js.map +1 -0
- package/dist/development/src/core/MutationGenerator.cjs +670 -0
- package/dist/development/src/core/MutationGenerator.cjs.map +1 -0
- package/dist/development/src/core/MutationGenerator.js +670 -0
- package/dist/development/src/core/MutationGenerator.js.map +1 -0
- package/dist/development/src/core/QueryGenerator.cjs +110 -0
- package/dist/development/src/core/QueryGenerator.cjs.map +1 -0
- package/dist/development/src/core/QueryGenerator.js +110 -0
- package/dist/development/src/core/QueryGenerator.js.map +1 -0
- package/dist/development/src/core/RealmKeyGenerator.cjs +42 -0
- package/dist/development/src/core/RealmKeyGenerator.cjs.map +1 -0
- package/dist/development/src/core/RealmKeyGenerator.js +42 -0
- package/dist/development/src/core/RealmKeyGenerator.js.map +1 -0
- package/dist/development/src/core/RequestResponseNormalizer.cjs +136 -0
- package/dist/development/src/core/RequestResponseNormalizer.cjs.map +1 -0
- package/dist/development/src/core/RequestResponseNormalizer.js +136 -0
- package/dist/development/src/core/RequestResponseNormalizer.js.map +1 -0
- package/dist/development/src/core/StateInitializer.cjs +379 -0
- package/dist/development/src/core/StateInitializer.cjs.map +1 -0
- package/dist/development/src/core/StateInitializer.js +379 -0
- package/dist/development/src/core/StateInitializer.js.map +1 -0
- package/dist/development/src/core/TreeAugmenter.cjs +351 -0
- package/dist/development/src/core/TreeAugmenter.cjs.map +1 -0
- package/dist/development/src/core/TreeAugmenter.js +351 -0
- package/dist/development/src/core/TreeAugmenter.js.map +1 -0
- package/dist/development/src/core/TreeStore.cjs +172 -0
- package/dist/development/src/core/TreeStore.cjs.map +1 -0
- package/dist/development/src/core/TreeStore.js +172 -0
- package/dist/development/src/core/TreeStore.js.map +1 -0
- package/dist/development/src/core/exceptions/ErrorLocator.cjs +59 -0
- package/dist/development/src/core/exceptions/ErrorLocator.cjs.map +1 -0
- package/dist/development/src/core/exceptions/ErrorLocator.js +59 -0
- package/dist/development/src/core/exceptions/ErrorLocator.js.map +1 -0
- package/dist/development/src/core/exceptions/MarkerSugarer.cjs +51 -0
- package/dist/development/src/core/exceptions/MarkerSugarer.cjs.map +1 -0
- package/dist/development/src/core/exceptions/MarkerSugarer.js +51 -0
- package/dist/development/src/core/exceptions/MarkerSugarer.js.map +1 -0
- package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs +33 -0
- package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
- package/dist/development/src/core/exceptions/TreeParameterSugarer.js +33 -0
- package/dist/development/src/core/exceptions/TreeParameterSugarer.js.map +1 -0
- package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs +23 -0
- package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
- package/dist/development/src/core/factories/createBatchUpdatesOptions.js +23 -0
- package/dist/development/src/core/factories/createBatchUpdatesOptions.js.map +1 -0
- package/dist/development/src/core/operations/EntityOperations.cjs +224 -0
- package/dist/development/src/core/operations/EntityOperations.cjs.map +1 -0
- package/dist/development/src/core/operations/EntityOperations.js +224 -0
- package/dist/development/src/core/operations/EntityOperations.js.map +1 -0
- package/dist/development/src/core/operations/FieldOperations.cjs +92 -0
- package/dist/development/src/core/operations/FieldOperations.cjs.map +1 -0
- package/dist/development/src/core/operations/FieldOperations.js +92 -0
- package/dist/development/src/core/operations/FieldOperations.js.map +1 -0
- package/dist/development/src/core/operations/ListOperations.cjs +158 -0
- package/dist/development/src/core/operations/ListOperations.cjs.map +1 -0
- package/dist/development/src/core/operations/ListOperations.js +158 -0
- package/dist/development/src/core/operations/ListOperations.js.map +1 -0
- package/dist/development/src/core/operations/OperationsHelpers.cjs +87 -0
- package/dist/development/src/core/operations/OperationsHelpers.cjs.map +1 -0
- package/dist/development/src/core/operations/OperationsHelpers.js +87 -0
- package/dist/development/src/core/operations/OperationsHelpers.js.map +1 -0
- package/dist/development/src/core/requestAliases/MutationAlias.cjs +14 -0
- package/dist/development/src/core/requestAliases/MutationAlias.cjs.map +1 -0
- package/dist/development/src/core/requestAliases/MutationAlias.js +14 -0
- package/dist/development/src/core/requestAliases/MutationAlias.js.map +1 -0
- package/dist/development/src/core/state/StateIterator.cjs +100 -0
- package/dist/development/src/core/state/StateIterator.cjs.map +1 -0
- package/dist/development/src/core/state/StateIterator.js +100 -0
- package/dist/development/src/core/state/StateIterator.js.map +1 -0
- package/dist/development/src/core/state/getEntityMarker.cjs +5 -0
- package/dist/development/src/core/state/getEntityMarker.cjs.map +1 -0
- package/dist/development/src/core/state/getEntityMarker.js +5 -0
- package/dist/development/src/core/state/getEntityMarker.js.map +1 -0
- package/dist/development/src/core/utils/getCombinedSignal.cjs +33 -0
- package/dist/development/src/core/utils/getCombinedSignal.cjs.map +1 -0
- package/dist/development/src/core/utils/getCombinedSignal.js +33 -0
- package/dist/development/src/core/utils/getCombinedSignal.js.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs +13 -0
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.js +13 -0
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.js.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js +18 -0
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js +16 -0
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -0
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js +7 -0
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js.map +1 -0
- package/dist/development/src/utils/isEmptyObject.cjs +12 -0
- package/dist/development/src/utils/isEmptyObject.cjs.map +1 -0
- package/dist/development/src/utils/isEmptyObject.js +12 -0
- package/dist/development/src/utils/isEmptyObject.js.map +1 -0
- package/dist/production/index.cjs +34 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +28 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/accessorTree/NormalizedPersistedData.cjs +10 -0
- package/dist/production/src/accessorTree/NormalizedPersistedData.cjs.map +1 -0
- package/dist/production/src/accessorTree/NormalizedPersistedData.js +10 -0
- package/dist/production/src/accessorTree/NormalizedPersistedData.js.map +1 -0
- package/dist/production/src/accessors/EntityAccessorImpl.cjs +179 -0
- package/dist/production/src/accessors/EntityAccessorImpl.cjs.map +1 -0
- package/dist/production/src/accessors/EntityAccessorImpl.js +179 -0
- package/dist/production/src/accessors/EntityAccessorImpl.js.map +1 -0
- package/dist/production/src/accessors/EntityListAccessorImpl.cjs +112 -0
- package/dist/production/src/accessors/EntityListAccessorImpl.cjs.map +1 -0
- package/dist/production/src/accessors/EntityListAccessorImpl.js +112 -0
- package/dist/production/src/accessors/EntityListAccessorImpl.js.map +1 -0
- package/dist/production/src/accessors/FieldAccessorImpl.cjs +54 -0
- package/dist/production/src/accessors/FieldAccessorImpl.cjs.map +1 -0
- package/dist/production/src/accessors/FieldAccessorImpl.js +54 -0
- package/dist/production/src/accessors/FieldAccessorImpl.js.map +1 -0
- package/dist/production/src/core/AccessorErrorManager.cjs +200 -0
- package/dist/production/src/core/AccessorErrorManager.cjs.map +1 -0
- package/dist/production/src/core/AccessorErrorManager.js +200 -0
- package/dist/production/src/core/AccessorErrorManager.js.map +1 -0
- package/dist/production/src/core/Config.cjs +29 -0
- package/dist/production/src/core/Config.cjs.map +1 -0
- package/dist/production/src/core/Config.js +29 -0
- package/dist/production/src/core/Config.js.map +1 -0
- package/dist/production/src/core/DataBinding.cjs +357 -0
- package/dist/production/src/core/DataBinding.cjs.map +1 -0
- package/dist/production/src/core/DataBinding.js +357 -0
- package/dist/production/src/core/DataBinding.js.map +1 -0
- package/dist/production/src/core/DirtinessTracker.cjs +26 -0
- package/dist/production/src/core/DirtinessTracker.cjs.map +1 -0
- package/dist/production/src/core/DirtinessTracker.js +26 -0
- package/dist/production/src/core/DirtinessTracker.js.map +1 -0
- package/dist/production/src/core/ErrorsPreprocessor.cjs +180 -0
- package/dist/production/src/core/ErrorsPreprocessor.cjs.map +1 -0
- package/dist/production/src/core/ErrorsPreprocessor.js +180 -0
- package/dist/production/src/core/ErrorsPreprocessor.js.map +1 -0
- package/dist/production/src/core/EventManager.cjs +413 -0
- package/dist/production/src/core/EventManager.cjs.map +1 -0
- package/dist/production/src/core/EventManager.js +413 -0
- package/dist/production/src/core/EventManager.js.map +1 -0
- package/dist/production/src/core/MutationGenerator.cjs +670 -0
- package/dist/production/src/core/MutationGenerator.cjs.map +1 -0
- package/dist/production/src/core/MutationGenerator.js +670 -0
- package/dist/production/src/core/MutationGenerator.js.map +1 -0
- package/dist/production/src/core/QueryGenerator.cjs +110 -0
- package/dist/production/src/core/QueryGenerator.cjs.map +1 -0
- package/dist/production/src/core/QueryGenerator.js +110 -0
- package/dist/production/src/core/QueryGenerator.js.map +1 -0
- package/dist/production/src/core/RealmKeyGenerator.cjs +42 -0
- package/dist/production/src/core/RealmKeyGenerator.cjs.map +1 -0
- package/dist/production/src/core/RealmKeyGenerator.js +42 -0
- package/dist/production/src/core/RealmKeyGenerator.js.map +1 -0
- package/dist/production/src/core/RequestResponseNormalizer.cjs +136 -0
- package/dist/production/src/core/RequestResponseNormalizer.cjs.map +1 -0
- package/dist/production/src/core/RequestResponseNormalizer.js +136 -0
- package/dist/production/src/core/RequestResponseNormalizer.js.map +1 -0
- package/dist/production/src/core/StateInitializer.cjs +379 -0
- package/dist/production/src/core/StateInitializer.cjs.map +1 -0
- package/dist/production/src/core/StateInitializer.js +379 -0
- package/dist/production/src/core/StateInitializer.js.map +1 -0
- package/dist/production/src/core/TreeAugmenter.cjs +351 -0
- package/dist/production/src/core/TreeAugmenter.cjs.map +1 -0
- package/dist/production/src/core/TreeAugmenter.js +351 -0
- package/dist/production/src/core/TreeAugmenter.js.map +1 -0
- package/dist/production/src/core/TreeStore.cjs +172 -0
- package/dist/production/src/core/TreeStore.cjs.map +1 -0
- package/dist/production/src/core/TreeStore.js +172 -0
- package/dist/production/src/core/TreeStore.js.map +1 -0
- package/dist/production/src/core/exceptions/ErrorLocator.cjs +59 -0
- package/dist/production/src/core/exceptions/ErrorLocator.cjs.map +1 -0
- package/dist/production/src/core/exceptions/ErrorLocator.js +59 -0
- package/dist/production/src/core/exceptions/ErrorLocator.js.map +1 -0
- package/dist/production/src/core/exceptions/MarkerSugarer.cjs +51 -0
- package/dist/production/src/core/exceptions/MarkerSugarer.cjs.map +1 -0
- package/dist/production/src/core/exceptions/MarkerSugarer.js +51 -0
- package/dist/production/src/core/exceptions/MarkerSugarer.js.map +1 -0
- package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs +33 -0
- package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
- package/dist/production/src/core/exceptions/TreeParameterSugarer.js +33 -0
- package/dist/production/src/core/exceptions/TreeParameterSugarer.js.map +1 -0
- package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs +23 -0
- package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
- package/dist/production/src/core/factories/createBatchUpdatesOptions.js +23 -0
- package/dist/production/src/core/factories/createBatchUpdatesOptions.js.map +1 -0
- package/dist/production/src/core/operations/EntityOperations.cjs +224 -0
- package/dist/production/src/core/operations/EntityOperations.cjs.map +1 -0
- package/dist/production/src/core/operations/EntityOperations.js +224 -0
- package/dist/production/src/core/operations/EntityOperations.js.map +1 -0
- package/dist/production/src/core/operations/FieldOperations.cjs +73 -0
- package/dist/production/src/core/operations/FieldOperations.cjs.map +1 -0
- package/dist/production/src/core/operations/FieldOperations.js +73 -0
- package/dist/production/src/core/operations/FieldOperations.js.map +1 -0
- package/dist/production/src/core/operations/ListOperations.cjs +158 -0
- package/dist/production/src/core/operations/ListOperations.cjs.map +1 -0
- package/dist/production/src/core/operations/ListOperations.js +158 -0
- package/dist/production/src/core/operations/ListOperations.js.map +1 -0
- package/dist/production/src/core/operations/OperationsHelpers.cjs +87 -0
- package/dist/production/src/core/operations/OperationsHelpers.cjs.map +1 -0
- package/dist/production/src/core/operations/OperationsHelpers.js +87 -0
- package/dist/production/src/core/operations/OperationsHelpers.js.map +1 -0
- package/dist/production/src/core/requestAliases/MutationAlias.cjs +14 -0
- package/dist/production/src/core/requestAliases/MutationAlias.cjs.map +1 -0
- package/dist/production/src/core/requestAliases/MutationAlias.js +14 -0
- package/dist/production/src/core/requestAliases/MutationAlias.js.map +1 -0
- package/dist/production/src/core/state/StateIterator.cjs +100 -0
- package/dist/production/src/core/state/StateIterator.cjs.map +1 -0
- package/dist/production/src/core/state/StateIterator.js +100 -0
- package/dist/production/src/core/state/StateIterator.js.map +1 -0
- package/dist/production/src/core/state/getEntityMarker.cjs +5 -0
- package/dist/production/src/core/state/getEntityMarker.cjs.map +1 -0
- package/dist/production/src/core/state/getEntityMarker.js +5 -0
- package/dist/production/src/core/state/getEntityMarker.js.map +1 -0
- package/dist/production/src/core/utils/getCombinedSignal.cjs +33 -0
- package/dist/production/src/core/utils/getCombinedSignal.cjs.map +1 -0
- package/dist/production/src/core/utils/getCombinedSignal.js +33 -0
- package/dist/production/src/core/utils/getCombinedSignal.js.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs +13 -0
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.js +13 -0
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.js.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js +18 -0
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js +16 -0
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -0
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js +7 -0
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js.map +1 -0
- package/dist/production/src/utils/isEmptyObject.cjs +12 -0
- package/dist/production/src/utils/isEmptyObject.cjs.map +1 -0
- package/dist/production/src/utils/isEmptyObject.js +12 -0
- package/dist/production/src/utils/isEmptyObject.js.map +1 -0
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts +18 -0
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -0
- package/dist/types/accessorTree/index.d.ts +2 -0
- package/dist/types/accessorTree/index.d.ts.map +1 -0
- package/dist/types/accessors/BindingConfig.d.ts +6 -0
- package/dist/types/accessors/BindingConfig.d.ts.map +1 -0
- package/dist/types/accessors/EntityAccessorImpl.d.ts +56 -0
- package/dist/types/accessors/EntityAccessorImpl.d.ts.map +1 -0
- package/dist/types/accessors/EntityListAccessorImpl.d.ts +57 -0
- package/dist/types/accessors/EntityListAccessorImpl.d.ts.map +1 -0
- package/dist/types/accessors/FieldAccessorImpl.d.ts +32 -0
- package/dist/types/accessors/FieldAccessorImpl.d.ts.map +1 -0
- package/dist/types/accessors/index.d.ts +5 -0
- package/dist/types/accessors/index.d.ts.map +1 -0
- package/dist/types/core/AccessorErrorManager.d.ts +25 -0
- package/dist/types/core/AccessorErrorManager.d.ts.map +1 -0
- package/dist/types/core/Config.d.ts +9 -0
- package/dist/types/core/Config.d.ts.map +1 -0
- package/dist/types/core/DataBinding.d.ts +54 -0
- package/dist/types/core/DataBinding.d.ts.map +1 -0
- package/dist/types/core/DirtinessTracker.d.ts +9 -0
- package/dist/types/core/DirtinessTracker.d.ts.map +1 -0
- package/dist/types/core/ErrorsPreprocessor.d.ts +34 -0
- package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -0
- package/dist/types/core/EventManager.d.ts +57 -0
- package/dist/types/core/EventManager.d.ts.map +1 -0
- package/dist/types/core/MutationGenerator.d.ts +49 -0
- package/dist/types/core/MutationGenerator.d.ts.map +1 -0
- package/dist/types/core/QueryGenerator.d.ts +13 -0
- package/dist/types/core/QueryGenerator.d.ts.map +1 -0
- package/dist/types/core/RealmKeyGenerator.d.ts +10 -0
- package/dist/types/core/RealmKeyGenerator.d.ts.map +1 -0
- package/dist/types/core/RequestResponseNormalizer.d.ts +11 -0
- package/dist/types/core/RequestResponseNormalizer.d.ts.map +1 -0
- package/dist/types/core/StateInitializer.d.ts +34 -0
- package/dist/types/core/StateInitializer.d.ts.map +1 -0
- package/dist/types/core/TreeAugmenter.d.ts +25 -0
- package/dist/types/core/TreeAugmenter.d.ts.map +1 -0
- package/dist/types/core/TreeStore.d.ts +30 -0
- package/dist/types/core/TreeStore.d.ts.map +1 -0
- package/dist/types/core/UpdateMetadata.d.ts +4 -0
- package/dist/types/core/UpdateMetadata.d.ts.map +1 -0
- package/dist/types/core/exceptions/ErrorLocator.d.ts +8 -0
- package/dist/types/core/exceptions/ErrorLocator.d.ts.map +1 -0
- package/dist/types/core/exceptions/MarkerSugarer.d.ts +10 -0
- package/dist/types/core/exceptions/MarkerSugarer.d.ts.map +1 -0
- package/dist/types/core/exceptions/TreeParameterSugarer.d.ts +11 -0
- package/dist/types/core/exceptions/TreeParameterSugarer.d.ts.map +1 -0
- package/dist/types/core/factories/createBatchUpdatesOptions.d.ts +5 -0
- package/dist/types/core/factories/createBatchUpdatesOptions.d.ts.map +1 -0
- package/dist/types/core/factories/index.d.ts +2 -0
- package/dist/types/core/factories/index.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +9 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/operations/EntityOperations.d.ts +26 -0
- package/dist/types/core/operations/EntityOperations.d.ts.map +1 -0
- package/dist/types/core/operations/FieldOperations.d.ts +22 -0
- package/dist/types/core/operations/FieldOperations.d.ts.map +1 -0
- package/dist/types/core/operations/ListOperations.d.ts +32 -0
- package/dist/types/core/operations/ListOperations.d.ts.map +1 -0
- package/dist/types/core/operations/OperationsHelpers.d.ts +14 -0
- package/dist/types/core/operations/OperationsHelpers.d.ts.map +1 -0
- package/dist/types/core/operations/index.d.ts +4 -0
- package/dist/types/core/operations/index.d.ts.map +1 -0
- package/dist/types/core/requestAliases/MutationAlias.d.ts +6 -0
- package/dist/types/core/requestAliases/MutationAlias.d.ts.map +1 -0
- package/dist/types/core/requestAliases/index.d.ts +2 -0
- package/dist/types/core/requestAliases/index.d.ts.map +1 -0
- package/dist/types/core/state/EntityListState.d.ts +29 -0
- package/dist/types/core/state/EntityListState.d.ts.map +1 -0
- package/dist/types/core/state/EntityRealmState.d.ts +44 -0
- package/dist/types/core/state/EntityRealmState.d.ts.map +1 -0
- package/dist/types/core/state/EntityState.d.ts +11 -0
- package/dist/types/core/state/EntityState.d.ts.map +1 -0
- package/dist/types/core/state/FieldState.d.ts +19 -0
- package/dist/types/core/state/FieldState.d.ts.map +1 -0
- package/dist/types/core/state/StateIterator.d.ts +14 -0
- package/dist/types/core/state/StateIterator.d.ts.map +1 -0
- package/dist/types/core/state/StateNode.d.ts +8 -0
- package/dist/types/core/state/StateNode.d.ts.map +1 -0
- package/dist/types/core/state/getEntityMarker.d.ts +3 -0
- package/dist/types/core/state/getEntityMarker.d.ts.map +1 -0
- package/dist/types/core/state/index.d.ts +8 -0
- package/dist/types/core/state/index.d.ts.map +1 -0
- package/dist/types/core/utils/getCombinedSignal.d.ts +2 -0
- package/dist/types/core/utils/getCombinedSignal.d.ts.map +1 -0
- package/dist/types/core/utils/index.d.ts +2 -0
- package/dist/types/core/utils/index.d.ts.map +1 -0
- package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts +7 -0
- package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts.map +1 -0
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +10 -0
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +1 -0
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +10 -0
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +1 -0
- package/dist/types/fieldHelpers/helpers/index.d.ts +3 -0
- package/dist/types/fieldHelpers/helpers/index.d.ts.map +1 -0
- package/dist/types/fieldHelpers/index.d.ts +2 -0
- package/dist/types/fieldHelpers/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/utils/assertNever.d.ts +2 -0
- package/dist/types/utils/assertNever.d.ts.map +1 -0
- package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts +2 -0
- package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/isEmptyObject.d.ts +2 -0
- package/dist/types/utils/isEmptyObject.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ErrorsPreprocessor } from "./ErrorsPreprocessor.js";
|
|
2
|
+
import { EventManager } from "./EventManager.js";
|
|
3
|
+
import { getEntityMarker } from "./state/getEntityMarker.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
class AccessorErrorManager {
|
|
8
|
+
constructor(eventManager, treeStore) {
|
|
9
|
+
this.eventManager = eventManager;
|
|
10
|
+
this.treeStore = treeStore;
|
|
11
|
+
__publicField(this, "errorsByState", /* @__PURE__ */ new Map());
|
|
12
|
+
__publicField(this, "getNewErrorId", /* @__PURE__ */ (() => {
|
|
13
|
+
let errorId = 1;
|
|
14
|
+
return () => errorId++;
|
|
15
|
+
})());
|
|
16
|
+
}
|
|
17
|
+
hasErrors() {
|
|
18
|
+
return !!this.errorsByState.size;
|
|
19
|
+
}
|
|
20
|
+
getErrors() {
|
|
21
|
+
return Array.from(this.errorsByState.values(), (it) => Array.from(it.values())).flat();
|
|
22
|
+
}
|
|
23
|
+
clearErrors() {
|
|
24
|
+
this.eventManager.syncOperation(() => {
|
|
25
|
+
for (const [stateNode] of this.errorsByState) {
|
|
26
|
+
stateNode.errors = void 0;
|
|
27
|
+
this.eventManager.registerJustUpdated(stateNode, EventManager.NO_CHANGES_DIFFERENCE);
|
|
28
|
+
}
|
|
29
|
+
this.errorsByState.clear();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
clearErrorsByState(state) {
|
|
33
|
+
return this.eventManager.syncOperation(() => {
|
|
34
|
+
if (!this.errorsByState.has(state)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.errorsByState.delete(state);
|
|
38
|
+
state.errors = void 0;
|
|
39
|
+
this.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
replaceErrors(data, operations) {
|
|
43
|
+
this.eventManager.syncOperation(() => {
|
|
44
|
+
this.clearErrors();
|
|
45
|
+
const preprocessor = new ErrorsPreprocessor(data, operations);
|
|
46
|
+
const errorTreeRoot = preprocessor.preprocess();
|
|
47
|
+
this.setRootStateErrors(errorTreeRoot);
|
|
48
|
+
this.dumpErrorData(data);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
addError(state, error) {
|
|
52
|
+
return this.eventManager.syncOperation(() => {
|
|
53
|
+
const errorId = this.getNewErrorId();
|
|
54
|
+
let errorsById = this.errorsByState.get(state);
|
|
55
|
+
if (errorsById === void 0) {
|
|
56
|
+
this.errorsByState.set(state, errorsById = /* @__PURE__ */ new Map());
|
|
57
|
+
}
|
|
58
|
+
errorsById.set(errorId, error);
|
|
59
|
+
state.errors = { errors: Array.from(errorsById.values()) };
|
|
60
|
+
this.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE);
|
|
61
|
+
return () => this.eventManager.syncOperation(() => {
|
|
62
|
+
const errorsById2 = this.errorsByState.get(state);
|
|
63
|
+
if (errorsById2 === void 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
errorsById2.delete(errorId);
|
|
67
|
+
if (errorsById2.size) {
|
|
68
|
+
state.errors = { errors: Array.from(errorsById2.values()) };
|
|
69
|
+
} else {
|
|
70
|
+
state.errors = void 0;
|
|
71
|
+
this.errorsByState.delete(state);
|
|
72
|
+
}
|
|
73
|
+
this.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
addSeveralErrors(state, errors) {
|
|
78
|
+
if (errors.validation) {
|
|
79
|
+
for (const error of errors.validation) {
|
|
80
|
+
this.addError(state, error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (errors.execution) {
|
|
84
|
+
for (const error of errors.execution) {
|
|
85
|
+
this.addError(state, error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
setRootStateErrors(errorTreeRoot) {
|
|
90
|
+
for (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {
|
|
91
|
+
for (const [subTreePlaceholder, rootError] of errorTreeRoot) {
|
|
92
|
+
const rootState = rootStates.get(subTreePlaceholder);
|
|
93
|
+
if (!rootState) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
switch (rootState.type) {
|
|
97
|
+
case "entityRealm": {
|
|
98
|
+
this.setEntityStateErrors(rootState, rootError);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case "entityList": {
|
|
102
|
+
this.setEntityListStateErrors(rootState, rootError);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
setEntityStateErrors(state, errors) {
|
|
110
|
+
this.addSeveralErrors(state, errors);
|
|
111
|
+
if (errors.nodeType !== "iNode") {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
for (const [childKey, child] of errors.children) {
|
|
115
|
+
if (typeof childKey !== "string") {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (child.nodeType === "leaf") {
|
|
119
|
+
const fieldState = state.children.get(childKey);
|
|
120
|
+
if (fieldState?.type === "field") {
|
|
121
|
+
this.addSeveralErrors(fieldState, child);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const fields = getEntityMarker(state).fields;
|
|
126
|
+
const placeholders = fields.placeholders.get(childKey);
|
|
127
|
+
if (placeholders === void 0) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const normalizedPlaceholders = typeof placeholders === "string" ? /* @__PURE__ */ new Set([placeholders]) : placeholders;
|
|
131
|
+
for (const normalizedPlaceholder of normalizedPlaceholders) {
|
|
132
|
+
const fieldState = state.children.get(normalizedPlaceholder);
|
|
133
|
+
if (fieldState === void 0) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
switch (fieldState.type) {
|
|
137
|
+
case "entityRealm":
|
|
138
|
+
if (child.nodeType === "iNode" && child.children.has(fieldState.entity.id.value)) {
|
|
139
|
+
this.setEntityStateErrors(fieldState, child.children.get(fieldState.entity.id.value));
|
|
140
|
+
} else {
|
|
141
|
+
this.setEntityStateErrors(fieldState, child);
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "entityList":
|
|
145
|
+
this.setEntityListStateErrors(fieldState, child);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
setEntityListStateErrors(state, errors) {
|
|
152
|
+
this.addSeveralErrors(state, errors);
|
|
153
|
+
if (errors.nodeType !== "iNode") {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
for (const [childKey, childError] of errors.children) {
|
|
157
|
+
let childState = state.children.get(childKey);
|
|
158
|
+
if (childState === void 0) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (childState.type === "entityRealmStub") {
|
|
162
|
+
childState.getAccessor();
|
|
163
|
+
childState = state.children.get(childKey);
|
|
164
|
+
}
|
|
165
|
+
if (childError.nodeType === "iNode") {
|
|
166
|
+
this.setEntityStateErrors(childState, childError);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
dumpErrorData(data) {
|
|
171
|
+
for (const subTreePlaceholder in data.data) {
|
|
172
|
+
const treeDatum = data.data[subTreePlaceholder];
|
|
173
|
+
const executionErrors = treeDatum.errors;
|
|
174
|
+
const allErrors = treeDatum?.validation?.errors ? executionErrors.concat(treeDatum.validation.errors) : executionErrors;
|
|
175
|
+
const normalizedErrors = allErrors.map((error) => {
|
|
176
|
+
const path = "paths" in error ? error.paths[0] ?? [] : error.path;
|
|
177
|
+
return {
|
|
178
|
+
path: path.map((pathPart) => {
|
|
179
|
+
if ("field" in pathPart) {
|
|
180
|
+
return pathPart.field;
|
|
181
|
+
}
|
|
182
|
+
if (pathPart.alias) {
|
|
183
|
+
return `#${pathPart.index}(${pathPart.alias})`;
|
|
184
|
+
}
|
|
185
|
+
return pathPart.index;
|
|
186
|
+
}).join("."),
|
|
187
|
+
type: "type" in error ? error.type : void 0,
|
|
188
|
+
message: typeof error.message === "string" ? error.message : error.message?.text
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
if (Object.keys(normalizedErrors).length) {
|
|
192
|
+
console.table(normalizedErrors);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
AccessorErrorManager
|
|
199
|
+
};
|
|
200
|
+
//# sourceMappingURL=AccessorErrorManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessorErrorManager.js","sources":["../../../../../packages/binding-legacy/src/core/AccessorErrorManager.ts"],"sourcesContent":["import { ErrorAccessor } from '@contember/binding-common'\nimport { ErrorsPreprocessor } from './ErrorsPreprocessor'\nimport { EventManager } from './EventManager'\nimport { EntityListState, EntityRealmState, getEntityMarker, StateNode } from './state'\nimport type { TreeStore } from './TreeStore'\nimport { SubMutationOperation } from './MutationGenerator'\nimport { DataBindingTransactionResult } from '@contember/binding-common'\nimport { MutationError, ValidationError } from '@contember/client'\n\nexport class AccessorErrorManager {\n\tprivate errorsByState: Map<StateNode, ErrorAccessor.ErrorsById> = new Map()\n\n\tprivate getNewErrorId = (() => {\n\t\tlet errorId = 1\n\n\t\treturn () => errorId++\n\t})()\n\n\tpublic constructor(private readonly eventManager: EventManager, private readonly treeStore: TreeStore) {}\n\n\tpublic hasErrors() {\n\t\treturn !!this.errorsByState.size\n\t}\n\n\tpublic getErrors(): ErrorAccessor.Error[] {\n\t\treturn Array.from(this.errorsByState.values(), it => Array.from(it.values())).flat()\n\t}\n\n\tpublic clearErrors() {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tfor (const [stateNode] of this.errorsByState) {\n\t\t\t\tstateNode.errors = undefined\n\t\t\t\tthis.eventManager.registerJustUpdated(stateNode, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\tthis.errorsByState.clear()\n\t\t})\n\t}\n\n\tpublic clearErrorsByState(state: StateNode): void {\n\t\treturn this.eventManager.syncOperation(() => {\n\t\t\tif (!this.errorsByState.has(state)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.errorsByState.delete(state)\n\t\t\tstate.errors = undefined\n\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t})\n\t}\n\n\tpublic replaceErrors(data: DataBindingTransactionResult, operations: SubMutationOperation[]) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tthis.clearErrors()\n\n\t\t\tconst preprocessor = new ErrorsPreprocessor(data, operations)\n\t\t\tconst errorTreeRoot = preprocessor.preprocess()\n\n\t\t\tthis.setRootStateErrors(errorTreeRoot)\n\n\t\t\tthis.dumpErrorData(data)\n\t\t})\n\t}\n\n\tpublic addError(state: StateNode, error: ErrorAccessor.Error): () => void {\n\t\treturn this.eventManager.syncOperation(() => {\n\t\t\tconst errorId = this.getNewErrorId()\n\n\t\t\tlet errorsById: ErrorAccessor.ErrorsById | undefined = this.errorsByState.get(state)\n\t\t\tif (errorsById === undefined) {\n\t\t\t\tthis.errorsByState.set(state, errorsById = new Map())\n\t\t\t}\n\t\t\terrorsById.set(errorId, error)\n\t\t\tstate.errors = { errors: Array.from(errorsById.values()) }\n\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\n\t\t\treturn () =>\n\t\t\t\tthis.eventManager.syncOperation(() => {\n\t\t\t\t\tconst errorsById = this.errorsByState.get(state)\n\t\t\t\t\tif (errorsById === undefined) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\terrorsById.delete(errorId)\n\t\t\t\t\tif (errorsById.size) {\n\t\t\t\t\t\tstate.errors = { errors: Array.from(errorsById.values()) }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate.errors = undefined\n\t\t\t\t\t\tthis.errorsByState.delete(state)\n\t\t\t\t\t}\n\t\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t\t})\n\t\t})\n\t}\n\n\tprivate addSeveralErrors(state: StateNode, errors: ErrorsPreprocessor.BaseErrorNode) {\n\t\tif (errors.validation) {\n\t\t\tfor (const error of errors.validation) {\n\t\t\t\tthis.addError(state, error)\n\t\t\t}\n\t\t}\n\t\tif (errors.execution) {\n\t\t\tfor (const error of errors.execution) {\n\t\t\t\tthis.addError(state, error)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setRootStateErrors(errorTreeRoot: ErrorsPreprocessor.ErrorTreeRoot) {\n\t\tfor (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {\n\t\t\tfor (const [subTreePlaceholder, rootError] of errorTreeRoot) {\n\t\t\t\tconst rootState = rootStates.get(subTreePlaceholder)\n\n\t\t\t\tif (!rootState) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tswitch (rootState.type) {\n\t\t\t\t\tcase 'entityRealm': {\n\t\t\t\t\t\tthis.setEntityStateErrors(rootState, rootError)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase 'entityList': {\n\t\t\t\t\t\tthis.setEntityListStateErrors(rootState, rootError)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setEntityStateErrors(\n\t\tstate: EntityRealmState,\n\t\terrors: ErrorsPreprocessor.ErrorINode | ErrorsPreprocessor.LeafErrorNode,\n\t) {\n\t\tthis.addSeveralErrors(state, errors)\n\n\t\tif (errors.nodeType !== 'iNode') {\n\t\t\treturn\n\t\t}\n\n\t\tfor (const [childKey, child] of errors.children) {\n\t\t\tif (typeof childKey !== 'string') {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.nodeType === 'leaf') {\n\t\t\t\tconst fieldState = state.children.get(childKey)\n\n\t\t\t\tif (fieldState?.type === 'field') {\n\t\t\t\t\tthis.addSeveralErrors(fieldState, child)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Deliberately letting flow get here as well. Leaf errors *CAN* refer to relations as well.\n\n\t\t\tconst fields = getEntityMarker(state).fields\n\t\t\tconst placeholders = fields.placeholders.get(childKey)\n\t\t\tif (placeholders === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst normalizedPlaceholders = typeof placeholders === 'string' ? new Set([placeholders]) : placeholders\n\n\t\t\tfor (const normalizedPlaceholder of normalizedPlaceholders) {\n\t\t\t\tconst fieldState = state.children.get(normalizedPlaceholder)\n\t\t\t\tif (fieldState === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tswitch (fieldState.type) {\n\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\t// unwrap for reduced has many\n\t\t\t\t\t\tif (child.nodeType === 'iNode' && child.children.has(fieldState.entity.id.value)) {\n\t\t\t\t\t\t\tthis.setEntityStateErrors(fieldState, child.children.get(fieldState.entity.id.value)!)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.setEntityStateErrors(fieldState, child)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\tthis.setEntityListStateErrors(fieldState, child)\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setEntityListStateErrors(\n\t\tstate: EntityListState,\n\t\terrors: ErrorsPreprocessor.ErrorINode | ErrorsPreprocessor.LeafErrorNode,\n\t) {\n\t\tthis.addSeveralErrors(state, errors)\n\n\t\tif (errors.nodeType !== 'iNode') {\n\t\t\treturn\n\t\t}\n\n\t\tfor (const [childKey, childError] of errors.children) {\n\t\t\tlet childState = state.children.get(childKey)\n\n\t\t\tif (childState === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (childState.type === 'entityRealmStub') {\n\t\t\t\tchildState.getAccessor() // Force init\n\t\t\t\tchildState = state.children.get(childKey)!\n\t\t\t}\n\n\t\t\tif (childError.nodeType === 'iNode') {\n\t\t\t\tthis.setEntityStateErrors(childState as EntityRealmState, childError)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate dumpErrorData(data: DataBindingTransactionResult) {\n\t\t// TODO this is just temporary\n\t\tfor (const subTreePlaceholder in data.data) {\n\t\t\tconst treeDatum = data.data[subTreePlaceholder]\n\t\t\tconst executionErrors: Array<MutationError | ValidationError> = treeDatum.errors\n\t\t\tconst allErrors = treeDatum?.validation?.errors\n\t\t\t\t? executionErrors.concat(treeDatum.validation.errors)\n\t\t\t\t: executionErrors\n\t\t\tconst normalizedErrors = allErrors.map((error: MutationError | ValidationError) => {\n\t\t\t\tconst path = 'paths' in error ? (error.paths[0] ?? []) : error.path\n\t\t\t\treturn {\n\t\t\t\t\tpath: path\n\t\t\t\t\t\t.map(pathPart => {\n\t\t\t\t\t\t\tif ('field' in pathPart) {\n\t\t\t\t\t\t\t\treturn pathPart.field\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (pathPart.alias) {\n\t\t\t\t\t\t\t\treturn `#${pathPart.index}(${pathPart.alias})`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn pathPart.index\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join('.'),\n\t\t\t\t\ttype: 'type' in error ? error.type : undefined,\n\t\t\t\t\tmessage: typeof error.message === 'string' ? error.message : error.message?.text,\n\t\t\t\t}\n\t\t\t})\n\t\t\tif (Object.keys(normalizedErrors).length) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: debug output\n\t\t\t\tconsole.table(normalizedErrors)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["errorsById"],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
const _Config = class _Config2 {
|
|
7
|
+
constructor(config = {}) {
|
|
8
|
+
__publicField(this, "config");
|
|
9
|
+
this.config = {
|
|
10
|
+
..._Config2.defaultConfig,
|
|
11
|
+
...config
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getValue(name) {
|
|
15
|
+
return this.config[name];
|
|
16
|
+
}
|
|
17
|
+
setValue(name, value) {
|
|
18
|
+
this.config[name] = value;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__publicField(_Config, "defaultConfig", {
|
|
23
|
+
beforePersistSettleLimit: 20,
|
|
24
|
+
beforeUpdateSettleLimit: 20,
|
|
25
|
+
persistSuccessSettleLimit: 20
|
|
26
|
+
});
|
|
27
|
+
let Config = _Config;
|
|
28
|
+
exports.Config = Config;
|
|
29
|
+
//# sourceMappingURL=Config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.cjs","sources":["../../../../../packages/binding-legacy/src/core/Config.ts"],"sourcesContent":["import type { BindingConfig } from '../accessors'\n\nexport class Config {\n\tprivate static defaultConfig: BindingConfig = {\n\t\tbeforePersistSettleLimit: 20,\n\t\tbeforeUpdateSettleLimit: 20,\n\t\tpersistSuccessSettleLimit: 20,\n\t}\n\n\tprivate readonly config: BindingConfig\n\n\tpublic constructor(config: Partial<BindingConfig> = {}) {\n\t\tthis.config = {\n\t\t\t...Config.defaultConfig,\n\t\t\t...config,\n\t\t}\n\t}\n\n\tpublic getValue<Name extends keyof BindingConfig>(name: Name): BindingConfig[Name] {\n\t\treturn this.config[name]\n\t}\n\n\tpublic setValue<Name extends keyof BindingConfig>(name: Name, value: BindingConfig[Name]): this {\n\t\tthis.config[name] = value\n\t\treturn this\n\t}\n}\n"],"names":["_Config"],"mappings":";;;;;AAEO,MAAM,UAAN,MAAMA,SAAO;AAAA,EASZ,YAAY,SAAiC,IAAI;AAFxD,kBAAA,MAAiB,QAAA;AAGhB,SAAK,SAAS;AAAA,MACb,GAAGA,SAAO;AAAA,MACV,GAAG;AAAA,IAAA;AAAA,EAEL;AAAA,EAEO,SAA2C,MAAiC;AAClF,WAAO,KAAK,OAAO,IAAI;AAAA,EACxB;AAAA,EAEO,SAA2C,MAAY,OAAkC;AAC/F,SAAK,OAAO,IAAI,IAAI;AACpB,WAAO;AAAA,EACR;AACD;AAvBC,cADY,SACG,iBAA+B;AAAA,EAC7C,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,2BAA2B;AAC5B,CAAA;AALM,IAAM,SAAN;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
const _Config = class _Config2 {
|
|
5
|
+
constructor(config = {}) {
|
|
6
|
+
__publicField(this, "config");
|
|
7
|
+
this.config = {
|
|
8
|
+
..._Config2.defaultConfig,
|
|
9
|
+
...config
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
getValue(name) {
|
|
13
|
+
return this.config[name];
|
|
14
|
+
}
|
|
15
|
+
setValue(name, value) {
|
|
16
|
+
this.config[name] = value;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__publicField(_Config, "defaultConfig", {
|
|
21
|
+
beforePersistSettleLimit: 20,
|
|
22
|
+
beforeUpdateSettleLimit: 20,
|
|
23
|
+
persistSuccessSettleLimit: 20
|
|
24
|
+
});
|
|
25
|
+
let Config = _Config;
|
|
26
|
+
export {
|
|
27
|
+
Config
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sources":["../../../../../packages/binding-legacy/src/core/Config.ts"],"sourcesContent":["import type { BindingConfig } from '../accessors'\n\nexport class Config {\n\tprivate static defaultConfig: BindingConfig = {\n\t\tbeforePersistSettleLimit: 20,\n\t\tbeforeUpdateSettleLimit: 20,\n\t\tpersistSuccessSettleLimit: 20,\n\t}\n\n\tprivate readonly config: BindingConfig\n\n\tpublic constructor(config: Partial<BindingConfig> = {}) {\n\t\tthis.config = {\n\t\t\t...Config.defaultConfig,\n\t\t\t...config,\n\t\t}\n\t}\n\n\tpublic getValue<Name extends keyof BindingConfig>(name: Name): BindingConfig[Name] {\n\t\treturn this.config[name]\n\t}\n\n\tpublic setValue<Name extends keyof BindingConfig>(name: Name, value: BindingConfig[Name]): this {\n\t\tthis.config[name] = value\n\t\treturn this\n\t}\n}\n"],"names":["_Config"],"mappings":";;;AAEO,MAAM,UAAN,MAAMA,SAAO;AAAA,EASZ,YAAY,SAAiC,IAAI;AAFxD,kBAAA,MAAiB,QAAA;AAGhB,SAAK,SAAS;AAAA,MACb,GAAGA,SAAO;AAAA,MACV,GAAG;AAAA,IAAA;AAAA,EAEL;AAAA,EAEO,SAA2C,MAAiC;AAClF,WAAO,KAAK,OAAO,IAAI;AAAA,EACxB;AAAA,EAEO,SAA2C,MAAY,OAAkC;AAC/F,SAAK,OAAO,IAAI,IAAI;AACpB,WAAO;AAAA,EACR;AACD;AAvBC,cADY,SACG,iBAA+B;AAAA,EAC7C,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,2BAA2B;AAC5B,CAAA;AALM,IAAM,SAAN;"}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const client = require("@contember/client");
|
|
4
|
+
const bindingCommon = require("@contember/binding-common");
|
|
5
|
+
const AccessorErrorManager = require("./AccessorErrorManager.cjs");
|
|
6
|
+
const Config = require("./Config.cjs");
|
|
7
|
+
const DirtinessTracker = require("./DirtinessTracker.cjs");
|
|
8
|
+
const EventManager = require("./EventManager.cjs");
|
|
9
|
+
const MutationGenerator = require("./MutationGenerator.cjs");
|
|
10
|
+
const QueryGenerator = require("./QueryGenerator.cjs");
|
|
11
|
+
const StateInitializer = require("./StateInitializer.cjs");
|
|
12
|
+
const TreeAugmenter = require("./TreeAugmenter.cjs");
|
|
13
|
+
const createBatchUpdatesOptions = require("./factories/createBatchUpdatesOptions.cjs");
|
|
14
|
+
const getCombinedSignal = require("./utils/getCombinedSignal.cjs");
|
|
15
|
+
const generateEnumerabilityPreventingEntropy = require("../utils/generateEnumerabilityPreventingEntropy.cjs");
|
|
16
|
+
const StateIterator = require("./state/StateIterator.cjs");
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
20
|
+
const _DataBinding = class _DataBinding2 {
|
|
21
|
+
// private treeRootListeners: {
|
|
22
|
+
// eventListeners: {}
|
|
23
|
+
// } = {
|
|
24
|
+
// eventListeners: {},
|
|
25
|
+
// }
|
|
26
|
+
constructor(contentApiClient, systemApiClient, tenantApiClient, treeStore, environment, createMarkerTree, batchedUpdates, onUpdate, onError, onPersistSuccess, options) {
|
|
27
|
+
this.contentApiClient = contentApiClient;
|
|
28
|
+
this.systemApiClient = systemApiClient;
|
|
29
|
+
this.tenantApiClient = tenantApiClient;
|
|
30
|
+
this.treeStore = treeStore;
|
|
31
|
+
this.environment = environment;
|
|
32
|
+
this.createMarkerTree = createMarkerTree;
|
|
33
|
+
this.batchedUpdates = batchedUpdates;
|
|
34
|
+
this.onUpdate = onUpdate;
|
|
35
|
+
this.onError = onError;
|
|
36
|
+
this.onPersistSuccess = onPersistSuccess;
|
|
37
|
+
this.options = options;
|
|
38
|
+
__publicField(this, "accessorErrorManager");
|
|
39
|
+
__publicField(this, "batchUpdatesOptions");
|
|
40
|
+
__publicField(this, "asyncBatchUpdatesOptions");
|
|
41
|
+
__publicField(this, "bindingOperations");
|
|
42
|
+
__publicField(this, "config");
|
|
43
|
+
__publicField(this, "dirtinessTracker");
|
|
44
|
+
__publicField(this, "eventManager");
|
|
45
|
+
__publicField(this, "stateInitializer");
|
|
46
|
+
__publicField(this, "treeAugmenter");
|
|
47
|
+
__publicField(this, "queryBuilder");
|
|
48
|
+
__publicField(this, "contentClient");
|
|
49
|
+
__publicField(this, "eventListenerStore", new bindingCommon.EventListenersStore());
|
|
50
|
+
__publicField(this, "resolvedOnUpdate", ({ isMutating }) => {
|
|
51
|
+
this.onUpdate(new bindingCommon.TreeRootAccessor(this.dirtinessTracker.hasChanges(), isMutating, this.bindingOperations), this);
|
|
52
|
+
});
|
|
53
|
+
__publicField(this, "pendingExtensions", /* @__PURE__ */ new Set());
|
|
54
|
+
__publicField(this, "flushResult");
|
|
55
|
+
this.config = new Config.Config();
|
|
56
|
+
this.batchUpdatesOptions = createBatchUpdatesOptions.createBatchUpdatesOptions(environment, this.treeStore);
|
|
57
|
+
this.asyncBatchUpdatesOptions = {
|
|
58
|
+
...this.batchUpdatesOptions,
|
|
59
|
+
contentClient: contentApiClient,
|
|
60
|
+
systemClient: systemApiClient,
|
|
61
|
+
tenantClient: tenantApiClient
|
|
62
|
+
};
|
|
63
|
+
this.dirtinessTracker = new DirtinessTracker.DirtinessTracker();
|
|
64
|
+
this.eventManager = new EventManager.EventManager(
|
|
65
|
+
this.asyncBatchUpdatesOptions,
|
|
66
|
+
this.batchUpdatesOptions,
|
|
67
|
+
this.config,
|
|
68
|
+
this.dirtinessTracker,
|
|
69
|
+
this.resolvedOnUpdate,
|
|
70
|
+
this.treeStore,
|
|
71
|
+
this.batchedUpdates
|
|
72
|
+
);
|
|
73
|
+
this.accessorErrorManager = new AccessorErrorManager.AccessorErrorManager(this.eventManager, this.treeStore);
|
|
74
|
+
this.stateInitializer = new StateInitializer.StateInitializer(
|
|
75
|
+
this.accessorErrorManager,
|
|
76
|
+
this.batchUpdatesOptions,
|
|
77
|
+
this.eventManager,
|
|
78
|
+
this.treeStore
|
|
79
|
+
);
|
|
80
|
+
this.treeAugmenter = new TreeAugmenter.TreeAugmenter(this.eventManager, this.stateInitializer, this.treeStore, options.skipStateUpdateAfterPersist);
|
|
81
|
+
this.bindingOperations = Object.freeze({
|
|
82
|
+
...this.asyncBatchUpdatesOptions,
|
|
83
|
+
addEventListener: (type, listener) => this.eventListenerStore.add({ type }, listener),
|
|
84
|
+
batchDeferredUpdates: (performUpdates) => {
|
|
85
|
+
this.eventManager.syncTransaction(() => performUpdates(this.bindingOperations));
|
|
86
|
+
},
|
|
87
|
+
extendTree: async (...args) => await this.extendTree(...args),
|
|
88
|
+
persist: async (options2) => await this.persist(options2),
|
|
89
|
+
fetchData: async (...args) => await this.fetchData(...args)
|
|
90
|
+
});
|
|
91
|
+
this.queryBuilder = bindingCommon.createQueryBuilder(this.environment.getSchema());
|
|
92
|
+
this.contentClient = new client.ContentClient(contentApiClient);
|
|
93
|
+
}
|
|
94
|
+
async persist({ onPersistError, onPersistSuccess, signal } = {}) {
|
|
95
|
+
return await this.eventManager.persistOperation(async () => {
|
|
96
|
+
this.eventManager.syncTransaction(() => {
|
|
97
|
+
this.accessorErrorManager.clearErrors();
|
|
98
|
+
});
|
|
99
|
+
await this.eventManager.triggerOnBeforePersist();
|
|
100
|
+
await this.checkErrorsBeforePersist(onPersistError);
|
|
101
|
+
const mutationResult = MutationGenerator.MutationGenerator.getPersistMutation(this.treeStore, this.queryBuilder);
|
|
102
|
+
if (mutationResult.operations.length === 0) {
|
|
103
|
+
return await this.processEmptyPersistMutation(onPersistSuccess);
|
|
104
|
+
}
|
|
105
|
+
const { mutations, operations } = mutationResult;
|
|
106
|
+
let response;
|
|
107
|
+
try {
|
|
108
|
+
response = await this.contentClient.mutate(
|
|
109
|
+
this.queryBuilder.transaction(mutations, {
|
|
110
|
+
deferForeignKeyConstraints: true
|
|
111
|
+
}),
|
|
112
|
+
{
|
|
113
|
+
signal,
|
|
114
|
+
onBeforeRequest: ({ query, variables }) => {
|
|
115
|
+
console.debug(query, variables);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
if (e instanceof client.GraphQlClientError) {
|
|
121
|
+
this.onError(e, this);
|
|
122
|
+
throw await this.persistFail({
|
|
123
|
+
errors: [e],
|
|
124
|
+
type: "invalidResponse"
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (response.ok && Object.values(response.data).every((it) => it.ok)) {
|
|
131
|
+
return await this.processSuccessfulPersistResult(response, operations, onPersistSuccess);
|
|
132
|
+
} else {
|
|
133
|
+
if (response.errorMessage) {
|
|
134
|
+
console.debug(response.errorMessage);
|
|
135
|
+
}
|
|
136
|
+
this.eventManager.syncTransaction(() => this.accessorErrorManager.replaceErrors(response, operations));
|
|
137
|
+
await this.eventManager.triggerOnPersistError(this.bindingOperations);
|
|
138
|
+
await onPersistError?.(this.bindingOperations);
|
|
139
|
+
throw await this.persistFail({
|
|
140
|
+
errors: this.accessorErrorManager.getErrors(),
|
|
141
|
+
type: "invalidInput",
|
|
142
|
+
response
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async checkErrorsBeforePersist(onPersistError) {
|
|
148
|
+
if (this.accessorErrorManager.hasErrors()) {
|
|
149
|
+
await this.eventManager.triggerOnPersistError(this.bindingOperations);
|
|
150
|
+
await onPersistError?.(this.bindingOperations);
|
|
151
|
+
throw await this.persistFail({
|
|
152
|
+
errors: this.accessorErrorManager.getErrors(),
|
|
153
|
+
type: "invalidInput"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async processEmptyPersistMutation(onPersistSuccess) {
|
|
158
|
+
this.dirtinessTracker.reset();
|
|
159
|
+
const persistSuccessOptions = {
|
|
160
|
+
...this.bindingOperations,
|
|
161
|
+
successType: "nothingToPersist"
|
|
162
|
+
};
|
|
163
|
+
await this.eventManager.triggerOnPersistSuccess(persistSuccessOptions);
|
|
164
|
+
await onPersistSuccess?.(persistSuccessOptions);
|
|
165
|
+
const result = { type: "nothingToPersist" };
|
|
166
|
+
await this.eventListenerStore.invoke({ type: "persistSuccess" }, result);
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
async processSuccessfulPersistResult(mutationData, operations, onPersistSuccess) {
|
|
170
|
+
const persistedEntityIds = Object.values(mutationData.data).map((it) => it.node?.id).filter((id) => id !== void 0);
|
|
171
|
+
const result = {
|
|
172
|
+
type: "justSuccess",
|
|
173
|
+
persistedEntityIds
|
|
174
|
+
};
|
|
175
|
+
try {
|
|
176
|
+
await this.eventManager.asyncTransaction(async () => {
|
|
177
|
+
this.resetTreeAfterSuccessfulPersist();
|
|
178
|
+
this.treeAugmenter.updatePersistedData(
|
|
179
|
+
Object.fromEntries(
|
|
180
|
+
Object.entries(mutationData.data).map(([placeholderName, subTreeResponse]) => [
|
|
181
|
+
placeholderName,
|
|
182
|
+
subTreeResponse.node
|
|
183
|
+
])
|
|
184
|
+
),
|
|
185
|
+
operations
|
|
186
|
+
);
|
|
187
|
+
const persistSuccessOptions = {
|
|
188
|
+
...this.bindingOperations,
|
|
189
|
+
successType: result.type
|
|
190
|
+
};
|
|
191
|
+
await this.eventManager.triggerOnPersistSuccess(persistSuccessOptions);
|
|
192
|
+
await onPersistSuccess?.(persistSuccessOptions);
|
|
193
|
+
await this.eventListenerStore.invoke({ type: "persistSuccess" }, result);
|
|
194
|
+
this.treeAugmenter.resetCreatingSubTrees();
|
|
195
|
+
});
|
|
196
|
+
} catch (e) {
|
|
197
|
+
console.error(e);
|
|
198
|
+
const resultWithError = {
|
|
199
|
+
...result,
|
|
200
|
+
afterPersistError: e
|
|
201
|
+
};
|
|
202
|
+
this.onPersistSuccess(resultWithError, this);
|
|
203
|
+
return resultWithError;
|
|
204
|
+
}
|
|
205
|
+
this.onPersistSuccess(result, this);
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
async persistFail(error) {
|
|
209
|
+
await this.eventListenerStore.invoke({ type: "persistError" }, error);
|
|
210
|
+
return error;
|
|
211
|
+
}
|
|
212
|
+
async extendTree(newFragment, options = {}) {
|
|
213
|
+
if (options.signal?.aborted) {
|
|
214
|
+
return Promise.reject(bindingCommon.DataBindingExtendAborted);
|
|
215
|
+
}
|
|
216
|
+
const markerTreeRoot = this.createMarkerTree(newFragment, options.environment ?? this.environment);
|
|
217
|
+
if (!options.force && this.treeStore.effectivelyHasTreeRoot(markerTreeRoot)) {
|
|
218
|
+
return this.eventManager.syncOperation(() => {
|
|
219
|
+
const newTreeRootId = this.getNewTreeRootId();
|
|
220
|
+
this.treeAugmenter.extendTreeStates(newTreeRootId, markerTreeRoot);
|
|
221
|
+
return newTreeRootId;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return await new Promise(async (resolve, reject) => {
|
|
225
|
+
const treeRootId = this.getNewTreeRootId();
|
|
226
|
+
this.pendingExtensions.add({
|
|
227
|
+
markerTreeRoot,
|
|
228
|
+
newFragment,
|
|
229
|
+
newTreeRootId: treeRootId,
|
|
230
|
+
options,
|
|
231
|
+
onError: options.onError
|
|
232
|
+
});
|
|
233
|
+
this.flushResult ?? (this.flushResult = (async () => {
|
|
234
|
+
await Promise.resolve();
|
|
235
|
+
this.flushResult = void 0;
|
|
236
|
+
return await this.flushBatchedTreeExtensions();
|
|
237
|
+
})());
|
|
238
|
+
if (!await this.flushResult || options.signal?.aborted) {
|
|
239
|
+
return reject(bindingCommon.DataBindingExtendAborted);
|
|
240
|
+
}
|
|
241
|
+
resolve(treeRootId);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async fetchData(fragment, options) {
|
|
245
|
+
const markerTreeRoot = this.createMarkerTree(fragment, options?.environment ?? this.environment);
|
|
246
|
+
const data = await this.fetchPersistedData(markerTreeRoot, options?.signal);
|
|
247
|
+
return {
|
|
248
|
+
data,
|
|
249
|
+
markerTreeRoot
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
async flushBatchedTreeExtensions() {
|
|
253
|
+
const pendingExtensions = Array.from(this.pendingExtensions).filter((extension) => {
|
|
254
|
+
return !extension.options.signal?.aborted;
|
|
255
|
+
});
|
|
256
|
+
this.pendingExtensions.clear();
|
|
257
|
+
const aggregateMarkerTreeRoot = pendingExtensions.reduce(
|
|
258
|
+
(previousValue, currentValue) => {
|
|
259
|
+
if (previousValue === void 0) {
|
|
260
|
+
return currentValue.markerTreeRoot;
|
|
261
|
+
}
|
|
262
|
+
return bindingCommon.MarkerMerger.mergeMarkerTreeRoots(previousValue, currentValue.markerTreeRoot);
|
|
263
|
+
},
|
|
264
|
+
void 0
|
|
265
|
+
);
|
|
266
|
+
if (aggregateMarkerTreeRoot === void 0) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
const aggregateSignal = getCombinedSignal.getCombinedSignal(pendingExtensions.map((extension) => extension.options.signal));
|
|
270
|
+
let aggregatePersistedData;
|
|
271
|
+
try {
|
|
272
|
+
aggregatePersistedData = await this.fetchPersistedData(aggregateMarkerTreeRoot, aggregateSignal);
|
|
273
|
+
} catch (e) {
|
|
274
|
+
if (e instanceof client.GraphQlClientError) {
|
|
275
|
+
if (e.type === "aborted") {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
for (const extension of pendingExtensions) {
|
|
279
|
+
extension.onError?.(e);
|
|
280
|
+
}
|
|
281
|
+
if (!pendingExtensions.every((it) => !!it.onError)) {
|
|
282
|
+
this.onError(e, this);
|
|
283
|
+
}
|
|
284
|
+
return false;
|
|
285
|
+
} else {
|
|
286
|
+
throw e;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (aggregateSignal?.aborted) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
this.eventManager.syncOperation(() => {
|
|
293
|
+
this.treeAugmenter.extendPersistedData(aggregatePersistedData, aggregateMarkerTreeRoot);
|
|
294
|
+
for (const extension of pendingExtensions) {
|
|
295
|
+
this.treeAugmenter.extendTreeStates(extension.newTreeRootId, extension.markerTreeRoot);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
async fetchPersistedData(tree, signal) {
|
|
301
|
+
const queryGenerator = new QueryGenerator.QueryGenerator(tree, this.queryBuilder);
|
|
302
|
+
const query = queryGenerator.getReadQuery();
|
|
303
|
+
return await this.contentClient.query(query, {
|
|
304
|
+
signal,
|
|
305
|
+
onBeforeRequest: ({ query: query2, variables }) => {
|
|
306
|
+
console.debug(query2, variables);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
resetTreeAfterSuccessfulPersist() {
|
|
311
|
+
this.eventManager.syncTransaction(() => {
|
|
312
|
+
this.accessorErrorManager.clearErrors();
|
|
313
|
+
this.dirtinessTracker.reset();
|
|
314
|
+
for (const [, rootState] of StateIterator.StateIterator.eachRootState(this.treeStore)) {
|
|
315
|
+
for (const state of StateIterator.StateIterator.depthFirstAllNodes(rootState)) {
|
|
316
|
+
switch (state.type) {
|
|
317
|
+
case "field": {
|
|
318
|
+
if (state.hasUnpersistedChanges || state.touchLog?.size) {
|
|
319
|
+
state.touchLog?.clear();
|
|
320
|
+
state.hasUnpersistedChanges = false;
|
|
321
|
+
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case "entityList":
|
|
326
|
+
if (state.unpersistedChangesCount > 0 || state.plannedRemovals?.size) {
|
|
327
|
+
state.unpersistedChangesCount = 0;
|
|
328
|
+
state.plannedRemovals?.clear();
|
|
329
|
+
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
case "entityRealm": {
|
|
333
|
+
if (state.unpersistedChangesCount > 0 || state.plannedHasOneDeletions?.size) {
|
|
334
|
+
state.unpersistedChangesCount = 0;
|
|
335
|
+
state.plannedHasOneDeletions?.clear();
|
|
336
|
+
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
337
|
+
}
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
default:
|
|
341
|
+
bindingCommon.assertNever(state);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
getNewTreeRootId() {
|
|
348
|
+
return this.treeStore.markerTrees.size === 0 ? void 0 : `${generateEnumerabilityPreventingEntropy.generateEnumerabilityPreventingEntropy()}-${_DataBinding2.getNextTreeRootIdSeed()}`;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
__publicField(_DataBinding, "getNextTreeRootIdSeed", /* @__PURE__ */ (() => {
|
|
352
|
+
let seed = 1;
|
|
353
|
+
return () => seed++;
|
|
354
|
+
})());
|
|
355
|
+
let DataBinding = _DataBinding;
|
|
356
|
+
exports.DataBinding = DataBinding;
|
|
357
|
+
//# sourceMappingURL=DataBinding.cjs.map
|