@fluid-experimental/tree 2.0.0-rc.1.0.3 → 2.0.0-rc.2.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/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +4 -0
- package/api-report/experimental-tree.api.md +4 -15
- package/dist/ChangeCompression.d.ts +5 -5
- package/dist/ChangeCompression.d.ts.map +1 -1
- package/dist/ChangeCompression.js +24 -24
- package/dist/ChangeCompression.js.map +1 -1
- package/dist/ChangeTypes.d.ts +3 -3
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +9 -9
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +7 -7
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +27 -27
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +2 -2
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +3 -3
- package/dist/EagerCheckout.d.ts.map +1 -1
- package/dist/EagerCheckout.js +2 -2
- package/dist/EagerCheckout.js.map +1 -1
- package/dist/EditLog.d.ts +4 -6
- 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 +6 -6
- package/dist/EditUtilities.d.ts.map +1 -1
- package/dist/EditUtilities.js +28 -28
- package/dist/EditUtilities.js.map +1 -1
- package/dist/Forest.d.ts +2 -2
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +13 -13
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +3 -3
- package/dist/HistoryEditFactory.d.ts.map +1 -1
- package/dist/HistoryEditFactory.js +36 -36
- package/dist/HistoryEditFactory.js.map +1 -1
- package/dist/IdConversion.d.ts +3 -3
- package/dist/IdConversion.d.ts.map +1 -1
- package/dist/IdConversion.js +23 -23
- package/dist/IdConversion.js.map +1 -1
- package/dist/InitialTree.d.ts +1 -1
- package/dist/InitialTree.d.ts.map +1 -1
- package/dist/InitialTree.js +2 -2
- package/dist/InitialTree.js.map +1 -1
- package/dist/LazyCheckout.d.ts +5 -5
- package/dist/LazyCheckout.d.ts.map +1 -1
- package/dist/LazyCheckout.js +2 -2
- package/dist/LazyCheckout.js.map +1 -1
- package/dist/LogViewer.d.ts +7 -7
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +25 -25
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js +32 -32
- package/dist/MergeHealth.js.map +1 -1
- package/dist/NodeIdUtilities.d.ts +3 -3
- package/dist/NodeIdUtilities.d.ts.map +1 -1
- package/dist/NodeIdUtilities.js +4 -4
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.d.ts +1 -1
- package/dist/PayloadUtilities.d.ts.map +1 -1
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/ReconciliationPath.d.ts +3 -3
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.js +5 -5
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +5 -5
- package/dist/RevisionView.d.ts.map +1 -1
- package/dist/RevisionView.js +11 -11
- package/dist/RevisionView.js.map +1 -1
- package/dist/SerializationUtilities.d.ts +4 -4
- package/dist/SerializationUtilities.d.ts.map +1 -1
- package/dist/SerializationUtilities.js +5 -5
- package/dist/SerializationUtilities.js.map +1 -1
- package/dist/SharedTree.d.ts +15 -18
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +154 -166
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +8 -8
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +67 -67
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/StringInterner.d.ts +1 -1
- package/dist/StringInterner.d.ts.map +1 -1
- package/dist/StringInterner.js +2 -2
- package/dist/StringInterner.js.map +1 -1
- package/dist/Summary.d.ts +4 -4
- 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 +3 -3
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js +13 -13
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +2 -2
- package/dist/SummaryTestUtilities.d.ts.map +1 -1
- package/dist/SummaryTestUtilities.js.map +1 -1
- package/dist/Transaction.d.ts +4 -4
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +10 -10
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.d.ts +7 -7
- package/dist/TransactionInternal.d.ts.map +1 -1
- package/dist/TransactionInternal.js +87 -87
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeCompressor.d.ts +4 -4
- package/dist/TreeCompressor.d.ts.map +1 -1
- package/dist/TreeCompressor.js +6 -6
- package/dist/TreeCompressor.js.map +1 -1
- package/dist/TreeNodeHandle.d.ts +3 -3
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js +5 -5
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +3 -3
- package/dist/TreeView.d.ts.map +1 -1
- package/dist/TreeView.js +10 -10
- package/dist/TreeView.js.map +1 -1
- package/dist/TreeViewUtilities.d.ts +2 -2
- package/dist/TreeViewUtilities.d.ts.map +1 -1
- package/dist/TreeViewUtilities.js +3 -3
- package/dist/TreeViewUtilities.js.map +1 -1
- package/dist/UndoRedoHandler.d.ts +2 -2
- package/dist/UndoRedoHandler.d.ts.map +1 -1
- package/dist/UndoRedoHandler.js +5 -5
- package/dist/UndoRedoHandler.js.map +1 -1
- package/dist/UuidUtilities.d.ts +1 -1
- package/dist/UuidUtilities.d.ts.map +1 -1
- package/dist/UuidUtilities.js +3 -3
- package/dist/UuidUtilities.js.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.js +4 -4
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +2 -2
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +78 -78
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/IdRange.d.ts +1 -1
- package/dist/id-compressor/IdRange.d.ts.map +1 -1
- package/dist/id-compressor/IdRange.js.map +1 -1
- package/dist/id-compressor/NumericUuid.d.ts +1 -1
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
- package/dist/id-compressor/NumericUuid.js +6 -6
- package/dist/id-compressor/NumericUuid.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts +2 -2
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js +14 -14
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/id-compressor/index.d.ts +4 -4
- package/dist/id-compressor/index.d.ts.map +1 -1
- package/dist/id-compressor/index.js +11 -11
- package/dist/id-compressor/index.js.map +1 -1
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +1 -1
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -1
- package/dist/id-compressor/persisted-types/index.d.ts +1 -1
- package/dist/id-compressor/persisted-types/index.d.ts.map +1 -1
- package/dist/id-compressor/persisted-types/index.js.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -73
- package/dist/index.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 +5 -8
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +1 -1
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +1 -1
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js +2 -5
- package/dist/migration-shim/sharedTreeDeltaHandler.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/package.json +3 -0
- 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 +4 -4
- package/dist/persisted-types/0.1.1.d.ts.map +1 -1
- package/dist/persisted-types/0.1.1.js +13 -13
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/dist/persisted-types/index.d.ts +2 -2
- package/dist/persisted-types/index.d.ts.map +1 -1
- package/dist/persisted-types/index.js +13 -13
- package/dist/persisted-types/index.js.map +1 -1
- package/dist/tree-alpha.d.ts +5 -8
- package/dist/tree-beta.d.ts +5 -1
- package/dist/tree-public.d.ts +5 -1
- package/dist/tree-untrimmed.d.ts +5 -8
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/ChangeCompression.d.ts +5 -5
- package/lib/ChangeCompression.d.ts.map +1 -1
- package/lib/ChangeCompression.js +3 -3
- package/lib/ChangeCompression.js.map +1 -1
- package/lib/ChangeTypes.d.ts +3 -3
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/ChangeTypes.js +3 -3
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +7 -7
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +6 -6
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +2 -2
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +3 -3
- package/lib/EagerCheckout.d.ts.map +1 -1
- package/lib/EagerCheckout.js +1 -1
- package/lib/EagerCheckout.js.map +1 -1
- package/lib/EditLog.d.ts +4 -6
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +1 -1
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +6 -6
- package/lib/EditUtilities.d.ts.map +1 -1
- package/lib/EditUtilities.js +7 -7
- package/lib/EditUtilities.js.map +1 -1
- package/lib/Forest.d.ts +2 -2
- 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 +3 -3
- package/lib/HistoryEditFactory.d.ts.map +1 -1
- package/lib/HistoryEditFactory.js +7 -7
- package/lib/HistoryEditFactory.js.map +1 -1
- package/lib/IdConversion.d.ts +3 -3
- package/lib/IdConversion.d.ts.map +1 -1
- package/lib/IdConversion.js +4 -4
- package/lib/IdConversion.js.map +1 -1
- package/lib/InitialTree.d.ts +1 -1
- package/lib/InitialTree.d.ts.map +1 -1
- package/lib/InitialTree.js +1 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LazyCheckout.d.ts +5 -5
- package/lib/LazyCheckout.d.ts.map +1 -1
- package/lib/LazyCheckout.js +1 -1
- package/lib/LazyCheckout.js.map +1 -1
- package/lib/LogViewer.d.ts +7 -7
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +4 -4
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js +5 -5
- package/lib/MergeHealth.js.map +1 -1
- package/lib/NodeIdUtilities.d.ts +3 -3
- package/lib/NodeIdUtilities.d.ts.map +1 -1
- package/lib/NodeIdUtilities.js +2 -2
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/PayloadUtilities.d.ts +1 -1
- package/lib/PayloadUtilities.d.ts.map +1 -1
- package/lib/PayloadUtilities.js.map +1 -1
- package/lib/ReconciliationPath.d.ts +3 -3
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.js +1 -1
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +5 -5
- package/lib/RevisionView.d.ts.map +1 -1
- package/lib/RevisionView.js +3 -3
- package/lib/RevisionView.js.map +1 -1
- package/lib/SerializationUtilities.d.ts +4 -4
- package/lib/SerializationUtilities.d.ts.map +1 -1
- package/lib/SerializationUtilities.js +1 -1
- package/lib/SerializationUtilities.js.map +1 -1
- package/lib/SharedTree.d.ts +15 -18
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +28 -40
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +8 -8
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +12 -12
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/StringInterner.d.ts +1 -1
- package/lib/StringInterner.d.ts.map +1 -1
- package/lib/StringInterner.js +1 -1
- package/lib/StringInterner.js.map +1 -1
- package/lib/Summary.d.ts +4 -4
- 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 +3 -3
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js +3 -3
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +2 -2
- package/lib/SummaryTestUtilities.d.ts.map +1 -1
- package/lib/SummaryTestUtilities.js.map +1 -1
- package/lib/Transaction.d.ts +4 -4
- package/lib/Transaction.d.ts.map +1 -1
- package/lib/Transaction.js +5 -5
- package/lib/Transaction.js.map +1 -1
- package/lib/TransactionInternal.d.ts +7 -7
- package/lib/TransactionInternal.d.ts.map +1 -1
- package/lib/TransactionInternal.js +5 -5
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/TreeCompressor.d.ts +4 -4
- 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 +3 -3
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js +1 -1
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +3 -3
- package/lib/TreeView.d.ts.map +1 -1
- package/lib/TreeView.js +3 -3
- package/lib/TreeView.js.map +1 -1
- package/lib/TreeViewUtilities.d.ts +2 -2
- package/lib/TreeViewUtilities.d.ts.map +1 -1
- package/lib/TreeViewUtilities.js +1 -1
- package/lib/TreeViewUtilities.js.map +1 -1
- package/lib/UndoRedoHandler.d.ts +2 -2
- package/lib/UndoRedoHandler.d.ts.map +1 -1
- package/lib/UndoRedoHandler.js +2 -2
- package/lib/UndoRedoHandler.js.map +1 -1
- package/lib/UuidUtilities.d.ts +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.js +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +2 -2
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +6 -6
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/IdRange.d.ts +1 -1
- package/lib/id-compressor/IdRange.d.ts.map +1 -1
- package/lib/id-compressor/IdRange.js.map +1 -1
- package/lib/id-compressor/NumericUuid.d.ts +1 -1
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
- package/lib/id-compressor/NumericUuid.js +2 -2
- package/lib/id-compressor/NumericUuid.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts +2 -2
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js +2 -2
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/id-compressor/index.d.ts +4 -4
- package/lib/id-compressor/index.d.ts.map +1 -1
- package/lib/id-compressor/index.js +3 -3
- package/lib/id-compressor/index.js.map +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -1
- package/lib/id-compressor/persisted-types/index.d.ts +1 -1
- package/lib/id-compressor/persisted-types/index.d.ts.map +1 -1
- package/lib/id-compressor/persisted-types/index.js.map +1 -1
- package/lib/index.d.ts +29 -29
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -22
- package/lib/index.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 +5 -8
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +1 -1
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +1 -1
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js +2 -5
- package/lib/migration-shim/sharedTreeDeltaHandler.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/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 +4 -4
- package/lib/persisted-types/0.1.1.d.ts.map +1 -1
- package/lib/persisted-types/0.1.1.js +2 -2
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/lib/persisted-types/index.d.ts +2 -2
- package/lib/persisted-types/index.d.ts.map +1 -1
- package/lib/persisted-types/index.js +2 -2
- package/lib/persisted-types/index.js.map +1 -1
- package/lib/test/AppendOnlySortedMap.perf.tests.js +2 -2
- package/lib/test/AppendOnlySortedMap.perf.tests.js.map +1 -1
- package/lib/test/AppendOnlySortedMap.tests.js +2 -2
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -1
- package/lib/test/ChangeCompression.tests.js +9 -9
- package/lib/test/ChangeCompression.tests.js.map +1 -1
- package/lib/test/Checkout.tests.d.ts +1 -1
- package/lib/test/Checkout.tests.d.ts.map +1 -1
- package/lib/test/Checkout.tests.js +2 -2
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Common.tests.js +1 -1
- package/lib/test/Common.tests.js.map +1 -1
- package/lib/test/EagerCheckout.tests.js +4 -4
- package/lib/test/EagerCheckout.tests.js.map +1 -1
- package/lib/test/Edit.tests.js +2 -2
- package/lib/test/Edit.tests.js.map +1 -1
- package/lib/test/EditLog.perf.tests.js +4 -4
- package/lib/test/EditLog.perf.tests.js.map +1 -1
- package/lib/test/EditLog.tests.js +3 -3
- package/lib/test/EditLog.tests.js.map +1 -1
- package/lib/test/EditUtilities.tests.js +6 -6
- package/lib/test/EditUtilities.tests.js.map +1 -1
- package/lib/test/Forest.perf.tests.js +4 -4
- package/lib/test/Forest.perf.tests.js.map +1 -1
- package/lib/test/Forest.tests.js +2 -2
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/GenericTransaction.tests.js +3 -3
- package/lib/test/GenericTransaction.tests.js.map +1 -1
- package/lib/test/HistoryEditFactory.tests.js +4 -4
- package/lib/test/HistoryEditFactory.tests.js.map +1 -1
- package/lib/test/IdCompressor.perf.tests.js +4 -4
- package/lib/test/IdCompressor.perf.tests.js.map +1 -1
- package/lib/test/IdCompressor.tests.js +7 -7
- package/lib/test/IdCompressor.tests.js.map +1 -1
- package/lib/test/IdConversion.tests.js +3 -3
- package/lib/test/IdConversion.tests.js.map +1 -1
- package/lib/test/LazyCheckout.tests.js +4 -4
- package/lib/test/LazyCheckout.tests.js.map +1 -1
- package/lib/test/LogViewer.tests.js +12 -12
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +6 -6
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -1
- package/lib/test/NumericUuid.perf.tests.js +3 -3
- package/lib/test/NumericUuid.perf.tests.js.map +1 -1
- package/lib/test/NumericUuid.tests.js +4 -4
- package/lib/test/NumericUuid.tests.js.map +1 -1
- package/lib/test/RevisionValueCache.tests.js +2 -2
- package/lib/test/RevisionValueCache.tests.js.map +1 -1
- package/lib/test/RevisionView.tests.js +6 -6
- package/lib/test/RevisionView.tests.js.map +1 -1
- package/lib/test/SessionIdNormalizer.tests.js +3 -3
- package/lib/test/SessionIdNormalizer.tests.js.map +1 -1
- package/lib/test/SharedTree.fuzz.tests.js +1 -1
- package/lib/test/SharedTree.fuzz.tests.js.map +1 -1
- package/lib/test/SharedTree.perf.tests.js +2 -2
- package/lib/test/SharedTree.perf.tests.js.map +1 -1
- package/lib/test/SharedTree.tests.js +7 -7
- package/lib/test/SharedTree.tests.js.map +1 -1
- package/lib/test/StringInterner.tests.js +1 -1
- package/lib/test/StringInterner.tests.js.map +1 -1
- package/lib/test/Summary.tests.d.ts +2 -2
- package/lib/test/Summary.tests.d.ts.map +1 -1
- package/lib/test/Summary.tests.js +14 -14
- package/lib/test/Summary.tests.js.map +1 -1
- package/lib/test/Transaction.tests.js +5 -5
- package/lib/test/Transaction.tests.js.map +1 -1
- package/lib/test/TransactionInternal.tests.js +7 -7
- package/lib/test/TransactionInternal.tests.js.map +1 -1
- package/lib/test/TreeCompression.tests.js +8 -8
- package/lib/test/TreeCompression.tests.js.map +1 -1
- package/lib/test/TreeView.tests.js +3 -3
- package/lib/test/TreeView.tests.js.map +1 -1
- package/lib/test/UndoRedoHandler.tests.js +2 -2
- package/lib/test/UndoRedoHandler.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +1 -1
- package/lib/test/fuzz/Generators.d.ts.map +1 -1
- package/lib/test/fuzz/Generators.js +4 -4
- package/lib/test/fuzz/Generators.js.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +5 -5
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
- package/lib/test/fuzz/Types.d.ts +6 -6
- package/lib/test/fuzz/Types.d.ts.map +1 -1
- package/lib/test/fuzz/Types.js.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +6 -6
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +6 -6
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -1
- package/lib/test/utilities/MockTransaction.d.ts +4 -4
- package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
- package/lib/test/utilities/MockTransaction.js +3 -3
- package/lib/test/utilities/MockTransaction.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.js +5 -5
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts +2 -2
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +22 -22
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +10 -10
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
- package/lib/test/utilities/SummaryLoadPerfTests.js +6 -6
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -1
- package/lib/test/utilities/SummarySizeTests.d.ts +1 -1
- package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -1
- package/lib/test/utilities/SummarySizeTests.js +5 -5
- package/lib/test/utilities/SummarySizeTests.js.map +1 -1
- package/lib/test/utilities/TestNode.d.ts +6 -6
- package/lib/test/utilities/TestNode.d.ts.map +1 -1
- package/lib/test/utilities/TestNode.js +5 -5
- package/lib/test/utilities/TestNode.js.map +1 -1
- package/lib/test/utilities/TestUtilities.d.ts +12 -12
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +18 -19
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +2 -2
- package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
- package/lib/test/utilities/UndoRedoTests.js +7 -7
- package/lib/test/utilities/UndoRedoTests.js.map +1 -1
- package/package.json +57 -31
- package/src/ChangeCompression.ts +7 -7
- package/src/ChangeTypes.ts +5 -5
- package/src/Checkout.ts +13 -13
- package/src/Common.ts +2 -2
- package/src/EagerCheckout.ts +3 -3
- package/src/EditLog.ts +6 -7
- package/src/EditUtilities.ts +10 -10
- package/src/Forest.ts +4 -4
- package/src/HistoryEditFactory.ts +11 -11
- package/src/IdConversion.ts +4 -4
- package/src/InitialTree.ts +3 -3
- package/src/LazyCheckout.ts +5 -5
- package/src/LogViewer.ts +8 -8
- package/src/MergeHealth.ts +6 -6
- package/src/NodeIdUtilities.ts +4 -4
- package/src/PayloadUtilities.ts +1 -1
- package/src/ReconciliationPath.ts +3 -3
- package/src/RevisionValueCache.ts +1 -1
- package/src/RevisionView.ts +7 -7
- package/src/SerializationUtilities.ts +5 -5
- package/src/SharedTree.ts +34 -54
- package/src/SharedTreeEncoder.ts +15 -15
- package/src/StringInterner.ts +2 -2
- package/src/Summary.ts +5 -5
- package/src/SummaryBackCompatibility.ts +10 -5
- package/src/SummaryTestUtilities.ts +3 -3
- package/src/Transaction.ts +8 -8
- package/src/TransactionInternal.ts +8 -8
- package/src/TreeCompressor.ts +6 -6
- package/src/TreeNodeHandle.ts +4 -4
- package/src/TreeView.ts +4 -4
- package/src/TreeViewUtilities.ts +3 -3
- package/src/UndoRedoHandler.ts +4 -4
- package/src/UuidUtilities.ts +2 -2
- package/src/id-compressor/AppendOnlySortedMap.ts +1 -1
- package/src/id-compressor/IdCompressor.ts +8 -8
- package/src/id-compressor/IdRange.ts +1 -1
- package/src/id-compressor/NumericUuid.ts +3 -3
- package/src/id-compressor/SessionIdNormalizer.ts +4 -4
- package/src/id-compressor/index.ts +4 -4
- package/src/id-compressor/persisted-types/0.0.1.ts +1 -1
- package/src/id-compressor/persisted-types/index.ts +1 -1
- package/src/index.ts +29 -29
- package/src/migration-shim/migrationDeltaHandler.ts +9 -10
- package/src/migration-shim/migrationShim.ts +7 -5
- package/src/migration-shim/migrationShimFactory.ts +4 -1
- package/src/migration-shim/sharedTreeDeltaHandler.ts +7 -6
- package/src/migration-shim/types.ts +1 -1
- package/src/persisted-types/0.0.2.ts +1 -1
- package/src/persisted-types/0.1.1.ts +4 -4
- package/src/persisted-types/index.ts +2 -2
- package/tsconfig.esnext.json +1 -2
- package/tsconfig.json +3 -0
- package/lib/test/Attach.tests.d.ts +0 -6
- package/lib/test/Attach.tests.d.ts.map +0 -1
- package/lib/test/Attach.tests.js +0 -52
- package/lib/test/Attach.tests.js.map +0 -1
package/dist/SharedTree.js
CHANGED
|
@@ -10,25 +10,25 @@ const client_utils_1 = require("@fluid-internal/client-utils");
|
|
|
10
10
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
11
11
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
12
12
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
13
|
+
const Common_js_1 = require("./Common.js");
|
|
14
|
+
const EditLog_js_1 = require("./EditLog.js");
|
|
15
|
+
const Identifiers_js_1 = require("./Identifiers.js");
|
|
16
|
+
const InitialTree_js_1 = require("./InitialTree.js");
|
|
17
|
+
const LogViewer_js_1 = require("./LogViewer.js");
|
|
18
|
+
const SummaryBackCompatibility_js_1 = require("./SummaryBackCompatibility.js");
|
|
19
|
+
const index_js_1 = require("./persisted-types/index.js");
|
|
20
|
+
const Summary_js_1 = require("./Summary.js");
|
|
21
|
+
const EditUtilities_js_1 = require("./EditUtilities.js");
|
|
22
|
+
const NodeIdUtilities_js_1 = require("./NodeIdUtilities.js");
|
|
23
|
+
const EventTypes_js_1 = require("./EventTypes.js");
|
|
24
|
+
const RevisionView_js_1 = require("./RevisionView.js");
|
|
25
|
+
const SharedTreeEncoder_js_1 = require("./SharedTreeEncoder.js");
|
|
26
|
+
const HistoryEditFactory_js_1 = require("./HistoryEditFactory.js");
|
|
27
|
+
const ChangeTypes_js_1 = require("./ChangeTypes.js");
|
|
28
|
+
const index_js_2 = require("./id-compressor/index.js");
|
|
29
|
+
const IdConversion_js_1 = require("./IdConversion.js");
|
|
30
|
+
const StringInterner_js_1 = require("./StringInterner.js");
|
|
31
|
+
const UuidUtilities_js_1 = require("./UuidUtilities.js");
|
|
32
32
|
/**
|
|
33
33
|
* Factory for SharedTree.
|
|
34
34
|
* Includes history in the summary.
|
|
@@ -78,12 +78,12 @@ class SharedTreeFactory {
|
|
|
78
78
|
createSharedTree(runtime, id) {
|
|
79
79
|
const [writeFormat] = this.args;
|
|
80
80
|
switch (writeFormat) {
|
|
81
|
-
case
|
|
81
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
82
82
|
return new SharedTree(runtime, id, ...this.args);
|
|
83
|
-
case
|
|
83
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
84
84
|
return new SharedTree(runtime, id, ...this.args);
|
|
85
85
|
default:
|
|
86
|
-
(0,
|
|
86
|
+
(0, Common_js_1.fail)('Unknown write format');
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -107,7 +107,7 @@ const snapshotFileName = 'header';
|
|
|
107
107
|
/**
|
|
108
108
|
* Used for version comparison.
|
|
109
109
|
*/
|
|
110
|
-
const sortedWriteVersions = [
|
|
110
|
+
const sortedWriteVersions = [index_js_1.WriteFormat.v0_0_2, index_js_1.WriteFormat.v0_1_1];
|
|
111
111
|
const sharedTreeTelemetryProperties = { all: { isSharedTreeEvent: true } };
|
|
112
112
|
/** The SessionId of the temporary IdCompressor that records stashed ops */
|
|
113
113
|
const stashedSessionId = '8477b8d5-cf6c-4673-8345-8f076a8f9bc6';
|
|
@@ -124,7 +124,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
124
124
|
}
|
|
125
125
|
static getFactory(...args) {
|
|
126
126
|
const [formatArg, options] = args;
|
|
127
|
-
const writeFormat = formatArg ??
|
|
127
|
+
const writeFormat = formatArg ?? index_js_1.WriteFormat.v0_1_1;
|
|
128
128
|
// On 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.
|
|
129
129
|
// Note that this means staged rollout changing this value should not be attempted.
|
|
130
130
|
// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.
|
|
@@ -138,12 +138,12 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
138
138
|
*/
|
|
139
139
|
get attributionId() {
|
|
140
140
|
switch (this.writeFormat) {
|
|
141
|
-
case
|
|
142
|
-
return
|
|
141
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
142
|
+
return UuidUtilities_js_1.nilUuid;
|
|
143
143
|
default: {
|
|
144
144
|
const { attributionId } = this.idCompressor;
|
|
145
|
-
if (attributionId ===
|
|
146
|
-
return
|
|
145
|
+
if (attributionId === index_js_1.ghostSessionId) {
|
|
146
|
+
return UuidUtilities_js_1.nilUuid;
|
|
147
147
|
}
|
|
148
148
|
return attributionId;
|
|
149
149
|
}
|
|
@@ -177,7 +177,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
177
177
|
normalizeToSessionSpace: (id, sessionId) => this.idCompressor.normalizeToSessionSpace(id, sessionId),
|
|
178
178
|
};
|
|
179
179
|
// The initial tree's definition isn't included in any op by default but it should still be interned. Including it here ensures that.
|
|
180
|
-
this.interner = new
|
|
180
|
+
this.interner = new StringInterner_js_1.MutableStringInterner([InitialTree_js_1.initialTree.definition]);
|
|
181
181
|
this.processEditResult = (editResult, editId) => {
|
|
182
182
|
// TODO:#44859: Invalid results should be handled by the app
|
|
183
183
|
this.emit(SharedTree.eventFromEditResult(editResult), editId);
|
|
@@ -191,7 +191,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
191
191
|
reconciliationPath,
|
|
192
192
|
outcome: result,
|
|
193
193
|
};
|
|
194
|
-
this.emit(
|
|
194
|
+
this.emit(EventTypes_js_1.SharedTreeEvent.SequencedEditApplied, eventArguments);
|
|
195
195
|
};
|
|
196
196
|
const historyPolicy = this.getHistoryPolicy(options);
|
|
197
197
|
this.summarizeHistory = historyPolicy.summarizeHistory;
|
|
@@ -219,17 +219,17 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
219
219
|
};
|
|
220
220
|
})();
|
|
221
221
|
const idCompressorLoger = (0, telemetry_utils_1.createSampledLogger)(this.logger, idCompressorEventSampler);
|
|
222
|
-
this.idCompressor = new
|
|
222
|
+
this.idCompressor = new index_js_2.IdCompressor((0, index_js_2.createSessionId)(), index_js_1.reservedIdCount, attributionId, idCompressorLoger);
|
|
223
223
|
this.editLogSize = options.inMemoryHistorySize;
|
|
224
224
|
this.editEvictionFrequency = options.inMemoryHistorySize;
|
|
225
225
|
const { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary({
|
|
226
226
|
editChunks: [],
|
|
227
227
|
editIds: [],
|
|
228
|
-
}, undefined, this.idCompressor, this.processEditResult, this.processSequencedEditResult,
|
|
228
|
+
}, undefined, this.idCompressor, this.processEditResult, this.processSequencedEditResult, index_js_1.WriteFormat.v0_1_1);
|
|
229
229
|
this.editLog = editLog;
|
|
230
230
|
this.cachingLogViewer = cachingLogViewer;
|
|
231
|
-
this.encoder_0_0_2 = new
|
|
232
|
-
this.encoder_0_1_1 = new
|
|
231
|
+
this.encoder_0_0_2 = new SharedTreeEncoder_js_1.SharedTreeEncoder_0_0_2(this.summarizeHistory);
|
|
232
|
+
this.encoder_0_1_1 = new SharedTreeEncoder_js_1.SharedTreeEncoder_0_1_1(this.summarizeHistory);
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* The write format version currently used by this `SharedTree`. This is always initialized to the write format
|
|
@@ -295,7 +295,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
295
295
|
* The result is safe to persist and re-use across `SharedTree` instances, unlike `NodeId`.
|
|
296
296
|
*/
|
|
297
297
|
convertToStableNodeId(id) {
|
|
298
|
-
return this.idCompressor.tryDecompress(id) ?? (0,
|
|
298
|
+
return this.idCompressor.tryDecompress(id) ?? (0, Common_js_1.fail)('Node id is not known to this SharedTree');
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
* Given a NodeId, attempt to return the corresponding stable ID.
|
|
@@ -314,7 +314,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
314
314
|
* `id` was at some point generated by an instance of this SharedTree.
|
|
315
315
|
*/
|
|
316
316
|
convertToNodeId(id) {
|
|
317
|
-
return (this.idCompressor.tryRecompress(id) ?? (0,
|
|
317
|
+
return (this.idCompressor.tryRecompress(id) ?? (0, Common_js_1.fail)('Stable node id is not known to this SharedTree'));
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
320
|
* Given a stable ID, return the corresponding NodeId or return undefined if the supplied stable ID was never generated with this tree,
|
|
@@ -332,12 +332,12 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
332
332
|
*/
|
|
333
333
|
attributeNodeId(id) {
|
|
334
334
|
switch (this.writeFormat) {
|
|
335
|
-
case
|
|
336
|
-
return
|
|
335
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
336
|
+
return UuidUtilities_js_1.nilUuid;
|
|
337
337
|
default: {
|
|
338
338
|
const attributionId = this.idCompressor.attributeId(id);
|
|
339
|
-
if (attributionId ===
|
|
340
|
-
return
|
|
339
|
+
if (attributionId === index_js_1.ghostSessionId) {
|
|
340
|
+
return UuidUtilities_js_1.nilUuid;
|
|
341
341
|
}
|
|
342
342
|
return attributionId;
|
|
343
343
|
}
|
|
@@ -365,7 +365,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
365
365
|
// ever invoked on a DataObject containing local changes when it is attached for the first time. In post-attach flows, an extra
|
|
366
366
|
// instance of the DataObject is created for generating summaries and will never have local edits.
|
|
367
367
|
if (this.editLog.numberOfLocalEdits > 0) {
|
|
368
|
-
if (this.writeFormat ===
|
|
368
|
+
if (this.writeFormat === index_js_1.WriteFormat.v0_1_1) {
|
|
369
369
|
// Since we're the first client to attach, we can safely finalize ourselves since we're the only ones who have made IDs.
|
|
370
370
|
this.idCompressor.finalizeCreationRange(this.idCompressor.takeNextCreationRange());
|
|
371
371
|
for (const edit of this.editLog.getLocalEdits()) {
|
|
@@ -383,16 +383,16 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
383
383
|
*/
|
|
384
384
|
saveSerializedSummary(options) {
|
|
385
385
|
const { serializer } = options ?? {};
|
|
386
|
-
return (0,
|
|
386
|
+
return (0, Summary_js_1.serialize)(this.saveSummary(), serializer ?? this.serializer, this.handle);
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
389
|
* Initialize shared tree with a serialized summary. This is used for testing.
|
|
390
390
|
* @returns Statistics about the loaded summary.
|
|
391
391
|
*/
|
|
392
392
|
loadSerializedSummary(blobData) {
|
|
393
|
-
const summary = (0,
|
|
393
|
+
const summary = (0, SummaryBackCompatibility_js_1.deserialize)(blobData, this.serializer);
|
|
394
394
|
this.loadSummary(summary);
|
|
395
|
-
return (0,
|
|
395
|
+
return (0, SummaryBackCompatibility_js_1.getSummaryStatistics)(summary);
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
398
398
|
* Saves this SharedTree into a deserialized summary.
|
|
@@ -408,12 +408,12 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
408
408
|
generateSummary() {
|
|
409
409
|
try {
|
|
410
410
|
switch (this.writeFormat) {
|
|
411
|
-
case
|
|
411
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
412
412
|
return this.encoder_0_0_2.encodeSummary(this.editLog, this.currentView, this);
|
|
413
|
-
case
|
|
413
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
414
414
|
return this.encoder_0_1_1.encodeSummary(this.editLog, this.currentView, this, this.idNormalizer, this.interner, this.idCompressor.serialize(false));
|
|
415
415
|
default:
|
|
416
|
-
(0,
|
|
416
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
catch (error) {
|
|
@@ -430,7 +430,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
430
430
|
loadSummary(summary) {
|
|
431
431
|
const { version: loadedSummaryVersion } = summary;
|
|
432
432
|
if (isUpdateRequired(loadedSummaryVersion, this.writeFormat)) {
|
|
433
|
-
this.submitOp({ type:
|
|
433
|
+
this.submitOp({ type: index_js_1.SharedTreeOpType.Update, version: this.writeFormat });
|
|
434
434
|
this.logger.sendTelemetryEvent({
|
|
435
435
|
eventName: 'RequestVersionUpdate',
|
|
436
436
|
versionFrom: loadedSummaryVersion,
|
|
@@ -444,31 +444,31 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
444
444
|
(0, core_utils_1.assert)(this.idCompressor.getAllIdsFromLocalSession().next().done === true, 0x630 /* Summary load should not be executed after local state is created. */);
|
|
445
445
|
let convertedSummary;
|
|
446
446
|
switch (loadedSummaryVersion) {
|
|
447
|
-
case
|
|
447
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
448
448
|
convertedSummary = this.encoder_0_0_2.decodeSummary(summary, this.attributionId);
|
|
449
449
|
break;
|
|
450
|
-
case
|
|
450
|
+
case index_js_1.WriteFormat.v0_1_1: {
|
|
451
451
|
const typedSummary = summary;
|
|
452
452
|
// See comment in factory constructor--ensure we write a consistent type of summary as how the document began.
|
|
453
453
|
const loadedSummaryIncludesHistory = typedSummary.currentTree !== undefined;
|
|
454
454
|
if (loadedSummaryIncludesHistory !== this.summarizeHistory) {
|
|
455
455
|
this.summarizeHistory = loadedSummaryIncludesHistory;
|
|
456
|
-
this.encoder_0_1_1 = new
|
|
456
|
+
this.encoder_0_1_1 = new SharedTreeEncoder_js_1.SharedTreeEncoder_0_1_1(this.summarizeHistory);
|
|
457
457
|
}
|
|
458
458
|
convertedSummary = this.encoder_0_1_1.decodeSummary(summary, this.attributionId);
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
default:
|
|
462
|
-
(0,
|
|
462
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
463
463
|
}
|
|
464
464
|
const { editHistory, currentTree, idCompressor, interner } = convertedSummary;
|
|
465
465
|
this.interner = interner;
|
|
466
|
-
this.interner.getOrCreateInternedId(
|
|
467
|
-
if (compareSummaryFormatVersions(loadedSummaryVersion,
|
|
466
|
+
this.interner.getOrCreateInternedId(InitialTree_js_1.initialTree.definition);
|
|
467
|
+
if (compareSummaryFormatVersions(loadedSummaryVersion, index_js_1.WriteFormat.v0_1_1) < 0) {
|
|
468
468
|
const { editIds, editChunks } = editHistory;
|
|
469
469
|
this.logger.sendTelemetryEvent({
|
|
470
470
|
eventName: 'SummaryConversion',
|
|
471
|
-
formatVersion:
|
|
471
|
+
formatVersion: index_js_1.WriteFormat.v0_1_1,
|
|
472
472
|
historySize: editIds.length,
|
|
473
473
|
totalNumberOfChunks: editChunks.length,
|
|
474
474
|
});
|
|
@@ -477,12 +477,12 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
477
477
|
}
|
|
478
478
|
static eventFromEditResult(editStatus) {
|
|
479
479
|
switch (editStatus) {
|
|
480
|
-
case
|
|
481
|
-
return
|
|
482
|
-
case
|
|
483
|
-
return
|
|
480
|
+
case index_js_1.EditStatus.Applied:
|
|
481
|
+
return EventTypes_js_1.SharedTreeDiagnosticEvent.AppliedEdit;
|
|
482
|
+
case index_js_1.EditStatus.Invalid:
|
|
483
|
+
return EventTypes_js_1.SharedTreeDiagnosticEvent.DroppedInvalidEdit;
|
|
484
484
|
default:
|
|
485
|
-
return
|
|
485
|
+
return EventTypes_js_1.SharedTreeDiagnosticEvent.DroppedMalformedEdit;
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
@@ -495,16 +495,16 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
495
495
|
// log viewers.
|
|
496
496
|
this.cachingLogViewer?.detachFromEditLog();
|
|
497
497
|
// Use previously registered EditAddedHandlers if there is an existing EditLog.
|
|
498
|
-
const editLog = new
|
|
499
|
-
editLog.on(
|
|
500
|
-
this.emit(
|
|
498
|
+
const editLog = new EditLog_js_1.EditLog(editHistory, this.logger, this.editLog?.editAddedHandlers, this.editLogSize, this.editEvictionFrequency);
|
|
499
|
+
editLog.on(EventTypes_js_1.SharedTreeDiagnosticEvent.UnexpectedHistoryChunk, () => {
|
|
500
|
+
this.emit(EventTypes_js_1.SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);
|
|
501
501
|
});
|
|
502
502
|
let initialRevision;
|
|
503
503
|
if (currentTree !== undefined) {
|
|
504
|
-
const currentView =
|
|
504
|
+
const currentView = RevisionView_js_1.RevisionView.fromTree(currentTree);
|
|
505
505
|
initialRevision = [editLog.length, { view: currentView }];
|
|
506
506
|
}
|
|
507
|
-
const logViewer = new
|
|
507
|
+
const logViewer = new LogViewer_js_1.CachingLogViewer(editLog, RevisionView_js_1.RevisionView.fromTree(InitialTree_js_1.initialTree, this), initialRevision, editStatusCallback, sequencedEditResultCallback, 0);
|
|
508
508
|
this.editLog = editLog;
|
|
509
509
|
this.cachingLogViewer = logViewer;
|
|
510
510
|
return { editLog, cachingLogViewer: logViewer };
|
|
@@ -527,7 +527,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
527
527
|
* - state of caches
|
|
528
528
|
*/
|
|
529
529
|
equals(sharedTree) {
|
|
530
|
-
if (!(0,
|
|
530
|
+
if (!(0, EditUtilities_js_1.areRevisionViewsSemanticallyEqual)(this.currentView, this, sharedTree.currentView, sharedTree)) {
|
|
531
531
|
return false;
|
|
532
532
|
}
|
|
533
533
|
return this.editLog.equals(sharedTree.editLog);
|
|
@@ -557,29 +557,29 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
557
557
|
const op = typedMessage.contents;
|
|
558
558
|
if (op.version === undefined) {
|
|
559
559
|
// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.
|
|
560
|
-
op.version =
|
|
560
|
+
op.version = index_js_1.WriteFormat.v0_0_2;
|
|
561
561
|
}
|
|
562
562
|
const { type, version } = op;
|
|
563
563
|
const sameVersion = version === this.writeFormat;
|
|
564
564
|
// Edit and handle ops should only be processed if they're the same version as the tree write version.
|
|
565
565
|
// Update ops should only be processed if they're not the same version.
|
|
566
566
|
if (sameVersion) {
|
|
567
|
-
if (type ===
|
|
567
|
+
if (type === index_js_1.SharedTreeOpType.Handle) {
|
|
568
568
|
// Edit virtualization is no longer supported, log the event and ignore the op.
|
|
569
569
|
this.logger.sendErrorEvent({ eventName: 'UnexpectedHistoryChunk' });
|
|
570
570
|
}
|
|
571
|
-
else if (type ===
|
|
572
|
-
if (op.version ===
|
|
571
|
+
else if (type === index_js_1.SharedTreeOpType.Edit) {
|
|
572
|
+
if (op.version === index_js_1.WriteFormat.v0_1_1) {
|
|
573
573
|
this.idCompressor.finalizeCreationRange(op.idRange);
|
|
574
574
|
}
|
|
575
575
|
const edit = this.parseSequencedEdit(op);
|
|
576
|
-
if (op.version ===
|
|
576
|
+
if (op.version === index_js_1.WriteFormat.v0_1_1) {
|
|
577
577
|
this.internStringsFromEdit(edit);
|
|
578
578
|
}
|
|
579
579
|
this.processSequencedEdit(edit, typedMessage);
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
else if (type ===
|
|
582
|
+
else if (type === index_js_1.SharedTreeOpType.Update) {
|
|
583
583
|
this.processVersionUpdate(op.version);
|
|
584
584
|
}
|
|
585
585
|
else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {
|
|
@@ -589,7 +589,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
589
589
|
this.logger.sendErrorEvent({
|
|
590
590
|
eventName: 'UnexpectedNewerOpVersion',
|
|
591
591
|
}, error);
|
|
592
|
-
(0,
|
|
592
|
+
(0, Common_js_1.fail)(error);
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
595
|
/**
|
|
@@ -610,22 +610,14 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
610
610
|
parseSequencedEdit(op) {
|
|
611
611
|
// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)
|
|
612
612
|
switch (op.version) {
|
|
613
|
-
case
|
|
614
|
-
return this.encoder_0_0_2.decodeEditOp(op,
|
|
615
|
-
case
|
|
616
|
-
return this.encoder_0_1_1.decodeEditOp(op,
|
|
613
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
614
|
+
return this.encoder_0_0_2.decodeEditOp(op, (x) => x, this);
|
|
615
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
616
|
+
return this.encoder_0_1_1.decodeEditOp(op, (x) => x, this.idNormalizer, this.interner);
|
|
617
617
|
default:
|
|
618
|
-
(0,
|
|
618
|
+
(0, Common_js_1.fail)('Unknown op version');
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
encodeSemiSerializedEdit(semiSerializedEdit) {
|
|
622
|
-
// semiSerializedEdit may have handles which have been replaced by `serializer.encode`.
|
|
623
|
-
// Since there is no API to un-replace them except via parse, re-stringify the edit, then parse it.
|
|
624
|
-
// Stringify using JSON, not IFluidSerializer since OPs use JSON directly.
|
|
625
|
-
// TODO:Performance:#48025: Avoid this serialization round trip.
|
|
626
|
-
const encodedEdit = this.serializer.parse(JSON.stringify(semiSerializedEdit));
|
|
627
|
-
return encodedEdit;
|
|
628
|
-
}
|
|
629
621
|
processSequencedEdit(edit, message) {
|
|
630
622
|
const { id: editId } = edit;
|
|
631
623
|
const wasLocalEdit = this.editLog.isLocalEdit(editId);
|
|
@@ -652,7 +644,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
652
644
|
processVersionUpdate(version) {
|
|
653
645
|
if (isUpdateRequired(this.writeFormat, version)) {
|
|
654
646
|
telemetry_utils_1.PerformanceEvent.timedExec(this.logger, { eventName: 'VersionUpdate', version }, () => {
|
|
655
|
-
if (compareSummaryFormatVersions(version,
|
|
647
|
+
if (compareSummaryFormatVersions(version, index_js_1.WriteFormat.v0_1_1) >= 0) {
|
|
656
648
|
this.upgradeFrom_0_0_2_to_0_1_1();
|
|
657
649
|
}
|
|
658
650
|
else {
|
|
@@ -673,11 +665,11 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
673
665
|
}
|
|
674
666
|
upgradeFrom_0_0_2_to_0_1_1() {
|
|
675
667
|
// Reset the string interner, re-populate only with information that there is consensus on
|
|
676
|
-
this.interner = new
|
|
668
|
+
this.interner = new StringInterner_js_1.MutableStringInterner([InitialTree_js_1.initialTree.definition]);
|
|
677
669
|
const oldIdCompressor = this.idCompressor;
|
|
678
670
|
// Create the IdCompressor that will be used after the upgrade
|
|
679
|
-
const newIdCompressor = new
|
|
680
|
-
const newContext = (0,
|
|
671
|
+
const newIdCompressor = new index_js_2.IdCompressor((0, index_js_2.createSessionId)(), index_js_1.reservedIdCount, this.attributionId, this.logger);
|
|
672
|
+
const newContext = (0, NodeIdUtilities_js_1.getNodeIdContext)(newIdCompressor);
|
|
681
673
|
// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.
|
|
682
674
|
// This will allow the client to continue to use local IDs that were allocated pre-upgrade
|
|
683
675
|
for (const localId of oldIdCompressor.getAllIdsFromLocalSession()) {
|
|
@@ -685,20 +677,20 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
685
677
|
}
|
|
686
678
|
const unifyHistoricalIds = (context) => {
|
|
687
679
|
for (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {
|
|
688
|
-
const edit = this.editLog.tryGetEditAtIndex(i) ?? (0,
|
|
689
|
-
(0,
|
|
680
|
+
const edit = this.editLog.tryGetEditAtIndex(i) ?? (0, Common_js_1.fail)('edit not found');
|
|
681
|
+
(0, IdConversion_js_1.convertEditIds)(edit, (id) => context.generateNodeId(this.convertToStableNodeId(id)));
|
|
690
682
|
}
|
|
691
683
|
};
|
|
692
684
|
// Construct a temporary "ghost" compressor which is used to generate final IDs that will be consistent across all upgrading clients
|
|
693
|
-
const ghostIdCompressor = new
|
|
694
|
-
const ghostContext = (0,
|
|
685
|
+
const ghostIdCompressor = new index_js_2.IdCompressor(index_js_1.ghostSessionId, index_js_1.reservedIdCount);
|
|
686
|
+
const ghostContext = (0, NodeIdUtilities_js_1.getNodeIdContext)(ghostIdCompressor);
|
|
695
687
|
if (this.summarizeHistory) {
|
|
696
688
|
// All clients have the full history, and can therefore all "generate" the same final IDs for every ID in the history
|
|
697
689
|
// via the ghost compressor.
|
|
698
690
|
unifyHistoricalIds(ghostContext);
|
|
699
691
|
// The same logic applies to string interning, so intern all the strings in the history (superset of those in the current view)
|
|
700
692
|
for (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {
|
|
701
|
-
this.internStringsFromEdit(this.editLog.tryGetEditAtIndex(i) ?? (0,
|
|
693
|
+
this.internStringsFromEdit(this.editLog.tryGetEditAtIndex(i) ?? (0, Common_js_1.fail)('edit not found'));
|
|
702
694
|
}
|
|
703
695
|
}
|
|
704
696
|
else {
|
|
@@ -720,8 +712,8 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
720
712
|
this.idCompressor = newIdCompressor;
|
|
721
713
|
}
|
|
722
714
|
applyEdit(...changesOrArray) {
|
|
723
|
-
const changes = (0,
|
|
724
|
-
const id = (0,
|
|
715
|
+
const changes = (0, Common_js_1.unwrapRestOrArray)(changesOrArray);
|
|
716
|
+
const id = (0, EditUtilities_js_1.newEditId)();
|
|
725
717
|
const internalEdit = {
|
|
726
718
|
id,
|
|
727
719
|
changes: changes.map((c) => this.internalizeChange(c)),
|
|
@@ -746,7 +738,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
746
738
|
const convertedStableId = stableIdRemapper?.(stableId) ?? stableId;
|
|
747
739
|
return this.generateNodeId(convertedStableId);
|
|
748
740
|
};
|
|
749
|
-
return Array.from(edits, (edit) => this.applyEditInternal((0,
|
|
741
|
+
return Array.from(edits, (edit) => this.applyEditInternal((0, IdConversion_js_1.convertEditIds)(edit, (id) => idConverter(id))).id);
|
|
750
742
|
}
|
|
751
743
|
/**
|
|
752
744
|
* Applies a set of internal changes to this tree. The result will be reflected in `SharedTree.currentView`.
|
|
@@ -757,7 +749,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
757
749
|
applyEditInternal(editOrChanges) {
|
|
758
750
|
let edit;
|
|
759
751
|
if (Array.isArray(editOrChanges)) {
|
|
760
|
-
const id = (0,
|
|
752
|
+
const id = (0, EditUtilities_js_1.newEditId)();
|
|
761
753
|
edit = { id, changes: editOrChanges };
|
|
762
754
|
}
|
|
763
755
|
else {
|
|
@@ -773,59 +765,59 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
773
765
|
*/
|
|
774
766
|
internalizeChange(change) {
|
|
775
767
|
switch (change.type) {
|
|
776
|
-
case
|
|
768
|
+
case ChangeTypes_js_1.ChangeType.Insert:
|
|
777
769
|
return {
|
|
778
770
|
source: change.source,
|
|
779
|
-
destination: (0,
|
|
780
|
-
type:
|
|
771
|
+
destination: (0, EditUtilities_js_1.deepCloneStablePlace)(change.destination),
|
|
772
|
+
type: index_js_1.ChangeTypeInternal.Insert,
|
|
781
773
|
};
|
|
782
|
-
case
|
|
774
|
+
case ChangeTypes_js_1.ChangeType.Detach: {
|
|
783
775
|
const detach = {
|
|
784
|
-
source: (0,
|
|
785
|
-
type:
|
|
776
|
+
source: (0, EditUtilities_js_1.deepCloneStableRange)(change.source),
|
|
777
|
+
type: index_js_1.ChangeTypeInternal.Detach,
|
|
786
778
|
};
|
|
787
|
-
(0,
|
|
779
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, detach, 'destination');
|
|
788
780
|
return detach;
|
|
789
781
|
}
|
|
790
|
-
case
|
|
782
|
+
case ChangeTypes_js_1.ChangeType.Build: {
|
|
791
783
|
if (isTreeNodeSequence(change.source)) {
|
|
792
|
-
const source = change.source.map((buildNode) => (0,
|
|
784
|
+
const source = change.source.map((buildNode) => (0, EditUtilities_js_1.convertTreeNodes)(buildNode, (nodeData) => (0, EditUtilities_js_1.internalizeBuildNode)(nodeData, this), (x) => typeof x === 'number'));
|
|
793
785
|
return {
|
|
794
786
|
source,
|
|
795
787
|
destination: change.destination,
|
|
796
|
-
type:
|
|
788
|
+
type: index_js_1.ChangeTypeInternal.Build,
|
|
797
789
|
};
|
|
798
790
|
}
|
|
799
791
|
else {
|
|
800
|
-
const source = (0,
|
|
792
|
+
const source = (0, EditUtilities_js_1.convertTreeNodes)(change.source, (nodeData) => (0, EditUtilities_js_1.internalizeBuildNode)(nodeData, this), (x) => typeof x === 'number');
|
|
801
793
|
return {
|
|
802
794
|
source: [source],
|
|
803
795
|
destination: change.destination,
|
|
804
|
-
type:
|
|
796
|
+
type: index_js_1.ChangeTypeInternal.Build,
|
|
805
797
|
};
|
|
806
798
|
}
|
|
807
799
|
}
|
|
808
|
-
case
|
|
800
|
+
case ChangeTypes_js_1.ChangeType.SetValue:
|
|
809
801
|
return {
|
|
810
802
|
nodeToModify: change.nodeToModify,
|
|
811
803
|
payload: change.payload,
|
|
812
|
-
type:
|
|
804
|
+
type: index_js_1.ChangeTypeInternal.SetValue,
|
|
813
805
|
};
|
|
814
|
-
case
|
|
806
|
+
case ChangeTypes_js_1.ChangeType.Constraint: {
|
|
815
807
|
const constraint = {
|
|
816
808
|
effect: change.effect,
|
|
817
809
|
toConstrain: change.toConstrain,
|
|
818
|
-
type:
|
|
810
|
+
type: index_js_1.ChangeTypeInternal.Constraint,
|
|
819
811
|
};
|
|
820
|
-
(0,
|
|
821
|
-
(0,
|
|
822
|
-
(0,
|
|
823
|
-
(0,
|
|
824
|
-
(0,
|
|
812
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, constraint, 'contentHash');
|
|
813
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, constraint, 'identityHash');
|
|
814
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, constraint, 'label');
|
|
815
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, constraint, 'length');
|
|
816
|
+
(0, Common_js_1.copyPropertyIfDefined)(change, constraint, 'parentNode');
|
|
825
817
|
return constraint;
|
|
826
818
|
}
|
|
827
819
|
default:
|
|
828
|
-
(0,
|
|
820
|
+
(0, Common_js_1.fail)('unexpected change type');
|
|
829
821
|
}
|
|
830
822
|
}
|
|
831
823
|
applyEditLocally(edit, message) {
|
|
@@ -841,7 +833,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
841
833
|
local: !isSequenced,
|
|
842
834
|
tree: this,
|
|
843
835
|
};
|
|
844
|
-
this.emit(
|
|
836
|
+
this.emit(EventTypes_js_1.SharedTreeEvent.EditCommitted, eventArguments);
|
|
845
837
|
}
|
|
846
838
|
/**
|
|
847
839
|
* Reverts a previous edit by applying a new edit containing the inverse of the original edit's changes.
|
|
@@ -850,7 +842,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
850
842
|
*/
|
|
851
843
|
revert(editId) {
|
|
852
844
|
const index = this.edits.getIndexOfId(editId);
|
|
853
|
-
const edit = this.edits.tryGetEditAtIndex(index) ?? (0,
|
|
845
|
+
const edit = this.edits.tryGetEditAtIndex(index) ?? (0, Common_js_1.fail)('edit not found');
|
|
854
846
|
const before = this.logViewer.getRevisionViewInMemory(index);
|
|
855
847
|
const changes = this.revertChanges(edit.changes, before);
|
|
856
848
|
if (changes === undefined) {
|
|
@@ -865,7 +857,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
865
857
|
* @returns the inverse of `changes` or undefined if the changes could not be inverted for the given tree state.
|
|
866
858
|
*/
|
|
867
859
|
revertChanges(changes, before) {
|
|
868
|
-
return (0,
|
|
860
|
+
return (0, HistoryEditFactory_js_1.revert)(changes, before, this.logger, this.emit.bind(this));
|
|
869
861
|
}
|
|
870
862
|
/**
|
|
871
863
|
* Submits an edit by the local client to the runtime.
|
|
@@ -875,20 +867,17 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
875
867
|
// Ops will be submitted again when attached (see loadSummary())
|
|
876
868
|
if (this.isAttached()) {
|
|
877
869
|
switch (this.writeFormat) {
|
|
878
|
-
case
|
|
879
|
-
this.submitOp(this.encoder_0_0_2.encodeEditOp(edit,
|
|
870
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
871
|
+
this.submitOp(this.encoder_0_0_2.encodeEditOp(edit, (x) => x, this));
|
|
880
872
|
break;
|
|
881
|
-
case
|
|
882
|
-
this.submitOp(this.encoder_0_1_1.encodeEditOp(edit,
|
|
873
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
874
|
+
this.submitOp(this.encoder_0_1_1.encodeEditOp(edit, (x) => x, this.idCompressor.takeNextCreationRange(), this.idNormalizer, this.interner));
|
|
883
875
|
break;
|
|
884
876
|
default:
|
|
885
|
-
(0,
|
|
877
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
886
878
|
}
|
|
887
879
|
}
|
|
888
880
|
}
|
|
889
|
-
serializeEdit(preparedEdit) {
|
|
890
|
-
return this.serializer.encode(preparedEdit, this.handle);
|
|
891
|
-
}
|
|
892
881
|
/** A type-safe `submitLocalMessage` wrapper to enforce op format */
|
|
893
882
|
submitOp(content, localOpMetadata = undefined) {
|
|
894
883
|
(0, core_utils_1.assert)(compareSummaryFormatVersions(content.version, this.writeFormat) === 0, 0x631 /* Attempted to submit op of wrong version */);
|
|
@@ -902,8 +891,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
902
891
|
* When closing a container, hosts have the option to stash this pending local state somewhere to be reapplied
|
|
903
892
|
* later (to avoid data loss).
|
|
904
893
|
* If a host then loads a container using that stashed state, this function is called for each stashed op, and is expected to:
|
|
905
|
-
*
|
|
906
|
-
* 2. Return any `localOpMetadata` that would have been associated with this op.
|
|
894
|
+
* Update this DDS to reflect that state locally, and submit the op to do that.
|
|
907
895
|
*
|
|
908
896
|
* @param content - op to apply locally.
|
|
909
897
|
*/
|
|
@@ -912,33 +900,33 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
912
900
|
// occurs in this method, and the result is passed to `resubmitCore` via the return value of this function.
|
|
913
901
|
const sharedTreeOp = op;
|
|
914
902
|
switch (sharedTreeOp.type) {
|
|
915
|
-
case
|
|
903
|
+
case index_js_1.SharedTreeOpType.Edit: {
|
|
916
904
|
let stashedEdit;
|
|
917
905
|
switch (this.writeFormat) {
|
|
918
|
-
case
|
|
906
|
+
case index_js_1.WriteFormat.v0_0_2:
|
|
919
907
|
switch (sharedTreeOp.version) {
|
|
920
|
-
case
|
|
908
|
+
case index_js_1.WriteFormat.v0_0_2: {
|
|
921
909
|
stashedEdit = this.parseSequencedEdit(sharedTreeOp);
|
|
922
910
|
break;
|
|
923
911
|
}
|
|
924
|
-
case
|
|
925
|
-
(0,
|
|
912
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
913
|
+
(0, Common_js_1.fail)('Received stashed op 0.1.1 before upgrade');
|
|
926
914
|
default:
|
|
927
|
-
(0,
|
|
915
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
928
916
|
}
|
|
929
917
|
break;
|
|
930
|
-
case
|
|
918
|
+
case index_js_1.WriteFormat.v0_1_1:
|
|
931
919
|
switch (sharedTreeOp.version) {
|
|
932
|
-
case
|
|
920
|
+
case index_js_1.WriteFormat.v0_0_2: {
|
|
933
921
|
// Use the IDs from the stashed ops as overrides for the equivalent new ops
|
|
934
|
-
stashedEdit = (0,
|
|
922
|
+
stashedEdit = (0, IdConversion_js_1.convertEditIds)(sharedTreeOp.edit, (id) => this.generateNodeId(id));
|
|
935
923
|
break;
|
|
936
924
|
}
|
|
937
|
-
case
|
|
925
|
+
case index_js_1.WriteFormat.v0_1_1: {
|
|
938
926
|
(0, core_utils_1.assert)(this.stashedIdCompressor !== null, 0x632 /* Stashed op applied after expected window */);
|
|
939
927
|
if (this.stashedIdCompressor === undefined) {
|
|
940
928
|
// Use a temporary compressor that will help translate the stashed ops
|
|
941
|
-
this.stashedIdCompressor =
|
|
929
|
+
this.stashedIdCompressor = index_js_2.IdCompressor.deserialize(this.idCompressor.serialize(false), stashedSessionId, sharedTreeOp.idRange.attributionId);
|
|
942
930
|
// Once all stashed ops have been applied, clear the temporary state
|
|
943
931
|
this.runtime.on('connected', () => {
|
|
944
932
|
this.stashedIdCompressor = null;
|
|
@@ -946,7 +934,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
946
934
|
}
|
|
947
935
|
// Pretend (from the perspective of the temporary compressor) that the stashed ops have been sequenced
|
|
948
936
|
this.stashedIdCompressor.finalizeCreationRange(sharedTreeOp.idRange);
|
|
949
|
-
const stashedIdContext = (0,
|
|
937
|
+
const stashedIdContext = (0, NodeIdUtilities_js_1.getNodeIdContext)(this.stashedIdCompressor);
|
|
950
938
|
// Use a normalizer to translate all node IDs in the stashed ops
|
|
951
939
|
const normalizer = {
|
|
952
940
|
localSessionId: this.idCompressor.localSessionId,
|
|
@@ -957,38 +945,38 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
957
945
|
},
|
|
958
946
|
normalizeToOpSpace: (id) => this.idNormalizer.normalizeToOpSpace(id),
|
|
959
947
|
};
|
|
960
|
-
stashedEdit = this.encoder_0_1_1.decodeEditOp(sharedTreeOp,
|
|
948
|
+
stashedEdit = this.encoder_0_1_1.decodeEditOp(sharedTreeOp, (x) => x, normalizer, this.interner);
|
|
961
949
|
break;
|
|
962
950
|
}
|
|
963
951
|
default:
|
|
964
|
-
(0,
|
|
952
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
965
953
|
}
|
|
966
954
|
break;
|
|
967
955
|
default:
|
|
968
|
-
(0,
|
|
956
|
+
(0, Common_js_1.fail)('Unknown version');
|
|
969
957
|
}
|
|
970
|
-
this.
|
|
971
|
-
return
|
|
958
|
+
this.applyEditInternal(stashedEdit);
|
|
959
|
+
return;
|
|
972
960
|
}
|
|
973
961
|
// Handle and update ops are only acknowledged by the client that generated them upon sequencing--no local changes necessary.
|
|
974
|
-
case
|
|
975
|
-
case
|
|
976
|
-
case
|
|
977
|
-
return
|
|
962
|
+
case index_js_1.SharedTreeOpType.Handle:
|
|
963
|
+
case index_js_1.SharedTreeOpType.Update:
|
|
964
|
+
case index_js_1.SharedTreeOpType.NoOp:
|
|
965
|
+
return;
|
|
978
966
|
default:
|
|
979
|
-
(0,
|
|
967
|
+
(0, Common_js_1.fail)('Unrecognized op');
|
|
980
968
|
}
|
|
981
969
|
}
|
|
982
970
|
reSubmitCore(op, localOpMetadata) {
|
|
983
971
|
const sharedTreeOp = op;
|
|
984
972
|
switch (sharedTreeOp.type) {
|
|
985
|
-
case
|
|
973
|
+
case index_js_1.SharedTreeOpType.Edit:
|
|
986
974
|
if (compareSummaryFormatVersions(sharedTreeOp.version, this.writeFormat) > 0) {
|
|
987
|
-
(0,
|
|
975
|
+
(0, Common_js_1.fail)('Attempted to resubmit op of version newer than current version');
|
|
988
976
|
}
|
|
989
977
|
else if (localOpMetadata?.transformedEdit !== undefined) {
|
|
990
978
|
// Optimization: stashed 0.0.2 ops require no transformation in 0.0.2; don't re-encode
|
|
991
|
-
if (this.writeFormat !==
|
|
979
|
+
if (this.writeFormat !== index_js_1.WriteFormat.v0_0_2 || sharedTreeOp.version !== index_js_1.WriteFormat.v0_0_2) {
|
|
992
980
|
this.submitEditOp(localOpMetadata.transformedEdit);
|
|
993
981
|
return;
|
|
994
982
|
}
|
|
@@ -1001,7 +989,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
1001
989
|
}
|
|
1002
990
|
changeWriteFormat(newFormat) {
|
|
1003
991
|
this.writeFormat = newFormat;
|
|
1004
|
-
this.emit(
|
|
992
|
+
this.emit(EventTypes_js_1.SharedTreeDiagnosticEvent.WriteVersionChanged, newFormat);
|
|
1005
993
|
}
|
|
1006
994
|
/**
|
|
1007
995
|
* Interns all Definitions and TraitLabel_s referenced by the provided edit.
|
|
@@ -1010,17 +998,17 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
1010
998
|
*/
|
|
1011
999
|
internStringsFromEdit(edit) {
|
|
1012
1000
|
for (const change of edit.changes) {
|
|
1013
|
-
if (change.type ===
|
|
1001
|
+
if (change.type === index_js_1.ChangeTypeInternal.Build) {
|
|
1014
1002
|
for (const root of change.source) {
|
|
1015
|
-
(0,
|
|
1003
|
+
(0, EditUtilities_js_1.walkTree)(root, (node) => {
|
|
1016
1004
|
this.interner.getOrCreateInternedId(node.definition);
|
|
1017
1005
|
for (const trait of Object.keys(node.traits)) {
|
|
1018
1006
|
this.interner.getOrCreateInternedId(trait);
|
|
1019
1007
|
}
|
|
1020
|
-
},
|
|
1008
|
+
}, Identifiers_js_1.isDetachedSequenceId);
|
|
1021
1009
|
}
|
|
1022
1010
|
}
|
|
1023
|
-
else if (change.type ===
|
|
1011
|
+
else if (change.type === index_js_1.ChangeTypeInternal.Insert) {
|
|
1024
1012
|
const { referenceTrait } = change.destination;
|
|
1025
1013
|
if (referenceTrait !== undefined) {
|
|
1026
1014
|
this.interner.getOrCreateInternedId(referenceTrait.label);
|
|
@@ -1038,7 +1026,7 @@ function compareSummaryFormatVersions(versionA, versionB) {
|
|
|
1038
1026
|
const versionAIndex = sortedWriteVersions.indexOf(versionA);
|
|
1039
1027
|
const versionBIndex = sortedWriteVersions.indexOf(versionB);
|
|
1040
1028
|
if (versionAIndex === -1 || versionBIndex === -1) {
|
|
1041
|
-
(0,
|
|
1029
|
+
(0, Common_js_1.fail)('Summary version being compared cannot be read.');
|
|
1042
1030
|
}
|
|
1043
1031
|
if (versionAIndex < versionBIndex) {
|
|
1044
1032
|
return -1;
|
|
@@ -1056,7 +1044,7 @@ function compareSummaryFormatVersions(versionA, versionB) {
|
|
|
1056
1044
|
function isUpdateRequired(oldVersion, newVersion) {
|
|
1057
1045
|
const newVersionIndex = sortedWriteVersions.indexOf(newVersion);
|
|
1058
1046
|
if (newVersionIndex === -1) {
|
|
1059
|
-
(0,
|
|
1047
|
+
(0, Common_js_1.fail)('New write version is invalid.');
|
|
1060
1048
|
}
|
|
1061
1049
|
return compareSummaryFormatVersions(oldVersion, newVersion) === -1 ? true : false;
|
|
1062
1050
|
}
|