@fluid-experimental/tree 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0
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/CHANGELOG.md +23 -0
- package/api-report/experimental-tree.api.md +2 -2
- package/dist/ChangeCompression.d.ts +2 -2
- package/dist/ChangeCompression.d.ts.map +1 -1
- package/dist/ChangeCompression.js +1 -1
- package/dist/ChangeCompression.js.map +1 -1
- package/dist/ChangeTypes.d.ts +1 -1
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +4 -4
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +3 -3
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +17 -17
- package/dist/Checkout.js.map +1 -1
- package/dist/EditLog.d.ts +1 -1
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +9 -9
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +3 -3
- package/dist/EditUtilities.d.ts.map +1 -1
- package/dist/EditUtilities.js +6 -6
- package/dist/EditUtilities.js.map +1 -1
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +23 -23
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +1 -1
- package/dist/HistoryEditFactory.d.ts.map +1 -1
- package/dist/HistoryEditFactory.js +7 -7
- package/dist/HistoryEditFactory.js.map +1 -1
- package/dist/IdConversion.d.ts.map +1 -1
- package/dist/IdConversion.js.map +1 -1
- package/dist/LogViewer.d.ts +2 -2
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +7 -7
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js +1 -1
- package/dist/MergeHealth.js.map +1 -1
- package/dist/NodeIdUtilities.d.ts +1 -1
- package/dist/NodeIdUtilities.d.ts.map +1 -1
- package/dist/NodeIdUtilities.js +1 -1
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.d.ts.map +1 -1
- package/dist/PayloadUtilities.js +2 -2
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/ReconciliationPath.d.ts +1 -1
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -2
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +2 -2
- package/dist/RevisionView.d.ts.map +1 -1
- package/dist/RevisionView.js.map +1 -1
- package/dist/SerializationUtilities.d.ts +1 -1
- package/dist/SerializationUtilities.d.ts.map +1 -1
- package/dist/SerializationUtilities.js.map +1 -1
- package/dist/SharedTree.d.ts +8 -7
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +78 -78
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +31 -31
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/Summary.d.ts +2 -2
- package/dist/Summary.d.ts.map +1 -1
- package/dist/Summary.js +2 -2
- package/dist/Summary.js.map +1 -1
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +1 -1
- package/dist/SummaryTestUtilities.d.ts.map +1 -1
- package/dist/SummaryTestUtilities.js.map +1 -1
- package/dist/Transaction.d.ts +3 -3
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +3 -3
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.d.ts +3 -3
- package/dist/TransactionInternal.d.ts.map +1 -1
- package/dist/TransactionInternal.js +6 -6
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeCompressor.d.ts +5 -1
- package/dist/TreeCompressor.d.ts.map +1 -1
- package/dist/TreeCompressor.js +5 -5
- package/dist/TreeCompressor.js.map +1 -1
- package/dist/TreeNodeHandle.d.ts +1 -1
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +1 -1
- package/dist/TreeView.d.ts.map +1 -1
- package/dist/TreeView.js +2 -3
- package/dist/TreeView.js.map +1 -1
- package/dist/UuidUtilities.d.ts.map +1 -1
- package/dist/UuidUtilities.js.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.js +3 -3
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +1 -1
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +25 -26
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/IdRange.d.ts.map +1 -1
- package/dist/id-compressor/IdRange.js +2 -2
- package/dist/id-compressor/IdRange.js.map +1 -1
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
- package/dist/id-compressor/NumericUuid.js +2 -1
- package/dist/id-compressor/NumericUuid.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js +8 -9
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js +11 -11
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +8 -4
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +13 -13
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +2 -2
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js +2 -2
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/packageVersion.d.ts +0 -2
- package/dist/migration-shim/packageVersion.d.ts.map +1 -1
- package/dist/migration-shim/packageVersion.js +0 -2
- package/dist/migration-shim/packageVersion.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js +8 -8
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +2 -2
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js +8 -4
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js +2 -2
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/dist/migration-shim/shimChannelServices.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js +2 -2
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/shimHandle.d.ts.map +1 -1
- package/dist/migration-shim/shimHandle.js.map +1 -1
- package/dist/migration-shim/types.d.ts +1 -1
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/migration-shim/utils.d.ts +1 -1
- package/dist/migration-shim/utils.d.ts.map +1 -1
- package/dist/migration-shim/utils.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +1 -1
- package/dist/persisted-types/0.0.2.d.ts.map +1 -1
- package/dist/persisted-types/0.0.2.js.map +1 -1
- package/dist/persisted-types/0.1.1.d.ts +1 -1
- package/dist/persisted-types/0.1.1.d.ts.map +1 -1
- package/dist/persisted-types/0.1.1.js +3 -3
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/lib/ChangeCompression.d.ts +2 -2
- package/lib/ChangeCompression.d.ts.map +1 -1
- package/lib/ChangeCompression.js +1 -1
- package/lib/ChangeCompression.js.map +1 -1
- package/lib/ChangeTypes.d.ts +1 -1
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/ChangeTypes.js +2 -2
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +3 -3
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +4 -4
- package/lib/Checkout.js.map +1 -1
- package/lib/EditLog.d.ts +1 -1
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +2 -2
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +3 -3
- package/lib/EditUtilities.d.ts.map +1 -1
- package/lib/EditUtilities.js +5 -5
- package/lib/EditUtilities.js.map +1 -1
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +2 -2
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +1 -1
- package/lib/HistoryEditFactory.d.ts.map +1 -1
- package/lib/HistoryEditFactory.js +5 -5
- package/lib/HistoryEditFactory.js.map +1 -1
- package/lib/IdConversion.d.ts.map +1 -1
- package/lib/IdConversion.js.map +1 -1
- package/lib/LogViewer.d.ts +2 -2
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +3 -3
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/NodeIdUtilities.d.ts +1 -1
- package/lib/NodeIdUtilities.d.ts.map +1 -1
- package/lib/NodeIdUtilities.js +1 -1
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/PayloadUtilities.d.ts.map +1 -1
- package/lib/PayloadUtilities.js +1 -1
- package/lib/PayloadUtilities.js.map +1 -1
- package/lib/ReconciliationPath.d.ts +1 -1
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -2
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +2 -2
- package/lib/RevisionView.d.ts.map +1 -1
- package/lib/RevisionView.js.map +1 -1
- package/lib/SerializationUtilities.d.ts +1 -1
- package/lib/SerializationUtilities.d.ts.map +1 -1
- package/lib/SerializationUtilities.js.map +1 -1
- package/lib/SharedTree.d.ts +8 -7
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +13 -13
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +5 -5
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/Summary.d.ts +2 -2
- package/lib/Summary.d.ts.map +1 -1
- package/lib/Summary.js +1 -1
- package/lib/Summary.js.map +1 -1
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +1 -1
- package/lib/SummaryTestUtilities.d.ts.map +1 -1
- package/lib/SummaryTestUtilities.js.map +1 -1
- package/lib/Transaction.d.ts +3 -3
- package/lib/Transaction.d.ts.map +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/Transaction.js.map +1 -1
- package/lib/TransactionInternal.d.ts +3 -3
- package/lib/TransactionInternal.d.ts.map +1 -1
- package/lib/TransactionInternal.js +3 -3
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/TreeCompressor.d.ts +5 -1
- package/lib/TreeCompressor.d.ts.map +1 -1
- package/lib/TreeCompressor.js +2 -2
- package/lib/TreeCompressor.js.map +1 -1
- package/lib/TreeNodeHandle.d.ts +1 -1
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +1 -1
- package/lib/TreeView.d.ts.map +1 -1
- package/lib/TreeView.js +1 -2
- package/lib/TreeView.js.map +1 -1
- package/lib/UuidUtilities.d.ts.map +1 -1
- package/lib/UuidUtilities.js +1 -1
- package/lib/UuidUtilities.js.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +1 -1
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +4 -5
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/IdRange.d.ts.map +1 -1
- package/lib/id-compressor/IdRange.js +1 -1
- package/lib/id-compressor/IdRange.js.map +1 -1
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
- package/lib/id-compressor/NumericUuid.js +2 -1
- package/lib/id-compressor/NumericUuid.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js +1 -2
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +8 -4
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +3 -3
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +2 -2
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/packageVersion.d.ts +0 -2
- package/lib/migration-shim/packageVersion.d.ts.map +1 -1
- package/lib/migration-shim/packageVersion.js +0 -2
- package/lib/migration-shim/packageVersion.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +2 -2
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js +6 -2
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/lib/migration-shim/shimChannelServices.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js +1 -1
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/shimHandle.d.ts.map +1 -1
- package/lib/migration-shim/shimHandle.js.map +1 -1
- package/lib/migration-shim/types.d.ts +1 -1
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/migration-shim/utils.d.ts +1 -1
- package/lib/migration-shim/utils.d.ts.map +1 -1
- package/lib/migration-shim/utils.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +1 -1
- package/lib/persisted-types/0.0.2.d.ts.map +1 -1
- package/lib/persisted-types/0.0.2.js.map +1 -1
- package/lib/persisted-types/0.1.1.d.ts +1 -1
- package/lib/persisted-types/0.1.1.d.ts.map +1 -1
- package/lib/persisted-types/0.1.1.js +1 -1
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/package.json +33 -32
- package/src/ChangeCompression.ts +8 -8
- package/src/ChangeTypes.ts +5 -4
- package/src/Checkout.ts +9 -7
- package/src/EditLog.ts +4 -3
- package/src/EditUtilities.ts +9 -8
- package/src/Forest.ts +3 -2
- package/src/HistoryEditFactory.ts +12 -11
- package/src/IdConversion.ts +2 -2
- package/src/LogViewer.ts +5 -4
- package/src/MergeHealth.ts +2 -1
- package/src/NodeIdUtilities.ts +2 -2
- package/src/PayloadUtilities.ts +2 -1
- package/src/ReconciliationPath.ts +1 -1
- package/src/RevisionValueCache.ts +3 -2
- package/src/RevisionView.ts +3 -3
- package/src/SerializationUtilities.ts +1 -1
- package/src/SharedTree.ts +46 -49
- package/src/SharedTreeEncoder.ts +30 -29
- package/src/Summary.ts +5 -3
- package/src/SummaryBackCompatibility.ts +1 -0
- package/src/SummaryTestUtilities.ts +2 -1
- package/src/Transaction.ts +7 -6
- package/src/TransactionInternal.ts +17 -16
- package/src/TreeCompressor.ts +6 -4
- package/src/TreeNodeHandle.ts +2 -2
- package/src/TreeView.ts +3 -3
- package/src/UuidUtilities.ts +2 -1
- package/src/id-compressor/AppendOnlySortedMap.ts +2 -1
- package/src/id-compressor/IdCompressor.ts +18 -17
- package/src/id-compressor/IdRange.ts +2 -1
- package/src/id-compressor/NumericUuid.ts +1 -1
- package/src/id-compressor/SessionIdNormalizer.ts +3 -3
- package/src/migration-shim/migrationDeltaHandler.ts +3 -2
- package/src/migration-shim/migrationShim.ts +14 -10
- package/src/migration-shim/migrationShimFactory.ts +6 -4
- package/src/migration-shim/packageVersion.ts +0 -2
- package/src/migration-shim/sharedTreeDeltaHandler.ts +3 -2
- package/src/migration-shim/sharedTreeShim.ts +7 -5
- package/src/migration-shim/sharedTreeShimFactory.ts +3 -3
- package/src/migration-shim/shimChannelServices.ts +1 -1
- package/src/migration-shim/shimDeltaConnection.ts +3 -2
- package/src/migration-shim/shimHandle.ts +1 -0
- package/src/migration-shim/types.ts +3 -1
- package/src/migration-shim/utils.ts +2 -1
- package/src/persisted-types/0.0.2.ts +2 -2
- package/src/persisted-types/0.1.1.ts +10 -8
- package/dist/tree-alpha.d.ts +0 -2901
- package/dist/tree-beta.d.ts +0 -348
- package/dist/tree-public.d.ts +0 -348
- package/dist/tree-untrimmed.d.ts +0 -3820
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.perf.tests.js +0 -49
- package/lib/test/AppendOnlySortedMap.perf.tests.js.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.js +0 -213
- package/lib/test/AppendOnlySortedMap.tests.js.map +0 -1
- package/lib/test/ChangeCompression.tests.d.ts +0 -6
- package/lib/test/ChangeCompression.tests.d.ts.map +0 -1
- package/lib/test/ChangeCompression.tests.js +0 -154
- package/lib/test/ChangeCompression.tests.js.map +0 -1
- package/lib/test/Checkout.tests.d.ts +0 -10
- package/lib/test/Checkout.tests.d.ts.map +0 -1
- package/lib/test/Checkout.tests.js +0 -460
- package/lib/test/Checkout.tests.js.map +0 -1
- package/lib/test/Common.tests.d.ts +0 -6
- package/lib/test/Common.tests.d.ts.map +0 -1
- package/lib/test/Common.tests.js +0 -102
- package/lib/test/Common.tests.js.map +0 -1
- package/lib/test/EagerCheckout.tests.d.ts +0 -6
- package/lib/test/EagerCheckout.tests.d.ts.map +0 -1
- package/lib/test/EagerCheckout.tests.js +0 -20
- package/lib/test/EagerCheckout.tests.js.map +0 -1
- package/lib/test/Edit.tests.d.ts +0 -6
- package/lib/test/Edit.tests.d.ts.map +0 -1
- package/lib/test/Edit.tests.js +0 -60
- package/lib/test/Edit.tests.js.map +0 -1
- package/lib/test/EditLog.perf.tests.d.ts +0 -6
- package/lib/test/EditLog.perf.tests.d.ts.map +0 -1
- package/lib/test/EditLog.perf.tests.js +0 -41
- package/lib/test/EditLog.perf.tests.js.map +0 -1
- package/lib/test/EditLog.tests.d.ts +0 -6
- package/lib/test/EditLog.tests.d.ts.map +0 -1
- package/lib/test/EditLog.tests.js +0 -355
- package/lib/test/EditLog.tests.js.map +0 -1
- package/lib/test/EditUtilities.tests.d.ts +0 -6
- package/lib/test/EditUtilities.tests.d.ts.map +0 -1
- package/lib/test/EditUtilities.tests.js +0 -512
- package/lib/test/EditUtilities.tests.js.map +0 -1
- package/lib/test/Forest.perf.tests.d.ts +0 -6
- package/lib/test/Forest.perf.tests.d.ts.map +0 -1
- package/lib/test/Forest.perf.tests.js +0 -135
- package/lib/test/Forest.perf.tests.js.map +0 -1
- package/lib/test/Forest.tests.d.ts +0 -6
- package/lib/test/Forest.tests.d.ts.map +0 -1
- package/lib/test/Forest.tests.js +0 -213
- package/lib/test/Forest.tests.js.map +0 -1
- package/lib/test/GenericTransaction.tests.d.ts +0 -6
- package/lib/test/GenericTransaction.tests.d.ts.map +0 -1
- package/lib/test/GenericTransaction.tests.js +0 -31
- package/lib/test/GenericTransaction.tests.js.map +0 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +0 -6
- package/lib/test/HistoryEditFactory.tests.d.ts.map +0 -1
- package/lib/test/HistoryEditFactory.tests.js +0 -170
- package/lib/test/HistoryEditFactory.tests.js.map +0 -1
- package/lib/test/IdCompressor.perf.tests.d.ts +0 -6
- package/lib/test/IdCompressor.perf.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.perf.tests.js +0 -290
- package/lib/test/IdCompressor.perf.tests.js.map +0 -1
- package/lib/test/IdCompressor.tests.d.ts +0 -6
- package/lib/test/IdCompressor.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.tests.js +0 -1542
- package/lib/test/IdCompressor.tests.js.map +0 -1
- package/lib/test/IdConversion.tests.d.ts +0 -6
- package/lib/test/IdConversion.tests.d.ts.map +0 -1
- package/lib/test/IdConversion.tests.js +0 -36
- package/lib/test/IdConversion.tests.js.map +0 -1
- package/lib/test/LazyCheckout.tests.d.ts +0 -6
- package/lib/test/LazyCheckout.tests.d.ts.map +0 -1
- package/lib/test/LazyCheckout.tests.js +0 -22
- package/lib/test/LazyCheckout.tests.js.map +0 -1
- package/lib/test/LogViewer.tests.d.ts +0 -6
- package/lib/test/LogViewer.tests.d.ts.map +0 -1
- package/lib/test/LogViewer.tests.js +0 -588
- package/lib/test/LogViewer.tests.js.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts +0 -6
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +0 -351
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +0 -1
- package/lib/test/NumericUuid.perf.tests.d.ts +0 -6
- package/lib/test/NumericUuid.perf.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.perf.tests.js +0 -68
- package/lib/test/NumericUuid.perf.tests.js.map +0 -1
- package/lib/test/NumericUuid.tests.d.ts +0 -6
- package/lib/test/NumericUuid.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.tests.js +0 -192
- package/lib/test/NumericUuid.tests.js.map +0 -1
- package/lib/test/RevisionValueCache.tests.d.ts +0 -6
- package/lib/test/RevisionValueCache.tests.d.ts.map +0 -1
- package/lib/test/RevisionValueCache.tests.js +0 -106
- package/lib/test/RevisionValueCache.tests.js.map +0 -1
- package/lib/test/RevisionView.tests.d.ts +0 -6
- package/lib/test/RevisionView.tests.d.ts.map +0 -1
- package/lib/test/RevisionView.tests.js +0 -131
- package/lib/test/RevisionView.tests.js.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.d.ts +0 -6
- package/lib/test/SessionIdNormalizer.tests.d.ts.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.js +0 -377
- package/lib/test/SessionIdNormalizer.tests.js.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.d.ts +0 -6
- package/lib/test/SharedTree.fuzz.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.js +0 -9
- package/lib/test/SharedTree.fuzz.tests.js.map +0 -1
- package/lib/test/SharedTree.perf.tests.d.ts +0 -6
- package/lib/test/SharedTree.perf.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.perf.tests.js +0 -39
- package/lib/test/SharedTree.perf.tests.js.map +0 -1
- package/lib/test/SharedTree.tests.d.ts +0 -6
- package/lib/test/SharedTree.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.tests.js +0 -22
- package/lib/test/SharedTree.tests.js.map +0 -1
- package/lib/test/StringInterner.tests.d.ts +0 -6
- package/lib/test/StringInterner.tests.d.ts.map +0 -1
- package/lib/test/StringInterner.tests.js +0 -73
- package/lib/test/StringInterner.tests.js.map +0 -1
- package/lib/test/Summary.tests.d.ts +0 -7
- package/lib/test/Summary.tests.d.ts.map +0 -1
- package/lib/test/Summary.tests.js +0 -386
- package/lib/test/Summary.tests.js.map +0 -1
- package/lib/test/Transaction.tests.d.ts +0 -6
- package/lib/test/Transaction.tests.d.ts.map +0 -1
- package/lib/test/Transaction.tests.js +0 -124
- package/lib/test/Transaction.tests.js.map +0 -1
- package/lib/test/TransactionInternal.tests.d.ts +0 -6
- package/lib/test/TransactionInternal.tests.d.ts.map +0 -1
- package/lib/test/TransactionInternal.tests.js +0 -576
- package/lib/test/TransactionInternal.tests.js.map +0 -1
- package/lib/test/TreeCompression.tests.d.ts +0 -6
- package/lib/test/TreeCompression.tests.d.ts.map +0 -1
- package/lib/test/TreeCompression.tests.js +0 -291
- package/lib/test/TreeCompression.tests.js.map +0 -1
- package/lib/test/TreeView.tests.d.ts +0 -6
- package/lib/test/TreeView.tests.d.ts.map +0 -1
- package/lib/test/TreeView.tests.js +0 -178
- package/lib/test/TreeView.tests.js.map +0 -1
- package/lib/test/UndoRedoHandler.tests.d.ts +0 -6
- package/lib/test/UndoRedoHandler.tests.d.ts.map +0 -1
- package/lib/test/UndoRedoHandler.tests.js +0 -37
- package/lib/test/UndoRedoHandler.tests.js.map +0 -1
- package/lib/test/fuzz/Generators.d.ts +0 -8
- package/lib/test/fuzz/Generators.d.ts.map +0 -1
- package/lib/test/fuzz/Generators.js +0 -345
- package/lib/test/fuzz/Generators.js.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +0 -23
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +0 -241
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +0 -1
- package/lib/test/fuzz/Types.d.ts +0 -136
- package/lib/test/fuzz/Types.d.ts.map +0 -1
- package/lib/test/fuzz/Types.js +0 -6
- package/lib/test/fuzz/Types.js.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +0 -246
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +0 -608
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +0 -1
- package/lib/test/utilities/MockTransaction.d.ts +0 -35
- package/lib/test/utilities/MockTransaction.d.ts.map +0 -1
- package/lib/test/utilities/MockTransaction.js +0 -51
- package/lib/test/utilities/MockTransaction.js.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +0 -12
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.js +0 -223
- package/lib/test/utilities/PendingLocalStateTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeTests.d.ts +0 -12
- package/lib/test/utilities/SharedTreeTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeTests.js +0 -949
- package/lib/test/utilities/SharedTreeTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +0 -11
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +0 -439
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +0 -10
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.js +0 -105
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +0 -1
- package/lib/test/utilities/SummarySizeTests.d.ts +0 -11
- package/lib/test/utilities/SummarySizeTests.d.ts.map +0 -1
- package/lib/test/utilities/SummarySizeTests.js +0 -160
- package/lib/test/utilities/SummarySizeTests.js.map +0 -1
- package/lib/test/utilities/TestCommon.d.ts +0 -13
- package/lib/test/utilities/TestCommon.d.ts.map +0 -1
- package/lib/test/utilities/TestCommon.js +0 -19
- package/lib/test/utilities/TestCommon.js.map +0 -1
- package/lib/test/utilities/TestNode.d.ts +0 -140
- package/lib/test/utilities/TestNode.d.ts.map +0 -1
- package/lib/test/utilities/TestNode.js +0 -282
- package/lib/test/utilities/TestNode.js.map +0 -1
- package/lib/test/utilities/TestSerializer.d.ts +0 -24
- package/lib/test/utilities/TestSerializer.d.ts.map +0 -1
- package/lib/test/utilities/TestSerializer.js +0 -40
- package/lib/test/utilities/TestSerializer.js.map +0 -1
- package/lib/test/utilities/TestUtilities.d.ts +0 -212
- package/lib/test/utilities/TestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/TestUtilities.js +0 -413
- package/lib/test/utilities/TestUtilities.js.map +0 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +0 -32
- package/lib/test/utilities/UndoRedoTests.d.ts.map +0 -1
- package/lib/test/utilities/UndoRedoTests.js +0 -317
- package/lib/test/utilities/UndoRedoTests.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { resolve } from 'path';
|
|
6
|
-
import { assert } from '@fluidframework/core-utils';
|
|
7
|
-
import { v5 as uuidv5 } from 'uuid';
|
|
8
|
-
import { expect } from 'chai';
|
|
9
|
-
import { LocalServerTestDriver } from '@fluid-private/test-drivers';
|
|
10
|
-
import { SummaryCollection, DefaultSummaryConfiguration } from '@fluidframework/container-runtime';
|
|
11
|
-
import { Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';
|
|
12
|
-
import { MockContainerRuntimeFactory, MockFluidDataStoreRuntime, MockStorage, } from '@fluidframework/test-runtime-utils';
|
|
13
|
-
import { TestObjectProvider, TestContainerRuntimeFactory, TestFluidObjectFactory, createAndAttachContainer, } from '@fluidframework/test-utils';
|
|
14
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
15
|
-
import { createChildLogger } from '@fluidframework/telemetry-utils';
|
|
16
|
-
import { fail, identity } from '../../Common.js';
|
|
17
|
-
import { IdCompressor } from '../../id-compressor/index.js';
|
|
18
|
-
import { createSessionId } from '../../id-compressor/NumericUuid.js';
|
|
19
|
-
import { getChangeNodeFromViewNode } from '../../SerializationUtilities.js';
|
|
20
|
-
import { initialTree } from '../../InitialTree.js';
|
|
21
|
-
import { ChangeInternal, reservedIdCount, WriteFormat, } from '../../persisted-types/index.js';
|
|
22
|
-
import { SharedTreeDiagnosticEvent } from '../../EventTypes.js';
|
|
23
|
-
import { getNodeId, getNodeIdContext, } from '../../NodeIdUtilities.js';
|
|
24
|
-
import { newEdit, setTrait } from '../../EditUtilities.js';
|
|
25
|
-
import { SharedTree } from '../../SharedTree.js';
|
|
26
|
-
import { StablePlace } from '../../ChangeTypes.js';
|
|
27
|
-
import { convertEditIds } from '../../IdConversion.js';
|
|
28
|
-
import { buildLeaf, RefreshingTestTree, SimpleTestTree } from './TestNode.js';
|
|
29
|
-
export const testTraitLabel = SimpleTestTree.traitLabel;
|
|
30
|
-
export function testTrait(view) {
|
|
31
|
-
return {
|
|
32
|
-
label: testTraitLabel,
|
|
33
|
-
parent: view.root,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
/** Sets up and returns an object of components useful for testing SharedTree. */
|
|
37
|
-
export function setUpTestSharedTree(options = { localMode: true }) {
|
|
38
|
-
const { id, initialTree, localMode, containerRuntimeFactory, setupEditId, summarizeHistory, writeFormat, attributionId, } = options;
|
|
39
|
-
const attachState = localMode === true ? AttachState.Detached : undefined;
|
|
40
|
-
let componentRuntime;
|
|
41
|
-
if (options.logger) {
|
|
42
|
-
const proxyHandler = {
|
|
43
|
-
get: (target, prop, receiver) => {
|
|
44
|
-
if (prop === 'logger' && options.logger) {
|
|
45
|
-
return options.logger;
|
|
46
|
-
}
|
|
47
|
-
return target[prop];
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
componentRuntime = new Proxy(new MockFluidDataStoreRuntime({ attachState }), proxyHandler);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
componentRuntime = new MockFluidDataStoreRuntime({ attachState });
|
|
54
|
-
}
|
|
55
|
-
// Enable expensiveValidation
|
|
56
|
-
let factory;
|
|
57
|
-
if (writeFormat === WriteFormat.v0_0_2) {
|
|
58
|
-
const options = { summarizeHistory: summarizeHistory ?? true };
|
|
59
|
-
factory = SharedTree.getFactory(writeFormat, options);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const options = {
|
|
63
|
-
summarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: true } : false,
|
|
64
|
-
attributionId,
|
|
65
|
-
};
|
|
66
|
-
factory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);
|
|
67
|
-
}
|
|
68
|
-
const tree = factory.create(componentRuntime, id ?? 'testSharedTree');
|
|
69
|
-
if (options.allowInvalid === undefined || !options.allowInvalid) {
|
|
70
|
-
tree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));
|
|
71
|
-
}
|
|
72
|
-
if (options.allowMalformed === undefined || !options.allowMalformed) {
|
|
73
|
-
tree.on(SharedTreeDiagnosticEvent.DroppedMalformedEdit, () => fail('unexpected malformed edit'));
|
|
74
|
-
}
|
|
75
|
-
if (options.noFailOnError === undefined || !options.noFailOnError) {
|
|
76
|
-
// any errors thrown by a SharedObject event listener will be caught and
|
|
77
|
-
// reemitted on this event. For testing purposes, rethrow so that it
|
|
78
|
-
// actually causes the test to fail.
|
|
79
|
-
tree.on('error', (error) => {
|
|
80
|
-
throw error;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const newContainerRuntimeFactory = containerRuntimeFactory ?? new MockContainerRuntimeFactory();
|
|
84
|
-
if (localMode !== true) {
|
|
85
|
-
const containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);
|
|
86
|
-
const services = {
|
|
87
|
-
deltaConnection: componentRuntime.createDeltaConnection(),
|
|
88
|
-
objectStorage: new MockStorage(undefined),
|
|
89
|
-
};
|
|
90
|
-
tree.connect(services);
|
|
91
|
-
}
|
|
92
|
-
if (initialTree !== undefined) {
|
|
93
|
-
setTestTree(tree, initialTree, setupEditId);
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
componentRuntime,
|
|
97
|
-
containerRuntimeFactory: newContainerRuntimeFactory,
|
|
98
|
-
tree,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
const TestDataStoreType = '@fluid-example/test-dataStore';
|
|
102
|
-
const testObjectProviders = [];
|
|
103
|
-
afterEach(() => {
|
|
104
|
-
for (const provider of testObjectProviders) {
|
|
105
|
-
provider.reset();
|
|
106
|
-
}
|
|
107
|
-
testObjectProviders.length = 0;
|
|
108
|
-
});
|
|
109
|
-
/**
|
|
110
|
-
* Sets up and returns an object of components useful for testing SharedTree with a local server.
|
|
111
|
-
* Required for tests that involve the uploadBlob API.
|
|
112
|
-
*
|
|
113
|
-
* Any TestObjectProvider created by this function will be reset after the test completes (via afterEach) hook.
|
|
114
|
-
*/
|
|
115
|
-
export async function setUpLocalServerTestSharedTree(options) {
|
|
116
|
-
const { blobs, headers, id, initialTree, testObjectProvider, setupEditId, summarizeHistory, writeFormat, uploadEditChunks, attributionId, pendingLocalState, } = options;
|
|
117
|
-
const featureGates = options.featureGates ?? {};
|
|
118
|
-
featureGates['Fluid.Container.enableOfflineLoad'] = true;
|
|
119
|
-
featureGates['Fluid.ContainerRuntime.DisablePartialFlush'] = true;
|
|
120
|
-
const treeId = id ?? 'test';
|
|
121
|
-
let factory;
|
|
122
|
-
if (writeFormat === WriteFormat.v0_0_2) {
|
|
123
|
-
const options = { summarizeHistory: summarizeHistory ?? true };
|
|
124
|
-
factory = SharedTree.getFactory(writeFormat, options);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
const options = {
|
|
128
|
-
summarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: uploadEditChunks ?? true } : false,
|
|
129
|
-
attributionId,
|
|
130
|
-
};
|
|
131
|
-
factory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);
|
|
132
|
-
}
|
|
133
|
-
const registry = [[treeId, factory]];
|
|
134
|
-
const runtimeFactory = () => new TestContainerRuntimeFactory(TestDataStoreType, new TestFluidObjectFactory(registry), {
|
|
135
|
-
summaryOptions: {
|
|
136
|
-
summaryConfigOverrides: {
|
|
137
|
-
...DefaultSummaryConfiguration,
|
|
138
|
-
...{
|
|
139
|
-
minIdleTime: 1000,
|
|
140
|
-
maxIdleTime: 1000,
|
|
141
|
-
maxTime: 1000 * 12,
|
|
142
|
-
initialSummarizerDelayMs: 0,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
const defaultCodeDetails = {
|
|
148
|
-
package: 'defaultTestPackage',
|
|
149
|
-
config: {},
|
|
150
|
-
};
|
|
151
|
-
function makeTestLoader(provider) {
|
|
152
|
-
const fluidEntryPoint = runtimeFactory();
|
|
153
|
-
const configProvider = (settings) => ({
|
|
154
|
-
getRawConfig: (name) => settings[name],
|
|
155
|
-
});
|
|
156
|
-
return provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {
|
|
157
|
-
options: { maxClientLeaveWaitTime: 1000 },
|
|
158
|
-
configProvider: configProvider(featureGates),
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
let provider;
|
|
162
|
-
let container;
|
|
163
|
-
if (testObjectProvider !== undefined) {
|
|
164
|
-
provider = testObjectProvider;
|
|
165
|
-
const driver = new LocalServerTestDriver();
|
|
166
|
-
const loader = makeTestLoader(provider);
|
|
167
|
-
// Once ILoaderOptions is specificable, this should use `provider.loadTestContainer` instead.
|
|
168
|
-
container = await loader.resolve({ url: await driver.createContainerUrl(treeId), headers }, pendingLocalState);
|
|
169
|
-
await waitContainerToCatchUp(container);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
const driver = new LocalServerTestDriver();
|
|
173
|
-
provider = new TestObjectProvider(Loader, driver, runtimeFactory);
|
|
174
|
-
testObjectProviders.push(provider);
|
|
175
|
-
// Once ILoaderOptions is specificable, this should use `provider.makeTestContainer` instead.
|
|
176
|
-
const loader = makeTestLoader(provider);
|
|
177
|
-
container = await createAndAttachContainer(defaultCodeDetails, loader, driver.createCreateNewRequest(treeId));
|
|
178
|
-
}
|
|
179
|
-
const dataObject = (await container.getEntryPoint());
|
|
180
|
-
const uploadedBlobs = blobs === undefined ? [] : await Promise.all(blobs.map(async (blob) => dataObject.context.uploadBlob(blob)));
|
|
181
|
-
const tree = await dataObject.getSharedObject(treeId);
|
|
182
|
-
if (initialTree !== undefined && testObjectProvider === undefined) {
|
|
183
|
-
setTestTree(tree, initialTree, setupEditId);
|
|
184
|
-
}
|
|
185
|
-
return { container, tree, testObjectProvider: provider, uploadedBlobs };
|
|
186
|
-
}
|
|
187
|
-
/** Sets testTrait to contain `node`. */
|
|
188
|
-
function setTestTree(tree, node, overrideId) {
|
|
189
|
-
const trait = testTrait(tree.currentView);
|
|
190
|
-
if (overrideId === undefined) {
|
|
191
|
-
return tree.applyEdit(...setTrait(trait, node)).id;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
const changes = setTrait(trait, node).map((c) => tree.internalizeChange(c));
|
|
195
|
-
return tree.applyEditInternal({ changes, id: overrideId }).id;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Creates a list of edits with stable IDs that can be processed by a SharedTree.
|
|
200
|
-
* @returns the list of created edits
|
|
201
|
-
*/
|
|
202
|
-
export function createStableEdits(numberOfEdits, idContext = makeNodeIdContext(), payload = identity) {
|
|
203
|
-
if (numberOfEdits === 0) {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
const uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';
|
|
207
|
-
const nodeId = idContext.generateNodeId('ae6b24eb-6fa8-42cc-abd2-48f250b7798f');
|
|
208
|
-
const node = buildLeaf(nodeId);
|
|
209
|
-
const insertEmptyNode = newEdit([
|
|
210
|
-
ChangeInternal.build([node], 0),
|
|
211
|
-
ChangeInternal.insert(0, StablePlace.atEndOf({ label: testTraitLabel, parent: idContext.convertToNodeId(initialTree.identifier) })),
|
|
212
|
-
]);
|
|
213
|
-
const edits = [{ ...insertEmptyNode, id: uuidv5('test', uuidNamespace) }];
|
|
214
|
-
// Every subsequent edit is a set payload
|
|
215
|
-
for (let i = 1; i < numberOfEdits; i++) {
|
|
216
|
-
const edit = newEdit([ChangeInternal.setPayload(nodeId, payload(i))]);
|
|
217
|
-
edits.push({ ...edit, id: uuidv5(i.toString(), uuidNamespace) });
|
|
218
|
-
}
|
|
219
|
-
return edits;
|
|
220
|
-
}
|
|
221
|
-
/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */
|
|
222
|
-
export function assertNoDelta(tree, editor) {
|
|
223
|
-
const viewA = tree.currentView;
|
|
224
|
-
editor();
|
|
225
|
-
const viewB = tree.currentView;
|
|
226
|
-
const delta = viewA.delta(viewB);
|
|
227
|
-
expect(delta).deep.equals({
|
|
228
|
-
changed: [],
|
|
229
|
-
added: [],
|
|
230
|
-
removed: [],
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Used to test error throwing in async functions.
|
|
235
|
-
*/
|
|
236
|
-
export async function asyncFunctionThrowsCorrectly(asyncFunction, expectedError) {
|
|
237
|
-
let errorMessage;
|
|
238
|
-
try {
|
|
239
|
-
await asyncFunction();
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
errorMessage = error.message;
|
|
243
|
-
}
|
|
244
|
-
return errorMessage === expectedError;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Returns true if two nodes have equivalent data, otherwise false.
|
|
248
|
-
* Does not compare children or payloads.
|
|
249
|
-
* @param nodes - two or more nodes to compare
|
|
250
|
-
*/
|
|
251
|
-
export function areNodesEquivalent(...nodes) {
|
|
252
|
-
if (nodes.length < 2) {
|
|
253
|
-
fail('Too few nodes to compare');
|
|
254
|
-
}
|
|
255
|
-
for (let i = 1; i < nodes.length; i++) {
|
|
256
|
-
if (nodes[i].definition !== nodes[0].definition) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
if (nodes[i].identifier !== nodes[0].identifier) {
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
// This accounts for this file being executed after compilation. If many tests want to leverage resources, we should unify
|
|
266
|
-
// resource path logic to a single place.
|
|
267
|
-
export const testDocumentsPathBase = resolve(__dirname, '../../../src/test/documents/');
|
|
268
|
-
export const versionComparator = (versionA, versionB) => {
|
|
269
|
-
const versionASplit = versionA.split('.');
|
|
270
|
-
const versionBSplit = versionB.split('.');
|
|
271
|
-
assert(versionASplit.length === versionBSplit.length && versionASplit.length === 3, 0x668 /* Version numbers should follow semantic versioning. */);
|
|
272
|
-
for (let i = 0; i < 3; ++i) {
|
|
273
|
-
const numberA = parseInt(versionASplit[i], 10);
|
|
274
|
-
const numberB = parseInt(versionBSplit[i], 10);
|
|
275
|
-
if (numberA > numberB) {
|
|
276
|
-
return 1;
|
|
277
|
-
}
|
|
278
|
-
if (numberA < numberB) {
|
|
279
|
-
return -1;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return 0;
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* Create a {@link SimpleTestTree} from the given {@link SharedTree} or {@link IdCompressor}
|
|
286
|
-
*/
|
|
287
|
-
export function setUpTestTree(idSource, expensiveValidation = false) {
|
|
288
|
-
const source = idSource ?? new IdCompressor(createSessionId(), reservedIdCount);
|
|
289
|
-
if (source instanceof SharedTree) {
|
|
290
|
-
assert(source.edits.length === 0, 0x669 /* tree must be a new SharedTree */);
|
|
291
|
-
const getNormalizer = () => getIdNormalizerFromSharedTree(source);
|
|
292
|
-
const contextWrapper = {
|
|
293
|
-
normalizeToOpSpace: (id) => getNormalizer().normalizeToOpSpace(id),
|
|
294
|
-
normalizeToSessionSpace: (id, sessionId) => getNormalizer().normalizeToSessionSpace(id, sessionId),
|
|
295
|
-
get localSessionId() {
|
|
296
|
-
return getNormalizer().localSessionId;
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
const simpleTestTree = new SimpleTestTree(source, contextWrapper, expensiveValidation);
|
|
300
|
-
setTestTree(source, simpleTestTree);
|
|
301
|
-
return simpleTestTree;
|
|
302
|
-
}
|
|
303
|
-
const context = makeNodeIdContext(source);
|
|
304
|
-
return new SimpleTestTree(context, context, expensiveValidation);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Gets an id normalizer from the provided shared-tree. This is
|
|
308
|
-
*/
|
|
309
|
-
export function getIdNormalizerFromSharedTree(sharedTree) {
|
|
310
|
-
return (sharedTree.idNormalizer ??
|
|
311
|
-
fail('Failed to find SharedTree normalizer'));
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Create a {@link SimpleTestTree} before each test
|
|
315
|
-
*/
|
|
316
|
-
export function refreshTestTree(idSourceFactory, fn, expensiveValidation = false) {
|
|
317
|
-
const factory = idSourceFactory ?? (() => new IdCompressor(createSessionId(), reservedIdCount));
|
|
318
|
-
return new RefreshingTestTree(() => {
|
|
319
|
-
return setUpTestTree(factory(), expensiveValidation);
|
|
320
|
-
}, fn);
|
|
321
|
-
}
|
|
322
|
-
export function makeNodeIdContext(idCompressor) {
|
|
323
|
-
const compressor = idCompressor ?? new IdCompressor(createSessionId(), reservedIdCount);
|
|
324
|
-
return getNodeIdContext(compressor);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Applies an arbitrary edit to the given SharedTree which leaves the tree in the same state that it was before the edit.
|
|
328
|
-
* This is useful for test scenarios that want to apply edits but don't care what they do.
|
|
329
|
-
*/
|
|
330
|
-
export function applyNoop(tree) {
|
|
331
|
-
return tree.applyEdit(...noopEdit(tree.currentView));
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Creates an arbitrary edit which leaves a tree in the same state that it was before the edit.
|
|
335
|
-
* This is useful for test scenarios that want to create edits but don't care what they do.
|
|
336
|
-
*/
|
|
337
|
-
export function noopEdit(view) {
|
|
338
|
-
const traitLocation = testTrait(view);
|
|
339
|
-
const trait = view.getTrait(traitLocation);
|
|
340
|
-
// Set the test trait to the same thing that it already was
|
|
341
|
-
return setTrait(traitLocation, trait.map((id) => getChangeNodeFromViewNode(view, id)));
|
|
342
|
-
}
|
|
343
|
-
/** Translate an ID in one context to an ID in another */
|
|
344
|
-
export function translateId(id, from, to) {
|
|
345
|
-
return to.convertToNodeId(from.convertToStableNodeId(getNodeId(id)));
|
|
346
|
-
}
|
|
347
|
-
export function normalizeId(tree, id) {
|
|
348
|
-
const normalizer = getIdNormalizerFromSharedTree(tree);
|
|
349
|
-
return normalizer.normalizeToOpSpace(id);
|
|
350
|
-
}
|
|
351
|
-
export function normalizeIds(tree, ...ids) {
|
|
352
|
-
const normalizer = getIdNormalizerFromSharedTree(tree);
|
|
353
|
-
return ids.map((id) => normalizer.normalizeToOpSpace(id));
|
|
354
|
-
}
|
|
355
|
-
export function idsAreEqual(treeA, idsA, treeB, idsB) {
|
|
356
|
-
if (idsA.length !== idsB.length) {
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
const contextA = getIdNormalizerFromSharedTree(treeA);
|
|
360
|
-
const contextB = getIdNormalizerFromSharedTree(treeB);
|
|
361
|
-
for (let i = 0; i < idsA.length; i++) {
|
|
362
|
-
if (contextA.normalizeToOpSpace(idsA[i]) !== contextB.normalizeToOpSpace(idsB[i])) {
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return true;
|
|
367
|
-
}
|
|
368
|
-
export function normalizeEdit(tree, edit) {
|
|
369
|
-
const context = getIdNormalizerFromSharedTree(tree);
|
|
370
|
-
return convertEditIds(edit, (id) => context.normalizeToOpSpace(id));
|
|
371
|
-
}
|
|
372
|
-
export function stabilizeEdit(tree, edit) {
|
|
373
|
-
return convertEditIds(edit, (id) => tree.convertToStableNodeId(id));
|
|
374
|
-
}
|
|
375
|
-
export function getEditLogInternal(tree) {
|
|
376
|
-
return tree.edits;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Spies on all future ops submitted to `containerRuntimeFactory`. When ops are submitted, they will be `push`ed into the
|
|
380
|
-
* returned array.
|
|
381
|
-
*/
|
|
382
|
-
export function spyOnSubmittedOps(containerRuntimeFactory) {
|
|
383
|
-
const ops = [];
|
|
384
|
-
const originalPush = containerRuntimeFactory.pushMessage.bind(containerRuntimeFactory);
|
|
385
|
-
containerRuntimeFactory.pushMessage = (message) => {
|
|
386
|
-
const { contents } = message;
|
|
387
|
-
ops.push(contents);
|
|
388
|
-
originalPush(message);
|
|
389
|
-
};
|
|
390
|
-
return ops;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Waits for summarization to occur, and returns a version that can be passed into newly loaded containers
|
|
394
|
-
* to ensure they load this summary version. Use the `LoaderHeader.version` header.
|
|
395
|
-
*/
|
|
396
|
-
export async function waitForSummary(mainContainer) {
|
|
397
|
-
const { deltaManager } = mainContainer;
|
|
398
|
-
const summaryCollection = new SummaryCollection(deltaManager, createChildLogger());
|
|
399
|
-
const ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);
|
|
400
|
-
return ackedSummary.summaryAck.contents.handle;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Runs an action while the given container has been paused
|
|
404
|
-
*/
|
|
405
|
-
export async function withContainerOffline(provider, container, action) {
|
|
406
|
-
await provider.ensureSynchronized();
|
|
407
|
-
await provider.opProcessingController.pauseProcessing(container);
|
|
408
|
-
const actionReturn = action();
|
|
409
|
-
const pendingLocalState = await container.closeAndGetPendingLocalState?.();
|
|
410
|
-
assert(pendingLocalState !== undefined, 0x726 /* pendingLocalState should be defined */);
|
|
411
|
-
return { actionReturn, pendingLocalState };
|
|
412
|
-
}
|
|
413
|
-
//# sourceMappingURL=TestUtilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAA0B,MAAM,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1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AAM,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,QAA6B,EAC7B,SAAiC,EACjC,MAAqB;IAErB,MAAM,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACpC,MAAM,QAAQ,CAAC,sBAAsB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;IAC9B,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,4BAA4B,EAAE,EAAE,CAAC;IAC3E,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAC5C,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 { assert } from '@fluidframework/core-utils';\nimport { v5 as uuidv5 } from 'uuid';\nimport { expect } from 'chai';\nimport { LocalServerTestDriver } from '@fluid-private/test-drivers';\nimport { SummaryCollection, DefaultSummaryConfiguration } from '@fluidframework/container-runtime';\nimport { IContainerExperimental, Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';\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\tITestObjectProvider,\n} from '@fluidframework/test-utils';\nimport { AttachState, type IContainer, type IHostLoader } from '@fluidframework/container-definitions';\nimport type {\n\tConfigTypes,\n\tIConfigProviderBase,\n\tIFluidCodeDetails,\n\tIFluidHandle,\n\tIRequestHeader,\n} from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport { createChildLogger } from '@fluidframework/telemetry-utils';\nimport { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';\nimport {\n\tAttributionId,\n\tDetachedSequenceId,\n\tEditId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tStableNodeId,\n} from '../../Identifiers.js';\nimport { fail, identity, ReplaceRecursive } from '../../Common.js';\nimport { IdCompressor } from '../../id-compressor/index.js';\nimport { createSessionId } from '../../id-compressor/NumericUuid.js';\nimport { getChangeNodeFromViewNode } from '../../SerializationUtilities.js';\nimport { initialTree } from '../../InitialTree.js';\nimport {\n\tChangeInternal,\n\tEdit,\n\tNodeData,\n\tPayload,\n\treservedIdCount,\n\tSharedTreeOp,\n\tSharedTreeOp_0_0_2,\n\tWriteFormat,\n} from '../../persisted-types/index.js';\nimport { TraitLocation, TreeView } from '../../TreeView.js';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes.js';\nimport {\n\tgetNodeId,\n\tgetNodeIdContext,\n\tNodeIdContext,\n\tNodeIdConverter,\n\tNodeIdNormalizer,\n} from '../../NodeIdUtilities.js';\nimport { newEdit, setTrait } from '../../EditUtilities.js';\nimport { SharedTree, SharedTreeFactory, SharedTreeOptions_0_0_2 } from '../../SharedTree.js';\nimport { BuildNode, Change, StablePlace } from '../../ChangeTypes.js';\nimport { convertEditIds } from '../../IdConversion.js';\nimport { OrderedEditSet } from '../../EditLog.js';\nimport { buildLeaf, RefreshingTestTree, SimpleTestTree, TestTree } from './TestNode.js';\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 * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\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 {\n\t\tid,\n\t\tinitialTree,\n\t\tlocalMode,\n\t\tcontainerRuntimeFactory,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tattributionId,\n\t} = options;\n\tconst attachState = localMode === true ? AttachState.Detached : undefined;\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({ attachState }), proxyHandler);\n\t} else {\n\t\tcomponentRuntime = new MockFluidDataStoreRuntime({ attachState });\n\t}\n\n\t// Enable expensiveValidation\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst tree = factory.create(componentRuntime, id ?? 'testSharedTree');\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\tconst containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);\n\t\tconst services = {\n\t\t\tdeltaConnection: componentRuntime.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: IContainer;\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 * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\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\t/**\n\t * If set, will be passed to the container on load\n\t */\n\tpendingLocalState?: string;\n\t/**\n\t * If set, will be added to the configProvider object passed to the loader\n\t * and will take effect for the duration of its lifetime\n\t */\n\tfeatureGates?: Record<string, ConfigTypes>;\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\tattributionId,\n\t\tpendingLocalState,\n\t} = options;\n\n\tconst featureGates = options.featureGates ?? {};\n\tfeatureGates['Fluid.Container.enableOfflineLoad'] = true;\n\tfeatureGates['Fluid.ContainerRuntime.DisablePartialFlush'] = true;\n\n\tconst treeId = id ?? 'test';\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: uploadEditChunks ?? true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst registry: ChannelFactoryRegistry = [[treeId, factory]];\n\n\tconst runtimeFactory = () =>\n\t\tnew TestContainerRuntimeFactory(TestDataStoreType, new TestFluidObjectFactory(registry), {\n\t\t\tsummaryOptions: {\n\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t...{\n\t\t\t\t\t\tminIdleTime: 1000, // Manually set idle times so some SharedTree tests don't timeout.\n\t\t\t\t\t\tmaxIdleTime: 1000,\n\t\t\t\t\t\tmaxTime: 1000 * 12,\n\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\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\tconst configProvider = (settings: Record<string, ConfigTypes>): IConfigProviderBase => ({\n\t\t\tgetRawConfig: (name: string): ConfigTypes => settings[name],\n\t\t});\n\n\t\treturn provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {\n\t\t\toptions: { maxClientLeaveWaitTime: 1000 },\n\t\t\tconfigProvider: configProvider(featureGates),\n\t\t});\n\t}\n\n\tlet provider: TestObjectProvider;\n\tlet container: IContainer;\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 }, pendingLocalState);\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(defaultCodeDetails, loader, driver.createCreateNewRequest(treeId));\n\t}\n\n\tconst dataObject = (await container.getEntryPoint()) as ITestFluidObject;\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\t0x668 /* 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, 0x669 /* 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\nexport function getEditLogInternal(tree: SharedTree): OrderedEditSet<ChangeInternal> {\n\treturn tree.edits as unknown as OrderedEditSet<ChangeInternal>;\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, createChildLogger());\n\tconst ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);\n\treturn ackedSummary.summaryAck.contents.handle;\n}\n\n/**\n * Runs an action while the given container has been paused\n */\nexport async function withContainerOffline<TReturn>(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainerExperimental,\n\taction: () => TReturn\n): Promise<{ actionReturn: TReturn; pendingLocalState: string }> {\n\tawait provider.ensureSynchronized();\n\tawait provider.opProcessingController.pauseProcessing(container);\n\tconst actionReturn = action();\n\tconst pendingLocalState = await container.closeAndGetPendingLocalState?.();\n\tassert(pendingLocalState !== undefined, 0x726 /* pendingLocalState should be defined */);\n\treturn { actionReturn, pendingLocalState };\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { EditId } from '../../Identifiers.js';
|
|
6
|
-
import { SharedTree } from '../../SharedTree.js';
|
|
7
|
-
/** Options used to generate a SharedTree undo/redo test suite. */
|
|
8
|
-
interface SharedTreeUndoRedoOptions {
|
|
9
|
-
/** Determines if the tests should be run in local state or connected state with a remote SharedTree */
|
|
10
|
-
localMode: boolean;
|
|
11
|
-
/** Title used for the test suite describe block. */
|
|
12
|
-
title: string;
|
|
13
|
-
/** Function for undoing an edit on a given tree. */
|
|
14
|
-
undo: (tree: SharedTree, editId: EditId) => EditId | undefined;
|
|
15
|
-
/** Function for redoing an edit on a given tree. */
|
|
16
|
-
redo: (tree: SharedTree, editId: EditId) => EditId | undefined;
|
|
17
|
-
/** Optional additional setup to run in a beforeEach block that takes the SharedTrees used in the tests. */
|
|
18
|
-
beforeEach?: (trees: SharedTree[]) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Function to run after edits. Used for testing the SharedTreeUndoRedoHandler in order to close stack
|
|
21
|
-
* operations between edits.
|
|
22
|
-
*/
|
|
23
|
-
afterEdit?: () => void;
|
|
24
|
-
/** If true, runs tests for out-of-order undo/redo. True by default. */
|
|
25
|
-
testOutOfOrderRevert?: boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Runs undo/redo tests for SharedTree
|
|
29
|
-
*/
|
|
30
|
-
export declare function runSharedTreeUndoRedoTestSuite(options: SharedTreeUndoRedoOptions): void;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=UndoRedoTests.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UndoRedoTests.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/UndoRedoTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAsB,MAAM,EAAU,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQjD,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"}
|