@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,9 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
1
5
|
import { type IEvent, type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
2
|
-
import {
|
|
3
|
-
import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type
|
|
6
|
+
import { type IChannelAttributes, IChannelFactory, type IChannelServices, type IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
7
|
+
import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type ISummaryTreeWithStats, type ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
8
|
+
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils/internal';
|
|
4
9
|
import { type ITree } from '@fluidframework/tree';
|
|
5
|
-
import {
|
|
6
|
-
import { type SharedTreeFactory as LegacySharedTreeFactory, type SharedTree as LegacySharedTree } from '../SharedTree.js';
|
|
10
|
+
import { type SharedTree as LegacySharedTree, type SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
|
|
7
11
|
import { type IShim } from './types.js';
|
|
8
12
|
/**
|
|
9
13
|
* Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrationShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtG,OAAO,EACN,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,uCAAuC,CAAC;AAI/C,OAAO,EACN,KAAK,sCAAsC,EAC3C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AAO,GAAG,SAAS,GAAG,sBAAsB;IAG/D,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAW,cAAc,IAAI,cAAc,CAE1C;CACD"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MigrationShim = void 0;
|
|
4
2
|
/*!
|
|
5
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
4
|
* Licensed under the MIT License.
|
|
7
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MigrationShim = void 0;
|
|
8
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
11
|
-
const
|
|
12
|
-
const shimChannelServices_js_1 = require("./shimChannelServices.js");
|
|
11
|
+
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
13
12
|
const migrationDeltaHandler_js_1 = require("./migrationDeltaHandler.js");
|
|
13
|
+
const shimChannelServices_js_1 = require("./shimChannelServices.js");
|
|
14
14
|
const shimDeltaConnection_js_1 = require("./shimDeltaConnection.js");
|
|
15
15
|
const shimHandle_js_1 = require("./shimHandle.js");
|
|
16
16
|
const ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee';
|
|
@@ -29,7 +29,7 @@ const ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee';
|
|
|
29
29
|
*
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
|
-
class MigrationShim extends
|
|
32
|
+
class MigrationShim extends internal_2.EventEmitterWithErrorHandling {
|
|
33
33
|
constructor(id, runtime, legacyTreeFactory, newTreeFactory, populateNewSharedObjectFn) {
|
|
34
34
|
super((event, e) => this.eventListenerErrorHandler(event, e));
|
|
35
35
|
this.id = id;
|
|
@@ -42,7 +42,7 @@ class MigrationShim extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
const newTree = this.newTreeFactory.create(this.runtime, this.id);
|
|
45
|
-
(0,
|
|
45
|
+
(0, internal_1.assert)(this.preMigrationDeltaConnection !== undefined, 0x82f /* Should be in v1 state */);
|
|
46
46
|
this.preMigrationDeltaConnection.disableSubmit();
|
|
47
47
|
const { idCompressor } = this.runtime;
|
|
48
48
|
if (idCompressor !== undefined) {
|
|
@@ -72,14 +72,14 @@ class MigrationShim extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
72
72
|
this.handle = new shimHandle_js_1.ShimHandle(this);
|
|
73
73
|
}
|
|
74
74
|
get legacyTree() {
|
|
75
|
-
(0,
|
|
75
|
+
(0, internal_1.assert)(this._legacyTree !== undefined, 0x7e6 /* Old tree not initialized */);
|
|
76
76
|
return this._legacyTree;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.eventListenerErrorHandler}
|
|
80
80
|
*/
|
|
81
81
|
eventListenerErrorHandler(event, e) {
|
|
82
|
-
const error =
|
|
82
|
+
const error = internal_2.DataProcessingError.wrapIfUnrecognized(e, 'SharedObjectEventListenerException');
|
|
83
83
|
error.addTelemetryProperties({ emittedEventName: String(event) });
|
|
84
84
|
this.closeWithError(error);
|
|
85
85
|
throw error;
|
|
@@ -140,9 +140,9 @@ class MigrationShim extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
140
140
|
}
|
|
141
141
|
// Only reconnect to the new shared tree this limits us to only migrating
|
|
142
142
|
reconnect() {
|
|
143
|
-
(0,
|
|
144
|
-
(0,
|
|
145
|
-
(0,
|
|
143
|
+
(0, internal_1.assert)(this.services !== undefined, 0x7e7 /* Not connected */);
|
|
144
|
+
(0, internal_1.assert)(this.newTree !== undefined, 0x7e8 /* New tree not initialized */);
|
|
145
|
+
(0, internal_1.assert)(this.postMigrationServices === undefined, 0x830 /* Already reconnected! */);
|
|
146
146
|
// This method attaches the newTree's delta handler to the MigrationShimDeltaHandler
|
|
147
147
|
this.postMigrationServices = {
|
|
148
148
|
objectStorage: this.services.objectStorage,
|
|
@@ -158,7 +158,7 @@ class MigrationShim extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
158
158
|
* @returns - shim services
|
|
159
159
|
*/
|
|
160
160
|
generateShimServicesOnce(services) {
|
|
161
|
-
(0,
|
|
161
|
+
(0, internal_1.assert)(this.services === undefined && this.preMigrationDeltaConnection === undefined, 0x7e9 /* Already connected */);
|
|
162
162
|
this.services = services;
|
|
163
163
|
this.preMigrationDeltaConnection = new shimDeltaConnection_js_1.PreMigrationDeltaConnection(this.services.deltaConnection, this.migrationDeltaHandler);
|
|
164
164
|
const shimServices = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationShim.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAAoE;AAepE,2DAAoD;AACpD,+EAAmG;AAEnG,qEAAqG;AAMrG,qEAA8F;AAC9F,yEAAuE;AACvE,qEAA6F;AAC7F,mDAA6C;AAmC7C,MAAM,cAAc,GAAG,sCAAmD,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,+CAA8C;IAChF,YACiB,EAAU,EACT,OAA+B,EAC/B,iBAA0C,EAC1C,cAA+B,EAC/B,yBAAiF;QAElG,KAAK,CAAC,CAAC,KAA4B,EAAE,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAN9E,OAAE,GAAF,EAAE,CAAQ;QACT,YAAO,GAAP,OAAO,CAAwB;QAC/B,sBAAiB,GAAjB,iBAAiB,CAAyB;QAC1C,mBAAc,GAAd,cAAc,CAAiB;QAC/B,8BAAyB,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AAe,EAAE,IAAI,CAAC,2BAA2B;SACjD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA7MD,sCA6MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { type IEvent, type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';\nimport {\n\tIChannelFactory,\n\ttype IChannelAttributes,\n\ttype IChannelServices,\n\ttype IFluidDataStoreRuntime,\n} from '@fluidframework/datastore-definitions';\nimport {\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype IGarbageCollectionData,\n\ttype ITelemetryContext,\n\ttype ISummaryTreeWithStats,\n} from '@fluidframework/runtime-definitions';\nimport { type ITree } from '@fluidframework/tree';\nimport { assert } from '@fluidframework/core-utils';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport { type EventEmitterEventType } from '@fluid-internal/client-utils';\nimport { DataProcessingError, EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';\nimport type { SessionId, IIdCompressorCore } from '@fluidframework/id-compressor';\nimport {\n\ttype SharedTreeFactory as LegacySharedTreeFactory,\n\ttype SharedTree as LegacySharedTree,\n} from '../SharedTree.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { MigrationShimDeltaHandler } from './migrationDeltaHandler.js';\nimport { PreMigrationDeltaConnection, StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport { type IShim, type IOpContents } from './types.js';\n\n/**\n * Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.\n *\n * @internal\n */\nexport interface IMigrationEvent extends IEvent {\n\t/**\n\t * Event that is emitted when the migration is complete.\n\t */\n\t(event: 'migrated', listener: () => void);\n}\n\n/**\n * Interface for migration operation.\n */\nexport interface IMigrationOp {\n\t/**\n\t * Type of the migration operation.\n\t */\n\ttype: 'barrier';\n\t/**\n\t * Old channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what state of the document was before the migration op initiated at.\n\t */\n\toldAttributes: IChannelAttributes;\n\t/**\n\t * New channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what the migration state of the new container is expected to be.\n\t */\n\tnewAttributes: IChannelAttributes;\n}\n\nconst ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee' as SessionId;\n\n/**\n * The MigrationShim loads in place of the legacy SharedTree. It provides API surface for migrating it to the new SharedTree, while also providing access to the current SharedTree for usage.\n *\n * @remarks\n *\n * This MigrationShim is responsible for submitting a migration op, processing the migrate op, swapping from the old\n * tree to the new tree, loading an old tree snapshot and creating an old tree.\n *\n * The MigrationShim expects to always load from a legacy SharedTree snapshot, though by the time it catches up in\n * processing all ops, it may find that the migration has already occurred. After migration occurs, it modifies its\n * attributes to point at the SharedTreeShimFactory. This will cause future clients to load with a SharedTreeShim and\n * the new SharedTree snapshot instead after the next summarization.\n *\n * @internal\n */\nexport class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent> implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly legacyTreeFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newTreeFactory: IChannelFactory,\n\t\tprivate readonly populateNewSharedObjectFn: (legacyTree: LegacySharedTree, newTree: ITree) => void\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: unknown) => this.eventListenerErrorHandler(event, e));\n\t\t// TODO: consider flattening this class\n\t\tthis.migrationDeltaHandler = new MigrationShimDeltaHandler(\n\t\t\tthis.processMigrateOp,\n\t\t\tthis.submitLocalMessage,\n\t\t\tthis.newTreeFactory.attributes\n\t\t);\n\t\tthis.handle = new ShimHandle<MigrationShim>(this);\n\t}\n\n\tprivate readonly processMigrateOp = (message: ISequencedDocumentMessage): boolean => {\n\t\tif (message.type !== MessageType.Operation || (message.contents as Partial<IMigrationOp>).type !== 'barrier') {\n\t\t\treturn false;\n\t\t}\n\t\tconst newTree = this.newTreeFactory.create(this.runtime, this.id) as ITree;\n\t\tassert(this.preMigrationDeltaConnection !== undefined, 0x82f /* Should be in v1 state */);\n\t\tthis.preMigrationDeltaConnection.disableSubmit();\n\t\tconst { idCompressor } = this.runtime;\n\t\tif (idCompressor !== undefined) {\n\t\t\t(idCompressor as unknown as IIdCompressorCore).beginGhostSession(ghostSessionId, () =>\n\t\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree)\n\t\t\t);\n\t\t} else {\n\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree);\n\t\t}\n\t\tthis.newTree = newTree;\n\t\tthis.reconnect();\n\t\tthis.emit('migrated');\n\t\treturn true;\n\t};\n\n\tprivate readonly migrationDeltaHandler: MigrationShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate preMigrationDeltaConnection?: PreMigrationDeltaConnection;\n\tprivate postMigrationServices?: IShimChannelServices;\n\n\tprivate _legacyTree: LegacySharedTree | undefined;\n\tprivate get legacyTree(): LegacySharedTree {\n\t\tassert(this._legacyTree !== undefined, 0x7e6 /* Old tree not initialized */);\n\t\treturn this._legacyTree;\n\t}\n\n\tprivate newTree: ITree | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeError}\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.eventListenerErrorHandler}\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: unknown): void {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(e, 'SharedObjectEventListenerException');\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeWithError}\n\t */\n\tprivate closeWithError(error: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>): void {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.verifyNotClosed}\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.submitLocalMessage}\n\t */\n\tprivate readonly submitLocalMessage = (message: IOpContents): void => {\n\t\tthis.verifyNotClosed();\n\t\t// This is a copy of submit local message from SharedObject\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(message, undefined);\n\t\t}\n\t};\n\n\t// Migration occurs once this op is read.\n\tpublic submitMigrateOp(): void {\n\t\tconst migrateOp: IMigrationOp = {\n\t\t\ttype: 'barrier',\n\t\t\toldAttributes: this.legacyTreeFactory.attributes,\n\t\t\tnewAttributes: this.newTreeFactory.attributes,\n\t\t};\n\n\t\tthis.submitLocalMessage(migrateOp);\n\t}\n\n\tpublic get currentTree(): LegacySharedTree | ITree {\n\t\treturn this.newTree ?? this.legacyTree;\n\t}\n\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._legacyTree = await this.legacyTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.legacyTreeFactory.attributes\n\t\t);\n\t}\n\tpublic create(): void {\n\t\tthis._legacyTree = this.legacyTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\n\t// Only connect to the legacy shared tree\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\tthis.legacyTree.connect(shimServices);\n\t}\n\n\t// Only reconnect to the new shared tree this limits us to only migrating\n\tprivate reconnect(): void {\n\t\tassert(this.services !== undefined, 0x7e7 /* Not connected */);\n\t\tassert(this.newTree !== undefined, 0x7e8 /* New tree not initialized */);\n\t\tassert(this.postMigrationServices === undefined, 0x830 /* Already reconnected! */);\n\t\t// This method attaches the newTree's delta handler to the MigrationShimDeltaHandler\n\t\tthis.postMigrationServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.migrationDeltaHandler,\n\t\t\t\tthis.newTree.attributes\n\t\t\t),\n\t\t};\n\t\tthis.newTree.connect(this.postMigrationServices);\n\t}\n\n\t/**\n\t * Only generate the ShimServices once as the underlying DeltaHandler can only be connected to once. If we connect\n\t * twice, we will be in a \"v2\" state even though we really are in a \"v1\" state. We will encounter unexpected op\n\t * dropping behavior or lack thereof and may corrupt the document.\n\t * @param services - the services to generate the shim services from\n\t * @returns - shim services\n\t */\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(\n\t\t\tthis.services === undefined && this.preMigrationDeltaConnection === undefined,\n\t\t\t0x7e9 /* Already connected */\n\t\t);\n\t\tthis.services = services;\n\t\tthis.preMigrationDeltaConnection = new PreMigrationDeltaConnection(\n\t\t\tthis.services.deltaConnection,\n\t\t\tthis.migrationDeltaHandler\n\t\t);\n\t\tconst shimServices: IShimChannelServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: this.preMigrationDeltaConnection,\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n\tpublic handle: IFluidHandle<MigrationShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"migrationShim.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iFAAoE;AAEpE,kEAA6D;AAS7D,+EAAmG;AAOnG,uEAA8G;AAQ9G,yEAAuE;AACvE,qEAA8F;AAC9F,qEAA6F;AAC7F,mDAA6C;AAmC7C,MAAM,cAAc,GAAG,sCAAmD,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,wCAA8C;IAChF,YACiB,EAAU,EACT,OAA+B,EAC/B,iBAA0C,EAC1C,cAA+B,EAC/B,yBAAiF;QAElG,KAAK,CAAC,CAAC,KAA4B,EAAE,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAN9E,OAAE,GAAF,EAAE,CAAQ;QACT,YAAO,GAAP,OAAO,CAAwB;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AAC;QACF,MAAM,YAAY,GAAyB;YAC1C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,eAAe,EAAE,IAAI,CAAC,2BAA2B;SACjD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA7MD,sCA6MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type EventEmitterEventType } from '@fluid-internal/client-utils';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { type IEvent, type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\tIChannelFactory,\n\ttype IChannelServices,\n\ttype IFluidDataStoreRuntime,\n} from '@fluidframework/datastore-definitions';\nimport type { SessionId } from '@fluidframework/id-compressor';\nimport type { IIdCompressorCore } from '@fluidframework/id-compressor/internal';\nimport { type ISequencedDocumentMessage, MessageType } from '@fluidframework/protocol-definitions';\nimport {\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype IGarbageCollectionData,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n} from '@fluidframework/runtime-definitions';\nimport { DataProcessingError, EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils/internal';\nimport { type ITree } from '@fluidframework/tree';\n\nimport {\n\ttype SharedTree as LegacySharedTree,\n\ttype SharedTreeFactory as LegacySharedTreeFactory,\n} from '../SharedTree.js';\n\nimport { MigrationShimDeltaHandler } from './migrationDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { PreMigrationDeltaConnection, StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport { type IOpContents, type IShim } from './types.js';\n\n/**\n * Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.\n *\n * @internal\n */\nexport interface IMigrationEvent extends IEvent {\n\t/**\n\t * Event that is emitted when the migration is complete.\n\t */\n\t(event: 'migrated', listener: () => void);\n}\n\n/**\n * Interface for migration operation.\n */\nexport interface IMigrationOp {\n\t/**\n\t * Type of the migration operation.\n\t */\n\ttype: 'barrier';\n\t/**\n\t * Old channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what state of the document was before the migration op initiated at.\n\t */\n\toldAttributes: IChannelAttributes;\n\t/**\n\t * New channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what the migration state of the new container is expected to be.\n\t */\n\tnewAttributes: IChannelAttributes;\n}\n\nconst ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee' as SessionId;\n\n/**\n * The MigrationShim loads in place of the legacy SharedTree. It provides API surface for migrating it to the new SharedTree, while also providing access to the current SharedTree for usage.\n *\n * @remarks\n *\n * This MigrationShim is responsible for submitting a migration op, processing the migrate op, swapping from the old\n * tree to the new tree, loading an old tree snapshot and creating an old tree.\n *\n * The MigrationShim expects to always load from a legacy SharedTree snapshot, though by the time it catches up in\n * processing all ops, it may find that the migration has already occurred. After migration occurs, it modifies its\n * attributes to point at the SharedTreeShimFactory. This will cause future clients to load with a SharedTreeShim and\n * the new SharedTree snapshot instead after the next summarization.\n *\n * @internal\n */\nexport class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent> implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly legacyTreeFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newTreeFactory: IChannelFactory,\n\t\tprivate readonly populateNewSharedObjectFn: (legacyTree: LegacySharedTree, newTree: ITree) => void\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: unknown) => this.eventListenerErrorHandler(event, e));\n\t\t// TODO: consider flattening this class\n\t\tthis.migrationDeltaHandler = new MigrationShimDeltaHandler(\n\t\t\tthis.processMigrateOp,\n\t\t\tthis.submitLocalMessage,\n\t\t\tthis.newTreeFactory.attributes\n\t\t);\n\t\tthis.handle = new ShimHandle<MigrationShim>(this);\n\t}\n\n\tprivate readonly processMigrateOp = (message: ISequencedDocumentMessage): boolean => {\n\t\tif (message.type !== MessageType.Operation || (message.contents as Partial<IMigrationOp>).type !== 'barrier') {\n\t\t\treturn false;\n\t\t}\n\t\tconst newTree = this.newTreeFactory.create(this.runtime, this.id) as ITree;\n\t\tassert(this.preMigrationDeltaConnection !== undefined, 0x82f /* Should be in v1 state */);\n\t\tthis.preMigrationDeltaConnection.disableSubmit();\n\t\tconst { idCompressor } = this.runtime;\n\t\tif (idCompressor !== undefined) {\n\t\t\t(idCompressor as unknown as IIdCompressorCore).beginGhostSession(ghostSessionId, () =>\n\t\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree)\n\t\t\t);\n\t\t} else {\n\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree);\n\t\t}\n\t\tthis.newTree = newTree;\n\t\tthis.reconnect();\n\t\tthis.emit('migrated');\n\t\treturn true;\n\t};\n\n\tprivate readonly migrationDeltaHandler: MigrationShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate preMigrationDeltaConnection?: PreMigrationDeltaConnection;\n\tprivate postMigrationServices?: IShimChannelServices;\n\n\tprivate _legacyTree: LegacySharedTree | undefined;\n\tprivate get legacyTree(): LegacySharedTree {\n\t\tassert(this._legacyTree !== undefined, 0x7e6 /* Old tree not initialized */);\n\t\treturn this._legacyTree;\n\t}\n\n\tprivate newTree: ITree | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeError}\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.eventListenerErrorHandler}\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: unknown): void {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(e, 'SharedObjectEventListenerException');\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeWithError}\n\t */\n\tprivate closeWithError(error: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>): void {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.verifyNotClosed}\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.submitLocalMessage}\n\t */\n\tprivate readonly submitLocalMessage = (message: IOpContents): void => {\n\t\tthis.verifyNotClosed();\n\t\t// This is a copy of submit local message from SharedObject\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(message, undefined);\n\t\t}\n\t};\n\n\t// Migration occurs once this op is read.\n\tpublic submitMigrateOp(): void {\n\t\tconst migrateOp: IMigrationOp = {\n\t\t\ttype: 'barrier',\n\t\t\toldAttributes: this.legacyTreeFactory.attributes,\n\t\t\tnewAttributes: this.newTreeFactory.attributes,\n\t\t};\n\n\t\tthis.submitLocalMessage(migrateOp);\n\t}\n\n\tpublic get currentTree(): LegacySharedTree | ITree {\n\t\treturn this.newTree ?? this.legacyTree;\n\t}\n\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._legacyTree = await this.legacyTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.legacyTreeFactory.attributes\n\t\t);\n\t}\n\tpublic create(): void {\n\t\tthis._legacyTree = this.legacyTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\n\t// Only connect to the legacy shared tree\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\tthis.legacyTree.connect(shimServices);\n\t}\n\n\t// Only reconnect to the new shared tree this limits us to only migrating\n\tprivate reconnect(): void {\n\t\tassert(this.services !== undefined, 0x7e7 /* Not connected */);\n\t\tassert(this.newTree !== undefined, 0x7e8 /* New tree not initialized */);\n\t\tassert(this.postMigrationServices === undefined, 0x830 /* Already reconnected! */);\n\t\t// This method attaches the newTree's delta handler to the MigrationShimDeltaHandler\n\t\tthis.postMigrationServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.migrationDeltaHandler,\n\t\t\t\tthis.newTree.attributes\n\t\t\t),\n\t\t};\n\t\tthis.newTree.connect(this.postMigrationServices);\n\t}\n\n\t/**\n\t * Only generate the ShimServices once as the underlying DeltaHandler can only be connected to once. If we connect\n\t * twice, we will be in a \"v2\" state even though we really are in a \"v1\" state. We will encounter unexpected op\n\t * dropping behavior or lack thereof and may corrupt the document.\n\t * @param services - the services to generate the shim services from\n\t * @returns - shim services\n\t */\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(\n\t\t\tthis.services === undefined && this.preMigrationDeltaConnection === undefined,\n\t\t\t0x7e9 /* Already connected */\n\t\t);\n\t\tthis.services = services;\n\t\tthis.preMigrationDeltaConnection = new PreMigrationDeltaConnection(\n\t\t\tthis.services.deltaConnection,\n\t\t\tthis.migrationDeltaHandler\n\t\t);\n\t\tconst shimServices: IShimChannelServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: this.preMigrationDeltaConnection,\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n\tpublic handle: IFluidHandle<MigrationShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type IChannelAttributes, type
|
|
5
|
+
import { type IChannelAttributes, type IChannelFactory, type IChannelServices, type IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
6
6
|
import { type ITree } from '@fluidframework/tree';
|
|
7
|
-
import { type
|
|
7
|
+
import { type SharedTree as LegacySharedTree, type SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
|
|
8
8
|
import { MigrationShim } from './migrationShim.js';
|
|
9
9
|
/**
|
|
10
10
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link MigrationShim}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,
|
|
1
|
+
{"version":3,"file":"migrationShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACN,KAAK,UAAU,IAAI,gBAAgB,EACnC,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAE1D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAFpB,UAAU,EAAE,uBAAuB,EACnC,UAAU,EAAE,eAAe,EAC3B,oBAAoB,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,KAAK,IAAI;IAGjG;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;;;;OAKG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAczB;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa;CAYzE"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.MigrationShimFactory = void 0;
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const migrationShim_js_1 = require("./migrationShim.js");
|
|
10
10
|
const utils_js_1 = require("./utils.js");
|
|
11
11
|
/**
|
|
@@ -50,7 +50,7 @@ class MigrationShimFactory {
|
|
|
50
50
|
*/
|
|
51
51
|
async load(runtime, id, services, attributes) {
|
|
52
52
|
// TODO: remove attributes check and move it to an automated test that constructing a MigrationShimFactory and checking its attributes/type matches the oldFactory.
|
|
53
|
-
(0,
|
|
53
|
+
(0, internal_1.assert)((0, utils_js_1.attributesMatch)(attributes, this.oldFactory.attributes), 0x7ea /* Attributes do not match */);
|
|
54
54
|
const migrationShim = new migrationShim_js_1.MigrationShim(id, runtime, this.oldFactory, this.newFactory, this.populateNewChannelFn);
|
|
55
55
|
await migrationShim.load(services);
|
|
56
56
|
return migrationShim;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"migrationShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAc7D,yDAAmD;AACnD,yCAA6C;AAE7C;;;;;;;;;;;GAWG;AACH,MAAa,oBAAoB;IAChC,YACkB,UAAmC,EACnC,UAA2B,EAC3B,oBAA+E;QAF/E,eAAU,GAAV,UAAU,CAAyB;QACnC,eAAU,GAAV,UAAU,CAAiB;QAC3B,yBAAoB,GAApB,oBAAoB,CAA2D;IAC9F,CAAC;IAEJ;;;;OAIG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,mKAAmK;QACnK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACrG,MAAM,aAAa,GAAG,IAAI,gCAAa,CACtC,EAAE,EACF,OAAO,EACP,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,oBAAoB,CACzB,CAAC;QACF,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,oCAAoC;QACpC,MAAM,aAAa,GAAG,IAAI,gCAAa,CACtC,EAAE,EACF,OAAO,EACP,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,oBAAoB,CACzB,CAAC;QACF,aAAa,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC;IACtB,CAAC;CACD;AArED,oDAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IChannelServices,\n\ttype IFluidDataStoreRuntime,\n} from '@fluidframework/datastore-definitions';\nimport { type ITree } from '@fluidframework/tree';\n\nimport {\n\ttype SharedTree as LegacySharedTree,\n\ttype SharedTreeFactory as LegacySharedTreeFactory,\n} from '../SharedTree.js';\n\nimport { MigrationShim } from './migrationShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link MigrationShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * @remarks\n *\n * It takes over the attributes of the legacy factory, so that it is loaded instead of the normal legacy factory. Once migration finishes, the shim it produces will change its attributes to those of the new factory - meaning that on the next summarization the shim will write a summary that will cause future clients to load a different factory and shim (the SharedTreeShimFactory and SharedTreeShim).\n * 1. pre-migration\n *\n * @sealed\n * @internal\n */\nexport class MigrationShimFactory implements IChannelFactory {\n\tpublic constructor(\n\t\tprivate readonly oldFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newFactory: IChannelFactory,\n\t\tprivate readonly populateNewChannelFn: (oldChannel: LegacySharedTree, newChannel: ITree) => void\n\t) {}\n\n\t/**\n\t * This factory takes over the type of the oldFactory to load in its place. The user must not include the MigrationShimFactory and the oldFactory in the same registry to avoid conflict.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.oldFactory.type;\n\t}\n\n\t/**\n\t * Should be the LegacySharedTree attributes\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.oldFactory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the MigrationShim - it should just load the old tree as this makes the factory's\n\t * responsibility simple. Trying to follow the Single Responsibility Principle here.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<MigrationShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a MigrationShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.oldFactory.attributes), 0x7ea /* Attributes do not match */);\n\t\tconst migrationShim = new MigrationShim(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tthis.oldFactory,\n\t\t\tthis.newFactory,\n\t\t\tthis.populateNewChannelFn\n\t\t);\n\t\tawait migrationShim.load(services);\n\t\treturn migrationShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Create MigrationShim that can hot swap from one DDS to a new DDS. We want the capability of creating an old tree\n\t * as when this code rolls out, there may be clients on the v1 version of the code, and we may want to have a dark\n\t * rollout capability.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): MigrationShim {\n\t\t// Maybe this should throw an error.\n\t\tconst migrationShim = new MigrationShim(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tthis.oldFactory,\n\t\t\tthis.newFactory,\n\t\t\tthis.populateNewChannelFn\n\t\t);\n\t\tmigrationShim.create();\n\t\treturn migrationShim;\n\t}\n}\n"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
4
|
*/
|
|
7
5
|
export declare const pkgName = "@fluid-experimental/migration-shim";
|
|
8
6
|
export declare const pkgVersion = "2.0.0-internal.8.0.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../src/migration-shim/packageVersion.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../src/migration-shim/packageVersion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,OAAO,uCAAuC,CAAC;AAC5D,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
7
5
|
*/
|
|
8
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
7
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../src/migration-shim/packageVersion.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../src/migration-shim/packageVersion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,OAAO,GAAG,oCAAoC,CAAC;AAC/C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const pkgName = '@fluid-experimental/migration-shim';\nexport const pkgVersion = '2.0.0-internal.8.0.0';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACpG,OAAO,
|
|
1
|
+
{"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACpG,OAAO,EAAE,KAAK,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEnG,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,kBAAkB;IAElE,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAEM,YAAY,IAAI,IAAI;IAIpB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKpD,mBAAmB,IAAI,OAAO;IAI9B,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAgB3F,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAK5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAQ9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYpB"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.SharedTreeShimDeltaHandler = void 0;
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
10
10
|
const utils_js_1 = require("./utils.js");
|
|
11
11
|
/**
|
|
@@ -24,7 +24,7 @@ class SharedTreeShimDeltaHandler {
|
|
|
24
24
|
}
|
|
25
25
|
get handler() {
|
|
26
26
|
const handler = this._handler;
|
|
27
|
-
(0,
|
|
27
|
+
(0, internal_1.assert)(handler !== undefined, 0x7eb /* No handler to process op */);
|
|
28
28
|
return handler;
|
|
29
29
|
}
|
|
30
30
|
get attached() {
|
|
@@ -34,7 +34,7 @@ class SharedTreeShimDeltaHandler {
|
|
|
34
34
|
this._attached = true;
|
|
35
35
|
}
|
|
36
36
|
attachTreeDeltaHandler(handler) {
|
|
37
|
-
(0,
|
|
37
|
+
(0, internal_1.assert)(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);
|
|
38
38
|
this._handler = handler;
|
|
39
39
|
}
|
|
40
40
|
hasTreeDeltaHandler() {
|
|
@@ -43,7 +43,7 @@ class SharedTreeShimDeltaHandler {
|
|
|
43
43
|
process(message, local, localOpMetadata) {
|
|
44
44
|
// This allows us to process the migrate op and prevent the shared object from processing the wrong ops
|
|
45
45
|
// Drop v1 ops
|
|
46
|
-
(0,
|
|
46
|
+
(0, internal_1.assert)(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);
|
|
47
47
|
if (message.type !== protocol_definitions_1.MessageType.Operation) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
@@ -59,12 +59,12 @@ class SharedTreeShimDeltaHandler {
|
|
|
59
59
|
}
|
|
60
60
|
// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.
|
|
61
61
|
reSubmit(contents, localOpMetadata) {
|
|
62
|
-
(0,
|
|
62
|
+
(0, internal_1.assert)(!this.shouldDropOp(contents), 0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */);
|
|
63
63
|
return this.handler.reSubmit(contents, localOpMetadata);
|
|
64
64
|
}
|
|
65
65
|
// We are not capable of applying stashed v1 ops.
|
|
66
66
|
applyStashedOp(contents) {
|
|
67
|
-
(0,
|
|
67
|
+
(0, internal_1.assert)(!this.shouldDropOp(contents), 0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */);
|
|
68
68
|
this.handler.applyStashedOp(contents);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
@@ -72,7 +72,7 @@ class SharedTreeShimDeltaHandler {
|
|
|
72
72
|
* v1 ops
|
|
73
73
|
*/
|
|
74
74
|
rollback(contents, localOpMetadata) {
|
|
75
|
-
(0,
|
|
75
|
+
(0, internal_1.assert)(!this.shouldDropOp(contents), 0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */);
|
|
76
76
|
return this.handler.rollback?.(contents, localOpMetadata);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -85,7 +85,7 @@ class SharedTreeShimDeltaHandler {
|
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
87
87
|
// Don't drop v2 ops in v2 state
|
|
88
|
-
(0,
|
|
88
|
+
(0, internal_1.assert)((0, utils_js_1.attributesMatch)(contents.fluidMigrationStamp, this.attributes), 0x834 /* Unexpected v2 op with mismatched attributes */);
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,+EAAmG;AAGnG,yCAA0D;AAE1D;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IACtC,YAAoC,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;QAS1D,cAAS,GAAG,KAAK,CAAC;IAT2C,CAAC;IAGtE,IAAY,OAAO;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAA,iBAAM,EAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpE,OAAO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AAe,CAAC,CAAC;IACzD,CAAC;IAED,iDAAiD;IAC1C,cAAc,CAAC,QAAiB;QACtC,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,YAAY,CAAC,QAAuB,CAAC,EAC3C,KAAK,CAAC,oGAAoG,CAC1G,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAE,QAAiB,EAAE,eAAwB;QAC3D,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,YAAY,CAAC,QAAuB,CAAC,EAC3C,KAAK,CAAC,wFAAwF,CAC9F,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,QAAqB;QACzC,IAAI,CAAC,IAAA,sBAAW,EAAC,QAAQ,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACZ;QAED,gCAAgC;QAChC,IAAA,iBAAM,EACL,IAAA,0BAAe,EAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AA/FD,gEA+FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions';\nimport { type ISequencedDocumentMessage, MessageType } from '@fluidframework/protocol-definitions';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.\n * This serves as an adapter to the real DeltaHandler, filter/process migration ops\n *\n * This should just have the ability to drop v1 & migrate ops, and process v2 ops. There may be an opportunity to\n * combine this class with the MigrationShimDeltaHandler, but for now the classes are separated. Once it is clear what\n * exact code can be shared between the two classes is and how it can be merge, we may figure out a way of merging\n * MigrationShimDeltaHandler and SharedTreeShimDeltaHandler.\n */\nexport class SharedTreeShimDeltaHandler implements IShimDeltaHandler {\n\tpublic constructor(private readonly attributes: IChannelAttributes) {}\n\n\tprivate _handler?: IDeltaHandler;\n\tprivate get handler(): IDeltaHandler {\n\t\tconst handler = this._handler;\n\t\tassert(handler !== undefined, 0x7eb /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic attachTreeDeltaHandler(handler: IDeltaHandler): void {\n\t\tassert(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this._handler !== undefined;\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\t// Drop v1 ops\n\t\tassert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);\n\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.handler.process(message, local, localOpMetadata);\n\t}\n\n\t// No idea whether any of the below 4 methods work as expected\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.handler.setConnectionState(connected);\n\t}\n\n\t// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.reSubmit(contents, localOpMetadata);\n\t}\n\n\t// We are not capable of applying stashed v1 ops.\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.handler.applyStashedOp(contents);\n\t}\n\n\t/**\n\t * We cannot rollback v1 ops, we have already migrated and are in v2 state, thus we should not be able to generate.\n\t * v1 ops\n\t */\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.rollback?.(contents, localOpMetadata);\n\t}\n\n\t/**\n\t * The SharedTreeShimDeltaHandler is already in a v2 state. Thus it should drop all v1 and migrate ops.\n\t * @param contents - the interrogable op contents to figure out if this is a v1 op, a migrate op, or a v2 op.\n\t * @returns whether or not the op is a v1 or migrate op and should be dropped/ignored.\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x834 /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { type
|
|
7
|
-
import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type
|
|
6
|
+
import { type IChannelAttributes, type IChannelFactory, type IChannelServices, type IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
7
|
+
import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type ISummaryTreeWithStats, type ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
8
8
|
import { type ITree } from '@fluidframework/tree';
|
|
9
9
|
import { type IShim } from './types.js';
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"sharedTreeShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,KAAK,sCAAsC,EAC3C,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;GAUG;AACH,qBAAa,cAAe,YAAW,KAAK;aAE1B,EAAE,EAAE,MAAM;aACV,OAAO,EAAE,sBAAsB;aAC/B,iBAAiB,EAAE,eAAe;gBAFlC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,eAAe;IAMnD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA6B;IACrE,OAAO,CAAC,QAAQ,CAAC,CAAmB;IACpC,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,IAAW,WAAW,IAAI,KAAK,CAG9B;IAED,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAEM,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,IAAW,cAAc,IAAI,cAAc,CAE1C;IACM,gBAAgB,CACtB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,EAC9B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,EAChC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,SAAS,GAC9C,qBAAqB;IAGX,SAAS,CACrB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,EAC9B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,EAChC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,SAAS,EAChD,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,OAAO,CAAC,qBAAqB,CAAC;IAG1B,UAAU,IAAI,OAAO;IAGrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAMnC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAerD,MAAM,IAAI,IAAI;IAIrB,OAAO,CAAC,wBAAwB;IAczB,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,sBAAsB;CAGtE"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.SharedTreeShim = void 0;
|
|
4
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
5
|
-
const
|
|
6
|
-
const shimChannelServices_js_1 = require("./shimChannelServices.js");
|
|
9
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
7
10
|
const sharedTreeDeltaHandler_js_1 = require("./sharedTreeDeltaHandler.js");
|
|
11
|
+
const shimChannelServices_js_1 = require("./shimChannelServices.js");
|
|
8
12
|
const shimDeltaConnection_js_1 = require("./shimDeltaConnection.js");
|
|
9
13
|
const shimHandle_js_1 = require("./shimHandle.js");
|
|
10
14
|
/**
|
|
@@ -27,7 +31,7 @@ class SharedTreeShim {
|
|
|
27
31
|
this.handle = new shimHandle_js_1.ShimHandle(this);
|
|
28
32
|
}
|
|
29
33
|
get currentTree() {
|
|
30
|
-
(0,
|
|
34
|
+
(0, internal_1.assert)(this._currentTree !== undefined, 0x7ed /* No current tree initialized */);
|
|
31
35
|
return this._currentTree;
|
|
32
36
|
}
|
|
33
37
|
get attributes() {
|
|
@@ -62,7 +66,7 @@ class SharedTreeShim {
|
|
|
62
66
|
this._currentTree = this.sharedTreeFactory.create(this.runtime, this.id);
|
|
63
67
|
}
|
|
64
68
|
generateShimServicesOnce(services) {
|
|
65
|
-
(0,
|
|
69
|
+
(0, internal_1.assert)(this.services === undefined, 0x7ee /* Already connected */);
|
|
66
70
|
this.services = services;
|
|
67
71
|
const shimServices = {
|
|
68
72
|
objectStorage: this.services.objectStorage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShim.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sharedTreeShim.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AAEpE,kEAA6D;AAe7D,2EAAyE;AACzE,qEAA8F;AAC9F,qEAAgE;AAChE,mDAA6C;AAG7C;;;;;;;;;;GAUG;AACH,MAAa,cAAc;IAC1B,YACiB,EAAU,EACV,OAA+B,EAC/B,iBAAkC;QAFlC,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAwB;QAC/B,sBAAiB,GAAjB,iBAAiB,CAAiB;QAElD,IAAI,CAAC,uBAAuB,GAAG,IAAI,sDAA0B,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,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CACrD,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,EAAE,EACP,YAAY,EACZ,IAAI,CAAC,iBAAiB,CAAC,UAAU,CACjC,CAAU,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAU,CAAC;IACnF,CAAC;IAEO,wBAAwB,CAAC,QAA0B;QAC1D,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,YAAY,GAAG;YACpB,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,eAAe,EAAE,IAAI,6CAAoB,CACxC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAC7B,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,iBAAiB,CAAC,UAAU,CACjC;SACD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACD;AAtFD,wCAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IChannelServices,\n\ttype IFluidDataStoreRuntime,\n} from '@fluidframework/datastore-definitions';\nimport {\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype IGarbageCollectionData,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n} from '@fluidframework/runtime-definitions';\nimport { type ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShimDeltaHandler } from './sharedTreeDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport { type IShim } from './types.js';\n\n/**\n * SharedTreeShim is loaded by clients that join after the migration completes, and holds the new SharedTree.\n *\n * @remarks\n *\n * Its sole responsibility should be to drop v1 & migrate ops. It should not be responsible for any other migration\n * logic. This should make the classes easier to reason about.\n * about.\n *\n * @internal\n */\nexport class SharedTreeShim implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly sharedTreeFactory: IChannelFactory\n\t) {\n\t\tthis.newTreeShimDeltaHandler = new SharedTreeShimDeltaHandler(sharedTreeFactory.attributes);\n\t\tthis.handle = new ShimHandle<SharedTreeShim>(this);\n\t}\n\n\tprivate readonly newTreeShimDeltaHandler: SharedTreeShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate _currentTree?: ITree;\n\tpublic get currentTree(): ITree {\n\t\tassert(this._currentTree !== undefined, 0x7ed /* No current tree initialized */);\n\t\treturn this._currentTree;\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\n\tpublic handle: IFluidHandle<SharedTreeShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\treturn this.currentTree.connect(shimServices);\n\t}\n\n\t// The goal here is to mimic the SharedObject.load functionality\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\t// This weird shimServices logic is to enable rehydration of the SharedTreeShim from a snapshot in a detached\n\t\t// state.\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._currentTree = (await this.sharedTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.sharedTreeFactory.attributes\n\t\t)) as ITree;\n\t}\n\n\tpublic create(): void {\n\t\tthis._currentTree = this.sharedTreeFactory.create(this.runtime, this.id) as ITree;\n\t}\n\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(this.services === undefined, 0x7ee /* Already connected */);\n\t\tthis.services = services;\n\t\tconst shimServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.newTreeShimDeltaHandler,\n\t\t\t\tthis.sharedTreeFactory.attributes\n\t\t\t),\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type IChannelAttributes, type
|
|
5
|
+
import { type IChannelAttributes, type IChannelFactory, type IChannelServices, type IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
6
6
|
import { SharedTreeShim } from './sharedTreeShim.js';
|
|
7
7
|
/**
|
|
8
8
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedTreeShim}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,
|
|
1
|
+
{"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,eAAe;IAE5D;;;;;OAKG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;;;OAIG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQ1B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.SharedTreeShimFactory = void 0;
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const sharedTreeShim_js_1 = require("./sharedTreeShim.js");
|
|
10
10
|
const utils_js_1 = require("./utils.js");
|
|
11
11
|
/**
|
|
@@ -50,7 +50,7 @@ class SharedTreeShimFactory {
|
|
|
50
50
|
*/
|
|
51
51
|
async load(runtime, id, services, attributes) {
|
|
52
52
|
// TODO: remove attributes check and move it to an automated test that constructing a SharedTreeShimFactory and checking its attributes/type matches the oldFactory.
|
|
53
|
-
(0,
|
|
53
|
+
(0, internal_1.assert)((0, utils_js_1.attributesMatch)(attributes, this.factory.attributes), 0x7ef /* Attributes do not match */);
|
|
54
54
|
const sharedTreeShim = new sharedTreeShim_js_1.SharedTreeShim(id, runtime, this.factory);
|
|
55
55
|
await sharedTreeShim.load(services);
|
|
56
56
|
return sharedTreeShim;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"sharedTreeShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAQ7D,2DAAqD;AACrD,yCAA6C;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACjC,YAAoC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEhE;;;;;OAKG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,oKAAoK;QACpK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClG,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AApDD,sDAoDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IChannelServices,\n\ttype IFluidDataStoreRuntime,\n} from '@fluidframework/datastore-definitions';\n\nimport { SharedTreeShim } from './sharedTreeShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedTreeShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * Note: There may be a need for 3 different factories for different parts of the migration.\n * That or three different shims. Potentially we can just do 2 as 2 and 3 can be combined.\n * 1. pre-migration\n * 2. after a summary has been generated but there may still be potential v1 ops\n * 3. post-migration after a summary has been generated and the msn has moved far enough forward for only v2 ops\n *\n * @sealed\n * @internal\n */\nexport class SharedTreeShimFactory implements IChannelFactory {\n\tpublic constructor(private readonly factory: IChannelFactory) {}\n\n\t/**\n\t * Can only load the new SharedTree - this allows our snapshots to be simple. We do not have to consider any new\n\t * unique snapshot formats and how to load from them.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.factory.type;\n\t}\n\n\t/**\n\t * Should be the new SharedTree attributes - this should indicate what type of tree snapshot we are expecting or\n\t * are capable of loading from.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.factory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the SharedTreeShim from a new SharedTree snapshot only.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<SharedTreeShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a SharedTreeShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.factory.attributes), 0x7ef /* Attributes do not match */);\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tawait sharedTreeShim.load(services);\n\t\treturn sharedTreeShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Should be only creating the SharedTreeShim, which will only generate a new SharedTree snapshot. That way we do\n\t * not have the capability of accidentally creating a LegacySharedTree snapshot.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeShim {\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tsharedTreeShim.create();\n\t\treturn sharedTreeShim;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type IChannelServices, type IChannelStorageService, type IDeltaConnection } from '@fluidframework/datastore-definitions';
|
|
6
6
|
/**
|
|
7
7
|
* ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection
|
|
8
8
|
* object in place of the original deltaConnection object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;gBAC5C,eAAe,EAAE,gBAAgB;IAIpD,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IACD,SAAgB,aAAa,EAAE,sBAAsB,CAAC;CACtD"}
|