@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,226 @@
|
|
|
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.revert = void 0;
|
|
8
|
+
const Identifiers_1 = require("./Identifiers");
|
|
9
|
+
const Common_1 = require("./Common");
|
|
10
|
+
const TreeViewUtilities_1 = require("./TreeViewUtilities");
|
|
11
|
+
const persisted_types_1 = require("./persisted-types");
|
|
12
|
+
const TransactionInternal_1 = require("./TransactionInternal");
|
|
13
|
+
const EditUtilities_1 = require("./EditUtilities");
|
|
14
|
+
const SerializationUtilities_1 = require("./SerializationUtilities");
|
|
15
|
+
/**
|
|
16
|
+
* Given a sequence of changes, produces an inverse sequence of changes, i.e. the minimal changes required to revert the given changes
|
|
17
|
+
* @param changes - the changes for which to produce an inverse.
|
|
18
|
+
* @param before - a view of the tree state before `changes` are/were applied - used as a basis for generating the inverse.
|
|
19
|
+
* @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
|
|
20
|
+
* applying `changes` to `before`. Applying _r_ to views other than _A_ is legal but may cause the changes to fail to apply or may
|
|
21
|
+
* not be a true semantic inverse. If the changes could not be reverted given the state of `before`, returns undefined.
|
|
22
|
+
*
|
|
23
|
+
* TODO: what should this do if `changes` fails to apply to `before`?
|
|
24
|
+
* TODO:#68574: Pass a view that corresponds to the appropriate Fluid reference sequence number rather than the view just before
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
function revert(changes, before) {
|
|
28
|
+
const result = [];
|
|
29
|
+
const builtNodes = new Map();
|
|
30
|
+
const detachedNodes = new Map();
|
|
31
|
+
// Open edit on revision to update it as changes are walked through
|
|
32
|
+
const editor = TransactionInternal_1.TransactionInternal.factory(before);
|
|
33
|
+
// Apply `edit`, generating an inverse as we go.
|
|
34
|
+
for (const change of changes) {
|
|
35
|
+
// Generate an inverse of each change
|
|
36
|
+
switch (change.type) {
|
|
37
|
+
case persisted_types_1.ChangeTypeInternal.Build: {
|
|
38
|
+
// Save nodes added to the detached state for use in future changes
|
|
39
|
+
const { destination, source } = change;
|
|
40
|
+
Common_1.assert(!builtNodes.has(destination), `Cannot revert Build: destination is already used by a Build`);
|
|
41
|
+
Common_1.assert(!detachedNodes.has(destination), `Cannot revert Build: destination is already used by a Detach`);
|
|
42
|
+
builtNodes.set(destination, source.reduce((ids, curr) => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (Identifiers_1.isDetachedSequenceId(curr)) {
|
|
45
|
+
const nodesForDetachedSequence = (_a = builtNodes.get(curr)) !== null && _a !== void 0 ? _a : Common_1.fail('detached sequence must have associated built nodes');
|
|
46
|
+
ids.push(...nodesForDetachedSequence);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
ids.push(curr.identifier);
|
|
50
|
+
}
|
|
51
|
+
return ids;
|
|
52
|
+
}, []));
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case persisted_types_1.ChangeTypeInternal.Insert: {
|
|
56
|
+
const { source } = change;
|
|
57
|
+
const nodesBuilt = builtNodes.get(source);
|
|
58
|
+
const nodesDetached = detachedNodes.get(source);
|
|
59
|
+
if (nodesBuilt !== undefined) {
|
|
60
|
+
result.unshift(createInvertedInsert(change, nodesBuilt));
|
|
61
|
+
builtNodes.delete(source);
|
|
62
|
+
}
|
|
63
|
+
else if (nodesDetached !== undefined) {
|
|
64
|
+
result.unshift(createInvertedInsert(change, nodesDetached, true));
|
|
65
|
+
detachedNodes.delete(source);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Cannot revert an insert whose source is no longer available for inserting (i.e. not just built, and not detached)
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case persisted_types_1.ChangeTypeInternal.Detach: {
|
|
74
|
+
const { destination } = change;
|
|
75
|
+
const invert = createInvertedDetach(change, editor.view);
|
|
76
|
+
if (invert === undefined) {
|
|
77
|
+
// Cannot revert a detach whose source does not exist in the tree
|
|
78
|
+
// TODO:68574: May not be possible once associated todo in `createInvertedDetach` is addressed
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const { invertedDetach, detachedNodeIds } = invert;
|
|
82
|
+
if (destination !== undefined) {
|
|
83
|
+
if (builtNodes.has(destination) || detachedNodes.has(destination)) {
|
|
84
|
+
// Malformed: destination was already used by a prior build or detach
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
detachedNodes.set(destination, detachedNodeIds);
|
|
88
|
+
}
|
|
89
|
+
result.unshift(...invertedDetach);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case persisted_types_1.ChangeTypeInternal.SetValue: {
|
|
93
|
+
const invert = createInvertedSetValue(change, editor.view);
|
|
94
|
+
if (invert === undefined) {
|
|
95
|
+
// Cannot revert a set for a node that does not exist in the tree
|
|
96
|
+
// TODO:68574: May not be possible once associated todo in `createInvertedSetValue` is addressed
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
result.unshift(...invert);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case persisted_types_1.ChangeTypeInternal.Constraint:
|
|
103
|
+
// TODO:#46759: Support Constraint in reverts
|
|
104
|
+
Common_1.fail('Revert currently does not support Constraints');
|
|
105
|
+
default:
|
|
106
|
+
Common_1.fail('Revert does not support the change type.');
|
|
107
|
+
}
|
|
108
|
+
// Update the revision
|
|
109
|
+
editor.applyChange(change);
|
|
110
|
+
}
|
|
111
|
+
editor.close();
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
exports.revert = revert;
|
|
115
|
+
/**
|
|
116
|
+
* The inverse of an Insert is a Detach that starts before the leftmost node inserted and ends after the rightmost.
|
|
117
|
+
*/
|
|
118
|
+
function createInvertedInsert(insert, nodesInserted, saveDetached = false) {
|
|
119
|
+
const leftmostNode = nodesInserted[0];
|
|
120
|
+
const rightmostNode = nodesInserted[nodesInserted.length - 1];
|
|
121
|
+
const source = {
|
|
122
|
+
start: {
|
|
123
|
+
referenceSibling: leftmostNode,
|
|
124
|
+
side: persisted_types_1.Side.Before,
|
|
125
|
+
},
|
|
126
|
+
end: {
|
|
127
|
+
referenceSibling: rightmostNode,
|
|
128
|
+
side: persisted_types_1.Side.After,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
return persisted_types_1.ChangeInternal.detach(source, saveDetached ? insert.source : undefined);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* If a detach does not include a destination, its inverse is a build and insert. Otherwise, it is just an insert.
|
|
135
|
+
* Information on the nodes that were detached is obtained by going to the revision before the detach.
|
|
136
|
+
*
|
|
137
|
+
* The anchor for the resulting Insert is chosen in the following order:
|
|
138
|
+
* 1. If detach.source.start.side is After: detach.source.start
|
|
139
|
+
*
|
|
140
|
+
* ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
|
|
141
|
+
* if detach.source.start is "After B", the anchor for the resulting Insert will also be "After B".
|
|
142
|
+
*
|
|
143
|
+
* For nodes [A..F] G H where [A..F] represents the detached nodes,
|
|
144
|
+
* if detach.source.start is "After start of trait", the anchor for the resulting Insert will also be "After start of trait".
|
|
145
|
+
*
|
|
146
|
+
* 2. Else if detach.source.end.side is Before: detach.source.end
|
|
147
|
+
*
|
|
148
|
+
* ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
|
|
149
|
+
* if detach.source.start is "Before C" and detach.source.end is "Before G",
|
|
150
|
+
* the anchor for the resulting Insert will be "Before G".
|
|
151
|
+
*
|
|
152
|
+
* 3. Else: After the node directly to the left of the originally detached nodes
|
|
153
|
+
*
|
|
154
|
+
* ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
|
|
155
|
+
* if detach.source.start is "Before C" and detach.source.end is "After F",
|
|
156
|
+
* the anchor for the resulting Insert will be "After B".
|
|
157
|
+
*
|
|
158
|
+
* When choosing the anchor, the existing anchors on detach.source are preferred when they have a valid sibling. Otherwise, the valid
|
|
159
|
+
* anchor to the left of the originally detached nodes is chosen.
|
|
160
|
+
*/
|
|
161
|
+
function createInvertedDetach(detach, viewBeforeChange) {
|
|
162
|
+
const validatedSource = EditUtilities_1.validateStableRange(viewBeforeChange, detach.source);
|
|
163
|
+
if (validatedSource.result !== EditUtilities_1.RangeValidationResultKind.Valid) {
|
|
164
|
+
// TODO:#68574: having the reference view would potentially allow us to revert some detaches that currently conflict
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
const { start, end } = TreeViewUtilities_1.rangeFromStableRange(viewBeforeChange, validatedSource);
|
|
168
|
+
const { trait: referenceTrait } = start;
|
|
169
|
+
const nodes = viewBeforeChange.getTrait(referenceTrait);
|
|
170
|
+
const startIndex = viewBeforeChange.findIndexWithinTrait(start);
|
|
171
|
+
const endIndex = viewBeforeChange.findIndexWithinTrait(end);
|
|
172
|
+
const detachedNodeIds = nodes.slice(startIndex, endIndex);
|
|
173
|
+
const leftOfDetached = nodes.slice(0, startIndex);
|
|
174
|
+
let insertDestination;
|
|
175
|
+
if (start.side === persisted_types_1.Side.After) {
|
|
176
|
+
insertDestination =
|
|
177
|
+
start.sibling === undefined
|
|
178
|
+
? { side: persisted_types_1.Side.After, referenceTrait }
|
|
179
|
+
: { side: persisted_types_1.Side.After, referenceSibling: start.sibling };
|
|
180
|
+
}
|
|
181
|
+
else if (end.side === persisted_types_1.Side.Before) {
|
|
182
|
+
insertDestination =
|
|
183
|
+
end.sibling === undefined
|
|
184
|
+
? { side: persisted_types_1.Side.Before, referenceTrait }
|
|
185
|
+
: { side: persisted_types_1.Side.Before, referenceSibling: end.sibling };
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const referenceSibling = leftOfDetached.pop();
|
|
189
|
+
insertDestination = {
|
|
190
|
+
side: persisted_types_1.Side.After,
|
|
191
|
+
referenceSibling,
|
|
192
|
+
referenceTrait: referenceSibling === undefined ? referenceTrait : undefined,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (detach.destination !== undefined) {
|
|
196
|
+
return {
|
|
197
|
+
invertedDetach: [persisted_types_1.ChangeInternal.insert(detach.destination, insertDestination)],
|
|
198
|
+
detachedNodeIds,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const detachedSequenceId = 0;
|
|
202
|
+
return {
|
|
203
|
+
invertedDetach: [
|
|
204
|
+
persisted_types_1.ChangeInternal.build(detachedNodeIds.map((id) => SerializationUtilities_1.getChangeNodeFromViewNode(viewBeforeChange, id)), detachedSequenceId),
|
|
205
|
+
persisted_types_1.ChangeInternal.insert(detachedSequenceId, insertDestination),
|
|
206
|
+
],
|
|
207
|
+
detachedNodeIds,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The inverse of a SetValue is a SetValue that sets the value to what it was prior to the change.
|
|
212
|
+
*/
|
|
213
|
+
function createInvertedSetValue(setValue, viewBeforeChange) {
|
|
214
|
+
const { nodeToModify } = setValue;
|
|
215
|
+
const node = viewBeforeChange.tryGetViewNode(nodeToModify);
|
|
216
|
+
if (node === undefined) {
|
|
217
|
+
// TODO:68574: With a reference view, may be able to better resolve conflicting sets
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface)
|
|
221
|
+
if (node.payload !== null) {
|
|
222
|
+
return [persisted_types_1.ChangeInternal.setPayload(nodeToModify, node.payload)];
|
|
223
|
+
}
|
|
224
|
+
return [persisted_types_1.ChangeInternal.clearPayload(nodeToModify)];
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=HistoryEditFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryEditFactory.js","sourceRoot":"","sources":["../src/HistoryEditFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAiF;AACjF,qCAAwC;AACxC,2DAA2D;AAC3D,uDAS2B;AAC3B,+DAA4D;AAC5D,mDAAiF;AAIjF,qEAAqE;AAErE;;;;;;;;;;;GAWG;AACH,SAAgB,MAAM,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AAc,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;IACD,OAAO,CAAC,gCAAc,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DetachedSequenceId, isDetachedSequenceId, NodeId } from './Identifiers';\nimport { assert, fail } from './Common';\nimport { rangeFromStableRange } from './TreeViewUtilities';\nimport {\n\tChangeInternal,\n\tChangeTypeInternal,\n\tDetachInternal,\n\tSetValueInternal,\n\tInsertInternal,\n\tBuildNodeInternal,\n\tSide,\n\tStableRangeInternal,\n} from './persisted-types';\nimport { TransactionInternal } from './TransactionInternal';\nimport { RangeValidationResultKind, validateStableRange } from './EditUtilities';\nimport { StablePlace } from './ChangeTypes';\nimport { RevisionView } from './RevisionView';\nimport { TreeView } from './TreeView';\nimport { getChangeNodeFromViewNode } from './SerializationUtilities';\n\n/**\n * Given a sequence of changes, produces an inverse sequence of changes, i.e. the minimal changes required to revert the given changes\n * @param changes - the changes for which to produce an inverse.\n * @param before - a view of the tree state before `changes` are/were applied - used as a basis for generating the inverse.\n * @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\n * applying `changes` to `before`. Applying _r_ to views other than _A_ is legal but may cause the changes to fail to apply or may\n * not be a true semantic inverse. If the changes could not be reverted given the state of `before`, returns undefined.\n *\n * TODO: what should this do if `changes` fails to apply to `before`?\n * TODO:#68574: Pass a view that corresponds to the appropriate Fluid reference sequence number rather than the view just before\n * @internal\n */\nexport function revert(changes: readonly ChangeInternal[], before: RevisionView): ChangeInternal[] | undefined {\n\tconst result: ChangeInternal[] = [];\n\n\tconst builtNodes = new Map<DetachedSequenceId, NodeId[]>();\n\tconst detachedNodes = new Map<DetachedSequenceId, NodeId[]>();\n\n\t// Open edit on revision to update it as changes are walked through\n\tconst editor = TransactionInternal.factory(before);\n\t// Apply `edit`, generating an inverse as we go.\n\tfor (const change of changes) {\n\t\t// Generate an inverse of each change\n\t\tswitch (change.type) {\n\t\t\tcase ChangeTypeInternal.Build: {\n\t\t\t\t// Save nodes added to the detached state for use in future changes\n\t\t\t\tconst { destination, source } = change;\n\t\t\t\tassert(!builtNodes.has(destination), `Cannot revert Build: destination is already used by a Build`);\n\t\t\t\tassert(!detachedNodes.has(destination), `Cannot revert Build: destination is already used by a Detach`);\n\t\t\t\tbuiltNodes.set(\n\t\t\t\t\tdestination,\n\t\t\t\t\tsource.reduce((ids: NodeId[], curr: BuildNodeInternal) => {\n\t\t\t\t\t\tif (isDetachedSequenceId(curr)) {\n\t\t\t\t\t\t\tconst nodesForDetachedSequence =\n\t\t\t\t\t\t\t\tbuiltNodes.get(curr) ?? fail('detached sequence must have associated built nodes');\n\n\t\t\t\t\t\t\tids.push(...nodesForDetachedSequence);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tids.push(curr.identifier);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn ids;\n\t\t\t\t\t}, [])\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.Insert: {\n\t\t\t\tconst { source } = change;\n\t\t\t\tconst nodesBuilt = builtNodes.get(source);\n\t\t\t\tconst nodesDetached = detachedNodes.get(source);\n\n\t\t\t\tif (nodesBuilt !== undefined) {\n\t\t\t\t\tresult.unshift(createInvertedInsert(change, nodesBuilt));\n\t\t\t\t\tbuiltNodes.delete(source);\n\t\t\t\t} else if (nodesDetached !== undefined) {\n\t\t\t\t\tresult.unshift(createInvertedInsert(change, nodesDetached, true));\n\t\t\t\t\tdetachedNodes.delete(source);\n\t\t\t\t} else {\n\t\t\t\t\t// Cannot revert an insert whose source is no longer available for inserting (i.e. not just built, and not detached)\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.Detach: {\n\t\t\t\tconst { destination } = change;\n\t\t\t\tconst invert = createInvertedDetach(change, editor.view);\n\t\t\t\tif (invert === undefined) {\n\t\t\t\t\t// Cannot revert a detach whose source does not exist in the tree\n\t\t\t\t\t// TODO:68574: May not be possible once associated todo in `createInvertedDetach` is addressed\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tconst { invertedDetach, detachedNodeIds } = invert;\n\n\t\t\t\tif (destination !== undefined) {\n\t\t\t\t\tif (builtNodes.has(destination) || detachedNodes.has(destination)) {\n\t\t\t\t\t\t// Malformed: destination was already used by a prior build or detach\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tdetachedNodes.set(destination, detachedNodeIds);\n\t\t\t\t}\n\n\t\t\t\tresult.unshift(...invertedDetach);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.SetValue: {\n\t\t\t\tconst invert = createInvertedSetValue(change, editor.view);\n\t\t\t\tif (invert === undefined) {\n\t\t\t\t\t// Cannot revert a set for a node that does not exist in the tree\n\t\t\t\t\t// TODO:68574: May not be possible once associated todo in `createInvertedSetValue` is addressed\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tresult.unshift(...invert);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.Constraint:\n\t\t\t\t// TODO:#46759: Support Constraint in reverts\n\t\t\t\tfail('Revert currently does not support Constraints');\n\t\t\tdefault:\n\t\t\t\tfail('Revert does not support the change type.');\n\t\t}\n\n\t\t// Update the revision\n\t\teditor.applyChange(change);\n\t}\n\n\teditor.close();\n\treturn result;\n}\n\n/**\n * The inverse of an Insert is a Detach that starts before the leftmost node inserted and ends after the rightmost.\n */\nfunction createInvertedInsert(\n\tinsert: InsertInternal,\n\tnodesInserted: readonly NodeId[],\n\tsaveDetached = false\n): ChangeInternal {\n\tconst leftmostNode = nodesInserted[0];\n\tconst rightmostNode = nodesInserted[nodesInserted.length - 1];\n\n\tconst source: StableRangeInternal = {\n\t\tstart: {\n\t\t\treferenceSibling: leftmostNode,\n\t\t\tside: Side.Before,\n\t\t},\n\t\tend: {\n\t\t\treferenceSibling: rightmostNode,\n\t\t\tside: Side.After,\n\t\t},\n\t};\n\n\treturn ChangeInternal.detach(source, saveDetached ? insert.source : undefined);\n}\n\n/**\n * If a detach does not include a destination, its inverse is a build and insert. Otherwise, it is just an insert.\n * Information on the nodes that were detached is obtained by going to the revision before the detach.\n *\n * The anchor for the resulting Insert is chosen in the following order:\n * 1. If detach.source.start.side is After: detach.source.start\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"After B\", the anchor for the resulting Insert will also be \"After B\".\n *\n * For nodes [A..F] G H where [A..F] represents the detached nodes,\n * if detach.source.start is \"After start of trait\", the anchor for the resulting Insert will also be \"After start of trait\".\n *\n * 2. Else if detach.source.end.side is Before: detach.source.end\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"Before C\" and detach.source.end is \"Before G\",\n * the anchor for the resulting Insert will be \"Before G\".\n *\n * 3. Else: After the node directly to the left of the originally detached nodes\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"Before C\" and detach.source.end is \"After F\",\n * the anchor for the resulting Insert will be \"After B\".\n *\n * When choosing the anchor, the existing anchors on detach.source are preferred when they have a valid sibling. Otherwise, the valid\n * anchor to the left of the originally detached nodes is chosen.\n */\nfunction createInvertedDetach(\n\tdetach: DetachInternal,\n\tviewBeforeChange: TreeView\n): { invertedDetach: ChangeInternal[]; detachedNodeIds: NodeId[] } | undefined {\n\tconst validatedSource = validateStableRange(viewBeforeChange, detach.source);\n\tif (validatedSource.result !== RangeValidationResultKind.Valid) {\n\t\t// TODO:#68574: having the reference view would potentially allow us to revert some detaches that currently conflict\n\t\treturn undefined;\n\t}\n\n\tconst { start, end } = rangeFromStableRange(viewBeforeChange, validatedSource);\n\tconst { trait: referenceTrait } = start;\n\tconst nodes = viewBeforeChange.getTrait(referenceTrait);\n\n\tconst startIndex = viewBeforeChange.findIndexWithinTrait(start);\n\tconst endIndex = viewBeforeChange.findIndexWithinTrait(end);\n\tconst detachedNodeIds: NodeId[] = nodes.slice(startIndex, endIndex);\n\n\tconst leftOfDetached = nodes.slice(0, startIndex);\n\n\tlet insertDestination: StablePlace;\n\n\tif (start.side === Side.After) {\n\t\tinsertDestination =\n\t\t\tstart.sibling === undefined\n\t\t\t\t? { side: Side.After, referenceTrait }\n\t\t\t\t: { side: Side.After, referenceSibling: start.sibling };\n\t} else if (end.side === Side.Before) {\n\t\tinsertDestination =\n\t\t\tend.sibling === undefined\n\t\t\t\t? { side: Side.Before, referenceTrait }\n\t\t\t\t: { side: Side.Before, referenceSibling: end.sibling };\n\t} else {\n\t\tconst referenceSibling = leftOfDetached.pop();\n\t\tinsertDestination = {\n\t\t\tside: Side.After,\n\t\t\treferenceSibling,\n\t\t\treferenceTrait: referenceSibling === undefined ? referenceTrait : undefined,\n\t\t};\n\t}\n\n\tif (detach.destination !== undefined) {\n\t\treturn {\n\t\t\tinvertedDetach: [ChangeInternal.insert(detach.destination, insertDestination)],\n\t\t\tdetachedNodeIds,\n\t\t};\n\t}\n\n\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\treturn {\n\t\tinvertedDetach: [\n\t\t\tChangeInternal.build(\n\t\t\t\tdetachedNodeIds.map((id) => getChangeNodeFromViewNode(viewBeforeChange, id)),\n\t\t\t\tdetachedSequenceId\n\t\t\t),\n\t\t\tChangeInternal.insert(detachedSequenceId, insertDestination),\n\t\t],\n\t\tdetachedNodeIds,\n\t};\n}\n\n/**\n * The inverse of a SetValue is a SetValue that sets the value to what it was prior to the change.\n */\nfunction createInvertedSetValue(setValue: SetValueInternal, viewBeforeChange: TreeView): ChangeInternal[] | undefined {\n\tconst { nodeToModify } = setValue;\n\tconst node = viewBeforeChange.tryGetViewNode(nodeToModify);\n\tif (node === undefined) {\n\t\t// TODO:68574: With a reference view, may be able to better resolve conflicting sets\n\t\treturn undefined;\n\t}\n\n\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface)\n\tif (node.payload !== null) {\n\t\treturn [ChangeInternal.setPayload(nodeToModify, node.payload)];\n\t}\n\treturn [ChangeInternal.clearPayload(nodeToModify)];\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ReplaceRecursive } from './Common';
|
|
6
|
+
import { NodeId } from './Identifiers';
|
|
7
|
+
import { ChangeInternal, Edit, NodeData, StablePlaceInternal, StableRangeInternal } from './persisted-types';
|
|
8
|
+
export declare function convertEditIds<IdFrom, IdTo>(edit: ReplaceRecursive<Edit<ChangeInternal>, NodeId, IdFrom>, convert: (id: IdFrom) => IdTo): Edit<ReplaceRecursive<ChangeInternal, NodeId, IdTo>>;
|
|
9
|
+
export declare function convertNodeDataIds<IdFrom, IdTo>(nodeData: NodeData<IdFrom>, convert: (id: IdFrom) => IdTo): NodeData<IdTo>;
|
|
10
|
+
export declare function convertStableRangeIds<IdFrom, IdTo>(range: ReplaceRecursive<StableRangeInternal, NodeId, IdFrom>, convert: (id: IdFrom) => IdTo): ReplaceRecursive<StableRangeInternal, NodeId, IdTo>;
|
|
11
|
+
export declare function convertStablePlaceIds<IdFrom, IdTo>({ side, referenceSibling, referenceTrait }: ReplaceRecursive<StablePlaceInternal, NodeId, IdFrom>, convert: (id: IdFrom) => IdTo): ReplaceRecursive<StablePlaceInternal, NodeId, IdTo>;
|
|
12
|
+
//# sourceMappingURL=IdConversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdConversion.d.ts","sourceRoot":"","sources":["../src/IdConversion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwC,gBAAgB,EAA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right (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.convertStablePlaceIds = exports.convertStableRangeIds = exports.convertNodeDataIds = exports.convertEditIds = void 0;
|
|
8
|
+
const Common_1 = require("./Common");
|
|
9
|
+
const EditUtilities_1 = require("./EditUtilities");
|
|
10
|
+
const Identifiers_1 = require("./Identifiers");
|
|
11
|
+
const persisted_types_1 = require("./persisted-types");
|
|
12
|
+
function convertEditIds(edit, convert) {
|
|
13
|
+
const changes = edit.changes.map((change) => {
|
|
14
|
+
switch (change.type) {
|
|
15
|
+
case persisted_types_1.ChangeTypeInternal.Build:
|
|
16
|
+
return {
|
|
17
|
+
type: persisted_types_1.ChangeTypeInternal.Build,
|
|
18
|
+
destination: change.destination,
|
|
19
|
+
source: change.source.map((tree) => {
|
|
20
|
+
return EditUtilities_1.convertTreeNodes(tree, (node) => convertNodeDataIds(node, convert), Identifiers_1.isDetachedSequenceId);
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
case persisted_types_1.ChangeTypeInternal.Insert:
|
|
24
|
+
return {
|
|
25
|
+
type: persisted_types_1.ChangeTypeInternal.Insert,
|
|
26
|
+
source: change.source,
|
|
27
|
+
destination: convertStablePlaceIds(change.destination, convert),
|
|
28
|
+
};
|
|
29
|
+
case persisted_types_1.ChangeTypeInternal.Detach: {
|
|
30
|
+
const detach = {
|
|
31
|
+
type: persisted_types_1.ChangeTypeInternal.Detach,
|
|
32
|
+
source: convertStableRangeIds(change.source, convert),
|
|
33
|
+
};
|
|
34
|
+
Common_1.copyPropertyIfDefined(change, detach, 'destination');
|
|
35
|
+
return detach;
|
|
36
|
+
}
|
|
37
|
+
case persisted_types_1.ChangeTypeInternal.SetValue:
|
|
38
|
+
return {
|
|
39
|
+
type: persisted_types_1.ChangeTypeInternal.SetValue,
|
|
40
|
+
nodeToModify: convert(change.nodeToModify),
|
|
41
|
+
payload: change.payload,
|
|
42
|
+
};
|
|
43
|
+
case persisted_types_1.ChangeTypeInternal.Constraint: {
|
|
44
|
+
const constraint = {
|
|
45
|
+
type: persisted_types_1.ChangeTypeInternal.Constraint,
|
|
46
|
+
effect: change.effect,
|
|
47
|
+
toConstrain: convertStableRangeIds(change.toConstrain, convert),
|
|
48
|
+
};
|
|
49
|
+
Common_1.copyPropertyIfDefined(change, constraint, 'identityHash');
|
|
50
|
+
Common_1.copyPropertyIfDefined(change, constraint, 'label');
|
|
51
|
+
Common_1.copyPropertyIfDefined(change, constraint, 'length');
|
|
52
|
+
Common_1.copyPropertyIfDefined(change, constraint, 'contentHash');
|
|
53
|
+
if (change.parentNode !== undefined) {
|
|
54
|
+
constraint.parentNode = convert(change.parentNode);
|
|
55
|
+
}
|
|
56
|
+
return constraint;
|
|
57
|
+
}
|
|
58
|
+
default:
|
|
59
|
+
Common_1.fail('Unknown change type.');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const newEdit = { id: edit.id, changes };
|
|
63
|
+
Common_1.copyPropertyIfDefined(edit, newEdit, 'pastAttemptCount');
|
|
64
|
+
return newEdit;
|
|
65
|
+
}
|
|
66
|
+
exports.convertEditIds = convertEditIds;
|
|
67
|
+
function convertNodeDataIds(nodeData, convert) {
|
|
68
|
+
const identifier = convert(nodeData.identifier);
|
|
69
|
+
const output = { definition: nodeData.definition, identifier };
|
|
70
|
+
Common_1.copyPropertyIfDefined(nodeData, output, 'payload');
|
|
71
|
+
return output;
|
|
72
|
+
}
|
|
73
|
+
exports.convertNodeDataIds = convertNodeDataIds;
|
|
74
|
+
function convertStableRangeIds(range, convert) {
|
|
75
|
+
const start = convertStablePlaceIds(range.start, convert);
|
|
76
|
+
const end = convertStablePlaceIds(range.end, convert);
|
|
77
|
+
return { start, end };
|
|
78
|
+
}
|
|
79
|
+
exports.convertStableRangeIds = convertStableRangeIds;
|
|
80
|
+
function convertStablePlaceIds({ side, referenceSibling, referenceTrait }, convert) {
|
|
81
|
+
const stablePlaceNew = {
|
|
82
|
+
side,
|
|
83
|
+
};
|
|
84
|
+
if (referenceSibling !== undefined) {
|
|
85
|
+
const nodeId = convert(referenceSibling);
|
|
86
|
+
stablePlaceNew.referenceSibling = nodeId;
|
|
87
|
+
}
|
|
88
|
+
if (referenceTrait !== undefined) {
|
|
89
|
+
const parent = convert(referenceTrait.parent);
|
|
90
|
+
stablePlaceNew.referenceTrait = {
|
|
91
|
+
label: referenceTrait.label,
|
|
92
|
+
parent,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return stablePlaceNew;
|
|
96
|
+
}
|
|
97
|
+
exports.convertStablePlaceIds = convertStablePlaceIds;
|
|
98
|
+
//# sourceMappingURL=IdConversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdConversion.js","sourceRoot":"","sources":["../src/IdConversion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAkF;AAClF,mDAAmD;AACnD,+CAAiF;AACjF,uDAW2B;AAE3B,SAAgB,cAAc,CAC7B,IAA4D,EAC5D,OAA6B;IAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAkD,EAAE;QAC3F,QAAQ,MAAM,CAAC,IAAI,EAAE;YACpB,KAAK,oCAAkB,CAAC,KAAK;gBAC5B,OAAO;oBACN,IAAI,EAAE,oCAAkB,CAAC,KAAK;oBAC9B,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBAClC,OAAO,gCAAgB,CAIrB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,kCAAoB,CAAC,CAAC;oBAC5E,CAAC,CAAC;iBACF,CAAC;YACH,KAAK,oCAAkB,CAAC,MAAM;g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IAAI,cAAc,KAAK,SAAS,EAAE;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC9C,cAAc,CAAC,cAAc,GAAG;YAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,MAAM;SACN,CAAC;KACF;IAED,OAAO,cAAc,CAAC;AACvB,CAAC;AAtBD,sDAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copyPropertyIfDefined, fail, Mutable, ReplaceRecursive } from './Common';\nimport { convertTreeNodes } from './EditUtilities';\nimport { DetachedSequenceId, isDetachedSequenceId, NodeId } from './Identifiers';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tNodeData,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n\tTreeNode,\n} from './persisted-types';\n\nexport function convertEditIds<IdFrom, IdTo>(\n\tedit: ReplaceRecursive<Edit<ChangeInternal>, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, IdTo>> {\n\tconst changes = edit.changes.map((change): ReplaceRecursive<ChangeInternal, NodeId, IdTo> => {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeTypeInternal.Build:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\tdestination: change.destination,\n\t\t\t\t\tsource: change.source.map((tree) => {\n\t\t\t\t\t\treturn convertTreeNodes<\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdFrom>, IdFrom>,\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdTo>, IdTo>,\n\t\t\t\t\t\t\tDetachedSequenceId\n\t\t\t\t\t\t>(tree, (node) => convertNodeDataIds(node, convert), isDetachedSequenceId);\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Insert:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: change.source,\n\t\t\t\t\tdestination: convertStablePlaceIds(change.destination, convert),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Detach: {\n\t\t\t\tconst detach: ReplaceRecursive<DetachInternal, NodeId, IdTo> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t\tsource: convertStableRangeIds(change.source, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t\tnodeToModify: convert(change.nodeToModify),\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Constraint: {\n\t\t\t\tconst constraint: Mutable<ReplaceRecursive<ConstraintInternal, NodeId, IdTo>> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(change.toConstrain, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tif (change.parentNode !== undefined) {\n\t\t\t\t\tconstraint.parentNode = convert(change.parentNode);\n\t\t\t\t}\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown change type.');\n\t\t}\n\t});\n\tconst newEdit = { id: edit.id, changes };\n\tcopyPropertyIfDefined(edit, newEdit, 'pastAttemptCount');\n\treturn newEdit;\n}\n\nexport function convertNodeDataIds<IdFrom, IdTo>(\n\tnodeData: NodeData<IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): NodeData<IdTo> {\n\tconst identifier = convert(nodeData.identifier);\n\tconst output = { definition: nodeData.definition, identifier };\n\tcopyPropertyIfDefined(nodeData, output, 'payload');\n\treturn output;\n}\n\nexport function convertStableRangeIds<IdFrom, IdTo>(\n\trange: ReplaceRecursive<StableRangeInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StableRangeInternal, NodeId, IdTo> {\n\tconst start = convertStablePlaceIds(range.start, convert);\n\tconst end = convertStablePlaceIds(range.end, convert);\n\treturn { start, end };\n}\n\nexport function convertStablePlaceIds<IdFrom, IdTo>(\n\t{ side, referenceSibling, referenceTrait }: ReplaceRecursive<StablePlaceInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StablePlaceInternal, NodeId, IdTo> {\n\tconst stablePlaceNew: Mutable<ReplaceRecursive<StablePlaceInternal, NodeId, IdTo>> = {\n\t\tside,\n\t};\n\n\tif (referenceSibling !== undefined) {\n\t\tconst nodeId = convert(referenceSibling);\n\t\tstablePlaceNew.referenceSibling = nodeId;\n\t}\n\n\tif (referenceTrait !== undefined) {\n\t\tconst parent = convert(referenceTrait.parent);\n\t\tstablePlaceNew.referenceTrait = {\n\t\t\tlabel: referenceTrait.label,\n\t\t\tparent,\n\t\t};\n\t}\n\n\treturn stablePlaceNew;\n}\n"]}
|
package/dist/Identifiers.d.ts
CHANGED
|
@@ -14,6 +14,20 @@
|
|
|
14
14
|
export declare type UuidString = string & {
|
|
15
15
|
readonly UuidString: '9d40d0ae-90d9-44b1-9482-9f55d59d5465';
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* A version 4, variant 2 uuid (https://datatracker.ietf.org/doc/html/rfc4122).
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare type StableId = UuidString & {
|
|
22
|
+
readonly StableId: '53172b0d-a3d5-41ea-bd75-b43839c97f5a';
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A StableId which is suitable for use as a session identifier
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare type SessionId = StableId & {
|
|
29
|
+
readonly SessionId: '4498f850-e14e-4be9-8db0-89ec00997e58';
|
|
30
|
+
};
|
|
17
31
|
/**
|
|
18
32
|
* Edit identifier
|
|
19
33
|
* @public
|
|
@@ -32,13 +46,81 @@ export declare type EditId = UuidString & {
|
|
|
32
46
|
export declare type DetachedSequenceId = number & {
|
|
33
47
|
readonly DetachedSequenceId: 'f7d7903a-194e-45e7-8e82-c9ef4333577d';
|
|
34
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* An identifier (UUID) that has been shortened by a distributed compression algorithm.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export declare type CompressedId = FinalCompressedId | LocalCompressedId;
|
|
54
|
+
/**
|
|
55
|
+
* The ID of the string that has been interned, which can be used by a {@link StringInterner} to retrieve the original string.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare type InternedStringId = number & {
|
|
59
|
+
readonly InternedStringId: 'e221abc9-9d17-4493-8db0-70c871a1c27c';
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A brand for identity types that are unique within a particular session (SharedTree instance).
|
|
63
|
+
*/
|
|
64
|
+
export interface SessionUnique {
|
|
65
|
+
readonly SessionUnique: 'cea55054-6b82-4cbf-ad19-1fa645ea3b3e';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A compressed ID that has been normalized into "session space" (see `IdCompressor` for more).
|
|
69
|
+
* Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to the
|
|
70
|
+
* compressor that produced them.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare type SessionSpaceCompressedId = CompressedId & SessionUnique;
|
|
74
|
+
/**
|
|
75
|
+
* A compressed ID that has been normalized into "op space" (see `IdCompressor` for more).
|
|
76
|
+
* Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require no normalizing when
|
|
77
|
+
* received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export declare type OpSpaceCompressedId = CompressedId & {
|
|
81
|
+
readonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A compressed ID that is local to a document. Stable across all revisions of a document starting from the one in which it was created.
|
|
85
|
+
* It should not be persisted outside of the history as it can only be decompressed in the context of the originating document.
|
|
86
|
+
* If external persistence is needed (e.g. by a client), a StableId should be used instead.
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export declare type FinalCompressedId = number & {
|
|
90
|
+
readonly FinalCompressedId: '5d83d1e2-98b7-4e4e-a889-54c855cfa73d';
|
|
91
|
+
readonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A compressed ID that is local to a session (can only be decompressed when paired with a SessionId).
|
|
95
|
+
* It should not be persisted outside of the history as it can only be decompressed in the context of the originating session.
|
|
96
|
+
* If external persistence is needed (e.g. by a client), a StableId should be used instead.
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export declare type LocalCompressedId = number & {
|
|
100
|
+
readonly LocalCompressedId: '6fccb42f-e2a4-4243-bd29-f13d12b9c6d1';
|
|
101
|
+
} & SessionUnique;
|
|
102
|
+
export interface NodeIdBrand {
|
|
103
|
+
readonly NodeId: 'e53e7d6b-c8b9-431a-8805-4843fc639342';
|
|
104
|
+
}
|
|
35
105
|
/**
|
|
36
106
|
* Node identifier.
|
|
37
107
|
* Identifies a node within a document.
|
|
38
108
|
* @public
|
|
39
109
|
*/
|
|
40
|
-
export declare type NodeId =
|
|
41
|
-
|
|
110
|
+
export declare type NodeId = number & SessionSpaceCompressedId & NodeIdBrand;
|
|
111
|
+
export declare type FinalNodeId = FinalCompressedId & NodeIdBrand;
|
|
112
|
+
/**
|
|
113
|
+
* A Node identifier which is persisted by SharedTree internals. Not usable as a {@link NodeId}.
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
export declare type OpSpaceNodeId = number & OpSpaceCompressedId & NodeIdBrand;
|
|
117
|
+
/**
|
|
118
|
+
* Globally unique node identifier.
|
|
119
|
+
* Uniquely identifies a node within and across documents. Can be used across SharedTree instances.
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
export declare type StableNodeId = string & {
|
|
123
|
+
readonly StableNodeId: 'a0843b38-699d-4bb2-aa7a-16c502a71151';
|
|
42
124
|
};
|
|
43
125
|
/**
|
|
44
126
|
* Definition.
|
|
@@ -56,4 +138,9 @@ export declare type Definition = UuidString & {
|
|
|
56
138
|
export declare type TraitLabel = UuidString & {
|
|
57
139
|
readonly TraitLabel: '613826ed-49cc-4df3-b2b8-bfc6866af8e3';
|
|
58
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Determine if a node is a DetachedSequenceId.
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
export declare function isDetachedSequenceId(node: DetachedSequenceId | object): node is DetachedSequenceId;
|
|
59
146
|
//# sourceMappingURL=Identifiers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identifiers.d.ts","sourceRoot":"","sources":["../src/Identifiers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,oBAAY,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,sCAAsC,CAAA;CAAE,CAAC;AAElG;;;GAGG;AACH,oBAAY,MAAM,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,sCAAsC,CAAA;CAAE,CAAC;AAE9F;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AC,YAAY,EAAE,sCAAsC,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,iBAAiB,GAAG,MAAM,GAAG;IACxC,QAAQ,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;IAGnE,QAAQ,CAAC,YAAY,EAAE,sCAAsC,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,iBAAiB,GAAG,MAAM,GAAG;IACxC,QAAQ,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;CACnE,GAAG,aAAa,CAAC;AAElB,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,MAAM,EAAE,sCAAsC,CAAC;CACxD;AAED;;;;GAIG;AACH,oBAAY,MAAM,GAAG,MAAM,GAAG,wBAAwB,GAAG,WAAW,CAAC;AAErE,oBAAY,WAAW,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAE1D;;;GAGG;AACH,oBAAY,aAAa,GAAG,MAAM,GAAG,mBAAmB,GAAG,WAAW,CAAC;AAEvE;;;;GAIG;AACH,oBAAY,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,sCAAsC,CAAA;CAAE,CAAC;AAEtG;;;;GAIG;AACH,oBAAY,UAAU,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,sCAAsC,CAAA;CAAE,CAAC;AAEtG;;;;GAIG;AACH,oBAAY,UAAU,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,sCAAsC,CAAA;CAAE,CAAC;AAEtG;;;GAGG;AAEH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,IAAI,kBAAkB,CAElG"}
|
package/dist/Identifiers.js
CHANGED
|
@@ -4,4 +4,14 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.isDetachedSequenceId = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Determine if a node is a DetachedSequenceId.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
// Nodes can be an `object` type which is a banned type.
|
|
13
|
+
function isDetachedSequenceId(node) {
|
|
14
|
+
return typeof node !== 'object';
|
|
15
|
+
}
|
|
16
|
+
exports.isDetachedSequenceId = isDetachedSequenceId;
|
|
7
17
|
//# sourceMappingURL=Identifiers.js.map
|
package/dist/Identifiers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identifiers.js","sourceRoot":"","sources":["../src/Identifiers.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Type-safe identifiers for specific use cases.\n */\n\n/**\n * A 128-bit Universally Unique IDentifier. Represented here\n * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,\n * where x is a lowercase hex digit.\n * @public\n */\nexport type UuidString = string & { readonly UuidString: '9d40d0ae-90d9-44b1-9482-9f55d59d5465' };\n\n/**\n * Edit identifier\n * @public\n */\nexport type EditId = UuidString & { readonly EditId: '56897beb-53e4-4e66-85da-4bf5cd5d0d49' };\n\n/**\n * Scoped to a single edit: identifies a sequences of nodes that can be moved into a trait.\n *\n * Within a given Edit, any DetachedSequenceId must be a source at most once, and a destination at most once.\n * If used as a source, it must be after it is used as a destination.\n * If this is violated, the Edit is considered malformed.\n * @public\n */\nexport type DetachedSequenceId = number & { readonly DetachedSequenceId: 'f7d7903a-194e-45e7-8e82-c9ef4333577d' };\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"Identifiers.js","sourceRoot":"","sources":["../src/Identifiers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA8IH;;;GAGG;AACH,wDAAwD;AACxD,SAAgB,oBAAoB,CAAC,IAAiC;IACrE,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AACjC,CAAC;AAFD,oDAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Type-safe identifiers for specific use cases.\n */\n\n/**\n * A 128-bit Universally Unique IDentifier. Represented here\n * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,\n * where x is a lowercase hex digit.\n * @public\n */\nexport type UuidString = string & { readonly UuidString: '9d40d0ae-90d9-44b1-9482-9f55d59d5465' };\n\n/**\n * A version 4, variant 2 uuid (https://datatracker.ietf.org/doc/html/rfc4122).\n * @internal\n */\nexport type StableId = UuidString & { readonly StableId: '53172b0d-a3d5-41ea-bd75-b43839c97f5a' };\n\n/**\n * A StableId which is suitable for use as a session identifier\n * @internal\n */\nexport type SessionId = StableId & { readonly SessionId: '4498f850-e14e-4be9-8db0-89ec00997e58' };\n\n/**\n * Edit identifier\n * @public\n */\nexport type EditId = UuidString & { readonly EditId: '56897beb-53e4-4e66-85da-4bf5cd5d0d49' };\n\n/**\n * Scoped to a single edit: identifies a sequences of nodes that can be moved into a trait.\n *\n * Within a given Edit, any DetachedSequenceId must be a source at most once, and a destination at most once.\n * If used as a source, it must be after it is used as a destination.\n * If this is violated, the Edit is considered malformed.\n * @public\n */\nexport type DetachedSequenceId = number & { readonly DetachedSequenceId: 'f7d7903a-194e-45e7-8e82-c9ef4333577d' };\n\n/**\n * An identifier (UUID) that has been shortened by a distributed compression algorithm.\n * @public\n */\nexport type CompressedId = FinalCompressedId | LocalCompressedId;\n\n/**\n * The ID of the string that has been interned, which can be used by a {@link StringInterner} to retrieve the original string.\n * @public\n */\nexport type InternedStringId = number & { readonly InternedStringId: 'e221abc9-9d17-4493-8db0-70c871a1c27c' };\n\n/**\n * A brand for identity types that are unique within a particular session (SharedTree instance).\n */\nexport interface SessionUnique {\n\treadonly SessionUnique: 'cea55054-6b82-4cbf-ad19-1fa645ea3b3e';\n}\n\n/**\n * A compressed ID that has been normalized into \"session space\" (see `IdCompressor` for more).\n * Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to the\n * compressor that produced them.\n * @public\n */\nexport type SessionSpaceCompressedId = CompressedId & SessionUnique;\n\n/**\n * A compressed ID that has been normalized into \"op space\" (see `IdCompressor` for more).\n * Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require no normalizing when\n * received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.\n * @internal\n */\nexport type OpSpaceCompressedId = CompressedId & {\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a document. Stable across all revisions of a document starting from the one in which it was created.\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating document.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @public\n */\nexport type FinalCompressedId = number & {\n\treadonly FinalCompressedId: '5d83d1e2-98b7-4e4e-a889-54c855cfa73d';\n\n\t// Same brand as OpNormalizedCompressedId, as final IDs are always finally normalized\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a session (can only be decompressed when paired with a SessionId).\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating session.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @public\n */\nexport type LocalCompressedId = number & {\n\treadonly LocalCompressedId: '6fccb42f-e2a4-4243-bd29-f13d12b9c6d1';\n} & SessionUnique; // Same brand as CompressedId, as local IDs are always locally normalized\n\nexport interface NodeIdBrand {\n\treadonly NodeId: 'e53e7d6b-c8b9-431a-8805-4843fc639342';\n}\n\n/**\n * Node identifier.\n * Identifies a node within a document.\n * @public\n */\nexport type NodeId = number & SessionSpaceCompressedId & NodeIdBrand;\n\nexport type FinalNodeId = FinalCompressedId & NodeIdBrand;\n\n/**\n * A Node identifier which is persisted by SharedTree internals. Not usable as a {@link NodeId}.\n * @internal\n */\nexport type OpSpaceNodeId = number & OpSpaceCompressedId & NodeIdBrand;\n\n/**\n * Globally unique node identifier.\n * Uniquely identifies a node within and across documents. Can be used across SharedTree instances.\n * @public\n */\nexport type StableNodeId = string & { readonly StableNodeId: 'a0843b38-699d-4bb2-aa7a-16c502a71151' };\n\n/**\n * Definition.\n * A full (Uuid) persistable definition.\n * @public\n */\nexport type Definition = UuidString & { readonly Definition: 'c0ef9488-2a78-482d-aeed-37fba996354c' };\n\n/**\n * Definition.\n * A full (Uuid) persistable label for a trait.\n * @public\n */\nexport type TraitLabel = UuidString & { readonly TraitLabel: '613826ed-49cc-4df3-b2b8-bfc6866af8e3' };\n\n/**\n * Determine if a node is a DetachedSequenceId.\n * @internal\n */\n// Nodes can be an `object` type which is a banned type.\nexport function isDetachedSequenceId(node: DetachedSequenceId | object): node is DetachedSequenceId {\n\treturn typeof node !== 'object';\n}\n"]}
|
package/dist/InitialTree.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { ChangeNode_0_0_2 } from './persisted-types';
|
|
6
6
|
/**
|
|
7
7
|
* The initial tree.
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export declare const initialTree:
|
|
10
|
+
export declare const initialTree: ChangeNode_0_0_2;
|
|
11
11
|
//# sourceMappingURL=InitialTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialTree.d.ts","sourceRoot":"","sources":["../src/InitialTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"InitialTree.d.ts","sourceRoot":"","sources":["../src/InitialTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,gBAIzB,CAAC"}
|
package/dist/InitialTree.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.initialTree = void 0;
|
|
8
|
+
const id_compressor_1 = require("./id-compressor");
|
|
8
9
|
/**
|
|
9
10
|
* The initial tree.
|
|
10
11
|
* @public
|
|
@@ -12,6 +13,6 @@ exports.initialTree = void 0;
|
|
|
12
13
|
exports.initialTree = {
|
|
13
14
|
traits: {},
|
|
14
15
|
definition: '51c58718-47b9-4fe4-ad46-56312f3b9e86',
|
|
15
|
-
identifier:
|
|
16
|
+
identifier: id_compressor_1.legacySharedTreeInitialTreeId,
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=InitialTree.js.map
|
package/dist/InitialTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialTree.js","sourceRoot":"","sources":["../src/InitialTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"InitialTree.js","sourceRoot":"","sources":["../src/InitialTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mDAAgE;AAGhE;;;GAGG;AACU,QAAA,WAAW,GAAqB;IAC5C,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,sCAAoD;IAChE,UAAU,EAAE,6CAA6C;CACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Definition, StableNodeId } from './Identifiers';\nimport { legacySharedTreeInitialTreeId } from './id-compressor';\nimport { ChangeNode_0_0_2 } from './persisted-types';\n\n/**\n * The initial tree.\n * @public\n */\nexport const initialTree: ChangeNode_0_0_2 = {\n\ttraits: {},\n\tdefinition: '51c58718-47b9-4fe4-ad46-56312f3b9e86' as Definition,\n\tidentifier: legacySharedTreeInitialTreeId as StableNodeId,\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { Checkout } from './Checkout';
|
|
6
|
+
import { EditId } from './Identifiers';
|
|
7
|
+
import { RevisionView } from './RevisionView';
|
|
8
|
+
import { SharedTree } from './SharedTree';
|
|
9
|
+
import { ValidEditingResult } from './TransactionInternal';
|
|
10
|
+
/**
|
|
11
|
+
* Checkout that only updates its view of the tree when explicitly requested.
|
|
12
|
+
* This means that the {@link Checkout.currentView} field will never change unless {@link LazyCheckout.waitForPendingUpdates} is called.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @sealed
|
|
16
|
+
*/
|
|
17
|
+
export declare class LazyCheckout extends Checkout {
|
|
18
|
+
private latestView;
|
|
19
|
+
/**
|
|
20
|
+
* @param tree - the tree
|
|
21
|
+
*/
|
|
22
|
+
constructor(tree: SharedTree);
|
|
23
|
+
protected handleNewEdit(id: EditId, result: ValidEditingResult): void;
|
|
24
|
+
protected get latestCommittedView(): RevisionView;
|
|
25
|
+
waitForPendingUpdates(): Promise<void>;
|
|
26
|
+
waitForEditsToSubmit(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=LazyCheckout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyCheckout.d.ts","sourceRoot":"","sources":["../src/LazyCheckout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAA+B,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,QAAQ;IACzC,OAAO,CAAC,UAAU,CAAe;IAEjC;;OAEG;gBACgB,IAAI,EAAE,UAAU;IAKnC,SAAS,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAKrE,SAAS,KAAK,mBAAmB,IAAI,YAAY,CAEhD;IAEY,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlD"}
|