@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0.0.2.js","sourceRoot":"","sources":["../../src/persisted-types/0.0.2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf;AAqID;;;GAGG;AACH,MAAM,CAAN,IAAY,UAgBX;AAhBD,WAAY,UAAU;IACrB;;;;OAIG;IACH,qDAAS,CAAA;IACT;;;OAGG;IACH,iDAAO,CAAA;IACP;;OAEG;IACH,iDAAO,CAAA;AACR,CAAC,EAhBW,UAAU,KAAV,UAAU,QAgBrB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC3B,4CAA4C;IAC5C,uDAAI,CAAA;IACJ,iEAAiE;IACjE,2DAAM,CAAA;IACN,mDAAmD;IACnD,uDAAI,CAAA;IACJ,sFAAsF;IACtF,2DAAM,CAAA;AACP,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAyCD;;;GAGG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACtB,4CAA4C;IAC5C,+BAAgB,CAAA;IAChB,2GAA2G;IAC3G,+BAAgB,CAAA;AACjB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AA4BD;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC7B,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,6DAAK,CAAA;IACL,mEAAQ,CAAA;IACR,uEAAU,CAAA;IACV,iFAAe,CAAA;AAChB,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B;AAwED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC3B;;OAEG;IACH,iFAAiB,CAAA;IAEjB;;;OAGG;IACH,uEAAY,CAAA;IAEZ;;;OAGG;IACH,mEAAU,CAAA;AACX,CAAC,EAjBW,gBAAgB,KAAhB,gBAAgB,QAiB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tEditId,\n\tDefinition,\n\tNodeId,\n\tStableNodeId,\n\tTraitLabel,\n\tDetachedSequenceId,\n\tUuidString,\n} from '../Identifiers';\n\n/**\n * Defines a place relative to sibling.\n * The \"outside\" of a trait is the `undefined` sibling,\n * so After `undefined` is the beginning of the trait, and before `undefined` is the end.\n *\n * For this purpose, traits look like:\n *\n * `{undefined} - {Node 0} - {Node 1} - ... - {Node N} - {undefined}`\n *\n * Each `{value}` in the diagram is a possible sibling, which is either a Node or undefined.\n * Each `-` in the above diagram is a `Place`, and can be describe as being `After` a particular `{sibling}` or `Before` it.\n * This means that `After` `{undefined}` means the same `Place` as before the first node\n * and `Before` `{undefined}` means the `Place` after the last Node.\n *\n * Each place can be specified, (aka 'anchored') in two ways (relative to the sibling before or after):\n * the choice of which way to anchor a place only matters when the kept across an edit, and thus evaluated in multiple contexts where the\n * two place description may no longer evaluate to the same place.\n * @alpha\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * A collection of changes to the tree that are applied atomically along with a unique identifier for the edit.\n * If any individual change fails to apply, the entire Edit will fail to apply.\n * @alpha\n */\nexport interface Edit<TChange> extends EditBase<TChange> {\n\t/**\n\t * Unique identifier for this edit. Must never be reused.\n\t * Used for referencing and de-duplicating edits.\n\t */\n\treadonly id: EditId;\n}\n\n/**\n * A collection of changes to the tree that are applied atomically. If any individual change fails to apply,\n * the entire Edit will fail to apply.\n * @internal\n */\nexport interface EditWithoutId<TChange> extends EditBase<TChange> {\n\t/**\n\t * Used to explicitly state that EditWithoutId cannot contain an id and prevents type Edit from being assigned to type EditWithoutId.\n\t */\n\treadonly id?: never;\n}\n\n/**\n * The information included in an edit.\n * @alpha\n */\nexport interface EditBase<TChange> {\n\t/**\n\t * Actual changes to apply.\n\t * Applied in order as part of a single transaction.\n\t */\n\treadonly changes: readonly TChange[];\n\n\t/**\n\t * For edits which are being re-issued due to a conflict, the number of times this edit has already been attempted.\n\t * Undefined means 0.\n\t */\n\treadonly pastAttemptCount?: number;\n\n\t// Add more metadata fields as needed in the future.\n\t// Include \"high level\"/\"Domain Specific\"/\"Hierarchal\" edits for application/domain use in implementing domain aware merge heuristics.\n}\n\n/**\n * Json compatible representation of a payload storing arbitrary Serializable data.\n *\n * Keys starting with \"IFluid\" are reserved for special use such as the JavaScript feature detection pattern and should not be used.\n *\n * See {@link comparePayloads} for equality semantics and related details (like what is allowed to be lost when serializing)\n *\n * TODO:#51984: Allow opting into heuristic blobbing in snapshots with a special IFluid key.\n * @alpha\n */\nexport type Payload = any;\n\n/**\n * Json compatible map as object.\n * Keys are TraitLabels,\n * Values are the content of the trait specified by the key.\n * @alpha\n */\nexport interface TraitMap<TChild> {\n\treadonly [key: string]: TreeNodeSequence<TChild>;\n}\n\n/**\n * A sequence of Nodes that make up a trait under a Node\n * @alpha\n */\nexport type TreeNodeSequence<TChild> = readonly TChild[];\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasTraits<TChild> {\n\treadonly traits: TraitMap<TChild>;\n}\n\n/**\n * The fields required by a node in a tree\n * @alpha\n */\nexport interface NodeData<TId> {\n\t/**\n\t * A payload of arbitrary serializable data\n\t */\n\treadonly payload?: Payload;\n\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * Typically use to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t */\n\treadonly definition: Definition;\n\t/**\n\t * Identifier which can be used to refer to this Node.\n\t */\n\treadonly identifier: TId;\n}\n\n/**\n * Satisfies `NodeData` and may contain children under traits (which may or may not be `TreeNodes`)\n * @alpha\n */\nexport interface TreeNode<TChild, TId> extends NodeData<TId>, HasTraits<TChild> {}\n\n/**\n * A tree whose nodes are either TreeNodes or a placeholder\n * @internal\n */\nexport type PlaceholderTree<TPlaceholder = never> = TreeNode<PlaceholderTree<TPlaceholder>, NodeId> | TPlaceholder;\n\n/**\n * Specifies the location of a trait (a labeled sequence of nodes) within the tree.\n * @alpha\n */\nexport interface TraitLocationInternal_0_0_2 {\n\treadonly parent: StableNodeId;\n\treadonly label: TraitLabel;\n}\n\n/**\n * JSON-compatible Node type. Objects of this type will be persisted in internal change objects (under Edits) in the SharedTree history.\n * @alpha\n */\nexport type ChangeNode_0_0_2 = TreeNode<ChangeNode_0_0_2, StableNodeId>;\n\n/**\n * The status code of an attempt to apply the changes in an Edit.\n * @alpha\n */\nexport enum EditStatus {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit contained a well-formed sequence of changes that couldn't be applied to the current view,\n\t * generally because concurrent changes caused one or more merge conflicts.\n\t */\n\tInvalid,\n\t/**\n\t * The edit was applied to the current view successfully.\n\t */\n\tApplied,\n}\n\n/**\n * Types of ops handled by SharedTree.\n */\nexport enum SharedTreeOpType {\n\t/** An op that includes edit information. */\n\tEdit,\n\t/** Includes a Fluid handle that corresponds to an edit chunk. */\n\tHandle,\n\t/** An op that does not affect the tree's state. */\n\tNoOp,\n\t/** Signals that SharedTree contents should be updated to match a new write format. */\n\tUpdate,\n}\n\n/**\n * SharedTreeOp containing a version stamp marking the write format of the tree which submitted it.\n */\nexport interface VersionedOp<Version extends WriteFormat = WriteFormat> {\n\t/** The supported SharedTree write version, see {@link WriteFormat}. */\n\treadonly version: Version;\n}\n\n/**\n * Requirements for SharedTree ops.\n */\nexport type SharedTreeOp_0_0_2 = SharedTreeEditOp_0_0_2 | SharedTreeNoOp | SharedTreeUpdateOp;\n\n/**\n * Op which has no application semantics. This op can be useful for triggering other\n */\nexport interface SharedTreeNoOp extends VersionedOp {\n\treadonly type: SharedTreeOpType.NoOp;\n}\n\n/**\n * Op indicating this SharedTree should upgrade its write format to the specified version.\n * The `version` field of this op reflects the version which should be upgraded to, not\n * the current version.\n * See docs/Breaking-Change-Migration.md for more details on the semantics of this op.\n */\nexport interface SharedTreeUpdateOp extends VersionedOp {\n\treadonly type: SharedTreeOpType.Update;\n}\n\n/**\n * A SharedTree op that includes edit information, and optionally a list of interned strings.\n */\nexport interface SharedTreeEditOp_0_0_2 extends VersionedOp<WriteFormat.v0_0_2> {\n\treadonly type: SharedTreeOpType.Edit;\n\t/** The collection of changes to apply. */\n\treadonly edit: Edit<ChangeInternal_0_0_2>;\n}\n\n/**\n * Format versions that SharedTree supports writing. Changes to op or summary formats necessitate updates.\n * @alpha\n */\nexport enum WriteFormat {\n\t/** Stores all edits in their raw format. */\n\tv0_0_2 = '0.0.2',\n\t/** Supports history virtualization, tree compression, string interning, and makes currentView optional. */\n\tv0_1_1 = '0.1.1',\n}\n\n/**\n * The minimal information on a SharedTree summary. Contains the summary format version.\n * @alpha\n */\nexport interface SharedTreeSummaryBase {\n\t/**\n\t * Field on summary under which version is stored.\n\t */\n\treadonly version: WriteFormat;\n}\n\n/**\n * Legacy summary format currently still used for writing.\n * TODO:#49901: Remove export when this format is no longer written.\n * @internal\n */\nexport interface SharedTreeSummary_0_0_2 extends SharedTreeSummaryBase {\n\treadonly version: WriteFormat.v0_0_2;\n\n\treadonly currentTree: ChangeNode_0_0_2;\n\t/**\n\t * A list of edits.\n\t */\n\treadonly sequencedEdits: readonly Edit<ChangeInternal_0_0_2>[];\n}\n\n/**\n * {@inheritdoc ChangeType}\n * @alpha\n */\nexport enum ChangeTypeInternal {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n\tCompressedBuild,\n}\n\n/**\n * {@inheritdoc (Change:type)}\n * @public\n */\nexport type ChangeInternal_0_0_2 =\n\t| InsertInternal_0_0_2\n\t| DetachInternal_0_0_2\n\t| BuildInternal_0_0_2\n\t| SetValueInternal_0_0_2\n\t| ConstraintInternal_0_0_2;\n\n/**\n * {@inheritdoc BuildNode}\n * @alpha\n */\nexport type BuildNodeInternal_0_0_2 = TreeNode<BuildNodeInternal_0_0_2, StableNodeId> | DetachedSequenceId;\n\n/**\n * {@inheritdoc Build}\n * @alpha\n */\nexport interface BuildInternal_0_0_2 {\n\t/** {@inheritdoc Build.destination } */\n\treadonly destination: DetachedSequenceId;\n\t/** {@inheritdoc Build.source } */\n\treadonly source: TreeNodeSequence<BuildNodeInternal_0_0_2>;\n\t/** {@inheritdoc Build.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Build;\n}\n\n/**\n * {@inheritdoc (Insert:interface)}\n * @alpha\n */\nexport interface InsertInternal_0_0_2 {\n\t/** {@inheritdoc (Insert:interface).destination } */\n\treadonly destination: StablePlaceInternal_0_0_2;\n\t/** {@inheritdoc (Insert:interface).source } */\n\treadonly source: DetachedSequenceId;\n\t/** {@inheritdoc (Insert:interface).\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Insert;\n}\n\n/**\n * {@inheritdoc Detach}\n * @alpha\n */\nexport interface DetachInternal_0_0_2 {\n\t/** {@inheritdoc Detach.destination } */\n\treadonly destination?: DetachedSequenceId;\n\t/** {@inheritdoc Detach.source } */\n\treadonly source: StableRangeInternal_0_0_2;\n\t/** {@inheritdoc Detach.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Detach;\n}\n\n/**\n * {@inheritdoc SetValue}\n * @alpha\n */\nexport interface SetValueInternal_0_0_2 {\n\t/** {@inheritdoc SetValue.nodeToModify } */\n\treadonly nodeToModify: StableNodeId;\n\t/** {@inheritdoc SetValue.payload } */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\t/** {@inheritdoc SetValue.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.SetValue;\n}\n\n/**\n * What to do when a Constraint is violated.\n * @alpha\n */\nexport enum ConstraintEffect {\n\t/**\n\t * Discard Edit.\n\t */\n\tInvalidAndDiscard,\n\n\t/**\n\t * Discard Edit, but record metadata that application may want to try and recover this change by recreating it.\n\t * Should this be the default policy for when another (non Constraint) change is invalid?\n\t */\n\tInvalidRetry,\n\n\t/**\n\t * Apply the change, but flag it for possible reconsideration by the app\n\t * (applying it is better than not, but perhaps the high level logic could produce something better).\n\t */\n\tValidRetry,\n}\n\n/**\n * {@inheritdoc Constraint}\n * @alpha\n */\nexport interface ConstraintInternal_0_0_2 {\n\t/** {@inheritdoc Constraint.toConstrain } */\n\treadonly toConstrain: StableRangeInternal_0_0_2;\n\t/** {@inheritdoc Constraint.identityHash } */\n\treadonly identityHash?: UuidString;\n\t/** {@inheritdoc Constraint.length } */\n\treadonly length?: number;\n\t/** {@inheritdoc Constraint.contentHash } */\n\treadonly contentHash?: UuidString;\n\t/** {@inheritdoc Constraint.parentNode } */\n\treadonly parentNode?: StableNodeId;\n\t/** {@inheritdoc Constraint.label } */\n\treadonly label?: TraitLabel;\n\t/** {@inheritdoc Constraint.effect } */\n\treadonly effect: ConstraintEffect;\n\t/** {@inheritdoc Constraint.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Constraint;\n}\n\n/**\n * {@inheritdoc (StablePlace:interface) }\n * @alpha\n */\nexport interface StablePlaceInternal_0_0_2 {\n\t/**\n\t * {@inheritdoc (StablePlace:interface).side }\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceSibling }\n\t */\n\treadonly referenceSibling?: StableNodeId;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceTrait }\n\t */\n\treadonly referenceTrait?: TraitLocationInternal_0_0_2;\n}\n\n/**\n * {@inheritdoc (StableRange:interface) }\n * @alpha\n */\nexport interface StableRangeInternal_0_0_2 {\n\t/** {@inheritdoc (StableRange:interface).start } */\n\treadonly start: StablePlaceInternal_0_0_2;\n\t/** {@inheritdoc (StableRange:interface).end } */\n\treadonly end: StablePlaceInternal_0_0_2;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"0.0.2.js","sourceRoot":"","sources":["../../src/persisted-types/0.0.2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf;AAqID;;;GAGG;AACH,MAAM,CAAN,IAAY,UAgBX;AAhBD,WAAY,UAAU;IACrB;;;;OAIG;IACH,qDAAS,CAAA;IACT;;;OAGG;IACH,iDAAO,CAAA;IACP;;OAEG;IACH,iDAAO,CAAA;AACR,CAAC,EAhBW,UAAU,KAAV,UAAU,QAgBrB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC3B,4CAA4C;IAC5C,uDAAI,CAAA;IACJ,iEAAiE;IACjE,2DAAM,CAAA;IACN,mDAAmD;IACnD,uDAAI,CAAA;IACJ,sFAAsF;IACtF,2DAAM,CAAA;AACP,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAyCD;;;GAGG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACtB,4CAA4C;IAC5C,+BAAgB,CAAA;IAChB,2GAA2G;IAC3G,+BAAgB,CAAA;AACjB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AA4BD;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC7B,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,6DAAK,CAAA;IACL,mEAAQ,CAAA;IACR,uEAAU,CAAA;IACV,iFAAe,CAAA;AAChB,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B;AAwED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC3B;;OAEG;IACH,iFAAiB,CAAA;IAEjB;;;OAGG;IACH,uEAAY,CAAA;IAEZ;;;OAGG;IACH,mEAAU,CAAA;AACX,CAAC,EAjBW,gBAAgB,KAAhB,gBAAgB,QAiB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tEditId,\n\tDefinition,\n\tNodeId,\n\tStableNodeId,\n\tTraitLabel,\n\tDetachedSequenceId,\n\tUuidString,\n} from '../Identifiers.js';\n\n/**\n * Defines a place relative to sibling.\n * The \"outside\" of a trait is the `undefined` sibling,\n * so After `undefined` is the beginning of the trait, and before `undefined` is the end.\n *\n * For this purpose, traits look like:\n *\n * `{undefined} - {Node 0} - {Node 1} - ... - {Node N} - {undefined}`\n *\n * Each `{value}` in the diagram is a possible sibling, which is either a Node or undefined.\n * Each `-` in the above diagram is a `Place`, and can be describe as being `After` a particular `{sibling}` or `Before` it.\n * This means that `After` `{undefined}` means the same `Place` as before the first node\n * and `Before` `{undefined}` means the `Place` after the last Node.\n *\n * Each place can be specified, (aka 'anchored') in two ways (relative to the sibling before or after):\n * the choice of which way to anchor a place only matters when the kept across an edit, and thus evaluated in multiple contexts where the\n * two place description may no longer evaluate to the same place.\n * @alpha\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * A collection of changes to the tree that are applied atomically along with a unique identifier for the edit.\n * If any individual change fails to apply, the entire Edit will fail to apply.\n * @alpha\n */\nexport interface Edit<TChange> extends EditBase<TChange> {\n\t/**\n\t * Unique identifier for this edit. Must never be reused.\n\t * Used for referencing and de-duplicating edits.\n\t */\n\treadonly id: EditId;\n}\n\n/**\n * A collection of changes to the tree that are applied atomically. If any individual change fails to apply,\n * the entire Edit will fail to apply.\n * @internal\n */\nexport interface EditWithoutId<TChange> extends EditBase<TChange> {\n\t/**\n\t * Used to explicitly state that EditWithoutId cannot contain an id and prevents type Edit from being assigned to type EditWithoutId.\n\t */\n\treadonly id?: never;\n}\n\n/**\n * The information included in an edit.\n * @alpha\n */\nexport interface EditBase<TChange> {\n\t/**\n\t * Actual changes to apply.\n\t * Applied in order as part of a single transaction.\n\t */\n\treadonly changes: readonly TChange[];\n\n\t/**\n\t * For edits which are being re-issued due to a conflict, the number of times this edit has already been attempted.\n\t * Undefined means 0.\n\t */\n\treadonly pastAttemptCount?: number;\n\n\t// Add more metadata fields as needed in the future.\n\t// Include \"high level\"/\"Domain Specific\"/\"Hierarchal\" edits for application/domain use in implementing domain aware merge heuristics.\n}\n\n/**\n * Json compatible representation of a payload storing arbitrary Serializable data.\n *\n * Keys starting with \"IFluid\" are reserved for special use such as the JavaScript feature detection pattern and should not be used.\n *\n * See {@link comparePayloads} for equality semantics and related details (like what is allowed to be lost when serializing)\n *\n * TODO:#51984: Allow opting into heuristic blobbing in snapshots with a special IFluid key.\n * @alpha\n */\nexport type Payload = any;\n\n/**\n * Json compatible map as object.\n * Keys are TraitLabels,\n * Values are the content of the trait specified by the key.\n * @alpha\n */\nexport interface TraitMap<TChild> {\n\treadonly [key: string]: TreeNodeSequence<TChild>;\n}\n\n/**\n * A sequence of Nodes that make up a trait under a Node\n * @alpha\n */\nexport type TreeNodeSequence<TChild> = readonly TChild[];\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasTraits<TChild> {\n\treadonly traits: TraitMap<TChild>;\n}\n\n/**\n * The fields required by a node in a tree\n * @alpha\n */\nexport interface NodeData<TId> {\n\t/**\n\t * A payload of arbitrary serializable data\n\t */\n\treadonly payload?: Payload;\n\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * Typically use to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t */\n\treadonly definition: Definition;\n\t/**\n\t * Identifier which can be used to refer to this Node.\n\t */\n\treadonly identifier: TId;\n}\n\n/**\n * Satisfies `NodeData` and may contain children under traits (which may or may not be `TreeNodes`)\n * @alpha\n */\nexport interface TreeNode<TChild, TId> extends NodeData<TId>, HasTraits<TChild> {}\n\n/**\n * A tree whose nodes are either TreeNodes or a placeholder\n * @internal\n */\nexport type PlaceholderTree<TPlaceholder = never> = TreeNode<PlaceholderTree<TPlaceholder>, NodeId> | TPlaceholder;\n\n/**\n * Specifies the location of a trait (a labeled sequence of nodes) within the tree.\n * @alpha\n */\nexport interface TraitLocationInternal_0_0_2 {\n\treadonly parent: StableNodeId;\n\treadonly label: TraitLabel;\n}\n\n/**\n * JSON-compatible Node type. Objects of this type will be persisted in internal change objects (under Edits) in the SharedTree history.\n * @alpha\n */\nexport type ChangeNode_0_0_2 = TreeNode<ChangeNode_0_0_2, StableNodeId>;\n\n/**\n * The status code of an attempt to apply the changes in an Edit.\n * @alpha\n */\nexport enum EditStatus {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit contained a well-formed sequence of changes that couldn't be applied to the current view,\n\t * generally because concurrent changes caused one or more merge conflicts.\n\t */\n\tInvalid,\n\t/**\n\t * The edit was applied to the current view successfully.\n\t */\n\tApplied,\n}\n\n/**\n * Types of ops handled by SharedTree.\n */\nexport enum SharedTreeOpType {\n\t/** An op that includes edit information. */\n\tEdit,\n\t/** Includes a Fluid handle that corresponds to an edit chunk. */\n\tHandle,\n\t/** An op that does not affect the tree's state. */\n\tNoOp,\n\t/** Signals that SharedTree contents should be updated to match a new write format. */\n\tUpdate,\n}\n\n/**\n * SharedTreeOp containing a version stamp marking the write format of the tree which submitted it.\n */\nexport interface VersionedOp<Version extends WriteFormat = WriteFormat> {\n\t/** The supported SharedTree write version, see {@link WriteFormat}. */\n\treadonly version: Version;\n}\n\n/**\n * Requirements for SharedTree ops.\n */\nexport type SharedTreeOp_0_0_2 = SharedTreeEditOp_0_0_2 | SharedTreeNoOp | SharedTreeUpdateOp;\n\n/**\n * Op which has no application semantics. This op can be useful for triggering other\n */\nexport interface SharedTreeNoOp extends VersionedOp {\n\treadonly type: SharedTreeOpType.NoOp;\n}\n\n/**\n * Op indicating this SharedTree should upgrade its write format to the specified version.\n * The `version` field of this op reflects the version which should be upgraded to, not\n * the current version.\n * See docs/Breaking-Change-Migration.md for more details on the semantics of this op.\n */\nexport interface SharedTreeUpdateOp extends VersionedOp {\n\treadonly type: SharedTreeOpType.Update;\n}\n\n/**\n * A SharedTree op that includes edit information, and optionally a list of interned strings.\n */\nexport interface SharedTreeEditOp_0_0_2 extends VersionedOp<WriteFormat.v0_0_2> {\n\treadonly type: SharedTreeOpType.Edit;\n\t/** The collection of changes to apply. */\n\treadonly edit: Edit<ChangeInternal_0_0_2>;\n}\n\n/**\n * Format versions that SharedTree supports writing. Changes to op or summary formats necessitate updates.\n * @alpha\n */\nexport enum WriteFormat {\n\t/** Stores all edits in their raw format. */\n\tv0_0_2 = '0.0.2',\n\t/** Supports history virtualization, tree compression, string interning, and makes currentView optional. */\n\tv0_1_1 = '0.1.1',\n}\n\n/**\n * The minimal information on a SharedTree summary. Contains the summary format version.\n * @alpha\n */\nexport interface SharedTreeSummaryBase {\n\t/**\n\t * Field on summary under which version is stored.\n\t */\n\treadonly version: WriteFormat;\n}\n\n/**\n * Legacy summary format currently still used for writing.\n * TODO:#49901: Remove export when this format is no longer written.\n * @internal\n */\nexport interface SharedTreeSummary_0_0_2 extends SharedTreeSummaryBase {\n\treadonly version: WriteFormat.v0_0_2;\n\n\treadonly currentTree: ChangeNode_0_0_2;\n\t/**\n\t * A list of edits.\n\t */\n\treadonly sequencedEdits: readonly Edit<ChangeInternal_0_0_2>[];\n}\n\n/**\n * {@inheritdoc ChangeType}\n * @alpha\n */\nexport enum ChangeTypeInternal {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n\tCompressedBuild,\n}\n\n/**\n * {@inheritdoc (Change:type)}\n * @public\n */\nexport type ChangeInternal_0_0_2 =\n\t| InsertInternal_0_0_2\n\t| DetachInternal_0_0_2\n\t| BuildInternal_0_0_2\n\t| SetValueInternal_0_0_2\n\t| ConstraintInternal_0_0_2;\n\n/**\n * {@inheritdoc BuildNode}\n * @alpha\n */\nexport type BuildNodeInternal_0_0_2 = TreeNode<BuildNodeInternal_0_0_2, StableNodeId> | DetachedSequenceId;\n\n/**\n * {@inheritdoc Build}\n * @alpha\n */\nexport interface BuildInternal_0_0_2 {\n\t/** {@inheritdoc Build.destination } */\n\treadonly destination: DetachedSequenceId;\n\t/** {@inheritdoc Build.source } */\n\treadonly source: TreeNodeSequence<BuildNodeInternal_0_0_2>;\n\t/** {@inheritdoc Build.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Build;\n}\n\n/**\n * {@inheritdoc (Insert:interface)}\n * @alpha\n */\nexport interface InsertInternal_0_0_2 {\n\t/** {@inheritdoc (Insert:interface).destination } */\n\treadonly destination: StablePlaceInternal_0_0_2;\n\t/** {@inheritdoc (Insert:interface).source } */\n\treadonly source: DetachedSequenceId;\n\t/** {@inheritdoc (Insert:interface).\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Insert;\n}\n\n/**\n * {@inheritdoc Detach}\n * @alpha\n */\nexport interface DetachInternal_0_0_2 {\n\t/** {@inheritdoc Detach.destination } */\n\treadonly destination?: DetachedSequenceId;\n\t/** {@inheritdoc Detach.source } */\n\treadonly source: StableRangeInternal_0_0_2;\n\t/** {@inheritdoc Detach.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Detach;\n}\n\n/**\n * {@inheritdoc SetValue}\n * @alpha\n */\nexport interface SetValueInternal_0_0_2 {\n\t/** {@inheritdoc SetValue.nodeToModify } */\n\treadonly nodeToModify: StableNodeId;\n\t/** {@inheritdoc SetValue.payload } */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\t/** {@inheritdoc SetValue.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.SetValue;\n}\n\n/**\n * What to do when a Constraint is violated.\n * @alpha\n */\nexport enum ConstraintEffect {\n\t/**\n\t * Discard Edit.\n\t */\n\tInvalidAndDiscard,\n\n\t/**\n\t * Discard Edit, but record metadata that application may want to try and recover this change by recreating it.\n\t * Should this be the default policy for when another (non Constraint) change is invalid?\n\t */\n\tInvalidRetry,\n\n\t/**\n\t * Apply the change, but flag it for possible reconsideration by the app\n\t * (applying it is better than not, but perhaps the high level logic could produce something better).\n\t */\n\tValidRetry,\n}\n\n/**\n * {@inheritdoc Constraint}\n * @alpha\n */\nexport interface ConstraintInternal_0_0_2 {\n\t/** {@inheritdoc Constraint.toConstrain } */\n\treadonly toConstrain: StableRangeInternal_0_0_2;\n\t/** {@inheritdoc Constraint.identityHash } */\n\treadonly identityHash?: UuidString;\n\t/** {@inheritdoc Constraint.length } */\n\treadonly length?: number;\n\t/** {@inheritdoc Constraint.contentHash } */\n\treadonly contentHash?: UuidString;\n\t/** {@inheritdoc Constraint.parentNode } */\n\treadonly parentNode?: StableNodeId;\n\t/** {@inheritdoc Constraint.label } */\n\treadonly label?: TraitLabel;\n\t/** {@inheritdoc Constraint.effect } */\n\treadonly effect: ConstraintEffect;\n\t/** {@inheritdoc Constraint.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.Constraint;\n}\n\n/**\n * {@inheritdoc (StablePlace:interface) }\n * @alpha\n */\nexport interface StablePlaceInternal_0_0_2 {\n\t/**\n\t * {@inheritdoc (StablePlace:interface).side }\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceSibling }\n\t */\n\treadonly referenceSibling?: StableNodeId;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceTrait }\n\t */\n\treadonly referenceTrait?: TraitLocationInternal_0_0_2;\n}\n\n/**\n * {@inheritdoc (StableRange:interface) }\n * @alpha\n */\nexport interface StableRangeInternal_0_0_2 {\n\t/** {@inheritdoc (StableRange:interface).start } */\n\treadonly start: StablePlaceInternal_0_0_2;\n\t/** {@inheritdoc (StableRange:interface).end } */\n\treadonly end: StablePlaceInternal_0_0_2;\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ReplaceRecursive } from '../Common';
|
|
6
|
-
import type { IdCreationRange, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession } from '../id-compressor';
|
|
7
|
-
import type { Definition, DetachedSequenceId, EditId, FinalNodeId, InternedStringId, NodeId, OpSpaceNodeId, SessionId, TraitLabel, UuidString } from '../Identifiers';
|
|
8
|
-
import { BuildInternal_0_0_2, ChangeTypeInternal, ConstraintEffect, ConstraintInternal_0_0_2, DetachInternal_0_0_2, Edit, EditWithoutId, InsertInternal_0_0_2, NodeData, Payload, SetValueInternal_0_0_2, SharedTreeNoOp, SharedTreeOpType, SharedTreeSummaryBase, SharedTreeUpdateOp, StablePlaceInternal_0_0_2, TraitLocationInternal_0_0_2, TreeNode, TreeNodeSequence, VersionedOp, WriteFormat } from './0.0.2';
|
|
5
|
+
import { ReplaceRecursive } from '../Common.js';
|
|
6
|
+
import type { IdCreationRange, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession } from '../id-compressor/index.js';
|
|
7
|
+
import type { Definition, DetachedSequenceId, EditId, FinalNodeId, InternedStringId, NodeId, OpSpaceNodeId, SessionId, TraitLabel, UuidString } from '../Identifiers.js';
|
|
8
|
+
import { BuildInternal_0_0_2, ChangeTypeInternal, ConstraintEffect, ConstraintInternal_0_0_2, DetachInternal_0_0_2, Edit, EditWithoutId, InsertInternal_0_0_2, NodeData, Payload, SetValueInternal_0_0_2, SharedTreeNoOp, SharedTreeOpType, SharedTreeSummaryBase, SharedTreeUpdateOp, StablePlaceInternal_0_0_2, TraitLocationInternal_0_0_2, TreeNode, TreeNodeSequence, VersionedOp, WriteFormat } from './0.0.2.js';
|
|
9
9
|
/**
|
|
10
10
|
* Specifies the location of a trait (a labeled sequence of nodes) within the tree.
|
|
11
11
|
* @alpha
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0.1.1.d.ts","sourceRoot":"","sources":["../../src/persisted-types/0.1.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAsB,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"0.1.1.d.ts","sourceRoot":"","sources":["../../src/persisted-types/0.1.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EACX,eAAe,EACf,mCAAmC,EACnC,wCAAwC,EACxC,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACX,UAAU,EACV,kBAAkB,EAClB,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAElB,yBAAyB,EACzB,2BAA2B,EAC3B,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC;IACzF,QAAQ,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,MAAM,cAAc,WAAsD,CAAC"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { assert } from '@fluidframework/core-utils';
|
|
6
|
-
import { assertNotUndefined } from '../Common';
|
|
7
|
-
import { ChangeTypeInternal, Side, } from './0.0.2';
|
|
6
|
+
import { assertNotUndefined } from '../Common.js';
|
|
7
|
+
import { ChangeTypeInternal, Side, } from './0.0.2.js';
|
|
8
8
|
// Note: Documentation of this constant is merged with documentation of the `ChangeInternal` interface.
|
|
9
9
|
/**
|
|
10
10
|
* @alpha
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0.1.1.js","sourceRoot":"","sources":["../../src/persisted-types/0.1.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,WAAW,CAAC;AAmBjE,OAAO,EAEN,kBAAkB,EAclB,IAAI,GAOJ,MAAM,SAAS,CAAC;AAgOjB,uGAAuG;AACvG;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,KAAK,EAAE,CAAC,MAA2C,EAAE,WAA+B,EAAiB,EAAE,CAAC,CAAC;QACxG,WAAW;QACX,MAAM;QACN,IAAI,EAAE,kBAAkB,CAAC,KAAK;KAC9B,CAAC;IAEF,MAAM,EAAE,CAAC,MAA0B,EAAE,WAAgC,EAAkB,EAAE,CAAC,CAAC;QAC1F,WAAW;QACX,MAAM;QACN,IAAI,EAAE,kBAAkB,CAAC,MAAM;KAC/B,CAAC;IAEF,MAAM,EAAE,CAAC,MAA2B,EAAE,WAAgC,EAAkB,EAAE,CAAC,CAAC;QAC3F,WAAW;QACX,MAAM;QACN,IAAI,EAAE,kBAAkB,CAAC,MAAM;KAC/B,CAAC;IAEF,UAAU,EAAE,CAAC,YAAuC,EAAE,OAAgB,EAAoB,EAAE,CAA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;;;OAGG;IACH,IAAI,EAAE,CAAC,IAA+B,EAAuB,EAAE,CAAC,CAAC;QAChE,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,GAAG,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;KACpC,CAAC;IACF;;;;OAIG;IACH,GAAG,EAAE,CAAC,KAA4B,EAAuB,EAAE,CAAC,CAAC;QAC5D,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC;QAC3C,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC;KACvC,CAAC;CACF,CAAC;AA2BF,sFAAsF;AACtF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,2CAA2C;AAC3C,8BAA8B;AAC9B,MAAM,CAAC,MAAM,cAAc,GAAG,sCAAmD,CAAC;AAElF,+EAA+E;AAC/E,SAAS,SAAS,CAAM,IAAyB;IAChD,OAAQ,IAAsB,CAAC,UAAU,IAAK,IAAY,CAAC;AAC5D,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 { assertNotUndefined, ReplaceRecursive } from '../Common';\n// These are re-exported from a persisted-types file.\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from '../id-compressor';\nimport type {\n\tDefinition,\n\tDetachedSequenceId,\n\tEditId,\n\tFinalNodeId,\n\tInternedStringId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tTraitLabel,\n\tUuidString,\n} from '../Identifiers';\nimport {\n\tBuildInternal_0_0_2,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tConstraintInternal_0_0_2,\n\tDetachInternal_0_0_2,\n\tEdit,\n\tEditWithoutId,\n\tInsertInternal_0_0_2,\n\tNodeData,\n\tPayload,\n\tSetValueInternal_0_0_2,\n\tSharedTreeNoOp,\n\tSharedTreeOpType,\n\tSharedTreeSummaryBase,\n\tSharedTreeUpdateOp,\n\tSide,\n\tStablePlaceInternal_0_0_2,\n\tTraitLocationInternal_0_0_2,\n\tTreeNode,\n\tTreeNodeSequence,\n\tVersionedOp,\n\tWriteFormat,\n} from './0.0.2';\n\n/**\n * Specifies the location of a trait (a labeled sequence of nodes) within the tree.\n * @alpha\n */\nexport interface TraitLocationInternal extends Omit<TraitLocationInternal_0_0_2, 'parent'> {\n\treadonly parent: NodeId;\n}\n\n/**\n * Alternating list of label then children list under that label.\n * The label may be interned, and children are {@link CompressedPlaceholderTree}.\n */\nexport type CompressedTraits<TId extends OpSpaceNodeId, TPlaceholder extends number | never> = (\n\t| InternedStringId\n\t| TraitLabel\n\t| (CompressedPlaceholderTree<TId, TPlaceholder> | TPlaceholder)[]\n)[];\n\n/**\n * A TreeNode that has been compressed into the following array format:\n * [identifier, definition, traits, payload],\n * where traits is also an array of [label, [trait], label, [trait], ...].\n * Payload is omitted if empty, and traits will be an empty subarray if no traits exist but a payload exists.\n * If both traits and payload does not exist, then both are omitted.\n * All trait labels and node definitions may also be string interned.\n * @internal\n */\nexport type CompressedPlaceholderTree<TId extends OpSpaceNodeId, TPlaceholder extends number | never> =\n\t| TPlaceholder\n\t| [InternedStringId | Definition] // The node Definition's interned string ID\n\t| [InternedStringId | Definition, TId]\n\t| [\n\t\t\tInternedStringId | Definition,\n\t\t\t[Payload, ...CompressedTraits<TId, TPlaceholder>] | CompressedTraits<TId, TPlaceholder>,\n\t ]\n\t| [\n\t\t\tInternedStringId | Definition,\n\t\t\tTId,\n\t\t\t[Payload, ...CompressedTraits<TId, TPlaceholder>] | CompressedTraits<TId, TPlaceholder>,\n\t ];\n\n/**\n * JSON-compatible Node type. Objects of this type will be persisted in internal change objects (under Edits) in the SharedTree history.\n * @internal\n */\nexport type ChangeNode = TreeNode<ChangeNode, NodeId>;\n\n/**\n * A ChangeNode that has been compressed into a {@link CompressedPlaceholderTree}.\n */\nexport type CompressedChangeNode<TId extends OpSpaceNodeId> = CompressedPlaceholderTree<TId, never>;\n\n/**\n * The contents of a SharedTree summary for write format 0.1.1.\n * Contains the current tree in a compressed format,\n * the edits needed to get from `initialTree` to the current tree,\n * and the interned strings that can be used to retrieve the interned summary.\n */\nexport interface SharedTreeSummary extends SharedTreeSummaryBase {\n\treadonly version: WriteFormat.v0_1_1;\n\n\treadonly currentTree?: CompressedChangeNode<FinalNodeId>;\n\n\t/**\n\t * Information that can populate an edit log.\n\t */\n\treadonly editHistory: EditLogSummary<CompressedChangeInternal<FinalNodeId>, FluidEditHandle>;\n\n\t/**\n\t * List of interned strings.\n\t * In 0.1.1, definitions and trait labels are interned deterministically on sequenced ops,\n\t * and each client maintains a string interner whose lifetime is tied to the SharedTree.\n\t */\n\treadonly internedStrings: readonly string[];\n\n\t/**\n\t * Information about all IDs compressed in the summary\n\t */\n\treadonly idCompressor: SerializedIdCompressorWithNoSession | SerializedIdCompressorWithOngoingSession;\n}\n\n/**\n * Information used to populate an edit log.\n * In 0.1.1, this is a persisted type only for `EditLogSummary<CompressedChangeInternal, FluidEditHandle>`,\n * where calling `FluidEditHandle.get` returns an array buffer of compressed `editChunk` contents.\n * The type is parameterized to avoid nearly identical type definitions for uncompressed forms of the edit\n * log, and abstracting away the fact that handle fetching needs to invoke decompression.\n * @internal\n */\nexport interface EditLogSummary<TChange, THandle> {\n\t/**\n\t * A of list of serialized chunks and their corresponding keys.\n\t * Start revision is the index of the first edit in the chunk in relation to the edit log.\n\t */\n\treadonly editChunks: readonly {\n\t\treadonly startRevision: number;\n\t\t/**\n\t\t * Either a chunk of edits or a handle that can be used to load that chunk.\n\t\t */\n\t\treadonly chunk: THandle | readonly EditWithoutId<TChange>[];\n\t}[];\n\n\t/**\n\t * A list of edits IDs for all sequenced edits.\n\t */\n\treadonly editIds: readonly EditId[];\n}\n\n/**\n * FluidEditHandles are used to load edit chunks stored outside of the EditLog.\n * Can be satisfied by IFluidHandle<ArrayBufferLike>.\n * Note that though this is in `PersistedTypes`, it isn't directly serializable (e.g. `get` is a function).\n * Its serialization relies on being encoded via an IFluidSerializer.\n * @internal\n */\nexport interface FluidEditHandle {\n\treadonly get: () => Promise<ArrayBuffer>;\n\treadonly absolutePath: string;\n}\n\n// Future write formats should make this a union type and append to it (e.g. `EditChunkContents_0_1_1 | EditChunkContents_2_0_0`).\nexport type EditChunkContents = EditChunkContents_0_1_1;\n\nexport interface EditChunkContents_0_1_1 {\n\tversion: WriteFormat.v0_1_1;\n\tedits: readonly EditWithoutId<CompressedChangeInternal<FinalNodeId>>[];\n}\n\n/**\n * Compressed change format type.\n * Encodes the same information as a {@link ChangeInternal}, but uses a more compact object format for `build` changes.\n */\nexport type CompressedChangeInternal<TId extends OpSpaceNodeId> =\n\t| ReplaceRecursive<Exclude<ChangeInternal, BuildInternal>, NodeId, TId>\n\t| CompressedBuildInternal<TId>;\n\n/**\n * A compressed version of {@link BuildInternal} where the source is a sequence of compressed nodes.\n */\nexport interface CompressedBuildInternal<TId extends OpSpaceNodeId> {\n\t/** {@inheritdoc Build.destination } */\n\treadonly destination: DetachedSequenceId;\n\t/** A sequence of nodes to build in some compressed format. */\n\treadonly source: TreeNodeSequence<CompressedBuildNode<TId>>;\n\t/** {@inheritdoc Build.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.CompressedBuild;\n}\n\n/**\n * A BuildNode that has been compressed into a {@link CompressedPlaceholderTree}.\n */\nexport type CompressedBuildNode<TId extends OpSpaceNodeId> = CompressedPlaceholderTree<TId, DetachedSequenceId>;\n\n// TODO: `ChangeInternal`s should be assignable to this type without casting; this will require some test refactoring.\n/**\n * This type should be used as an opaque handle in the public API for `ChangeInternal` objects.\n * This is useful for supporting public APIs which involve working with a tree's edit history,\n * which will involve changes that have already been internalized.\n * @alpha\n */\nexport interface InternalizedChange {\n\tInternalChangeBrand: '2cae1045-61cf-4ef7-a6a3-8ad920cb7ab3';\n}\n\n/**\n * {@inheritdoc (Change:type)}\n * @alpha\n */\nexport type ChangeInternal = InsertInternal | DetachInternal | BuildInternal | SetValueInternal | ConstraintInternal;\n\n/**\n * {@inheritdoc BuildNode}\n * @alpha\n */\nexport type BuildNodeInternal = TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\n/**\n * {@inheritdoc Build}\n * @alpha\n */\nexport interface BuildInternal extends Omit<BuildInternal_0_0_2, 'source'> {\n\treadonly source: TreeNodeSequence<BuildNodeInternal>;\n}\n\n/**\n * {@inheritdoc (Insert:interface)}\n * @alpha\n */\nexport interface InsertInternal extends Omit<InsertInternal_0_0_2, 'destination'> {\n\t/** {@inheritdoc (Insert:interface).destination } */\n\treadonly destination: StablePlaceInternal;\n}\n\n/**\n * {@inheritdoc Detach}\n * @alpha\n */\nexport interface DetachInternal extends Omit<DetachInternal_0_0_2, 'source'> {\n\t/** {@inheritdoc Detach.source } */\n\treadonly source: StableRangeInternal;\n}\n\n/**\n * {@inheritdoc SetValue}\n * @alpha\n */\nexport interface SetValueInternal extends Omit<SetValueInternal_0_0_2, 'nodeToModify'> {\n\t/** {@inheritdoc SetValue.nodeToModify } */\n\treadonly nodeToModify: NodeId;\n}\n\n/**\n * {@inheritdoc Constraint}\n * @alpha\n */\nexport interface ConstraintInternal extends Omit<ConstraintInternal_0_0_2, 'toConstrain' | 'parentNode'> {\n\t/** {@inheritdoc Constraint.toConstrain } */\n\treadonly toConstrain: StableRangeInternal;\n\t/** {@inheritdoc Constraint.parentNode } */\n\treadonly parentNode?: NodeId;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `ChangeInternal` interface.\n/**\n * @alpha\n */\nexport const ChangeInternal = {\n\tbuild: (source: TreeNodeSequence<BuildNodeInternal>, destination: DetachedSequenceId): BuildInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Build,\n\t}),\n\n\tinsert: (source: DetachedSequenceId, destination: StablePlaceInternal): InsertInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Insert,\n\t}),\n\n\tdetach: (source: StableRangeInternal, destination?: DetachedSequenceId): DetachInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeData<NodeId> | NodeId, payload: Payload): SetValueInternal => ({\n\t\tnodeToModify: getNodeId(nodeToModify),\n\t\tpayload,\n\t\ttype: ChangeTypeInternal.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeData<NodeId> | NodeId): SetValueInternal => ({\n\t\tnodeToModify: getNodeId(nodeToModify),\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeTypeInternal.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRangeInternal,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): ConstraintInternal => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeTypeInternal.Constraint,\n\t}),\n\n\t/** {@inheritdoc (Change:variable).delete } */\n\tdelete: (stableRange: StableRangeInternal): ChangeInternal => ChangeInternal.detach(stableRange),\n\n\t/** {@inheritdoc (Change:variable).insertTree } */\n\tinsertTree: (nodes: TreeNodeSequence<BuildNodeInternal>, destination: StablePlaceInternal): ChangeInternal[] => {\n\t\tconst build = ChangeInternal.build(nodes, 0 as DetachedSequenceId);\n\t\treturn [build, ChangeInternal.insert(build.destination, destination)];\n\t},\n\n\t/** {@inheritdoc (Change:variable).move } */\n\tmove: (source: StableRangeInternal, destination: StablePlaceInternal): ChangeInternal[] => {\n\t\tconst detach = ChangeInternal.detach(source, 0 as DetachedSequenceId);\n\t\treturn [detach, ChangeInternal.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * {@inheritdoc (StablePlace:interface) }\n * @alpha\n */\nexport interface StablePlaceInternal extends Omit<StablePlaceInternal_0_0_2, 'referenceSibling' | 'referenceTrait'> {\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceSibling }\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceTrait }\n\t */\n\treadonly referenceTrait?: TraitLocationInternal;\n}\n\n/**\n * {@inheritdoc (StableRange:interface) }\n * @alpha\n */\nexport interface StableRangeInternal {\n\t/** {@inheritdoc (StableRange:interface).start } */\n\treadonly start: StablePlaceInternal;\n\t/** {@inheritdoc (StableRange:interface).end } */\n\treadonly end: StablePlaceInternal;\n}\n\n/**\n * The remainder of this file consists of factory methods duplicated with those for StableRange/StablePlace and are maintained while\n * the new persisted version of SharedTree ops/summaries is rolled out.\n */\n\n/**\n * @alpha\n */\nexport const StablePlaceInternal = {\n\t/**\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlaceInternal => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlaceInternal => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocationInternal): StablePlaceInternal => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocationInternal): StablePlaceInternal => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n/**\n * @alpha\n */\nexport const StableRangeInternal = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlaceInternal): { to: (end: StablePlaceInternal) => StableRangeInternal } => ({\n\t\tto: (end: StablePlaceInternal): StableRangeInternal => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x65e /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x65f /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains only the provided `node`.\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRangeInternal => ({\n\t\tstart: StablePlaceInternal.before(node),\n\t\tend: StablePlaceInternal.after(node),\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains everything in the trait.\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocationInternal): StableRangeInternal => ({\n\t\tstart: StablePlaceInternal.atStartOf(trait),\n\t\tend: StablePlaceInternal.atEndOf(trait),\n\t}),\n};\n\n/**\n * Discriminated union of valid 0.0.1 SharedTree op types.\n */\nexport type SharedTreeOp = SharedTreeEditOp | SharedTreeHandleOp | SharedTreeUpdateOp | SharedTreeNoOp;\n\nexport interface SharedTreeEditOp extends VersionedOp<WriteFormat.v0_1_1> {\n\treadonly type: SharedTreeOpType.Edit;\n\t/** The collection of changes to apply. */\n\treadonly edit: Edit<CompressedChangeInternal<OpSpaceNodeId>>;\n\t/** Contains all the IDs generated by the originating client since the last sent op */\n\treadonly idRange: IdCreationRange;\n}\n\n/**\n * A SharedTree op that includes edit handle information.\n * The handle corresponds to an edit chunk in the edit log.\n */\nexport interface SharedTreeHandleOp extends VersionedOp<WriteFormat.v0_1_1> {\n\treadonly type: SharedTreeOpType.Handle;\n\t/** The serialized handle to an uploaded edit chunk. */\n\treadonly editHandle: string;\n\t/** The index of the first edit in the chunk that corresponds to the handle. */\n\treadonly startRevision: number;\n}\n\n/** The number of IDs that a SharedTree reserves for current or future internal use */\n// This value must never change\nexport const reservedIdCount = 10;\n\n/** The SessionID of the Upgrade Session */\n// This UUID must never change\nexport const ghostSessionId = '79590933-1c70-4fda-817a-adab57c20318' as SessionId;\n\n/** Accepts either a node or a node's identifier, and returns the identifier */\nfunction getNodeId<TId>(node: TId | NodeData<TId>): TId {\n\treturn (node as NodeData<TId>).identifier ?? (node as TId);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"0.1.1.js","sourceRoot":"","sources":["../../src/persisted-types/0.1.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,cAAc,CAAC;AAmBpE,OAAO,EAEN,kBAAkB,EAclB,IAAI,GAOJ,MAAM,YAAY,CAAC;AAgOpB,uGAAuG;AACvG;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,KAAK,EAAE,CAAC,MAA2C,EAAE,WAA+B,EAAiB,EAAE,CAAC,CAAC;QACxG,WAAW;QACX,MAAM;QACN,IAAI,EAAE,kBAAkB,CAAC,KAAK;KAC9B,CAAC;IAEF,MAAM,EAAE,CAAC,MAA0B,EAAE,WAAgC,EAAkB,EAAE,CAAC,CAAC;QAC1F,WAAW;QACX,MAAM;QACN,IAAI,EAAE,kBAAkB,CAAC,MAAM;KAC/B,CAAC;IAEF,MAAM,EAAE,CAAC,MAA2B,EAAE,WAAgC,EAAkB,EAAE,CAAC,CAAC;QAC3F,WAAW;QACX,MAAM;QACN,IAA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AC,wEAAwE,CAC9E,CAAC;aACF;YACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACvB,CAAC;KACD,CAAC;IACF;;;OAGG;IACH,IAAI,EAAE,CAAC,IAA+B,EAAuB,EAAE,CAAC,CAAC;QAChE,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,GAAG,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;KACpC,CAAC;IACF;;;;OAIG;IACH,GAAG,EAAE,CAAC,KAA4B,EAAuB,EAAE,CAAC,CAAC;QAC5D,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC;QAC3C,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC;KACvC,CAAC;CACF,CAAC;AA2BF,sFAAsF;AACtF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,2CAA2C;AAC3C,8BAA8B;AAC9B,MAAM,CAAC,MAAM,cAAc,GAAG,sCAAmD,CAAC;AAElF,+EAA+E;AAC/E,SAAS,SAAS,CAAM,IAAyB;IAChD,OAAQ,IAAsB,CAAC,UAAU,IAAK,IAAY,CAAC;AAC5D,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 { assertNotUndefined, ReplaceRecursive } from '../Common.js';\n// These are re-exported from a persisted-types file.\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from '../id-compressor/index.js';\nimport type {\n\tDefinition,\n\tDetachedSequenceId,\n\tEditId,\n\tFinalNodeId,\n\tInternedStringId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tTraitLabel,\n\tUuidString,\n} from '../Identifiers.js';\nimport {\n\tBuildInternal_0_0_2,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tConstraintInternal_0_0_2,\n\tDetachInternal_0_0_2,\n\tEdit,\n\tEditWithoutId,\n\tInsertInternal_0_0_2,\n\tNodeData,\n\tPayload,\n\tSetValueInternal_0_0_2,\n\tSharedTreeNoOp,\n\tSharedTreeOpType,\n\tSharedTreeSummaryBase,\n\tSharedTreeUpdateOp,\n\tSide,\n\tStablePlaceInternal_0_0_2,\n\tTraitLocationInternal_0_0_2,\n\tTreeNode,\n\tTreeNodeSequence,\n\tVersionedOp,\n\tWriteFormat,\n} from './0.0.2.js';\n\n/**\n * Specifies the location of a trait (a labeled sequence of nodes) within the tree.\n * @alpha\n */\nexport interface TraitLocationInternal extends Omit<TraitLocationInternal_0_0_2, 'parent'> {\n\treadonly parent: NodeId;\n}\n\n/**\n * Alternating list of label then children list under that label.\n * The label may be interned, and children are {@link CompressedPlaceholderTree}.\n */\nexport type CompressedTraits<TId extends OpSpaceNodeId, TPlaceholder extends number | never> = (\n\t| InternedStringId\n\t| TraitLabel\n\t| (CompressedPlaceholderTree<TId, TPlaceholder> | TPlaceholder)[]\n)[];\n\n/**\n * A TreeNode that has been compressed into the following array format:\n * [identifier, definition, traits, payload],\n * where traits is also an array of [label, [trait], label, [trait], ...].\n * Payload is omitted if empty, and traits will be an empty subarray if no traits exist but a payload exists.\n * If both traits and payload does not exist, then both are omitted.\n * All trait labels and node definitions may also be string interned.\n * @internal\n */\nexport type CompressedPlaceholderTree<TId extends OpSpaceNodeId, TPlaceholder extends number | never> =\n\t| TPlaceholder\n\t| [InternedStringId | Definition] // The node Definition's interned string ID\n\t| [InternedStringId | Definition, TId]\n\t| [\n\t\t\tInternedStringId | Definition,\n\t\t\t[Payload, ...CompressedTraits<TId, TPlaceholder>] | CompressedTraits<TId, TPlaceholder>,\n\t ]\n\t| [\n\t\t\tInternedStringId | Definition,\n\t\t\tTId,\n\t\t\t[Payload, ...CompressedTraits<TId, TPlaceholder>] | CompressedTraits<TId, TPlaceholder>,\n\t ];\n\n/**\n * JSON-compatible Node type. Objects of this type will be persisted in internal change objects (under Edits) in the SharedTree history.\n * @internal\n */\nexport type ChangeNode = TreeNode<ChangeNode, NodeId>;\n\n/**\n * A ChangeNode that has been compressed into a {@link CompressedPlaceholderTree}.\n */\nexport type CompressedChangeNode<TId extends OpSpaceNodeId> = CompressedPlaceholderTree<TId, never>;\n\n/**\n * The contents of a SharedTree summary for write format 0.1.1.\n * Contains the current tree in a compressed format,\n * the edits needed to get from `initialTree` to the current tree,\n * and the interned strings that can be used to retrieve the interned summary.\n */\nexport interface SharedTreeSummary extends SharedTreeSummaryBase {\n\treadonly version: WriteFormat.v0_1_1;\n\n\treadonly currentTree?: CompressedChangeNode<FinalNodeId>;\n\n\t/**\n\t * Information that can populate an edit log.\n\t */\n\treadonly editHistory: EditLogSummary<CompressedChangeInternal<FinalNodeId>, FluidEditHandle>;\n\n\t/**\n\t * List of interned strings.\n\t * In 0.1.1, definitions and trait labels are interned deterministically on sequenced ops,\n\t * and each client maintains a string interner whose lifetime is tied to the SharedTree.\n\t */\n\treadonly internedStrings: readonly string[];\n\n\t/**\n\t * Information about all IDs compressed in the summary\n\t */\n\treadonly idCompressor: SerializedIdCompressorWithNoSession | SerializedIdCompressorWithOngoingSession;\n}\n\n/**\n * Information used to populate an edit log.\n * In 0.1.1, this is a persisted type only for `EditLogSummary<CompressedChangeInternal, FluidEditHandle>`,\n * where calling `FluidEditHandle.get` returns an array buffer of compressed `editChunk` contents.\n * The type is parameterized to avoid nearly identical type definitions for uncompressed forms of the edit\n * log, and abstracting away the fact that handle fetching needs to invoke decompression.\n * @internal\n */\nexport interface EditLogSummary<TChange, THandle> {\n\t/**\n\t * A of list of serialized chunks and their corresponding keys.\n\t * Start revision is the index of the first edit in the chunk in relation to the edit log.\n\t */\n\treadonly editChunks: readonly {\n\t\treadonly startRevision: number;\n\t\t/**\n\t\t * Either a chunk of edits or a handle that can be used to load that chunk.\n\t\t */\n\t\treadonly chunk: THandle | readonly EditWithoutId<TChange>[];\n\t}[];\n\n\t/**\n\t * A list of edits IDs for all sequenced edits.\n\t */\n\treadonly editIds: readonly EditId[];\n}\n\n/**\n * FluidEditHandles are used to load edit chunks stored outside of the EditLog.\n * Can be satisfied by IFluidHandle<ArrayBufferLike>.\n * Note that though this is in `PersistedTypes`, it isn't directly serializable (e.g. `get` is a function).\n * Its serialization relies on being encoded via an IFluidSerializer.\n * @internal\n */\nexport interface FluidEditHandle {\n\treadonly get: () => Promise<ArrayBuffer>;\n\treadonly absolutePath: string;\n}\n\n// Future write formats should make this a union type and append to it (e.g. `EditChunkContents_0_1_1 | EditChunkContents_2_0_0`).\nexport type EditChunkContents = EditChunkContents_0_1_1;\n\nexport interface EditChunkContents_0_1_1 {\n\tversion: WriteFormat.v0_1_1;\n\tedits: readonly EditWithoutId<CompressedChangeInternal<FinalNodeId>>[];\n}\n\n/**\n * Compressed change format type.\n * Encodes the same information as a {@link ChangeInternal}, but uses a more compact object format for `build` changes.\n */\nexport type CompressedChangeInternal<TId extends OpSpaceNodeId> =\n\t| ReplaceRecursive<Exclude<ChangeInternal, BuildInternal>, NodeId, TId>\n\t| CompressedBuildInternal<TId>;\n\n/**\n * A compressed version of {@link BuildInternal} where the source is a sequence of compressed nodes.\n */\nexport interface CompressedBuildInternal<TId extends OpSpaceNodeId> {\n\t/** {@inheritdoc Build.destination } */\n\treadonly destination: DetachedSequenceId;\n\t/** A sequence of nodes to build in some compressed format. */\n\treadonly source: TreeNodeSequence<CompressedBuildNode<TId>>;\n\t/** {@inheritdoc Build.\"type\" } */\n\treadonly type: typeof ChangeTypeInternal.CompressedBuild;\n}\n\n/**\n * A BuildNode that has been compressed into a {@link CompressedPlaceholderTree}.\n */\nexport type CompressedBuildNode<TId extends OpSpaceNodeId> = CompressedPlaceholderTree<TId, DetachedSequenceId>;\n\n// TODO: `ChangeInternal`s should be assignable to this type without casting; this will require some test refactoring.\n/**\n * This type should be used as an opaque handle in the public API for `ChangeInternal` objects.\n * This is useful for supporting public APIs which involve working with a tree's edit history,\n * which will involve changes that have already been internalized.\n * @alpha\n */\nexport interface InternalizedChange {\n\tInternalChangeBrand: '2cae1045-61cf-4ef7-a6a3-8ad920cb7ab3';\n}\n\n/**\n * {@inheritdoc (Change:type)}\n * @alpha\n */\nexport type ChangeInternal = InsertInternal | DetachInternal | BuildInternal | SetValueInternal | ConstraintInternal;\n\n/**\n * {@inheritdoc BuildNode}\n * @alpha\n */\nexport type BuildNodeInternal = TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\n/**\n * {@inheritdoc Build}\n * @alpha\n */\nexport interface BuildInternal extends Omit<BuildInternal_0_0_2, 'source'> {\n\treadonly source: TreeNodeSequence<BuildNodeInternal>;\n}\n\n/**\n * {@inheritdoc (Insert:interface)}\n * @alpha\n */\nexport interface InsertInternal extends Omit<InsertInternal_0_0_2, 'destination'> {\n\t/** {@inheritdoc (Insert:interface).destination } */\n\treadonly destination: StablePlaceInternal;\n}\n\n/**\n * {@inheritdoc Detach}\n * @alpha\n */\nexport interface DetachInternal extends Omit<DetachInternal_0_0_2, 'source'> {\n\t/** {@inheritdoc Detach.source } */\n\treadonly source: StableRangeInternal;\n}\n\n/**\n * {@inheritdoc SetValue}\n * @alpha\n */\nexport interface SetValueInternal extends Omit<SetValueInternal_0_0_2, 'nodeToModify'> {\n\t/** {@inheritdoc SetValue.nodeToModify } */\n\treadonly nodeToModify: NodeId;\n}\n\n/**\n * {@inheritdoc Constraint}\n * @alpha\n */\nexport interface ConstraintInternal extends Omit<ConstraintInternal_0_0_2, 'toConstrain' | 'parentNode'> {\n\t/** {@inheritdoc Constraint.toConstrain } */\n\treadonly toConstrain: StableRangeInternal;\n\t/** {@inheritdoc Constraint.parentNode } */\n\treadonly parentNode?: NodeId;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `ChangeInternal` interface.\n/**\n * @alpha\n */\nexport const ChangeInternal = {\n\tbuild: (source: TreeNodeSequence<BuildNodeInternal>, destination: DetachedSequenceId): BuildInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Build,\n\t}),\n\n\tinsert: (source: DetachedSequenceId, destination: StablePlaceInternal): InsertInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Insert,\n\t}),\n\n\tdetach: (source: StableRangeInternal, destination?: DetachedSequenceId): DetachInternal => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeTypeInternal.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeData<NodeId> | NodeId, payload: Payload): SetValueInternal => ({\n\t\tnodeToModify: getNodeId(nodeToModify),\n\t\tpayload,\n\t\ttype: ChangeTypeInternal.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeData<NodeId> | NodeId): SetValueInternal => ({\n\t\tnodeToModify: getNodeId(nodeToModify),\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeTypeInternal.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRangeInternal,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): ConstraintInternal => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeTypeInternal.Constraint,\n\t}),\n\n\t/** {@inheritdoc (Change:variable).delete } */\n\tdelete: (stableRange: StableRangeInternal): ChangeInternal => ChangeInternal.detach(stableRange),\n\n\t/** {@inheritdoc (Change:variable).insertTree } */\n\tinsertTree: (nodes: TreeNodeSequence<BuildNodeInternal>, destination: StablePlaceInternal): ChangeInternal[] => {\n\t\tconst build = ChangeInternal.build(nodes, 0 as DetachedSequenceId);\n\t\treturn [build, ChangeInternal.insert(build.destination, destination)];\n\t},\n\n\t/** {@inheritdoc (Change:variable).move } */\n\tmove: (source: StableRangeInternal, destination: StablePlaceInternal): ChangeInternal[] => {\n\t\tconst detach = ChangeInternal.detach(source, 0 as DetachedSequenceId);\n\t\treturn [detach, ChangeInternal.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * {@inheritdoc (StablePlace:interface) }\n * @alpha\n */\nexport interface StablePlaceInternal extends Omit<StablePlaceInternal_0_0_2, 'referenceSibling' | 'referenceTrait'> {\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceSibling }\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * {@inheritdoc (StablePlace:interface).referenceTrait }\n\t */\n\treadonly referenceTrait?: TraitLocationInternal;\n}\n\n/**\n * {@inheritdoc (StableRange:interface) }\n * @alpha\n */\nexport interface StableRangeInternal {\n\t/** {@inheritdoc (StableRange:interface).start } */\n\treadonly start: StablePlaceInternal;\n\t/** {@inheritdoc (StableRange:interface).end } */\n\treadonly end: StablePlaceInternal;\n}\n\n/**\n * The remainder of this file consists of factory methods duplicated with those for StableRange/StablePlace and are maintained while\n * the new persisted version of SharedTree ops/summaries is rolled out.\n */\n\n/**\n * @alpha\n */\nexport const StablePlaceInternal = {\n\t/**\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlaceInternal => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlaceInternal => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocationInternal): StablePlaceInternal => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocationInternal): StablePlaceInternal => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n/**\n * @alpha\n */\nexport const StableRangeInternal = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlaceInternal): { to: (end: StablePlaceInternal) => StableRangeInternal } => ({\n\t\tto: (end: StablePlaceInternal): StableRangeInternal => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x65e /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x65f /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains only the provided `node`.\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRangeInternal => ({\n\t\tstart: StablePlaceInternal.before(node),\n\t\tend: StablePlaceInternal.after(node),\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains everything in the trait.\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocationInternal): StableRangeInternal => ({\n\t\tstart: StablePlaceInternal.atStartOf(trait),\n\t\tend: StablePlaceInternal.atEndOf(trait),\n\t}),\n};\n\n/**\n * Discriminated union of valid 0.0.1 SharedTree op types.\n */\nexport type SharedTreeOp = SharedTreeEditOp | SharedTreeHandleOp | SharedTreeUpdateOp | SharedTreeNoOp;\n\nexport interface SharedTreeEditOp extends VersionedOp<WriteFormat.v0_1_1> {\n\treadonly type: SharedTreeOpType.Edit;\n\t/** The collection of changes to apply. */\n\treadonly edit: Edit<CompressedChangeInternal<OpSpaceNodeId>>;\n\t/** Contains all the IDs generated by the originating client since the last sent op */\n\treadonly idRange: IdCreationRange;\n}\n\n/**\n * A SharedTree op that includes edit handle information.\n * The handle corresponds to an edit chunk in the edit log.\n */\nexport interface SharedTreeHandleOp extends VersionedOp<WriteFormat.v0_1_1> {\n\treadonly type: SharedTreeOpType.Handle;\n\t/** The serialized handle to an uploaded edit chunk. */\n\treadonly editHandle: string;\n\t/** The index of the first edit in the chunk that corresponds to the handle. */\n\treadonly startRevision: number;\n}\n\n/** The number of IDs that a SharedTree reserves for current or future internal use */\n// This value must never change\nexport const reservedIdCount = 10;\n\n/** The SessionID of the Upgrade Session */\n// This UUID must never change\nexport const ghostSessionId = '79590933-1c70-4fda-817a-adab57c20318' as SessionId;\n\n/** Accepts either a node or a node's identifier, and returns the identifier */\nfunction getNodeId<TId>(node: TId | NodeData<TId>): TId {\n\treturn (node as NodeData<TId>).identifier ?? (node as TId);\n}\n"]}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { BuildInternal_0_0_2, BuildNodeInternal_0_0_2, ChangeInternal_0_0_2, ChangeNode_0_0_2, ChangeTypeInternal, ConstraintEffect, ConstraintInternal_0_0_2, DetachInternal_0_0_2, Edit, EditBase, EditStatus, EditWithoutId, HasTraits, InsertInternal_0_0_2, NodeData, Payload, PlaceholderTree, SetValueInternal_0_0_2, SharedTreeEditOp_0_0_2, SharedTreeNoOp, SharedTreeOp_0_0_2, SharedTreeOpType, SharedTreeSummary_0_0_2, SharedTreeSummaryBase, SharedTreeUpdateOp, Side, StablePlaceInternal_0_0_2, StableRangeInternal_0_0_2, TraitLocationInternal_0_0_2, TraitMap, TreeNode, TreeNodeSequence, VersionedOp, WriteFormat, } from './0.0.2';
|
|
6
|
-
export { BuildInternal, BuildNodeInternal, ChangeInternal, ChangeNode, CompressedBuildInternal, CompressedBuildNode, CompressedChangeInternal, CompressedChangeNode, CompressedPlaceholderTree, CompressedTraits, ConstraintInternal, DetachInternal, EditChunkContents, EditChunkContents_0_1_1, EditLogSummary, FluidEditHandle, ghostSessionId, InsertInternal, InternalizedChange, reservedIdCount, SetValueInternal, SharedTreeEditOp, SharedTreeHandleOp, SharedTreeOp, SharedTreeSummary, StablePlaceInternal, StableRangeInternal, TraitLocationInternal, } from './0.1.1';
|
|
5
|
+
export { BuildInternal_0_0_2, BuildNodeInternal_0_0_2, ChangeInternal_0_0_2, ChangeNode_0_0_2, ChangeTypeInternal, ConstraintEffect, ConstraintInternal_0_0_2, DetachInternal_0_0_2, Edit, EditBase, EditStatus, EditWithoutId, HasTraits, InsertInternal_0_0_2, NodeData, Payload, PlaceholderTree, SetValueInternal_0_0_2, SharedTreeEditOp_0_0_2, SharedTreeNoOp, SharedTreeOp_0_0_2, SharedTreeOpType, SharedTreeSummary_0_0_2, SharedTreeSummaryBase, SharedTreeUpdateOp, Side, StablePlaceInternal_0_0_2, StableRangeInternal_0_0_2, TraitLocationInternal_0_0_2, TraitMap, TreeNode, TreeNodeSequence, VersionedOp, WriteFormat, } from './0.0.2.js';
|
|
6
|
+
export { BuildInternal, BuildNodeInternal, ChangeInternal, ChangeNode, CompressedBuildInternal, CompressedBuildNode, CompressedChangeInternal, CompressedChangeNode, CompressedPlaceholderTree, CompressedTraits, ConstraintInternal, DetachInternal, EditChunkContents, EditChunkContents_0_1_1, EditLogSummary, FluidEditHandle, ghostSessionId, InsertInternal, InternalizedChange, reservedIdCount, SetValueInternal, SharedTreeEditOp, SharedTreeHandleOp, SharedTreeOp, SharedTreeSummary, StablePlaceInternal, StableRangeInternal, TraitLocationInternal, } from './0.1.1.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,IAAI,EACJ,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,WAAW,GACX,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,IAAI,EACJ,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,WAAW,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
// API Exports
|
|
6
|
-
export { ChangeTypeInternal, ConstraintEffect, EditStatus, SharedTreeOpType, Side, WriteFormat, } from './0.0.2';
|
|
7
|
-
export { ChangeInternal, ghostSessionId, reservedIdCount, StablePlaceInternal, StableRangeInternal, } from './0.1.1';
|
|
6
|
+
export { ChangeTypeInternal, ConstraintEffect, EditStatus, SharedTreeOpType, Side, WriteFormat, } from './0.0.2.js';
|
|
7
|
+
export { ChangeInternal, ghostSessionId, reservedIdCount, StablePlaceInternal, StableRangeInternal, } from './0.1.1.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc;AAEd,OAAO,EAKN,kBAAkB,EAClB,gBAAgB,EAKhB,UAAU,EAWV,gBAAgB,EAIhB,IAAI,EAQJ,WAAW,GACX,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc;AAEd,OAAO,EAKN,kBAAkB,EAClB,gBAAgB,EAKhB,UAAU,EAWV,gBAAgB,EAIhB,IAAI,EAQJ,WAAW,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAGN,cAAc,EAcd,cAAc,EAGd,eAAe,EAMf,mBAAmB,EACnB,mBAAmB,GAEnB,MAAM,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// API Exports\n\nexport {\n\tBuildInternal_0_0_2,\n\tBuildNodeInternal_0_0_2,\n\tChangeInternal_0_0_2,\n\tChangeNode_0_0_2,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tConstraintInternal_0_0_2,\n\tDetachInternal_0_0_2,\n\tEdit,\n\tEditBase,\n\tEditStatus,\n\tEditWithoutId,\n\tHasTraits,\n\tInsertInternal_0_0_2,\n\tNodeData,\n\tPayload,\n\tPlaceholderTree,\n\tSetValueInternal_0_0_2,\n\tSharedTreeEditOp_0_0_2,\n\tSharedTreeNoOp,\n\tSharedTreeOp_0_0_2,\n\tSharedTreeOpType,\n\tSharedTreeSummary_0_0_2,\n\tSharedTreeSummaryBase,\n\tSharedTreeUpdateOp,\n\tSide,\n\tStablePlaceInternal_0_0_2,\n\tStableRangeInternal_0_0_2,\n\tTraitLocationInternal_0_0_2,\n\tTraitMap,\n\tTreeNode,\n\tTreeNodeSequence,\n\tVersionedOp,\n\tWriteFormat,\n} from './0.0.2.js';\nexport {\n\tBuildInternal,\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tCompressedBuildInternal,\n\tCompressedBuildNode,\n\tCompressedChangeInternal,\n\tCompressedChangeNode,\n\tCompressedPlaceholderTree,\n\tCompressedTraits,\n\tConstraintInternal,\n\tDetachInternal,\n\tEditChunkContents,\n\tEditChunkContents_0_1_1,\n\tEditLogSummary,\n\tFluidEditHandle,\n\tghostSessionId,\n\tInsertInternal,\n\tInternalizedChange,\n\treservedIdCount,\n\tSetValueInternal,\n\tSharedTreeEditOp,\n\tSharedTreeHandleOp,\n\tSharedTreeOp,\n\tSharedTreeSummary,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n\tTraitLocationInternal,\n} from './0.1.1.js';\n"]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { benchmark, BenchmarkType } from '@fluid-tools/benchmark';
|
|
6
6
|
import { makeRandom } from '@fluid-private/stochastic-test-utils';
|
|
7
|
-
import { compareFiniteNumbers } from '../Common';
|
|
8
|
-
import { AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap';
|
|
7
|
+
import { compareFiniteNumbers } from '../Common.js';
|
|
8
|
+
import { AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';
|
|
9
9
|
function runAppendOnlyMapPerfTests(mapBuilder) {
|
|
10
10
|
const type = BenchmarkType.Measurement;
|
|
11
11
|
let map;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppendOnlySortedMap.perf.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAW,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AppendOnlySortedMap.perf.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAW,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,SAAS,yBAAyB,CAAC,UAAqD;IACvF,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC;IACvC,IAAI,GAAwC,CAAC;IAC7C,IAAI,IAAa,CAAC;IAClB,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,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,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from '@fluid-tools/benchmark';\nimport { IRandom, makeRandom } from '@fluid-private/stochastic-test-utils';\nimport { compareFiniteNumbers } from '../Common.js';\nimport { AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';\n\nfunction runAppendOnlyMapPerfTests(mapBuilder: () => AppendOnlySortedMap<number, number>) {\n\tconst type = BenchmarkType.Measurement;\n\tlet map: AppendOnlySortedMap<number, number>;\n\tlet rand: IRandom;\n\tconst keyChoices: number[] = [];\n\tlet localChoice = 0;\n\tconst before = () => {\n\t\trand = makeRandom(42);\n\t\tmap = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\tlocalChoice = 0;\n\t};\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a key`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.get(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a pair or lower`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.getPairOrNextLower(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n}\n\ndescribe('AppendOnlySortedMap Perf', () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n"]}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { strict as assert } from 'assert';
|
|
7
7
|
import { expect } from 'chai';
|
|
8
8
|
import { validateAssertionError } from '@fluidframework/test-runtime-utils';
|
|
9
|
-
import { assertNotUndefined, compareFiniteNumbers } from '../Common';
|
|
10
|
-
import { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap';
|
|
9
|
+
import { assertNotUndefined, compareFiniteNumbers } from '../Common.js';
|
|
10
|
+
import { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';
|
|
11
11
|
function runAppendOnlyMapTests(mapBuilder) {
|
|
12
12
|
it('detects out-of-order keys', () => {
|
|
13
13
|
const map = mapBuilder();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppendOnlySortedMap.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAE/B,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,SAAS,qBAAqB,CAAC,UAAqD;IACnF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACpC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,MAAM,SAAS,GAAG,+CAA+C,CAAC;QAClE,MAAM,CAAC,MAAM,CACZ,GAAG,EAA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AC,GAAG,CAAC,CAAC;YACxC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC/E,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QACtE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,GAAG,IAAI,yBAAyB,CACxC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACnB,oBAAoB,CACpB,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe;QACzD,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,EACvB,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,+BAA+B,CAAC,CACxE,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { strict as assert } from 'assert';\nimport { expect } from 'chai';\nimport { validateAssertionError } from '@fluidframework/test-runtime-utils';\nimport { assertNotUndefined, compareFiniteNumbers } from '../Common';\nimport { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap';\n\nfunction runAppendOnlyMapTests(mapBuilder: () => AppendOnlySortedMap<number, number>) {\n\tit('detects out-of-order keys', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted key must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(-1, 1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(1, 2);\n\t});\n\n\tit('can get the min and max keys', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.maxKey()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.maxKey()).to.equal(i);\n\t\t\texpect(map.minKey()).to.equal(0);\n\t\t}\n\t});\n\n\tit('can get the first and last pairs', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.first()).to.be.undefined;\n\t\texpect(map.last()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.last()).to.deep.equal([i, i]);\n\t\t\texpect(map.first()).to.deep.equal([0, 0]);\n\t\t}\n\t});\n\n\tit('can get values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.get(-1)).to.be.undefined;\n\t\texpect(map.get(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.get(i)).to.equal(i);\n\t\t}\n\t});\n\n\tit('can get pairs by index', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 10, i);\n\t\t}\n\t\texpect(map.getAtIndex(-1)).to.be.undefined;\n\t\texpect(map.getAtIndex(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.getAtIndex(i)).to.deep.equal([i * 10, i]);\n\t\t}\n\t});\n\n\tit('can get an entry or next lower by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLower(-1)).to.be.undefined;\n\t\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\t\texpect(map.getPairOrNextLower(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLower(i * 2 + 1)).to.deep.equal([i * 2, i * 2]);\n\t\t\t}\n\t\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\t\t\texpect(map.getPairOrNextLower(maxKey + 1)).to.deep.equal([maxKey, maxKey]);\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\tconst minKey = assertNotUndefined(map.minKey());\n\t\t\texpect(map.getPairOrNextHigher(minKey - 1)).to.deep.equal([minKey, minKey]);\n\t\t\tfor (let i = 0; i < map.size - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2 + 1)).to.deep.equal([i * 2 + 2, i * 2 + 2]);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextHigher(map.size * 2 + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('knows how big it is', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.size).to.equal(i);\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.size).to.equal(elementCount);\n\t});\n\n\tit('can enumerate its keys and values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tconst keys: number[] = [];\n\t\tconst values: number[] = [];\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tconst key = i;\n\t\t\tconst value = i * 2;\n\t\t\tmap.append(key, value);\n\t\t\tkeys.push(key);\n\t\t\tvalues.push(value);\n\t\t}\n\t\texpect([...map.keys()]).to.deep.equal(keys);\n\t\texpect([...map.values()]).to.deep.equal(values);\n\t});\n\n\tit('can calculate the indexOf a search element', () => {\n\t\tconst elements: number[] = [0, 0, 2, 0, 3, 0];\n\t\tconst comparator = (search: number, key: number, value: number): number => {\n\t\t\treturn compareFiniteNumbers(search, key);\n\t\t};\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 0, comparator)).to.equal(0);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 2, comparator)).to.equal(2);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 3, comparator)).to.equal(4);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, -1, comparator)).to.equal(0 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 1, comparator)).to.equal(2 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 10, comparator)).to.equal(6 ^ AppendOnlySortedMap.failureXor);\n\t});\n\n\tdescribe('can perform range queries', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 2, i * 2);\n\t\t}\n\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\n\t\tit('on empty ranges', () => {\n\t\t\texpect([...map.getRange(1, -1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(maxKey + 1, maxKey + 1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on ranges of size 1', () => {\n\t\t\texpect([...map.getRange(0, 0)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(1, 1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(-1, -1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on non-empty ranges', () => {\n\t\t\texpect([...map.getRange(0, 1)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(0, 2)]).to.deep.equal([\n\t\t\t\t[0, 0],\n\t\t\t\t[2, 2],\n\t\t\t]);\n\t\t\texpect([...map.getRange(1, 5)]).to.deep.equal([\n\t\t\t\t[2, 2],\n\t\t\t\t[4, 4],\n\t\t\t]);\n\t\t\tconst allEntries = [...map.entries()];\n\t\t\texpect([...map.getRange(0, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(0, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t});\n\t});\n}\n\ndescribe('AppendOnlySortedMap', () => {\n\trunAppendOnlyMapTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n\ndescribe('AppendOnlyDoublySortedMap', () => {\n\tconst mapBuilder = () =>\n\t\tnew AppendOnlyDoublySortedMap<number, number, number>(\n\t\t\tcompareFiniteNumbers,\n\t\t\t(value) => value,\n\t\t\tcompareFiniteNumbers\n\t\t);\n\trunAppendOnlyMapTests(mapBuilder);\n\n\tit('detects out-of-order values', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted value must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(1, -1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(2, 1);\n\t});\n\n\tit('can get an entry or next lower by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLowerByValue(-1)).to.be.undefined;\n\t\t\tfor (let i = 1; i < elementCount; i++) {\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2 + 1)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t}\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\tfor (let i = 0; i < elementCount - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2 + 1)).to.deep.equal([i - elementCount + 1, i * 2 + 2]);\n\t\t\t}\n\t\t\tconst maxValue = (elementCount - 1) * 2;\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue)).to.deep.equal([-1, maxValue]);\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('validity assertion detects out-of-order keys', () => {\n\t\tconst map = new AppendOnlyDoublySortedMap<[number], [number], number>(\n\t\t\t(a, b) => compareFiniteNumbers(a[0], b[0]),\n\t\t\t(value) => value[0],\n\t\t\tcompareFiniteNumbers\n\t\t);\n\t\tmap.append([0], [0]);\n\t\tmap.append([1], [1]);\n\t\tassertNotUndefined(map.get([1]))[0] = -1; // mutate value\n\t\tassert.throws(\n\t\t\t() => map.assertValid(),\n\t\t\t(e: Error) => validateAssertionError(e, 'Values in map must be sorted.')\n\t\t);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"AppendOnlySortedMap.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAE/B,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAEzG,SAAS,qBAAqB,CAAC,UAAqD;IACnF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACpC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,MAAM,SAAS,GAAG,+CAA+C,CAAC;QAClE,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,SAAS,CAAC,CAClD,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACvC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,MAAM,YAAY,GAAG,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EA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AAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACnB,oBAAoB,CACpB,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe;QACzD,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,EACvB,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,+BAA+B,CAAC,CACxE,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { strict as assert } from 'assert';\nimport { expect } from 'chai';\nimport { validateAssertionError } from '@fluidframework/test-runtime-utils';\nimport { assertNotUndefined, compareFiniteNumbers } from '../Common.js';\nimport { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';\n\nfunction runAppendOnlyMapTests(mapBuilder: () => AppendOnlySortedMap<number, number>) {\n\tit('detects out-of-order keys', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted key must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(-1, 1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(1, 2);\n\t});\n\n\tit('can get the min and max keys', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.maxKey()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.maxKey()).to.equal(i);\n\t\t\texpect(map.minKey()).to.equal(0);\n\t\t}\n\t});\n\n\tit('can get the first and last pairs', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.first()).to.be.undefined;\n\t\texpect(map.last()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.last()).to.deep.equal([i, i]);\n\t\t\texpect(map.first()).to.deep.equal([0, 0]);\n\t\t}\n\t});\n\n\tit('can get values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.get(-1)).to.be.undefined;\n\t\texpect(map.get(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.get(i)).to.equal(i);\n\t\t}\n\t});\n\n\tit('can get pairs by index', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 10, i);\n\t\t}\n\t\texpect(map.getAtIndex(-1)).to.be.undefined;\n\t\texpect(map.getAtIndex(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.getAtIndex(i)).to.deep.equal([i * 10, i]);\n\t\t}\n\t});\n\n\tit('can get an entry or next lower by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLower(-1)).to.be.undefined;\n\t\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\t\texpect(map.getPairOrNextLower(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLower(i * 2 + 1)).to.deep.equal([i * 2, i * 2]);\n\t\t\t}\n\t\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\t\t\texpect(map.getPairOrNextLower(maxKey + 1)).to.deep.equal([maxKey, maxKey]);\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\tconst minKey = assertNotUndefined(map.minKey());\n\t\t\texpect(map.getPairOrNextHigher(minKey - 1)).to.deep.equal([minKey, minKey]);\n\t\t\tfor (let i = 0; i < map.size - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2 + 1)).to.deep.equal([i * 2 + 2, i * 2 + 2]);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextHigher(map.size * 2 + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('knows how big it is', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.size).to.equal(i);\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.size).to.equal(elementCount);\n\t});\n\n\tit('can enumerate its keys and values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tconst keys: number[] = [];\n\t\tconst values: number[] = [];\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tconst key = i;\n\t\t\tconst value = i * 2;\n\t\t\tmap.append(key, value);\n\t\t\tkeys.push(key);\n\t\t\tvalues.push(value);\n\t\t}\n\t\texpect([...map.keys()]).to.deep.equal(keys);\n\t\texpect([...map.values()]).to.deep.equal(values);\n\t});\n\n\tit('can calculate the indexOf a search element', () => {\n\t\tconst elements: number[] = [0, 0, 2, 0, 3, 0];\n\t\tconst comparator = (search: number, key: number, value: number): number => {\n\t\t\treturn compareFiniteNumbers(search, key);\n\t\t};\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 0, comparator)).to.equal(0);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 2, comparator)).to.equal(2);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 3, comparator)).to.equal(4);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, -1, comparator)).to.equal(0 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 1, comparator)).to.equal(2 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 10, comparator)).to.equal(6 ^ AppendOnlySortedMap.failureXor);\n\t});\n\n\tdescribe('can perform range queries', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 2, i * 2);\n\t\t}\n\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\n\t\tit('on empty ranges', () => {\n\t\t\texpect([...map.getRange(1, -1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(maxKey + 1, maxKey + 1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on ranges of size 1', () => {\n\t\t\texpect([...map.getRange(0, 0)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(1, 1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(-1, -1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on non-empty ranges', () => {\n\t\t\texpect([...map.getRange(0, 1)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(0, 2)]).to.deep.equal([\n\t\t\t\t[0, 0],\n\t\t\t\t[2, 2],\n\t\t\t]);\n\t\t\texpect([...map.getRange(1, 5)]).to.deep.equal([\n\t\t\t\t[2, 2],\n\t\t\t\t[4, 4],\n\t\t\t]);\n\t\t\tconst allEntries = [...map.entries()];\n\t\t\texpect([...map.getRange(0, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(0, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t});\n\t});\n}\n\ndescribe('AppendOnlySortedMap', () => {\n\trunAppendOnlyMapTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n\ndescribe('AppendOnlyDoublySortedMap', () => {\n\tconst mapBuilder = () =>\n\t\tnew AppendOnlyDoublySortedMap<number, number, number>(\n\t\t\tcompareFiniteNumbers,\n\t\t\t(value) => value,\n\t\t\tcompareFiniteNumbers\n\t\t);\n\trunAppendOnlyMapTests(mapBuilder);\n\n\tit('detects out-of-order values', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted value must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(1, -1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(2, 1);\n\t});\n\n\tit('can get an entry or next lower by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLowerByValue(-1)).to.be.undefined;\n\t\t\tfor (let i = 1; i < elementCount; i++) {\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2 + 1)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t}\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\tfor (let i = 0; i < elementCount - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2 + 1)).to.deep.equal([i - elementCount + 1, i * 2 + 2]);\n\t\t\t}\n\t\t\tconst maxValue = (elementCount - 1) * 2;\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue)).to.deep.equal([-1, maxValue]);\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('validity assertion detects out-of-order keys', () => {\n\t\tconst map = new AppendOnlyDoublySortedMap<[number], [number], number>(\n\t\t\t(a, b) => compareFiniteNumbers(a[0], b[0]),\n\t\t\t(value) => value[0],\n\t\t\tcompareFiniteNumbers\n\t\t);\n\t\tmap.append([0], [0]);\n\t\tmap.append([1], [1]);\n\t\tassertNotUndefined(map.get([1]))[0] = -1; // mutate value\n\t\tassert.throws(\n\t\t\t() => map.assertValid(),\n\t\t\t(e: Error) => validateAssertionError(e, 'Values in map must be sorted.')\n\t\t);\n\t});\n});\n"]}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { expect } from 'chai';
|
|
6
|
-
import { MutableStringInterner } from '../StringInterner';
|
|
7
|
-
import { ChangeInternal, ChangeTypeInternal, ConstraintEffect, } from '../persisted-types';
|
|
8
|
-
import { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression';
|
|
9
|
-
import { StablePlace, StableRange } from '../ChangeTypes';
|
|
10
|
-
import { newEdit, newEditId } from '../EditUtilities';
|
|
11
|
-
import { InterningTreeCompressor } from '../TreeCompressor';
|
|
12
|
-
import { scopeIdNormalizer } from '../NodeIdUtilities';
|
|
13
|
-
import { convertStableRangeIds } from '../IdConversion';
|
|
14
|
-
import { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities';
|
|
6
|
+
import { MutableStringInterner } from '../StringInterner.js';
|
|
7
|
+
import { ChangeInternal, ChangeTypeInternal, ConstraintEffect, } from '../persisted-types/index.js';
|
|
8
|
+
import { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression.js';
|
|
9
|
+
import { StablePlace, StableRange } from '../ChangeTypes.js';
|
|
10
|
+
import { newEdit, newEditId } from '../EditUtilities.js';
|
|
11
|
+
import { InterningTreeCompressor } from '../TreeCompressor.js';
|
|
12
|
+
import { scopeIdNormalizer } from '../NodeIdUtilities.js';
|
|
13
|
+
import { convertStableRangeIds } from '../IdConversion.js';
|
|
14
|
+
import { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities.js';
|
|
15
15
|
class TestTreeCompressor {
|
|
16
16
|
constructor(treeCompressor = new InterningTreeCompressor()) {
|
|
17
17
|
this.treeCompressor = treeCompressor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeCompression.tests.js","sourceRoot":"","sources":["../../src/test/ChangeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAkB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAEN,cAAc,EACd,kBAAkB,EAIlB,gBAAgB,GAMhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAkB,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAkC,iBAAiB,EAA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AAC;QACF,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE;YACzE,GAAG,IAAI;YACP,OAAO,EAAE,CAAC,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC;SACxE,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACrE,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAuB;YACtC,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;YACnC,MAAM,EAAE,gBAAgB,CAAC,iBAAiB;YAC1C,IAAI,EAAE,kBAAkB,CAAC,UAAU;SACnC,CAAC;QACF,MAAM,IAAI,GAAyB;YAClC,EAAE,EAAE,SAAS,EAAE;YACf,OAAO,EAAE,CAAC,UAAU,CAAC;SACrB,CAAC;QACF,eAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE;YAC9C,GAAG,IAAI;YACP,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,UAAU,CAAC,IAAI;oBACrB,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,WAAW,EAAE,qBAAqB,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;iBAC/F;aACD;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { expect } from 'chai';\nimport { DetachedSequenceId, OpSpaceNodeId } from '../Identifiers';\nimport { MutableStringInterner, StringInterner } from '../StringInterner';\nimport {\n\tBuildInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tCompressedBuildInternal,\n\tCompressedChangeInternal,\n\tCompressedPlaceholderTree,\n\tConstraintEffect,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tPlaceholderTree,\n\tSetValueInternal,\n} from '../persisted-types';\nimport { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression';\nimport { StablePlace, StableRange } from '../ChangeTypes';\nimport { newEdit, newEditId } from '../EditUtilities';\nimport { TreeCompressor, InterningTreeCompressor } from '../TreeCompressor';\nimport { ContextualizedNodeIdNormalizer, scopeIdNormalizer } from '../NodeIdUtilities';\nimport { convertStableRangeIds } from '../IdConversion';\nimport { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities';\n\n// CompressedChange type for this test suite. It aligns with CompressedChangeInternal but doesn't actually compress trees.\ntype TestCompressedChange = CompressedChangeInternal<OpSpaceNodeId>;\n\nclass TestTreeCompressor<TPlaceholder extends DetachedSequenceId | never> implements TreeCompressor<TPlaceholder> {\n\tpublic compressTreeCalls: PlaceholderTree<TPlaceholder>[] = [];\n\tpublic decompressTreeCalls: CompressedPlaceholderTree<OpSpaceNodeId, TPlaceholder>[] = [];\n\n\tpublic constructor(private readonly treeCompressor = new InterningTreeCompressor<TPlaceholder>()) {}\n\n\tpublic compress<TId extends OpSpaceNodeId>(\n\t\tnode: PlaceholderTree<TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): CompressedPlaceholderTree<TId, TPlaceholder> {\n\t\tthis.compressTreeCalls.push(node);\n\t\treturn this.treeCompressor.compress(node, interner, idNormalizer);\n\t}\n\n\tpublic decompress<TId extends OpSpaceNodeId>(\n\t\tnode: CompressedPlaceholderTree<TId, TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): PlaceholderTree<TPlaceholder> {\n\t\tthis.decompressTreeCalls.push(node);\n\t\treturn this.treeCompressor.decompress(node, interner, idNormalizer);\n\t}\n}\n\ndescribe('ChangeCompression', () => {\n\tconst treeCompressor = new TestTreeCompressor();\n\n\tbeforeEach(() => {\n\t\ttreeCompressor.compressTreeCalls.length = 0;\n\t\ttreeCompressor.decompressTreeCalls.length = 0;\n\t});\n\n\tconst compressor = new ChangeCompressor(treeCompressor);\n\n\t/**\n\t * Verifies an edit can round-trip through compression/decompression. Optionally also asserts the compressed state\n\t * matches some expected state.\n\t *\n\t * The mocked treeCompressor above is used for tree-level compression, so that tests can assert tree compression is invoked\n\t * without taking a dependency on its implementation.\n\t */\n\tfunction testCompression(\n\t\tedit: Edit<ChangeInternal>,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<OpSpaceNodeId>,\n\t\tcompressed?: Edit<TestCompressedChange>\n\t): void {\n\t\tconst interner = new MutableStringInterner();\n\t\tconst compressedEdit = compressEdit(compressor, interner, idNormalizer, edit);\n\t\tif (compressed !== undefined) {\n\t\t\texpect(compressedEdit).to.deep.equal(compressed);\n\t\t}\n\n\t\tconst buildChanges = edit.changes.filter<BuildInternal>(\n\t\t\t(change: ChangeInternal): change is BuildInternal => change.type === ChangeTypeInternal.Build\n\t\t);\n\t\tlet treeIndex = 0;\n\t\tfor (const buildChange of buildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.compressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.compressTreeCalls.length);\n\n\t\texpect(treeCompressor.decompressTreeCalls.length).to.equal(0);\n\n\t\tconst internedStrings = interner.getSerializable();\n\t\tconst newInterner = new MutableStringInterner(internedStrings);\n\t\tconst decompressedEdit = decompressEdit(compressor, newInterner, idNormalizer, compressedEdit);\n\n\t\tconst compressedBuildChanges = compressedEdit.changes.filter<CompressedBuildInternal<OpSpaceNodeId>>(\n\t\t\t(change): change is CompressedBuildInternal<OpSpaceNodeId> =>\n\t\t\t\tchange.type === ChangeTypeInternal.CompressedBuild\n\t\t);\n\n\t\ttreeIndex = 0;\n\t\tfor (const buildChange of compressedBuildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.decompressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.decompressTreeCalls.length);\n\t\texpect(decompressedEdit).to.deep.equal(edit);\n\t}\n\n\tit('Compresses the BuildNodes of an edit with Build Changes', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst edit = newEdit(ChangeInternal.insertTree([tree.toChangeNode()], StablePlace.after(tree.left)));\n\t\tconst expectedCompressedEdit: Edit<TestCompressedChange> = {\n\t\t\tid: edit.id,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\t\t\tsource: [\n\t\t\t\t\t\tnew InterningTreeCompressor().compress(\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\tnew MutableStringInterner(),\n\t\t\t\t\t\t\tscopeIdNormalizer(tree)\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\ttype: ChangeTypeInternal.CompressedBuild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdestination: { side: 1, referenceSibling: tree.normalizeToOpSpace(tree.left.identifier) },\n\t\t\t\t\tsource: 0 as DetachedSequenceId,\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), expectedCompressedEdit);\n\t});\n\n\tit('compresses id references in Detach changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst detach: DetachInternal = {\n\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\tsource: StableRange.only(tree),\n\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [detach],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...detach, source: convertStableRangeIds(detach.source, (id) => tree.normalizeToOpSpace(id)) }],\n\t\t});\n\t});\n\n\tit('compresses id references in SetValue changes to op space', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst setValue: SetValueInternal = {\n\t\t\tnodeToModify: id,\n\t\t\tpayload: 5,\n\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [setValue],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(context, context.localSessionId), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...setValue, nodeToModify: context.normalizeToOpSpace(id) }],\n\t\t});\n\t});\n\n\tit('compresses id references in Constraint changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst constraint: ConstraintInternal = {\n\t\t\ttoConstrain: StableRange.only(tree),\n\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [constraint],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: constraint.type,\n\t\t\t\t\teffect: constraint.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(constraint.toConstrain, (id) => tree.normalizeToOpSpace(id)),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"ChangeCompression.tests.js","sourceRoot":"","sources":["../../src/test/ChangeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,E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,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,WAAW,EAAE,qBAAqB,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;iBAC/F;aACD;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { expect } from 'chai';\nimport { DetachedSequenceId, OpSpaceNodeId } from '../Identifiers.js';\nimport { MutableStringInterner, StringInterner } from '../StringInterner.js';\nimport {\n\tBuildInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tCompressedBuildInternal,\n\tCompressedChangeInternal,\n\tCompressedPlaceholderTree,\n\tConstraintEffect,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tPlaceholderTree,\n\tSetValueInternal,\n} from '../persisted-types/index.js';\nimport { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression.js';\nimport { StablePlace, StableRange } from '../ChangeTypes.js';\nimport { newEdit, newEditId } from '../EditUtilities.js';\nimport { TreeCompressor, InterningTreeCompressor } from '../TreeCompressor.js';\nimport { ContextualizedNodeIdNormalizer, scopeIdNormalizer } from '../NodeIdUtilities.js';\nimport { convertStableRangeIds } from '../IdConversion.js';\nimport { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities.js';\n\n// CompressedChange type for this test suite. It aligns with CompressedChangeInternal but doesn't actually compress trees.\ntype TestCompressedChange = CompressedChangeInternal<OpSpaceNodeId>;\n\nclass TestTreeCompressor<TPlaceholder extends DetachedSequenceId | never> implements TreeCompressor<TPlaceholder> {\n\tpublic compressTreeCalls: PlaceholderTree<TPlaceholder>[] = [];\n\tpublic decompressTreeCalls: CompressedPlaceholderTree<OpSpaceNodeId, TPlaceholder>[] = [];\n\n\tpublic constructor(private readonly treeCompressor = new InterningTreeCompressor<TPlaceholder>()) {}\n\n\tpublic compress<TId extends OpSpaceNodeId>(\n\t\tnode: PlaceholderTree<TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): CompressedPlaceholderTree<TId, TPlaceholder> {\n\t\tthis.compressTreeCalls.push(node);\n\t\treturn this.treeCompressor.compress(node, interner, idNormalizer);\n\t}\n\n\tpublic decompress<TId extends OpSpaceNodeId>(\n\t\tnode: CompressedPlaceholderTree<TId, TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): PlaceholderTree<TPlaceholder> {\n\t\tthis.decompressTreeCalls.push(node);\n\t\treturn this.treeCompressor.decompress(node, interner, idNormalizer);\n\t}\n}\n\ndescribe('ChangeCompression', () => {\n\tconst treeCompressor = new TestTreeCompressor();\n\n\tbeforeEach(() => {\n\t\ttreeCompressor.compressTreeCalls.length = 0;\n\t\ttreeCompressor.decompressTreeCalls.length = 0;\n\t});\n\n\tconst compressor = new ChangeCompressor(treeCompressor);\n\n\t/**\n\t * Verifies an edit can round-trip through compression/decompression. Optionally also asserts the compressed state\n\t * matches some expected state.\n\t *\n\t * The mocked treeCompressor above is used for tree-level compression, so that tests can assert tree compression is invoked\n\t * without taking a dependency on its implementation.\n\t */\n\tfunction testCompression(\n\t\tedit: Edit<ChangeInternal>,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<OpSpaceNodeId>,\n\t\tcompressed?: Edit<TestCompressedChange>\n\t): void {\n\t\tconst interner = new MutableStringInterner();\n\t\tconst compressedEdit = compressEdit(compressor, interner, idNormalizer, edit);\n\t\tif (compressed !== undefined) {\n\t\t\texpect(compressedEdit).to.deep.equal(compressed);\n\t\t}\n\n\t\tconst buildChanges = edit.changes.filter<BuildInternal>(\n\t\t\t(change: ChangeInternal): change is BuildInternal => change.type === ChangeTypeInternal.Build\n\t\t);\n\t\tlet treeIndex = 0;\n\t\tfor (const buildChange of buildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.compressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.compressTreeCalls.length);\n\n\t\texpect(treeCompressor.decompressTreeCalls.length).to.equal(0);\n\n\t\tconst internedStrings = interner.getSerializable();\n\t\tconst newInterner = new MutableStringInterner(internedStrings);\n\t\tconst decompressedEdit = decompressEdit(compressor, newInterner, idNormalizer, compressedEdit);\n\n\t\tconst compressedBuildChanges = compressedEdit.changes.filter<CompressedBuildInternal<OpSpaceNodeId>>(\n\t\t\t(change): change is CompressedBuildInternal<OpSpaceNodeId> =>\n\t\t\t\tchange.type === ChangeTypeInternal.CompressedBuild\n\t\t);\n\n\t\ttreeIndex = 0;\n\t\tfor (const buildChange of compressedBuildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.decompressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.decompressTreeCalls.length);\n\t\texpect(decompressedEdit).to.deep.equal(edit);\n\t}\n\n\tit('Compresses the BuildNodes of an edit with Build Changes', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst edit = newEdit(ChangeInternal.insertTree([tree.toChangeNode()], StablePlace.after(tree.left)));\n\t\tconst expectedCompressedEdit: Edit<TestCompressedChange> = {\n\t\t\tid: edit.id,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\t\t\tsource: [\n\t\t\t\t\t\tnew InterningTreeCompressor().compress(\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\tnew MutableStringInterner(),\n\t\t\t\t\t\t\tscopeIdNormalizer(tree)\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\ttype: ChangeTypeInternal.CompressedBuild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdestination: { side: 1, referenceSibling: tree.normalizeToOpSpace(tree.left.identifier) },\n\t\t\t\t\tsource: 0 as DetachedSequenceId,\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), expectedCompressedEdit);\n\t});\n\n\tit('compresses id references in Detach changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst detach: DetachInternal = {\n\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\tsource: StableRange.only(tree),\n\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [detach],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...detach, source: convertStableRangeIds(detach.source, (id) => tree.normalizeToOpSpace(id)) }],\n\t\t});\n\t});\n\n\tit('compresses id references in SetValue changes to op space', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst setValue: SetValueInternal = {\n\t\t\tnodeToModify: id,\n\t\t\tpayload: 5,\n\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [setValue],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(context, context.localSessionId), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...setValue, nodeToModify: context.normalizeToOpSpace(id) }],\n\t\t});\n\t});\n\n\tit('compresses id references in Constraint changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst constraint: ConstraintInternal = {\n\t\t\ttoConstrain: StableRange.only(tree),\n\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [constraint],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: constraint.type,\n\t\t\t\t\teffect: constraint.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(constraint.toConstrain, (id) => tree.normalizeToOpSpace(id)),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout.tests.d.ts","sourceRoot":"","sources":["../../src/test/Checkout.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAMN,UAAU,EAEV,QAAQ,EAKR,MAAM,
|
|
1
|
+
{"version":3,"file":"Checkout.tests.d.ts","sourceRoot":"","sources":["../../src/test/Checkout.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAMN,UAAU,EAEV,QAAQ,EAKR,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,wBAAgB,aAAa,CAC5B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,QAAQ,CAAC,EACxD,eAAe,CAAC,EAAE,MAAM,IAAI,GAC1B,IAAI,CAwkBN"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { strict as assert } from 'assert';
|
|
6
6
|
import { validateAssertionError } from '@fluidframework/test-runtime-utils';
|
|
7
7
|
import { expect } from 'chai';
|
|
8
|
-
import { setTrait, EditStatus, StableRange, StablePlace, EditValidationResult, SharedTreeEvent, CheckoutEvent, Change, Side, areRevisionViewsSemanticallyEqual, } from '../index';
|
|
9
|
-
import { setUpTestSharedTree, setUpTestTree } from './utilities/TestUtilities';
|
|
8
|
+
import { setTrait, EditStatus, StableRange, StablePlace, EditValidationResult, SharedTreeEvent, CheckoutEvent, Change, Side, areRevisionViewsSemanticallyEqual, } from '../index.js';
|
|
9
|
+
import { setUpTestSharedTree, setUpTestTree } from './utilities/TestUtilities.js';
|
|
10
10
|
/**
|
|
11
11
|
* Checkout test suite
|
|
12
12
|
*/
|