@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
|
@@ -7,18 +7,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.SharedTreeEncoder_0_0_2 = exports.SharedTreeEncoder_0_1_1 = void 0;
|
|
8
8
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
9
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
10
|
+
const Common_js_1 = require("./Common.js");
|
|
11
|
+
const EditLog_js_1 = require("./EditLog.js");
|
|
12
|
+
const EditUtilities_js_1 = require("./EditUtilities.js");
|
|
13
|
+
const InitialTree_js_1 = require("./InitialTree.js");
|
|
14
|
+
const NodeIdUtilities_js_1 = require("./NodeIdUtilities.js");
|
|
15
|
+
const SerializationUtilities_js_1 = require("./SerializationUtilities.js");
|
|
16
|
+
const index_js_1 = require("./persisted-types/index.js");
|
|
17
|
+
const StringInterner_js_1 = require("./StringInterner.js");
|
|
18
|
+
const TreeCompressor_js_1 = require("./TreeCompressor.js");
|
|
19
|
+
const index_js_2 = require("./id-compressor/index.js");
|
|
20
|
+
const ChangeCompression_js_1 = require("./ChangeCompression.js");
|
|
21
|
+
const IdConversion_js_1 = require("./IdConversion.js");
|
|
22
22
|
/**
|
|
23
23
|
* Object capable of converting between the current internal representation for 0.1.1 edits and their wire format.
|
|
24
24
|
* @internal
|
|
@@ -26,8 +26,8 @@ const IdConversion_1 = require("./IdConversion");
|
|
|
26
26
|
class SharedTreeEncoder_0_1_1 {
|
|
27
27
|
constructor(summarizeHistory) {
|
|
28
28
|
this.summarizeHistory = summarizeHistory;
|
|
29
|
-
this.treeCompressor = new
|
|
30
|
-
this.changeCompressor = new
|
|
29
|
+
this.treeCompressor = new TreeCompressor_js_1.InterningTreeCompressor();
|
|
30
|
+
this.changeCompressor = new ChangeCompression_js_1.ChangeCompressor(this.treeCompressor);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Encodes an edit op to be sent.
|
|
@@ -40,11 +40,11 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
40
40
|
// IFluidHandles are not allowed in Ops.
|
|
41
41
|
// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.
|
|
42
42
|
// So replace the handles by encoding before sending:
|
|
43
|
-
const semiSerialized = fluidSerialize((0,
|
|
43
|
+
const semiSerialized = fluidSerialize((0, ChangeCompression_js_1.compressEdit)(this.changeCompressor, interner, (0, NodeIdUtilities_js_1.scopeIdNormalizer)(idNormalizer, idRange.sessionId), edit));
|
|
44
44
|
return {
|
|
45
|
-
type:
|
|
45
|
+
type: index_js_1.SharedTreeOpType.Edit,
|
|
46
46
|
edit: semiSerialized,
|
|
47
|
-
version:
|
|
47
|
+
version: index_js_1.WriteFormat.v0_1_1,
|
|
48
48
|
idRange,
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -58,7 +58,7 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
58
58
|
decodeEditOp(op, fluidDeserialize, idNormalizer, interner) {
|
|
59
59
|
const { edit: semiSerializedEdit } = op;
|
|
60
60
|
const parsedEdit = fluidDeserialize(semiSerializedEdit);
|
|
61
|
-
return (0,
|
|
61
|
+
return (0, ChangeCompression_js_1.decompressEdit)(this.changeCompressor, interner, (0, NodeIdUtilities_js_1.scopeIdNormalizer)(idNormalizer, op.idRange.sessionId), parsedEdit);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Encodes a summary.
|
|
@@ -72,18 +72,18 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
72
72
|
* Decodes an encoded summary.
|
|
73
73
|
*/
|
|
74
74
|
decodeSummary({ editHistory, currentTree: compressedTree, internedStrings, idCompressor: serializedIdCompressor, version, }, attributionId) {
|
|
75
|
-
(0,
|
|
75
|
+
(0, Common_js_1.assertWithMessage)(version === index_js_1.WriteFormat.v0_1_1, `Invalid summary version to decode: ${version}, expected: 0.1.1`);
|
|
76
76
|
(0, core_utils_1.assert)(typeof editHistory === 'object', 0x633 /* 0.1.1 summary encountered with non-object edit history. */);
|
|
77
|
-
const idCompressor = (0,
|
|
78
|
-
?
|
|
79
|
-
:
|
|
80
|
-
const interner = new
|
|
81
|
-
const sequencedNormalizer = (0,
|
|
77
|
+
const idCompressor = (0, index_js_2.hasOngoingSession)(serializedIdCompressor)
|
|
78
|
+
? index_js_2.IdCompressor.deserialize(serializedIdCompressor)
|
|
79
|
+
: index_js_2.IdCompressor.deserialize(serializedIdCompressor, (0, index_js_2.createSessionId)(), attributionId);
|
|
80
|
+
const interner = new StringInterner_js_1.MutableStringInterner(internedStrings);
|
|
81
|
+
const sequencedNormalizer = (0, NodeIdUtilities_js_1.sequencedIdNormalizer)((0, NodeIdUtilities_js_1.getNodeIdContext)(idCompressor));
|
|
82
82
|
const decompressedTree = compressedTree !== undefined
|
|
83
83
|
? this.treeCompressor.decompress(compressedTree, interner, sequencedNormalizer)
|
|
84
84
|
: undefined;
|
|
85
85
|
const { editChunks, editIds } = editHistory;
|
|
86
|
-
(0,
|
|
86
|
+
(0, Common_js_1.assertWithMessage)(editChunks !== undefined, 'Missing editChunks on 0.1.1 summary.');
|
|
87
87
|
(0, core_utils_1.assert)(editIds !== undefined, 0x634 /* Missing editIds on 0.1.1 summary. */);
|
|
88
88
|
const uncompressedChunks = editChunks.map(({ startRevision, chunk }) => ({
|
|
89
89
|
startRevision,
|
|
@@ -98,7 +98,7 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
98
98
|
},
|
|
99
99
|
baseHandle: chunk,
|
|
100
100
|
}
|
|
101
|
-
: chunk.map((edit) => (0,
|
|
101
|
+
: chunk.map((edit) => (0, ChangeCompression_js_1.decompressEdit)(this.changeCompressor, interner, sequencedNormalizer, edit)),
|
|
102
102
|
}));
|
|
103
103
|
return {
|
|
104
104
|
currentTree: decompressedTree,
|
|
@@ -113,26 +113,26 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
113
113
|
* Writes summary format 0.1.1 which does not store the currentView for no history summaries.
|
|
114
114
|
*/
|
|
115
115
|
noHistorySummarizer(_edits, currentView, idContext, idNormalizer, interner, serializedIdCompressor) {
|
|
116
|
-
const currentTree = (0,
|
|
117
|
-
const initialTreeId = idContext.convertToNodeId(
|
|
116
|
+
const currentTree = (0, SerializationUtilities_js_1.getChangeNodeFromView)(currentView);
|
|
117
|
+
const initialTreeId = idContext.convertToNodeId(InitialTree_js_1.initialTree.identifier);
|
|
118
118
|
const changes = [];
|
|
119
119
|
// Generate a set of changes to set the root node's children to that of the root in the currentTree
|
|
120
120
|
Object.entries(currentTree.traits).forEach(([label, children]) => {
|
|
121
121
|
const id = 0;
|
|
122
|
-
changes.push(
|
|
122
|
+
changes.push(index_js_1.ChangeInternal.build(children, id), index_js_1.ChangeInternal.insert(id, index_js_1.StablePlaceInternal.atStartOf({ parent: initialTreeId, label: label })));
|
|
123
123
|
});
|
|
124
124
|
if (currentTree.payload !== undefined) {
|
|
125
|
-
changes.push(
|
|
125
|
+
changes.push(index_js_1.ChangeInternal.setPayload(initialTreeId, currentTree.payload));
|
|
126
126
|
}
|
|
127
|
-
(0, core_utils_1.assert)(currentTree.identifier === initialTreeId && currentTree.definition ===
|
|
128
|
-
const edit = (0,
|
|
129
|
-
const compressedChanges = edit.changes.map((change) => this.changeCompressor.compress(change, interner, (0,
|
|
127
|
+
(0, core_utils_1.assert)(currentTree.identifier === initialTreeId && currentTree.definition === InitialTree_js_1.initialTree.definition, 0x635 /* root definition and identifier should be immutable. */);
|
|
128
|
+
const edit = (0, EditUtilities_js_1.newEdit)(changes);
|
|
129
|
+
const compressedChanges = edit.changes.map((change) => this.changeCompressor.compress(change, interner, (0, NodeIdUtilities_js_1.sequencedIdNormalizer)(idNormalizer)));
|
|
130
130
|
return {
|
|
131
131
|
editHistory: {
|
|
132
132
|
editChunks: [{ startRevision: 0, chunk: [{ changes: compressedChanges }] }],
|
|
133
133
|
editIds: [edit.id],
|
|
134
134
|
},
|
|
135
|
-
version:
|
|
135
|
+
version: index_js_1.WriteFormat.v0_1_1,
|
|
136
136
|
internedStrings: interner.getSerializable(),
|
|
137
137
|
idCompressor: serializedIdCompressor,
|
|
138
138
|
};
|
|
@@ -142,26 +142,26 @@ class SharedTreeEncoder_0_1_1 {
|
|
|
142
142
|
* and string interning and tree compression will be applied.
|
|
143
143
|
*/
|
|
144
144
|
fullHistorySummarizer(edits, currentView, idNormalizer, interner, serializedIdCompressor) {
|
|
145
|
-
const sequencedNormalizer = (0,
|
|
146
|
-
const currentTree = this.treeCompressor.compress((0,
|
|
145
|
+
const sequencedNormalizer = (0, NodeIdUtilities_js_1.sequencedIdNormalizer)(idNormalizer);
|
|
146
|
+
const currentTree = this.treeCompressor.compress((0, SerializationUtilities_js_1.getChangeNodeFromView)(currentView), interner, sequencedNormalizer);
|
|
147
147
|
return {
|
|
148
148
|
currentTree,
|
|
149
|
-
editHistory: edits.getEditLogSummary((edit) => (0,
|
|
150
|
-
version:
|
|
149
|
+
editHistory: edits.getEditLogSummary((edit) => (0, ChangeCompression_js_1.compressEdit)(this.changeCompressor, interner, sequencedNormalizer, edit)),
|
|
150
|
+
version: index_js_1.WriteFormat.v0_1_1,
|
|
151
151
|
internedStrings: interner.getSerializable(),
|
|
152
152
|
idCompressor: serializedIdCompressor,
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
encodeEditChunk(edits, idNormalizer, interner) {
|
|
156
|
-
const compressedEdits = edits.map((edit) => (0,
|
|
156
|
+
const compressedEdits = edits.map((edit) => (0, ChangeCompression_js_1.compressEdit)(this.changeCompressor, interner, idNormalizer, edit));
|
|
157
157
|
return {
|
|
158
|
-
version:
|
|
158
|
+
version: index_js_1.WriteFormat.v0_1_1,
|
|
159
159
|
edits: compressedEdits,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
decodeEditChunk(contents, idNormalizer, interner) {
|
|
163
|
-
(0,
|
|
164
|
-
return contents.edits.map((edit) => (0,
|
|
163
|
+
(0, Common_js_1.assertWithMessage)(contents.version === index_js_1.WriteFormat.v0_1_1, `Invalid editChunk to decode: ${contents.version}. Expected 0.1.1.`);
|
|
164
|
+
return contents.edits.map((edit) => (0, ChangeCompression_js_1.decompressEdit)(this.changeCompressor, interner, idNormalizer, edit));
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
exports.SharedTreeEncoder_0_1_1 = SharedTreeEncoder_0_1_1;
|
|
@@ -184,11 +184,11 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
184
184
|
// IFluidHandles are not allowed in Ops.
|
|
185
185
|
// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.
|
|
186
186
|
// So replace the handles by encoding before sending:
|
|
187
|
-
const semiSerialized = fluidSerialize((0,
|
|
187
|
+
const semiSerialized = fluidSerialize((0, IdConversion_js_1.convertEditIds)(edit, (id) => idConverter.convertToStableNodeId(id)));
|
|
188
188
|
return {
|
|
189
|
-
type:
|
|
189
|
+
type: index_js_1.SharedTreeOpType.Edit,
|
|
190
190
|
edit: semiSerialized,
|
|
191
|
-
version:
|
|
191
|
+
version: index_js_1.WriteFormat.v0_0_2,
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
@@ -201,7 +201,7 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
201
201
|
decodeEditOp(op, fluidDeserialize, idGenerator) {
|
|
202
202
|
const { edit: semiSerializedEdit } = op;
|
|
203
203
|
const parsedEdit = fluidDeserialize(semiSerializedEdit);
|
|
204
|
-
return (0,
|
|
204
|
+
return (0, IdConversion_js_1.convertEditIds)(parsedEdit, (id) => idGenerator.generateNodeId(id));
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Encodes a summary.
|
|
@@ -216,19 +216,19 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
216
216
|
*/
|
|
217
217
|
decodeSummary({ currentTree, sequencedEdits }, attributionId) {
|
|
218
218
|
(0, core_utils_1.assert)(sequencedEdits !== undefined, 0x636 /* 0.0.2 summary encountered with missing sequencedEdits field. */);
|
|
219
|
-
const idCompressor = new
|
|
220
|
-
const idGenerator = (0,
|
|
219
|
+
const idCompressor = new index_js_2.IdCompressor((0, index_js_2.createSessionId)(), index_js_1.reservedIdCount, attributionId);
|
|
220
|
+
const idGenerator = (0, NodeIdUtilities_js_1.getNodeIdContext)(idCompressor);
|
|
221
221
|
const generateId = (id) => idGenerator.generateNodeId(id);
|
|
222
222
|
// This saves all of the edits in the summary as part of the first chunk.
|
|
223
|
-
const temporaryLog = new
|
|
224
|
-
sequencedEdits.forEach((edit) => temporaryLog.addSequencedEdit((0,
|
|
223
|
+
const temporaryLog = new EditLog_js_1.EditLog();
|
|
224
|
+
sequencedEdits.forEach((edit) => temporaryLog.addSequencedEdit((0, IdConversion_js_1.convertEditIds)(edit, generateId), {
|
|
225
225
|
sequenceNumber: 1,
|
|
226
226
|
referenceSequenceNumber: 0,
|
|
227
227
|
}));
|
|
228
228
|
return {
|
|
229
|
-
currentTree: (0,
|
|
229
|
+
currentTree: (0, EditUtilities_js_1.convertTreeNodes)(currentTree, (node) => (0, IdConversion_js_1.convertNodeDataIds)(node, generateId)),
|
|
230
230
|
idCompressor,
|
|
231
|
-
interner: new
|
|
231
|
+
interner: new StringInterner_js_1.MutableStringInterner(),
|
|
232
232
|
// This cast is valid because we just constructed this log and gave it only in-session edits.
|
|
233
233
|
editHistory: temporaryLog.getEditLogSummary(),
|
|
234
234
|
};
|
|
@@ -239,29 +239,29 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
239
239
|
* @param stable - Generates the single edit with a stable edit ID. False by default, used for testing.
|
|
240
240
|
*/
|
|
241
241
|
noHistorySummarizer(_edits, currentView, idConverter) {
|
|
242
|
-
const currentTree = (0,
|
|
242
|
+
const currentTree = (0, SerializationUtilities_js_1.getChangeNode_0_0_2FromView)(currentView, idConverter);
|
|
243
243
|
const changes = [];
|
|
244
244
|
// Generate a set of changes to set the root node's children to that of the root in the currentTree
|
|
245
245
|
Object.entries(currentTree.traits).forEach(([label, children]) => {
|
|
246
246
|
const id = 0;
|
|
247
|
-
changes.push({ type:
|
|
248
|
-
type:
|
|
247
|
+
changes.push({ type: index_js_1.ChangeTypeInternal.Build, source: children, destination: id }, {
|
|
248
|
+
type: index_js_1.ChangeTypeInternal.Insert,
|
|
249
249
|
source: id,
|
|
250
250
|
destination: {
|
|
251
|
-
side:
|
|
252
|
-
referenceTrait: { label: label, parent:
|
|
251
|
+
side: index_js_1.Side.After,
|
|
252
|
+
referenceTrait: { label: label, parent: InitialTree_js_1.initialTree.identifier },
|
|
253
253
|
},
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
256
|
if (currentTree.payload !== undefined) {
|
|
257
257
|
changes.push({
|
|
258
|
-
type:
|
|
259
|
-
nodeToModify:
|
|
258
|
+
type: index_js_1.ChangeTypeInternal.SetValue,
|
|
259
|
+
nodeToModify: InitialTree_js_1.initialTree.identifier,
|
|
260
260
|
payload: currentTree.payload,
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
|
-
(0, core_utils_1.assert)(currentTree.identifier ===
|
|
264
|
-
const edit = (0,
|
|
263
|
+
(0, core_utils_1.assert)(currentTree.identifier === InitialTree_js_1.initialTree.identifier && currentTree.definition === InitialTree_js_1.initialTree.definition, 0x637 /* root definition and identifier should be immutable. */);
|
|
264
|
+
const edit = (0, EditUtilities_js_1.newEdit)(changes);
|
|
265
265
|
return {
|
|
266
266
|
currentTree,
|
|
267
267
|
sequencedEdits: [
|
|
@@ -270,7 +270,7 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
270
270
|
changes: edit.changes,
|
|
271
271
|
},
|
|
272
272
|
],
|
|
273
|
-
version:
|
|
273
|
+
version: index_js_1.WriteFormat.v0_0_2,
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
@@ -282,21 +282,21 @@ class SharedTreeEncoder_0_0_2 {
|
|
|
282
282
|
let idIndex = 0;
|
|
283
283
|
editChunks.forEach(({ chunk }) => {
|
|
284
284
|
if (isEditHandle(chunk)) {
|
|
285
|
-
(0,
|
|
285
|
+
(0, Common_js_1.fail)('Cannot write handles to summary version 0.0.2');
|
|
286
286
|
}
|
|
287
287
|
else {
|
|
288
288
|
chunk.forEach(({ changes }) => {
|
|
289
|
-
sequencedEdits.push((0,
|
|
289
|
+
sequencedEdits.push((0, IdConversion_js_1.convertEditIds)({
|
|
290
290
|
changes,
|
|
291
|
-
id: editIds[idIndex++] ?? (0,
|
|
291
|
+
id: editIds[idIndex++] ?? (0, Common_js_1.fail)('Number of edits should match number of edit IDs.'),
|
|
292
292
|
}, (id) => idConverter.convertToStableNodeId(id)));
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
296
|
return {
|
|
297
|
-
currentTree: (0,
|
|
297
|
+
currentTree: (0, SerializationUtilities_js_1.getChangeNode_0_0_2FromView)(currentView, idConverter),
|
|
298
298
|
sequencedEdits,
|
|
299
|
-
version:
|
|
299
|
+
version: index_js_1.WriteFormat.v0_0_2,
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTreeEncoder.js","sourceRoot":"","sources":["../src/SharedTreeEncoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,+DAAyD;AACzD,qCAAmD;AACnD,uCAAoC;AACpC,mDAA4D;AAE5D,+CAA4C;AAC5C,uDAS2B;AAC3B,qEAA8F;AAC9F,uDA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iBACrB;aACD;YACD,OAAO,EAAE,6BAAW,CAAC,MAAM;SAC3B,CAAC;IACH,CAAC;IACD;;OAEG;IACK,qBAAqB,CAC5B,KAA8B,EAC9B,WAAyB,EACzB,WAA4B;QAE5B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1D,MAAM,cAAc,GAAiC,EAAE,CAAC;QACxD,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YAChC,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;gBACxB,IAAA,aAAI,EAAC,+CAA+C,CAAC,CAAC;aACtD;iBAAM;gBACN,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;oBAC7B,cAAc,CAAC,IAAI,CAClB,IAAA,6BAAc,EACb;wBACC,OAAO;wBACP,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,IAAA,aAAI,EAAC,kDAAkD,CAAC;qBAClF,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAC7C,CACD,CAAC;gBACH,CAAC,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,WAAW,EAAE,IAAA,oDAA2B,EAAC,WAAW,EAAE,WAAW,CAAC;YAClE,cAAc;YACd,OAAO,EAAE,6BAAW,CAAC,MAAM;SAC3B,CAAC;IACH,CAAC;CACD;AAlLD,0DAkLC;AAED,SAAS,YAAY,CAAC,KAA0D;IAC/E,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","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';\nimport { IsoBuffer } from '@fluid-internal/client-utils';\nimport { assertWithMessage, fail } from './Common';\nimport { EditLog } from './EditLog';\nimport { convertTreeNodes, newEdit } from './EditUtilities';\nimport { AttributionId, DetachedSequenceId, FinalNodeId, OpSpaceNodeId, TraitLabel } from './Identifiers';\nimport { initialTree } from './InitialTree';\nimport {\n\tContextualizedNodeIdNormalizer,\n\tgetNodeIdContext,\n\tNodeIdContext,\n\tNodeIdConverter,\n\tNodeIdGenerator,\n\tNodeIdNormalizer,\n\tscopeIdNormalizer,\n\tsequencedIdNormalizer,\n} from './NodeIdUtilities';\nimport { getChangeNodeFromView, getChangeNode_0_0_2FromView } from './SerializationUtilities';\nimport {\n\tCompressedChangeInternal,\n\tChangeInternal,\n\tSharedTreeSummary_0_0_2,\n\tWriteFormat,\n\tChangeNode,\n\tEdit,\n\tSharedTreeEditOp,\n\tSharedTreeOpType,\n\tSharedTreeSummary,\n\tEditWithoutId,\n\tChangeTypeInternal,\n\tChangeInternal_0_0_2,\n\tSharedTreeEditOp_0_0_2,\n\treservedIdCount,\n\tChangeNode_0_0_2,\n\tEditChunkContents,\n\tEditLogSummary,\n\tEditChunkContents_0_1_1,\n\tFluidEditHandle,\n\tStablePlaceInternal,\n\tSide,\n} from './persisted-types';\nimport { RevisionView } from './RevisionView';\nimport { MutableStringInterner, StringInterner } from './StringInterner';\nimport { SummaryContents } from './Summary';\nimport { InterningTreeCompressor } from './TreeCompressor';\nimport {\n\tcreateSessionId,\n\thasOngoingSession,\n\tIdCompressor,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n} from './id-compressor';\nimport { ChangeCompressor, compressEdit, decompressEdit } from './ChangeCompression';\nimport { convertEditIds, convertNodeDataIds } from './IdConversion';\n\n/**\n * Object capable of converting between the current internal representation for 0.1.1 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_1_1 {\n\tprivate readonly treeCompressor = new InterningTreeCompressor<never>();\n\tprivate readonly changeCompressor = new ChangeCompressor(this.treeCompressor);\n\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (\n\t\t\tedit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidRange: IdCreationRange,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): SharedTreeEditOp {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(\n\t\t\tcompressEdit(this.changeCompressor, interner, scopeIdNormalizer(idNormalizer, idRange.sessionId), edit)\n\t\t);\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tidRange,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp,\n\t\tfluidDeserialize: (\n\t\t\tsemiSerializedEdit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn decompressEdit(\n\t\t\tthis.changeCompressor,\n\t\t\tinterner,\n\t\t\tscopeIdNormalizer(idNormalizer, op.idRange.sessionId),\n\t\t\tparsedEdit\n\t\t);\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idNormalizer, interner, serializedIdCompressor)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idContext, idNormalizer, interner, serializedIdCompressor);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{\n\t\t\teditHistory,\n\t\t\tcurrentTree: compressedTree,\n\t\t\tinternedStrings,\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t\tversion,\n\t\t}: SharedTreeSummary,\n\t\tattributionId: AttributionId\n\t): SummaryContents {\n\t\tassertWithMessage(\n\t\t\tversion === WriteFormat.v0_1_1,\n\t\t\t`Invalid summary version to decode: ${version}, expected: 0.1.1`\n\t\t);\n\t\tassert(typeof editHistory === 'object', 0x633 /* 0.1.1 summary encountered with non-object edit history. */);\n\n\t\tconst idCompressor = hasOngoingSession(serializedIdCompressor)\n\t\t\t? IdCompressor.deserialize(serializedIdCompressor)\n\t\t\t: IdCompressor.deserialize(serializedIdCompressor, createSessionId(), attributionId);\n\n\t\tconst interner = new MutableStringInterner(internedStrings);\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(getNodeIdContext(idCompressor));\n\t\tconst decompressedTree: ChangeNode | undefined =\n\t\t\tcompressedTree !== undefined\n\t\t\t\t? this.treeCompressor.decompress(compressedTree, interner, sequencedNormalizer)\n\t\t\t\t: undefined;\n\t\tconst { editChunks, editIds } = editHistory;\n\t\tassertWithMessage(editChunks !== undefined, 'Missing editChunks on 0.1.1 summary.');\n\t\tassert(editIds !== undefined, 0x634 /* Missing editIds on 0.1.1 summary. */);\n\n\t\tconst uncompressedChunks = editChunks.map(({ startRevision, chunk }) => ({\n\t\t\tstartRevision,\n\t\t\tchunk: isEditHandle(chunk)\n\t\t\t\t? {\n\t\t\t\t\t\tget: async () => {\n\t\t\t\t\t\t\tconst baseHandle = chunk;\n\t\t\t\t\t\t\tconst contents: EditChunkContents = JSON.parse(\n\t\t\t\t\t\t\t\tIsoBuffer.from(await baseHandle.get()).toString()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// Note: any interned IDs referenced in chunks taken at the time of summarization must be included\n\t\t\t\t\t\t\t// in the summary. So this interner is sufficient.\n\t\t\t\t\t\t\treturn this.decodeEditChunk(contents, sequencedNormalizer, interner);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbaseHandle: chunk,\n\t\t\t\t }\n\t\t\t\t: chunk.map((edit) => decompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)),\n\t\t}));\n\t\treturn {\n\t\t\tcurrentTree: decompressedTree,\n\t\t\teditHistory: { editIds, editChunks: uncompressedChunks },\n\t\t\tidCompressor,\n\t\t\tinterner,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * Writes summary format 0.1.1 which does not store the currentView for no history summaries.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst currentTree = getChangeNodeFromView(currentView);\n\t\tconst initialTreeId = idContext.convertToNodeId(initialTree.identifier);\n\t\tconst changes: ChangeInternal[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\tChangeInternal.build(children, id),\n\t\t\t\tChangeInternal.insert(\n\t\t\t\t\tid,\n\t\t\t\t\tStablePlaceInternal.atStartOf({ parent: initialTreeId, label: label as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push(ChangeInternal.setPayload(initialTreeId, currentTree.payload));\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTreeId && currentTree.definition === initialTree.definition,\n\t\t\t0x635 /* root definition and identifier should be immutable. */\n\t\t);\n\t\tconst edit = newEdit(changes);\n\t\tconst compressedChanges = edit.changes.map((change) =>\n\t\t\tthis.changeCompressor.compress(change, interner, sequencedIdNormalizer(idNormalizer))\n\t\t);\n\t\treturn {\n\t\t\teditHistory: {\n\t\t\t\teditChunks: [{ startRevision: 0, chunk: [{ changes: compressedChanges }] }],\n\t\t\t\teditIds: [edit.id],\n\t\t\t},\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\t/**\n\t * Generates a summary with format version 0.1.1. This will prefer handles over edits in edit chunks where possible,\n\t * and string interning and tree compression will be applied.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(idNormalizer);\n\t\tconst currentTree = this.treeCompressor.compress(\n\t\t\tgetChangeNodeFromView(currentView),\n\t\t\tinterner,\n\t\t\tsequencedNormalizer\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\teditHistory: edits.getEditLogSummary((edit) =>\n\t\t\t\tcompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)\n\t\t\t),\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\tpublic encodeEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditChunkContents_0_1_1 {\n\t\tconst compressedEdits = edits.map((edit) => compressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t\treturn {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tedits: compressedEdits,\n\t\t};\n\t}\n\n\tpublic decodeEditChunk(\n\t\tcontents: EditChunkContents,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditWithoutId<ChangeInternal>[] {\n\t\tassertWithMessage(\n\t\t\tcontents.version === WriteFormat.v0_1_1,\n\t\t\t`Invalid editChunk to decode: ${contents.version}. Expected 0.1.1.`\n\t\t);\n\t\treturn contents.edits.map((edit) => decompressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t}\n}\n\n/**\n * Object capable of converting between the current internal representation for 0.0.2 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_0_2 {\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (edit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeEditOp_0_0_2 {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(convertEditIds(edit, (id) => idConverter.convertToStableNodeId(id)));\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp_0_0_2,\n\t\tfluidDeserialize: (semiSerializedEdit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidGenerator: NodeIdGenerator\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn convertEditIds(parsedEdit, (id) => idGenerator.generateNodeId(id));\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idConverter)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idConverter);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{ currentTree, sequencedEdits }: SharedTreeSummary_0_0_2,\n\t\tattributionId?: AttributionId\n\t): SummaryContents {\n\t\tassert(sequencedEdits !== undefined, 0x636 /* 0.0.2 summary encountered with missing sequencedEdits field. */);\n\t\tconst idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId);\n\t\tconst idGenerator = getNodeIdContext(idCompressor);\n\t\tconst generateId = (id) => idGenerator.generateNodeId(id);\n\n\t\t// This saves all of the edits in the summary as part of the first chunk.\n\t\tconst temporaryLog = new EditLog<ChangeInternal>();\n\t\tsequencedEdits.forEach((edit) =>\n\t\t\ttemporaryLog.addSequencedEdit(convertEditIds(edit, generateId), {\n\t\t\t\tsequenceNumber: 1,\n\t\t\t\treferenceSequenceNumber: 0,\n\t\t\t})\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree: convertTreeNodes<ChangeNode_0_0_2, ChangeNode>(currentTree, (node) =>\n\t\t\t\tconvertNodeDataIds(node, generateId)\n\t\t\t),\n\t\t\tidCompressor,\n\t\t\tinterner: new MutableStringInterner(),\n\t\t\t// This cast is valid because we just constructed this log and gave it only in-session edits.\n\t\t\teditHistory: temporaryLog.getEditLogSummary() as EditLogSummary<ChangeInternal, never>,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * @param stable - Generates the single edit with a stable edit ID. False by default, used for testing.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst currentTree = getChangeNode_0_0_2FromView(currentView, idConverter);\n\t\tconst changes: ChangeInternal_0_0_2[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\t{ type: ChangeTypeInternal.Build, source: children, destination: id },\n\t\t\t\t{\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: id,\n\t\t\t\t\tdestination: {\n\t\t\t\t\t\tside: Side.After,\n\t\t\t\t\t\treferenceTrait: { label: label as TraitLabel, parent: initialTree.identifier },\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push({\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\tnodeToModify: initialTree.identifier,\n\t\t\t\tpayload: currentTree.payload,\n\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTree.identifier && currentTree.definition === initialTree.definition,\n\t\t\t0x637 /* root definition and identifier should be immutable. */\n\t\t);\n\t\tconst edit = newEdit(changes);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\tsequencedEdits: [\n\t\t\t\t{\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t},\n\t\t\t],\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\t/**\n\t * Preserves the full history in the generated summary.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst { editChunks, editIds } = edits.getEditLogSummary();\n\n\t\tconst sequencedEdits: Edit<ChangeInternal_0_0_2>[] = [];\n\t\tlet idIndex = 0;\n\t\teditChunks.forEach(({ chunk }) => {\n\t\t\tif (isEditHandle(chunk)) {\n\t\t\t\tfail('Cannot write handles to summary version 0.0.2');\n\t\t\t} else {\n\t\t\t\tchunk.forEach(({ changes }) => {\n\t\t\t\t\tsequencedEdits.push(\n\t\t\t\t\t\tconvertEditIds(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchanges,\n\t\t\t\t\t\t\t\tid: editIds[idIndex++] ?? fail('Number of edits should match number of edit IDs.'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(id) => idConverter.convertToStableNodeId(id)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tcurrentTree: getChangeNode_0_0_2FromView(currentView, idConverter),\n\t\t\tsequencedEdits,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n}\n\nfunction isEditHandle(chunk: FluidEditHandle | readonly EditWithoutId<unknown>[]): chunk is FluidEditHandle {\n\treturn !Array.isArray(chunk);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SharedTreeEncoder.js","sourceRoot":"","sources":["../src/SharedTreeEncoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,+DAAyD;AACzD,2CAAsD;AACtD,6CAAuC;AACvC,yDAA+D;AAE/D,qDAA+C;AAC/C,6DAS8B;AAC9B,2EAAiG;AACjG,yDAsBoC;AAEpC,2DAA4E;AAE5E,2DAA8D;AAC9D,uDAMkC;AAClC,iEAAwF;AACxF,uDAAuE;AAEvE;;;GAGG;AACH,MAAa,uBAAuB;IAInC,YAAoC,gBAAyB;QAAzB,qBAAgB,GAAhB,gBAAgB,CAAS;QAH5C,mBAAc,GAAG,IAAI,2CAAuB,EAAS,CAAC;QACtD,qBAAgB,GAAG,IAAI,uCAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAEd,CAAC;IAEjE;;;;;;OAMG;IACI,YAAY,CAClB,IAA0B,EAC1B,cAEkD,EAClD,OAAwB,EACxB,YAA6C,EAC7C,QAAwB;QAExB,wCAAwC;QACxC,kFAAkF;QAClF,qDAAqD;QACrD,MAAM,cAAc,GAAG,cAAc,CACpC,IAAA,mCAAY,EAAC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,IAAA,sCAAiB,EAAC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IAAA,gCAAc,EACb;wBACC,OAAO;wBACP,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,IAAA,gBAAI,EAAC,kDAAkD,CAAC;qBAClF,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAC7C,CACD,CAAC;gBACH,CAAC,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,WAAW,EAAE,IAAA,uDAA2B,EAAC,WAAW,EAAE,WAAW,CAAC;YAClE,cAAc;YACd,OAAO,EAAE,sBAAW,CAAC,MAAM;SAC3B,CAAC;IACH,CAAC;CACD;AAlLD,0DAkLC;AAED,SAAS,YAAY,CAAC,KAA0D;IAC/E,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","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';\nimport { IsoBuffer } from '@fluid-internal/client-utils';\nimport { assertWithMessage, fail } from './Common.js';\nimport { EditLog } from './EditLog.js';\nimport { convertTreeNodes, newEdit } from './EditUtilities.js';\nimport { AttributionId, DetachedSequenceId, FinalNodeId, OpSpaceNodeId, TraitLabel } from './Identifiers.js';\nimport { initialTree } from './InitialTree.js';\nimport {\n\tContextualizedNodeIdNormalizer,\n\tgetNodeIdContext,\n\tNodeIdContext,\n\tNodeIdConverter,\n\tNodeIdGenerator,\n\tNodeIdNormalizer,\n\tscopeIdNormalizer,\n\tsequencedIdNormalizer,\n} from './NodeIdUtilities.js';\nimport { getChangeNodeFromView, getChangeNode_0_0_2FromView } from './SerializationUtilities.js';\nimport {\n\tCompressedChangeInternal,\n\tChangeInternal,\n\tSharedTreeSummary_0_0_2,\n\tWriteFormat,\n\tChangeNode,\n\tEdit,\n\tSharedTreeEditOp,\n\tSharedTreeOpType,\n\tSharedTreeSummary,\n\tEditWithoutId,\n\tChangeTypeInternal,\n\tChangeInternal_0_0_2,\n\tSharedTreeEditOp_0_0_2,\n\treservedIdCount,\n\tChangeNode_0_0_2,\n\tEditChunkContents,\n\tEditLogSummary,\n\tEditChunkContents_0_1_1,\n\tFluidEditHandle,\n\tStablePlaceInternal,\n\tSide,\n} from './persisted-types/index.js';\nimport { RevisionView } from './RevisionView.js';\nimport { MutableStringInterner, StringInterner } from './StringInterner.js';\nimport { SummaryContents } from './Summary.js';\nimport { InterningTreeCompressor } from './TreeCompressor.js';\nimport {\n\tcreateSessionId,\n\thasOngoingSession,\n\tIdCompressor,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n} from './id-compressor/index.js';\nimport { ChangeCompressor, compressEdit, decompressEdit } from './ChangeCompression.js';\nimport { convertEditIds, convertNodeDataIds } from './IdConversion.js';\n\n/**\n * Object capable of converting between the current internal representation for 0.1.1 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_1_1 {\n\tprivate readonly treeCompressor = new InterningTreeCompressor<never>();\n\tprivate readonly changeCompressor = new ChangeCompressor(this.treeCompressor);\n\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (\n\t\t\tedit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidRange: IdCreationRange,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): SharedTreeEditOp {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(\n\t\t\tcompressEdit(this.changeCompressor, interner, scopeIdNormalizer(idNormalizer, idRange.sessionId), edit)\n\t\t);\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tidRange,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp,\n\t\tfluidDeserialize: (\n\t\t\tsemiSerializedEdit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn decompressEdit(\n\t\t\tthis.changeCompressor,\n\t\t\tinterner,\n\t\t\tscopeIdNormalizer(idNormalizer, op.idRange.sessionId),\n\t\t\tparsedEdit\n\t\t);\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idNormalizer, interner, serializedIdCompressor)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idContext, idNormalizer, interner, serializedIdCompressor);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{\n\t\t\teditHistory,\n\t\t\tcurrentTree: compressedTree,\n\t\t\tinternedStrings,\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t\tversion,\n\t\t}: SharedTreeSummary,\n\t\tattributionId: AttributionId\n\t): SummaryContents {\n\t\tassertWithMessage(\n\t\t\tversion === WriteFormat.v0_1_1,\n\t\t\t`Invalid summary version to decode: ${version}, expected: 0.1.1`\n\t\t);\n\t\tassert(typeof editHistory === 'object', 0x633 /* 0.1.1 summary encountered with non-object edit history. */);\n\n\t\tconst idCompressor = hasOngoingSession(serializedIdCompressor)\n\t\t\t? IdCompressor.deserialize(serializedIdCompressor)\n\t\t\t: IdCompressor.deserialize(serializedIdCompressor, createSessionId(), attributionId);\n\n\t\tconst interner = new MutableStringInterner(internedStrings);\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(getNodeIdContext(idCompressor));\n\t\tconst decompressedTree: ChangeNode | undefined =\n\t\t\tcompressedTree !== undefined\n\t\t\t\t? this.treeCompressor.decompress(compressedTree, interner, sequencedNormalizer)\n\t\t\t\t: undefined;\n\t\tconst { editChunks, editIds } = editHistory;\n\t\tassertWithMessage(editChunks !== undefined, 'Missing editChunks on 0.1.1 summary.');\n\t\tassert(editIds !== undefined, 0x634 /* Missing editIds on 0.1.1 summary. */);\n\n\t\tconst uncompressedChunks = editChunks.map(({ startRevision, chunk }) => ({\n\t\t\tstartRevision,\n\t\t\tchunk: isEditHandle(chunk)\n\t\t\t\t? {\n\t\t\t\t\t\tget: async () => {\n\t\t\t\t\t\t\tconst baseHandle = chunk;\n\t\t\t\t\t\t\tconst contents: EditChunkContents = JSON.parse(\n\t\t\t\t\t\t\t\tIsoBuffer.from(await baseHandle.get()).toString()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// Note: any interned IDs referenced in chunks taken at the time of summarization must be included\n\t\t\t\t\t\t\t// in the summary. So this interner is sufficient.\n\t\t\t\t\t\t\treturn this.decodeEditChunk(contents, sequencedNormalizer, interner);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbaseHandle: chunk,\n\t\t\t\t }\n\t\t\t\t: chunk.map((edit) => decompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)),\n\t\t}));\n\t\treturn {\n\t\t\tcurrentTree: decompressedTree,\n\t\t\teditHistory: { editIds, editChunks: uncompressedChunks },\n\t\t\tidCompressor,\n\t\t\tinterner,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * Writes summary format 0.1.1 which does not store the currentView for no history summaries.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst currentTree = getChangeNodeFromView(currentView);\n\t\tconst initialTreeId = idContext.convertToNodeId(initialTree.identifier);\n\t\tconst changes: ChangeInternal[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\tChangeInternal.build(children, id),\n\t\t\t\tChangeInternal.insert(\n\t\t\t\t\tid,\n\t\t\t\t\tStablePlaceInternal.atStartOf({ parent: initialTreeId, label: label as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push(ChangeInternal.setPayload(initialTreeId, currentTree.payload));\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTreeId && currentTree.definition === initialTree.definition,\n\t\t\t0x635 /* root definition and identifier should be immutable. */\n\t\t);\n\t\tconst edit = newEdit(changes);\n\t\tconst compressedChanges = edit.changes.map((change) =>\n\t\t\tthis.changeCompressor.compress(change, interner, sequencedIdNormalizer(idNormalizer))\n\t\t);\n\t\treturn {\n\t\t\teditHistory: {\n\t\t\t\teditChunks: [{ startRevision: 0, chunk: [{ changes: compressedChanges }] }],\n\t\t\t\teditIds: [edit.id],\n\t\t\t},\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\t/**\n\t * Generates a summary with format version 0.1.1. This will prefer handles over edits in edit chunks where possible,\n\t * and string interning and tree compression will be applied.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(idNormalizer);\n\t\tconst currentTree = this.treeCompressor.compress(\n\t\t\tgetChangeNodeFromView(currentView),\n\t\t\tinterner,\n\t\t\tsequencedNormalizer\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\teditHistory: edits.getEditLogSummary((edit) =>\n\t\t\t\tcompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)\n\t\t\t),\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\tpublic encodeEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditChunkContents_0_1_1 {\n\t\tconst compressedEdits = edits.map((edit) => compressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t\treturn {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tedits: compressedEdits,\n\t\t};\n\t}\n\n\tpublic decodeEditChunk(\n\t\tcontents: EditChunkContents,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditWithoutId<ChangeInternal>[] {\n\t\tassertWithMessage(\n\t\t\tcontents.version === WriteFormat.v0_1_1,\n\t\t\t`Invalid editChunk to decode: ${contents.version}. Expected 0.1.1.`\n\t\t);\n\t\treturn contents.edits.map((edit) => decompressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t}\n}\n\n/**\n * Object capable of converting between the current internal representation for 0.0.2 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_0_2 {\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (edit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeEditOp_0_0_2 {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(convertEditIds(edit, (id) => idConverter.convertToStableNodeId(id)));\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp_0_0_2,\n\t\tfluidDeserialize: (semiSerializedEdit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidGenerator: NodeIdGenerator\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn convertEditIds(parsedEdit, (id) => idGenerator.generateNodeId(id));\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idConverter)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idConverter);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{ currentTree, sequencedEdits }: SharedTreeSummary_0_0_2,\n\t\tattributionId?: AttributionId\n\t): SummaryContents {\n\t\tassert(sequencedEdits !== undefined, 0x636 /* 0.0.2 summary encountered with missing sequencedEdits field. */);\n\t\tconst idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId);\n\t\tconst idGenerator = getNodeIdContext(idCompressor);\n\t\tconst generateId = (id) => idGenerator.generateNodeId(id);\n\n\t\t// This saves all of the edits in the summary as part of the first chunk.\n\t\tconst temporaryLog = new EditLog<ChangeInternal>();\n\t\tsequencedEdits.forEach((edit) =>\n\t\t\ttemporaryLog.addSequencedEdit(convertEditIds(edit, generateId), {\n\t\t\t\tsequenceNumber: 1,\n\t\t\t\treferenceSequenceNumber: 0,\n\t\t\t})\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree: convertTreeNodes<ChangeNode_0_0_2, ChangeNode>(currentTree, (node) =>\n\t\t\t\tconvertNodeDataIds(node, generateId)\n\t\t\t),\n\t\t\tidCompressor,\n\t\t\tinterner: new MutableStringInterner(),\n\t\t\t// This cast is valid because we just constructed this log and gave it only in-session edits.\n\t\t\teditHistory: temporaryLog.getEditLogSummary() as EditLogSummary<ChangeInternal, never>,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * @param stable - Generates the single edit with a stable edit ID. False by default, used for testing.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst currentTree = getChangeNode_0_0_2FromView(currentView, idConverter);\n\t\tconst changes: ChangeInternal_0_0_2[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\t{ type: ChangeTypeInternal.Build, source: children, destination: id },\n\t\t\t\t{\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: id,\n\t\t\t\t\tdestination: {\n\t\t\t\t\t\tside: Side.After,\n\t\t\t\t\t\treferenceTrait: { label: label as TraitLabel, parent: initialTree.identifier },\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push({\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\tnodeToModify: initialTree.identifier,\n\t\t\t\tpayload: currentTree.payload,\n\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTree.identifier && currentTree.definition === initialTree.definition,\n\t\t\t0x637 /* root definition and identifier should be immutable. */\n\t\t);\n\t\tconst edit = newEdit(changes);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\tsequencedEdits: [\n\t\t\t\t{\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t},\n\t\t\t],\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\t/**\n\t * Preserves the full history in the generated summary.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst { editChunks, editIds } = edits.getEditLogSummary();\n\n\t\tconst sequencedEdits: Edit<ChangeInternal_0_0_2>[] = [];\n\t\tlet idIndex = 0;\n\t\teditChunks.forEach(({ chunk }) => {\n\t\t\tif (isEditHandle(chunk)) {\n\t\t\t\tfail('Cannot write handles to summary version 0.0.2');\n\t\t\t} else {\n\t\t\t\tchunk.forEach(({ changes }) => {\n\t\t\t\t\tsequencedEdits.push(\n\t\t\t\t\t\tconvertEditIds(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchanges,\n\t\t\t\t\t\t\t\tid: editIds[idIndex++] ?? fail('Number of edits should match number of edit IDs.'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(id) => idConverter.convertToStableNodeId(id)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tcurrentTree: getChangeNode_0_0_2FromView(currentView, idConverter),\n\t\t\tsequencedEdits,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n}\n\nfunction isEditHandle(chunk: FluidEditHandle | readonly EditWithoutId<unknown>[]): chunk is FluidEditHandle {\n\treturn !Array.isArray(chunk);\n}\n"]}
|
package/dist/StringInterner.d.ts
CHANGED
|
@@ -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 { InternedStringId } from './Identifiers';
|
|
5
|
+
import type { InternedStringId } from './Identifiers.js';
|
|
6
6
|
/**
|
|
7
7
|
* Interns strings as integers.
|
|
8
8
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringInterner.d.ts","sourceRoot":"","sources":["../src/StringInterner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"StringInterner.d.ts","sourceRoot":"","sources":["../src/StringInterner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC3D,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,eAAe,IAAI,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,cAAc;IAC3D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuC;IAC7E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgB;IAEhD;;;OAGG;gBACS,YAAY,GAAE,SAAS,MAAM,EAAO;IAMhD;;;OAGG;IACI,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAItD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIjE;;;;;OAKG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI1C;;;OAGG;IACI,eAAe,IAAI,SAAS,MAAM,EAAE;IAI3C,+GAA+G;IAC/G,OAAO,CAAC,WAAW;CAMnB"}
|
package/dist/StringInterner.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.MutableStringInterner = void 0;
|
|
8
|
-
const
|
|
8
|
+
const Common_js_1 = require("./Common.js");
|
|
9
9
|
/**
|
|
10
10
|
* Interns strings as integers.
|
|
11
11
|
* Given a string, this class will produce a unique integer associated with that string that can then be used to retrieve the string.
|
|
@@ -39,7 +39,7 @@ class MutableStringInterner {
|
|
|
39
39
|
* @returns a string that is uniquely associated with the given intern ID
|
|
40
40
|
*/
|
|
41
41
|
getString(internId) {
|
|
42
|
-
return this.internedStrings[internId] ?? (0,
|
|
42
|
+
return this.internedStrings[internId] ?? (0, Common_js_1.fail)(`No string associated with ${internId}.`);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* @returns The list of strings interned where the indices map to the associated {@link InternedStringId} of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringInterner.js","sourceRoot":"","sources":["../src/StringInterner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"StringInterner.js","sourceRoot":"","sources":["../src/StringInterner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAmC;AAanC;;;GAGG;AACH,MAAa,qBAAqB;IAIjC;;;OAGG;IACH,YAAY,eAAkC,EAAE;QAP/B,0BAAqB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAC5D,oBAAe,GAAa,EAAE,CAAC;QAO/C,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;SAClC;IACF,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;IAEM,aAAa,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,IAAA,gBAAI,EAAC,6BAA6B,QAAQ,GAAG,CAAC,CAAC;IACzF,CAAC;IAED;;;OAGG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAED,+GAA+G;IACvG,WAAW,CAAC,KAAa;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAwB,CAAC;QACvE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,UAAU,CAAC;IACnB,CAAC;CACD;AAnDD,sDAmDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from './Common.js';\nimport type { InternedStringId } from './Identifiers.js';\n\n/**\n * Interns strings as integers.\n * @internal\n */\nexport interface StringInterner {\n\tgetInternedId(input: string): InternedStringId | undefined;\n\tgetString(internedId: number): string;\n\tgetSerializable(): readonly string[];\n}\n\n/**\n * Interns strings as integers.\n * Given a string, this class will produce a unique integer associated with that string that can then be used to retrieve the string.\n */\nexport class MutableStringInterner implements StringInterner {\n\tprivate readonly stringToInternedIdMap = new Map<string, InternedStringId>();\n\tprivate readonly internedStrings: string[] = [];\n\n\t/**\n\t * @param inputStrings - A list of strings to intern in the order given. Can be used to rehydrate from a previous\n\t * `StringInterner`'s {@link StringInterner.getSerializable} return value.\n\t */\n\tconstructor(inputStrings: readonly string[] = []) {\n\t\tfor (const value of inputStrings) {\n\t\t\tthis.getOrCreateInternedId(value);\n\t\t}\n\t}\n\n\t/**\n\t * @param input - The string to get the associated intern ID for\n\t * @returns an intern ID that is uniquely associated with the input string\n\t */\n\tpublic getOrCreateInternedId(input: string): InternedStringId {\n\t\treturn this.getInternedId(input) ?? this.createNewId(input);\n\t}\n\n\tpublic getInternedId(input: string): InternedStringId | undefined {\n\t\treturn this.stringToInternedIdMap.get(input);\n\t}\n\n\t/**\n\t *\n\t * @param internId - The intern ID to get the associated string for. Can only retrieve strings that have been\n\t * used as inputs to calls of `getInternId`.\n\t * @returns a string that is uniquely associated with the given intern ID\n\t */\n\tpublic getString(internId: number): string {\n\t\treturn this.internedStrings[internId] ?? fail(`No string associated with ${internId}.`);\n\t}\n\n\t/**\n\t * @returns The list of strings interned where the indices map to the associated {@link InternedStringId} of\n\t * each string.\n\t */\n\tpublic getSerializable(): readonly string[] {\n\t\treturn this.internedStrings;\n\t}\n\n\t/** Create a new interned id. Assumes without validation that the input doesn't already have an interned id. */\n\tprivate createNewId(input: string): InternedStringId {\n\t\tconst internedId = this.stringToInternedIdMap.size as InternedStringId;\n\t\tthis.stringToInternedIdMap.set(input, internedId);\n\t\tthis.internedStrings.push(input);\n\t\treturn internedId;\n\t}\n}\n"]}
|
package/dist/Summary.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
6
6
|
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
7
|
-
import type { IdCompressor } from './id-compressor';
|
|
8
|
-
import type { EditLogSummary, SharedTreeSummaryBase, ChangeNode, ChangeInternal } from './persisted-types';
|
|
9
|
-
import type { EditHandle } from './EditLog';
|
|
10
|
-
import type { MutableStringInterner } from './StringInterner';
|
|
7
|
+
import type { IdCompressor } from './id-compressor/index.js';
|
|
8
|
+
import type { EditLogSummary, SharedTreeSummaryBase, ChangeNode, ChangeInternal } from './persisted-types/index.js';
|
|
9
|
+
import type { EditHandle } from './EditLog.js';
|
|
10
|
+
import type { MutableStringInterner } from './StringInterner.js';
|
|
11
11
|
/**
|
|
12
12
|
* The contents of a SharedTree summary, converted to a common internal format that can be
|
|
13
13
|
* loaded into a SharedTree.
|
package/dist/Summary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../src/Summary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oCAAoC,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../src/Summary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oCAAoC,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACpH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC;IAEjF;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAElH"}
|
package/dist/Summary.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.serialize = void 0;
|
|
8
8
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
9
|
-
const
|
|
9
|
+
const Common_js_1 = require("./Common.js");
|
|
10
10
|
/**
|
|
11
11
|
* Serializes a SharedTree summary into a JSON string. This may later be used to initialize a SharedTree's state via `deserialize()`
|
|
12
12
|
* Also replaces handle objects with their serialized form.
|
|
@@ -16,7 +16,7 @@ const Common_1 = require("./Common");
|
|
|
16
16
|
* @param bind - The object handle required to serialize handles in the summary
|
|
17
17
|
*/
|
|
18
18
|
function serialize(summary, serializer, bind) {
|
|
19
|
-
return (0, shared_object_base_1.serializeHandles)(summary, serializer, bind) ?? (0,
|
|
19
|
+
return (0, shared_object_base_1.serializeHandles)(summary, serializer, bind) ?? (0, Common_js_1.fail)();
|
|
20
20
|
}
|
|
21
21
|
exports.serialize = serialize;
|
|
22
22
|
//# sourceMappingURL=Summary.js.map
|
package/dist/Summary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.js","sourceRoot":"","sources":["../src/Summary.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"Summary.js","sourceRoot":"","sources":["../src/Summary.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAwF;AACxF,2CAAmC;AA8BnC;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,OAA8B,EAAE,UAA4B,EAAE,IAAkB;IACzG,OAAO,IAAA,qCAAgB,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,IAAA,gBAAI,GAAE,CAAC;AAC9D,CAAC;AAFD,8BAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from '@fluidframework/core-interfaces';\nimport { IFluidSerializer, serializeHandles } from '@fluidframework/shared-object-base';\nimport { fail } from './Common.js';\nimport type { IdCompressor } from './id-compressor/index.js';\nimport type { EditLogSummary, SharedTreeSummaryBase, ChangeNode, ChangeInternal } from './persisted-types/index.js';\nimport type { EditHandle } from './EditLog.js';\nimport type { MutableStringInterner } from './StringInterner.js';\n\n/**\n * The contents of a SharedTree summary, converted to a common internal format that can be\n * loaded into a SharedTree.\n * @internal\n */\nexport interface SummaryContents {\n\treadonly currentTree?: ChangeNode;\n\n\t/**\n\t * Information that can populate an edit log.\n\t */\n\treadonly editHistory: EditLogSummary<ChangeInternal, EditHandle<ChangeInternal>>;\n\n\t/**\n\t * Information about all IDs compressed in the summary\n\t */\n\treadonly idCompressor: IdCompressor;\n\n\t/**\n\t * Interner pre-loaded with all definitions and labels from the summary.\n\t */\n\treadonly interner: MutableStringInterner;\n}\n\n/**\n * Serializes a SharedTree summary into a JSON string. This may later be used to initialize a SharedTree's state via `deserialize()`\n * Also replaces handle objects with their serialized form.\n *\n * @param summary - The SharedTree summary to serialize.\n * @param serializer - The serializer required to serialize handles in the summary.\n * @param bind - The object handle required to serialize handles in the summary\n */\nexport function serialize(summary: SharedTreeSummaryBase, serializer: IFluidSerializer, bind: IFluidHandle): string {\n\treturn serializeHandles(summary, serializer, bind) ?? fail();\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 {
|
|
5
|
+
import type { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
6
6
|
import type { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
7
|
-
import { SharedTreeSummaryBase } from './persisted-types';
|
|
7
|
+
import { SharedTreeSummaryBase } from './persisted-types/index.js';
|
|
8
8
|
/**
|
|
9
9
|
* Deserializes a JSON object produced by `serialize()` and uses it to initialize the tree with the encoded state.
|
|
10
10
|
* Also constructs handle objects from their serialized form.
|
|
@@ -19,7 +19,7 @@ export declare function deserialize(jsonSummary: string, serializer: IFluidSeria
|
|
|
19
19
|
/**
|
|
20
20
|
* General statistics about summaries.
|
|
21
21
|
*/
|
|
22
|
-
export interface SummaryStatistics extends
|
|
22
|
+
export interface SummaryStatistics extends ITelemetryBaseProperties {
|
|
23
23
|
/** Format version the summary is written in. */
|
|
24
24
|
readonly formatVersion: string;
|
|
25
25
|
/** Number of edits. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SummaryBackCompatibility.d.ts","sourceRoot":"","sources":["../src/SummaryBackCompatibility.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SummaryBackCompatibility.d.ts","sourceRoot":"","sources":["../src/SummaryBackCompatibility.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAEN,qBAAqB,EAGrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,qBAAqB,CAmBpG;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IAClE,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,uBAAuB;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,gEAAgE;IAChE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAqCtF"}
|