@fluid-experimental/tree 2.0.0-internal.5.1.1 → 2.0.0-internal.5.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-experimental/tree
2
2
 
3
+ ## 2.0.0-internal.5.2.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.5.1.0
4
8
 
5
9
  Dependency updates only.
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
6
- import { IDisposable, IErrorEvent } from '@fluidframework/common-definitions';
6
+ import { IErrorEvent } from '@fluidframework/common-definitions';
7
+ import { IDisposable } from '@fluidframework/core-interfaces';
7
8
  import { EditId } from './Identifiers';
8
9
  import { TreeView } from './TreeView';
9
10
  import { RevisionView } from './RevisionView';
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,6BAA6B,EAAuB,MAAM,iCAAiC,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAwB,MAAM,oCAAoC,CAAC;AAEpG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAA0D,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;GAGG;AACH,oBAAY,a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AO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACvD;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,4BAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD;AArWD,4BAqWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/common-utils';\nimport { ChildLogger, EventEmitterWithErrorHandling, ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';\nimport { IDisposable, IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { assertWithMessage, fail, RestOrArray, unwrapRestOrArray } from './Common';\nimport { EditId } from './Identifiers';\nimport { CachingLogViewer } from './LogViewer';\nimport { TreeView } from './TreeView';\nimport { RevisionView } from './RevisionView';\nimport { EditCommittedHandler, SharedTree } from './SharedTree';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types';\nimport { SharedTreeEvent } from './EventTypes';\nimport { newEditId } from './EditUtilities';\nimport { Change } from './ChangeTypes';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @public\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @public\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @public\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = ChildLogger.create(this.tree.logger, 'Checkout');\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t * @internal\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t) {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t * @returns - the result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
1
+ {"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,qEAAkH;AAGlH,qCAAmF;AAEnF,2CAA+C;AAI/C,+DAAmH;AACnH,uDAAqE;AACrE,6CAA+C;AAC/C,mDAA4C;AAG5C;;;GAGG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACxB;;;OAGG;IACH,0CAAyB,CAAA;AAC1B,CAAC,EANW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAMxB;AASD;;;GAGG;AACH,IAAY,oBAiBX;AAjBD,WAAY,oBAAoB;IAC/B;;;;OAIG;IACH,yEAAS,CAAA;IACT;;;;OAIG;IACH,qEAAO,CAAA;IACP;;OAEG;IACH,iEAAK,CAAA;AACN,CAAC,EAjBW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAiB/B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAsB,QAAS,SAAQ,+CAA8C;IA4CpF,YAAsB,IAAgB,EAAE,WAAyB,EAAE,eAAqC;QACvG,KAAK,CAAC,CAAC,MAAM,EAAE,KAAc,EAAE,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QALG,aAAQ,GAAY,KAAK,CAAC;QAMhC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,6BAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,SAAS,YAAY,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AAM,CAAC,CAAC;QACnD,MAAM,IAAI,GACT,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,mCAAI,IAAA,aAAI,EAAC,qDAAqD,CAAC,CAAC;QACzG,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;SACtC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;YAC5C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACvD;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,4BAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD;AArWD,4BAqWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/common-utils';\nimport { ChildLogger, EventEmitterWithErrorHandling, ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';\nimport { IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { IDisposable } from '@fluidframework/core-interfaces';\nimport { assertWithMessage, fail, RestOrArray, unwrapRestOrArray } from './Common';\nimport { EditId } from './Identifiers';\nimport { CachingLogViewer } from './LogViewer';\nimport { TreeView } from './TreeView';\nimport { RevisionView } from './RevisionView';\nimport { EditCommittedHandler, SharedTree } from './SharedTree';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types';\nimport { SharedTreeEvent } from './EventTypes';\nimport { newEditId } from './EditUtilities';\nimport { Change } from './ChangeTypes';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @public\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @public\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @public\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = ChildLogger.create(this.tree.logger, 'Checkout');\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t * @internal\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t) {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t * @returns - the result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
package/lib/Checkout.d.ts CHANGED
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
6
- import { IDisposable, IErrorEvent } from '@fluidframework/common-definitions';
6
+ import { IErrorEvent } from '@fluidframework/common-definitions';
7
+ import { IDisposable } from '@fluidframework/core-interfaces';
7
8
  import { EditId } from './Identifiers';
8
9
  import { TreeView } from './TreeView';
9
10
  import { RevisionView } from './RevisionView';
@@ -1 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microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/common-utils';\nimport { ChildLogger, EventEmitterWithErrorHandling, ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';\nimport { IDisposable, IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { assertWithMessage, fail, RestOrArray, unwrapRestOrArray } from './Common';\nimport { EditId } from './Identifiers';\nimport { CachingLogViewer } from './LogViewer';\nimport { TreeView } from './TreeView';\nimport { RevisionView } from './RevisionView';\nimport { EditCommittedHandler, SharedTree } from './SharedTree';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types';\nimport { SharedTreeEvent } from './EventTypes';\nimport { newEditId } from './EditUtilities';\nimport { Change } from './ChangeTypes';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @public\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @public\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @public\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = ChildLogger.create(this.tree.logger, 'Checkout');\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t * @internal\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t) {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t * @returns - the result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
1
+ {"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAuB,MAAM,iCAAiC,CAAC;AAGlH,OAAO,EAAE,iBAAiB,EAA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C,KAAK,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;SACtC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;YAC5C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACvD;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/common-utils';\nimport { ChildLogger, EventEmitterWithErrorHandling, ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';\nimport { IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { IDisposable } from '@fluidframework/core-interfaces';\nimport { assertWithMessage, fail, RestOrArray, unwrapRestOrArray } from './Common';\nimport { EditId } from './Identifiers';\nimport { CachingLogViewer } from './LogViewer';\nimport { TreeView } from './TreeView';\nimport { RevisionView } from './RevisionView';\nimport { EditCommittedHandler, SharedTree } from './SharedTree';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types';\nimport { SharedTreeEvent } from './EventTypes';\nimport { newEditId } from './EditUtilities';\nimport { Change } from './ChangeTypes';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @public\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @public\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @public\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = ChildLogger.create(this.tree.logger, 'Checkout');\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t * @internal\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t) {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t * @returns - the result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.tests.d.ts","sourceRoot":"","sources":["../../src/test/Summary.tests.ts"],"names":[],"mappings":"AAaA,OAAO,EAA+D,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE9G,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkB3C,wHAAwH;AACxH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAsF3D;AAED,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAmCpH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CA+NnD"}
1
+ {"version":3,"file":"Summary.tests.d.ts","sourceRoot":"","sources":["../../src/test/Summary.tests.ts"],"names":[],"mappings":"AAaA,OAAO,EAA+D,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE9G,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkB3C,wHAAwH;AACxH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAsF3D;AAED,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAmCpH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAwNnD"}
@@ -265,10 +265,6 @@ export function runSummaryTests(title) {
265
265
  await testObjectProvider.ensureSynchronized();
266
266
  await expectSharedTreesEqual(resubmitTree, tree);
267
267
  await expectSharedTreesEqual(tree, await createSummaryTestTree(WriteFormat.v0_1_1, true));
268
- // https://dev.azure.com/fluidframework/internal/_workitems/edit/3347
269
- const events = testObjectProvider.logger.reportAndClearTrackedEvents();
270
- expect(events.unexpectedErrors.length).to.equal(1);
271
- expect(events.unexpectedErrors[0].eventName).to.equal('fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch');
272
268
  });
273
269
  it('Normalizes a denormalized summary containing nodes with empty traits', async () => {
274
270
  const { tree } = await setUp011Tree({});
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.tests.js","sourceRoot":"","sources":["../../src/test/Summary.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM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C,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,EAAE,CAAa,CAAC;IAC3G,CAAC;;AA3BsB,kCAAS,GAAG,sCAAmD,CAAC;AAC/D,sCAAa,GAAG,sCAAsC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport * as fs from 'fs';\nimport { join } from 'path';\nimport { expect, assert } from 'chai';\nimport { v5 } from 'uuid';\nimport { Change, StablePlace, StableRange } from '../ChangeTypes';\nimport { fail, RecursiveMutable } from '../Common';\nimport { areRevisionViewsSemanticallyEqual } from '../EditUtilities';\nimport { EditId, NodeId, SessionId, StableId, TraitLabel } from '../Identifiers';\nimport { initialTree } from '../InitialTree';\nimport { reservedIdCount, SharedTreeSummary, SharedTreeSummary_0_0_2, WriteFormat } from '../persisted-types';\nimport { getChangeNodeFromView } from '../SerializationUtilities';\nimport { SharedTree } from '../SharedTree';\nimport { deserialize, getSummaryStatistics, SummaryStatistics } from '../SummaryBackCompatibility';\nimport { IdCompressor } from '../id-compressor';\nimport { convertEditIds } from '../IdConversion';\nimport { MutableStringInterner } from '../StringInterner';\nimport { sequencedIdNormalizer } from '../NodeIdUtilities';\nimport { expectDefined } from './utilities/TestCommon';\nimport { TestFluidSerializer } from './utilities/TestSerializer';\nimport {\n\tgetEditLogInternal,\n\tgetIdNormalizerFromSharedTree,\n\tmakeNodeIdContext,\n\tsetUpLocalServerTestSharedTree,\n\ttestDocumentsPathBase,\n} from './utilities/TestUtilities';\n\nconst directory = join(testDocumentsPathBase, 'summary-tests');\n\n/** Applies a smattering of interesting edits to the given shared tree in an attempt to cover a variety of use cases */\nexport function applyTestEdits(sharedTree: SharedTree): void {\n\tconst uuid = new DeterministicIdGenerator(sharedTree.getWriteFormat(), sharedTree);\n\n\tfunction applyEdit(changes: Change[]): void {\n\t\tconst internalChanges = changes.map((c) => sharedTree.internalizeChange(c));\n\t\tsharedTree.applyEditInternal({ id: uuid.getNextEditId(), changes: internalChanges });\n\t}\n\n\t/*\n\t * Build a tree that looks like the following:\n\t *\n\t * ROOT\n\t * | 'root'\n\t * [root]\n\t * 'left' / \\ 'right'\n\t * [A] [B, C, D]\n\t * | 'leaf'\n\t * [E('payload')]\n\t */\n\n\tconst cDetachedId = 0;\n\tconst rootDetachedId = 1;\n\tconst aId = uuid.getNextNodeId();\n\tconst cId = uuid.getNextNodeId();\n\tconst dId = uuid.getNextNodeId();\n\n\tapplyEdit([\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'C',\n\t\t\t\t\tidentifier: cId,\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleaf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdefinition: 'E',\n\t\t\t\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\t\t\t\tpayload: 'payload',\n\t\t\t\t\t\t\t},\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\tcDetachedId\n\t\t),\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'Root',\n\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleft: [{ definition: 'A', identifier: aId }],\n\t\t\t\t\t\tright: [\n\t\t\t\t\t\t\t{ definition: 'B', identifier: uuid.getNextNodeId() },\n\t\t\t\t\t\t\tcDetachedId,\n\t\t\t\t\t\t\t{ definition: 'D', identifier: dId },\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\trootDetachedId\n\t\t),\n\t\tChange.insert(\n\t\t\trootDetachedId,\n\t\t\tStablePlace.atStartOf({\n\t\t\t\tlabel: 'root' as TraitLabel,\n\t\t\t\tparent: sharedTree.convertToNodeId(initialTree.identifier),\n\t\t\t})\n\t\t),\n\t]);\n\n\t/**\n\t * Edit the tree\n\t *\n\t * 1. Move C after A\n\t * 2. Delete D\n\t * 3.\n\t * ...\n\t * 102. Set the payload of A to _i_ for all _i_ in 0...100\n\t */\n\n\tapplyEdit([...Change.move(StableRange.only(cId), StablePlace.after(aId))]);\n\tapplyEdit([Change.delete(StableRange.only(dId))]);\n\tfor (let i = 0; i < 100; i++) {\n\t\tapplyEdit([Change.setPayload(aId, i)]);\n\t}\n}\n\nexport async function createSummaryTestTree(writeFormat: WriteFormat, summarizeHistory: boolean): Promise<SharedTree> {\n\tconst { tree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat,\n\t\tsummarizeHistory,\n\t\tuploadEditChunks: summarizeHistory,\n\t});\n\n\tif (writeFormat === WriteFormat.v0_1_1) {\n\t\tconst idCompressor = new IdCompressor('968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId, reservedIdCount);\n\t\tconst interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst context = makeNodeIdContext(idCompressor);\n\t\tconst normalizer = sequencedIdNormalizer(context);\n\t\tconst sharedTreeSummaryWithConstantSessionId: SharedTreeSummary = {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tcurrentTree: summarizeHistory\n\t\t\t\t? [\n\t\t\t\t\t\tinterner.getOrCreateInternedId(initialTree.definition),\n\t\t\t\t\t\tnormalizer.normalizeToOpSpace(context.convertToNodeId(initialTree.identifier)),\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t\teditHistory: {\n\t\t\t\teditIds: [],\n\t\t\t\teditChunks: [],\n\t\t\t},\n\t\t\tidCompressor: idCompressor.serialize(true),\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t};\n\n\t\ttree.loadSummary(sharedTreeSummaryWithConstantSessionId);\n\t}\n\n\tapplyTestEdits(tree);\n\n\tawait testObjectProvider.ensureSynchronized();\n\treturn tree;\n}\n\nexport function runSummaryTests(title: string): void {\n\tdescribe(title, () => {\n\t\t// Note: this test serializer doesn't handle blobs properly (it just uses JSON.stringify/JSON.parse).\n\t\tconst testSerializer = new TestFluidSerializer();\n\n\t\tconst {\n\t\t\tsummaryFileWithHistory_0_0_2,\n\t\t\tsummaryFileNoHistory_0_0_2,\n\t\t\tsummaryFileEmptyTraits_0_0_2,\n\t\t\tsummaryFileWithHistory_0_1_1,\n\t\t\tsummaryFileNoHistory_0_1_1,\n\t\t\tsummaryFileUpgrade_0_1_1,\n\t\t} = loadSummaryTestFiles();\n\n\t\t// Re-enable this test for an easy way to write the test summary files to disk\n\t\tit.skip('save files to disk', async () => {\n\t\t\tawait makeSummaryTestFiles();\n\t\t});\n\n\t\tdescribe('0.0.2 write format', () => {\n\t\t\tconst setUp002Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_0_2, ...options });\n\n\t\t\tconst setUp002SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_0_2, summarizeHistory);\n\n\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({});\n\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\texpect(getChangeNodeFromView(tree.currentView)).deep.equals(\n\t\t\t\t\tgetChangeNodeFromView(expectedTree.currentView)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files without history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary_0_0_2> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary_0_0_2 = JSON.parse(summaryFileNoHistory_0_0_2);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\tsummary.sequencedEdits[0].id = expectedSummary.sequencedEdits[0].id;\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files with history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.0.2 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_0_2);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp002SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.0.2 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tconst expectedTree = await setUp002SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading next version', () => {\n\t\t\t\tit('reads 0.1.1', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\t// TODO: There may need to be a testObjectProvider synchronization here to upload\n\t\t\t\t\t// blobs from this summary.\n\t\t\t\t\t// We should also look at how this test asserts behavior w.r.t blobs.\n\t\t\t\t\tconst newSummary = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\t\tconst expectedSummary = JSON.parse(summaryFileWithHistory_0_1_1);\n\t\t\t\t\texpect(newSummary).to.deep.equal(expectedSummary);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_0_2, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_0_2,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('0.1.1 write format', () => {\n\t\t\tconst setUp011Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_1_1, ...options });\n\n\t\t\tconst setUp011SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_1_1, summarizeHistory);\n\n\t\t\tit('writes 0.1.1 files without history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary = JSON.parse(summaryFileNoHistory_0_1_1);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\texpectDefined(summary.editHistory).editIds[0] = expectDefined(expectedSummary.editHistory?.editIds[0]);\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t});\n\n\t\t\tit('writes 0.1.1 files with history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_1_1)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.1.1 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_1_1);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp011SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.1.1 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(false);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading previous versions', () => {\n\t\t\t\tit('reads 0.0.2', async () => {\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2', async () => {\n\t\t\t\t\tconst { tree, testObjectProvider } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\t// Synchronize to give a chance for the update op to be sequenced.\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileUpgrade_0_1_1)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2 that has several stale ops that it resubmits', async () => {\n\t\t\t\t\tconst { tree: resubmitTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t\t\t});\n\t\t\t\t\tapplyTestEdits(resubmitTree);\n\t\t\t\t\tconst { tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\t\t\ttestObjectProvider,\n\t\t\t\t\t});\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tawait expectSharedTreesEqual(resubmitTree, tree);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, await createSummaryTestTree(WriteFormat.v0_1_1, true));\n\n\t\t\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({});\n\t\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\texpect(\n\t\t\t\t\t\tareRevisionViewsSemanticallyEqual(\n\t\t\t\t\t\t\ttree.currentView,\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\texpectedTree.currentView,\n\t\t\t\t\t\t\texpectedTree\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\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_1_1, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst totalChunks = 1;\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t\ttotalNumberOfChunks: totalChunks,\n\t\t\t\t\tuploadedChunks: 0,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\t});\n}\n\nasync function expectSharedTreesEqual(\n\tsharedTreeA: SharedTree,\n\tsharedTreeB: SharedTree,\n\tcompareEditIds = true\n): Promise<void> {\n\tif (\n\t\t!areRevisionViewsSemanticallyEqual(sharedTreeA.currentView, sharedTreeA, sharedTreeB.currentView, sharedTreeB)\n\t) {\n\t\texpect.fail('trees have different current views');\n\t}\n\n\tif (sharedTreeA.edits.length !== sharedTreeB.edits.length) {\n\t\texpect.fail('trees have different amounts of edits');\n\t}\n\n\tfor (let i = 0; i < sharedTreeA.edits.length; i++) {\n\t\tconst roundTrip = <T>(obj: T): T => JSON.parse(JSON.stringify(obj)) as T;\n\n\t\tconst editA = roundTrip(\n\t\t\tconvertEditIds(getEditLogInternal(sharedTreeA).tryGetEditAtIndex(i) ?? fail('edit not found'), (id) =>\n\t\t\t\tsharedTreeA.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tconst editB = roundTrip(\n\t\t\tconvertEditIds(getEditLogInternal(sharedTreeB).tryGetEditAtIndex(i) ?? fail('edit not found'), (id) =>\n\t\t\t\tsharedTreeB.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tif (compareEditIds) {\n\t\t\texpect(editA).to.deep.equal(editB, `trees have different edits (index ${i})`);\n\t\t} else {\n\t\t\texpect(editA.changes).to.deep.equal(editB.changes, `edits have different changes (index ${i})`);\n\t\t}\n\t}\n}\n\nfunction loadSummaryTestFiles(): {\n\tsummaryFileWithHistory_0_0_2: string;\n\tsummaryFileNoHistory_0_0_2: string;\n\tsummaryFileEmptyTraits_0_0_2: string;\n\tsummaryFileWithHistory_0_1_1: string;\n\tsummaryFileNoHistory_0_1_1: string;\n\tsummaryFileUpgrade_0_1_1: string;\n} {\n\tconst summaryFileWithHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-0-0-2.json'), 'utf8');\n\tconst summaryFileNoHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-no-history-0-0-2.json'), 'utf8');\n\tconst summaryFileEmptyTraits_0_0_2 = fs.readFileSync(join(directory, 'summary-empty-traits-0-0-2.json'), 'utf8');\n\tconst summaryFileWithHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-0-1-1.json'), 'utf8');\n\tconst summaryFileNoHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-no-history-0-1-1.json'), 'utf8');\n\tconst summaryFileUpgrade_0_1_1 = fs.readFileSync(join(directory, 'summary-upgrade-0-1-1.json'), 'utf8');\n\n\treturn {\n\t\tsummaryFileWithHistory_0_0_2,\n\t\tsummaryFileNoHistory_0_0_2,\n\t\tsummaryFileEmptyTraits_0_0_2,\n\t\tsummaryFileWithHistory_0_1_1,\n\t\tsummaryFileNoHistory_0_1_1,\n\t\tsummaryFileUpgrade_0_1_1,\n\t};\n}\n\nasync function makeSummaryTestFiles(): Promise<void> {\n\ttry {\n\t\tfs.accessSync(directory);\n\t} catch {\n\t\tfs.mkdirSync(directory);\n\t}\n\n\tconst treeWithHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, true);\n\tconst treeNoHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, false);\n\tconst treeWithHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, true);\n\tconst treeNoHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, false);\n\n\tfs.writeFileSync(join(directory, `summary-0-0-2.json`), treeWithHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-0-2.json`), treeNoHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-0-1-1.json`), treeWithHistory_0_1_1.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-1-1.json`), treeNoHistory_0_1_1.saveSerializedSummary());\n\n\tconst { tree: upgradedTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat: WriteFormat.v0_1_1,\n\t\tsummarizeHistory: true,\n\t});\n\tupgradedTree.loadSummary(treeWithHistory_0_0_2.saveSummary());\n\tawait testObjectProvider.ensureSynchronized();\n\tfs.writeFileSync(join(directory, `summary-upgrade-0-1-1.json`), upgradedTree.saveSerializedSummary());\n}\n\n/** Every instance of this class generates the same sequence of v5 UUIDs */\nclass DeterministicIdGenerator {\n\tpublic static readonly sessionId = '968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId;\n\tprivate static readonly uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tprivate editIdCount = 0;\n\tprivate readonly constantIdCompressor?: IdCompressor;\n\n\tpublic constructor(public readonly writeFormat: WriteFormat, private readonly sharedTree: SharedTree) {\n\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId === DeterministicIdGenerator.sessionId);\n\t\t} else {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId !== DeterministicIdGenerator.sessionId);\n\t\t\tthis.constantIdCompressor = new IdCompressor(DeterministicIdGenerator.sessionId, reservedIdCount);\n\t\t}\n\t}\n\n\tpublic getNextEditId(): EditId {\n\t\treturn v5((this.editIdCount++).toString(), DeterministicIdGenerator.uuidNamespace) as EditId;\n\t}\n\n\tpublic getNextNodeId(): NodeId {\n\t\treturn this.writeFormat === WriteFormat.v0_0_2\n\t\t\t? this.sharedTree.generateNodeId(this.getNextStableId())\n\t\t\t: this.sharedTree.generateNodeId();\n\t}\n\n\tprivate getNextStableId(): StableId {\n\t\tassert(this.constantIdCompressor !== undefined);\n\t\treturn this.constantIdCompressor.decompress(this.constantIdCompressor.generateCompressedId()) as StableId;\n\t}\n}\n"]}
1
+ {"version":3,"file":"Summary.tests.js","sourceRoot":"","sources":["../../src/test/Summary.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,WAA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AAC,CAAC;QAIvB,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW,CAAC,MAAM,EAAE;YAC5C,MAAM,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,cAAc,KAAK,wBAAwB,CAAC,SAAS,CAAC,CAAC;SACxG;aAAM;YACN,MAAM,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,cAAc,KAAK,wBAAwB,CAAC,SAAS,CAAC,CAAC;YACxG,IAAI,CAAC,oBAAoB,GAAG,IAAI,YAAY,CAAC,wBAAwB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;SAClG;IACF,CAAC;IAEM,aAAa;QACnB,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,wBAAwB,CAAC,aAAa,CAAW,CAAC;IAC9F,CAAC;IAEM,aAAa;QACnB,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW,CAAC,MAAM;YAC7C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACxD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC;IAEO,eAAe;QACtB,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,EAAE,CAAa,CAAC;IAC3G,CAAC;;AA3BsB,kCAAS,GAAG,sCAAmD,CAAC;AAC/D,sCAAa,GAAG,sCAAsC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport * as fs from 'fs';\nimport { join } from 'path';\nimport { expect, assert } from 'chai';\nimport { v5 } from 'uuid';\nimport { Change, StablePlace, StableRange } from '../ChangeTypes';\nimport { fail, RecursiveMutable } from '../Common';\nimport { areRevisionViewsSemanticallyEqual } from '../EditUtilities';\nimport { EditId, NodeId, SessionId, StableId, TraitLabel } from '../Identifiers';\nimport { initialTree } from '../InitialTree';\nimport { reservedIdCount, SharedTreeSummary, SharedTreeSummary_0_0_2, WriteFormat } from '../persisted-types';\nimport { getChangeNodeFromView } from '../SerializationUtilities';\nimport { SharedTree } from '../SharedTree';\nimport { deserialize, getSummaryStatistics, SummaryStatistics } from '../SummaryBackCompatibility';\nimport { IdCompressor } from '../id-compressor';\nimport { convertEditIds } from '../IdConversion';\nimport { MutableStringInterner } from '../StringInterner';\nimport { sequencedIdNormalizer } from '../NodeIdUtilities';\nimport { expectDefined } from './utilities/TestCommon';\nimport { TestFluidSerializer } from './utilities/TestSerializer';\nimport {\n\tgetEditLogInternal,\n\tgetIdNormalizerFromSharedTree,\n\tmakeNodeIdContext,\n\tsetUpLocalServerTestSharedTree,\n\ttestDocumentsPathBase,\n} from './utilities/TestUtilities';\n\nconst directory = join(testDocumentsPathBase, 'summary-tests');\n\n/** Applies a smattering of interesting edits to the given shared tree in an attempt to cover a variety of use cases */\nexport function applyTestEdits(sharedTree: SharedTree): void {\n\tconst uuid = new DeterministicIdGenerator(sharedTree.getWriteFormat(), sharedTree);\n\n\tfunction applyEdit(changes: Change[]): void {\n\t\tconst internalChanges = changes.map((c) => sharedTree.internalizeChange(c));\n\t\tsharedTree.applyEditInternal({ id: uuid.getNextEditId(), changes: internalChanges });\n\t}\n\n\t/*\n\t * Build a tree that looks like the following:\n\t *\n\t * ROOT\n\t * | 'root'\n\t * [root]\n\t * 'left' / \\ 'right'\n\t * [A] [B, C, D]\n\t * | 'leaf'\n\t * [E('payload')]\n\t */\n\n\tconst cDetachedId = 0;\n\tconst rootDetachedId = 1;\n\tconst aId = uuid.getNextNodeId();\n\tconst cId = uuid.getNextNodeId();\n\tconst dId = uuid.getNextNodeId();\n\n\tapplyEdit([\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'C',\n\t\t\t\t\tidentifier: cId,\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleaf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdefinition: 'E',\n\t\t\t\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\t\t\t\tpayload: 'payload',\n\t\t\t\t\t\t\t},\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\tcDetachedId\n\t\t),\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'Root',\n\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleft: [{ definition: 'A', identifier: aId }],\n\t\t\t\t\t\tright: [\n\t\t\t\t\t\t\t{ definition: 'B', identifier: uuid.getNextNodeId() },\n\t\t\t\t\t\t\tcDetachedId,\n\t\t\t\t\t\t\t{ definition: 'D', identifier: dId },\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\trootDetachedId\n\t\t),\n\t\tChange.insert(\n\t\t\trootDetachedId,\n\t\t\tStablePlace.atStartOf({\n\t\t\t\tlabel: 'root' as TraitLabel,\n\t\t\t\tparent: sharedTree.convertToNodeId(initialTree.identifier),\n\t\t\t})\n\t\t),\n\t]);\n\n\t/**\n\t * Edit the tree\n\t *\n\t * 1. Move C after A\n\t * 2. Delete D\n\t * 3.\n\t * ...\n\t * 102. Set the payload of A to _i_ for all _i_ in 0...100\n\t */\n\n\tapplyEdit([...Change.move(StableRange.only(cId), StablePlace.after(aId))]);\n\tapplyEdit([Change.delete(StableRange.only(dId))]);\n\tfor (let i = 0; i < 100; i++) {\n\t\tapplyEdit([Change.setPayload(aId, i)]);\n\t}\n}\n\nexport async function createSummaryTestTree(writeFormat: WriteFormat, summarizeHistory: boolean): Promise<SharedTree> {\n\tconst { tree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat,\n\t\tsummarizeHistory,\n\t\tuploadEditChunks: summarizeHistory,\n\t});\n\n\tif (writeFormat === WriteFormat.v0_1_1) {\n\t\tconst idCompressor = new IdCompressor('968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId, reservedIdCount);\n\t\tconst interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst context = makeNodeIdContext(idCompressor);\n\t\tconst normalizer = sequencedIdNormalizer(context);\n\t\tconst sharedTreeSummaryWithConstantSessionId: SharedTreeSummary = {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tcurrentTree: summarizeHistory\n\t\t\t\t? [\n\t\t\t\t\t\tinterner.getOrCreateInternedId(initialTree.definition),\n\t\t\t\t\t\tnormalizer.normalizeToOpSpace(context.convertToNodeId(initialTree.identifier)),\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t\teditHistory: {\n\t\t\t\teditIds: [],\n\t\t\t\teditChunks: [],\n\t\t\t},\n\t\t\tidCompressor: idCompressor.serialize(true),\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t};\n\n\t\ttree.loadSummary(sharedTreeSummaryWithConstantSessionId);\n\t}\n\n\tapplyTestEdits(tree);\n\n\tawait testObjectProvider.ensureSynchronized();\n\treturn tree;\n}\n\nexport function runSummaryTests(title: string): void {\n\tdescribe(title, () => {\n\t\t// Note: this test serializer doesn't handle blobs properly (it just uses JSON.stringify/JSON.parse).\n\t\tconst testSerializer = new TestFluidSerializer();\n\n\t\tconst {\n\t\t\tsummaryFileWithHistory_0_0_2,\n\t\t\tsummaryFileNoHistory_0_0_2,\n\t\t\tsummaryFileEmptyTraits_0_0_2,\n\t\t\tsummaryFileWithHistory_0_1_1,\n\t\t\tsummaryFileNoHistory_0_1_1,\n\t\t\tsummaryFileUpgrade_0_1_1,\n\t\t} = loadSummaryTestFiles();\n\n\t\t// Re-enable this test for an easy way to write the test summary files to disk\n\t\tit.skip('save files to disk', async () => {\n\t\t\tawait makeSummaryTestFiles();\n\t\t});\n\n\t\tdescribe('0.0.2 write format', () => {\n\t\t\tconst setUp002Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_0_2, ...options });\n\n\t\t\tconst setUp002SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_0_2, summarizeHistory);\n\n\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({});\n\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\texpect(getChangeNodeFromView(tree.currentView)).deep.equals(\n\t\t\t\t\tgetChangeNodeFromView(expectedTree.currentView)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files without history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary_0_0_2> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary_0_0_2 = JSON.parse(summaryFileNoHistory_0_0_2);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\tsummary.sequencedEdits[0].id = expectedSummary.sequencedEdits[0].id;\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files with history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.0.2 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_0_2);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp002SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.0.2 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tconst expectedTree = await setUp002SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading next version', () => {\n\t\t\t\tit('reads 0.1.1', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\t// TODO: There may need to be a testObjectProvider synchronization here to upload\n\t\t\t\t\t// blobs from this summary.\n\t\t\t\t\t// We should also look at how this test asserts behavior w.r.t blobs.\n\t\t\t\t\tconst newSummary = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\t\tconst expectedSummary = JSON.parse(summaryFileWithHistory_0_1_1);\n\t\t\t\t\texpect(newSummary).to.deep.equal(expectedSummary);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_0_2, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_0_2,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('0.1.1 write format', () => {\n\t\t\tconst setUp011Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_1_1, ...options });\n\n\t\t\tconst setUp011SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_1_1, summarizeHistory);\n\n\t\t\tit('writes 0.1.1 files without history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary = JSON.parse(summaryFileNoHistory_0_1_1);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\texpectDefined(summary.editHistory).editIds[0] = expectDefined(expectedSummary.editHistory?.editIds[0]);\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t});\n\n\t\t\tit('writes 0.1.1 files with history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_1_1)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.1.1 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_1_1);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp011SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.1.1 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(false);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading previous versions', () => {\n\t\t\t\tit('reads 0.0.2', async () => {\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2', async () => {\n\t\t\t\t\tconst { tree, testObjectProvider } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\t// Synchronize to give a chance for the update op to be sequenced.\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileUpgrade_0_1_1)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2 that has several stale ops that it resubmits', async () => {\n\t\t\t\t\tconst { tree: resubmitTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t\t\t});\n\t\t\t\t\tapplyTestEdits(resubmitTree);\n\t\t\t\t\tconst { tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\t\t\ttestObjectProvider,\n\t\t\t\t\t});\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tawait expectSharedTreesEqual(resubmitTree, tree);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, await createSummaryTestTree(WriteFormat.v0_1_1, true));\n\t\t\t\t});\n\n\t\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({});\n\t\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\texpect(\n\t\t\t\t\t\tareRevisionViewsSemanticallyEqual(\n\t\t\t\t\t\t\ttree.currentView,\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\texpectedTree.currentView,\n\t\t\t\t\t\t\texpectedTree\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\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_1_1, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst totalChunks = 1;\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t\ttotalNumberOfChunks: totalChunks,\n\t\t\t\t\tuploadedChunks: 0,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\t});\n}\n\nasync function expectSharedTreesEqual(\n\tsharedTreeA: SharedTree,\n\tsharedTreeB: SharedTree,\n\tcompareEditIds = true\n): Promise<void> {\n\tif (\n\t\t!areRevisionViewsSemanticallyEqual(sharedTreeA.currentView, sharedTreeA, sharedTreeB.currentView, sharedTreeB)\n\t) {\n\t\texpect.fail('trees have different current views');\n\t}\n\n\tif (sharedTreeA.edits.length !== sharedTreeB.edits.length) {\n\t\texpect.fail('trees have different amounts of edits');\n\t}\n\n\tfor (let i = 0; i < sharedTreeA.edits.length; i++) {\n\t\tconst roundTrip = <T>(obj: T): T => JSON.parse(JSON.stringify(obj)) as T;\n\n\t\tconst editA = roundTrip(\n\t\t\tconvertEditIds(getEditLogInternal(sharedTreeA).tryGetEditAtIndex(i) ?? fail('edit not found'), (id) =>\n\t\t\t\tsharedTreeA.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tconst editB = roundTrip(\n\t\t\tconvertEditIds(getEditLogInternal(sharedTreeB).tryGetEditAtIndex(i) ?? fail('edit not found'), (id) =>\n\t\t\t\tsharedTreeB.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tif (compareEditIds) {\n\t\t\texpect(editA).to.deep.equal(editB, `trees have different edits (index ${i})`);\n\t\t} else {\n\t\t\texpect(editA.changes).to.deep.equal(editB.changes, `edits have different changes (index ${i})`);\n\t\t}\n\t}\n}\n\nfunction loadSummaryTestFiles(): {\n\tsummaryFileWithHistory_0_0_2: string;\n\tsummaryFileNoHistory_0_0_2: string;\n\tsummaryFileEmptyTraits_0_0_2: string;\n\tsummaryFileWithHistory_0_1_1: string;\n\tsummaryFileNoHistory_0_1_1: string;\n\tsummaryFileUpgrade_0_1_1: string;\n} {\n\tconst summaryFileWithHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-0-0-2.json'), 'utf8');\n\tconst summaryFileNoHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-no-history-0-0-2.json'), 'utf8');\n\tconst summaryFileEmptyTraits_0_0_2 = fs.readFileSync(join(directory, 'summary-empty-traits-0-0-2.json'), 'utf8');\n\tconst summaryFileWithHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-0-1-1.json'), 'utf8');\n\tconst summaryFileNoHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-no-history-0-1-1.json'), 'utf8');\n\tconst summaryFileUpgrade_0_1_1 = fs.readFileSync(join(directory, 'summary-upgrade-0-1-1.json'), 'utf8');\n\n\treturn {\n\t\tsummaryFileWithHistory_0_0_2,\n\t\tsummaryFileNoHistory_0_0_2,\n\t\tsummaryFileEmptyTraits_0_0_2,\n\t\tsummaryFileWithHistory_0_1_1,\n\t\tsummaryFileNoHistory_0_1_1,\n\t\tsummaryFileUpgrade_0_1_1,\n\t};\n}\n\nasync function makeSummaryTestFiles(): Promise<void> {\n\ttry {\n\t\tfs.accessSync(directory);\n\t} catch {\n\t\tfs.mkdirSync(directory);\n\t}\n\n\tconst treeWithHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, true);\n\tconst treeNoHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, false);\n\tconst treeWithHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, true);\n\tconst treeNoHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, false);\n\n\tfs.writeFileSync(join(directory, `summary-0-0-2.json`), treeWithHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-0-2.json`), treeNoHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-0-1-1.json`), treeWithHistory_0_1_1.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-1-1.json`), treeNoHistory_0_1_1.saveSerializedSummary());\n\n\tconst { tree: upgradedTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat: WriteFormat.v0_1_1,\n\t\tsummarizeHistory: true,\n\t});\n\tupgradedTree.loadSummary(treeWithHistory_0_0_2.saveSummary());\n\tawait testObjectProvider.ensureSynchronized();\n\tfs.writeFileSync(join(directory, `summary-upgrade-0-1-1.json`), upgradedTree.saveSerializedSummary());\n}\n\n/** Every instance of this class generates the same sequence of v5 UUIDs */\nclass DeterministicIdGenerator {\n\tpublic static readonly sessionId = '968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId;\n\tprivate static readonly uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tprivate editIdCount = 0;\n\tprivate readonly constantIdCompressor?: IdCompressor;\n\n\tpublic constructor(public readonly writeFormat: WriteFormat, private readonly sharedTree: SharedTree) {\n\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId === DeterministicIdGenerator.sessionId);\n\t\t} else {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId !== DeterministicIdGenerator.sessionId);\n\t\t\tthis.constantIdCompressor = new IdCompressor(DeterministicIdGenerator.sessionId, reservedIdCount);\n\t\t}\n\t}\n\n\tpublic getNextEditId(): EditId {\n\t\treturn v5((this.editIdCount++).toString(), DeterministicIdGenerator.uuidNamespace) as EditId;\n\t}\n\n\tpublic getNextNodeId(): NodeId {\n\t\treturn this.writeFormat === WriteFormat.v0_0_2\n\t\t\t? this.sharedTree.generateNodeId(this.getNextStableId())\n\t\t\t: this.sharedTree.generateNodeId();\n\t}\n\n\tprivate getNextStableId(): StableId {\n\t\tassert(this.constantIdCompressor !== undefined);\n\t\treturn this.constantIdCompressor.decompress(this.constantIdCompressor.generateCompressedId()) as StableId;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SharedTreeVersioningTests.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/SharedTreeVersioningTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,EAIN,2BAA2B,EAC3B,wBAAwB,EAIxB,MAAM,iBAAiB,CAAC;AAOzB;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,2BAA2B,QAyhBxF"}
1
+ {"version":3,"file":"SharedTreeVersioningTests.d.ts","sourceRoot":"","sources":["../../../src/test/utilities/SharedTreeVersioningTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,EAIN,2BAA2B,EAC3B,wBAAwB,EAIxB,MAAM,iBAAiB,CAAC;AAOzB;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,2BAA2B,QAkhBxF"}
@@ -266,10 +266,6 @@ export function runSharedTreeVersioningTests(title, setUpTestSharedTree) {
266
266
  expect(stableIds.has(tree.convertToStableNodeId(id))).to.be.false;
267
267
  }
268
268
  expect(tree.equals(tree)).to.be.true;
269
- // https://dev.azure.com/fluidframework/internal/_workitems/edit/3347
270
- const events = testObjectProvider.logger.reportAndClearTrackedEvents();
271
- expect(events.unexpectedErrors.length).to.equal(1);
272
- expect(events.unexpectedErrors[0].eventName).to.equal('fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch');
273
269
  });
274
270
  it('converts IDs correctly after upgrading from 0.0.2', async () => {
275
271
  const { testObjectProvider, tree: tree1 } = await setUpLocalServerTestSharedTree({
@@ -1 +1 @@
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BACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from 'assert';\nimport { ITelemetryBaseEvent } from '@fluidframework/common-definitions';\nimport { LoaderHeader } from '@fluidframework/container-definitions';\nimport { MockFluidDataStoreRuntime, validateAssertionError } from '@fluidframework/test-runtime-utils';\nimport { expect } from 'chai';\nimport { StableRange, StablePlace, BuildNode, Change } from '../../ChangeTypes';\nimport { Mutable } from '../../Common';\nimport { EditLog } from '../../EditLog';\nimport { areRevisionViewsSemanticallyEqual } from '../../EditUtilities';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes';\nimport { NodeId, StableNodeId, TraitLabel } from '../../Identifiers';\nimport { SharedTreeOpType, SharedTreeUpdateOp, TreeNodeSequence, WriteFormat } from '../../persisted-types';\nimport { SharedTree } from '../../SharedTree';\nimport { TreeNodeHandle } from '../../TreeNodeHandle';\nimport { nilUuid } from '../../UuidUtilities';\nimport { applyTestEdits } from '../Summary.tests';\nimport { buildLeaf } from './TestNode';\nimport {\n\tapplyNoop,\n\tsetUpLocalServerTestSharedTree,\n\tsetUpTestTree,\n\tSharedTreeTestingComponents,\n\tSharedTreeTestingOptions,\n\tspyOnSubmittedOps,\n\ttestTrait,\n\twaitForSummary,\n} from './TestUtilities';\n\nfunction spyOnVersionChanges(tree: SharedTree): WriteFormat[] {\n\tconst versions: WriteFormat[] = [];\n\ttree.on(SharedTreeDiagnosticEvent.WriteVersionChanged, (version) => versions.push(version));\n\treturn versions;\n}\n/**\n * Runs a test suite for operations on `SharedTree` that depend on correct versioning.\n * This suite can be used to test other implementations that aim to fulfill `SharedTree`'s contract.\n */\nexport function runSharedTreeVersioningTests(\n\ttitle: string,\n\tsetUpTestSharedTree: (options?: SharedTreeTestingOptions) => SharedTreeTestingComponents\n) {\n\tdescribe(title, () => {\n\t\tconst oldVersion = WriteFormat.v0_0_2;\n\t\tconst newVersion = WriteFormat.v0_1_1;\n\t\tconst treeOptions = { localMode: false, writeFormat: oldVersion };\n\t\tconst secondTreeOptions = {\n\t\t\tid: 'secondTestSharedTree',\n\t\t\tlocalMode: false,\n\t\t\twriteFormat: newVersion,\n\t\t};\n\n\t\tit('defaults to latest version if no version is specified when creating factory', () => {\n\t\t\tconst sharedTree = SharedTree.getFactory().create(new MockFluidDataStoreRuntime(), 'SharedTree');\n\t\t\tconst writeFormats = Object.values(WriteFormat);\n\t\t\texpect(sharedTree.getWriteFormat()).to.equal(writeFormats[writeFormats.length - 1]);\n\t\t});\n\n\t\tit('only processes edit ops if they have the same version', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\n\t\t\texpect(tree.edits.length).to.equal(0);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t// The newer tree should have ignored the first edit\n\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\t\t});\n\n\t\tit('resubmits ops concurrent to an update op using the new format', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\twriteFormat: newVersion,\n\t\t\t});\n\n\t\t\tconst testTree = setUpTestTree(tree);\n\t\t\tconst rootStableId = testTree.stable.identifier;\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\ttree.applyEdit(...Change.move(StableRange.only(testTree.left), StablePlace.after(testTree.right)));\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t// Verify even though one edit was applied, 2 edit ops were sent due to the version upgrade.\n\t\t\texpect(ops.length).to.equal(3);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\n\t\t\texpect(ops[1].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\n\t\t\t// Verify both trees apply the updated op.\n\t\t\tconst handle = new TreeNodeHandle(tree.currentView, tree.convertToNodeId(rootStableId));\n\t\t\texpect(handle.traits[testTree.left.traitLabel]).to.equal(undefined);\n\t\t\texpect(handle.traits[testTree.right.traitLabel].length).to.equal(2);\n\t\t\tconst handle2 = new TreeNodeHandle(newerTree.currentView, newerTree.convertToNodeId(rootStableId));\n\t\t\texpect(handle2.traits[testTree.left.traitLabel]).to.equal(undefined);\n\t\t\texpect(handle2.traits[testTree.right.traitLabel].length).to.equal(2);\n\t\t});\n\n\t\tit('throws if an edit op with a newer version than the write version is received', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\n\t\t\texpect(tree.edits.length).to.equal(0);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\n\t\t\t// Process an edit and expect it to throw\n\t\t\tapplyNoop(newerTree);\n\t\t\tassert.throws(\n\t\t\t\t() => containerRuntimeFactory.processAllMessages(),\n\t\t\t\t(e) => validateAssertionError(e, 'Newer op version received by a client that has yet to be updated.')\n\t\t\t);\n\t\t});\n\n\t\tit('ignores duplicate update ops', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into multiple newer trees to trigger version update ops\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\t\t\tconst { tree: newerTree2 } = setUpTestSharedTree({\n\t\t\t\tcontainerRuntimeFactory: newerContainerRuntimeFactory,\n\t\t\t\t...secondTreeOptions,\n\t\t\t});\n\t\t\tconst { tree: newerTree3 } = setUpTestSharedTree({\n\t\t\t\tcontainerRuntimeFactory: newerContainerRuntimeFactory,\n\t\t\t\t...secondTreeOptions,\n\t\t\t});\n\n\t\t\tconst versions = spyOnVersionChanges(newerTree);\n\t\t\tconst versions2 = spyOnVersionChanges(newerTree2);\n\t\t\tconst versions3 = spyOnVersionChanges(newerTree3);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tnewerTree2.loadSummary(summary);\n\t\t\tnewerTree3.loadSummary(summary);\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\n\t\t\t// Each tree should have processed a version update once\n\t\t\texpect(versions).to.deep.equal([oldVersion, newVersion]);\n\t\t\texpect(versions2).to.deep.equal([oldVersion, newVersion]);\n\t\t\texpect(versions3).to.deep.equal([oldVersion, newVersion]);\n\t\t});\n\n\t\tit('maintains custom EditLog and LogViewer callbacks when updating', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\tlet editAdded = 0;\n\n\t\t\t// Load the summary into multiple newer trees to trigger version update ops\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\n\t\t\tconst versions = spyOnVersionChanges(newerTree);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\t(newerTree.edits as EditLog).registerEditAddedHandler(() => editAdded++);\n\n\t\t\texpect(versions).to.have.length(1);\n\t\t\texpect(versions[0]).to.equal(oldVersion);\n\n\t\t\t// Update occurs after the handler is added to the old edit log\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(versions).to.have.length(2);\n\t\t\texpect(versions[1]).to.equal(newVersion);\n\n\t\t\tconst additionalEdits = 5;\n\t\t\tfor (let i = 0; i < additionalEdits; i++) {\n\t\t\t\tapplyNoop(newerTree);\n\t\t\t}\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\n\t\t\t// The edit added handler should run twice for each additional edit (once when applying locally and once when applying the sequenced edit)\n\t\t\texpect(editAdded).to.equal(additionalEdits * 2);\n\t\t});\n\n\t\tit('begins writing the new version only after updating', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a newer tree to trigger a version update op\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\n\t\t\tconst ops = spyOnSubmittedOps(newerContainerRuntimeFactory);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tapplyNoop(newerTree);\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\tapplyNoop(newerTree);\n\n\t\t\texpect(ops.length).to.equal(4);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\t\t\t// Because the first op was submitted before the Update message was sequenced, it should use\n\t\t\t// the same write format as the loaded summary.\n\t\t\texpect(ops[1].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\t\t\texpect(ops[3].version).to.equal(newVersion);\n\t\t});\n\n\t\tit('Existing client can update to a write version higher than the initialized write version', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst versions = spyOnVersionChanges(tree);\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a newer tree to trigger a version update op\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\t// Apply another arbitrary edit to the initial tree, which should now be using the new write version.\n\t\t\tapplyNoop(tree);\n\n\t\t\texpect(versions).to.eql([newVersion]);\n\t\t\texpect(ops.length).to.equal(3);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\n\t\t\texpect(ops[0].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\t\t});\n\n\t\tit('New client can update to a write version higher than the initialized version on summary load', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\twriteFormat: newVersion,\n\t\t\t});\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a tree with older write version; it should recognize the document is already using\n\t\t\t// the new write version and use that instead.\n\t\t\tconst { tree: olderTree } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\twriteFormat: oldVersion,\n\t\t\t});\n\n\t\t\tolderTree.loadSummary(summary);\n\t\t\tapplyNoop(olderTree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\texpect(ops.length).to.equal(2);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([SharedTreeOpType.Edit, SharedTreeOpType.Edit]);\n\t\t\texpect(ops.map((op) => op.version)).to.eql([newVersion, newVersion]);\n\t\t});\n\n\t\tit('can load a 0.1.1 summary and access the current view', () => {\n\t\t\t// This is a regression test for the logic initializing SharedTree's EditLog from a summary.\n\t\t\t// The 0.1.1 format omits `currentTree`, but EditLog should still tolerate synchronous access\n\t\t\t// of the first edit in the session (which is a single insert containing that tree).\n\t\t\tconst options: SharedTreeTestingOptions = {\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\tsummarizeHistory: false,\n\t\t\t\tlocalMode: false,\n\t\t\t};\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(options);\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\t\t\tconst { tree: newTree } = setUpTestSharedTree({ containerRuntimeFactory, ...options });\n\t\t\tnewTree.loadSummary(summary);\n\t\t\texpect(newTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(() => newTree.currentView).to.not.throw();\n\t\t});\n\n\t\tit('upgrades properly when no edits are sent', async () => {\n\t\t\t// Starts in 0.0.2 (so no upgrade)\n\t\t\tconst { testObjectProvider, tree: tree1 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_0_2);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_0_2);\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree1.equals(tree2)).to.be.true;\n\t\t});\n\n\t\tit('generates unique IDs after upgrading from 0.0.2', async () => {\n\t\t\tconst idCount = 100;\n\n\t\t\tconst { testObjectProvider, tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tapplyTestEdits(tree);\n\n\t\t\tconst nodeIds = new Set<NodeId>();\n\t\t\tconst stableIds = new Set<StableNodeId>();\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\tconst id = tree.generateNodeId();\n\t\t\t\tnodeIds.add(id);\n\t\t\t\tstableIds.add(tree.convertToStableNodeId(id));\n\t\t\t}\n\n\t\t\t// New tree joins, causes an upgrade\n\t\t\tawait setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\t// No IDs should be generated that were already generated before the update\n\t\t\t\tconst id = tree.generateNodeId();\n\t\t\t\texpect(nodeIds.has(id)).to.be.false;\n\t\t\t\texpect(stableIds.has(tree.convertToStableNodeId(id))).to.be.false;\n\t\t\t}\n\t\t\texpect(tree.equals(tree)).to.be.true;\n\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t);\n\t\t});\n\n\t\tit('converts IDs correctly after upgrading from 0.0.2', async () => {\n\t\t\tconst { testObjectProvider, tree: tree1 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst idCount = 10;\n\t\t\tconst ids: [NodeId, StableNodeId][] = [];\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\tconst id = tree1.generateNodeId();\n\t\t\t\tids.push([id, tree1.convertToStableNodeId(id)]);\n\t\t\t}\n\n\t\t\t// Use some of the IDs in edits, but leave others unused.\n\t\t\t// They should all be valid and usable after upgrade.\n\t\t\tconst builds: Mutable<TreeNodeSequence<BuildNode>> = [];\n\t\t\tfor (let i = 1; i < ids.length; i += 2) {\n\t\t\t\tbuilds.push(buildLeaf(ids[i][0], i));\n\t\t\t}\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\tbuilds,\n\t\t\t\t\tStablePlace.atEndOf({ parent: tree1.currentView.root, label: 'foo' as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\tconst view = tree1.currentView;\n\t\t\tfor (let i = 0; i < ids.length; i++) {\n\t\t\t\tconst [nodeIdBefore, stableIdBefore] = ids[i];\n\t\t\t\texpect(tree1.convertToStableNodeId(nodeIdBefore)).to.equal(stableIdBefore);\n\t\t\t\tif (i % 2 === 0) {\n\t\t\t\t\texpect(view.hasNode(nodeIdBefore)).to.be.false;\n\t\t\t\t} else {\n\t\t\t\t\texpect(view.hasNode(nodeIdBefore)).to.be.true;\n\t\t\t\t\tconst node = view.getViewNode(nodeIdBefore);\n\t\t\t\t\texpect(node.payload).to.equal(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\texpect(tree1.equals(tree2)).to.be.true;\n\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t);\n\t\t});\n\n\t\tit('interns strings correctly after upgrading from 0.0.2', async () => {\n\t\t\tconst {\n\t\t\t\ttestObjectProvider,\n\t\t\t\ttree: tree1,\n\t\t\t\tcontainer,\n\t\t\t} = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t\tsummarizeHistory: false,\n\t\t\t});\n\n\t\t\tconst internedDefinition = 'internedDefinition';\n\n\t\t\tconst id = tree1.generateNodeId();\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\t{ definition: internedDefinition, identifier: id },\n\t\t\t\t\tStablePlace.atStartOf(testTrait(tree1.currentView))\n\t\t\t\t)\n\t\t\t);\n\t\t\ttree1.applyEdit(Change.delete(StableRange.only(id)));\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\tconst summaryVersion = await waitForSummary(container);\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t\theaders: { [LoaderHeader.version]: summaryVersion },\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\t{ definition: internedDefinition, identifier: tree1.generateNodeId() },\n\t\t\t\t\tStablePlace.atStartOf(testTrait(tree1.currentView))\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(areRevisionViewsSemanticallyEqual(tree1.currentView, tree1, tree2.currentView, tree2)).to.be.true;\n\t\t}).timeout(10000);\n\n\t\tit('attributes all pre-upgrade IDs to the nil UUID after upgrading from 0.0.2', async () => {\n\t\t\tconst { testObjectProvider, tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst attributionId = tree.attributionId;\n\t\t\texpect(attributionId).to.equal(nilUuid);\n\t\t\tconst nodeId = tree.generateNodeId();\n\t\t\tconst stableNodeId = tree.convertToStableNodeId(nodeId);\n\n\t\t\ttree.applyEdit(Change.insertTree(buildLeaf(nodeId), StablePlace.atStartOf(testTrait(tree.currentView))));\n\n\t\t\t// New tree joins, causes an upgrade\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree.attributeNodeId(nodeId)).to.equal(attributionId);\n\t\t\texpect(tree2.attributeNodeId(tree2.convertToNodeId(stableNodeId))).to.equal(attributionId);\n\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t);\n\t\t});\n\n\t\tdescribe('telemetry', () => {\n\t\t\tconst events: ITelemetryBaseEvent[] = [];\n\t\t\tconst logger = { send: (event) => events.push(event) };\n\t\t\tbeforeEach(() => {\n\t\t\t\tevents.length = 0;\n\t\t\t});\n\n\t\t\tit('emits RequestVersionUpdate events', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t\t...secondTreeOptions,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\n\t\t\t\tnewerTree.loadSummary(tree.saveSummary());\n\t\t\t\texpect(\n\t\t\t\t\tevents.some(\n\t\t\t\t\t\t(event) =>\n\t\t\t\t\t\t\tevent.eventName === 'SharedTree:RequestVersionUpdate' &&\n\t\t\t\t\t\t\tevent.versionTo === newVersion &&\n\t\t\t\t\t\t\tevent.versionFrom === oldVersion &&\n\t\t\t\t\t\t\tevent.category === 'generic'\n\t\t\t\t\t)\n\t\t\t\t).to.equal(true);\n\t\t\t});\n\n\t\t\tit('emits VersionUpdate events', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t\t...secondTreeOptions,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\n\t\t\t\tnewerTree.loadSummary(tree.saveSummary());\n\t\t\t\tconst matchesVersionUpdate = (event: ITelemetryBaseEvent) =>\n\t\t\t\t\tevent.eventName === 'SharedTree:VersionUpdate_end' &&\n\t\t\t\t\tevent.version === newVersion &&\n\t\t\t\t\tevent.category === 'performance' &&\n\t\t\t\t\ttypeof event.duration === 'number';\n\n\t\t\t\texpect(events.some(matchesVersionUpdate)).to.equal(false);\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\texpect(events.some(matchesVersionUpdate)).to.equal(true);\n\t\t\t});\n\n\t\t\tit('emits error events on VersionUpdate failure', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst op: SharedTreeUpdateOp = {\n\t\t\t\t\ttype: SharedTreeOpType.Update,\n\t\t\t\t\tversion: newVersion,\n\t\t\t\t};\n\t\t\t\tcontainerRuntimeFactory.pushMessage({ contents: op });\n\t\t\t\t(tree.edits as EditLog).getLocalEdits = () => {\n\t\t\t\t\tthrow new Error('Simulated issue in update');\n\t\t\t\t};\n\t\t\t\tconst matchesFailedVersionUpdate = (event: ITelemetryBaseEvent) =>\n\t\t\t\t\tevent.eventName === 'SharedTree:VersionUpdate_cancel' &&\n\t\t\t\t\tevent.category === 'error' &&\n\t\t\t\t\tevent.error === 'Simulated issue in update';\n\n\t\t\t\texpect(events.some(matchesFailedVersionUpdate)).to.equal(false);\n\t\t\t\tassert.throws(\n\t\t\t\t\t() => containerRuntimeFactory.processAllMessages(),\n\t\t\t\t\t(e) => validateAssertionError(e, /Simulated issue in update/)\n\t\t\t\t);\n\t\t\t\texpect(events.some(matchesFailedVersionUpdate)).to.equal(true);\n\t\t\t});\n\t\t});\n\t});\n}\n"]}
1
+ {"version":3,"file":"SharedTreeVersioningTests.js","sourceRoot":"","sources":["../../../src/test/utilities/SharedT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IAAI,EAAE,uBAAuB,EAAE,GAAG,mBAAmB,iCAAM,WAAW,KAAE,MAAM,IAAG,CAAC;gBAC1F,MAAM,EAAE,GAAuB;oBAC9B,IAAI,EAAE,gBAAgB,CAAC,MAAM;oBAC7B,OAAO,EAAE,UAAU;iBACnB,CAAC;gBACF,uBAAuB,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;gBACrD,IAAI,CAAC,KAAiB,CAAC,aAAa,GAAG,GAAG,EAAE;oBAC5C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;gBAC9C,CAAC,CAAC;gBACF,MAAM,0BAA0B,GAAG,CAAC,KAA0B,EAAE,EAAE,CACjE,KAAK,CAAC,SAAS,KAAK,iCAAiC;oBACrD,KAAK,CAAC,QAAQ,KAAK,OAAO;oBAC1B,KAAK,CAAC,KAAK,KAAK,2BAA2B,CAAC;gBAE7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAChE,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,uBAAuB,CAAC,kBAAkB,EAAE,EAClD,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAC7D,CAAC;gBACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from 'assert';\nimport { ITelemetryBaseEvent } from '@fluidframework/common-definitions';\nimport { LoaderHeader } from '@fluidframework/container-definitions';\nimport { MockFluidDataStoreRuntime, validateAssertionError } from '@fluidframework/test-runtime-utils';\nimport { expect } from 'chai';\nimport { StableRange, StablePlace, BuildNode, Change } from '../../ChangeTypes';\nimport { Mutable } from '../../Common';\nimport { EditLog } from '../../EditLog';\nimport { areRevisionViewsSemanticallyEqual } from '../../EditUtilities';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes';\nimport { NodeId, StableNodeId, TraitLabel } from '../../Identifiers';\nimport { SharedTreeOpType, SharedTreeUpdateOp, TreeNodeSequence, WriteFormat } from '../../persisted-types';\nimport { SharedTree } from '../../SharedTree';\nimport { TreeNodeHandle } from '../../TreeNodeHandle';\nimport { nilUuid } from '../../UuidUtilities';\nimport { applyTestEdits } from '../Summary.tests';\nimport { buildLeaf } from './TestNode';\nimport {\n\tapplyNoop,\n\tsetUpLocalServerTestSharedTree,\n\tsetUpTestTree,\n\tSharedTreeTestingComponents,\n\tSharedTreeTestingOptions,\n\tspyOnSubmittedOps,\n\ttestTrait,\n\twaitForSummary,\n} from './TestUtilities';\n\nfunction spyOnVersionChanges(tree: SharedTree): WriteFormat[] {\n\tconst versions: WriteFormat[] = [];\n\ttree.on(SharedTreeDiagnosticEvent.WriteVersionChanged, (version) => versions.push(version));\n\treturn versions;\n}\n/**\n * Runs a test suite for operations on `SharedTree` that depend on correct versioning.\n * This suite can be used to test other implementations that aim to fulfill `SharedTree`'s contract.\n */\nexport function runSharedTreeVersioningTests(\n\ttitle: string,\n\tsetUpTestSharedTree: (options?: SharedTreeTestingOptions) => SharedTreeTestingComponents\n) {\n\tdescribe(title, () => {\n\t\tconst oldVersion = WriteFormat.v0_0_2;\n\t\tconst newVersion = WriteFormat.v0_1_1;\n\t\tconst treeOptions = { localMode: false, writeFormat: oldVersion };\n\t\tconst secondTreeOptions = {\n\t\t\tid: 'secondTestSharedTree',\n\t\t\tlocalMode: false,\n\t\t\twriteFormat: newVersion,\n\t\t};\n\n\t\tit('defaults to latest version if no version is specified when creating factory', () => {\n\t\t\tconst sharedTree = SharedTree.getFactory().create(new MockFluidDataStoreRuntime(), 'SharedTree');\n\t\t\tconst writeFormats = Object.values(WriteFormat);\n\t\t\texpect(sharedTree.getWriteFormat()).to.equal(writeFormats[writeFormats.length - 1]);\n\t\t});\n\n\t\tit('only processes edit ops if they have the same version', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\n\t\t\texpect(tree.edits.length).to.equal(0);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t// The newer tree should have ignored the first edit\n\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\t\t});\n\n\t\tit('resubmits ops concurrent to an update op using the new format', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\twriteFormat: newVersion,\n\t\t\t});\n\n\t\t\tconst testTree = setUpTestTree(tree);\n\t\t\tconst rootStableId = testTree.stable.identifier;\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\ttree.applyEdit(...Change.move(StableRange.only(testTree.left), StablePlace.after(testTree.right)));\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t// Verify even though one edit was applied, 2 edit ops were sent due to the version upgrade.\n\t\t\texpect(ops.length).to.equal(3);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\n\t\t\texpect(ops[1].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\n\t\t\t// Verify both trees apply the updated op.\n\t\t\tconst handle = new TreeNodeHandle(tree.currentView, tree.convertToNodeId(rootStableId));\n\t\t\texpect(handle.traits[testTree.left.traitLabel]).to.equal(undefined);\n\t\t\texpect(handle.traits[testTree.right.traitLabel].length).to.equal(2);\n\t\t\tconst handle2 = new TreeNodeHandle(newerTree.currentView, newerTree.convertToNodeId(rootStableId));\n\t\t\texpect(handle2.traits[testTree.left.traitLabel]).to.equal(undefined);\n\t\t\texpect(handle2.traits[testTree.right.traitLabel].length).to.equal(2);\n\t\t});\n\n\t\tit('throws if an edit op with a newer version than the write version is received', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\n\t\t\texpect(tree.edits.length).to.equal(0);\n\t\t\texpect(newerTree.edits.length).to.equal(0);\n\n\t\t\t// Process an edit and expect it to throw\n\t\t\tapplyNoop(newerTree);\n\t\t\tassert.throws(\n\t\t\t\t() => containerRuntimeFactory.processAllMessages(),\n\t\t\t\t(e) => validateAssertionError(e, 'Newer op version received by a client that has yet to be updated.')\n\t\t\t);\n\t\t});\n\n\t\tit('ignores duplicate update ops', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into multiple newer trees to trigger version update ops\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\t\t\tconst { tree: newerTree2 } = setUpTestSharedTree({\n\t\t\t\tcontainerRuntimeFactory: newerContainerRuntimeFactory,\n\t\t\t\t...secondTreeOptions,\n\t\t\t});\n\t\t\tconst { tree: newerTree3 } = setUpTestSharedTree({\n\t\t\t\tcontainerRuntimeFactory: newerContainerRuntimeFactory,\n\t\t\t\t...secondTreeOptions,\n\t\t\t});\n\n\t\t\tconst versions = spyOnVersionChanges(newerTree);\n\t\t\tconst versions2 = spyOnVersionChanges(newerTree2);\n\t\t\tconst versions3 = spyOnVersionChanges(newerTree3);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tnewerTree2.loadSummary(summary);\n\t\t\tnewerTree3.loadSummary(summary);\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\n\t\t\t// Each tree should have processed a version update once\n\t\t\texpect(versions).to.deep.equal([oldVersion, newVersion]);\n\t\t\texpect(versions2).to.deep.equal([oldVersion, newVersion]);\n\t\t\texpect(versions3).to.deep.equal([oldVersion, newVersion]);\n\t\t});\n\n\t\tit('maintains custom EditLog and LogViewer callbacks when updating', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\tlet editAdded = 0;\n\n\t\t\t// Load the summary into multiple newer trees to trigger version update ops\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\n\t\t\tconst versions = spyOnVersionChanges(newerTree);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\t(newerTree.edits as EditLog).registerEditAddedHandler(() => editAdded++);\n\n\t\t\texpect(versions).to.have.length(1);\n\t\t\texpect(versions[0]).to.equal(oldVersion);\n\n\t\t\t// Update occurs after the handler is added to the old edit log\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(versions).to.have.length(2);\n\t\t\texpect(versions[1]).to.equal(newVersion);\n\n\t\t\tconst additionalEdits = 5;\n\t\t\tfor (let i = 0; i < additionalEdits; i++) {\n\t\t\t\tapplyNoop(newerTree);\n\t\t\t}\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\n\t\t\t// The edit added handler should run twice for each additional edit (once when applying locally and once when applying the sequenced edit)\n\t\t\texpect(editAdded).to.equal(additionalEdits * 2);\n\t\t});\n\n\t\tit('begins writing the new version only after updating', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a newer tree to trigger a version update op\n\t\t\tconst { tree: newerTree, containerRuntimeFactory: newerContainerRuntimeFactory } =\n\t\t\t\tsetUpTestSharedTree(secondTreeOptions);\n\n\t\t\tconst ops = spyOnSubmittedOps(newerContainerRuntimeFactory);\n\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tapplyNoop(newerTree);\n\t\t\tnewerContainerRuntimeFactory.processAllMessages();\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\tapplyNoop(newerTree);\n\n\t\t\texpect(ops.length).to.equal(4);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\t\t\t// Because the first op was submitted before the Update message was sequenced, it should use\n\t\t\t// the same write format as the loaded summary.\n\t\t\texpect(ops[1].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\t\t\texpect(ops[3].version).to.equal(newVersion);\n\t\t});\n\n\t\tit('Existing client can update to a write version higher than the initialized write version', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(treeOptions);\n\t\t\tconst versions = spyOnVersionChanges(tree);\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\n\t\t\t// Process an edit\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a newer tree to trigger a version update op\n\t\t\tconst { tree: newerTree } = setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions });\n\t\t\tnewerTree.loadSummary(summary);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(newerTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\t// Apply another arbitrary edit to the initial tree, which should now be using the new write version.\n\t\t\tapplyNoop(tree);\n\n\t\t\texpect(versions).to.eql([newVersion]);\n\t\t\texpect(ops.length).to.equal(3);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t\tSharedTreeOpType.Update,\n\t\t\t\tSharedTreeOpType.Edit,\n\t\t\t]);\n\n\t\t\texpect(ops[0].version).to.equal(oldVersion);\n\t\t\texpect(ops[2].version).to.equal(newVersion);\n\t\t});\n\n\t\tit('New client can update to a write version higher than the initialized version on summary load', () => {\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\twriteFormat: newVersion,\n\t\t\t});\n\t\t\tconst ops = spyOnSubmittedOps(containerRuntimeFactory);\n\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\n\t\t\t// Load the summary into a tree with older write version; it should recognize the document is already using\n\t\t\t// the new write version and use that instead.\n\t\t\tconst { tree: olderTree } = setUpTestSharedTree({\n\t\t\t\t...treeOptions,\n\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\twriteFormat: oldVersion,\n\t\t\t});\n\n\t\t\tolderTree.loadSummary(summary);\n\t\t\tapplyNoop(olderTree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\texpect(ops.length).to.equal(2);\n\t\t\texpect(ops.map((op) => op.type)).to.eql([SharedTreeOpType.Edit, SharedTreeOpType.Edit]);\n\t\t\texpect(ops.map((op) => op.version)).to.eql([newVersion, newVersion]);\n\t\t});\n\n\t\tit('can load a 0.1.1 summary and access the current view', () => {\n\t\t\t// This is a regression test for the logic initializing SharedTree's EditLog from a summary.\n\t\t\t// The 0.1.1 format omits `currentTree`, but EditLog should still tolerate synchronous access\n\t\t\t// of the first edit in the session (which is a single insert containing that tree).\n\t\t\tconst options: SharedTreeTestingOptions = {\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\tsummarizeHistory: false,\n\t\t\t\tlocalMode: false,\n\t\t\t};\n\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree(options);\n\t\t\tapplyNoop(tree);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\tconst summary = tree.saveSummary();\n\t\t\tconst { tree: newTree } = setUpTestSharedTree({ containerRuntimeFactory, ...options });\n\t\t\tnewTree.loadSummary(summary);\n\t\t\texpect(newTree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(() => newTree.currentView).to.not.throw();\n\t\t});\n\n\t\tit('upgrades properly when no edits are sent', async () => {\n\t\t\t// Starts in 0.0.2 (so no upgrade)\n\t\t\tconst { testObjectProvider, tree: tree1 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_0_2);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_0_2);\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree1.equals(tree2)).to.be.true;\n\t\t});\n\n\t\tit('generates unique IDs after upgrading from 0.0.2', async () => {\n\t\t\tconst idCount = 100;\n\n\t\t\tconst { testObjectProvider, tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tapplyTestEdits(tree);\n\n\t\t\tconst nodeIds = new Set<NodeId>();\n\t\t\tconst stableIds = new Set<StableNodeId>();\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\tconst id = tree.generateNodeId();\n\t\t\t\tnodeIds.add(id);\n\t\t\t\tstableIds.add(tree.convertToStableNodeId(id));\n\t\t\t}\n\n\t\t\t// New tree joins, causes an upgrade\n\t\t\tawait setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\t// No IDs should be generated that were already generated before the update\n\t\t\t\tconst id = tree.generateNodeId();\n\t\t\t\texpect(nodeIds.has(id)).to.be.false;\n\t\t\t\texpect(stableIds.has(tree.convertToStableNodeId(id))).to.be.false;\n\t\t\t}\n\t\t\texpect(tree.equals(tree)).to.be.true;\n\t\t});\n\n\t\tit('converts IDs correctly after upgrading from 0.0.2', async () => {\n\t\t\tconst { testObjectProvider, tree: tree1 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst idCount = 10;\n\t\t\tconst ids: [NodeId, StableNodeId][] = [];\n\t\t\tfor (let i = 0; i < idCount; i++) {\n\t\t\t\tconst id = tree1.generateNodeId();\n\t\t\t\tids.push([id, tree1.convertToStableNodeId(id)]);\n\t\t\t}\n\n\t\t\t// Use some of the IDs in edits, but leave others unused.\n\t\t\t// They should all be valid and usable after upgrade.\n\t\t\tconst builds: Mutable<TreeNodeSequence<BuildNode>> = [];\n\t\t\tfor (let i = 1; i < ids.length; i += 2) {\n\t\t\t\tbuilds.push(buildLeaf(ids[i][0], i));\n\t\t\t}\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\tbuilds,\n\t\t\t\t\tStablePlace.atEndOf({ parent: tree1.currentView.root, label: 'foo' as TraitLabel })\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\tconst view = tree1.currentView;\n\t\t\tfor (let i = 0; i < ids.length; i++) {\n\t\t\t\tconst [nodeIdBefore, stableIdBefore] = ids[i];\n\t\t\t\texpect(tree1.convertToStableNodeId(nodeIdBefore)).to.equal(stableIdBefore);\n\t\t\t\tif (i % 2 === 0) {\n\t\t\t\t\texpect(view.hasNode(nodeIdBefore)).to.be.false;\n\t\t\t\t} else {\n\t\t\t\t\texpect(view.hasNode(nodeIdBefore)).to.be.true;\n\t\t\t\t\tconst node = view.getViewNode(nodeIdBefore);\n\t\t\t\t\texpect(node.payload).to.equal(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\texpect(tree1.equals(tree2)).to.be.true;\n\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t);\n\t\t});\n\n\t\tit('interns strings correctly after upgrading from 0.0.2', async () => {\n\t\t\tconst {\n\t\t\t\ttestObjectProvider,\n\t\t\t\ttree: tree1,\n\t\t\t\tcontainer,\n\t\t\t} = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t\tsummarizeHistory: false,\n\t\t\t});\n\n\t\t\tconst internedDefinition = 'internedDefinition';\n\n\t\t\tconst id = tree1.generateNodeId();\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\t{ definition: internedDefinition, identifier: id },\n\t\t\t\t\tStablePlace.atStartOf(testTrait(tree1.currentView))\n\t\t\t\t)\n\t\t\t);\n\t\t\ttree1.applyEdit(Change.delete(StableRange.only(id)));\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\tconst summaryVersion = await waitForSummary(container);\n\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t\theaders: { [LoaderHeader.version]: summaryVersion },\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree1.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree2.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\n\t\t\ttree1.applyEdit(\n\t\t\t\t...Change.insertTree(\n\t\t\t\t\t{ definition: internedDefinition, identifier: tree1.generateNodeId() },\n\t\t\t\t\tStablePlace.atStartOf(testTrait(tree1.currentView))\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(areRevisionViewsSemanticallyEqual(tree1.currentView, tree1, tree2.currentView, tree2)).to.be.true;\n\t\t}).timeout(10000);\n\n\t\tit('attributes all pre-upgrade IDs to the nil UUID after upgrading from 0.0.2', async () => {\n\t\t\tconst { testObjectProvider, tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t});\n\n\t\t\tconst attributionId = tree.attributionId;\n\t\t\texpect(attributionId).to.equal(nilUuid);\n\t\t\tconst nodeId = tree.generateNodeId();\n\t\t\tconst stableNodeId = tree.convertToStableNodeId(nodeId);\n\n\t\t\ttree.applyEdit(Change.insertTree(buildLeaf(nodeId), StablePlace.atStartOf(testTrait(tree.currentView))));\n\n\t\t\t// New tree joins, causes an upgrade\n\t\t\tconst { tree: tree2 } = await setUpLocalServerTestSharedTree({\n\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\ttestObjectProvider,\n\t\t\t});\n\n\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\texpect(tree.getWriteFormat()).to.equal(WriteFormat.v0_1_1);\n\t\t\texpect(tree.attributeNodeId(nodeId)).to.equal(attributionId);\n\t\t\texpect(tree2.attributeNodeId(tree2.convertToNodeId(stableNodeId))).to.equal(attributionId);\n\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/3347\n\t\t\tconst events = testObjectProvider.logger.reportAndClearTrackedEvents();\n\t\t\texpect(events.unexpectedErrors.length).to.equal(1);\n\t\t\texpect(events.unexpectedErrors[0].eventName).to.equal(\n\t\t\t\t'fluid:telemetry:ContainerRuntime:Outbox:ReferenceSequenceNumberMismatch'\n\t\t\t);\n\t\t});\n\n\t\tdescribe('telemetry', () => {\n\t\t\tconst events: ITelemetryBaseEvent[] = [];\n\t\t\tconst logger = { send: (event) => events.push(event) };\n\t\t\tbeforeEach(() => {\n\t\t\t\tevents.length = 0;\n\t\t\t});\n\n\t\t\tit('emits RequestVersionUpdate events', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t\t...secondTreeOptions,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\n\t\t\t\tnewerTree.loadSummary(tree.saveSummary());\n\t\t\t\texpect(\n\t\t\t\t\tevents.some(\n\t\t\t\t\t\t(event) =>\n\t\t\t\t\t\t\tevent.eventName === 'SharedTree:RequestVersionUpdate' &&\n\t\t\t\t\t\t\tevent.versionTo === newVersion &&\n\t\t\t\t\t\t\tevent.versionFrom === oldVersion &&\n\t\t\t\t\t\t\tevent.category === 'generic'\n\t\t\t\t\t)\n\t\t\t\t).to.equal(true);\n\t\t\t});\n\n\t\t\tit('emits VersionUpdate events', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst { tree: newerTree } = setUpTestSharedTree({\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t\t...secondTreeOptions,\n\t\t\t\t\tlogger,\n\t\t\t\t});\n\n\t\t\t\tnewerTree.loadSummary(tree.saveSummary());\n\t\t\t\tconst matchesVersionUpdate = (event: ITelemetryBaseEvent) =>\n\t\t\t\t\tevent.eventName === 'SharedTree:VersionUpdate_end' &&\n\t\t\t\t\tevent.version === newVersion &&\n\t\t\t\t\tevent.category === 'performance' &&\n\t\t\t\t\ttypeof event.duration === 'number';\n\n\t\t\t\texpect(events.some(matchesVersionUpdate)).to.equal(false);\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\texpect(events.some(matchesVersionUpdate)).to.equal(true);\n\t\t\t});\n\n\t\t\tit('emits error events on VersionUpdate failure', () => {\n\t\t\t\tconst { tree, containerRuntimeFactory } = setUpTestSharedTree({ ...treeOptions, logger });\n\t\t\t\tconst op: SharedTreeUpdateOp = {\n\t\t\t\t\ttype: SharedTreeOpType.Update,\n\t\t\t\t\tversion: newVersion,\n\t\t\t\t};\n\t\t\t\tcontainerRuntimeFactory.pushMessage({ contents: op });\n\t\t\t\t(tree.edits as EditLog).getLocalEdits = () => {\n\t\t\t\t\tthrow new Error('Simulated issue in update');\n\t\t\t\t};\n\t\t\t\tconst matchesFailedVersionUpdate = (event: ITelemetryBaseEvent) =>\n\t\t\t\t\tevent.eventName === 'SharedTree:VersionUpdate_cancel' &&\n\t\t\t\t\tevent.category === 'error' &&\n\t\t\t\t\tevent.error === 'Simulated issue in update';\n\n\t\t\t\texpect(events.some(matchesFailedVersionUpdate)).to.equal(false);\n\t\t\t\tassert.throws(\n\t\t\t\t\t() => containerRuntimeFactory.processAllMessages(),\n\t\t\t\t\t(e) => validateAssertionError(e, /Simulated issue in update/)\n\t\t\t\t);\n\t\t\t\texpect(events.some(matchesFailedVersionUpdate)).to.equal(true);\n\t\t\t});\n\t\t});\n\t});\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/tree",
3
- "version": "2.0.0-internal.5.1.1",
3
+ "version": "2.0.0-internal.5.2.0",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -17,14 +17,14 @@
17
17
  "dependencies": {
18
18
  "@fluidframework/common-definitions": "^0.20.1",
19
19
  "@fluidframework/common-utils": "^1.1.1",
20
- "@fluidframework/container-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
21
- "@fluidframework/core-interfaces": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
22
- "@fluidframework/core-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
23
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
20
+ "@fluidframework/container-definitions": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
21
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
22
+ "@fluidframework/core-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
23
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
24
24
  "@fluidframework/protocol-definitions": "^1.1.0",
25
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
26
- "@fluidframework/shared-object-base": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
27
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
25
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
26
+ "@fluidframework/shared-object-base": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
27
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
28
28
  "buffer": "^6.0.3",
29
29
  "denque": "^1.5.1",
30
30
  "lru-cache": "^6.0.0",
@@ -32,19 +32,19 @@
32
32
  "uuid": "^8.3.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
36
- "@fluid-internal/test-drivers": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
37
- "@fluid-tools/benchmark": "^0.47.0",
35
+ "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
36
+ "@fluid-internal/test-drivers": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
37
+ "@fluid-tools/benchmark": "^0.48.0",
38
38
  "@fluidframework/build-common": "^1.2.0",
39
- "@fluidframework/container-loader": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
40
- "@fluidframework/container-runtime": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
39
+ "@fluidframework/container-loader": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
40
+ "@fluidframework/container-runtime": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
41
41
  "@fluidframework/eslint-config-fluid": "^2.0.0",
42
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
43
- "@fluidframework/runtime-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
44
- "@fluidframework/test-driver-definitions": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
45
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
46
- "@fluidframework/test-utils": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
47
- "@fluidframework/undo-redo": ">=2.0.0-internal.5.1.1 <2.0.0-internal.5.2.0",
42
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
43
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
44
+ "@fluidframework/test-driver-definitions": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
45
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
46
+ "@fluidframework/test-utils": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
47
+ "@fluidframework/undo-redo": ">=2.0.0-internal.5.2.0 <2.0.0-internal.5.3.0",
48
48
  "@microsoft/api-extractor": "^7.34.4",
49
49
  "@types/chai": "^4.0.0",
50
50
  "@types/lru-cache": "^5.1.0",
package/src/Checkout.ts CHANGED
@@ -5,7 +5,8 @@
5
5
 
6
6
  import { assert } from '@fluidframework/common-utils';
7
7
  import { ChildLogger, EventEmitterWithErrorHandling, ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
8
- import { IDisposable, IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';
8
+ import { IErrorEvent, ITelemetryProperties } from '@fluidframework/common-definitions';
9
+ import { IDisposable } from '@fluidframework/core-interfaces';
9
10
  import { assertWithMessage, fail, RestOrArray, unwrapRestOrArray } from './Common';
10
11
  import { EditId } from './Identifiers';
11
12
  import { CachingLogViewer } from './LogViewer';