@fluid-experimental/tree 0.58.2002 → 0.58.3000-61081
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/README.md +9 -9
- package/dist/ChangeCompression.d.ts +39 -0
- package/dist/ChangeCompression.d.ts.map +1 -0
- package/dist/ChangeCompression.js +117 -0
- package/dist/ChangeCompression.js.map +1 -0
- package/{lib/default-edits/PersistedTypes.d.ts → dist/ChangeTypes.d.ts} +58 -100
- package/dist/ChangeTypes.d.ts.map +1 -0
- package/dist/{default-edits/PersistedTypes.js → ChangeTypes.js} +21 -76
- package/dist/ChangeTypes.js.map +1 -0
- package/dist/Checkout.d.ts +39 -27
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +59 -31
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +175 -38
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +240 -103
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +24 -0
- package/dist/EagerCheckout.d.ts.map +1 -0
- package/dist/{BasicCheckout.js → EagerCheckout.js} +9 -6
- package/dist/EagerCheckout.js.map +1 -0
- package/dist/EditLog.d.ts +77 -63
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +85 -48
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +168 -0
- package/dist/EditUtilities.d.ts.map +1 -0
- package/dist/EditUtilities.js +373 -0
- package/dist/EditUtilities.js.map +1 -0
- package/dist/EventTypes.d.ts +73 -0
- package/dist/EventTypes.d.ts.map +1 -0
- package/dist/EventTypes.js +78 -0
- package/dist/EventTypes.js.map +1 -0
- package/dist/Forest.d.ts +29 -7
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +60 -36
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +20 -0
- package/dist/HistoryEditFactory.d.ts.map +1 -0
- package/dist/HistoryEditFactory.js +226 -0
- package/dist/HistoryEditFactory.js.map +1 -0
- package/dist/IdConversion.d.ts +12 -0
- package/dist/IdConversion.d.ts.map +1 -0
- package/dist/IdConversion.js +98 -0
- package/dist/IdConversion.js.map +1 -0
- package/dist/Identifiers.d.ts +89 -2
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js +10 -0
- package/dist/Identifiers.js.map +1 -1
- package/dist/InitialTree.d.ts +2 -2
- package/dist/InitialTree.d.ts.map +1 -1
- package/dist/InitialTree.js +2 -1
- package/dist/InitialTree.js.map +1 -1
- package/dist/LazyCheckout.d.ts +28 -0
- package/dist/LazyCheckout.d.ts.map +1 -0
- package/dist/LazyCheckout.js +44 -0
- package/dist/LazyCheckout.js.map +1 -0
- package/dist/LogViewer.d.ts +130 -85
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +110 -85
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts +221 -0
- package/dist/MergeHealth.d.ts.map +1 -0
- package/dist/MergeHealth.js +263 -0
- package/dist/MergeHealth.js.map +1 -0
- package/dist/NodeIdUtilities.d.ts +90 -0
- package/dist/NodeIdUtilities.d.ts.map +1 -0
- package/dist/NodeIdUtilities.js +60 -0
- package/dist/NodeIdUtilities.js.map +1 -0
- package/dist/PayloadUtilities.d.ts +42 -0
- package/dist/PayloadUtilities.d.ts.map +1 -0
- package/dist/PayloadUtilities.js +114 -0
- package/dist/PayloadUtilities.js.map +1 -0
- package/dist/ReconciliationPath.d.ts +18 -13
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +11 -2
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -3
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +83 -0
- package/dist/RevisionView.d.ts.map +1 -0
- package/dist/RevisionView.js +182 -0
- package/dist/RevisionView.js.map +1 -0
- package/dist/SerializationUtilities.d.ts +36 -0
- package/dist/SerializationUtilities.d.ts.map +1 -0
- package/dist/SerializationUtilities.js +102 -0
- package/dist/SerializationUtilities.js.map +1 -0
- package/dist/SharedTree.d.ts +400 -0
- package/dist/SharedTree.d.ts.map +1 -0
- package/dist/SharedTree.js +1064 -0
- package/dist/SharedTree.js.map +1 -0
- package/dist/SharedTreeEncoder.d.ts +102 -0
- package/dist/SharedTreeEncoder.d.ts.map +1 -0
- package/dist/SharedTreeEncoder.js +313 -0
- package/dist/SharedTreeEncoder.js.map +1 -0
- package/dist/StringInterner.d.ts +46 -0
- package/dist/StringInterner.d.ts.map +1 -0
- package/dist/StringInterner.js +61 -0
- package/dist/StringInterner.js.map +1 -0
- package/dist/Summary.d.ts +40 -0
- package/dist/Summary.d.ts.map +1 -0
- package/dist/Summary.js +23 -0
- package/dist/Summary.js.map +1 -0
- package/dist/SummaryBackCompatibility.d.ts +22 -22
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js +30 -33
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +31 -0
- package/dist/SummaryTestUtilities.d.ts.map +1 -0
- package/dist/SummaryTestUtilities.js +37 -0
- package/dist/SummaryTestUtilities.js.map +1 -0
- package/dist/Transaction.d.ts +53 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +76 -0
- package/dist/Transaction.js.map +1 -0
- package/dist/TransactionInternal.d.ts +543 -0
- package/dist/TransactionInternal.d.ts.map +1 -0
- package/dist/TransactionInternal.js +622 -0
- package/dist/TransactionInternal.js.map +1 -0
- package/dist/TreeCompressor.d.ts +37 -0
- package/dist/TreeCompressor.d.ts.map +1 -0
- package/dist/TreeCompressor.js +132 -0
- package/dist/TreeCompressor.js.map +1 -0
- package/dist/TreeNodeHandle.d.ts +12 -18
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js +13 -23
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +166 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +217 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/TreeViewUtilities.d.ts +21 -0
- package/dist/TreeViewUtilities.d.ts.map +1 -0
- package/dist/TreeViewUtilities.js +77 -0
- package/dist/TreeViewUtilities.js.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/dist/UndoRedoHandler.d.ts.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +5 -9
- package/dist/UndoRedoHandler.js.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.js +283 -0
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/dist/id-compressor/IdCompressor.d.ts +389 -0
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -0
- package/dist/id-compressor/IdCompressor.js +1353 -0
- package/dist/id-compressor/IdCompressor.js.map +1 -0
- package/dist/id-compressor/IdRange.d.ts +11 -0
- package/dist/id-compressor/IdRange.d.ts.map +1 -0
- package/dist/id-compressor/IdRange.js +29 -0
- package/dist/id-compressor/IdRange.js.map +1 -0
- package/dist/id-compressor/NumericUuid.d.ts +63 -0
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -0
- package/dist/id-compressor/NumericUuid.js +377 -0
- package/dist/id-compressor/NumericUuid.js.map +1 -0
- package/dist/id-compressor/index.d.ts +12 -0
- package/dist/id-compressor/index.d.ts.map +1 -0
- package/dist/id-compressor/index.js +26 -0
- package/dist/id-compressor/index.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/dist/id-compressor/persisted-types/index.d.ts +6 -0
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/index.js +18 -0
- package/dist/id-compressor/persisted-types/index.js.map +1 -0
- package/dist/index.d.ts +29 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +385 -0
- package/dist/persisted-types/0.0.2.d.ts.map +1 -0
- package/dist/persisted-types/0.0.2.js +113 -0
- package/dist/persisted-types/0.0.2.js.map +1 -0
- package/dist/persisted-types/0.1.1.d.ts +314 -0
- package/dist/persisted-types/0.1.1.d.ts.map +1 -0
- package/dist/persisted-types/0.1.1.js +153 -0
- package/dist/persisted-types/0.1.1.js.map +1 -0
- package/dist/persisted-types/index.d.ts +7 -0
- package/dist/persisted-types/index.d.ts.map +1 -0
- package/dist/persisted-types/index.js +20 -0
- package/dist/persisted-types/index.js.map +1 -0
- package/docs/0-1-1-Compression.md +228 -0
- package/docs/Breaking-Change-Migration.md +52 -0
- package/docs/Compression.md +2 -2
- package/docs/Telemetry.md +43 -0
- package/lib/ChangeCompression.d.ts +39 -0
- package/lib/ChangeCompression.d.ts.map +1 -0
- package/lib/ChangeCompression.js +111 -0
- package/lib/ChangeCompression.js.map +1 -0
- package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -100
- package/lib/ChangeTypes.d.ts.map +1 -0
- package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
- package/lib/ChangeTypes.js.map +1 -0
- package/lib/Checkout.d.ts +39 -27
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +51 -23
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +175 -38
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +226 -101
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +24 -0
- package/lib/EagerCheckout.d.ts.map +1 -0
- package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
- package/lib/EagerCheckout.js.map +1 -0
- package/lib/EditLog.d.ts +77 -63
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +83 -47
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +168 -0
- package/lib/EditUtilities.d.ts.map +1 -0
- package/lib/EditUtilities.js +353 -0
- package/lib/EditUtilities.js.map +1 -0
- package/lib/EventTypes.d.ts +73 -0
- package/lib/EventTypes.d.ts.map +1 -0
- package/lib/EventTypes.js +75 -0
- package/lib/EventTypes.js.map +1 -0
- package/lib/Forest.d.ts +29 -7
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +58 -35
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +20 -0
- package/lib/HistoryEditFactory.d.ts.map +1 -0
- package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
- package/lib/HistoryEditFactory.js.map +1 -0
- package/lib/IdConversion.d.ts +12 -0
- package/lib/IdConversion.d.ts.map +1 -0
- package/lib/IdConversion.js +91 -0
- package/lib/IdConversion.js.map +1 -0
- package/lib/Identifiers.d.ts +89 -2
- package/lib/Identifiers.d.ts.map +1 -1
- package/lib/Identifiers.js +8 -1
- package/lib/Identifiers.js.map +1 -1
- package/lib/InitialTree.d.ts +2 -2
- package/lib/InitialTree.d.ts.map +1 -1
- package/lib/InitialTree.js +2 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LazyCheckout.d.ts +28 -0
- package/lib/LazyCheckout.d.ts.map +1 -0
- package/lib/LazyCheckout.js +40 -0
- package/lib/LazyCheckout.js.map +1 -0
- package/lib/LogViewer.d.ts +130 -85
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +102 -77
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts +221 -0
- package/lib/MergeHealth.d.ts.map +1 -0
- package/lib/MergeHealth.js +258 -0
- package/lib/MergeHealth.js.map +1 -0
- package/lib/NodeIdUtilities.d.ts +90 -0
- package/lib/NodeIdUtilities.d.ts.map +1 -0
- package/lib/NodeIdUtilities.js +53 -0
- package/lib/NodeIdUtilities.js.map +1 -0
- package/lib/PayloadUtilities.d.ts +42 -0
- package/lib/PayloadUtilities.d.ts.map +1 -0
- package/lib/PayloadUtilities.js +110 -0
- package/lib/PayloadUtilities.js.map +1 -0
- package/lib/ReconciliationPath.d.ts +18 -13
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +11 -2
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -3
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +83 -0
- package/lib/RevisionView.d.ts.map +1 -0
- package/lib/RevisionView.js +175 -0
- package/lib/RevisionView.js.map +1 -0
- package/lib/SerializationUtilities.d.ts +36 -0
- package/lib/SerializationUtilities.d.ts.map +1 -0
- package/lib/SerializationUtilities.js +95 -0
- package/lib/SerializationUtilities.js.map +1 -0
- package/lib/SharedTree.d.ts +400 -0
- package/lib/SharedTree.d.ts.map +1 -0
- package/lib/SharedTree.js +1059 -0
- package/lib/SharedTree.js.map +1 -0
- package/lib/SharedTreeEncoder.d.ts +102 -0
- package/lib/SharedTreeEncoder.d.ts.map +1 -0
- package/lib/SharedTreeEncoder.js +308 -0
- package/lib/SharedTreeEncoder.js.map +1 -0
- package/lib/StringInterner.d.ts +46 -0
- package/lib/StringInterner.d.ts.map +1 -0
- package/lib/StringInterner.js +57 -0
- package/lib/StringInterner.js.map +1 -0
- package/lib/Summary.d.ts +40 -0
- package/lib/Summary.d.ts.map +1 -0
- package/lib/Summary.js +19 -0
- package/lib/Summary.js.map +1 -0
- package/lib/SummaryBackCompatibility.d.ts +22 -22
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js +29 -32
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +31 -0
- package/lib/SummaryTestUtilities.d.ts.map +1 -0
- package/lib/SummaryTestUtilities.js +32 -0
- package/lib/SummaryTestUtilities.js.map +1 -0
- package/lib/Transaction.d.ts +53 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +72 -0
- package/lib/Transaction.js.map +1 -0
- package/lib/TransactionInternal.d.ts +543 -0
- package/lib/TransactionInternal.d.ts.map +1 -0
- package/lib/TransactionInternal.js +618 -0
- package/lib/TransactionInternal.js.map +1 -0
- package/lib/TreeCompressor.d.ts +37 -0
- package/lib/TreeCompressor.d.ts.map +1 -0
- package/lib/TreeCompressor.js +128 -0
- package/lib/TreeCompressor.js.map +1 -0
- package/lib/TreeNodeHandle.d.ts +12 -18
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js +14 -24
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +166 -0
- package/lib/TreeView.d.ts.map +1 -0
- package/lib/TreeView.js +213 -0
- package/lib/TreeView.js.map +1 -0
- package/lib/TreeViewUtilities.d.ts +21 -0
- package/lib/TreeViewUtilities.d.ts.map +1 -0
- package/lib/TreeViewUtilities.js +71 -0
- package/lib/TreeViewUtilities.js.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/lib/UndoRedoHandler.d.ts.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
- package/lib/UndoRedoHandler.js.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/lib/id-compressor/IdCompressor.d.ts +389 -0
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
- package/lib/id-compressor/IdCompressor.js +1343 -0
- package/lib/id-compressor/IdCompressor.js.map +1 -0
- package/lib/id-compressor/IdRange.d.ts +11 -0
- package/lib/id-compressor/IdRange.d.ts.map +1 -0
- package/lib/id-compressor/IdRange.js +25 -0
- package/lib/id-compressor/IdRange.js.map +1 -0
- package/lib/id-compressor/NumericUuid.d.ts +63 -0
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
- package/lib/id-compressor/NumericUuid.js +365 -0
- package/lib/id-compressor/NumericUuid.js.map +1 -0
- package/lib/id-compressor/index.d.ts +12 -0
- package/lib/id-compressor/index.d.ts.map +1 -0
- package/lib/id-compressor/index.js +12 -0
- package/lib/id-compressor/index.js.map +1 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/lib/id-compressor/persisted-types/index.d.ts +6 -0
- package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/lib/id-compressor/persisted-types/index.js +6 -0
- package/lib/id-compressor/persisted-types/index.js.map +1 -0
- package/lib/index.d.ts +29 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +23 -6
- package/lib/index.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +385 -0
- package/lib/persisted-types/0.0.2.d.ts.map +1 -0
- package/lib/persisted-types/0.0.2.js +110 -0
- package/lib/persisted-types/0.0.2.js.map +1 -0
- package/lib/persisted-types/0.1.1.d.ts +314 -0
- package/lib/persisted-types/0.1.1.d.ts.map +1 -0
- package/lib/persisted-types/0.1.1.js +150 -0
- package/lib/persisted-types/0.1.1.js.map +1 -0
- package/lib/persisted-types/index.d.ts +7 -0
- package/lib/persisted-types/index.d.ts.map +1 -0
- package/lib/persisted-types/index.js +8 -0
- package/lib/persisted-types/index.js.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.js +169 -0
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
- package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
- package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
- package/lib/test/ChangeCompression.tests.js +145 -0
- package/lib/test/ChangeCompression.tests.js.map +1 -0
- package/lib/test/Checkout.tests.d.ts +2 -3
- package/lib/test/Checkout.tests.d.ts.map +1 -1
- package/lib/test/Checkout.tests.js +126 -69
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Common.tests.js +60 -2
- package/lib/test/Common.tests.js.map +1 -1
- package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
- package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
- package/lib/test/EagerCheckout.tests.js +20 -0
- package/lib/test/EagerCheckout.tests.js.map +1 -0
- package/lib/test/Edit.tests.js +22 -14
- package/lib/test/Edit.tests.js.map +1 -1
- package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
- package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
- package/lib/test/EditLog.perf.tests.js +30 -0
- package/lib/test/EditLog.perf.tests.js.map +1 -0
- package/lib/test/EditLog.tests.js +10 -6
- package/lib/test/EditLog.tests.js.map +1 -1
- package/lib/test/EditUtilities.tests.d.ts +6 -0
- package/lib/test/EditUtilities.tests.d.ts.map +1 -0
- package/lib/test/EditUtilities.tests.js +503 -0
- package/lib/test/EditUtilities.tests.js.map +1 -0
- package/lib/test/Forest.perf.tests.d.ts +6 -0
- package/lib/test/Forest.perf.tests.d.ts.map +1 -0
- package/lib/test/Forest.perf.tests.js +133 -0
- package/lib/test/Forest.perf.tests.js.map +1 -0
- package/lib/test/Forest.tests.js +54 -27
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/GenericTransaction.tests.js +12 -3
- package/lib/test/GenericTransaction.tests.js.map +1 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
- package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
- package/lib/test/HistoryEditFactory.tests.js +90 -0
- package/lib/test/HistoryEditFactory.tests.js.map +1 -0
- package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
- package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.perf.tests.js +304 -0
- package/lib/test/IdCompressor.perf.tests.js.map +1 -0
- package/lib/test/IdCompressor.tests.d.ts +6 -0
- package/lib/test/IdCompressor.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.tests.js +1075 -0
- package/lib/test/IdCompressor.tests.js.map +1 -0
- package/lib/test/IdConversion.tests.d.ts +6 -0
- package/lib/test/IdConversion.tests.d.ts.map +1 -0
- package/lib/test/IdConversion.tests.js +36 -0
- package/lib/test/IdConversion.tests.js.map +1 -0
- package/lib/test/LazyCheckout.tests.d.ts +6 -0
- package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
- package/lib/test/LazyCheckout.tests.js +22 -0
- package/lib/test/LazyCheckout.tests.js.map +1 -0
- package/lib/test/LogViewer.tests.js +269 -187
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
- package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
- package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.perf.tests.js +68 -0
- package/lib/test/NumericUuid.perf.tests.js.map +1 -0
- package/lib/test/NumericUuid.tests.d.ts +6 -0
- package/lib/test/NumericUuid.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.tests.js +191 -0
- package/lib/test/NumericUuid.tests.js.map +1 -0
- package/lib/test/RevisionView.tests.d.ts +6 -0
- package/lib/test/RevisionView.tests.d.ts.map +1 -0
- package/lib/test/RevisionView.tests.js +133 -0
- package/lib/test/RevisionView.tests.js.map +1 -0
- package/lib/test/SharedTree.perf.tests.d.ts +6 -0
- package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
- package/lib/test/SharedTree.perf.tests.js +39 -0
- package/lib/test/SharedTree.perf.tests.js.map +1 -0
- package/lib/test/SharedTree.tests.js +15 -3
- package/lib/test/SharedTree.tests.js.map +1 -1
- package/lib/test/StringInterner.tests.d.ts +6 -0
- package/lib/test/StringInterner.tests.d.ts.map +1 -0
- package/lib/test/StringInterner.tests.js +71 -0
- package/lib/test/StringInterner.tests.js.map +1 -0
- package/lib/test/Summary.tests.d.ts +8 -0
- package/lib/test/Summary.tests.d.ts.map +1 -0
- package/lib/test/Summary.tests.js +407 -0
- package/lib/test/Summary.tests.js.map +1 -0
- package/lib/test/Transaction.tests.js +76 -330
- package/lib/test/Transaction.tests.js.map +1 -1
- package/lib/test/TransactionInternal.tests.d.ts +6 -0
- package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
- package/lib/test/TransactionInternal.tests.js +568 -0
- package/lib/test/TransactionInternal.tests.js.map +1 -0
- package/lib/test/TreeCompression.tests.d.ts +6 -0
- package/lib/test/TreeCompression.tests.d.ts.map +1 -0
- package/lib/test/TreeCompression.tests.js +292 -0
- package/lib/test/TreeCompression.tests.js.map +1 -0
- package/lib/test/TreeView.tests.d.ts +6 -0
- package/lib/test/TreeView.tests.d.ts.map +1 -0
- package/lib/test/TreeView.tests.js +147 -0
- package/lib/test/TreeView.tests.js.map +1 -0
- package/lib/test/UndoRedoHandler.tests.js +2 -2
- package/lib/test/UndoRedoHandler.tests.js.map +1 -1
- package/lib/test/Virtualization.tests.js +147 -62
- package/lib/test/Virtualization.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +19 -0
- package/lib/test/fuzz/Generators.d.ts.map +1 -0
- package/lib/test/fuzz/Generators.js +420 -0
- package/lib/test/fuzz/Generators.js.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js +200 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
- package/lib/test/fuzz/Types.d.ts +133 -0
- package/lib/test/fuzz/Types.d.ts.map +1 -0
- package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
- package/lib/test/fuzz/Types.js.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
- package/lib/test/utilities/MockTransaction.d.ts +26 -7
- package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
- package/lib/test/utilities/MockTransaction.js +40 -11
- package/lib/test/utilities/MockTransaction.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
- package/lib/test/utilities/PendingLocalStateTests.js +105 -0
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
- package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +696 -439
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js +345 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
- package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
- package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
- package/lib/test/utilities/SummarySizeTests.js +158 -0
- package/lib/test/utilities/SummarySizeTests.js.map +1 -0
- package/lib/test/utilities/TestCommon.d.ts +9 -0
- package/lib/test/utilities/TestCommon.d.ts.map +1 -0
- package/lib/test/utilities/TestCommon.js +13 -0
- package/lib/test/utilities/TestCommon.js.map +1 -0
- package/lib/test/utilities/TestNode.d.ts +140 -0
- package/lib/test/utilities/TestNode.d.ts.map +1 -0
- package/lib/test/utilities/TestNode.js +292 -0
- package/lib/test/utilities/TestNode.js.map +1 -0
- package/lib/test/utilities/TestUtilities.d.ts +84 -70
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +218 -143
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
- package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
- package/lib/test/utilities/UndoRedoTests.js +138 -149
- package/lib/test/utilities/UndoRedoTests.js.map +1 -1
- package/package.json +19 -14
- package/src/ChangeCompression.ts +159 -0
- package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -120
- package/src/Checkout.ts +81 -52
- package/src/Common.ts +317 -117
- package/src/EagerCheckout.ts +38 -0
- package/src/EditLog.ts +153 -100
- package/src/EditUtilities.ts +559 -0
- package/src/EventTypes.ts +74 -0
- package/src/Forest.ts +81 -73
- package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
- package/src/IdConversion.ts +125 -0
- package/src/Identifiers.ts +101 -1
- package/src/InitialTree.ts +5 -4
- package/src/LazyCheckout.ts +51 -0
- package/src/LogViewer.ts +242 -166
- package/src/MergeHealth.ts +447 -0
- package/src/NodeIdUtilities.ts +141 -0
- package/src/PayloadUtilities.ts +124 -0
- package/src/ReconciliationPath.ts +18 -13
- package/src/RevisionValueCache.ts +14 -5
- package/src/RevisionView.ts +252 -0
- package/src/SerializationUtilities.ts +130 -0
- package/src/SharedTree.ts +1448 -0
- package/src/SharedTreeEncoder.ts +493 -0
- package/src/StringInterner.ts +72 -0
- package/src/Summary.ts +48 -0
- package/src/SummaryBackCompatibility.ts +47 -57
- package/src/SummaryTestUtilities.ts +54 -0
- package/src/Transaction.ts +94 -0
- package/src/TransactionInternal.ts +1088 -0
- package/src/TreeCompressor.ts +222 -0
- package/src/TreeNodeHandle.ts +19 -32
- package/src/TreeView.ts +321 -0
- package/src/TreeViewUtilities.ts +77 -0
- package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
- package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
- package/src/id-compressor/IdCompressor.md +3 -0
- package/src/id-compressor/IdCompressor.ts +1848 -0
- package/src/id-compressor/IdRange.ts +33 -0
- package/src/id-compressor/NumericUuid.ts +414 -0
- package/src/id-compressor/index.ts +13 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
- package/src/id-compressor/persisted-types/README.md +3 -0
- package/src/id-compressor/persisted-types/index.ts +6 -0
- package/src/index.ts +119 -59
- package/src/persisted-types/0.0.2.ts +442 -0
- package/src/persisted-types/0.1.1.ts +476 -0
- package/src/persisted-types/README.md +22 -0
- package/src/persisted-types/index.ts +9 -0
- package/.mocharc.js +0 -41
- package/api/tree.api.md +0 -729
- package/dist/BasicCheckout.d.ts +0 -23
- package/dist/BasicCheckout.d.ts.map +0 -1
- package/dist/BasicCheckout.js.map +0 -1
- package/dist/Snapshot.d.ts +0 -198
- package/dist/Snapshot.d.ts.map +0 -1
- package/dist/Snapshot.js +0 -267
- package/dist/Snapshot.js.map +0 -1
- package/dist/SnapshotUtilities.d.ts +0 -29
- package/dist/SnapshotUtilities.d.ts.map +0 -1
- package/dist/SnapshotUtilities.js +0 -73
- package/dist/SnapshotUtilities.js.map +0 -1
- package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
- package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/dist/anchored-edits/AnchorResolution.js +0 -162
- package/dist/anchored-edits/AnchorResolution.js.map +0 -1
- package/dist/anchored-edits/Factory.d.ts +0 -56
- package/dist/anchored-edits/Factory.d.ts.map +0 -1
- package/dist/anchored-edits/Factory.js +0 -79
- package/dist/anchored-edits/Factory.js.map +0 -1
- package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
- package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/anchored-edits/PersistedTypes.js +0 -131
- package/dist/anchored-edits/PersistedTypes.js.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
- package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
- package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/dist/anchored-edits/index.d.ts +0 -10
- package/dist/anchored-edits/index.d.ts.map +0 -1
- package/dist/anchored-edits/index.js +0 -34
- package/dist/anchored-edits/index.js.map +0 -1
- package/dist/default-edits/EditUtilities.d.ts +0 -57
- package/dist/default-edits/EditUtilities.d.ts.map +0 -1
- package/dist/default-edits/EditUtilities.js +0 -192
- package/dist/default-edits/EditUtilities.js.map +0 -1
- package/dist/default-edits/Factory.d.ts +0 -56
- package/dist/default-edits/Factory.d.ts.map +0 -1
- package/dist/default-edits/Factory.js +0 -79
- package/dist/default-edits/Factory.js.map +0 -1
- package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
- package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/dist/default-edits/HistoryEditFactory.js +0 -187
- package/dist/default-edits/HistoryEditFactory.js.map +0 -1
- package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/default-edits/PersistedTypes.js.map +0 -1
- package/dist/default-edits/SharedTree.d.ts +0 -111
- package/dist/default-edits/SharedTree.d.ts.map +0 -1
- package/dist/default-edits/SharedTree.js +0 -124
- package/dist/default-edits/SharedTree.js.map +0 -1
- package/dist/default-edits/Summary.d.ts +0 -15
- package/dist/default-edits/Summary.d.ts.map +0 -1
- package/dist/default-edits/Summary.js +0 -35
- package/dist/default-edits/Summary.js.map +0 -1
- package/dist/default-edits/Transaction.d.ts +0 -41
- package/dist/default-edits/Transaction.d.ts.map +0 -1
- package/dist/default-edits/Transaction.js +0 -225
- package/dist/default-edits/Transaction.js.map +0 -1
- package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/dist/default-edits/UndoRedoHandler.js.map +0 -1
- package/dist/default-edits/index.d.ts +0 -13
- package/dist/default-edits/index.d.ts.map +0 -1
- package/dist/default-edits/index.js +0 -41
- package/dist/default-edits/index.js.map +0 -1
- package/dist/generic/GenericEditUtilities.d.ts +0 -26
- package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
- package/dist/generic/GenericEditUtilities.js +0 -45
- package/dist/generic/GenericEditUtilities.js.map +0 -1
- package/dist/generic/GenericSharedTree.d.ts +0 -221
- package/dist/generic/GenericSharedTree.d.ts.map +0 -1
- package/dist/generic/GenericSharedTree.js +0 -447
- package/dist/generic/GenericSharedTree.js.map +0 -1
- package/dist/generic/GenericTransaction.d.ts +0 -87
- package/dist/generic/GenericTransaction.d.ts.map +0 -1
- package/dist/generic/GenericTransaction.js +0 -144
- package/dist/generic/GenericTransaction.js.map +0 -1
- package/dist/generic/PersistedTypes.d.ts +0 -194
- package/dist/generic/PersistedTypes.d.ts.map +0 -1
- package/dist/generic/PersistedTypes.js +0 -42
- package/dist/generic/PersistedTypes.js.map +0 -1
- package/dist/generic/Summary.d.ts +0 -63
- package/dist/generic/Summary.d.ts.map +0 -1
- package/dist/generic/Summary.js +0 -64
- package/dist/generic/Summary.js.map +0 -1
- package/dist/generic/index.d.ts +0 -10
- package/dist/generic/index.d.ts.map +0 -1
- package/dist/generic/index.js +0 -26
- package/dist/generic/index.js.map +0 -1
- package/lib/BasicCheckout.d.ts +0 -23
- package/lib/BasicCheckout.d.ts.map +0 -1
- package/lib/BasicCheckout.js.map +0 -1
- package/lib/Snapshot.d.ts +0 -198
- package/lib/Snapshot.d.ts.map +0 -1
- package/lib/Snapshot.js +0 -263
- package/lib/Snapshot.js.map +0 -1
- package/lib/SnapshotUtilities.d.ts +0 -29
- package/lib/SnapshotUtilities.d.ts.map +0 -1
- package/lib/SnapshotUtilities.js +0 -67
- package/lib/SnapshotUtilities.js.map +0 -1
- package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
- package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/lib/anchored-edits/AnchorResolution.js +0 -152
- package/lib/anchored-edits/AnchorResolution.js.map +0 -1
- package/lib/anchored-edits/Factory.d.ts +0 -56
- package/lib/anchored-edits/Factory.d.ts.map +0 -1
- package/lib/anchored-edits/Factory.js +0 -74
- package/lib/anchored-edits/Factory.js.map +0 -1
- package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
- package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/anchored-edits/PersistedTypes.js +0 -128
- package/lib/anchored-edits/PersistedTypes.js.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
- package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
- package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/lib/anchored-edits/index.d.ts +0 -10
- package/lib/anchored-edits/index.d.ts.map +0 -1
- package/lib/anchored-edits/index.js +0 -11
- package/lib/anchored-edits/index.js.map +0 -1
- package/lib/default-edits/EditUtilities.d.ts +0 -57
- package/lib/default-edits/EditUtilities.d.ts.map +0 -1
- package/lib/default-edits/EditUtilities.js +0 -181
- package/lib/default-edits/EditUtilities.js.map +0 -1
- package/lib/default-edits/Factory.d.ts +0 -56
- package/lib/default-edits/Factory.d.ts.map +0 -1
- package/lib/default-edits/Factory.js +0 -74
- package/lib/default-edits/Factory.js.map +0 -1
- package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
- package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/lib/default-edits/HistoryEditFactory.js.map +0 -1
- package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/default-edits/PersistedTypes.js.map +0 -1
- package/lib/default-edits/SharedTree.d.ts +0 -111
- package/lib/default-edits/SharedTree.d.ts.map +0 -1
- package/lib/default-edits/SharedTree.js +0 -100
- package/lib/default-edits/SharedTree.js.map +0 -1
- package/lib/default-edits/Summary.d.ts +0 -15
- package/lib/default-edits/Summary.d.ts.map +0 -1
- package/lib/default-edits/Summary.js +0 -31
- package/lib/default-edits/Summary.js.map +0 -1
- package/lib/default-edits/Transaction.d.ts +0 -41
- package/lib/default-edits/Transaction.d.ts.map +0 -1
- package/lib/default-edits/Transaction.js +0 -221
- package/lib/default-edits/Transaction.js.map +0 -1
- package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/lib/default-edits/UndoRedoHandler.js.map +0 -1
- package/lib/default-edits/index.d.ts +0 -13
- package/lib/default-edits/index.d.ts.map +0 -1
- package/lib/default-edits/index.js +0 -14
- package/lib/default-edits/index.js.map +0 -1
- package/lib/generic/GenericEditUtilities.d.ts +0 -26
- package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
- package/lib/generic/GenericEditUtilities.js +0 -38
- package/lib/generic/GenericEditUtilities.js.map +0 -1
- package/lib/generic/GenericSharedTree.d.ts +0 -221
- package/lib/generic/GenericSharedTree.d.ts.map +0 -1
- package/lib/generic/GenericSharedTree.js +0 -443
- package/lib/generic/GenericSharedTree.js.map +0 -1
- package/lib/generic/GenericTransaction.d.ts +0 -87
- package/lib/generic/GenericTransaction.d.ts.map +0 -1
- package/lib/generic/GenericTransaction.js +0 -140
- package/lib/generic/GenericTransaction.js.map +0 -1
- package/lib/generic/PersistedTypes.d.ts +0 -194
- package/lib/generic/PersistedTypes.d.ts.map +0 -1
- package/lib/generic/PersistedTypes.js +0 -39
- package/lib/generic/PersistedTypes.js.map +0 -1
- package/lib/generic/Summary.d.ts +0 -63
- package/lib/generic/Summary.d.ts.map +0 -1
- package/lib/generic/Summary.js +0 -58
- package/lib/generic/Summary.js.map +0 -1
- package/lib/generic/index.d.ts +0 -10
- package/lib/generic/index.d.ts.map +0 -1
- package/lib/generic/index.js +0 -11
- package/lib/generic/index.js.map +0 -1
- package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
- package/lib/test/Anchors.glassBox.tests.js +0 -410
- package/lib/test/Anchors.glassBox.tests.js.map +0 -1
- package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
- package/lib/test/BasicCheckout.tests.js +0 -8
- package/lib/test/BasicCheckout.tests.js.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
- package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
- package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
- package/lib/test/Snapshot.tests.d.ts.map +0 -1
- package/lib/test/Snapshot.tests.js +0 -96
- package/lib/test/Snapshot.tests.js.map +0 -1
- package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
- package/lib/test/SnapshotUtilities.tests.js +0 -168
- package/lib/test/SnapshotUtilities.tests.js.map +0 -1
- package/lib/test/undoRedoStackManager.d.ts +0 -26
- package/lib/test/undoRedoStackManager.d.ts.map +0 -1
- package/lib/test/undoRedoStackManager.js +0 -176
- package/lib/test/undoRedoStackManager.js.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
- package/src/BasicCheckout.ts +0 -34
- package/src/Snapshot.ts +0 -363
- package/src/SnapshotUtilities.ts +0 -88
- package/src/anchored-edits/AnchorResolution.ts +0 -442
- package/src/anchored-edits/Factory.ts +0 -94
- package/src/anchored-edits/PersistedTypes.ts +0 -310
- package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
- package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
- package/src/anchored-edits/index.ts +0 -21
- package/src/default-edits/EditUtilities.ts +0 -220
- package/src/default-edits/Factory.ts +0 -94
- package/src/default-edits/SharedTree.ts +0 -174
- package/src/default-edits/Summary.ts +0 -44
- package/src/default-edits/Transaction.ts +0 -262
- package/src/default-edits/index.ts +0 -29
- package/src/generic/GenericEditUtilities.ts +0 -46
- package/src/generic/GenericSharedTree.ts +0 -593
- package/src/generic/GenericTransaction.ts +0 -194
- package/src/generic/PersistedTypes.ts +0 -221
- package/src/generic/Summary.ts +0 -113
- package/src/generic/index.ts +0 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionInternal.tests.js","sourceRoot":"","sources":["../../src/test/TransactionInternal.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,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AC3B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU;gBACpC,UAAU,EAAE,cAAc,CAAC,UAAU;gBACrC,MAAM,EAAE,EAAE;aACV,CAAC;YAEF,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC;YACnF,WAAW,CAAC,WAAW,CACtB,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CACnG,CAAC;YACF,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACxG,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { expect } from 'chai';\nimport { DetachedSequenceId, NodeId, TraitLabel } from '../Identifiers';\nimport { assert } from '../Common';\nimport { getChangeNodeFromViewNode } from '../SerializationUtilities';\nimport { GenericTransaction, TransactionInternal } from '../TransactionInternal';\nimport {\n\tChangeInternal,\n\tChangeNode,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tEditStatus,\n\tSetValueInternal,\n\tSide,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n} from '../persisted-types';\nimport { StablePlace, StableRange } from '../ChangeTypes';\nimport { deepCompareNodes, PlaceValidationResult, RangeValidationResultKind } from '../EditUtilities';\nimport { SimpleTestTree } from './utilities/TestNode';\nimport { refreshTestTree, testTrait, testTraitLabel } from './utilities/TestUtilities';\n\ndescribe('Transaction', () => {\n\tlet transaction: GenericTransaction;\n\tconst testTree = refreshTestTree(\n\t\tundefined,\n\t\t(t) => {\n\t\t\ttransaction = TransactionInternal.factory(t.view);\n\t\t},\n\t\ttrue\n\t);\n\tdescribe('Constraints', () => {\n\t\tfunction getTestTrait(): StableRangeInternal {\n\t\t\treturn StableRange.all(testTrait(transaction.view));\n\t\t}\n\n\t\tit('can be met', () => {\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('can be unmet', () => {\n\t\t\tconst badId = testTree.generateNodeId('not in tree');\n\t\t\tconst invalidStableRange: StableRangeInternal = {\n\t\t\t\tstart: { side: Side.After, referenceSibling: badId },\n\t\t\t\tend: { side: Side.Before },\n\t\t\t};\n\t\t\tconst constraint = {\n\t\t\t\ttoConstrain: {\n\t\t\t\t\tstart: { side: Side.After, referenceSibling: badId },\n\t\t\t\t\tend: { side: Side.Before },\n\t\t\t\t},\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint as ChangeTypeInternal.Constraint,\n\t\t\t};\n\t\t\ttransaction.applyChange(constraint);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.ConstraintViolation,\n\t\t\t\tconstraint,\n\t\t\t\tviolation: {\n\t\t\t\t\tkind: TransactionInternal.ConstraintViolationKind.BadRange,\n\t\t\t\t\trangeFailure: {\n\t\t\t\t\t\tkind: RangeValidationResultKind.BadPlace,\n\t\t\t\t\t\tplace: invalidStableRange.start,\n\t\t\t\t\t\tplaceFailure: PlaceValidationResult.MissingSibling,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tit('effect can apply anyway', () => {\n\t\t\tconst badId = testTree.generateNodeId('not in tree');\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: {\n\t\t\t\t\tstart: { side: Side.After, referenceSibling: badId },\n\t\t\t\t\tend: { side: Side.Before },\n\t\t\t\t},\n\t\t\t\teffect: ConstraintEffect.ValidRetry,\n\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('length can be met', () => {\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\tlength: 0,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('length can be unmet', () => {\n\t\t\tconst constraint = {\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint as ChangeTypeInternal.Constraint,\n\t\t\t\tlength: 1,\n\t\t\t};\n\t\t\ttransaction.applyChange(constraint);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.ConstraintViolation,\n\t\t\t\tconstraint,\n\t\t\t\tviolation: {\n\t\t\t\t\tkind: TransactionInternal.ConstraintViolationKind.BadLength,\n\t\t\t\t\tactual: 0,\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tit('parent can be met', () => {\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\tparentNode: testTree.identifier,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('parent can be unmet', () => {\n\t\t\tconst parentNode = testTree.generateNodeId('not in tree');\n\t\t\tconst constraint = {\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint as ChangeTypeInternal.Constraint,\n\t\t\t\tparentNode,\n\t\t\t};\n\t\t\ttransaction.applyChange(constraint);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.ConstraintViolation,\n\t\t\t\tconstraint,\n\t\t\t\tviolation: {\n\t\t\t\t\tkind: TransactionInternal.ConstraintViolationKind.BadParent,\n\t\t\t\t\tactual: parentNode,\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tit('label can be met', () => {\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\tlabel: testTraitLabel,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('label can be unmet', () => {\n\t\t\tconst constraint = {\n\t\t\t\ttoConstrain: getTestTrait(),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeTypeInternal.Constraint as ChangeTypeInternal.Constraint,\n\t\t\t\tlabel: '7969ee2e-5418-43db-929a-4e9a23c5499d' as TraitLabel,\n\t\t\t};\n\t\t\ttransaction.applyChange(constraint);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.ConstraintViolation,\n\t\t\t\tconstraint,\n\t\t\t\tviolation: {\n\t\t\t\t\tkind: TransactionInternal.ConstraintViolationKind.BadLabel,\n\t\t\t\t\tactual: testTraitLabel,\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('SetValue', () => {\n\t\tit('can be invalid if the node does not exist', () => {\n\t\t\tconst change: SetValueInternal = {\n\t\t\t\tnodeToModify: testTree.generateNodeId(),\n\t\t\t\tpayload: {},\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t};\n\t\t\ttransaction.applyChange(change);\n\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.UnknownId,\n\t\t\t\tchange,\n\t\t\t\tid: change.nodeToModify,\n\t\t\t});\n\t\t});\n\n\t\tit('can change payload', () => {\n\t\t\tconst payload = { foo: {} };\n\t\t\ttransaction.applyChange({\n\t\t\t\tnodeToModify: testTree.identifier,\n\t\t\t\tpayload, // Arbitrary payload.\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.getViewNode(testTree.identifier).payload).deep.equals(payload);\n\t\t});\n\n\t\t// 'null' is not included here since it means clear the payload in setValue.\n\t\tfor (const payload of [0, '', [], {}]) {\n\t\t\tit(`can set payload to ${JSON.stringify(payload)}`, () => {\n\t\t\t\ttransaction.applyChange({\n\t\t\t\t\tnodeToModify: testTree.identifier,\n\t\t\t\t\tpayload,\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t});\n\t\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\t\texpect(transaction.view.getViewNode(testTree.identifier).payload).equals(payload);\n\t\t\t});\n\t\t}\n\n\t\tit('can clear an unset payload', () => {\n\t\t\ttransaction.applyChange(ChangeInternal.clearPayload(testTree.identifier));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getViewNode(testTree.identifier), 'payload')).to.be.false;\n\t\t\texpect({}.hasOwnProperty.call(getChangeNodeFromViewNode(transaction.view, testTree.identifier), 'payload'))\n\t\t\t\t.to.be.false;\n\t\t});\n\n\t\tit('can clear a set payload', () => {\n\t\t\ttransaction.applyChange({\n\t\t\t\tnodeToModify: testTree.identifier,\n\t\t\t\tpayload: {},\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t});\n\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.getViewNode(testTree.identifier).payload).not.undefined;\n\t\t\ttransaction.applyChange(ChangeInternal.clearPayload(testTree.identifier));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getViewNode(testTree.identifier), 'payload')).to.be.false;\n\t\t\texpect({}.hasOwnProperty.call(getChangeNodeFromViewNode(transaction.view, testTree.identifier), 'payload'))\n\t\t\t\t.to.be.false;\n\t\t});\n\t});\n\n\tdescribe('Insert', () => {\n\t\tconst buildId = 0 as DetachedSequenceId;\n\n\t\tdescribe('can be malformed', () => {\n\t\t\tit('when the detached sequence ID is bogus', () => {\n\t\t\t\ttransaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));\n\t\t\t\tconst change = ChangeInternal.insert(\n\t\t\t\t\t// Non-existent detached id\n\t\t\t\t\t1 as DetachedSequenceId,\n\t\t\t\t\t{ referenceSibling: testTree.identifier, side: Side.After }\n\t\t\t\t);\n\t\t\t\ttransaction.applyChange(change);\n\t\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\t\tconst result = transaction.close();\n\t\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\t\texpect(result.failure).deep.equals({\n\t\t\t\t\tkind: TransactionInternal.FailureKind.DetachedSequenceNotFound,\n\t\t\t\t\tchange,\n\t\t\t\t\tsequenceId: change.source,\n\t\t\t\t});\n\t\t\t});\n\t\t\tit('when the target place is malformed', () => {\n\t\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\t\ttransaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));\n\n\t\t\t\tconst referenceTrait = testTree.left.traitLocation;\n\t\t\t\tconst malformedPlace = {\n\t\t\t\t\t// A place is malformed if it has both a reference trait and a reference sibling\n\t\t\t\t\treferenceTrait,\n\t\t\t\t\treferenceSibling: testTree.left.identifier,\n\t\t\t\t\tside: Side.Before,\n\t\t\t\t};\n\t\t\t\tconst change = ChangeInternal.insert(buildId, malformedPlace);\n\t\t\t\ttransaction.applyChange(change);\n\t\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\t\tconst result = transaction.close();\n\t\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\t\texpect(result.failure).deep.equals({\n\t\t\t\t\tkind: TransactionInternal.FailureKind.BadPlace,\n\t\t\t\t\tchange,\n\t\t\t\t\tplace: malformedPlace,\n\t\t\t\t\tplaceFailure: PlaceValidationResult.Malformed,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t\tit('can be invalid when the target place is invalid', () => {\n\t\t\tconst badId = testTree.generateNodeId('not in tree');\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\ttransaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], buildId));\n\t\t\tconst place = {\n\t\t\t\treferenceSibling: badId,\n\t\t\t\tside: Side.After,\n\t\t\t};\n\t\t\tconst change = ChangeInternal.insert(buildId, place);\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.BadPlace,\n\t\t\t\tchange,\n\t\t\t\tplace,\n\t\t\t\tplaceFailure: PlaceValidationResult.MissingSibling,\n\t\t\t});\n\t\t});\n\t\tit('a detached node with a payload', () => {\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\tconst payload = 42;\n\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChanges([\n\t\t\t\tChangeInternal.setPayload(testTree.left.identifier, payload),\n\t\t\t\tChangeInternal.detach(StableRange.only(testTree.left), detachedId),\n\t\t\t\tChangeInternal.insert(detachedId, StablePlace.atStartOf(testTree.left.traitLocation)),\n\t\t\t]);\n\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([testTree.left.identifier]);\n\t\t\texpect(transaction.view.getViewNode(testTree.left.identifier).payload).to.equal(payload);\n\t\t});\n\t\t[Side.Before, Side.After].forEach((side) => {\n\t\t\tit(`can insert a node at the ${side === Side.After ? 'beginning' : 'end'} of a trait`, () => {\n\t\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\t\tconst newNodeId = testTree.generateNodeId();\n\t\t\t\tconst newNode = testTree.buildLeafInternal(newNodeId);\n\t\t\t\ttransaction.applyChanges(\n\t\t\t\t\tChangeInternal.insertTree(\n\t\t\t\t\t\t[newNode],\n\t\t\t\t\t\tside === Side.After\n\t\t\t\t\t\t\t? StablePlace.atStartOf(testTree.left.traitLocation)\n\t\t\t\t\t\t\t: StablePlace.atEndOf(testTree.left.traitLocation)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals(\n\t\t\t\t\tside === Side.After ? [newNodeId, testTree.left.identifier] : [testTree.left.identifier, newNodeId]\n\t\t\t\t);\n\t\t\t});\n\t\t\tit(`can insert a node ${side === Side.Before ? 'before' : 'after'} another node`, () => {\n\t\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\t\tconst newNode = testTree.buildLeafInternal();\n\n\t\t\t\ttransaction.applyChanges(\n\t\t\t\t\tChangeInternal.insertTree([newNode], { referenceSibling: testTree.left.identifier, side })\n\t\t\t\t);\n\t\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals(\n\t\t\t\t\tside === Side.Before\n\t\t\t\t\t\t? [newNode.identifier, testTree.left.identifier]\n\t\t\t\t\t\t: [testTree.left.identifier, newNode.identifier]\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('Build', () => {\n\t\tit('can be malformed due to detached ID collision', () => {\n\t\t\t// Apply two Build_s with the same detached id\n\t\t\ttransaction.applyChange(ChangeInternal.build([testTree.buildLeafInternal()], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\tconst change = ChangeInternal.build([testTree.buildLeafInternal()], 0 as DetachedSequenceId);\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\tchange,\n\t\t\t\tsequenceId: change.destination,\n\t\t\t});\n\t\t});\n\n\t\tit('can be malformed due to duplicate node identifiers', () => {\n\t\t\t// Build two nodes with the same identifier, one of them nested\n\t\t\tconst newNode = testTree.buildLeafInternal();\n\t\t\tconst change = ChangeInternal.build(\n\t\t\t\t[\n\t\t\t\t\tnewNode,\n\t\t\t\t\t{\n\t\t\t\t\t\t...testTree.buildLeafInternal(),\n\t\t\t\t\t\ttraits: {\n\t\t\t\t\t\t\t[testTree.left.traitLabel]: [\n\t\t\t\t\t\t\t\t{ ...testTree.buildLeafInternal(), identifier: newNode.identifier },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t0 as DetachedSequenceId\n\t\t\t);\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.DuplicateIdInBuild,\n\t\t\t\tchange,\n\t\t\t\tid: newNode.identifier,\n\t\t\t});\n\t\t});\n\n\t\tit('is invalid when a node already exists with the given identifier', () => {\n\t\t\t// Build two nodes with the same identifier\n\t\t\tconst identifier = testTree.generateNodeId();\n\t\t\tconst node1: ChangeNode = {\n\t\t\t\tidentifier,\n\t\t\t\tdefinition: SimpleTestTree.definition,\n\t\t\t\ttraits: {},\n\t\t\t};\n\t\t\tconst node2: ChangeNode = {\n\t\t\t\tidentifier,\n\t\t\t\tdefinition: SimpleTestTree.definition,\n\t\t\t\ttraits: {},\n\t\t\t};\n\n\t\t\ttransaction.applyChange(ChangeInternal.build([node1], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\tconst change = ChangeInternal.build([node2], 1 as DetachedSequenceId);\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.IdAlreadyInUse,\n\t\t\t\tchange,\n\t\t\t\tid: identifier,\n\t\t\t});\n\t\t});\n\n\t\tit('is invalid to build a node that has already been inserted', () => {\n\t\t\t// Build new node using identifier already in use in the tree\n\t\t\tconst newNode: ChangeNode = {\n\t\t\t\tidentifier: testTree.left.identifier,\n\t\t\t\tdefinition: SimpleTestTree.definition,\n\t\t\t\ttraits: {},\n\t\t\t};\n\n\t\t\ttransaction.applyChange(ChangeInternal.build([newNode], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure.kind).equals(TransactionInternal.FailureKind.IdAlreadyInUse);\n\t\t});\n\n\t\tit('can build a detached node', () => {\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\tconst newNode = testTree.buildLeafInternal();\n\t\t\ttransaction.applyChange(ChangeInternal.build([newNode], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.hasNode(newNode.identifier)).is.true;\n\t\t\texpect(transaction.view.tryGetParentViewNode(newNode.identifier)).is.undefined;\n\t\t\texpect(deepCompareNodes(getChangeNodeFromViewNode(transaction.view, newNode.identifier), newNode)).to.be\n\t\t\t\t.true;\n\t\t});\n\n\t\tit(\"can be malformed if detached sequence id doesn't exist\", () => {\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\t\t\tconst change = {\n\t\t\t\tdestination: 1 as DetachedSequenceId,\n\t\t\t\tsource: [detachedSequenceId],\n\t\t\t\ttype: ChangeTypeInternal.Build as ChangeTypeInternal.Build,\n\t\t\t};\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.DetachedSequenceNotFound,\n\t\t\t\tchange,\n\t\t\t\tsequenceId: detachedSequenceId,\n\t\t\t});\n\t\t});\n\n\t\tit('can build a node with an explicit empty trait', () => {\n\t\t\t// Forest should strip off the empty trait\n\t\t\tconst nodeWithEmpty = testTree.buildLeafInternal();\n\t\t\tconst traits = new Map<TraitLabel, NodeId[]>();\n\t\t\tconst emptyTrait: NodeId[] = [];\n\t\t\ttraits.set(testTree.left.traitLabel, emptyTrait);\n\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(ChangeInternal.build([nodeWithEmpty], detachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\tconst viewNodeWithEmpty = transaction.view.getViewNode(nodeWithEmpty.identifier);\n\t\t\texpect(viewNodeWithEmpty.traits.size).to.equal(0);\n\t\t});\n\t});\n\n\tdescribe('Detach', () => {\n\t\tit('can be malformed if the target range is malformed', () => {\n\t\t\tconst malformedPlace = {\n\t\t\t\t// A place is malformed if it has both a reference trait and a reference sibling\n\t\t\t\treferenceTrait: testTree.left.traitLocation,\n\t\t\t\treferenceSibling: testTree.left.identifier,\n\t\t\t\tside: Side.Before,\n\t\t\t};\n\t\t\tconst range = StableRangeInternal.from(malformedPlace).to(StablePlaceInternal.after(testTree.right));\n\t\t\tconst change = ChangeInternal.detach(range);\n\t\t\t// Supplied StableRange is malformed\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.BadRange,\n\t\t\t\tchange,\n\t\t\t\trange,\n\t\t\t\trangeFailure: {\n\t\t\t\t\tkind: RangeValidationResultKind.BadPlace,\n\t\t\t\t\tplace: malformedPlace,\n\t\t\t\t\tplaceFailure: PlaceValidationResult.Malformed,\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tit('can be malformed if the destination sequence id is already in use', () => {\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.detach(StableRangeInternal.only(testTree.left), 0 as DetachedSequenceId)\n\t\t\t);\n\t\t\tconst change = ChangeInternal.detach(StableRangeInternal.only(testTree.right), 0 as DetachedSequenceId);\n\t\t\t// Supplied StableRange is malformed\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Malformed);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\tchange,\n\t\t\t\tsequenceId: change.destination,\n\t\t\t});\n\t\t});\n\t\tit('can be invalid if the target range is invalid', () => {\n\t\t\tconst range = StableRangeInternal.from(StablePlaceInternal.atEndOf(testTree.left.traitLocation)).to(\n\t\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t\t);\n\t\t\tconst change = ChangeInternal.detach(range);\n\t\t\t// Start place is before end place\n\t\t\ttransaction.applyChange(change);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t\tconst result = transaction.close();\n\t\t\tassert(result.status === EditStatus.Invalid);\n\t\t\texpect(result.failure).deep.equals({\n\t\t\t\tkind: TransactionInternal.FailureKind.BadRange,\n\t\t\t\tchange,\n\t\t\t\trange,\n\t\t\t\trangeFailure: RangeValidationResultKind.Inverted,\n\t\t\t});\n\t\t});\n\t\tit('can delete a node', () => {\n\t\t\ttransaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left)));\n\t\t\texpect(transaction.view.hasNode(testTree.left.identifier)).is.false;\n\t\t});\n\t});\n\n\tdescribe('Composite changes', () => {\n\t\tit('can form a node move', () => {\n\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId));\n\t\t\ttransaction.applyChange(ChangeInternal.insert(detachedId, StablePlaceInternal.after(testTree.right)));\n\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([]);\n\t\t\texpect(transaction.view.getTrait(testTree.right.traitLocation)).deep.equals([\n\t\t\t\ttestTree.right.identifier,\n\t\t\t\ttestTree.left.identifier,\n\t\t\t]);\n\t\t});\n\t\tit('can form a wrap insert', () => {\n\t\t\t// A wrap insert is an edit that inserts a new node between a subtree and its parent atomically.\n\t\t\t// Ex: given A -> B -> C, a wrap insert of D around B would produce A -> D -> B -> C\n\t\t\tconst leftNodeDetachedId = 0 as DetachedSequenceId;\n\t\t\tconst parentDetachedId = 1 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), leftNodeDetachedId));\n\t\t\t// This is node D, from the example\n\t\t\tconst wrappingParentId = testTree.generateNodeId();\n\t\t\tconst wrappingParentNode = testTree.buildLeafInternal(wrappingParentId);\n\t\t\tconst wrappingTraitLabel = 'wrapTrait' as TraitLabel;\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.build(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...wrappingParentNode,\n\t\t\t\t\t\t\ttraits: { [wrappingTraitLabel]: [leftNodeDetachedId] }, // Re-parent left under new node\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tparentDetachedId\n\t\t\t\t)\n\t\t\t);\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.insert(parentDetachedId, StablePlace.atStartOf(testTree.left.traitLocation))\n\t\t\t);\n\t\t\tconst leftTrait = transaction.view.getTrait(testTree.left.traitLocation);\n\t\t\texpect(leftTrait).deep.equals([wrappingParentId]);\n\t\t\tconst wrappingTrait = transaction.view.getTrait({\n\t\t\t\tparent: wrappingParentId,\n\t\t\t\tlabel: wrappingTraitLabel,\n\t\t\t});\n\t\t\texpect(wrappingTrait).deep.equals([testTree.left.identifier]);\n\t\t});\n\n\t\tit('can build and insert a tree that contains detached subtrees', () => {\n\t\t\tconst leftNodeDetachedId = 0 as DetachedSequenceId;\n\t\t\tconst rightNodeDetachedId = 1 as DetachedSequenceId;\n\t\t\tconst detachedIdSubtree = 2 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left), leftNodeDetachedId));\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.detach(StableRangeInternal.only(testTree.right), rightNodeDetachedId)\n\t\t\t);\n\n\t\t\tconst detachedNodeId = testTree.generateNodeId();\n\t\t\tconst detachedSubtree = {\n\t\t\t\t...testTree.buildLeafInternal(detachedNodeId),\n\t\t\t\ttraits: {\n\t\t\t\t\t[testTree.left.traitLabel]: [leftNodeDetachedId],\n\t\t\t\t\t[testTree.right.traitLabel]: [rightNodeDetachedId],\n\t\t\t\t},\n\t\t\t};\n\t\t\ttransaction.applyChange(ChangeInternal.build([detachedSubtree], detachedIdSubtree));\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.insert(detachedIdSubtree, StablePlace.atStartOf(testTree.left.traitLocation))\n\t\t\t);\n\t\t\texpect(transaction.view.getTrait(testTree.right.traitLocation)).deep.equals([]);\n\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([detachedNodeId]);\n\n\t\t\tconst insertedSubtree = getChangeNodeFromViewNode(transaction.view, detachedNodeId);\n\t\t\tconst traits = insertedSubtree.traits;\n\n\t\t\tconst leftTreeTraits = traits[testTree.left.traitLabel];\n\t\t\texpect(leftTreeTraits).to.have.lengthOf(1);\n\t\t\texpect(deepCompareNodes(leftTreeTraits[0], testTree.left)).to.be.true;\n\n\t\t\tconst rightTreeTraits = traits[testTree.right.traitLabel];\n\t\t\texpect(rightTreeTraits).to.have.lengthOf(1);\n\t\t\texpect(deepCompareNodes(rightTreeTraits[0], testTree.right)).to.be.true;\n\t\t});\n\n\t\tit('can build and insert a tree with the same identity as that of a detached subtree', () => {\n\t\t\tconst transaction = TransactionInternal.factory(testTree.view);\n\t\t\ttransaction.applyChange(ChangeInternal.detach(StableRangeInternal.only(testTree.left)));\n\t\t\tconst idOfDetachedNodeToInsert = 1 as DetachedSequenceId;\n\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([]);\n\n\t\t\tconst newNode: ChangeNode = {\n\t\t\t\tidentifier: testTree.left.identifier,\n\t\t\t\tdefinition: SimpleTestTree.definition,\n\t\t\t\ttraits: {},\n\t\t\t};\n\n\t\t\ttransaction.applyChange(ChangeInternal.build([newNode], idOfDetachedNodeToInsert));\n\t\t\ttransaction.applyChange(\n\t\t\t\tChangeInternal.insert(idOfDetachedNodeToInsert, StablePlace.atStartOf(testTree.left.traitLocation))\n\t\t\t);\n\t\t\texpect(transaction.view.getTrait(testTree.left.traitLocation)).deep.equals([testTree.left.identifier]);\n\t\t});\n\t});\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeCompression.tests.d.ts","sourceRoot":"","sources":["../../src/test/TreeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { expect } from 'chai';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
import { assert } from '../Common';
|
|
8
|
+
import { walkTree } from '../EditUtilities';
|
|
9
|
+
import { createSessionId, IdCompressor, isFinalId, isLocalId } from '../id-compressor';
|
|
10
|
+
import { isDetachedSequenceId, } from '../Identifiers';
|
|
11
|
+
import { scopeIdNormalizer } from '../NodeIdUtilities';
|
|
12
|
+
import { RevisionView } from '../RevisionView';
|
|
13
|
+
import { MutableStringInterner } from '../StringInterner';
|
|
14
|
+
import { InterningTreeCompressor } from '../TreeCompressor';
|
|
15
|
+
import { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities';
|
|
16
|
+
/**
|
|
17
|
+
* Verifies a tree can round-trip through compression/decompression. Optionally also asserts the compressed state
|
|
18
|
+
* matches some expected state.
|
|
19
|
+
*
|
|
20
|
+
* By default, this function asserts the round-tripped tree is deeply equal to the `tree` parameter.
|
|
21
|
+
* If that parameter is not normalized (ex: contains extra properties), a custom `roundTripAsserter` can be passed instead.
|
|
22
|
+
*/
|
|
23
|
+
function testCompression(tree, idNormalizer, compressed, roundTripAsserter, internStrings = (interner, tree) => {
|
|
24
|
+
walkTree(tree, (node) => {
|
|
25
|
+
interner.getOrCreateInternedId(node.definition);
|
|
26
|
+
for (const trait of Object.keys(node.traits).sort()) {
|
|
27
|
+
interner.getOrCreateInternedId(trait);
|
|
28
|
+
}
|
|
29
|
+
}, isDetachedSequenceId);
|
|
30
|
+
}) {
|
|
31
|
+
const interner = new MutableStringInterner();
|
|
32
|
+
internStrings(interner, tree);
|
|
33
|
+
const treeCompressor = new InterningTreeCompressor();
|
|
34
|
+
const compressedTree = treeCompressor.compress(tree, interner, idNormalizer);
|
|
35
|
+
if (compressed !== undefined) {
|
|
36
|
+
expect(compressedTree).to.deep.equal(compressed);
|
|
37
|
+
}
|
|
38
|
+
const internedStrings = interner.getSerializable();
|
|
39
|
+
const newInterner = new MutableStringInterner(internedStrings);
|
|
40
|
+
const decompressedTree = treeCompressor.decompress(compressedTree, newInterner, idNormalizer);
|
|
41
|
+
if (roundTripAsserter) {
|
|
42
|
+
roundTripAsserter(tree, decompressedTree);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
expect(decompressedTree).to.deep.equal(tree);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Brands the passed in number as an `InternedStringId`.
|
|
50
|
+
* Ergonomic helper for making expected compressed trees typecheck.
|
|
51
|
+
*/
|
|
52
|
+
function internedId(n) {
|
|
53
|
+
return n;
|
|
54
|
+
}
|
|
55
|
+
describe('TreeCompression', () => {
|
|
56
|
+
it('noops on a placeholder root tree', () => {
|
|
57
|
+
const placeholderId = 42;
|
|
58
|
+
const context = makeNodeIdContext();
|
|
59
|
+
testCompression(placeholderId, scopeIdNormalizer(context), placeholderId);
|
|
60
|
+
});
|
|
61
|
+
it('can compress trees containing nested DetachedSequenceIds', () => {
|
|
62
|
+
const context = makeNodeIdContext();
|
|
63
|
+
const id = context.generateNodeId();
|
|
64
|
+
const detachedSequenceId = 43;
|
|
65
|
+
const tree = {
|
|
66
|
+
identifier: id,
|
|
67
|
+
definition: 'node',
|
|
68
|
+
traits: {
|
|
69
|
+
someTrait: [detachedSequenceId],
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
testCompression(tree, scopeIdNormalizer(context), [
|
|
73
|
+
internedId(0),
|
|
74
|
+
context.normalizeToOpSpace(id),
|
|
75
|
+
[internedId(1), [detachedSequenceId]],
|
|
76
|
+
]);
|
|
77
|
+
});
|
|
78
|
+
it('omits traits and payload fields on empty leaf nodes', () => {
|
|
79
|
+
const context = makeNodeIdContext();
|
|
80
|
+
const id = context.generateNodeId();
|
|
81
|
+
const tree = {
|
|
82
|
+
identifier: id,
|
|
83
|
+
definition: 'node',
|
|
84
|
+
traits: {},
|
|
85
|
+
};
|
|
86
|
+
testCompression(tree, scopeIdNormalizer(context), [internedId(0), context.normalizeToOpSpace(id)]);
|
|
87
|
+
});
|
|
88
|
+
it('handles payloads on leaves', () => {
|
|
89
|
+
const context = makeNodeIdContext();
|
|
90
|
+
const id = context.generateNodeId();
|
|
91
|
+
const tree = {
|
|
92
|
+
identifier: id,
|
|
93
|
+
definition: 'node',
|
|
94
|
+
traits: {},
|
|
95
|
+
payload: 5,
|
|
96
|
+
};
|
|
97
|
+
testCompression(tree, scopeIdNormalizer(context), [internedId(0), context.normalizeToOpSpace(id), [5]]);
|
|
98
|
+
});
|
|
99
|
+
it('handles non-interned `Definition`s', () => {
|
|
100
|
+
const context = makeNodeIdContext();
|
|
101
|
+
const id = context.generateNodeId();
|
|
102
|
+
const definition = 'node';
|
|
103
|
+
const tree = {
|
|
104
|
+
identifier: id,
|
|
105
|
+
definition,
|
|
106
|
+
traits: {},
|
|
107
|
+
};
|
|
108
|
+
testCompression(tree, scopeIdNormalizer(context), [definition, context.normalizeToOpSpace(id)], undefined, () => { } /* intern nothing */);
|
|
109
|
+
});
|
|
110
|
+
it('handles non-interned `TraitLabel`s', () => {
|
|
111
|
+
const context = makeNodeIdContext();
|
|
112
|
+
const parentId = context.generateNodeId();
|
|
113
|
+
const childId = context.generateNodeId();
|
|
114
|
+
const parentDefinition = 'def1';
|
|
115
|
+
const childDefinition = 'def2';
|
|
116
|
+
const tree = {
|
|
117
|
+
identifier: parentId,
|
|
118
|
+
definition: parentDefinition,
|
|
119
|
+
traits: {
|
|
120
|
+
trait1: [
|
|
121
|
+
{
|
|
122
|
+
identifier: childId,
|
|
123
|
+
definition: childDefinition,
|
|
124
|
+
traits: {},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
testCompression(tree, scopeIdNormalizer(context), [internedId(0), context.normalizeToOpSpace(parentId), ['trait1', [[internedId(1)]]]], undefined, (interner) => {
|
|
130
|
+
interner.getOrCreateInternedId(parentDefinition);
|
|
131
|
+
interner.getOrCreateInternedId(childDefinition);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
it('handles intermediate nodes without payloads', () => {
|
|
135
|
+
const context = makeNodeIdContext();
|
|
136
|
+
const parentId = context.generateNodeId();
|
|
137
|
+
const childId = context.generateNodeId();
|
|
138
|
+
const parentDefinition = 'def1';
|
|
139
|
+
const childDefinition = 'def2';
|
|
140
|
+
const tree = {
|
|
141
|
+
identifier: parentId,
|
|
142
|
+
definition: parentDefinition,
|
|
143
|
+
traits: {
|
|
144
|
+
trait1: [
|
|
145
|
+
{
|
|
146
|
+
identifier: childId,
|
|
147
|
+
definition: childDefinition,
|
|
148
|
+
traits: {},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
testCompression(tree, scopeIdNormalizer(context), [
|
|
154
|
+
internedId(0),
|
|
155
|
+
context.normalizeToOpSpace(parentId),
|
|
156
|
+
[internedId(1), [[internedId(2)]]],
|
|
157
|
+
]);
|
|
158
|
+
});
|
|
159
|
+
it('handles intermediate nodes with payloads', () => {
|
|
160
|
+
const context = makeNodeIdContext();
|
|
161
|
+
const parentId = context.generateNodeId();
|
|
162
|
+
const childId = context.generateNodeId();
|
|
163
|
+
const parentDefinition = 'def1';
|
|
164
|
+
const childDefinition = 'def2';
|
|
165
|
+
const payload = 'parentPayload';
|
|
166
|
+
const tree = {
|
|
167
|
+
identifier: parentId,
|
|
168
|
+
definition: parentDefinition,
|
|
169
|
+
traits: {
|
|
170
|
+
trait1: [
|
|
171
|
+
{
|
|
172
|
+
identifier: childId,
|
|
173
|
+
definition: childDefinition,
|
|
174
|
+
traits: {},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
payload,
|
|
179
|
+
};
|
|
180
|
+
testCompression(tree, scopeIdNormalizer(context), [
|
|
181
|
+
internedId(0),
|
|
182
|
+
context.normalizeToOpSpace(parentId),
|
|
183
|
+
[payload, internedId(1), [[internedId(2)]]],
|
|
184
|
+
]);
|
|
185
|
+
});
|
|
186
|
+
it('handles traits with multiple nodes', () => {
|
|
187
|
+
const tree = setUpTestTree();
|
|
188
|
+
testCompression(tree, scopeIdNormalizer(tree), [
|
|
189
|
+
internedId(0),
|
|
190
|
+
tree.normalizeToOpSpace(tree.identifier),
|
|
191
|
+
[
|
|
192
|
+
internedId(1),
|
|
193
|
+
[[internedId(0), tree.normalizeToOpSpace(tree.left.identifier)]],
|
|
194
|
+
internedId(2),
|
|
195
|
+
[[internedId(0)]],
|
|
196
|
+
],
|
|
197
|
+
],
|
|
198
|
+
// SimpleTestTree contains extra properties, so deep compare as objects is insufficient. The revision view strategy
|
|
199
|
+
// only works for valid standalone trees (i.e. ones without placeholders).
|
|
200
|
+
(tree, treeAfterRoundTrip) => {
|
|
201
|
+
expect(RevisionView.fromTree(tree).equals(RevisionView.fromTree(treeAfterRoundTrip)), 'Unequal revision views');
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
it('can round trip a tree with several levels', () => {
|
|
205
|
+
const context = makeNodeIdContext();
|
|
206
|
+
const makeLeaf = () => ({
|
|
207
|
+
identifier: context.generateNodeId(),
|
|
208
|
+
definition: uuidv4(),
|
|
209
|
+
traits: {},
|
|
210
|
+
});
|
|
211
|
+
// Makes a full 2-ary tree with the provided height.
|
|
212
|
+
const makeTreeWithHeight = (height) => {
|
|
213
|
+
if (height === 0) {
|
|
214
|
+
return makeLeaf();
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
identifier: context.generateNodeId(),
|
|
218
|
+
definition: uuidv4(),
|
|
219
|
+
traits: {
|
|
220
|
+
[uuidv4()]: [makeTreeWithHeight(height - 1)],
|
|
221
|
+
[uuidv4()]: [makeTreeWithHeight(height - 1)],
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
testCompression(makeTreeWithHeight(3), scopeIdNormalizer(context));
|
|
226
|
+
});
|
|
227
|
+
it('elides IDs that span multiple children or cousins', () => {
|
|
228
|
+
const reservedIdCount = 4;
|
|
229
|
+
const idCompressor = new IdCompressor(createSessionId(), reservedIdCount);
|
|
230
|
+
const context = makeNodeIdContext(idCompressor);
|
|
231
|
+
// Order of IDs: [-1, -2, -3, -4, 0, 1, 2, -5, 3, -6, -6]
|
|
232
|
+
// After elision: [-1, _, _, _, 0, _, _, -5, 3, -6, -6]
|
|
233
|
+
const localIds = [...Array(6).keys()].map((_) => context.generateNodeId());
|
|
234
|
+
localIds.forEach((id) => assert(isLocalId(id)));
|
|
235
|
+
const finalIds = [...Array(reservedIdCount).keys()].map((_, i) => idCompressor.getReservedId(i));
|
|
236
|
+
finalIds.forEach((id) => assert(isFinalId(id)));
|
|
237
|
+
function node(identifier, traits) {
|
|
238
|
+
return {
|
|
239
|
+
identifier,
|
|
240
|
+
definition: 'def',
|
|
241
|
+
traits: traits !== null && traits !== void 0 ? traits : {},
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const tree = node(localIds[0], {
|
|
245
|
+
zebra: [node(localIds[5]), node(localIds[5])],
|
|
246
|
+
maganio: [
|
|
247
|
+
node(localIds[3]),
|
|
248
|
+
node(finalIds[0], {
|
|
249
|
+
pardesio: [node(finalIds[2]), node(localIds[4]), node(finalIds[3])],
|
|
250
|
+
hortonio: [node(finalIds[1])],
|
|
251
|
+
}),
|
|
252
|
+
],
|
|
253
|
+
aardvark: [
|
|
254
|
+
node(localIds[1], {
|
|
255
|
+
basketball: [node(localIds[2])],
|
|
256
|
+
}),
|
|
257
|
+
],
|
|
258
|
+
});
|
|
259
|
+
const nodeDef = internedId(0);
|
|
260
|
+
function id(id) {
|
|
261
|
+
return context.normalizeToOpSpace(id);
|
|
262
|
+
}
|
|
263
|
+
testCompression(tree, scopeIdNormalizer(context), [
|
|
264
|
+
nodeDef,
|
|
265
|
+
id(tree.identifier),
|
|
266
|
+
[
|
|
267
|
+
internedId(1),
|
|
268
|
+
[[nodeDef, [internedId(4), [[nodeDef]]]]],
|
|
269
|
+
internedId(2),
|
|
270
|
+
[
|
|
271
|
+
[nodeDef],
|
|
272
|
+
[
|
|
273
|
+
nodeDef,
|
|
274
|
+
id(finalIds[0]),
|
|
275
|
+
[
|
|
276
|
+
internedId(5),
|
|
277
|
+
[[nodeDef]],
|
|
278
|
+
internedId(6),
|
|
279
|
+
[[nodeDef], [nodeDef, id(localIds[4])], [nodeDef, id(finalIds[3])]],
|
|
280
|
+
],
|
|
281
|
+
],
|
|
282
|
+
],
|
|
283
|
+
internedId(3),
|
|
284
|
+
[
|
|
285
|
+
[nodeDef, id(localIds[5])],
|
|
286
|
+
[nodeDef, id(localIds[5])],
|
|
287
|
+
],
|
|
288
|
+
],
|
|
289
|
+
]);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
//# sourceMappingURL=TreeCompression.tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeCompression.tests.js","sourceRoot":"","sources":["../../src/test/TreeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WA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,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { expect } from 'chai';\nimport { v4 as uuidv4 } from 'uuid';\nimport { assert } from '../Common';\nimport { walkTree } from '../EditUtilities';\nimport { createSessionId, IdCompressor, isFinalId, isLocalId } from '../id-compressor';\nimport {\n\tDefinition,\n\tDetachedSequenceId,\n\tInternedStringId,\n\tisDetachedSequenceId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tTraitLabel,\n} from '../Identifiers';\nimport { ContextualizedNodeIdNormalizer, scopeIdNormalizer } from '../NodeIdUtilities';\nimport { CompressedPlaceholderTree, PlaceholderTree, TraitMap, TreeNode } from '../persisted-types';\nimport { RevisionView } from '../RevisionView';\nimport { MutableStringInterner } from '../StringInterner';\nimport { InterningTreeCompressor } from '../TreeCompressor';\nimport { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities';\n\n/**\n * Verifies a tree can round-trip through compression/decompression. Optionally also asserts the compressed state\n * matches some expected state.\n *\n * By default, this function asserts the round-tripped tree is deeply equal to the `tree` parameter.\n * If that parameter is not normalized (ex: contains extra properties), a custom `roundTripAsserter` can be passed instead.\n */\nfunction testCompression<TPlaceholder extends DetachedSequenceId | never>(\n\ttree: PlaceholderTree<TPlaceholder>,\n\tidNormalizer: ContextualizedNodeIdNormalizer<OpSpaceNodeId>,\n\tcompressed?: CompressedPlaceholderTree<OpSpaceNodeId, TPlaceholder>,\n\troundTripAsserter?: (tree: PlaceholderTree<TPlaceholder>, roundTrippedTree: PlaceholderTree<TPlaceholder>) => void,\n\tinternStrings: (interner: MutableStringInterner, tree: PlaceholderTree<TPlaceholder>) => void = (\n\t\tinterner,\n\t\ttree\n\t) => {\n\t\twalkTree<Exclude<PlaceholderTree<DetachedSequenceId>, DetachedSequenceId>, DetachedSequenceId>(\n\t\t\ttree,\n\t\t\t(node) => {\n\t\t\t\tinterner.getOrCreateInternedId(node.definition);\n\t\t\t\tfor (const trait of Object.keys(node.traits).sort()) {\n\t\t\t\t\tinterner.getOrCreateInternedId(trait);\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDetachedSequenceId\n\t\t);\n\t}\n): void {\n\tconst interner = new MutableStringInterner();\n\tinternStrings(interner, tree);\n\tconst treeCompressor = new InterningTreeCompressor<TPlaceholder>();\n\tconst compressedTree = treeCompressor.compress(tree, interner, idNormalizer);\n\tif (compressed !== undefined) {\n\t\texpect(compressedTree).to.deep.equal(compressed);\n\t}\n\tconst internedStrings = interner.getSerializable();\n\tconst newInterner = new MutableStringInterner(internedStrings);\n\tconst decompressedTree = treeCompressor.decompress(compressedTree, newInterner, idNormalizer);\n\tif (roundTripAsserter) {\n\t\troundTripAsserter(tree, decompressedTree);\n\t} else {\n\t\texpect(decompressedTree).to.deep.equal(tree);\n\t}\n}\n\n/**\n * Brands the passed in number as an `InternedStringId`.\n * Ergonomic helper for making expected compressed trees typecheck.\n */\nfunction internedId(n: number): InternedStringId {\n\treturn n as InternedStringId;\n}\n\ndescribe('TreeCompression', () => {\n\tit('noops on a placeholder root tree', () => {\n\t\tconst placeholderId = 42 as DetachedSequenceId;\n\t\tconst context = makeNodeIdContext();\n\t\ttestCompression(placeholderId, scopeIdNormalizer(context), placeholderId);\n\t});\n\n\tit('can compress trees containing nested DetachedSequenceIds', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst detachedSequenceId = 43 as DetachedSequenceId;\n\t\tconst tree: PlaceholderTree<DetachedSequenceId> = {\n\t\t\tidentifier: id,\n\t\t\tdefinition: 'node' as Definition,\n\t\t\ttraits: {\n\t\t\t\tsomeTrait: [detachedSequenceId],\n\t\t\t},\n\t\t};\n\t\ttestCompression(tree, scopeIdNormalizer(context), [\n\t\t\tinternedId(0),\n\t\t\tcontext.normalizeToOpSpace(id),\n\t\t\t[internedId(1), [detachedSequenceId]],\n\t\t]);\n\t});\n\n\tit('omits traits and payload fields on empty leaf nodes', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: id,\n\t\t\tdefinition: 'node' as Definition,\n\t\t\ttraits: {},\n\t\t};\n\t\ttestCompression(tree, scopeIdNormalizer(context), [internedId(0), context.normalizeToOpSpace(id)]);\n\t});\n\n\tit('handles payloads on leaves', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: id,\n\t\t\tdefinition: 'node' as Definition,\n\t\t\ttraits: {},\n\t\t\tpayload: 5,\n\t\t};\n\t\ttestCompression(tree, scopeIdNormalizer(context), [internedId(0), context.normalizeToOpSpace(id), [5]]);\n\t});\n\n\tit('handles non-interned `Definition`s', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst definition = 'node' as Definition;\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: id,\n\t\t\tdefinition,\n\t\t\ttraits: {},\n\t\t};\n\t\ttestCompression(\n\t\t\ttree,\n\t\t\tscopeIdNormalizer(context),\n\t\t\t[definition, context.normalizeToOpSpace(id)],\n\t\t\tundefined,\n\t\t\t() => {} /* intern nothing */\n\t\t);\n\t});\n\n\tit('handles non-interned `TraitLabel`s', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst parentId = context.generateNodeId();\n\t\tconst childId = context.generateNodeId();\n\t\tconst parentDefinition = 'def1' as Definition;\n\t\tconst childDefinition = 'def2' as Definition;\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: parentId,\n\t\t\tdefinition: parentDefinition,\n\t\t\ttraits: {\n\t\t\t\ttrait1: [\n\t\t\t\t\t{\n\t\t\t\t\t\tidentifier: childId,\n\t\t\t\t\t\tdefinition: childDefinition,\n\t\t\t\t\t\ttraits: {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t};\n\t\ttestCompression(\n\t\t\ttree,\n\t\t\tscopeIdNormalizer(context),\n\t\t\t[internedId(0), context.normalizeToOpSpace(parentId), ['trait1', [[internedId(1)]]]],\n\t\t\tundefined,\n\t\t\t(interner) => {\n\t\t\t\tinterner.getOrCreateInternedId(parentDefinition);\n\t\t\t\tinterner.getOrCreateInternedId(childDefinition);\n\t\t\t}\n\t\t);\n\t});\n\n\tit('handles intermediate nodes without payloads', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst parentId = context.generateNodeId();\n\t\tconst childId = context.generateNodeId();\n\t\tconst parentDefinition = 'def1' as Definition;\n\t\tconst childDefinition = 'def2' as Definition;\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: parentId,\n\t\t\tdefinition: parentDefinition,\n\t\t\ttraits: {\n\t\t\t\ttrait1: [\n\t\t\t\t\t{\n\t\t\t\t\t\tidentifier: childId,\n\t\t\t\t\t\tdefinition: childDefinition,\n\t\t\t\t\t\ttraits: {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t};\n\t\ttestCompression(tree, scopeIdNormalizer(context), [\n\t\t\tinternedId(0),\n\t\t\tcontext.normalizeToOpSpace(parentId),\n\t\t\t[internedId(1), [[internedId(2)]]],\n\t\t]);\n\t});\n\n\tit('handles intermediate nodes with payloads', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst parentId = context.generateNodeId();\n\t\tconst childId = context.generateNodeId();\n\t\tconst parentDefinition = 'def1' as Definition;\n\t\tconst childDefinition = 'def2' as Definition;\n\t\tconst payload = 'parentPayload';\n\t\tconst tree: PlaceholderTree = {\n\t\t\tidentifier: parentId,\n\t\t\tdefinition: parentDefinition,\n\t\t\ttraits: {\n\t\t\t\ttrait1: [\n\t\t\t\t\t{\n\t\t\t\t\t\tidentifier: childId,\n\t\t\t\t\t\tdefinition: childDefinition,\n\t\t\t\t\t\ttraits: {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\tpayload,\n\t\t};\n\t\ttestCompression(tree, scopeIdNormalizer(context), [\n\t\t\tinternedId(0),\n\t\t\tcontext.normalizeToOpSpace(parentId),\n\t\t\t[payload, internedId(1), [[internedId(2)]]],\n\t\t]);\n\t});\n\n\tit('handles traits with multiple nodes', () => {\n\t\tconst tree = setUpTestTree();\n\t\ttestCompression<never>(\n\t\t\ttree,\n\t\t\tscopeIdNormalizer(tree),\n\t\t\t[\n\t\t\t\tinternedId(0),\n\t\t\t\ttree.normalizeToOpSpace(tree.identifier),\n\t\t\t\t[\n\t\t\t\t\tinternedId(1),\n\t\t\t\t\t[[internedId(0), tree.normalizeToOpSpace(tree.left.identifier)]],\n\t\t\t\t\tinternedId(2),\n\t\t\t\t\t[[internedId(0)]], // Right ID should be elided, but no others\n\t\t\t\t],\n\t\t\t],\n\t\t\t// SimpleTestTree contains extra properties, so deep compare as objects is insufficient. The revision view strategy\n\t\t\t// only works for valid standalone trees (i.e. ones without placeholders).\n\t\t\t(tree, treeAfterRoundTrip) => {\n\t\t\t\texpect(\n\t\t\t\t\tRevisionView.fromTree(tree).equals(RevisionView.fromTree(treeAfterRoundTrip)),\n\t\t\t\t\t'Unequal revision views'\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t});\n\n\tit('can round trip a tree with several levels', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst makeLeaf = (): PlaceholderTree => ({\n\t\t\tidentifier: context.generateNodeId(),\n\t\t\tdefinition: uuidv4() as Definition,\n\t\t\ttraits: {},\n\t\t});\n\n\t\t// Makes a full 2-ary tree with the provided height.\n\t\tconst makeTreeWithHeight = (height: number): PlaceholderTree => {\n\t\t\tif (height === 0) {\n\t\t\t\treturn makeLeaf();\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tidentifier: context.generateNodeId(),\n\t\t\t\tdefinition: uuidv4() as Definition,\n\t\t\t\ttraits: {\n\t\t\t\t\t[uuidv4() as TraitLabel]: [makeTreeWithHeight(height - 1)],\n\t\t\t\t\t[uuidv4() as TraitLabel]: [makeTreeWithHeight(height - 1)],\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\n\t\ttestCompression(makeTreeWithHeight(3), scopeIdNormalizer(context));\n\t});\n\n\tit('elides IDs that span multiple children or cousins', () => {\n\t\tconst reservedIdCount = 4;\n\t\tconst idCompressor = new IdCompressor(createSessionId(), reservedIdCount);\n\t\tconst context = makeNodeIdContext(idCompressor);\n\t\t// Order of IDs: [-1, -2, -3, -4, 0, 1, 2, -5, 3, -6, -6]\n\t\t// After elision: [-1, _, _, _, 0, _, _, -5, 3, -6, -6]\n\t\tconst localIds = [...Array(6).keys()].map((_) => context.generateNodeId());\n\t\tlocalIds.forEach((id) => assert(isLocalId(id)));\n\t\tconst finalIds = [...Array(reservedIdCount).keys()].map((_, i) => idCompressor.getReservedId(i) as NodeId);\n\t\tfinalIds.forEach((id) => assert(isFinalId(id)));\n\n\t\tfunction node(\n\t\t\tidentifier: NodeId,\n\t\t\ttraits?: TraitMap<TreeNode<PlaceholderTree, NodeId>>\n\t\t): TreeNode<PlaceholderTree, NodeId> {\n\t\t\treturn {\n\t\t\t\tidentifier,\n\t\t\t\tdefinition: 'def' as Definition,\n\t\t\t\ttraits: traits ?? {},\n\t\t\t};\n\t\t}\n\n\t\tconst tree: PlaceholderTree = node(localIds[0], {\n\t\t\tzebra: [node(localIds[5]), node(localIds[5])],\n\t\t\tmaganio: [\n\t\t\t\tnode(localIds[3]),\n\t\t\t\tnode(finalIds[0], {\n\t\t\t\t\tpardesio: [node(finalIds[2]), node(localIds[4]), node(finalIds[3])],\n\t\t\t\t\thortonio: [node(finalIds[1])],\n\t\t\t\t}),\n\t\t\t],\n\t\t\taardvark: [\n\t\t\t\tnode(localIds[1], {\n\t\t\t\t\tbasketball: [node(localIds[2])],\n\t\t\t\t}),\n\t\t\t],\n\t\t});\n\n\t\tconst nodeDef = internedId(0);\n\n\t\tfunction id(id: NodeId): OpSpaceNodeId {\n\t\t\treturn context.normalizeToOpSpace(id);\n\t\t}\n\n\t\ttestCompression<never>(tree, scopeIdNormalizer(context), [\n\t\t\tnodeDef,\n\t\t\tid(tree.identifier),\n\t\t\t[\n\t\t\t\tinternedId(1), // aardvark\n\t\t\t\t[[nodeDef, [internedId(4), [[nodeDef]]]]],\n\t\t\t\tinternedId(2), // maganio\n\t\t\t\t[\n\t\t\t\t\t[nodeDef],\n\t\t\t\t\t[\n\t\t\t\t\t\tnodeDef,\n\t\t\t\t\t\tid(finalIds[0]),\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tinternedId(5), // hortonio\n\t\t\t\t\t\t\t[[nodeDef]],\n\t\t\t\t\t\t\tinternedId(6), // pardesio\n\t\t\t\t\t\t\t[[nodeDef], [nodeDef, id(localIds[4])], [nodeDef, id(finalIds[3])]],\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t\tinternedId(3), // zebra\n\t\t\t\t[\n\t\t\t\t\t[nodeDef, id(localIds[5])],\n\t\t\t\t\t[nodeDef, id(localIds[5])],\n\t\t\t\t],\n\t\t\t],\n\t\t]);\n\t});\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeView.tests.d.ts","sourceRoot":"","sources":["../../src/test/TreeView.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { expect } from 'chai';
|
|
6
|
+
import { RevisionView } from '../RevisionView';
|
|
7
|
+
import { refreshTestTree } from './utilities/TestUtilities';
|
|
8
|
+
import { expectDefined } from './utilities/TestCommon';
|
|
9
|
+
describe('TreeView', () => {
|
|
10
|
+
const testTree = refreshTestTree();
|
|
11
|
+
describe('can compute deltas', () => {
|
|
12
|
+
it('that are the same object', () => {
|
|
13
|
+
const view = testTree.view;
|
|
14
|
+
expect(view.delta(view)).deep.equals({
|
|
15
|
+
changed: [],
|
|
16
|
+
added: [],
|
|
17
|
+
removed: [],
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
it('that have the same tree', () => {
|
|
21
|
+
const viewA = RevisionView.fromTree(testTree);
|
|
22
|
+
const viewB = RevisionView.fromTree(testTree);
|
|
23
|
+
expect(viewA.delta(viewB)).deep.equals({
|
|
24
|
+
changed: [],
|
|
25
|
+
added: [],
|
|
26
|
+
removed: [],
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('with different root ids', () => {
|
|
30
|
+
const viewA = RevisionView.fromTree(testTree.buildLeaf(testTree.generateNodeId()));
|
|
31
|
+
const viewB = RevisionView.fromTree(testTree.buildLeaf(testTree.generateNodeId()));
|
|
32
|
+
expect(() => viewA.delta(viewB)).to.throw('Delta can only be calculated between views that share a root');
|
|
33
|
+
});
|
|
34
|
+
it('with different subtrees', () => {
|
|
35
|
+
const rootId = testTree.generateNodeId();
|
|
36
|
+
const leafA = testTree.buildLeaf(testTree.generateNodeId());
|
|
37
|
+
const leafB = testTree.buildLeaf(testTree.generateNodeId());
|
|
38
|
+
const subtreeA = {
|
|
39
|
+
identifier: testTree.generateNodeId(),
|
|
40
|
+
definition: 'node',
|
|
41
|
+
traits: { children: [leafA] },
|
|
42
|
+
};
|
|
43
|
+
const subtreeB = {
|
|
44
|
+
identifier: testTree.generateNodeId(),
|
|
45
|
+
definition: 'node',
|
|
46
|
+
traits: { children: [leafB] },
|
|
47
|
+
};
|
|
48
|
+
const rootA = {
|
|
49
|
+
identifier: rootId,
|
|
50
|
+
definition: 'node',
|
|
51
|
+
traits: {
|
|
52
|
+
children: [subtreeA],
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const rootB = {
|
|
56
|
+
identifier: rootId,
|
|
57
|
+
definition: 'node',
|
|
58
|
+
traits: {
|
|
59
|
+
children: [subtreeB],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const viewA = RevisionView.fromTree(rootA);
|
|
63
|
+
const viewB = RevisionView.fromTree(rootB);
|
|
64
|
+
const delta = viewA.delta(viewB);
|
|
65
|
+
expect(delta.changed).deep.equals([rootId]);
|
|
66
|
+
expect(delta.removed.length).equals(2);
|
|
67
|
+
expect(delta.added.length).equals(2);
|
|
68
|
+
expect(delta.removed).contains(subtreeA.identifier);
|
|
69
|
+
expect(delta.removed).contains(leafA.identifier);
|
|
70
|
+
expect(delta.added).contains(subtreeB.identifier);
|
|
71
|
+
expect(delta.added).contains(leafB.identifier);
|
|
72
|
+
});
|
|
73
|
+
it('with different payloads', () => {
|
|
74
|
+
const rootId = testTree.generateNodeId();
|
|
75
|
+
const nodeA = {
|
|
76
|
+
identifier: rootId,
|
|
77
|
+
definition: 'node',
|
|
78
|
+
payload: 'test1',
|
|
79
|
+
traits: {},
|
|
80
|
+
};
|
|
81
|
+
const nodeB = {
|
|
82
|
+
identifier: rootId,
|
|
83
|
+
definition: 'node',
|
|
84
|
+
payload: 'test2',
|
|
85
|
+
traits: {},
|
|
86
|
+
};
|
|
87
|
+
const viewA = RevisionView.fromTree(nodeA);
|
|
88
|
+
const viewB = RevisionView.fromTree(nodeB);
|
|
89
|
+
const delta = viewA.delta(viewB);
|
|
90
|
+
expect(delta.changed).deep.equals([rootId]);
|
|
91
|
+
expect(delta.removed).deep.equals([]);
|
|
92
|
+
expect(delta.added).deep.equals([]);
|
|
93
|
+
});
|
|
94
|
+
it('after an insert', () => {
|
|
95
|
+
const viewA = testTree.view;
|
|
96
|
+
const insertedNode = testTree.buildLeaf(testTree.generateNodeId());
|
|
97
|
+
const treeB = {
|
|
98
|
+
identifier: testTree.identifier,
|
|
99
|
+
definition: testTree.definition,
|
|
100
|
+
traits: Object.assign(Object.assign({}, testTree.traits), { left: [insertedNode, testTree.left] }),
|
|
101
|
+
};
|
|
102
|
+
const viewB = RevisionView.fromTree(treeB);
|
|
103
|
+
const delta = viewA.delta(viewB);
|
|
104
|
+
expect(delta.changed).deep.equals([testTree.identifier]);
|
|
105
|
+
expect(delta.removed).deep.equals([]);
|
|
106
|
+
expect(delta.added).deep.equals([insertedNode.identifier]);
|
|
107
|
+
});
|
|
108
|
+
it('after a delete', () => {
|
|
109
|
+
const viewA = testTree.view;
|
|
110
|
+
const treeB = {
|
|
111
|
+
identifier: testTree.identifier,
|
|
112
|
+
definition: testTree.definition,
|
|
113
|
+
traits: Object.assign(Object.assign({}, testTree.traits), { left: [] }),
|
|
114
|
+
};
|
|
115
|
+
const viewB = RevisionView.fromTree(treeB);
|
|
116
|
+
const delta = viewA.delta(viewB);
|
|
117
|
+
expect(delta.changed).deep.equals([testTree.identifier]);
|
|
118
|
+
expect(delta.removed).deep.equals([testTree.left.identifier]);
|
|
119
|
+
expect(delta.added).deep.equals([]);
|
|
120
|
+
});
|
|
121
|
+
it('after a move', () => {
|
|
122
|
+
const viewA = testTree.view;
|
|
123
|
+
const treeB = {
|
|
124
|
+
identifier: testTree.identifier,
|
|
125
|
+
definition: testTree.definition,
|
|
126
|
+
traits: Object.assign(Object.assign({}, testTree.traits), { left: [], right: [testTree.right, testTree.left] }),
|
|
127
|
+
};
|
|
128
|
+
const viewB = RevisionView.fromTree(treeB);
|
|
129
|
+
const delta = viewA.delta(viewB);
|
|
130
|
+
expect(delta.changed).deep.equals([testTree.identifier]);
|
|
131
|
+
expect(delta.removed).deep.equals([]);
|
|
132
|
+
expect(delta.added).deep.equals([]);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
it('correctly returns node parentage', () => {
|
|
136
|
+
const view = testTree.view;
|
|
137
|
+
for (const node of view) {
|
|
138
|
+
const parentNode = view.tryGetParentViewNode(node.identifier);
|
|
139
|
+
if (parentNode !== undefined) {
|
|
140
|
+
const parentage = expectDefined(node.parentage);
|
|
141
|
+
expect(parentage.label).to.equal(view.getTraitLabel(node.identifier));
|
|
142
|
+
expect(parentage.parent).to.equal(parentNode.identifier);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=TreeView.tests.js.map
|