@fluid-experimental/tree 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +4 -7
- package/dist/EditLog.js.map +1 -1
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +1 -7
- package/dist/LogViewer.js.map +1 -1
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +12 -12
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +6 -12
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/TransactionInternal.d.ts.map +1 -1
- package/dist/TransactionInternal.js +4 -7
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +3 -1
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +45 -17
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +4 -7
- package/lib/EditLog.js.map +1 -1
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +1 -7
- package/lib/LogViewer.js.map +1 -1
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +12 -12
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +6 -12
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/TransactionInternal.d.ts.map +1 -1
- package/lib/TransactionInternal.js +4 -7
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +3 -1
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +45 -17
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +1 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -1
- package/lib/test/SessionIdNormalizer.tests.js +4 -6
- package/lib/test/SessionIdNormalizer.tests.js.map +1 -1
- package/lib/test/Summary.tests.js +3 -6
- package/lib/test/Summary.tests.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +33 -11
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/TestNode.d.ts.map +1 -1
- package/lib/test/utilities/TestNode.js +2 -12
- package/lib/test/utilities/TestNode.js.map +1 -1
- package/package.json +18 -18
- package/src/EditLog.ts +21 -23
- package/src/LogViewer.ts +1 -6
- package/src/SharedTree.ts +17 -16
- package/src/SharedTreeEncoder.ts +6 -17
- package/src/TransactionInternal.ts +11 -13
- package/src/id-compressor/IdCompressor.ts +46 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTreeEncoder.js","sourceRoot":"","sources":["../src/SharedTreeEncoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,qCAAwC;AACxC,uCAAoC;AACpC,mDAA4D;AAE5D,+CAA4C;AAC5C,uDAS2B;AAC3B,qEAA8F;AAC9F,uDAsB2B;AAE3B,qDAAyE;AAEzE,qDAA2D;AAC3D,mDAMyB;AACzB,2DAAqF;AACrF,iDAAoE;AAEpE;;;GAGG;AACH,MAAa,uBAAuB;IAInC,YAAoC,gBAAyB;QAAzB,qBAAgB,GAAhB,gBAAgB,CAAS;QAH5C,mBAAc,GAAG,IAAI,wCAAuB,EAAS,CAAC;QACtD,qBAAgB,GAAG,IAAI,oCAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAEd,CAAC;IAEjE;;;;;;OAMG;IACI,YAAY,CAClB,IAA0B,EAC1B,cAEkD,EAClD,OAAwB,EACxB,YAA6C,EAC7C,QAAwB;QAExB,wCAAwC;QACxC,kFAAkF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AAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;;oBAC7B,cAAc,CAAC,IAAI,CAClB,IAAA,6BAAc,EACb;wBACC,OAAO;wBACP,EAAE,EAAE,MAAA,OAAO,CAAC,OAAO,EAAE,CAAC,mCAAI,IAAA,aAAI,EAAC,kDAAkD,CAAC;qBAClF,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAC7C,CACD,CAAC;gBACH,CAAC,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,WAAW,EAAE,IAAA,oDAA2B,EAAC,WAAW,EAAE,WAAW,CAAC;YAClE,cAAc;YACd,OAAO,EAAE,6BAAW,CAAC,MAAM;SAC3B,CAAC;IACH,CAAC;CACD;AApLD,0DAoLC;AAED,SAAS,YAAY,CAAC,KAA0D;IAC/E,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from '@fluidframework/common-utils';\nimport { assert, fail } from './Common';\nimport { EditLog } from './EditLog';\nimport { convertTreeNodes, newEdit } from './EditUtilities';\nimport { AttributionId, DetachedSequenceId, FinalNodeId, OpSpaceNodeId, TraitLabel } from './Identifiers';\nimport { initialTree } from './InitialTree';\nimport {\n\tContextualizedNodeIdNormalizer,\n\tgetNodeIdContext,\n\tNodeIdContext,\n\tNodeIdConverter,\n\tNodeIdGenerator,\n\tNodeIdNormalizer,\n\tscopeIdNormalizer,\n\tsequencedIdNormalizer,\n} from './NodeIdUtilities';\nimport { getChangeNodeFromView, getChangeNode_0_0_2FromView } from './SerializationUtilities';\nimport {\n\tCompressedChangeInternal,\n\tChangeInternal,\n\tSharedTreeSummary_0_0_2,\n\tWriteFormat,\n\tChangeNode,\n\tEdit,\n\tSharedTreeEditOp,\n\tSharedTreeOpType,\n\tSharedTreeSummary,\n\tEditWithoutId,\n\tChangeTypeInternal,\n\tChangeInternal_0_0_2,\n\tSharedTreeEditOp_0_0_2,\n\treservedIdCount,\n\tChangeNode_0_0_2,\n\tEditChunkContents,\n\tEditLogSummary,\n\tEditChunkContents_0_1_1,\n\tFluidEditHandle,\n\tStablePlaceInternal,\n\tSide,\n} from './persisted-types';\nimport { RevisionView } from './RevisionView';\nimport { MutableStringInterner, StringInterner } from './StringInterner';\nimport { SummaryContents } from './Summary';\nimport { InterningTreeCompressor } from './TreeCompressor';\nimport {\n\tcreateSessionId,\n\thasOngoingSession,\n\tIdCompressor,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n} from './id-compressor';\nimport { ChangeCompressor, compressEdit, decompressEdit } from './ChangeCompression';\nimport { convertEditIds, convertNodeDataIds } from './IdConversion';\n\n/**\n * Object capable of converting between the current internal representation for 0.1.1 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_1_1 {\n\tprivate readonly treeCompressor = new InterningTreeCompressor<never>();\n\tprivate readonly changeCompressor = new ChangeCompressor(this.treeCompressor);\n\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (\n\t\t\tedit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidRange: IdCreationRange,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): SharedTreeEditOp {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(\n\t\t\tcompressEdit(this.changeCompressor, interner, scopeIdNormalizer(idNormalizer, idRange.sessionId), edit)\n\t\t);\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tidRange,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp,\n\t\tfluidDeserialize: (\n\t\t\tsemiSerializedEdit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn decompressEdit(\n\t\t\tthis.changeCompressor,\n\t\t\tinterner,\n\t\t\tscopeIdNormalizer(idNormalizer, op.idRange.sessionId),\n\t\t\tparsedEdit\n\t\t);\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tif (this.summarizeHistory) {\n\t\t\treturn this.fullHistorySummarizer(edits, currentView, idNormalizer, interner, serializedIdCompressor);\n\t\t} else {\n\t\t\treturn this.noHistorySummarizer(\n\t\t\t\tedits,\n\t\t\t\tcurrentView,\n\t\t\t\tidContext,\n\t\t\t\tidNormalizer,\n\t\t\t\tinterner,\n\t\t\t\tserializedIdCompressor\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{\n\t\t\teditHistory,\n\t\t\tcurrentTree: compressedTree,\n\t\t\tinternedStrings,\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t\tversion,\n\t\t}: SharedTreeSummary,\n\t\tattributionId: AttributionId\n\t): SummaryContents {\n\t\tassert(version === WriteFormat.v0_1_1, `Invalid summary version to decode: ${version}, expected: 0.1.1`);\n\t\tassert(typeof editHistory === 'object', '0.1.1 summary encountered with non-object edit history.');\n\n\t\tconst idCompressor = hasOngoingSession(serializedIdCompressor)\n\t\t\t? IdCompressor.deserialize(serializedIdCompressor)\n\t\t\t: IdCompressor.deserialize(serializedIdCompressor, createSessionId(), attributionId);\n\n\t\tconst interner = new MutableStringInterner(internedStrings);\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(getNodeIdContext(idCompressor));\n\t\tconst decompressedTree: ChangeNode | undefined =\n\t\t\tcompressedTree !== undefined\n\t\t\t\t? this.treeCompressor.decompress(compressedTree, interner, sequencedNormalizer)\n\t\t\t\t: undefined;\n\t\tconst { editChunks, editIds } = editHistory;\n\t\tassert(editChunks !== undefined, 'Missing editChunks on 0.1.1 summary.');\n\t\tassert(editIds !== undefined, 'Missing editIds on 0.1.1 summary.');\n\n\t\tconst uncompressedChunks = editChunks.map(({ startRevision, chunk }) => ({\n\t\t\tstartRevision,\n\t\t\tchunk: isEditHandle(chunk)\n\t\t\t\t? {\n\t\t\t\t\t\tget: async () => {\n\t\t\t\t\t\t\tconst baseHandle = chunk;\n\t\t\t\t\t\t\tconst contents: EditChunkContents = JSON.parse(\n\t\t\t\t\t\t\t\tIsoBuffer.from(await baseHandle.get()).toString()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// Note: any interned IDs referenced in chunks taken at the time of summarization must be included\n\t\t\t\t\t\t\t// in the summary. So this interner is sufficient.\n\t\t\t\t\t\t\treturn this.decodeEditChunk(contents, sequencedNormalizer, interner);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbaseHandle: chunk,\n\t\t\t\t }\n\t\t\t\t: chunk.map((edit) => decompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)),\n\t\t}));\n\t\treturn {\n\t\t\tcurrentTree: decompressedTree,\n\t\t\teditHistory: { editIds, editChunks: uncompressedChunks },\n\t\t\tidCompressor,\n\t\t\tinterner,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * Writes summary format 0.1.1 which does not store the currentView for no history summaries.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst currentTree = getChangeNodeFromView(currentView);\n\t\tconst initialTreeId = idContext.convertToNodeId(initialTree.identifier);\n\t\tconst changes: ChangeInternal[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\tChangeInternal.build(children, id),\n\t\t\t\tChangeInternal.insert(\n\t\t\t\t\tid,\n\t\t\t\t\tStablePlaceInternal.atStartOf({ parent: initialTreeId, label: label as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push(ChangeInternal.setPayload(initialTreeId, currentTree.payload));\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTreeId && currentTree.definition === initialTree.definition,\n\t\t\t'root definition and identifier should be immutable.'\n\t\t);\n\t\tconst edit = newEdit(changes);\n\t\tconst compressedChanges = edit.changes.map((change) =>\n\t\t\tthis.changeCompressor.compress(change, interner, sequencedIdNormalizer(idNormalizer))\n\t\t);\n\t\treturn {\n\t\t\teditHistory: {\n\t\t\t\teditChunks: [{ startRevision: 0, chunk: [{ changes: compressedChanges }] }],\n\t\t\t\teditIds: [edit.id],\n\t\t\t},\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\t/**\n\t * Generates a summary with format version 0.1.1. This will prefer handles over edits in edit chunks where possible,\n\t * and string interning and tree compression will be applied.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(idNormalizer);\n\t\tconst currentTree = this.treeCompressor.compress(\n\t\t\tgetChangeNodeFromView(currentView),\n\t\t\tinterner,\n\t\t\tsequencedNormalizer\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\teditHistory: edits.getEditLogSummary((edit) =>\n\t\t\t\tcompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)\n\t\t\t),\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\tpublic encodeEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditChunkContents_0_1_1 {\n\t\tconst compressedEdits = edits.map((edit) => compressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t\treturn {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tedits: compressedEdits,\n\t\t};\n\t}\n\n\tpublic decodeEditChunk(\n\t\tcontents: EditChunkContents,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditWithoutId<ChangeInternal>[] {\n\t\tassert(\n\t\t\tcontents.version === WriteFormat.v0_1_1,\n\t\t\t`Invalid editChunk to decode: ${contents.version}. Expected 0.1.1.`\n\t\t);\n\t\treturn contents.edits.map((edit) => decompressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t}\n}\n\n/**\n * Object capable of converting between the current internal representation for 0.0.2 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_0_2 {\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (edit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeEditOp_0_0_2 {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(convertEditIds(edit, (id) => idConverter.convertToStableNodeId(id)));\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp_0_0_2,\n\t\tfluidDeserialize: (semiSerializedEdit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidGenerator: NodeIdGenerator\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn convertEditIds(parsedEdit, (id) => idGenerator.generateNodeId(id));\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tif (this.summarizeHistory) {\n\t\t\treturn this.fullHistorySummarizer(edits, currentView, idConverter);\n\t\t} else {\n\t\t\treturn this.noHistorySummarizer(edits, currentView, idConverter);\n\t\t}\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{ currentTree, sequencedEdits }: SharedTreeSummary_0_0_2,\n\t\tattributionId?: AttributionId\n\t): SummaryContents {\n\t\tassert(sequencedEdits !== undefined, '0.0.2 summary encountered with missing sequencedEdits field.');\n\t\tconst idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId);\n\t\tconst idGenerator = getNodeIdContext(idCompressor);\n\t\tconst generateId = (id) => idGenerator.generateNodeId(id);\n\n\t\t// This saves all of the edits in the summary as part of the first chunk.\n\t\tconst temporaryLog = new EditLog<ChangeInternal>();\n\t\tsequencedEdits.forEach((edit) =>\n\t\t\ttemporaryLog.addSequencedEdit(convertEditIds(edit, generateId), {\n\t\t\t\tsequenceNumber: 1,\n\t\t\t\treferenceSequenceNumber: 0,\n\t\t\t})\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree: convertTreeNodes<ChangeNode_0_0_2, ChangeNode>(currentTree, (node) =>\n\t\t\t\tconvertNodeDataIds(node, generateId)\n\t\t\t),\n\t\t\tidCompressor,\n\t\t\tinterner: new MutableStringInterner(),\n\t\t\t// This cast is valid because we just constructed this log and gave it only in-session edits.\n\t\t\teditHistory: temporaryLog.getEditLogSummary() as EditLogSummary<ChangeInternal, never>,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * @param stable - Generates the single edit with a stable edit ID. False by default, used for testing.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst currentTree = getChangeNode_0_0_2FromView(currentView, idConverter);\n\t\tconst changes: ChangeInternal_0_0_2[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\t{ type: ChangeTypeInternal.Build, source: children, destination: id },\n\t\t\t\t{\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: id,\n\t\t\t\t\tdestination: {\n\t\t\t\t\t\tside: Side.After,\n\t\t\t\t\t\treferenceTrait: { label: label as TraitLabel, parent: initialTree.identifier },\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push({\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\tnodeToModify: initialTree.identifier,\n\t\t\t\tpayload: currentTree.payload,\n\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTree.identifier && currentTree.definition === initialTree.definition,\n\t\t\t'root definition and identifier should be immutable.'\n\t\t);\n\t\tconst edit = newEdit(changes);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\tsequencedEdits: [\n\t\t\t\t{\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t},\n\t\t\t],\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\t/**\n\t * Preserves the full history in the generated summary.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst { editChunks, editIds } = edits.getEditLogSummary();\n\n\t\tconst sequencedEdits: Edit<ChangeInternal_0_0_2>[] = [];\n\t\tlet idIndex = 0;\n\t\teditChunks.forEach(({ chunk }) => {\n\t\t\tif (isEditHandle(chunk)) {\n\t\t\t\tfail('Cannot write handles to summary version 0.0.2');\n\t\t\t} else {\n\t\t\t\tchunk.forEach(({ changes }) => {\n\t\t\t\t\tsequencedEdits.push(\n\t\t\t\t\t\tconvertEditIds(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchanges,\n\t\t\t\t\t\t\t\tid: editIds[idIndex++] ?? fail('Number of edits should match number of edit IDs.'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(id) => idConverter.convertToStableNodeId(id)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tcurrentTree: getChangeNode_0_0_2FromView(currentView, idConverter),\n\t\t\tsequencedEdits,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n}\n\nfunction isEditHandle(chunk: FluidEditHandle | readonly EditWithoutId<unknown>[]): chunk is FluidEditHandle {\n\treturn !Array.isArray(chunk);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SharedTree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*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from '@fluidframework/common-utils';\nimport { assert, fail } from './Common';\nimport { EditLog } from './EditLog';\nimport { convertTreeNodes, newEdit } from './EditUtilities';\nimport { AttributionId, DetachedSequenceId, FinalNodeId, OpSpaceNodeId, TraitLabel } from './Identifiers';\nimport { initialTree } from './InitialTree';\nimport {\n\tContextualizedNodeIdNormalizer,\n\tgetNodeIdContext,\n\tNodeIdContext,\n\tNodeIdConverter,\n\tNodeIdGenerator,\n\tNodeIdNormalizer,\n\tscopeIdNormalizer,\n\tsequencedIdNormalizer,\n} from './NodeIdUtilities';\nimport { getChangeNodeFromView, getChangeNode_0_0_2FromView } from './SerializationUtilities';\nimport {\n\tCompressedChangeInternal,\n\tChangeInternal,\n\tSharedTreeSummary_0_0_2,\n\tWriteFormat,\n\tChangeNode,\n\tEdit,\n\tSharedTreeEditOp,\n\tSharedTreeOpType,\n\tSharedTreeSummary,\n\tEditWithoutId,\n\tChangeTypeInternal,\n\tChangeInternal_0_0_2,\n\tSharedTreeEditOp_0_0_2,\n\treservedIdCount,\n\tChangeNode_0_0_2,\n\tEditChunkContents,\n\tEditLogSummary,\n\tEditChunkContents_0_1_1,\n\tFluidEditHandle,\n\tStablePlaceInternal,\n\tSide,\n} from './persisted-types';\nimport { RevisionView } from './RevisionView';\nimport { MutableStringInterner, StringInterner } from './StringInterner';\nimport { SummaryContents } from './Summary';\nimport { InterningTreeCompressor } from './TreeCompressor';\nimport {\n\tcreateSessionId,\n\thasOngoingSession,\n\tIdCompressor,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n} from './id-compressor';\nimport { ChangeCompressor, compressEdit, decompressEdit } from './ChangeCompression';\nimport { convertEditIds, convertNodeDataIds } from './IdConversion';\n\n/**\n * Object capable of converting between the current internal representation for 0.1.1 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_1_1 {\n\tprivate readonly treeCompressor = new InterningTreeCompressor<never>();\n\tprivate readonly changeCompressor = new ChangeCompressor(this.treeCompressor);\n\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (\n\t\t\tedit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidRange: IdCreationRange,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): SharedTreeEditOp {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(\n\t\t\tcompressEdit(this.changeCompressor, interner, scopeIdNormalizer(idNormalizer, idRange.sessionId), edit)\n\t\t);\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tidRange,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp,\n\t\tfluidDeserialize: (\n\t\t\tsemiSerializedEdit: Edit<CompressedChangeInternal<OpSpaceNodeId>>\n\t\t) => Edit<CompressedChangeInternal<OpSpaceNodeId>>,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn decompressEdit(\n\t\t\tthis.changeCompressor,\n\t\t\tinterner,\n\t\t\tscopeIdNormalizer(idNormalizer, op.idRange.sessionId),\n\t\t\tparsedEdit\n\t\t);\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idNormalizer, interner, serializedIdCompressor)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idContext, idNormalizer, interner, serializedIdCompressor);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{\n\t\t\teditHistory,\n\t\t\tcurrentTree: compressedTree,\n\t\t\tinternedStrings,\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t\tversion,\n\t\t}: SharedTreeSummary,\n\t\tattributionId: AttributionId\n\t): SummaryContents {\n\t\tassert(version === WriteFormat.v0_1_1, `Invalid summary version to decode: ${version}, expected: 0.1.1`);\n\t\tassert(typeof editHistory === 'object', '0.1.1 summary encountered with non-object edit history.');\n\n\t\tconst idCompressor = hasOngoingSession(serializedIdCompressor)\n\t\t\t? IdCompressor.deserialize(serializedIdCompressor)\n\t\t\t: IdCompressor.deserialize(serializedIdCompressor, createSessionId(), attributionId);\n\n\t\tconst interner = new MutableStringInterner(internedStrings);\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(getNodeIdContext(idCompressor));\n\t\tconst decompressedTree: ChangeNode | undefined =\n\t\t\tcompressedTree !== undefined\n\t\t\t\t? this.treeCompressor.decompress(compressedTree, interner, sequencedNormalizer)\n\t\t\t\t: undefined;\n\t\tconst { editChunks, editIds } = editHistory;\n\t\tassert(editChunks !== undefined, 'Missing editChunks on 0.1.1 summary.');\n\t\tassert(editIds !== undefined, 'Missing editIds on 0.1.1 summary.');\n\n\t\tconst uncompressedChunks = editChunks.map(({ startRevision, chunk }) => ({\n\t\t\tstartRevision,\n\t\t\tchunk: isEditHandle(chunk)\n\t\t\t\t? {\n\t\t\t\t\t\tget: async () => {\n\t\t\t\t\t\t\tconst baseHandle = chunk;\n\t\t\t\t\t\t\tconst contents: EditChunkContents = JSON.parse(\n\t\t\t\t\t\t\t\tIsoBuffer.from(await baseHandle.get()).toString()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// Note: any interned IDs referenced in chunks taken at the time of summarization must be included\n\t\t\t\t\t\t\t// in the summary. So this interner is sufficient.\n\t\t\t\t\t\t\treturn this.decodeEditChunk(contents, sequencedNormalizer, interner);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbaseHandle: chunk,\n\t\t\t\t }\n\t\t\t\t: chunk.map((edit) => decompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)),\n\t\t}));\n\t\treturn {\n\t\t\tcurrentTree: decompressedTree,\n\t\t\teditHistory: { editIds, editChunks: uncompressedChunks },\n\t\t\tidCompressor,\n\t\t\tinterner,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * Writes summary format 0.1.1 which does not store the currentView for no history summaries.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidContext: NodeIdContext,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst currentTree = getChangeNodeFromView(currentView);\n\t\tconst initialTreeId = idContext.convertToNodeId(initialTree.identifier);\n\t\tconst changes: ChangeInternal[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\tChangeInternal.build(children, id),\n\t\t\t\tChangeInternal.insert(\n\t\t\t\t\tid,\n\t\t\t\t\tStablePlaceInternal.atStartOf({ parent: initialTreeId, label: label as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push(ChangeInternal.setPayload(initialTreeId, currentTree.payload));\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTreeId && currentTree.definition === initialTree.definition,\n\t\t\t'root definition and identifier should be immutable.'\n\t\t);\n\t\tconst edit = newEdit(changes);\n\t\tconst compressedChanges = edit.changes.map((change) =>\n\t\t\tthis.changeCompressor.compress(change, interner, sequencedIdNormalizer(idNormalizer))\n\t\t);\n\t\treturn {\n\t\t\teditHistory: {\n\t\t\t\teditChunks: [{ startRevision: 0, chunk: [{ changes: compressedChanges }] }],\n\t\t\t\teditIds: [edit.id],\n\t\t\t},\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\t/**\n\t * Generates a summary with format version 0.1.1. This will prefer handles over edits in edit chunks where possible,\n\t * and string interning and tree compression will be applied.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidNormalizer: NodeIdNormalizer<OpSpaceNodeId>,\n\t\tinterner: StringInterner,\n\t\tserializedIdCompressor: SerializedIdCompressorWithNoSession\n\t): SharedTreeSummary {\n\t\tconst sequencedNormalizer = sequencedIdNormalizer(idNormalizer);\n\t\tconst currentTree = this.treeCompressor.compress(\n\t\t\tgetChangeNodeFromView(currentView),\n\t\t\tinterner,\n\t\t\tsequencedNormalizer\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\teditHistory: edits.getEditLogSummary((edit) =>\n\t\t\t\tcompressEdit(this.changeCompressor, interner, sequencedNormalizer, edit)\n\t\t\t),\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t\tidCompressor: serializedIdCompressor,\n\t\t};\n\t}\n\n\tpublic encodeEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditChunkContents_0_1_1 {\n\t\tconst compressedEdits = edits.map((edit) => compressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t\treturn {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tedits: compressedEdits,\n\t\t};\n\t}\n\n\tpublic decodeEditChunk(\n\t\tcontents: EditChunkContents,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<FinalNodeId>,\n\t\tinterner: StringInterner\n\t): EditWithoutId<ChangeInternal>[] {\n\t\tassert(\n\t\t\tcontents.version === WriteFormat.v0_1_1,\n\t\t\t`Invalid editChunk to decode: ${contents.version}. Expected 0.1.1.`\n\t\t);\n\t\treturn contents.edits.map((edit) => decompressEdit(this.changeCompressor, interner, idNormalizer, edit));\n\t}\n}\n\n/**\n * Object capable of converting between the current internal representation for 0.0.2 edits and their wire format.\n * @internal\n */\nexport class SharedTreeEncoder_0_0_2 {\n\tpublic constructor(private readonly summarizeHistory: boolean) {}\n\n\t/**\n\t * Encodes an edit op to be sent.\n\t * @param edit - edit to encode.\n\t * @param fluidSerialize - Callback which serializes Fluid handles contained in a JSON-serializable object, returning the result.\n\t * Should be invoked on the edit contents at some point before op encoding is complete.\n\t * This is because edit contents may have Payloads needing to be serialized.\n\t */\n\tpublic encodeEditOp(\n\t\tedit: Edit<ChangeInternal>,\n\t\tfluidSerialize: (edit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeEditOp_0_0_2 {\n\t\t// IFluidHandles are not allowed in Ops.\n\t\t// Ops can contain Fluid's Serializable (for payloads) which allows IFluidHandles.\n\t\t// So replace the handles by encoding before sending:\n\t\tconst semiSerialized = fluidSerialize(convertEditIds(edit, (id) => idConverter.convertToStableNodeId(id)));\n\n\t\treturn {\n\t\t\ttype: SharedTreeOpType.Edit,\n\t\t\tedit: semiSerialized,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\n\t/**\n\t * Decodes an edit op encoded with `encodeEditOp`.\n\t * @param op - op to decode.\n\t * @param fluidDeserialize - Callback which deserializes Fluid handles contained in a JSON-serializable object.\n\t * Should be invoked on the semi-serialized edit contents at some point before decoding is complete.\n\t * This will rehydrate any serialized Fluid handles into usable IFluidHandle objects.\n\t */\n\tpublic decodeEditOp(\n\t\top: SharedTreeEditOp_0_0_2,\n\t\tfluidDeserialize: (semiSerializedEdit: Edit<ChangeInternal_0_0_2>) => Edit<ChangeInternal_0_0_2>,\n\t\tidGenerator: NodeIdGenerator\n\t): Edit<ChangeInternal> {\n\t\tconst { edit: semiSerializedEdit } = op;\n\t\tconst parsedEdit = fluidDeserialize(semiSerializedEdit);\n\t\treturn convertEditIds(parsedEdit, (id) => idGenerator.generateNodeId(id));\n\t}\n\n\t/**\n\t * Encodes a summary.\n\t */\n\tpublic encodeSummary(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\treturn this.summarizeHistory\n\t\t\t? this.fullHistorySummarizer(edits, currentView, idConverter)\n\t\t\t: this.noHistorySummarizer(edits, currentView, idConverter);\n\t}\n\n\t/**\n\t * Decodes an encoded summary.\n\t */\n\tpublic decodeSummary(\n\t\t{ currentTree, sequencedEdits }: SharedTreeSummary_0_0_2,\n\t\tattributionId?: AttributionId\n\t): SummaryContents {\n\t\tassert(sequencedEdits !== undefined, '0.0.2 summary encountered with missing sequencedEdits field.');\n\t\tconst idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId);\n\t\tconst idGenerator = getNodeIdContext(idCompressor);\n\t\tconst generateId = (id) => idGenerator.generateNodeId(id);\n\n\t\t// This saves all of the edits in the summary as part of the first chunk.\n\t\tconst temporaryLog = new EditLog<ChangeInternal>();\n\t\tsequencedEdits.forEach((edit) =>\n\t\t\ttemporaryLog.addSequencedEdit(convertEditIds(edit, generateId), {\n\t\t\t\tsequenceNumber: 1,\n\t\t\t\treferenceSequenceNumber: 0,\n\t\t\t})\n\t\t);\n\n\t\treturn {\n\t\t\tcurrentTree: convertTreeNodes<ChangeNode_0_0_2, ChangeNode>(currentTree, (node) =>\n\t\t\t\tconvertNodeDataIds(node, generateId)\n\t\t\t),\n\t\t\tidCompressor,\n\t\t\tinterner: new MutableStringInterner(),\n\t\t\t// This cast is valid because we just constructed this log and gave it only in-session edits.\n\t\t\teditHistory: temporaryLog.getEditLogSummary() as EditLogSummary<ChangeInternal, never>,\n\t\t};\n\t}\n\n\t/**\n\t * Does not preserve (persist) history at all.\n\t * Instead, the history returned in the summary will contain a single edit that creates a revision identical to the supplied view.\n\t * @param stable - Generates the single edit with a stable edit ID. False by default, used for testing.\n\t */\n\tprivate noHistorySummarizer<TChange>(\n\t\t_edits: EditLog<TChange>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst currentTree = getChangeNode_0_0_2FromView(currentView, idConverter);\n\t\tconst changes: ChangeInternal_0_0_2[] = [];\n\t\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\t\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\t\tconst id = 0 as DetachedSequenceId;\n\t\t\tchanges.push(\n\t\t\t\t{ type: ChangeTypeInternal.Build, source: children, destination: id },\n\t\t\t\t{\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: id,\n\t\t\t\t\tdestination: {\n\t\t\t\t\t\tside: Side.After,\n\t\t\t\t\t\treferenceTrait: { label: label as TraitLabel, parent: initialTree.identifier },\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tif (currentTree.payload !== undefined) {\n\t\t\tchanges.push({\n\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\tnodeToModify: initialTree.identifier,\n\t\t\t\tpayload: currentTree.payload,\n\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tcurrentTree.identifier === initialTree.identifier && currentTree.definition === initialTree.definition,\n\t\t\t'root definition and identifier should be immutable.'\n\t\t);\n\t\tconst edit = newEdit(changes);\n\n\t\treturn {\n\t\t\tcurrentTree,\n\t\t\tsequencedEdits: [\n\t\t\t\t{\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t},\n\t\t\t],\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n\t/**\n\t * Preserves the full history in the generated summary.\n\t */\n\tprivate fullHistorySummarizer(\n\t\tedits: EditLog<ChangeInternal>,\n\t\tcurrentView: RevisionView,\n\t\tidConverter: NodeIdConverter\n\t): SharedTreeSummary_0_0_2 {\n\t\tconst { editChunks, editIds } = edits.getEditLogSummary();\n\n\t\tconst sequencedEdits: Edit<ChangeInternal_0_0_2>[] = [];\n\t\tlet idIndex = 0;\n\t\teditChunks.forEach(({ chunk }) => {\n\t\t\tif (isEditHandle(chunk)) {\n\t\t\t\tfail('Cannot write handles to summary version 0.0.2');\n\t\t\t} else {\n\t\t\t\tchunk.forEach(({ changes }) => {\n\t\t\t\t\tsequencedEdits.push(\n\t\t\t\t\t\tconvertEditIds(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchanges,\n\t\t\t\t\t\t\t\tid: editIds[idIndex++] ?? fail('Number of edits should match number of edit IDs.'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(id) => idConverter.convertToStableNodeId(id)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tcurrentTree: getChangeNode_0_0_2FromView(currentView, idConverter),\n\t\t\tsequencedEdits,\n\t\t\tversion: WriteFormat.v0_0_2,\n\t\t};\n\t}\n}\n\nfunction isEditHandle(chunk: FluidEditHandle | readonly EditWithoutId<unknown>[]): chunk is FluidEditHandle {\n\treturn !Array.isArray(chunk);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionInternal.d.ts","sourceRoot":"","sources":["../src/TransactionInternal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuC,MAAM,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAwB,MAAM,eAAe,CAAC;AAE7F,OAAO,EAEN,iBAAiB,EACjB,cAAc,EAGd,kBAAkB,EAElB,UAAU,EAGV,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKN,wBAAwB,EACxB,wBAAwB,EAGxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;GAGG;AACH,oBAAY,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;OAE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wB,CAAC;KAC/C,GACD;QACA,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC;QACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB,GACD;QACA,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC;QACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB,GACD;QACA,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC,QAAQ,CAAC;QAChD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;KAC3B,CAAC;IAEL;;OAEG;IACH,MAAM,MAAM,uBAAuB;QAClC;;WAEG;QACH,QAAQ,aAAa;QACrB;;WAEG;QACH,SAAS,cAAc;QACvB;;WAEG;QACH,SAAS,cAAc;QACvB;;WAEG;QACH,QAAQ,aAAa;KACrB;;CACD"}
|
|
@@ -166,17 +166,14 @@ class GenericTransaction {
|
|
|
166
166
|
}
|
|
167
167
|
const resolvedChange = resolutionResult.result;
|
|
168
168
|
const changeResult = this.policy.dispatchChange(this.state, resolvedChange);
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
this.state = Common_1.Result.isOk(changeResult)
|
|
170
|
+
? {
|
|
171
171
|
status: persisted_types_1.EditStatus.Applied,
|
|
172
172
|
view: changeResult.result,
|
|
173
173
|
changes: this.changes.concat(change),
|
|
174
174
|
steps: this.steps.concat({ resolvedChange, after: changeResult.result }),
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
else {
|
|
178
|
-
this.state = Object.assign(Object.assign({}, this.state), changeResult.error);
|
|
179
|
-
}
|
|
175
|
+
}
|
|
176
|
+
: Object.assign(Object.assign({}, this.state), changeResult.error);
|
|
180
177
|
return this;
|
|
181
178
|
}
|
|
182
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionInternal.js","sourceRoot":"","sources":["../src/TransactionInternal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAuE;AAC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AS,CAAC;aACjB;YACD,uHAAuH;YACvH,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACjC,OAAO,eAAe,CAAC;QACxB,CAAC;KACD;IAhYY,0BAAM,SAgYlB,CAAA;IAED;;OAEG;IACH,IAAY,WAqCX;IArCD,WAAY,WAAW;QACtB;;WAEG;QACH,gEAAiD,CAAA;QACjD;;WAEG;QACH,gFAAiE,CAAA;QACjE;;WAEG;QACH,oEAAqD,CAAA;QACrD;;WAEG;QACH,wDAAyC,CAAA;QACzC;;WAEG;QACH,gDAAiC,CAAA;QACjC;;WAEG;QACH,sCAAuB,CAAA;QACvB;;WAEG;QACH,oCAAqB,CAAA;QACrB;;WAEG;QACH,oCAAqB,CAAA;QACrB;;WAEG;QACH,0DAA2C,CAAA;IAC5C,CAAC,EArCW,WAAW,GAAX,+BAAW,KAAX,+BAAW,QAqCtB;IA2MD;;OAEG;IACH,IAAY,uBAiBX;IAjBD,WAAY,uBAAuB;QAClC;;WAEG;QACH,gDAAqB,CAAA;QACrB;;WAEG;QACH,kDAAuB,CAAA;QACvB;;WAEG;QACH,kDAAuB,CAAA;QACvB;;WAEG;QACH,gDAAqB,CAAA;IACtB,CAAC,EAjBW,uBAAuB,GAAvB,2CAAuB,KAAvB,2CAAuB,QAiBlC;AACF,CAAC,EAvpBgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAupBnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, copyPropertyIfDefined, fail, Result } from './Common';\nimport { NodeId, DetachedSequenceId, TraitLabel, isDetachedSequenceId } from './Identifiers';\nimport { rangeFromStableRange } from './TreeViewUtilities';\nimport {\n\tBuildInternal,\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tConstraintInternal,\n\tDetachInternal,\n\tEditStatus,\n\tInsertInternal,\n\tSetValueInternal,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n} from './persisted-types';\nimport {\n\tdetachRange,\n\tinsertIntoTrait,\n\tvalidateStablePlace,\n\tvalidateStableRange,\n\tBadPlaceValidationResult,\n\tBadRangeValidationResult,\n\tPlaceValidationResult,\n\tRangeValidationResultKind,\n} from './EditUtilities';\nimport { RevisionView, TransactionView } from './RevisionView';\nimport { ReconciliationChange, ReconciliationPath } from './ReconciliationPath';\nimport { TreeViewNode } from './TreeView';\n\n/**\n * Result of applying a transaction.\n * @public\n */\nexport type EditingResult = FailedEditingResult | ValidEditingResult;\n\n/**\n * Basic result of applying a transaction.\n * @public\n */\nexport interface EditingResultBase {\n\t/**\n\t * The final status of the transaction.\n\t */\n\treadonly status: EditStatus;\n\t/**\n\t * The valid changes applied as part of the transaction.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied as part of the transaction.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n\t/**\n\t * The revision preceding the transaction.\n\t */\n\treadonly before: RevisionView;\n}\n\n/**\n * Result of applying an invalid or malformed transaction.\n * @public\n */\nexport interface FailedEditingResult extends EditingResultBase {\n\t/**\n\t * {@inheritDoc EditingResultBase.status}\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about what caused the transaction to fail.\n\t */\n\treadonly failure: TransactionInternal.Failure;\n\t/**\n\t * The valid changes applied as part of the transaction.\n\t * Those were ultimately abandoned due to the transaction failure.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied as part of the transaction.\n\t * Those were ultimately abandoned due to the transaction failure.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * Result of applying a valid transaction.\n * @public\n */\nexport interface ValidEditingResult extends EditingResultBase {\n\t/**\n\t * {@inheritDoc EditingResultBase.status}\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The new revision produced by the transaction.\n\t */\n\treadonly after: RevisionView;\n}\n\n/**\n * The result of applying a change within a transaction.\n * @public\n */\nexport type ChangeResult = Result<TransactionView, TransactionFailure>;\n\n/**\n * The ongoing state of a transaction.\n * @public\n */\nexport type TransactionState = SucceedingTransactionState | FailingTransactionState;\n\n/**\n * The state of a transaction that has not encountered an error.\n */\nexport interface SucceedingTransactionState {\n\t/**\n\t * The current status of the transaction.\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The view reflecting the latest applied change.\n\t */\n\treadonly view: TransactionView;\n\t/**\n\t * The applied changes so far.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied so far.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The state of a transaction that has encountered an error.\n */\nexport interface FailingTransactionState extends TransactionFailure {\n\t/**\n\t * The view reflecting the latest applied change.\n\t */\n\treadonly view: TransactionView;\n\t/**\n\t * The applied changes so far.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied so far.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The failure state of a transaction.\n */\nexport interface TransactionFailure {\n\t/**\n\t * The status indicating the kind of failure encountered.\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about what caused the transaction to fail.\n\t */\n\treadonly failure: TransactionInternal.Failure;\n}\n\n/**\n * A mutable transaction for applying sequences of changes to a TreeView.\n * Allows viewing the intermediate states.\n *\n * Contains necessary state to apply changes within an edit to a TreeView.\n *\n * May have any number of changes applied to make up the edit.\n * Use `close` to complete the transaction, returning the array of changes and an EditingResult showing the\n * results of applying the changes as an Edit to the initial TreeView (passed to the constructor).\n *\n * No data outside the Transaction is modified by Transaction:\n * the results from `close` must be used to actually submit an `Edit`.\n */\nexport class GenericTransaction {\n\tprivate readonly policy: GenericTransactionPolicy;\n\tprotected readonly before: RevisionView;\n\tprivate state: TransactionState;\n\tprivate open = true;\n\n\t/**\n\t * Create and open an edit of the provided `TreeView`. After applying 0 or more changes, this editor should be closed via `close()`.\n\t * @param view - the `TreeView` at which this edit begins. The first change will be applied against this view.\n\t */\n\tpublic constructor(view: RevisionView, policy: GenericTransactionPolicy) {\n\t\tthis.before = view;\n\t\tthis.policy = policy;\n\t\tthis.state = {\n\t\t\tview: view.openForTransaction(),\n\t\t\tstatus: EditStatus.Applied,\n\t\t\tchanges: [],\n\t\t\tsteps: [],\n\t\t};\n\t}\n\n\t/** Whether or not this transaction has been closed via `close()` */\n\tpublic get isOpen(): boolean {\n\t\treturn this.open;\n\t}\n\n\t/**\n\t * The most up-to-date `TreeView` for this edit. This is the state of the tree after all changes applied so far.\n\t */\n\tpublic get view(): TransactionView {\n\t\treturn this.state.view;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get status(): EditStatus {\n\t\treturn this.state.status;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get changes(): readonly ChangeInternal[] {\n\t\treturn this.state.changes;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get steps(): readonly ReconciliationChange[] {\n\t\treturn this.state.steps;\n\t}\n\n\t/** @returns the final `EditStatus` and `TreeView` after all changes are applied. */\n\tpublic close(): EditingResult {\n\t\tassert(this.open, 'transaction has already been closed');\n\t\tthis.open = false;\n\t\tif (this.state.status === EditStatus.Applied) {\n\t\t\tconst validation = this.policy.validateOnClose(this.state);\n\t\t\tif (Result.isOk(validation)) {\n\t\t\t\tif (validation.result !== this.view) {\n\t\t\t\t\tthis.state = { ...this.state, view: validation.result };\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\tsteps: this.steps,\n\t\t\t\t\tchanges: this.changes,\n\t\t\t\t\tbefore: this.before,\n\t\t\t\t\tafter: this.view.close(),\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis.state = { ...this.state, ...validation.error };\n\t\t\treturn {\n\t\t\t\t...validation.error,\n\t\t\t\tsteps: this.steps,\n\t\t\t\tchanges: this.changes,\n\t\t\t\tbefore: this.before,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tstatus: this.state.status,\n\t\t\tfailure: this.state.failure,\n\t\t\tsteps: this.steps,\n\t\t\tchanges: this.changes,\n\t\t\tbefore: this.before,\n\t\t};\n\t}\n\n\t/**\n\t * A helper to apply a sequence of changes. Changes will be applied one after the other. If a change fails to apply,\n\t * the remaining changes in `changes` will be ignored.\n\t * @param changes - the sequence of changes to apply.\n\t * @param path - the reconciliation path for the first change.\n\t * @returns this\n\t */\n\tpublic applyChanges(changes: Iterable<ChangeInternal>, path: ReconciliationPath = []): this {\n\t\tconst iter = changes[Symbol.iterator]();\n\t\tconst firsChangeInternal = iter.next().value;\n\t\tlet iterResult = iter.next();\n\t\tif (iterResult.done === true) {\n\t\t\tfor (const change of changes) {\n\t\t\t\tif (this.applyChange(change, path).status !== EditStatus.Applied) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif (this.applyChange(firsChangeInternal, path).status !== EditStatus.Applied) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst ongoingEdit = {\n\t\t\t0: this.steps[this.steps.length - 1],\n\t\t\tbefore: this.view,\n\t\t\tafter: this.view,\n\t\t\tlength: 1,\n\t\t};\n\n\t\t/**\n\t\t * We use a Proxy instead of `{ ...path, ...objectWithOngoingEdit }` to avoid eagerly demanding all parts of the path, which may\n\t\t * require extensive computation.\n\t\t */\n\t\tconst pathWithOngoingEdit = new Proxy(path, {\n\t\t\tget: (target: ReconciliationPath, prop: string): ReconciliationPath[number | 'length'] => {\n\t\t\t\tif (prop === 'length') {\n\t\t\t\t\treturn target.length + 1;\n\t\t\t\t}\n\t\t\t\treturn prop === String(target.length) ? ongoingEdit : target[prop];\n\t\t\t},\n\t\t});\n\n\t\twhile (iterResult.done !== true) {\n\t\t\tif (this.applyChange(iterResult.value, pathWithOngoingEdit).status !== EditStatus.Applied) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tongoingEdit[ongoingEdit.length] = this.steps[this.steps.length - 1];\n\t\t\tongoingEdit.length += 1;\n\t\t\tongoingEdit.after = this.view;\n\t\t\titerResult = iter.next();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Attempt to apply the given change as part of this edit. This method should not be called if a previous change in this edit failed to\n\t * apply.\n\t * @param change - the change to apply\n\t * @param path - the reconciliation path for the change.\n\t * @returns this\n\t */\n\tpublic applyChange(change: ChangeInternal, path: ReconciliationPath = []): this {\n\t\tassert(this.open, 'Editor must be open to apply changes.');\n\t\tif (this.state.status !== EditStatus.Applied) {\n\t\t\tfail('Cannot apply change to an edit unless all previous changes have applied');\n\t\t}\n\t\tconst resolutionResult = this.policy.tryResolveChange(this.state, change, path);\n\t\tif (Result.isError(resolutionResult)) {\n\t\t\tthis.state = { ...this.state, ...resolutionResult.error };\n\t\t\treturn this;\n\t\t}\n\t\tconst resolvedChange = resolutionResult.result;\n\t\tconst changeResult = this.policy.dispatchChange(this.state, resolvedChange);\n\t\tif (Result.isOk(changeResult)) {\n\t\t\tthis.state = {\n\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\tview: changeResult.result,\n\t\t\t\tchanges: this.changes.concat(change),\n\t\t\t\tsteps: this.steps.concat({ resolvedChange, after: changeResult.result }),\n\t\t\t};\n\t\t} else {\n\t\t\tthis.state = {\n\t\t\t\t...this.state,\n\t\t\t\t...changeResult.error,\n\t\t\t};\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * An object that encapsulates the rules and state pertaining to a specific subclass of {@link GenericTransaction}.\n * The characteristics that define such a subclass (and an implementation of this interface) are:\n * - The type of change that can be applied\n * - How those changes impact the state of the tree\n * - How those changes are resolved in the face of concurrent changes\n * - What makes a transaction valid\n * - The kind of situations that might lead to a transaction failure\n *\n * Instances of this type are passed to the {@link GenericTransaction} constructor.\n */\nexport interface GenericTransactionPolicy {\n\t/**\n\t * Given a change, attempts to derive an equivalent change which can be applied to the current state even if the given change was issued\n\t * over a different state. This can be used to apply a sequence of changes that were issued concurrently, i.e., without knowledge of\n\t * each other.\n\t * @param state - The current state on which the returned change will be applied.\n\t * @param change - The original change issued.\n\t * @param path - The reconciliation path for the change.\n\t * @returns The change to be applied to the current state, or a failure if the change cannot be resolved.\n\t */\n\ttryResolveChange(\n\t\tstate: SucceedingTransactionState,\n\t\tchange: ChangeInternal,\n\t\tpath: ReconciliationPath\n\t): Result<ChangeInternal, TransactionFailure>;\n\n\t/**\n\t * Provides a new state given the current state and a change to apply.\n\t * @param state - The current state on which the change is applied.\n\t * @param change - The change to apply to the current state.\n\t * @returns The new state reflecting the applied change, or a failure.\n\t */\n\tdispatchChange(state: SucceedingTransactionState, change: ChangeInternal): ChangeResult;\n\n\t/**\n\t * Additional transaction validation when the transaction is closed.\n\t * @param state - The current state of the transaction.\n\t * @returns The new state reflecting the closed transaction, or a failure if the transaction cannot be closed.\n\t */\n\tvalidateOnClose(state: SucceedingTransactionState): ChangeResult;\n}\n\n/**\n * A mutable transaction for applying sequences of changes to a TreeView.\n * Allows viewing the intermediate states.\n *\n * Contains necessary state to apply changes within an edit to a TreeView.\n *\n * May have any number of changes applied to make up the edit.\n * Use `close` to complete the transaction, returning the array of changes and an EditingResult showing the\n * results of applying the changes as an Edit to the initial TreeView (passed to the constructor).\n *\n * No data outside the Transaction is modified by Transaction:\n * the results from `close` must be used to actually submit an `Edit`.\n * @public\n */\nexport namespace TransactionInternal {\n\t/**\n\t * Makes a new {@link GenericTransaction} that follows the {@link TransactionInternal.Policy} policy.\n\t */\n\texport function factory(view: RevisionView): GenericTransaction {\n\t\treturn new GenericTransaction(view, new Policy());\n\t}\n\n\ttype ValidState = SucceedingTransactionState;\n\n\t/**\n\t * The policy followed by a {@link TransactionInternal}.\n\t */\n\texport class Policy implements GenericTransactionPolicy {\n\t\t/**\n\t\t * Maps detached sequences of nodes to their NodeIds\n\t\t */\n\t\tprotected readonly detached: Map<DetachedSequenceId, readonly NodeId[]> = new Map();\n\n\t\t/**\n\t\t * Resolves change with Result.Ok\n\t\t *\n\t\t * @param state - Unused\n\t\t * @param change - Change to resolve\n\t\t * @returns Result.Ok which contains change\n\t\t */\n\t\tpublic tryResolveChange(state: ValidState, change: ChangeInternal): Result.Ok<ChangeInternal> {\n\t\t\treturn Result.ok(change);\n\t\t}\n\n\t\t/**\n\t\t * Validates the transaction when it is closed\n\t\t *\n\t\t * @param state - Current state\n\t\t * @returns a {@link ChangeResult} containing either the change result or a Failure\n\t\t */\n\t\tpublic validateOnClose(state: ValidState): ChangeResult {\n\t\t\t// Making the policy choice that storing a detached sequences in an edit but not using it is an error.\n\t\t\treturn this.detached.size !== 0\n\t\t\t\t? Result.error({\n\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\tkind: FailureKind.UnusedDetachedSequence,\n\t\t\t\t\t\t\tsequenceId: this.detached.keys().next().value,\n\t\t\t\t\t\t},\n\t\t\t\t })\n\t\t\t\t: Result.ok(state.view);\n\t\t}\n\n\t\t/**\n\t\t * Applies a given change\n\t\t *\n\t\t * @param state - Current state\n\t\t * @param change - Change to apply\n\t\t * @returns a {@link ChangeResult} containing either the change result or a Failure\n\t\t */\n\t\tpublic dispatchChange(state: ValidState, change: ChangeInternal): ChangeResult {\n\t\t\tswitch (change.type) {\n\t\t\t\tcase ChangeTypeInternal.Build:\n\t\t\t\t\treturn this.applyBuild(state, change);\n\t\t\t\tcase ChangeTypeInternal.Insert:\n\t\t\t\t\treturn this.applyInsert(state, change);\n\t\t\t\tcase ChangeTypeInternal.Detach:\n\t\t\t\t\treturn this.applyDetach(state, change);\n\t\t\t\tcase ChangeTypeInternal.Constraint:\n\t\t\t\t\treturn this.applyConstraint(state, change);\n\t\t\t\tcase ChangeTypeInternal.SetValue:\n\t\t\t\t\treturn this.applySetValue(state, change);\n\t\t\t\tdefault:\n\t\t\t\t\treturn fail('Attempted to apply unsupported change');\n\t\t\t}\n\t\t}\n\n\t\tprivate applyBuild(state: ValidState, change: BuildInternal): ChangeResult {\n\t\t\tif (this.detached.has(change.destination)) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: change.destination,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet idAlreadyPresent: NodeId | undefined;\n\t\t\tlet duplicateIdInBuild: NodeId | undefined;\n\t\t\tlet invalidId: NodeId | undefined;\n\t\t\tlet detachedSequenceNotFound: DetachedSequenceId | undefined;\n\t\t\tconst map = new Map<NodeId, TreeViewNode>();\n\t\t\tconst newIds = this.createViewNodesForTree(\n\t\t\t\tchange.source,\n\t\t\t\t(id, viewNode) => {\n\t\t\t\t\tif (map.has(id)) {\n\t\t\t\t\t\tduplicateIdInBuild = id;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.view.hasNode(viewNode.identifier)) {\n\t\t\t\t\t\tidAlreadyPresent = id;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmap.set(id, viewNode);\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\t(detachedId) => {\n\t\t\t\t\tdetachedSequenceNotFound = detachedId;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif (idAlreadyPresent !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.IdAlreadyInUse, change, id: idAlreadyPresent },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (duplicateIdInBuild !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: { kind: FailureKind.DuplicateIdInBuild, change, id: duplicateIdInBuild },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (invalidId !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.UnknownId, change, id: invalidId },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (detachedSequenceNotFound !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceNotFound,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: detachedSequenceNotFound,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst view = state.view.addNodes(map.values());\n\t\t\tthis.detached.set(\n\t\t\t\tchange.destination,\n\t\t\t\tnewIds ?? fail('Unhandled failure case in Transaction.createViewNodesForTree')\n\t\t\t);\n\t\t\treturn Result.ok(view);\n\t\t}\n\n\t\tprivate applyInsert(state: ValidState, change: InsertInternal): ChangeResult {\n\t\t\tconst source = this.detached.get(change.source);\n\t\t\tif (source === undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceNotFound,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: change.source,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst validatedDestination = validateStablePlace(state.view, change.destination);\n\t\t\tif (validatedDestination.result !== PlaceValidationResult.Valid) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus:\n\t\t\t\t\t\tvalidatedDestination.result === PlaceValidationResult.Malformed\n\t\t\t\t\t\t\t? EditStatus.Malformed\n\t\t\t\t\t\t\t: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.BadPlace,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tplace: change.destination,\n\t\t\t\t\t\tplaceFailure: validatedDestination.result,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.detached.delete(change.source);\n\t\t\tconst view = insertIntoTrait(state.view, source, validatedDestination);\n\t\t\treturn Result.ok(view);\n\t\t}\n\n\t\tprivate applyDetach(state: ValidState, change: DetachInternal): ChangeResult {\n\t\t\tconst validatedSource = validateStableRange(state.view, change.source);\n\t\t\tif (validatedSource.result !== RangeValidationResultKind.Valid) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus:\n\t\t\t\t\t\tvalidatedSource.result === RangeValidationResultKind.PlacesInDifferentTraits ||\n\t\t\t\t\t\tvalidatedSource.result === RangeValidationResultKind.Inverted ||\n\t\t\t\t\t\tvalidatedSource.result.placeFailure !== PlaceValidationResult.Malformed\n\t\t\t\t\t\t\t? EditStatus.Invalid\n\t\t\t\t\t\t\t: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.BadRange,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\trange: change.source,\n\t\t\t\t\t\trangeFailure: validatedSource.result,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst result = detachRange(state.view, validatedSource);\n\t\t\tlet modifiedView = result.view;\n\t\t\tconst { detached } = result;\n\n\t\t\t// Store or dispose detached\n\t\t\tif (change.destination !== undefined) {\n\t\t\t\tif (this.detached.has(change.destination)) {\n\t\t\t\t\treturn Result.error({\n\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\tkind: FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\t\t\t\tchange,\n\t\t\t\t\t\t\tsequenceId: change.destination,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.detached.set(change.destination, detached);\n\t\t\t} else {\n\t\t\t\tmodifiedView = modifiedView.deleteNodes(detached);\n\t\t\t}\n\t\t\treturn Result.ok(modifiedView);\n\t\t}\n\n\t\tprivate applyConstraint(state: ValidState, change: ConstraintInternal): ChangeResult {\n\t\t\t// TODO: Implement identityHash and contentHash\n\t\t\tassert(change.identityHash === undefined, 'identityHash constraint is not implemented');\n\t\t\tassert(change.contentHash === undefined, 'contentHash constraint is not implemented');\n\n\t\t\tconst validatedChange = validateStableRange(state.view, change.toConstrain);\n\t\t\tif (validatedChange.result !== RangeValidationResultKind.Valid) {\n\t\t\t\treturn validatedChange.result !== RangeValidationResultKind.PlacesInDifferentTraits &&\n\t\t\t\t\tvalidatedChange.result !== RangeValidationResultKind.Inverted &&\n\t\t\t\t\tvalidatedChange.result.placeFailure !== PlaceValidationResult.Malformed\n\t\t\t\t\t? change.effect === ConstraintEffect.ValidRetry\n\t\t\t\t\t\t? Result.ok(state.view)\n\t\t\t\t\t\t: Result.error({\n\t\t\t\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadRange,\n\t\t\t\t\t\t\t\t\t\trangeFailure: validatedChange.result,\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 })\n\t\t\t\t\t: Result.error({\n\t\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadRange,\n\t\t\t\t\t\t\t\t\trangeFailure: validatedChange.result,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t });\n\t\t\t}\n\n\t\t\tconst { start, end } = rangeFromStableRange(state.view, validatedChange);\n\t\t\tconst startIndex = state.view.findIndexWithinTrait(start);\n\t\t\tconst endIndex = state.view.findIndexWithinTrait(end);\n\n\t\t\tif (change.length !== undefined && change.length !== endIndex - startIndex) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadLength,\n\t\t\t\t\t\t\tactual: endIndex - startIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (change.parentNode !== undefined && change.parentNode !== end.trait.parent) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadParent,\n\t\t\t\t\t\t\tactual: change.parentNode,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (change.label !== undefined && change.label !== end.trait.label) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadLabel,\n\t\t\t\t\t\t\tactual: end.trait.label,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn Result.ok(state.view);\n\t\t}\n\n\t\tprivate applySetValue(state: ValidState, change: SetValueInternal): ChangeResult {\n\t\t\tif (!state.view.hasNode(change.nodeToModify)) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.UnknownId, change, id: change.nodeToModify },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst newView = state.view.setNodeValue(change.nodeToModify, change.payload);\n\t\t\treturn Result.ok(newView);\n\t\t}\n\n\t\t/**\n\t\t * Generates tree view nodes from the supplied edit nodes.\n\t\t * Invokes onCreateNode for each new node, and halts creation early if it returns true.\n\t\t * Invokes onInvalidDetachedId and halts early for any invalid detached IDs referenced in the edit node sequence.\n\t\t * @returns all the top-level node IDs in `sequence` (both from nodes and from detached sequences).\n\t\t */\n\t\tprotected createViewNodesForTree(\n\t\t\tsequence: Iterable<BuildNodeInternal>,\n\t\t\tonCreateNode: (stableId: NodeId, node: TreeViewNode) => boolean,\n\t\t\tonInvalidDetachedId: (sequenceId: DetachedSequenceId) => void\n\t\t): NodeId[] | undefined {\n\t\t\tconst topLevelIds: NodeId[] = [];\n\t\t\tconst unprocessed: BuildNodeInternal[] = [];\n\t\t\tfor (const buildNode of sequence) {\n\t\t\t\tif (isDetachedSequenceId(buildNode)) {\n\t\t\t\t\tconst detachedIds = this.getDetachedNodeIds(buildNode, onInvalidDetachedId);\n\t\t\t\t\tif (detachedIds === undefined) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\ttopLevelIds.push(...detachedIds);\n\t\t\t\t} else {\n\t\t\t\t\tunprocessed.push(buildNode);\n\t\t\t\t\ttopLevelIds.push(buildNode.identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (unprocessed.length > 0) {\n\t\t\t\tconst node = unprocessed.pop();\n\t\t\t\tassert(node !== undefined && !isDetachedSequenceId(node));\n\t\t\t\tconst traits = new Map<TraitLabel, readonly NodeId[]>();\n\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\tfor (const key in node.traits) {\n\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(node.traits, key)) {\n\t\t\t\t\t\tconst children = node.traits[key];\n\t\t\t\t\t\tif (children.length > 0) {\n\t\t\t\t\t\t\tconst childIds: NodeId[] = [];\n\t\t\t\t\t\t\tfor (const child of children) {\n\t\t\t\t\t\t\t\tif (isDetachedSequenceId(child)) {\n\t\t\t\t\t\t\t\t\tconst detachedIds = this.getDetachedNodeIds(child, onInvalidDetachedId);\n\t\t\t\t\t\t\t\t\tif (detachedIds === undefined) {\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchildIds.push(...detachedIds);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tchildIds.push(child.identifier);\n\t\t\t\t\t\t\t\t\tunprocessed.push(child);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttraits.set(key as TraitLabel, childIds);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst newNode: TreeViewNode = {\n\t\t\t\t\tidentifier: node.identifier,\n\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\ttraits,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(node, newNode, 'payload');\n\t\t\t\tif (onCreateNode(node.identifier, newNode)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn topLevelIds;\n\t\t}\n\n\t\tprivate getDetachedNodeIds(\n\t\t\tdetachedId: DetachedSequenceId,\n\t\t\tonInvalidDetachedId: (sequenceId: DetachedSequenceId) => void\n\t\t): readonly NodeId[] | undefined {\n\t\t\t// Retrieve the detached sequence from the void.\n\t\t\tconst detachedNodeIds = this.detached.get(detachedId);\n\t\t\tif (detachedNodeIds === undefined) {\n\t\t\t\tonInvalidDetachedId(detachedId);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Since we have retrieved the sequence, remove it from the void to prevent a second tree from multi-parenting it later\n\t\t\tthis.detached.delete(detachedId);\n\t\t\treturn detachedNodeIds;\n\t\t}\n\t}\n\n\t/**\n\t * The kinds of failures that a transaction might encounter.\n\t */\n\texport enum FailureKind {\n\t\t/**\n\t\t * Transaction has an unused DetachedSequenceId\n\t\t */\n\t\tUnusedDetachedSequence = 'UnusedDetachedSequence',\n\t\t/**\n\t\t * Transaction has a build operation using an already in use DetachedSequenceID.\n\t\t */\n\t\tDetachedSequenceIdAlreadyInUse = 'DetachedSequenceIdAlreadyInUse',\n\t\t/**\n\t\t * Transaction tries to operate on an unknown DetachedSequenceID\n\t\t */\n\t\tDetachedSequenceNotFound = 'DetachedSequenceNotFound',\n\t\t/**\n\t\t * Transaction has a build which uses a duplicated NodeId\n\t\t */\n\t\tDuplicateIdInBuild = 'DuplicateIdInBuild',\n\t\t/**\n\t\t * Transaction tries to build a node using an ID which is already used in the current state\n\t\t */\n\t\tIdAlreadyInUse = 'IdAlreadyInUse',\n\t\t/**\n\t\t * Transaction tries to set value of an unknown node\n\t\t */\n\t\tUnknownId = 'UnknownId',\n\t\t/**\n\t\t * Transaction tries to insert in an invalid Place\n\t\t */\n\t\tBadPlace = 'BadPlace',\n\t\t/**\n\t\t * Transaction tries to detach an invalid Range\n\t\t */\n\t\tBadRange = 'BadRange',\n\t\t/**\n\t\t * Transaction has an invalid constraint\n\t\t */\n\t\tConstraintViolation = 'ConstraintViolation',\n\t}\n\n\t/**\n\t * A failure encountered by a transaction.\n\t */\n\texport type Failure =\n\t\t| UnusedDetachedSequenceFailure\n\t\t| DetachedSequenceIdAlreadyInUseFailure\n\t\t| DetachedSequenceNotFoundFailure\n\t\t| DuplicateIdInBuildFailure\n\t\t| IdAlreadyInUseFailure\n\t\t| UnknownIdFailure\n\t\t| BadPlaceFailure\n\t\t| BadRangeFailure\n\t\t| ConstraintViolationFailure;\n\n\t/**\n\t * Error returned when a transaction is closed while there is an unused detached sequence.\n\t */\n\texport interface UnusedDetachedSequenceFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.UnusedDetachedSequence)\n\t\t */\n\t\treadonly kind: FailureKind.UnusedDetachedSequence;\n\t\t/**\n\t\t * The unused DetachedSequenceId\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a transaction encounters a build operation using an already in use DetachedSequenceID.\n\t */\n\texport interface DetachedSequenceIdAlreadyInUseFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DetachedSequenceIdAlreadyInUse)\n\t\t */\n\t\treadonly kind: FailureKind.DetachedSequenceIdAlreadyInUse;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The DetachedSequenceId that is already in use\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a transaction tries to operate on an unknown DetachedSequenceID\n\t */\n\texport interface DetachedSequenceNotFoundFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DetachedSequenceNotFound)\n\t\t */\n\t\treadonly kind: FailureKind.DetachedSequenceNotFound;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The DetachedSequenceId that wasn't found\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a build uses a duplicated NodeId\n\t */\n\texport interface DuplicateIdInBuildFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DuplicateIdInBuild)\n\t\t */\n\t\treadonly kind: FailureKind.DuplicateIdInBuild;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * ID of duplicated node\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when a build node ID is already used in the current state\n\t */\n\texport interface IdAlreadyInUseFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.IdAlreadyInUse)\n\t\t */\n\t\treadonly kind: FailureKind.IdAlreadyInUse;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * ID of already in use node\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when a change is attempted on an unknown NodeId\n\t */\n\texport interface UnknownIdFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.UnknownId)\n\t\t */\n\t\treadonly kind: FailureKind.UnknownId;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The unknown ID\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when an insert change uses an invalid Place\n\t */\n\texport interface BadPlaceFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.BadPlace)\n\t\t */\n\t\treadonly kind: FailureKind.BadPlace;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The faulting place\n\t\t */\n\t\treadonly place: StablePlaceInternal;\n\t\t/**\n\t\t * The reason for the failure\n\t\t */\n\t\treadonly placeFailure: BadPlaceValidationResult;\n\t}\n\n\t/**\n\t * Error thrown when a detach operation is given an invalid or malformed Range\n\t */\n\texport interface BadRangeFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.BadRange)\n\t\t */\n\t\treadonly kind: FailureKind.BadRange;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * Faulting range\n\t\t */\n\t\treadonly range: StableRangeInternal;\n\t\t/**\n\t\t * The reason for the failure\n\t\t */\n\t\treadonly rangeFailure: BadRangeValidationResult;\n\t}\n\n\t/**\n\t * Error thrown when a constraint fails to apply\n\t */\n\texport interface ConstraintViolationFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.ConstraintViolation)\n\t\t */\n\t\treadonly kind: FailureKind.ConstraintViolation;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly constraint: ConstraintInternal;\n\t\t/**\n\t\t * The first violation the constraint encounters (there may be others).\n\t\t */\n\t\treadonly violation: ConstraintViolationResult;\n\t}\n\n\t/**\n\t * The details of what kind of constraint was violated and caused a ConstraintViolationFailure error to occur\n\t */\n\texport type ConstraintViolationResult =\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadRange;\n\t\t\t\treadonly rangeFailure: BadRangeValidationResult;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadLength;\n\t\t\t\treadonly actual: number;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadParent;\n\t\t\t\treadonly actual: NodeId;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadLabel;\n\t\t\t\treadonly actual: TraitLabel;\n\t\t };\n\n\t/**\n\t * Enum of possible kinds of constraint violations that can be encountered\n\t */\n\texport enum ConstraintViolationKind {\n\t\t/**\n\t\t * The constraint failed because it applies to an invalid range\n\t\t */\n\t\tBadRange = 'BadRange',\n\t\t/**\n\t\t * The constraint failed because the length prescribed by the constraint does not match the length of range being constrained\n\t\t */\n\t\tBadLength = 'BadLength',\n\t\t/**\n\t\t * The constraint failed because the parent prescribed by the constraint does not match the actual parent of the range being constrained\n\t\t */\n\t\tBadParent = 'BadParent',\n\t\t/**\n\t\t * The constraint failed because the trait label prescribed by the constraint does not match the actual trait label of the range being constrained\n\t\t */\n\t\tBadLabel = 'BadLabel',\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TransactionInternal.js","sourceRoot":"","sources":["../src/TransactionInternal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAuE;AACvE,+CAA6F;AAC7F,2DAA2D;AAC3D,uDAa2B;AAC3B,mDASyB;AA4IzB;;;;;;;;;;;;GAYG;AACH,MAAa,kBAAkB;IAM9B;;;OAGG;IACH,YAAmB,IAA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;IACH,IAAY,WAqCX;IArCD,WAAY,WAAW;QACtB;;WAEG;QACH,gEAAiD,CAAA;QACjD;;WAEG;QACH,gFAAiE,CAAA;QACjE;;WAEG;QACH,oEAAqD,CAAA;QACrD;;WAEG;QACH,wDAAyC,CAAA;QACzC;;WAEG;QACH,gDAAiC,CAAA;QACjC;;WAEG;QACH,sCAAuB,CAAA;QACvB;;WAEG;QACH,oCAAqB,CAAA;QACrB;;WAEG;QACH,oCAAqB,CAAA;QACrB;;WAEG;QACH,0DAA2C,CAAA;IAC5C,CAAC,EArCW,WAAW,GAAX,+BAAW,KAAX,+BAAW,QAqCtB;IA2MD;;OAEG;IACH,IAAY,uBAiBX;IAjBD,WAAY,uBAAuB;QAClC;;WAEG;QACH,gDAAqB,CAAA;QACrB;;WAEG;QACH,kDAAuB,CAAA;QACvB;;WAEG;QACH,kDAAuB,CAAA;QACvB;;WAEG;QACH,gDAAqB,CAAA;IACtB,CAAC,EAjBW,uBAAuB,GAAvB,2CAAuB,KAAvB,2CAAuB,QAiBlC;AACF,CAAC,EAvpBgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAupBnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, copyPropertyIfDefined, fail, Result } from './Common';\nimport { NodeId, DetachedSequenceId, TraitLabel, isDetachedSequenceId } from './Identifiers';\nimport { rangeFromStableRange } from './TreeViewUtilities';\nimport {\n\tBuildInternal,\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tConstraintEffect,\n\tConstraintInternal,\n\tDetachInternal,\n\tEditStatus,\n\tInsertInternal,\n\tSetValueInternal,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n} from './persisted-types';\nimport {\n\tdetachRange,\n\tinsertIntoTrait,\n\tvalidateStablePlace,\n\tvalidateStableRange,\n\tBadPlaceValidationResult,\n\tBadRangeValidationResult,\n\tPlaceValidationResult,\n\tRangeValidationResultKind,\n} from './EditUtilities';\nimport { RevisionView, TransactionView } from './RevisionView';\nimport { ReconciliationChange, ReconciliationPath } from './ReconciliationPath';\nimport { TreeViewNode } from './TreeView';\n\n/**\n * Result of applying a transaction.\n * @public\n */\nexport type EditingResult = FailedEditingResult | ValidEditingResult;\n\n/**\n * Basic result of applying a transaction.\n * @public\n */\nexport interface EditingResultBase {\n\t/**\n\t * The final status of the transaction.\n\t */\n\treadonly status: EditStatus;\n\t/**\n\t * The valid changes applied as part of the transaction.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied as part of the transaction.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n\t/**\n\t * The revision preceding the transaction.\n\t */\n\treadonly before: RevisionView;\n}\n\n/**\n * Result of applying an invalid or malformed transaction.\n * @public\n */\nexport interface FailedEditingResult extends EditingResultBase {\n\t/**\n\t * {@inheritDoc EditingResultBase.status}\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about what caused the transaction to fail.\n\t */\n\treadonly failure: TransactionInternal.Failure;\n\t/**\n\t * The valid changes applied as part of the transaction.\n\t * Those were ultimately abandoned due to the transaction failure.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied as part of the transaction.\n\t * Those were ultimately abandoned due to the transaction failure.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * Result of applying a valid transaction.\n * @public\n */\nexport interface ValidEditingResult extends EditingResultBase {\n\t/**\n\t * {@inheritDoc EditingResultBase.status}\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The new revision produced by the transaction.\n\t */\n\treadonly after: RevisionView;\n}\n\n/**\n * The result of applying a change within a transaction.\n * @public\n */\nexport type ChangeResult = Result<TransactionView, TransactionFailure>;\n\n/**\n * The ongoing state of a transaction.\n * @public\n */\nexport type TransactionState = SucceedingTransactionState | FailingTransactionState;\n\n/**\n * The state of a transaction that has not encountered an error.\n */\nexport interface SucceedingTransactionState {\n\t/**\n\t * The current status of the transaction.\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The view reflecting the latest applied change.\n\t */\n\treadonly view: TransactionView;\n\t/**\n\t * The applied changes so far.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied so far.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The state of a transaction that has encountered an error.\n */\nexport interface FailingTransactionState extends TransactionFailure {\n\t/**\n\t * The view reflecting the latest applied change.\n\t */\n\treadonly view: TransactionView;\n\t/**\n\t * The applied changes so far.\n\t */\n\treadonly changes: readonly ChangeInternal[];\n\t/**\n\t * The editing steps applied so far.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The failure state of a transaction.\n */\nexport interface TransactionFailure {\n\t/**\n\t * The status indicating the kind of failure encountered.\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about what caused the transaction to fail.\n\t */\n\treadonly failure: TransactionInternal.Failure;\n}\n\n/**\n * A mutable transaction for applying sequences of changes to a TreeView.\n * Allows viewing the intermediate states.\n *\n * Contains necessary state to apply changes within an edit to a TreeView.\n *\n * May have any number of changes applied to make up the edit.\n * Use `close` to complete the transaction, returning the array of changes and an EditingResult showing the\n * results of applying the changes as an Edit to the initial TreeView (passed to the constructor).\n *\n * No data outside the Transaction is modified by Transaction:\n * the results from `close` must be used to actually submit an `Edit`.\n */\nexport class GenericTransaction {\n\tprivate readonly policy: GenericTransactionPolicy;\n\tprotected readonly before: RevisionView;\n\tprivate state: TransactionState;\n\tprivate open = true;\n\n\t/**\n\t * Create and open an edit of the provided `TreeView`. After applying 0 or more changes, this editor should be closed via `close()`.\n\t * @param view - the `TreeView` at which this edit begins. The first change will be applied against this view.\n\t */\n\tpublic constructor(view: RevisionView, policy: GenericTransactionPolicy) {\n\t\tthis.before = view;\n\t\tthis.policy = policy;\n\t\tthis.state = {\n\t\t\tview: view.openForTransaction(),\n\t\t\tstatus: EditStatus.Applied,\n\t\t\tchanges: [],\n\t\t\tsteps: [],\n\t\t};\n\t}\n\n\t/** Whether or not this transaction has been closed via `close()` */\n\tpublic get isOpen(): boolean {\n\t\treturn this.open;\n\t}\n\n\t/**\n\t * The most up-to-date `TreeView` for this edit. This is the state of the tree after all changes applied so far.\n\t */\n\tpublic get view(): TransactionView {\n\t\treturn this.state.view;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get status(): EditStatus {\n\t\treturn this.state.status;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get changes(): readonly ChangeInternal[] {\n\t\treturn this.state.changes;\n\t}\n\n\t/**\n\t * The status code of the most recent attempted change.\n\t */\n\tpublic get steps(): readonly ReconciliationChange[] {\n\t\treturn this.state.steps;\n\t}\n\n\t/** @returns the final `EditStatus` and `TreeView` after all changes are applied. */\n\tpublic close(): EditingResult {\n\t\tassert(this.open, 'transaction has already been closed');\n\t\tthis.open = false;\n\t\tif (this.state.status === EditStatus.Applied) {\n\t\t\tconst validation = this.policy.validateOnClose(this.state);\n\t\t\tif (Result.isOk(validation)) {\n\t\t\t\tif (validation.result !== this.view) {\n\t\t\t\t\tthis.state = { ...this.state, view: validation.result };\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\tsteps: this.steps,\n\t\t\t\t\tchanges: this.changes,\n\t\t\t\t\tbefore: this.before,\n\t\t\t\t\tafter: this.view.close(),\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis.state = { ...this.state, ...validation.error };\n\t\t\treturn {\n\t\t\t\t...validation.error,\n\t\t\t\tsteps: this.steps,\n\t\t\t\tchanges: this.changes,\n\t\t\t\tbefore: this.before,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tstatus: this.state.status,\n\t\t\tfailure: this.state.failure,\n\t\t\tsteps: this.steps,\n\t\t\tchanges: this.changes,\n\t\t\tbefore: this.before,\n\t\t};\n\t}\n\n\t/**\n\t * A helper to apply a sequence of changes. Changes will be applied one after the other. If a change fails to apply,\n\t * the remaining changes in `changes` will be ignored.\n\t * @param changes - the sequence of changes to apply.\n\t * @param path - the reconciliation path for the first change.\n\t * @returns this\n\t */\n\tpublic applyChanges(changes: Iterable<ChangeInternal>, path: ReconciliationPath = []): this {\n\t\tconst iter = changes[Symbol.iterator]();\n\t\tconst firsChangeInternal = iter.next().value;\n\t\tlet iterResult = iter.next();\n\t\tif (iterResult.done === true) {\n\t\t\tfor (const change of changes) {\n\t\t\t\tif (this.applyChange(change, path).status !== EditStatus.Applied) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif (this.applyChange(firsChangeInternal, path).status !== EditStatus.Applied) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst ongoingEdit = {\n\t\t\t0: this.steps[this.steps.length - 1],\n\t\t\tbefore: this.view,\n\t\t\tafter: this.view,\n\t\t\tlength: 1,\n\t\t};\n\n\t\t/**\n\t\t * We use a Proxy instead of `{ ...path, ...objectWithOngoingEdit }` to avoid eagerly demanding all parts of the path, which may\n\t\t * require extensive computation.\n\t\t */\n\t\tconst pathWithOngoingEdit = new Proxy(path, {\n\t\t\tget: (target: ReconciliationPath, prop: string): ReconciliationPath[number | 'length'] => {\n\t\t\t\tif (prop === 'length') {\n\t\t\t\t\treturn target.length + 1;\n\t\t\t\t}\n\t\t\t\treturn prop === String(target.length) ? ongoingEdit : target[prop];\n\t\t\t},\n\t\t});\n\n\t\twhile (iterResult.done !== true) {\n\t\t\tif (this.applyChange(iterResult.value, pathWithOngoingEdit).status !== EditStatus.Applied) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tongoingEdit[ongoingEdit.length] = this.steps[this.steps.length - 1];\n\t\t\tongoingEdit.length += 1;\n\t\t\tongoingEdit.after = this.view;\n\t\t\titerResult = iter.next();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Attempt to apply the given change as part of this edit. This method should not be called if a previous change in this edit failed to\n\t * apply.\n\t * @param change - the change to apply\n\t * @param path - the reconciliation path for the change.\n\t * @returns this\n\t */\n\tpublic applyChange(change: ChangeInternal, path: ReconciliationPath = []): this {\n\t\tassert(this.open, 'Editor must be open to apply changes.');\n\t\tif (this.state.status !== EditStatus.Applied) {\n\t\t\tfail('Cannot apply change to an edit unless all previous changes have applied');\n\t\t}\n\t\tconst resolutionResult = this.policy.tryResolveChange(this.state, change, path);\n\t\tif (Result.isError(resolutionResult)) {\n\t\t\tthis.state = { ...this.state, ...resolutionResult.error };\n\t\t\treturn this;\n\t\t}\n\t\tconst resolvedChange = resolutionResult.result;\n\t\tconst changeResult = this.policy.dispatchChange(this.state, resolvedChange);\n\t\tthis.state = Result.isOk(changeResult)\n\t\t\t? {\n\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\tview: changeResult.result,\n\t\t\t\t\tchanges: this.changes.concat(change),\n\t\t\t\t\tsteps: this.steps.concat({ resolvedChange, after: changeResult.result }),\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\t...this.state,\n\t\t\t\t\t...changeResult.error,\n\t\t\t };\n\t\treturn this;\n\t}\n}\n\n/**\n * An object that encapsulates the rules and state pertaining to a specific subclass of {@link GenericTransaction}.\n * The characteristics that define such a subclass (and an implementation of this interface) are:\n * - The type of change that can be applied\n * - How those changes impact the state of the tree\n * - How those changes are resolved in the face of concurrent changes\n * - What makes a transaction valid\n * - The kind of situations that might lead to a transaction failure\n *\n * Instances of this type are passed to the {@link GenericTransaction} constructor.\n */\nexport interface GenericTransactionPolicy {\n\t/**\n\t * Given a change, attempts to derive an equivalent change which can be applied to the current state even if the given change was issued\n\t * over a different state. This can be used to apply a sequence of changes that were issued concurrently, i.e., without knowledge of\n\t * each other.\n\t * @param state - The current state on which the returned change will be applied.\n\t * @param change - The original change issued.\n\t * @param path - The reconciliation path for the change.\n\t * @returns The change to be applied to the current state, or a failure if the change cannot be resolved.\n\t */\n\ttryResolveChange(\n\t\tstate: SucceedingTransactionState,\n\t\tchange: ChangeInternal,\n\t\tpath: ReconciliationPath\n\t): Result<ChangeInternal, TransactionFailure>;\n\n\t/**\n\t * Provides a new state given the current state and a change to apply.\n\t * @param state - The current state on which the change is applied.\n\t * @param change - The change to apply to the current state.\n\t * @returns The new state reflecting the applied change, or a failure.\n\t */\n\tdispatchChange(state: SucceedingTransactionState, change: ChangeInternal): ChangeResult;\n\n\t/**\n\t * Additional transaction validation when the transaction is closed.\n\t * @param state - The current state of the transaction.\n\t * @returns The new state reflecting the closed transaction, or a failure if the transaction cannot be closed.\n\t */\n\tvalidateOnClose(state: SucceedingTransactionState): ChangeResult;\n}\n\n/**\n * A mutable transaction for applying sequences of changes to a TreeView.\n * Allows viewing the intermediate states.\n *\n * Contains necessary state to apply changes within an edit to a TreeView.\n *\n * May have any number of changes applied to make up the edit.\n * Use `close` to complete the transaction, returning the array of changes and an EditingResult showing the\n * results of applying the changes as an Edit to the initial TreeView (passed to the constructor).\n *\n * No data outside the Transaction is modified by Transaction:\n * the results from `close` must be used to actually submit an `Edit`.\n * @public\n */\nexport namespace TransactionInternal {\n\t/**\n\t * Makes a new {@link GenericTransaction} that follows the {@link TransactionInternal.Policy} policy.\n\t */\n\texport function factory(view: RevisionView): GenericTransaction {\n\t\treturn new GenericTransaction(view, new Policy());\n\t}\n\n\ttype ValidState = SucceedingTransactionState;\n\n\t/**\n\t * The policy followed by a {@link TransactionInternal}.\n\t */\n\texport class Policy implements GenericTransactionPolicy {\n\t\t/**\n\t\t * Maps detached sequences of nodes to their NodeIds\n\t\t */\n\t\tprotected readonly detached: Map<DetachedSequenceId, readonly NodeId[]> = new Map();\n\n\t\t/**\n\t\t * Resolves change with Result.Ok\n\t\t *\n\t\t * @param state - Unused\n\t\t * @param change - Change to resolve\n\t\t * @returns Result.Ok which contains change\n\t\t */\n\t\tpublic tryResolveChange(state: ValidState, change: ChangeInternal): Result.Ok<ChangeInternal> {\n\t\t\treturn Result.ok(change);\n\t\t}\n\n\t\t/**\n\t\t * Validates the transaction when it is closed\n\t\t *\n\t\t * @param state - Current state\n\t\t * @returns a {@link ChangeResult} containing either the change result or a Failure\n\t\t */\n\t\tpublic validateOnClose(state: ValidState): ChangeResult {\n\t\t\t// Making the policy choice that storing a detached sequences in an edit but not using it is an error.\n\t\t\treturn this.detached.size !== 0\n\t\t\t\t? Result.error({\n\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\tkind: FailureKind.UnusedDetachedSequence,\n\t\t\t\t\t\t\tsequenceId: this.detached.keys().next().value,\n\t\t\t\t\t\t},\n\t\t\t\t })\n\t\t\t\t: Result.ok(state.view);\n\t\t}\n\n\t\t/**\n\t\t * Applies a given change\n\t\t *\n\t\t * @param state - Current state\n\t\t * @param change - Change to apply\n\t\t * @returns a {@link ChangeResult} containing either the change result or a Failure\n\t\t */\n\t\tpublic dispatchChange(state: ValidState, change: ChangeInternal): ChangeResult {\n\t\t\tswitch (change.type) {\n\t\t\t\tcase ChangeTypeInternal.Build:\n\t\t\t\t\treturn this.applyBuild(state, change);\n\t\t\t\tcase ChangeTypeInternal.Insert:\n\t\t\t\t\treturn this.applyInsert(state, change);\n\t\t\t\tcase ChangeTypeInternal.Detach:\n\t\t\t\t\treturn this.applyDetach(state, change);\n\t\t\t\tcase ChangeTypeInternal.Constraint:\n\t\t\t\t\treturn this.applyConstraint(state, change);\n\t\t\t\tcase ChangeTypeInternal.SetValue:\n\t\t\t\t\treturn this.applySetValue(state, change);\n\t\t\t\tdefault:\n\t\t\t\t\treturn fail('Attempted to apply unsupported change');\n\t\t\t}\n\t\t}\n\n\t\tprivate applyBuild(state: ValidState, change: BuildInternal): ChangeResult {\n\t\t\tif (this.detached.has(change.destination)) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: change.destination,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet idAlreadyPresent: NodeId | undefined;\n\t\t\tlet duplicateIdInBuild: NodeId | undefined;\n\t\t\tlet invalidId: NodeId | undefined;\n\t\t\tlet detachedSequenceNotFound: DetachedSequenceId | undefined;\n\t\t\tconst map = new Map<NodeId, TreeViewNode>();\n\t\t\tconst newIds = this.createViewNodesForTree(\n\t\t\t\tchange.source,\n\t\t\t\t(id, viewNode) => {\n\t\t\t\t\tif (map.has(id)) {\n\t\t\t\t\t\tduplicateIdInBuild = id;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.view.hasNode(viewNode.identifier)) {\n\t\t\t\t\t\tidAlreadyPresent = id;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tmap.set(id, viewNode);\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\t(detachedId) => {\n\t\t\t\t\tdetachedSequenceNotFound = detachedId;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif (idAlreadyPresent !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.IdAlreadyInUse, change, id: idAlreadyPresent },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (duplicateIdInBuild !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: { kind: FailureKind.DuplicateIdInBuild, change, id: duplicateIdInBuild },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (invalidId !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.UnknownId, change, id: invalidId },\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (detachedSequenceNotFound !== undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceNotFound,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: detachedSequenceNotFound,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst view = state.view.addNodes(map.values());\n\t\t\tthis.detached.set(\n\t\t\t\tchange.destination,\n\t\t\t\tnewIds ?? fail('Unhandled failure case in Transaction.createViewNodesForTree')\n\t\t\t);\n\t\t\treturn Result.ok(view);\n\t\t}\n\n\t\tprivate applyInsert(state: ValidState, change: InsertInternal): ChangeResult {\n\t\t\tconst source = this.detached.get(change.source);\n\t\t\tif (source === undefined) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.DetachedSequenceNotFound,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tsequenceId: change.source,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst validatedDestination = validateStablePlace(state.view, change.destination);\n\t\t\tif (validatedDestination.result !== PlaceValidationResult.Valid) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus:\n\t\t\t\t\t\tvalidatedDestination.result === PlaceValidationResult.Malformed\n\t\t\t\t\t\t\t? EditStatus.Malformed\n\t\t\t\t\t\t\t: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.BadPlace,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\tplace: change.destination,\n\t\t\t\t\t\tplaceFailure: validatedDestination.result,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.detached.delete(change.source);\n\t\t\tconst view = insertIntoTrait(state.view, source, validatedDestination);\n\t\t\treturn Result.ok(view);\n\t\t}\n\n\t\tprivate applyDetach(state: ValidState, change: DetachInternal): ChangeResult {\n\t\t\tconst validatedSource = validateStableRange(state.view, change.source);\n\t\t\tif (validatedSource.result !== RangeValidationResultKind.Valid) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus:\n\t\t\t\t\t\tvalidatedSource.result === RangeValidationResultKind.PlacesInDifferentTraits ||\n\t\t\t\t\t\tvalidatedSource.result === RangeValidationResultKind.Inverted ||\n\t\t\t\t\t\tvalidatedSource.result.placeFailure !== PlaceValidationResult.Malformed\n\t\t\t\t\t\t\t? EditStatus.Invalid\n\t\t\t\t\t\t\t: EditStatus.Malformed,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.BadRange,\n\t\t\t\t\t\tchange,\n\t\t\t\t\t\trange: change.source,\n\t\t\t\t\t\trangeFailure: validatedSource.result,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst result = detachRange(state.view, validatedSource);\n\t\t\tlet modifiedView = result.view;\n\t\t\tconst { detached } = result;\n\n\t\t\t// Store or dispose detached\n\t\t\tif (change.destination !== undefined) {\n\t\t\t\tif (this.detached.has(change.destination)) {\n\t\t\t\t\treturn Result.error({\n\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\tkind: FailureKind.DetachedSequenceIdAlreadyInUse,\n\t\t\t\t\t\t\tchange,\n\t\t\t\t\t\t\tsequenceId: change.destination,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.detached.set(change.destination, detached);\n\t\t\t} else {\n\t\t\t\tmodifiedView = modifiedView.deleteNodes(detached);\n\t\t\t}\n\t\t\treturn Result.ok(modifiedView);\n\t\t}\n\n\t\tprivate applyConstraint(state: ValidState, change: ConstraintInternal): ChangeResult {\n\t\t\t// TODO: Implement identityHash and contentHash\n\t\t\tassert(change.identityHash === undefined, 'identityHash constraint is not implemented');\n\t\t\tassert(change.contentHash === undefined, 'contentHash constraint is not implemented');\n\n\t\t\tconst validatedChange = validateStableRange(state.view, change.toConstrain);\n\t\t\tif (validatedChange.result !== RangeValidationResultKind.Valid) {\n\t\t\t\treturn validatedChange.result !== RangeValidationResultKind.PlacesInDifferentTraits &&\n\t\t\t\t\tvalidatedChange.result !== RangeValidationResultKind.Inverted &&\n\t\t\t\t\tvalidatedChange.result.placeFailure !== PlaceValidationResult.Malformed\n\t\t\t\t\t? change.effect === ConstraintEffect.ValidRetry\n\t\t\t\t\t\t? Result.ok(state.view)\n\t\t\t\t\t\t: Result.error({\n\t\t\t\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadRange,\n\t\t\t\t\t\t\t\t\t\trangeFailure: validatedChange.result,\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 })\n\t\t\t\t\t: Result.error({\n\t\t\t\t\t\t\tstatus: EditStatus.Malformed,\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadRange,\n\t\t\t\t\t\t\t\t\trangeFailure: validatedChange.result,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t });\n\t\t\t}\n\n\t\t\tconst { start, end } = rangeFromStableRange(state.view, validatedChange);\n\t\t\tconst startIndex = state.view.findIndexWithinTrait(start);\n\t\t\tconst endIndex = state.view.findIndexWithinTrait(end);\n\n\t\t\tif (change.length !== undefined && change.length !== endIndex - startIndex) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadLength,\n\t\t\t\t\t\t\tactual: endIndex - startIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (change.parentNode !== undefined && change.parentNode !== end.trait.parent) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadParent,\n\t\t\t\t\t\t\tactual: change.parentNode,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (change.label !== undefined && change.label !== end.trait.label) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: {\n\t\t\t\t\t\tkind: FailureKind.ConstraintViolation,\n\t\t\t\t\t\tconstraint: change,\n\t\t\t\t\t\tviolation: {\n\t\t\t\t\t\t\tkind: ConstraintViolationKind.BadLabel,\n\t\t\t\t\t\t\tactual: end.trait.label,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn Result.ok(state.view);\n\t\t}\n\n\t\tprivate applySetValue(state: ValidState, change: SetValueInternal): ChangeResult {\n\t\t\tif (!state.view.hasNode(change.nodeToModify)) {\n\t\t\t\treturn Result.error({\n\t\t\t\t\tstatus: EditStatus.Invalid,\n\t\t\t\t\tfailure: { kind: FailureKind.UnknownId, change, id: change.nodeToModify },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst newView = state.view.setNodeValue(change.nodeToModify, change.payload);\n\t\t\treturn Result.ok(newView);\n\t\t}\n\n\t\t/**\n\t\t * Generates tree view nodes from the supplied edit nodes.\n\t\t * Invokes onCreateNode for each new node, and halts creation early if it returns true.\n\t\t * Invokes onInvalidDetachedId and halts early for any invalid detached IDs referenced in the edit node sequence.\n\t\t * @returns all the top-level node IDs in `sequence` (both from nodes and from detached sequences).\n\t\t */\n\t\tprotected createViewNodesForTree(\n\t\t\tsequence: Iterable<BuildNodeInternal>,\n\t\t\tonCreateNode: (stableId: NodeId, node: TreeViewNode) => boolean,\n\t\t\tonInvalidDetachedId: (sequenceId: DetachedSequenceId) => void\n\t\t): NodeId[] | undefined {\n\t\t\tconst topLevelIds: NodeId[] = [];\n\t\t\tconst unprocessed: BuildNodeInternal[] = [];\n\t\t\tfor (const buildNode of sequence) {\n\t\t\t\tif (isDetachedSequenceId(buildNode)) {\n\t\t\t\t\tconst detachedIds = this.getDetachedNodeIds(buildNode, onInvalidDetachedId);\n\t\t\t\t\tif (detachedIds === undefined) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\ttopLevelIds.push(...detachedIds);\n\t\t\t\t} else {\n\t\t\t\t\tunprocessed.push(buildNode);\n\t\t\t\t\ttopLevelIds.push(buildNode.identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (unprocessed.length > 0) {\n\t\t\t\tconst node = unprocessed.pop();\n\t\t\t\tassert(node !== undefined && !isDetachedSequenceId(node));\n\t\t\t\tconst traits = new Map<TraitLabel, readonly NodeId[]>();\n\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\tfor (const key in node.traits) {\n\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(node.traits, key)) {\n\t\t\t\t\t\tconst children = node.traits[key];\n\t\t\t\t\t\tif (children.length > 0) {\n\t\t\t\t\t\t\tconst childIds: NodeId[] = [];\n\t\t\t\t\t\t\tfor (const child of children) {\n\t\t\t\t\t\t\t\tif (isDetachedSequenceId(child)) {\n\t\t\t\t\t\t\t\t\tconst detachedIds = this.getDetachedNodeIds(child, onInvalidDetachedId);\n\t\t\t\t\t\t\t\t\tif (detachedIds === undefined) {\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchildIds.push(...detachedIds);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tchildIds.push(child.identifier);\n\t\t\t\t\t\t\t\t\tunprocessed.push(child);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttraits.set(key as TraitLabel, childIds);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst newNode: TreeViewNode = {\n\t\t\t\t\tidentifier: node.identifier,\n\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\ttraits,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(node, newNode, 'payload');\n\t\t\t\tif (onCreateNode(node.identifier, newNode)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn topLevelIds;\n\t\t}\n\n\t\tprivate getDetachedNodeIds(\n\t\t\tdetachedId: DetachedSequenceId,\n\t\t\tonInvalidDetachedId: (sequenceId: DetachedSequenceId) => void\n\t\t): readonly NodeId[] | undefined {\n\t\t\t// Retrieve the detached sequence from the void.\n\t\t\tconst detachedNodeIds = this.detached.get(detachedId);\n\t\t\tif (detachedNodeIds === undefined) {\n\t\t\t\tonInvalidDetachedId(detachedId);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Since we have retrieved the sequence, remove it from the void to prevent a second tree from multi-parenting it later\n\t\t\tthis.detached.delete(detachedId);\n\t\t\treturn detachedNodeIds;\n\t\t}\n\t}\n\n\t/**\n\t * The kinds of failures that a transaction might encounter.\n\t */\n\texport enum FailureKind {\n\t\t/**\n\t\t * Transaction has an unused DetachedSequenceId\n\t\t */\n\t\tUnusedDetachedSequence = 'UnusedDetachedSequence',\n\t\t/**\n\t\t * Transaction has a build operation using an already in use DetachedSequenceID.\n\t\t */\n\t\tDetachedSequenceIdAlreadyInUse = 'DetachedSequenceIdAlreadyInUse',\n\t\t/**\n\t\t * Transaction tries to operate on an unknown DetachedSequenceID\n\t\t */\n\t\tDetachedSequenceNotFound = 'DetachedSequenceNotFound',\n\t\t/**\n\t\t * Transaction has a build which uses a duplicated NodeId\n\t\t */\n\t\tDuplicateIdInBuild = 'DuplicateIdInBuild',\n\t\t/**\n\t\t * Transaction tries to build a node using an ID which is already used in the current state\n\t\t */\n\t\tIdAlreadyInUse = 'IdAlreadyInUse',\n\t\t/**\n\t\t * Transaction tries to set value of an unknown node\n\t\t */\n\t\tUnknownId = 'UnknownId',\n\t\t/**\n\t\t * Transaction tries to insert in an invalid Place\n\t\t */\n\t\tBadPlace = 'BadPlace',\n\t\t/**\n\t\t * Transaction tries to detach an invalid Range\n\t\t */\n\t\tBadRange = 'BadRange',\n\t\t/**\n\t\t * Transaction has an invalid constraint\n\t\t */\n\t\tConstraintViolation = 'ConstraintViolation',\n\t}\n\n\t/**\n\t * A failure encountered by a transaction.\n\t */\n\texport type Failure =\n\t\t| UnusedDetachedSequenceFailure\n\t\t| DetachedSequenceIdAlreadyInUseFailure\n\t\t| DetachedSequenceNotFoundFailure\n\t\t| DuplicateIdInBuildFailure\n\t\t| IdAlreadyInUseFailure\n\t\t| UnknownIdFailure\n\t\t| BadPlaceFailure\n\t\t| BadRangeFailure\n\t\t| ConstraintViolationFailure;\n\n\t/**\n\t * Error returned when a transaction is closed while there is an unused detached sequence.\n\t */\n\texport interface UnusedDetachedSequenceFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.UnusedDetachedSequence)\n\t\t */\n\t\treadonly kind: FailureKind.UnusedDetachedSequence;\n\t\t/**\n\t\t * The unused DetachedSequenceId\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a transaction encounters a build operation using an already in use DetachedSequenceID.\n\t */\n\texport interface DetachedSequenceIdAlreadyInUseFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DetachedSequenceIdAlreadyInUse)\n\t\t */\n\t\treadonly kind: FailureKind.DetachedSequenceIdAlreadyInUse;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The DetachedSequenceId that is already in use\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a transaction tries to operate on an unknown DetachedSequenceID\n\t */\n\texport interface DetachedSequenceNotFoundFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DetachedSequenceNotFound)\n\t\t */\n\t\treadonly kind: FailureKind.DetachedSequenceNotFound;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The DetachedSequenceId that wasn't found\n\t\t */\n\t\treadonly sequenceId: DetachedSequenceId;\n\t}\n\n\t/**\n\t * Error thrown when a build uses a duplicated NodeId\n\t */\n\texport interface DuplicateIdInBuildFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.DuplicateIdInBuild)\n\t\t */\n\t\treadonly kind: FailureKind.DuplicateIdInBuild;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * ID of duplicated node\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when a build node ID is already used in the current state\n\t */\n\texport interface IdAlreadyInUseFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.IdAlreadyInUse)\n\t\t */\n\t\treadonly kind: FailureKind.IdAlreadyInUse;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * ID of already in use node\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when a change is attempted on an unknown NodeId\n\t */\n\texport interface UnknownIdFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.UnknownId)\n\t\t */\n\t\treadonly kind: FailureKind.UnknownId;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The unknown ID\n\t\t */\n\t\treadonly id: NodeId;\n\t}\n\n\t/**\n\t * Error thrown when an insert change uses an invalid Place\n\t */\n\texport interface BadPlaceFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.BadPlace)\n\t\t */\n\t\treadonly kind: FailureKind.BadPlace;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * The faulting place\n\t\t */\n\t\treadonly place: StablePlaceInternal;\n\t\t/**\n\t\t * The reason for the failure\n\t\t */\n\t\treadonly placeFailure: BadPlaceValidationResult;\n\t}\n\n\t/**\n\t * Error thrown when a detach operation is given an invalid or malformed Range\n\t */\n\texport interface BadRangeFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.BadRange)\n\t\t */\n\t\treadonly kind: FailureKind.BadRange;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly change: ChangeInternal;\n\t\t/**\n\t\t * Faulting range\n\t\t */\n\t\treadonly range: StableRangeInternal;\n\t\t/**\n\t\t * The reason for the failure\n\t\t */\n\t\treadonly rangeFailure: BadRangeValidationResult;\n\t}\n\n\t/**\n\t * Error thrown when a constraint fails to apply\n\t */\n\texport interface ConstraintViolationFailure {\n\t\t/**\n\t\t * Failure kind (will always be FailureKind.ConstraintViolation)\n\t\t */\n\t\treadonly kind: FailureKind.ConstraintViolation;\n\t\t/**\n\t\t * Faulting Change\n\t\t */\n\t\treadonly constraint: ConstraintInternal;\n\t\t/**\n\t\t * The first violation the constraint encounters (there may be others).\n\t\t */\n\t\treadonly violation: ConstraintViolationResult;\n\t}\n\n\t/**\n\t * The details of what kind of constraint was violated and caused a ConstraintViolationFailure error to occur\n\t */\n\texport type ConstraintViolationResult =\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadRange;\n\t\t\t\treadonly rangeFailure: BadRangeValidationResult;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadLength;\n\t\t\t\treadonly actual: number;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadParent;\n\t\t\t\treadonly actual: NodeId;\n\t\t }\n\t\t| {\n\t\t\t\treadonly kind: ConstraintViolationKind.BadLabel;\n\t\t\t\treadonly actual: TraitLabel;\n\t\t };\n\n\t/**\n\t * Enum of possible kinds of constraint violations that can be encountered\n\t */\n\texport enum ConstraintViolationKind {\n\t\t/**\n\t\t * The constraint failed because it applies to an invalid range\n\t\t */\n\t\tBadRange = 'BadRange',\n\t\t/**\n\t\t * The constraint failed because the length prescribed by the constraint does not match the length of range being constrained\n\t\t */\n\t\tBadLength = 'BadLength',\n\t\t/**\n\t\t * The constraint failed because the parent prescribed by the constraint does not match the actual parent of the range being constrained\n\t\t */\n\t\tBadParent = 'BadParent',\n\t\t/**\n\t\t * The constraint failed because the trait label prescribed by the constraint does not match the actual trait label of the range being constrained\n\t\t */\n\t\tBadLabel = 'BadLabel',\n\t}\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { ITelemetryLogger } from '@fluidframework/common-definitions';
|
|
5
6
|
import { LocalCompressedId, FinalCompressedId, SessionSpaceCompressedId, StableId, OpSpaceCompressedId, SessionId, CompressedId, AttributionId } from '../Identifiers';
|
|
6
7
|
import type { IdCreationRange, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, VersionedSerializedIdCompressor } from './persisted-types';
|
|
7
8
|
/**
|
|
@@ -84,6 +85,7 @@ export declare function isLocalId(id: CompressedId): id is LocalCompressedId;
|
|
|
84
85
|
export declare class IdCompressor {
|
|
85
86
|
readonly localSessionId: SessionId;
|
|
86
87
|
readonly reservedIdCount: number;
|
|
88
|
+
private readonly logger?;
|
|
87
89
|
/**
|
|
88
90
|
* Max allowed cluster size
|
|
89
91
|
*/
|
|
@@ -174,7 +176,7 @@ export declare class IdCompressor {
|
|
|
174
176
|
* this compressor will generate its own. An `AttributionId` is an `UuidString` which may be validated via
|
|
175
177
|
* {@link isUuidString} or generated via {@link generateStableId}.
|
|
176
178
|
*/
|
|
177
|
-
constructor(localSessionId: SessionId, reservedIdCount: number, attributionId?: AttributionId);
|
|
179
|
+
constructor(localSessionId: SessionId, reservedIdCount: number, attributionId?: AttributionId, logger?: ITelemetryLogger | undefined);
|
|
178
180
|
/**
|
|
179
181
|
* Creates a session object for the supplied ID.
|
|
180
182
|
* Must only be called once per ID.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCompressor.d.ts","sourceRoot":"","sources":["../../src/id-compressor/IdCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"IdCompressor.d.ts","sourceRoot":"","sources":["../../src/id-compressor/IdCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAetE,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,YAAY,EAEZ,aAAa,EACb,MAAM,gBAAgB,CAAC;AAaxB,OAAO,KAAK,EACX,eAAe,EAIf,mCAAmC,EACnC,wCAAwC,EAIxC,+BAA+B,EAC/B,MAAM,mBAAmB,CAAC;AA2E3B;;;GAGG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAQ1C;;;GAGG;AACH,eAAO,MAAM,6BAA6B,0CAA0C,CAAC;AAErF;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,YAA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