@fluid-experimental/tree 2.74.0 → 2.81.0-374083
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/assertTagging.config.mjs +14 -0
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js.map +1 -1
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/UndoRedoHandler.d.ts.map +1 -1
- package/dist/UndoRedoHandler.js.map +1 -1
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +2 -2
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +5 -5
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +1 -0
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +3 -3
- 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 +2 -2
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +5 -5
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/dist/migration-shim/shimChannelServices.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +2 -2
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/shimHandle.d.ts +1 -1
- package/dist/migration-shim/shimHandle.d.ts.map +1 -1
- package/dist/migration-shim/shimHandle.js.map +1 -1
- package/dist/migration-shim/types.d.ts +4 -4
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/migration-shim/utils.d.ts +3 -3
- package/dist/migration-shim/utils.d.ts.map +1 -1
- package/dist/migration-shim/utils.js.map +1 -1
- package/eslint.config.mts +5 -4
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js.map +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/UndoRedoHandler.d.ts.map +1 -1
- package/lib/UndoRedoHandler.js.map +1 -1
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +2 -2
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +5 -5
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +1 -0
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +3 -3
- 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 +2 -2
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +5 -5
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/lib/migration-shim/shimChannelServices.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +2 -2
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/shimHandle.d.ts +1 -1
- package/lib/migration-shim/shimHandle.d.ts.map +1 -1
- package/lib/migration-shim/shimHandle.js.map +1 -1
- package/lib/migration-shim/types.d.ts +4 -4
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/migration-shim/utils.d.ts +3 -3
- package/lib/migration-shim/utils.d.ts.map +1 -1
- package/lib/migration-shim/utils.js.map +1 -1
- package/package.json +32 -32
- package/src/Checkout.ts +1 -1
- package/src/Common.ts +5 -1
- package/src/MergeHealth.ts +5 -5
- package/src/SharedTree.ts +2 -2
- package/src/SharedTreeEncoder.ts +9 -2
- package/src/UndoRedoHandler.ts +5 -5
- package/src/id-compressor/IdCompressor.ts +1 -1
- package/src/id-compressor/SessionIdNormalizer.ts +1 -1
- package/src/migration-shim/migrationDeltaHandler.ts +2 -2
- package/src/migration-shim/migrationShim.ts +11 -13
- package/src/migration-shim/migrationShimFactory.ts +7 -10
- package/src/migration-shim/sharedTreeDeltaHandler.ts +2 -2
- package/src/migration-shim/sharedTreeShim.ts +14 -14
- package/src/migration-shim/sharedTreeShimFactory.ts +5 -5
- package/src/migration-shim/shimChannelServices.ts +4 -4
- package/src/migration-shim/shimDeltaConnection.ts +5 -5
- package/src/migration-shim/shimHandle.ts +1 -1
- package/src/migration-shim/types.ts +8 -8
- package/src/migration-shim/utils.ts +3 -3
- package/.eslintrc.cjs +0 -45
package/dist/SharedTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTree.js","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,iFAAoE;AAEpE,kEAA6D;AAc7D,0EAKqD;AACrD,uEAOkD;AAElD,qDAAgF;AAChF,2CAA0F;AAC1F,6CAAmE;AACnE,yDAQ4B;AAC5B,mDAA6E;AAC7E,mEAAiD;AACjD,uDAAmD;AACnD,qDAS0B;AAC1B,qDAA+C;AAC/C,iDAOwB;AACxB,6DAAyF;AAEzF,uDAAiD;AACjD,iEAA0F;AAC1F,2DAA4D;AAC5D,6CAA0D;AAC1D,+EAAkF;AAElF,yDAA6C;AAC7C,uDAAyE;AACzE,yDAwBoC;AACpC,6DAAmF;AA4FnF;;;;GAIG;AACH,MAAa,iBAAiB;IAa7B;;;;;;OAMG;IACH,YAAY,GAAG,IAAoB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,iBAAiB,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,kBAAgD;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,gBA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,IAAI,aAAa,GAAG,aAAa,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,UAAkB,EAAE,UAAkB;IAC/D,MAAM,eAAe,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAyB,CAAC,CAAC;IAC/E,IAAI,eAAe,KAAK,CAAC,CAAC,EAAE,CAAC;QAC5B,IAAA,gBAAI,EAAC,+BAA+B,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA+C;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from '@fluid-internal/client-utils';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from '@fluidframework/datastore-definitions/internal';\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype IRuntimeMessageCollection,\n\ttype ISequencedMessageEnvelope,\n} from '@fluidframework/runtime-definitions/internal';\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from '@fluidframework/shared-object-base/internal';\nimport {\n\tIEventSampler,\n\tITelemetryLoggerPropertyBags,\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { BuildNode, BuildTreeNode, Change, ChangeType } from './ChangeTypes.js';\nimport { RestOrArray, copyPropertyIfDefined, fail, unwrapRestOrArray } from './Common.js';\nimport { EditHandle, EditLog, OrderedEditSet } from './EditLog.js';\nimport {\n\tareRevisionViewsSemanticallyEqual,\n\tconvertTreeNodes,\n\tdeepCloneStablePlace,\n\tdeepCloneStableRange,\n\tinternalizeBuildNode,\n\tnewEditId,\n\twalkTree,\n} from './EditUtilities.js';\nimport { SharedTreeDiagnosticEvent, SharedTreeEvent } from './EventTypes.js';\nimport { revert } from './HistoryEditFactory.js';\nimport { convertEditIds } from './IdConversion.js';\nimport {\n\tAttributionId,\n\tDetachedSequenceId,\n\tEditId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tStableNodeId,\n\tisDetachedSequenceId,\n} from './Identifiers.js';\nimport { initialTree } from './InitialTree.js';\nimport {\n\tCachingLogViewer,\n\tEditCacheEntry,\n\tEditStatusCallback,\n\tLogViewer,\n\tSequencedEditResult,\n\tSequencedEditResultCallback,\n} from './LogViewer.js';\nimport { NodeIdContext, NodeIdNormalizer, getNodeIdContext } from './NodeIdUtilities.js';\nimport { ReconciliationPath } from './ReconciliationPath.js';\nimport { RevisionView } from './RevisionView.js';\nimport { SharedTreeEncoder_0_0_2, SharedTreeEncoder_0_1_1 } from './SharedTreeEncoder.js';\nimport { MutableStringInterner } from './StringInterner.js';\nimport { SummaryContents, serialize } from './Summary.js';\nimport { deserialize, getSummaryStatistics } from './SummaryBackCompatibility.js';\nimport { TransactionInternal } from './TransactionInternal.js';\nimport { nilUuid } from './UuidUtilities.js';\nimport { IdCompressor, createSessionId } from './id-compressor/index.js';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tEditLogSummary,\n\tEditStatus,\n\tInternalizedChange,\n\tSharedTreeEditOp,\n\tSharedTreeEditOp_0_0_2,\n\tSharedTreeOp,\n\tSharedTreeOpType,\n\tSharedTreeOp_0_0_2,\n\tSharedTreeSummary,\n\tSharedTreeSummaryBase,\n\tSharedTreeSummary_0_0_2,\n\tTreeNode,\n\tTreeNodeSequence,\n\tWriteFormat,\n\tghostSessionId,\n\treservedIdCount,\n} from './persisted-types/index.js';\nimport { SharedTreeAttributes, SharedTreeFactoryType } from './publicContracts.js';\n\n/**\n * The write format and associated options used to construct a `SharedTree`\n * @alpha\n */\nexport type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];\n\n/**\n * The type of shared tree options for a given write format\n * @alpha\n */\nexport type SharedTreeOptions<\n\tWF extends WriteFormat,\n\tHistoryCompatibility extends 'Forwards' | 'None' = 'Forwards',\n> = SharedTreeBaseOptions &\n\tOmit<\n\t\tWF extends WriteFormat.v0_0_2\n\t\t\t? SharedTreeOptions_0_0_2\n\t\t\t: WF extends WriteFormat.v0_1_1\n\t\t\t\t? SharedTreeOptions_0_1_1\n\t\t\t\t: never,\n\t\tHistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never\n\t>;\n\n/**\n * Configuration options for SharedTree that are independent of write format versions.\n * @alpha\n */\nexport interface SharedTreeBaseOptions {\n\t/**\n\t * The target number of sequenced edits that the tree will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits in the collaboration window are not evicted.\n\t *\n\t * The size is set to infinity by default, meaning that all edits in session are kept within memory.\n\t */\n\tinMemoryHistorySize?: number;\n\t/**\n\t * The rate at which edits are evicted from memory. This is a factor of the inMemoryHistorySize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t */\n\teditEvictionFrequency?: number;\n}\n\n/**\n * Configuration options for a SharedTree with write format 0.0.2\n * @alpha\n */\nexport interface SharedTreeOptions_0_0_2 {\n\t/**\n\t * Determines if the history is included in summaries.\n\t *\n\t * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization\n\t * later once it has been enabled, and thus the history cannot be safely deleted.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t */\n\tsummarizeHistory?: boolean;\n}\n\n/**\n * Configuration options for a SharedTree with write format 0.1.1\n * @alpha\n */\nexport interface SharedTreeOptions_0_1_1 {\n\t/**\n\t * Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t *\n\t * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization\n\t * later once it has been enabled, and thus the history cannot be safely deleted.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t */\n\tsummarizeHistory?: false | { uploadEditChunks: boolean };\n\t/** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */\n\tattributionId?: AttributionId;\n}\n\n/**\n * Factory for SharedTree.\n * Includes history in the summary.\n * @alpha\n */\nexport class SharedTreeFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic static Type = SharedTreeFactoryType;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic static Attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tprivate readonly args: SharedTreeArgs;\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format\n\t * documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tconstructor(...args: SharedTreeArgs) {\n\t\tthis.args = args;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn SharedTreeFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn SharedTreeFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\t_channelAttributes: Readonly<IChannelAttributes>\n\t): Promise<SharedTree> {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tawait sharedTree.load(services);\n\t\treturn sharedTree;\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - data store runtime that owns the new SharedTree\n\t * @param id - optional name for the SharedTree\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tsharedTree.initializeLocal();\n\t\treturn sharedTree;\n\t}\n\n\tprivate createSharedTree(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst [writeFormat] = this.args;\n\t\tswitch (writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn new SharedTree(runtime, id, ...(this.args as SharedTreeArgs<WriteFormat.v0_0_2>));\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn new SharedTree(runtime, id, ...(this.args as SharedTreeArgs<WriteFormat.v0_1_1>));\n\t\t\tdefault:\n\t\t\t\tfail('Unknown write format');\n\t\t}\n\t}\n}\n\n/**\n * Filename where the snapshot is stored.\n */\nconst snapshotFileName = 'header';\n\n/**\n * Used for version comparison.\n */\nconst sortedWriteVersions = [WriteFormat.v0_0_2, WriteFormat.v0_1_1];\n\n/**\n * The arguments included when the EditCommitted SharedTreeEvent is emitted.\n * @alpha\n */\nexport interface EditCommittedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly editId: EditId;\n\t/** Whether or not this is a local edit. */\n\treadonly local: boolean;\n\t/** The tree the edit was committed on. Required for local edit events handled by SharedTreeUndoRedoHandler. */\n\treadonly tree: SharedTree;\n}\n\n/**\n * The arguments included when the {@link SharedTreeEvent.SequencedEditApplied} SharedTreeEvent is emitted.\n * @alpha\n */\nexport interface SequencedEditAppliedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly edit: Edit<ChangeInternal>;\n\t/** Whether or not this was a local edit. */\n\treadonly wasLocal: boolean;\n\t/** The tree the edit was applied to. */\n\treadonly tree: SharedTree;\n\t/** The telemetry logger associated with sequenced edit application. */\n\treadonly logger: ITelemetryLoggerExt;\n\t/** The reconciliation path for the edit. See {@link ReconciliationPath} for details. */\n\treadonly reconciliationPath: ReconciliationPath;\n\t/** The outcome of the sequenced edit being applied. */\n\treadonly outcome: EditApplicationOutcome;\n}\n\n/**\n * The outcome of an edit.\n * @alpha\n */\nexport type EditApplicationOutcome =\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly view: RevisionView;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Applied;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly failure: TransactionInternal.Failure;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t };\n\n/**\n * Events which may be emitted by `SharedTree`. See {@link SharedTreeEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ISharedTreeEvents extends ISharedObjectEvents {\n\t(event: 'committedEdit', listener: EditCommittedHandler);\n\t(event: 'appliedSequencedEdit', listener: SequencedEditAppliedHandler);\n}\n\n/**\n * Expected type for a handler of the `EditCommitted` event.\n * @alpha\n */\nexport type EditCommittedHandler = (args: EditCommittedEventArguments) => void;\n\n/**\n * Expected type for a handler of the {@link SharedTreeEvent.SequencedEditApplied} event.\n * @alpha\n */\nexport type SequencedEditAppliedHandler = (args: SequencedEditAppliedEventArguments) => void;\n\nconst sharedTreeTelemetryProperties: ITelemetryLoggerPropertyBags = {\n\tall: { isSharedTreeEvent: true },\n};\n\n/**\n * Contains information resulting from processing stashed shared tree ops\n * @alpha\n */\nexport interface StashedLocalOpMetadata {\n\t/** A modified version of the edit in an edit op that should be resubmitted rather than the original edit */\n\ttransformedEdit?: Edit<ChangeInternal>;\n}\n\n/** The SessionId of the temporary IdCompressor that records stashed ops */\nconst stashedSessionId = '8477b8d5-cf6c-4673-8345-8f076a8f9bc6' as SessionId;\n\n/**\n * A {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/README.md | distributed tree}.\n * @alpha\n */\nexport class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {\n\t/**\n\t * Create a new SharedTree. It will contain the default value (see initialTree).\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree {\n\t\treturn runtime.createChannel(id, SharedTreeFactory.Type) as SharedTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.\n\t * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree\n\t * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,\n\t * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version\n\t * written.\n\t * See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tpublic static getFactory(...args: SharedTreeArgs<WriteFormat.v0_0_2>): SharedTreeFactory;\n\n\tpublic static getFactory(...args: SharedTreeArgs<WriteFormat.v0_1_1>): SharedTreeFactory;\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store, using the latest write version and default options.\n\t */\n\tpublic static getFactory(): SharedTreeFactory;\n\n\tpublic static getFactory(...args: SharedTreeArgs | []): SharedTreeFactory {\n\t\tconst [formatArg, options] = args;\n\t\tconst writeFormat = formatArg ?? WriteFormat.v0_1_1;\n\t\t// \tOn 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.\n\t\t// Note that this means staged rollout changing this value should not be attempted.\n\t\t// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.\n\t\t// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t\treturn new SharedTreeFactory(writeFormat, options);\n\t}\n\n\t/**\n\t * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or\n\t * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those\n\t * with a write format of 0.0.2) use the nil UUID as their attribution ID.\n\t */\n\tpublic get attributionId(): AttributionId {\n\t\tswitch (this.writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn nilUuid;\n\t\t\tdefault: {\n\t\t\t\tconst { attributionId } = this.idCompressor;\n\t\t\t\tif (attributionId === ghostSessionId) {\n\t\t\t\t\treturn nilUuid;\n\t\t\t\t}\n\t\t\t\treturn attributionId;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * This is SharedTree's internal IdCompressor that predates the one in the runtime. If access\n\t * to the IdCompressor is needed, this is the one that should be used.\n\t */\n\tprivate idCompressor: IdCompressor;\n\n\tprivate readonly idNormalizer: NodeIdNormalizer<OpSpaceNodeId> & { tree: SharedTree } = {\n\t\ttree: this,\n\t\tget localSessionId() {\n\t\t\treturn this.tree.idCompressor.localSessionId;\n\t\t},\n\t\tnormalizeToOpSpace: (id) => this.idCompressor.normalizeToOpSpace(id) as OpSpaceNodeId,\n\t\tnormalizeToSessionSpace: (id, sessionId) => this.idCompressor.normalizeToSessionSpace(id, sessionId) as NodeId,\n\t};\n\t/** Temporarily created to apply stashed ops from a previous session */\n\tprivate stashedIdCompressor?: IdCompressor | null;\n\n\t// The initial tree's definition isn't included in any op by default but it should still be interned. Including it here ensures that.\n\tprivate interner: MutableStringInterner = new MutableStringInterner([initialTree.definition]);\n\n\t/**\n\t * The log of completed edits for this SharedTree.\n\t */\n\tprivate editLog: EditLog<ChangeInternal>;\n\tprivate readonly editLogSize?: number;\n\tprivate readonly editEvictionFrequency?: number;\n\n\t/**\n\t * As an implementation detail, SharedTree uses a log viewer that caches views of different revisions.\n\t * It is not exposed to avoid accidental correctness issues, but `logViewer` is exposed in order to give clients a way\n\t * to access the revision history.\n\t */\n\tprivate cachingLogViewer: CachingLogViewer;\n\n\t/**\n\t * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).\n\t */\n\tpublic get logViewer(): LogViewer {\n\t\treturn this.cachingLogViewer;\n\t}\n\n\t/**\n\t * logger for SharedTree events.\n\t */\n\tpublic readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sequencedEditAppliedLogger: ITelemetryLoggerExt;\n\n\tprivate readonly encoder_0_0_2: SharedTreeEncoder_0_0_2;\n\tprivate encoder_0_1_1: SharedTreeEncoder_0_1_1;\n\n\tprivate readonly processEditResult = (editResult: EditStatus, editId: EditId): void => {\n\t\t// TODO:#44859: Invalid results should be handled by the app\n\t\tthis.emit(SharedTree.eventFromEditResult(editResult), editId);\n\t};\n\n\tprivate readonly processSequencedEditResult = ({\n\t\tedit,\n\t\twasLocal,\n\t\tresult,\n\t\treconciliationPath,\n\t}: SequencedEditResult): void => {\n\t\tconst eventArguments: SequencedEditAppliedEventArguments = {\n\t\t\tedit,\n\t\t\twasLocal,\n\t\t\ttree: this,\n\t\t\tlogger: this.sequencedEditAppliedLogger,\n\t\t\treconciliationPath,\n\t\t\toutcome: result,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.SequencedEditApplied, eventArguments);\n\t};\n\n\tprivate summarizeHistory: boolean;\n\n\tprivate getHistoryPolicy(options: SharedTreeOptions<WriteFormat, 'Forwards' | 'None'>): {\n\t\tsummarizeHistory: boolean;\n\t} {\n\t\tconst noCompatOptions = options as SharedTreeOptions<WriteFormat, 'None'>;\n\t\treturn typeof noCompatOptions.summarizeHistory === 'object'\n\t\t\t? {\n\t\t\t\t\tsummarizeHistory: true,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tsummarizeHistory: noCompatOptions.summarizeHistory ?? false,\n\t\t\t\t};\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - The runtime the SharedTree will be associated with\n\t * @param id - Unique ID for the SharedTree\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format\n\t * documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t */\n\tpublic constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);\n\n\tpublic constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);\n\n\tpublic constructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-readonly -- false positive; modified in changeWriteFormat()\n\t\tprivate writeFormat: WriteFormat,\n\t\toptions: SharedTreeOptions<typeof writeFormat> = {}\n\t) {\n\t\tsuper(id, runtime, SharedTreeFactory.Attributes, 'fluid_legacySharedTree_');\n\t\tconst historyPolicy = this.getHistoryPolicy(options);\n\t\tthis.summarizeHistory = historyPolicy.summarizeHistory;\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: 'SharedTree',\n\t\t\tproperties: sharedTreeTelemetryProperties,\n\t\t});\n\t\tthis.sequencedEditAppliedLogger = createChildLogger({\n\t\t\tlogger: this.logger,\n\t\t\tnamespace: 'SequencedEditApplied',\n\t\t\tproperties: sharedTreeTelemetryProperties,\n\t\t});\n\n\t\tconst attributionId = (options as SharedTreeOptions<WriteFormat.v0_1_1>).attributionId;\n\n\t\t/**\n\t\t * Because the IdCompressor emits so much telemetry, this function is used to sample\n\t\t * approximately 5% of all clients. Only the given percentage of sessions will emit telemetry.\n\t\t */\n\t\tconst idCompressorEventSampler: IEventSampler = (() => {\n\t\t\tconst isIdCompressorTelemetryEnabled = Math.random() < 0.05;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\treturn isIdCompressorTelemetryEnabled;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\t\tconst idCompressorLoger = createSampledLogger(this.logger, idCompressorEventSampler);\n\t\tthis.idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId, idCompressorLoger);\n\t\tthis.editLogSize = options.inMemoryHistorySize;\n\t\tthis.editEvictionFrequency = options.inMemoryHistorySize;\n\t\tconst { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary(\n\t\t\t{\n\t\t\t\teditChunks: [],\n\t\t\t\teditIds: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tthis.idCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tWriteFormat.v0_1_1\n\t\t);\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = cachingLogViewer;\n\t\tthis.encoder_0_0_2 = new SharedTreeEncoder_0_0_2(this.summarizeHistory);\n\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t}\n\n\t/**\n\t * The write format version currently used by this `SharedTree`. This is always initialized to the write format\n\t * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another\n\t * SharedTree with a higher write format, or when loading a summary with a higher write format).\n\t */\n\tpublic getWriteFormat(): WriteFormat {\n\t\treturn this.writeFormat;\n\t}\n\n\t/**\n\t * Computes the oldest client in the quorum, true by default if the container is detached and false by default if the client isn't connected.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate computeIsOldest(): boolean {\n\t\t// If the container is detached, we are the only ones that know about it and are the oldest by default.\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// If we're not connected we can't be the oldest connected client.\n\t\tif (!this.runtime.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(this.runtime.clientId !== undefined, 0x62d /* Client id should be set if connected. */);\n\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tconst selfSequencedClient = quorum.getMember(this.runtime.clientId);\n\t\t// When in readonly mode our clientId will not be present in the quorum.\n\t\tif (selfSequencedClient === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst members = quorum.getMembers();\n\t\tfor (const sequencedClient of members.values()) {\n\t\t\tif (sequencedClient.sequenceNumber < selfSequencedClient.sequenceNumber) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// No member of the quorum was older\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns the current view of the tree.\n\t */\n\tpublic get currentView(): RevisionView {\n\t\treturn this.logViewer.getRevisionViewInMemory(Number.POSITIVE_INFINITY);\n\t}\n\n\t/**\n\t * Generates a node identifier.\n\t * The returned IDs may be used as the identifier of a node in the SharedTree.\n\t * `NodeId`s are *always* unique and stable within the scope of the tree and session that generated them. They are *not* unique within\n\t * a Fluid container, and *cannot* be compared across instances of a SharedTree. They are *not* stable across sessions/lifetimes of a\n\t * SharedTree, and *cannot* be persisted (e.g. stored in payloads, uploaded in blobs, etc.). If stable persistence is needed,\n\t * NodeIdConverter.convertToStableNodeId may be used to return a corresponding UUID that is globally unique and stable.\n\t * @param override - if supplied, calls to `convertToStableNodeId` using the returned node ID will return the override instead of\n\t * the UUID. Calls to `generateNodeId` with the same override always return the same ID. Performance note: passing an override string\n\t * incurs a storage cost that is significantly higher that a node ID without one, and should be avoided if possible.\n\t */\n\tpublic generateNodeId(override?: string): NodeId {\n\t\treturn this.idCompressor.generateCompressedId(override) as NodeId;\n\t}\n\n\t/**\n\t * Given a NodeId, returns the corresponding stable ID or throws if the supplied node ID was not generated with this tree (`NodeId`s\n\t * may not be used across SharedTree instances, see `generateNodeId` for more).\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The result is safe to persist and re-use across `SharedTree` instances, unlike `NodeId`.\n\t */\n\tpublic convertToStableNodeId(id: NodeId): StableNodeId {\n\t\treturn (this.idCompressor.tryDecompress(id) as StableNodeId) ?? fail('Node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a NodeId, attempt to return the corresponding stable ID.\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The returned stable ID is undefined if `id` was never created with this SharedTree. If a stable ID is returned, this does not imply\n\t * that there is a node with `id` in the current revision of the tree, only that `id` was at some point generated by some instance of\n\t * this tree.\n\t */\n\tpublic tryConvertToStableNodeId(id: NodeId): StableNodeId | undefined {\n\t\treturn this.idCompressor.tryDecompress(id) as StableNodeId | undefined;\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or throws if the supplied stable ID was never generated with this tree, either\n\t * as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t */\n\tpublic convertToNodeId(id: StableNodeId): NodeId {\n\t\treturn (this.idCompressor.tryRecompress(id) as NodeId) ?? fail('Stable node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or return undefined if the supplied stable ID was never generated with this tree,\n\t * either as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t */\n\tpublic tryConvertToNodeId(id: StableNodeId): NodeId | undefined {\n\t\treturn this.idCompressor.tryRecompress(id) as NodeId | undefined;\n\t}\n\n\t/**\n\t * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients\n\t * with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default\n\t * `attributionId` of the tree.\n\t */\n\tpublic attributeNodeId(id: NodeId): AttributionId {\n\t\tswitch (this.writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn nilUuid;\n\t\t\tdefault: {\n\t\t\t\tconst attributionId = this.idCompressor.attributeId(id);\n\t\t\t\tif (attributionId === ghostSessionId) {\n\t\t\t\t\treturn nilUuid;\n\t\t\t\t}\n\t\t\t\treturn attributionId;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @returns the edit history of the tree.\n\t */\n\tpublic get edits(): OrderedEditSet<InternalizedChange> {\n\t\treturn this.editLog as unknown as OrderedEditSet<InternalizedChange>;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(snapshotFileName, this.saveSerializedSummary({ serializer }));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic override getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\t// If local changes exist, emulate the sequencing of those changes.\n\t\t// Doing so is necessary so edits created during DataObject.initializingFirstTime are included.\n\t\t// Doing so is safe because it is guaranteed that the DDS has not yet been attached. This is because summary creation is only\n\t\t// ever invoked on a DataObject containing local changes when it is attached for the first time. In post-attach flows, an extra\n\t\t// instance of the DataObject is created for generating summaries and will never have local edits.\n\t\tif (this.editLog.numberOfLocalEdits > 0) {\n\t\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\t\t// Since we're the first client to attach, we can safely finalize ourselves since we're the only ones who have made IDs.\n\t\t\t\tthis.idCompressor.finalizeCreationRange(this.idCompressor.takeNextCreationRange());\n\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.editLog.sequenceLocalEdits();\n\t\t}\n\t\treturn super.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a serialized summary. This is used for testing.\n\t *\n\t * @param summarizer - Optional summarizer to use. If not passed in, SharedTree's summarizer is used.\n\t */\n\tpublic saveSerializedSummary(options?: { serializer?: IFluidSerializer }): string {\n\t\tconst { serializer } = options ?? {};\n\t\treturn serialize(this.saveSummary(), serializer ?? this.serializer, this.handle);\n\t}\n\n\t/**\n\t * Initialize shared tree with a serialized summary. This is used for testing.\n\t * @returns Statistics about the loaded summary.\n\t */\n\tpublic loadSerializedSummary(blobData: string): ITelemetryBaseProperties {\n\t\tconst summary = deserialize(blobData, this.serializer);\n\t\tthis.loadSummary(summary);\n\t\treturn getSummaryStatistics(summary);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a deserialized summary.\n\t */\n\tpublic saveSummary(): SharedTreeSummaryBase {\n\t\tassert(this.editLog.numberOfLocalEdits === 0, 0x62f /* generateSummary must not be called with local edits */);\n\t\treturn this.generateSummary();\n\t}\n\n\t/**\n\t * Generates a SharedTree summary for the current state of the tree.\n\t * Will never be called when local edits are present.\n\t */\n\tprivate generateSummary(): SharedTreeSummaryBase {\n\t\ttry {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\treturn this.encoder_0_0_2.encodeSummary(this.editLog, this.currentView, this);\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\treturn this.encoder_0_1_1.encodeSummary(\n\t\t\t\t\t\tthis.editLog,\n\t\t\t\t\t\tthis.currentView,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\tthis.interner,\n\t\t\t\t\t\tthis.idCompressor.serialize(false)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger?.sendErrorEvent({\n\t\t\t\teventName: 'UnsupportedSummaryWriteFormat',\n\t\t\t\tformatVersion: this.writeFormat,\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Initialize shared tree with a deserialized summary.\n\t */\n\tpublic loadSummary(summary: SharedTreeSummaryBase): void {\n\t\tconst { version: loadedSummaryVersion } = summary;\n\n\t\tif (this.deltaManager.readOnlyInfo.readonly !== true && isUpdateRequired(loadedSummaryVersion, this.writeFormat)) {\n\t\t\tthis.submitOp({ type: SharedTreeOpType.Update, version: this.writeFormat });\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'RequestVersionUpdate',\n\t\t\t\tversionFrom: loadedSummaryVersion,\n\t\t\t\tversionTo: this.writeFormat,\n\t\t\t});\n\t\t}\n\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, this.writeFormat) !== 0) {\n\t\t\t// Write whatever format the loaded summary uses (this is the current agreed-upon format: it may be updated by an update op)\n\t\t\tthis.changeWriteFormat(loadedSummaryVersion);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.idCompressor.getAllIdsFromLocalSession().next().done === true,\n\t\t\t0x630 /* Summary load should not be executed after local state is created. */\n\t\t);\n\n\t\tlet convertedSummary: SummaryContents;\n\t\tswitch (loadedSummaryVersion) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\tconvertedSummary = this.encoder_0_0_2.decodeSummary(summary as SharedTreeSummary_0_0_2, this.attributionId);\n\t\t\t\tbreak;\n\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\tconst typedSummary = summary as SharedTreeSummary;\n\t\t\t\t// See comment in factory constructor--ensure we write a consistent type of summary as how the document began.\n\t\t\t\tconst loadedSummaryIncludesHistory = typedSummary.currentTree !== undefined;\n\t\t\t\tif (loadedSummaryIncludesHistory !== this.summarizeHistory) {\n\t\t\t\t\tthis.summarizeHistory = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t\t\t\t}\n\n\t\t\t\tconvertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary, this.attributionId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown version');\n\t\t}\n\n\t\tconst { editHistory, currentTree, idCompressor, interner } = convertedSummary;\n\t\tthis.interner = interner;\n\t\tthis.interner.getOrCreateInternedId(initialTree.definition);\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, WriteFormat.v0_1_1) < 0) {\n\t\t\tconst { editIds, editChunks } = editHistory;\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'SummaryConversion',\n\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\thistorySize: editIds.length,\n\t\t\t\ttotalNumberOfChunks: editChunks.length,\n\t\t\t});\n\t\t}\n\n\t\tthis.initializeNewEditLogFromSummary(\n\t\t\teditHistory,\n\t\t\tcurrentTree,\n\t\t\tidCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tsummary.version\n\t\t);\n\t}\n\n\tprivate static eventFromEditResult(editStatus: EditStatus): SharedTreeDiagnosticEvent {\n\t\tswitch (editStatus) {\n\t\t\tcase EditStatus.Applied:\n\t\t\t\treturn SharedTreeDiagnosticEvent.AppliedEdit;\n\t\t\tcase EditStatus.Invalid:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedInvalidEdit;\n\t\t\tdefault:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedMalformedEdit;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes a new `EditLog` and `CachingLogViewer` on this `SharedTree`, replacing and disposing of any previously existing ones.\n\t * @returns the initialized values (this is mostly to keep the constructor happy)\n\t */\n\tprivate initializeNewEditLogFromSummary(\n\t\teditHistory: EditLogSummary<ChangeInternal, EditHandle<ChangeInternal>>,\n\t\tcurrentTree: ChangeNode | undefined,\n\t\tidCompressor: IdCompressor,\n\t\teditStatusCallback: EditStatusCallback,\n\t\tsequencedEditResultCallback: SequencedEditResultCallback,\n\t\tversion: WriteFormat\n\t): { editLog: EditLog<ChangeInternal>; cachingLogViewer: CachingLogViewer } {\n\t\tthis.idCompressor = idCompressor;\n\t\t// Dispose the current log viewer if it exists. This ensures that re-used EditAddedHandlers below don't retain references to old\n\t\t// log viewers.\n\t\tthis.cachingLogViewer?.detachFromEditLog();\n\n\t\t// Use previously registered EditAddedHandlers if there is an existing EditLog.\n\t\tconst editLog = new EditLog(\n\t\t\teditHistory,\n\t\t\tthis.logger,\n\t\t\tthis.editLog?.editAddedHandlers,\n\t\t\tthis.editLogSize,\n\t\t\tthis.editEvictionFrequency\n\t\t);\n\n\t\teditLog.on(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk, () => {\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);\n\t\t});\n\n\t\tlet initialRevision: [number, EditCacheEntry] | undefined;\n\t\tif (currentTree !== undefined) {\n\t\t\tconst currentView = RevisionView.fromTree(currentTree);\n\t\t\tinitialRevision = [editLog.length, { view: currentView }];\n\t\t}\n\n\t\tconst logViewer = new CachingLogViewer(\n\t\t\teditLog,\n\t\t\tRevisionView.fromTree(initialTree, this),\n\t\t\tinitialRevision,\n\t\t\teditStatusCallback,\n\t\t\tsequencedEditResultCallback,\n\t\t\t0\n\t\t);\n\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = logViewer;\n\t\treturn { editLog, cachingLogViewer: logViewer };\n\t}\n\n\t/**\n\t * Compares this shared tree to another for equality. Should only be used for internal correctness testing.\n\t *\n\t * Equality means that the histories as captured by the EditLogs are equivalent.\n\t *\n\t * Equality does not include:\n\t *\n\t * - if an edit is open\n\t *\n\t * - the shared tree's id\n\t *\n\t * - local vs sequenced status of edits\n\t *\n\t * - registered event listeners\n\t *\n\t * - state of caches\n\t */\n\tpublic equals(sharedTree: SharedTree): boolean {\n\t\tif (!areRevisionViewsSemanticallyEqual(this.currentView, this, sharedTree.currentView, sharedTree)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.editLog.equals(sharedTree.editLog);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst summaryLoadPerformanceEvent = PerformanceEvent.start(this.logger, {\n\t\t\teventName: 'SummaryLoad',\n\t\t});\n\n\t\ttry {\n\t\t\tconst newBlob = await storage.readBlob(snapshotFileName);\n\t\t\tconst blobData = bufferToString(newBlob, 'utf8');\n\n\t\t\tconst stats = this.loadSerializedSummary(blobData);\n\n\t\t\tsummaryLoadPerformanceEvent.end(stats);\n\t\t} catch (error) {\n\t\t\tsummaryLoadPerformanceEvent.cancel({ eventName: 'SummaryLoadFailure' }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent.contents);\n\t\t}\n\t}\n\n\tprivate processMessage(messageEnvelope: ISequencedMessageEnvelope, contents: unknown): void {\n\t\tconst typedContents = contents as SharedTreeOp_0_0_2 | SharedTreeOp;\n\t\tthis.cachingLogViewer.setMinimumSequenceNumber(messageEnvelope.minimumSequenceNumber);\n\t\tconst op = typedContents;\n\t\tif (op.version === undefined) {\n\t\t\t// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.\n\t\t\t(op as { version: WriteFormat | undefined }).version = WriteFormat.v0_0_2;\n\t\t}\n\t\tconst { type, version } = op;\n\t\tconst sameVersion = version === this.writeFormat;\n\n\t\t// Edit and handle ops should only be processed if they're the same version as the tree write version.\n\t\t// Update ops should only be processed if they're not the same version.\n\t\tif (sameVersion) {\n\t\t\tif (type === SharedTreeOpType.Handle) {\n\t\t\t\t// Edit virtualization is no longer supported, log the event and ignore the op.\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: 'UnexpectedHistoryChunk' });\n\t\t\t} else if (type === SharedTreeOpType.Edit) {\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.idCompressor.finalizeCreationRange(op.idRange);\n\t\t\t\t}\n\t\t\t\tconst edit = this.parseSequencedEdit(op);\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t\tthis.processSequencedEdit(edit, messageEnvelope);\n\t\t\t}\n\t\t} else if (type === SharedTreeOpType.Update) {\n\t\t\tthis.processVersionUpdate(op.version);\n\t\t} else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {\n\t\t\t// An op version newer than our current version should not be received. If this happens, either an\n\t\t\t// incorrect op version has been written or an update op was skipped.\n\t\t\tconst error = 'Newer op version received by a client that has yet to be updated.';\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'UnexpectedNewerOpVersion',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t\tfail(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}\n\t */\n\tprotected registerCore(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * Parses a sequenced edit. This is only invoked for ops with version matching the current `writeFormat`.\n\t */\n\tprivate parseSequencedEdit(op: SharedTreeEditOp | SharedTreeEditOp_0_0_2): Edit<ChangeInternal> {\n\t\t// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)\n\t\tswitch (op.version) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn this.encoder_0_0_2.decodeEditOp(op, (x) => x, this);\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn this.encoder_0_1_1.decodeEditOp(op, (x) => x, this.idNormalizer, this.interner);\n\t\t\tdefault:\n\t\t\t\tfail('Unknown op version');\n\t\t}\n\t}\n\n\tprivate processSequencedEdit(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope): void {\n\t\tconst { id: editId } = edit;\n\t\tconst wasLocalEdit = this.editLog.isLocalEdit(editId);\n\n\t\t// If the id of the supplied edit matches a non-local edit already present in the log, this would normally be indicative of an error.\n\t\t// However, the @fluidframework packages prior to 0.37.x have a bug which can cause data corruption by sequencing duplicate edits--\n\t\t// see discussion on the following github issue: https://github.com/microsoft/FluidFramework/issues/4399\n\t\t// To work around this issue, we currently tolerate duplicate ops in loaded documents.\n\t\t// This could be strengthened in the future to only apply to documents which may have been impacted.\n\t\tconst shouldIgnoreEdit = this.editLog.tryGetIndexOfId(editId) !== undefined && !wasLocalEdit;\n\t\tif (shouldIgnoreEdit) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (wasLocalEdit) {\n\t\t\tthis.editLog.addSequencedEdit(edit, messageEnvelope);\n\t\t} else {\n\t\t\tthis.applyEditLocally(edit, messageEnvelope);\n\t\t}\n\t}\n\n\t/**\n\t * Updates SharedTree to the provided version if the version is a valid write version newer than the current version.\n\t * @param version - The version to update to.\n\t */\n\tprivate processVersionUpdate(version: WriteFormat) {\n\t\tif (isUpdateRequired(this.writeFormat, version)) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: 'VersionUpdate', version },\n\t\t\t\t() => {\n\t\t\t\t\tif (compareSummaryFormatVersions(version, WriteFormat.v0_1_1) >= 0) {\n\t\t\t\t\t\tthis.upgradeFrom_0_0_2_to_0_1_1();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Updating to version ${version} is not supported.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeWriteFormat(version);\n\n\t\t\t\t\t// The edit log may contain some local edits submitted after the version update op was submitted but\n\t\t\t\t\t// before we receive the message it has been sequenced. Since these edits must be sequenced after the version\n\t\t\t\t\t// update op, they will be discarded. These edits are then re-submitted using the new format.\n\t\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\t\tthis.submitEditOp(edit);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tend: true,\n\t\t\t\t\tcancel: 'error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate upgradeFrom_0_0_2_to_0_1_1(): void {\n\t\t// Reset the string interner, re-populate only with information that there is consensus on\n\t\tthis.interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst oldIdCompressor = this.idCompressor;\n\t\t// Create the IdCompressor that will be used after the upgrade\n\t\tconst newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount, this.attributionId, this.logger);\n\t\tconst newContext = getNodeIdContext(newIdCompressor);\n\t\t// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.\n\t\t// This will allow the client to continue to use local IDs that were allocated pre-upgrade\n\t\tfor (const localId of oldIdCompressor.getAllIdsFromLocalSession()) {\n\t\t\tnewIdCompressor.generateCompressedId(oldIdCompressor.decompress(localId));\n\t\t}\n\n\t\tconst unifyHistoricalIds = (context: NodeIdContext): void => {\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tconst edit = this.editLog.tryGetEditAtIndex(i) ?? fail('edit not found');\n\t\t\t\tconvertEditIds(edit, (id) => context.generateNodeId(this.convertToStableNodeId(id)));\n\t\t\t}\n\t\t};\n\t\t// Construct a temporary \"ghost\" compressor which is used to generate final IDs that will be consistent across all upgrading clients\n\t\tconst ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount);\n\t\tconst ghostContext = getNodeIdContext(ghostIdCompressor);\n\t\tif (this.summarizeHistory) {\n\t\t\t// All clients have the full history, and can therefore all \"generate\" the same final IDs for every ID in the history\n\t\t\t// via the ghost compressor.\n\t\t\tunifyHistoricalIds(ghostContext);\n\t\t\t// The same logic applies to string interning, so intern all the strings in the history (superset of those in the current view)\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tthis.internStringsFromEdit(this.editLog.tryGetEditAtIndex(i) ?? fail('edit not found'));\n\t\t\t}\n\t\t} else {\n\t\t\t// Clients do not have the full history, but all share the same current view (sequenced). They can all finalize the same final\n\t\t\t// IDs for every ID in the view via the ghost compressor.\n\t\t\t// The same logic applies for the string interner.\n\t\t\tfor (const node of this.logViewer.getRevisionViewInMemory(this.editLog.numberOfSequencedEdits)) {\n\t\t\t\tghostContext.generateNodeId(this.convertToStableNodeId(node.identifier));\n\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\tfor (const label of [...node.traits.keys()].sort()) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(label);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Every node in this client's history can simply be generated in the new compressor as well, preserving the UUID\n\t\t\tunifyHistoricalIds(newContext);\n\t\t}\n\t\t// Finalize any IDs in the ghost compressor into the actual compressor. This simulates all clients reaching a consensus on those IDs\n\t\tnewIdCompressor.finalizeCreationRange(ghostIdCompressor.takeNextCreationRange());\n\t\tthis.idCompressor = newIdCompressor;\n\t}\n\n\t/**\n\t * Applies a set of changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * This method does not allow for snapshot isolation, as the changes are always applied to the most recent revision.\n\t * If it is desireable to read from and apply changes to a fixed view that does not change when remote changes arrive, `Checkout`\n\t * should be used instead.\n\t */\n\tpublic applyEdit(...changes: readonly Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(changes: readonly Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(...changesOrArray: RestOrArray<Change>): Edit<InternalizedChange> {\n\t\tconst changes = unwrapRestOrArray(changesOrArray);\n\t\tconst id = newEditId();\n\t\tconst internalEdit: Edit<ChangeInternal> = {\n\t\t\tid,\n\t\t\tchanges: changes.map((c) => this.internalizeChange(c)),\n\t\t};\n\t\tthis.submitEditOp(internalEdit);\n\t\tthis.applyEditLocally(internalEdit, undefined);\n\t\treturn internalEdit as unknown as Edit<InternalizedChange>;\n\t}\n\n\t/**\n\t * Merges `edits` from `other` into this SharedTree.\n\t * @param other - Tree containing the edits that should be applied to this one.\n\t * @param edits - Iterable of edits from `other` to apply.\n\t * @param stableIdRemapper - Optional remapper to translate stable identities from `other` into stable identities on this tree.\n\t * Any references that `other` contains to a stable id `foo` will be replaced with references to the id `stableIdRemapper(foo)`.\n\t *\n\t * Payloads on the edits are left intact.\n\t * @returns a list containing `EditId`s for all applied edits.\n\t */\n\tpublic mergeEditsFrom(\n\t\tother: SharedTree,\n\t\tedits: Iterable<Edit<InternalizedChange>>,\n\t\tstableIdRemapper?: (id: StableNodeId) => StableNodeId\n\t): EditId[] {\n\t\tconst idConverter = (id: NodeId) => {\n\t\t\tconst stableId = other.convertToStableNodeId(id);\n\t\t\tconst convertedStableId = stableIdRemapper?.(stableId) ?? stableId;\n\t\t\treturn this.generateNodeId(convertedStableId);\n\t\t};\n\n\t\treturn Array.from(\n\t\t\tedits as unknown as Iterable<Edit<ChangeInternal>>,\n\t\t\t(edit) => this.applyEditInternal(convertEditIds(edit, (id) => idConverter(id))).id\n\t\t);\n\t}\n\n\t/**\n\t * Applies a set of internal changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * External users should use one of the more specialized functions, like `applyEdit` which handles constructing the actual `Edit`\n\t * and uses public Change types.\n\t * This is exposed for internal use only.\n\t */\n\tpublic applyEditInternal(editOrChanges: Edit<ChangeInternal> | readonly ChangeInternal[]): Edit<ChangeInternal> {\n\t\tlet edit: Edit<ChangeInternal>;\n\t\tif (Array.isArray(editOrChanges)) {\n\t\t\tconst id = newEditId();\n\t\t\tedit = { id, changes: editOrChanges };\n\t\t} else {\n\t\t\tedit = editOrChanges as Edit<ChangeInternal>;\n\t\t}\n\t\tthis.submitEditOp(edit);\n\t\tthis.applyEditLocally(edit, undefined);\n\t\treturn edit;\n\t}\n\n\t/**\n\t * Converts a public Change type to an internal representation.\n\t * This is exposed for internal use only.\n\t */\n\tpublic internalizeChange(change: Change): ChangeInternal {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeType.Insert:\n\t\t\t\treturn {\n\t\t\t\t\tsource: change.source as DetachedSequenceId,\n\t\t\t\t\tdestination: deepCloneStablePlace(change.destination),\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t};\n\t\t\tcase ChangeType.Detach: {\n\t\t\t\tconst detach: DetachInternal = {\n\t\t\t\t\tsource: deepCloneStableRange(change.source),\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeType.Build: {\n\t\t\t\tif (isTreeNodeSequence(change.source)) {\n\t\t\t\t\tconst source = change.source.map((buildNode) =>\n\t\t\t\t\t\tconvertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\t\tbuildNode,\n\t\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t\t)\n\t\t\t\t\t) as TreeNodeSequence<TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId>;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst source = convertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\tchange.source,\n\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t) as TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource: [source],\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase ChangeType.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\tnodeToModify: change.nodeToModify,\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t};\n\t\t\tcase ChangeType.Constraint: {\n\t\t\t\tconst constraint: ConstraintInternal = {\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: change.toConstrain,\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'parentNode');\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('unexpected change type');\n\t\t}\n\t}\n\n\tprivate applyEditLocally(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope | undefined): void {\n\t\tconst isSequenced = messageEnvelope !== undefined;\n\t\tif (isSequenced) {\n\t\t\tthis.editLog.addSequencedEdit(edit, messageEnvelope);\n\t\t} else {\n\t\t\tthis.editLog.addLocalEdit(edit);\n\t\t}\n\n\t\tconst eventArguments: EditCommittedEventArguments = {\n\t\t\teditId: edit.id,\n\t\t\tlocal: !isSequenced,\n\t\t\ttree: this,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.EditCommitted, eventArguments);\n\t}\n\n\t/**\n\t * Reverts a previous edit by applying a new edit containing the inverse of the original edit's changes.\n\t * @param editId - the edit to revert\n\t * @returns the id of the new edit, or undefined if the original edit could not be inverted given the current tree state.\n\t */\n\tpublic revert(editId: EditId): EditId | undefined {\n\t\tconst index = this.edits.getIndexOfId(editId);\n\t\tconst edit = this.edits.tryGetEditAtIndex(index) ?? fail('edit not found');\n\t\tconst before = this.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.revertChanges(edit.changes, before);\n\t\tif (changes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.applyEditInternal(changes).id;\n\t}\n\n\t/**\n\t * Revert the given changes\n\t * @param changes - the changes to revert\n\t * @param before - the revision view before the changes were originally applied\n\t * @returns the inverse of `changes` or undefined if the changes could not be inverted for the given tree state.\n\t */\n\tpublic revertChanges(changes: readonly InternalizedChange[], before: RevisionView): ChangeInternal[] | undefined {\n\t\treturn revert(changes as unknown as readonly ChangeInternal[], before, this.logger, this.emit.bind(this));\n\t}\n\n\t/**\n\t * Submits an edit by the local client to the runtime.\n\t */\n\tprivate submitEditOp(edit: Edit<ChangeInternal>): void {\n\t\t// Only submit ops if attached, since op submission can have stateful side effects (e.g. changing the IdCompressor)\n\t\t// Ops will be submitted again when attached (see loadSummary())\n\t\tif (this.isAttached()) {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\tthis.submitOp(this.encoder_0_0_2.encodeEditOp(edit, (x) => x, this));\n\t\t\t\t\tbreak;\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\tthis.submitOp(\n\t\t\t\t\t\tthis.encoder_0_1_1.encodeEditOp(\n\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t(x) => x,\n\t\t\t\t\t\t\tthis.idCompressor.takeNextCreationRange(),\n\t\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t}\n\t}\n\n\t/** A type-safe `submitLocalMessage` wrapper to enforce op format */\n\tprivate submitOp(content: SharedTreeOp | SharedTreeOp_0_0_2, localOpMetadata: unknown = undefined): void {\n\t\tassert(\n\t\t\tcompareSummaryFormatVersions(content.version, this.writeFormat) === 0,\n\t\t\t0x631 /* Attempted to submit op of wrong version */\n\t\t);\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\tpublic getRuntime(): IFluidDataStoreRuntime {\n\t\treturn this.runtime;\n\t}\n\n\t/**\n\t * \"Pending local state\" refers to ops submitted to the runtime that have not yet been acked.\n\t * When closing a container, hosts have the option to stash this pending local state somewhere to be reapplied\n\t * later (to avoid data loss).\n\t * If a host then loads a container using that stashed state, this function is called for each stashed op, and is expected to:\n\t * Update this DDS to reflect that state locally, and submit the op to do that.\n\t *\n\t * @param content - op to apply locally.\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\t// In some scenarios, edit ops need to have their edits transformed before application and resubmission. The transformation\n\t\t// occurs in this method, and the result is passed to `resubmitCore` via the return value of this function.\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit: {\n\t\t\t\tlet stashedEdit: Edit<ChangeInternal> | undefined;\n\t\t\t\tswitch (this.writeFormat) {\n\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\tstashedEdit = this.parseSequencedEdit(sharedTreeOp);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\tfail('Received stashed op 0.1.1 before upgrade');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\t// Use the IDs from the stashed ops as overrides for the equivalent new ops\n\t\t\t\t\t\t\t\tstashedEdit = convertEditIds(sharedTreeOp.edit, (id) => this.generateNodeId(id));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\t\t\t\t\tassert(this.stashedIdCompressor !== null, 0x632 /* Stashed op applied after expected window */);\n\t\t\t\t\t\t\t\tif (this.stashedIdCompressor === undefined) {\n\t\t\t\t\t\t\t\t\t// Use a temporary compressor that will help translate the stashed ops\n\t\t\t\t\t\t\t\t\tthis.stashedIdCompressor = IdCompressor.deserialize(\n\t\t\t\t\t\t\t\t\t\tthis.idCompressor.serialize(false),\n\t\t\t\t\t\t\t\t\t\tstashedSessionId,\n\t\t\t\t\t\t\t\t\t\tsharedTreeOp.idRange.attributionId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t// Once all stashed ops have been applied, clear the temporary state\n\t\t\t\t\t\t\t\t\tthis.runtime.on('connected', () => {\n\t\t\t\t\t\t\t\t\t\tthis.stashedIdCompressor = null;\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Pretend (from the perspective of the temporary compressor) that the stashed ops have been sequenced\n\t\t\t\t\t\t\t\tthis.stashedIdCompressor.finalizeCreationRange(sharedTreeOp.idRange);\n\t\t\t\t\t\t\t\tconst stashedIdContext = getNodeIdContext(this.stashedIdCompressor);\n\t\t\t\t\t\t\t\t// Use a normalizer to translate all node IDs in the stashed ops\n\t\t\t\t\t\t\t\tconst normalizer: NodeIdNormalizer<OpSpaceNodeId> = {\n\t\t\t\t\t\t\t\t\tlocalSessionId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\t\t\tnormalizeToSessionSpace: (id, _sessionId) => {\n\t\t\t\t\t\t\t\t\t\t// Interpret the IDs from the stashed ops as stable IDs, and use those as overrides for the equivalent new ops\n\t\t\t\t\t\t\t\t\t\tconst sessionSpaceId = stashedIdContext.normalizeToSessionSpace(id, sharedTreeOp.idRange.sessionId);\n\t\t\t\t\t\t\t\t\t\treturn this.generateNodeId(stashedIdContext.convertToStableNodeId(sessionSpaceId));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnormalizeToOpSpace: (id) => this.idNormalizer.normalizeToOpSpace(id),\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tstashedEdit = this.encoder_0_1_1.decodeEditOp(sharedTreeOp, (x) => x, normalizer, this.interner);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t}\n\t\t\t\tthis.applyEditInternal(stashedEdit);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle and update ops are only acknowledged by the client that generated them upon sequencing--no local changes necessary.\n\t\t\tcase SharedTreeOpType.Handle:\n\t\t\tcase SharedTreeOpType.Update:\n\t\t\tcase SharedTreeOpType.NoOp:\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tfail('Unrecognized op');\n\t\t}\n\t}\n\n\tprotected reSubmitCore(op: unknown, localOpMetadata?: StashedLocalOpMetadata): void {\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit:\n\t\t\t\tif (compareSummaryFormatVersions(sharedTreeOp.version, this.writeFormat) > 0) {\n\t\t\t\t\tfail('Attempted to resubmit op of version newer than current version');\n\t\t\t\t} else if (localOpMetadata?.transformedEdit !== undefined) {\n\t\t\t\t\t// Optimization: stashed 0.0.2 ops require no transformation in 0.0.2; don't re-encode\n\t\t\t\t\tif (this.writeFormat !== WriteFormat.v0_0_2 || sharedTreeOp.version !== WriteFormat.v0_0_2) {\n\t\t\t\t\t\tthis.submitEditOp(localOpMetadata.transformedEdit);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tsuper.reSubmitCore(sharedTreeOp, localOpMetadata);\n\t}\n\n\tprivate changeWriteFormat(newFormat: WriteFormat): void {\n\t\tthis.writeFormat = newFormat;\n\t\tthis.emit(SharedTreeDiagnosticEvent.WriteVersionChanged, newFormat);\n\t}\n\n\t/**\n\t * Interns all Definitions and TraitLabel_s referenced by the provided edit.\n\t *\n\t * Clients must have consensus on the interned values to guarantee the interned ID is valid.\n\t */\n\tprivate internStringsFromEdit(edit: Edit<ChangeInternal>): void {\n\t\tfor (const change of edit.changes) {\n\t\t\tif (change.type === ChangeTypeInternal.Build) {\n\t\t\t\tfor (const root of change.source) {\n\t\t\t\t\twalkTree<TreeNode<BuildNodeInternal, NodeId>, DetachedSequenceId>(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\t(node) => {\n\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\t\t\t\tfor (const trait of Object.keys(node.traits)) {\n\t\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(trait);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDetachedSequenceId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (change.type === ChangeTypeInternal.Insert) {\n\t\t\t\tconst { referenceTrait } = change.destination;\n\t\t\t\tif (referenceTrait !== undefined) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(referenceTrait.label);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @returns 1 if versionA is newer, -1 if versionB is newer, and 0 if the versions are the same.\n * @throws if either version isn't a valid WriteFormat version.\n */\nfunction compareSummaryFormatVersions(versionA: string, versionB: string): number {\n\tconst versionAIndex = sortedWriteVersions.indexOf(versionA as WriteFormat);\n\tconst versionBIndex = sortedWriteVersions.indexOf(versionB as WriteFormat);\n\n\tif (versionAIndex === -1 || versionBIndex === -1) {\n\t\tfail('Summary version being compared cannot be read.');\n\t}\n\n\tif (versionAIndex < versionBIndex) {\n\t\treturn -1;\n\t} else if (versionAIndex > versionBIndex) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n/**\n * Checks if the summary version needs to be updated.\n * @returns true if the old version is older than the new version.\n * @throws if the new version isn't a supported WriteFormat version.\n */\nfunction isUpdateRequired(oldVersion: string, newVersion: string): boolean {\n\tconst newVersionIndex = sortedWriteVersions.indexOf(newVersion as WriteFormat);\n\tif (newVersionIndex === -1) {\n\t\tfail('New write version is invalid.');\n\t}\n\n\treturn compareSummaryFormatVersions(oldVersion, newVersion) === -1 ? true : false;\n}\n\nfunction isTreeNodeSequence(source: TreeNodeSequence<BuildNode> | BuildNode): source is TreeNodeSequence<BuildNode> {\n\treturn Array.isArray(source);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SharedTree.js","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,iFAAoE;AAEpE,kEAA6D;AAc7D,0EAKqD;AACrD,uEAOkD;AAElD,qDAAgF;AAChF,2CAA0F;AAC1F,6CAAmE;AACnE,yDAQ4B;AAC5B,mDAA6E;AAC7E,mEAAiD;AACjD,uDAAmD;AACnD,qDAS0B;AAC1B,qDAA+C;AAC/C,iDAOwB;AACxB,6DAAyF;AAEzF,uDAAiD;AACjD,iEAA0F;AAC1F,2DAA4D;AAC5D,6CAA0D;AAC1D,+EAAkF;AAElF,yDAA6C;AAC7C,uDAAyE;AACzE,yDAwBoC;AACpC,6DAAmF;AA4FnF;;;;GAIG;AACH,MAAa,iBAAiB;IAa7B;;;;;;OAMG;IACH,YAAY,GAAG,IAAoB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,iBAAiB,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,kBAAgD;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtD,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,UAAU,GAA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AC,OAAO,CAAC,UAAyB,CAAC,CAAC;IAC/E,IAAI,eAAe,KAAK,CAAC,CAAC,EAAE,CAAC;QAC5B,IAAA,gBAAI,EAAC,+BAA+B,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA+C;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from '@fluid-internal/client-utils';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from '@fluidframework/datastore-definitions/internal';\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype IRuntimeMessageCollection,\n\ttype ISequencedMessageEnvelope,\n} from '@fluidframework/runtime-definitions/internal';\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from '@fluidframework/shared-object-base/internal';\nimport {\n\tIEventSampler,\n\tITelemetryLoggerPropertyBags,\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { BuildNode, BuildTreeNode, Change, ChangeType } from './ChangeTypes.js';\nimport { RestOrArray, copyPropertyIfDefined, fail, unwrapRestOrArray } from './Common.js';\nimport { EditHandle, EditLog, OrderedEditSet } from './EditLog.js';\nimport {\n\tareRevisionViewsSemanticallyEqual,\n\tconvertTreeNodes,\n\tdeepCloneStablePlace,\n\tdeepCloneStableRange,\n\tinternalizeBuildNode,\n\tnewEditId,\n\twalkTree,\n} from './EditUtilities.js';\nimport { SharedTreeDiagnosticEvent, SharedTreeEvent } from './EventTypes.js';\nimport { revert } from './HistoryEditFactory.js';\nimport { convertEditIds } from './IdConversion.js';\nimport {\n\tAttributionId,\n\tDetachedSequenceId,\n\tEditId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tStableNodeId,\n\tisDetachedSequenceId,\n} from './Identifiers.js';\nimport { initialTree } from './InitialTree.js';\nimport {\n\tCachingLogViewer,\n\tEditCacheEntry,\n\tEditStatusCallback,\n\tLogViewer,\n\tSequencedEditResult,\n\tSequencedEditResultCallback,\n} from './LogViewer.js';\nimport { NodeIdContext, NodeIdNormalizer, getNodeIdContext } from './NodeIdUtilities.js';\nimport { ReconciliationPath } from './ReconciliationPath.js';\nimport { RevisionView } from './RevisionView.js';\nimport { SharedTreeEncoder_0_0_2, SharedTreeEncoder_0_1_1 } from './SharedTreeEncoder.js';\nimport { MutableStringInterner } from './StringInterner.js';\nimport { SummaryContents, serialize } from './Summary.js';\nimport { deserialize, getSummaryStatistics } from './SummaryBackCompatibility.js';\nimport { TransactionInternal } from './TransactionInternal.js';\nimport { nilUuid } from './UuidUtilities.js';\nimport { IdCompressor, createSessionId } from './id-compressor/index.js';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tEditLogSummary,\n\tEditStatus,\n\tInternalizedChange,\n\tSharedTreeEditOp,\n\tSharedTreeEditOp_0_0_2,\n\tSharedTreeOp,\n\tSharedTreeOpType,\n\tSharedTreeOp_0_0_2,\n\tSharedTreeSummary,\n\tSharedTreeSummaryBase,\n\tSharedTreeSummary_0_0_2,\n\tTreeNode,\n\tTreeNodeSequence,\n\tWriteFormat,\n\tghostSessionId,\n\treservedIdCount,\n} from './persisted-types/index.js';\nimport { SharedTreeAttributes, SharedTreeFactoryType } from './publicContracts.js';\n\n/**\n * The write format and associated options used to construct a `SharedTree`\n * @alpha\n */\nexport type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];\n\n/**\n * The type of shared tree options for a given write format\n * @alpha\n */\nexport type SharedTreeOptions<\n\tWF extends WriteFormat,\n\tHistoryCompatibility extends 'Forwards' | 'None' = 'Forwards',\n> = SharedTreeBaseOptions &\n\tOmit<\n\t\tWF extends WriteFormat.v0_0_2\n\t\t\t? SharedTreeOptions_0_0_2\n\t\t\t: WF extends WriteFormat.v0_1_1\n\t\t\t\t? SharedTreeOptions_0_1_1\n\t\t\t\t: never,\n\t\tHistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never\n\t>;\n\n/**\n * Configuration options for SharedTree that are independent of write format versions.\n * @alpha\n */\nexport interface SharedTreeBaseOptions {\n\t/**\n\t * The target number of sequenced edits that the tree will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits in the collaboration window are not evicted.\n\t *\n\t * The size is set to infinity by default, meaning that all edits in session are kept within memory.\n\t */\n\tinMemoryHistorySize?: number;\n\t/**\n\t * The rate at which edits are evicted from memory. This is a factor of the inMemoryHistorySize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t */\n\teditEvictionFrequency?: number;\n}\n\n/**\n * Configuration options for a SharedTree with write format 0.0.2\n * @alpha\n */\nexport interface SharedTreeOptions_0_0_2 {\n\t/**\n\t * Determines if the history is included in summaries.\n\t *\n\t * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization\n\t * later once it has been enabled, and thus the history cannot be safely deleted.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t */\n\tsummarizeHistory?: boolean;\n}\n\n/**\n * Configuration options for a SharedTree with write format 0.1.1\n * @alpha\n */\nexport interface SharedTreeOptions_0_1_1 {\n\t/**\n\t * Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t *\n\t * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization\n\t * later once it has been enabled, and thus the history cannot be safely deleted.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t */\n\tsummarizeHistory?: false | { uploadEditChunks: boolean };\n\t/** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */\n\tattributionId?: AttributionId;\n}\n\n/**\n * Factory for SharedTree.\n * Includes history in the summary.\n * @alpha\n */\nexport class SharedTreeFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic static Type = SharedTreeFactoryType;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic static Attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tprivate readonly args: SharedTreeArgs;\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format\n\t * documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tconstructor(...args: SharedTreeArgs) {\n\t\tthis.args = args;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn SharedTreeFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn SharedTreeFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\t_channelAttributes: Readonly<IChannelAttributes>\n\t): Promise<SharedTree> {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tawait sharedTree.load(services);\n\t\treturn sharedTree;\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - data store runtime that owns the new SharedTree\n\t * @param id - optional name for the SharedTree\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tsharedTree.initializeLocal();\n\t\treturn sharedTree;\n\t}\n\n\tprivate createSharedTree(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst [writeFormat] = this.args;\n\t\tswitch (writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn new SharedTree(runtime, id, ...(this.args as SharedTreeArgs<WriteFormat.v0_0_2>));\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn new SharedTree(runtime, id, ...(this.args as SharedTreeArgs<WriteFormat.v0_1_1>));\n\t\t\tdefault:\n\t\t\t\tfail('Unknown write format');\n\t\t}\n\t}\n}\n\n/**\n * Filename where the snapshot is stored.\n */\nconst snapshotFileName = 'header';\n\n/**\n * Used for version comparison.\n */\nconst sortedWriteVersions = [WriteFormat.v0_0_2, WriteFormat.v0_1_1];\n\n/**\n * The arguments included when the EditCommitted SharedTreeEvent is emitted.\n * @alpha\n */\nexport interface EditCommittedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly editId: EditId;\n\t/** Whether or not this is a local edit. */\n\treadonly local: boolean;\n\t/** The tree the edit was committed on. Required for local edit events handled by SharedTreeUndoRedoHandler. */\n\treadonly tree: SharedTree;\n}\n\n/**\n * The arguments included when the {@link SharedTreeEvent.SequencedEditApplied} SharedTreeEvent is emitted.\n * @alpha\n */\nexport interface SequencedEditAppliedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly edit: Edit<ChangeInternal>;\n\t/** Whether or not this was a local edit. */\n\treadonly wasLocal: boolean;\n\t/** The tree the edit was applied to. */\n\treadonly tree: SharedTree;\n\t/** The telemetry logger associated with sequenced edit application. */\n\treadonly logger: ITelemetryLoggerExt;\n\t/** The reconciliation path for the edit. See {@link ReconciliationPath} for details. */\n\treadonly reconciliationPath: ReconciliationPath;\n\t/** The outcome of the sequenced edit being applied. */\n\treadonly outcome: EditApplicationOutcome;\n}\n\n/**\n * The outcome of an edit.\n * @alpha\n */\nexport type EditApplicationOutcome =\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly view: RevisionView;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Applied;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly failure: TransactionInternal.Failure;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t };\n\n/**\n * Events which may be emitted by `SharedTree`. See {@link SharedTreeEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ISharedTreeEvents extends ISharedObjectEvents {\n\t(event: 'committedEdit', listener: EditCommittedHandler);\n\t(event: 'appliedSequencedEdit', listener: SequencedEditAppliedHandler);\n}\n\n/**\n * Expected type for a handler of the `EditCommitted` event.\n * @alpha\n */\nexport type EditCommittedHandler = (args: EditCommittedEventArguments) => void;\n\n/**\n * Expected type for a handler of the {@link SharedTreeEvent.SequencedEditApplied} event.\n * @alpha\n */\nexport type SequencedEditAppliedHandler = (args: SequencedEditAppliedEventArguments) => void;\n\nconst sharedTreeTelemetryProperties: ITelemetryLoggerPropertyBags = {\n\tall: { isSharedTreeEvent: true },\n};\n\n/**\n * Contains information resulting from processing stashed shared tree ops\n * @alpha\n */\nexport interface StashedLocalOpMetadata {\n\t/** A modified version of the edit in an edit op that should be resubmitted rather than the original edit */\n\ttransformedEdit?: Edit<ChangeInternal>;\n}\n\n/** The SessionId of the temporary IdCompressor that records stashed ops */\nconst stashedSessionId = '8477b8d5-cf6c-4673-8345-8f076a8f9bc6' as SessionId;\n\n/**\n * A {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/README.md | distributed tree}.\n * @alpha\n */\nexport class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {\n\t/**\n\t * Create a new SharedTree. It will contain the default value (see initialTree).\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree {\n\t\treturn runtime.createChannel(id, SharedTreeFactory.Type) as SharedTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.\n\t * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree\n\t * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,\n\t * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version\n\t * written.\n\t * See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tpublic static getFactory(...args: SharedTreeArgs<WriteFormat.v0_0_2>): SharedTreeFactory;\n\n\tpublic static getFactory(...args: SharedTreeArgs<WriteFormat.v0_1_1>): SharedTreeFactory;\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store, using the latest write version and default options.\n\t */\n\tpublic static getFactory(): SharedTreeFactory;\n\n\tpublic static getFactory(...args: SharedTreeArgs | []): SharedTreeFactory {\n\t\tconst [formatArg, options] = args;\n\t\tconst writeFormat = formatArg ?? WriteFormat.v0_1_1;\n\t\t// \tOn 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.\n\t\t// Note that this means staged rollout changing this value should not be attempted.\n\t\t// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.\n\t\t// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t\treturn new SharedTreeFactory(writeFormat, options);\n\t}\n\n\t/**\n\t * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or\n\t * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those\n\t * with a write format of 0.0.2) use the nil UUID as their attribution ID.\n\t */\n\tpublic get attributionId(): AttributionId {\n\t\tswitch (this.writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn nilUuid;\n\t\t\tdefault: {\n\t\t\t\tconst { attributionId } = this.idCompressor;\n\t\t\t\tif (attributionId === ghostSessionId) {\n\t\t\t\t\treturn nilUuid;\n\t\t\t\t}\n\t\t\t\treturn attributionId;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * This is SharedTree's internal IdCompressor that predates the one in the runtime. If access\n\t * to the IdCompressor is needed, this is the one that should be used.\n\t */\n\tprivate idCompressor: IdCompressor;\n\n\tprivate readonly idNormalizer: NodeIdNormalizer<OpSpaceNodeId> & { tree: SharedTree } = {\n\t\ttree: this,\n\t\tget localSessionId() {\n\t\t\treturn this.tree.idCompressor.localSessionId;\n\t\t},\n\t\tnormalizeToOpSpace: (id) => this.idCompressor.normalizeToOpSpace(id) as OpSpaceNodeId,\n\t\tnormalizeToSessionSpace: (id, sessionId) => this.idCompressor.normalizeToSessionSpace(id, sessionId) as NodeId,\n\t};\n\t/** Temporarily created to apply stashed ops from a previous session */\n\tprivate stashedIdCompressor?: IdCompressor | null;\n\n\t// The initial tree's definition isn't included in any op by default but it should still be interned. Including it here ensures that.\n\tprivate interner: MutableStringInterner = new MutableStringInterner([initialTree.definition]);\n\n\t/**\n\t * The log of completed edits for this SharedTree.\n\t */\n\tprivate editLog: EditLog<ChangeInternal>;\n\tprivate readonly editLogSize?: number;\n\tprivate readonly editEvictionFrequency?: number;\n\n\t/**\n\t * As an implementation detail, SharedTree uses a log viewer that caches views of different revisions.\n\t * It is not exposed to avoid accidental correctness issues, but `logViewer` is exposed in order to give clients a way\n\t * to access the revision history.\n\t */\n\tprivate cachingLogViewer: CachingLogViewer;\n\n\t/**\n\t * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).\n\t */\n\tpublic get logViewer(): LogViewer {\n\t\treturn this.cachingLogViewer;\n\t}\n\n\t/**\n\t * logger for SharedTree events.\n\t */\n\tpublic readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sequencedEditAppliedLogger: ITelemetryLoggerExt;\n\n\tprivate readonly encoder_0_0_2: SharedTreeEncoder_0_0_2;\n\tprivate encoder_0_1_1: SharedTreeEncoder_0_1_1;\n\n\tprivate readonly processEditResult = (editResult: EditStatus, editId: EditId): void => {\n\t\t// TODO:#44859: Invalid results should be handled by the app\n\t\tthis.emit(SharedTree.eventFromEditResult(editResult), editId);\n\t};\n\n\tprivate readonly processSequencedEditResult = ({\n\t\tedit,\n\t\twasLocal,\n\t\tresult,\n\t\treconciliationPath,\n\t}: SequencedEditResult): void => {\n\t\tconst eventArguments: SequencedEditAppliedEventArguments = {\n\t\t\tedit,\n\t\t\twasLocal,\n\t\t\ttree: this,\n\t\t\tlogger: this.sequencedEditAppliedLogger,\n\t\t\treconciliationPath,\n\t\t\toutcome: result,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.SequencedEditApplied, eventArguments);\n\t};\n\n\tprivate summarizeHistory: boolean;\n\n\tprivate getHistoryPolicy(options: SharedTreeOptions<WriteFormat, 'Forwards' | 'None'>): {\n\t\tsummarizeHistory: boolean;\n\t} {\n\t\tconst noCompatOptions = options as SharedTreeOptions<WriteFormat, 'None'>;\n\t\treturn typeof noCompatOptions.summarizeHistory === 'object'\n\t\t\t? {\n\t\t\t\t\tsummarizeHistory: true,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tsummarizeHistory: noCompatOptions.summarizeHistory ?? false,\n\t\t\t\t};\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - The runtime the SharedTree will be associated with\n\t * @param id - Unique ID for the SharedTree\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format\n\t * documentation} for more information.\n\t * @param options - Configuration options for this tree\n\t */\n\tpublic constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);\n\n\tpublic constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);\n\n\tpublic constructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-readonly -- false positive; modified in changeWriteFormat()\n\t\tprivate writeFormat: WriteFormat,\n\t\toptions: SharedTreeOptions<typeof writeFormat> = {}\n\t) {\n\t\tsuper(id, runtime, SharedTreeFactory.Attributes, 'fluid_legacySharedTree_');\n\t\tconst historyPolicy = this.getHistoryPolicy(options);\n\t\tthis.summarizeHistory = historyPolicy.summarizeHistory;\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: 'SharedTree',\n\t\t\tproperties: sharedTreeTelemetryProperties,\n\t\t});\n\t\tthis.sequencedEditAppliedLogger = createChildLogger({\n\t\t\tlogger: this.logger,\n\t\t\tnamespace: 'SequencedEditApplied',\n\t\t\tproperties: sharedTreeTelemetryProperties,\n\t\t});\n\n\t\tconst attributionId = (options as SharedTreeOptions<WriteFormat.v0_1_1>).attributionId;\n\n\t\t/**\n\t\t * Because the IdCompressor emits so much telemetry, this function is used to sample\n\t\t * approximately 5% of all clients. Only the given percentage of sessions will emit telemetry.\n\t\t */\n\t\tconst idCompressorEventSampler: IEventSampler = (() => {\n\t\t\tconst isIdCompressorTelemetryEnabled = Math.random() < 0.05;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\treturn isIdCompressorTelemetryEnabled;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\t\tconst idCompressorLoger = createSampledLogger(this.logger, idCompressorEventSampler);\n\t\tthis.idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId, idCompressorLoger);\n\t\tthis.editLogSize = options.inMemoryHistorySize;\n\t\tthis.editEvictionFrequency = options.inMemoryHistorySize;\n\t\tconst { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary(\n\t\t\t{\n\t\t\t\teditChunks: [],\n\t\t\t\teditIds: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tthis.idCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tWriteFormat.v0_1_1\n\t\t);\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = cachingLogViewer;\n\t\tthis.encoder_0_0_2 = new SharedTreeEncoder_0_0_2(this.summarizeHistory);\n\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t}\n\n\t/**\n\t * The write format version currently used by this `SharedTree`. This is always initialized to the write format\n\t * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another\n\t * SharedTree with a higher write format, or when loading a summary with a higher write format).\n\t */\n\tpublic getWriteFormat(): WriteFormat {\n\t\treturn this.writeFormat;\n\t}\n\n\t/**\n\t * Computes the oldest client in the quorum, true by default if the container is detached and false by default if the client isn't connected.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate computeIsOldest(): boolean {\n\t\t// If the container is detached, we are the only ones that know about it and are the oldest by default.\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// If we're not connected we can't be the oldest connected client.\n\t\tif (!this.runtime.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(this.runtime.clientId !== undefined, 0x62d /* Client id should be set if connected. */);\n\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tconst selfSequencedClient = quorum.getMember(this.runtime.clientId);\n\t\t// When in readonly mode our clientId will not be present in the quorum.\n\t\tif (selfSequencedClient === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst members = quorum.getMembers();\n\t\tfor (const sequencedClient of members.values()) {\n\t\t\tif (sequencedClient.sequenceNumber < selfSequencedClient.sequenceNumber) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// No member of the quorum was older\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns the current view of the tree.\n\t */\n\tpublic get currentView(): RevisionView {\n\t\treturn this.logViewer.getRevisionViewInMemory(Number.POSITIVE_INFINITY);\n\t}\n\n\t/**\n\t * Generates a node identifier.\n\t * The returned IDs may be used as the identifier of a node in the SharedTree.\n\t * `NodeId`s are *always* unique and stable within the scope of the tree and session that generated them. They are *not* unique within\n\t * a Fluid container, and *cannot* be compared across instances of a SharedTree. They are *not* stable across sessions/lifetimes of a\n\t * SharedTree, and *cannot* be persisted (e.g. stored in payloads, uploaded in blobs, etc.). If stable persistence is needed,\n\t * NodeIdConverter.convertToStableNodeId may be used to return a corresponding UUID that is globally unique and stable.\n\t * @param override - if supplied, calls to `convertToStableNodeId` using the returned node ID will return the override instead of\n\t * the UUID. Calls to `generateNodeId` with the same override always return the same ID. Performance note: passing an override string\n\t * incurs a storage cost that is significantly higher that a node ID without one, and should be avoided if possible.\n\t */\n\tpublic generateNodeId(override?: string): NodeId {\n\t\treturn this.idCompressor.generateCompressedId(override) as NodeId;\n\t}\n\n\t/**\n\t * Given a NodeId, returns the corresponding stable ID or throws if the supplied node ID was not generated with this tree (`NodeId`s\n\t * may not be used across SharedTree instances, see `generateNodeId` for more).\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The result is safe to persist and re-use across `SharedTree` instances, unlike `NodeId`.\n\t */\n\tpublic convertToStableNodeId(id: NodeId): StableNodeId {\n\t\treturn (this.idCompressor.tryDecompress(id) as StableNodeId) ?? fail('Node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a NodeId, attempt to return the corresponding stable ID.\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The returned stable ID is undefined if `id` was never created with this SharedTree. If a stable ID is returned, this does not imply\n\t * that there is a node with `id` in the current revision of the tree, only that `id` was at some point generated by some instance of\n\t * this tree.\n\t */\n\tpublic tryConvertToStableNodeId(id: NodeId): StableNodeId | undefined {\n\t\treturn this.idCompressor.tryDecompress(id) as StableNodeId | undefined;\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or throws if the supplied stable ID was never generated with this tree, either\n\t * as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t */\n\tpublic convertToNodeId(id: StableNodeId): NodeId {\n\t\treturn (this.idCompressor.tryRecompress(id) as NodeId) ?? fail('Stable node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or return undefined if the supplied stable ID was never generated with this tree,\n\t * either as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t */\n\tpublic tryConvertToNodeId(id: StableNodeId): NodeId | undefined {\n\t\treturn this.idCompressor.tryRecompress(id) as NodeId | undefined;\n\t}\n\n\t/**\n\t * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients\n\t * with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default\n\t * `attributionId` of the tree.\n\t */\n\tpublic attributeNodeId(id: NodeId): AttributionId {\n\t\tswitch (this.writeFormat) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn nilUuid;\n\t\t\tdefault: {\n\t\t\t\tconst attributionId = this.idCompressor.attributeId(id);\n\t\t\t\tif (attributionId === ghostSessionId) {\n\t\t\t\t\treturn nilUuid;\n\t\t\t\t}\n\t\t\t\treturn attributionId;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @returns the edit history of the tree.\n\t */\n\tpublic get edits(): OrderedEditSet<InternalizedChange> {\n\t\treturn this.editLog as unknown as OrderedEditSet<InternalizedChange>;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(snapshotFileName, this.saveSerializedSummary({ serializer }));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic override getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\t// If local changes exist, emulate the sequencing of those changes.\n\t\t// Doing so is necessary so edits created during DataObject.initializingFirstTime are included.\n\t\t// Doing so is safe because it is guaranteed that the DDS has not yet been attached. This is because summary creation is only\n\t\t// ever invoked on a DataObject containing local changes when it is attached for the first time. In post-attach flows, an extra\n\t\t// instance of the DataObject is created for generating summaries and will never have local edits.\n\t\tif (this.editLog.numberOfLocalEdits > 0) {\n\t\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\t\t// Since we're the first client to attach, we can safely finalize ourselves since we're the only ones who have made IDs.\n\t\t\t\tthis.idCompressor.finalizeCreationRange(this.idCompressor.takeNextCreationRange());\n\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.editLog.sequenceLocalEdits();\n\t\t}\n\t\treturn super.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a serialized summary. This is used for testing.\n\t *\n\t * @param summarizer - Optional summarizer to use. If not passed in, SharedTree's summarizer is used.\n\t */\n\tpublic saveSerializedSummary(options?: { serializer?: IFluidSerializer }): string {\n\t\tconst { serializer } = options ?? {};\n\t\treturn serialize(this.saveSummary(), serializer ?? this.serializer, this.handle);\n\t}\n\n\t/**\n\t * Initialize shared tree with a serialized summary. This is used for testing.\n\t * @returns Statistics about the loaded summary.\n\t */\n\tpublic loadSerializedSummary(blobData: string): ITelemetryBaseProperties {\n\t\tconst summary = deserialize(blobData, this.serializer);\n\t\tthis.loadSummary(summary);\n\t\treturn getSummaryStatistics(summary);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a deserialized summary.\n\t */\n\tpublic saveSummary(): SharedTreeSummaryBase {\n\t\tassert(this.editLog.numberOfLocalEdits === 0, 0x62f /* generateSummary must not be called with local edits */);\n\t\treturn this.generateSummary();\n\t}\n\n\t/**\n\t * Generates a SharedTree summary for the current state of the tree.\n\t * Will never be called when local edits are present.\n\t */\n\tprivate generateSummary(): SharedTreeSummaryBase {\n\t\ttry {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\treturn this.encoder_0_0_2.encodeSummary(this.editLog, this.currentView, this);\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\treturn this.encoder_0_1_1.encodeSummary(\n\t\t\t\t\t\tthis.editLog,\n\t\t\t\t\t\tthis.currentView,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\tthis.interner,\n\t\t\t\t\t\tthis.idCompressor.serialize(false)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger?.sendErrorEvent({\n\t\t\t\teventName: 'UnsupportedSummaryWriteFormat',\n\t\t\t\tformatVersion: this.writeFormat,\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Initialize shared tree with a deserialized summary.\n\t */\n\tpublic loadSummary(summary: SharedTreeSummaryBase): void {\n\t\tconst { version: loadedSummaryVersion } = summary;\n\n\t\tif (this.deltaManager.readOnlyInfo.readonly !== true && isUpdateRequired(loadedSummaryVersion, this.writeFormat)) {\n\t\t\tthis.submitOp({ type: SharedTreeOpType.Update, version: this.writeFormat });\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'RequestVersionUpdate',\n\t\t\t\tversionFrom: loadedSummaryVersion,\n\t\t\t\tversionTo: this.writeFormat,\n\t\t\t});\n\t\t}\n\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, this.writeFormat) !== 0) {\n\t\t\t// Write whatever format the loaded summary uses (this is the current agreed-upon format: it may be updated by an update op)\n\t\t\tthis.changeWriteFormat(loadedSummaryVersion);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.idCompressor.getAllIdsFromLocalSession().next().done === true,\n\t\t\t0x630 /* Summary load should not be executed after local state is created. */\n\t\t);\n\n\t\tlet convertedSummary: SummaryContents;\n\t\tswitch (loadedSummaryVersion) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\tconvertedSummary = this.encoder_0_0_2.decodeSummary(summary as SharedTreeSummary_0_0_2, this.attributionId);\n\t\t\t\tbreak;\n\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\tconst typedSummary = summary as SharedTreeSummary;\n\t\t\t\t// See comment in factory constructor--ensure we write a consistent type of summary as how the document began.\n\t\t\t\tconst loadedSummaryIncludesHistory = typedSummary.currentTree !== undefined;\n\t\t\t\tif (loadedSummaryIncludesHistory !== this.summarizeHistory) {\n\t\t\t\t\tthis.summarizeHistory = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t\t\t\t}\n\n\t\t\t\tconvertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary, this.attributionId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown version');\n\t\t}\n\n\t\tconst { editHistory, currentTree, idCompressor, interner } = convertedSummary;\n\t\tthis.interner = interner;\n\t\tthis.interner.getOrCreateInternedId(initialTree.definition);\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, WriteFormat.v0_1_1) < 0) {\n\t\t\tconst { editIds, editChunks } = editHistory;\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'SummaryConversion',\n\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\thistorySize: editIds.length,\n\t\t\t\ttotalNumberOfChunks: editChunks.length,\n\t\t\t});\n\t\t}\n\n\t\tthis.initializeNewEditLogFromSummary(\n\t\t\teditHistory,\n\t\t\tcurrentTree,\n\t\t\tidCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tsummary.version\n\t\t);\n\t}\n\n\tprivate static eventFromEditResult(editStatus: EditStatus): SharedTreeDiagnosticEvent {\n\t\tswitch (editStatus) {\n\t\t\tcase EditStatus.Applied:\n\t\t\t\treturn SharedTreeDiagnosticEvent.AppliedEdit;\n\t\t\tcase EditStatus.Invalid:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedInvalidEdit;\n\t\t\tdefault:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedMalformedEdit;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes a new `EditLog` and `CachingLogViewer` on this `SharedTree`, replacing and disposing of any previously existing ones.\n\t * @returns the initialized values (this is mostly to keep the constructor happy)\n\t */\n\tprivate initializeNewEditLogFromSummary(\n\t\teditHistory: EditLogSummary<ChangeInternal, EditHandle<ChangeInternal>>,\n\t\tcurrentTree: ChangeNode | undefined,\n\t\tidCompressor: IdCompressor,\n\t\teditStatusCallback: EditStatusCallback,\n\t\tsequencedEditResultCallback: SequencedEditResultCallback,\n\t\tversion: WriteFormat\n\t): { editLog: EditLog<ChangeInternal>; cachingLogViewer: CachingLogViewer } {\n\t\tthis.idCompressor = idCompressor;\n\t\t// Dispose the current log viewer if it exists. This ensures that re-used EditAddedHandlers below don't retain references to old\n\t\t// log viewers.\n\t\tthis.cachingLogViewer?.detachFromEditLog();\n\n\t\t// Use previously registered EditAddedHandlers if there is an existing EditLog.\n\t\tconst editLog = new EditLog(\n\t\t\teditHistory,\n\t\t\tthis.logger,\n\t\t\tthis.editLog?.editAddedHandlers,\n\t\t\tthis.editLogSize,\n\t\t\tthis.editEvictionFrequency\n\t\t);\n\n\t\teditLog.on(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk, () => {\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);\n\t\t});\n\n\t\tlet initialRevision: [number, EditCacheEntry] | undefined;\n\t\tif (currentTree !== undefined) {\n\t\t\tconst currentView = RevisionView.fromTree(currentTree);\n\t\t\tinitialRevision = [editLog.length, { view: currentView }];\n\t\t}\n\n\t\tconst logViewer = new CachingLogViewer(\n\t\t\teditLog,\n\t\t\tRevisionView.fromTree(initialTree, this),\n\t\t\tinitialRevision,\n\t\t\teditStatusCallback,\n\t\t\tsequencedEditResultCallback,\n\t\t\t0\n\t\t);\n\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = logViewer;\n\t\treturn { editLog, cachingLogViewer: logViewer };\n\t}\n\n\t/**\n\t * Compares this shared tree to another for equality. Should only be used for internal correctness testing.\n\t *\n\t * Equality means that the histories as captured by the EditLogs are equivalent.\n\t *\n\t * Equality does not include:\n\t *\n\t * - if an edit is open\n\t *\n\t * - the shared tree's id\n\t *\n\t * - local vs sequenced status of edits\n\t *\n\t * - registered event listeners\n\t *\n\t * - state of caches\n\t */\n\tpublic equals(sharedTree: SharedTree): boolean {\n\t\tif (!areRevisionViewsSemanticallyEqual(this.currentView, this, sharedTree.currentView, sharedTree)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.editLog.equals(sharedTree.editLog);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst summaryLoadPerformanceEvent = PerformanceEvent.start(this.logger, {\n\t\t\teventName: 'SummaryLoad',\n\t\t});\n\n\t\ttry {\n\t\t\tconst newBlob = await storage.readBlob(snapshotFileName);\n\t\t\tconst blobData = bufferToString(newBlob, 'utf8');\n\n\t\t\tconst stats = this.loadSerializedSummary(blobData);\n\n\t\t\tsummaryLoadPerformanceEvent.end(stats);\n\t\t} catch (error) {\n\t\t\tsummaryLoadPerformanceEvent.cancel({ eventName: 'SummaryLoadFailure' }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent.contents);\n\t\t}\n\t}\n\n\tprivate processMessage(messageEnvelope: ISequencedMessageEnvelope, contents: unknown): void {\n\t\tconst typedContents = contents as SharedTreeOp_0_0_2 | SharedTreeOp;\n\t\tthis.cachingLogViewer.setMinimumSequenceNumber(messageEnvelope.minimumSequenceNumber);\n\t\tconst op = typedContents;\n\t\tif (op.version === undefined) {\n\t\t\t// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.\n\t\t\t(op as { version: WriteFormat | undefined }).version = WriteFormat.v0_0_2;\n\t\t}\n\t\tconst { type, version } = op;\n\t\tconst sameVersion = version === this.writeFormat;\n\n\t\t// Edit and handle ops should only be processed if they're the same version as the tree write version.\n\t\t// Update ops should only be processed if they're not the same version.\n\t\tif (sameVersion) {\n\t\t\tif (type === SharedTreeOpType.Handle) {\n\t\t\t\t// Edit virtualization is no longer supported, log the event and ignore the op.\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: 'UnexpectedHistoryChunk' });\n\t\t\t} else if (type === SharedTreeOpType.Edit) {\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.idCompressor.finalizeCreationRange(op.idRange);\n\t\t\t\t}\n\t\t\t\tconst edit = this.parseSequencedEdit(op);\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t\tthis.processSequencedEdit(edit, messageEnvelope);\n\t\t\t}\n\t\t} else if (type === SharedTreeOpType.Update) {\n\t\t\tthis.processVersionUpdate(op.version);\n\t\t} else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {\n\t\t\t// An op version newer than our current version should not be received. If this happens, either an\n\t\t\t// incorrect op version has been written or an update op was skipped.\n\t\t\tconst error = 'Newer op version received by a client that has yet to be updated.';\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'UnexpectedNewerOpVersion',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t\tfail(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}\n\t */\n\tprotected registerCore(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * Parses a sequenced edit. This is only invoked for ops with version matching the current `writeFormat`.\n\t */\n\tprivate parseSequencedEdit(op: SharedTreeEditOp | SharedTreeEditOp_0_0_2): Edit<ChangeInternal> {\n\t\t// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)\n\t\tswitch (op.version) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn this.encoder_0_0_2.decodeEditOp(op, (x) => x, this);\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn this.encoder_0_1_1.decodeEditOp(op, (x) => x, this.idNormalizer, this.interner);\n\t\t\tdefault:\n\t\t\t\tfail('Unknown op version');\n\t\t}\n\t}\n\n\tprivate processSequencedEdit(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope): void {\n\t\tconst { id: editId } = edit;\n\t\tconst wasLocalEdit = this.editLog.isLocalEdit(editId);\n\n\t\t// If the id of the supplied edit matches a non-local edit already present in the log, this would normally be indicative of an error.\n\t\t// However, the @fluidframework packages prior to 0.37.x have a bug which can cause data corruption by sequencing duplicate edits--\n\t\t// see discussion on the following github issue: https://github.com/microsoft/FluidFramework/issues/4399\n\t\t// To work around this issue, we currently tolerate duplicate ops in loaded documents.\n\t\t// This could be strengthened in the future to only apply to documents which may have been impacted.\n\t\tconst shouldIgnoreEdit = this.editLog.tryGetIndexOfId(editId) !== undefined && !wasLocalEdit;\n\t\tif (shouldIgnoreEdit) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (wasLocalEdit) {\n\t\t\tthis.editLog.addSequencedEdit(edit, messageEnvelope);\n\t\t} else {\n\t\t\tthis.applyEditLocally(edit, messageEnvelope);\n\t\t}\n\t}\n\n\t/**\n\t * Updates SharedTree to the provided version if the version is a valid write version newer than the current version.\n\t * @param version - The version to update to.\n\t */\n\tprivate processVersionUpdate(version: WriteFormat): void {\n\t\tif (isUpdateRequired(this.writeFormat, version)) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: 'VersionUpdate', version },\n\t\t\t\t() => {\n\t\t\t\t\tif (compareSummaryFormatVersions(version, WriteFormat.v0_1_1) >= 0) {\n\t\t\t\t\t\tthis.upgradeFrom_0_0_2_to_0_1_1();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Updating to version ${version} is not supported.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeWriteFormat(version);\n\n\t\t\t\t\t// The edit log may contain some local edits submitted after the version update op was submitted but\n\t\t\t\t\t// before we receive the message it has been sequenced. Since these edits must be sequenced after the version\n\t\t\t\t\t// update op, they will be discarded. These edits are then re-submitted using the new format.\n\t\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\t\tthis.submitEditOp(edit);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tend: true,\n\t\t\t\t\tcancel: 'error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate upgradeFrom_0_0_2_to_0_1_1(): void {\n\t\t// Reset the string interner, re-populate only with information that there is consensus on\n\t\tthis.interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst oldIdCompressor = this.idCompressor;\n\t\t// Create the IdCompressor that will be used after the upgrade\n\t\tconst newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount, this.attributionId, this.logger);\n\t\tconst newContext = getNodeIdContext(newIdCompressor);\n\t\t// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.\n\t\t// This will allow the client to continue to use local IDs that were allocated pre-upgrade\n\t\tfor (const localId of oldIdCompressor.getAllIdsFromLocalSession()) {\n\t\t\tnewIdCompressor.generateCompressedId(oldIdCompressor.decompress(localId));\n\t\t}\n\n\t\tconst unifyHistoricalIds = (context: NodeIdContext): void => {\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tconst edit = this.editLog.tryGetEditAtIndex(i) ?? fail('edit not found');\n\t\t\t\tconvertEditIds(edit, (id) => context.generateNodeId(this.convertToStableNodeId(id)));\n\t\t\t}\n\t\t};\n\t\t// Construct a temporary \"ghost\" compressor which is used to generate final IDs that will be consistent across all upgrading clients\n\t\tconst ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount);\n\t\tconst ghostContext = getNodeIdContext(ghostIdCompressor);\n\t\tif (this.summarizeHistory) {\n\t\t\t// All clients have the full history, and can therefore all \"generate\" the same final IDs for every ID in the history\n\t\t\t// via the ghost compressor.\n\t\t\tunifyHistoricalIds(ghostContext);\n\t\t\t// The same logic applies to string interning, so intern all the strings in the history (superset of those in the current view)\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tthis.internStringsFromEdit(this.editLog.tryGetEditAtIndex(i) ?? fail('edit not found'));\n\t\t\t}\n\t\t} else {\n\t\t\t// Clients do not have the full history, but all share the same current view (sequenced). They can all finalize the same final\n\t\t\t// IDs for every ID in the view via the ghost compressor.\n\t\t\t// The same logic applies for the string interner.\n\t\t\tfor (const node of this.logViewer.getRevisionViewInMemory(this.editLog.numberOfSequencedEdits)) {\n\t\t\t\tghostContext.generateNodeId(this.convertToStableNodeId(node.identifier));\n\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\tfor (const label of [...node.traits.keys()].sort()) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(label);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Every node in this client's history can simply be generated in the new compressor as well, preserving the UUID\n\t\t\tunifyHistoricalIds(newContext);\n\t\t}\n\t\t// Finalize any IDs in the ghost compressor into the actual compressor. This simulates all clients reaching a consensus on those IDs\n\t\tnewIdCompressor.finalizeCreationRange(ghostIdCompressor.takeNextCreationRange());\n\t\tthis.idCompressor = newIdCompressor;\n\t}\n\n\t/**\n\t * Applies a set of changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * This method does not allow for snapshot isolation, as the changes are always applied to the most recent revision.\n\t * If it is desireable to read from and apply changes to a fixed view that does not change when remote changes arrive, `Checkout`\n\t * should be used instead.\n\t */\n\tpublic applyEdit(...changes: readonly Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(changes: readonly Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(...changesOrArray: RestOrArray<Change>): Edit<InternalizedChange> {\n\t\tconst changes = unwrapRestOrArray(changesOrArray);\n\t\tconst id = newEditId();\n\t\tconst internalEdit: Edit<ChangeInternal> = {\n\t\t\tid,\n\t\t\tchanges: changes.map((c) => this.internalizeChange(c)),\n\t\t};\n\t\tthis.submitEditOp(internalEdit);\n\t\tthis.applyEditLocally(internalEdit, undefined);\n\t\treturn internalEdit as unknown as Edit<InternalizedChange>;\n\t}\n\n\t/**\n\t * Merges `edits` from `other` into this SharedTree.\n\t * @param other - Tree containing the edits that should be applied to this one.\n\t * @param edits - Iterable of edits from `other` to apply.\n\t * @param stableIdRemapper - Optional remapper to translate stable identities from `other` into stable identities on this tree.\n\t * Any references that `other` contains to a stable id `foo` will be replaced with references to the id `stableIdRemapper(foo)`.\n\t *\n\t * Payloads on the edits are left intact.\n\t * @returns a list containing `EditId`s for all applied edits.\n\t */\n\tpublic mergeEditsFrom(\n\t\tother: SharedTree,\n\t\tedits: Iterable<Edit<InternalizedChange>>,\n\t\tstableIdRemapper?: (id: StableNodeId) => StableNodeId\n\t): EditId[] {\n\t\tconst idConverter = (id: NodeId): NodeId => {\n\t\t\tconst stableId = other.convertToStableNodeId(id);\n\t\t\tconst convertedStableId = stableIdRemapper?.(stableId) ?? stableId;\n\t\t\treturn this.generateNodeId(convertedStableId);\n\t\t};\n\n\t\treturn Array.from(\n\t\t\tedits as unknown as Iterable<Edit<ChangeInternal>>,\n\t\t\t(edit) => this.applyEditInternal(convertEditIds(edit, (id) => idConverter(id))).id\n\t\t);\n\t}\n\n\t/**\n\t * Applies a set of internal changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * External users should use one of the more specialized functions, like `applyEdit` which handles constructing the actual `Edit`\n\t * and uses public Change types.\n\t * This is exposed for internal use only.\n\t */\n\tpublic applyEditInternal(editOrChanges: Edit<ChangeInternal> | readonly ChangeInternal[]): Edit<ChangeInternal> {\n\t\tlet edit: Edit<ChangeInternal>;\n\t\tif (Array.isArray(editOrChanges)) {\n\t\t\tconst id = newEditId();\n\t\t\tedit = { id, changes: editOrChanges };\n\t\t} else {\n\t\t\tedit = editOrChanges as Edit<ChangeInternal>;\n\t\t}\n\t\tthis.submitEditOp(edit);\n\t\tthis.applyEditLocally(edit, undefined);\n\t\treturn edit;\n\t}\n\n\t/**\n\t * Converts a public Change type to an internal representation.\n\t * This is exposed for internal use only.\n\t */\n\tpublic internalizeChange(change: Change): ChangeInternal {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeType.Insert:\n\t\t\t\treturn {\n\t\t\t\t\tsource: change.source as DetachedSequenceId,\n\t\t\t\t\tdestination: deepCloneStablePlace(change.destination),\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t};\n\t\t\tcase ChangeType.Detach: {\n\t\t\t\tconst detach: DetachInternal = {\n\t\t\t\t\tsource: deepCloneStableRange(change.source),\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeType.Build: {\n\t\t\t\tif (isTreeNodeSequence(change.source)) {\n\t\t\t\t\tconst source = change.source.map((buildNode) =>\n\t\t\t\t\t\tconvertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\t\tbuildNode,\n\t\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t\t)\n\t\t\t\t\t) as TreeNodeSequence<TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId>;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst source = convertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\tchange.source,\n\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t) as TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource: [source],\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase ChangeType.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\tnodeToModify: change.nodeToModify,\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t};\n\t\t\tcase ChangeType.Constraint: {\n\t\t\t\tconst constraint: ConstraintInternal = {\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: change.toConstrain,\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'parentNode');\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('unexpected change type');\n\t\t}\n\t}\n\n\tprivate applyEditLocally(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope | undefined): void {\n\t\tconst isSequenced = messageEnvelope !== undefined;\n\t\tif (isSequenced) {\n\t\t\tthis.editLog.addSequencedEdit(edit, messageEnvelope);\n\t\t} else {\n\t\t\tthis.editLog.addLocalEdit(edit);\n\t\t}\n\n\t\tconst eventArguments: EditCommittedEventArguments = {\n\t\t\teditId: edit.id,\n\t\t\tlocal: !isSequenced,\n\t\t\ttree: this,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.EditCommitted, eventArguments);\n\t}\n\n\t/**\n\t * Reverts a previous edit by applying a new edit containing the inverse of the original edit's changes.\n\t * @param editId - the edit to revert\n\t * @returns the id of the new edit, or undefined if the original edit could not be inverted given the current tree state.\n\t */\n\tpublic revert(editId: EditId): EditId | undefined {\n\t\tconst index = this.edits.getIndexOfId(editId);\n\t\tconst edit = this.edits.tryGetEditAtIndex(index) ?? fail('edit not found');\n\t\tconst before = this.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.revertChanges(edit.changes, before);\n\t\tif (changes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.applyEditInternal(changes).id;\n\t}\n\n\t/**\n\t * Revert the given changes\n\t * @param changes - the changes to revert\n\t * @param before - the revision view before the changes were originally applied\n\t * @returns the inverse of `changes` or undefined if the changes could not be inverted for the given tree state.\n\t */\n\tpublic revertChanges(changes: readonly InternalizedChange[], before: RevisionView): ChangeInternal[] | undefined {\n\t\treturn revert(changes as unknown as readonly ChangeInternal[], before, this.logger, this.emit.bind(this));\n\t}\n\n\t/**\n\t * Submits an edit by the local client to the runtime.\n\t */\n\tprivate submitEditOp(edit: Edit<ChangeInternal>): void {\n\t\t// Only submit ops if attached, since op submission can have stateful side effects (e.g. changing the IdCompressor)\n\t\t// Ops will be submitted again when attached (see loadSummary())\n\t\tif (this.isAttached()) {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\tthis.submitOp(this.encoder_0_0_2.encodeEditOp(edit, (x) => x, this));\n\t\t\t\t\tbreak;\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\tthis.submitOp(\n\t\t\t\t\t\tthis.encoder_0_1_1.encodeEditOp(\n\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t(x) => x,\n\t\t\t\t\t\t\tthis.idCompressor.takeNextCreationRange(),\n\t\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t}\n\t}\n\n\t/** A type-safe `submitLocalMessage` wrapper to enforce op format */\n\tprivate submitOp(content: SharedTreeOp | SharedTreeOp_0_0_2, localOpMetadata: unknown = undefined): void {\n\t\tassert(\n\t\t\tcompareSummaryFormatVersions(content.version, this.writeFormat) === 0,\n\t\t\t0x631 /* Attempted to submit op of wrong version */\n\t\t);\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\tpublic getRuntime(): IFluidDataStoreRuntime {\n\t\treturn this.runtime;\n\t}\n\n\t/**\n\t * \"Pending local state\" refers to ops submitted to the runtime that have not yet been acked.\n\t * When closing a container, hosts have the option to stash this pending local state somewhere to be reapplied\n\t * later (to avoid data loss).\n\t * If a host then loads a container using that stashed state, this function is called for each stashed op, and is expected to:\n\t * Update this DDS to reflect that state locally, and submit the op to do that.\n\t *\n\t * @param content - op to apply locally.\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\t// In some scenarios, edit ops need to have their edits transformed before application and resubmission. The transformation\n\t\t// occurs in this method, and the result is passed to `resubmitCore` via the return value of this function.\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit: {\n\t\t\t\tlet stashedEdit: Edit<ChangeInternal> | undefined;\n\t\t\t\tswitch (this.writeFormat) {\n\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\tstashedEdit = this.parseSequencedEdit(sharedTreeOp);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\tfail('Received stashed op 0.1.1 before upgrade');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\t// Use the IDs from the stashed ops as overrides for the equivalent new ops\n\t\t\t\t\t\t\t\tstashedEdit = convertEditIds(sharedTreeOp.edit, (id) => this.generateNodeId(id));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\t\t\t\t\tassert(this.stashedIdCompressor !== null, 0x632 /* Stashed op applied after expected window */);\n\t\t\t\t\t\t\t\tif (this.stashedIdCompressor === undefined) {\n\t\t\t\t\t\t\t\t\t// Use a temporary compressor that will help translate the stashed ops\n\t\t\t\t\t\t\t\t\tthis.stashedIdCompressor = IdCompressor.deserialize(\n\t\t\t\t\t\t\t\t\t\tthis.idCompressor.serialize(false),\n\t\t\t\t\t\t\t\t\t\tstashedSessionId,\n\t\t\t\t\t\t\t\t\t\tsharedTreeOp.idRange.attributionId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t// Once all stashed ops have been applied, clear the temporary state\n\t\t\t\t\t\t\t\t\tthis.runtime.on('connected', () => {\n\t\t\t\t\t\t\t\t\t\tthis.stashedIdCompressor = null;\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Pretend (from the perspective of the temporary compressor) that the stashed ops have been sequenced\n\t\t\t\t\t\t\t\tthis.stashedIdCompressor.finalizeCreationRange(sharedTreeOp.idRange);\n\t\t\t\t\t\t\t\tconst stashedIdContext = getNodeIdContext(this.stashedIdCompressor);\n\t\t\t\t\t\t\t\t// Use a normalizer to translate all node IDs in the stashed ops\n\t\t\t\t\t\t\t\tconst normalizer: NodeIdNormalizer<OpSpaceNodeId> = {\n\t\t\t\t\t\t\t\t\tlocalSessionId: this.idCompressor.localSessionId,\n\t\t\t\t\t\t\t\t\tnormalizeToSessionSpace: (id, _sessionId) => {\n\t\t\t\t\t\t\t\t\t\t// Interpret the IDs from the stashed ops as stable IDs, and use those as overrides for the equivalent new ops\n\t\t\t\t\t\t\t\t\t\tconst sessionSpaceId = stashedIdContext.normalizeToSessionSpace(id, sharedTreeOp.idRange.sessionId);\n\t\t\t\t\t\t\t\t\t\treturn this.generateNodeId(stashedIdContext.convertToStableNodeId(sessionSpaceId));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnormalizeToOpSpace: (id) => this.idNormalizer.normalizeToOpSpace(id),\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tstashedEdit = this.encoder_0_1_1.decodeEditOp(sharedTreeOp, (x) => x, normalizer, this.interner);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t}\n\t\t\t\tthis.applyEditInternal(stashedEdit);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle and update ops are only acknowledged by the client that generated them upon sequencing--no local changes necessary.\n\t\t\tcase SharedTreeOpType.Handle:\n\t\t\tcase SharedTreeOpType.Update:\n\t\t\tcase SharedTreeOpType.NoOp:\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tfail('Unrecognized op');\n\t\t}\n\t}\n\n\tprotected reSubmitCore(op: unknown, localOpMetadata?: StashedLocalOpMetadata): void {\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit:\n\t\t\t\tif (compareSummaryFormatVersions(sharedTreeOp.version, this.writeFormat) > 0) {\n\t\t\t\t\tfail('Attempted to resubmit op of version newer than current version');\n\t\t\t\t} else if (localOpMetadata?.transformedEdit !== undefined) {\n\t\t\t\t\t// Optimization: stashed 0.0.2 ops require no transformation in 0.0.2; don't re-encode\n\t\t\t\t\tif (this.writeFormat !== WriteFormat.v0_0_2 || sharedTreeOp.version !== WriteFormat.v0_0_2) {\n\t\t\t\t\t\tthis.submitEditOp(localOpMetadata.transformedEdit);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tsuper.reSubmitCore(sharedTreeOp, localOpMetadata);\n\t}\n\n\tprivate changeWriteFormat(newFormat: WriteFormat): void {\n\t\tthis.writeFormat = newFormat;\n\t\tthis.emit(SharedTreeDiagnosticEvent.WriteVersionChanged, newFormat);\n\t}\n\n\t/**\n\t * Interns all Definitions and TraitLabel_s referenced by the provided edit.\n\t *\n\t * Clients must have consensus on the interned values to guarantee the interned ID is valid.\n\t */\n\tprivate internStringsFromEdit(edit: Edit<ChangeInternal>): void {\n\t\tfor (const change of edit.changes) {\n\t\t\tif (change.type === ChangeTypeInternal.Build) {\n\t\t\t\tfor (const root of change.source) {\n\t\t\t\t\twalkTree<TreeNode<BuildNodeInternal, NodeId>, DetachedSequenceId>(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\t(node) => {\n\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\t\t\t\tfor (const trait of Object.keys(node.traits)) {\n\t\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(trait);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDetachedSequenceId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (change.type === ChangeTypeInternal.Insert) {\n\t\t\t\tconst { referenceTrait } = change.destination;\n\t\t\t\tif (referenceTrait !== undefined) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(referenceTrait.label);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @returns 1 if versionA is newer, -1 if versionB is newer, and 0 if the versions are the same.\n * @throws if either version isn't a valid WriteFormat version.\n */\nfunction compareSummaryFormatVersions(versionA: string, versionB: string): number {\n\tconst versionAIndex = sortedWriteVersions.indexOf(versionA as WriteFormat);\n\tconst versionBIndex = sortedWriteVersions.indexOf(versionB as WriteFormat);\n\n\tif (versionAIndex === -1 || versionBIndex === -1) {\n\t\tfail('Summary version being compared cannot be read.');\n\t}\n\n\tif (versionAIndex < versionBIndex) {\n\t\treturn -1;\n\t} else if (versionAIndex > versionBIndex) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n/**\n * Checks if the summary version needs to be updated.\n * @returns true if the old version is older than the new version.\n * @throws if the new version isn't a supported WriteFormat version.\n */\nfunction isUpdateRequired(oldVersion: string, newVersion: string): boolean {\n\tconst newVersionIndex = sortedWriteVersions.indexOf(newVersion as WriteFormat);\n\tif (newVersionIndex === -1) {\n\t\tfail('New write version is invalid.');\n\t}\n\n\treturn compareSummaryFormatVersions(oldVersion, newVersion) === -1 ? true : false;\n}\n\nfunction isTreeNodeSequence(source: TreeNodeSequence<BuildNode> | BuildNode): source is TreeNodeSequence<BuildNode> {\n\treturn Array.isArray(source);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTreeEncoder.d.ts","sourceRoot":"","sources":["../src/SharedTreeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,
|
|
1
|
+
{"version":3,"file":"SharedTreeEncoder.d.ts","sourceRoot":"","sources":["../src/SharedTreeEncoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACN,aAAa,EAEb,WAAW,EACX,aAAa,EAGb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAIhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAyB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAEN,eAAe,EACf,mCAAmC,EAGnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,oBAAoB,EAIpB,wBAAwB,EACxB,IAAI,EACJ,iBAAiB,EACjB,uBAAuB,EAEvB,aAAa,EAEb,gBAAgB,EAChB,sBAAsB,EAEtB,iBAAiB,EACjB,uBAAuB,EAKvB,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,qBAAa,uBAAuB;IAIhB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAHpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwC;IACvE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6C;gBAE1C,gBAAgB,EAAE,OAAO;IAE7D;;;;;;OAMG;IACI,YAAY,CAClB,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,EAC1B,cAAc,EAAE,CACf,IAAI,EAAE,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,KAC/C,IAA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