@fluid-experimental/tree 0.58.2002 → 0.59.1000
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 +52 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +72 -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 +52 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +68 -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 +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 +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 +89 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../src/TreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,UAAU,E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A2F;IACpF,gBAAgB,IAAI,IAAI;IAIxB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAI1D,6DAA6D;aAC7C,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAE/C;;;OAGG;IACI,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAQ,GAAG,OAAO;IAS9D,OAAO,CAAE,sBAAsB;IAW/B,OAAO,CAAC,cAAc;IAItB;;;;;OAKG;IACI,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;CAI3C"}
|
package/dist/TreeView.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TreeView = void 0;
|
|
8
|
+
const Common_1 = require("./Common");
|
|
9
|
+
const Forest_1 = require("./Forest");
|
|
10
|
+
const persisted_types_1 = require("./persisted-types");
|
|
11
|
+
/**
|
|
12
|
+
* A view of a distributed tree.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
class TreeView {
|
|
16
|
+
constructor(root, forest) {
|
|
17
|
+
this.root = root;
|
|
18
|
+
this.forest = forest;
|
|
19
|
+
this.rootNode = this.getViewNode(root);
|
|
20
|
+
}
|
|
21
|
+
/** @returns the number of nodes in this view */
|
|
22
|
+
get size() {
|
|
23
|
+
return this.forest.size;
|
|
24
|
+
}
|
|
25
|
+
/** @returns true iff a node with the given id exists in this view */
|
|
26
|
+
hasNode(id) {
|
|
27
|
+
return this.forest.has(id);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @returns the index just after place (which specifies a location between items).
|
|
31
|
+
* Performance note: this is O(siblings in trait).
|
|
32
|
+
*/
|
|
33
|
+
findIndexWithinTrait(place) {
|
|
34
|
+
if (place.sibling === undefined) {
|
|
35
|
+
return this.getIndexOfSide(place.side, place.trait);
|
|
36
|
+
}
|
|
37
|
+
return getIndex(place.side, this.getIndexInTrait(place.sibling));
|
|
38
|
+
}
|
|
39
|
+
/** @returns the node associated with the given id in this view. Fails if the node does not exist in this view. */
|
|
40
|
+
getViewNode(id) {
|
|
41
|
+
var _a;
|
|
42
|
+
return (_a = this.tryGetViewNode(id)) !== null && _a !== void 0 ? _a : Common_1.fail('NodeId not found');
|
|
43
|
+
}
|
|
44
|
+
/** @returns the node associated with the given id in this view, or undefined if the node does not exist in this view */
|
|
45
|
+
tryGetViewNode(id) {
|
|
46
|
+
const forestNode = this.forest.tryGet(id);
|
|
47
|
+
if (forestNode !== undefined && Forest_1.isParentedForestNode(forestNode)) {
|
|
48
|
+
const viewNode = {
|
|
49
|
+
definition: forestNode.definition,
|
|
50
|
+
identifier: forestNode.identifier,
|
|
51
|
+
traits: forestNode.traits,
|
|
52
|
+
parentage: {
|
|
53
|
+
label: forestNode.traitParent,
|
|
54
|
+
parent: forestNode.parentId,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
Common_1.copyPropertyIfDefined(forestNode, viewNode, 'payload');
|
|
58
|
+
return viewNode;
|
|
59
|
+
}
|
|
60
|
+
return forestNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @returns the label of the trait under which a node with the given id resides. Fails if the node does not exist in this view or if
|
|
64
|
+
* it is the root node.
|
|
65
|
+
*/
|
|
66
|
+
getTraitLabel(id) {
|
|
67
|
+
return this.forest.getParent(id).traitParent;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @returns the label of the trait under which a node with the given id resides, or undefined if the node is not present in this
|
|
71
|
+
* view or if it is the root node
|
|
72
|
+
*/
|
|
73
|
+
tryGetTraitLabel(id) {
|
|
74
|
+
var _a;
|
|
75
|
+
return (_a = this.forest.tryGetParent(id)) === null || _a === void 0 ? void 0 : _a.traitParent;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @returns the parent of the node with the given id. Fails if the node does not exist in this view or if it is the root node.
|
|
79
|
+
*/
|
|
80
|
+
getParentViewNode(id) {
|
|
81
|
+
const parentInfo = this.forest.getParent(id);
|
|
82
|
+
return this.getViewNode(parentInfo.parentId);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @returns the parent of the node with the given id. Returns undefined if the node does not exist in this view or if it is the root
|
|
86
|
+
* node.
|
|
87
|
+
*/
|
|
88
|
+
tryGetParentViewNode(id) {
|
|
89
|
+
const parentInfo = this.forest.tryGetParent(id);
|
|
90
|
+
if (parentInfo === undefined) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
return this.getViewNode(parentInfo.parentId);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @returns the trait location of the node with the given id. Fails if the node does not exist in this view or of it is the root
|
|
97
|
+
* node
|
|
98
|
+
*/
|
|
99
|
+
getTraitLocation(id) {
|
|
100
|
+
const parentData = this.forest.getParent(id);
|
|
101
|
+
return {
|
|
102
|
+
parent: parentData.parentId,
|
|
103
|
+
label: parentData.traitParent,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @returns the trait location of the node with the given id, or undefined if the node does not exist in this view or if it is the root
|
|
108
|
+
* node
|
|
109
|
+
*/
|
|
110
|
+
tryGetTraitLocation(id) {
|
|
111
|
+
const parentData = this.forest.tryGetParent(id);
|
|
112
|
+
if (parentData === undefined) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
parent: parentData.parentId,
|
|
117
|
+
label: parentData.traitParent,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* @returns the index within the trait under which the node with the given id resides. The node must exist in this view and must have a
|
|
122
|
+
* parent.
|
|
123
|
+
* Performance note: this is O(siblings in trait).
|
|
124
|
+
*/
|
|
125
|
+
getIndexInTrait(id) {
|
|
126
|
+
const index = this.tryGetIndexInTrait(id);
|
|
127
|
+
return index !== null && index !== void 0 ? index : Common_1.fail('ID does not exist in the forest.');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @returns the index within the trait under which the node with the given id resides, or undefined if the node does not exist in this
|
|
131
|
+
* view or does not have a parent.
|
|
132
|
+
* Performance note: this is O(siblings in trait).
|
|
133
|
+
*/
|
|
134
|
+
tryGetIndexInTrait(id) {
|
|
135
|
+
var _a, _b, _c;
|
|
136
|
+
const cachedIndex = (_a = this.traitIndicesCache) === null || _a === void 0 ? void 0 : _a.get(id);
|
|
137
|
+
if (cachedIndex !== undefined) {
|
|
138
|
+
return cachedIndex;
|
|
139
|
+
}
|
|
140
|
+
const parentData = this.forest.tryGetParent(id);
|
|
141
|
+
if (parentData === undefined) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const parent = this.forest.tryGet(parentData.parentId);
|
|
145
|
+
if (parent === undefined) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
const trait = (_b = parent.traits.get(parentData.traitParent)) !== null && _b !== void 0 ? _b : Common_1.fail('inconsistent forest: trait parent not found');
|
|
149
|
+
let foundIndex;
|
|
150
|
+
if (trait.length === 0) {
|
|
151
|
+
return foundIndex;
|
|
152
|
+
}
|
|
153
|
+
(_c = this.traitIndicesCache) !== null && _c !== void 0 ? _c : (this.traitIndicesCache = new Map());
|
|
154
|
+
for (let i = 0; i < trait.length; i++) {
|
|
155
|
+
const nodeInTrait = trait[i];
|
|
156
|
+
const index = i;
|
|
157
|
+
this.traitIndicesCache.set(nodeInTrait, index);
|
|
158
|
+
if (nodeInTrait === id) {
|
|
159
|
+
foundIndex = index;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return foundIndex;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @returns the trait at the given location. If no such trait exists, returns an empty trait.
|
|
166
|
+
*/
|
|
167
|
+
getTrait(traitLocation) {
|
|
168
|
+
var _a;
|
|
169
|
+
return (_a = this.getViewNode(traitLocation.parent).traits.get(traitLocation.label)) !== null && _a !== void 0 ? _a : [];
|
|
170
|
+
}
|
|
171
|
+
/** Asserts that the view's internal state is consistent. Useful for testing/validation. */
|
|
172
|
+
assertConsistent() {
|
|
173
|
+
this.forest.assertConsistent();
|
|
174
|
+
}
|
|
175
|
+
[Symbol.iterator]() {
|
|
176
|
+
return this.iterateNodeDescendants(this.rootNode);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @returns true iff the given view's forest of nodes is equivalent to this view's forest of nodes
|
|
180
|
+
* @param strict - if true, the views' forests must be the same object, otherwise they must merely be equivalent
|
|
181
|
+
*/
|
|
182
|
+
hasEqualForest(view, strict = false) {
|
|
183
|
+
if (this.root === view.root) {
|
|
184
|
+
// TODO:#49100:Perf: make this faster and/or remove use by PrefetchingCheckout.
|
|
185
|
+
return strict ? this.forest === view.forest : this.forest.equals(view.forest);
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
*iterateNodeDescendants(node) {
|
|
190
|
+
yield node;
|
|
191
|
+
for (const label of [...node.traits.keys()].sort()) {
|
|
192
|
+
const trait = node.traits.get(label);
|
|
193
|
+
for (const childId of trait !== null && trait !== void 0 ? trait : Common_1.fail('Expected trait with label')) {
|
|
194
|
+
const child = this.getViewNode(childId);
|
|
195
|
+
yield* this.iterateNodeDescendants(child);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
getIndexOfSide(side, traitLocation) {
|
|
200
|
+
return side === persisted_types_1.Side.After ? 0 : this.getTrait(traitLocation).length;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Calculate the difference between two `TreeView`s
|
|
204
|
+
* @param view - the other view to compare to this one
|
|
205
|
+
* @returns A {@link Delta} which nodes must be changed, added, and removed to get from `this` to `view`.
|
|
206
|
+
* The views must share a root.
|
|
207
|
+
*/
|
|
208
|
+
delta(view) {
|
|
209
|
+
Common_1.assert(this.root === view.root, 'Delta can only be calculated between views that share a root');
|
|
210
|
+
return this.forest.delta(view.forest);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.TreeView = TreeView;
|
|
214
|
+
function getIndex(side, index) {
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
216
|
+
return (side + index);
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=TreeView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeView.js","sourceRoot":"","sources":["../src/TreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAA+D;AAE/D,qCAA+D;AAC/D,uDAAmD;AAsEnD;;;GAGG;AACH,MAAsB,QAAQ;IAY7B,YAAsB,IAAY,EAAE,MAAc;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,gDAAgD;IAChD,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,qEAAqE;IAC9D,OAAO,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,KAAoB;QAC/C,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SACpD;QACD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,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CAAC;QAChG,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACD;AA1OD,4BA0OC;AAED,SAAS,QAAQ,CAAC,IAAU,EAAE,KAAqB;IAClD,qEAAqE;IACrE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAe,CAAC;AACrC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, copyPropertyIfDefined, fail } from './Common';\nimport { NodeId, TraitLabel } from './Identifiers';\nimport { Delta, Forest, isParentedForestNode } from './Forest';\nimport { NodeData, Side } from './persisted-types';\n\n/**\n * Specifies the location of a trait (a labeled sequence of nodes) within the tree.\n * @public\n */\nexport interface TraitLocation {\n\treadonly parent: NodeId;\n\treadonly label: TraitLabel;\n}\n\n/**\n * An immutable view of a distributed tree node.\n * @public\n */\nexport interface TreeViewNode extends NodeData<NodeId> {\n\t/** The IDs of the children under this node */\n\treadonly traits: ReadonlyMap<TraitLabel, readonly NodeId[]>;\n\t/** The parent and trait under which this node resides. Undefined iff this is the root node of the tree (i.e. {@link initialTree}). */\n\treadonly parentage?: TraitLocation;\n}\n\n/**\n * Index of a place within a trait.\n * 0 = before all nodes,\n * 1 = after first node,\n * etc.\n * @public\n */\nexport type PlaceIndex = number & { readonly PlaceIndex: unique symbol };\n\n/**\n * Index of a node within a trait.\n * 0 = first node,\n * 1 = second node,\n * etc.\n * @public\n */\nexport type TraitNodeIndex = number & { readonly TraitNodeIndex: unique symbol };\n\n/**\n * A place within a particular `TreeView` that is anchored relative to a specific node in the tree, or relative to the outside of the trait.\n * Valid iff 'trait' is valid and, if provided, sibling is in the Location specified by 'trait'.\n * @public\n */\nexport interface TreeViewPlace {\n\treadonly sibling?: NodeId;\n\treadonly side: Side;\n\treadonly trait: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait within a particular `TreeView`.\n * Valid iff start and end are valid and are within the same trait.\n * @public\n */\nexport interface TreeViewRange {\n\treadonly start: TreeViewPlace;\n\treadonly end: TreeViewPlace;\n}\n\n/**\n * Contains some redundant information. Use only in computations between edits. Do not store.\n * @public\n */\nexport interface NodeInTrait {\n\treadonly trait: TraitLocation;\n\treadonly index: TraitNodeIndex;\n}\n\n/**\n * A view of a distributed tree.\n * @public\n */\nexport abstract class TreeView {\n\tpublic readonly root: NodeId;\n\tprotected readonly forest: Forest;\n\tprivate readonly rootNode: TreeViewNode;\n\n\t/**\n\t * A cache of node's index within their parent trait.\n\t * Used to avoid redundant linear scans of traits.\n\t * Not shared across views; initialized to empty each time a TreeView is created.\n\t */\n\tprivate traitIndicesCache?: Map<NodeId, TraitNodeIndex>;\n\n\tprotected constructor(root: NodeId, forest: Forest) {\n\t\tthis.root = root;\n\t\tthis.forest = forest;\n\t\tthis.rootNode = this.getViewNode(root);\n\t}\n\n\t/** @returns the number of nodes in this view */\n\tpublic get size(): number {\n\t\treturn this.forest.size;\n\t}\n\n\t/** @returns true iff a node with the given id exists in this view */\n\tpublic hasNode(id: NodeId): boolean {\n\t\treturn this.forest.has(id);\n\t}\n\n\t/**\n\t * @returns the index just after place (which specifies a location between items).\n\t * Performance note: this is O(siblings in trait).\n\t */\n\tpublic findIndexWithinTrait(place: TreeViewPlace): PlaceIndex {\n\t\tif (place.sibling === undefined) {\n\t\t\treturn this.getIndexOfSide(place.side, place.trait);\n\t\t}\n\t\treturn getIndex(place.side, this.getIndexInTrait(place.sibling));\n\t}\n\n\t/** @returns the node associated with the given id in this view. Fails if the node does not exist in this view. */\n\tpublic getViewNode(id: NodeId): TreeViewNode {\n\t\treturn this.tryGetViewNode(id) ?? fail('NodeId not found');\n\t}\n\n\t/** @returns the node associated with the given id in this view, or undefined if the node does not exist in this view */\n\tpublic tryGetViewNode(id: NodeId): TreeViewNode | undefined {\n\t\tconst forestNode = this.forest.tryGet(id);\n\t\tif (forestNode !== undefined && isParentedForestNode(forestNode)) {\n\t\t\tconst viewNode: TreeViewNode = {\n\t\t\t\tdefinition: forestNode.definition,\n\t\t\t\tidentifier: forestNode.identifier,\n\t\t\t\ttraits: forestNode.traits,\n\t\t\t\tparentage: {\n\t\t\t\t\tlabel: forestNode.traitParent,\n\t\t\t\t\tparent: forestNode.parentId,\n\t\t\t\t},\n\t\t\t};\n\t\t\tcopyPropertyIfDefined(forestNode, viewNode, 'payload');\n\t\t\treturn viewNode;\n\t\t}\n\n\t\treturn forestNode;\n\t}\n\n\t/**\n\t * @returns the label of the trait under which a node with the given id resides. Fails if the node does not exist in this view or if\n\t * it is the root node.\n\t */\n\tpublic getTraitLabel(id: NodeId): TraitLabel {\n\t\treturn this.forest.getParent(id).traitParent;\n\t}\n\n\t/**\n\t * @returns the label of the trait under which a node with the given id resides, or undefined if the node is not present in this\n\t * view or if it is the root node\n\t */\n\tpublic tryGetTraitLabel(id: NodeId): TraitLabel | undefined {\n\t\treturn this.forest.tryGetParent(id)?.traitParent;\n\t}\n\n\t/**\n\t * @returns the parent of the node with the given id. Fails if the node does not exist in this view or if it is the root node.\n\t */\n\tpublic getParentViewNode(id: NodeId): TreeViewNode {\n\t\tconst parentInfo = this.forest.getParent(id);\n\t\treturn this.getViewNode(parentInfo.parentId);\n\t}\n\n\t/**\n\t * @returns the parent of the node with the given id. Returns undefined if the node does not exist in this view or if it is the root\n\t * node.\n\t */\n\tpublic tryGetParentViewNode(id: NodeId): TreeViewNode | undefined {\n\t\tconst parentInfo = this.forest.tryGetParent(id);\n\t\tif (parentInfo === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.getViewNode(parentInfo.parentId);\n\t}\n\n\t/**\n\t * @returns the trait location of the node with the given id. Fails if the node does not exist in this view or of it is the root\n\t * node\n\t */\n\tpublic getTraitLocation(id: NodeId): TraitLocation {\n\t\tconst parentData = this.forest.getParent(id);\n\t\treturn {\n\t\t\tparent: parentData.parentId,\n\t\t\tlabel: parentData.traitParent,\n\t\t};\n\t}\n\n\t/**\n\t * @returns the trait location of the node with the given id, or undefined if the node does not exist in this view or if it is the root\n\t * node\n\t */\n\tpublic tryGetTraitLocation(id: NodeId): TraitLocation | undefined {\n\t\tconst parentData = this.forest.tryGetParent(id);\n\t\tif (parentData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\tparent: parentData.parentId,\n\t\t\tlabel: parentData.traitParent,\n\t\t};\n\t}\n\n\t/**\n\t * @returns the index within the trait under which the node with the given id resides. The node must exist in this view and must have a\n\t * parent.\n\t * Performance note: this is O(siblings in trait).\n\t */\n\tpublic getIndexInTrait(id: NodeId): TraitNodeIndex {\n\t\tconst index = this.tryGetIndexInTrait(id);\n\t\treturn index ?? fail('ID does not exist in the forest.');\n\t}\n\n\t/**\n\t * @returns the index within the trait under which the node with the given id resides, or undefined if the node does not exist in this\n\t * view or does not have a parent.\n\t * Performance note: this is O(siblings in trait).\n\t */\n\tpublic tryGetIndexInTrait(id: NodeId): TraitNodeIndex | undefined {\n\t\tconst cachedIndex = this.traitIndicesCache?.get(id);\n\t\tif (cachedIndex !== undefined) {\n\t\t\treturn cachedIndex;\n\t\t}\n\n\t\tconst parentData = this.forest.tryGetParent(id);\n\t\tif (parentData === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parent = this.forest.tryGet(parentData.parentId);\n\t\tif (parent === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst trait = parent.traits.get(parentData.traitParent) ?? fail('inconsistent forest: trait parent not found');\n\t\tlet foundIndex: TraitNodeIndex | undefined;\n\t\tif (trait.length === 0) {\n\t\t\treturn foundIndex;\n\t\t}\n\n\t\tthis.traitIndicesCache ??= new Map();\n\t\tfor (let i = 0; i < trait.length; i++) {\n\t\t\tconst nodeInTrait = trait[i];\n\t\t\tconst index = i as TraitNodeIndex;\n\t\t\tthis.traitIndicesCache.set(nodeInTrait, index);\n\t\t\tif (nodeInTrait === id) {\n\t\t\t\tfoundIndex = index;\n\t\t\t}\n\t\t}\n\n\t\treturn foundIndex;\n\t}\n\n\t/**\n\t * @returns the trait at the given location. If no such trait exists, returns an empty trait.\n\t */\n\tpublic getTrait(traitLocation: TraitLocation): readonly NodeId[] {\n\t\treturn this.getViewNode(traitLocation.parent).traits.get(traitLocation.label) ?? [];\n\t}\n\n\t/** Asserts that the view's internal state is consistent. Useful for testing/validation. */\n\tpublic assertConsistent(): void {\n\t\tthis.forest.assertConsistent();\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<TreeViewNode> {\n\t\treturn this.iterateNodeDescendants(this.rootNode);\n\t}\n\n\t/** @returns true iff the given view is equal to this view */\n\tpublic abstract equals(view: TreeView): boolean;\n\n\t/**\n\t * @returns true iff the given view's forest of nodes is equivalent to this view's forest of nodes\n\t * @param strict - if true, the views' forests must be the same object, otherwise they must merely be equivalent\n\t */\n\tpublic hasEqualForest(view: TreeView, strict = false): boolean {\n\t\tif (this.root === view.root) {\n\t\t\t// TODO:#49100:Perf: make this faster and/or remove use by PrefetchingCheckout.\n\t\t\treturn strict ? this.forest === view.forest : this.forest.equals(view.forest);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate *iterateNodeDescendants(node: TreeViewNode): IterableIterator<TreeViewNode> {\n\t\tyield node;\n\t\tfor (const label of [...node.traits.keys()].sort()) {\n\t\t\tconst trait = node.traits.get(label);\n\t\t\tfor (const childId of trait ?? fail('Expected trait with label')) {\n\t\t\t\tconst child = this.getViewNode(childId);\n\t\t\t\tyield* this.iterateNodeDescendants(child);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getIndexOfSide(side: Side, traitLocation: TraitLocation): PlaceIndex {\n\t\treturn side === Side.After ? (0 as PlaceIndex) : (this.getTrait(traitLocation).length as PlaceIndex);\n\t}\n\n\t/**\n\t * Calculate the difference between two `TreeView`s\n\t * @param view - the other view to compare to this one\n\t * @returns A {@link Delta} which nodes must be changed, added, and removed to get from `this` to `view`.\n\t * The views must share a root.\n\t */\n\tpublic delta(view: TreeView): Delta<NodeId> {\n\t\tassert(this.root === view.root, 'Delta can only be calculated between views that share a root');\n\t\treturn this.forest.delta(view.forest);\n\t}\n}\n\nfunction getIndex(side: Side, index: TraitNodeIndex): PlaceIndex {\n\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n\treturn (side + index) as PlaceIndex;\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { StablePlace, StableRange } from './ChangeTypes';
|
|
6
|
+
import { TraitLocation, TreeView, TreeViewPlace, TreeViewRange } from './TreeView';
|
|
7
|
+
/**
|
|
8
|
+
* Express the given {@link (StableRange:interface)} as a {@link TreeViewRange}
|
|
9
|
+
*/
|
|
10
|
+
export declare function rangeFromStableRange(view: TreeView, range: StableRange): TreeViewRange;
|
|
11
|
+
/**
|
|
12
|
+
* Express the given {@link (StablePlace:interface)} as a {@link TreeViewPlace}
|
|
13
|
+
*/
|
|
14
|
+
export declare function placeFromStablePlace(view: TreeView, stablePlace: StablePlace): TreeViewPlace;
|
|
15
|
+
/**
|
|
16
|
+
* Return the trait under which the given range resides
|
|
17
|
+
* @param view - the {@link TreeView} within which to retrieve the trait location
|
|
18
|
+
* @param range - must be well formed and valid
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTraitLocationOfRange(view: TreeView, range: StableRange): TraitLocation;
|
|
21
|
+
//# sourceMappingURL=TreeViewUtilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeViewUtilities.d.ts","sourceRoot":"","sources":["../src/TreeViewUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa,CAOtF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,aAAa,CAc5F;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa,CAQzF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getTraitLocationOfRange = exports.placeFromStablePlace = exports.rangeFromStableRange = void 0;
|
|
8
|
+
const Common_1 = require("./Common");
|
|
9
|
+
/**
|
|
10
|
+
* Express the given {@link (StableRange:interface)} as a {@link TreeViewRange}
|
|
11
|
+
*/
|
|
12
|
+
function rangeFromStableRange(view, range) {
|
|
13
|
+
const location = getTraitLocationOfRange(view, range);
|
|
14
|
+
// This can be optimized for better constant factors.
|
|
15
|
+
return {
|
|
16
|
+
start: sideOfRange(range, SideOfRange.Start, location),
|
|
17
|
+
end: sideOfRange(range, SideOfRange.End, location),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.rangeFromStableRange = rangeFromStableRange;
|
|
21
|
+
/**
|
|
22
|
+
* Express the given {@link (StablePlace:interface)} as a {@link TreeViewPlace}
|
|
23
|
+
*/
|
|
24
|
+
function placeFromStablePlace(view, stablePlace) {
|
|
25
|
+
const { side } = stablePlace;
|
|
26
|
+
if (stablePlace.referenceSibling === undefined) {
|
|
27
|
+
Common_1.assert(stablePlace.referenceTrait !== undefined);
|
|
28
|
+
return {
|
|
29
|
+
trait: stablePlace.referenceTrait,
|
|
30
|
+
side,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
trait: view.getTraitLocation(stablePlace.referenceSibling),
|
|
35
|
+
side: stablePlace.side,
|
|
36
|
+
sibling: stablePlace.referenceSibling,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.placeFromStablePlace = placeFromStablePlace;
|
|
40
|
+
/**
|
|
41
|
+
* Return the trait under which the given range resides
|
|
42
|
+
* @param view - the {@link TreeView} within which to retrieve the trait location
|
|
43
|
+
* @param range - must be well formed and valid
|
|
44
|
+
*/
|
|
45
|
+
function getTraitLocationOfRange(view, range) {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
const referenceTrait = (_a = range.start.referenceTrait) !== null && _a !== void 0 ? _a : range.end.referenceTrait;
|
|
48
|
+
if (referenceTrait) {
|
|
49
|
+
return referenceTrait;
|
|
50
|
+
}
|
|
51
|
+
const sibling = (_c = (_b = range.start.referenceSibling) !== null && _b !== void 0 ? _b : range.end.referenceSibling) !== null && _c !== void 0 ? _c : Common_1.fail('malformed range does not indicate trait');
|
|
52
|
+
return view.getTraitLocation(sibling);
|
|
53
|
+
}
|
|
54
|
+
exports.getTraitLocationOfRange = getTraitLocationOfRange;
|
|
55
|
+
function sideOfRange(range, sideOfRange, trait) {
|
|
56
|
+
const siblingRelative = sideOfRange === SideOfRange.Start ? range.start : range.end;
|
|
57
|
+
return {
|
|
58
|
+
trait,
|
|
59
|
+
side: siblingRelative.side,
|
|
60
|
+
sibling: siblingRelative.referenceSibling,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Denotes either the start or end of a range
|
|
65
|
+
*/
|
|
66
|
+
var SideOfRange;
|
|
67
|
+
(function (SideOfRange) {
|
|
68
|
+
/**
|
|
69
|
+
* The start of the range
|
|
70
|
+
*/
|
|
71
|
+
SideOfRange[SideOfRange["Start"] = 0] = "Start";
|
|
72
|
+
/**
|
|
73
|
+
* The end of the range
|
|
74
|
+
*/
|
|
75
|
+
SideOfRange[SideOfRange["End"] = 1] = "End";
|
|
76
|
+
})(SideOfRange || (SideOfRange = {}));
|
|
77
|
+
//# sourceMappingURL=TreeViewUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeViewUtilities.js","sourceRoot":"","sources":["../src/TreeViewUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qCAAwC;AAGxC;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAc,EAAE,KAAkB;IACtE,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtD,qDAAqD;IACrD,OAAO;QACN,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;QACtD,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC;KAClD,CAAC;AACH,CAAC;AAPD,oDAOC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAc,EAAE,WAAwB;IAC5E,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;IAC7B,IAAI,WAAW,CAAC,gBAAgB,KAAK,SAAS,EAAE;QAC/C,eAAM,CAAC,WAAW,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC;QACjD,OAAO;YACN,KAAK,EAAE,WAAW,CAAC,cAAc;YACjC,IAAI;SACJ,CAAC;KACF;IACD,OAAO;QACN,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,gBAAgB,CAAC;QAC1D,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,OAAO,EAAE,WAAW,CAAC,gBAAgB;KACrC,CAAC;AACH,CAAC;AAdD,oDAcC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,IAAc,EAAE,KAAkB;;IACzE,MAAM,cAAc,SAAG,KAAK,CAAC,KAAK,CAAC,cAAc,mCAAI,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC;IAC9E,IAAI,cAAc,EAAE;QACnB,OAAO,cAAc,CAAC;KACtB;IACD,MAAM,OAAO,eACZ,KAAK,CAAC,KAAK,CAAC,gBAAgB,mCAAI,KAAK,CAAC,GAAG,CAAC,gBAAgB,mCAAI,aAAI,CAAC,yCAAyC,CAAC,CAAC;IAC/G,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AARD,0DAQC;AAED,SAAS,WAAW,CAAC,KAAkB,EAAE,WAAwB,EAAE,KAAoB;IACtF,MAAM,eAAe,GAAG,WAAW,KAAK,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IACpF,OAAO;QACN,KAAK;QACL,IAAI,EAAE,eAAe,CAAC,IAAI;QAC1B,OAAO,EAAE,eAAe,CAAC,gBAAgB;KACzC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,IAAK,WASJ;AATD,WAAK,WAAW;IACf;;OAEG;IACH,+CAAS,CAAA;IACT;;OAEG;IACH,2CAAO,CAAA;AACR,CAAC,EATI,WAAW,KAAX,WAAW,QASf","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { StablePlace, StableRange } from './ChangeTypes';\nimport { assert, fail } from './Common';\nimport { TraitLocation, TreeView, TreeViewPlace, TreeViewRange } from './TreeView';\n\n/**\n * Express the given {@link (StableRange:interface)} as a {@link TreeViewRange}\n */\nexport function rangeFromStableRange(view: TreeView, range: StableRange): TreeViewRange {\n\tconst location = getTraitLocationOfRange(view, range);\n\t// This can be optimized for better constant factors.\n\treturn {\n\t\tstart: sideOfRange(range, SideOfRange.Start, location),\n\t\tend: sideOfRange(range, SideOfRange.End, location),\n\t};\n}\n\n/**\n * Express the given {@link (StablePlace:interface)} as a {@link TreeViewPlace}\n */\nexport function placeFromStablePlace(view: TreeView, stablePlace: StablePlace): TreeViewPlace {\n\tconst { side } = stablePlace;\n\tif (stablePlace.referenceSibling === undefined) {\n\t\tassert(stablePlace.referenceTrait !== undefined);\n\t\treturn {\n\t\t\ttrait: stablePlace.referenceTrait,\n\t\t\tside,\n\t\t};\n\t}\n\treturn {\n\t\ttrait: view.getTraitLocation(stablePlace.referenceSibling),\n\t\tside: stablePlace.side,\n\t\tsibling: stablePlace.referenceSibling,\n\t};\n}\n\n/**\n * Return the trait under which the given range resides\n * @param view - the {@link TreeView} within which to retrieve the trait location\n * @param range - must be well formed and valid\n */\nexport function getTraitLocationOfRange(view: TreeView, range: StableRange): TraitLocation {\n\tconst referenceTrait = range.start.referenceTrait ?? range.end.referenceTrait;\n\tif (referenceTrait) {\n\t\treturn referenceTrait;\n\t}\n\tconst sibling =\n\t\trange.start.referenceSibling ?? range.end.referenceSibling ?? fail('malformed range does not indicate trait');\n\treturn view.getTraitLocation(sibling);\n}\n\nfunction sideOfRange(range: StableRange, sideOfRange: SideOfRange, trait: TraitLocation): TreeViewPlace {\n\tconst siblingRelative = sideOfRange === SideOfRange.Start ? range.start : range.end;\n\treturn {\n\t\ttrait,\n\t\tside: siblingRelative.side,\n\t\tsibling: siblingRelative.referenceSibling,\n\t};\n}\n\n/**\n * Denotes either the start or end of a range\n */\nenum SideOfRange {\n\t/**\n\t * The start of the range\n\t */\n\tStart = 0,\n\t/**\n\t * The end of the range\n\t */\n\tEnd = 1,\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { EditId } from '
|
|
5
|
+
import { EditId } from './Identifiers';
|
|
6
6
|
import { SharedTree } from './SharedTree';
|
|
7
7
|
export interface IRevertible {
|
|
8
8
|
revert(): any;
|
|
@@ -26,7 +26,7 @@ export declare class SharedTreeUndoRedoHandler {
|
|
|
26
26
|
* Tracks a change on a shared tree and allows reverting it
|
|
27
27
|
*/
|
|
28
28
|
export declare class SharedTreeRevertible implements IRevertible {
|
|
29
|
-
private editId;
|
|
29
|
+
private readonly editId;
|
|
30
30
|
private readonly tree;
|
|
31
31
|
constructor(editId: EditId, tree: SharedTree);
|
|
32
32
|
revert(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UndoRedoHandler.d.ts","sourceRoot":"","sources":["../src/UndoRedoHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAA+B,UAAU,EAAE,MAAM,cAAc,CAAC;AAKvE,MAAM,WAAW,WAAW;IAC3B,MAAM,QAAG;IACT,OAAO,QAAG;CACV;AAED,MAAM,WAAW,aAAa;IAC7B,sBAAsB,CAAC,UAAU,EAAE,WAAW,OAAE;CAChD;AAED;;;GAGG;AACH,qBAAa,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAEjD,UAAU,CAAC,IAAI,EAAE,UAAU;IAG3B,UAAU,CAAC,IAAI,EAAE,UAAU;IAIlC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAc/B;CACF;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,WAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAU,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAArC,MAAM,EAAE,MAAM,EAAmB,IAAI,EAAE,UAAU;IAEvE,MAAM;IAIN,OAAO;CAGd"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.SharedTreeRevertible = exports.SharedTreeUndoRedoHandler = void 0;
|
|
8
|
-
const Common_1 = require("
|
|
9
|
-
const
|
|
8
|
+
const Common_1 = require("./Common");
|
|
9
|
+
const EventTypes_1 = require("./EventTypes");
|
|
10
10
|
/**
|
|
11
11
|
* A shared tree undo redo handler that will add revertible local tree changes to the provided
|
|
12
12
|
* undo redo stack manager
|
|
@@ -22,10 +22,10 @@ class SharedTreeUndoRedoHandler {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
attachTree(tree) {
|
|
25
|
-
tree.on(
|
|
25
|
+
tree.on(EventTypes_1.SharedTreeEvent.EditCommitted, this.treeDeltaHandler);
|
|
26
26
|
}
|
|
27
27
|
detachTree(tree) {
|
|
28
|
-
tree.off(
|
|
28
|
+
tree.off(EventTypes_1.SharedTreeEvent.EditCommitted, this.treeDeltaHandler);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.SharedTreeUndoRedoHandler = SharedTreeUndoRedoHandler;
|
|
@@ -38,11 +38,7 @@ class SharedTreeRevertible {
|
|
|
38
38
|
this.tree = tree;
|
|
39
39
|
}
|
|
40
40
|
revert() {
|
|
41
|
-
|
|
42
|
-
const edit = this.tree.edits.getEditInSessionAtIndex(editIndex);
|
|
43
|
-
const snapshotBefore = this.tree.logViewer.getSnapshotInSession(editIndex);
|
|
44
|
-
// Apply the revert edit and set it as the new revertible edit.
|
|
45
|
-
this.editId = this.tree.editor.revert(edit, snapshotBefore);
|
|
41
|
+
this.tree.revert(this.editId);
|
|
46
42
|
}
|
|
47
43
|
discard() {
|
|
48
44
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UndoRedoHandler.js","sourceRoot":"","sources":["../src/UndoRedoHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAA8C;AAC9C,6CAA+C;AAgB/C;;;GAGG;AACH,MAAa,yBAAyB;IACrC,YAA6B,YAA2B;QAA3B,iBAAY,GAAZ,YAAY,CAAe;QASvC,qBAAgB,GAAG,CAAC,cAA2C,EAAE,EAAE;YACnF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC;YAE/C,IAAI,KAAK,EAAE;gBACV,IAAI,CAAC,YAAY,CAAC,sBAAsB,CACvC,IAAI,oBAAoB,CACvB,MAAM,EACN,2BAAkB,CACjB,IAAI,EACJ,sGAAsG,CACtG,CACD,CACD,CAAC;aACF;QACF,CAAC,CAAC;IAvByD,CAAC;IAErD,UAAU,CAAC,IAAgB;QACjC,IAAI,CAAC,EAAE,CAAC,4BAAe,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IACM,UAAU,CAAC,IAAgB;QACjC,IAAI,CAAC,GAAG,CAAC,4BAAe,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChE,CAAC;CAiBD;AAzBD,8DAyBC;AAED;;GAEG;AACH,MAAa,oBAAoB;IAChC,YAA6B,MAAc,EAAmB,IAAgB;QAAjD,WAAM,GAAN,MAAM,CAAQ;QAAmB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAE3E,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEM,OAAO;QACb,OAAO;IACR,CAAC;CACD;AAVD,oDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assertNotUndefined } from './Common';\nimport { SharedTreeEvent } from './EventTypes';\nimport { EditId } from './Identifiers';\nimport { EditCommittedEventArguments, SharedTree } from './SharedTree';\n\n// TODO: We temporarily duplicate these contracts from 'framework/undo-redo' to unblock development\n// while we decide on the correct layering for undo.\n\nexport interface IRevertible {\n\trevert();\n\tdiscard();\n}\n\nexport interface IUndoConsumer {\n\tpushToCurrentOperation(revertible: IRevertible);\n}\n\n/**\n * A shared tree undo redo handler that will add revertible local tree changes to the provided\n * undo redo stack manager\n */\nexport class SharedTreeUndoRedoHandler {\n\tconstructor(private readonly stackManager: IUndoConsumer) {}\n\n\tpublic attachTree(tree: SharedTree) {\n\t\ttree.on(SharedTreeEvent.EditCommitted, this.treeDeltaHandler);\n\t}\n\tpublic detachTree(tree: SharedTree) {\n\t\ttree.off(SharedTreeEvent.EditCommitted, this.treeDeltaHandler);\n\t}\n\n\tprivate readonly treeDeltaHandler = (eventArguments: EditCommittedEventArguments) => {\n\t\tconst { editId, local, tree } = eventArguments;\n\n\t\tif (local) {\n\t\t\tthis.stackManager.pushToCurrentOperation(\n\t\t\t\tnew SharedTreeRevertible(\n\t\t\t\t\teditId,\n\t\t\t\t\tassertNotUndefined(\n\t\t\t\t\t\ttree,\n\t\t\t\t\t\t'An edit committed event for a revertible edit should include the target SharedTree in its arguments.'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * Tracks a change on a shared tree and allows reverting it\n */\nexport class SharedTreeRevertible implements IRevertible {\n\tconstructor(private readonly editId: EditId, private readonly tree: SharedTree) {}\n\n\tpublic revert() {\n\t\tthis.tree.revert(this.editId);\n\t}\n\n\tpublic discard() {\n\t\treturn;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A map in which entries are always added in key-sorted order.
|
|
7
|
+
* Supports appending and searching.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AppendOnlySortedMap<K, V> {
|
|
10
|
+
protected readonly comparator: (a: K, b: K) => number;
|
|
11
|
+
protected readonly elements: [K, V][];
|
|
12
|
+
/**
|
|
13
|
+
* @param comparator a comparator for keys
|
|
14
|
+
*/
|
|
15
|
+
constructor(comparator: (a: K, b: K) => number);
|
|
16
|
+
/**
|
|
17
|
+
* @returns the number of entries in this map
|
|
18
|
+
*/
|
|
19
|
+
get size(): number;
|
|
20
|
+
/**
|
|
21
|
+
* @returns the min key in the map.
|
|
22
|
+
*/
|
|
23
|
+
minKey(): K | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* @returns the max key in the map.
|
|
26
|
+
*/
|
|
27
|
+
maxKey(): K | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* @returns an iterable of the entries in the map.
|
|
30
|
+
*/
|
|
31
|
+
entries(): IterableIterator<readonly [K, V]>;
|
|
32
|
+
/**
|
|
33
|
+
* @returns an iterable of the keys in the map.
|
|
34
|
+
*/
|
|
35
|
+
keys(): IterableIterator<K>;
|
|
36
|
+
/**
|
|
37
|
+
* @returns an iterable of the values in the map.
|
|
38
|
+
*/
|
|
39
|
+
values(): IterableIterator<V>;
|
|
40
|
+
/**
|
|
41
|
+
* @returns an iterable of the entries in the map, reversed.
|
|
42
|
+
*/
|
|
43
|
+
entriesReversed(): IterableIterator<readonly [K, V]>;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a new key/value pair to the map. `key` must be > to all keys in the map.
|
|
46
|
+
* @param key the key to add.
|
|
47
|
+
* @param value the value to add.
|
|
48
|
+
*/
|
|
49
|
+
append(key: K, value: V): void;
|
|
50
|
+
private readonly compareKeys;
|
|
51
|
+
/**
|
|
52
|
+
* @param key the key to lookup.
|
|
53
|
+
* @returns the value associated with `key` if such an entry exists, and undefined otherwise.
|
|
54
|
+
*/
|
|
55
|
+
get(key: K): V | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* @param key the key to lookup.
|
|
58
|
+
* @returns the entry associated with `key` if such an entry exists, the entry associated with the next lower key if such an entry
|
|
59
|
+
* exists, and undefined otherwise.
|
|
60
|
+
*/
|
|
61
|
+
getPairOrNextLower(key: K): readonly [K, V] | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @param key the key to lookup.
|
|
64
|
+
* @returns the entry associated with `key` if such an entry exists, the entry associated with the next higher key if such an entry
|
|
65
|
+
* exists, and undefined otherwise.
|
|
66
|
+
*/
|
|
67
|
+
getPairOrNextHigher(key: K): readonly [K, V] | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Compares two `AppendOnlySortedMap`s.
|
|
70
|
+
*/
|
|
71
|
+
equals(other: AppendOnlySortedMap<K, V>, compareValues: (a: V, b: V) => boolean): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Queries a range of entries.
|
|
74
|
+
* @param from the key to start the range query at, inclusive.
|
|
75
|
+
* @param to the key to end the range query at, inclusive.
|
|
76
|
+
* @returns the range of entries.
|
|
77
|
+
*/
|
|
78
|
+
getRange(from: K, to: K): IterableIterator<readonly [K, V]>;
|
|
79
|
+
protected getPairOrNextLowerBy<T>(search: T, comparator: (search: T, element: readonly [K, V]) => number): readonly [K, V] | undefined;
|
|
80
|
+
private getIndexOfOrNextLower;
|
|
81
|
+
protected getPairOrNextHigherBy<T>(search: T, comparator: (search: T, element: readonly [K, V]) => number): readonly [K, V] | undefined;
|
|
82
|
+
private getIndexOfOrNextHigher;
|
|
83
|
+
/**
|
|
84
|
+
* The value xor'd with the result index when a search fails.
|
|
85
|
+
*/
|
|
86
|
+
static readonly failureXor = -1;
|
|
87
|
+
/**
|
|
88
|
+
* Performs a binary search on the sorted array.
|
|
89
|
+
* @param elements
|
|
90
|
+
* @param search
|
|
91
|
+
* @param comparator
|
|
92
|
+
* @returns the index of `search`, or (if not present) the index it would have been inserted into xor'd with `failureXor`. Note that
|
|
93
|
+
* negating is not an adequate solution as that could result in -0.
|
|
94
|
+
*/
|
|
95
|
+
static indexOf<T, K, V>(elements: readonly (readonly [K, V])[], search: T, comparator: (search: T, element: readonly [K, V]) => number): number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A map in which entries are always added in both key-sorted and value-sorted order.
|
|
99
|
+
* Supports appending and searching.
|
|
100
|
+
*/
|
|
101
|
+
export declare class AppendOnlyDoublySortedMap<K, V, S> extends AppendOnlySortedMap<K, V> {
|
|
102
|
+
private readonly extractSearchValue;
|
|
103
|
+
private readonly valueComparator;
|
|
104
|
+
constructor(keyComparator: (a: K, b: K) => number, extractSearchValue: (value: V) => S, valueComparator: (search: S, value: V) => number);
|
|
105
|
+
append(key: K, value: V): void;
|
|
106
|
+
private readonly compareValues;
|
|
107
|
+
/**
|
|
108
|
+
* @param value the value to lookup.
|
|
109
|
+
* @returns the key associated with `value` if such an entry exists, and undefined otherwise.
|
|
110
|
+
*/
|
|
111
|
+
getByValue(value: S): K | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* @param searchValue the search value to lookup.
|
|
114
|
+
* @returns the entry who's value, when run through the extractor provided to the constructor, matches `searchValue`. If no such entry
|
|
115
|
+
* exists, this method returns the next lower entry as determined by the value comparator provided to the constructor. If no such entry
|
|
116
|
+
* exists, this method returns undefined.
|
|
117
|
+
*/
|
|
118
|
+
getPairOrNextLowerByValue(searchValue: S): readonly [K, V] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* @param searchValue the search value to lookup.
|
|
121
|
+
* @returns the entry who's value, when run through the extractor provided to the constructor, matches `searchValue`. If no such entry
|
|
122
|
+
* exists, this method returns the next higher entry as determined by the value comparator provided to the constructor. If no such entry
|
|
123
|
+
* exists, this method returns undefined.
|
|
124
|
+
*/
|
|
125
|
+
getPairOrNextHigherByValue(searchValue: S): readonly [K, V] | undefined;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=AppendOnlySortedMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppendOnlySortedMap.d.ts","sourceRoot":"","sources":["../../src/id-compressor/AppendOnlySortedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,EAAE,CAAC;IAMjB,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM;IALxE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAM;IAE3C;;OAEG;gBACmC,UAAU,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