@fluid-experimental/tree 0.58.2000 → 0.58.3000-61081
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/ChangeCompression.d.ts +39 -0
- package/dist/ChangeCompression.d.ts.map +1 -0
- package/dist/ChangeCompression.js +117 -0
- package/dist/ChangeCompression.js.map +1 -0
- package/{lib/default-edits/PersistedTypes.d.ts → dist/ChangeTypes.d.ts} +58 -100
- package/dist/ChangeTypes.d.ts.map +1 -0
- package/dist/{default-edits/PersistedTypes.js → ChangeTypes.js} +21 -76
- package/dist/ChangeTypes.js.map +1 -0
- package/dist/Checkout.d.ts +39 -27
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +59 -31
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +175 -38
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +240 -103
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +24 -0
- package/dist/EagerCheckout.d.ts.map +1 -0
- package/dist/{BasicCheckout.js → EagerCheckout.js} +9 -6
- package/dist/EagerCheckout.js.map +1 -0
- package/dist/EditLog.d.ts +77 -63
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +85 -48
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +168 -0
- package/dist/EditUtilities.d.ts.map +1 -0
- package/dist/EditUtilities.js +373 -0
- package/dist/EditUtilities.js.map +1 -0
- package/dist/EventTypes.d.ts +73 -0
- package/dist/EventTypes.d.ts.map +1 -0
- package/dist/EventTypes.js +78 -0
- package/dist/EventTypes.js.map +1 -0
- package/dist/Forest.d.ts +29 -7
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +60 -36
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +20 -0
- package/dist/HistoryEditFactory.d.ts.map +1 -0
- package/dist/HistoryEditFactory.js +226 -0
- package/dist/HistoryEditFactory.js.map +1 -0
- package/dist/IdConversion.d.ts +12 -0
- package/dist/IdConversion.d.ts.map +1 -0
- package/dist/IdConversion.js +98 -0
- package/dist/IdConversion.js.map +1 -0
- package/dist/Identifiers.d.ts +89 -2
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js +10 -0
- package/dist/Identifiers.js.map +1 -1
- package/dist/InitialTree.d.ts +2 -2
- package/dist/InitialTree.d.ts.map +1 -1
- package/dist/InitialTree.js +2 -1
- package/dist/InitialTree.js.map +1 -1
- package/dist/LazyCheckout.d.ts +28 -0
- package/dist/LazyCheckout.d.ts.map +1 -0
- package/dist/LazyCheckout.js +44 -0
- package/dist/LazyCheckout.js.map +1 -0
- package/dist/LogViewer.d.ts +130 -85
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +110 -85
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts +221 -0
- package/dist/MergeHealth.d.ts.map +1 -0
- package/dist/MergeHealth.js +263 -0
- package/dist/MergeHealth.js.map +1 -0
- package/dist/NodeIdUtilities.d.ts +90 -0
- package/dist/NodeIdUtilities.d.ts.map +1 -0
- package/dist/NodeIdUtilities.js +60 -0
- package/dist/NodeIdUtilities.js.map +1 -0
- package/dist/PayloadUtilities.d.ts +42 -0
- package/dist/PayloadUtilities.d.ts.map +1 -0
- package/dist/PayloadUtilities.js +114 -0
- package/dist/PayloadUtilities.js.map +1 -0
- package/dist/ReconciliationPath.d.ts +18 -13
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +11 -2
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -3
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +83 -0
- package/dist/RevisionView.d.ts.map +1 -0
- package/dist/RevisionView.js +182 -0
- package/dist/RevisionView.js.map +1 -0
- package/dist/SerializationUtilities.d.ts +36 -0
- package/dist/SerializationUtilities.d.ts.map +1 -0
- package/dist/SerializationUtilities.js +102 -0
- package/dist/SerializationUtilities.js.map +1 -0
- package/dist/SharedTree.d.ts +400 -0
- package/dist/SharedTree.d.ts.map +1 -0
- package/dist/SharedTree.js +1064 -0
- package/dist/SharedTree.js.map +1 -0
- package/dist/SharedTreeEncoder.d.ts +102 -0
- package/dist/SharedTreeEncoder.d.ts.map +1 -0
- package/dist/SharedTreeEncoder.js +313 -0
- package/dist/SharedTreeEncoder.js.map +1 -0
- package/dist/StringInterner.d.ts +46 -0
- package/dist/StringInterner.d.ts.map +1 -0
- package/dist/StringInterner.js +61 -0
- package/dist/StringInterner.js.map +1 -0
- package/dist/Summary.d.ts +40 -0
- package/dist/Summary.d.ts.map +1 -0
- package/dist/Summary.js +23 -0
- package/dist/Summary.js.map +1 -0
- package/dist/SummaryBackCompatibility.d.ts +22 -22
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js +30 -33
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +31 -0
- package/dist/SummaryTestUtilities.d.ts.map +1 -0
- package/dist/SummaryTestUtilities.js +37 -0
- package/dist/SummaryTestUtilities.js.map +1 -0
- package/dist/Transaction.d.ts +53 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +76 -0
- package/dist/Transaction.js.map +1 -0
- package/dist/TransactionInternal.d.ts +543 -0
- package/dist/TransactionInternal.d.ts.map +1 -0
- package/dist/TransactionInternal.js +622 -0
- package/dist/TransactionInternal.js.map +1 -0
- package/dist/TreeCompressor.d.ts +37 -0
- package/dist/TreeCompressor.d.ts.map +1 -0
- package/dist/TreeCompressor.js +132 -0
- package/dist/TreeCompressor.js.map +1 -0
- package/dist/TreeNodeHandle.d.ts +12 -18
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js +13 -23
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +166 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +217 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/TreeViewUtilities.d.ts +21 -0
- package/dist/TreeViewUtilities.d.ts.map +1 -0
- package/dist/TreeViewUtilities.js +77 -0
- package/dist/TreeViewUtilities.js.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/dist/UndoRedoHandler.d.ts.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +5 -9
- package/dist/UndoRedoHandler.js.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.js +283 -0
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/dist/id-compressor/IdCompressor.d.ts +389 -0
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -0
- package/dist/id-compressor/IdCompressor.js +1353 -0
- package/dist/id-compressor/IdCompressor.js.map +1 -0
- package/dist/id-compressor/IdRange.d.ts +11 -0
- package/dist/id-compressor/IdRange.d.ts.map +1 -0
- package/dist/id-compressor/IdRange.js +29 -0
- package/dist/id-compressor/IdRange.js.map +1 -0
- package/dist/id-compressor/NumericUuid.d.ts +63 -0
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -0
- package/dist/id-compressor/NumericUuid.js +377 -0
- package/dist/id-compressor/NumericUuid.js.map +1 -0
- package/dist/id-compressor/index.d.ts +12 -0
- package/dist/id-compressor/index.d.ts.map +1 -0
- package/dist/id-compressor/index.js +26 -0
- package/dist/id-compressor/index.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/dist/id-compressor/persisted-types/index.d.ts +6 -0
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/index.js +18 -0
- package/dist/id-compressor/persisted-types/index.js.map +1 -0
- package/dist/index.d.ts +29 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +385 -0
- package/dist/persisted-types/0.0.2.d.ts.map +1 -0
- package/dist/persisted-types/0.0.2.js +113 -0
- package/dist/persisted-types/0.0.2.js.map +1 -0
- package/dist/persisted-types/0.1.1.d.ts +314 -0
- package/dist/persisted-types/0.1.1.d.ts.map +1 -0
- package/dist/persisted-types/0.1.1.js +153 -0
- package/dist/persisted-types/0.1.1.js.map +1 -0
- package/dist/persisted-types/index.d.ts +7 -0
- package/dist/persisted-types/index.d.ts.map +1 -0
- package/dist/persisted-types/index.js +20 -0
- package/dist/persisted-types/index.js.map +1 -0
- package/docs/0-1-1-Compression.md +228 -0
- package/docs/Breaking-Change-Migration.md +52 -0
- package/docs/Compression.md +2 -2
- package/docs/Telemetry.md +43 -0
- package/lib/ChangeCompression.d.ts +39 -0
- package/lib/ChangeCompression.d.ts.map +1 -0
- package/lib/ChangeCompression.js +111 -0
- package/lib/ChangeCompression.js.map +1 -0
- package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -100
- package/lib/ChangeTypes.d.ts.map +1 -0
- package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
- package/lib/ChangeTypes.js.map +1 -0
- package/lib/Checkout.d.ts +39 -27
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +51 -23
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +175 -38
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +226 -101
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +24 -0
- package/lib/EagerCheckout.d.ts.map +1 -0
- package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
- package/lib/EagerCheckout.js.map +1 -0
- package/lib/EditLog.d.ts +77 -63
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +83 -47
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +168 -0
- package/lib/EditUtilities.d.ts.map +1 -0
- package/lib/EditUtilities.js +353 -0
- package/lib/EditUtilities.js.map +1 -0
- package/lib/EventTypes.d.ts +73 -0
- package/lib/EventTypes.d.ts.map +1 -0
- package/lib/EventTypes.js +75 -0
- package/lib/EventTypes.js.map +1 -0
- package/lib/Forest.d.ts +29 -7
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +58 -35
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +20 -0
- package/lib/HistoryEditFactory.d.ts.map +1 -0
- package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
- package/lib/HistoryEditFactory.js.map +1 -0
- package/lib/IdConversion.d.ts +12 -0
- package/lib/IdConversion.d.ts.map +1 -0
- package/lib/IdConversion.js +91 -0
- package/lib/IdConversion.js.map +1 -0
- package/lib/Identifiers.d.ts +89 -2
- package/lib/Identifiers.d.ts.map +1 -1
- package/lib/Identifiers.js +8 -1
- package/lib/Identifiers.js.map +1 -1
- package/lib/InitialTree.d.ts +2 -2
- package/lib/InitialTree.d.ts.map +1 -1
- package/lib/InitialTree.js +2 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LazyCheckout.d.ts +28 -0
- package/lib/LazyCheckout.d.ts.map +1 -0
- package/lib/LazyCheckout.js +40 -0
- package/lib/LazyCheckout.js.map +1 -0
- package/lib/LogViewer.d.ts +130 -85
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +102 -77
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts +221 -0
- package/lib/MergeHealth.d.ts.map +1 -0
- package/lib/MergeHealth.js +258 -0
- package/lib/MergeHealth.js.map +1 -0
- package/lib/NodeIdUtilities.d.ts +90 -0
- package/lib/NodeIdUtilities.d.ts.map +1 -0
- package/lib/NodeIdUtilities.js +53 -0
- package/lib/NodeIdUtilities.js.map +1 -0
- package/lib/PayloadUtilities.d.ts +42 -0
- package/lib/PayloadUtilities.d.ts.map +1 -0
- package/lib/PayloadUtilities.js +110 -0
- package/lib/PayloadUtilities.js.map +1 -0
- package/lib/ReconciliationPath.d.ts +18 -13
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +11 -2
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -3
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +83 -0
- package/lib/RevisionView.d.ts.map +1 -0
- package/lib/RevisionView.js +175 -0
- package/lib/RevisionView.js.map +1 -0
- package/lib/SerializationUtilities.d.ts +36 -0
- package/lib/SerializationUtilities.d.ts.map +1 -0
- package/lib/SerializationUtilities.js +95 -0
- package/lib/SerializationUtilities.js.map +1 -0
- package/lib/SharedTree.d.ts +400 -0
- package/lib/SharedTree.d.ts.map +1 -0
- package/lib/SharedTree.js +1059 -0
- package/lib/SharedTree.js.map +1 -0
- package/lib/SharedTreeEncoder.d.ts +102 -0
- package/lib/SharedTreeEncoder.d.ts.map +1 -0
- package/lib/SharedTreeEncoder.js +308 -0
- package/lib/SharedTreeEncoder.js.map +1 -0
- package/lib/StringInterner.d.ts +46 -0
- package/lib/StringInterner.d.ts.map +1 -0
- package/lib/StringInterner.js +57 -0
- package/lib/StringInterner.js.map +1 -0
- package/lib/Summary.d.ts +40 -0
- package/lib/Summary.d.ts.map +1 -0
- package/lib/Summary.js +19 -0
- package/lib/Summary.js.map +1 -0
- package/lib/SummaryBackCompatibility.d.ts +22 -22
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js +29 -32
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +31 -0
- package/lib/SummaryTestUtilities.d.ts.map +1 -0
- package/lib/SummaryTestUtilities.js +32 -0
- package/lib/SummaryTestUtilities.js.map +1 -0
- package/lib/Transaction.d.ts +53 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +72 -0
- package/lib/Transaction.js.map +1 -0
- package/lib/TransactionInternal.d.ts +543 -0
- package/lib/TransactionInternal.d.ts.map +1 -0
- package/lib/TransactionInternal.js +618 -0
- package/lib/TransactionInternal.js.map +1 -0
- package/lib/TreeCompressor.d.ts +37 -0
- package/lib/TreeCompressor.d.ts.map +1 -0
- package/lib/TreeCompressor.js +128 -0
- package/lib/TreeCompressor.js.map +1 -0
- package/lib/TreeNodeHandle.d.ts +12 -18
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js +14 -24
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +166 -0
- package/lib/TreeView.d.ts.map +1 -0
- package/lib/TreeView.js +213 -0
- package/lib/TreeView.js.map +1 -0
- package/lib/TreeViewUtilities.d.ts +21 -0
- package/lib/TreeViewUtilities.d.ts.map +1 -0
- package/lib/TreeViewUtilities.js +71 -0
- package/lib/TreeViewUtilities.js.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/lib/UndoRedoHandler.d.ts.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
- package/lib/UndoRedoHandler.js.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/lib/id-compressor/IdCompressor.d.ts +389 -0
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
- package/lib/id-compressor/IdCompressor.js +1343 -0
- package/lib/id-compressor/IdCompressor.js.map +1 -0
- package/lib/id-compressor/IdRange.d.ts +11 -0
- package/lib/id-compressor/IdRange.d.ts.map +1 -0
- package/lib/id-compressor/IdRange.js +25 -0
- package/lib/id-compressor/IdRange.js.map +1 -0
- package/lib/id-compressor/NumericUuid.d.ts +63 -0
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
- package/lib/id-compressor/NumericUuid.js +365 -0
- package/lib/id-compressor/NumericUuid.js.map +1 -0
- package/lib/id-compressor/index.d.ts +12 -0
- package/lib/id-compressor/index.d.ts.map +1 -0
- package/lib/id-compressor/index.js +12 -0
- package/lib/id-compressor/index.js.map +1 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/lib/id-compressor/persisted-types/index.d.ts +6 -0
- package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/lib/id-compressor/persisted-types/index.js +6 -0
- package/lib/id-compressor/persisted-types/index.js.map +1 -0
- package/lib/index.d.ts +29 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +23 -6
- package/lib/index.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +385 -0
- package/lib/persisted-types/0.0.2.d.ts.map +1 -0
- package/lib/persisted-types/0.0.2.js +110 -0
- package/lib/persisted-types/0.0.2.js.map +1 -0
- package/lib/persisted-types/0.1.1.d.ts +314 -0
- package/lib/persisted-types/0.1.1.d.ts.map +1 -0
- package/lib/persisted-types/0.1.1.js +150 -0
- package/lib/persisted-types/0.1.1.js.map +1 -0
- package/lib/persisted-types/index.d.ts +7 -0
- package/lib/persisted-types/index.d.ts.map +1 -0
- package/lib/persisted-types/index.js +8 -0
- package/lib/persisted-types/index.js.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.js +169 -0
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
- package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
- package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
- package/lib/test/ChangeCompression.tests.js +145 -0
- package/lib/test/ChangeCompression.tests.js.map +1 -0
- package/lib/test/Checkout.tests.d.ts +2 -3
- package/lib/test/Checkout.tests.d.ts.map +1 -1
- package/lib/test/Checkout.tests.js +126 -69
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Common.tests.js +60 -2
- package/lib/test/Common.tests.js.map +1 -1
- package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
- package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
- package/lib/test/EagerCheckout.tests.js +20 -0
- package/lib/test/EagerCheckout.tests.js.map +1 -0
- package/lib/test/Edit.tests.js +22 -14
- package/lib/test/Edit.tests.js.map +1 -1
- package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
- package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
- package/lib/test/EditLog.perf.tests.js +30 -0
- package/lib/test/EditLog.perf.tests.js.map +1 -0
- package/lib/test/EditLog.tests.js +10 -6
- package/lib/test/EditLog.tests.js.map +1 -1
- package/lib/test/EditUtilities.tests.d.ts +6 -0
- package/lib/test/EditUtilities.tests.d.ts.map +1 -0
- package/lib/test/EditUtilities.tests.js +503 -0
- package/lib/test/EditUtilities.tests.js.map +1 -0
- package/lib/test/Forest.perf.tests.d.ts +6 -0
- package/lib/test/Forest.perf.tests.d.ts.map +1 -0
- package/lib/test/Forest.perf.tests.js +133 -0
- package/lib/test/Forest.perf.tests.js.map +1 -0
- package/lib/test/Forest.tests.js +54 -27
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/GenericTransaction.tests.js +12 -3
- package/lib/test/GenericTransaction.tests.js.map +1 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
- package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
- package/lib/test/HistoryEditFactory.tests.js +90 -0
- package/lib/test/HistoryEditFactory.tests.js.map +1 -0
- package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
- package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.perf.tests.js +304 -0
- package/lib/test/IdCompressor.perf.tests.js.map +1 -0
- package/lib/test/IdCompressor.tests.d.ts +6 -0
- package/lib/test/IdCompressor.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.tests.js +1075 -0
- package/lib/test/IdCompressor.tests.js.map +1 -0
- package/lib/test/IdConversion.tests.d.ts +6 -0
- package/lib/test/IdConversion.tests.d.ts.map +1 -0
- package/lib/test/IdConversion.tests.js +36 -0
- package/lib/test/IdConversion.tests.js.map +1 -0
- package/lib/test/LazyCheckout.tests.d.ts +6 -0
- package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
- package/lib/test/LazyCheckout.tests.js +22 -0
- package/lib/test/LazyCheckout.tests.js.map +1 -0
- package/lib/test/LogViewer.tests.js +269 -187
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
- package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
- package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.perf.tests.js +68 -0
- package/lib/test/NumericUuid.perf.tests.js.map +1 -0
- package/lib/test/NumericUuid.tests.d.ts +6 -0
- package/lib/test/NumericUuid.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.tests.js +191 -0
- package/lib/test/NumericUuid.tests.js.map +1 -0
- package/lib/test/RevisionView.tests.d.ts +6 -0
- package/lib/test/RevisionView.tests.d.ts.map +1 -0
- package/lib/test/RevisionView.tests.js +133 -0
- package/lib/test/RevisionView.tests.js.map +1 -0
- package/lib/test/SharedTree.perf.tests.d.ts +6 -0
- package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
- package/lib/test/SharedTree.perf.tests.js +39 -0
- package/lib/test/SharedTree.perf.tests.js.map +1 -0
- package/lib/test/SharedTree.tests.js +15 -3
- package/lib/test/SharedTree.tests.js.map +1 -1
- package/lib/test/StringInterner.tests.d.ts +6 -0
- package/lib/test/StringInterner.tests.d.ts.map +1 -0
- package/lib/test/StringInterner.tests.js +71 -0
- package/lib/test/StringInterner.tests.js.map +1 -0
- package/lib/test/Summary.tests.d.ts +8 -0
- package/lib/test/Summary.tests.d.ts.map +1 -0
- package/lib/test/Summary.tests.js +407 -0
- package/lib/test/Summary.tests.js.map +1 -0
- package/lib/test/Transaction.tests.js +76 -330
- package/lib/test/Transaction.tests.js.map +1 -1
- package/lib/test/TransactionInternal.tests.d.ts +6 -0
- package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
- package/lib/test/TransactionInternal.tests.js +568 -0
- package/lib/test/TransactionInternal.tests.js.map +1 -0
- package/lib/test/TreeCompression.tests.d.ts +6 -0
- package/lib/test/TreeCompression.tests.d.ts.map +1 -0
- package/lib/test/TreeCompression.tests.js +292 -0
- package/lib/test/TreeCompression.tests.js.map +1 -0
- package/lib/test/TreeView.tests.d.ts +6 -0
- package/lib/test/TreeView.tests.d.ts.map +1 -0
- package/lib/test/TreeView.tests.js +147 -0
- package/lib/test/TreeView.tests.js.map +1 -0
- package/lib/test/UndoRedoHandler.tests.js +2 -2
- package/lib/test/UndoRedoHandler.tests.js.map +1 -1
- package/lib/test/Virtualization.tests.js +147 -62
- package/lib/test/Virtualization.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +19 -0
- package/lib/test/fuzz/Generators.d.ts.map +1 -0
- package/lib/test/fuzz/Generators.js +420 -0
- package/lib/test/fuzz/Generators.js.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js +200 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
- package/lib/test/fuzz/Types.d.ts +133 -0
- package/lib/test/fuzz/Types.d.ts.map +1 -0
- package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
- package/lib/test/fuzz/Types.js.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
- package/lib/test/utilities/MockTransaction.d.ts +26 -7
- package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
- package/lib/test/utilities/MockTransaction.js +40 -11
- package/lib/test/utilities/MockTransaction.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
- package/lib/test/utilities/PendingLocalStateTests.js +105 -0
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
- package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +696 -439
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js +345 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
- package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
- package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
- package/lib/test/utilities/SummarySizeTests.js +158 -0
- package/lib/test/utilities/SummarySizeTests.js.map +1 -0
- package/lib/test/utilities/TestCommon.d.ts +9 -0
- package/lib/test/utilities/TestCommon.d.ts.map +1 -0
- package/lib/test/utilities/TestCommon.js +13 -0
- package/lib/test/utilities/TestCommon.js.map +1 -0
- package/lib/test/utilities/TestNode.d.ts +140 -0
- package/lib/test/utilities/TestNode.d.ts.map +1 -0
- package/lib/test/utilities/TestNode.js +292 -0
- package/lib/test/utilities/TestNode.js.map +1 -0
- package/lib/test/utilities/TestUtilities.d.ts +84 -70
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +218 -143
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
- package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
- package/lib/test/utilities/UndoRedoTests.js +138 -149
- package/lib/test/utilities/UndoRedoTests.js.map +1 -1
- package/package.json +19 -14
- package/src/ChangeCompression.ts +159 -0
- package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -120
- package/src/Checkout.ts +81 -52
- package/src/Common.ts +317 -117
- package/src/EagerCheckout.ts +38 -0
- package/src/EditLog.ts +153 -100
- package/src/EditUtilities.ts +559 -0
- package/src/EventTypes.ts +74 -0
- package/src/Forest.ts +81 -73
- package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
- package/src/IdConversion.ts +125 -0
- package/src/Identifiers.ts +101 -1
- package/src/InitialTree.ts +5 -4
- package/src/LazyCheckout.ts +51 -0
- package/src/LogViewer.ts +242 -166
- package/src/MergeHealth.ts +447 -0
- package/src/NodeIdUtilities.ts +141 -0
- package/src/PayloadUtilities.ts +124 -0
- package/src/ReconciliationPath.ts +18 -13
- package/src/RevisionValueCache.ts +14 -5
- package/src/RevisionView.ts +252 -0
- package/src/SerializationUtilities.ts +130 -0
- package/src/SharedTree.ts +1448 -0
- package/src/SharedTreeEncoder.ts +493 -0
- package/src/StringInterner.ts +72 -0
- package/src/Summary.ts +48 -0
- package/src/SummaryBackCompatibility.ts +47 -57
- package/src/SummaryTestUtilities.ts +54 -0
- package/src/Transaction.ts +94 -0
- package/src/TransactionInternal.ts +1088 -0
- package/src/TreeCompressor.ts +222 -0
- package/src/TreeNodeHandle.ts +19 -32
- package/src/TreeView.ts +321 -0
- package/src/TreeViewUtilities.ts +77 -0
- package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
- package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
- package/src/id-compressor/IdCompressor.md +3 -0
- package/src/id-compressor/IdCompressor.ts +1848 -0
- package/src/id-compressor/IdRange.ts +33 -0
- package/src/id-compressor/NumericUuid.ts +414 -0
- package/src/id-compressor/index.ts +13 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
- package/src/id-compressor/persisted-types/README.md +3 -0
- package/src/id-compressor/persisted-types/index.ts +6 -0
- package/src/index.ts +119 -59
- package/src/persisted-types/0.0.2.ts +442 -0
- package/src/persisted-types/0.1.1.ts +476 -0
- package/src/persisted-types/README.md +22 -0
- package/src/persisted-types/index.ts +9 -0
- package/.mocharc.js +0 -41
- package/api/tree.api.md +0 -729
- package/dist/BasicCheckout.d.ts +0 -23
- package/dist/BasicCheckout.d.ts.map +0 -1
- package/dist/BasicCheckout.js.map +0 -1
- package/dist/Snapshot.d.ts +0 -198
- package/dist/Snapshot.d.ts.map +0 -1
- package/dist/Snapshot.js +0 -267
- package/dist/Snapshot.js.map +0 -1
- package/dist/SnapshotUtilities.d.ts +0 -29
- package/dist/SnapshotUtilities.d.ts.map +0 -1
- package/dist/SnapshotUtilities.js +0 -73
- package/dist/SnapshotUtilities.js.map +0 -1
- package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
- package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/dist/anchored-edits/AnchorResolution.js +0 -162
- package/dist/anchored-edits/AnchorResolution.js.map +0 -1
- package/dist/anchored-edits/Factory.d.ts +0 -56
- package/dist/anchored-edits/Factory.d.ts.map +0 -1
- package/dist/anchored-edits/Factory.js +0 -79
- package/dist/anchored-edits/Factory.js.map +0 -1
- package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
- package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/anchored-edits/PersistedTypes.js +0 -131
- package/dist/anchored-edits/PersistedTypes.js.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
- package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
- package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/dist/anchored-edits/index.d.ts +0 -10
- package/dist/anchored-edits/index.d.ts.map +0 -1
- package/dist/anchored-edits/index.js +0 -34
- package/dist/anchored-edits/index.js.map +0 -1
- package/dist/default-edits/EditUtilities.d.ts +0 -57
- package/dist/default-edits/EditUtilities.d.ts.map +0 -1
- package/dist/default-edits/EditUtilities.js +0 -192
- package/dist/default-edits/EditUtilities.js.map +0 -1
- package/dist/default-edits/Factory.d.ts +0 -56
- package/dist/default-edits/Factory.d.ts.map +0 -1
- package/dist/default-edits/Factory.js +0 -79
- package/dist/default-edits/Factory.js.map +0 -1
- package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
- package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/dist/default-edits/HistoryEditFactory.js +0 -187
- package/dist/default-edits/HistoryEditFactory.js.map +0 -1
- package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/default-edits/PersistedTypes.js.map +0 -1
- package/dist/default-edits/SharedTree.d.ts +0 -111
- package/dist/default-edits/SharedTree.d.ts.map +0 -1
- package/dist/default-edits/SharedTree.js +0 -124
- package/dist/default-edits/SharedTree.js.map +0 -1
- package/dist/default-edits/Summary.d.ts +0 -15
- package/dist/default-edits/Summary.d.ts.map +0 -1
- package/dist/default-edits/Summary.js +0 -35
- package/dist/default-edits/Summary.js.map +0 -1
- package/dist/default-edits/Transaction.d.ts +0 -41
- package/dist/default-edits/Transaction.d.ts.map +0 -1
- package/dist/default-edits/Transaction.js +0 -225
- package/dist/default-edits/Transaction.js.map +0 -1
- package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/dist/default-edits/UndoRedoHandler.js.map +0 -1
- package/dist/default-edits/index.d.ts +0 -13
- package/dist/default-edits/index.d.ts.map +0 -1
- package/dist/default-edits/index.js +0 -41
- package/dist/default-edits/index.js.map +0 -1
- package/dist/generic/GenericEditUtilities.d.ts +0 -26
- package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
- package/dist/generic/GenericEditUtilities.js +0 -45
- package/dist/generic/GenericEditUtilities.js.map +0 -1
- package/dist/generic/GenericSharedTree.d.ts +0 -221
- package/dist/generic/GenericSharedTree.d.ts.map +0 -1
- package/dist/generic/GenericSharedTree.js +0 -447
- package/dist/generic/GenericSharedTree.js.map +0 -1
- package/dist/generic/GenericTransaction.d.ts +0 -87
- package/dist/generic/GenericTransaction.d.ts.map +0 -1
- package/dist/generic/GenericTransaction.js +0 -144
- package/dist/generic/GenericTransaction.js.map +0 -1
- package/dist/generic/PersistedTypes.d.ts +0 -194
- package/dist/generic/PersistedTypes.d.ts.map +0 -1
- package/dist/generic/PersistedTypes.js +0 -42
- package/dist/generic/PersistedTypes.js.map +0 -1
- package/dist/generic/Summary.d.ts +0 -63
- package/dist/generic/Summary.d.ts.map +0 -1
- package/dist/generic/Summary.js +0 -64
- package/dist/generic/Summary.js.map +0 -1
- package/dist/generic/index.d.ts +0 -10
- package/dist/generic/index.d.ts.map +0 -1
- package/dist/generic/index.js +0 -26
- package/dist/generic/index.js.map +0 -1
- package/lib/BasicCheckout.d.ts +0 -23
- package/lib/BasicCheckout.d.ts.map +0 -1
- package/lib/BasicCheckout.js.map +0 -1
- package/lib/Snapshot.d.ts +0 -198
- package/lib/Snapshot.d.ts.map +0 -1
- package/lib/Snapshot.js +0 -263
- package/lib/Snapshot.js.map +0 -1
- package/lib/SnapshotUtilities.d.ts +0 -29
- package/lib/SnapshotUtilities.d.ts.map +0 -1
- package/lib/SnapshotUtilities.js +0 -67
- package/lib/SnapshotUtilities.js.map +0 -1
- package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
- package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/lib/anchored-edits/AnchorResolution.js +0 -152
- package/lib/anchored-edits/AnchorResolution.js.map +0 -1
- package/lib/anchored-edits/Factory.d.ts +0 -56
- package/lib/anchored-edits/Factory.d.ts.map +0 -1
- package/lib/anchored-edits/Factory.js +0 -74
- package/lib/anchored-edits/Factory.js.map +0 -1
- package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
- package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/anchored-edits/PersistedTypes.js +0 -128
- package/lib/anchored-edits/PersistedTypes.js.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
- package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
- package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/lib/anchored-edits/index.d.ts +0 -10
- package/lib/anchored-edits/index.d.ts.map +0 -1
- package/lib/anchored-edits/index.js +0 -11
- package/lib/anchored-edits/index.js.map +0 -1
- package/lib/default-edits/EditUtilities.d.ts +0 -57
- package/lib/default-edits/EditUtilities.d.ts.map +0 -1
- package/lib/default-edits/EditUtilities.js +0 -181
- package/lib/default-edits/EditUtilities.js.map +0 -1
- package/lib/default-edits/Factory.d.ts +0 -56
- package/lib/default-edits/Factory.d.ts.map +0 -1
- package/lib/default-edits/Factory.js +0 -74
- package/lib/default-edits/Factory.js.map +0 -1
- package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
- package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/lib/default-edits/HistoryEditFactory.js.map +0 -1
- package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/default-edits/PersistedTypes.js.map +0 -1
- package/lib/default-edits/SharedTree.d.ts +0 -111
- package/lib/default-edits/SharedTree.d.ts.map +0 -1
- package/lib/default-edits/SharedTree.js +0 -100
- package/lib/default-edits/SharedTree.js.map +0 -1
- package/lib/default-edits/Summary.d.ts +0 -15
- package/lib/default-edits/Summary.d.ts.map +0 -1
- package/lib/default-edits/Summary.js +0 -31
- package/lib/default-edits/Summary.js.map +0 -1
- package/lib/default-edits/Transaction.d.ts +0 -41
- package/lib/default-edits/Transaction.d.ts.map +0 -1
- package/lib/default-edits/Transaction.js +0 -221
- package/lib/default-edits/Transaction.js.map +0 -1
- package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/lib/default-edits/UndoRedoHandler.js.map +0 -1
- package/lib/default-edits/index.d.ts +0 -13
- package/lib/default-edits/index.d.ts.map +0 -1
- package/lib/default-edits/index.js +0 -14
- package/lib/default-edits/index.js.map +0 -1
- package/lib/generic/GenericEditUtilities.d.ts +0 -26
- package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
- package/lib/generic/GenericEditUtilities.js +0 -38
- package/lib/generic/GenericEditUtilities.js.map +0 -1
- package/lib/generic/GenericSharedTree.d.ts +0 -221
- package/lib/generic/GenericSharedTree.d.ts.map +0 -1
- package/lib/generic/GenericSharedTree.js +0 -443
- package/lib/generic/GenericSharedTree.js.map +0 -1
- package/lib/generic/GenericTransaction.d.ts +0 -87
- package/lib/generic/GenericTransaction.d.ts.map +0 -1
- package/lib/generic/GenericTransaction.js +0 -140
- package/lib/generic/GenericTransaction.js.map +0 -1
- package/lib/generic/PersistedTypes.d.ts +0 -194
- package/lib/generic/PersistedTypes.d.ts.map +0 -1
- package/lib/generic/PersistedTypes.js +0 -39
- package/lib/generic/PersistedTypes.js.map +0 -1
- package/lib/generic/Summary.d.ts +0 -63
- package/lib/generic/Summary.d.ts.map +0 -1
- package/lib/generic/Summary.js +0 -58
- package/lib/generic/Summary.js.map +0 -1
- package/lib/generic/index.d.ts +0 -10
- package/lib/generic/index.d.ts.map +0 -1
- package/lib/generic/index.js +0 -11
- package/lib/generic/index.js.map +0 -1
- package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
- package/lib/test/Anchors.glassBox.tests.js +0 -410
- package/lib/test/Anchors.glassBox.tests.js.map +0 -1
- package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
- package/lib/test/BasicCheckout.tests.js +0 -8
- package/lib/test/BasicCheckout.tests.js.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
- package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
- package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
- package/lib/test/Snapshot.tests.d.ts.map +0 -1
- package/lib/test/Snapshot.tests.js +0 -96
- package/lib/test/Snapshot.tests.js.map +0 -1
- package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
- package/lib/test/SnapshotUtilities.tests.js +0 -168
- package/lib/test/SnapshotUtilities.tests.js.map +0 -1
- package/lib/test/undoRedoStackManager.d.ts +0 -26
- package/lib/test/undoRedoStackManager.d.ts.map +0 -1
- package/lib/test/undoRedoStackManager.js +0 -176
- package/lib/test/undoRedoStackManager.js.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
- package/src/BasicCheckout.ts +0 -34
- package/src/Snapshot.ts +0 -363
- package/src/SnapshotUtilities.ts +0 -88
- package/src/anchored-edits/AnchorResolution.ts +0 -442
- package/src/anchored-edits/Factory.ts +0 -94
- package/src/anchored-edits/PersistedTypes.ts +0 -310
- package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
- package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
- package/src/anchored-edits/index.ts +0 -21
- package/src/default-edits/EditUtilities.ts +0 -220
- package/src/default-edits/Factory.ts +0 -94
- package/src/default-edits/SharedTree.ts +0 -174
- package/src/default-edits/Summary.ts +0 -44
- package/src/default-edits/Transaction.ts +0 -262
- package/src/default-edits/index.ts +0 -29
- package/src/generic/GenericEditUtilities.ts +0 -46
- package/src/generic/GenericSharedTree.ts +0 -593
- package/src/generic/GenericTransaction.ts +0 -194
- package/src/generic/PersistedTypes.ts +0 -221
- package/src/generic/Summary.ts +0 -113
- package/src/generic/index.ts +0 -41
|
@@ -2,68 +2,39 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { resolve } from 'path';
|
|
6
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
6
7
|
import { expect } from 'chai';
|
|
7
|
-
import {
|
|
8
|
+
import { SummaryCollection } from '@fluidframework/container-runtime';
|
|
9
|
+
import { Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';
|
|
8
10
|
import { requestFluidObject } from '@fluidframework/runtime-utils';
|
|
9
11
|
import { MockContainerRuntimeFactory, MockFluidDataStoreRuntime, MockStorage, } from '@fluidframework/test-runtime-utils';
|
|
10
|
-
import { TestObjectProvider, TestContainerRuntimeFactory, TestFluidObjectFactory, } from '@fluidframework/test-utils';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { TestObjectProvider, TestContainerRuntimeFactory, TestFluidObjectFactory, createAndAttachContainer, } from '@fluidframework/test-utils';
|
|
13
|
+
import { LocalServerTestDriver } from '@fluidframework/test-drivers';
|
|
14
|
+
import { TelemetryNullLogger } from '@fluidframework/common-utils';
|
|
15
|
+
import { assert, fail, identity } from '../../Common';
|
|
16
|
+
import { IdCompressor } from '../../id-compressor';
|
|
17
|
+
import { createSessionId } from '../../id-compressor/NumericUuid';
|
|
18
|
+
import { getChangeNodeFromViewNode } from '../../SerializationUtilities';
|
|
13
19
|
import { initialTree } from '../../InitialTree';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export const simpleTestTree = Object.assign(Object.assign({}, makeEmptyNode('25de3875-9537-47ec-8699-8a85e772a509')), { traits: { [leftTraitLabel]: [left], [rightTraitLabel]: [right] } });
|
|
29
|
-
/** Convenient pre-made TraitLocation for the left trait of 'simpleTestTree'. */
|
|
30
|
-
export const leftTraitLocation = {
|
|
31
|
-
parent: simpleTestTree.identifier,
|
|
32
|
-
label: leftTraitLabel,
|
|
33
|
-
};
|
|
34
|
-
/** Convenient pre-made TraitLocation for the right trait of 'simpleTestTree'. */
|
|
35
|
-
export const rightTraitLocation = {
|
|
36
|
-
parent: simpleTestTree.identifier,
|
|
37
|
-
label: rightTraitLabel,
|
|
38
|
-
};
|
|
39
|
-
/** Convenient pre-made Snapshot for 'simpleTestTree'. */
|
|
40
|
-
export const simpleTreeSnapshot = Snapshot.fromTree(simpleTestTree);
|
|
41
|
-
/** Convenient pre-made Snapshot for 'initialTree'. */
|
|
42
|
-
export const initialSnapshot = Snapshot.fromTree(initialTree);
|
|
43
|
-
/**
|
|
44
|
-
* Convenient pre-made Snapshot for 'simpleTestTree'.
|
|
45
|
-
* Expensive validation is turned on for this snapshot, and it should not be used for performance testing.
|
|
46
|
-
*/
|
|
47
|
-
export const simpleTreeSnapshotWithValidation = Snapshot.fromTree(simpleTestTree, true);
|
|
48
|
-
/**
|
|
49
|
-
* Convenient pre-made Snapshot for 'initialTree'.
|
|
50
|
-
* Expensive validation is turned on for this snapshot, and it should not be used for performance testing.
|
|
51
|
-
*/
|
|
52
|
-
export const initialSnapshotWithValidation = Snapshot.fromTree(initialTree, true);
|
|
53
|
-
export const testTrait = {
|
|
54
|
-
parent: initialSnapshot.root,
|
|
55
|
-
label: 'e276f382-fa99-49a1-ae81-42001791c733',
|
|
56
|
-
};
|
|
57
|
-
/** Sets up and returns an object of components useful for testing SharedTree. */
|
|
58
|
-
export function setUpTestSharedTree(options) {
|
|
59
|
-
return setUpTestSharedTreeGeneric(SharedTree.getFactory, options);
|
|
60
|
-
}
|
|
61
|
-
/** Sets up and returns an object of components useful for testing SharedTreeWithAnchors. */
|
|
62
|
-
export function setUpTestSharedTreeWithAnchors(options) {
|
|
63
|
-
return setUpTestSharedTreeGeneric(SharedTreeWithAnchors.getFactory, options);
|
|
20
|
+
import { ChangeInternal, reservedIdCount, WriteFormat, } from '../../persisted-types';
|
|
21
|
+
import { SharedTreeDiagnosticEvent } from '../../EventTypes';
|
|
22
|
+
import { getNodeId, getNodeIdContext } from '../../NodeIdUtilities';
|
|
23
|
+
import { newEdit, setTrait } from '../../EditUtilities';
|
|
24
|
+
import { SharedTree } from '../../SharedTree';
|
|
25
|
+
import { StablePlace } from '../../ChangeTypes';
|
|
26
|
+
import { convertEditIds } from '../../IdConversion';
|
|
27
|
+
import { buildLeaf, RefreshingTestTree, SimpleTestTree } from './TestNode';
|
|
28
|
+
export const testTraitLabel = SimpleTestTree.traitLabel;
|
|
29
|
+
export function testTrait(view) {
|
|
30
|
+
return {
|
|
31
|
+
label: testTraitLabel,
|
|
32
|
+
parent: view.root,
|
|
33
|
+
};
|
|
64
34
|
}
|
|
65
|
-
|
|
66
|
-
|
|
35
|
+
/** Sets up and returns an object of components useful for testing SharedTree. */
|
|
36
|
+
export function setUpTestSharedTree(options = { localMode: true }) {
|
|
37
|
+
const { id, initialTree, localMode, containerRuntimeFactory, setupEditId, summarizeHistory, writeFormat } = options;
|
|
67
38
|
let componentRuntime;
|
|
68
39
|
if (options.logger) {
|
|
69
40
|
const proxyHandler = {
|
|
@@ -80,7 +51,7 @@ function setUpTestSharedTreeGeneric(factoryGetter, options = { localMode: true }
|
|
|
80
51
|
componentRuntime = new MockFluidDataStoreRuntime();
|
|
81
52
|
}
|
|
82
53
|
// Enable expensiveValidation
|
|
83
|
-
const factory =
|
|
54
|
+
const factory = SharedTree.getFactory(writeFormat !== null && writeFormat !== void 0 ? writeFormat : WriteFormat.v0_1_1, summarizeHistory === undefined || summarizeHistory === true ? { uploadEditChunks: true } : false);
|
|
84
55
|
const tree = factory.create(componentRuntime, id === undefined ? 'testSharedTree' : id, true);
|
|
85
56
|
if (options.allowInvalid === undefined || !options.allowInvalid) {
|
|
86
57
|
tree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));
|
|
@@ -118,102 +89,110 @@ function setUpTestSharedTreeGeneric(factoryGetter, options = { localMode: true }
|
|
|
118
89
|
};
|
|
119
90
|
}
|
|
120
91
|
const TestDataStoreType = '@fluid-example/test-dataStore';
|
|
92
|
+
const testObjectProviders = [];
|
|
93
|
+
afterEach(() => {
|
|
94
|
+
for (const provider of testObjectProviders) {
|
|
95
|
+
provider.reset();
|
|
96
|
+
}
|
|
97
|
+
testObjectProviders.length = 0;
|
|
98
|
+
});
|
|
121
99
|
/**
|
|
122
100
|
* Sets up and returns an object of components useful for testing SharedTree with a local server.
|
|
123
101
|
* Required for tests that involve the uploadBlob API.
|
|
124
102
|
*
|
|
125
|
-
*
|
|
103
|
+
* Any TestObjectProvider created by this function will be reset after the test completes (via afterEach) hook.
|
|
126
104
|
*/
|
|
127
105
|
export async function setUpLocalServerTestSharedTree(options) {
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Sets up and returns an object of components useful for testing SharedTreeWithAnchors with a local server.
|
|
132
|
-
* Required for tests that involve the uploadBlob API.
|
|
133
|
-
*
|
|
134
|
-
* If using this method, be sure to clean up server state by calling `reset` on the TestObjectProvider.
|
|
135
|
-
*/
|
|
136
|
-
export async function setUpLocalServerTestSharedTreeWithAnchors(options) {
|
|
137
|
-
return setUpLocalServerTestSharedTreeGeneric(SharedTreeWithAnchors.getFactory, options);
|
|
138
|
-
}
|
|
139
|
-
async function setUpLocalServerTestSharedTreeGeneric(factoryGetter, options) {
|
|
140
|
-
const { id, initialTree, testObjectProvider, setupEditId, summarizeHistory } = options;
|
|
106
|
+
const { blobs, headers, id, initialTree, testObjectProvider, setupEditId, summarizeHistory, writeFormat, uploadEditChunks, } = options;
|
|
141
107
|
const treeId = id !== null && id !== void 0 ? id : 'test';
|
|
142
|
-
const registry = [
|
|
108
|
+
const registry = [
|
|
109
|
+
[
|
|
110
|
+
treeId,
|
|
111
|
+
SharedTree.getFactory(writeFormat !== null && writeFormat !== void 0 ? writeFormat : WriteFormat.v0_1_1, summarizeHistory === undefined || summarizeHistory === true
|
|
112
|
+
? { uploadEditChunks: uploadEditChunks !== null && uploadEditChunks !== void 0 ? uploadEditChunks : true }
|
|
113
|
+
: false),
|
|
114
|
+
],
|
|
115
|
+
];
|
|
143
116
|
const innerRequestHandler = async (request, runtime) => runtime.IFluidHandleContext.resolveHandle(request);
|
|
144
117
|
const runtimeFactory = () => new TestContainerRuntimeFactory(TestDataStoreType, new TestFluidObjectFactory(registry), {
|
|
145
118
|
summaryOptions: { initialSummarizerDelayMs: 0 },
|
|
146
119
|
}, [innerRequestHandler]);
|
|
120
|
+
const defaultCodeDetails = {
|
|
121
|
+
package: 'defaultTestPackage',
|
|
122
|
+
config: {},
|
|
123
|
+
};
|
|
124
|
+
function makeTestLoader(provider) {
|
|
125
|
+
const fluidEntryPoint = runtimeFactory();
|
|
126
|
+
return provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {
|
|
127
|
+
options: { maxClientLeaveWaitTime: 1000 },
|
|
128
|
+
});
|
|
129
|
+
}
|
|
147
130
|
let provider;
|
|
148
131
|
let container;
|
|
149
132
|
if (testObjectProvider !== undefined) {
|
|
150
133
|
provider = testObjectProvider;
|
|
151
|
-
|
|
134
|
+
const driver = new LocalServerTestDriver();
|
|
135
|
+
const loader = makeTestLoader(provider);
|
|
136
|
+
// Once ILoaderOptions is specificable, this should use `provider.loadTestContainer` instead.
|
|
137
|
+
container = (await loader.resolve({ url: await driver.createContainerUrl(treeId), headers }));
|
|
138
|
+
await waitContainerToCatchUp(container);
|
|
152
139
|
}
|
|
153
140
|
else {
|
|
154
|
-
|
|
155
|
-
|
|
141
|
+
const driver = new LocalServerTestDriver();
|
|
142
|
+
provider = new TestObjectProvider(Loader, driver, runtimeFactory);
|
|
143
|
+
testObjectProviders.push(provider);
|
|
144
|
+
// Once ILoaderOptions is specificable, this should use `provider.makeTestContainer` instead.
|
|
145
|
+
const loader = makeTestLoader(provider);
|
|
146
|
+
container = (await createAndAttachContainer(defaultCodeDetails, loader, driver.createCreateNewRequest(treeId)));
|
|
156
147
|
}
|
|
157
|
-
const dataObject = await requestFluidObject(container, '
|
|
148
|
+
const dataObject = await requestFluidObject(container, '/');
|
|
149
|
+
const uploadedBlobs = blobs === undefined ? [] : await Promise.all(blobs.map(async (blob) => dataObject.context.uploadBlob(blob)));
|
|
158
150
|
const tree = await dataObject.getSharedObject(treeId);
|
|
159
151
|
if (initialTree !== undefined && testObjectProvider === undefined) {
|
|
160
152
|
setTestTree(tree, initialTree, setupEditId);
|
|
161
153
|
}
|
|
162
|
-
return { tree, testObjectProvider: provider };
|
|
154
|
+
return { container, tree, testObjectProvider: provider, uploadedBlobs };
|
|
163
155
|
}
|
|
164
156
|
/** Sets testTrait to contain `node`. */
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
/** Creates a node with two children, one under a 'left' trait and one under a 'right' trait */
|
|
176
|
-
export function makeTestNode(identifier = uuidv4()) {
|
|
177
|
-
const definition = 'node';
|
|
178
|
-
const left = makeEmptyNode('c4acaed2-afac-417e-a3d7-07ea73c0330a');
|
|
179
|
-
const right = makeEmptyNode('452c618a-ba0c-4d9b-89f3-2248d27f8c7f');
|
|
180
|
-
const leftTraitLabel = 'left';
|
|
181
|
-
const rightTraitLabel = 'right';
|
|
182
|
-
return {
|
|
183
|
-
definition,
|
|
184
|
-
identifier,
|
|
185
|
-
traits: { [leftTraitLabel]: [left], [rightTraitLabel]: [right] },
|
|
186
|
-
};
|
|
157
|
+
function setTestTree(tree, node, overrideId) {
|
|
158
|
+
const trait = testTrait(tree.currentView);
|
|
159
|
+
if (overrideId === undefined) {
|
|
160
|
+
return tree.applyEdit(...setTrait(trait, node)).id;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
const changes = setTrait(trait, node).map((c) => tree.internalizeChange(c));
|
|
164
|
+
return tree.applyEditInternal({ changes, id: overrideId }).id;
|
|
165
|
+
}
|
|
187
166
|
}
|
|
188
167
|
/**
|
|
189
168
|
* Creates a list of edits with stable IDs that can be processed by a SharedTree.
|
|
190
|
-
* @param numberOfEdits - the number of edits to create
|
|
191
169
|
* @returns the list of created edits
|
|
192
170
|
*/
|
|
193
|
-
export function createStableEdits(numberOfEdits) {
|
|
171
|
+
export function createStableEdits(numberOfEdits, idContext = makeNodeIdContext(), payload = identity) {
|
|
172
|
+
if (numberOfEdits === 0) {
|
|
173
|
+
return [];
|
|
174
|
+
}
|
|
194
175
|
const uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Change.insert(0, StablePlace.before(left)),
|
|
176
|
+
const nodeId = idContext.generateNodeId('ae6b24eb-6fa8-42cc-abd2-48f250b7798f');
|
|
177
|
+
const node = buildLeaf(nodeId);
|
|
178
|
+
const insertEmptyNode = newEdit([
|
|
179
|
+
ChangeInternal.build([node], 0),
|
|
180
|
+
ChangeInternal.insert(0, StablePlace.atEndOf({ label: testTraitLabel, parent: idContext.convertToNodeId(initialTree.identifier) })),
|
|
201
181
|
]);
|
|
202
|
-
const edits = [];
|
|
203
|
-
edits.push(Object.assign(Object.assign({}, firstEdit), { id: uuidv5('test', uuidNamespace) }));
|
|
182
|
+
const edits = [Object.assign(Object.assign({}, insertEmptyNode), { id: uuidv5('test', uuidNamespace) })];
|
|
204
183
|
// Every subsequent edit is a set payload
|
|
205
|
-
for (let i = 1; i < numberOfEdits
|
|
206
|
-
const edit = newEdit([
|
|
184
|
+
for (let i = 1; i < numberOfEdits; i++) {
|
|
185
|
+
const edit = newEdit([ChangeInternal.setPayload(nodeId, payload(i))]);
|
|
207
186
|
edits.push(Object.assign(Object.assign({}, edit), { id: uuidv5(i.toString(), uuidNamespace) }));
|
|
208
187
|
}
|
|
209
188
|
return edits;
|
|
210
189
|
}
|
|
211
190
|
/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */
|
|
212
191
|
export function assertNoDelta(tree, editor) {
|
|
213
|
-
const
|
|
192
|
+
const viewA = tree.currentView;
|
|
214
193
|
editor();
|
|
215
|
-
const
|
|
216
|
-
const delta =
|
|
194
|
+
const viewB = tree.currentView;
|
|
195
|
+
const delta = viewA.delta(viewB);
|
|
217
196
|
expect(delta).deep.equals({
|
|
218
197
|
changed: [],
|
|
219
198
|
added: [],
|
|
@@ -252,42 +231,138 @@ export function areNodesEquivalent(...nodes) {
|
|
|
252
231
|
}
|
|
253
232
|
return true;
|
|
254
233
|
}
|
|
234
|
+
// This accounts for this file being executed after compilation. If many tests want to leverage resources, we should unify
|
|
235
|
+
// resource path logic to a single place.
|
|
236
|
+
export const testDocumentsPathBase = resolve(__dirname, '../../../src/test/documents/');
|
|
237
|
+
export const versionComparator = (versionA, versionB) => {
|
|
238
|
+
const versionASplit = versionA.split('.');
|
|
239
|
+
const versionBSplit = versionB.split('.');
|
|
240
|
+
assert(versionASplit.length === versionBSplit.length && versionASplit.length === 3, 'Version numbers should follow semantic versioning.');
|
|
241
|
+
for (let i = 0; i < 3; ++i) {
|
|
242
|
+
const numberA = parseInt(versionASplit[i], 10);
|
|
243
|
+
const numberB = parseInt(versionBSplit[i], 10);
|
|
244
|
+
if (numberA > numberB) {
|
|
245
|
+
return 1;
|
|
246
|
+
}
|
|
247
|
+
if (numberA < numberB) {
|
|
248
|
+
return -1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return 0;
|
|
252
|
+
};
|
|
255
253
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* See {@link comparePayloads} for payload comparison semantics.
|
|
254
|
+
* Create a {@link SimpleTestTree} from the given {@link SharedTree} or {@link IdCompressor}
|
|
259
255
|
*/
|
|
260
|
-
export function
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
256
|
+
export function setUpTestTree(idSource, expensiveValidation = false) {
|
|
257
|
+
const source = idSource !== null && idSource !== void 0 ? idSource : new IdCompressor(createSessionId(), reservedIdCount);
|
|
258
|
+
if (source instanceof SharedTree) {
|
|
259
|
+
assert(source.edits.length === 0, 'tree must be a new SharedTree');
|
|
260
|
+
const getNormalizer = () => getIdNormalizerFromSharedTree(source);
|
|
261
|
+
const contextWrapper = {
|
|
262
|
+
normalizeToOpSpace: (id) => getNormalizer().normalizeToOpSpace(id),
|
|
263
|
+
normalizeToSessionSpace: (id, sessionId) => getNormalizer().normalizeToSessionSpace(id, sessionId),
|
|
264
|
+
get localSessionId() {
|
|
265
|
+
return getNormalizer().localSessionId;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
const simpleTestTree = new SimpleTestTree(source, contextWrapper, expensiveValidation);
|
|
269
|
+
setTestTree(source, simpleTestTree);
|
|
270
|
+
return simpleTestTree;
|
|
269
271
|
}
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
const context = makeNodeIdContext(source);
|
|
273
|
+
return new SimpleTestTree(context, context, expensiveValidation);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Gets an id normalizer from the provided shared-tree. This is
|
|
277
|
+
*/
|
|
278
|
+
export function getIdNormalizerFromSharedTree(sharedTree) {
|
|
279
|
+
var _a;
|
|
280
|
+
return ((_a = sharedTree.idNormalizer) !== null && _a !== void 0 ? _a : fail('Failed to find SharedTree normalizer'));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Create a {@link SimpleTestTree} before each test
|
|
284
|
+
*/
|
|
285
|
+
export function refreshTestTree(idSourceFactory, fn, expensiveValidation = false) {
|
|
286
|
+
const factory = idSourceFactory !== null && idSourceFactory !== void 0 ? idSourceFactory : (() => new IdCompressor(createSessionId(), reservedIdCount));
|
|
287
|
+
return new RefreshingTestTree(() => {
|
|
288
|
+
return setUpTestTree(factory(), expensiveValidation);
|
|
289
|
+
}, fn);
|
|
290
|
+
}
|
|
291
|
+
export function makeNodeIdContext(idCompressor) {
|
|
292
|
+
const compressor = idCompressor !== null && idCompressor !== void 0 ? idCompressor : new IdCompressor(createSessionId(), reservedIdCount);
|
|
293
|
+
return getNodeIdContext(compressor);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Applies an arbitrary edit to the given SharedTree which leaves the tree in the same state that it was before the edit.
|
|
297
|
+
* This is useful for test scenarios that want to apply edits but don't care what they do.
|
|
298
|
+
*/
|
|
299
|
+
export function applyNoop(tree) {
|
|
300
|
+
return tree.applyEdit(...noopEdit(tree.currentView));
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Creates an arbitrary edit which leaves a tree in the same state that it was before the edit.
|
|
304
|
+
* This is useful for test scenarios that want to create edits but don't care what they do.
|
|
305
|
+
*/
|
|
306
|
+
export function noopEdit(view) {
|
|
307
|
+
const traitLocation = testTrait(view);
|
|
308
|
+
const trait = view.getTrait(traitLocation);
|
|
309
|
+
// Set the test trait to the same thing that it already was
|
|
310
|
+
return setTrait(traitLocation, trait.map((id) => getChangeNodeFromViewNode(view, id)));
|
|
311
|
+
}
|
|
312
|
+
/** Translate an ID in one context to an ID in another */
|
|
313
|
+
export function translateId(id, from, to) {
|
|
314
|
+
return to.convertToNodeId(from.convertToStableNodeId(getNodeId(id)));
|
|
315
|
+
}
|
|
316
|
+
export function normalizeId(tree, id) {
|
|
317
|
+
const normalizer = getIdNormalizerFromSharedTree(tree);
|
|
318
|
+
return normalizer.normalizeToOpSpace(id);
|
|
319
|
+
}
|
|
320
|
+
export function normalizeIds(tree, ...ids) {
|
|
321
|
+
const normalizer = getIdNormalizerFromSharedTree(tree);
|
|
322
|
+
return ids.map((id) => normalizer.normalizeToOpSpace(id));
|
|
323
|
+
}
|
|
324
|
+
export function idsAreEqual(treeA, idsA, treeB, idsB) {
|
|
325
|
+
if (idsA.length !== idsB.length) {
|
|
273
326
|
return false;
|
|
274
327
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
const traitsEqual = compareArrays(childrenA, childrenB, (childA, childB) => {
|
|
281
|
-
if (typeof childA === 'number' || typeof childB === 'number') {
|
|
282
|
-
// Check if children are DetachedSequenceIds
|
|
283
|
-
return childA === childB;
|
|
284
|
-
}
|
|
285
|
-
return deepCompareNodes(childA, childB);
|
|
286
|
-
});
|
|
287
|
-
if (!traitsEqual) {
|
|
328
|
+
const contextA = getIdNormalizerFromSharedTree(treeA);
|
|
329
|
+
const contextB = getIdNormalizerFromSharedTree(treeB);
|
|
330
|
+
for (let i = 0; i < idsA.length; i++) {
|
|
331
|
+
if (contextA.normalizeToOpSpace(idsA[i]) !== contextB.normalizeToOpSpace(idsB[i])) {
|
|
288
332
|
return false;
|
|
289
333
|
}
|
|
290
334
|
}
|
|
291
335
|
return true;
|
|
292
336
|
}
|
|
337
|
+
export function normalizeEdit(tree, edit) {
|
|
338
|
+
const context = getIdNormalizerFromSharedTree(tree);
|
|
339
|
+
return convertEditIds(edit, (id) => context.normalizeToOpSpace(id));
|
|
340
|
+
}
|
|
341
|
+
export function stabilizeEdit(tree, edit) {
|
|
342
|
+
return convertEditIds(edit, (id) => tree.convertToStableNodeId(id));
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Spies on all future ops submitted to `containerRuntimeFactory`. When ops are submitted, they will be `push`ed into the
|
|
346
|
+
* returned array.
|
|
347
|
+
*/
|
|
348
|
+
export function spyOnSubmittedOps(containerRuntimeFactory) {
|
|
349
|
+
const ops = [];
|
|
350
|
+
const originalPush = containerRuntimeFactory.pushMessage.bind(containerRuntimeFactory);
|
|
351
|
+
containerRuntimeFactory.pushMessage = (message) => {
|
|
352
|
+
const { contents } = message;
|
|
353
|
+
ops.push(contents);
|
|
354
|
+
originalPush(message);
|
|
355
|
+
};
|
|
356
|
+
return ops;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Waits for summarization to occur, and returns a version that can be passed into newly loaded containers
|
|
360
|
+
* to ensure they load this summary version. Use the `LoaderHeader.version` header.
|
|
361
|
+
*/
|
|
362
|
+
export async function waitForSummary(mainContainer) {
|
|
363
|
+
const { deltaManager } = mainContainer;
|
|
364
|
+
const summaryCollection = new SummaryCollection(deltaManager, new TelemetryNullLogger());
|
|
365
|
+
const ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);
|
|
366
|
+
return ackedSummary.summaryAck.contents.handle;
|
|
367
|
+
}
|
|
293
368
|
//# sourceMappingURL=TestUtilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestUtilities.js","sourceRoot":"","sources":["../../../src/test/utilities/TestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,WAAW,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAIN,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAqB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAuC,OAAO,EAA2B,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAgC,MAAM,sBAAsB,CAAC;AAC3F,OAAO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["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuidv4, v5 as uuidv5 } from 'uuid';\nimport { expect } from 'chai';\nimport { IContainer } from '@fluidframework/container-definitions';\nimport { Loader } from '@fluidframework/container-loader';\nimport { requestFluidObject } from '@fluidframework/runtime-utils';\nimport {\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from '@fluidframework/test-runtime-utils';\nimport {\n\tChannelFactoryRegistry,\n\tITestContainerConfig,\n\tITestFluidObject,\n\tTestObjectProvider,\n\tTestContainerRuntimeFactory,\n\tTestFluidObjectFactory,\n} from '@fluidframework/test-utils';\nimport { createFluidTestDriver } from '@fluidframework/test-drivers';\nimport { ITelemetryBaseLogger } from '@fluidframework/common-definitions';\nimport { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';\nimport { IRequest } from '@fluidframework/core-interfaces';\nimport { Definition, DetachedSequenceId, EditId, NodeId, TraitLabel } from '../../Identifiers';\nimport { compareArrays, comparePayloads, fail } from '../../Common';\nimport { initialTree } from '../../InitialTree';\nimport { Snapshot } from '../../Snapshot';\nimport { SharedTree, Change, setTrait, SharedTreeFactory, StablePlace } from '../../default-edits';\nimport { ChangeNode, Edit, GenericSharedTree, newEdit, NodeData, TraitLocation } from '../../generic';\nimport { SharedTreeWithAnchors, SharedTreeWithAnchorsFactory } from '../../anchored-edits';\nimport { SharedTreeDiagnosticEvent } from '../../generic/GenericSharedTree';\n\n/** Objects returned by setUpTestSharedTree */\nexport interface SharedTreeTestingComponents<TSharedTree = SharedTree> {\n\t/** The MockFluidDataStoreRuntime used to created the SharedTree. */\n\tcomponentRuntime: MockFluidDataStoreRuntime;\n\t/**\n\t * The MockContainerRuntimeFactory created if one was not provided in the options.\n\t * Only connected to the SharedTree if the localMode option was set to false.\n\t * */\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory;\n\t/** The SharedTree created and set up. */\n\ttree: TSharedTree;\n}\n\n/** Options used to customize setUpTestSharedTree */\nexport interface SharedTreeTestingOptions {\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same containerRuntimeFactory,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: ChangeNode;\n\t/** If false, a MockContainerRuntimeFactory connected to the SharedTree will be returned. */\n\tlocalMode?: boolean;\n\t/**\n\t * MockContainerRuntimeFactory to connect the SharedTree to. A new one will not be created if one is provided.\n\t * If localMode is set to true, it will not be connected to the created SharedTree.\n\t * */\n\tcontainerRuntimeFactory?: MockContainerRuntimeFactory;\n\t/** Iff true, do not `fail` on invalid edits */\n\tallowInvalid?: boolean;\n\t/** Iff true, do not `fail` on malformed edits */\n\tallowMalformed?: boolean;\n\t/** Unless set to true, a SharedTree error causes the test to fail */\n\tnoFailOnError?: boolean;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\n\t/**\n\t * Telemetry logger injected into the SharedTree.\n\t */\n\tlogger?: ITelemetryBaseLogger;\n}\n\n/** Left node of 'simpleTestTree' */\nexport const left: ChangeNode = makeEmptyNode('a083857d-a8e1-447a-ba7c-92fd0be9db2b' as NodeId);\n\n/** Right node of 'simpleTestTree' */\nexport const right: ChangeNode = makeEmptyNode('78849e85-cb7f-4b93-9fdc-18439c60fe30' as NodeId);\n\n/** Label for the 'left' trait in 'simpleTestTree' */\nexport const leftTraitLabel = 'left' as TraitLabel;\n\n/** Label for the 'right' trait in 'simpleTestTree' */\nexport const rightTraitLabel = 'right' as TraitLabel;\n\n/** A simple, three node tree useful for testing. Contains one node under a 'left' trait and one under a 'right' trait. */\nexport const simpleTestTree: ChangeNode = {\n\t...makeEmptyNode('25de3875-9537-47ec-8699-8a85e772a509' as NodeId),\n\ttraits: { [leftTraitLabel]: [left], [rightTraitLabel]: [right] },\n};\n\n/** Convenient pre-made TraitLocation for the left trait of 'simpleTestTree'. */\nexport const leftTraitLocation = {\n\tparent: simpleTestTree.identifier,\n\tlabel: leftTraitLabel,\n};\n\n/** Convenient pre-made TraitLocation for the right trait of 'simpleTestTree'. */\nexport const rightTraitLocation = {\n\tparent: simpleTestTree.identifier,\n\tlabel: rightTraitLabel,\n};\n\n/** Convenient pre-made Snapshot for 'simpleTestTree'. */\nexport const simpleTreeSnapshot = Snapshot.fromTree(simpleTestTree);\n\n/** Convenient pre-made Snapshot for 'initialTree'. */\nexport const initialSnapshot = Snapshot.fromTree(initialTree);\n\n/**\n * Convenient pre-made Snapshot for 'simpleTestTree'.\n * Expensive validation is turned on for this snapshot, and it should not be used for performance testing.\n */\nexport const simpleTreeSnapshotWithValidation = Snapshot.fromTree(simpleTestTree, true);\n\n/**\n * Convenient pre-made Snapshot for 'initialTree'.\n * Expensive validation is turned on for this snapshot, and it should not be used for performance testing.\n */\nexport const initialSnapshotWithValidation = Snapshot.fromTree(initialTree, true);\n\nexport const testTrait: TraitLocation = {\n\tparent: initialSnapshot.root,\n\tlabel: 'e276f382-fa99-49a1-ae81-42001791c733' as TraitLabel,\n};\n\n/** Sets up and returns an object of components useful for testing SharedTree. */\nexport function setUpTestSharedTree(options?: SharedTreeTestingOptions): SharedTreeTestingComponents {\n\treturn setUpTestSharedTreeGeneric(SharedTree.getFactory, options);\n}\n\n/** Sets up and returns an object of components useful for testing SharedTreeWithAnchors. */\nexport function setUpTestSharedTreeWithAnchors(\n\toptions?: SharedTreeTestingOptions\n): SharedTreeTestingComponents<SharedTreeWithAnchors> {\n\treturn setUpTestSharedTreeGeneric(SharedTreeWithAnchors.getFactory, options);\n}\n\nfunction setUpTestSharedTreeGeneric<\n\tTSharedTree extends SharedTree | SharedTreeWithAnchors,\n\tTSharedTreeFactory extends SharedTreeFactory | SharedTreeWithAnchorsFactory\n>(\n\tfactoryGetter: (summarizeHistory?: boolean) => TSharedTreeFactory,\n\toptions: SharedTreeTestingOptions = { localMode: true }\n): SharedTreeTestingComponents<TSharedTree> {\n\tconst { id, initialTree, localMode, containerRuntimeFactory, setupEditId } = options;\n\tlet componentRuntime: MockFluidDataStoreRuntime;\n\tif (options.logger) {\n\t\tconst proxyHandler: ProxyHandler<MockFluidDataStoreRuntime> = {\n\t\t\tget: (target, prop, receiver) => {\n\t\t\t\tif (prop === 'logger' && options.logger) {\n\t\t\t\t\treturn options.logger;\n\t\t\t\t}\n\t\t\t\treturn target[prop as keyof MockFluidDataStoreRuntime];\n\t\t\t},\n\t\t};\n\t\tcomponentRuntime = new Proxy(new MockFluidDataStoreRuntime(), proxyHandler);\n\t} else {\n\t\tcomponentRuntime = new MockFluidDataStoreRuntime();\n\t}\n\n\t// Enable expensiveValidation\n\tconst factory = factoryGetter(options.summarizeHistory);\n\tconst tree = factory.create(componentRuntime, id === undefined ? 'testSharedTree' : id, true) as TSharedTree;\n\n\tif (options.allowInvalid === undefined || !options.allowInvalid) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));\n\t}\n\n\tif (options.allowMalformed === undefined || !options.allowMalformed) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedMalformedEdit, () => fail('unexpected malformed edit'));\n\t}\n\n\tif (options.noFailOnError === undefined || !options.noFailOnError) {\n\t\t// any errors thrown by a SharedObject event listener will be caught and\n\t\t// reemitted on this event. For testing purposes, rethrow so that it\n\t\t// actually causes the test to fail.\n\t\ttree.on('error', (error) => {\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tconst newContainerRuntimeFactory = containerRuntimeFactory || new MockContainerRuntimeFactory();\n\n\tif (localMode === true) {\n\t\tcomponentRuntime.local = true;\n\t} else {\n\t\tconst containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);\n\t\tconst services = {\n\t\t\tdeltaConnection: containerRuntime.createDeltaConnection(),\n\t\t\tobjectStorage: new MockStorage(undefined),\n\t\t};\n\t\ttree.connect(services);\n\t}\n\n\tif (initialTree !== undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn {\n\t\tcomponentRuntime,\n\t\tcontainerRuntimeFactory: newContainerRuntimeFactory,\n\t\ttree,\n\t};\n}\n\nconst TestDataStoreType = '@fluid-example/test-dataStore';\n\n/** Objects returned by setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingComponents<TSharedTree = SharedTree> {\n\t/** The testObjectProvider created if one was not set in the options. */\n\ttestObjectProvider: TestObjectProvider;\n\t/** The SharedTree created and set up. */\n\ttree: TSharedTree;\n}\n\n/** Options used to customize setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingOptions {\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same testObjectProvider,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: ChangeNode;\n\t/** If set, uses the provider to create the container and create the SharedTree. */\n\ttestObjectProvider?: TestObjectProvider;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n}\n\n/**\n * Sets up and returns an object of components useful for testing SharedTree with a local server.\n * Required for tests that involve the uploadBlob API.\n *\n * If using this method, be sure to clean up server state by calling `reset` on the TestObjectProvider.\n */\nexport async function setUpLocalServerTestSharedTree(\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents> {\n\treturn setUpLocalServerTestSharedTreeGeneric(SharedTree.getFactory, options);\n}\n\n/**\n * Sets up and returns an object of components useful for testing SharedTreeWithAnchors with a local server.\n * Required for tests that involve the uploadBlob API.\n *\n * If using this method, be sure to clean up server state by calling `reset` on the TestObjectProvider.\n */\nexport async function setUpLocalServerTestSharedTreeWithAnchors(\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents<SharedTreeWithAnchors>> {\n\treturn setUpLocalServerTestSharedTreeGeneric(SharedTreeWithAnchors.getFactory, options);\n}\n\nasync function setUpLocalServerTestSharedTreeGeneric<\n\tTSharedTree extends SharedTree | SharedTreeWithAnchors,\n\tTSharedTreeFactory extends SharedTreeFactory | SharedTreeWithAnchorsFactory\n>(\n\tfactoryGetter: (summarizeHistory?: boolean) => TSharedTreeFactory,\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents<TSharedTree>> {\n\tconst { id, initialTree, testObjectProvider, setupEditId, summarizeHistory } = options;\n\n\tconst treeId = id ?? 'test';\n\tconst registry: ChannelFactoryRegistry = [[treeId, factoryGetter(summarizeHistory)]];\n\tconst innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n\t\truntime.IFluidHandleContext.resolveHandle(request);\n\tconst runtimeFactory = () =>\n\t\tnew TestContainerRuntimeFactory(\n\t\t\tTestDataStoreType,\n\t\t\tnew TestFluidObjectFactory(registry),\n\t\t\t{\n\t\t\t\tsummaryOptions: { initialSummarizerDelayMs: 0 },\n\t\t\t},\n\t\t\t[innerRequestHandler]\n\t\t);\n\n\tlet provider: TestObjectProvider;\n\tlet container: IContainer;\n\n\tif (testObjectProvider !== undefined) {\n\t\tprovider = testObjectProvider;\n\t\tcontainer = await provider.loadTestContainer();\n\t} else {\n\t\tprovider = new TestObjectProvider(Loader, await createFluidTestDriver(), runtimeFactory);\n\t\tcontainer = await provider.makeTestContainer();\n\t}\n\n\tconst dataObject = await requestFluidObject<ITestFluidObject>(container, 'default');\n\tconst tree = await dataObject.getSharedObject<TSharedTree>(treeId);\n\n\tif (initialTree !== undefined && testObjectProvider === undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn { tree, testObjectProvider: provider };\n}\n\n/** Sets testTrait to contain `node`. */\nexport function setTestTree<TExtraChangeTypes = never>(\n\ttree: GenericSharedTree<TExtraChangeTypes | Change>,\n\tnode: ChangeNode,\n\toverrideId?: EditId\n): EditId {\n\tconst edit = newEdit(setTrait(testTrait, [node]));\n\ttree.processLocalEdit({ ...edit, id: overrideId || edit.id });\n\treturn overrideId || edit.id;\n}\n\n/** Creates an empty node for testing purposes. */\nexport function makeEmptyNode(identifier: NodeId = uuidv4() as NodeId): ChangeNode {\n\tconst definition = 'node' as Definition;\n\treturn { definition, identifier, traits: {} };\n}\n\n/** Creates a node with two children, one under a 'left' trait and one under a 'right' trait */\nexport function makeTestNode(identifier: NodeId = uuidv4() as NodeId): ChangeNode {\n\tconst definition = 'node' as Definition;\n\tconst left: ChangeNode = makeEmptyNode('c4acaed2-afac-417e-a3d7-07ea73c0330a' as NodeId);\n\tconst right: ChangeNode = makeEmptyNode('452c618a-ba0c-4d9b-89f3-2248d27f8c7f' as NodeId);\n\tconst leftTraitLabel = 'left' as TraitLabel;\n\tconst rightTraitLabel = 'right' as TraitLabel;\n\treturn {\n\t\tdefinition,\n\t\tidentifier,\n\t\ttraits: { [leftTraitLabel]: [left], [rightTraitLabel]: [right] },\n\t};\n}\n\n/**\n * Creates a list of edits with stable IDs that can be processed by a SharedTree.\n * @param numberOfEdits - the number of edits to create\n * @returns the list of created edits\n */\nexport function createStableEdits(numberOfEdits: number): Edit<Change>[] {\n\tconst uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\n\t// First edit is an insert\n\tconst nodeId = 'ae6b24eb-6fa8-42cc-abd2-48f250b7798f' as NodeId;\n\tconst node = makeEmptyNode(nodeId);\n\tconst firstEdit = newEdit([\n\t\tChange.build([node], 0 as DetachedSequenceId),\n\t\tChange.insert(0 as DetachedSequenceId, StablePlace.before(left)),\n\t]);\n\n\tconst edits: Edit<Change>[] = [];\n\tedits.push({ ...firstEdit, id: uuidv5('test', uuidNamespace) as EditId });\n\n\t// Every subsequent edit is a set payload\n\tfor (let i = 1; i < numberOfEdits - 1; i++) {\n\t\tconst edit = newEdit([Change.setPayload(nodeId, i)]);\n\t\tedits.push({ ...edit, id: uuidv5(i.toString(), uuidNamespace) as EditId });\n\t}\n\n\treturn edits;\n}\n\n/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */\nexport function assertNoDelta<TChange>(tree: GenericSharedTree<TChange>, editor: () => void) {\n\tconst snapshotA = tree.currentView;\n\teditor();\n\tconst snapshotB = tree.currentView;\n\tconst delta = snapshotA.delta(snapshotB);\n\texpect(delta).deep.equals({\n\t\tchanged: [],\n\t\tadded: [],\n\t\tremoved: [],\n\t});\n}\n\n/**\n * Used to test error throwing in async functions.\n */\nexport async function asyncFunctionThrowsCorrectly(\n\tasyncFunction: () => Promise<unknown>,\n\texpectedError: string\n): Promise<boolean> {\n\tlet errorMessage;\n\n\ttry {\n\t\tawait asyncFunction();\n\t} catch (error) {\n\t\terrorMessage = error.message;\n\t}\n\n\treturn errorMessage === expectedError;\n}\n\n/*\n * Returns true if two nodes have equivalent data, otherwise false.\n * Does not compare children or payloads.\n * @param nodes - two or more nodes to compare\n */\nexport function areNodesEquivalent(...nodes: NodeData[]): boolean {\n\tif (nodes.length < 2) {\n\t\tfail('Too few nodes to compare');\n\t}\n\n\tfor (let i = 1; i < nodes.length; i++) {\n\t\tif (nodes[i].definition !== nodes[0].definition) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodes[i].identifier !== nodes[0].identifier) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\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(a: ChangeNode, b: ChangeNode): boolean {\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\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(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"]}
|
|
1
|
+
{"version":3,"file":"TestUtilities.js","sourceRoot":"","sources":["../../../src/test/utilities/TestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAa,MAAM,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,WAAW,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGN,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAOnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,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B,MAAM,OAAO,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,IAAgB,EAChB,IAA0B;IAE1B,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAChC,uBAAoD;IAEpD,MAAM,GAAG,GAAS,EAAE,CAAC;IACrB,MAAM,YAAY,GAAG,uBAAuB,CAAC,WAAW,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACvF,uBAAuB,CAAC,WAAW,GAAG,CAAC,OAA2C,EAAE,EAAE;QACrF,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC7B,GAAG,CAAC,IAAI,CAAC,QAAc,CAAC,CAAC;QACzB,YAAY,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,aAAyB;IAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;IACvC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,YAAY,EAAE,IAAI,mBAAmB,EAAE,CAAC,CAAC;IACzF,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC7F,OAAO,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { resolve } from 'path';\nimport { v5 as uuidv5 } from 'uuid';\nimport { expect } from 'chai';\nimport { SummaryCollection } from '@fluidframework/container-runtime';\nimport { Container, Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';\nimport { requestFluidObject } from '@fluidframework/runtime-utils';\nimport {\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from '@fluidframework/test-runtime-utils';\nimport {\n\tChannelFactoryRegistry,\n\tITestFluidObject,\n\tTestObjectProvider,\n\tTestContainerRuntimeFactory,\n\tTestFluidObjectFactory,\n\tcreateAndAttachContainer,\n} from '@fluidframework/test-utils';\nimport { LocalServerTestDriver } from '@fluidframework/test-drivers';\nimport { ITelemetryBaseLogger } from '@fluidframework/common-definitions';\nimport { TelemetryNullLogger } from '@fluidframework/common-utils';\nimport type { IContainer, IHostLoader } from '@fluidframework/container-definitions';\nimport type { IFluidCodeDetails, IFluidHandle, IRequestHeader } from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';\nimport { IRequest } from '@fluidframework/core-interfaces';\nimport { DetachedSequenceId, EditId, NodeId, OpSpaceNodeId, SessionId, StableNodeId } from '../../Identifiers';\nimport { assert, fail, identity, ReplaceRecursive } from '../../Common';\nimport { IdCompressor } from '../../id-compressor';\nimport { createSessionId } from '../../id-compressor/NumericUuid';\nimport { getChangeNodeFromViewNode } from '../../SerializationUtilities';\nimport { initialTree } from '../../InitialTree';\nimport {\n\tChangeInternal,\n\tEdit,\n\tNodeData,\n\tPayload,\n\treservedIdCount,\n\tSharedTreeOp,\n\tSharedTreeOp_0_0_2,\n\tWriteFormat,\n} from '../../persisted-types';\nimport { TraitLocation, TreeView } from '../../TreeView';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes';\nimport { getNodeId, getNodeIdContext, NodeIdContext, NodeIdConverter, NodeIdNormalizer } from '../../NodeIdUtilities';\nimport { newEdit, setTrait } from '../../EditUtilities';\nimport { SharedTree } from '../../SharedTree';\nimport { BuildNode, Change, StablePlace } from '../../ChangeTypes';\nimport { convertEditIds } from '../../IdConversion';\nimport { buildLeaf, RefreshingTestTree, SimpleTestTree, TestTree } from './TestNode';\n\n/** Objects returned by setUpTestSharedTree */\nexport interface SharedTreeTestingComponents {\n\t/** The MockFluidDataStoreRuntime used to created the SharedTree. */\n\tcomponentRuntime: MockFluidDataStoreRuntime;\n\t/**\n\t * The MockContainerRuntimeFactory created if one was not provided in the options.\n\t * Only connected to the SharedTree if the localMode option was set to false.\n\t * */\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n}\n\n/** Options used to customize setUpTestSharedTree */\nexport interface SharedTreeTestingOptions {\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same containerRuntimeFactory,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If false, a MockContainerRuntimeFactory connected to the SharedTree will be returned. */\n\tlocalMode?: boolean;\n\t/**\n\t * MockContainerRuntimeFactory to connect the SharedTree to. A new one will not be created if one is provided.\n\t * If localMode is set to true, it will not be connected to the created SharedTree.\n\t * */\n\tcontainerRuntimeFactory?: MockContainerRuntimeFactory;\n\t/** Iff true, do not `fail` on invalid edits */\n\tallowInvalid?: boolean;\n\t/** Iff true, do not `fail` on malformed edits */\n\tallowMalformed?: boolean;\n\t/** Unless set to true, a SharedTree error causes the test to fail */\n\tnoFailOnError?: boolean;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.1.1.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\n\t/**\n\t * Telemetry logger injected into the SharedTree.\n\t */\n\tlogger?: ITelemetryBaseLogger;\n}\n\nexport const testTraitLabel = SimpleTestTree.traitLabel;\nexport function testTrait(view: TreeView): TraitLocation {\n\treturn {\n\t\tlabel: testTraitLabel,\n\t\tparent: view.root,\n\t};\n}\n\n/** Sets up and returns an object of components useful for testing SharedTree. */\nexport function setUpTestSharedTree(\n\toptions: SharedTreeTestingOptions = { localMode: true }\n): SharedTreeTestingComponents {\n\tconst { id, initialTree, localMode, containerRuntimeFactory, setupEditId, summarizeHistory, writeFormat } = options;\n\tlet componentRuntime: MockFluidDataStoreRuntime;\n\tif (options.logger) {\n\t\tconst proxyHandler: ProxyHandler<MockFluidDataStoreRuntime> = {\n\t\t\tget: (target, prop, receiver) => {\n\t\t\t\tif (prop === 'logger' && options.logger) {\n\t\t\t\t\treturn options.logger;\n\t\t\t\t}\n\t\t\t\treturn target[prop as keyof MockFluidDataStoreRuntime];\n\t\t\t},\n\t\t};\n\t\tcomponentRuntime = new Proxy(new MockFluidDataStoreRuntime(), proxyHandler);\n\t} else {\n\t\tcomponentRuntime = new MockFluidDataStoreRuntime();\n\t}\n\n\t// Enable expensiveValidation\n\tconst factory = SharedTree.getFactory(\n\t\twriteFormat ?? WriteFormat.v0_1_1,\n\t\tsummarizeHistory === undefined || summarizeHistory === true ? { uploadEditChunks: true } : false\n\t);\n\tconst tree = factory.create(componentRuntime, id === undefined ? 'testSharedTree' : id, true);\n\n\tif (options.allowInvalid === undefined || !options.allowInvalid) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));\n\t}\n\n\tif (options.allowMalformed === undefined || !options.allowMalformed) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedMalformedEdit, () => fail('unexpected malformed edit'));\n\t}\n\n\tif (options.noFailOnError === undefined || !options.noFailOnError) {\n\t\t// any errors thrown by a SharedObject event listener will be caught and\n\t\t// reemitted on this event. For testing purposes, rethrow so that it\n\t\t// actually causes the test to fail.\n\t\ttree.on('error', (error) => {\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tconst newContainerRuntimeFactory = containerRuntimeFactory || new MockContainerRuntimeFactory();\n\n\tif (localMode === true) {\n\t\tcomponentRuntime.local = true;\n\t} else {\n\t\tconst containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);\n\t\tconst services = {\n\t\t\tdeltaConnection: containerRuntime.createDeltaConnection(),\n\t\t\tobjectStorage: new MockStorage(undefined),\n\t\t};\n\t\ttree.connect(services);\n\t}\n\n\tif (initialTree !== undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn {\n\t\tcomponentRuntime,\n\t\tcontainerRuntimeFactory: newContainerRuntimeFactory,\n\t\ttree,\n\t};\n}\n\nconst TestDataStoreType = '@fluid-example/test-dataStore';\n\n/** Objects returned by setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingComponents {\n\t/** The testObjectProvider created if one was not set in the options. */\n\ttestObjectProvider: TestObjectProvider;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n\t/** The container created and set up. */\n\tcontainer: Container;\n\t/** Handles to any blobs uploaded via `blobs` */\n\tuploadedBlobs: IFluidHandle<ArrayBufferLike>[];\n}\n\n/** Options used to customize setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingOptions {\n\t/** Contents of blobs that should be uploaded to the runtime upon creation. Handles to these blobs will be returned. */\n\tblobs?: ArrayBufferLike[];\n\t/** Headers to include on the container load request. */\n\theaders?: IRequestHeader;\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same testObjectProvider,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If set, uses the provider to create the container and create the SharedTree. */\n\ttestObjectProvider?: TestObjectProvider;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.0.2.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * If not set, will upload edit chunks when they are full.\n\t */\n\tuploadEditChunks?: boolean;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n}\n\nconst testObjectProviders: TestObjectProvider[] = [];\nafterEach(() => {\n\tfor (const provider of testObjectProviders) {\n\t\tprovider.reset();\n\t}\n\ttestObjectProviders.length = 0;\n});\n\n/**\n * Sets up and returns an object of components useful for testing SharedTree with a local server.\n * Required for tests that involve the uploadBlob API.\n *\n * Any TestObjectProvider created by this function will be reset after the test completes (via afterEach) hook.\n */\nexport async function setUpLocalServerTestSharedTree(\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents> {\n\tconst {\n\t\tblobs,\n\t\theaders,\n\t\tid,\n\t\tinitialTree,\n\t\ttestObjectProvider,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tuploadEditChunks,\n\t} = options;\n\n\tconst treeId = id ?? 'test';\n\tconst registry: ChannelFactoryRegistry = [\n\t\t[\n\t\t\ttreeId,\n\t\t\tSharedTree.getFactory(\n\t\t\t\twriteFormat ?? WriteFormat.v0_1_1,\n\t\t\t\tsummarizeHistory === undefined || summarizeHistory === true\n\t\t\t\t\t? { uploadEditChunks: uploadEditChunks ?? true }\n\t\t\t\t\t: false\n\t\t\t),\n\t\t],\n\t];\n\tconst innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n\t\truntime.IFluidHandleContext.resolveHandle(request);\n\n\tconst runtimeFactory = () =>\n\t\tnew TestContainerRuntimeFactory(\n\t\t\tTestDataStoreType,\n\t\t\tnew TestFluidObjectFactory(registry),\n\t\t\t{\n\t\t\t\tsummaryOptions: { initialSummarizerDelayMs: 0 },\n\t\t\t},\n\t\t\t[innerRequestHandler]\n\t\t);\n\n\tconst defaultCodeDetails: IFluidCodeDetails = {\n\t\tpackage: 'defaultTestPackage',\n\t\tconfig: {},\n\t};\n\n\tfunction makeTestLoader(provider: TestObjectProvider): IHostLoader {\n\t\tconst fluidEntryPoint = runtimeFactory();\n\t\treturn provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {\n\t\t\toptions: { maxClientLeaveWaitTime: 1000 },\n\t\t});\n\t}\n\n\tlet provider: TestObjectProvider;\n\tlet container: Container;\n\n\tif (testObjectProvider !== undefined) {\n\t\tprovider = testObjectProvider;\n\t\tconst driver = new LocalServerTestDriver();\n\t\tconst loader = makeTestLoader(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.loadTestContainer` instead.\n\t\tcontainer = (await loader.resolve({ url: await driver.createContainerUrl(treeId), headers })) as Container;\n\t\tawait waitContainerToCatchUp(container);\n\t} else {\n\t\tconst driver = new LocalServerTestDriver();\n\t\tprovider = new TestObjectProvider(Loader, driver, runtimeFactory);\n\t\ttestObjectProviders.push(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.makeTestContainer` instead.\n\t\tconst loader = makeTestLoader(provider);\n\t\tcontainer = (await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tdriver.createCreateNewRequest(treeId)\n\t\t)) as Container;\n\t}\n\n\tconst dataObject = await requestFluidObject<ITestFluidObject>(container, '/');\n\n\tconst uploadedBlobs =\n\t\tblobs === undefined ? [] : await Promise.all(blobs.map(async (blob) => dataObject.context.uploadBlob(blob)));\n\tconst tree = await dataObject.getSharedObject<SharedTree>(treeId);\n\n\tif (initialTree !== undefined && testObjectProvider === undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn { container, tree, testObjectProvider: provider, uploadedBlobs };\n}\n\n/** Sets testTrait to contain `node`. */\nfunction setTestTree(tree: SharedTree, node: BuildNode, overrideId?: EditId): EditId {\n\tconst trait = testTrait(tree.currentView);\n\tif (overrideId === undefined) {\n\t\treturn tree.applyEdit(...setTrait(trait, node)).id;\n\t} else {\n\t\tconst changes = setTrait(trait, node).map((c) => tree.internalizeChange(c));\n\t\treturn tree.applyEditInternal({ changes, id: overrideId }).id;\n\t}\n}\n\n/**\n * Creates a list of edits with stable IDs that can be processed by a SharedTree.\n * @returns the list of created edits\n */\nexport function createStableEdits(\n\tnumberOfEdits: number,\n\tidContext: NodeIdContext = makeNodeIdContext(),\n\tpayload: (i: number) => Payload = identity\n): Edit<ChangeInternal>[] {\n\tif (numberOfEdits === 0) {\n\t\treturn [];\n\t}\n\n\tconst uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tconst nodeId = idContext.generateNodeId('ae6b24eb-6fa8-42cc-abd2-48f250b7798f');\n\tconst node = buildLeaf(nodeId);\n\tconst insertEmptyNode = newEdit([\n\t\tChangeInternal.build([node], 0 as DetachedSequenceId),\n\t\tChangeInternal.insert(\n\t\t\t0 as DetachedSequenceId,\n\t\t\tStablePlace.atEndOf({ label: testTraitLabel, parent: idContext.convertToNodeId(initialTree.identifier) })\n\t\t),\n\t]);\n\n\tconst edits: Edit<ChangeInternal>[] = [{ ...insertEmptyNode, id: uuidv5('test', uuidNamespace) as EditId }];\n\n\t// Every subsequent edit is a set payload\n\tfor (let i = 1; i < numberOfEdits; i++) {\n\t\tconst edit = newEdit([ChangeInternal.setPayload(nodeId, payload(i))]);\n\t\tedits.push({ ...edit, id: uuidv5(i.toString(), uuidNamespace) as EditId });\n\t}\n\n\treturn edits;\n}\n\n/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */\nexport function assertNoDelta(tree: SharedTree, editor: () => void) {\n\tconst viewA = tree.currentView;\n\teditor();\n\tconst viewB = tree.currentView;\n\tconst delta = viewA.delta(viewB);\n\texpect(delta).deep.equals({\n\t\tchanged: [],\n\t\tadded: [],\n\t\tremoved: [],\n\t});\n}\n\n/**\n * Used to test error throwing in async functions.\n */\nexport async function asyncFunctionThrowsCorrectly(\n\tasyncFunction: () => Promise<unknown>,\n\texpectedError: string\n): Promise<boolean> {\n\tlet errorMessage: string | undefined;\n\n\ttry {\n\t\tawait asyncFunction();\n\t} catch (error) {\n\t\terrorMessage = (error as Error).message;\n\t}\n\n\treturn errorMessage === expectedError;\n}\n\n/*\n * Returns true if two nodes have equivalent data, otherwise false.\n * Does not compare children or payloads.\n * @param nodes - two or more nodes to compare\n */\nexport function areNodesEquivalent(...nodes: NodeData<unknown>[]): boolean {\n\tif (nodes.length < 2) {\n\t\tfail('Too few nodes to compare');\n\t}\n\n\tfor (let i = 1; i < nodes.length; i++) {\n\t\tif (nodes[i].definition !== nodes[0].definition) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodes[i].identifier !== nodes[0].identifier) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n// This accounts for this file being executed after compilation. If many tests want to leverage resources, we should unify\n// resource path logic to a single place.\nexport const testDocumentsPathBase = resolve(__dirname, '../../../src/test/documents/');\n\nexport const versionComparator = (versionA: string, versionB: string): number => {\n\tconst versionASplit = versionA.split('.');\n\tconst versionBSplit = versionB.split('.');\n\n\tassert(\n\t\tversionASplit.length === versionBSplit.length && versionASplit.length === 3,\n\t\t'Version numbers should follow semantic versioning.'\n\t);\n\n\tfor (let i = 0; i < 3; ++i) {\n\t\tconst numberA = parseInt(versionASplit[i], 10);\n\t\tconst numberB = parseInt(versionBSplit[i], 10);\n\n\t\tif (numberA > numberB) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (numberA < numberB) {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\treturn 0;\n};\n\n/**\n * Create a {@link SimpleTestTree} from the given {@link SharedTree} or {@link IdCompressor}\n */\nexport function setUpTestTree(idSource?: IdCompressor | SharedTree, expensiveValidation = false): TestTree {\n\tconst source = idSource ?? new IdCompressor(createSessionId(), reservedIdCount);\n\tif (source instanceof SharedTree) {\n\t\tassert(source.edits.length === 0, 'tree must be a new SharedTree');\n\t\tconst getNormalizer = () => getIdNormalizerFromSharedTree(source);\n\t\tconst contextWrapper = {\n\t\t\tnormalizeToOpSpace: (id: NodeId) => getNormalizer().normalizeToOpSpace(id),\n\t\t\tnormalizeToSessionSpace: (id: OpSpaceNodeId, sessionId: SessionId) =>\n\t\t\t\tgetNormalizer().normalizeToSessionSpace(id, sessionId),\n\t\t\tget localSessionId() {\n\t\t\t\treturn getNormalizer().localSessionId;\n\t\t\t},\n\t\t};\n\t\tconst simpleTestTree = new SimpleTestTree(source, contextWrapper, expensiveValidation);\n\t\tsetTestTree(source, simpleTestTree);\n\t\treturn simpleTestTree;\n\t}\n\n\tconst context = makeNodeIdContext(source);\n\treturn new SimpleTestTree(context, context, expensiveValidation);\n}\n\n/**\n * Gets an id normalizer from the provided shared-tree. This is\n */\nexport function getIdNormalizerFromSharedTree(sharedTree: SharedTree): NodeIdNormalizer<OpSpaceNodeId> {\n\treturn (\n\t\t((sharedTree as any).idNormalizer as NodeIdNormalizer<OpSpaceNodeId>) ??\n\t\tfail('Failed to find SharedTree normalizer')\n\t);\n}\n\n/**\n * Create a {@link SimpleTestTree} before each test\n */\nexport function refreshTestTree(\n\tidSourceFactory?: (() => IdCompressor) | (() => SharedTree),\n\tfn?: (testTree: TestTree) => void,\n\texpensiveValidation = false\n): TestTree {\n\tconst factory = idSourceFactory ?? (() => new IdCompressor(createSessionId(), reservedIdCount));\n\treturn new RefreshingTestTree(() => {\n\t\treturn setUpTestTree(factory(), expensiveValidation);\n\t}, fn);\n}\n\nexport function makeNodeIdContext(idCompressor?: IdCompressor): NodeIdContext & NodeIdNormalizer<OpSpaceNodeId> {\n\tconst compressor = idCompressor ?? new IdCompressor(createSessionId(), reservedIdCount);\n\treturn getNodeIdContext(compressor);\n}\n\n/**\n * Applies an arbitrary edit to the given SharedTree which leaves the tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to apply edits but don't care what they do.\n */\nexport function applyNoop(tree: SharedTree): Edit<unknown> {\n\treturn tree.applyEdit(...noopEdit(tree.currentView));\n}\n\n/**\n * Creates an arbitrary edit which leaves a tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to create edits but don't care what they do.\n */\nexport function noopEdit(view: TreeView): Change[] {\n\tconst traitLocation = testTrait(view);\n\tconst trait = view.getTrait(traitLocation);\n\t// Set the test trait to the same thing that it already was\n\treturn setTrait(\n\t\ttraitLocation,\n\t\ttrait.map((id) => getChangeNodeFromViewNode(view, id))\n\t);\n}\n\n/** Translate an ID in one context to an ID in another */\nexport function translateId(id: NodeId | NodeData<NodeId>, from: NodeIdConverter, to: NodeIdConverter): NodeId {\n\treturn to.convertToNodeId(from.convertToStableNodeId(getNodeId(id)));\n}\n\nexport function normalizeId(tree: SharedTree, id: NodeId): OpSpaceNodeId {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn normalizer.normalizeToOpSpace(id);\n}\n\nexport function normalizeIds(tree: SharedTree, ...ids: NodeId[]): OpSpaceNodeId[] {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn ids.map((id) => normalizer.normalizeToOpSpace(id));\n}\n\nexport function idsAreEqual(treeA: SharedTree, idsA: NodeId[], treeB: SharedTree, idsB: NodeId[]): boolean {\n\tif (idsA.length !== idsB.length) {\n\t\treturn false;\n\t}\n\tconst contextA = getIdNormalizerFromSharedTree(treeA);\n\tconst contextB = getIdNormalizerFromSharedTree(treeB);\n\tfor (let i = 0; i < idsA.length; i++) {\n\t\tif (contextA.normalizeToOpSpace(idsA[i]) !== contextB.normalizeToOpSpace(idsB[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function normalizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, OpSpaceNodeId>> {\n\tconst context = getIdNormalizerFromSharedTree(tree);\n\treturn convertEditIds(edit, (id) => context.normalizeToOpSpace(id));\n}\n\nexport function stabilizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, StableNodeId>> {\n\treturn convertEditIds(edit, (id) => tree.convertToStableNodeId(id));\n}\n\n/**\n * Spies on all future ops submitted to `containerRuntimeFactory`. When ops are submitted, they will be `push`ed into the\n * returned array.\n */\nexport function spyOnSubmittedOps<Op extends SharedTreeOp | SharedTreeOp_0_0_2>(\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory\n): Op[] {\n\tconst ops: Op[] = [];\n\tconst originalPush = containerRuntimeFactory.pushMessage.bind(containerRuntimeFactory);\n\tcontainerRuntimeFactory.pushMessage = (message: Partial<ISequencedDocumentMessage>) => {\n\t\tconst { contents } = message;\n\t\tops.push(contents as Op);\n\t\toriginalPush(message);\n\t};\n\treturn ops;\n}\n\n/**\n * Waits for summarization to occur, and returns a version that can be passed into newly loaded containers\n * to ensure they load this summary version. Use the `LoaderHeader.version` header.\n */\nexport async function waitForSummary(mainContainer: IContainer): Promise<string> {\n\tconst { deltaManager } = mainContainer;\n\tconst summaryCollection = new SummaryCollection(deltaManager, new TelemetryNullLogger());\n\tconst ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);\n\treturn ackedSummary.summaryAck.contents.handle;\n}\n"]}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
/// <reference types="mocha" />
|
|
6
|
-
import { SharedTree } from '../../default-edits';
|
|
7
5
|
import { EditId } from '../../Identifiers';
|
|
6
|
+
import { SharedTree } from '../../SharedTree';
|
|
8
7
|
/** Options used to generate a SharedTree undo/redo test suite. */
|
|
9
8
|
interface SharedTreeUndoRedoOptions {
|
|
10
9
|
/** Determines if the tests should be run in local state or connected state with a remote SharedTree */
|
|
@@ -12,9 +11,9 @@ interface SharedTreeUndoRedoOptions {
|
|
|
12
11
|
/** Title used for the test suite describe block. */
|
|
13
12
|
title: string;
|
|
14
13
|
/** Function for undoing an edit on a given tree. */
|
|
15
|
-
undo: (tree: SharedTree, editId: EditId) => EditId;
|
|
14
|
+
undo: (tree: SharedTree, editId: EditId) => EditId | undefined;
|
|
16
15
|
/** Function for redoing an edit on a given tree. */
|
|
17
|
-
redo: (tree: SharedTree, editId: EditId) => EditId;
|
|
16
|
+
redo: (tree: SharedTree, editId: EditId) => EditId | undefined;
|
|
18
17
|
/** Optional additional setup to run in a beforeEach block that takes the SharedTrees used in the tests. */
|
|
19
18
|
beforeEach?: (trees: SharedTree[]) => void;
|
|
20
19
|
/**
|
|
@@ -28,6 +27,6 @@ interface SharedTreeUndoRedoOptions {
|
|
|
28
27
|
/**
|
|
29
28
|
* Runs undo/redo tests for SharedTree
|
|
30
29
|
*/
|
|
31
|
-
export declare function runSharedTreeUndoRedoTestSuite(options: SharedTreeUndoRedoOptions):
|
|
30
|
+
export declare function runSharedTreeUndoRedoTestSuite(options: SharedTreeUndoRedoOptions): void;
|
|
32
31
|
export {};
|
|
33
32
|
//# sourceMappingURL=UndoRedoTests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UndoRedoTests.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/UndoRedoTests.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"UndoRedoTests.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/UndoRedoTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAsB,MAAM,EAAU,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,kEAAkE;AAClE,UAAU,yBAAyB;IAClC,uGAAuG;IACvG,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,oDAAoD;IACpD,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,2GAA2G;IAC3G,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CA8XvF"}
|