@fluid-experimental/tree 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0
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/CHANGELOG.md +23 -0
- package/api-report/experimental-tree.api.md +2 -2
- package/dist/ChangeCompression.d.ts +2 -2
- package/dist/ChangeCompression.d.ts.map +1 -1
- package/dist/ChangeCompression.js +1 -1
- package/dist/ChangeCompression.js.map +1 -1
- package/dist/ChangeTypes.d.ts +1 -1
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +4 -4
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +3 -3
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +17 -17
- package/dist/Checkout.js.map +1 -1
- package/dist/EditLog.d.ts +1 -1
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +9 -9
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +3 -3
- package/dist/EditUtilities.d.ts.map +1 -1
- package/dist/EditUtilities.js +6 -6
- package/dist/EditUtilities.js.map +1 -1
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +23 -23
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +1 -1
- package/dist/HistoryEditFactory.d.ts.map +1 -1
- package/dist/HistoryEditFactory.js +7 -7
- package/dist/HistoryEditFactory.js.map +1 -1
- package/dist/IdConversion.d.ts.map +1 -1
- package/dist/IdConversion.js.map +1 -1
- package/dist/LogViewer.d.ts +2 -2
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +7 -7
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js +1 -1
- package/dist/MergeHealth.js.map +1 -1
- package/dist/NodeIdUtilities.d.ts +1 -1
- package/dist/NodeIdUtilities.d.ts.map +1 -1
- package/dist/NodeIdUtilities.js +1 -1
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.d.ts.map +1 -1
- package/dist/PayloadUtilities.js +2 -2
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/ReconciliationPath.d.ts +1 -1
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -2
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +2 -2
- package/dist/RevisionView.d.ts.map +1 -1
- package/dist/RevisionView.js.map +1 -1
- package/dist/SerializationUtilities.d.ts +1 -1
- package/dist/SerializationUtilities.d.ts.map +1 -1
- package/dist/SerializationUtilities.js.map +1 -1
- package/dist/SharedTree.d.ts +8 -7
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +78 -78
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +31 -31
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/Summary.d.ts +2 -2
- package/dist/Summary.d.ts.map +1 -1
- package/dist/Summary.js +2 -2
- package/dist/Summary.js.map +1 -1
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +1 -1
- package/dist/SummaryTestUtilities.d.ts.map +1 -1
- package/dist/SummaryTestUtilities.js.map +1 -1
- package/dist/Transaction.d.ts +3 -3
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +3 -3
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.d.ts +3 -3
- package/dist/TransactionInternal.d.ts.map +1 -1
- package/dist/TransactionInternal.js +6 -6
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeCompressor.d.ts +5 -1
- package/dist/TreeCompressor.d.ts.map +1 -1
- package/dist/TreeCompressor.js +5 -5
- package/dist/TreeCompressor.js.map +1 -1
- package/dist/TreeNodeHandle.d.ts +1 -1
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +1 -1
- package/dist/TreeView.d.ts.map +1 -1
- package/dist/TreeView.js +2 -3
- package/dist/TreeView.js.map +1 -1
- package/dist/UuidUtilities.d.ts.map +1 -1
- package/dist/UuidUtilities.js.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.js +3 -3
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +1 -1
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +25 -26
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/IdRange.d.ts.map +1 -1
- package/dist/id-compressor/IdRange.js +2 -2
- package/dist/id-compressor/IdRange.js.map +1 -1
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
- package/dist/id-compressor/NumericUuid.js +2 -1
- package/dist/id-compressor/NumericUuid.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js +8 -9
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js +11 -11
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +8 -4
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +13 -13
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +2 -2
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js +2 -2
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/packageVersion.d.ts +0 -2
- package/dist/migration-shim/packageVersion.d.ts.map +1 -1
- package/dist/migration-shim/packageVersion.js +0 -2
- package/dist/migration-shim/packageVersion.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js +8 -8
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +2 -2
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js +8 -4
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js +2 -2
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/dist/migration-shim/shimChannelServices.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js +2 -2
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/shimHandle.d.ts.map +1 -1
- package/dist/migration-shim/shimHandle.js.map +1 -1
- package/dist/migration-shim/types.d.ts +1 -1
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/migration-shim/utils.d.ts +1 -1
- package/dist/migration-shim/utils.d.ts.map +1 -1
- package/dist/migration-shim/utils.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +1 -1
- package/dist/persisted-types/0.0.2.d.ts.map +1 -1
- package/dist/persisted-types/0.0.2.js.map +1 -1
- package/dist/persisted-types/0.1.1.d.ts +1 -1
- package/dist/persisted-types/0.1.1.d.ts.map +1 -1
- package/dist/persisted-types/0.1.1.js +3 -3
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/lib/ChangeCompression.d.ts +2 -2
- package/lib/ChangeCompression.d.ts.map +1 -1
- package/lib/ChangeCompression.js +1 -1
- package/lib/ChangeCompression.js.map +1 -1
- package/lib/ChangeTypes.d.ts +1 -1
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/ChangeTypes.js +2 -2
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +3 -3
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +4 -4
- package/lib/Checkout.js.map +1 -1
- package/lib/EditLog.d.ts +1 -1
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +2 -2
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +3 -3
- package/lib/EditUtilities.d.ts.map +1 -1
- package/lib/EditUtilities.js +5 -5
- package/lib/EditUtilities.js.map +1 -1
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +2 -2
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +1 -1
- package/lib/HistoryEditFactory.d.ts.map +1 -1
- package/lib/HistoryEditFactory.js +5 -5
- package/lib/HistoryEditFactory.js.map +1 -1
- package/lib/IdConversion.d.ts.map +1 -1
- package/lib/IdConversion.js.map +1 -1
- package/lib/LogViewer.d.ts +2 -2
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +3 -3
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/NodeIdUtilities.d.ts +1 -1
- package/lib/NodeIdUtilities.d.ts.map +1 -1
- package/lib/NodeIdUtilities.js +1 -1
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/PayloadUtilities.d.ts.map +1 -1
- package/lib/PayloadUtilities.js +1 -1
- package/lib/PayloadUtilities.js.map +1 -1
- package/lib/ReconciliationPath.d.ts +1 -1
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -2
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +2 -2
- package/lib/RevisionView.d.ts.map +1 -1
- package/lib/RevisionView.js.map +1 -1
- package/lib/SerializationUtilities.d.ts +1 -1
- package/lib/SerializationUtilities.d.ts.map +1 -1
- package/lib/SerializationUtilities.js.map +1 -1
- package/lib/SharedTree.d.ts +8 -7
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +13 -13
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +5 -5
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/Summary.d.ts +2 -2
- package/lib/Summary.d.ts.map +1 -1
- package/lib/Summary.js +1 -1
- package/lib/Summary.js.map +1 -1
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +1 -1
- package/lib/SummaryTestUtilities.d.ts.map +1 -1
- package/lib/SummaryTestUtilities.js.map +1 -1
- package/lib/Transaction.d.ts +3 -3
- package/lib/Transaction.d.ts.map +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/Transaction.js.map +1 -1
- package/lib/TransactionInternal.d.ts +3 -3
- package/lib/TransactionInternal.d.ts.map +1 -1
- package/lib/TransactionInternal.js +3 -3
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/TreeCompressor.d.ts +5 -1
- package/lib/TreeCompressor.d.ts.map +1 -1
- package/lib/TreeCompressor.js +2 -2
- package/lib/TreeCompressor.js.map +1 -1
- package/lib/TreeNodeHandle.d.ts +1 -1
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +1 -1
- package/lib/TreeView.d.ts.map +1 -1
- package/lib/TreeView.js +1 -2
- package/lib/TreeView.js.map +1 -1
- package/lib/UuidUtilities.d.ts.map +1 -1
- package/lib/UuidUtilities.js +1 -1
- package/lib/UuidUtilities.js.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +1 -1
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +4 -5
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/IdRange.d.ts.map +1 -1
- package/lib/id-compressor/IdRange.js +1 -1
- package/lib/id-compressor/IdRange.js.map +1 -1
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
- package/lib/id-compressor/NumericUuid.js +2 -1
- package/lib/id-compressor/NumericUuid.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js +1 -2
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +8 -4
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +3 -3
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +2 -2
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/packageVersion.d.ts +0 -2
- package/lib/migration-shim/packageVersion.d.ts.map +1 -1
- package/lib/migration-shim/packageVersion.js +0 -2
- package/lib/migration-shim/packageVersion.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +2 -2
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js +6 -2
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/lib/migration-shim/shimChannelServices.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js +1 -1
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/shimHandle.d.ts.map +1 -1
- package/lib/migration-shim/shimHandle.js.map +1 -1
- package/lib/migration-shim/types.d.ts +1 -1
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/migration-shim/utils.d.ts +1 -1
- package/lib/migration-shim/utils.d.ts.map +1 -1
- package/lib/migration-shim/utils.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +1 -1
- package/lib/persisted-types/0.0.2.d.ts.map +1 -1
- package/lib/persisted-types/0.0.2.js.map +1 -1
- package/lib/persisted-types/0.1.1.d.ts +1 -1
- package/lib/persisted-types/0.1.1.d.ts.map +1 -1
- package/lib/persisted-types/0.1.1.js +1 -1
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/package.json +33 -32
- package/src/ChangeCompression.ts +8 -8
- package/src/ChangeTypes.ts +5 -4
- package/src/Checkout.ts +9 -7
- package/src/EditLog.ts +4 -3
- package/src/EditUtilities.ts +9 -8
- package/src/Forest.ts +3 -2
- package/src/HistoryEditFactory.ts +12 -11
- package/src/IdConversion.ts +2 -2
- package/src/LogViewer.ts +5 -4
- package/src/MergeHealth.ts +2 -1
- package/src/NodeIdUtilities.ts +2 -2
- package/src/PayloadUtilities.ts +2 -1
- package/src/ReconciliationPath.ts +1 -1
- package/src/RevisionValueCache.ts +3 -2
- package/src/RevisionView.ts +3 -3
- package/src/SerializationUtilities.ts +1 -1
- package/src/SharedTree.ts +46 -49
- package/src/SharedTreeEncoder.ts +30 -29
- package/src/Summary.ts +5 -3
- package/src/SummaryBackCompatibility.ts +1 -0
- package/src/SummaryTestUtilities.ts +2 -1
- package/src/Transaction.ts +7 -6
- package/src/TransactionInternal.ts +17 -16
- package/src/TreeCompressor.ts +6 -4
- package/src/TreeNodeHandle.ts +2 -2
- package/src/TreeView.ts +3 -3
- package/src/UuidUtilities.ts +2 -1
- package/src/id-compressor/AppendOnlySortedMap.ts +2 -1
- package/src/id-compressor/IdCompressor.ts +18 -17
- package/src/id-compressor/IdRange.ts +2 -1
- package/src/id-compressor/NumericUuid.ts +1 -1
- package/src/id-compressor/SessionIdNormalizer.ts +3 -3
- package/src/migration-shim/migrationDeltaHandler.ts +3 -2
- package/src/migration-shim/migrationShim.ts +14 -10
- package/src/migration-shim/migrationShimFactory.ts +6 -4
- package/src/migration-shim/packageVersion.ts +0 -2
- package/src/migration-shim/sharedTreeDeltaHandler.ts +3 -2
- package/src/migration-shim/sharedTreeShim.ts +7 -5
- package/src/migration-shim/sharedTreeShimFactory.ts +3 -3
- package/src/migration-shim/shimChannelServices.ts +1 -1
- package/src/migration-shim/shimDeltaConnection.ts +3 -2
- package/src/migration-shim/shimHandle.ts +1 -0
- package/src/migration-shim/types.ts +3 -1
- package/src/migration-shim/utils.ts +2 -1
- package/src/persisted-types/0.0.2.ts +2 -2
- package/src/persisted-types/0.1.1.ts +10 -8
- package/dist/tree-alpha.d.ts +0 -2901
- package/dist/tree-beta.d.ts +0 -348
- package/dist/tree-public.d.ts +0 -348
- package/dist/tree-untrimmed.d.ts +0 -3820
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.perf.tests.js +0 -49
- package/lib/test/AppendOnlySortedMap.perf.tests.js.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.js +0 -213
- package/lib/test/AppendOnlySortedMap.tests.js.map +0 -1
- package/lib/test/ChangeCompression.tests.d.ts +0 -6
- package/lib/test/ChangeCompression.tests.d.ts.map +0 -1
- package/lib/test/ChangeCompression.tests.js +0 -154
- package/lib/test/ChangeCompression.tests.js.map +0 -1
- package/lib/test/Checkout.tests.d.ts +0 -10
- package/lib/test/Checkout.tests.d.ts.map +0 -1
- package/lib/test/Checkout.tests.js +0 -460
- package/lib/test/Checkout.tests.js.map +0 -1
- package/lib/test/Common.tests.d.ts +0 -6
- package/lib/test/Common.tests.d.ts.map +0 -1
- package/lib/test/Common.tests.js +0 -102
- package/lib/test/Common.tests.js.map +0 -1
- package/lib/test/EagerCheckout.tests.d.ts +0 -6
- package/lib/test/EagerCheckout.tests.d.ts.map +0 -1
- package/lib/test/EagerCheckout.tests.js +0 -20
- package/lib/test/EagerCheckout.tests.js.map +0 -1
- package/lib/test/Edit.tests.d.ts +0 -6
- package/lib/test/Edit.tests.d.ts.map +0 -1
- package/lib/test/Edit.tests.js +0 -60
- package/lib/test/Edit.tests.js.map +0 -1
- package/lib/test/EditLog.perf.tests.d.ts +0 -6
- package/lib/test/EditLog.perf.tests.d.ts.map +0 -1
- package/lib/test/EditLog.perf.tests.js +0 -41
- package/lib/test/EditLog.perf.tests.js.map +0 -1
- package/lib/test/EditLog.tests.d.ts +0 -6
- package/lib/test/EditLog.tests.d.ts.map +0 -1
- package/lib/test/EditLog.tests.js +0 -355
- package/lib/test/EditLog.tests.js.map +0 -1
- package/lib/test/EditUtilities.tests.d.ts +0 -6
- package/lib/test/EditUtilities.tests.d.ts.map +0 -1
- package/lib/test/EditUtilities.tests.js +0 -512
- package/lib/test/EditUtilities.tests.js.map +0 -1
- package/lib/test/Forest.perf.tests.d.ts +0 -6
- package/lib/test/Forest.perf.tests.d.ts.map +0 -1
- package/lib/test/Forest.perf.tests.js +0 -135
- package/lib/test/Forest.perf.tests.js.map +0 -1
- package/lib/test/Forest.tests.d.ts +0 -6
- package/lib/test/Forest.tests.d.ts.map +0 -1
- package/lib/test/Forest.tests.js +0 -213
- package/lib/test/Forest.tests.js.map +0 -1
- package/lib/test/GenericTransaction.tests.d.ts +0 -6
- package/lib/test/GenericTransaction.tests.d.ts.map +0 -1
- package/lib/test/GenericTransaction.tests.js +0 -31
- package/lib/test/GenericTransaction.tests.js.map +0 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +0 -6
- package/lib/test/HistoryEditFactory.tests.d.ts.map +0 -1
- package/lib/test/HistoryEditFactory.tests.js +0 -170
- package/lib/test/HistoryEditFactory.tests.js.map +0 -1
- package/lib/test/IdCompressor.perf.tests.d.ts +0 -6
- package/lib/test/IdCompressor.perf.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.perf.tests.js +0 -290
- package/lib/test/IdCompressor.perf.tests.js.map +0 -1
- package/lib/test/IdCompressor.tests.d.ts +0 -6
- package/lib/test/IdCompressor.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.tests.js +0 -1542
- package/lib/test/IdCompressor.tests.js.map +0 -1
- package/lib/test/IdConversion.tests.d.ts +0 -6
- package/lib/test/IdConversion.tests.d.ts.map +0 -1
- package/lib/test/IdConversion.tests.js +0 -36
- package/lib/test/IdConversion.tests.js.map +0 -1
- package/lib/test/LazyCheckout.tests.d.ts +0 -6
- package/lib/test/LazyCheckout.tests.d.ts.map +0 -1
- package/lib/test/LazyCheckout.tests.js +0 -22
- package/lib/test/LazyCheckout.tests.js.map +0 -1
- package/lib/test/LogViewer.tests.d.ts +0 -6
- package/lib/test/LogViewer.tests.d.ts.map +0 -1
- package/lib/test/LogViewer.tests.js +0 -588
- package/lib/test/LogViewer.tests.js.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts +0 -6
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +0 -351
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +0 -1
- package/lib/test/NumericUuid.perf.tests.d.ts +0 -6
- package/lib/test/NumericUuid.perf.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.perf.tests.js +0 -68
- package/lib/test/NumericUuid.perf.tests.js.map +0 -1
- package/lib/test/NumericUuid.tests.d.ts +0 -6
- package/lib/test/NumericUuid.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.tests.js +0 -192
- package/lib/test/NumericUuid.tests.js.map +0 -1
- package/lib/test/RevisionValueCache.tests.d.ts +0 -6
- package/lib/test/RevisionValueCache.tests.d.ts.map +0 -1
- package/lib/test/RevisionValueCache.tests.js +0 -106
- package/lib/test/RevisionValueCache.tests.js.map +0 -1
- package/lib/test/RevisionView.tests.d.ts +0 -6
- package/lib/test/RevisionView.tests.d.ts.map +0 -1
- package/lib/test/RevisionView.tests.js +0 -131
- package/lib/test/RevisionView.tests.js.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.d.ts +0 -6
- package/lib/test/SessionIdNormalizer.tests.d.ts.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.js +0 -377
- package/lib/test/SessionIdNormalizer.tests.js.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.d.ts +0 -6
- package/lib/test/SharedTree.fuzz.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.js +0 -9
- package/lib/test/SharedTree.fuzz.tests.js.map +0 -1
- package/lib/test/SharedTree.perf.tests.d.ts +0 -6
- package/lib/test/SharedTree.perf.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.perf.tests.js +0 -39
- package/lib/test/SharedTree.perf.tests.js.map +0 -1
- package/lib/test/SharedTree.tests.d.ts +0 -6
- package/lib/test/SharedTree.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.tests.js +0 -22
- package/lib/test/SharedTree.tests.js.map +0 -1
- package/lib/test/StringInterner.tests.d.ts +0 -6
- package/lib/test/StringInterner.tests.d.ts.map +0 -1
- package/lib/test/StringInterner.tests.js +0 -73
- package/lib/test/StringInterner.tests.js.map +0 -1
- package/lib/test/Summary.tests.d.ts +0 -7
- package/lib/test/Summary.tests.d.ts.map +0 -1
- package/lib/test/Summary.tests.js +0 -386
- package/lib/test/Summary.tests.js.map +0 -1
- package/lib/test/Transaction.tests.d.ts +0 -6
- package/lib/test/Transaction.tests.d.ts.map +0 -1
- package/lib/test/Transaction.tests.js +0 -124
- package/lib/test/Transaction.tests.js.map +0 -1
- package/lib/test/TransactionInternal.tests.d.ts +0 -6
- package/lib/test/TransactionInternal.tests.d.ts.map +0 -1
- package/lib/test/TransactionInternal.tests.js +0 -576
- package/lib/test/TransactionInternal.tests.js.map +0 -1
- package/lib/test/TreeCompression.tests.d.ts +0 -6
- package/lib/test/TreeCompression.tests.d.ts.map +0 -1
- package/lib/test/TreeCompression.tests.js +0 -291
- package/lib/test/TreeCompression.tests.js.map +0 -1
- package/lib/test/TreeView.tests.d.ts +0 -6
- package/lib/test/TreeView.tests.d.ts.map +0 -1
- package/lib/test/TreeView.tests.js +0 -178
- package/lib/test/TreeView.tests.js.map +0 -1
- package/lib/test/UndoRedoHandler.tests.d.ts +0 -6
- package/lib/test/UndoRedoHandler.tests.d.ts.map +0 -1
- package/lib/test/UndoRedoHandler.tests.js +0 -37
- package/lib/test/UndoRedoHandler.tests.js.map +0 -1
- package/lib/test/fuzz/Generators.d.ts +0 -8
- package/lib/test/fuzz/Generators.d.ts.map +0 -1
- package/lib/test/fuzz/Generators.js +0 -345
- package/lib/test/fuzz/Generators.js.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +0 -23
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +0 -241
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +0 -1
- package/lib/test/fuzz/Types.d.ts +0 -136
- package/lib/test/fuzz/Types.d.ts.map +0 -1
- package/lib/test/fuzz/Types.js +0 -6
- package/lib/test/fuzz/Types.js.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +0 -246
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +0 -608
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +0 -1
- package/lib/test/utilities/MockTransaction.d.ts +0 -35
- package/lib/test/utilities/MockTransaction.d.ts.map +0 -1
- package/lib/test/utilities/MockTransaction.js +0 -51
- package/lib/test/utilities/MockTransaction.js.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +0 -12
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.js +0 -223
- package/lib/test/utilities/PendingLocalStateTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeTests.d.ts +0 -12
- package/lib/test/utilities/SharedTreeTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeTests.js +0 -949
- package/lib/test/utilities/SharedTreeTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +0 -11
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +0 -439
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +0 -10
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.js +0 -105
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +0 -1
- package/lib/test/utilities/SummarySizeTests.d.ts +0 -11
- package/lib/test/utilities/SummarySizeTests.d.ts.map +0 -1
- package/lib/test/utilities/SummarySizeTests.js +0 -160
- package/lib/test/utilities/SummarySizeTests.js.map +0 -1
- package/lib/test/utilities/TestCommon.d.ts +0 -13
- package/lib/test/utilities/TestCommon.d.ts.map +0 -1
- package/lib/test/utilities/TestCommon.js +0 -19
- package/lib/test/utilities/TestCommon.js.map +0 -1
- package/lib/test/utilities/TestNode.d.ts +0 -140
- package/lib/test/utilities/TestNode.d.ts.map +0 -1
- package/lib/test/utilities/TestNode.js +0 -282
- package/lib/test/utilities/TestNode.js.map +0 -1
- package/lib/test/utilities/TestSerializer.d.ts +0 -24
- package/lib/test/utilities/TestSerializer.d.ts.map +0 -1
- package/lib/test/utilities/TestSerializer.js +0 -40
- package/lib/test/utilities/TestSerializer.js.map +0 -1
- package/lib/test/utilities/TestUtilities.d.ts +0 -212
- package/lib/test/utilities/TestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/TestUtilities.js +0 -413
- package/lib/test/utilities/TestUtilities.js.map +0 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +0 -32
- package/lib/test/utilities/UndoRedoTests.d.ts.map +0 -1
- package/lib/test/utilities/UndoRedoTests.js +0 -317
- package/lib/test/utilities/UndoRedoTests.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,576 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { expect, assert } from 'chai';
|
|
6
|
-
import { getChangeNodeFromViewNode } from '../SerializationUtilities.js';
|
|
7
|
-
import { TransactionInternal } from '../TransactionInternal.js';
|
|
8
|
-
import { ChangeInternal, ChangeTypeInternal, ConstraintEffect, EditStatus, Side, StablePlaceInternal, StableRangeInternal, } from '../persisted-types/index.js';
|
|
9
|
-
import { StablePlace, StableRange } from '../ChangeTypes.js';
|
|
10
|
-
import { deepCompareNodes, PlaceValidationResult, RangeValidationResultKind } from '../EditUtilities.js';
|
|
11
|
-
import { SimpleTestTree } from './utilities/TestNode.js';
|
|
12
|
-
import { refreshTestTree, testTrait, testTraitLabel } from './utilities/TestUtilities.js';
|
|
13
|
-
describe('Transaction', () => {
|
|
14
|
-
let transaction;
|
|
15
|
-
const testTree = refreshTestTree(undefined, (t) => {
|
|
16
|
-
transaction = TransactionInternal.factory(t.view);
|
|
17
|
-
}, true);
|
|
18
|
-
describe('Constraints', () => {
|
|
19
|
-
function getTestTrait() {
|
|
20
|
-
return StableRange.all(testTrait(transaction.view));
|
|
21
|
-
}
|
|
22
|
-
it('can be met', () => {
|
|
23
|
-
transaction.applyChange({
|
|
24
|
-
toConstrain: getTestTrait(),
|
|
25
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
26
|
-
type: ChangeTypeInternal.Constraint,
|
|
27
|
-
});
|
|
28
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
29
|
-
});
|
|
30
|
-
it('can be unmet', () => {
|
|
31
|
-
const badId = testTree.generateNodeId('not in tree');
|
|
32
|
-
const invalidStableRange = {
|
|
33
|
-
start: { side: Side.After, referenceSibling: badId },
|
|
34
|
-
end: { side: Side.Before },
|
|
35
|
-
};
|
|
36
|
-
const constraint = {
|
|
37
|
-
toConstrain: {
|
|
38
|
-
start: { side: Side.After, referenceSibling: badId },
|
|
39
|
-
end: { side: Side.Before },
|
|
40
|
-
},
|
|
41
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
42
|
-
type: ChangeTypeInternal.Constraint,
|
|
43
|
-
};
|
|
44
|
-
transaction.applyChange(constraint);
|
|
45
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
46
|
-
const result = transaction.close();
|
|
47
|
-
assert(result.status === EditStatus.Invalid);
|
|
48
|
-
expect(result.failure).deep.equals({
|
|
49
|
-
kind: TransactionInternal.FailureKind.ConstraintViolation,
|
|
50
|
-
constraint,
|
|
51
|
-
violation: {
|
|
52
|
-
kind: TransactionInternal.ConstraintViolationKind.BadRange,
|
|
53
|
-
rangeFailure: {
|
|
54
|
-
kind: RangeValidationResultKind.BadPlace,
|
|
55
|
-
place: invalidStableRange.start,
|
|
56
|
-
placeFailure: PlaceValidationResult.MissingSibling,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
it('effect can apply anyway', () => {
|
|
62
|
-
const badId = testTree.generateNodeId('not in tree');
|
|
63
|
-
transaction.applyChange({
|
|
64
|
-
toConstrain: {
|
|
65
|
-
start: { side: Side.After, referenceSibling: badId },
|
|
66
|
-
end: { side: Side.Before },
|
|
67
|
-
},
|
|
68
|
-
effect: ConstraintEffect.ValidRetry,
|
|
69
|
-
type: ChangeTypeInternal.Constraint,
|
|
70
|
-
});
|
|
71
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
72
|
-
});
|
|
73
|
-
it('length can be met', () => {
|
|
74
|
-
transaction.applyChange({
|
|
75
|
-
toConstrain: getTestTrait(),
|
|
76
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
77
|
-
type: ChangeTypeInternal.Constraint,
|
|
78
|
-
length: 0,
|
|
79
|
-
});
|
|
80
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
81
|
-
});
|
|
82
|
-
it('length can be unmet', () => {
|
|
83
|
-
const constraint = {
|
|
84
|
-
toConstrain: getTestTrait(),
|
|
85
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
86
|
-
type: ChangeTypeInternal.Constraint,
|
|
87
|
-
length: 1,
|
|
88
|
-
};
|
|
89
|
-
transaction.applyChange(constraint);
|
|
90
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
91
|
-
const result = transaction.close();
|
|
92
|
-
assert(result.status === EditStatus.Invalid);
|
|
93
|
-
expect(result.failure).deep.equals({
|
|
94
|
-
kind: TransactionInternal.FailureKind.ConstraintViolation,
|
|
95
|
-
constraint,
|
|
96
|
-
violation: {
|
|
97
|
-
kind: TransactionInternal.ConstraintViolationKind.BadLength,
|
|
98
|
-
actual: 0,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
it('parent can be met', () => {
|
|
103
|
-
transaction.applyChange({
|
|
104
|
-
toConstrain: getTestTrait(),
|
|
105
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
106
|
-
type: ChangeTypeInternal.Constraint,
|
|
107
|
-
parentNode: testTree.identifier,
|
|
108
|
-
});
|
|
109
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
110
|
-
});
|
|
111
|
-
it('parent can be unmet', () => {
|
|
112
|
-
const parentNode = testTree.generateNodeId('not in tree');
|
|
113
|
-
const constraint = {
|
|
114
|
-
toConstrain: getTestTrait(),
|
|
115
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
116
|
-
type: ChangeTypeInternal.Constraint,
|
|
117
|
-
parentNode,
|
|
118
|
-
};
|
|
119
|
-
transaction.applyChange(constraint);
|
|
120
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
121
|
-
const result = transaction.close();
|
|
122
|
-
assert(result.status === EditStatus.Invalid);
|
|
123
|
-
expect(result.failure).deep.equals({
|
|
124
|
-
kind: TransactionInternal.FailureKind.ConstraintViolation,
|
|
125
|
-
constraint,
|
|
126
|
-
violation: {
|
|
127
|
-
kind: TransactionInternal.ConstraintViolationKind.BadParent,
|
|
128
|
-
actual: parentNode,
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
it('label can be met', () => {
|
|
133
|
-
transaction.applyChange({
|
|
134
|
-
toConstrain: getTestTrait(),
|
|
135
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
136
|
-
type: ChangeTypeInternal.Constraint,
|
|
137
|
-
label: testTraitLabel,
|
|
138
|
-
});
|
|
139
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
140
|
-
});
|
|
141
|
-
it('label can be unmet', () => {
|
|
142
|
-
const constraint = {
|
|
143
|
-
toConstrain: getTestTrait(),
|
|
144
|
-
effect: ConstraintEffect.InvalidAndDiscard,
|
|
145
|
-
type: ChangeTypeInternal.Constraint,
|
|
146
|
-
label: '7969ee2e-5418-43db-929a-4e9a23c5499d',
|
|
147
|
-
};
|
|
148
|
-
transaction.applyChange(constraint);
|
|
149
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
150
|
-
const result = transaction.close();
|
|
151
|
-
assert(result.status === EditStatus.Invalid);
|
|
152
|
-
expect(result.failure).deep.equals({
|
|
153
|
-
kind: TransactionInternal.FailureKind.ConstraintViolation,
|
|
154
|
-
constraint,
|
|
155
|
-
violation: {
|
|
156
|
-
kind: TransactionInternal.ConstraintViolationKind.BadLabel,
|
|
157
|
-
actual: testTraitLabel,
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('SetValue', () => {
|
|
163
|
-
it('can be invalid if the node does not exist', () => {
|
|
164
|
-
const change = {
|
|
165
|
-
nodeToModify: testTree.generateNodeId(),
|
|
166
|
-
payload: {},
|
|
167
|
-
type: ChangeTypeInternal.SetValue,
|
|
168
|
-
};
|
|
169
|
-
transaction.applyChange(change);
|
|
170
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
171
|
-
const result = transaction.close();
|
|
172
|
-
assert(result.status === EditStatus.Invalid);
|
|
173
|
-
expect(result.failure).deep.equals({
|
|
174
|
-
kind: TransactionInternal.FailureKind.UnknownId,
|
|
175
|
-
change,
|
|
176
|
-
id: change.nodeToModify,
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
it('can change payload', () => {
|
|
180
|
-
const payload = { foo: {} };
|
|
181
|
-
transaction.applyChange({
|
|
182
|
-
nodeToModify: testTree.identifier,
|
|
183
|
-
payload,
|
|
184
|
-
type: ChangeTypeInternal.SetValue,
|
|
185
|
-
});
|
|
186
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
187
|
-
expect(transaction.view.getViewNode(testTree.identifier).payload).deep.equals(payload);
|
|
188
|
-
});
|
|
189
|
-
// 'null' is not included here since it means clear the payload in setValue.
|
|
190
|
-
for (const payload of [0, '', [], {}]) {
|
|
191
|
-
it(`can set payload to ${JSON.stringify(payload)}`, () => {
|
|
192
|
-
transaction.applyChange({
|
|
193
|
-
nodeToModify: testTree.identifier,
|
|
194
|
-
payload,
|
|
195
|
-
type: ChangeTypeInternal.SetValue,
|
|
196
|
-
});
|
|
197
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
198
|
-
expect(transaction.view.getViewNode(testTree.identifier).payload).equals(payload);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
it('can clear an unset payload', () => {
|
|
202
|
-
transaction.applyChange(ChangeInternal.clearPayload(testTree.identifier));
|
|
203
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
204
|
-
expect({}.hasOwnProperty.call(transaction.view.getViewNode(testTree.identifier), 'payload')).to.be.false;
|
|
205
|
-
expect({}.hasOwnProperty.call(getChangeNodeFromViewNode(transaction.view, testTree.identifier), 'payload'))
|
|
206
|
-
.to.be.false;
|
|
207
|
-
});
|
|
208
|
-
it('can clear a set payload', () => {
|
|
209
|
-
transaction.applyChange({
|
|
210
|
-
nodeToModify: testTree.identifier,
|
|
211
|
-
payload: {},
|
|
212
|
-
type: ChangeTypeInternal.SetValue,
|
|
213
|
-
});
|
|
214
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
215
|
-
expect(transaction.view.getViewNode(testTree.identifier).payload).not.undefined;
|
|
216
|
-
transaction.applyChange(ChangeInternal.clearPayload(testTree.identifier));
|
|
217
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
218
|
-
expect({}.hasOwnProperty.call(transaction.view.getViewNode(testTree.identifier), 'payload')).to.be.false;
|
|
219
|
-
expect({}.hasOwnProperty.call(getChangeNodeFromViewNode(transaction.view, testTree.identifier), 'payload'))
|
|
220
|
-
.to.be.false;
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
describe('Insert', () => {
|
|
224
|
-
const buildId = 0;
|
|
225
|
-
describe('can be malformed', () => {
|
|
226
|
-
it('when the detached sequence ID is bogus', () => {
|
|
227
|
-
transaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));
|
|
228
|
-
const change = ChangeInternal.insert(
|
|
229
|
-
// Non-existent detached id
|
|
230
|
-
1, { referenceSibling: testTree.identifier, side: Side.After });
|
|
231
|
-
transaction.applyChange(change);
|
|
232
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
233
|
-
const result = transaction.close();
|
|
234
|
-
assert(result.status === EditStatus.Malformed);
|
|
235
|
-
expect(result.failure).deep.equals({
|
|
236
|
-
kind: TransactionInternal.FailureKind.DetachedSequenceNotFound,
|
|
237
|
-
change,
|
|
238
|
-
sequenceId: change.source,
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
it('when the target place is malformed', () => {
|
|
242
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
243
|
-
transaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));
|
|
244
|
-
const referenceTrait = testTree.left.traitLocation;
|
|
245
|
-
const malformedPlace = {
|
|
246
|
-
// A place is malformed if it has both a reference trait and a reference sibling
|
|
247
|
-
referenceTrait,
|
|
248
|
-
referenceSibling: testTree.left.identifier,
|
|
249
|
-
side: Side.Before,
|
|
250
|
-
};
|
|
251
|
-
const change = ChangeInternal.insert(buildId, malformedPlace);
|
|
252
|
-
transaction.applyChange(change);
|
|
253
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
254
|
-
const result = transaction.close();
|
|
255
|
-
assert(result.status === EditStatus.Malformed);
|
|
256
|
-
expect(result.failure).deep.equals({
|
|
257
|
-
kind: TransactionInternal.FailureKind.BadPlace,
|
|
258
|
-
change,
|
|
259
|
-
place: malformedPlace,
|
|
260
|
-
placeFailure: PlaceValidationResult.Malformed,
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
it('can be invalid when the target place is invalid', () => {
|
|
265
|
-
const badId = testTree.generateNodeId('not in tree');
|
|
266
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
267
|
-
transaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));
|
|
268
|
-
const place = {
|
|
269
|
-
referenceSibling: badId,
|
|
270
|
-
side: Side.After,
|
|
271
|
-
};
|
|
272
|
-
const change = ChangeInternal.insert(buildId, place);
|
|
273
|
-
transaction.applyChange(change);
|
|
274
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
275
|
-
const result = transaction.close();
|
|
276
|
-
assert(result.status === EditStatus.Invalid);
|
|
277
|
-
expect(result.failure).deep.equals({
|
|
278
|
-
kind: TransactionInternal.FailureKind.BadPlace,
|
|
279
|
-
change,
|
|
280
|
-
place,
|
|
281
|
-
placeFailure: PlaceValidationResult.MissingSibling,
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
it('a detached node with a payload', () => {
|
|
285
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
286
|
-
const payload = 42;
|
|
287
|
-
const detachedId = 0;
|
|
288
|
-
transaction.applyChanges([
|
|
289
|
-
ChangeInternal.setPayload(testTree.left.identifier, payload),
|
|
290
|
-
ChangeInternal.detach(StableRange.only(testTree.left), detachedId),
|
|
291
|
-
ChangeInternal.insert(detachedId, StablePlace.atStartOf(testTree.left.traitLocation)),
|
|
292
|
-
]);
|
|
293
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([testTree.left.identifier]);
|
|
294
|
-
expect(transaction.view.getViewNode(testTree.left.identifier).payload).to.equal(payload);
|
|
295
|
-
});
|
|
296
|
-
[Side.Before, Side.After].forEach((side) => {
|
|
297
|
-
it(`can insert a node at the ${side === Side.After ? 'beginning' : 'end'} of a trait`, () => {
|
|
298
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
299
|
-
const newNodeId = testTree.generateNodeId();
|
|
300
|
-
const newNode = testTree.buildLeafInternal(newNodeId);
|
|
301
|
-
transaction.applyChanges(ChangeInternal.insertTree([newNode], side === Side.After
|
|
302
|
-
? StablePlace.atStartOf(testTree.left.traitLocation)
|
|
303
|
-
: StablePlace.atEndOf(testTree.left.traitLocation)));
|
|
304
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals(side === Side.After ? [newNodeId, testTree.left.identifier] : [testTree.left.identifier, newNodeId]);
|
|
305
|
-
});
|
|
306
|
-
it(`can insert a node ${side === Side.Before ? 'before' : 'after'} another node`, () => {
|
|
307
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
308
|
-
const newNode = testTree.buildLeafInternal();
|
|
309
|
-
transaction.applyChanges(ChangeInternal.insertTree([newNode], { referenceSibling: testTree.left.identifier, side }));
|
|
310
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals(side === Side.Before
|
|
311
|
-
? [newNode.identifier, testTree.left.identifier]
|
|
312
|
-
: [testTree.left.identifier, newNode.identifier]);
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
describe('Build', () => {
|
|
317
|
-
it('can be malformed due to detached ID collision', () => {
|
|
318
|
-
// Apply two Build_s with the same detached id
|
|
319
|
-
transaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], 0));
|
|
320
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
321
|
-
const change = ChangeInternal.build([testTree.buildLeafInternal()], 0);
|
|
322
|
-
transaction.applyChange(change);
|
|
323
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
324
|
-
const result = transaction.close();
|
|
325
|
-
assert(result.status === EditStatus.Malformed);
|
|
326
|
-
expect(result.failure).deep.equals({
|
|
327
|
-
kind: TransactionInternal.FailureKind.DetachedSequenceIdAlreadyInUse,
|
|
328
|
-
change,
|
|
329
|
-
sequenceId: change.destination,
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
it('can be malformed due to duplicate node identifiers', () => {
|
|
333
|
-
// Build two nodes with the same identifier, one of them nested
|
|
334
|
-
const newNode = testTree.buildLeafInternal();
|
|
335
|
-
const change = ChangeInternal.build([
|
|
336
|
-
newNode,
|
|
337
|
-
{
|
|
338
|
-
...testTree.buildLeafInternal(),
|
|
339
|
-
traits: {
|
|
340
|
-
[testTree.left.traitLabel]: [
|
|
341
|
-
{ ...testTree.buildLeafInternal(), identifier: newNode.identifier },
|
|
342
|
-
],
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
], 0);
|
|
346
|
-
transaction.applyChange(change);
|
|
347
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
348
|
-
const result = transaction.close();
|
|
349
|
-
assert(result.status === EditStatus.Malformed);
|
|
350
|
-
expect(result.failure).deep.equals({
|
|
351
|
-
kind: TransactionInternal.FailureKind.DuplicateIdInBuild,
|
|
352
|
-
change,
|
|
353
|
-
id: newNode.identifier,
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
it('is invalid when a node already exists with the given identifier', () => {
|
|
357
|
-
// Build two nodes with the same identifier
|
|
358
|
-
const identifier = testTree.generateNodeId();
|
|
359
|
-
const node1 = {
|
|
360
|
-
identifier,
|
|
361
|
-
definition: SimpleTestTree.definition,
|
|
362
|
-
traits: {},
|
|
363
|
-
};
|
|
364
|
-
const node2 = {
|
|
365
|
-
identifier,
|
|
366
|
-
definition: SimpleTestTree.definition,
|
|
367
|
-
traits: {},
|
|
368
|
-
};
|
|
369
|
-
transaction.applyChange(ChangeInternal.build([node1], 0));
|
|
370
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
371
|
-
const change = ChangeInternal.build([node2], 1);
|
|
372
|
-
transaction.applyChange(change);
|
|
373
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
374
|
-
const result = transaction.close();
|
|
375
|
-
assert(result.status === EditStatus.Invalid);
|
|
376
|
-
expect(result.failure).deep.equals({
|
|
377
|
-
kind: TransactionInternal.FailureKind.IdAlreadyInUse,
|
|
378
|
-
change,
|
|
379
|
-
id: identifier,
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
it('is invalid to build a node that has already been inserted', () => {
|
|
383
|
-
// Build new node using identifier already in use in the tree
|
|
384
|
-
const newNode = {
|
|
385
|
-
identifier: testTree.left.identifier,
|
|
386
|
-
definition: SimpleTestTree.definition,
|
|
387
|
-
traits: {},
|
|
388
|
-
};
|
|
389
|
-
transaction.applyChange(ChangeInternal.build([newNode], 0));
|
|
390
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
391
|
-
const result = transaction.close();
|
|
392
|
-
assert(result.status === EditStatus.Invalid);
|
|
393
|
-
expect(result.failure.kind).equals(TransactionInternal.FailureKind.IdAlreadyInUse);
|
|
394
|
-
});
|
|
395
|
-
it('can build a detached node', () => {
|
|
396
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
397
|
-
const newNode = testTree.buildLeafInternal();
|
|
398
|
-
transaction.applyChange(ChangeInternal.build([newNode], 0));
|
|
399
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
400
|
-
expect(transaction.view.hasNode(newNode.identifier)).is.true;
|
|
401
|
-
expect(transaction.view.tryGetParentViewNode(newNode.identifier)).is.undefined;
|
|
402
|
-
expect(deepCompareNodes(getChangeNodeFromViewNode(transaction.view, newNode.identifier), newNode)).to.be
|
|
403
|
-
.true;
|
|
404
|
-
});
|
|
405
|
-
it("can be malformed if detached sequence id doesn't exist", () => {
|
|
406
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
407
|
-
const detachedSequenceId = 0;
|
|
408
|
-
const change = {
|
|
409
|
-
destination: 1,
|
|
410
|
-
source: [detachedSequenceId],
|
|
411
|
-
type: ChangeTypeInternal.Build,
|
|
412
|
-
};
|
|
413
|
-
transaction.applyChange(change);
|
|
414
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
415
|
-
const result = transaction.close();
|
|
416
|
-
assert(result.status === EditStatus.Malformed);
|
|
417
|
-
expect(result.failure).deep.equals({
|
|
418
|
-
kind: TransactionInternal.FailureKind.DetachedSequenceNotFound,
|
|
419
|
-
change,
|
|
420
|
-
sequenceId: detachedSequenceId,
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
it('can build a node with an explicit empty trait', () => {
|
|
424
|
-
// Forest should strip off the empty trait
|
|
425
|
-
const nodeWithEmpty = testTree.buildLeafInternal();
|
|
426
|
-
const traits = new Map();
|
|
427
|
-
const emptyTrait = [];
|
|
428
|
-
traits.set(testTree.left.traitLabel, emptyTrait);
|
|
429
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
430
|
-
const detachedSequenceId = 0;
|
|
431
|
-
transaction.applyChange(ChangeInternal.build([nodeWithEmpty], detachedSequenceId));
|
|
432
|
-
expect(transaction.status).equals(EditStatus.Applied);
|
|
433
|
-
const viewNodeWithEmpty = transaction.view.getViewNode(nodeWithEmpty.identifier);
|
|
434
|
-
expect(viewNodeWithEmpty.traits.size).to.equal(0);
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
describe('Detach', () => {
|
|
438
|
-
it('can be malformed if the target range is malformed', () => {
|
|
439
|
-
const malformedPlace = {
|
|
440
|
-
// A place is malformed if it has both a reference trait and a reference sibling
|
|
441
|
-
referenceTrait: testTree.left.traitLocation,
|
|
442
|
-
referenceSibling: testTree.left.identifier,
|
|
443
|
-
side: Side.Before,
|
|
444
|
-
};
|
|
445
|
-
const range = StableRangeInternal.from(malformedPlace).to(StablePlaceInternal.after(testTree.right));
|
|
446
|
-
const change = ChangeInternal.detach(range);
|
|
447
|
-
// Supplied StableRange is malformed
|
|
448
|
-
transaction.applyChange(change);
|
|
449
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
450
|
-
const result = transaction.close();
|
|
451
|
-
assert(result.status === EditStatus.Malformed);
|
|
452
|
-
expect(result.failure).deep.equals({
|
|
453
|
-
kind: TransactionInternal.FailureKind.BadRange,
|
|
454
|
-
change,
|
|
455
|
-
range,
|
|
456
|
-
rangeFailure: {
|
|
457
|
-
kind: RangeValidationResultKind.BadPlace,
|
|
458
|
-
place: malformedPlace,
|
|
459
|
-
placeFailure: PlaceValidationResult.Malformed,
|
|
460
|
-
},
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
it('can be malformed if the destination sequence id is already in use', () => {
|
|
464
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), 0));
|
|
465
|
-
const change = ChangeInternal.detach(StableRangeInternal.only(testTree.right), 0);
|
|
466
|
-
// Supplied StableRange is malformed
|
|
467
|
-
transaction.applyChange(change);
|
|
468
|
-
expect(transaction.status).equals(EditStatus.Malformed);
|
|
469
|
-
const result = transaction.close();
|
|
470
|
-
assert(result.status === EditStatus.Malformed);
|
|
471
|
-
expect(result.failure).deep.equals({
|
|
472
|
-
kind: TransactionInternal.FailureKind.DetachedSequenceIdAlreadyInUse,
|
|
473
|
-
change,
|
|
474
|
-
sequenceId: change.destination,
|
|
475
|
-
});
|
|
476
|
-
});
|
|
477
|
-
it('can be invalid if the target range is invalid', () => {
|
|
478
|
-
const range = StableRangeInternal.from(StablePlaceInternal.atEndOf(testTree.left.traitLocation)).to(StablePlaceInternal.atStartOf(testTree.left.traitLocation));
|
|
479
|
-
const change = ChangeInternal.detach(range);
|
|
480
|
-
// Start place is before end place
|
|
481
|
-
transaction.applyChange(change);
|
|
482
|
-
expect(transaction.status).equals(EditStatus.Invalid);
|
|
483
|
-
const result = transaction.close();
|
|
484
|
-
assert(result.status === EditStatus.Invalid);
|
|
485
|
-
expect(result.failure).deep.equals({
|
|
486
|
-
kind: TransactionInternal.FailureKind.BadRange,
|
|
487
|
-
change,
|
|
488
|
-
range,
|
|
489
|
-
rangeFailure: RangeValidationResultKind.Inverted,
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
it('can delete a node', () => {
|
|
493
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left)));
|
|
494
|
-
expect(transaction.view.hasNode(testTree.left.identifier)).is.false;
|
|
495
|
-
});
|
|
496
|
-
});
|
|
497
|
-
describe('Composite changes', () => {
|
|
498
|
-
it('can form a node move', () => {
|
|
499
|
-
const detachedId = 0;
|
|
500
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId));
|
|
501
|
-
transaction.applyChange(ChangeInternal.insert(detachedId, StablePlaceInternal.after(testTree.right)));
|
|
502
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([]);
|
|
503
|
-
expect(transaction.view.getTrait(testTree.right.traitLocation)).deep.equals([
|
|
504
|
-
testTree.right.identifier,
|
|
505
|
-
testTree.left.identifier,
|
|
506
|
-
]);
|
|
507
|
-
});
|
|
508
|
-
it('can form a wrap insert', () => {
|
|
509
|
-
// A wrap insert is an edit that inserts a new node between a subtree and its parent atomically.
|
|
510
|
-
// Ex: given A -> B -> C, a wrap insert of D around B would produce A -> D -> B -> C
|
|
511
|
-
const leftNodeDetachedId = 0;
|
|
512
|
-
const parentDetachedId = 1;
|
|
513
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), leftNodeDetachedId));
|
|
514
|
-
// This is node D, from the example
|
|
515
|
-
const wrappingParentId = testTree.generateNodeId();
|
|
516
|
-
const wrappingParentNode = testTree.buildLeafInternal(wrappingParentId);
|
|
517
|
-
const wrappingTraitLabel = 'wrapTrait';
|
|
518
|
-
transaction.applyChange(ChangeInternal.build([
|
|
519
|
-
{
|
|
520
|
-
...wrappingParentNode,
|
|
521
|
-
traits: { [wrappingTraitLabel]: [leftNodeDetachedId] }, // Re-parent left under new node
|
|
522
|
-
},
|
|
523
|
-
], parentDetachedId));
|
|
524
|
-
transaction.applyChange(ChangeInternal.insert(parentDetachedId, StablePlace.atStartOf(testTree.left.traitLocation)));
|
|
525
|
-
const leftTrait = transaction.view.getTrait(testTree.left.traitLocation);
|
|
526
|
-
expect(leftTrait).deep.equals([wrappingParentId]);
|
|
527
|
-
const wrappingTrait = transaction.view.getTrait({
|
|
528
|
-
parent: wrappingParentId,
|
|
529
|
-
label: wrappingTraitLabel,
|
|
530
|
-
});
|
|
531
|
-
expect(wrappingTrait).deep.equals([testTree.left.identifier]);
|
|
532
|
-
});
|
|
533
|
-
it('can build and insert a tree that contains detached subtrees', () => {
|
|
534
|
-
const leftNodeDetachedId = 0;
|
|
535
|
-
const rightNodeDetachedId = 1;
|
|
536
|
-
const detachedIdSubtree = 2;
|
|
537
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), leftNodeDetachedId));
|
|
538
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.right), rightNodeDetachedId));
|
|
539
|
-
const detachedNodeId = testTree.generateNodeId();
|
|
540
|
-
const detachedSubtree = {
|
|
541
|
-
...testTree.buildLeafInternal(detachedNodeId),
|
|
542
|
-
traits: {
|
|
543
|
-
[testTree.left.traitLabel]: [leftNodeDetachedId],
|
|
544
|
-
[testTree.right.traitLabel]: [rightNodeDetachedId],
|
|
545
|
-
},
|
|
546
|
-
};
|
|
547
|
-
transaction.applyChange(ChangeInternal.build([detachedSubtree], detachedIdSubtree));
|
|
548
|
-
transaction.applyChange(ChangeInternal.insert(detachedIdSubtree, StablePlace.atStartOf(testTree.left.traitLocation)));
|
|
549
|
-
expect(transaction.view.getTrait(testTree.right.traitLocation)).deep.equals([]);
|
|
550
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([detachedNodeId]);
|
|
551
|
-
const insertedSubtree = getChangeNodeFromViewNode(transaction.view, detachedNodeId);
|
|
552
|
-
const traits = insertedSubtree.traits;
|
|
553
|
-
const leftTreeTraits = traits[testTree.left.traitLabel];
|
|
554
|
-
expect(leftTreeTraits).to.have.lengthOf(1);
|
|
555
|
-
expect(deepCompareNodes(leftTreeTraits[0], testTree.left)).to.be.true;
|
|
556
|
-
const rightTreeTraits = traits[testTree.right.traitLabel];
|
|
557
|
-
expect(rightTreeTraits).to.have.lengthOf(1);
|
|
558
|
-
expect(deepCompareNodes(rightTreeTraits[0], testTree.right)).to.be.true;
|
|
559
|
-
});
|
|
560
|
-
it('can build and insert a tree with the same identity as that of a detached subtree', () => {
|
|
561
|
-
const transaction = TransactionInternal.factory(testTree.view);
|
|
562
|
-
transaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left)));
|
|
563
|
-
const idOfDetachedNodeToInsert = 1;
|
|
564
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([]);
|
|
565
|
-
const newNode = {
|
|
566
|
-
identifier: testTree.left.identifier,
|
|
567
|
-
definition: SimpleTestTree.definition,
|
|
568
|
-
traits: {},
|
|
569
|
-
};
|
|
570
|
-
transaction.applyChange(ChangeInternal.build([newNode], idOfDetachedNodeToInsert));
|
|
571
|
-
transaction.applyChange(ChangeInternal.insert(idOfDetachedNodeToInsert, StablePlace.atStartOf(testTree.left.traitLocation)));
|
|
572
|
-
expect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([testTree.left.identifier]);
|
|
573
|
-
});
|
|
574
|
-
});
|
|
575
|
-
});
|
|
576
|
-
//# sourceMappingURL=TransactionInternal.tests.js.map
|