@fluid-experimental/tree 0.58.2001 → 0.59.2000-61729
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 +159 -46
- 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 -105
- 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 +61 -32
- 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 +129 -85
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +111 -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 +105 -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 +439 -0
- package/dist/SharedTree.d.ts.map +1 -0
- package/dist/SharedTree.js +1109 -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 +71 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +92 -0
- package/dist/Transaction.js.map +1 -0
- package/dist/TransactionInternal.d.ts +540 -0
- package/dist/TransactionInternal.d.ts.map +1 -0
- package/dist/TransactionInternal.js +626 -0
- package/dist/TransactionInternal.js.map +1 -0
- package/dist/TreeCompressor.d.ts +36 -0
- package/dist/TreeCompressor.d.ts.map +1 -0
- package/dist/TreeCompressor.js +137 -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 +218 -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/docs/Write-Format.md +19 -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 -105
- 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 +53 -24
- 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 +129 -85
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +103 -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 +105 -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 +439 -0
- package/lib/SharedTree.d.ts.map +1 -0
- package/lib/SharedTree.js +1104 -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 +71 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +88 -0
- package/lib/Transaction.js.map +1 -0
- package/lib/TransactionInternal.d.ts +540 -0
- package/lib/TransactionInternal.d.ts.map +1 -0
- package/lib/TransactionInternal.js +622 -0
- package/lib/TransactionInternal.js.map +1 -0
- package/lib/TreeCompressor.d.ts +36 -0
- package/lib/TreeCompressor.d.ts.map +1 -0
- package/lib/TreeCompressor.js +133 -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 +214 -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 +276 -191
- 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 +109 -329
- 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 +176 -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 +146 -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 +217 -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 +370 -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 +22 -17
- package/src/ChangeCompression.ts +159 -0
- package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -125
- package/src/Checkout.ts +82 -53
- 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 +156 -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 +1501 -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 +120 -0
- package/src/TransactionInternal.ts +1087 -0
- package/src/TreeCompressor.ts +213 -0
- package/src/TreeNodeHandle.ts +19 -32
- package/src/TreeView.ts +322 -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 +118 -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/docs/Future.md +0 -155
- 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
package/src/Forest.ts
CHANGED
|
@@ -4,28 +4,44 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import BTree from 'sorted-btree';
|
|
7
|
-
import { fail, assert,
|
|
8
|
-
import { NodeData, Payload } from './generic';
|
|
7
|
+
import { fail, assert, copyPropertyIfDefined, compareBtrees, compareFiniteNumbers } from './Common';
|
|
9
8
|
import { NodeId, TraitLabel } from './Identifiers';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
type Optional<T> = {
|
|
13
|
-
[P in keyof T]: T[P] | undefined;
|
|
14
|
-
};
|
|
9
|
+
import { comparePayloads } from './PayloadUtilities';
|
|
10
|
+
import { NodeData, Payload } from './persisted-types';
|
|
15
11
|
|
|
16
12
|
/**
|
|
17
|
-
* A node that can be contained within a Forest
|
|
13
|
+
* A node that can be contained within a Forest
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
18
16
|
*/
|
|
19
|
-
export interface ForestNode extends NodeData {
|
|
17
|
+
export interface ForestNode extends NodeData<NodeId> {
|
|
20
18
|
readonly traits: ReadonlyMap<TraitLabel, readonly NodeId[]>;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A node within a Forest that has a parent (and is therefore not the root node)
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export interface ParentedForestNode extends ForestNode, ParentData {}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Check whether or not the given node in a forest is parented
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export function isParentedForestNode(node: ForestNode): node is ParentedForestNode {
|
|
34
|
+
const parentedNode = node as ForestNode & Partial<ParentedForestNode>;
|
|
35
|
+
const hasParent = parentedNode.parentId !== undefined;
|
|
36
|
+
const hasTraitParent = parentedNode.traitParent !== undefined;
|
|
37
|
+
assert(hasParent === hasTraitParent, 'node must have either both parent and traitParent set or neither');
|
|
38
|
+
return hasParent;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
/**
|
|
28
42
|
* Information about a ForestNode's parent
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
29
45
|
*/
|
|
30
46
|
export interface ParentData {
|
|
31
47
|
readonly parentId: NodeId;
|
|
@@ -51,20 +67,22 @@ export interface Delta<NodeId> {
|
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
interface ForestState {
|
|
54
|
-
nodes: BTree<NodeId,
|
|
70
|
+
nodes: BTree<NodeId, ForestNode>;
|
|
55
71
|
expensiveValidation: boolean;
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
/**
|
|
59
75
|
* An immutable forest of ForestNode.
|
|
60
76
|
* Enforces single parenting, and allows querying the parent.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
61
79
|
*/
|
|
62
80
|
export class Forest {
|
|
63
81
|
/**
|
|
64
82
|
* Contains the nodes in the forest.
|
|
65
83
|
* Used as an immutable data-structure: must not be modified.
|
|
66
84
|
*/
|
|
67
|
-
private readonly nodes: BTree<NodeId,
|
|
85
|
+
private readonly nodes: BTree<NodeId, ForestNode>;
|
|
68
86
|
|
|
69
87
|
/**
|
|
70
88
|
* If true, consistency checks will be applied after forest operations.
|
|
@@ -87,7 +105,7 @@ export class Forest {
|
|
|
87
105
|
this.nodes = data.nodes;
|
|
88
106
|
this.expensiveValidation = data.expensiveValidation;
|
|
89
107
|
} else {
|
|
90
|
-
this.nodes = new BTree<NodeId,
|
|
108
|
+
this.nodes = new BTree<NodeId, ForestNode>(undefined, compareFiniteNumbers);
|
|
91
109
|
this.expensiveValidation = data ?? false;
|
|
92
110
|
}
|
|
93
111
|
if (this.expensiveValidation) {
|
|
@@ -110,14 +128,21 @@ export class Forest {
|
|
|
110
128
|
}
|
|
111
129
|
|
|
112
130
|
/**
|
|
113
|
-
* Adds the supplied nodes to the forest. The IDs must be unique in the forest.
|
|
131
|
+
* Adds the supplied nodes to the forest. The nodes' IDs must be unique in the forest.
|
|
114
132
|
* @param nodes - the sequence of nodes to add to the forest. If any of them have children which exist in the forest already, those
|
|
115
|
-
* children will be parented. Any trait arrays present in a node must be non-empty.
|
|
133
|
+
* children will be parented. Any trait arrays present in a node must be non-empty. The nodes may be provided in any order.
|
|
116
134
|
*/
|
|
117
135
|
public add(nodes: Iterable<ForestNode>): Forest {
|
|
118
136
|
const newNodes = [...nodes];
|
|
119
|
-
const childToParent = new Map<NodeId, ParentData>();
|
|
120
137
|
const mutableNodes = this.nodes.clone();
|
|
138
|
+
|
|
139
|
+
// This method iterates through the supplied nodes in two passes, first looking only at children and second actually adding the
|
|
140
|
+
// nodes. This allows nodes to be passed in any order, e.g. a parent followed by a child or a child followed by a parent.
|
|
141
|
+
|
|
142
|
+
const childToParent = new Map<NodeId, ParentData>(); // Temporarily records the parentage of children that don't exist yet
|
|
143
|
+
|
|
144
|
+
// First, inspect the children of each node. If the child is already in the forest, update its parentage. If it is not in the
|
|
145
|
+
// forest, it may be about to be added in the second loop below so record its parentage temporarily for when that happens.
|
|
121
146
|
for (const node of newNodes) {
|
|
122
147
|
const { identifier } = node;
|
|
123
148
|
for (const [traitLabel, trait] of node.traits) {
|
|
@@ -125,8 +150,8 @@ export class Forest {
|
|
|
125
150
|
for (const childId of trait) {
|
|
126
151
|
const child = mutableNodes.get(childId);
|
|
127
152
|
if (child !== undefined) {
|
|
128
|
-
assert(child.parentId === undefined, 'can not give a child multiple parents');
|
|
129
153
|
// A child already exists in the forest, and its parent is now being added
|
|
154
|
+
assert(!isParentedForestNode(child), 'can not give a child multiple parents');
|
|
130
155
|
const parentedChild = {
|
|
131
156
|
definition: child.definition,
|
|
132
157
|
identifier: child.identifier,
|
|
@@ -135,19 +160,22 @@ export class Forest {
|
|
|
135
160
|
traitParent: traitLabel,
|
|
136
161
|
};
|
|
137
162
|
copyPropertyIfDefined(child, parentedChild, 'payload');
|
|
138
|
-
|
|
163
|
+
// Overwrite the existing child with its parented version
|
|
164
|
+
mutableNodes.set(childId, parentedChild);
|
|
139
165
|
} else {
|
|
166
|
+
// The child hasn't been added yet, so record its parentage to use when it is added below
|
|
140
167
|
childToParent.set(childId, { parentId: identifier, traitParent: traitLabel });
|
|
141
168
|
}
|
|
142
169
|
}
|
|
143
170
|
}
|
|
144
171
|
}
|
|
145
172
|
|
|
173
|
+
// Now add each node to the forest and apply any parentage information that was recorded above
|
|
146
174
|
for (const node of newNodes) {
|
|
147
175
|
const parentData = childToParent.get(node.identifier);
|
|
148
176
|
assert(!mutableNodes.has(node.identifier), 'can not add node with already existing id');
|
|
149
177
|
if (parentData !== undefined) {
|
|
150
|
-
//
|
|
178
|
+
// This is a child whom we haven't added yet, but whose parent we already added above. Supply the recorded parentage info.
|
|
151
179
|
const child = {
|
|
152
180
|
definition: node.definition,
|
|
153
181
|
identifier: node.identifier,
|
|
@@ -155,10 +183,10 @@ export class Forest {
|
|
|
155
183
|
...parentData,
|
|
156
184
|
};
|
|
157
185
|
copyPropertyIfDefined(node, child, 'payload');
|
|
158
|
-
mutableNodes.set(node.identifier, child
|
|
186
|
+
mutableNodes.set(node.identifier, child);
|
|
159
187
|
} else {
|
|
160
|
-
//
|
|
161
|
-
mutableNodes.set(node.identifier, node
|
|
188
|
+
// This is a node that has no parent. Add it with no parentage information.
|
|
189
|
+
mutableNodes.set(node.identifier, node);
|
|
162
190
|
}
|
|
163
191
|
}
|
|
164
192
|
|
|
@@ -200,8 +228,8 @@ export class Forest {
|
|
|
200
228
|
|
|
201
229
|
for (const childId of childIds) {
|
|
202
230
|
mutableNodes.editRange(childId, childId, true, (_, n) => {
|
|
203
|
-
assert(n
|
|
204
|
-
const breakVal: { value:
|
|
231
|
+
assert(!isParentedForestNode(n), 'can not attach node that already has a parent');
|
|
232
|
+
const breakVal: { value: ParentedForestNode } = {
|
|
205
233
|
value: {
|
|
206
234
|
...n,
|
|
207
235
|
parentId,
|
|
@@ -255,13 +283,14 @@ export class Forest {
|
|
|
255
283
|
mutableNodes.set(parentId, { ...parentNode, traits });
|
|
256
284
|
for (const childId of detached) {
|
|
257
285
|
mutableNodes.editRange(childId, childId, true, (_, n) => {
|
|
258
|
-
const breakVal: { value:
|
|
286
|
+
const breakVal: { value: ForestNode } = {
|
|
259
287
|
value: {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
288
|
+
definition: n.definition,
|
|
289
|
+
identifier: n.identifier,
|
|
290
|
+
traits: n.traits,
|
|
263
291
|
},
|
|
264
292
|
};
|
|
293
|
+
copyPropertyIfDefined(n, breakVal.value, 'payload');
|
|
265
294
|
return breakVal;
|
|
266
295
|
});
|
|
267
296
|
}
|
|
@@ -280,6 +309,7 @@ export class Forest {
|
|
|
280
309
|
* @param nodeId - the id of the node
|
|
281
310
|
* @param value - the new value
|
|
282
311
|
*/
|
|
312
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
283
313
|
public setValue(nodeId: NodeId, value: Payload | null): Forest {
|
|
284
314
|
const node = this.nodes.get(nodeId);
|
|
285
315
|
assert(node, 'can not replace payload for node that does not exist');
|
|
@@ -290,13 +320,20 @@ export class Forest {
|
|
|
290
320
|
} else {
|
|
291
321
|
delete newNode.payload;
|
|
292
322
|
}
|
|
293
|
-
mutableNodes.set(nodeId, newNode
|
|
323
|
+
mutableNodes.set(nodeId, newNode);
|
|
294
324
|
return new Forest({
|
|
295
325
|
nodes: mutableNodes,
|
|
296
326
|
expensiveValidation: this.expensiveValidation,
|
|
297
327
|
});
|
|
298
328
|
}
|
|
299
329
|
|
|
330
|
+
/**
|
|
331
|
+
* @returns true if the node associated with `id` exists in this forest, otherwise false
|
|
332
|
+
*/
|
|
333
|
+
public has(id: NodeId): boolean {
|
|
334
|
+
return this.nodes.has(id);
|
|
335
|
+
}
|
|
336
|
+
|
|
300
337
|
/**
|
|
301
338
|
* @returns the node associated with `id`. Should not be used if there is no node with the provided id.
|
|
302
339
|
*/
|
|
@@ -328,24 +365,21 @@ export class Forest {
|
|
|
328
365
|
});
|
|
329
366
|
}
|
|
330
367
|
|
|
331
|
-
private deleteRecursive(
|
|
332
|
-
mutableNodes: BTree<NodeId, ForestNodeWithParentage>,
|
|
333
|
-
id: NodeId,
|
|
334
|
-
deleteChildren: boolean
|
|
335
|
-
): void {
|
|
368
|
+
private deleteRecursive(mutableNodes: BTree<NodeId, ForestNode>, id: NodeId, deleteChildren: boolean): void {
|
|
336
369
|
const node = mutableNodes.get(id) ?? fail('node to delete must exist');
|
|
337
|
-
assert(node
|
|
370
|
+
assert(!isParentedForestNode(node), 'deleted nodes must be unparented');
|
|
338
371
|
mutableNodes.delete(id);
|
|
339
372
|
for (const trait of node.traits.values()) {
|
|
340
373
|
for (const childId of trait) {
|
|
341
374
|
mutableNodes.editRange(childId, childId, true, (_, n) => {
|
|
342
|
-
const breakVal: { value:
|
|
375
|
+
const breakVal: { value: ForestNode } = {
|
|
343
376
|
value: {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
377
|
+
definition: n.definition,
|
|
378
|
+
identifier: n.identifier,
|
|
379
|
+
traits: n.traits,
|
|
347
380
|
},
|
|
348
381
|
};
|
|
382
|
+
copyPropertyIfDefined(n, breakVal.value, 'payload');
|
|
349
383
|
return breakVal;
|
|
350
384
|
});
|
|
351
385
|
|
|
@@ -363,12 +397,7 @@ export class Forest {
|
|
|
363
397
|
public assertConsistent(): void {
|
|
364
398
|
const checkedChildren = new Set<NodeId>([]);
|
|
365
399
|
for (const [nodeId, node] of this.nodes.entries(undefined, [])) {
|
|
366
|
-
|
|
367
|
-
(node.parentId === undefined) === (node.traitParent === undefined),
|
|
368
|
-
'node must have either both parent and traitParent set or neither'
|
|
369
|
-
);
|
|
370
|
-
|
|
371
|
-
if (node.parentId !== undefined && node.traitParent !== undefined) {
|
|
400
|
+
if (isParentedForestNode(node)) {
|
|
372
401
|
const parent = this.get(node.parentId);
|
|
373
402
|
const trait = parent.traits.get(node.traitParent);
|
|
374
403
|
assert(trait !== undefined);
|
|
@@ -380,6 +409,7 @@ export class Forest {
|
|
|
380
409
|
for (const childId of trait) {
|
|
381
410
|
const child = this.nodes.get(childId);
|
|
382
411
|
assert(child, 'child in trait is not in forest');
|
|
412
|
+
assert(isParentedForestNode(child), 'child is not parented');
|
|
383
413
|
assert(child.parentId === node.identifier, 'child parent pointer is incorrect');
|
|
384
414
|
assert(
|
|
385
415
|
!checkedChildren.has(childId),
|
|
@@ -404,10 +434,8 @@ export class Forest {
|
|
|
404
434
|
fail('NodeId not found');
|
|
405
435
|
}
|
|
406
436
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
traitParent: child.traitParent ?? fail('Node is not parented'),
|
|
410
|
-
};
|
|
437
|
+
assert(isParentedForestNode(child), 'Node is not parented');
|
|
438
|
+
return { parentId: child.parentId, traitParent: child.traitParent };
|
|
411
439
|
}
|
|
412
440
|
|
|
413
441
|
/**
|
|
@@ -415,11 +443,7 @@ export class Forest {
|
|
|
415
443
|
*/
|
|
416
444
|
public tryGetParent(id: NodeId): ParentData | undefined {
|
|
417
445
|
const child = this.nodes.get(id);
|
|
418
|
-
if (child === undefined) {
|
|
419
|
-
return undefined;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (child.parentId === undefined || child.traitParent === undefined) {
|
|
446
|
+
if (child === undefined || !isParentedForestNode(child)) {
|
|
423
447
|
return undefined;
|
|
424
448
|
}
|
|
425
449
|
|
|
@@ -429,10 +453,6 @@ export class Forest {
|
|
|
429
453
|
};
|
|
430
454
|
}
|
|
431
455
|
|
|
432
|
-
private static breakOnDifference(): { break: boolean } {
|
|
433
|
-
return { break: true };
|
|
434
|
-
}
|
|
435
|
-
|
|
436
456
|
/**
|
|
437
457
|
* Compares two forests for equality.
|
|
438
458
|
* @param forest - the other forest to compare to this one
|
|
@@ -448,19 +468,7 @@ export class Forest {
|
|
|
448
468
|
return false;
|
|
449
469
|
}
|
|
450
470
|
|
|
451
|
-
|
|
452
|
-
forest.nodes,
|
|
453
|
-
Forest.breakOnDifference,
|
|
454
|
-
Forest.breakOnDifference,
|
|
455
|
-
(_, nodeThis, nodeOther) => {
|
|
456
|
-
if (!compareForestNodes(nodeThis, nodeOther)) {
|
|
457
|
-
return { break: true };
|
|
458
|
-
}
|
|
459
|
-
return undefined;
|
|
460
|
-
}
|
|
461
|
-
);
|
|
462
|
-
|
|
463
|
-
return diff === undefined;
|
|
471
|
+
return compareBtrees(this.nodes, forest.nodes, compareForestNodes);
|
|
464
472
|
}
|
|
465
473
|
|
|
466
474
|
/**
|
|
@@ -496,7 +504,7 @@ export class Forest {
|
|
|
496
504
|
}
|
|
497
505
|
|
|
498
506
|
/**
|
|
499
|
-
* @returns true iff two `
|
|
507
|
+
* @returns true iff two `ForestNodes` are equivalent.
|
|
500
508
|
* May return false for nodes they contain equivalent payloads encoded differently.
|
|
501
509
|
*/
|
|
502
510
|
export function compareForestNodes(nodeA: ForestNode, nodeB: ForestNode): boolean {
|
|
@@ -3,49 +3,72 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { DetachedSequenceId, NodeId } from '
|
|
7
|
-
import { assert, fail } from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { DetachedSequenceId, isDetachedSequenceId, NodeId } from './Identifiers';
|
|
7
|
+
import { assert, fail } from './Common';
|
|
8
|
+
import { rangeFromStableRange } from './TreeViewUtilities';
|
|
9
|
+
import {
|
|
10
|
+
ChangeInternal,
|
|
11
|
+
ChangeTypeInternal,
|
|
12
|
+
DetachInternal,
|
|
13
|
+
SetValueInternal,
|
|
14
|
+
InsertInternal,
|
|
15
|
+
BuildNodeInternal,
|
|
16
|
+
Side,
|
|
17
|
+
StableRangeInternal,
|
|
18
|
+
} from './persisted-types';
|
|
19
|
+
import { TransactionInternal } from './TransactionInternal';
|
|
20
|
+
import { RangeValidationResultKind, validateStableRange } from './EditUtilities';
|
|
21
|
+
import { StablePlace } from './ChangeTypes';
|
|
22
|
+
import { RevisionView } from './RevisionView';
|
|
23
|
+
import { TreeView } from './TreeView';
|
|
24
|
+
import { getChangeNodeFromViewNode } from './SerializationUtilities';
|
|
13
25
|
|
|
14
26
|
/**
|
|
15
27
|
* Given a sequence of changes, produces an inverse sequence of changes, i.e. the minimal changes required to revert the given changes
|
|
16
28
|
* @param changes - the changes for which to produce an inverse.
|
|
17
|
-
* @param before - a
|
|
18
|
-
* @returns a sequence of changes _r_ that will produce `before` if applied to a
|
|
19
|
-
* applying `changes` to `before`. Applying _r_ to
|
|
20
|
-
* not be a true semantic inverse.
|
|
29
|
+
* @param before - a view of the tree state before `changes` are/were applied - used as a basis for generating the inverse.
|
|
30
|
+
* @returns if the changes could be reverted, a sequence of changes _r_ that will produce `before` if applied to a view _A_, where _A_ is the result of
|
|
31
|
+
* applying `changes` to `before`. Applying _r_ to views other than _A_ is legal but may cause the changes to fail to apply or may
|
|
32
|
+
* not be a true semantic inverse. If the changes could not be reverted given the state of `before`, returns undefined.
|
|
21
33
|
*
|
|
22
34
|
* TODO: what should this do if `changes` fails to apply to `before`?
|
|
23
|
-
*
|
|
35
|
+
* TODO:#68574: Pass a view that corresponds to the appropriate Fluid reference sequence number rather than the view just before
|
|
36
|
+
* @internal
|
|
24
37
|
*/
|
|
25
|
-
export function revert(changes: readonly
|
|
26
|
-
const result:
|
|
38
|
+
export function revert(changes: readonly ChangeInternal[], before: RevisionView): ChangeInternal[] | undefined {
|
|
39
|
+
const result: ChangeInternal[] = [];
|
|
27
40
|
|
|
28
41
|
const builtNodes = new Map<DetachedSequenceId, NodeId[]>();
|
|
29
42
|
const detachedNodes = new Map<DetachedSequenceId, NodeId[]>();
|
|
30
43
|
|
|
31
44
|
// Open edit on revision to update it as changes are walked through
|
|
32
|
-
const editor =
|
|
45
|
+
const editor = TransactionInternal.factory(before);
|
|
33
46
|
// Apply `edit`, generating an inverse as we go.
|
|
34
47
|
for (const change of changes) {
|
|
35
48
|
// Generate an inverse of each change
|
|
36
49
|
switch (change.type) {
|
|
37
|
-
case
|
|
50
|
+
case ChangeTypeInternal.Build: {
|
|
38
51
|
// Save nodes added to the detached state for use in future changes
|
|
39
52
|
const { destination, source } = change;
|
|
40
53
|
assert(!builtNodes.has(destination), `Cannot revert Build: destination is already used by a Build`);
|
|
41
54
|
assert(!detachedNodes.has(destination), `Cannot revert Build: destination is already used by a Detach`);
|
|
42
55
|
builtNodes.set(
|
|
43
56
|
destination,
|
|
44
|
-
source.
|
|
57
|
+
source.reduce((ids: NodeId[], curr: BuildNodeInternal) => {
|
|
58
|
+
if (isDetachedSequenceId(curr)) {
|
|
59
|
+
const nodesForDetachedSequence =
|
|
60
|
+
builtNodes.get(curr) ?? fail('detached sequence must have associated built nodes');
|
|
61
|
+
|
|
62
|
+
ids.push(...nodesForDetachedSequence);
|
|
63
|
+
} else {
|
|
64
|
+
ids.push(curr.identifier);
|
|
65
|
+
}
|
|
66
|
+
return ids;
|
|
67
|
+
}, [])
|
|
45
68
|
);
|
|
46
69
|
break;
|
|
47
70
|
}
|
|
48
|
-
case
|
|
71
|
+
case ChangeTypeInternal.Insert: {
|
|
49
72
|
const { source } = change;
|
|
50
73
|
const nodesBuilt = builtNodes.get(source);
|
|
51
74
|
const nodesDetached = detachedNodes.get(source);
|
|
@@ -57,37 +80,46 @@ export function revert(changes: readonly Change[], before: Snapshot): Change[] {
|
|
|
57
80
|
result.unshift(createInvertedInsert(change, nodesDetached, true));
|
|
58
81
|
detachedNodes.delete(source);
|
|
59
82
|
} else {
|
|
60
|
-
|
|
83
|
+
// Cannot revert an insert whose source is no longer available for inserting (i.e. not just built, and not detached)
|
|
84
|
+
return undefined;
|
|
61
85
|
}
|
|
62
86
|
|
|
63
87
|
break;
|
|
64
88
|
}
|
|
65
|
-
case
|
|
89
|
+
case ChangeTypeInternal.Detach: {
|
|
66
90
|
const { destination } = change;
|
|
67
|
-
const
|
|
91
|
+
const invert = createInvertedDetach(change, editor.view);
|
|
92
|
+
if (invert === undefined) {
|
|
93
|
+
// Cannot revert a detach whose source does not exist in the tree
|
|
94
|
+
// TODO:68574: May not be possible once associated todo in `createInvertedDetach` is addressed
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const { invertedDetach, detachedNodeIds } = invert;
|
|
68
98
|
|
|
69
99
|
if (destination !== undefined) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
assert(
|
|
75
|
-
!detachedNodes.has(destination),
|
|
76
|
-
`Cannot revert Detach: destination is already used by a Detach`
|
|
77
|
-
);
|
|
100
|
+
if (builtNodes.has(destination) || detachedNodes.has(destination)) {
|
|
101
|
+
// Malformed: destination was already used by a prior build or detach
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
78
104
|
detachedNodes.set(destination, detachedNodeIds);
|
|
79
105
|
}
|
|
80
106
|
|
|
81
107
|
result.unshift(...invertedDetach);
|
|
82
108
|
break;
|
|
83
109
|
}
|
|
84
|
-
case
|
|
85
|
-
|
|
110
|
+
case ChangeTypeInternal.SetValue: {
|
|
111
|
+
const invert = createInvertedSetValue(change, editor.view);
|
|
112
|
+
if (invert === undefined) {
|
|
113
|
+
// Cannot revert a set for a node that does not exist in the tree
|
|
114
|
+
// TODO:68574: May not be possible once associated todo in `createInvertedSetValue` is addressed
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
result.unshift(...invert);
|
|
86
118
|
break;
|
|
87
|
-
|
|
119
|
+
}
|
|
120
|
+
case ChangeTypeInternal.Constraint:
|
|
88
121
|
// TODO:#46759: Support Constraint in reverts
|
|
89
122
|
fail('Revert currently does not support Constraints');
|
|
90
|
-
break;
|
|
91
123
|
default:
|
|
92
124
|
fail('Revert does not support the change type.');
|
|
93
125
|
}
|
|
@@ -101,13 +133,17 @@ export function revert(changes: readonly Change[], before: Snapshot): Change[] {
|
|
|
101
133
|
}
|
|
102
134
|
|
|
103
135
|
/**
|
|
104
|
-
*
|
|
136
|
+
* The inverse of an Insert is a Detach that starts before the leftmost node inserted and ends after the rightmost.
|
|
105
137
|
*/
|
|
106
|
-
function createInvertedInsert(
|
|
138
|
+
function createInvertedInsert(
|
|
139
|
+
insert: InsertInternal,
|
|
140
|
+
nodesInserted: readonly NodeId[],
|
|
141
|
+
saveDetached = false
|
|
142
|
+
): ChangeInternal {
|
|
107
143
|
const leftmostNode = nodesInserted[0];
|
|
108
144
|
const rightmostNode = nodesInserted[nodesInserted.length - 1];
|
|
109
145
|
|
|
110
|
-
const source:
|
|
146
|
+
const source: StableRangeInternal = {
|
|
111
147
|
start: {
|
|
112
148
|
referenceSibling: leftmostNode,
|
|
113
149
|
side: Side.Before,
|
|
@@ -118,7 +154,7 @@ function createInvertedInsert(insert: Insert, nodesInserted: readonly NodeId[],
|
|
|
118
154
|
},
|
|
119
155
|
};
|
|
120
156
|
|
|
121
|
-
return
|
|
157
|
+
return ChangeInternal.detach(source, saveDetached ? insert.source : undefined);
|
|
122
158
|
}
|
|
123
159
|
|
|
124
160
|
/**
|
|
@@ -150,17 +186,21 @@ function createInvertedInsert(insert: Insert, nodesInserted: readonly NodeId[],
|
|
|
150
186
|
* anchor to the left of the originally detached nodes is chosen.
|
|
151
187
|
*/
|
|
152
188
|
function createInvertedDetach(
|
|
153
|
-
detach:
|
|
154
|
-
|
|
155
|
-
): { invertedDetach:
|
|
156
|
-
const
|
|
189
|
+
detach: DetachInternal,
|
|
190
|
+
viewBeforeChange: TreeView
|
|
191
|
+
): { invertedDetach: ChangeInternal[]; detachedNodeIds: NodeId[] } | undefined {
|
|
192
|
+
const validatedSource = validateStableRange(viewBeforeChange, detach.source);
|
|
193
|
+
if (validatedSource.result !== RangeValidationResultKind.Valid) {
|
|
194
|
+
// TODO:#68574: having the reference view would potentially allow us to revert some detaches that currently conflict
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
157
197
|
|
|
158
|
-
const { start, end } = rangeFromStableRange(
|
|
198
|
+
const { start, end } = rangeFromStableRange(viewBeforeChange, validatedSource);
|
|
159
199
|
const { trait: referenceTrait } = start;
|
|
160
|
-
const nodes =
|
|
200
|
+
const nodes = viewBeforeChange.getTrait(referenceTrait);
|
|
161
201
|
|
|
162
|
-
const startIndex =
|
|
163
|
-
const endIndex =
|
|
202
|
+
const startIndex = viewBeforeChange.findIndexWithinTrait(start);
|
|
203
|
+
const endIndex = viewBeforeChange.findIndexWithinTrait(end);
|
|
164
204
|
const detachedNodeIds: NodeId[] = nodes.slice(startIndex, endIndex);
|
|
165
205
|
|
|
166
206
|
const leftOfDetached = nodes.slice(0, startIndex);
|
|
@@ -188,7 +228,7 @@ function createInvertedDetach(
|
|
|
188
228
|
|
|
189
229
|
if (detach.destination !== undefined) {
|
|
190
230
|
return {
|
|
191
|
-
invertedDetach: [
|
|
231
|
+
invertedDetach: [ChangeInternal.insert(detach.destination, insertDestination)],
|
|
192
232
|
detachedNodeIds,
|
|
193
233
|
};
|
|
194
234
|
}
|
|
@@ -196,20 +236,30 @@ function createInvertedDetach(
|
|
|
196
236
|
const detachedSequenceId = 0 as DetachedSequenceId;
|
|
197
237
|
return {
|
|
198
238
|
invertedDetach: [
|
|
199
|
-
|
|
200
|
-
|
|
239
|
+
ChangeInternal.build(
|
|
240
|
+
detachedNodeIds.map((id) => getChangeNodeFromViewNode(viewBeforeChange, id)),
|
|
241
|
+
detachedSequenceId
|
|
242
|
+
),
|
|
243
|
+
ChangeInternal.insert(detachedSequenceId, insertDestination),
|
|
201
244
|
],
|
|
202
245
|
detachedNodeIds,
|
|
203
246
|
};
|
|
204
247
|
}
|
|
205
248
|
|
|
206
|
-
|
|
249
|
+
/**
|
|
250
|
+
* The inverse of a SetValue is a SetValue that sets the value to what it was prior to the change.
|
|
251
|
+
*/
|
|
252
|
+
function createInvertedSetValue(setValue: SetValueInternal, viewBeforeChange: TreeView): ChangeInternal[] | undefined {
|
|
207
253
|
const { nodeToModify } = setValue;
|
|
208
|
-
const
|
|
254
|
+
const node = viewBeforeChange.tryGetViewNode(nodeToModify);
|
|
255
|
+
if (node === undefined) {
|
|
256
|
+
// TODO:68574: With a reference view, may be able to better resolve conflicting sets
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
209
259
|
|
|
210
260
|
// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface)
|
|
211
|
-
if (
|
|
212
|
-
return [
|
|
261
|
+
if (node.payload !== null) {
|
|
262
|
+
return [ChangeInternal.setPayload(nodeToModify, node.payload)];
|
|
213
263
|
}
|
|
214
|
-
return [
|
|
264
|
+
return [ChangeInternal.clearPayload(nodeToModify)];
|
|
215
265
|
}
|