@fluid-experimental/tree 2.0.0-internal.3.2.2 → 2.0.0-internal.3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Common.d.ts CHANGED
@@ -135,14 +135,6 @@ export declare function find<T>(sequence: Iterable<T>, find: (t: T) => boolean):
135
135
  * Defaults to `Object.is()` equality (a shallow compare)
136
136
  */
137
137
  export declare function compareIterables<T>(iterableA: Iterable<T>, iterableB: Iterable<T>, elementComparator?: (a: T, b: T) => boolean): boolean;
138
- /**
139
- * Compare two arrays and return true if their elements are equivalent and in the same order.
140
- * @param arrayA - The first array to compare
141
- * @param arrayB - The second array to compare
142
- * @param elementComparator - The function used to check if two `T`s are equivalent.
143
- * Defaults to `Object.is()` equality (a shallow compare)
144
- */
145
- export declare function compareArrays<T>(arrayA: readonly T[], arrayB: readonly T[], elementComparator?: (a: T, b: T) => boolean): boolean;
146
138
  /**
147
139
  * Compare two maps and return true if their contents are equivalent.
148
140
  * @param mapA - The first array to compare
@@ -1 +1 @@
1
- {"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,KAAK,MAAM,cAAc,CAAC;AAIjC;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,oBAAoB;IAC1E,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAErE;AAgBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEzE;AAED;;;;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,GACT,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAEhC;AACD;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,SAAS,gBAAgB,CAAC,EAAE,CAAC,EAC5D,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,GAAG,GACT,KAAK,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAE7C;AAED;;;;GAIG;AACH,oBAAY,WAAW,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAEtG"}
package/dist/Common.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.unwrapRestOrArray = exports.hasLength = exports.hasExactlyLength = exports.Result = exports.backmap = exports.compareBtrees = exports.setPropertyIfDefined = exports.copyPropertyIfDefined = exports.identity = exports.noop = exports.getOrCreate = exports.compareMaps = exports.compareArrays = exports.compareIterables = exports.find = exports.reduce = exports.filter = exports.map = exports.memoizeGetter = exports.assign = exports.assertArrayOfOne = exports.assertNotUndefined = exports.fail = exports.assert = exports.compareStrings = exports.compareFiniteNumbersReversed = exports.compareFiniteNumbers = exports.isSharedTreeEvent = exports.sharedTreeAssertionErrorType = void 0;
7
+ exports.unwrapRestOrArray = exports.hasLength = exports.hasExactlyLength = exports.Result = exports.backmap = exports.compareBtrees = exports.setPropertyIfDefined = exports.copyPropertyIfDefined = exports.identity = exports.noop = exports.getOrCreate = exports.compareMaps = exports.compareIterables = exports.find = exports.reduce = exports.filter = exports.map = exports.memoizeGetter = exports.assign = exports.assertArrayOfOne = exports.assertNotUndefined = exports.fail = exports.assert = exports.compareStrings = exports.compareFiniteNumbersReversed = exports.compareFiniteNumbers = exports.isSharedTreeEvent = exports.sharedTreeAssertionErrorType = void 0;
8
8
  const defaultFailMessage = 'Assertion failed';
9
9
  /**
10
10
  * Assertion failures in SharedTree will throw an exception containing this value as an `errorType`. The Fluid runtime propagates this field
@@ -250,25 +250,6 @@ function compareIterators(iteratorA, iteratorB, elementComparator = Object.is) {
250
250
  // If one iterator is done, but not the other, then they are not equivalent
251
251
  return a.done === b.done;
252
252
  }
253
- /**
254
- * Compare two arrays and return true if their elements are equivalent and in the same order.
255
- * @param arrayA - The first array to compare
256
- * @param arrayB - The second array to compare
257
- * @param elementComparator - The function used to check if two `T`s are equivalent.
258
- * Defaults to `Object.is()` equality (a shallow compare)
259
- */
260
- function compareArrays(arrayA, arrayB, elementComparator = Object.is) {
261
- if (arrayA.length !== arrayB.length) {
262
- return false;
263
- }
264
- for (let i = 0; i < arrayA.length; i++) {
265
- if (!elementComparator(arrayA[i], arrayB[i])) {
266
- return false;
267
- }
268
- }
269
- return true;
270
- }
271
- exports.compareArrays = compareArrays;
272
253
  /**
273
254
  * Compare two maps and return true if their contents are equivalent.
274
255
  * @param mapA - The first array to compare
@@ -1 +1 @@
1
- {"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,qBAAqB,CAAC;AASlE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAA0B;IAC3D,OAAQ,KAAkD,CAAC,iBAAiB,KAAK,IAAI,CAAC;AACvF,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,MAAM,wBAAyB,SAAQ,KAAK;IAG3C,YAAmB,OAAe;;QACjC,KAAK,CAAC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CAAC,CAAE,KAAa,CAAC;AAClF,CAAC;AAFD,8CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport BTree from 'sorted-btree';\n\nconst defaultFailMessage = 'Assertion failed';\n\n/**\n * Assertion failures in SharedTree will throw an exception containing this value as an `errorType`. The Fluid runtime propagates this field\n * in its handlings of errors thrown by containers. See\n * https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-utils/src/error.ts\n *\n * Exporting this enables users to safely filter telemetry handling of errors based on their type.\n *\n * @public\n */\nexport const sharedTreeAssertionErrorType = 'SharedTreeAssertion';\n\n/**\n * Telemetry properties decorated on all SharedTree events.\n */\nexport interface SharedTreeTelemetryProperties extends ITelemetryProperties {\n\treadonly isSharedTreeEvent: true;\n}\n\n/**\n * Returns if the supplied event is a SharedTree telemetry event.\n */\nexport function isSharedTreeEvent(event: ITelemetryBaseEvent): boolean {\n\treturn (event as unknown as SharedTreeTelemetryProperties).isSharedTreeEvent === true;\n}\n\n/**\n * Error object thrown by assertion failures in `SharedTree`.\n */\nclass SharedTreeAssertionError extends Error {\n\tpublic readonly errorType = sharedTreeAssertionErrorType;\n\n\tpublic constructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'Assertion error';\n\t\t// Note: conditional as `captureStackTrace` isn't defined in all browsers (e.g. Safari).\n\t\tError.captureStackTrace?.(this);\n\t}\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * A numeric comparator used for sorting in descending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbersReversed<T extends number>(a: T, b: T): number {\n\treturn b - a;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Asserts against a boolean condition. Throws an Error if the assertion failed. Will run and throw in release builds.\n * Use when violations are logic errors in the program.\n * @param condition - A condition to assert is truthy\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param containsPII - boolean flag for whether the message passed in contains personally identifying information (PII).\n */\nexport function assert(condition: unknown, message?: string, containsPII = false): asserts condition {\n\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\tif (!condition) {\n\t\tfail(message, containsPII);\n\t}\n}\n\n/**\n * Fails an assertion. Throws an Error that the assertion failed.\n * Use when violations are logic errors in the program.\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param containsPII - boolean flag for whether the message passed in contains personally identifying information (PII).\n */\nexport function fail(message: string = defaultFailMessage, containsPII = false): never {\n\tif (process.env.NODE_ENV !== 'production') {\n\t\tdebugger;\n\t\tconsole.error(message);\n\t}\n\n\tthrow new SharedTreeAssertionError(containsPII ? 'Assertion failed' : message);\n}\n\n/**\n * Asserts a value is not undefined, and returns the value.\n * Use when violations are logic errors in the program.\n *\n * @remarks\n * When practical, prefer the pattern `x ?? fail('message')` over `assertNotUndefined(x, 'message')`.\n * Using `?? fail` allows for message formatting without incurring the cost of formatting the message\n * in the non failing case.\n *\n * Example:\n * ```typescript\n * x ?? fail(`x should exist for ${y}`)\n * ```\n *\n * Additionally the `?? fail` avoids an extra call/stack frame in the non failing case.\n *\n * Another pattern to prefer over `assertNotUndefined(x, 'message')` is `assert(x !== undefined)`.\n * This pattern is preferred because it is more general (same approach works with typeof, instance of,\n * comparison to other values etc.).\n *\n * @param value - Value to assert against is non undefined.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertNotUndefined<T>(value: T | undefined, message = 'value must not be undefined'): T {\n\tassert(value !== undefined, message);\n\treturn value;\n}\n\n/**\n * Asserts an array contains a single value and returns the value.\n * @param array - Array to assert contains a single value.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertArrayOfOne<T>(array: readonly T[], message = 'array value must contain exactly one item'): T {\n\tassert(array.length === 1, message);\n\treturn array[0];\n}\n\n/**\n * Assign a property and value to a given object.\n * @param object - The object to add the property to\n * @param property - The property key\n * @param value - The value of the property\n * @returns `object` after assigning `value` to the property `property`.\n */\nexport function assign<T, K extends keyof never, V>(object: T, property: K, value: V): With<T, K, V> {\n\treturn Object.assign(object, { [property]: value }) as With<T, K, V>;\n}\n\n/**\n * Redefine a property to have the given value. This is simply a type-safe wrapper around\n * `Object.defineProperty`, but it is useful for caching public getters on first read.\n *\n * @example\n * ```typescript\n * // `randomOnce()` will return a random number, but always the same random number.\n * {\n * get randomOnce(): number {\n * return memoizeGetter(this, 'randomOnce', random(100))\n * }\n * }\n * ```\n * @param object - The object containing the property\n * @param propName - The name of the property on the object\n * @param value - The value of the property\n */\nexport function memoizeGetter<T, K extends keyof T>(object: T, propName: K, value: T[K]): T[K] {\n\tObject.defineProperty(object, propName, {\n\t\tvalue,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn value;\n}\n\n/**\n * Map an iterable to another iterable\n */\nexport function* map<T, R>(sequence: Iterable<T>, mapper: (t: T) => R): Iterable<R> {\n\tfor (const t of sequence) {\n\t\tyield mapper(t);\n\t}\n}\n\n/**\n * Filter an iterable into another iterable\n */\nexport function* filter<T>(sequence: Iterable<T>, filter: (t: T) => boolean): Iterable<T> {\n\tfor (const t of sequence) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Reduce an iterable into a single value, or undefined if the iterable has too few elements to reduce\n */\nexport function reduce<T>(\n\tsequence: Iterable<T>,\n\treduce: (previous: T, current: T) => T,\n\tinitialValue?: T\n): T | undefined {\n\tlet previous: T | undefined;\n\tlet current: T | undefined;\n\tfor (const t of sequence) {\n\t\tcurrent = t;\n\t\tif (previous === undefined) {\n\t\t\tif (initialValue !== undefined) {\n\t\t\t\tcurrent = reduce(initialValue, current);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrent = reduce(previous, current);\n\t\t}\n\t\tprevious = current;\n\t}\n\treturn current;\n}\n\n/**\n * Returns the first element of the given sequence that satisfies the given predicate, or undefined if no such element exists\n */\nexport function find<T>(sequence: Iterable<T>, find: (t: T) => boolean): T | undefined {\n\tfor (const t of sequence) {\n\t\tif (find(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Iterate through two iterables and return true if they yield equivalent elements in the same order.\n * @param iterableA - The first iterable to compare\n * @param iterableB - The second iterable to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareIterables<T>(\n\titerableA: Iterable<T>,\n\titerableB: Iterable<T>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\treturn compareIterators<T>(iterableA[Symbol.iterator](), iterableB[Symbol.iterator](), elementComparator);\n}\n\n/**\n * Iterate through two iterators and return true if they yield equivalent elements in the same order.\n * @param iteratorA - The first iterator to compare\n * @param iteratorB - The second iterator to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nfunction compareIterators<T, TReturn extends T = T>(\n\titeratorA: Iterator<T, TReturn>,\n\titeratorB: Iterator<T, TReturn>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\tlet a: IteratorResult<T, TReturn>;\n\tlet b: IteratorResult<T, TReturn>;\n\tfor (\n\t\ta = iteratorA.next(), b = iteratorB.next(); // Given two iterators...\n\t\ta.done !== true && b.done !== true; // ...while both have elements remaining...\n\t\ta = iteratorA.next(), b = iteratorB.next() // ...take one element at a time from each...\n\t) {\n\t\t// ...and ensure that their elements are equivalent\n\t\tif (!elementComparator(a.value, b.value)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// If one iterator is done, but not the other, then they are not equivalent\n\treturn a.done === b.done;\n}\n\n/**\n * Compare two arrays and return true if their elements are equivalent and in the same order.\n * @param arrayA - The first array to compare\n * @param arrayB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareArrays<T>(\n\tarrayA: readonly T[],\n\tarrayB: readonly T[],\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\tif (arrayA.length !== arrayB.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < arrayA.length; i++) {\n\t\tif (!elementComparator(arrayA[i], arrayB[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Compare two maps and return true if their contents are equivalent.\n * @param mapA - The first array to compare\n * @param mapB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareMaps<K, V>(\n\tmapA: ReadonlyMap<K, V>,\n\tmapB: ReadonlyMap<K, V>,\n\telementComparator: (a: V, b: V) => boolean = Object.is\n): boolean {\n\tif (mapA.size !== mapB.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [keyA, valueA] of mapA) {\n\t\tconst valueB = mapB.get(keyA);\n\t\tif (valueB === undefined || !elementComparator(valueA, valueB)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(map: Map<K, V>, key: K, defaultValue: (key: K) => V): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Function which does nothing (no-ops).\n */\nexport function noop(): void {\n\t// noop\n}\n\n/**\n * Function which returns its input\n */\nexport function identity<T>(t: T): T {\n\treturn t;\n}\n\n/**\n * Copies a property in such a way that it is only set on `destination` if it is present on `source`.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function copyPropertyIfDefined<TSrc, TDst>(source: TSrc, destination: TDst, property: keyof TSrc): void {\n\tconst value = source[property];\n\tif (value !== undefined) {\n\t\t(destination as any)[property] = value;\n\t}\n}\n\n/**\n * Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function setPropertyIfDefined<TDst, P extends keyof TDst>(\n\tvalue: TDst[P] | undefined,\n\tdestination: TDst,\n\tproperty: P\n): void {\n\tif (value !== undefined) {\n\t\tdestination[property] = value;\n\t}\n}\n\n/**\n * @example\n * ```typescript\n * function (thing: ObjectWithMaybeFoo) {\n * \t const x: MyActualType = {\n * \t bar: 3\n * };\n * \t\tx.foo = 3;\n *\n * \t copyPropertyIfDefined(thing, x, 'foo');\n * }\n * ```\n */\n\nfunction breakOnDifference(): { break: boolean } {\n\treturn { break: true };\n}\n\n/**\n * Helper that returns whether two b-trees are equal.\n * Accelerated when large portions of the tree are shared between the two.\n */\nexport function compareBtrees<K, V>(treeA: BTree<K, V>, treeB: BTree<K, V>, compare: (valA: V, valB: V) => boolean) {\n\tconst diff = treeA.diffAgainst(treeB, breakOnDifference, breakOnDifference, (_, valA, valB) => {\n\t\tif (!compare(valA, valB)) {\n\t\t\treturn { break: true };\n\t\t}\n\t\treturn undefined;\n\t});\n\n\treturn diff === undefined;\n}\n\nexport function backmap<K, V>(forwardmap: Map<V, K>): Map<K, V> {\n\treturn new Map(map(forwardmap, ([key, value]) => [value, key]));\n}\n\n/**\n * A developer facing (non-localized) error message.\n * TODO: better error system.\n */\nexport type ErrorString = string;\n\n/**\n * Discriminated union instance that wraps either a result of type `TOk` or an error of type `TError`.\n */\nexport type Result<TOk, TError> = Result.Ok<TOk> | Result.Error<TError>;\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Result {\n\t/**\n\t * Factory function for making a successful Result.\n\t * @param result - The result to wrap in the Result.\n\t */\n\texport function ok<TOk>(result: TOk): Ok<TOk> {\n\t\treturn { type: ResultType.Ok, result };\n\t}\n\t/**\n\t * Factory function for making a unsuccessful Result.\n\t * @param error - The error to wrap in the Result.\n\t */\n\texport function error<TError>(error: TError): Error<TError> {\n\t\treturn { type: ResultType.Error, error };\n\t}\n\t/**\n\t * Type guard for successful Result.\n\t * @returns True if `result` is successful.\n\t */\n\texport function isOk<TOk, TError>(result: Result<TOk, TError>): result is Ok<TOk> {\n\t\treturn result.type === ResultType.Ok;\n\t}\n\t/**\n\t * Type guard for unsuccessful Result.\n\t * @returns True if `result` is unsuccessful.\n\t */\n\texport function isError<TOk, TError>(result: Result<TOk, TError>): result is Error<TError> {\n\t\treturn result.type === ResultType.Error;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is ok.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new result.\n\t * @returns The given result if it is not ok, the mapped result otherwise.\n\t */\n\texport function mapOk<TOkIn, TOkOut, TError>(\n\t\tresult: Result<TOkIn, TError>,\n\t\tmap: (ok: TOkIn) => TOkOut\n\t): Result<TOkOut, TError> {\n\t\treturn isOk(result) ? ok(map(result.result)) : result;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is an error.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new error.\n\t * @returns The given result if it is ok, the mapped result otherwise.\n\t */\n\texport function mapError<TOk, TErrorIn, TErrorOut>(\n\t\tresult: Result<TOk, TErrorIn>,\n\t\tmap: (error: TErrorIn) => TErrorOut\n\t): Result<TOk, TErrorOut> {\n\t\treturn isError(result) ? error(map(result.error)) : result;\n\t}\n\t/**\n\t * Tag value use to differentiate the members of the `Result` discriminated union.\n\t */\n\texport enum ResultType {\n\t\t/** Signals a successful result. */\n\t\tOk,\n\t\t/** Signals an unsuccessful result. */\n\t\tError,\n\t}\n\t/**\n\t * Wraps a result of type `TOk`.\n\t */\n\texport interface Ok<TOk> {\n\t\treadonly type: ResultType.Ok;\n\t\treadonly result: TOk;\n\t}\n\t/**\n\t * Wraps an error of type `TError`.\n\t */\n\texport interface Error<TError> {\n\t\treadonly type: ResultType.Error;\n\t\treadonly error: TError;\n\t}\n}\n\n/** Type that removes `readonly` from fields. */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/** Type that recursively removes `readonly` from fields. */\nexport type RecursiveMutable<T> = {\n\t-readonly [K in keyof T]: RecursiveMutable<T[K]>;\n};\n\n/** Type that produces a writeable map from a readonly map. */\nexport type MutableMap<T extends ReadonlyMap<unknown, unknown>> = T extends ReadonlyMap<infer K, infer V>\n\t? Map<K, V>\n\t: never;\n\n/** Type that includes the property K: V on T */\nexport type With<T, K extends keyof never, V> = T & { [key in K]: V };\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, 'delete' | 'clear'> {\n\tget(key: K): V;\n}\n\n/**\n * Change the given property Prop of type T to have a type of TPropNew\n */\nexport type ChangePropType<T, Prop extends keyof T, TPropNew> = Omit<T, Prop> & { [_ in Prop]: TPropNew };\n\n// eslint-disable-next-line @rushstack/no-new-null\ntype Primitive = string | number | bigint | boolean | null | symbol | undefined;\n\n/**\n * Recursively replace all properties with type assignable to type TReplace in T with properties of type TWith.\n */\nexport type ReplaceRecursive<T, TReplace, TWith> = T extends TReplace\n\t? TWith\n\t: T extends Primitive\n\t? T\n\t: {\n\t\t\t[P in keyof T]: ReplaceRecursive<T[P], TReplace, TWith>;\n\t };\n\n/** A union type of the first `N` positive integers */\nexport type TakeWholeNumbers<N extends number, A extends never[] = []> = N extends A['length']\n\t? never\n\t: A['length'] | TakeWholeNumbers<N, [never, ...A]>;\n/** Returns a tuple type with exactly `Length` elements of type `T` */\nexport type ArrayOfLength<T, Length extends number, A extends T[] = []> = Length extends A['length']\n\t? A\n\t: ArrayOfLength<T, Length, [T, ...A]>;\n/**\n * Fails if `array` does not have exactly `length` elements\n */\nexport function hasExactlyLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is ArrayOfLength<T, Len> {\n\treturn array.length === length;\n}\n/**\n * Fails if `array` does not have at least `length` elements\n */\nexport function hasLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is [...ArrayOfLength<T, Len>, ...T[]] {\n\treturn array.length >= length;\n}\n\n/**\n * Type for a rest parameter which can accept many values, or a single array.\n * Since a callee cannot modify an array passed as a rest parameter with the spread operator,\n * an array passed directly should be readonly for consistency (caller retains ownership).\n */\nexport type RestOrArray<T> = readonly T[] | [readonly T[]];\n\n/**\n * When value is a one-element array containing another array, unwraps and returns the inner array.\n * Otherwise, returns the provided array.\n * Useful for implementing functions with a `RestOrArray` parameter.\n * T must not be implemented with an array (`Array.isArray(t)` must return false)\n */\nexport function unwrapRestOrArray<T>(value: [any[]] extends [T] ? never : RestOrArray<T>): readonly T[] {\n\treturn value.length === 1 && Array.isArray(value[0]) ? value[0] : (value as T[]);\n}\n"]}
1
+ {"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,qBAAqB,CAAC;AASlE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAA0B;IAC3D,OAAQ,KAAkD,CAAC,iBAAiB,KAAK,IAAI,CAAC;AACvF,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,MAAM,wBAAyB,SAAQ,KAAK;IAG3C,YAAmB,OAAe;;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,cAAS,GAAG,oCAA4B,CAAC;QAIxD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,wFAAwF;QACxF,MAAA,KAAK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B,mCAAmC;QACnC,uCAAE,CAAA;QACF,sCAAsC;QACtC,6CAAK,CAAA;IACN,CAAC,EALW,UAAU,GAAV,iBAAU,KAAV,iBAAU,QAKrB;AAeF,CAAC,EA5EgB,MAAM,GAAN,cAAM,KAAN,cAAM,QA4EtB;AAoDD;;GAEG;AACH,SAAgB,gBAAgB,CAC/B,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;AAChC,CAAC;AALD,4CAKC;AACD;;GAEG;AACH,SAAgB,SAAS,CACxB,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;AAC/B,CAAC;AALD,8BAKC;AASD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAI,KAAmD;IACvF,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC;AAClF,CAAC;AAFD,8CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseEvent, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport BTree from 'sorted-btree';\n\nconst defaultFailMessage = 'Assertion failed';\n\n/**\n * Assertion failures in SharedTree will throw an exception containing this value as an `errorType`. The Fluid runtime propagates this field\n * in its handlings of errors thrown by containers. See\n * https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-utils/src/error.ts\n *\n * Exporting this enables users to safely filter telemetry handling of errors based on their type.\n *\n * @public\n */\nexport const sharedTreeAssertionErrorType = 'SharedTreeAssertion';\n\n/**\n * Telemetry properties decorated on all SharedTree events.\n */\nexport interface SharedTreeTelemetryProperties extends ITelemetryProperties {\n\treadonly isSharedTreeEvent: true;\n}\n\n/**\n * Returns if the supplied event is a SharedTree telemetry event.\n */\nexport function isSharedTreeEvent(event: ITelemetryBaseEvent): boolean {\n\treturn (event as unknown as SharedTreeTelemetryProperties).isSharedTreeEvent === true;\n}\n\n/**\n * Error object thrown by assertion failures in `SharedTree`.\n */\nclass SharedTreeAssertionError extends Error {\n\tpublic readonly errorType = sharedTreeAssertionErrorType;\n\n\tpublic constructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'Assertion error';\n\t\t// Note: conditional as `captureStackTrace` isn't defined in all browsers (e.g. Safari).\n\t\tError.captureStackTrace?.(this);\n\t}\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * A numeric comparator used for sorting in descending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbersReversed<T extends number>(a: T, b: T): number {\n\treturn b - a;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Asserts against a boolean condition. Throws an Error if the assertion failed. Will run and throw in release builds.\n * Use when violations are logic errors in the program.\n * @param condition - A condition to assert is truthy\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param containsPII - boolean flag for whether the message passed in contains personally identifying information (PII).\n */\nexport function assert(condition: unknown, message?: string, containsPII = false): asserts condition {\n\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\tif (!condition) {\n\t\tfail(message, containsPII);\n\t}\n}\n\n/**\n * Fails an assertion. Throws an Error that the assertion failed.\n * Use when violations are logic errors in the program.\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param containsPII - boolean flag for whether the message passed in contains personally identifying information (PII).\n */\nexport function fail(message: string = defaultFailMessage, containsPII = false): never {\n\tif (process.env.NODE_ENV !== 'production') {\n\t\tdebugger;\n\t\tconsole.error(message);\n\t}\n\n\tthrow new SharedTreeAssertionError(containsPII ? 'Assertion failed' : message);\n}\n\n/**\n * Asserts a value is not undefined, and returns the value.\n * Use when violations are logic errors in the program.\n *\n * @remarks\n * When practical, prefer the pattern `x ?? fail('message')` over `assertNotUndefined(x, 'message')`.\n * Using `?? fail` allows for message formatting without incurring the cost of formatting the message\n * in the non failing case.\n *\n * Example:\n * ```typescript\n * x ?? fail(`x should exist for ${y}`)\n * ```\n *\n * Additionally the `?? fail` avoids an extra call/stack frame in the non failing case.\n *\n * Another pattern to prefer over `assertNotUndefined(x, 'message')` is `assert(x !== undefined)`.\n * This pattern is preferred because it is more general (same approach works with typeof, instance of,\n * comparison to other values etc.).\n *\n * @param value - Value to assert against is non undefined.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertNotUndefined<T>(value: T | undefined, message = 'value must not be undefined'): T {\n\tassert(value !== undefined, message);\n\treturn value;\n}\n\n/**\n * Asserts an array contains a single value and returns the value.\n * @param array - Array to assert contains a single value.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertArrayOfOne<T>(array: readonly T[], message = 'array value must contain exactly one item'): T {\n\tassert(array.length === 1, message);\n\treturn array[0];\n}\n\n/**\n * Assign a property and value to a given object.\n * @param object - The object to add the property to\n * @param property - The property key\n * @param value - The value of the property\n * @returns `object` after assigning `value` to the property `property`.\n */\nexport function assign<T, K extends keyof never, V>(object: T, property: K, value: V): With<T, K, V> {\n\treturn Object.assign(object, { [property]: value }) as With<T, K, V>;\n}\n\n/**\n * Redefine a property to have the given value. This is simply a type-safe wrapper around\n * `Object.defineProperty`, but it is useful for caching public getters on first read.\n *\n * @example\n * ```typescript\n * // `randomOnce()` will return a random number, but always the same random number.\n * {\n * get randomOnce(): number {\n * return memoizeGetter(this, 'randomOnce', random(100))\n * }\n * }\n * ```\n * @param object - The object containing the property\n * @param propName - The name of the property on the object\n * @param value - The value of the property\n */\nexport function memoizeGetter<T, K extends keyof T>(object: T, propName: K, value: T[K]): T[K] {\n\tObject.defineProperty(object, propName, {\n\t\tvalue,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn value;\n}\n\n/**\n * Map an iterable to another iterable\n */\nexport function* map<T, R>(sequence: Iterable<T>, mapper: (t: T) => R): Iterable<R> {\n\tfor (const t of sequence) {\n\t\tyield mapper(t);\n\t}\n}\n\n/**\n * Filter an iterable into another iterable\n */\nexport function* filter<T>(sequence: Iterable<T>, filter: (t: T) => boolean): Iterable<T> {\n\tfor (const t of sequence) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Reduce an iterable into a single value, or undefined if the iterable has too few elements to reduce\n */\nexport function reduce<T>(\n\tsequence: Iterable<T>,\n\treduce: (previous: T, current: T) => T,\n\tinitialValue?: T\n): T | undefined {\n\tlet previous: T | undefined;\n\tlet current: T | undefined;\n\tfor (const t of sequence) {\n\t\tcurrent = t;\n\t\tif (previous === undefined) {\n\t\t\tif (initialValue !== undefined) {\n\t\t\t\tcurrent = reduce(initialValue, current);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrent = reduce(previous, current);\n\t\t}\n\t\tprevious = current;\n\t}\n\treturn current;\n}\n\n/**\n * Returns the first element of the given sequence that satisfies the given predicate, or undefined if no such element exists\n */\nexport function find<T>(sequence: Iterable<T>, find: (t: T) => boolean): T | undefined {\n\tfor (const t of sequence) {\n\t\tif (find(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Iterate through two iterables and return true if they yield equivalent elements in the same order.\n * @param iterableA - The first iterable to compare\n * @param iterableB - The second iterable to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareIterables<T>(\n\titerableA: Iterable<T>,\n\titerableB: Iterable<T>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\treturn compareIterators<T>(iterableA[Symbol.iterator](), iterableB[Symbol.iterator](), elementComparator);\n}\n\n/**\n * Iterate through two iterators and return true if they yield equivalent elements in the same order.\n * @param iteratorA - The first iterator to compare\n * @param iteratorB - The second iterator to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nfunction compareIterators<T, TReturn extends T = T>(\n\titeratorA: Iterator<T, TReturn>,\n\titeratorB: Iterator<T, TReturn>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\tlet a: IteratorResult<T, TReturn>;\n\tlet b: IteratorResult<T, TReturn>;\n\tfor (\n\t\ta = iteratorA.next(), b = iteratorB.next(); // Given two iterators...\n\t\ta.done !== true && b.done !== true; // ...while both have elements remaining...\n\t\ta = iteratorA.next(), b = iteratorB.next() // ...take one element at a time from each...\n\t) {\n\t\t// ...and ensure that their elements are equivalent\n\t\tif (!elementComparator(a.value, b.value)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// If one iterator is done, but not the other, then they are not equivalent\n\treturn a.done === b.done;\n}\n\n/**\n * Compare two maps and return true if their contents are equivalent.\n * @param mapA - The first array to compare\n * @param mapB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareMaps<K, V>(\n\tmapA: ReadonlyMap<K, V>,\n\tmapB: ReadonlyMap<K, V>,\n\telementComparator: (a: V, b: V) => boolean = Object.is\n): boolean {\n\tif (mapA.size !== mapB.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [keyA, valueA] of mapA) {\n\t\tconst valueB = mapB.get(keyA);\n\t\tif (valueB === undefined || !elementComparator(valueA, valueB)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(map: Map<K, V>, key: K, defaultValue: (key: K) => V): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Function which does nothing (no-ops).\n */\nexport function noop(): void {\n\t// noop\n}\n\n/**\n * Function which returns its input\n */\nexport function identity<T>(t: T): T {\n\treturn t;\n}\n\n/**\n * Copies a property in such a way that it is only set on `destination` if it is present on `source`.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function copyPropertyIfDefined<TSrc, TDst>(source: TSrc, destination: TDst, property: keyof TSrc): void {\n\tconst value = source[property];\n\tif (value !== undefined) {\n\t\t(destination as any)[property] = value;\n\t}\n}\n\n/**\n * Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function setPropertyIfDefined<TDst, P extends keyof TDst>(\n\tvalue: TDst[P] | undefined,\n\tdestination: TDst,\n\tproperty: P\n): void {\n\tif (value !== undefined) {\n\t\tdestination[property] = value;\n\t}\n}\n\n/**\n * @example\n * ```typescript\n * function (thing: ObjectWithMaybeFoo) {\n * \t const x: MyActualType = {\n * \t bar: 3\n * };\n * \t\tx.foo = 3;\n *\n * \t copyPropertyIfDefined(thing, x, 'foo');\n * }\n * ```\n */\n\nfunction breakOnDifference(): { break: boolean } {\n\treturn { break: true };\n}\n\n/**\n * Helper that returns whether two b-trees are equal.\n * Accelerated when large portions of the tree are shared between the two.\n */\nexport function compareBtrees<K, V>(treeA: BTree<K, V>, treeB: BTree<K, V>, compare: (valA: V, valB: V) => boolean) {\n\tconst diff = treeA.diffAgainst(treeB, breakOnDifference, breakOnDifference, (_, valA, valB) => {\n\t\tif (!compare(valA, valB)) {\n\t\t\treturn { break: true };\n\t\t}\n\t\treturn undefined;\n\t});\n\n\treturn diff === undefined;\n}\n\nexport function backmap<K, V>(forwardmap: Map<V, K>): Map<K, V> {\n\treturn new Map(map(forwardmap, ([key, value]) => [value, key]));\n}\n\n/**\n * A developer facing (non-localized) error message.\n * TODO: better error system.\n */\nexport type ErrorString = string;\n\n/**\n * Discriminated union instance that wraps either a result of type `TOk` or an error of type `TError`.\n */\nexport type Result<TOk, TError> = Result.Ok<TOk> | Result.Error<TError>;\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Result {\n\t/**\n\t * Factory function for making a successful Result.\n\t * @param result - The result to wrap in the Result.\n\t */\n\texport function ok<TOk>(result: TOk): Ok<TOk> {\n\t\treturn { type: ResultType.Ok, result };\n\t}\n\t/**\n\t * Factory function for making a unsuccessful Result.\n\t * @param error - The error to wrap in the Result.\n\t */\n\texport function error<TError>(error: TError): Error<TError> {\n\t\treturn { type: ResultType.Error, error };\n\t}\n\t/**\n\t * Type guard for successful Result.\n\t * @returns True if `result` is successful.\n\t */\n\texport function isOk<TOk, TError>(result: Result<TOk, TError>): result is Ok<TOk> {\n\t\treturn result.type === ResultType.Ok;\n\t}\n\t/**\n\t * Type guard for unsuccessful Result.\n\t * @returns True if `result` is unsuccessful.\n\t */\n\texport function isError<TOk, TError>(result: Result<TOk, TError>): result is Error<TError> {\n\t\treturn result.type === ResultType.Error;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is ok.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new result.\n\t * @returns The given result if it is not ok, the mapped result otherwise.\n\t */\n\texport function mapOk<TOkIn, TOkOut, TError>(\n\t\tresult: Result<TOkIn, TError>,\n\t\tmap: (ok: TOkIn) => TOkOut\n\t): Result<TOkOut, TError> {\n\t\treturn isOk(result) ? ok(map(result.result)) : result;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is an error.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new error.\n\t * @returns The given result if it is ok, the mapped result otherwise.\n\t */\n\texport function mapError<TOk, TErrorIn, TErrorOut>(\n\t\tresult: Result<TOk, TErrorIn>,\n\t\tmap: (error: TErrorIn) => TErrorOut\n\t): Result<TOk, TErrorOut> {\n\t\treturn isError(result) ? error(map(result.error)) : result;\n\t}\n\t/**\n\t * Tag value use to differentiate the members of the `Result` discriminated union.\n\t */\n\texport enum ResultType {\n\t\t/** Signals a successful result. */\n\t\tOk,\n\t\t/** Signals an unsuccessful result. */\n\t\tError,\n\t}\n\t/**\n\t * Wraps a result of type `TOk`.\n\t */\n\texport interface Ok<TOk> {\n\t\treadonly type: ResultType.Ok;\n\t\treadonly result: TOk;\n\t}\n\t/**\n\t * Wraps an error of type `TError`.\n\t */\n\texport interface Error<TError> {\n\t\treadonly type: ResultType.Error;\n\t\treadonly error: TError;\n\t}\n}\n\n/** Type that removes `readonly` from fields. */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/** Type that recursively removes `readonly` from fields. */\nexport type RecursiveMutable<T> = {\n\t-readonly [K in keyof T]: RecursiveMutable<T[K]>;\n};\n\n/** Type that produces a writeable map from a readonly map. */\nexport type MutableMap<T extends ReadonlyMap<unknown, unknown>> = T extends ReadonlyMap<infer K, infer V>\n\t? Map<K, V>\n\t: never;\n\n/** Type that includes the property K: V on T */\nexport type With<T, K extends keyof never, V> = T & { [key in K]: V };\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, 'delete' | 'clear'> {\n\tget(key: K): V;\n}\n\n/**\n * Change the given property Prop of type T to have a type of TPropNew\n */\nexport type ChangePropType<T, Prop extends keyof T, TPropNew> = Omit<T, Prop> & { [_ in Prop]: TPropNew };\n\n// eslint-disable-next-line @rushstack/no-new-null\ntype Primitive = string | number | bigint | boolean | null | symbol | undefined;\n\n/**\n * Recursively replace all properties with type assignable to type TReplace in T with properties of type TWith.\n */\nexport type ReplaceRecursive<T, TReplace, TWith> = T extends TReplace\n\t? TWith\n\t: T extends Primitive\n\t? T\n\t: {\n\t\t\t[P in keyof T]: ReplaceRecursive<T[P], TReplace, TWith>;\n\t };\n\n/** A union type of the first `N` positive integers */\nexport type TakeWholeNumbers<N extends number, A extends never[] = []> = N extends A['length']\n\t? never\n\t: A['length'] | TakeWholeNumbers<N, [never, ...A]>;\n/** Returns a tuple type with exactly `Length` elements of type `T` */\nexport type ArrayOfLength<T, Length extends number, A extends T[] = []> = Length extends A['length']\n\t? A\n\t: ArrayOfLength<T, Length, [T, ...A]>;\n/**\n * Fails if `array` does not have exactly `length` elements\n */\nexport function hasExactlyLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is ArrayOfLength<T, Len> {\n\treturn array.length === length;\n}\n/**\n * Fails if `array` does not have at least `length` elements\n */\nexport function hasLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is [...ArrayOfLength<T, Len>, ...T[]] {\n\treturn array.length >= length;\n}\n\n/**\n * Type for a rest parameter which can accept many values, or a single array.\n * Since a callee cannot modify an array passed as a rest parameter with the spread operator,\n * an array passed directly should be readonly for consistency (caller retains ownership).\n */\nexport type RestOrArray<T> = readonly T[] | [readonly T[]];\n\n/**\n * When value is a one-element array containing another array, unwraps and returns the inner array.\n * Otherwise, returns the provided array.\n * Useful for implementing functions with a `RestOrArray` parameter.\n * T must not be implemented with an array (`Array.isArray(t)` must return false)\n */\nexport function unwrapRestOrArray<T>(value: [any[]] extends [T] ? never : RestOrArray<T>): readonly T[] {\n\treturn value.length === 1 && Array.isArray(value[0]) ? value[0] : (value as T[]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EditLog.d.ts","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5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AC,OAAO,CAAC,GAAG,SAAS,CAAC;IAK3E;;OAEG;IACU,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAIlE;;OAEG;IACI,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;CAG5D"}
package/dist/EditLog.js CHANGED
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.EditLog = exports.getNumberOfHandlesFromEditLogSummary = exports.separateEditAndId = void 0;
11
11
  const sorted_btree_1 = __importDefault(require("sorted-btree"));
12
12
  const common_utils_1 = require("@fluidframework/common-utils");
13
+ const core_utils_1 = require("@fluidframework/core-utils");
13
14
  const Common_1 = require("./Common");
14
15
  /**
15
16
  * Returns an object that separates an Edit into two fields, id and editWithoutId.
@@ -345,7 +346,7 @@ class EditLog extends common_utils_1.TypedEventEmitter {
345
346
  equals(other) {
346
347
  // TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.
347
348
  // We can use our edit validation code when we write it since it will need to do deep walks of the changes.
348
- return (0, Common_1.compareArrays)(this.editIds, other.editIds);
349
+ return (0, core_utils_1.compareArrays)(this.editIds, other.editIds);
349
350
  }
350
351
  getEditLogSummary(compressEdit) {
351
352
  const editIds = this.sequencedEdits.map(({ id }) => id);
@@ -1 +1 @@
1
- {"version":3,"file":"EditLog.js","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,+DAAiE;AAEjE,qCAAuD;AAkJvD;;GAEG;AACH,SAAgB,iBAAiB,CAAU,IAAmB;IAI7D,MAAM,aAAa,mCAAQ,IAAI,KAAE,EAAE,EAAE,SAAS,GAAE,CAAC;IACjD,OAAO,aAAa,CAAC,EAAE,CAAC;IACxB,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC;AAP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AC,CAAC;IAChE,CAAC;CACD;AA/aD,0BA+aC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport { TypedEventEmitter } from '@fluidframework/common-utils';\nimport type { IEvent, ITelemetryLogger } from '@fluidframework/common-definitions';\nimport { assert, compareArrays, fail } from './Common';\nimport type { EditId } from './Identifiers';\nimport type { StringInterner } from './StringInterner';\nimport { Edit, EditLogSummary, EditWithoutId, FluidEditHandle } from './persisted-types';\nimport type { ChangeCompressor } from './ChangeCompression';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * @public\n * @sealed\n */\nexport interface OrderedEditSet<TChange = unknown> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\ttryGetEditAtIndex(index: number): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the edit with the given identifier within this `OrderedEditSet`.\n\t */\n\ttryGetEditFromId(editId: EditId): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t * @deprecated this will be removed in favor of {@link OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Compressor+interner pair used for encoding an {@link EditLog} into a summary.\n * @internal\n */\nexport interface EditLogEncoder {\n\tcompressor: ChangeCompressor;\n\tinterner: StringInterner;\n}\n\n/**\n * A sequence of edits that may or may not need to be downloaded into the EditLog from an external service\n * @deprecated Edit virtualization is no longer supported.\n */\nexport interface EditChunk<TChange> {\n\thandle?: EditHandle<TChange>;\n\tedits?: EditWithoutId<TChange>[];\n}\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * This is typically implemented by a wrapper around an IFluidHandle<ArrayBufferLike>.\n * @deprecated Edit virtualization is no longer supported.\n * @public\n */\nexport interface EditHandle<TChange> {\n\treadonly get: () => Promise<EditWithoutId<TChange>[]>;\n\treadonly baseHandle: FluidEditHandle;\n}\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): {\n\tid: EditId;\n\teditWithoutId: EditWithoutId<TChange>;\n} {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\n/**\n * @param summary - The edit log summary to parse.\n * @returns the number of handles saved to the provided edit log summary.\n * @deprecated Edit virtualization is no longer supported.\n */\nexport function getNumberOfHandlesFromEditLogSummary(summary: EditLogSummary<unknown, unknown>): number {\n\tconst { editChunks } = summary;\n\n\tlet numberOfHandles = 0;\n\teditChunks.forEach(({ chunk }) => {\n\t\tif (!Array.isArray(chunk)) {\n\t\t\tnumberOfHandles++;\n\t\t}\n\t});\n\n\treturn numberOfHandles;\n}\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * Event fired before edits are evicted from the edit log. It takes in a count of the number of edits to evict\n * starting from the oldest in memory edit. To get the edit itself, call {@link EditLog.getEditAtIndex}.\n * The edit index corresponds to the count + {@link EditLog.earliestAvailableEditIndex}.\n */\nexport type EditEvictionHandler = (editsToEvict: number) => void;\n\n/**\n * Events which may be emitted by {@link EditLog}\n * @public\n */\nexport interface IEditLogEvents extends IEvent {\n\t(event: 'unexpectedHistoryChunk', listener: () => void);\n}\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n */\nexport class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\n\tprivate readonly sequenceNumberToIndex?: BTree<number, number>;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEdits: Edit<TChange>[] = [];\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\n\tprivate readonly allEditIds: Map<EditId, OrderedEditId> = new Map();\n\tprivate _earliestAvailableEditIndex = 0;\n\tprivate readonly _editAddedHandlers: Set<EditAddedHandler<TChange>> = new Set();\n\tprivate readonly _editEvictionHandlers: Set<EditEvictionHandler> = new Set();\n\n\t/**\n\t * @returns The index of the earliest edit stored in this log.\n\t * Edit indices are unique and strictly increasing within the session.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this._earliestAvailableEditIndex;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t * @param editAddedHandlers - Optional handlers that are called when edits are added.\n\t * @param targetLength - The target number of sequenced edits that the log will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits greater than or equal to the `minSequenceNumber` (aka in the collaboration window) are not evicted.\n\t * @param evictionFrequency - The rate at which edits are evicted from memory. This is a factor of the editLogSize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t * @param editEvictionHandlers - Handlers that are called before edits are evicted from memory. This provides a chance for\n\t * callers to work with the edits before they are lost.\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange, EditHandle<TChange>> = { editIds: [], editChunks: [] },\n\t\tprivate readonly logger?: ITelemetryLogger,\n\t\teditAddedHandlers: readonly EditAddedHandler<TChange>[] = [],\n\t\tprivate readonly targetLength = Infinity,\n\t\tprivate readonly evictionFrequency = targetLength * 2,\n\t\teditEvictionHandlers: readonly EditEvictionHandler[] = []\n\t) {\n\t\tsuper();\n\t\tconst { editChunks, editIds } = summary;\n\n\t\tfor (const handler of editAddedHandlers) {\n\t\t\tthis.registerEditAddedHandler(handler);\n\t\t}\n\n\t\tif (targetLength !== Infinity) {\n\t\t\tif (targetLength < 0 || evictionFrequency < 0) {\n\t\t\t\tfail('targetLength and evictionFrequency should not be negative');\n\t\t\t}\n\t\t\tthis.sequenceNumberToIndex = new BTree([[0, 0]]);\n\t\t\tfor (const handler of editEvictionHandlers) {\n\t\t\t\tthis.registerEditEvictionHandler(handler);\n\t\t\t}\n\t\t}\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tfor (const [index, edit] of chunk.entries()) {\n\t\t\t\t\tconst editIndex = startRevision + index;\n\t\t\t\t\tconst id = editIds[editIndex];\n\t\t\t\t\tthis.sequencedEdits.push({ id, ...edit });\n\t\t\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\t\t\tassert(encounteredEditId === undefined, 'Duplicate acked edit.');\n\t\t\t\t\tthis.allEditIds.set(id, { isLocal: false, index: editIndex });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Ignore any edit handles, these edits are now unrecoverable.\n\t\t\t\t// This should instead download the edit chunk and store them but history is not\n\t\t\t\t// being used so we're going with the simpler solution.\n\t\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedEditHandleInSummary' });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): () => void {\n\t\tthis._editAddedHandlers.add(handler);\n\t\treturn () => this._editAddedHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditAddedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editAddedHandlers(): readonly EditAddedHandler<TChange>[] {\n\t\treturn Array.from(this._editAddedHandlers);\n\t}\n\n\t/**\n\t * Registers a handler that is called before an edit is evicted from this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditEvictionHandler(handler: EditEvictionHandler): () => void {\n\t\tthis._editEvictionHandlers.add(handler);\n\t\treturn () => this._editEvictionHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditEvictedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editEvictedHandlers(): readonly EditEvictionHandler[] {\n\t\treturn Array.from(this._editEvictionHandlers);\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEdits.map(({ id }) => id).concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry?.isLocal ?? false;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a sequenced revision (not local).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = this.allEditIds.get(this.localEdits[0].id) ?? fail('edit not found');\n\t\t\tassert(firstLocal.isLocal);\n\t\t\treturn (\n\t\t\t\tthis._earliestAvailableEditIndex +\n\t\t\t\tthis.numberOfSequencedEdits +\n\t\t\t\torderedEdit.localSequence -\n\t\t\t\tfirstLocal.localSequence\n\t\t\t);\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn this.allEditIds.get(editId) ?? fail('All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIdAtIndex}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex].id;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tpublic tryGetEditAtIndex(index: number): Edit<TChange> | undefined {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditFromId}\n\t */\n\tpublic tryGetEditFromId(editId: EditId): Edit<TChange> | undefined {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Returns all local edits from this EditLog\n\t * This is useful for op format upgrades, which might warrant re-submission of these ops using the new format.\n\t * See the breaking change documentation for more information.\n\t */\n\tpublic *getLocalEdits(): Iterable<Edit<TChange>> {\n\t\tfor (const edit of this.localEdits) {\n\t\t\tyield edit;\n\t\t}\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tassert(\n\t\t\tminSequenceNumber >= this._minSequenceNumber,\n\t\t\t'Sequenced edits should carry a monotonically increasing min number'\n\t\t);\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\n\t\tconst { id } = edit;\n\t\t// The index of the sequenced edit to add\n\t\tconst index = this._earliestAvailableEditIndex + this.numberOfSequencedEdits;\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 'Duplicate acked edit.');\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = this.localEdits.shift()?.id ?? fail('Local edit should exist');\n\t\t\tassert(oldLocalEditId === id, 'Causal ordering should be upheld');\n\t\t}\n\n\t\tthis.sequencedEdits.push(edit);\n\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tif (info !== undefined) {\n\t\t\tthis.sequenceNumberToIndex?.set(info.sequenceNumber, index);\n\t\t}\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\n\t\t// Check if any edits need to be evicted due to this addition\n\t\tif (this.sequenceNumberToIndex !== undefined && this.numberOfSequencedEdits >= this.evictionFrequency) {\n\t\t\tthis.evictEdits();\n\t\t}\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = { localSequence: this.localEditSequence++, isLocal: true };\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this._editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\tprivate evictEdits(): void {\n\t\tassert(\n\t\t\tthis.sequenceNumberToIndex !== undefined,\n\t\t\t'Edits should never be evicted if the target length is set to infinity'\n\t\t);\n\n\t\tconst minSequenceIndex =\n\t\t\tthis.sequenceNumberToIndex.getPairOrNextHigher(this._minSequenceNumber)?.[1] ??\n\t\t\tfail('No index associated with that sequence number.');\n\t\t// Exclude any edits in the collab window from being evicted\n\t\tconst numberOfEvictableEdits = minSequenceIndex - this.earliestAvailableEditIndex;\n\n\t\tif (numberOfEvictableEdits > 0) {\n\t\t\t// Evict either all but the target log size or the number of evictable edits, whichever is smaller\n\t\t\tconst numberOfDesiredEditsToEvict = this.numberOfSequencedEdits - this.targetLength;\n\t\t\tconst numberOfEditsToEvict = Math.min(numberOfEvictableEdits, numberOfDesiredEditsToEvict);\n\t\t\tfor (const handler of this._editEvictionHandlers) {\n\t\t\t\thandler(numberOfEditsToEvict);\n\t\t\t}\n\n\t\t\t// Remove the edits and move up the earliest available index\n\t\t\tconst removedEdits = this.sequencedEdits.splice(0, numberOfEditsToEvict);\n\t\t\tthis._earliestAvailableEditIndex += numberOfEditsToEvict;\n\n\t\t\t// On eviction, we need to remove the IDs of edits that have been evicted\n\t\t\tremovedEdits.forEach((edit) => this.allEditIds.delete(edit.id));\n\n\t\t\t// The minSequenceNumber is strictly increasing so we can clear sequence numbers before it\n\t\t\tthis.sequenceNumberToIndex.deleteRange(0, this._minSequenceNumber, false);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypesInternal>(other: EditLog<TOtherChangeTypesInternal>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary(): EditLogSummary<TChange, FluidEditHandle>;\n\t/**\n\t * @param compressEdit - a function which compresses edits\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TCompressedChange, FluidEditHandle>;\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit?: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TChange, FluidEditHandle> | EditLogSummary<TCompressedChange, FluidEditHandle> {\n\t\tconst editIds = this.sequencedEdits.map(({ id }) => id);\n\t\treturn compressEdit !== undefined\n\t\t\t? {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map((edit) => compressEdit(edit)),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ],\n\t\t\t\t\teditIds,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map(({ changes }) => ({ changes })),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ],\n\t\t\t\t\teditIds,\n\t\t\t };\n\t}\n\n\t// APIS DEPRECATED DUE TO HISTORY'S PEACEFUL DEATH\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n}\n"]}
1
+ {"version":3,"file":"EditLog.js","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,+DAAiE;AAEjE,2DAA2D;AAC3D,qCAAwC;AAkJxC;;GAEG;AACH,SAAgB,iBAAiB,CAAU,IAAmB;IAI7D,MAAM,aAAa,mCAAQ,IAAI,KAAE,EAAE,EAAE,SAAS,GAAE,CAAC;IACjD,OAAO,aAAa,CAAC,EAAE,CAAC;IACxB,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC;AAPD,8CAOC;AAED;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,OAAyC;IAC7F,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC1B,eAAe,EAAE,CAAC;SAClB;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACxB,CAAC;AAXD,oFAWC;AAwBD;;;;;;GAMG;AACH,MAAa,OAA2B,SAAQ,gCAAiC;IA6BhF;;;;;;;;;;;;;OAaG;IACH,YACC,UAAwD,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,E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,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;yBAC9D;qBACA;gBACL,OAAO;aACN,CAAC;IACN,CAAC;IAED,kDAAkD;IAClD;;OAEG;IACI,KAAK,CAAC,UAAU,CAAC,MAAc;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,KAAa;;QACxC,OAAO,MAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,mCAAI,IAAA,aAAI,EAAC,gBAAgB,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,uBAAuB,CAAC,KAAa;;QAC3C,OAAO,MAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,mCAAI,IAAA,aAAI,EAAC,gBAAgB,CAAC,CAAC;IAChE,CAAC;CACD;AA/aD,0BA+aC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport { TypedEventEmitter } from '@fluidframework/common-utils';\nimport type { IEvent, ITelemetryLogger } from '@fluidframework/common-definitions';\nimport { compareArrays } from '@fluidframework/core-utils';\nimport { assert, fail } from './Common';\nimport type { EditId } from './Identifiers';\nimport type { StringInterner } from './StringInterner';\nimport { Edit, EditLogSummary, EditWithoutId, FluidEditHandle } from './persisted-types';\nimport type { ChangeCompressor } from './ChangeCompression';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * @public\n * @sealed\n */\nexport interface OrderedEditSet<TChange = unknown> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\ttryGetEditAtIndex(index: number): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the edit with the given identifier within this `OrderedEditSet`.\n\t */\n\ttryGetEditFromId(editId: EditId): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t * @deprecated this will be removed in favor of {@link OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Compressor+interner pair used for encoding an {@link EditLog} into a summary.\n * @internal\n */\nexport interface EditLogEncoder {\n\tcompressor: ChangeCompressor;\n\tinterner: StringInterner;\n}\n\n/**\n * A sequence of edits that may or may not need to be downloaded into the EditLog from an external service\n * @deprecated Edit virtualization is no longer supported.\n */\nexport interface EditChunk<TChange> {\n\thandle?: EditHandle<TChange>;\n\tedits?: EditWithoutId<TChange>[];\n}\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * This is typically implemented by a wrapper around an IFluidHandle<ArrayBufferLike>.\n * @deprecated Edit virtualization is no longer supported.\n * @public\n */\nexport interface EditHandle<TChange> {\n\treadonly get: () => Promise<EditWithoutId<TChange>[]>;\n\treadonly baseHandle: FluidEditHandle;\n}\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): {\n\tid: EditId;\n\teditWithoutId: EditWithoutId<TChange>;\n} {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\n/**\n * @param summary - The edit log summary to parse.\n * @returns the number of handles saved to the provided edit log summary.\n * @deprecated Edit virtualization is no longer supported.\n */\nexport function getNumberOfHandlesFromEditLogSummary(summary: EditLogSummary<unknown, unknown>): number {\n\tconst { editChunks } = summary;\n\n\tlet numberOfHandles = 0;\n\teditChunks.forEach(({ chunk }) => {\n\t\tif (!Array.isArray(chunk)) {\n\t\t\tnumberOfHandles++;\n\t\t}\n\t});\n\n\treturn numberOfHandles;\n}\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * Event fired before edits are evicted from the edit log. It takes in a count of the number of edits to evict\n * starting from the oldest in memory edit. To get the edit itself, call {@link EditLog.getEditAtIndex}.\n * The edit index corresponds to the count + {@link EditLog.earliestAvailableEditIndex}.\n */\nexport type EditEvictionHandler = (editsToEvict: number) => void;\n\n/**\n * Events which may be emitted by {@link EditLog}\n * @public\n */\nexport interface IEditLogEvents extends IEvent {\n\t(event: 'unexpectedHistoryChunk', listener: () => void);\n}\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n */\nexport class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\n\tprivate readonly sequenceNumberToIndex?: BTree<number, number>;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEdits: Edit<TChange>[] = [];\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\n\tprivate readonly allEditIds: Map<EditId, OrderedEditId> = new Map();\n\tprivate _earliestAvailableEditIndex = 0;\n\tprivate readonly _editAddedHandlers: Set<EditAddedHandler<TChange>> = new Set();\n\tprivate readonly _editEvictionHandlers: Set<EditEvictionHandler> = new Set();\n\n\t/**\n\t * @returns The index of the earliest edit stored in this log.\n\t * Edit indices are unique and strictly increasing within the session.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this._earliestAvailableEditIndex;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t * @param editAddedHandlers - Optional handlers that are called when edits are added.\n\t * @param targetLength - The target number of sequenced edits that the log will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits greater than or equal to the `minSequenceNumber` (aka in the collaboration window) are not evicted.\n\t * @param evictionFrequency - The rate at which edits are evicted from memory. This is a factor of the editLogSize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t * @param editEvictionHandlers - Handlers that are called before edits are evicted from memory. This provides a chance for\n\t * callers to work with the edits before they are lost.\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange, EditHandle<TChange>> = { editIds: [], editChunks: [] },\n\t\tprivate readonly logger?: ITelemetryLogger,\n\t\teditAddedHandlers: readonly EditAddedHandler<TChange>[] = [],\n\t\tprivate readonly targetLength = Infinity,\n\t\tprivate readonly evictionFrequency = targetLength * 2,\n\t\teditEvictionHandlers: readonly EditEvictionHandler[] = []\n\t) {\n\t\tsuper();\n\t\tconst { editChunks, editIds } = summary;\n\n\t\tfor (const handler of editAddedHandlers) {\n\t\t\tthis.registerEditAddedHandler(handler);\n\t\t}\n\n\t\tif (targetLength !== Infinity) {\n\t\t\tif (targetLength < 0 || evictionFrequency < 0) {\n\t\t\t\tfail('targetLength and evictionFrequency should not be negative');\n\t\t\t}\n\t\t\tthis.sequenceNumberToIndex = new BTree([[0, 0]]);\n\t\t\tfor (const handler of editEvictionHandlers) {\n\t\t\t\tthis.registerEditEvictionHandler(handler);\n\t\t\t}\n\t\t}\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tfor (const [index, edit] of chunk.entries()) {\n\t\t\t\t\tconst editIndex = startRevision + index;\n\t\t\t\t\tconst id = editIds[editIndex];\n\t\t\t\t\tthis.sequencedEdits.push({ id, ...edit });\n\t\t\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\t\t\tassert(encounteredEditId === undefined, 'Duplicate acked edit.');\n\t\t\t\t\tthis.allEditIds.set(id, { isLocal: false, index: editIndex });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Ignore any edit handles, these edits are now unrecoverable.\n\t\t\t\t// This should instead download the edit chunk and store them but history is not\n\t\t\t\t// being used so we're going with the simpler solution.\n\t\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedEditHandleInSummary' });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): () => void {\n\t\tthis._editAddedHandlers.add(handler);\n\t\treturn () => this._editAddedHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditAddedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editAddedHandlers(): readonly EditAddedHandler<TChange>[] {\n\t\treturn Array.from(this._editAddedHandlers);\n\t}\n\n\t/**\n\t * Registers a handler that is called before an edit is evicted from this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditEvictionHandler(handler: EditEvictionHandler): () => void {\n\t\tthis._editEvictionHandlers.add(handler);\n\t\treturn () => this._editEvictionHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditEvictedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editEvictedHandlers(): readonly EditEvictionHandler[] {\n\t\treturn Array.from(this._editEvictionHandlers);\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEdits.map(({ id }) => id).concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry?.isLocal ?? false;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a sequenced revision (not local).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = this.allEditIds.get(this.localEdits[0].id) ?? fail('edit not found');\n\t\t\tassert(firstLocal.isLocal);\n\t\t\treturn (\n\t\t\t\tthis._earliestAvailableEditIndex +\n\t\t\t\tthis.numberOfSequencedEdits +\n\t\t\t\torderedEdit.localSequence -\n\t\t\t\tfirstLocal.localSequence\n\t\t\t);\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn this.allEditIds.get(editId) ?? fail('All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIdAtIndex}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex].id;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tpublic tryGetEditAtIndex(index: number): Edit<TChange> | undefined {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditFromId}\n\t */\n\tpublic tryGetEditFromId(editId: EditId): Edit<TChange> | undefined {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Returns all local edits from this EditLog\n\t * This is useful for op format upgrades, which might warrant re-submission of these ops using the new format.\n\t * See the breaking change documentation for more information.\n\t */\n\tpublic *getLocalEdits(): Iterable<Edit<TChange>> {\n\t\tfor (const edit of this.localEdits) {\n\t\t\tyield edit;\n\t\t}\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tassert(\n\t\t\tminSequenceNumber >= this._minSequenceNumber,\n\t\t\t'Sequenced edits should carry a monotonically increasing min number'\n\t\t);\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\n\t\tconst { id } = edit;\n\t\t// The index of the sequenced edit to add\n\t\tconst index = this._earliestAvailableEditIndex + this.numberOfSequencedEdits;\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 'Duplicate acked edit.');\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = this.localEdits.shift()?.id ?? fail('Local edit should exist');\n\t\t\tassert(oldLocalEditId === id, 'Causal ordering should be upheld');\n\t\t}\n\n\t\tthis.sequencedEdits.push(edit);\n\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tif (info !== undefined) {\n\t\t\tthis.sequenceNumberToIndex?.set(info.sequenceNumber, index);\n\t\t}\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\n\t\t// Check if any edits need to be evicted due to this addition\n\t\tif (this.sequenceNumberToIndex !== undefined && this.numberOfSequencedEdits >= this.evictionFrequency) {\n\t\t\tthis.evictEdits();\n\t\t}\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = { localSequence: this.localEditSequence++, isLocal: true };\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this._editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\tprivate evictEdits(): void {\n\t\tassert(\n\t\t\tthis.sequenceNumberToIndex !== undefined,\n\t\t\t'Edits should never be evicted if the target length is set to infinity'\n\t\t);\n\n\t\tconst minSequenceIndex =\n\t\t\tthis.sequenceNumberToIndex.getPairOrNextHigher(this._minSequenceNumber)?.[1] ??\n\t\t\tfail('No index associated with that sequence number.');\n\t\t// Exclude any edits in the collab window from being evicted\n\t\tconst numberOfEvictableEdits = minSequenceIndex - this.earliestAvailableEditIndex;\n\n\t\tif (numberOfEvictableEdits > 0) {\n\t\t\t// Evict either all but the target log size or the number of evictable edits, whichever is smaller\n\t\t\tconst numberOfDesiredEditsToEvict = this.numberOfSequencedEdits - this.targetLength;\n\t\t\tconst numberOfEditsToEvict = Math.min(numberOfEvictableEdits, numberOfDesiredEditsToEvict);\n\t\t\tfor (const handler of this._editEvictionHandlers) {\n\t\t\t\thandler(numberOfEditsToEvict);\n\t\t\t}\n\n\t\t\t// Remove the edits and move up the earliest available index\n\t\t\tconst removedEdits = this.sequencedEdits.splice(0, numberOfEditsToEvict);\n\t\t\tthis._earliestAvailableEditIndex += numberOfEditsToEvict;\n\n\t\t\t// On eviction, we need to remove the IDs of edits that have been evicted\n\t\t\tremovedEdits.forEach((edit) => this.allEditIds.delete(edit.id));\n\n\t\t\t// The minSequenceNumber is strictly increasing so we can clear sequence numbers before it\n\t\t\tthis.sequenceNumberToIndex.deleteRange(0, this._minSequenceNumber, false);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypesInternal>(other: EditLog<TOtherChangeTypesInternal>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary(): EditLogSummary<TChange, FluidEditHandle>;\n\t/**\n\t * @param compressEdit - a function which compresses edits\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TCompressedChange, FluidEditHandle>;\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit?: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TChange, FluidEditHandle> | EditLogSummary<TCompressedChange, FluidEditHandle> {\n\t\tconst editIds = this.sequencedEdits.map(({ id }) => id);\n\t\treturn compressEdit !== undefined\n\t\t\t? {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map((edit) => compressEdit(edit)),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ],\n\t\t\t\t\teditIds,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map(({ changes }) => ({ changes })),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ],\n\t\t\t\t\teditIds,\n\t\t\t };\n\t}\n\n\t// APIS DEPRECATED DUE TO HISTORY'S PEACEFUL DEATH\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EditUtilities.d.ts","sourceRoot":"","sources":["../src/EditUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAkC,MAAM,EAAE,MAAM,EAAE,YAAY,EAA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C,QAAQ,GAClC;IACA,IAAI,EAAE,yBAAyB,CAAC,QAAQ,CAAC;IACzC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,YAAY,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAEL;;GAEG;AACH,oBAAY,wBAAwB,GAAG,OAAO,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAavG;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,aAAa,EAAE,WAAW,GACxB,eAAe,CAEjB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,WAAW,GACxB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAExD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAKpE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAEpE;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,aAAa,GAC1B,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAOrD"}
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.internalizeBuildNode = exports.deepCloneStableRange = exports.deepCloneStablePlace = exports.detachRange = exports.insertIntoTrait = exports.RangeValidationResultKind = exports.validateStableRange = exports.PlaceValidationResult = exports.validateStablePlace = exports.setTraitInternal = exports.setTrait = exports.areRevisionViewsSemanticallyEqual = exports.compareNodes = exports.deepCompareNodes = exports.walkTree = exports.convertTreeNodes = exports.newEditId = exports.newEdit = exports.compareEdits = void 0;
8
8
  const uuid_1 = require("uuid");
9
+ const core_utils_1 = require("@fluidframework/core-utils");
9
10
  const Common_1 = require("./Common");
10
11
  const persisted_types_1 = require("./persisted-types");
11
12
  const ChangeTypes_1 = require("./ChangeTypes");
@@ -148,7 +149,7 @@ function deepCompareNodes(a, b, comparator = compareNodes) {
148
149
  if (childrenA.length !== childrenB.length) {
149
150
  return false;
150
151
  }
151
- const traitsEqual = (0, Common_1.compareArrays)(childrenA, childrenB, (childA, childB) => {
152
+ const traitsEqual = (0, core_utils_1.compareArrays)(childrenA, childrenB, (childA, childB) => {
152
153
  if (typeof childA === 'number' || typeof childB === 'number') {
153
154
  // Check if children are DetachedSequenceIds
154
155
  return childA === childB;