@fluid-experimental/tree 0.58.2001 → 0.59.2000-61729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -46
- package/dist/ChangeCompression.d.ts +39 -0
- package/dist/ChangeCompression.d.ts.map +1 -0
- package/dist/ChangeCompression.js +117 -0
- package/dist/ChangeCompression.js.map +1 -0
- package/{lib/default-edits/PersistedTypes.d.ts → dist/ChangeTypes.d.ts} +58 -105
- package/dist/ChangeTypes.d.ts.map +1 -0
- package/dist/{default-edits/PersistedTypes.js → ChangeTypes.js} +21 -76
- package/dist/ChangeTypes.js.map +1 -0
- package/dist/Checkout.d.ts +39 -27
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +61 -32
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +175 -38
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +240 -103
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +24 -0
- package/dist/EagerCheckout.d.ts.map +1 -0
- package/dist/{BasicCheckout.js → EagerCheckout.js} +9 -6
- package/dist/EagerCheckout.js.map +1 -0
- package/dist/EditLog.d.ts +77 -63
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +85 -48
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +168 -0
- package/dist/EditUtilities.d.ts.map +1 -0
- package/dist/EditUtilities.js +373 -0
- package/dist/EditUtilities.js.map +1 -0
- package/dist/EventTypes.d.ts +73 -0
- package/dist/EventTypes.d.ts.map +1 -0
- package/dist/EventTypes.js +78 -0
- package/dist/EventTypes.js.map +1 -0
- package/dist/Forest.d.ts +29 -7
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +60 -36
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +20 -0
- package/dist/HistoryEditFactory.d.ts.map +1 -0
- package/dist/HistoryEditFactory.js +226 -0
- package/dist/HistoryEditFactory.js.map +1 -0
- package/dist/IdConversion.d.ts +12 -0
- package/dist/IdConversion.d.ts.map +1 -0
- package/dist/IdConversion.js +98 -0
- package/dist/IdConversion.js.map +1 -0
- package/dist/Identifiers.d.ts +89 -2
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js +10 -0
- package/dist/Identifiers.js.map +1 -1
- package/dist/InitialTree.d.ts +2 -2
- package/dist/InitialTree.d.ts.map +1 -1
- package/dist/InitialTree.js +2 -1
- package/dist/InitialTree.js.map +1 -1
- package/dist/LazyCheckout.d.ts +28 -0
- package/dist/LazyCheckout.d.ts.map +1 -0
- package/dist/LazyCheckout.js +44 -0
- package/dist/LazyCheckout.js.map +1 -0
- package/dist/LogViewer.d.ts +129 -85
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +111 -85
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts +221 -0
- package/dist/MergeHealth.d.ts.map +1 -0
- package/dist/MergeHealth.js +263 -0
- package/dist/MergeHealth.js.map +1 -0
- package/dist/NodeIdUtilities.d.ts +105 -0
- package/dist/NodeIdUtilities.d.ts.map +1 -0
- package/dist/NodeIdUtilities.js +60 -0
- package/dist/NodeIdUtilities.js.map +1 -0
- package/dist/PayloadUtilities.d.ts +42 -0
- package/dist/PayloadUtilities.d.ts.map +1 -0
- package/dist/PayloadUtilities.js +114 -0
- package/dist/PayloadUtilities.js.map +1 -0
- package/dist/ReconciliationPath.d.ts +18 -13
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +11 -2
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -3
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +83 -0
- package/dist/RevisionView.d.ts.map +1 -0
- package/dist/RevisionView.js +182 -0
- package/dist/RevisionView.js.map +1 -0
- package/dist/SerializationUtilities.d.ts +36 -0
- package/dist/SerializationUtilities.d.ts.map +1 -0
- package/dist/SerializationUtilities.js +102 -0
- package/dist/SerializationUtilities.js.map +1 -0
- package/dist/SharedTree.d.ts +439 -0
- package/dist/SharedTree.d.ts.map +1 -0
- package/dist/SharedTree.js +1109 -0
- package/dist/SharedTree.js.map +1 -0
- package/dist/SharedTreeEncoder.d.ts +102 -0
- package/dist/SharedTreeEncoder.d.ts.map +1 -0
- package/dist/SharedTreeEncoder.js +313 -0
- package/dist/SharedTreeEncoder.js.map +1 -0
- package/dist/StringInterner.d.ts +46 -0
- package/dist/StringInterner.d.ts.map +1 -0
- package/dist/StringInterner.js +61 -0
- package/dist/StringInterner.js.map +1 -0
- package/dist/Summary.d.ts +40 -0
- package/dist/Summary.d.ts.map +1 -0
- package/dist/Summary.js +23 -0
- package/dist/Summary.js.map +1 -0
- package/dist/SummaryBackCompatibility.d.ts +22 -22
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js +30 -33
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +31 -0
- package/dist/SummaryTestUtilities.d.ts.map +1 -0
- package/dist/SummaryTestUtilities.js +37 -0
- package/dist/SummaryTestUtilities.js.map +1 -0
- package/dist/Transaction.d.ts +71 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +92 -0
- package/dist/Transaction.js.map +1 -0
- package/dist/TransactionInternal.d.ts +540 -0
- package/dist/TransactionInternal.d.ts.map +1 -0
- package/dist/TransactionInternal.js +626 -0
- package/dist/TransactionInternal.js.map +1 -0
- package/dist/TreeCompressor.d.ts +36 -0
- package/dist/TreeCompressor.d.ts.map +1 -0
- package/dist/TreeCompressor.js +137 -0
- package/dist/TreeCompressor.js.map +1 -0
- package/dist/TreeNodeHandle.d.ts +12 -18
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js +13 -23
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +166 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +218 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/TreeViewUtilities.d.ts +21 -0
- package/dist/TreeViewUtilities.d.ts.map +1 -0
- package/dist/TreeViewUtilities.js +77 -0
- package/dist/TreeViewUtilities.js.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/dist/UndoRedoHandler.d.ts.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +5 -9
- package/dist/UndoRedoHandler.js.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.js +283 -0
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/dist/id-compressor/IdCompressor.d.ts +389 -0
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -0
- package/dist/id-compressor/IdCompressor.js +1353 -0
- package/dist/id-compressor/IdCompressor.js.map +1 -0
- package/dist/id-compressor/IdRange.d.ts +11 -0
- package/dist/id-compressor/IdRange.d.ts.map +1 -0
- package/dist/id-compressor/IdRange.js +29 -0
- package/dist/id-compressor/IdRange.js.map +1 -0
- package/dist/id-compressor/NumericUuid.d.ts +63 -0
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -0
- package/dist/id-compressor/NumericUuid.js +377 -0
- package/dist/id-compressor/NumericUuid.js.map +1 -0
- package/dist/id-compressor/index.d.ts +12 -0
- package/dist/id-compressor/index.d.ts.map +1 -0
- package/dist/id-compressor/index.js +26 -0
- package/dist/id-compressor/index.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/dist/id-compressor/persisted-types/index.d.ts +6 -0
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/index.js +18 -0
- package/dist/id-compressor/persisted-types/index.js.map +1 -0
- package/dist/index.d.ts +29 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +385 -0
- package/dist/persisted-types/0.0.2.d.ts.map +1 -0
- package/dist/persisted-types/0.0.2.js +113 -0
- package/dist/persisted-types/0.0.2.js.map +1 -0
- package/dist/persisted-types/0.1.1.d.ts +314 -0
- package/dist/persisted-types/0.1.1.d.ts.map +1 -0
- package/dist/persisted-types/0.1.1.js +153 -0
- package/dist/persisted-types/0.1.1.js.map +1 -0
- package/dist/persisted-types/index.d.ts +7 -0
- package/dist/persisted-types/index.d.ts.map +1 -0
- package/dist/persisted-types/index.js +20 -0
- package/dist/persisted-types/index.js.map +1 -0
- package/docs/0-1-1-Compression.md +228 -0
- package/docs/Breaking-Change-Migration.md +52 -0
- package/docs/Compression.md +2 -2
- package/docs/Telemetry.md +43 -0
- package/docs/Write-Format.md +19 -0
- package/lib/ChangeCompression.d.ts +39 -0
- package/lib/ChangeCompression.d.ts.map +1 -0
- package/lib/ChangeCompression.js +111 -0
- package/lib/ChangeCompression.js.map +1 -0
- package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -105
- package/lib/ChangeTypes.d.ts.map +1 -0
- package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
- package/lib/ChangeTypes.js.map +1 -0
- package/lib/Checkout.d.ts +39 -27
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +53 -24
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +175 -38
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +226 -101
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +24 -0
- package/lib/EagerCheckout.d.ts.map +1 -0
- package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
- package/lib/EagerCheckout.js.map +1 -0
- package/lib/EditLog.d.ts +77 -63
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +83 -47
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +168 -0
- package/lib/EditUtilities.d.ts.map +1 -0
- package/lib/EditUtilities.js +353 -0
- package/lib/EditUtilities.js.map +1 -0
- package/lib/EventTypes.d.ts +73 -0
- package/lib/EventTypes.d.ts.map +1 -0
- package/lib/EventTypes.js +75 -0
- package/lib/EventTypes.js.map +1 -0
- package/lib/Forest.d.ts +29 -7
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +58 -35
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +20 -0
- package/lib/HistoryEditFactory.d.ts.map +1 -0
- package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
- package/lib/HistoryEditFactory.js.map +1 -0
- package/lib/IdConversion.d.ts +12 -0
- package/lib/IdConversion.d.ts.map +1 -0
- package/lib/IdConversion.js +91 -0
- package/lib/IdConversion.js.map +1 -0
- package/lib/Identifiers.d.ts +89 -2
- package/lib/Identifiers.d.ts.map +1 -1
- package/lib/Identifiers.js +8 -1
- package/lib/Identifiers.js.map +1 -1
- package/lib/InitialTree.d.ts +2 -2
- package/lib/InitialTree.d.ts.map +1 -1
- package/lib/InitialTree.js +2 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LazyCheckout.d.ts +28 -0
- package/lib/LazyCheckout.d.ts.map +1 -0
- package/lib/LazyCheckout.js +40 -0
- package/lib/LazyCheckout.js.map +1 -0
- package/lib/LogViewer.d.ts +129 -85
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +103 -77
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts +221 -0
- package/lib/MergeHealth.d.ts.map +1 -0
- package/lib/MergeHealth.js +258 -0
- package/lib/MergeHealth.js.map +1 -0
- package/lib/NodeIdUtilities.d.ts +105 -0
- package/lib/NodeIdUtilities.d.ts.map +1 -0
- package/lib/NodeIdUtilities.js +53 -0
- package/lib/NodeIdUtilities.js.map +1 -0
- package/lib/PayloadUtilities.d.ts +42 -0
- package/lib/PayloadUtilities.d.ts.map +1 -0
- package/lib/PayloadUtilities.js +110 -0
- package/lib/PayloadUtilities.js.map +1 -0
- package/lib/ReconciliationPath.d.ts +18 -13
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +11 -2
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -3
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +83 -0
- package/lib/RevisionView.d.ts.map +1 -0
- package/lib/RevisionView.js +175 -0
- package/lib/RevisionView.js.map +1 -0
- package/lib/SerializationUtilities.d.ts +36 -0
- package/lib/SerializationUtilities.d.ts.map +1 -0
- package/lib/SerializationUtilities.js +95 -0
- package/lib/SerializationUtilities.js.map +1 -0
- package/lib/SharedTree.d.ts +439 -0
- package/lib/SharedTree.d.ts.map +1 -0
- package/lib/SharedTree.js +1104 -0
- package/lib/SharedTree.js.map +1 -0
- package/lib/SharedTreeEncoder.d.ts +102 -0
- package/lib/SharedTreeEncoder.d.ts.map +1 -0
- package/lib/SharedTreeEncoder.js +308 -0
- package/lib/SharedTreeEncoder.js.map +1 -0
- package/lib/StringInterner.d.ts +46 -0
- package/lib/StringInterner.d.ts.map +1 -0
- package/lib/StringInterner.js +57 -0
- package/lib/StringInterner.js.map +1 -0
- package/lib/Summary.d.ts +40 -0
- package/lib/Summary.d.ts.map +1 -0
- package/lib/Summary.js +19 -0
- package/lib/Summary.js.map +1 -0
- package/lib/SummaryBackCompatibility.d.ts +22 -22
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js +29 -32
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +31 -0
- package/lib/SummaryTestUtilities.d.ts.map +1 -0
- package/lib/SummaryTestUtilities.js +32 -0
- package/lib/SummaryTestUtilities.js.map +1 -0
- package/lib/Transaction.d.ts +71 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +88 -0
- package/lib/Transaction.js.map +1 -0
- package/lib/TransactionInternal.d.ts +540 -0
- package/lib/TransactionInternal.d.ts.map +1 -0
- package/lib/TransactionInternal.js +622 -0
- package/lib/TransactionInternal.js.map +1 -0
- package/lib/TreeCompressor.d.ts +36 -0
- package/lib/TreeCompressor.d.ts.map +1 -0
- package/lib/TreeCompressor.js +133 -0
- package/lib/TreeCompressor.js.map +1 -0
- package/lib/TreeNodeHandle.d.ts +12 -18
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js +14 -24
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +166 -0
- package/lib/TreeView.d.ts.map +1 -0
- package/lib/TreeView.js +214 -0
- package/lib/TreeView.js.map +1 -0
- package/lib/TreeViewUtilities.d.ts +21 -0
- package/lib/TreeViewUtilities.d.ts.map +1 -0
- package/lib/TreeViewUtilities.js +71 -0
- package/lib/TreeViewUtilities.js.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/lib/UndoRedoHandler.d.ts.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
- package/lib/UndoRedoHandler.js.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/lib/id-compressor/IdCompressor.d.ts +389 -0
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
- package/lib/id-compressor/IdCompressor.js +1343 -0
- package/lib/id-compressor/IdCompressor.js.map +1 -0
- package/lib/id-compressor/IdRange.d.ts +11 -0
- package/lib/id-compressor/IdRange.d.ts.map +1 -0
- package/lib/id-compressor/IdRange.js +25 -0
- package/lib/id-compressor/IdRange.js.map +1 -0
- package/lib/id-compressor/NumericUuid.d.ts +63 -0
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
- package/lib/id-compressor/NumericUuid.js +365 -0
- package/lib/id-compressor/NumericUuid.js.map +1 -0
- package/lib/id-compressor/index.d.ts +12 -0
- package/lib/id-compressor/index.d.ts.map +1 -0
- package/lib/id-compressor/index.js +12 -0
- package/lib/id-compressor/index.js.map +1 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/lib/id-compressor/persisted-types/index.d.ts +6 -0
- package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/lib/id-compressor/persisted-types/index.js +6 -0
- package/lib/id-compressor/persisted-types/index.js.map +1 -0
- package/lib/index.d.ts +29 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +23 -6
- package/lib/index.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +385 -0
- package/lib/persisted-types/0.0.2.d.ts.map +1 -0
- package/lib/persisted-types/0.0.2.js +110 -0
- package/lib/persisted-types/0.0.2.js.map +1 -0
- package/lib/persisted-types/0.1.1.d.ts +314 -0
- package/lib/persisted-types/0.1.1.d.ts.map +1 -0
- package/lib/persisted-types/0.1.1.js +150 -0
- package/lib/persisted-types/0.1.1.js.map +1 -0
- package/lib/persisted-types/index.d.ts +7 -0
- package/lib/persisted-types/index.d.ts.map +1 -0
- package/lib/persisted-types/index.js +8 -0
- package/lib/persisted-types/index.js.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.js +169 -0
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
- package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
- package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
- package/lib/test/ChangeCompression.tests.js +145 -0
- package/lib/test/ChangeCompression.tests.js.map +1 -0
- package/lib/test/Checkout.tests.d.ts +2 -3
- package/lib/test/Checkout.tests.d.ts.map +1 -1
- package/lib/test/Checkout.tests.js +126 -69
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Common.tests.js +60 -2
- package/lib/test/Common.tests.js.map +1 -1
- package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
- package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
- package/lib/test/EagerCheckout.tests.js +20 -0
- package/lib/test/EagerCheckout.tests.js.map +1 -0
- package/lib/test/Edit.tests.js +22 -14
- package/lib/test/Edit.tests.js.map +1 -1
- package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
- package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
- package/lib/test/EditLog.perf.tests.js +30 -0
- package/lib/test/EditLog.perf.tests.js.map +1 -0
- package/lib/test/EditLog.tests.js +10 -6
- package/lib/test/EditLog.tests.js.map +1 -1
- package/lib/test/EditUtilities.tests.d.ts +6 -0
- package/lib/test/EditUtilities.tests.d.ts.map +1 -0
- package/lib/test/EditUtilities.tests.js +503 -0
- package/lib/test/EditUtilities.tests.js.map +1 -0
- package/lib/test/Forest.perf.tests.d.ts +6 -0
- package/lib/test/Forest.perf.tests.d.ts.map +1 -0
- package/lib/test/Forest.perf.tests.js +133 -0
- package/lib/test/Forest.perf.tests.js.map +1 -0
- package/lib/test/Forest.tests.js +54 -27
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/GenericTransaction.tests.js +12 -3
- package/lib/test/GenericTransaction.tests.js.map +1 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
- package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
- package/lib/test/HistoryEditFactory.tests.js +90 -0
- package/lib/test/HistoryEditFactory.tests.js.map +1 -0
- package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
- package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.perf.tests.js +304 -0
- package/lib/test/IdCompressor.perf.tests.js.map +1 -0
- package/lib/test/IdCompressor.tests.d.ts +6 -0
- package/lib/test/IdCompressor.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.tests.js +1075 -0
- package/lib/test/IdCompressor.tests.js.map +1 -0
- package/lib/test/IdConversion.tests.d.ts +6 -0
- package/lib/test/IdConversion.tests.d.ts.map +1 -0
- package/lib/test/IdConversion.tests.js +36 -0
- package/lib/test/IdConversion.tests.js.map +1 -0
- package/lib/test/LazyCheckout.tests.d.ts +6 -0
- package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
- package/lib/test/LazyCheckout.tests.js +22 -0
- package/lib/test/LazyCheckout.tests.js.map +1 -0
- package/lib/test/LogViewer.tests.js +276 -191
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
- package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
- package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.perf.tests.js +68 -0
- package/lib/test/NumericUuid.perf.tests.js.map +1 -0
- package/lib/test/NumericUuid.tests.d.ts +6 -0
- package/lib/test/NumericUuid.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.tests.js +191 -0
- package/lib/test/NumericUuid.tests.js.map +1 -0
- package/lib/test/RevisionView.tests.d.ts +6 -0
- package/lib/test/RevisionView.tests.d.ts.map +1 -0
- package/lib/test/RevisionView.tests.js +133 -0
- package/lib/test/RevisionView.tests.js.map +1 -0
- package/lib/test/SharedTree.perf.tests.d.ts +6 -0
- package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
- package/lib/test/SharedTree.perf.tests.js +39 -0
- package/lib/test/SharedTree.perf.tests.js.map +1 -0
- package/lib/test/SharedTree.tests.js +15 -3
- package/lib/test/SharedTree.tests.js.map +1 -1
- package/lib/test/StringInterner.tests.d.ts +6 -0
- package/lib/test/StringInterner.tests.d.ts.map +1 -0
- package/lib/test/StringInterner.tests.js +71 -0
- package/lib/test/StringInterner.tests.js.map +1 -0
- package/lib/test/Summary.tests.d.ts +8 -0
- package/lib/test/Summary.tests.d.ts.map +1 -0
- package/lib/test/Summary.tests.js +407 -0
- package/lib/test/Summary.tests.js.map +1 -0
- package/lib/test/Transaction.tests.js +109 -329
- package/lib/test/Transaction.tests.js.map +1 -1
- package/lib/test/TransactionInternal.tests.d.ts +6 -0
- package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
- package/lib/test/TransactionInternal.tests.js +568 -0
- package/lib/test/TransactionInternal.tests.js.map +1 -0
- package/lib/test/TreeCompression.tests.d.ts +6 -0
- package/lib/test/TreeCompression.tests.d.ts.map +1 -0
- package/lib/test/TreeCompression.tests.js +292 -0
- package/lib/test/TreeCompression.tests.js.map +1 -0
- package/lib/test/TreeView.tests.d.ts +6 -0
- package/lib/test/TreeView.tests.d.ts.map +1 -0
- package/lib/test/TreeView.tests.js +176 -0
- package/lib/test/TreeView.tests.js.map +1 -0
- package/lib/test/UndoRedoHandler.tests.js +2 -2
- package/lib/test/UndoRedoHandler.tests.js.map +1 -1
- package/lib/test/Virtualization.tests.js +146 -62
- package/lib/test/Virtualization.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +19 -0
- package/lib/test/fuzz/Generators.d.ts.map +1 -0
- package/lib/test/fuzz/Generators.js +420 -0
- package/lib/test/fuzz/Generators.js.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js +217 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
- package/lib/test/fuzz/Types.d.ts +133 -0
- package/lib/test/fuzz/Types.d.ts.map +1 -0
- package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
- package/lib/test/fuzz/Types.js.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
- package/lib/test/utilities/MockTransaction.d.ts +26 -7
- package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
- package/lib/test/utilities/MockTransaction.js +40 -11
- package/lib/test/utilities/MockTransaction.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
- package/lib/test/utilities/PendingLocalStateTests.js +105 -0
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
- package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +696 -439
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js +370 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
- package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
- package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
- package/lib/test/utilities/SummarySizeTests.js +158 -0
- package/lib/test/utilities/SummarySizeTests.js.map +1 -0
- package/lib/test/utilities/TestCommon.d.ts +9 -0
- package/lib/test/utilities/TestCommon.d.ts.map +1 -0
- package/lib/test/utilities/TestCommon.js +13 -0
- package/lib/test/utilities/TestCommon.js.map +1 -0
- package/lib/test/utilities/TestNode.d.ts +140 -0
- package/lib/test/utilities/TestNode.d.ts.map +1 -0
- package/lib/test/utilities/TestNode.js +292 -0
- package/lib/test/utilities/TestNode.js.map +1 -0
- package/lib/test/utilities/TestUtilities.d.ts +84 -70
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +218 -143
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
- package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
- package/lib/test/utilities/UndoRedoTests.js +138 -149
- package/lib/test/utilities/UndoRedoTests.js.map +1 -1
- package/package.json +22 -17
- package/src/ChangeCompression.ts +159 -0
- package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -125
- package/src/Checkout.ts +82 -53
- package/src/Common.ts +317 -117
- package/src/EagerCheckout.ts +38 -0
- package/src/EditLog.ts +153 -100
- package/src/EditUtilities.ts +559 -0
- package/src/EventTypes.ts +74 -0
- package/src/Forest.ts +81 -73
- package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
- package/src/IdConversion.ts +125 -0
- package/src/Identifiers.ts +101 -1
- package/src/InitialTree.ts +5 -4
- package/src/LazyCheckout.ts +51 -0
- package/src/LogViewer.ts +242 -166
- package/src/MergeHealth.ts +447 -0
- package/src/NodeIdUtilities.ts +156 -0
- package/src/PayloadUtilities.ts +124 -0
- package/src/ReconciliationPath.ts +18 -13
- package/src/RevisionValueCache.ts +14 -5
- package/src/RevisionView.ts +252 -0
- package/src/SerializationUtilities.ts +130 -0
- package/src/SharedTree.ts +1501 -0
- package/src/SharedTreeEncoder.ts +493 -0
- package/src/StringInterner.ts +72 -0
- package/src/Summary.ts +48 -0
- package/src/SummaryBackCompatibility.ts +47 -57
- package/src/SummaryTestUtilities.ts +54 -0
- package/src/Transaction.ts +120 -0
- package/src/TransactionInternal.ts +1087 -0
- package/src/TreeCompressor.ts +213 -0
- package/src/TreeNodeHandle.ts +19 -32
- package/src/TreeView.ts +322 -0
- package/src/TreeViewUtilities.ts +77 -0
- package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
- package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
- package/src/id-compressor/IdCompressor.md +3 -0
- package/src/id-compressor/IdCompressor.ts +1848 -0
- package/src/id-compressor/IdRange.ts +33 -0
- package/src/id-compressor/NumericUuid.ts +414 -0
- package/src/id-compressor/index.ts +13 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
- package/src/id-compressor/persisted-types/README.md +3 -0
- package/src/id-compressor/persisted-types/index.ts +6 -0
- package/src/index.ts +118 -59
- package/src/persisted-types/0.0.2.ts +442 -0
- package/src/persisted-types/0.1.1.ts +476 -0
- package/src/persisted-types/README.md +22 -0
- package/src/persisted-types/index.ts +9 -0
- package/.mocharc.js +0 -41
- package/api/tree.api.md +0 -729
- package/dist/BasicCheckout.d.ts +0 -23
- package/dist/BasicCheckout.d.ts.map +0 -1
- package/dist/BasicCheckout.js.map +0 -1
- package/dist/Snapshot.d.ts +0 -198
- package/dist/Snapshot.d.ts.map +0 -1
- package/dist/Snapshot.js +0 -267
- package/dist/Snapshot.js.map +0 -1
- package/dist/SnapshotUtilities.d.ts +0 -29
- package/dist/SnapshotUtilities.d.ts.map +0 -1
- package/dist/SnapshotUtilities.js +0 -73
- package/dist/SnapshotUtilities.js.map +0 -1
- package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
- package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/dist/anchored-edits/AnchorResolution.js +0 -162
- package/dist/anchored-edits/AnchorResolution.js.map +0 -1
- package/dist/anchored-edits/Factory.d.ts +0 -56
- package/dist/anchored-edits/Factory.d.ts.map +0 -1
- package/dist/anchored-edits/Factory.js +0 -79
- package/dist/anchored-edits/Factory.js.map +0 -1
- package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
- package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/anchored-edits/PersistedTypes.js +0 -131
- package/dist/anchored-edits/PersistedTypes.js.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
- package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
- package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/dist/anchored-edits/index.d.ts +0 -10
- package/dist/anchored-edits/index.d.ts.map +0 -1
- package/dist/anchored-edits/index.js +0 -34
- package/dist/anchored-edits/index.js.map +0 -1
- package/dist/default-edits/EditUtilities.d.ts +0 -57
- package/dist/default-edits/EditUtilities.d.ts.map +0 -1
- package/dist/default-edits/EditUtilities.js +0 -192
- package/dist/default-edits/EditUtilities.js.map +0 -1
- package/dist/default-edits/Factory.d.ts +0 -56
- package/dist/default-edits/Factory.d.ts.map +0 -1
- package/dist/default-edits/Factory.js +0 -79
- package/dist/default-edits/Factory.js.map +0 -1
- package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
- package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/dist/default-edits/HistoryEditFactory.js +0 -187
- package/dist/default-edits/HistoryEditFactory.js.map +0 -1
- package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/default-edits/PersistedTypes.js.map +0 -1
- package/dist/default-edits/SharedTree.d.ts +0 -111
- package/dist/default-edits/SharedTree.d.ts.map +0 -1
- package/dist/default-edits/SharedTree.js +0 -124
- package/dist/default-edits/SharedTree.js.map +0 -1
- package/dist/default-edits/Summary.d.ts +0 -15
- package/dist/default-edits/Summary.d.ts.map +0 -1
- package/dist/default-edits/Summary.js +0 -35
- package/dist/default-edits/Summary.js.map +0 -1
- package/dist/default-edits/Transaction.d.ts +0 -41
- package/dist/default-edits/Transaction.d.ts.map +0 -1
- package/dist/default-edits/Transaction.js +0 -225
- package/dist/default-edits/Transaction.js.map +0 -1
- package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/dist/default-edits/UndoRedoHandler.js.map +0 -1
- package/dist/default-edits/index.d.ts +0 -13
- package/dist/default-edits/index.d.ts.map +0 -1
- package/dist/default-edits/index.js +0 -41
- package/dist/default-edits/index.js.map +0 -1
- package/dist/generic/GenericEditUtilities.d.ts +0 -26
- package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
- package/dist/generic/GenericEditUtilities.js +0 -45
- package/dist/generic/GenericEditUtilities.js.map +0 -1
- package/dist/generic/GenericSharedTree.d.ts +0 -221
- package/dist/generic/GenericSharedTree.d.ts.map +0 -1
- package/dist/generic/GenericSharedTree.js +0 -447
- package/dist/generic/GenericSharedTree.js.map +0 -1
- package/dist/generic/GenericTransaction.d.ts +0 -87
- package/dist/generic/GenericTransaction.d.ts.map +0 -1
- package/dist/generic/GenericTransaction.js +0 -144
- package/dist/generic/GenericTransaction.js.map +0 -1
- package/dist/generic/PersistedTypes.d.ts +0 -194
- package/dist/generic/PersistedTypes.d.ts.map +0 -1
- package/dist/generic/PersistedTypes.js +0 -42
- package/dist/generic/PersistedTypes.js.map +0 -1
- package/dist/generic/Summary.d.ts +0 -63
- package/dist/generic/Summary.d.ts.map +0 -1
- package/dist/generic/Summary.js +0 -64
- package/dist/generic/Summary.js.map +0 -1
- package/dist/generic/index.d.ts +0 -10
- package/dist/generic/index.d.ts.map +0 -1
- package/dist/generic/index.js +0 -26
- package/dist/generic/index.js.map +0 -1
- package/docs/Future.md +0 -155
- package/lib/BasicCheckout.d.ts +0 -23
- package/lib/BasicCheckout.d.ts.map +0 -1
- package/lib/BasicCheckout.js.map +0 -1
- package/lib/Snapshot.d.ts +0 -198
- package/lib/Snapshot.d.ts.map +0 -1
- package/lib/Snapshot.js +0 -263
- package/lib/Snapshot.js.map +0 -1
- package/lib/SnapshotUtilities.d.ts +0 -29
- package/lib/SnapshotUtilities.d.ts.map +0 -1
- package/lib/SnapshotUtilities.js +0 -67
- package/lib/SnapshotUtilities.js.map +0 -1
- package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
- package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/lib/anchored-edits/AnchorResolution.js +0 -152
- package/lib/anchored-edits/AnchorResolution.js.map +0 -1
- package/lib/anchored-edits/Factory.d.ts +0 -56
- package/lib/anchored-edits/Factory.d.ts.map +0 -1
- package/lib/anchored-edits/Factory.js +0 -74
- package/lib/anchored-edits/Factory.js.map +0 -1
- package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
- package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/anchored-edits/PersistedTypes.js +0 -128
- package/lib/anchored-edits/PersistedTypes.js.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
- package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
- package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/lib/anchored-edits/index.d.ts +0 -10
- package/lib/anchored-edits/index.d.ts.map +0 -1
- package/lib/anchored-edits/index.js +0 -11
- package/lib/anchored-edits/index.js.map +0 -1
- package/lib/default-edits/EditUtilities.d.ts +0 -57
- package/lib/default-edits/EditUtilities.d.ts.map +0 -1
- package/lib/default-edits/EditUtilities.js +0 -181
- package/lib/default-edits/EditUtilities.js.map +0 -1
- package/lib/default-edits/Factory.d.ts +0 -56
- package/lib/default-edits/Factory.d.ts.map +0 -1
- package/lib/default-edits/Factory.js +0 -74
- package/lib/default-edits/Factory.js.map +0 -1
- package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
- package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/lib/default-edits/HistoryEditFactory.js.map +0 -1
- package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/default-edits/PersistedTypes.js.map +0 -1
- package/lib/default-edits/SharedTree.d.ts +0 -111
- package/lib/default-edits/SharedTree.d.ts.map +0 -1
- package/lib/default-edits/SharedTree.js +0 -100
- package/lib/default-edits/SharedTree.js.map +0 -1
- package/lib/default-edits/Summary.d.ts +0 -15
- package/lib/default-edits/Summary.d.ts.map +0 -1
- package/lib/default-edits/Summary.js +0 -31
- package/lib/default-edits/Summary.js.map +0 -1
- package/lib/default-edits/Transaction.d.ts +0 -41
- package/lib/default-edits/Transaction.d.ts.map +0 -1
- package/lib/default-edits/Transaction.js +0 -221
- package/lib/default-edits/Transaction.js.map +0 -1
- package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/lib/default-edits/UndoRedoHandler.js.map +0 -1
- package/lib/default-edits/index.d.ts +0 -13
- package/lib/default-edits/index.d.ts.map +0 -1
- package/lib/default-edits/index.js +0 -14
- package/lib/default-edits/index.js.map +0 -1
- package/lib/generic/GenericEditUtilities.d.ts +0 -26
- package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
- package/lib/generic/GenericEditUtilities.js +0 -38
- package/lib/generic/GenericEditUtilities.js.map +0 -1
- package/lib/generic/GenericSharedTree.d.ts +0 -221
- package/lib/generic/GenericSharedTree.d.ts.map +0 -1
- package/lib/generic/GenericSharedTree.js +0 -443
- package/lib/generic/GenericSharedTree.js.map +0 -1
- package/lib/generic/GenericTransaction.d.ts +0 -87
- package/lib/generic/GenericTransaction.d.ts.map +0 -1
- package/lib/generic/GenericTransaction.js +0 -140
- package/lib/generic/GenericTransaction.js.map +0 -1
- package/lib/generic/PersistedTypes.d.ts +0 -194
- package/lib/generic/PersistedTypes.d.ts.map +0 -1
- package/lib/generic/PersistedTypes.js +0 -39
- package/lib/generic/PersistedTypes.js.map +0 -1
- package/lib/generic/Summary.d.ts +0 -63
- package/lib/generic/Summary.d.ts.map +0 -1
- package/lib/generic/Summary.js +0 -58
- package/lib/generic/Summary.js.map +0 -1
- package/lib/generic/index.d.ts +0 -10
- package/lib/generic/index.d.ts.map +0 -1
- package/lib/generic/index.js +0 -11
- package/lib/generic/index.js.map +0 -1
- package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
- package/lib/test/Anchors.glassBox.tests.js +0 -410
- package/lib/test/Anchors.glassBox.tests.js.map +0 -1
- package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
- package/lib/test/BasicCheckout.tests.js +0 -8
- package/lib/test/BasicCheckout.tests.js.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
- package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
- package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
- package/lib/test/Snapshot.tests.d.ts.map +0 -1
- package/lib/test/Snapshot.tests.js +0 -96
- package/lib/test/Snapshot.tests.js.map +0 -1
- package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
- package/lib/test/SnapshotUtilities.tests.js +0 -168
- package/lib/test/SnapshotUtilities.tests.js.map +0 -1
- package/lib/test/undoRedoStackManager.d.ts +0 -26
- package/lib/test/undoRedoStackManager.d.ts.map +0 -1
- package/lib/test/undoRedoStackManager.js +0 -176
- package/lib/test/undoRedoStackManager.js.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
- package/src/BasicCheckout.ts +0 -34
- package/src/Snapshot.ts +0 -363
- package/src/SnapshotUtilities.ts +0 -88
- package/src/anchored-edits/AnchorResolution.ts +0 -442
- package/src/anchored-edits/Factory.ts +0 -94
- package/src/anchored-edits/PersistedTypes.ts +0 -310
- package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
- package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
- package/src/anchored-edits/index.ts +0 -21
- package/src/default-edits/EditUtilities.ts +0 -220
- package/src/default-edits/Factory.ts +0 -94
- package/src/default-edits/SharedTree.ts +0 -174
- package/src/default-edits/Summary.ts +0 -44
- package/src/default-edits/Transaction.ts +0 -262
- package/src/default-edits/index.ts +0 -29
- package/src/generic/GenericEditUtilities.ts +0 -46
- package/src/generic/GenericSharedTree.ts +0 -593
- package/src/generic/GenericTransaction.ts +0 -194
- package/src/generic/PersistedTypes.ts +0 -221
- package/src/generic/Summary.ts +0 -113
- package/src/generic/index.ts +0 -41
|
@@ -0,0 +1,373 @@
|
|
|
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.internalizeBuildNode = exports.deepCloneStableRange = exports.deepCloneStablePlace = exports.detachRange = exports.insertIntoTrait = exports.RangeValidationResultKind = exports.validateStableRange = exports.PlaceValidationResult = exports.validateStablePlace = exports.setTraitInternal = exports.setTrait = exports.areRevisionViewsSemanticallyEqual = exports.compareNodes = exports.deepCompareNodes = exports.walkTree = exports.convertTreeNodes = exports.newEditId = exports.newEdit = exports.compareEdits = void 0;
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const Common_1 = require("./Common");
|
|
10
|
+
const persisted_types_1 = require("./persisted-types");
|
|
11
|
+
const ChangeTypes_1 = require("./ChangeTypes");
|
|
12
|
+
const TreeViewUtilities_1 = require("./TreeViewUtilities");
|
|
13
|
+
const RevisionView_1 = require("./RevisionView");
|
|
14
|
+
const SerializationUtilities_1 = require("./SerializationUtilities");
|
|
15
|
+
const PayloadUtilities_1 = require("./PayloadUtilities");
|
|
16
|
+
/**
|
|
17
|
+
* Functions for constructing and comparing Edits.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the provided Edits have equivalent properties.
|
|
21
|
+
*/
|
|
22
|
+
function compareEdits(editIdA, editIdB) {
|
|
23
|
+
// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.
|
|
24
|
+
// We can use our edit validation code when we write it since it will need to do deep walks of the changes.
|
|
25
|
+
return editIdA === editIdB;
|
|
26
|
+
}
|
|
27
|
+
exports.compareEdits = compareEdits;
|
|
28
|
+
/**
|
|
29
|
+
* Generates a new edit object from the supplied changes.
|
|
30
|
+
*/
|
|
31
|
+
function newEdit(changes) {
|
|
32
|
+
return { id: newEditId(), changes };
|
|
33
|
+
}
|
|
34
|
+
exports.newEdit = newEdit;
|
|
35
|
+
/**
|
|
36
|
+
* Generates a new edit object from the supplied changes.
|
|
37
|
+
*/
|
|
38
|
+
function newEditId() {
|
|
39
|
+
return uuid_1.v4();
|
|
40
|
+
}
|
|
41
|
+
exports.newEditId = newEditId;
|
|
42
|
+
/**
|
|
43
|
+
* Transform an input tree into an isomorphic output tree
|
|
44
|
+
* @param tree - the input tree
|
|
45
|
+
* @param convert - a conversion function that will run on each (non-placeholder) node in the input tree to produce the output tree.
|
|
46
|
+
* Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted
|
|
47
|
+
* and return undefined.
|
|
48
|
+
* @param isPlaceholder - a predicate which determines if the given node is of type TPlaceholder
|
|
49
|
+
*/
|
|
50
|
+
function convertTreeNodes(root, convert, isPlaceholder) {
|
|
51
|
+
var _a;
|
|
52
|
+
if (isKnownType(root, isPlaceholder)) {
|
|
53
|
+
return root;
|
|
54
|
+
}
|
|
55
|
+
const convertedRoot = convert(root);
|
|
56
|
+
// `convertedRoot` might be the same as `root`, in which case stash the children of `root` before wiping them from `convertedRoot`
|
|
57
|
+
const rootTraits = root === convertedRoot ? { traits: root.traits } : root;
|
|
58
|
+
convertedRoot.traits = {};
|
|
59
|
+
const pendingNodes = [{ childIterator: RevisionView_1.iterateChildren(rootTraits)[Symbol.iterator](), newNode: convertedRoot }];
|
|
60
|
+
while (pendingNodes.length > 0) {
|
|
61
|
+
const { childIterator, newNode } = (_a = pendingNodes[pendingNodes.length - 1]) !== null && _a !== void 0 ? _a : Common_1.fail('Undefined node');
|
|
62
|
+
const { value, done } = childIterator.next();
|
|
63
|
+
if (done === true) {
|
|
64
|
+
pendingNodes.pop();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const [traitLabel, child] = value;
|
|
68
|
+
let convertedChild;
|
|
69
|
+
if (!isKnownType(child, isPlaceholder)) {
|
|
70
|
+
convertedChild = convert(child);
|
|
71
|
+
if (child.traits !== undefined) {
|
|
72
|
+
const childTraits = child === convertedChild ? { traits: child.traits } : child;
|
|
73
|
+
pendingNodes.push({
|
|
74
|
+
childIterator: RevisionView_1.iterateChildren(childTraits)[Symbol.iterator](),
|
|
75
|
+
newNode: convertedChild,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
convertedChild.traits = {};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
convertedChild = child;
|
|
82
|
+
}
|
|
83
|
+
const newTraits = newNode.traits;
|
|
84
|
+
let newTrait = newTraits[traitLabel];
|
|
85
|
+
if (newTrait === undefined) {
|
|
86
|
+
newTrait = [];
|
|
87
|
+
newTraits[traitLabel] = newTrait;
|
|
88
|
+
}
|
|
89
|
+
newTrait.push(convertedChild);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return convertedRoot;
|
|
93
|
+
}
|
|
94
|
+
exports.convertTreeNodes = convertTreeNodes;
|
|
95
|
+
function walkTree(tree, visitors, isPlaceholder) {
|
|
96
|
+
var _a;
|
|
97
|
+
const nodeVisitor = typeof visitors === 'function' ? visitors : visitors.nodeVisitor;
|
|
98
|
+
const placeholderVisitor = typeof visitors === 'object' ? visitors.placeholderVisitor : undefined;
|
|
99
|
+
if (isKnownType(tree, isPlaceholder)) {
|
|
100
|
+
placeholderVisitor === null || placeholderVisitor === void 0 ? void 0 : placeholderVisitor(tree);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
nodeVisitor === null || nodeVisitor === void 0 ? void 0 : nodeVisitor(tree);
|
|
104
|
+
const childIterators = [RevisionView_1.iterateChildren(tree)[Symbol.iterator]()];
|
|
105
|
+
while (childIterators.length > 0) {
|
|
106
|
+
const childIterator = (_a = childIterators[childIterators.length - 1]) !== null && _a !== void 0 ? _a : Common_1.fail('Undefined node');
|
|
107
|
+
const { value, done } = childIterator.next();
|
|
108
|
+
if (done === true) {
|
|
109
|
+
childIterators.pop();
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const [_, child] = value;
|
|
113
|
+
if (isKnownType(child, isPlaceholder)) {
|
|
114
|
+
placeholderVisitor === null || placeholderVisitor === void 0 ? void 0 : placeholderVisitor(child);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
nodeVisitor === null || nodeVisitor === void 0 ? void 0 : nodeVisitor(child);
|
|
118
|
+
childIterators.push(RevisionView_1.iterateChildren(child)[Symbol.iterator]());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.walkTree = walkTree;
|
|
124
|
+
// Useful for collapsing type checks in `convertTreeNodes` into a single line
|
|
125
|
+
function isKnownType(value, isType) {
|
|
126
|
+
var _a;
|
|
127
|
+
return (_a = isType === null || isType === void 0 ? void 0 : isType(value)) !== null && _a !== void 0 ? _a : false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if two trees are equivalent, meaning they have the same descendants with the same properties.
|
|
131
|
+
*
|
|
132
|
+
* See {@link comparePayloads} for payload comparison semantics.
|
|
133
|
+
*/
|
|
134
|
+
function deepCompareNodes(a, b, comparator = compareNodes) {
|
|
135
|
+
if (a === b) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (!comparator(a, b)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const traitsA = Object.entries(a.traits);
|
|
142
|
+
const traitsB = Object.entries(b.traits);
|
|
143
|
+
if (traitsA.length !== traitsB.length) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
for (const [traitLabel, childrenA] of traitsA) {
|
|
147
|
+
const childrenB = b.traits[traitLabel];
|
|
148
|
+
if (childrenA.length !== childrenB.length) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
const traitsEqual = Common_1.compareArrays(childrenA, childrenB, (childA, childB) => {
|
|
152
|
+
if (typeof childA === 'number' || typeof childB === 'number') {
|
|
153
|
+
// Check if children are DetachedSequenceIds
|
|
154
|
+
return childA === childB;
|
|
155
|
+
}
|
|
156
|
+
return deepCompareNodes(childA, childB);
|
|
157
|
+
});
|
|
158
|
+
if (!traitsEqual) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
exports.deepCompareNodes = deepCompareNodes;
|
|
165
|
+
/*
|
|
166
|
+
* Returns true if two nodes have equivalent data and payloads, otherwise false.
|
|
167
|
+
* Does not compare children
|
|
168
|
+
* @param nodes - two or more nodes to compare
|
|
169
|
+
*/
|
|
170
|
+
function compareNodes(a, b) {
|
|
171
|
+
if (a === b) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if (a.identifier !== b.identifier) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (a.definition !== b.definition) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
if (!PayloadUtilities_1.comparePayloads(a.payload, b.payload)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
exports.compareNodes = compareNodes;
|
|
186
|
+
/**
|
|
187
|
+
* Compare two views such that semantically equivalent node IDs are considered equal.
|
|
188
|
+
*/
|
|
189
|
+
function areRevisionViewsSemanticallyEqual(treeViewA, idConverterA, treeViewB, idConverterB) {
|
|
190
|
+
const treeA = SerializationUtilities_1.getChangeNode_0_0_2FromView(treeViewA, idConverterA);
|
|
191
|
+
const treeB = SerializationUtilities_1.getChangeNode_0_0_2FromView(treeViewB, idConverterB);
|
|
192
|
+
if (!deepCompareNodes(treeA, treeB)) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
exports.areRevisionViewsSemanticallyEqual = areRevisionViewsSemanticallyEqual;
|
|
198
|
+
/**
|
|
199
|
+
* Create a sequence of changes that resets the contents of `trait`.
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
function setTrait(trait, nodes) {
|
|
203
|
+
const id = 0;
|
|
204
|
+
const traitContents = ChangeTypes_1.StableRange.all(trait);
|
|
205
|
+
return [ChangeTypes_1.Change.detach(traitContents), ChangeTypes_1.Change.build(nodes, id), ChangeTypes_1.Change.insert(id, traitContents.start)];
|
|
206
|
+
}
|
|
207
|
+
exports.setTrait = setTrait;
|
|
208
|
+
/**
|
|
209
|
+
* Create a sequence of changes that resets the contents of `trait`.
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
function setTraitInternal(trait, nodes) {
|
|
213
|
+
const id = 0;
|
|
214
|
+
const traitContents = persisted_types_1.StableRangeInternal.all(trait);
|
|
215
|
+
return [
|
|
216
|
+
persisted_types_1.ChangeInternal.detach(traitContents),
|
|
217
|
+
persisted_types_1.ChangeInternal.build(nodes, id),
|
|
218
|
+
persisted_types_1.ChangeInternal.insert(id, traitContents.start),
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
exports.setTraitInternal = setTraitInternal;
|
|
222
|
+
/**
|
|
223
|
+
* Check the validity of the given `StablePlace`
|
|
224
|
+
* @param view - the `TreeView` within which to validate the given place
|
|
225
|
+
* @param place - the `StablePlace` to check
|
|
226
|
+
*/
|
|
227
|
+
function validateStablePlace(view, place) {
|
|
228
|
+
/* A StablePlace is valid if the following conditions are met:
|
|
229
|
+
* 1. A sibling or trait is defined.
|
|
230
|
+
* 2. If a sibling is defined, both it and its parent exist in the `TreeView`.
|
|
231
|
+
* 3. If a trait is defined, its parent node exists in the `TreeView`.
|
|
232
|
+
* 4. If a sibling and a trait location are both specified, the sibling needs to actually be in that trait.
|
|
233
|
+
*/
|
|
234
|
+
const { referenceSibling, referenceTrait } = place;
|
|
235
|
+
// A well-formed `StablePlace` specifies exactly one of `referenceSibling` and `referenceTrait`.
|
|
236
|
+
if ((referenceSibling === undefined && referenceTrait === undefined) ||
|
|
237
|
+
(referenceSibling !== undefined && referenceTrait !== undefined)) {
|
|
238
|
+
return { result: PlaceValidationResult.Malformed };
|
|
239
|
+
}
|
|
240
|
+
if (referenceSibling !== undefined) {
|
|
241
|
+
if (!view.hasNode(referenceSibling)) {
|
|
242
|
+
return { result: PlaceValidationResult.MissingSibling };
|
|
243
|
+
}
|
|
244
|
+
// Detached nodes and the root are invalid anchors.
|
|
245
|
+
if (view.tryGetTraitLabel(referenceSibling) === undefined) {
|
|
246
|
+
return { result: PlaceValidationResult.SiblingIsRootOrDetached };
|
|
247
|
+
}
|
|
248
|
+
return { result: PlaceValidationResult.Valid, side: place.side, referenceSibling };
|
|
249
|
+
}
|
|
250
|
+
if (referenceTrait === undefined) {
|
|
251
|
+
return { result: PlaceValidationResult.MissingParent };
|
|
252
|
+
}
|
|
253
|
+
if (!view.hasNode(referenceTrait.parent)) {
|
|
254
|
+
return { result: PlaceValidationResult.MissingParent };
|
|
255
|
+
}
|
|
256
|
+
return { result: PlaceValidationResult.Valid, side: place.side, referenceTrait };
|
|
257
|
+
}
|
|
258
|
+
exports.validateStablePlace = validateStablePlace;
|
|
259
|
+
/**
|
|
260
|
+
* The result of validating a place.
|
|
261
|
+
*/
|
|
262
|
+
var PlaceValidationResult;
|
|
263
|
+
(function (PlaceValidationResult) {
|
|
264
|
+
PlaceValidationResult["Valid"] = "Valid";
|
|
265
|
+
PlaceValidationResult["Malformed"] = "Malformed";
|
|
266
|
+
PlaceValidationResult["SiblingIsRootOrDetached"] = "SiblingIsRootOrDetached";
|
|
267
|
+
PlaceValidationResult["MissingSibling"] = "MissingSibling";
|
|
268
|
+
PlaceValidationResult["MissingParent"] = "MissingParent";
|
|
269
|
+
})(PlaceValidationResult = exports.PlaceValidationResult || (exports.PlaceValidationResult = {}));
|
|
270
|
+
/**
|
|
271
|
+
* Check the validity of the given `StableRange`
|
|
272
|
+
* @param view - the `TreeView` within which to validate the given range
|
|
273
|
+
* @param range - the `StableRange` to check
|
|
274
|
+
*/
|
|
275
|
+
function validateStableRange(view, range) {
|
|
276
|
+
/* A StableRange is valid if the following conditions are met:
|
|
277
|
+
* 1. Its start and end places are valid.
|
|
278
|
+
* 2. Its start and end places are within the same trait.
|
|
279
|
+
* 3. Its start place is before its end place.
|
|
280
|
+
*/
|
|
281
|
+
const { start, end } = range;
|
|
282
|
+
const validatedStart = validateStablePlace(view, start);
|
|
283
|
+
if (validatedStart.result !== PlaceValidationResult.Valid) {
|
|
284
|
+
return {
|
|
285
|
+
result: { kind: RangeValidationResultKind.BadPlace, place: start, placeFailure: validatedStart.result },
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const validatedEnd = validateStablePlace(view, end);
|
|
289
|
+
if (validatedEnd.result !== PlaceValidationResult.Valid) {
|
|
290
|
+
return { result: { kind: RangeValidationResultKind.BadPlace, place: end, placeFailure: validatedEnd.result } };
|
|
291
|
+
}
|
|
292
|
+
const startTraitLocation = validatedStart.referenceTrait || view.getTraitLocation(validatedStart.referenceSibling);
|
|
293
|
+
const endTraitLocation = validatedEnd.referenceTrait || view.getTraitLocation(validatedEnd.referenceSibling);
|
|
294
|
+
if (!compareTraits(startTraitLocation, endTraitLocation)) {
|
|
295
|
+
return { result: RangeValidationResultKind.PlacesInDifferentTraits };
|
|
296
|
+
}
|
|
297
|
+
const { start: startPlace, end: endPlace } = TreeViewUtilities_1.rangeFromStableRange(view, {
|
|
298
|
+
start: validatedStart,
|
|
299
|
+
end: validatedEnd,
|
|
300
|
+
});
|
|
301
|
+
const startIndex = view.findIndexWithinTrait(startPlace);
|
|
302
|
+
const endIndex = view.findIndexWithinTrait(endPlace);
|
|
303
|
+
if (startIndex > endIndex) {
|
|
304
|
+
return { result: RangeValidationResultKind.Inverted };
|
|
305
|
+
}
|
|
306
|
+
return { result: RangeValidationResultKind.Valid, start: validatedStart, end: validatedEnd };
|
|
307
|
+
}
|
|
308
|
+
exports.validateStableRange = validateStableRange;
|
|
309
|
+
/**
|
|
310
|
+
* The kinds of result of validating a range.
|
|
311
|
+
*/
|
|
312
|
+
var RangeValidationResultKind;
|
|
313
|
+
(function (RangeValidationResultKind) {
|
|
314
|
+
RangeValidationResultKind["Valid"] = "Valid";
|
|
315
|
+
RangeValidationResultKind["BadPlace"] = "BadPlace";
|
|
316
|
+
RangeValidationResultKind["PlacesInDifferentTraits"] = "PlacesInDifferentTraits";
|
|
317
|
+
RangeValidationResultKind["Inverted"] = "Inverted";
|
|
318
|
+
})(RangeValidationResultKind = exports.RangeValidationResultKind || (exports.RangeValidationResultKind = {}));
|
|
319
|
+
/**
|
|
320
|
+
* Check if two TraitLocations are equal.
|
|
321
|
+
*/
|
|
322
|
+
function compareTraits(traitA, traitB) {
|
|
323
|
+
if (traitA.label !== traitB.label || traitA.parent !== traitB.parent) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Parents a set of nodes in a specified location within a trait.
|
|
330
|
+
* @param nodesToInsert - the nodes to parent in the specified place. The nodes must already be present in the TreeView.
|
|
331
|
+
* @param placeToInsert - the location to insert the nodes.
|
|
332
|
+
*/
|
|
333
|
+
function insertIntoTrait(view, nodesToInsert, placeToInsert) {
|
|
334
|
+
return view.attachRange(nodesToInsert, TreeViewUtilities_1.placeFromStablePlace(view, placeToInsert));
|
|
335
|
+
}
|
|
336
|
+
exports.insertIntoTrait = insertIntoTrait;
|
|
337
|
+
/**
|
|
338
|
+
* Detaches a range of nodes from their parent. The detached nodes remain in the TreeView.
|
|
339
|
+
* @param rangeToDetach - the range of nodes to detach
|
|
340
|
+
*/
|
|
341
|
+
function detachRange(view, rangeToDetach) {
|
|
342
|
+
return view.detachRange(TreeViewUtilities_1.rangeFromStableRange(view, rangeToDetach));
|
|
343
|
+
}
|
|
344
|
+
exports.detachRange = detachRange;
|
|
345
|
+
/**
|
|
346
|
+
* Deeply clone the given StablePlace
|
|
347
|
+
*/
|
|
348
|
+
function deepCloneStablePlace(place) {
|
|
349
|
+
const clone = { side: place.side };
|
|
350
|
+
Common_1.copyPropertyIfDefined(place, clone, 'referenceSibling');
|
|
351
|
+
Common_1.copyPropertyIfDefined(place, clone, 'referenceTrait');
|
|
352
|
+
return clone;
|
|
353
|
+
}
|
|
354
|
+
exports.deepCloneStablePlace = deepCloneStablePlace;
|
|
355
|
+
/**
|
|
356
|
+
* Deeply clone the given StableRange
|
|
357
|
+
*/
|
|
358
|
+
function deepCloneStableRange(range) {
|
|
359
|
+
return { start: deepCloneStablePlace(range.start), end: deepCloneStablePlace(range.end) };
|
|
360
|
+
}
|
|
361
|
+
exports.deepCloneStableRange = deepCloneStableRange;
|
|
362
|
+
/** Convert a node used in a Build change into its internal representation */
|
|
363
|
+
function internalizeBuildNode(nodeData, nodeIdContext) {
|
|
364
|
+
var _a;
|
|
365
|
+
const output = {
|
|
366
|
+
definition: nodeData.definition,
|
|
367
|
+
identifier: (_a = nodeData.identifier) !== null && _a !== void 0 ? _a : nodeIdContext.generateNodeId(),
|
|
368
|
+
};
|
|
369
|
+
Common_1.copyPropertyIfDefined(nodeData, output, 'payload');
|
|
370
|
+
return output;
|
|
371
|
+
}
|
|
372
|
+
exports.internalizeBuildNode = internalizeBuildNode;
|
|
373
|
+
//# sourceMappingURL=EditUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditUtilities.js","sourceRoot":"","sources":["../src/EditUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAoC;AACpC,qCAA+E;AAG/E,uDAe2B;AAE3B,+CAA8G;AAC9G,2DAAiF;AACjF,iDAAkE;AAClE,qEAAuE;AACvE,yDAAqD;AAErD;;GAEG;AAEH;;GAEG;AACH,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAe;IAC5D,8GAA8G;IAC9G,2GAA2G;IAC3G,OAAO,OAAO,KAAK,OAAO,CAAC;AAC5B,CAAC;AAJD,oCAIC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAQ,OAAyB;IACvD,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,SAAS;IACxB,OAAO,SAAM,EAAY,CAAC;AAC3B,CAAC;AAFD,8BAEC;AAiCD;;;;;;;GAOG;AAC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C;AALD,kCAKC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAkB;IACtD,MAAM,KAAK,GAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAChD,8BAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACxD,8BAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC;AACd,CAAC;AALD,oDAKC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAkB;IACtD,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;AAC3F,CAAC;AAFD,oDAEC;AAED,6EAA6E;AAC7E,SAAgB,oBAAoB,CACnC,QAAuB,EACvB,aAA4B;;IAE5B,MAAM,MAAM,GAAG;QACd,UAAU,EAAE,QAAQ,CAAC,UAAwB;QAC7C,UAAU,QAAE,QAAQ,CAAC,UAAU,mCAAI,aAAa,CAAC,cAAc,EAAE;KACjE,CAAC;IACF,8BAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC;AACf,CAAC;AAVD,oDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuidv4 } from 'uuid';\nimport { compareArrays, copyPropertyIfDefined, fail, Mutable } from './Common';\nimport { Definition, DetachedSequenceId, EditId, NodeId, StableNodeId, TraitLabel } from './Identifiers';\nimport { NodeIdContext, NodeIdConverter } from './NodeIdUtilities';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tChangeNode_0_0_2,\n\tEdit,\n\tHasTraits,\n\tNodeData,\n\tSide,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n\tTraitLocationInternal,\n\tTraitMap,\n\tTreeNode,\n\tTreeNodeSequence,\n} from './persisted-types';\nimport { TraitLocation, TreeView } from './TreeView';\nimport { BuildNode, BuildTreeNode, Change, HasVariadicTraits, StablePlace, StableRange } from './ChangeTypes';\nimport { placeFromStablePlace, rangeFromStableRange } from './TreeViewUtilities';\nimport { iterateChildren, TransactionView } from './RevisionView';\nimport { getChangeNode_0_0_2FromView } from './SerializationUtilities';\nimport { comparePayloads } from './PayloadUtilities';\n\n/**\n * Functions for constructing and comparing Edits.\n */\n\n/**\n * Returns true if the provided Edits have equivalent properties.\n */\nexport function compareEdits(editIdA: EditId, editIdB: EditId): boolean {\n\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\treturn editIdA === editIdB;\n}\n\n/**\n * Generates a new edit object from the supplied changes.\n */\nexport function newEdit<TEdit>(changes: readonly TEdit[]): Edit<TEdit> {\n\treturn { id: newEditId(), changes };\n}\n\n/**\n * Generates a new edit object from the supplied changes.\n */\nexport function newEditId(): EditId {\n\treturn uuidv4() as EditId;\n}\n\n/**\n * A node type that does not require its children to be specified\n */\nexport type NoTraits<TChild extends HasVariadicTraits<unknown>> = Omit<TChild, keyof HasVariadicTraits<TChild>>;\n\n/**\n * Transform an input tree into an isomorphic output tree\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output tree.\n */\nexport function convertTreeNodes<TIn extends HasVariadicTraits<TIn>, TOut extends HasTraits<TOut>>(\n\troot: TIn,\n\tconvert: (node: TIn) => NoTraits<TOut>\n): TOut;\n\n/**\n * Transform an input tree into an isomorphic output tree\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each (non-placeholder) node in the input tree to produce the output tree.\n * @param isPlaceholder - a predicate which determines if a node is a placeholder\n */\nexport function convertTreeNodes<\n\tTIn extends HasVariadicTraits<TIn | TPlaceholder>,\n\tTOut extends HasTraits<TOut | TPlaceholder>,\n\tTPlaceholder\n>(\n\troot: TIn | TPlaceholder,\n\tconvert: (node: TIn) => NoTraits<TOut>,\n\tisPlaceholder: (node: TIn | TPlaceholder) => node is TPlaceholder\n): TOut | TPlaceholder;\n\n/**\n * Transform an input tree into an isomorphic output tree\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each (non-placeholder) node in the input tree to produce the output tree.\n * Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted\n * and return undefined.\n * @param isPlaceholder - a predicate which determines if the given node is of type TPlaceholder\n */\nexport function convertTreeNodes<\n\tTIn extends HasVariadicTraits<TIn | TPlaceholder>,\n\tTOut extends HasTraits<TOut | TPlaceholder>,\n\tTPlaceholder\n>(\n\troot: TIn | TPlaceholder,\n\tconvert: (node: TIn) => NoTraits<TOut>,\n\tisPlaceholder?: (node: TIn | TPlaceholder) => node is TPlaceholder\n): TOut | TPlaceholder {\n\tif (isKnownType(root, isPlaceholder)) {\n\t\treturn root;\n\t}\n\n\tconst convertedRoot = convert(root) as TOut;\n\t// `convertedRoot` might be the same as `root`, in which case stash the children of `root` before wiping them from `convertedRoot`\n\tconst rootTraits = (root as unknown as TOut) === convertedRoot ? { traits: root.traits } : root;\n\t(convertedRoot as Mutable<TOut>).traits = {};\n\tconst pendingNodes: {\n\t\tchildIterator: Iterator<[TraitLabel, TIn | TPlaceholder]>;\n\t\tnewNode: Mutable<TOut>;\n\t}[] = [{ childIterator: iterateChildren(rootTraits)[Symbol.iterator](), newNode: convertedRoot }];\n\n\twhile (pendingNodes.length > 0) {\n\t\tconst { childIterator, newNode } = pendingNodes[pendingNodes.length - 1] ?? fail('Undefined node');\n\t\tconst { value, done } = childIterator.next();\n\t\tif (done === true) {\n\t\t\tpendingNodes.pop();\n\t\t} else {\n\t\t\tconst [traitLabel, child] = value as [TraitLabel, TIn | TPlaceholder];\n\t\t\tlet convertedChild: TOut | TPlaceholder;\n\t\t\tif (!isKnownType(child, isPlaceholder)) {\n\t\t\t\tconvertedChild = convert(child) as TOut;\n\t\t\t\tif (child.traits !== undefined) {\n\t\t\t\t\tconst childTraits =\n\t\t\t\t\t\t(child as unknown as TOut) === convertedChild ? { traits: child.traits } : child;\n\t\t\t\t\tpendingNodes.push({\n\t\t\t\t\t\tchildIterator: iterateChildren(childTraits)[Symbol.iterator](),\n\t\t\t\t\t\tnewNode: convertedChild,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t(convertedChild as Mutable<TOut>).traits = {};\n\t\t\t} else {\n\t\t\t\tconvertedChild = child;\n\t\t\t}\n\t\t\tconst newTraits = newNode.traits as Mutable<TraitMap<TOut | TPlaceholder>>;\n\t\t\tlet newTrait = newTraits[traitLabel];\n\t\t\tif (newTrait === undefined) {\n\t\t\t\tnewTrait = [];\n\t\t\t\tnewTraits[traitLabel] = newTrait;\n\t\t\t}\n\t\t\t(newTrait as (TOut | TPlaceholder)[]).push(convertedChild);\n\t\t}\n\t}\n\n\treturn convertedRoot;\n}\n\n/**\n * Visits an input tree in a depth-first pre-order traversal.\n * @param tree - the input tree\n * @param visitor - callback invoked for each node in the tree.\n */\nexport function walkTree<TIn extends HasVariadicTraits<TIn>>(tree: TIn, visitor: (node: TIn) => void): void;\n\n/**\n * Visits an input tree containing placeholders in a depth-first pre-order traversal.\n * @param tree - the input tree\n * @param visitor - callback invoked for each node in the tree. Must return true if the given node is a TPlaceholder.\n */\nexport function walkTree<TIn extends HasVariadicTraits<TIn | TPlaceholder>, TPlaceholder = never>(\n\ttree: TIn | TPlaceholder,\n\tvisitors:\n\t\t| ((node: TIn) => void)\n\t\t| { nodeVisitor?: (node: TIn) => void; placeholderVisitor?: (placeholder: TPlaceholder) => void },\n\tisPlaceholder: (node: TIn | TPlaceholder) => node is TPlaceholder\n): void;\n\nexport function walkTree<TIn extends HasVariadicTraits<TIn | TPlaceholder>, TPlaceholder = never>(\n\ttree: TIn | TPlaceholder,\n\tvisitors:\n\t\t| ((node: TIn) => void)\n\t\t| { nodeVisitor?: (node: TIn) => void; placeholderVisitor?: (placeholder: TPlaceholder) => void },\n\tisPlaceholder?: (node: TIn | TPlaceholder) => node is TPlaceholder\n): void {\n\tconst nodeVisitor = typeof visitors === 'function' ? visitors : visitors.nodeVisitor;\n\tconst placeholderVisitor = typeof visitors === 'object' ? visitors.placeholderVisitor : undefined;\n\tif (isKnownType(tree, isPlaceholder)) {\n\t\tplaceholderVisitor?.(tree);\n\t\treturn;\n\t}\n\tnodeVisitor?.(tree);\n\n\tconst childIterators: Iterator<[TraitLabel, TIn | TPlaceholder]>[] = [iterateChildren(tree)[Symbol.iterator]()];\n\n\twhile (childIterators.length > 0) {\n\t\tconst childIterator = childIterators[childIterators.length - 1] ?? fail('Undefined node');\n\t\tconst { value, done } = childIterator.next();\n\t\tif (done === true) {\n\t\t\tchildIterators.pop();\n\t\t} else {\n\t\t\tconst [_, child] = value as [TraitLabel, TIn | TPlaceholder];\n\t\t\tif (isKnownType(child, isPlaceholder)) {\n\t\t\t\tplaceholderVisitor?.(child);\n\t\t\t} else {\n\t\t\t\tnodeVisitor?.(child);\n\t\t\t\tchildIterators.push(iterateChildren(child)[Symbol.iterator]());\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Useful for collapsing type checks in `convertTreeNodes` into a single line\nfunction isKnownType<T, Type extends T>(value: T, isType?: (value: T) => value is Type): value is Type {\n\treturn isType?.(value) ?? false;\n}\n\n/**\n * Check if two trees are equivalent, meaning they have the same descendants with the same properties.\n *\n * See {@link comparePayloads} for payload comparison semantics.\n */\nexport function deepCompareNodes(\n\ta: ChangeNode | ChangeNode_0_0_2,\n\tb: ChangeNode | ChangeNode_0_0_2,\n\tcomparator: (\n\t\ta: NodeData<NodeId> | NodeData<StableNodeId>,\n\t\tb: NodeData<NodeId> | NodeData<StableNodeId>\n\t) => boolean = compareNodes\n): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (!comparator(a, b)) {\n\t\treturn false;\n\t}\n\n\tconst traitsA = Object.entries(a.traits);\n\tconst traitsB = Object.entries(b.traits);\n\n\tif (traitsA.length !== traitsB.length) {\n\t\treturn false;\n\t}\n\n\tfor (const [traitLabel, childrenA] of traitsA) {\n\t\tconst childrenB = b.traits[traitLabel];\n\n\t\tif (childrenA.length !== childrenB.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst traitsEqual = compareArrays<ChangeNode | ChangeNode_0_0_2>(childrenA, childrenB, (childA, childB) => {\n\t\t\tif (typeof childA === 'number' || typeof childB === 'number') {\n\t\t\t\t// Check if children are DetachedSequenceIds\n\t\t\t\treturn childA === childB;\n\t\t\t}\n\n\t\t\treturn deepCompareNodes(childA, childB);\n\t\t});\n\n\t\tif (!traitsEqual) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/*\n * Returns true if two nodes have equivalent data and payloads, otherwise false.\n * Does not compare children\n * @param nodes - two or more nodes to compare\n */\nexport function compareNodes(\n\ta: NodeData<NodeId> | NodeData<StableNodeId>,\n\tb: NodeData<NodeId> | NodeData<StableNodeId>\n): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (a.identifier !== b.identifier) {\n\t\treturn false;\n\t}\n\n\tif (a.definition !== b.definition) {\n\t\treturn false;\n\t}\n\n\tif (!comparePayloads(a.payload, b.payload)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Compare two views such that semantically equivalent node IDs are considered equal.\n */\nexport function areRevisionViewsSemanticallyEqual(\n\ttreeViewA: TreeView,\n\tidConverterA: NodeIdConverter,\n\ttreeViewB: TreeView,\n\tidConverterB: NodeIdConverter\n): boolean {\n\tconst treeA = getChangeNode_0_0_2FromView(treeViewA, idConverterA);\n\tconst treeB = getChangeNode_0_0_2FromView(treeViewB, idConverterB);\n\tif (!deepCompareNodes(treeA, treeB)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Create a sequence of changes that resets the contents of `trait`.\n * @public\n */\nexport function setTrait(trait: TraitLocation, nodes: BuildNode | TreeNodeSequence<BuildNode>): Change[] {\n\tconst id = 0 as DetachedSequenceId;\n\tconst traitContents = StableRange.all(trait);\n\treturn [Change.detach(traitContents), Change.build(nodes, id), Change.insert(id, traitContents.start)];\n}\n\n/**\n * Create a sequence of changes that resets the contents of `trait`.\n * @internal\n */\nexport function setTraitInternal(\n\ttrait: TraitLocationInternal,\n\tnodes: TreeNodeSequence<BuildNodeInternal>\n): ChangeInternal[] {\n\tconst id = 0 as DetachedSequenceId;\n\tconst traitContents = StableRangeInternal.all(trait);\n\treturn [\n\t\tChangeInternal.detach(traitContents),\n\t\tChangeInternal.build(nodes, id),\n\t\tChangeInternal.insert(id, traitContents.start),\n\t];\n}\n\n/**\n * Check the validity of the given `StablePlace`\n * @param view - the `TreeView` within which to validate the given place\n * @param place - the `StablePlace` to check\n */\nexport function validateStablePlace(\n\tview: TreeView,\n\tplace: StablePlaceInternal\n):\n\t| {\n\t\t\tresult: PlaceValidationResult.Valid;\n\t\t\tside: Side;\n\t\t\treferenceSibling: NodeId;\n\t\t\treferenceTrait?: never;\n\t }\n\t| {\n\t\t\tresult: PlaceValidationResult.Valid;\n\t\t\tside: Side;\n\t\t\treferenceSibling?: never;\n\t\t\treferenceTrait: TraitLocation;\n\t }\n\t| { result: Exclude<PlaceValidationResult, PlaceValidationResult.Valid> } {\n\t/* A StablePlace is valid if the following conditions are met:\n\t * 1. A sibling or trait is defined.\n\t * 2. If a sibling is defined, both it and its parent exist in the `TreeView`.\n\t * 3. If a trait is defined, its parent node exists in the `TreeView`.\n\t * 4. If a sibling and a trait location are both specified, the sibling needs to actually be in that trait.\n\t */\n\tconst { referenceSibling, referenceTrait } = place;\n\n\t// A well-formed `StablePlace` specifies exactly one of `referenceSibling` and `referenceTrait`.\n\tif (\n\t\t(referenceSibling === undefined && referenceTrait === undefined) ||\n\t\t(referenceSibling !== undefined && referenceTrait !== undefined)\n\t) {\n\t\treturn { result: PlaceValidationResult.Malformed };\n\t}\n\n\tif (referenceSibling !== undefined) {\n\t\tif (!view.hasNode(referenceSibling)) {\n\t\t\treturn { result: PlaceValidationResult.MissingSibling };\n\t\t}\n\n\t\t// Detached nodes and the root are invalid anchors.\n\t\tif (view.tryGetTraitLabel(referenceSibling) === undefined) {\n\t\t\treturn { result: PlaceValidationResult.SiblingIsRootOrDetached };\n\t\t}\n\n\t\treturn { result: PlaceValidationResult.Valid, side: place.side, referenceSibling };\n\t}\n\n\tif (referenceTrait === undefined) {\n\t\treturn { result: PlaceValidationResult.MissingParent };\n\t}\n\n\tif (!view.hasNode(referenceTrait.parent)) {\n\t\treturn { result: PlaceValidationResult.MissingParent };\n\t}\n\n\treturn { result: PlaceValidationResult.Valid, side: place.side, referenceTrait };\n}\n\n/**\n * The result of validating a place.\n */\nexport enum PlaceValidationResult {\n\tValid = 'Valid',\n\tMalformed = 'Malformed',\n\tSiblingIsRootOrDetached = 'SiblingIsRootOrDetached',\n\tMissingSibling = 'MissingSibling',\n\tMissingParent = 'MissingParent',\n}\n\n/**\n * The result of validating a bad place.\n */\nexport type BadPlaceValidationResult = Exclude<PlaceValidationResult, PlaceValidationResult.Valid>;\n\n/**\n * Check the validity of the given `StableRange`\n * @param view - the `TreeView` within which to validate the given range\n * @param range - the `StableRange` to check\n */\nexport function validateStableRange(\n\tview: TreeView,\n\trange: StableRangeInternal\n):\n\t| { result: RangeValidationResultKind.Valid; start: StablePlaceInternal; end: StablePlaceInternal }\n\t| { result: Exclude<RangeValidationResult, RangeValidationResultKind.Valid> } {\n\t/* A StableRange is valid if the following conditions are met:\n\t * 1. Its start and end places are valid.\n\t * 2. Its start and end places are within the same trait.\n\t * 3. Its start place is before its end place.\n\t */\n\tconst { start, end } = range;\n\n\tconst validatedStart = validateStablePlace(view, start);\n\tif (validatedStart.result !== PlaceValidationResult.Valid) {\n\t\treturn {\n\t\t\tresult: { kind: RangeValidationResultKind.BadPlace, place: start, placeFailure: validatedStart.result },\n\t\t};\n\t}\n\n\tconst validatedEnd = validateStablePlace(view, end);\n\tif (validatedEnd.result !== PlaceValidationResult.Valid) {\n\t\treturn { result: { kind: RangeValidationResultKind.BadPlace, place: end, placeFailure: validatedEnd.result } };\n\t}\n\n\tconst startTraitLocation = validatedStart.referenceTrait || view.getTraitLocation(validatedStart.referenceSibling);\n\tconst endTraitLocation = validatedEnd.referenceTrait || view.getTraitLocation(validatedEnd.referenceSibling);\n\tif (!compareTraits(startTraitLocation, endTraitLocation)) {\n\t\treturn { result: RangeValidationResultKind.PlacesInDifferentTraits };\n\t}\n\n\tconst { start: startPlace, end: endPlace } = rangeFromStableRange(view, {\n\t\tstart: validatedStart,\n\t\tend: validatedEnd,\n\t});\n\tconst startIndex = view.findIndexWithinTrait(startPlace);\n\tconst endIndex = view.findIndexWithinTrait(endPlace);\n\n\tif (startIndex > endIndex) {\n\t\treturn { result: RangeValidationResultKind.Inverted };\n\t}\n\n\treturn { result: RangeValidationResultKind.Valid, start: validatedStart, end: validatedEnd };\n}\n\n/**\n * The kinds of result of validating a range.\n */\nexport enum RangeValidationResultKind {\n\tValid = 'Valid',\n\tBadPlace = 'BadPlace',\n\tPlacesInDifferentTraits = 'PlacesInDifferentTraits',\n\tInverted = 'Inverted',\n}\n\n/**\n * The result of validating a range.\n */\nexport type RangeValidationResult =\n\t| RangeValidationResultKind.Valid\n\t| RangeValidationResultKind.PlacesInDifferentTraits\n\t| RangeValidationResultKind.Inverted\n\t| {\n\t\t\tkind: RangeValidationResultKind.BadPlace;\n\t\t\tplace: StablePlaceInternal;\n\t\t\tplaceFailure: BadPlaceValidationResult;\n\t };\n\n/**\n * The result of validating a bad range.\n */\nexport type BadRangeValidationResult = Exclude<RangeValidationResult, RangeValidationResultKind.Valid>;\n\n/**\n * Check if two TraitLocations are equal.\n */\nfunction compareTraits(traitA: TraitLocation, traitB: TraitLocation): boolean {\n\tif (traitA.label !== traitB.label || traitA.parent !== traitB.parent) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Parents a set of nodes in a specified location within a trait.\n * @param nodesToInsert - the nodes to parent in the specified place. The nodes must already be present in the TreeView.\n * @param placeToInsert - the location to insert the nodes.\n */\nexport function insertIntoTrait(\n\tview: TransactionView,\n\tnodesToInsert: readonly NodeId[],\n\tplaceToInsert: StablePlace\n): TransactionView {\n\treturn view.attachRange(nodesToInsert, placeFromStablePlace(view, placeToInsert));\n}\n\n/**\n * Detaches a range of nodes from their parent. The detached nodes remain in the TreeView.\n * @param rangeToDetach - the range of nodes to detach\n */\nexport function detachRange(\n\tview: TransactionView,\n\trangeToDetach: StableRange\n): { view: TransactionView; detached: readonly NodeId[] } {\n\treturn view.detachRange(rangeFromStableRange(view, rangeToDetach));\n}\n\n/**\n * Deeply clone the given StablePlace\n */\nexport function deepCloneStablePlace(place: StablePlace): StablePlace {\n\tconst clone: StablePlace = { side: place.side };\n\tcopyPropertyIfDefined(place, clone, 'referenceSibling');\n\tcopyPropertyIfDefined(place, clone, 'referenceTrait');\n\treturn clone;\n}\n\n/**\n * Deeply clone the given StableRange\n */\nexport function deepCloneStableRange(range: StableRange): StableRange {\n\treturn { start: deepCloneStablePlace(range.start), end: deepCloneStablePlace(range.end) };\n}\n\n/** Convert a node used in a Build change into its internal representation */\nexport function internalizeBuildNode(\n\tnodeData: BuildTreeNode,\n\tnodeIdContext: NodeIdContext\n): Omit<TreeNode<BuildNodeInternal, NodeId>, 'traits'> {\n\tconst output = {\n\t\tdefinition: nodeData.definition as Definition,\n\t\tidentifier: nodeData.identifier ?? nodeIdContext.generateNodeId(),\n\t};\n\tcopyPropertyIfDefined(nodeData, output, 'payload');\n\treturn output;\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* An event emitted by a `SharedTree` to indicate a state change. See {@link ISharedTreeEvents} for event argument information.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare enum SharedTreeEvent {
|
|
10
|
+
/**
|
|
11
|
+
* An edit has been committed to the log.
|
|
12
|
+
* This happens when either:
|
|
13
|
+
* 1. A locally generated edit is added to the log.
|
|
14
|
+
* 2. A remotely generated edit is added to the log.
|
|
15
|
+
* Note that, for locally generated edits, this event will not be emitted again when that edit is sequenced.
|
|
16
|
+
* Passed the EditId of the committed edit, i.e. supports callbacks of type {@link EditCommittedHandler}.
|
|
17
|
+
*/
|
|
18
|
+
EditCommitted = "committedEdit",
|
|
19
|
+
/**
|
|
20
|
+
* A sequenced edit has been applied.
|
|
21
|
+
* This includes local edits though the callback is only invoked once the sequenced version is received.
|
|
22
|
+
* For edits that were local (see {@link SequencedEditAppliedEventArguments.wasLocal}, this callback will only be called once.
|
|
23
|
+
* For non-local edits, it may be called multiple times: the number of calls and when they occur depends on caching and is an
|
|
24
|
+
* implementation detail.
|
|
25
|
+
* Supports callbacks of type {@link SequencedEditAppliedHandler}.
|
|
26
|
+
*/
|
|
27
|
+
SequencedEditApplied = "sequencedEditApplied"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An event emitted by a `SharedTree` for diagnostic purposes.
|
|
31
|
+
* See {@link ISharedTreeEvents} for event argument information.
|
|
32
|
+
*/
|
|
33
|
+
export declare enum SharedTreeDiagnosticEvent {
|
|
34
|
+
/**
|
|
35
|
+
* A single catch up blob has been uploaded.
|
|
36
|
+
*/
|
|
37
|
+
CatchUpBlobUploaded = "uploadedCatchUpBlob",
|
|
38
|
+
/**
|
|
39
|
+
* An edit chunk blob has been uploaded. This includes catchup blobs.
|
|
40
|
+
*/
|
|
41
|
+
EditChunkUploaded = "uploadedEditChunk",
|
|
42
|
+
/**
|
|
43
|
+
* A valid edit (local or remote) has been applied.
|
|
44
|
+
* Passed the EditId of the applied edit.
|
|
45
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
46
|
+
* and/or due to not caching the output of every edit.
|
|
47
|
+
*/
|
|
48
|
+
AppliedEdit = "appliedEdit",
|
|
49
|
+
/**
|
|
50
|
+
* An invalid edit (local or remote) has been dropped.
|
|
51
|
+
* Passed the EditId of the dropped edit.
|
|
52
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
53
|
+
* and/or due to not caching the output of every edit.
|
|
54
|
+
*/
|
|
55
|
+
DroppedInvalidEdit = "droppedInvalidEdit",
|
|
56
|
+
/**
|
|
57
|
+
* A malformed edit (local or remote) has been dropped.
|
|
58
|
+
* Passed the EditId of the dropped edit.
|
|
59
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
60
|
+
* and/or due to not caching the output of every edit.
|
|
61
|
+
*/
|
|
62
|
+
DroppedMalformedEdit = "droppedMalformedEdit",
|
|
63
|
+
/**
|
|
64
|
+
* A history chunk has been received that does not have a corresponding edit chunk on the edit log.
|
|
65
|
+
*/
|
|
66
|
+
UnexpectedHistoryChunk = "unexpectedHistoryChunk",
|
|
67
|
+
/**
|
|
68
|
+
* The current write format changed, either because an old summary was loaded or an update op was successfully processed.
|
|
69
|
+
* This event is emitted with the new version as an argument.
|
|
70
|
+
*/
|
|
71
|
+
WriteVersionChanged = "writeVersionChanged"
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=EventTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTypes.d.ts","sourceRoot":"","sources":["../src/EventTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,oBAAY,eAAe;IAC1B;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,oBAAoB,yBAAyB;CAC7C;AAED;;;GAGG;AACH,oBAAY,yBAAyB;IACpC;;OAEG;IACH,mBAAmB,wBAAwB;IAC3C;;OAEG;IACH,iBAAiB,sBAAsB;IACvC;;;;;OAKG;IACH,WAAW,gBAAgB;IAC3B;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;;;OAKG;IACH,oBAAoB,yBAAyB;IAC7C;;OAEG;IACH,sBAAsB,2BAA2B;IACjD;;;OAGG;IACH,mBAAmB,wBAAwB;CAC3C"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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.SharedTreeDiagnosticEvent = exports.SharedTreeEvent = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* An event emitted by a `SharedTree` to indicate a state change. See {@link ISharedTreeEvents} for event argument information.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
var SharedTreeEvent;
|
|
13
|
+
(function (SharedTreeEvent) {
|
|
14
|
+
/**
|
|
15
|
+
* An edit has been committed to the log.
|
|
16
|
+
* This happens when either:
|
|
17
|
+
* 1. A locally generated edit is added to the log.
|
|
18
|
+
* 2. A remotely generated edit is added to the log.
|
|
19
|
+
* Note that, for locally generated edits, this event will not be emitted again when that edit is sequenced.
|
|
20
|
+
* Passed the EditId of the committed edit, i.e. supports callbacks of type {@link EditCommittedHandler}.
|
|
21
|
+
*/
|
|
22
|
+
SharedTreeEvent["EditCommitted"] = "committedEdit";
|
|
23
|
+
/**
|
|
24
|
+
* A sequenced edit has been applied.
|
|
25
|
+
* This includes local edits though the callback is only invoked once the sequenced version is received.
|
|
26
|
+
* For edits that were local (see {@link SequencedEditAppliedEventArguments.wasLocal}, this callback will only be called once.
|
|
27
|
+
* For non-local edits, it may be called multiple times: the number of calls and when they occur depends on caching and is an
|
|
28
|
+
* implementation detail.
|
|
29
|
+
* Supports callbacks of type {@link SequencedEditAppliedHandler}.
|
|
30
|
+
*/
|
|
31
|
+
SharedTreeEvent["SequencedEditApplied"] = "sequencedEditApplied";
|
|
32
|
+
})(SharedTreeEvent = exports.SharedTreeEvent || (exports.SharedTreeEvent = {}));
|
|
33
|
+
/**
|
|
34
|
+
* An event emitted by a `SharedTree` for diagnostic purposes.
|
|
35
|
+
* See {@link ISharedTreeEvents} for event argument information.
|
|
36
|
+
*/
|
|
37
|
+
var SharedTreeDiagnosticEvent;
|
|
38
|
+
(function (SharedTreeDiagnosticEvent) {
|
|
39
|
+
/**
|
|
40
|
+
* A single catch up blob has been uploaded.
|
|
41
|
+
*/
|
|
42
|
+
SharedTreeDiagnosticEvent["CatchUpBlobUploaded"] = "uploadedCatchUpBlob";
|
|
43
|
+
/**
|
|
44
|
+
* An edit chunk blob has been uploaded. This includes catchup blobs.
|
|
45
|
+
*/
|
|
46
|
+
SharedTreeDiagnosticEvent["EditChunkUploaded"] = "uploadedEditChunk";
|
|
47
|
+
/**
|
|
48
|
+
* A valid edit (local or remote) has been applied.
|
|
49
|
+
* Passed the EditId of the applied edit.
|
|
50
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
51
|
+
* and/or due to not caching the output of every edit.
|
|
52
|
+
*/
|
|
53
|
+
SharedTreeDiagnosticEvent["AppliedEdit"] = "appliedEdit";
|
|
54
|
+
/**
|
|
55
|
+
* An invalid edit (local or remote) has been dropped.
|
|
56
|
+
* Passed the EditId of the dropped edit.
|
|
57
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
58
|
+
* and/or due to not caching the output of every edit.
|
|
59
|
+
*/
|
|
60
|
+
SharedTreeDiagnosticEvent["DroppedInvalidEdit"] = "droppedInvalidEdit";
|
|
61
|
+
/**
|
|
62
|
+
* A malformed edit (local or remote) has been dropped.
|
|
63
|
+
* Passed the EditId of the dropped edit.
|
|
64
|
+
* Note that this may be called multiple times, due to concurrent edits causing reordering,
|
|
65
|
+
* and/or due to not caching the output of every edit.
|
|
66
|
+
*/
|
|
67
|
+
SharedTreeDiagnosticEvent["DroppedMalformedEdit"] = "droppedMalformedEdit";
|
|
68
|
+
/**
|
|
69
|
+
* A history chunk has been received that does not have a corresponding edit chunk on the edit log.
|
|
70
|
+
*/
|
|
71
|
+
SharedTreeDiagnosticEvent["UnexpectedHistoryChunk"] = "unexpectedHistoryChunk";
|
|
72
|
+
/**
|
|
73
|
+
* The current write format changed, either because an old summary was loaded or an update op was successfully processed.
|
|
74
|
+
* This event is emitted with the new version as an argument.
|
|
75
|
+
*/
|
|
76
|
+
SharedTreeDiagnosticEvent["WriteVersionChanged"] = "writeVersionChanged";
|
|
77
|
+
})(SharedTreeDiagnosticEvent = exports.SharedTreeDiagnosticEvent || (exports.SharedTreeDiagnosticEvent = {}));
|
|
78
|
+
//# sourceMappingURL=EventTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTypes.js","sourceRoot":"","sources":["../src/EventTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACH,IAAY,eAmBX;AAnBD,WAAY,eAAe;IAC1B;;;;;;;OAOG;IACH,kDAA+B,CAAA;IAC/B;;;;;;;OAOG;IACH,gEAA6C,CAAA;AAC9C,CAAC,EAnBW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmB1B;AAED;;;GAGG;AACH,IAAY,yBAuCX;AAvCD,WAAY,yBAAyB;IACpC;;OAEG;IACH,wEAA2C,CAAA;IAC3C;;OAEG;IACH,oEAAuC,CAAA;IACvC;;;;;OAKG;IACH,wDAA2B,CAAA;IAC3B;;;;;OAKG;IACH,sEAAyC,CAAA;IACzC;;;;;OAKG;IACH,0EAA6C,CAAA;IAC7C;;OAEG;IACH,8EAAiD,CAAA;IACjD;;;OAGG;IACH,wEAA2C,CAAA;AAC5C,CAAC,EAvCW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAuCpC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * An event emitted by a `SharedTree` to indicate a state change. See {@link ISharedTreeEvents} for event argument information.\n * @public\n */\nexport enum SharedTreeEvent {\n\t/**\n\t * An edit has been committed to the log.\n\t * This happens when either:\n\t * \t1. A locally generated edit is added to the log.\n\t * \t2. A remotely generated edit is added to the log.\n\t * Note that, for locally generated edits, this event will not be emitted again when that edit is sequenced.\n\t * Passed the EditId of the committed edit, i.e. supports callbacks of type {@link EditCommittedHandler}.\n\t */\n\tEditCommitted = 'committedEdit',\n\t/**\n\t * A sequenced edit has been applied.\n\t * This includes local edits though the callback is only invoked once the sequenced version is received.\n\t * For edits that were local (see {@link SequencedEditAppliedEventArguments.wasLocal}, this callback will only be called once.\n\t * For non-local edits, it may be called multiple times: the number of calls and when they occur depends on caching and is an\n\t * implementation detail.\n\t * Supports callbacks of type {@link SequencedEditAppliedHandler}.\n\t */\n\tSequencedEditApplied = 'sequencedEditApplied',\n}\n\n/**\n * An event emitted by a `SharedTree` for diagnostic purposes.\n * See {@link ISharedTreeEvents} for event argument information.\n */\nexport enum SharedTreeDiagnosticEvent {\n\t/**\n\t * A single catch up blob has been uploaded.\n\t */\n\tCatchUpBlobUploaded = 'uploadedCatchUpBlob',\n\t/**\n\t * An edit chunk blob has been uploaded. This includes catchup blobs.\n\t */\n\tEditChunkUploaded = 'uploadedEditChunk',\n\t/**\n\t * A valid edit (local or remote) has been applied.\n\t * Passed the EditId of the applied edit.\n\t * Note that this may be called multiple times, due to concurrent edits causing reordering,\n\t * and/or due to not caching the output of every edit.\n\t */\n\tAppliedEdit = 'appliedEdit',\n\t/**\n\t * An invalid edit (local or remote) has been dropped.\n\t * Passed the EditId of the dropped edit.\n\t * Note that this may be called multiple times, due to concurrent edits causing reordering,\n\t * and/or due to not caching the output of every edit.\n\t */\n\tDroppedInvalidEdit = 'droppedInvalidEdit',\n\t/**\n\t * A malformed edit (local or remote) has been dropped.\n\t * Passed the EditId of the dropped edit.\n\t * Note that this may be called multiple times, due to concurrent edits causing reordering,\n\t * and/or due to not caching the output of every edit.\n\t */\n\tDroppedMalformedEdit = 'droppedMalformedEdit',\n\t/**\n\t * A history chunk has been received that does not have a corresponding edit chunk on the edit log.\n\t */\n\tUnexpectedHistoryChunk = 'unexpectedHistoryChunk',\n\t/**\n\t * The current write format changed, either because an old summary was loaded or an update op was successfully processed.\n\t * This event is emitted with the new version as an argument.\n\t */\n\tWriteVersionChanged = 'writeVersionChanged',\n}\n"]}
|