@fluid-experimental/tree 0.58.2001 → 0.59.2000-61729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -46
- package/dist/ChangeCompression.d.ts +39 -0
- package/dist/ChangeCompression.d.ts.map +1 -0
- package/dist/ChangeCompression.js +117 -0
- package/dist/ChangeCompression.js.map +1 -0
- package/{lib/default-edits/PersistedTypes.d.ts → dist/ChangeTypes.d.ts} +58 -105
- package/dist/ChangeTypes.d.ts.map +1 -0
- package/dist/{default-edits/PersistedTypes.js → ChangeTypes.js} +21 -76
- package/dist/ChangeTypes.js.map +1 -0
- package/dist/Checkout.d.ts +39 -27
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +61 -32
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +175 -38
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +240 -103
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +24 -0
- package/dist/EagerCheckout.d.ts.map +1 -0
- package/dist/{BasicCheckout.js → EagerCheckout.js} +9 -6
- package/dist/EagerCheckout.js.map +1 -0
- package/dist/EditLog.d.ts +77 -63
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +85 -48
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +168 -0
- package/dist/EditUtilities.d.ts.map +1 -0
- package/dist/EditUtilities.js +373 -0
- package/dist/EditUtilities.js.map +1 -0
- package/dist/EventTypes.d.ts +73 -0
- package/dist/EventTypes.d.ts.map +1 -0
- package/dist/EventTypes.js +78 -0
- package/dist/EventTypes.js.map +1 -0
- package/dist/Forest.d.ts +29 -7
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +60 -36
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +20 -0
- package/dist/HistoryEditFactory.d.ts.map +1 -0
- package/dist/HistoryEditFactory.js +226 -0
- package/dist/HistoryEditFactory.js.map +1 -0
- package/dist/IdConversion.d.ts +12 -0
- package/dist/IdConversion.d.ts.map +1 -0
- package/dist/IdConversion.js +98 -0
- package/dist/IdConversion.js.map +1 -0
- package/dist/Identifiers.d.ts +89 -2
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js +10 -0
- package/dist/Identifiers.js.map +1 -1
- package/dist/InitialTree.d.ts +2 -2
- package/dist/InitialTree.d.ts.map +1 -1
- package/dist/InitialTree.js +2 -1
- package/dist/InitialTree.js.map +1 -1
- package/dist/LazyCheckout.d.ts +28 -0
- package/dist/LazyCheckout.d.ts.map +1 -0
- package/dist/LazyCheckout.js +44 -0
- package/dist/LazyCheckout.js.map +1 -0
- package/dist/LogViewer.d.ts +129 -85
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +111 -85
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts +221 -0
- package/dist/MergeHealth.d.ts.map +1 -0
- package/dist/MergeHealth.js +263 -0
- package/dist/MergeHealth.js.map +1 -0
- package/dist/NodeIdUtilities.d.ts +105 -0
- package/dist/NodeIdUtilities.d.ts.map +1 -0
- package/dist/NodeIdUtilities.js +60 -0
- package/dist/NodeIdUtilities.js.map +1 -0
- package/dist/PayloadUtilities.d.ts +42 -0
- package/dist/PayloadUtilities.d.ts.map +1 -0
- package/dist/PayloadUtilities.js +114 -0
- package/dist/PayloadUtilities.js.map +1 -0
- package/dist/ReconciliationPath.d.ts +18 -13
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +11 -2
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -3
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +83 -0
- package/dist/RevisionView.d.ts.map +1 -0
- package/dist/RevisionView.js +182 -0
- package/dist/RevisionView.js.map +1 -0
- package/dist/SerializationUtilities.d.ts +36 -0
- package/dist/SerializationUtilities.d.ts.map +1 -0
- package/dist/SerializationUtilities.js +102 -0
- package/dist/SerializationUtilities.js.map +1 -0
- package/dist/SharedTree.d.ts +439 -0
- package/dist/SharedTree.d.ts.map +1 -0
- package/dist/SharedTree.js +1109 -0
- package/dist/SharedTree.js.map +1 -0
- package/dist/SharedTreeEncoder.d.ts +102 -0
- package/dist/SharedTreeEncoder.d.ts.map +1 -0
- package/dist/SharedTreeEncoder.js +313 -0
- package/dist/SharedTreeEncoder.js.map +1 -0
- package/dist/StringInterner.d.ts +46 -0
- package/dist/StringInterner.d.ts.map +1 -0
- package/dist/StringInterner.js +61 -0
- package/dist/StringInterner.js.map +1 -0
- package/dist/Summary.d.ts +40 -0
- package/dist/Summary.d.ts.map +1 -0
- package/dist/Summary.js +23 -0
- package/dist/Summary.js.map +1 -0
- package/dist/SummaryBackCompatibility.d.ts +22 -22
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js +30 -33
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +31 -0
- package/dist/SummaryTestUtilities.d.ts.map +1 -0
- package/dist/SummaryTestUtilities.js +37 -0
- package/dist/SummaryTestUtilities.js.map +1 -0
- package/dist/Transaction.d.ts +71 -0
- package/dist/Transaction.d.ts.map +1 -0
- package/dist/Transaction.js +92 -0
- package/dist/Transaction.js.map +1 -0
- package/dist/TransactionInternal.d.ts +540 -0
- package/dist/TransactionInternal.d.ts.map +1 -0
- package/dist/TransactionInternal.js +626 -0
- package/dist/TransactionInternal.js.map +1 -0
- package/dist/TreeCompressor.d.ts +36 -0
- package/dist/TreeCompressor.d.ts.map +1 -0
- package/dist/TreeCompressor.js +137 -0
- package/dist/TreeCompressor.js.map +1 -0
- package/dist/TreeNodeHandle.d.ts +12 -18
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js +13 -23
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +166 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +218 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/TreeViewUtilities.d.ts +21 -0
- package/dist/TreeViewUtilities.d.ts.map +1 -0
- package/dist/TreeViewUtilities.js +77 -0
- package/dist/TreeViewUtilities.js.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/dist/UndoRedoHandler.d.ts.map +1 -0
- package/dist/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +5 -9
- package/dist/UndoRedoHandler.js.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.js +283 -0
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/dist/id-compressor/IdCompressor.d.ts +389 -0
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -0
- package/dist/id-compressor/IdCompressor.js +1353 -0
- package/dist/id-compressor/IdCompressor.js.map +1 -0
- package/dist/id-compressor/IdRange.d.ts +11 -0
- package/dist/id-compressor/IdRange.d.ts.map +1 -0
- package/dist/id-compressor/IdRange.js +29 -0
- package/dist/id-compressor/IdRange.js.map +1 -0
- package/dist/id-compressor/NumericUuid.d.ts +63 -0
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -0
- package/dist/id-compressor/NumericUuid.js +377 -0
- package/dist/id-compressor/NumericUuid.js.map +1 -0
- package/dist/id-compressor/index.d.ts +12 -0
- package/dist/id-compressor/index.d.ts.map +1 -0
- package/dist/id-compressor/index.js +26 -0
- package/dist/id-compressor/index.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/dist/id-compressor/persisted-types/index.d.ts +6 -0
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/dist/id-compressor/persisted-types/index.js +18 -0
- package/dist/id-compressor/persisted-types/index.js.map +1 -0
- package/dist/index.d.ts +29 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +385 -0
- package/dist/persisted-types/0.0.2.d.ts.map +1 -0
- package/dist/persisted-types/0.0.2.js +113 -0
- package/dist/persisted-types/0.0.2.js.map +1 -0
- package/dist/persisted-types/0.1.1.d.ts +314 -0
- package/dist/persisted-types/0.1.1.d.ts.map +1 -0
- package/dist/persisted-types/0.1.1.js +153 -0
- package/dist/persisted-types/0.1.1.js.map +1 -0
- package/dist/persisted-types/index.d.ts +7 -0
- package/dist/persisted-types/index.d.ts.map +1 -0
- package/dist/persisted-types/index.js +20 -0
- package/dist/persisted-types/index.js.map +1 -0
- package/docs/0-1-1-Compression.md +228 -0
- package/docs/Breaking-Change-Migration.md +52 -0
- package/docs/Compression.md +2 -2
- package/docs/Telemetry.md +43 -0
- package/docs/Write-Format.md +19 -0
- package/lib/ChangeCompression.d.ts +39 -0
- package/lib/ChangeCompression.d.ts.map +1 -0
- package/lib/ChangeCompression.js +111 -0
- package/lib/ChangeCompression.js.map +1 -0
- package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -105
- package/lib/ChangeTypes.d.ts.map +1 -0
- package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
- package/lib/ChangeTypes.js.map +1 -0
- package/lib/Checkout.d.ts +39 -27
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +53 -24
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +175 -38
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +226 -101
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +24 -0
- package/lib/EagerCheckout.d.ts.map +1 -0
- package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
- package/lib/EagerCheckout.js.map +1 -0
- package/lib/EditLog.d.ts +77 -63
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +83 -47
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +168 -0
- package/lib/EditUtilities.d.ts.map +1 -0
- package/lib/EditUtilities.js +353 -0
- package/lib/EditUtilities.js.map +1 -0
- package/lib/EventTypes.d.ts +73 -0
- package/lib/EventTypes.d.ts.map +1 -0
- package/lib/EventTypes.js +75 -0
- package/lib/EventTypes.js.map +1 -0
- package/lib/Forest.d.ts +29 -7
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +58 -35
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +20 -0
- package/lib/HistoryEditFactory.d.ts.map +1 -0
- package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
- package/lib/HistoryEditFactory.js.map +1 -0
- package/lib/IdConversion.d.ts +12 -0
- package/lib/IdConversion.d.ts.map +1 -0
- package/lib/IdConversion.js +91 -0
- package/lib/IdConversion.js.map +1 -0
- package/lib/Identifiers.d.ts +89 -2
- package/lib/Identifiers.d.ts.map +1 -1
- package/lib/Identifiers.js +8 -1
- package/lib/Identifiers.js.map +1 -1
- package/lib/InitialTree.d.ts +2 -2
- package/lib/InitialTree.d.ts.map +1 -1
- package/lib/InitialTree.js +2 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LazyCheckout.d.ts +28 -0
- package/lib/LazyCheckout.d.ts.map +1 -0
- package/lib/LazyCheckout.js +40 -0
- package/lib/LazyCheckout.js.map +1 -0
- package/lib/LogViewer.d.ts +129 -85
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +103 -77
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts +221 -0
- package/lib/MergeHealth.d.ts.map +1 -0
- package/lib/MergeHealth.js +258 -0
- package/lib/MergeHealth.js.map +1 -0
- package/lib/NodeIdUtilities.d.ts +105 -0
- package/lib/NodeIdUtilities.d.ts.map +1 -0
- package/lib/NodeIdUtilities.js +53 -0
- package/lib/NodeIdUtilities.js.map +1 -0
- package/lib/PayloadUtilities.d.ts +42 -0
- package/lib/PayloadUtilities.d.ts.map +1 -0
- package/lib/PayloadUtilities.js +110 -0
- package/lib/PayloadUtilities.js.map +1 -0
- package/lib/ReconciliationPath.d.ts +18 -13
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +11 -2
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -3
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +83 -0
- package/lib/RevisionView.d.ts.map +1 -0
- package/lib/RevisionView.js +175 -0
- package/lib/RevisionView.js.map +1 -0
- package/lib/SerializationUtilities.d.ts +36 -0
- package/lib/SerializationUtilities.d.ts.map +1 -0
- package/lib/SerializationUtilities.js +95 -0
- package/lib/SerializationUtilities.js.map +1 -0
- package/lib/SharedTree.d.ts +439 -0
- package/lib/SharedTree.d.ts.map +1 -0
- package/lib/SharedTree.js +1104 -0
- package/lib/SharedTree.js.map +1 -0
- package/lib/SharedTreeEncoder.d.ts +102 -0
- package/lib/SharedTreeEncoder.d.ts.map +1 -0
- package/lib/SharedTreeEncoder.js +308 -0
- package/lib/SharedTreeEncoder.js.map +1 -0
- package/lib/StringInterner.d.ts +46 -0
- package/lib/StringInterner.d.ts.map +1 -0
- package/lib/StringInterner.js +57 -0
- package/lib/StringInterner.js.map +1 -0
- package/lib/Summary.d.ts +40 -0
- package/lib/Summary.d.ts.map +1 -0
- package/lib/Summary.js +19 -0
- package/lib/Summary.js.map +1 -0
- package/lib/SummaryBackCompatibility.d.ts +22 -22
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js +29 -32
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +31 -0
- package/lib/SummaryTestUtilities.d.ts.map +1 -0
- package/lib/SummaryTestUtilities.js +32 -0
- package/lib/SummaryTestUtilities.js.map +1 -0
- package/lib/Transaction.d.ts +71 -0
- package/lib/Transaction.d.ts.map +1 -0
- package/lib/Transaction.js +88 -0
- package/lib/Transaction.js.map +1 -0
- package/lib/TransactionInternal.d.ts +540 -0
- package/lib/TransactionInternal.d.ts.map +1 -0
- package/lib/TransactionInternal.js +622 -0
- package/lib/TransactionInternal.js.map +1 -0
- package/lib/TreeCompressor.d.ts +36 -0
- package/lib/TreeCompressor.d.ts.map +1 -0
- package/lib/TreeCompressor.js +133 -0
- package/lib/TreeCompressor.js.map +1 -0
- package/lib/TreeNodeHandle.d.ts +12 -18
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js +14 -24
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +166 -0
- package/lib/TreeView.d.ts.map +1 -0
- package/lib/TreeView.js +214 -0
- package/lib/TreeView.js.map +1 -0
- package/lib/TreeViewUtilities.d.ts +21 -0
- package/lib/TreeViewUtilities.d.ts.map +1 -0
- package/lib/TreeViewUtilities.js +71 -0
- package/lib/TreeViewUtilities.js.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
- package/lib/UndoRedoHandler.d.ts.map +1 -0
- package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
- package/lib/UndoRedoHandler.js.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
- package/lib/id-compressor/IdCompressor.d.ts +389 -0
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
- package/lib/id-compressor/IdCompressor.js +1343 -0
- package/lib/id-compressor/IdCompressor.js.map +1 -0
- package/lib/id-compressor/IdRange.d.ts +11 -0
- package/lib/id-compressor/IdRange.d.ts.map +1 -0
- package/lib/id-compressor/IdRange.js +25 -0
- package/lib/id-compressor/IdRange.js.map +1 -0
- package/lib/id-compressor/NumericUuid.d.ts +63 -0
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
- package/lib/id-compressor/NumericUuid.js +365 -0
- package/lib/id-compressor/NumericUuid.js.map +1 -0
- package/lib/id-compressor/index.d.ts +12 -0
- package/lib/id-compressor/index.d.ts.map +1 -0
- package/lib/id-compressor/index.js +12 -0
- package/lib/id-compressor/index.js.map +1 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
- package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
- package/lib/id-compressor/persisted-types/index.d.ts +6 -0
- package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
- package/lib/id-compressor/persisted-types/index.js +6 -0
- package/lib/id-compressor/persisted-types/index.js.map +1 -0
- package/lib/index.d.ts +29 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +23 -6
- package/lib/index.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +385 -0
- package/lib/persisted-types/0.0.2.d.ts.map +1 -0
- package/lib/persisted-types/0.0.2.js +110 -0
- package/lib/persisted-types/0.0.2.js.map +1 -0
- package/lib/persisted-types/0.1.1.d.ts +314 -0
- package/lib/persisted-types/0.1.1.d.ts.map +1 -0
- package/lib/persisted-types/0.1.1.js +150 -0
- package/lib/persisted-types/0.1.1.js.map +1 -0
- package/lib/persisted-types/index.d.ts +7 -0
- package/lib/persisted-types/index.d.ts.map +1 -0
- package/lib/persisted-types/index.js +8 -0
- package/lib/persisted-types/index.js.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.js +169 -0
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
- package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
- package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
- package/lib/test/ChangeCompression.tests.js +145 -0
- package/lib/test/ChangeCompression.tests.js.map +1 -0
- package/lib/test/Checkout.tests.d.ts +2 -3
- package/lib/test/Checkout.tests.d.ts.map +1 -1
- package/lib/test/Checkout.tests.js +126 -69
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Common.tests.js +60 -2
- package/lib/test/Common.tests.js.map +1 -1
- package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
- package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
- package/lib/test/EagerCheckout.tests.js +20 -0
- package/lib/test/EagerCheckout.tests.js.map +1 -0
- package/lib/test/Edit.tests.js +22 -14
- package/lib/test/Edit.tests.js.map +1 -1
- package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
- package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
- package/lib/test/EditLog.perf.tests.js +30 -0
- package/lib/test/EditLog.perf.tests.js.map +1 -0
- package/lib/test/EditLog.tests.js +10 -6
- package/lib/test/EditLog.tests.js.map +1 -1
- package/lib/test/EditUtilities.tests.d.ts +6 -0
- package/lib/test/EditUtilities.tests.d.ts.map +1 -0
- package/lib/test/EditUtilities.tests.js +503 -0
- package/lib/test/EditUtilities.tests.js.map +1 -0
- package/lib/test/Forest.perf.tests.d.ts +6 -0
- package/lib/test/Forest.perf.tests.d.ts.map +1 -0
- package/lib/test/Forest.perf.tests.js +133 -0
- package/lib/test/Forest.perf.tests.js.map +1 -0
- package/lib/test/Forest.tests.js +54 -27
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/GenericTransaction.tests.js +12 -3
- package/lib/test/GenericTransaction.tests.js.map +1 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
- package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
- package/lib/test/HistoryEditFactory.tests.js +90 -0
- package/lib/test/HistoryEditFactory.tests.js.map +1 -0
- package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
- package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.perf.tests.js +304 -0
- package/lib/test/IdCompressor.perf.tests.js.map +1 -0
- package/lib/test/IdCompressor.tests.d.ts +6 -0
- package/lib/test/IdCompressor.tests.d.ts.map +1 -0
- package/lib/test/IdCompressor.tests.js +1075 -0
- package/lib/test/IdCompressor.tests.js.map +1 -0
- package/lib/test/IdConversion.tests.d.ts +6 -0
- package/lib/test/IdConversion.tests.d.ts.map +1 -0
- package/lib/test/IdConversion.tests.js +36 -0
- package/lib/test/IdConversion.tests.js.map +1 -0
- package/lib/test/LazyCheckout.tests.d.ts +6 -0
- package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
- package/lib/test/LazyCheckout.tests.js +22 -0
- package/lib/test/LazyCheckout.tests.js.map +1 -0
- package/lib/test/LogViewer.tests.js +276 -191
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
- package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
- package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.perf.tests.js +68 -0
- package/lib/test/NumericUuid.perf.tests.js.map +1 -0
- package/lib/test/NumericUuid.tests.d.ts +6 -0
- package/lib/test/NumericUuid.tests.d.ts.map +1 -0
- package/lib/test/NumericUuid.tests.js +191 -0
- package/lib/test/NumericUuid.tests.js.map +1 -0
- package/lib/test/RevisionView.tests.d.ts +6 -0
- package/lib/test/RevisionView.tests.d.ts.map +1 -0
- package/lib/test/RevisionView.tests.js +133 -0
- package/lib/test/RevisionView.tests.js.map +1 -0
- package/lib/test/SharedTree.perf.tests.d.ts +6 -0
- package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
- package/lib/test/SharedTree.perf.tests.js +39 -0
- package/lib/test/SharedTree.perf.tests.js.map +1 -0
- package/lib/test/SharedTree.tests.js +15 -3
- package/lib/test/SharedTree.tests.js.map +1 -1
- package/lib/test/StringInterner.tests.d.ts +6 -0
- package/lib/test/StringInterner.tests.d.ts.map +1 -0
- package/lib/test/StringInterner.tests.js +71 -0
- package/lib/test/StringInterner.tests.js.map +1 -0
- package/lib/test/Summary.tests.d.ts +8 -0
- package/lib/test/Summary.tests.d.ts.map +1 -0
- package/lib/test/Summary.tests.js +407 -0
- package/lib/test/Summary.tests.js.map +1 -0
- package/lib/test/Transaction.tests.js +109 -329
- package/lib/test/Transaction.tests.js.map +1 -1
- package/lib/test/TransactionInternal.tests.d.ts +6 -0
- package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
- package/lib/test/TransactionInternal.tests.js +568 -0
- package/lib/test/TransactionInternal.tests.js.map +1 -0
- package/lib/test/TreeCompression.tests.d.ts +6 -0
- package/lib/test/TreeCompression.tests.d.ts.map +1 -0
- package/lib/test/TreeCompression.tests.js +292 -0
- package/lib/test/TreeCompression.tests.js.map +1 -0
- package/lib/test/TreeView.tests.d.ts +6 -0
- package/lib/test/TreeView.tests.d.ts.map +1 -0
- package/lib/test/TreeView.tests.js +176 -0
- package/lib/test/TreeView.tests.js.map +1 -0
- package/lib/test/UndoRedoHandler.tests.js +2 -2
- package/lib/test/UndoRedoHandler.tests.js.map +1 -1
- package/lib/test/Virtualization.tests.js +146 -62
- package/lib/test/Virtualization.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +19 -0
- package/lib/test/fuzz/Generators.d.ts.map +1 -0
- package/lib/test/fuzz/Generators.js +420 -0
- package/lib/test/fuzz/Generators.js.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js +217 -0
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
- package/lib/test/fuzz/Types.d.ts +133 -0
- package/lib/test/fuzz/Types.d.ts.map +1 -0
- package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
- package/lib/test/fuzz/Types.js.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
- package/lib/test/utilities/MockTransaction.d.ts +26 -7
- package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
- package/lib/test/utilities/MockTransaction.js +40 -11
- package/lib/test/utilities/MockTransaction.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
- package/lib/test/utilities/PendingLocalStateTests.js +105 -0
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
- package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +696 -439
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js +370 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
- package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
- package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
- package/lib/test/utilities/SummarySizeTests.js +158 -0
- package/lib/test/utilities/SummarySizeTests.js.map +1 -0
- package/lib/test/utilities/TestCommon.d.ts +9 -0
- package/lib/test/utilities/TestCommon.d.ts.map +1 -0
- package/lib/test/utilities/TestCommon.js +13 -0
- package/lib/test/utilities/TestCommon.js.map +1 -0
- package/lib/test/utilities/TestNode.d.ts +140 -0
- package/lib/test/utilities/TestNode.d.ts.map +1 -0
- package/lib/test/utilities/TestNode.js +292 -0
- package/lib/test/utilities/TestNode.js.map +1 -0
- package/lib/test/utilities/TestUtilities.d.ts +84 -70
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +218 -143
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
- package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
- package/lib/test/utilities/UndoRedoTests.js +138 -149
- package/lib/test/utilities/UndoRedoTests.js.map +1 -1
- package/package.json +22 -17
- package/src/ChangeCompression.ts +159 -0
- package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -125
- package/src/Checkout.ts +82 -53
- package/src/Common.ts +317 -117
- package/src/EagerCheckout.ts +38 -0
- package/src/EditLog.ts +153 -100
- package/src/EditUtilities.ts +559 -0
- package/src/EventTypes.ts +74 -0
- package/src/Forest.ts +81 -73
- package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
- package/src/IdConversion.ts +125 -0
- package/src/Identifiers.ts +101 -1
- package/src/InitialTree.ts +5 -4
- package/src/LazyCheckout.ts +51 -0
- package/src/LogViewer.ts +242 -166
- package/src/MergeHealth.ts +447 -0
- package/src/NodeIdUtilities.ts +156 -0
- package/src/PayloadUtilities.ts +124 -0
- package/src/ReconciliationPath.ts +18 -13
- package/src/RevisionValueCache.ts +14 -5
- package/src/RevisionView.ts +252 -0
- package/src/SerializationUtilities.ts +130 -0
- package/src/SharedTree.ts +1501 -0
- package/src/SharedTreeEncoder.ts +493 -0
- package/src/StringInterner.ts +72 -0
- package/src/Summary.ts +48 -0
- package/src/SummaryBackCompatibility.ts +47 -57
- package/src/SummaryTestUtilities.ts +54 -0
- package/src/Transaction.ts +120 -0
- package/src/TransactionInternal.ts +1087 -0
- package/src/TreeCompressor.ts +213 -0
- package/src/TreeNodeHandle.ts +19 -32
- package/src/TreeView.ts +322 -0
- package/src/TreeViewUtilities.ts +77 -0
- package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
- package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
- package/src/id-compressor/IdCompressor.md +3 -0
- package/src/id-compressor/IdCompressor.ts +1848 -0
- package/src/id-compressor/IdRange.ts +33 -0
- package/src/id-compressor/NumericUuid.ts +414 -0
- package/src/id-compressor/index.ts +13 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
- package/src/id-compressor/persisted-types/README.md +3 -0
- package/src/id-compressor/persisted-types/index.ts +6 -0
- package/src/index.ts +118 -59
- package/src/persisted-types/0.0.2.ts +442 -0
- package/src/persisted-types/0.1.1.ts +476 -0
- package/src/persisted-types/README.md +22 -0
- package/src/persisted-types/index.ts +9 -0
- package/.mocharc.js +0 -41
- package/api/tree.api.md +0 -729
- package/dist/BasicCheckout.d.ts +0 -23
- package/dist/BasicCheckout.d.ts.map +0 -1
- package/dist/BasicCheckout.js.map +0 -1
- package/dist/Snapshot.d.ts +0 -198
- package/dist/Snapshot.d.ts.map +0 -1
- package/dist/Snapshot.js +0 -267
- package/dist/Snapshot.js.map +0 -1
- package/dist/SnapshotUtilities.d.ts +0 -29
- package/dist/SnapshotUtilities.d.ts.map +0 -1
- package/dist/SnapshotUtilities.js +0 -73
- package/dist/SnapshotUtilities.js.map +0 -1
- package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
- package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/dist/anchored-edits/AnchorResolution.js +0 -162
- package/dist/anchored-edits/AnchorResolution.js.map +0 -1
- package/dist/anchored-edits/Factory.d.ts +0 -56
- package/dist/anchored-edits/Factory.d.ts.map +0 -1
- package/dist/anchored-edits/Factory.js +0 -79
- package/dist/anchored-edits/Factory.js.map +0 -1
- package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
- package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/anchored-edits/PersistedTypes.js +0 -131
- package/dist/anchored-edits/PersistedTypes.js.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
- package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
- package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/dist/anchored-edits/index.d.ts +0 -10
- package/dist/anchored-edits/index.d.ts.map +0 -1
- package/dist/anchored-edits/index.js +0 -34
- package/dist/anchored-edits/index.js.map +0 -1
- package/dist/default-edits/EditUtilities.d.ts +0 -57
- package/dist/default-edits/EditUtilities.d.ts.map +0 -1
- package/dist/default-edits/EditUtilities.js +0 -192
- package/dist/default-edits/EditUtilities.js.map +0 -1
- package/dist/default-edits/Factory.d.ts +0 -56
- package/dist/default-edits/Factory.d.ts.map +0 -1
- package/dist/default-edits/Factory.js +0 -79
- package/dist/default-edits/Factory.js.map +0 -1
- package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
- package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/dist/default-edits/HistoryEditFactory.js +0 -187
- package/dist/default-edits/HistoryEditFactory.js.map +0 -1
- package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
- package/dist/default-edits/PersistedTypes.js.map +0 -1
- package/dist/default-edits/SharedTree.d.ts +0 -111
- package/dist/default-edits/SharedTree.d.ts.map +0 -1
- package/dist/default-edits/SharedTree.js +0 -124
- package/dist/default-edits/SharedTree.js.map +0 -1
- package/dist/default-edits/Summary.d.ts +0 -15
- package/dist/default-edits/Summary.d.ts.map +0 -1
- package/dist/default-edits/Summary.js +0 -35
- package/dist/default-edits/Summary.js.map +0 -1
- package/dist/default-edits/Transaction.d.ts +0 -41
- package/dist/default-edits/Transaction.d.ts.map +0 -1
- package/dist/default-edits/Transaction.js +0 -225
- package/dist/default-edits/Transaction.js.map +0 -1
- package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/dist/default-edits/UndoRedoHandler.js.map +0 -1
- package/dist/default-edits/index.d.ts +0 -13
- package/dist/default-edits/index.d.ts.map +0 -1
- package/dist/default-edits/index.js +0 -41
- package/dist/default-edits/index.js.map +0 -1
- package/dist/generic/GenericEditUtilities.d.ts +0 -26
- package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
- package/dist/generic/GenericEditUtilities.js +0 -45
- package/dist/generic/GenericEditUtilities.js.map +0 -1
- package/dist/generic/GenericSharedTree.d.ts +0 -221
- package/dist/generic/GenericSharedTree.d.ts.map +0 -1
- package/dist/generic/GenericSharedTree.js +0 -447
- package/dist/generic/GenericSharedTree.js.map +0 -1
- package/dist/generic/GenericTransaction.d.ts +0 -87
- package/dist/generic/GenericTransaction.d.ts.map +0 -1
- package/dist/generic/GenericTransaction.js +0 -144
- package/dist/generic/GenericTransaction.js.map +0 -1
- package/dist/generic/PersistedTypes.d.ts +0 -194
- package/dist/generic/PersistedTypes.d.ts.map +0 -1
- package/dist/generic/PersistedTypes.js +0 -42
- package/dist/generic/PersistedTypes.js.map +0 -1
- package/dist/generic/Summary.d.ts +0 -63
- package/dist/generic/Summary.d.ts.map +0 -1
- package/dist/generic/Summary.js +0 -64
- package/dist/generic/Summary.js.map +0 -1
- package/dist/generic/index.d.ts +0 -10
- package/dist/generic/index.d.ts.map +0 -1
- package/dist/generic/index.js +0 -26
- package/dist/generic/index.js.map +0 -1
- package/docs/Future.md +0 -155
- package/lib/BasicCheckout.d.ts +0 -23
- package/lib/BasicCheckout.d.ts.map +0 -1
- package/lib/BasicCheckout.js.map +0 -1
- package/lib/Snapshot.d.ts +0 -198
- package/lib/Snapshot.d.ts.map +0 -1
- package/lib/Snapshot.js +0 -263
- package/lib/Snapshot.js.map +0 -1
- package/lib/SnapshotUtilities.d.ts +0 -29
- package/lib/SnapshotUtilities.d.ts.map +0 -1
- package/lib/SnapshotUtilities.js +0 -67
- package/lib/SnapshotUtilities.js.map +0 -1
- package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
- package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
- package/lib/anchored-edits/AnchorResolution.js +0 -152
- package/lib/anchored-edits/AnchorResolution.js.map +0 -1
- package/lib/anchored-edits/Factory.d.ts +0 -56
- package/lib/anchored-edits/Factory.d.ts.map +0 -1
- package/lib/anchored-edits/Factory.js +0 -74
- package/lib/anchored-edits/Factory.js.map +0 -1
- package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
- package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/anchored-edits/PersistedTypes.js +0 -128
- package/lib/anchored-edits/PersistedTypes.js.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
- package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
- package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
- package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
- package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
- package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
- package/lib/anchored-edits/index.d.ts +0 -10
- package/lib/anchored-edits/index.d.ts.map +0 -1
- package/lib/anchored-edits/index.js +0 -11
- package/lib/anchored-edits/index.js.map +0 -1
- package/lib/default-edits/EditUtilities.d.ts +0 -57
- package/lib/default-edits/EditUtilities.d.ts.map +0 -1
- package/lib/default-edits/EditUtilities.js +0 -181
- package/lib/default-edits/EditUtilities.js.map +0 -1
- package/lib/default-edits/Factory.d.ts +0 -56
- package/lib/default-edits/Factory.d.ts.map +0 -1
- package/lib/default-edits/Factory.js +0 -74
- package/lib/default-edits/Factory.js.map +0 -1
- package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
- package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
- package/lib/default-edits/HistoryEditFactory.js.map +0 -1
- package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
- package/lib/default-edits/PersistedTypes.js.map +0 -1
- package/lib/default-edits/SharedTree.d.ts +0 -111
- package/lib/default-edits/SharedTree.d.ts.map +0 -1
- package/lib/default-edits/SharedTree.js +0 -100
- package/lib/default-edits/SharedTree.js.map +0 -1
- package/lib/default-edits/Summary.d.ts +0 -15
- package/lib/default-edits/Summary.d.ts.map +0 -1
- package/lib/default-edits/Summary.js +0 -31
- package/lib/default-edits/Summary.js.map +0 -1
- package/lib/default-edits/Transaction.d.ts +0 -41
- package/lib/default-edits/Transaction.d.ts.map +0 -1
- package/lib/default-edits/Transaction.js +0 -221
- package/lib/default-edits/Transaction.js.map +0 -1
- package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
- package/lib/default-edits/UndoRedoHandler.js.map +0 -1
- package/lib/default-edits/index.d.ts +0 -13
- package/lib/default-edits/index.d.ts.map +0 -1
- package/lib/default-edits/index.js +0 -14
- package/lib/default-edits/index.js.map +0 -1
- package/lib/generic/GenericEditUtilities.d.ts +0 -26
- package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
- package/lib/generic/GenericEditUtilities.js +0 -38
- package/lib/generic/GenericEditUtilities.js.map +0 -1
- package/lib/generic/GenericSharedTree.d.ts +0 -221
- package/lib/generic/GenericSharedTree.d.ts.map +0 -1
- package/lib/generic/GenericSharedTree.js +0 -443
- package/lib/generic/GenericSharedTree.js.map +0 -1
- package/lib/generic/GenericTransaction.d.ts +0 -87
- package/lib/generic/GenericTransaction.d.ts.map +0 -1
- package/lib/generic/GenericTransaction.js +0 -140
- package/lib/generic/GenericTransaction.js.map +0 -1
- package/lib/generic/PersistedTypes.d.ts +0 -194
- package/lib/generic/PersistedTypes.d.ts.map +0 -1
- package/lib/generic/PersistedTypes.js +0 -39
- package/lib/generic/PersistedTypes.js.map +0 -1
- package/lib/generic/Summary.d.ts +0 -63
- package/lib/generic/Summary.d.ts.map +0 -1
- package/lib/generic/Summary.js +0 -58
- package/lib/generic/Summary.js.map +0 -1
- package/lib/generic/index.d.ts +0 -10
- package/lib/generic/index.d.ts.map +0 -1
- package/lib/generic/index.js +0 -11
- package/lib/generic/index.js.map +0 -1
- package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
- package/lib/test/Anchors.glassBox.tests.js +0 -410
- package/lib/test/Anchors.glassBox.tests.js.map +0 -1
- package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
- package/lib/test/BasicCheckout.tests.js +0 -8
- package/lib/test/BasicCheckout.tests.js.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
- package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
- package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
- package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
- package/lib/test/Snapshot.tests.d.ts.map +0 -1
- package/lib/test/Snapshot.tests.js +0 -96
- package/lib/test/Snapshot.tests.js.map +0 -1
- package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
- package/lib/test/SnapshotUtilities.tests.js +0 -168
- package/lib/test/SnapshotUtilities.tests.js.map +0 -1
- package/lib/test/undoRedoStackManager.d.ts +0 -26
- package/lib/test/undoRedoStackManager.d.ts.map +0 -1
- package/lib/test/undoRedoStackManager.js +0 -176
- package/lib/test/undoRedoStackManager.js.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
- package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
- package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
- package/src/BasicCheckout.ts +0 -34
- package/src/Snapshot.ts +0 -363
- package/src/SnapshotUtilities.ts +0 -88
- package/src/anchored-edits/AnchorResolution.ts +0 -442
- package/src/anchored-edits/Factory.ts +0 -94
- package/src/anchored-edits/PersistedTypes.ts +0 -310
- package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
- package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
- package/src/anchored-edits/index.ts +0 -21
- package/src/default-edits/EditUtilities.ts +0 -220
- package/src/default-edits/Factory.ts +0 -94
- package/src/default-edits/SharedTree.ts +0 -174
- package/src/default-edits/Summary.ts +0 -44
- package/src/default-edits/Transaction.ts +0 -262
- package/src/default-edits/index.ts +0 -29
- package/src/generic/GenericEditUtilities.ts +0 -46
- package/src/generic/GenericSharedTree.ts +0 -593
- package/src/generic/GenericTransaction.ts +0 -194
- package/src/generic/PersistedTypes.ts +0 -221
- package/src/generic/Summary.ts +0 -113
- package/src/generic/index.ts +0 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedTreeFuzzTests.d.ts","sourceRoot":"","sources":["../../../src/test/fuzz/SharedTreeFuzzTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,aAAa,EAA8B,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAS/F;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACvC,SAAS,EAAE,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,EAC/C,IAAI,EAAE,MAAM,EACZ,gBAAgB,GAAE,OAAc,EAChC,QAAQ,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CA8GlC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAkI1D"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { promises as fs, existsSync, mkdirSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import Prando from 'prando';
|
|
8
|
+
import { expect } from 'chai';
|
|
9
|
+
import { setUpLocalServerTestSharedTree, testDocumentsPathBase } from '../utilities/TestUtilities';
|
|
10
|
+
import { WriteFormat } from '../../persisted-types';
|
|
11
|
+
import { fail } from '../../Common';
|
|
12
|
+
import { areRevisionViewsSemanticallyEqual } from '../../EditUtilities';
|
|
13
|
+
import { done } from './Types';
|
|
14
|
+
import { chain, makeOpGenerator, take } from './Generators';
|
|
15
|
+
const directory = join(testDocumentsPathBase, 'fuzz-tests');
|
|
16
|
+
// TODO: Kludge: Use this to change the seed such that the tests avoid hitting bugs in the Fluid Framework.
|
|
17
|
+
// Should be removed once fuzz tests pass reliably with any seed.
|
|
18
|
+
const adjustSeed = 2;
|
|
19
|
+
/**
|
|
20
|
+
* Performs random actions on a set of clients.
|
|
21
|
+
* @param generator finite generator for a sequence of Operations to test. The test will run until this generator is exhausted.
|
|
22
|
+
* @param seed the seed for the random generation of the fuzz actions
|
|
23
|
+
* @param synchronizeAtEnd if provided, all client will have all operations delivered from the server at the end of the test
|
|
24
|
+
* @param saveInfo optionally provide an operation number at which a history of all operations will be saved to disk at a given filepath.
|
|
25
|
+
* This can be useful for debugging why a fuzz test may have failed.
|
|
26
|
+
*/
|
|
27
|
+
export async function performFuzzActions(generator, seed, synchronizeAtEnd = true, saveInfo) {
|
|
28
|
+
var _a;
|
|
29
|
+
const rand = new Prando(seed);
|
|
30
|
+
// Note: the direct fields of `state` aren't mutated, but it is mutated transitively.
|
|
31
|
+
const state = { rand, passiveCollaborators: [], activeCollaborators: [] };
|
|
32
|
+
const { activeCollaborators, passiveCollaborators } = state;
|
|
33
|
+
const operations = [];
|
|
34
|
+
for (let operation = await generator(state, undefined); operation !== done; operation = await generator(state, undefined)) {
|
|
35
|
+
operations.push(operation);
|
|
36
|
+
if (saveInfo !== undefined && operations.length === saveInfo.saveAt) {
|
|
37
|
+
await fs.writeFile(saveInfo.filepath, JSON.stringify(operations));
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
switch (operation.type) {
|
|
41
|
+
case 'edit': {
|
|
42
|
+
const { index, contents } = operation;
|
|
43
|
+
const { tree } = activeCollaborators[index];
|
|
44
|
+
switch (contents.fuzzType) {
|
|
45
|
+
case 'insert':
|
|
46
|
+
tree.applyEdit(contents.build, contents.insert);
|
|
47
|
+
break;
|
|
48
|
+
case 'delete':
|
|
49
|
+
tree.applyEdit(contents);
|
|
50
|
+
break;
|
|
51
|
+
case 'move':
|
|
52
|
+
tree.applyEdit(contents.detach, contents.insert);
|
|
53
|
+
break;
|
|
54
|
+
case 'setPayload':
|
|
55
|
+
tree.applyEdit(contents);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
fail('Invalid edit.');
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case 'join': {
|
|
64
|
+
const { isObserver, summarizeHistory, writeFormat } = operation;
|
|
65
|
+
const { container, tree, testObjectProvider } = await setUpLocalServerTestSharedTree({
|
|
66
|
+
writeFormat,
|
|
67
|
+
summarizeHistory,
|
|
68
|
+
testObjectProvider: state.testObjectProvider,
|
|
69
|
+
});
|
|
70
|
+
if (state.testObjectProvider === undefined) {
|
|
71
|
+
state.testObjectProvider = testObjectProvider;
|
|
72
|
+
}
|
|
73
|
+
(isObserver ? passiveCollaborators : activeCollaborators).push({ container, tree });
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 'leave': {
|
|
77
|
+
const { index, isObserver } = operation;
|
|
78
|
+
const treeList = isObserver ? passiveCollaborators : activeCollaborators;
|
|
79
|
+
treeList[index].container.close();
|
|
80
|
+
treeList.splice(index, 1);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case 'synchronize': {
|
|
84
|
+
const { testObjectProvider } = state;
|
|
85
|
+
if (testObjectProvider === undefined) {
|
|
86
|
+
fail('Attempted to synchronize with undefined testObjectProvider');
|
|
87
|
+
}
|
|
88
|
+
await testObjectProvider.ensureSynchronized();
|
|
89
|
+
const trees = [...state.activeCollaborators, ...state.passiveCollaborators];
|
|
90
|
+
if (trees.length > 1) {
|
|
91
|
+
const first = trees[0].tree;
|
|
92
|
+
for (let i = 1; i < trees.length; i++) {
|
|
93
|
+
const tree = trees[i].tree;
|
|
94
|
+
const editLogA = first.editsInternal;
|
|
95
|
+
const editLogB = tree.editsInternal;
|
|
96
|
+
const minEdits = Math.min(editLogA.length, editLogB.length);
|
|
97
|
+
for (let j = 0; j < minEdits - 1; j++) {
|
|
98
|
+
const editA = await editLogA.getEditAtIndex(editLogA.length - j - 1);
|
|
99
|
+
const editB = await editLogB.getEditAtIndex(editLogB.length - j - 1);
|
|
100
|
+
expect(editA.id).to.equal(editB.id);
|
|
101
|
+
}
|
|
102
|
+
expect(areRevisionViewsSemanticallyEqual(tree.currentView, tree, first.currentView, first))
|
|
103
|
+
.to.be.true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
default:
|
|
109
|
+
throw new Error('Unknown operation.');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
console.log(`Error encountered on operation number ${operations.length}`);
|
|
114
|
+
if (saveInfo !== undefined && saveInfo.saveOnFailure) {
|
|
115
|
+
await fs.writeFile(saveInfo.filepath, JSON.stringify(operations));
|
|
116
|
+
}
|
|
117
|
+
throw err;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (synchronizeAtEnd) {
|
|
121
|
+
await ((_a = state.testObjectProvider) === null || _a === void 0 ? void 0 : _a.ensureSynchronized());
|
|
122
|
+
const trees = [...activeCollaborators.map(({ tree }) => tree), ...passiveCollaborators.map(({ tree }) => tree)];
|
|
123
|
+
for (let i = 0; i < trees.length - 1; i++) {
|
|
124
|
+
expect(trees[i].equals(trees[i + 1]));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return state;
|
|
128
|
+
}
|
|
129
|
+
export function runSharedTreeFuzzTests(title) {
|
|
130
|
+
// Some useful tips for debugging fuzz tests:
|
|
131
|
+
// - A JSON dump of the operation sequence can be written to disk by passing `true` for `saveOnFailure`.
|
|
132
|
+
// - Different shared-tree instances can be distinguished (e.g. in logs) by using `tree.getRuntime().clientId`
|
|
133
|
+
describe(title, () => {
|
|
134
|
+
function runTest(generatorFactory, seed, saveOnFailure) {
|
|
135
|
+
it(`with seed ${seed}`, async () => {
|
|
136
|
+
const saveInfo = saveOnFailure !== undefined
|
|
137
|
+
? { filepath: join(directory, `test-history-${seed}.json`), saveOnFailure }
|
|
138
|
+
: undefined;
|
|
139
|
+
if (saveInfo !== undefined && !existsSync(directory)) {
|
|
140
|
+
mkdirSync(directory);
|
|
141
|
+
}
|
|
142
|
+
await performFuzzActions(generatorFactory(), seed + adjustSeed, true, saveInfo);
|
|
143
|
+
}).timeout(10000);
|
|
144
|
+
}
|
|
145
|
+
function runMixedVersionTests(summarizeHistory, testsPerSuite) {
|
|
146
|
+
describe('using 0.0.2 and 0.1.1 trees', () => {
|
|
147
|
+
for (let seed = 0; seed < testsPerSuite; seed++) {
|
|
148
|
+
runTest(() => take(1000, makeOpGenerator({ joinConfig: { summarizeHistory: [summarizeHistory] } })), seed);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
describe('using only version 0.0.2', () => {
|
|
152
|
+
for (let seed = 0; seed < testsPerSuite; seed++) {
|
|
153
|
+
runTest(() => take(1000, makeOpGenerator({
|
|
154
|
+
joinConfig: {
|
|
155
|
+
writeFormat: [WriteFormat.v0_0_2],
|
|
156
|
+
summarizeHistory: [summarizeHistory],
|
|
157
|
+
},
|
|
158
|
+
})), seed);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
describe('using only version 0.1.1', () => {
|
|
162
|
+
for (let seed = 0; seed < testsPerSuite; seed++) {
|
|
163
|
+
runTest(() => take(1000, makeOpGenerator({
|
|
164
|
+
joinConfig: {
|
|
165
|
+
writeFormat: [WriteFormat.v0_1_1],
|
|
166
|
+
summarizeHistory: [summarizeHistory],
|
|
167
|
+
},
|
|
168
|
+
})), seed);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
describe('upgrading halfway through', () => {
|
|
172
|
+
const testLength = 500;
|
|
173
|
+
const maximumActiveCollaborators = 10;
|
|
174
|
+
const maximumPassiveCollaborators = 5;
|
|
175
|
+
const editConfig = { maxTreeSize: 1000 };
|
|
176
|
+
const generatorFactory = () => chain(take(testLength / 2 - 1, makeOpGenerator({
|
|
177
|
+
editConfig,
|
|
178
|
+
joinConfig: {
|
|
179
|
+
maximumActiveCollaborators,
|
|
180
|
+
maximumPassiveCollaborators,
|
|
181
|
+
writeFormat: [WriteFormat.v0_0_2],
|
|
182
|
+
summarizeHistory: [summarizeHistory],
|
|
183
|
+
},
|
|
184
|
+
})), take(1, makeOpGenerator({
|
|
185
|
+
joinConfig: {
|
|
186
|
+
maximumActiveCollaborators: maximumActiveCollaborators + 1,
|
|
187
|
+
maximumPassiveCollaborators,
|
|
188
|
+
writeFormat: [WriteFormat.v0_1_1],
|
|
189
|
+
summarizeHistory: [summarizeHistory],
|
|
190
|
+
},
|
|
191
|
+
editWeight: 0,
|
|
192
|
+
joinWeight: 1,
|
|
193
|
+
leaveWeight: 0,
|
|
194
|
+
synchronizeWeight: 0,
|
|
195
|
+
})), take(testLength / 2, makeOpGenerator({
|
|
196
|
+
editConfig,
|
|
197
|
+
joinConfig: {
|
|
198
|
+
maximumActiveCollaborators,
|
|
199
|
+
maximumPassiveCollaborators,
|
|
200
|
+
summarizeHistory: [summarizeHistory],
|
|
201
|
+
},
|
|
202
|
+
})));
|
|
203
|
+
for (let seed = 0; seed < testsPerSuite; seed++) {
|
|
204
|
+
runTest(generatorFactory, seed);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
const testCount = 1;
|
|
209
|
+
describe('with no-history summarization', () => {
|
|
210
|
+
runMixedVersionTests(false, testCount);
|
|
211
|
+
});
|
|
212
|
+
describe('with history summarization', () => {
|
|
213
|
+
runMixedVersionTests(true, testCount);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=SharedTreeFuzzTests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedTreeFuzzTests.js","sourceRoot":"","sources":["../../../src/test/fuzz/SharedTreeFuzzTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,8BAA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,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { promises as fs, existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport Prando from 'prando';\nimport { expect } from 'chai';\nimport { setUpLocalServerTestSharedTree, testDocumentsPathBase } from '../utilities/TestUtilities';\nimport { ChangeInternal, WriteFormat } from '../../persisted-types';\nimport { fail } from '../../Common';\nimport { areRevisionViewsSemanticallyEqual } from '../../EditUtilities';\nimport { EditLog } from '../../EditLog';\nimport { FuzzTestState, done, EditGenerationConfig, AsyncGenerator, Operation } from './Types';\nimport { chain, makeOpGenerator, take } from './Generators';\n\nconst directory = join(testDocumentsPathBase, 'fuzz-tests');\n\n// TODO: Kludge: Use this to change the seed such that the tests avoid hitting bugs in the Fluid Framework.\n// Should be removed once fuzz tests pass reliably with any seed.\nconst adjustSeed = 2;\n\n/**\n * Performs random actions on a set of clients.\n * @param generator finite generator for a sequence of Operations to test. The test will run until this generator is exhausted.\n * @param seed the seed for the random generation of the fuzz actions\n * @param synchronizeAtEnd if provided, all client will have all operations delivered from the server at the end of the test\n * @param saveInfo optionally provide an operation number at which a history of all operations will be saved to disk at a given filepath.\n * This can be useful for debugging why a fuzz test may have failed.\n */\nexport async function performFuzzActions(\n\tgenerator: AsyncGenerator<Operation, undefined>,\n\tseed: number,\n\tsynchronizeAtEnd: boolean = true,\n\tsaveInfo?: { saveAt?: number; saveOnFailure: boolean; filepath: string }\n): Promise<Required<FuzzTestState>> {\n\tconst rand = new Prando(seed);\n\n\t// Note: the direct fields of `state` aren't mutated, but it is mutated transitively.\n\tconst state: FuzzTestState = { rand, passiveCollaborators: [], activeCollaborators: [] };\n\tconst { activeCollaborators, passiveCollaborators } = state;\n\tconst operations: Operation[] = [];\n\tfor (\n\t\tlet operation = await generator(state, undefined);\n\t\toperation !== done;\n\t\toperation = await generator(state, undefined)\n\t) {\n\t\toperations.push(operation);\n\t\tif (saveInfo !== undefined && operations.length === saveInfo.saveAt) {\n\t\t\tawait fs.writeFile(saveInfo.filepath, JSON.stringify(operations));\n\t\t}\n\n\t\ttry {\n\t\t\tswitch (operation.type) {\n\t\t\t\tcase 'edit': {\n\t\t\t\t\tconst { index, contents } = operation;\n\t\t\t\t\tconst { tree } = activeCollaborators[index];\n\t\t\t\t\tswitch (contents.fuzzType) {\n\t\t\t\t\t\tcase 'insert':\n\t\t\t\t\t\t\ttree.applyEdit(contents.build, contents.insert);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'delete':\n\t\t\t\t\t\t\ttree.applyEdit(contents);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'move':\n\t\t\t\t\t\t\ttree.applyEdit(contents.detach, contents.insert);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'setPayload':\n\t\t\t\t\t\t\ttree.applyEdit(contents);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tfail('Invalid edit.');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'join': {\n\t\t\t\t\tconst { isObserver, summarizeHistory, writeFormat } = operation;\n\t\t\t\t\tconst { container, tree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat,\n\t\t\t\t\t\tsummarizeHistory,\n\t\t\t\t\t\ttestObjectProvider: state.testObjectProvider,\n\t\t\t\t\t});\n\t\t\t\t\tif (state.testObjectProvider === undefined) {\n\t\t\t\t\t\tstate.testObjectProvider = testObjectProvider;\n\t\t\t\t\t}\n\t\t\t\t\t(isObserver ? passiveCollaborators : activeCollaborators).push({ container, tree });\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'leave': {\n\t\t\t\t\tconst { index, isObserver } = operation;\n\t\t\t\t\tconst treeList = isObserver ? passiveCollaborators : activeCollaborators;\n\t\t\t\t\ttreeList[index].container.close();\n\t\t\t\t\ttreeList.splice(index, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'synchronize': {\n\t\t\t\t\tconst { testObjectProvider } = state;\n\t\t\t\t\tif (testObjectProvider === undefined) {\n\t\t\t\t\t\tfail('Attempted to synchronize with undefined testObjectProvider');\n\t\t\t\t\t}\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tconst trees = [...state.activeCollaborators, ...state.passiveCollaborators];\n\t\t\t\t\tif (trees.length > 1) {\n\t\t\t\t\t\tconst first = trees[0].tree;\n\t\t\t\t\t\tfor (let i = 1; i < trees.length; i++) {\n\t\t\t\t\t\t\tconst tree = trees[i].tree;\n\t\t\t\t\t\t\tconst editLogA = first.editsInternal as EditLog<ChangeInternal>;\n\t\t\t\t\t\t\tconst editLogB = tree.editsInternal as EditLog<ChangeInternal>;\n\t\t\t\t\t\t\tconst minEdits = Math.min(editLogA.length, editLogB.length);\n\t\t\t\t\t\t\tfor (let j = 0; j < minEdits - 1; j++) {\n\t\t\t\t\t\t\t\tconst editA = await editLogA.getEditAtIndex(editLogA.length - j - 1);\n\t\t\t\t\t\t\t\tconst editB = await editLogB.getEditAtIndex(editLogB.length - j - 1);\n\t\t\t\t\t\t\t\texpect(editA.id).to.equal(editB.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texpect(areRevisionViewsSemanticallyEqual(tree.currentView, tree, first.currentView, first))\n\t\t\t\t\t\t\t\t.to.be.true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error('Unknown operation.');\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconsole.log(`Error encountered on operation number ${operations.length}`);\n\t\t\tif (saveInfo !== undefined && saveInfo.saveOnFailure) {\n\t\t\t\tawait fs.writeFile(saveInfo.filepath, JSON.stringify(operations));\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tif (synchronizeAtEnd) {\n\t\tawait state.testObjectProvider?.ensureSynchronized();\n\t\tconst trees = [...activeCollaborators.map(({ tree }) => tree), ...passiveCollaborators.map(({ tree }) => tree)];\n\t\tfor (let i = 0; i < trees.length - 1; i++) {\n\t\t\texpect(trees[i].equals(trees[i + 1]));\n\t\t}\n\t}\n\n\treturn state as Required<FuzzTestState>;\n}\n\nexport function runSharedTreeFuzzTests(title: string): void {\n\t// Some useful tips for debugging fuzz tests:\n\t// - A JSON dump of the operation sequence can be written to disk by passing `true` for `saveOnFailure`.\n\t// - Different shared-tree instances can be distinguished (e.g. in logs) by using `tree.getRuntime().clientId`\n\tdescribe(title, () => {\n\t\tfunction runTest(\n\t\t\tgeneratorFactory: () => AsyncGenerator<Operation, undefined>,\n\t\t\tseed: number,\n\t\t\tsaveOnFailure?: boolean\n\t\t): void {\n\t\t\tit(`with seed ${seed}`, async () => {\n\t\t\t\tconst saveInfo =\n\t\t\t\t\tsaveOnFailure !== undefined\n\t\t\t\t\t\t? { filepath: join(directory, `test-history-${seed}.json`), saveOnFailure }\n\t\t\t\t\t\t: undefined;\n\t\t\t\tif (saveInfo !== undefined && !existsSync(directory)) {\n\t\t\t\t\tmkdirSync(directory);\n\t\t\t\t}\n\t\t\t\tawait performFuzzActions(generatorFactory(), seed + adjustSeed, true, saveInfo);\n\t\t\t}).timeout(10000);\n\t\t}\n\n\t\tfunction runMixedVersionTests(summarizeHistory: boolean, testsPerSuite: number): void {\n\t\t\tdescribe('using 0.0.2 and 0.1.1 trees', () => {\n\t\t\t\tfor (let seed = 0; seed < testsPerSuite; seed++) {\n\t\t\t\t\trunTest(\n\t\t\t\t\t\t() => take(1000, makeOpGenerator({ joinConfig: { summarizeHistory: [summarizeHistory] } })),\n\t\t\t\t\t\tseed\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tdescribe('using only version 0.0.2', () => {\n\t\t\t\tfor (let seed = 0; seed < testsPerSuite; seed++) {\n\t\t\t\t\trunTest(\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\ttake(\n\t\t\t\t\t\t\t\t1000,\n\t\t\t\t\t\t\t\tmakeOpGenerator({\n\t\t\t\t\t\t\t\t\tjoinConfig: {\n\t\t\t\t\t\t\t\t\t\twriteFormat: [WriteFormat.v0_0_2],\n\t\t\t\t\t\t\t\t\t\tsummarizeHistory: [summarizeHistory],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tseed\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tdescribe('using only version 0.1.1', () => {\n\t\t\t\tfor (let seed = 0; seed < testsPerSuite; seed++) {\n\t\t\t\t\trunTest(\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\ttake(\n\t\t\t\t\t\t\t\t1000,\n\t\t\t\t\t\t\t\tmakeOpGenerator({\n\t\t\t\t\t\t\t\t\tjoinConfig: {\n\t\t\t\t\t\t\t\t\t\twriteFormat: [WriteFormat.v0_1_1],\n\t\t\t\t\t\t\t\t\t\tsummarizeHistory: [summarizeHistory],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tseed\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tdescribe('upgrading halfway through', () => {\n\t\t\t\tconst testLength = 500;\n\t\t\t\tconst maximumActiveCollaborators = 10;\n\t\t\t\tconst maximumPassiveCollaborators = 5;\n\t\t\t\tconst editConfig: EditGenerationConfig = { maxTreeSize: 1000 };\n\t\t\t\tconst generatorFactory = () =>\n\t\t\t\t\tchain(\n\t\t\t\t\t\ttake(\n\t\t\t\t\t\t\ttestLength / 2 - 1,\n\t\t\t\t\t\t\tmakeOpGenerator({\n\t\t\t\t\t\t\t\teditConfig,\n\t\t\t\t\t\t\t\tjoinConfig: {\n\t\t\t\t\t\t\t\t\tmaximumActiveCollaborators,\n\t\t\t\t\t\t\t\t\tmaximumPassiveCollaborators,\n\t\t\t\t\t\t\t\t\twriteFormat: [WriteFormat.v0_0_2],\n\t\t\t\t\t\t\t\t\tsummarizeHistory: [summarizeHistory],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttake(\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\tmakeOpGenerator({\n\t\t\t\t\t\t\t\tjoinConfig: {\n\t\t\t\t\t\t\t\t\tmaximumActiveCollaborators: maximumActiveCollaborators + 1,\n\t\t\t\t\t\t\t\t\tmaximumPassiveCollaborators,\n\t\t\t\t\t\t\t\t\twriteFormat: [WriteFormat.v0_1_1],\n\t\t\t\t\t\t\t\t\tsummarizeHistory: [summarizeHistory],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\teditWeight: 0,\n\t\t\t\t\t\t\t\tjoinWeight: 1,\n\t\t\t\t\t\t\t\tleaveWeight: 0,\n\t\t\t\t\t\t\t\tsynchronizeWeight: 0,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttake(\n\t\t\t\t\t\t\ttestLength / 2,\n\t\t\t\t\t\t\tmakeOpGenerator({\n\t\t\t\t\t\t\t\teditConfig,\n\t\t\t\t\t\t\t\tjoinConfig: {\n\t\t\t\t\t\t\t\t\tmaximumActiveCollaborators,\n\t\t\t\t\t\t\t\t\tmaximumPassiveCollaborators,\n\t\t\t\t\t\t\t\t\tsummarizeHistory: [summarizeHistory],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\tfor (let seed = 0; seed < testsPerSuite; seed++) {\n\t\t\t\t\trunTest(generatorFactory, seed);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst testCount = 1;\n\t\tdescribe('with no-history summarization', () => {\n\t\t\trunMixedVersionTests(false, testCount);\n\t\t});\n\n\t\tdescribe('with history summarization', () => {\n\t\t\trunMixedVersionTests(true, testCount);\n\t\t});\n\t});\n}\n"]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { TestObjectProvider } from '@fluidframework/test-utils';
|
|
6
|
+
import type Prando from 'prando';
|
|
7
|
+
import type { IContainer } from '@fluidframework/container-definitions';
|
|
8
|
+
import type { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
9
|
+
import type { SharedTree } from '../../SharedTree';
|
|
10
|
+
import type { WriteFormat } from '../../persisted-types';
|
|
11
|
+
import type { Build, Detach, Insert, SetValue } from '../../ChangeTypes';
|
|
12
|
+
import type { TreeView } from '../../TreeView';
|
|
13
|
+
import type { NodeId } from '../../Identifiers';
|
|
14
|
+
import type { NodeIdGenerator } from '../../NodeIdUtilities';
|
|
15
|
+
export interface FuzzTestState {
|
|
16
|
+
rand: Prando;
|
|
17
|
+
testObjectProvider?: TestObjectProvider;
|
|
18
|
+
activeCollaborators: Collaborator[];
|
|
19
|
+
passiveCollaborators: Collaborator[];
|
|
20
|
+
}
|
|
21
|
+
export interface Collaborator {
|
|
22
|
+
container: IContainer;
|
|
23
|
+
tree: SharedTree;
|
|
24
|
+
}
|
|
25
|
+
export interface TreeEdit {
|
|
26
|
+
type: 'edit';
|
|
27
|
+
contents: FuzzChange;
|
|
28
|
+
/** index of the tree to apply the edit to. */
|
|
29
|
+
index: number;
|
|
30
|
+
}
|
|
31
|
+
export interface TreeJoin {
|
|
32
|
+
type: 'join';
|
|
33
|
+
summarizeHistory: boolean;
|
|
34
|
+
writeFormat: WriteFormat;
|
|
35
|
+
isObserver: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface TreeLeave {
|
|
38
|
+
type: 'leave';
|
|
39
|
+
isObserver: boolean;
|
|
40
|
+
index: number;
|
|
41
|
+
}
|
|
42
|
+
export interface Synchronize {
|
|
43
|
+
type: 'synchronize';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Operations:
|
|
47
|
+
* - Any valid edit on any shared tree
|
|
48
|
+
* - New SharedTree joins session with some initial params
|
|
49
|
+
* - Existing SharedTree leaves session
|
|
50
|
+
* - Local server synchronizes connected clients
|
|
51
|
+
*
|
|
52
|
+
* Note that these objects should be JSON serializable for ease in debugging fuzz tests.
|
|
53
|
+
* Future potential work:
|
|
54
|
+
* - More fine-grained control of summarization processes
|
|
55
|
+
*/
|
|
56
|
+
export declare type Operation = TreeEdit | TreeJoin | TreeLeave | Synchronize;
|
|
57
|
+
export declare const done: unique symbol;
|
|
58
|
+
/**
|
|
59
|
+
* TAdditionalState can be used to compose generators (see treatment of how fuzzed edit changes pass in
|
|
60
|
+
* the tree to which they apply to sub-generators)
|
|
61
|
+
*/
|
|
62
|
+
export declare type AsyncGenerator<T, TAdditionalState> = (state: FuzzTestState, additionalState: TAdditionalState) => Promise<T | typeof done>;
|
|
63
|
+
export interface FuzzInsert {
|
|
64
|
+
fuzzType: 'insert';
|
|
65
|
+
build: Build;
|
|
66
|
+
insert: Insert;
|
|
67
|
+
}
|
|
68
|
+
export declare type FuzzDelete = Detach & {
|
|
69
|
+
fuzzType: 'delete';
|
|
70
|
+
};
|
|
71
|
+
export interface FuzzMove {
|
|
72
|
+
fuzzType: 'move';
|
|
73
|
+
detach: Detach;
|
|
74
|
+
insert: Insert;
|
|
75
|
+
}
|
|
76
|
+
export declare type FuzzSetPayload = SetValue & {
|
|
77
|
+
fuzzType: 'setPayload';
|
|
78
|
+
};
|
|
79
|
+
export declare type FuzzChange = FuzzInsert | FuzzDelete | FuzzMove | FuzzSetPayload;
|
|
80
|
+
export interface TreeContext {
|
|
81
|
+
view: TreeView;
|
|
82
|
+
idGenerator: NodeIdGenerator;
|
|
83
|
+
idList: NodeId[];
|
|
84
|
+
dataStoreRuntime: IFluidDataStoreRuntime;
|
|
85
|
+
}
|
|
86
|
+
export interface InsertGenerationConfig {
|
|
87
|
+
/** default: 3 */
|
|
88
|
+
maxTreeSequenceSize?: number;
|
|
89
|
+
/** The number of possible definitions. Default: 20. */
|
|
90
|
+
definitionPoolSize?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface EditGenerationConfig {
|
|
93
|
+
/** default: Number.POSITIVE_INFINITY (no max size) */
|
|
94
|
+
maxTreeSize?: number;
|
|
95
|
+
/** default: 3 */
|
|
96
|
+
insertWeight?: number;
|
|
97
|
+
/** default: 1 */
|
|
98
|
+
deleteWeight?: number;
|
|
99
|
+
/** default: 1 */
|
|
100
|
+
moveWeight?: number;
|
|
101
|
+
/** default: 1 */
|
|
102
|
+
setPayloadWeight?: number;
|
|
103
|
+
insertConfig?: InsertGenerationConfig;
|
|
104
|
+
/** The number of possible trait labels. Default: 20. */
|
|
105
|
+
traitLabelPoolSize?: number;
|
|
106
|
+
}
|
|
107
|
+
export interface JoinGenerationConfig {
|
|
108
|
+
/**
|
|
109
|
+
* Valid `summarizeHistory` values. Defaults to [false].
|
|
110
|
+
*/
|
|
111
|
+
summarizeHistory?: boolean[];
|
|
112
|
+
/**
|
|
113
|
+
* Valid `writeFormat` values. Defaults to 0.0.2 and 0.1.1.
|
|
114
|
+
*/
|
|
115
|
+
writeFormat?: WriteFormat[];
|
|
116
|
+
/** default: Number.POSITIVE_INFINITY (no max size) */
|
|
117
|
+
maximumPassiveCollaborators?: number;
|
|
118
|
+
/** default: Number.POSITIVE_INFINITY (no max size) */
|
|
119
|
+
maximumActiveCollaborators?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface OperationGenerationConfig {
|
|
122
|
+
editConfig?: EditGenerationConfig;
|
|
123
|
+
joinConfig?: JoinGenerationConfig;
|
|
124
|
+
/** default: 10 */
|
|
125
|
+
editWeight?: number;
|
|
126
|
+
/** default: 1 */
|
|
127
|
+
joinWeight?: number;
|
|
128
|
+
/** default: 1 */
|
|
129
|
+
leaveWeight?: number;
|
|
130
|
+
/** default: 1 */
|
|
131
|
+
synchronizeWeight?: number;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/test/fuzz/Types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,mBAAmB,EAAE,YAAY,EAAE,CAAC;IACpC,oBAAoB,EAAE,YAAY,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC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 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
//# sourceMappingURL=
|
|
5
|
+
export const done = Symbol('GeneratorDone');
|
|
6
|
+
//# sourceMappingURL=Types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../src/test/fuzz/Types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8DH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TestObjectProvider } from '@fluidframework/test-utils';\nimport type Prando from 'prando';\nimport type { IContainer } from '@fluidframework/container-definitions';\nimport type { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';\nimport type { SharedTree } from '../../SharedTree';\nimport type { WriteFormat } from '../../persisted-types';\nimport type { Build, Detach, Insert, SetValue } from '../../ChangeTypes';\nimport type { TreeView } from '../../TreeView';\nimport type { NodeId } from '../../Identifiers';\nimport type { NodeIdGenerator } from '../../NodeIdUtilities';\n\nexport interface FuzzTestState {\n\trand: Prando;\n\ttestObjectProvider?: TestObjectProvider;\n\tactiveCollaborators: Collaborator[];\n\tpassiveCollaborators: Collaborator[];\n}\n\nexport interface Collaborator {\n\tcontainer: IContainer;\n\ttree: SharedTree;\n}\n\nexport interface TreeEdit {\n\ttype: 'edit';\n\tcontents: FuzzChange;\n\t/** index of the tree to apply the edit to. */\n\tindex: number;\n}\n\nexport interface TreeJoin {\n\ttype: 'join';\n\tsummarizeHistory: boolean;\n\twriteFormat: WriteFormat;\n\tisObserver: boolean;\n}\n\nexport interface TreeLeave {\n\ttype: 'leave';\n\tisObserver: boolean;\n\tindex: number;\n}\n\nexport interface Synchronize {\n\ttype: 'synchronize';\n}\n\n/**\n * Operations:\n * - Any valid edit on any shared tree\n * - New SharedTree joins session with some initial params\n * - Existing SharedTree leaves session\n * - Local server synchronizes connected clients\n *\n * Note that these objects should be JSON serializable for ease in debugging fuzz tests.\n * Future potential work:\n * - More fine-grained control of summarization processes\n */\nexport type Operation = TreeEdit | TreeJoin | TreeLeave | Synchronize;\n\nexport const done = Symbol('GeneratorDone');\n\n/**\n * TAdditionalState can be used to compose generators (see treatment of how fuzzed edit changes pass in\n * the tree to which they apply to sub-generators)\n */\nexport type AsyncGenerator<T, TAdditionalState> = (\n\tstate: FuzzTestState,\n\tadditionalState: TAdditionalState\n) => Promise<T | typeof done>;\n\nexport interface FuzzInsert {\n\tfuzzType: 'insert';\n\tbuild: Build;\n\tinsert: Insert;\n}\n\nexport type FuzzDelete = Detach & { fuzzType: 'delete' };\n\nexport interface FuzzMove {\n\tfuzzType: 'move';\n\tdetach: Detach;\n\tinsert: Insert;\n}\n\nexport type FuzzSetPayload = SetValue & { fuzzType: 'setPayload' };\n\nexport type FuzzChange = FuzzInsert | FuzzDelete | FuzzMove | FuzzSetPayload;\n\nexport interface TreeContext {\n\tview: TreeView;\n\tidGenerator: NodeIdGenerator;\n\tidList: NodeId[];\n\tdataStoreRuntime: IFluidDataStoreRuntime;\n}\n\nexport interface InsertGenerationConfig {\n\t/** default: 3 */\n\tmaxTreeSequenceSize?: number;\n\t/** The number of possible definitions. Default: 20. */\n\tdefinitionPoolSize?: number;\n}\n\nexport interface EditGenerationConfig {\n\t/** default: Number.POSITIVE_INFINITY (no max size) */\n\tmaxTreeSize?: number;\n\t/** default: 3 */\n\tinsertWeight?: number;\n\t/** default: 1 */\n\tdeleteWeight?: number;\n\t/** default: 1 */\n\tmoveWeight?: number;\n\t/** default: 1 */\n\tsetPayloadWeight?: number;\n\tinsertConfig?: InsertGenerationConfig;\n\t/** The number of possible trait labels. Default: 20. */\n\ttraitLabelPoolSize?: number;\n}\n\nexport interface JoinGenerationConfig {\n\t/**\n\t * Valid `summarizeHistory` values. Defaults to [false].\n\t */\n\tsummarizeHistory?: boolean[];\n\t/**\n\t * Valid `writeFormat` values. Defaults to 0.0.2 and 0.1.1.\n\t */\n\twriteFormat?: WriteFormat[];\n\t/** default: Number.POSITIVE_INFINITY (no max size) */\n\tmaximumPassiveCollaborators?: number;\n\t/** default: Number.POSITIVE_INFINITY (no max size) */\n\tmaximumActiveCollaborators?: number;\n}\n\nexport interface OperationGenerationConfig {\n\teditConfig?: EditGenerationConfig;\n\tjoinConfig?: JoinGenerationConfig;\n\t/** default: 10 */\n\teditWeight?: number;\n\t/** default: 1 */\n\tjoinWeight?: number;\n\t/** default: 1 */\n\tleaveWeight?: number;\n\t/** default: 1 */\n\tsynchronizeWeight?: number;\n}\n"]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
6
|
+
import { ClosedMap } from '../../Common';
|
|
7
|
+
import { IdCompressor, IdRangeDescriptor } from '../../id-compressor/IdCompressor';
|
|
8
|
+
import { NumericUuid } from '../../id-compressor/NumericUuid';
|
|
9
|
+
import { SessionId, StableId, SessionSpaceCompressedId } from '../../Identifiers';
|
|
10
|
+
import type { IdCreationRange, SerializedIdCompressorWithOngoingSession, SerializedIdCompressorWithNoSession } from '../../id-compressor';
|
|
11
|
+
/** Identifies a compressor in a network */
|
|
12
|
+
export declare enum Client {
|
|
13
|
+
Client1 = "Client1",
|
|
14
|
+
Client2 = "Client2",
|
|
15
|
+
Client3 = "Client3"
|
|
16
|
+
}
|
|
17
|
+
/** Identifies a compressor with respect to a specific operation */
|
|
18
|
+
export declare enum SemanticClient {
|
|
19
|
+
LocalClient = "LocalClient"
|
|
20
|
+
}
|
|
21
|
+
/** Identifies categories of compressors */
|
|
22
|
+
export declare enum MetaClient {
|
|
23
|
+
All = "All"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Used to attribute actions to clients in a distributed collaboration session.
|
|
27
|
+
* `Local` implies a local and unsequenced operation. All others imply sequenced operations.
|
|
28
|
+
*/
|
|
29
|
+
export declare type OriginatingClient = Client | SemanticClient;
|
|
30
|
+
export declare const OriginatingClient: {
|
|
31
|
+
LocalClient: SemanticClient.LocalClient;
|
|
32
|
+
Client1: Client.Client1;
|
|
33
|
+
Client2: Client.Client2;
|
|
34
|
+
Client3: Client.Client3;
|
|
35
|
+
};
|
|
36
|
+
/** Identifies a compressor to which to send an operation */
|
|
37
|
+
export declare type DestinationClient = Client | MetaClient;
|
|
38
|
+
export declare const DestinationClient: {
|
|
39
|
+
All: MetaClient.All;
|
|
40
|
+
Client1: Client.Client1;
|
|
41
|
+
Client2: Client.Client2;
|
|
42
|
+
Client3: Client.Client3;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new compressor with the supplied cluster capacity.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createCompressor<T>(client: Client, clusterCapacity?: number, attributionInfo?: Serializable<T>): IdCompressor;
|
|
48
|
+
/**
|
|
49
|
+
* A closed map from NamedClient to T.
|
|
50
|
+
*/
|
|
51
|
+
export declare type ClientMap<T> = ClosedMap<Client, T>;
|
|
52
|
+
/**
|
|
53
|
+
* An array of session ID strings corresponding to all non-local `Client` entries.
|
|
54
|
+
*/
|
|
55
|
+
export declare const sessionIds: ClientMap<SessionId>;
|
|
56
|
+
/**
|
|
57
|
+
* An array of session uuids corresponding to all non-local `Client` entries.
|
|
58
|
+
*/
|
|
59
|
+
export declare const sessionNumericUuids: ClientMap<NumericUuid>;
|
|
60
|
+
/** An immutable view of an `IdCompressor` */
|
|
61
|
+
export interface ReadonlyIdCompressor extends Omit<IdCompressor, 'generateCompressedId' | 'generateCompressedIdRange' | 'takeNextCreationRange' | 'finalizeCreationRange'> {
|
|
62
|
+
readonly clusterCapacity: number;
|
|
63
|
+
}
|
|
64
|
+
/** Information about a generated ID in a network to be validated by tests */
|
|
65
|
+
export interface TestIdData {
|
|
66
|
+
readonly id: SessionSpaceCompressedId;
|
|
67
|
+
readonly originatingClient: Client;
|
|
68
|
+
readonly sessionId: SessionId;
|
|
69
|
+
readonly sessionNumericUuid: NumericUuid;
|
|
70
|
+
readonly expectedOverride: string | undefined;
|
|
71
|
+
readonly isSequenced: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Simulates a network of ID compressors.
|
|
75
|
+
* Not suitable for performance testing.
|
|
76
|
+
*/
|
|
77
|
+
export declare class IdCompressorTestNetwork {
|
|
78
|
+
readonly initialClusterSize: number;
|
|
79
|
+
private readonly onIdReceived?;
|
|
80
|
+
/** The compressors used in this network */
|
|
81
|
+
private readonly compressors;
|
|
82
|
+
/** The log of operations seen by the server so far. Append-only. */
|
|
83
|
+
private readonly serverOperations;
|
|
84
|
+
/** An index into `serverOperations` for each client which represents how many operations have been delivered to that client */
|
|
85
|
+
private readonly clientProgress;
|
|
86
|
+
/** All ids (local and sequenced) that a client has created or received, in order. */
|
|
87
|
+
private readonly idLogs;
|
|
88
|
+
/** All ids that a client has received from the server, in order. */
|
|
89
|
+
private readonly sequencedIdLogs;
|
|
90
|
+
constructor(initialClusterSize?: number, onIdReceived?: ((network: IdCompressorTestNetwork, clientTo: Client, ids: TestIdData[]) => void) | undefined);
|
|
91
|
+
/**
|
|
92
|
+
* Returns an immutable handle to a compressor in the network.
|
|
93
|
+
*/
|
|
94
|
+
getCompressor(client: Client): ReadonlyIdCompressor;
|
|
95
|
+
/**
|
|
96
|
+
* Returns a mutable handle to a compressor in the network. Use of mutation methods will break the network invariants and
|
|
97
|
+
* should only be used if the network will not be used again.
|
|
98
|
+
*/
|
|
99
|
+
getCompressorUnsafe(client: Client): IdCompressor;
|
|
100
|
+
/**
|
|
101
|
+
* Returns data for all IDs created and received by this client, including ack's of their own (i.e. their own IDs will appear twice)
|
|
102
|
+
*/
|
|
103
|
+
getIdLog(client: Client): readonly TestIdData[];
|
|
104
|
+
/**
|
|
105
|
+
* Returns data for all IDs received by this client, including ack's of their own (i.e. their own IDs will appear twice)
|
|
106
|
+
*/
|
|
107
|
+
getSequencedIdLog(client: Client): readonly TestIdData[];
|
|
108
|
+
/**
|
|
109
|
+
* Get all compressors for the given destination
|
|
110
|
+
*/
|
|
111
|
+
getTargetCompressors(clientTo: DestinationClient): [Client, IdCompressor][];
|
|
112
|
+
/**
|
|
113
|
+
* Submit a capacity change operation to the network. It will not take effect immediately but will be processed in sequence order.
|
|
114
|
+
*/
|
|
115
|
+
enqueueCapacityChange(newClusterCapacity: number): void;
|
|
116
|
+
private addNewId;
|
|
117
|
+
/**
|
|
118
|
+
* Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.
|
|
119
|
+
* Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.
|
|
120
|
+
*/
|
|
121
|
+
allocateAndSendIds(client: Client, numIds: number): {
|
|
122
|
+
range: IdRangeDescriptor<SessionSpaceCompressedId>;
|
|
123
|
+
sessionId: SessionId;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Allocates a new range of local IDs and enqueues them for future delivery via a `testIdDelivery` action.
|
|
127
|
+
* Calls to this method determine the total order of delivery, regardless of when `deliverOperations` is called.
|
|
128
|
+
*/
|
|
129
|
+
allocateAndSendIds(client: Client, numIds: number, overrides: {
|
|
130
|
+
[index: number]: string;
|
|
131
|
+
}): IdCreationRange;
|
|
132
|
+
/**
|
|
133
|
+
* Delivers all undelivered ID ranges and cluster capacity changes from the server to the target clients.
|
|
134
|
+
*/
|
|
135
|
+
deliverOperations(clientTakingDelivery: DestinationClient): void;
|
|
136
|
+
/**
|
|
137
|
+
* Simulate a client disconnecting (and serializing), then reconnecting (and deserializing)
|
|
138
|
+
*/
|
|
139
|
+
goOfflineThenResume(client: Client): void;
|
|
140
|
+
/**
|
|
141
|
+
* Ensure general validity of the network state. Useful for calling periodically or at the end of test scenarios.
|
|
142
|
+
*/
|
|
143
|
+
assertNetworkState(): void;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Roundtrips the supplied compressor through serialization and deserialization.
|
|
147
|
+
*/
|
|
148
|
+
export declare function roundtrip(compressor: ReadonlyIdCompressor, withSession: true): [SerializedIdCompressorWithOngoingSession, IdCompressor];
|
|
149
|
+
/**
|
|
150
|
+
* Roundtrips the supplied compressor through serialization and deserialization.
|
|
151
|
+
*/
|
|
152
|
+
export declare function roundtrip(compressor: ReadonlyIdCompressor, withSession: false): [SerializedIdCompressorWithNoSession, IdCompressor];
|
|
153
|
+
/**
|
|
154
|
+
* Asserts that the supplied compressor correctly roundtrips through serialization/deserialization.
|
|
155
|
+
*/
|
|
156
|
+
export declare function expectSerializes(compressor: ReadonlyIdCompressor): [SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession];
|
|
157
|
+
/**
|
|
158
|
+
* Merges 'from' into 'to', and returns 'to'.
|
|
159
|
+
*/
|
|
160
|
+
export declare function mergeArrayMaps<K, V>(to: Pick<Map<K, V[]>, 'get' | 'set'>, from: ReadonlyMap<K, V[]>): Pick<Map<K, V[]>, 'get' | 'set'>;
|
|
161
|
+
/**
|
|
162
|
+
* Performs random actions on a test network.
|
|
163
|
+
* @param network the test network to test
|
|
164
|
+
* @param seed the seed for the random generation of the fuzz actions
|
|
165
|
+
* @param includeOverrides whether or not the fuzz actions will generate override UUIDs
|
|
166
|
+
* @param observerClient if provided, this client will never generate local ids
|
|
167
|
+
* @param synchronizeAtEnd if provided, all client will have all operations delivered from the server at the end of the test
|
|
168
|
+
* @param numUsages if provided, the number of operations to perform as part of this test. Defaults to 1000.
|
|
169
|
+
* @param validator if provided, this callback will be invoked periodically during the fuzz test.
|
|
170
|
+
*/
|
|
171
|
+
export declare function performFuzzActions(network: IdCompressorTestNetwork, seed: number, includeOverrides: boolean, observerClient?: Client, synchronizeAtEnd?: boolean, numUsages?: number, maxClusterSize?: number, validator?: (network: IdCompressorTestNetwork) => void): void;
|
|
172
|
+
/**
|
|
173
|
+
* Converts the supplied integer to a uuid.
|
|
174
|
+
*/
|
|
175
|
+
export declare function integerToStableId(num: number | bigint): StableId;
|
|
176
|
+
/**
|
|
177
|
+
* Pads the strings to a length of 32 with zeroes.
|
|
178
|
+
*/
|
|
179
|
+
export declare function padToUuidLength(str: string): string;
|
|
180
|
+
//# sourceMappingURL=IdCompressorTestUtilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdCompressorTestUtilities.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/IdCompressorTestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAA8B,SAAS,EAAqB,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAa,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAIN,WAAW,EAGX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAqB,SAAS,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAErG,OAAO,KAAK,EACX,eAAe,EACf,wCAAwC,EACxC,mCAAmC,EACnC,MAAM,qBAAqB,CAAC;AAE7B,2CAA2C;AAC3C,oBAAY,MAAM;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACnB;AAED,mEAAmE;AACnE,oBAAY,cAAc;IACzB,WAAW,gBAAgB;CAC3B;AAED,2CAA2C;AAC3C,oBAAY,UAAU;IACrB,GAAG,QAAQ;CACX;AAED;;;GAGG;AACH,oBAAY,iBAAiB,GAAG,MAAM,GAAG,cAAc,CAAC;AACxD,eAAO,MAAM,iBAAiB;;;;;CAAmC,CAAC;AAElE,4DAA4D;AAC5D,oBAAY,iBAAiB,GAAG,MAAM,GAAG,UAAU,CAAC;AACpD,eAAO,MAAM,iBAAiB;;;;;CAA+B,CAA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