@fluid-experimental/tree 2.81.1 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/api-report/experimental-tree.alpha.api.md +0 -3
- package/biome.jsonc +1 -1
- package/dist/ChangeTypes.d.ts +23 -5
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +23 -5
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +7 -3
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +7 -3
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +2 -0
- package/dist/Common.js.map +1 -1
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +3 -1
- package/dist/LogViewer.js.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +21 -21
- package/dist/id-compressor/AppendOnlySortedMap.js +21 -21
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/ChangeTypes.d.ts +23 -5
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/ChangeTypes.js +23 -5
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +7 -3
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +7 -3
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +2 -0
- package/lib/Common.js.map +1 -1
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +3 -1
- package/lib/LogViewer.js.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +21 -21
- package/lib/id-compressor/AppendOnlySortedMap.js +21 -21
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/package.json +24 -24
- package/src/ChangeTypes.ts +23 -5
- package/src/Checkout.ts +7 -3
- package/src/Common.ts +4 -3
- package/src/LogViewer.ts +1 -0
- package/src/id-compressor/AppendOnlySortedMap.ts +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppendOnlySortedMap.js","sourceRoot":"","sources":["../../src/id-compressor/AppendOnlySortedMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,kEAA6D;AAE7D,4CAAoC;AAEpC;;;GAGG;AACH,MAAa,mBAAmB;IAG/B;;OAEG;IACH,YAAsC,UAAkC;QAAlC,eAAU,GAAV,UAAU,CAAwB;QALrD,aAAQ,GAAc,EAAE,CAAC;IAK+B,CAAC;IAE5E;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAkB,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAkB,CAAC;IACjE,CAAC;IAED;;OAEG;IACI,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAkB,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAkB,CAAC;IACjE,CAAC;IAED;;OAEG;IACI,KAAK;QACX,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;QAC5B,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI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C,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACI,yBAAyB,CAAC,WAAc;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACI,0BAA0B,CAAC,WAAc;QAC/C,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,WAAW;QACjB,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,IAAuC,CAAC;QAC5C,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACxB,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAC1F,KAAK,CAAC,mCAAmC,CACzC,CAAC;YACH,CAAC;YACD,IAAI,GAAG,EAAE,CAAC;QACX,CAAC;IACF,CAAC;CACD;AApED,8DAoEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { fail } from '../Common.js';\n\n/**\n * A map in which entries are always added in key-sorted order.\n * Supports appending and searching.\n */\nexport class AppendOnlySortedMap<K, V> {\n\tprotected readonly elements: (K | V)[] = [];\n\n\t/**\n\t * @param comparator - a comparator for keys\n\t */\n\tpublic constructor(protected readonly comparator: (a: K, b: K) => number) {}\n\n\t/**\n\t * @returns the number of entries in this map\n\t */\n\tpublic get size(): number {\n\t\treturn this.elements.length / 2;\n\t}\n\n\t/**\n\t * @returns the min key in the map.\n\t */\n\tpublic minKey(): K | undefined {\n\t\treturn this.elements[0] as K | undefined;\n\t}\n\n\t/**\n\t * @returns the max key in the map.\n\t */\n\tpublic maxKey(): K | undefined {\n\t\treturn this.elements[this.elements.length - 2] as K | undefined;\n\t}\n\n\t/**\n\t * @returns the min value in the map.\n\t */\n\tpublic minValue(): V | undefined {\n\t\treturn this.elements[1] as V | undefined;\n\t}\n\n\t/**\n\t * @returns the min value in the map.\n\t */\n\tpublic maxValue(): V | undefined {\n\t\treturn this.elements[this.elements.length - 1] as V | undefined;\n\t}\n\n\t/**\n\t * @returns the min key in the map.\n\t */\n\tpublic first(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[0] as K, elements[1] as V];\n\t}\n\n\t/**\n\t * @returns the max key in the map.\n\t */\n\tpublic last(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst lastKeyIndex = length - 2;\n\t\treturn [elements[lastKeyIndex] as K, elements[lastKeyIndex + 1] as V];\n\t}\n\n\t/**\n\t * Returns the element at the insertion index.\n\t */\n\tpublic getAtIndex(index: number): [K, V] | undefined {\n\t\tconst realIndex = index * 2;\n\t\tconst { elements } = this;\n\t\tif (realIndex < 0 || realIndex > elements.length - 1) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[realIndex] as K, elements[realIndex + 1] as V];\n\t}\n\n\t/**\n\t * @returns an iterable of the entries in the map.\n\t */\n\tpublic *entries(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the keys in the map.\n\t */\n\tpublic *keys(): IterableIterator<K> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i] as K;\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the values in the map.\n\t */\n\tpublic *values(): IterableIterator<V> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i + 1] as V;\n\t\t}\n\t}\n\n\t/**\n\t * @returns an iterable of the entries in the map, reversed.\n\t */\n\tpublic *entriesReversed(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = elements.length - 2; i >= 0; i -= 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new key/value pair to the map. `key` must be \\> to all keys in the map.\n\t * @param key - the key to add.\n\t * @param value - the value to add.\n\t */\n\tpublic append(key: K, value: V): void {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length !== 0 && this.comparator(key, this.maxKey() as K) <= 0) {\n\t\t\tfail('Inserted key must be > all others in the map.');\n\t\t}\n\t\telements.push(key);\n\t\telements.push(value);\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the value associated with `key` if such an entry exists, and undefined otherwise.\n\t */\n\tpublic get(key: K): V | undefined {\n\t\tconst index = AppendOnlySortedMap.keyIndexOf(this.elements, key, this.comparator);\n\t\tif (index < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.elements[index + 1] as V;\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the entry associated with `key` if such an entry exists, the entry associated with the next lower key if such an entry\n\t * exists, and undefined otherwise.\n\t */\n\tpublic getPairOrNextLower(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextLowerBy(key, this.comparator);\n\t}\n\n\t/**\n\t * @param key - the key to lookup.\n\t * @returns the entry associated with `key` if such an entry exists, the entry associated with the next higher key if such an entry\n\t * exists, and undefined otherwise.\n\t */\n\tpublic getPairOrNextHigher(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextHigherBy(key, this.comparator);\n\t}\n\n\t/**\n\t * Compares two `AppendOnlySortedMap`s.\n\t */\n\tpublic equals(other: AppendOnlySortedMap<K, V>, compareValues: (a: V, b: V) => boolean): boolean {\n\t\tif (other === this) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.elements.length !== other.elements.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (let i = this.elements.length - 2; i >= 0; i -= 2) {\n\t\t\tconst keyThis = this.elements[i] as K;\n\t\t\tconst valueThis = this.elements[i + 1] as V;\n\t\t\tconst keyOther = other.elements[i] as K;\n\t\t\tconst valueOther = other.elements[i + 1] as V;\n\t\t\tif (this.comparator(keyThis, keyOther) !== 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!compareValues(valueThis, valueOther)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test-only expensive assertions to check the internal validity of the data structure.\n\t */\n\tpublic assertValid(): void {\n\t\tlet prev: readonly [K, unknown] | undefined;\n\t\tfor (const kv of this.entries()) {\n\t\t\tif (prev !== undefined) {\n\t\t\t\tassert(this.comparator(kv[0], prev[0]) > 0, 0x63e /* Keys in map must be sorted. */);\n\t\t\t}\n\t\t\tprev = kv;\n\t\t}\n\t}\n\n\t/**\n\t * Queries a range of entries.\n\t * @param from - the key to start the range query at, inclusive.\n\t * @param to - the key to end the range query at, inclusive.\n\t * @returns the range of entries.\n\t */\n\tpublic *getRange(from: K, to: K): IterableIterator<readonly [K, V]> {\n\t\tconst keyIndexFrom = this.getKeyIndexOfOrNextHigher(from, this.comparator);\n\t\tif (keyIndexFrom === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst keyIndexTo = this.getKeyIndexOfOrNextLower(to, this.comparator);\n\t\tif (keyIndexTo === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = keyIndexFrom; i <= keyIndexTo; i += 2) {\n\t\t\tyield [this.elements[i] as K, this.elements[i + 1] as V];\n\t\t}\n\t}\n\n\tprotected getPairOrNextLowerBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextLower(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextLower<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tif (elements.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex > 0) {\n\t\t\t\treturn keyIndex - 2;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\tprotected getPairOrNextHigherBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextHigher(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextHigher<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex < length) {\n\t\t\t\treturn keyIndex;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\t/**\n\t * The value xor'd with the result index when a search fails.\n\t */\n\tpublic static readonly failureXor = -1;\n\n\t/**\n\t * Performs a binary search on the sorted array.\n\t * @returns the index of the key for `search`, or (if not present) the index it would have been inserted into xor'd\n\t * with `failureXor`. Note that negating is not an adequate solution as that could result in -0.\n\t */\n\tpublic static keyIndexOf<T, K, V>(\n\t\telements: readonly (K | V)[],\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number {\n\t\t// Low, high, and mid are addresses of [K,V] pairs and *not* key indices\n\t\tlet low = 0;\n\t\tlet high = elements.length / 2;\n\t\tlet mid = high >> 1;\n\t\twhile (low < high) {\n\t\t\tconst keyIndex = mid * 2;\n\t\t\tconst c = comparator(search, elements[keyIndex] as K, elements[keyIndex + 1] as V);\n\t\t\tif (c > 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (c < 0) {\n\t\t\t\thigh = mid;\n\t\t\t} else if (c === 0) {\n\t\t\t\treturn keyIndex;\n\t\t\t} else {\n\t\t\t\tfail('Invalid comparator.');\n\t\t\t}\n\t\t\tmid = (low + high) >> 1;\n\t\t}\n\t\treturn (mid * 2) ^ AppendOnlySortedMap.failureXor;\n\t}\n}\n\n/**\n * A map in which entries are always added in both key-sorted and value-sorted order.\n * Supports appending and searching.\n */\nexport class AppendOnlyDoublySortedMap<K, V, S> extends AppendOnlySortedMap<K, V> {\n\tpublic constructor(\n\t\tkeyComparator: (a: K, b: K) => number,\n\t\tprivate readonly extractSearchValue: (value: V) => S,\n\t\tprivate readonly valueComparator: (search: S, value: S) => number\n\t) {\n\t\tsuper(keyComparator);\n\t}\n\n\tpublic append(key: K, value: V): void {\n\t\tif (\n\t\t\tthis.elements.length !== 0 &&\n\t\t\tthis.valueComparator(this.extractSearchValue(value), this.extractSearchValue(this.maxValue() as V)) <= 0\n\t\t) {\n\t\t\tfail('Inserted value must be > all others in the map.');\n\t\t}\n\t\tsuper.append(key, value);\n\t}\n\n\tprivate readonly compareValues = (search: S, _: K, value: V): number => {\n\t\treturn this.valueComparator(search, this.extractSearchValue(value));\n\t};\n\n\t/**\n\t * @param value - the value to lookup.\n\t * @returns the key associated with `value` if such an entry exists, and undefined otherwise.\n\t */\n\tpublic getByValue(value: S): K | undefined {\n\t\tconst index = AppendOnlySortedMap.keyIndexOf(this.elements, value, this.compareValues);\n\t\treturn this.elements[index]?.[0];\n\t}\n\n\t/**\n\t * @param searchValue - the search value to lookup.\n\t * @returns the entry who's value, when run through the extractor provided to the constructor, matches\n\t * `searchValue`. If no such entry exists, this method returns the next lower entry as determined by the value\n\t * comparator provided to the constructor. If no such entry exists, this method returns undefined.\n\t */\n\tpublic getPairOrNextLowerByValue(searchValue: S): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextLowerBy(searchValue, this.compareValues);\n\t}\n\n\t/**\n\t * @param searchValue - the search value to lookup.\n\t * @returns the entry who's value, when run through the extractor provided to the constructor, matches `searchValue`. If no such entry\n\t * exists, this method returns the next higher entry as determined by the value comparator provided to the constructor. If no such entry\n\t * exists, this method returns undefined.\n\t */\n\tpublic getPairOrNextHigherByValue(searchValue: S): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextHigherBy(searchValue, this.compareValues);\n\t}\n\n\t/**\n\t * Test-only expensive assertions to check the internal validity of the data structure.\n\t */\n\tpublic assertValid(): void {\n\t\tsuper.assertValid();\n\t\tlet prev: readonly [unknown, V] | undefined;\n\t\tfor (const kv of this.entries()) {\n\t\t\tif (prev !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.valueComparator(this.extractSearchValue(kv[1]), this.extractSearchValue(prev[1])) > 0,\n\t\t\t\t\t0x63f /* Values in map must be sorted. */\n\t\t\t\t);\n\t\t\t}\n\t\t\tprev = kv;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version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yBAAyB,CAAC,WAAc;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACI,0BAA0B,CAAC,WAAc;QAC/C,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,WAAW;QACjB,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,IAAuC,CAAC;QAC5C,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACxB,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAC1F,KAAK,CAAC,mCAAmC,CACzC,CAAC;YACH,CAAC;YACD,IAAI,GAAG,EAAE,CAAC;QACX,CAAC;IACF,CAAC;CACD;AApED,8DAoEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { fail } from '../Common.js';\n\n/**\n * A map in which entries are always added in key-sorted order.\n * Supports appending and searching.\n */\nexport class AppendOnlySortedMap<K, V> {\n\tprotected readonly elements: (K | V)[] = [];\n\n\t/**\n\t * @param comparator - a comparator for keys\n\t */\n\tpublic constructor(protected readonly comparator: (a: K, b: K) => number) {}\n\n\t/**\n\t * Gets the number of entries in this map\n\t */\n\tpublic get size(): number {\n\t\treturn this.elements.length / 2;\n\t}\n\n\t/**\n\t * Gets the min key in the map.\n\t */\n\tpublic minKey(): K | undefined {\n\t\treturn this.elements[0] as K | undefined;\n\t}\n\n\t/**\n\t * Gets the max key in the map.\n\t */\n\tpublic maxKey(): K | undefined {\n\t\treturn this.elements[this.elements.length - 2] as K | undefined;\n\t}\n\n\t/**\n\t * Gets the min value in the map.\n\t */\n\tpublic minValue(): V | undefined {\n\t\treturn this.elements[1] as V | undefined;\n\t}\n\n\t/**\n\t * Gets the max value in the map.\n\t */\n\tpublic maxValue(): V | undefined {\n\t\treturn this.elements[this.elements.length - 1] as V | undefined;\n\t}\n\n\t/**\n\t * Gets the first entry in the map.\n\t */\n\tpublic first(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[0] as K, elements[1] as V];\n\t}\n\n\t/**\n\t * Gets the last entry in the map.\n\t */\n\tpublic last(): [K, V] | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst lastKeyIndex = length - 2;\n\t\treturn [elements[lastKeyIndex] as K, elements[lastKeyIndex + 1] as V];\n\t}\n\n\t/**\n\t * Returns the element at the insertion index.\n\t */\n\tpublic getAtIndex(index: number): [K, V] | undefined {\n\t\tconst realIndex = index * 2;\n\t\tconst { elements } = this;\n\t\tif (realIndex < 0 || realIndex > elements.length - 1) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn [elements[realIndex] as K, elements[realIndex + 1] as V];\n\t}\n\n\t/**\n\t * Gets an iterable of the entries in the map.\n\t */\n\tpublic *entries(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * Gets an iterable of the keys in the map.\n\t */\n\tpublic *keys(): IterableIterator<K> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i] as K;\n\t\t}\n\t}\n\n\t/**\n\t * Gets an iterable of the values in the map.\n\t */\n\tpublic *values(): IterableIterator<V> {\n\t\tconst { elements } = this;\n\t\tfor (let i = 0; i < elements.length; i += 2) {\n\t\t\tyield elements[i + 1] as V;\n\t\t}\n\t}\n\n\t/**\n\t * Gets an iterable of the entries in the map, reversed.\n\t */\n\tpublic *entriesReversed(): IterableIterator<readonly [K, V]> {\n\t\tconst { elements } = this;\n\t\tfor (let i = elements.length - 2; i >= 0; i -= 2) {\n\t\t\tyield [elements[i] as K, elements[i + 1] as V];\n\t\t}\n\t}\n\n\t/**\n\t * Adds a new key/value pair to the map. `key` must be \\> to all keys in the map.\n\t * @param key - The key to add.\n\t * @param value - The value to add.\n\t */\n\tpublic append(key: K, value: V): void {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length !== 0 && this.comparator(key, this.maxKey() as K) <= 0) {\n\t\t\tfail('Inserted key must be > all others in the map.');\n\t\t}\n\t\telements.push(key);\n\t\telements.push(value);\n\t}\n\n\t/**\n\t * Gets the value associated with `key` if such an entry exists, and `undefined` otherwise.\n\t * @param key - The key to lookup.\n\t */\n\tpublic get(key: K): V | undefined {\n\t\tconst index = AppendOnlySortedMap.keyIndexOf(this.elements, key, this.comparator);\n\t\tif (index < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.elements[index + 1] as V;\n\t}\n\n\t/**\n\t * Gets the entry associated with `key` if such an entry exists, the entry associated with the next lower key if\n\t * such an entry exists, and `undefined` otherwise.\n\t * @param key - The key to lookup.\n\t */\n\tpublic getPairOrNextLower(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextLowerBy(key, this.comparator);\n\t}\n\n\t/**\n\t * Gets the entry associated with `key` if such an entry exists, the entry associated with the next higher key if\n\t * such an entry exists, and `undefined` otherwise.\n\t * @param key - The key to lookup.\n\t */\n\tpublic getPairOrNextHigher(key: K): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextHigherBy(key, this.comparator);\n\t}\n\n\t/**\n\t * Compares two `AppendOnlySortedMap`s.\n\t */\n\tpublic equals(other: AppendOnlySortedMap<K, V>, compareValues: (a: V, b: V) => boolean): boolean {\n\t\tif (other === this) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.elements.length !== other.elements.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (let i = this.elements.length - 2; i >= 0; i -= 2) {\n\t\t\tconst keyThis = this.elements[i] as K;\n\t\t\tconst valueThis = this.elements[i + 1] as V;\n\t\t\tconst keyOther = other.elements[i] as K;\n\t\t\tconst valueOther = other.elements[i + 1] as V;\n\t\t\tif (this.comparator(keyThis, keyOther) !== 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!compareValues(valueThis, valueOther)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Test-only expensive assertions to check the internal validity of the data structure.\n\t */\n\tpublic assertValid(): void {\n\t\tlet prev: readonly [K, unknown] | undefined;\n\t\tfor (const kv of this.entries()) {\n\t\t\tif (prev !== undefined) {\n\t\t\t\tassert(this.comparator(kv[0], prev[0]) > 0, 0x63e /* Keys in map must be sorted. */);\n\t\t\t}\n\t\t\tprev = kv;\n\t\t}\n\t}\n\n\t/**\n\t * Queries a range of entries.\n\t * @param from - the key to start the range query at, inclusive.\n\t * @param to - the key to end the range query at, inclusive.\n\t * @returns the range of entries.\n\t */\n\tpublic *getRange(from: K, to: K): IterableIterator<readonly [K, V]> {\n\t\tconst keyIndexFrom = this.getKeyIndexOfOrNextHigher(from, this.comparator);\n\t\tif (keyIndexFrom === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst keyIndexTo = this.getKeyIndexOfOrNextLower(to, this.comparator);\n\t\tif (keyIndexTo === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let i = keyIndexFrom; i <= keyIndexTo; i += 2) {\n\t\t\tyield [this.elements[i] as K, this.elements[i + 1] as V];\n\t\t}\n\t}\n\n\tprotected getPairOrNextLowerBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextLower(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextLower<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tif (elements.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex > 0) {\n\t\t\t\treturn keyIndex - 2;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\tprotected getPairOrNextHigherBy<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): readonly [K, V] | undefined {\n\t\tconst keyIndex = this.getKeyIndexOfOrNextHigher(search, comparator);\n\t\tif (keyIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [this.elements[keyIndex] as K, this.elements[keyIndex + 1] as V];\n\t}\n\n\tprivate getKeyIndexOfOrNextHigher<T>(\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number | undefined {\n\t\tconst { elements } = this;\n\t\tconst { length } = elements;\n\t\tif (length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet keyIndex = AppendOnlySortedMap.keyIndexOf(elements, search, comparator);\n\t\tif (keyIndex < 0) {\n\t\t\tkeyIndex ^= AppendOnlySortedMap.failureXor;\n\t\t\tif (keyIndex < length) {\n\t\t\t\treturn keyIndex;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn keyIndex;\n\t}\n\n\t/**\n\t * The value xor'd with the result index when a search fails.\n\t */\n\tpublic static readonly failureXor = -1;\n\n\t/**\n\t * Performs a binary search on the sorted array.\n\t * @returns the index of the key for `search`, or (if not present) the index it would have been inserted into xor'd\n\t * with `failureXor`. Note that negating is not an adequate solution as that could result in -0.\n\t */\n\tpublic static keyIndexOf<T, K, V>(\n\t\telements: readonly (K | V)[],\n\t\tsearch: T,\n\t\tcomparator: (search: T, key: K, value: V) => number\n\t): number {\n\t\t// Low, high, and mid are addresses of [K,V] pairs and *not* key indices\n\t\tlet low = 0;\n\t\tlet high = elements.length / 2;\n\t\tlet mid = high >> 1;\n\t\twhile (low < high) {\n\t\t\tconst keyIndex = mid * 2;\n\t\t\tconst c = comparator(search, elements[keyIndex] as K, elements[keyIndex + 1] as V);\n\t\t\tif (c > 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (c < 0) {\n\t\t\t\thigh = mid;\n\t\t\t} else if (c === 0) {\n\t\t\t\treturn keyIndex;\n\t\t\t} else {\n\t\t\t\tfail('Invalid comparator.');\n\t\t\t}\n\t\t\tmid = (low + high) >> 1;\n\t\t}\n\t\treturn (mid * 2) ^ AppendOnlySortedMap.failureXor;\n\t}\n}\n\n/**\n * A map in which entries are always added in both key-sorted and value-sorted order.\n * Supports appending and searching.\n */\nexport class AppendOnlyDoublySortedMap<K, V, S> extends AppendOnlySortedMap<K, V> {\n\tpublic constructor(\n\t\tkeyComparator: (a: K, b: K) => number,\n\t\tprivate readonly extractSearchValue: (value: V) => S,\n\t\tprivate readonly valueComparator: (search: S, value: S) => number\n\t) {\n\t\tsuper(keyComparator);\n\t}\n\n\tpublic append(key: K, value: V): void {\n\t\tif (\n\t\t\tthis.elements.length !== 0 &&\n\t\t\tthis.valueComparator(this.extractSearchValue(value), this.extractSearchValue(this.maxValue() as V)) <= 0\n\t\t) {\n\t\t\tfail('Inserted value must be > all others in the map.');\n\t\t}\n\t\tsuper.append(key, value);\n\t}\n\n\tprivate readonly compareValues = (search: S, _: K, value: V): number => {\n\t\treturn this.valueComparator(search, this.extractSearchValue(value));\n\t};\n\n\t/**\n\t * @param value - the value to lookup.\n\t * @returns the key associated with `value` if such an entry exists, and undefined otherwise.\n\t */\n\tpublic getByValue(value: S): K | undefined {\n\t\tconst index = AppendOnlySortedMap.keyIndexOf(this.elements, value, this.compareValues);\n\t\treturn this.elements[index]?.[0];\n\t}\n\n\t/**\n\t * @param searchValue - the search value to lookup.\n\t * @returns the entry who's value, when run through the extractor provided to the constructor, matches\n\t * `searchValue`. If no such entry exists, this method returns the next lower entry as determined by the value\n\t * comparator provided to the constructor. If no such entry exists, this method returns undefined.\n\t */\n\tpublic getPairOrNextLowerByValue(searchValue: S): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextLowerBy(searchValue, this.compareValues);\n\t}\n\n\t/**\n\t * @param searchValue - the search value to lookup.\n\t * @returns the entry who's value, when run through the extractor provided to the constructor, matches `searchValue`. If no such entry\n\t * exists, this method returns the next higher entry as determined by the value comparator provided to the constructor. If no such entry\n\t * exists, this method returns undefined.\n\t */\n\tpublic getPairOrNextHigherByValue(searchValue: S): readonly [K, V] | undefined {\n\t\treturn this.getPairOrNextHigherBy(searchValue, this.compareValues);\n\t}\n\n\t/**\n\t * Test-only expensive assertions to check the internal validity of the data structure.\n\t */\n\tpublic assertValid(): void {\n\t\tsuper.assertValid();\n\t\tlet prev: readonly [unknown, V] | undefined;\n\t\tfor (const kv of this.entries()) {\n\t\t\tif (prev !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.valueComparator(this.extractSearchValue(kv[1]), this.extractSearchValue(prev[1])) > 0,\n\t\t\t\t\t0x63f /* Values in map must be sorted. */\n\t\t\t\t);\n\t\t\t}\n\t\t\tprev = kv;\n\t\t}\n\t}\n}\n"]}
|
package/lib/ChangeTypes.d.ts
CHANGED
|
@@ -176,15 +176,21 @@ export declare const Change: {
|
|
|
176
176
|
constraint: (toConstrain: StableRange, effect: ConstraintEffect, identityHash?: UuidString, length?: number, contentHash?: UuidString, parentNode?: NodeId, label?: TraitLabel) => Constraint;
|
|
177
177
|
/** Helpers for making high-level composite operations */
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
179
|
+
* Deletes a range of nodes from the tree.
|
|
180
|
+
*
|
|
181
|
+
* @returns A change that deletes the supplied part of the tree.
|
|
180
182
|
*/
|
|
181
183
|
delete: (stableRange: StableRange) => Change;
|
|
182
184
|
/**
|
|
183
|
-
*
|
|
185
|
+
* Inserts nodes into the tree at the specified location.
|
|
186
|
+
*
|
|
187
|
+
* @returns The changes that insert 'nodes' into the specified location in the tree.
|
|
184
188
|
*/
|
|
185
189
|
insertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace) => Change[];
|
|
186
190
|
/**
|
|
187
|
-
*
|
|
191
|
+
* Moves nodes from one location to another in the tree.
|
|
192
|
+
*
|
|
193
|
+
* @returns The changes that moves the specified content to a new location in the tree.
|
|
188
194
|
*/
|
|
189
195
|
move: (source: StableRange, destination: StablePlace) => Change[];
|
|
190
196
|
};
|
|
@@ -263,18 +269,26 @@ export interface StableRange {
|
|
|
263
269
|
*/
|
|
264
270
|
export declare const StablePlace: {
|
|
265
271
|
/**
|
|
272
|
+
* Creates a stable place representing the location directly before a node.
|
|
273
|
+
*
|
|
266
274
|
* @returns The location directly before `node`.
|
|
267
275
|
*/
|
|
268
276
|
before: (node: NodeData<NodeId> | NodeId) => StablePlace;
|
|
269
277
|
/**
|
|
278
|
+
* Creates a stable place representing the location directly after a node.
|
|
279
|
+
*
|
|
270
280
|
* @returns The location directly after `node`.
|
|
271
281
|
*/
|
|
272
282
|
after: (node: NodeData<NodeId> | NodeId) => StablePlace;
|
|
273
283
|
/**
|
|
284
|
+
* Creates a stable place representing the location at the start of a trait.
|
|
285
|
+
*
|
|
274
286
|
* @returns The location at the start of `trait`.
|
|
275
287
|
*/
|
|
276
288
|
atStartOf: (trait: TraitLocation) => StablePlace;
|
|
277
289
|
/**
|
|
290
|
+
* Creates a stable place representing the location at the end of a trait.
|
|
291
|
+
*
|
|
278
292
|
* @returns The location at the end of `trait`.
|
|
279
293
|
*/
|
|
280
294
|
atEndOf: (trait: TraitLocation) => StablePlace;
|
|
@@ -296,12 +310,16 @@ export declare const StableRange: {
|
|
|
296
310
|
to: (end: StablePlace) => StableRange;
|
|
297
311
|
};
|
|
298
312
|
/**
|
|
299
|
-
*
|
|
313
|
+
* Creates a `StableRange` which contains only the provided `node`.
|
|
314
|
+
*
|
|
315
|
+
* @remarks
|
|
300
316
|
* Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.
|
|
301
317
|
*/
|
|
302
318
|
only: (node: NodeData<NodeId> | NodeId) => StableRange;
|
|
303
319
|
/**
|
|
304
|
-
*
|
|
320
|
+
* Creates a `StableRange` which contains everything in the trait.
|
|
321
|
+
*
|
|
322
|
+
* @remarks
|
|
305
323
|
* This is anchored using the provided `trait`, and is independent of the actual contents of the trait:
|
|
306
324
|
* it does not use sibling anchoring.
|
|
307
325
|
*/
|
package/lib/ChangeTypes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeTypes.d.ts","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEzG;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,GA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,GAAG,MAAM,KAAG,WAAW;IAIpD;;;;;;OAMG;iBACU,aAAa,KAAG,WAAW;CAIxC,CAAC"}
|
package/lib/ChangeTypes.js
CHANGED
|
@@ -61,18 +61,24 @@ export const Change = {
|
|
|
61
61
|
}),
|
|
62
62
|
/** Helpers for making high-level composite operations */
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Deletes a range of nodes from the tree.
|
|
65
|
+
*
|
|
66
|
+
* @returns A change that deletes the supplied part of the tree.
|
|
65
67
|
*/
|
|
66
68
|
delete: (stableRange) => Change.detach(stableRange),
|
|
67
69
|
/**
|
|
68
|
-
*
|
|
70
|
+
* Inserts nodes into the tree at the specified location.
|
|
71
|
+
*
|
|
72
|
+
* @returns The changes that insert 'nodes' into the specified location in the tree.
|
|
69
73
|
*/
|
|
70
74
|
insertTree: (nodes, destination) => {
|
|
71
75
|
const build = Change.build(nodes, 0);
|
|
72
76
|
return [build, Change.insert(build.destination, destination)];
|
|
73
77
|
},
|
|
74
78
|
/**
|
|
75
|
-
*
|
|
79
|
+
* Moves nodes from one location to another in the tree.
|
|
80
|
+
*
|
|
81
|
+
* @returns The changes that moves the specified content to a new location in the tree.
|
|
76
82
|
*/
|
|
77
83
|
move: (source, destination) => {
|
|
78
84
|
const detach = Change.detach(source, 0);
|
|
@@ -92,6 +98,8 @@ export const Change = {
|
|
|
92
98
|
*/
|
|
93
99
|
export const StablePlace = {
|
|
94
100
|
/**
|
|
101
|
+
* Creates a stable place representing the location directly before a node.
|
|
102
|
+
*
|
|
95
103
|
* @returns The location directly before `node`.
|
|
96
104
|
*/
|
|
97
105
|
before: (node) => ({
|
|
@@ -99,6 +107,8 @@ export const StablePlace = {
|
|
|
99
107
|
referenceSibling: getNodeId(node),
|
|
100
108
|
}),
|
|
101
109
|
/**
|
|
110
|
+
* Creates a stable place representing the location directly after a node.
|
|
111
|
+
*
|
|
102
112
|
* @returns The location directly after `node`.
|
|
103
113
|
*/
|
|
104
114
|
after: (node) => ({
|
|
@@ -106,6 +116,8 @@ export const StablePlace = {
|
|
|
106
116
|
referenceSibling: getNodeId(node),
|
|
107
117
|
}),
|
|
108
118
|
/**
|
|
119
|
+
* Creates a stable place representing the location at the start of a trait.
|
|
120
|
+
*
|
|
109
121
|
* @returns The location at the start of `trait`.
|
|
110
122
|
*/
|
|
111
123
|
atStartOf: (trait) => ({
|
|
@@ -113,6 +125,8 @@ export const StablePlace = {
|
|
|
113
125
|
referenceTrait: trait,
|
|
114
126
|
}),
|
|
115
127
|
/**
|
|
128
|
+
* Creates a stable place representing the location at the end of a trait.
|
|
129
|
+
*
|
|
116
130
|
* @returns The location at the end of `trait`.
|
|
117
131
|
*/
|
|
118
132
|
atEndOf: (trait) => ({
|
|
@@ -144,7 +158,9 @@ export const StableRange = {
|
|
|
144
158
|
},
|
|
145
159
|
}),
|
|
146
160
|
/**
|
|
147
|
-
*
|
|
161
|
+
* Creates a `StableRange` which contains only the provided `node`.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
148
164
|
* Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.
|
|
149
165
|
*/
|
|
150
166
|
only: (node) => ({
|
|
@@ -152,7 +168,9 @@ export const StableRange = {
|
|
|
152
168
|
end: StablePlace.after(node),
|
|
153
169
|
}),
|
|
154
170
|
/**
|
|
155
|
-
*
|
|
171
|
+
* Creates a `StableRange` which contains everything in the trait.
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
156
174
|
* This is anchored using the provided `trait`, and is independent of the actual contents of the trait:
|
|
157
175
|
* it does not use sibling anchoring.
|
|
158
176
|
*/
|
package/lib/ChangeTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeTypes.js","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,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Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { assertNotUndefined } from './Common.js';\nimport { NodeId, TraitLabel, UuidString } from './Identifiers.js';\nimport { getNodeId } from './NodeIdUtilities.js';\nimport { TraitLocation } from './TreeView.js';\nimport { ConstraintEffect, NodeData, Payload, Side, TreeNodeSequence } from './persisted-types/index.js';\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasVariadicTraits<TChild> {\n\treadonly traits?: {\n\t\treadonly [key: string]: TChild | TreeNodeSequence<TChild> | undefined;\n\t};\n}\n\n/**\n * The type of a Change\n * @alpha\n */\nexport enum ChangeType {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n}\n\n/**\n * A change that composes an Edit.\n *\n * @remarks\n *\n * `Change` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * Change.insert(sourceId, destination)\n * ```\n * @alpha\n */\nexport type Change = Insert | Detach | Build | SetValue | Constraint;\n\n/**\n * Node or a detached sequence of nodes (referred to by a detached sequence ID) for use in a Build change.\n * See `BuildTreeNode` for more.\n * @alpha\n */\nexport type BuildNode = BuildTreeNode | number;\n\n/**\n * Node for use in a Build change, which is composed of a definition describing what this nodes type, an identifier identifying this node\n * within the tree, and a payload containing an opaque serializable piece of data.\n * An identifier can be provided explicitly if the node must be referred to before the results of the `Change` containing this\n * BuildTreeNode can be observed. If `identifier` is not supplied, one will be generated for it in an especially efficient manner\n * that allows for compact storage and transmission and thus this property should be omitted if convenient.\n * See the SharedTree readme for more on the tree format.\n * @alpha\n */\nexport interface BuildTreeNode extends HasVariadicTraits<BuildNode> {\n\tdefinition: string;\n\tidentifier?: NodeId;\n\tpayload?: Payload;\n}\n\n/**\n * Constructs a sequence of nodes, associates it with the supplied ID, and stores it for use in later changes.\n * Does not modify the document.\n *\n * Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),\n * and all Nodes' identifiers are previously unused.\n * @alpha\n */\nexport interface Build {\n\treadonly destination: number;\n\treadonly source: BuildNode | TreeNodeSequence<BuildNode>;\n\treadonly type: typeof ChangeType.Build;\n}\n\n/**\n * Inserts a sequence of nodes at the specified destination.\n * The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a \"move\" operation).\n * @alpha\n */\nexport interface Insert {\n\treadonly destination: StablePlace;\n\treadonly source: number;\n\treadonly type: typeof ChangeType.Insert;\n}\n\n/**\n * Removes a sequence of nodes from the tree.\n * If a destination is specified, the detached sequence is associated with that ID and held for possible reuse\n * by later changes in this same Edit (such as by an Insert).\n * A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.\n * @alpha\n */\nexport interface Detach {\n\treadonly destination?: number;\n\treadonly source: StableRange;\n\treadonly type: typeof ChangeType.Detach;\n}\n\n/**\n * Modifies the payload of a node.\n * @alpha\n */\nexport interface SetValue {\n\treadonly nodeToModify: NodeId;\n\t/**\n\t * Sets or clears the payload.\n\t * To improve ease of forwards compatibility, an explicit `null` value is used to represent the clearing of a payload.\n\t * SetValue may use `undefined` in future API versions to mean \"don't change the payload\" (which is useful if e.g. other\n\t * fields are added to SetValue that can be changed without altering the payload)\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\treadonly type: typeof ChangeType.SetValue;\n}\n\n/**\n * A set of constraints on the validity of an Edit.\n * A Constraint is used to detect when an Edit, due to other concurrent edits, may have unintended effects or merge in\n * non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the\n * various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).\n * Does not modify the document.\n * @alpha\n */\nexport interface Constraint {\n\t/**\n\t * Selects a sequence of nodes which will be checked against the constraints specified by the optional fields.\n\t * If `toConstrain` is invalid, it will be treated like a constraint being unmet.\n\t * Depending on `effect` this may or may not make the Edit invalid.\n\t *\n\t * When a constraint is not met, the effects is specified by `effect`.\n\t */\n\treadonly toConstrain: StableRange;\n\n\t/**\n\t * Require that the identities of all the nodes in toConstrain hash to this value.\n\t * Hash is order dependent.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes to have specific identities.\n\t */\n\treadonly identityHash?: UuidString;\n\n\t/**\n\t * Require that the number of nodes in toConstrain is this value.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * Require that the contents of all of the nodes in toConstrain hash to this value.\n\t * Hash is an order dependant deep hash, which includes all subtree content recursively.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes have exact values (transitively).\n\t */\n\treadonly contentHash?: UuidString;\n\n\t/**\n\t * Require that parent under which toConstrain is located has this identifier.\n\t */\n\treadonly parentNode?: NodeId;\n\n\t/**\n\t * Require that the trait under which toConstrain is located has this label.\n\t */\n\treadonly label?: TraitLabel;\n\n\t/**\n\t * What to do if a constraint is not met.\n\t */\n\treadonly effect: ConstraintEffect;\n\n\t/**\n\t * Marker for which kind of Change this is.\n\t */\n\treadonly type: typeof ChangeType.Constraint;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `Change` interface.\n/**\n * @alpha\n */\nexport const Change = {\n\tbuild: (source: BuildNode | TreeNodeSequence<BuildNode>, destination: number): Build => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Build,\n\t}),\n\n\tinsert: (source: number, destination: StablePlace): Insert => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Insert,\n\t}),\n\n\tdetach: (source: StableRange, destination?: number): Detach => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeId, payload: Payload): SetValue => ({\n\t\tnodeToModify,\n\t\tpayload,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeId): SetValue => ({\n\t\tnodeToModify,\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRange,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): Constraint => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeType.Constraint,\n\t}),\n\n\t/** Helpers for making high-level composite operations */\n\n\t/**\n\t * @returns a change that deletes the supplied part of the tree.\n\t */\n\tdelete: (stableRange: StableRange): Change => Change.detach(stableRange),\n\n\t/**\n\t * @returns changes that insert 'nodes' into the specified location in the tree.\n\t */\n\tinsertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace): Change[] => {\n\t\tconst build = Change.build(nodes, 0);\n\t\treturn [build, Change.insert(build.destination, destination)];\n\t},\n\n\t/**\n\t * @returns changes that moves the specified content to a new location in the tree.\n\t */\n\tmove: (source: StableRange, destination: StablePlace): Change[] => {\n\t\tconst detach = Change.detach(source, 0);\n\t\treturn [detach, Change.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * A location in a trait.\n * This is NOT the location of a node, but a location where a node could be inserted:\n * it is next to a sibling or at one end of the trait.\n *\n * To be well formed, either `sibling` or `trait` must be defined, but not both.\n *\n * Any given insertion location can be described by two `StablePlace` objects, one with `Side.After` and one with `Side.Before`.\n * For example, in a trait containing two strings \"foo\" and \"bar\", there are 6 different `StablePlace`s corresponding to 3 locations in the\n * trait a new node could be inserted: at the start, before \"foo\", after \"foo\", before \"bar\", after \"bar\", and at the end.\n * Neither of the two ways to specify the same location are considered to be after each other.\n *\n * The anchor (`referenceSibling` or `referenceTrait`) used for a particular `StablePlace` can have an impact in collaborative scenarios.\n *\n * `StablePlace` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StablePlace.before(node)\n * StablePlace.atStartOf(trait)\n * ```\n * @alpha\n */\nexport interface StablePlace {\n\t/**\n\t * Where this StablePlace is relative to the sibling (if specified), or an end of the trait (if no sibling specified).\n\t * If 'After' and there is no sibling, this StablePlace is after the front of the trait.\n\t * If 'Before' and there is no sibling, this StablePlace is before the back of the trait.\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * The sibling to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceTrait must be unspecified.\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * The trait to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceSibling must be unspecified.\n\t */\n\treadonly referenceTrait?: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait.\n * Valid iff start and end are valid and are within the same trait and the start does not occur after the end in the trait.\n *\n * See {@link (StablePlace:interface)} for what it means for a place to be \"after\" another place.\n *\n * @remarks\n *\n * `StableRange` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n * ```\n * @alpha\n */\nexport interface StableRange {\n\treadonly start: StablePlace;\n\treadonly end: StablePlace;\n}\n\n/**\n * The remainder of this file consists of ergonomic factory methods for persisted types, or common combinations thereof (e.g. \"Move\" as a\n * combination of a \"Detach\" change and an \"Insert\" change).\n *\n * None of these helpers are persisted in documents, and therefore changes to their semantics need only follow standard semantic versioning\n * practices.\n */\n\n// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.\n/**\n * @alpha\n */\nexport const StablePlace = {\n\t/**\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.\n/**\n * @alpha\n */\nexport const StableRange = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlace): { to: (end: StablePlace) => StableRange } => ({\n\t\tto: (end: StablePlace): StableRange => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x5fe /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x5ff /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains only the provided `node`.\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRange => ({\n\t\tstart: StablePlace.before(node),\n\t\tend: StablePlace.after(node),\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains everything in the trait.\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocation): StableRange => ({\n\t\tstart: StablePlace.atStartOf(trait),\n\t\tend: StablePlace.atEndOf(trait),\n\t}),\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ChangeTypes.js","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAuC,IAAI,EAAoB,MAAM,4BAA4B,CAAC;AAYzG;;;GAGG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACrB,+CAAM,CAAA;IACN,+CAAM,CAAA;IACN,6CAAK,CAAA;IACL,mDAAQ,CAAA;IACR,uDAAU,CAAA;AACX,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AA6JD,+FAA+F;AAC/F;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,KAAK,EAAE,CAAC,MAA+C,EAAE,WAAmB,EAAS,EAAE,CAAC,CAAC;QACxF,WAAW;QACX,MAAM;QACN,IAAI,EAAE,UAAU,CAAC,KAAK;KACtB,CAAC;IAEF,MAAM,EAAE,CAAC,MAAc,EAAE,WAAwB,EAAU,EAAE,CAAC,CAAC;QAC9D,WAAW;QACX,MAAM;QACN,IAAI,EAAE,UAAU,CAAC,MAAM;KACvB,CAAC;IAEF,MAAM,EAAE,CAAC,MAAmB,EAAE,WAAoB,EAAU,EAAE,CAAC,CAAC;QAC/D,WAAW;QACX,MAAM;QACN,IAAI,EAAE,UAAU,CAAC,MAAM;KACvB,CAAC;IAEF,UAAU,EAAE,CAAC,YAAoB,EAAE,OAAgB,EAAY,EAAE,CAAC,CAAC;QAClE,YAAY;QACZ,OAAO;QACP,IAAI,EAAE,UAAU,CAAC,QAAQ;KACzB,CAAC;IAEF,YAAY,EAAE,CAAC,YAAoB,EAAY,EA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WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;KAC5B,CAAC;IACF;;;;;;OAMG;IACH,GAAG,EAAE,CAAC,KAAoB,EAAe,EAAE,CAAC,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;KAC/B,CAAC;CACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { assertNotUndefined } from './Common.js';\nimport { NodeId, TraitLabel, UuidString } from './Identifiers.js';\nimport { getNodeId } from './NodeIdUtilities.js';\nimport { TraitLocation } from './TreeView.js';\nimport { ConstraintEffect, NodeData, Payload, Side, TreeNodeSequence } from './persisted-types/index.js';\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasVariadicTraits<TChild> {\n\treadonly traits?: {\n\t\treadonly [key: string]: TChild | TreeNodeSequence<TChild> | undefined;\n\t};\n}\n\n/**\n * The type of a Change\n * @alpha\n */\nexport enum ChangeType {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n}\n\n/**\n * A change that composes an Edit.\n *\n * @remarks\n *\n * `Change` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * Change.insert(sourceId, destination)\n * ```\n * @alpha\n */\nexport type Change = Insert | Detach | Build | SetValue | Constraint;\n\n/**\n * Node or a detached sequence of nodes (referred to by a detached sequence ID) for use in a Build change.\n * See `BuildTreeNode` for more.\n * @alpha\n */\nexport type BuildNode = BuildTreeNode | number;\n\n/**\n * Node for use in a Build change, which is composed of a definition describing what this nodes type, an identifier identifying this node\n * within the tree, and a payload containing an opaque serializable piece of data.\n * An identifier can be provided explicitly if the node must be referred to before the results of the `Change` containing this\n * BuildTreeNode can be observed. If `identifier` is not supplied, one will be generated for it in an especially efficient manner\n * that allows for compact storage and transmission and thus this property should be omitted if convenient.\n * See the SharedTree readme for more on the tree format.\n * @alpha\n */\nexport interface BuildTreeNode extends HasVariadicTraits<BuildNode> {\n\tdefinition: string;\n\tidentifier?: NodeId;\n\tpayload?: Payload;\n}\n\n/**\n * Constructs a sequence of nodes, associates it with the supplied ID, and stores it for use in later changes.\n * Does not modify the document.\n *\n * Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),\n * and all Nodes' identifiers are previously unused.\n * @alpha\n */\nexport interface Build {\n\treadonly destination: number;\n\treadonly source: BuildNode | TreeNodeSequence<BuildNode>;\n\treadonly type: typeof ChangeType.Build;\n}\n\n/**\n * Inserts a sequence of nodes at the specified destination.\n * The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a \"move\" operation).\n * @alpha\n */\nexport interface Insert {\n\treadonly destination: StablePlace;\n\treadonly source: number;\n\treadonly type: typeof ChangeType.Insert;\n}\n\n/**\n * Removes a sequence of nodes from the tree.\n * If a destination is specified, the detached sequence is associated with that ID and held for possible reuse\n * by later changes in this same Edit (such as by an Insert).\n * A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.\n * @alpha\n */\nexport interface Detach {\n\treadonly destination?: number;\n\treadonly source: StableRange;\n\treadonly type: typeof ChangeType.Detach;\n}\n\n/**\n * Modifies the payload of a node.\n * @alpha\n */\nexport interface SetValue {\n\treadonly nodeToModify: NodeId;\n\t/**\n\t * Sets or clears the payload.\n\t * To improve ease of forwards compatibility, an explicit `null` value is used to represent the clearing of a payload.\n\t * SetValue may use `undefined` in future API versions to mean \"don't change the payload\" (which is useful if e.g. other\n\t * fields are added to SetValue that can be changed without altering the payload)\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\treadonly type: typeof ChangeType.SetValue;\n}\n\n/**\n * A set of constraints on the validity of an Edit.\n * A Constraint is used to detect when an Edit, due to other concurrent edits, may have unintended effects or merge in\n * non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the\n * various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).\n * Does not modify the document.\n * @alpha\n */\nexport interface Constraint {\n\t/**\n\t * Selects a sequence of nodes which will be checked against the constraints specified by the optional fields.\n\t * If `toConstrain` is invalid, it will be treated like a constraint being unmet.\n\t * Depending on `effect` this may or may not make the Edit invalid.\n\t *\n\t * When a constraint is not met, the effects is specified by `effect`.\n\t */\n\treadonly toConstrain: StableRange;\n\n\t/**\n\t * Require that the identities of all the nodes in toConstrain hash to this value.\n\t * Hash is order dependent.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes to have specific identities.\n\t */\n\treadonly identityHash?: UuidString;\n\n\t/**\n\t * Require that the number of nodes in toConstrain is this value.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * Require that the contents of all of the nodes in toConstrain hash to this value.\n\t * Hash is an order dependant deep hash, which includes all subtree content recursively.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes have exact values (transitively).\n\t */\n\treadonly contentHash?: UuidString;\n\n\t/**\n\t * Require that parent under which toConstrain is located has this identifier.\n\t */\n\treadonly parentNode?: NodeId;\n\n\t/**\n\t * Require that the trait under which toConstrain is located has this label.\n\t */\n\treadonly label?: TraitLabel;\n\n\t/**\n\t * What to do if a constraint is not met.\n\t */\n\treadonly effect: ConstraintEffect;\n\n\t/**\n\t * Marker for which kind of Change this is.\n\t */\n\treadonly type: typeof ChangeType.Constraint;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `Change` interface.\n/**\n * @alpha\n */\nexport const Change = {\n\tbuild: (source: BuildNode | TreeNodeSequence<BuildNode>, destination: number): Build => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Build,\n\t}),\n\n\tinsert: (source: number, destination: StablePlace): Insert => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Insert,\n\t}),\n\n\tdetach: (source: StableRange, destination?: number): Detach => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeId, payload: Payload): SetValue => ({\n\t\tnodeToModify,\n\t\tpayload,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeId): SetValue => ({\n\t\tnodeToModify,\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRange,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): Constraint => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeType.Constraint,\n\t}),\n\n\t/** Helpers for making high-level composite operations */\n\n\t/**\n\t * Deletes a range of nodes from the tree.\n\t *\n\t * @returns A change that deletes the supplied part of the tree.\n\t */\n\tdelete: (stableRange: StableRange): Change => Change.detach(stableRange),\n\n\t/**\n\t * Inserts nodes into the tree at the specified location.\n\t *\n\t * @returns The changes that insert 'nodes' into the specified location in the tree.\n\t */\n\tinsertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace): Change[] => {\n\t\tconst build = Change.build(nodes, 0);\n\t\treturn [build, Change.insert(build.destination, destination)];\n\t},\n\n\t/**\n\t * Moves nodes from one location to another in the tree.\n\t *\n\t * @returns The changes that moves the specified content to a new location in the tree.\n\t */\n\tmove: (source: StableRange, destination: StablePlace): Change[] => {\n\t\tconst detach = Change.detach(source, 0);\n\t\treturn [detach, Change.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * A location in a trait.\n * This is NOT the location of a node, but a location where a node could be inserted:\n * it is next to a sibling or at one end of the trait.\n *\n * To be well formed, either `sibling` or `trait` must be defined, but not both.\n *\n * Any given insertion location can be described by two `StablePlace` objects, one with `Side.After` and one with `Side.Before`.\n * For example, in a trait containing two strings \"foo\" and \"bar\", there are 6 different `StablePlace`s corresponding to 3 locations in the\n * trait a new node could be inserted: at the start, before \"foo\", after \"foo\", before \"bar\", after \"bar\", and at the end.\n * Neither of the two ways to specify the same location are considered to be after each other.\n *\n * The anchor (`referenceSibling` or `referenceTrait`) used for a particular `StablePlace` can have an impact in collaborative scenarios.\n *\n * `StablePlace` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StablePlace.before(node)\n * StablePlace.atStartOf(trait)\n * ```\n * @alpha\n */\nexport interface StablePlace {\n\t/**\n\t * Where this StablePlace is relative to the sibling (if specified), or an end of the trait (if no sibling specified).\n\t * If 'After' and there is no sibling, this StablePlace is after the front of the trait.\n\t * If 'Before' and there is no sibling, this StablePlace is before the back of the trait.\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * The sibling to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceTrait must be unspecified.\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * The trait to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceSibling must be unspecified.\n\t */\n\treadonly referenceTrait?: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait.\n * Valid iff start and end are valid and are within the same trait and the start does not occur after the end in the trait.\n *\n * See {@link (StablePlace:interface)} for what it means for a place to be \"after\" another place.\n *\n * @remarks\n *\n * `StableRange` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n * ```\n * @alpha\n */\nexport interface StableRange {\n\treadonly start: StablePlace;\n\treadonly end: StablePlace;\n}\n\n/**\n * The remainder of this file consists of ergonomic factory methods for persisted types, or common combinations thereof (e.g. \"Move\" as a\n * combination of a \"Detach\" change and an \"Insert\" change).\n *\n * None of these helpers are persisted in documents, and therefore changes to their semantics need only follow standard semantic versioning\n * practices.\n */\n\n// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.\n/**\n * @alpha\n */\nexport const StablePlace = {\n\t/**\n\t * Creates a stable place representing the location directly before a node.\n\t *\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * Creates a stable place representing the location directly after a node.\n\t *\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * Creates a stable place representing the location at the start of a trait.\n\t *\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * Creates a stable place representing the location at the end of a trait.\n\t *\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.\n/**\n * @alpha\n */\nexport const StableRange = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlace): { to: (end: StablePlace) => StableRange } => ({\n\t\tto: (end: StablePlace): StableRange => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x5fe /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x5ff /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * Creates a `StableRange` which contains only the provided `node`.\n\t *\n\t * @remarks\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRange => ({\n\t\tstart: StablePlace.before(node),\n\t\tend: StablePlace.after(node),\n\t}),\n\t/**\n\t * Creates a `StableRange` which contains everything in the trait.\n\t *\n\t * @remarks\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocation): StableRange => ({\n\t\tstart: StablePlace.atStartOf(trait),\n\t\tend: StablePlace.atEndOf(trait),\n\t}),\n};\n"]}
|
package/lib/Checkout.d.ts
CHANGED
|
@@ -104,12 +104,14 @@ export declare abstract class Checkout extends EventEmitterWithErrorHandling<ICh
|
|
|
104
104
|
disposed: boolean;
|
|
105
105
|
protected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler);
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* Gets the current view of the tree, including the result of changes applied so far during an edit.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
108
110
|
* Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.
|
|
109
111
|
*/
|
|
110
112
|
get currentView(): TreeView;
|
|
111
113
|
/**
|
|
112
|
-
*
|
|
114
|
+
* Whether there is currently an open edit operation.
|
|
113
115
|
*/
|
|
114
116
|
hasOpenEdit(): boolean;
|
|
115
117
|
/**
|
|
@@ -186,7 +188,9 @@ export declare abstract class Checkout extends EventEmitterWithErrorHandling<ICh
|
|
|
186
188
|
*/
|
|
187
189
|
abortEdit(): void;
|
|
188
190
|
/**
|
|
189
|
-
*
|
|
191
|
+
* Gets the {@link EditStatus} of the current edit.
|
|
192
|
+
*
|
|
193
|
+
* @remarks
|
|
190
194
|
* Has no side effects.
|
|
191
195
|
* Can only be called if an edit is open.
|
|
192
196
|
*/
|
package/lib/Checkout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAA4B,MAAM,iCAAiC,CAAC;AAErG,OAAO,EAEN,6BAA6B,EAE7B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAA0D,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACtH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE9E;;;GAGG;AACH,oBAAY,aAAa;IACxB;;;OAGG;IACH,UAAU,eAAe;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IACnD,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,OAAE;CAC7E;AAED;;;GAGG;AACH,oBAAY,oBAAoB;IAC/B;;;;OAIG;IACH,SAAS,IAAA;IACT;;;;OAIG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,KAAK,IAAA;CACL;AAED;;;;;;;;;;;;;;GAcG;AACH,8BAAs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IAAI;CAUnC"}
|
package/lib/Checkout.js
CHANGED
|
@@ -77,14 +77,16 @@ export class Checkout extends EventEmitterWithErrorHandling {
|
|
|
77
77
|
this.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Gets the current view of the tree, including the result of changes applied so far during an edit.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
81
83
|
* Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.
|
|
82
84
|
*/
|
|
83
85
|
get currentView() {
|
|
84
86
|
return this.currentEdit?.view ?? this.latestCommittedView;
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
|
-
*
|
|
89
|
+
* Whether there is currently an open edit operation.
|
|
88
90
|
*/
|
|
89
91
|
hasOpenEdit() {
|
|
90
92
|
return this.currentEdit !== undefined;
|
|
@@ -248,7 +250,9 @@ export class Checkout extends EventEmitterWithErrorHandling {
|
|
|
248
250
|
this.emitChange();
|
|
249
251
|
}
|
|
250
252
|
/**
|
|
251
|
-
*
|
|
253
|
+
* Gets the {@link EditStatus} of the current edit.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
252
256
|
* Has no side effects.
|
|
253
257
|
* Can only be called if an edit is open.
|
|
254
258
|
*/
|
package/lib/Checkout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAe,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iB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C,KAAK,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;YAC7C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t): void {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAe,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAA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Aa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;YAC7C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * Gets the current view of the tree, including the result of changes applied so far during an edit.\n\t *\n\t * @remarks\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * Whether there is currently an open edit operation.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t): void {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Gets the {@link EditStatus} of the current edit.\n\t *\n\t * @remarks\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
|
package/lib/Common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAIlD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB;IAC9E,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OA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