@contember/binding-legacy 2.1.0-alpha.30 → 2.1.0-alpha.36
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/package.json +10 -5
- package/src/accessorTree/NormalizedPersistedData.ts +1 -1
- package/src/accessors/EntityAccessorImpl.ts +13 -11
- package/src/accessors/EntityListAccessorImpl.ts +16 -7
- package/src/core/AccessorErrorManager.ts +2 -2
- package/src/core/DataBinding.ts +24 -15
- package/src/core/ErrorsPreprocessor.ts +4 -5
- package/src/core/EventManager.ts +34 -46
- package/src/core/MutationGenerator.ts +23 -27
- package/src/core/QueryGenerator.ts +4 -5
- package/src/core/RealmKeyGenerator.ts +5 -3
- package/src/core/RequestResponseNormalizer.ts +3 -8
- package/src/core/StateInitializer.ts +10 -18
- package/src/core/TreeAugmenter.ts +8 -15
- package/src/core/TreeStore.ts +5 -4
- package/src/core/operations/EntityOperations.ts +25 -25
- package/src/core/operations/FieldOperations.ts +15 -17
- package/src/core/operations/ListOperations.ts +15 -15
- package/src/core/operations/OperationsHelpers.ts +2 -2
- package/src/core/state/EntityListState.ts +3 -9
- package/src/fieldHelpers/helpers/TemporalFieldHelper.ts +3 -3
- package/src/utils/assertNever.ts +4 -4
- package/tests/example.test.ts +2 -2
- package/dist/development/index.cjs +0 -34
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -28
- package/dist/development/index.js.map +0 -1
- package/dist/development/src/accessorTree/NormalizedPersistedData.cjs +0 -10
- package/dist/development/src/accessorTree/NormalizedPersistedData.cjs.map +0 -1
- package/dist/development/src/accessorTree/NormalizedPersistedData.js +0 -10
- package/dist/development/src/accessorTree/NormalizedPersistedData.js.map +0 -1
- package/dist/development/src/accessors/EntityAccessorImpl.cjs +0 -179
- package/dist/development/src/accessors/EntityAccessorImpl.cjs.map +0 -1
- package/dist/development/src/accessors/EntityAccessorImpl.js +0 -179
- package/dist/development/src/accessors/EntityAccessorImpl.js.map +0 -1
- package/dist/development/src/accessors/EntityListAccessorImpl.cjs +0 -112
- package/dist/development/src/accessors/EntityListAccessorImpl.cjs.map +0 -1
- package/dist/development/src/accessors/EntityListAccessorImpl.js +0 -112
- package/dist/development/src/accessors/EntityListAccessorImpl.js.map +0 -1
- package/dist/development/src/accessors/FieldAccessorImpl.cjs +0 -54
- package/dist/development/src/accessors/FieldAccessorImpl.cjs.map +0 -1
- package/dist/development/src/accessors/FieldAccessorImpl.js +0 -54
- package/dist/development/src/accessors/FieldAccessorImpl.js.map +0 -1
- package/dist/development/src/core/AccessorErrorManager.cjs +0 -200
- package/dist/development/src/core/AccessorErrorManager.cjs.map +0 -1
- package/dist/development/src/core/AccessorErrorManager.js +0 -200
- package/dist/development/src/core/AccessorErrorManager.js.map +0 -1
- package/dist/development/src/core/Config.cjs +0 -29
- package/dist/development/src/core/Config.cjs.map +0 -1
- package/dist/development/src/core/Config.js +0 -29
- package/dist/development/src/core/Config.js.map +0 -1
- package/dist/development/src/core/DataBinding.cjs +0 -354
- package/dist/development/src/core/DataBinding.cjs.map +0 -1
- package/dist/development/src/core/DataBinding.js +0 -354
- package/dist/development/src/core/DataBinding.js.map +0 -1
- package/dist/development/src/core/DirtinessTracker.cjs +0 -26
- package/dist/development/src/core/DirtinessTracker.cjs.map +0 -1
- package/dist/development/src/core/DirtinessTracker.js +0 -26
- package/dist/development/src/core/DirtinessTracker.js.map +0 -1
- package/dist/development/src/core/ErrorsPreprocessor.cjs +0 -180
- package/dist/development/src/core/ErrorsPreprocessor.cjs.map +0 -1
- package/dist/development/src/core/ErrorsPreprocessor.js +0 -180
- package/dist/development/src/core/ErrorsPreprocessor.js.map +0 -1
- package/dist/development/src/core/EventManager.cjs +0 -439
- package/dist/development/src/core/EventManager.cjs.map +0 -1
- package/dist/development/src/core/EventManager.js +0 -439
- package/dist/development/src/core/EventManager.js.map +0 -1
- package/dist/development/src/core/MutationGenerator.cjs +0 -670
- package/dist/development/src/core/MutationGenerator.cjs.map +0 -1
- package/dist/development/src/core/MutationGenerator.js +0 -670
- package/dist/development/src/core/MutationGenerator.js.map +0 -1
- package/dist/development/src/core/QueryGenerator.cjs +0 -110
- package/dist/development/src/core/QueryGenerator.cjs.map +0 -1
- package/dist/development/src/core/QueryGenerator.js +0 -110
- package/dist/development/src/core/QueryGenerator.js.map +0 -1
- package/dist/development/src/core/RealmKeyGenerator.cjs +0 -42
- package/dist/development/src/core/RealmKeyGenerator.cjs.map +0 -1
- package/dist/development/src/core/RealmKeyGenerator.js +0 -42
- package/dist/development/src/core/RealmKeyGenerator.js.map +0 -1
- package/dist/development/src/core/RequestResponseNormalizer.cjs +0 -136
- package/dist/development/src/core/RequestResponseNormalizer.cjs.map +0 -1
- package/dist/development/src/core/RequestResponseNormalizer.js +0 -136
- package/dist/development/src/core/RequestResponseNormalizer.js.map +0 -1
- package/dist/development/src/core/StateInitializer.cjs +0 -379
- package/dist/development/src/core/StateInitializer.cjs.map +0 -1
- package/dist/development/src/core/StateInitializer.js +0 -379
- package/dist/development/src/core/StateInitializer.js.map +0 -1
- package/dist/development/src/core/TreeAugmenter.cjs +0 -354
- package/dist/development/src/core/TreeAugmenter.cjs.map +0 -1
- package/dist/development/src/core/TreeAugmenter.js +0 -354
- package/dist/development/src/core/TreeAugmenter.js.map +0 -1
- package/dist/development/src/core/TreeStore.cjs +0 -172
- package/dist/development/src/core/TreeStore.cjs.map +0 -1
- package/dist/development/src/core/TreeStore.js +0 -172
- package/dist/development/src/core/TreeStore.js.map +0 -1
- package/dist/development/src/core/exceptions/ErrorLocator.cjs +0 -59
- package/dist/development/src/core/exceptions/ErrorLocator.cjs.map +0 -1
- package/dist/development/src/core/exceptions/ErrorLocator.js +0 -59
- package/dist/development/src/core/exceptions/ErrorLocator.js.map +0 -1
- package/dist/development/src/core/exceptions/MarkerSugarer.cjs +0 -51
- package/dist/development/src/core/exceptions/MarkerSugarer.cjs.map +0 -1
- package/dist/development/src/core/exceptions/MarkerSugarer.js +0 -51
- package/dist/development/src/core/exceptions/MarkerSugarer.js.map +0 -1
- package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs +0 -33
- package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs.map +0 -1
- package/dist/development/src/core/exceptions/TreeParameterSugarer.js +0 -33
- package/dist/development/src/core/exceptions/TreeParameterSugarer.js.map +0 -1
- package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs +0 -23
- package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs.map +0 -1
- package/dist/development/src/core/factories/createBatchUpdatesOptions.js +0 -23
- package/dist/development/src/core/factories/createBatchUpdatesOptions.js.map +0 -1
- package/dist/development/src/core/operations/EntityOperations.cjs +0 -226
- package/dist/development/src/core/operations/EntityOperations.cjs.map +0 -1
- package/dist/development/src/core/operations/EntityOperations.js +0 -226
- package/dist/development/src/core/operations/EntityOperations.js.map +0 -1
- package/dist/development/src/core/operations/FieldOperations.cjs +0 -92
- package/dist/development/src/core/operations/FieldOperations.cjs.map +0 -1
- package/dist/development/src/core/operations/FieldOperations.js +0 -92
- package/dist/development/src/core/operations/FieldOperations.js.map +0 -1
- package/dist/development/src/core/operations/ListOperations.cjs +0 -158
- package/dist/development/src/core/operations/ListOperations.cjs.map +0 -1
- package/dist/development/src/core/operations/ListOperations.js +0 -158
- package/dist/development/src/core/operations/ListOperations.js.map +0 -1
- package/dist/development/src/core/operations/OperationsHelpers.cjs +0 -87
- package/dist/development/src/core/operations/OperationsHelpers.cjs.map +0 -1
- package/dist/development/src/core/operations/OperationsHelpers.js +0 -87
- package/dist/development/src/core/operations/OperationsHelpers.js.map +0 -1
- package/dist/development/src/core/requestAliases/MutationAlias.cjs +0 -14
- package/dist/development/src/core/requestAliases/MutationAlias.cjs.map +0 -1
- package/dist/development/src/core/requestAliases/MutationAlias.js +0 -14
- package/dist/development/src/core/requestAliases/MutationAlias.js.map +0 -1
- package/dist/development/src/core/state/StateIterator.cjs +0 -100
- package/dist/development/src/core/state/StateIterator.cjs.map +0 -1
- package/dist/development/src/core/state/StateIterator.js +0 -100
- package/dist/development/src/core/state/StateIterator.js.map +0 -1
- package/dist/development/src/core/state/getEntityMarker.cjs +0 -5
- package/dist/development/src/core/state/getEntityMarker.cjs.map +0 -1
- package/dist/development/src/core/state/getEntityMarker.js +0 -5
- package/dist/development/src/core/state/getEntityMarker.js.map +0 -1
- package/dist/development/src/core/utils/getCombinedSignal.cjs +0 -33
- package/dist/development/src/core/utils/getCombinedSignal.cjs.map +0 -1
- package/dist/development/src/core/utils/getCombinedSignal.js +0 -33
- package/dist/development/src/core/utils/getCombinedSignal.js.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs +0 -13
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.js +0 -13
- package/dist/development/src/fieldHelpers/helpers/FieldHelper.js.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +0 -18
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js +0 -18
- package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs +0 -16
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +0 -1
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js +0 -16
- package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js.map +0 -1
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs +0 -7
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +0 -1
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js +0 -7
- package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js.map +0 -1
- package/dist/development/src/utils/isEmptyObject.cjs +0 -12
- package/dist/development/src/utils/isEmptyObject.cjs.map +0 -1
- package/dist/development/src/utils/isEmptyObject.js +0 -12
- package/dist/development/src/utils/isEmptyObject.js.map +0 -1
- package/dist/production/index.cjs +0 -34
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.js +0 -28
- package/dist/production/index.js.map +0 -1
- package/dist/production/src/accessorTree/NormalizedPersistedData.cjs +0 -10
- package/dist/production/src/accessorTree/NormalizedPersistedData.cjs.map +0 -1
- package/dist/production/src/accessorTree/NormalizedPersistedData.js +0 -10
- package/dist/production/src/accessorTree/NormalizedPersistedData.js.map +0 -1
- package/dist/production/src/accessors/EntityAccessorImpl.cjs +0 -179
- package/dist/production/src/accessors/EntityAccessorImpl.cjs.map +0 -1
- package/dist/production/src/accessors/EntityAccessorImpl.js +0 -179
- package/dist/production/src/accessors/EntityAccessorImpl.js.map +0 -1
- package/dist/production/src/accessors/EntityListAccessorImpl.cjs +0 -112
- package/dist/production/src/accessors/EntityListAccessorImpl.cjs.map +0 -1
- package/dist/production/src/accessors/EntityListAccessorImpl.js +0 -112
- package/dist/production/src/accessors/EntityListAccessorImpl.js.map +0 -1
- package/dist/production/src/accessors/FieldAccessorImpl.cjs +0 -54
- package/dist/production/src/accessors/FieldAccessorImpl.cjs.map +0 -1
- package/dist/production/src/accessors/FieldAccessorImpl.js +0 -54
- package/dist/production/src/accessors/FieldAccessorImpl.js.map +0 -1
- package/dist/production/src/core/AccessorErrorManager.cjs +0 -200
- package/dist/production/src/core/AccessorErrorManager.cjs.map +0 -1
- package/dist/production/src/core/AccessorErrorManager.js +0 -200
- package/dist/production/src/core/AccessorErrorManager.js.map +0 -1
- package/dist/production/src/core/Config.cjs +0 -29
- package/dist/production/src/core/Config.cjs.map +0 -1
- package/dist/production/src/core/Config.js +0 -29
- package/dist/production/src/core/Config.js.map +0 -1
- package/dist/production/src/core/DataBinding.cjs +0 -354
- package/dist/production/src/core/DataBinding.cjs.map +0 -1
- package/dist/production/src/core/DataBinding.js +0 -354
- package/dist/production/src/core/DataBinding.js.map +0 -1
- package/dist/production/src/core/DirtinessTracker.cjs +0 -26
- package/dist/production/src/core/DirtinessTracker.cjs.map +0 -1
- package/dist/production/src/core/DirtinessTracker.js +0 -26
- package/dist/production/src/core/DirtinessTracker.js.map +0 -1
- package/dist/production/src/core/ErrorsPreprocessor.cjs +0 -180
- package/dist/production/src/core/ErrorsPreprocessor.cjs.map +0 -1
- package/dist/production/src/core/ErrorsPreprocessor.js +0 -180
- package/dist/production/src/core/ErrorsPreprocessor.js.map +0 -1
- package/dist/production/src/core/EventManager.cjs +0 -413
- package/dist/production/src/core/EventManager.cjs.map +0 -1
- package/dist/production/src/core/EventManager.js +0 -413
- package/dist/production/src/core/EventManager.js.map +0 -1
- package/dist/production/src/core/MutationGenerator.cjs +0 -670
- package/dist/production/src/core/MutationGenerator.cjs.map +0 -1
- package/dist/production/src/core/MutationGenerator.js +0 -670
- package/dist/production/src/core/MutationGenerator.js.map +0 -1
- package/dist/production/src/core/QueryGenerator.cjs +0 -110
- package/dist/production/src/core/QueryGenerator.cjs.map +0 -1
- package/dist/production/src/core/QueryGenerator.js +0 -110
- package/dist/production/src/core/QueryGenerator.js.map +0 -1
- package/dist/production/src/core/RealmKeyGenerator.cjs +0 -42
- package/dist/production/src/core/RealmKeyGenerator.cjs.map +0 -1
- package/dist/production/src/core/RealmKeyGenerator.js +0 -42
- package/dist/production/src/core/RealmKeyGenerator.js.map +0 -1
- package/dist/production/src/core/RequestResponseNormalizer.cjs +0 -136
- package/dist/production/src/core/RequestResponseNormalizer.cjs.map +0 -1
- package/dist/production/src/core/RequestResponseNormalizer.js +0 -136
- package/dist/production/src/core/RequestResponseNormalizer.js.map +0 -1
- package/dist/production/src/core/StateInitializer.cjs +0 -379
- package/dist/production/src/core/StateInitializer.cjs.map +0 -1
- package/dist/production/src/core/StateInitializer.js +0 -379
- package/dist/production/src/core/StateInitializer.js.map +0 -1
- package/dist/production/src/core/TreeAugmenter.cjs +0 -354
- package/dist/production/src/core/TreeAugmenter.cjs.map +0 -1
- package/dist/production/src/core/TreeAugmenter.js +0 -354
- package/dist/production/src/core/TreeAugmenter.js.map +0 -1
- package/dist/production/src/core/TreeStore.cjs +0 -172
- package/dist/production/src/core/TreeStore.cjs.map +0 -1
- package/dist/production/src/core/TreeStore.js +0 -172
- package/dist/production/src/core/TreeStore.js.map +0 -1
- package/dist/production/src/core/exceptions/ErrorLocator.cjs +0 -59
- package/dist/production/src/core/exceptions/ErrorLocator.cjs.map +0 -1
- package/dist/production/src/core/exceptions/ErrorLocator.js +0 -59
- package/dist/production/src/core/exceptions/ErrorLocator.js.map +0 -1
- package/dist/production/src/core/exceptions/MarkerSugarer.cjs +0 -51
- package/dist/production/src/core/exceptions/MarkerSugarer.cjs.map +0 -1
- package/dist/production/src/core/exceptions/MarkerSugarer.js +0 -51
- package/dist/production/src/core/exceptions/MarkerSugarer.js.map +0 -1
- package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs +0 -33
- package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs.map +0 -1
- package/dist/production/src/core/exceptions/TreeParameterSugarer.js +0 -33
- package/dist/production/src/core/exceptions/TreeParameterSugarer.js.map +0 -1
- package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs +0 -23
- package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs.map +0 -1
- package/dist/production/src/core/factories/createBatchUpdatesOptions.js +0 -23
- package/dist/production/src/core/factories/createBatchUpdatesOptions.js.map +0 -1
- package/dist/production/src/core/operations/EntityOperations.cjs +0 -226
- package/dist/production/src/core/operations/EntityOperations.cjs.map +0 -1
- package/dist/production/src/core/operations/EntityOperations.js +0 -226
- package/dist/production/src/core/operations/EntityOperations.js.map +0 -1
- package/dist/production/src/core/operations/FieldOperations.cjs +0 -73
- package/dist/production/src/core/operations/FieldOperations.cjs.map +0 -1
- package/dist/production/src/core/operations/FieldOperations.js +0 -73
- package/dist/production/src/core/operations/FieldOperations.js.map +0 -1
- package/dist/production/src/core/operations/ListOperations.cjs +0 -158
- package/dist/production/src/core/operations/ListOperations.cjs.map +0 -1
- package/dist/production/src/core/operations/ListOperations.js +0 -158
- package/dist/production/src/core/operations/ListOperations.js.map +0 -1
- package/dist/production/src/core/operations/OperationsHelpers.cjs +0 -87
- package/dist/production/src/core/operations/OperationsHelpers.cjs.map +0 -1
- package/dist/production/src/core/operations/OperationsHelpers.js +0 -87
- package/dist/production/src/core/operations/OperationsHelpers.js.map +0 -1
- package/dist/production/src/core/requestAliases/MutationAlias.cjs +0 -14
- package/dist/production/src/core/requestAliases/MutationAlias.cjs.map +0 -1
- package/dist/production/src/core/requestAliases/MutationAlias.js +0 -14
- package/dist/production/src/core/requestAliases/MutationAlias.js.map +0 -1
- package/dist/production/src/core/state/StateIterator.cjs +0 -100
- package/dist/production/src/core/state/StateIterator.cjs.map +0 -1
- package/dist/production/src/core/state/StateIterator.js +0 -100
- package/dist/production/src/core/state/StateIterator.js.map +0 -1
- package/dist/production/src/core/state/getEntityMarker.cjs +0 -5
- package/dist/production/src/core/state/getEntityMarker.cjs.map +0 -1
- package/dist/production/src/core/state/getEntityMarker.js +0 -5
- package/dist/production/src/core/state/getEntityMarker.js.map +0 -1
- package/dist/production/src/core/utils/getCombinedSignal.cjs +0 -33
- package/dist/production/src/core/utils/getCombinedSignal.cjs.map +0 -1
- package/dist/production/src/core/utils/getCombinedSignal.js +0 -33
- package/dist/production/src/core/utils/getCombinedSignal.js.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs +0 -13
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.js +0 -13
- package/dist/production/src/fieldHelpers/helpers/FieldHelper.js.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +0 -18
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js +0 -18
- package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs +0 -16
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +0 -1
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js +0 -16
- package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js.map +0 -1
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs +0 -7
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +0 -1
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js +0 -7
- package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js.map +0 -1
- package/dist/production/src/utils/isEmptyObject.cjs +0 -12
- package/dist/production/src/utils/isEmptyObject.cjs.map +0 -1
- package/dist/production/src/utils/isEmptyObject.js +0 -12
- package/dist/production/src/utils/isEmptyObject.js.map +0 -1
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts +0 -18
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +0 -1
- package/dist/types/accessorTree/index.d.ts +0 -2
- package/dist/types/accessorTree/index.d.ts.map +0 -1
- package/dist/types/accessors/BindingConfig.d.ts +0 -6
- package/dist/types/accessors/BindingConfig.d.ts.map +0 -1
- package/dist/types/accessors/EntityAccessorImpl.d.ts +0 -56
- package/dist/types/accessors/EntityAccessorImpl.d.ts.map +0 -1
- package/dist/types/accessors/EntityListAccessorImpl.d.ts +0 -57
- package/dist/types/accessors/EntityListAccessorImpl.d.ts.map +0 -1
- package/dist/types/accessors/FieldAccessorImpl.d.ts +0 -32
- package/dist/types/accessors/FieldAccessorImpl.d.ts.map +0 -1
- package/dist/types/accessors/index.d.ts +0 -5
- package/dist/types/accessors/index.d.ts.map +0 -1
- package/dist/types/core/AccessorErrorManager.d.ts +0 -25
- package/dist/types/core/AccessorErrorManager.d.ts.map +0 -1
- package/dist/types/core/Config.d.ts +0 -9
- package/dist/types/core/Config.d.ts.map +0 -1
- package/dist/types/core/DataBinding.d.ts +0 -54
- package/dist/types/core/DataBinding.d.ts.map +0 -1
- package/dist/types/core/DirtinessTracker.d.ts +0 -9
- package/dist/types/core/DirtinessTracker.d.ts.map +0 -1
- package/dist/types/core/ErrorsPreprocessor.d.ts +0 -34
- package/dist/types/core/ErrorsPreprocessor.d.ts.map +0 -1
- package/dist/types/core/EventManager.d.ts +0 -57
- package/dist/types/core/EventManager.d.ts.map +0 -1
- package/dist/types/core/MutationGenerator.d.ts +0 -49
- package/dist/types/core/MutationGenerator.d.ts.map +0 -1
- package/dist/types/core/QueryGenerator.d.ts +0 -13
- package/dist/types/core/QueryGenerator.d.ts.map +0 -1
- package/dist/types/core/RealmKeyGenerator.d.ts +0 -10
- package/dist/types/core/RealmKeyGenerator.d.ts.map +0 -1
- package/dist/types/core/RequestResponseNormalizer.d.ts +0 -11
- package/dist/types/core/RequestResponseNormalizer.d.ts.map +0 -1
- package/dist/types/core/StateInitializer.d.ts +0 -34
- package/dist/types/core/StateInitializer.d.ts.map +0 -1
- package/dist/types/core/TreeAugmenter.d.ts +0 -25
- package/dist/types/core/TreeAugmenter.d.ts.map +0 -1
- package/dist/types/core/TreeStore.d.ts +0 -30
- package/dist/types/core/TreeStore.d.ts.map +0 -1
- package/dist/types/core/UpdateMetadata.d.ts +0 -4
- package/dist/types/core/UpdateMetadata.d.ts.map +0 -1
- package/dist/types/core/exceptions/ErrorLocator.d.ts +0 -8
- package/dist/types/core/exceptions/ErrorLocator.d.ts.map +0 -1
- package/dist/types/core/exceptions/MarkerSugarer.d.ts +0 -10
- package/dist/types/core/exceptions/MarkerSugarer.d.ts.map +0 -1
- package/dist/types/core/exceptions/TreeParameterSugarer.d.ts +0 -11
- package/dist/types/core/exceptions/TreeParameterSugarer.d.ts.map +0 -1
- package/dist/types/core/factories/createBatchUpdatesOptions.d.ts +0 -5
- package/dist/types/core/factories/createBatchUpdatesOptions.d.ts.map +0 -1
- package/dist/types/core/factories/index.d.ts +0 -2
- package/dist/types/core/factories/index.d.ts.map +0 -1
- package/dist/types/core/index.d.ts +0 -9
- package/dist/types/core/index.d.ts.map +0 -1
- package/dist/types/core/operations/EntityOperations.d.ts +0 -26
- package/dist/types/core/operations/EntityOperations.d.ts.map +0 -1
- package/dist/types/core/operations/FieldOperations.d.ts +0 -22
- package/dist/types/core/operations/FieldOperations.d.ts.map +0 -1
- package/dist/types/core/operations/ListOperations.d.ts +0 -32
- package/dist/types/core/operations/ListOperations.d.ts.map +0 -1
- package/dist/types/core/operations/OperationsHelpers.d.ts +0 -14
- package/dist/types/core/operations/OperationsHelpers.d.ts.map +0 -1
- package/dist/types/core/operations/index.d.ts +0 -4
- package/dist/types/core/operations/index.d.ts.map +0 -1
- package/dist/types/core/requestAliases/MutationAlias.d.ts +0 -6
- package/dist/types/core/requestAliases/MutationAlias.d.ts.map +0 -1
- package/dist/types/core/requestAliases/index.d.ts +0 -2
- package/dist/types/core/requestAliases/index.d.ts.map +0 -1
- package/dist/types/core/state/EntityListState.d.ts +0 -29
- package/dist/types/core/state/EntityListState.d.ts.map +0 -1
- package/dist/types/core/state/EntityRealmState.d.ts +0 -44
- package/dist/types/core/state/EntityRealmState.d.ts.map +0 -1
- package/dist/types/core/state/EntityState.d.ts +0 -11
- package/dist/types/core/state/EntityState.d.ts.map +0 -1
- package/dist/types/core/state/FieldState.d.ts +0 -19
- package/dist/types/core/state/FieldState.d.ts.map +0 -1
- package/dist/types/core/state/StateIterator.d.ts +0 -14
- package/dist/types/core/state/StateIterator.d.ts.map +0 -1
- package/dist/types/core/state/StateNode.d.ts +0 -8
- package/dist/types/core/state/StateNode.d.ts.map +0 -1
- package/dist/types/core/state/getEntityMarker.d.ts +0 -3
- package/dist/types/core/state/getEntityMarker.d.ts.map +0 -1
- package/dist/types/core/state/index.d.ts +0 -8
- package/dist/types/core/state/index.d.ts.map +0 -1
- package/dist/types/core/utils/getCombinedSignal.d.ts +0 -2
- package/dist/types/core/utils/getCombinedSignal.d.ts.map +0 -1
- package/dist/types/core/utils/index.d.ts +0 -2
- package/dist/types/core/utils/index.d.ts.map +0 -1
- package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts +0 -7
- package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts.map +0 -1
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +0 -10
- package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +0 -1
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +0 -10
- package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +0 -1
- package/dist/types/fieldHelpers/helpers/index.d.ts +0 -3
- package/dist/types/fieldHelpers/helpers/index.d.ts.map +0 -1
- package/dist/types/fieldHelpers/index.d.ts +0 -2
- package/dist/types/fieldHelpers/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/dist/types/utils/assertNever.d.ts +0 -2
- package/dist/types/utils/assertNever.d.ts.map +0 -1
- package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts +0 -2
- package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/isEmptyObject.d.ts +0 -2
- package/dist/types/utils/isEmptyObject.d.ts.map +0 -1
|
@@ -1,200 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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// eslint-disable-next-line no-console\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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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;AAFvC,kBAAA,MAAA,QAAA;AAGhB,SAAK,SAAS;AAAA,MACb,GAAGA,SAAO;AAAA,MACV,GAAG;AAAA,IACJ;AAAA,EAAA;AAAA,EAGM,SAA2C,MAAiC;AAC3E,WAAA,KAAK,OAAO,IAAI;AAAA,EAAA;AAAA,EAGjB,SAA2C,MAAY,OAAkC;AAC1F,SAAA,OAAO,IAAI,IAAI;AACb,WAAA;AAAA,EAAA;AAET;AAvBC,cADY,SACG,iBAA+B;AAAA,EAC7C,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,2BAA2B;AAC5B,CAAA;AALM,IAAM,SAAN;;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;AAFvC,kBAAA,MAAA,QAAA;AAGhB,SAAK,SAAS;AAAA,MACb,GAAGA,SAAO;AAAA,MACV,GAAG;AAAA,IACJ;AAAA,EAAA;AAAA,EAGM,SAA2C,MAAiC;AAC3E,WAAA,KAAK,OAAO,IAAI;AAAA,EAAA;AAAA,EAGjB,SAA2C,MAAY,OAAkC;AAC1F,SAAA,OAAO,IAAI,IAAI;AACb,WAAA;AAAA,EAAA;AAET;AAvBC,cADY,SACG,iBAA+B;AAAA,EAC7C,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,2BAA2B;AAC5B,CAAA;AALM,IAAM,SAAN;"}
|
|
@@ -1,354 +0,0 @@
|
|
|
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(this.queryBuilder.transaction(mutations, {
|
|
109
|
-
deferForeignKeyConstraints: true
|
|
110
|
-
}), {
|
|
111
|
-
signal,
|
|
112
|
-
onBeforeRequest: ({ query, variables }) => {
|
|
113
|
-
console.debug(query, variables);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
} catch (e) {
|
|
117
|
-
if (e instanceof client.GraphQlClientError) {
|
|
118
|
-
this.onError(e, this);
|
|
119
|
-
throw await this.persistFail({
|
|
120
|
-
errors: [e],
|
|
121
|
-
type: "invalidResponse"
|
|
122
|
-
});
|
|
123
|
-
} else {
|
|
124
|
-
throw e;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (response.ok && Object.values(response.data).every((it) => it.ok)) {
|
|
128
|
-
return await this.processSuccessfulPersistResult(response, operations, onPersistSuccess);
|
|
129
|
-
} else {
|
|
130
|
-
if (response.errorMessage) {
|
|
131
|
-
console.debug(response.errorMessage);
|
|
132
|
-
}
|
|
133
|
-
this.eventManager.syncTransaction(() => this.accessorErrorManager.replaceErrors(response, operations));
|
|
134
|
-
await this.eventManager.triggerOnPersistError(this.bindingOperations);
|
|
135
|
-
await onPersistError?.(this.bindingOperations);
|
|
136
|
-
throw await this.persistFail({
|
|
137
|
-
errors: this.accessorErrorManager.getErrors(),
|
|
138
|
-
type: "invalidInput",
|
|
139
|
-
response
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
async checkErrorsBeforePersist(onPersistError) {
|
|
145
|
-
if (this.accessorErrorManager.hasErrors()) {
|
|
146
|
-
await this.eventManager.triggerOnPersistError(this.bindingOperations);
|
|
147
|
-
await onPersistError?.(this.bindingOperations);
|
|
148
|
-
throw await this.persistFail({
|
|
149
|
-
errors: this.accessorErrorManager.getErrors(),
|
|
150
|
-
type: "invalidInput"
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async processEmptyPersistMutation(onPersistSuccess) {
|
|
155
|
-
this.dirtinessTracker.reset();
|
|
156
|
-
const persistSuccessOptions = {
|
|
157
|
-
...this.bindingOperations,
|
|
158
|
-
successType: "nothingToPersist"
|
|
159
|
-
};
|
|
160
|
-
await this.eventManager.triggerOnPersistSuccess(persistSuccessOptions);
|
|
161
|
-
await onPersistSuccess?.(persistSuccessOptions);
|
|
162
|
-
const result = { type: "nothingToPersist" };
|
|
163
|
-
await this.eventListenerStore.invoke({ type: "persistSuccess" }, result);
|
|
164
|
-
return result;
|
|
165
|
-
}
|
|
166
|
-
async processSuccessfulPersistResult(mutationData, operations, onPersistSuccess) {
|
|
167
|
-
const persistedEntityIds = Object.values(mutationData.data).map((it) => it.node?.id).filter((id) => id !== void 0);
|
|
168
|
-
const result = {
|
|
169
|
-
type: "justSuccess",
|
|
170
|
-
persistedEntityIds
|
|
171
|
-
};
|
|
172
|
-
try {
|
|
173
|
-
await this.eventManager.asyncTransaction(async () => {
|
|
174
|
-
this.resetTreeAfterSuccessfulPersist();
|
|
175
|
-
this.treeAugmenter.updatePersistedData(
|
|
176
|
-
Object.fromEntries(
|
|
177
|
-
Object.entries(mutationData.data).map(([placeholderName, subTreeResponse]) => [
|
|
178
|
-
placeholderName,
|
|
179
|
-
subTreeResponse.node
|
|
180
|
-
])
|
|
181
|
-
),
|
|
182
|
-
operations
|
|
183
|
-
);
|
|
184
|
-
const persistSuccessOptions = {
|
|
185
|
-
...this.bindingOperations,
|
|
186
|
-
successType: result.type
|
|
187
|
-
};
|
|
188
|
-
await this.eventManager.triggerOnPersistSuccess(persistSuccessOptions);
|
|
189
|
-
await onPersistSuccess?.(persistSuccessOptions);
|
|
190
|
-
await this.eventListenerStore.invoke({ type: "persistSuccess" }, result);
|
|
191
|
-
this.treeAugmenter.resetCreatingSubTrees();
|
|
192
|
-
});
|
|
193
|
-
} catch (e) {
|
|
194
|
-
console.error(e);
|
|
195
|
-
const resultWithError = {
|
|
196
|
-
...result,
|
|
197
|
-
afterPersistError: e
|
|
198
|
-
};
|
|
199
|
-
this.onPersistSuccess(resultWithError, this);
|
|
200
|
-
return resultWithError;
|
|
201
|
-
}
|
|
202
|
-
this.onPersistSuccess(result, this);
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
async persistFail(error) {
|
|
206
|
-
await this.eventListenerStore.invoke({ type: "persistError" }, error);
|
|
207
|
-
return error;
|
|
208
|
-
}
|
|
209
|
-
async extendTree(newFragment, options = {}) {
|
|
210
|
-
if (options.signal?.aborted) {
|
|
211
|
-
return Promise.reject(bindingCommon.DataBindingExtendAborted);
|
|
212
|
-
}
|
|
213
|
-
const markerTreeRoot = this.createMarkerTree(newFragment, options.environment ?? this.environment);
|
|
214
|
-
if (!options.force && this.treeStore.effectivelyHasTreeRoot(markerTreeRoot)) {
|
|
215
|
-
return this.eventManager.syncOperation(() => {
|
|
216
|
-
const newTreeRootId = this.getNewTreeRootId();
|
|
217
|
-
this.treeAugmenter.extendTreeStates(newTreeRootId, markerTreeRoot);
|
|
218
|
-
return newTreeRootId;
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
return await new Promise(async (resolve, reject) => {
|
|
222
|
-
const treeRootId = this.getNewTreeRootId();
|
|
223
|
-
this.pendingExtensions.add({
|
|
224
|
-
markerTreeRoot,
|
|
225
|
-
newFragment,
|
|
226
|
-
newTreeRootId: treeRootId,
|
|
227
|
-
options,
|
|
228
|
-
onError: options.onError
|
|
229
|
-
});
|
|
230
|
-
this.flushResult ?? (this.flushResult = (async () => {
|
|
231
|
-
await Promise.resolve();
|
|
232
|
-
this.flushResult = void 0;
|
|
233
|
-
return await this.flushBatchedTreeExtensions();
|
|
234
|
-
})());
|
|
235
|
-
if (!await this.flushResult || options.signal?.aborted) {
|
|
236
|
-
return reject(bindingCommon.DataBindingExtendAborted);
|
|
237
|
-
}
|
|
238
|
-
resolve(treeRootId);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
async fetchData(fragment, options) {
|
|
242
|
-
const markerTreeRoot = this.createMarkerTree(fragment, options?.environment ?? this.environment);
|
|
243
|
-
const data = await this.fetchPersistedData(markerTreeRoot, options?.signal);
|
|
244
|
-
return {
|
|
245
|
-
data,
|
|
246
|
-
markerTreeRoot
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
async flushBatchedTreeExtensions() {
|
|
250
|
-
const pendingExtensions = Array.from(this.pendingExtensions).filter((extension) => {
|
|
251
|
-
return !extension.options.signal?.aborted;
|
|
252
|
-
});
|
|
253
|
-
this.pendingExtensions.clear();
|
|
254
|
-
const aggregateMarkerTreeRoot = pendingExtensions.reduce(
|
|
255
|
-
(previousValue, currentValue) => {
|
|
256
|
-
if (previousValue === void 0) {
|
|
257
|
-
return currentValue.markerTreeRoot;
|
|
258
|
-
}
|
|
259
|
-
return bindingCommon.MarkerMerger.mergeMarkerTreeRoots(previousValue, currentValue.markerTreeRoot);
|
|
260
|
-
},
|
|
261
|
-
void 0
|
|
262
|
-
);
|
|
263
|
-
if (aggregateMarkerTreeRoot === void 0) {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
const aggregateSignal = getCombinedSignal.getCombinedSignal(pendingExtensions.map((extension) => extension.options.signal));
|
|
267
|
-
let aggregatePersistedData;
|
|
268
|
-
try {
|
|
269
|
-
aggregatePersistedData = await this.fetchPersistedData(aggregateMarkerTreeRoot, aggregateSignal);
|
|
270
|
-
} catch (e) {
|
|
271
|
-
if (e instanceof client.GraphQlClientError) {
|
|
272
|
-
if (e.type === "aborted") {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
for (const extension of pendingExtensions) {
|
|
276
|
-
extension.onError?.(e);
|
|
277
|
-
}
|
|
278
|
-
if (!pendingExtensions.every((it) => !!it.onError)) {
|
|
279
|
-
this.onError(e, this);
|
|
280
|
-
}
|
|
281
|
-
return false;
|
|
282
|
-
} else {
|
|
283
|
-
throw e;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
if (aggregateSignal?.aborted) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
this.eventManager.syncOperation(() => {
|
|
290
|
-
this.treeAugmenter.extendPersistedData(aggregatePersistedData, aggregateMarkerTreeRoot);
|
|
291
|
-
for (const extension of pendingExtensions) {
|
|
292
|
-
this.treeAugmenter.extendTreeStates(extension.newTreeRootId, extension.markerTreeRoot);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
async fetchPersistedData(tree, signal) {
|
|
298
|
-
const queryGenerator = new QueryGenerator.QueryGenerator(tree, this.queryBuilder);
|
|
299
|
-
const query = queryGenerator.getReadQuery();
|
|
300
|
-
return await this.contentClient.query(query, {
|
|
301
|
-
signal,
|
|
302
|
-
onBeforeRequest: ({ query: query2, variables }) => {
|
|
303
|
-
console.debug(query2, variables);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
resetTreeAfterSuccessfulPersist() {
|
|
308
|
-
this.eventManager.syncTransaction(() => {
|
|
309
|
-
this.accessorErrorManager.clearErrors();
|
|
310
|
-
this.dirtinessTracker.reset();
|
|
311
|
-
for (const [, rootState] of StateIterator.StateIterator.eachRootState(this.treeStore)) {
|
|
312
|
-
for (const state of StateIterator.StateIterator.depthFirstAllNodes(rootState)) {
|
|
313
|
-
switch (state.type) {
|
|
314
|
-
case "field": {
|
|
315
|
-
if (state.hasUnpersistedChanges || state.touchLog?.size) {
|
|
316
|
-
state.touchLog?.clear();
|
|
317
|
-
state.hasUnpersistedChanges = false;
|
|
318
|
-
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
319
|
-
}
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
case "entityList":
|
|
323
|
-
if (state.unpersistedChangesCount > 0 || state.plannedRemovals?.size) {
|
|
324
|
-
state.unpersistedChangesCount = 0;
|
|
325
|
-
state.plannedRemovals?.clear();
|
|
326
|
-
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
327
|
-
}
|
|
328
|
-
break;
|
|
329
|
-
case "entityRealm": {
|
|
330
|
-
if (state.unpersistedChangesCount > 0 || state.plannedHasOneDeletions?.size) {
|
|
331
|
-
state.unpersistedChangesCount = 0;
|
|
332
|
-
state.plannedHasOneDeletions?.clear();
|
|
333
|
-
this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
default:
|
|
338
|
-
bindingCommon.assertNever(state);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
getNewTreeRootId() {
|
|
345
|
-
return this.treeStore.markerTrees.size === 0 ? void 0 : `${generateEnumerabilityPreventingEntropy.generateEnumerabilityPreventingEntropy()}-${_DataBinding2.getNextTreeRootIdSeed()}`;
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
__publicField(_DataBinding, "getNextTreeRootIdSeed", /* @__PURE__ */ (() => {
|
|
349
|
-
let seed = 1;
|
|
350
|
-
return () => seed++;
|
|
351
|
-
})());
|
|
352
|
-
let DataBinding = _DataBinding;
|
|
353
|
-
exports.DataBinding = DataBinding;
|
|
354
|
-
//# sourceMappingURL=DataBinding.cjs.map
|