@fluidframework/sequence 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/defaultMap.d.ts +3 -2
  3. package/dist/defaultMap.d.ts.map +1 -1
  4. package/dist/defaultMap.js +4 -3
  5. package/dist/defaultMap.js.map +1 -1
  6. package/dist/defaultMapInterfaces.d.ts +12 -1
  7. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  8. package/dist/defaultMapInterfaces.js.map +1 -1
  9. package/dist/index.d.ts +4 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +17 -3
  12. package/dist/index.js.map +1 -1
  13. package/dist/intervalCollection.d.ts +240 -78
  14. package/dist/intervalCollection.d.ts.map +1 -1
  15. package/dist/intervalCollection.js +313 -190
  16. package/dist/intervalCollection.js.map +1 -1
  17. package/dist/intervalIndex/index.d.ts +8 -0
  18. package/dist/intervalIndex/index.d.ts.map +1 -0
  19. package/dist/intervalIndex/index.js +12 -0
  20. package/dist/intervalIndex/index.js.map +1 -0
  21. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +32 -0
  22. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -0
  23. package/dist/intervalIndex/overlappingIntervalsIndex.js +103 -0
  24. package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -0
  25. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +8 -0
  26. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -0
  27. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +33 -0
  28. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -0
  29. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +33 -0
  30. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -0
  31. package/dist/intervalIndex/sequenceIntervalIndexes.js +7 -0
  32. package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -0
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/revertibles.d.ts +104 -0
  37. package/dist/revertibles.d.ts.map +1 -0
  38. package/dist/revertibles.js +414 -0
  39. package/dist/revertibles.js.map +1 -0
  40. package/dist/sequence.d.ts +4 -4
  41. package/dist/sequence.d.ts.map +1 -1
  42. package/dist/sequence.js +3 -3
  43. package/dist/sequence.js.map +1 -1
  44. package/dist/sharedIntervalCollection.d.ts +3 -3
  45. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  46. package/dist/sharedIntervalCollection.js +1 -1
  47. package/dist/sharedIntervalCollection.js.map +1 -1
  48. package/dist/tsdoc-metadata.json +11 -0
  49. package/lib/defaultMap.d.ts +3 -2
  50. package/lib/defaultMap.d.ts.map +1 -1
  51. package/lib/defaultMap.js +4 -3
  52. package/lib/defaultMap.js.map +1 -1
  53. package/lib/defaultMapInterfaces.d.ts +12 -1
  54. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  55. package/lib/defaultMapInterfaces.js.map +1 -1
  56. package/lib/index.d.ts +4 -2
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +3 -1
  59. package/lib/index.js.map +1 -1
  60. package/lib/intervalCollection.d.ts +240 -78
  61. package/lib/intervalCollection.d.ts.map +1 -1
  62. package/lib/intervalCollection.js +310 -190
  63. package/lib/intervalCollection.js.map +1 -1
  64. package/lib/intervalIndex/index.d.ts +8 -0
  65. package/lib/intervalIndex/index.d.ts.map +1 -0
  66. package/lib/intervalIndex/index.js +7 -0
  67. package/lib/intervalIndex/index.js.map +1 -0
  68. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +32 -0
  69. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -0
  70. package/lib/intervalIndex/overlappingIntervalsIndex.js +98 -0
  71. package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -0
  72. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +8 -0
  73. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -0
  74. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +29 -0
  75. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -0
  76. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +33 -0
  77. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -0
  78. package/lib/intervalIndex/sequenceIntervalIndexes.js +6 -0
  79. package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -0
  80. package/lib/packageVersion.d.ts +1 -1
  81. package/lib/packageVersion.js +1 -1
  82. package/lib/packageVersion.js.map +1 -1
  83. package/lib/revertibles.d.ts +104 -0
  84. package/lib/revertibles.d.ts.map +1 -0
  85. package/lib/revertibles.js +404 -0
  86. package/lib/revertibles.js.map +1 -0
  87. package/lib/sequence.d.ts +4 -4
  88. package/lib/sequence.d.ts.map +1 -1
  89. package/lib/sequence.js +3 -3
  90. package/lib/sequence.js.map +1 -1
  91. package/lib/sharedIntervalCollection.d.ts +3 -3
  92. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  93. package/lib/sharedIntervalCollection.js +1 -1
  94. package/lib/sharedIntervalCollection.js.map +1 -1
  95. package/package.json +22 -24
  96. package/src/defaultMap.ts +4 -1
  97. package/src/defaultMapInterfaces.ts +13 -1
  98. package/src/index.ts +27 -5
  99. package/src/intervalCollection.ts +660 -216
  100. package/src/intervalIndex/index.ts +11 -0
  101. package/src/intervalIndex/overlappingIntervalsIndex.ts +166 -0
  102. package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +71 -0
  103. package/src/intervalIndex/sequenceIntervalIndexes.ts +32 -0
  104. package/src/packageVersion.ts +1 -1
  105. package/src/revertibles.ts +626 -0
  106. package/src/sequence.ts +12 -2
  107. package/src/sharedIntervalCollection.ts +4 -2
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { SequenceIntervalIndexes } from "./sequenceIntervalIndexes";
6
+ export { IOverlappingIntervalsIndex, createOverlappingIntervalsIndex, } from "./overlappingIntervalsIndex";
7
+ export { createOverlappingSequenceIntervalsIndex } from "./overlappingSequenceIntervalsIndex";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACN,0BAA0B,EAC1B,+BAA+B,GAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uCAAuC,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createOverlappingIntervalsIndex, } from "./overlappingIntervalsIndex";
6
+ export { createOverlappingSequenceIntervalsIndex } from "./overlappingSequenceIntervalsIndex";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intervalIndex/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,+BAA+B,GAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uCAAuC,EAAE,MAAM,qCAAqC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { SequenceIntervalIndexes } from \"./sequenceIntervalIndexes\";\nexport {\n\tIOverlappingIntervalsIndex,\n\tcreateOverlappingIntervalsIndex,\n} from \"./overlappingIntervalsIndex\";\nexport { createOverlappingSequenceIntervalsIndex } from \"./overlappingSequenceIntervalsIndex\";\n"]}
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Client } from "@fluidframework/merge-tree";
6
+ import { IIntervalHelpers, IntervalIndex, ISerializableInterval } from "../intervalCollection";
7
+ import { IntervalTree } from "../intervalTree";
8
+ export interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
9
+ /**
10
+ * @returns an array of all intervals contained in this collection that overlap the range
11
+ * `[start end]`.
12
+ */
13
+ findOverlappingIntervals(start: number, end: number): TInterval[];
14
+ /**
15
+ * Gathers the interval results based on specified parameters.
16
+ */
17
+ gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;
18
+ }
19
+ export declare class OverlappingIntervalsIndex<TInterval extends ISerializableInterval> implements IOverlappingIntervalsIndex<TInterval> {
20
+ protected readonly intervalTree: IntervalTree<TInterval>;
21
+ protected readonly client: Client;
22
+ protected readonly helpers: IIntervalHelpers<TInterval>;
23
+ constructor(client: Client, helpers: IIntervalHelpers<TInterval>);
24
+ map(fn: (interval: TInterval) => void): void;
25
+ mapUntil(fn: (interval: TInterval) => boolean): void;
26
+ gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;
27
+ findOverlappingIntervals(start: number, end: number): TInterval[];
28
+ remove(interval: TInterval): void;
29
+ add(interval: TInterval): void;
30
+ }
31
+ export declare function createOverlappingIntervalsIndex<TInterval extends ISerializableInterval>(client: Client, helpers: IIntervalHelpers<TInterval>): IOverlappingIntervalsIndex<TInterval>;
32
+ //# sourceMappingURL=overlappingIntervalsIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlappingIntervalsIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/overlappingIntervalsIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4B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IAI1B,GAAG,CAAC,QAAQ,EAAE,SAAS;CAG9B;AAED,wBAAgB,+BAA+B,CAAC,SAAS,SAAS,qBAAqB,EACtF,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAClC,0BAA0B,CAAC,SAAS,CAAC,CAEvC"}
@@ -0,0 +1,98 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IntervalType, } from "../intervalCollection";
6
+ import { IntervalTree } from "../intervalTree";
7
+ export class OverlappingIntervalsIndex {
8
+ constructor(client, helpers) {
9
+ this.intervalTree = new IntervalTree();
10
+ this.client = client;
11
+ this.helpers = helpers;
12
+ }
13
+ map(fn) {
14
+ this.intervalTree.map(fn);
15
+ }
16
+ mapUntil(fn) {
17
+ this.intervalTree.mapUntil(fn);
18
+ }
19
+ gatherIterationResults(results, iteratesForward, start, end) {
20
+ if (this.intervalTree.intervals.isEmpty()) {
21
+ return;
22
+ }
23
+ if (start === undefined && end === undefined) {
24
+ // No start/end provided. Gather the whole tree in the specified order.
25
+ if (iteratesForward) {
26
+ this.intervalTree.map((interval) => {
27
+ results.push(interval);
28
+ });
29
+ }
30
+ else {
31
+ this.intervalTree.mapBackward((interval) => {
32
+ results.push(interval);
33
+ });
34
+ }
35
+ }
36
+ else {
37
+ const transientInterval = this.helpers.create("transient", start, end, this.client, IntervalType.Transient);
38
+ if (start === undefined) {
39
+ // Only end position provided. Since the tree is not sorted by end position,
40
+ // walk the whole tree in the specified order, gathering intervals that match the end.
41
+ if (iteratesForward) {
42
+ this.intervalTree.map((interval) => {
43
+ if (transientInterval.compareEnd(interval) === 0) {
44
+ results.push(interval);
45
+ }
46
+ });
47
+ }
48
+ else {
49
+ this.intervalTree.mapBackward((interval) => {
50
+ if (transientInterval.compareEnd(interval) === 0) {
51
+ results.push(interval);
52
+ }
53
+ });
54
+ }
55
+ }
56
+ else {
57
+ // Start and (possibly) end provided. Walk the subtrees that may contain
58
+ // this start position.
59
+ const compareFn = end === undefined
60
+ ? (node) => {
61
+ return transientInterval.compareStart(node.key);
62
+ }
63
+ : (node) => {
64
+ return transientInterval.compare(node.key);
65
+ };
66
+ const continueLeftFn = (cmpResult) => cmpResult <= 0;
67
+ const continueRightFn = (cmpResult) => cmpResult >= 0;
68
+ const actionFn = (node) => {
69
+ results.push(node.key);
70
+ };
71
+ if (iteratesForward) {
72
+ this.intervalTree.intervals.walkExactMatchesForward(compareFn, actionFn, continueLeftFn, continueRightFn);
73
+ }
74
+ else {
75
+ this.intervalTree.intervals.walkExactMatchesBackward(compareFn, actionFn, continueLeftFn, continueRightFn);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ findOverlappingIntervals(start, end) {
81
+ if (end < start || this.intervalTree.intervals.isEmpty()) {
82
+ return [];
83
+ }
84
+ const transientInterval = this.helpers.create("transient", start, end, this.client, IntervalType.Transient);
85
+ const overlappingIntervalNodes = this.intervalTree.match(transientInterval);
86
+ return overlappingIntervalNodes.map((node) => node.key);
87
+ }
88
+ remove(interval) {
89
+ this.intervalTree.removeExisting(interval);
90
+ }
91
+ add(interval) {
92
+ this.intervalTree.put(interval);
93
+ }
94
+ }
95
+ export function createOverlappingIntervalsIndex(client, helpers) {
96
+ return new OverlappingIntervalsIndex(client, helpers);
97
+ }
98
+ //# sourceMappingURL=overlappingIntervalsIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlappingIntervalsIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/overlappingIntervalsIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAIZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAgB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAqB7D,MAAM,OAAO,yBAAyB;IAOrC,YAAY,MAAc,EAAE,OAAoC;QAJ7C,iBAAY,GAAG,IAAI,YAAY,EAAa,CAAC;QAK/D,IAAI,CAAC,M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;IAEM,wBAAwB,CAAC,KAAa,EAAE,GAAW;QACzD,IAAI,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE;YACzD,OAAO,EAAE,CAAC;SACV;QACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAC5C,WAAW,EACX,KAAK,EACL,GAAG,EACH,IAAI,CAAC,MAAM,EACX,YAAY,CAAC,SAAS,CACtB,CAAC;QAEF,MAAM,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC5E,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAEM,MAAM,CAAC,QAAmB;QAChC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,GAAG,CAAC,QAAmB;QAC7B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACD;AAED,MAAM,UAAU,+BAA+B,CAC9C,MAAc,EACd,OAAoC;IAEpC,OAAO,IAAI,yBAAyB,CAAY,MAAM,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Client } from \"@fluidframework/merge-tree\";\nimport {\n\tIntervalType,\n\tIIntervalHelpers,\n\tIntervalIndex,\n\tISerializableInterval,\n} from \"../intervalCollection\";\nimport { IntervalNode, IntervalTree } from \"../intervalTree\";\n\nexport interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection that overlap the range\n\t * `[start end]`.\n\t */\n\tfindOverlappingIntervals(start: number, end: number): TInterval[];\n\n\t/**\n\t * Gathers the interval results based on specified parameters.\n\t */\n\tgatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t): void;\n}\n\nexport class OverlappingIntervalsIndex<TInterval extends ISerializableInterval>\n\timplements IOverlappingIntervalsIndex<TInterval>\n{\n\tprotected readonly intervalTree = new IntervalTree<TInterval>();\n\tprotected readonly client: Client;\n\tprotected readonly helpers: IIntervalHelpers<TInterval>;\n\n\tconstructor(client: Client, helpers: IIntervalHelpers<TInterval>) {\n\t\tthis.client = client;\n\t\tthis.helpers = helpers;\n\t}\n\n\tpublic map(fn: (interval: TInterval) => void) {\n\t\tthis.intervalTree.map(fn);\n\t}\n\n\tpublic mapUntil(fn: (interval: TInterval) => boolean) {\n\t\tthis.intervalTree.mapUntil(fn);\n\t}\n\n\tpublic gatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t): void {\n\t\tif (this.intervalTree.intervals.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (start === undefined && end === undefined) {\n\t\t\t// No start/end provided. Gather the whole tree in the specified order.\n\t\t\tif (iteratesForward) {\n\t\t\t\tthis.intervalTree.map((interval: TInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.intervalTree.mapBackward((interval: TInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst transientInterval: TInterval = this.helpers.create(\n\t\t\t\t\"transient\",\n\t\t\t\tstart,\n\t\t\t\tend,\n\t\t\t\tthis.client,\n\t\t\t\tIntervalType.Transient,\n\t\t\t);\n\n\t\t\tif (start === undefined) {\n\t\t\t\t// Only end position provided. Since the tree is not sorted by end position,\n\t\t\t\t// walk the whole tree in the specified order, gathering intervals that match the end.\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.map((interval: TInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.mapBackward((interval: TInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Start and (possibly) end provided. Walk the subtrees that may contain\n\t\t\t\t// this start position.\n\t\t\t\tconst compareFn =\n\t\t\t\t\tend === undefined\n\t\t\t\t\t\t? (node: IntervalNode<TInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compareStart(node.key);\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: (node: IntervalNode<TInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compare(node.key);\n\t\t\t\t\t\t };\n\t\t\t\tconst continueLeftFn = (cmpResult: number) => cmpResult <= 0;\n\t\t\t\tconst continueRightFn = (cmpResult: number) => cmpResult >= 0;\n\t\t\t\tconst actionFn = (node: IntervalNode<TInterval>) => {\n\t\t\t\t\tresults.push(node.key);\n\t\t\t\t};\n\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesForward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesBackward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic findOverlappingIntervals(start: number, end: number): TInterval[] {\n\t\tif (end < start || this.intervalTree.intervals.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\t\tconst transientInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tstart,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\tconst overlappingIntervalNodes = this.intervalTree.match(transientInterval);\n\t\treturn overlappingIntervalNodes.map((node) => node.key);\n\t}\n\n\tpublic remove(interval: TInterval) {\n\t\tthis.intervalTree.removeExisting(interval);\n\t}\n\n\tpublic add(interval: TInterval) {\n\t\tthis.intervalTree.put(interval);\n\t}\n}\n\nexport function createOverlappingIntervalsIndex<TInterval extends ISerializableInterval>(\n\tclient: Client,\n\thelpers: IIntervalHelpers<TInterval>,\n): IOverlappingIntervalsIndex<TInterval> {\n\treturn new OverlappingIntervalsIndex<TInterval>(client, helpers);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Client } from "@fluidframework/merge-tree";
6
+ import { SequenceIntervalIndexes } from "./sequenceIntervalIndexes";
7
+ export declare function createOverlappingSequenceIntervalsIndex(client: Client): SequenceIntervalIndexes.Overlapping;
8
+ //# sourceMappingURL=overlappingSequenceIntervalsIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlappingSequenceIntervalsIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/overlappingSequenceIntervalsIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EAKN,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAgDpE,wBAAgB,uCAAuC,CACtD,MAAM,EAAE,MAAM,GACZ,uBAAuB,CAAC,WAAW,CAErC"}
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ReferenceType, compareReferencePositions, reservedRangeLabelsKey, } from "@fluidframework/merge-tree";
6
+ import { sequenceIntervalHelpers, IntervalType, SequenceInterval, createPositionReferenceFromSegoff, } from "../intervalCollection";
7
+ import { OverlappingIntervalsIndex } from "./overlappingIntervalsIndex";
8
+ class OverlappingSequenceIntervalsIndex extends OverlappingIntervalsIndex {
9
+ constructor(client) {
10
+ super(client, sequenceIntervalHelpers);
11
+ }
12
+ findOverlappingIntervalsBySegoff(startSegoff, endSegoff) {
13
+ if (this.intervalTree.intervals.isEmpty()) {
14
+ return [];
15
+ }
16
+ const startLref = createPositionReferenceFromSegoff(this.client, startSegoff, ReferenceType.Transient);
17
+ const endLref = createPositionReferenceFromSegoff(this.client, endSegoff, ReferenceType.Transient);
18
+ if (compareReferencePositions(startLref, endLref) > 0) {
19
+ return [];
20
+ }
21
+ const transientInterval = new SequenceInterval(this.client, startLref, endLref, IntervalType.Transient, { [reservedRangeLabelsKey]: ["transient"] });
22
+ const overlappingIntervalNodes = this.intervalTree.match(transientInterval);
23
+ return overlappingIntervalNodes.map((node) => node.key);
24
+ }
25
+ }
26
+ export function createOverlappingSequenceIntervalsIndex(client) {
27
+ return new OverlappingSequenceIntervalsIndex(client);
28
+ }
29
+ //# sourceMappingURL=overlappingSequenceIntervalsIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlappingSequenceIntervalsIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/overlappingSequenceIntervalsIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,aAAa,EACb,yBAAyB,EACzB,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,iCAAiC,GACjC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,iCACL,SAAQ,yBAA2C;IAGnD,YAAY,MAAc;QACzB,KAAK,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACxC,CAAC;IAEM,gCAAgC,CACtC,WAA0E,EAC1E,SAAwE;QAExE,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE;YAC1C,OAAO,EAAE,CAAC;SACV;QAED,MAAM,SAAS,GAAG,iCAAiC,CAClD,IAAI,CAAC,MAAM,EACX,WAAW,EACX,aAAa,CAAC,SAAS,CACvB,CAAC;QAEF,MAAM,OAAO,GAAG,iCAAiC,CAChD,IAAI,CAAC,MAAM,EACX,SAAS,EACT,aAAa,CAAC,SAAS,CACvB,CAAC;QAEF,IAAI,yBAAyB,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;YACtD,OAAO,EAAE,CAAC;SACV;QAED,MAAM,iBAAiB,GAAG,IAAI,gBAAgB,CAC7C,IAAI,CAAC,MAAM,EACX,SAAS,EACT,OAAO,EACP,YAAY,CAAC,SAAS,EACtB,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAC3C,CAAC;QAEF,MAAM,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC5E,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;CACD;AAED,MAAM,UAAU,uCAAuC,CACtD,MAAc;IAEd,OAAO,IAAI,iCAAiC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tClient,\n\tISegment,\n\tReferenceType,\n\tcompareReferencePositions,\n\treservedRangeLabelsKey,\n} from \"@fluidframework/merge-tree\";\nimport {\n\tsequenceIntervalHelpers,\n\tIntervalType,\n\tSequenceInterval,\n\tcreatePositionReferenceFromSegoff,\n} from \"../intervalCollection\";\nimport { SequenceIntervalIndexes } from \"./sequenceIntervalIndexes\";\nimport { OverlappingIntervalsIndex } from \"./overlappingIntervalsIndex\";\n\nclass OverlappingSequenceIntervalsIndex\n\textends OverlappingIntervalsIndex<SequenceInterval>\n\timplements SequenceIntervalIndexes.Overlapping\n{\n\tconstructor(client: Client) {\n\t\tsuper(client, sequenceIntervalHelpers);\n\t}\n\n\tpublic findOverlappingIntervalsBySegoff(\n\t\tstartSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t\tendSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t): Iterable<SequenceInterval> {\n\t\tif (this.intervalTree.intervals.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst startLref = createPositionReferenceFromSegoff(\n\t\t\tthis.client,\n\t\t\tstartSegoff,\n\t\t\tReferenceType.Transient,\n\t\t);\n\n\t\tconst endLref = createPositionReferenceFromSegoff(\n\t\t\tthis.client,\n\t\t\tendSegoff,\n\t\t\tReferenceType.Transient,\n\t\t);\n\n\t\tif (compareReferencePositions(startLref, endLref) > 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst transientInterval = new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tstartLref,\n\t\t\tendLref,\n\t\t\tIntervalType.Transient,\n\t\t\t{ [reservedRangeLabelsKey]: [\"transient\"] },\n\t\t);\n\n\t\tconst overlappingIntervalNodes = this.intervalTree.match(transientInterval);\n\t\treturn overlappingIntervalNodes.map((node) => node.key);\n\t}\n}\n\nexport function createOverlappingSequenceIntervalsIndex(\n\tclient: Client,\n): SequenceIntervalIndexes.Overlapping {\n\treturn new OverlappingSequenceIntervalsIndex(client);\n}\n"]}
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ISegment } from "@fluidframework/merge-tree";
6
+ import { SequenceInterval } from "../intervalCollection";
7
+ import { IOverlappingIntervalsIndex } from "./overlappingIntervalsIndex";
8
+ /**
9
+ * This namespace contains specialiazations of indexes which support spatial queries
10
+ * specifically for `SequenceInterval`s.
11
+ */
12
+ export declare namespace SequenceIntervalIndexes {
13
+ /**
14
+ * Collection of intervals.
15
+ *
16
+ * Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.
17
+ */
18
+ interface Overlapping extends IOverlappingIntervalsIndex<SequenceInterval> {
19
+ /**
20
+ * Finds overlapping intervals within the specified range.
21
+ *
22
+ * @returns an array of all intervals that overlap with the specified SegOff range (includes both ends)
23
+ */
24
+ findOverlappingIntervalsBySegoff(startSegoff: {
25
+ segment: ISegment | undefined;
26
+ offset: number | undefined;
27
+ }, endSegoff: {
28
+ segment: ISegment | undefined;
29
+ offset: number | undefined;
30
+ }): any;
31
+ }
32
+ }
33
+ //# sourceMappingURL=sequenceIntervalIndexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequenceIntervalIndexes.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;GAGG;AAEH,yBAAiB,uBAAuB,CAAC;IACxC;;;;OAIG;IACH,UAAiB,WAAY,SAAQ,0BAA0B,CAAC,gBAAgB,CAAC;QAChF;;;;WAIG;QACH,gCAAgC,CAC/B,WAAW,EAAE;YAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;YAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,EAC1E,SAAS,EAAE;YAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;YAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,OACvE;KACF;CACD"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=sequenceIntervalIndexes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequenceIntervalIndexes.js","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment } from \"@fluidframework/merge-tree\";\nimport { SequenceInterval } from \"../intervalCollection\";\nimport { IOverlappingIntervalsIndex } from \"./overlappingIntervalsIndex\";\n\n/**\n * This namespace contains specialiazations of indexes which support spatial queries\n * specifically for `SequenceInterval`s.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace SequenceIntervalIndexes {\n\t/**\n\t * Collection of intervals.\n\t *\n\t * Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.\n\t */\n\texport interface Overlapping extends IOverlappingIntervalsIndex<SequenceInterval> {\n\t\t/**\n\t\t * Finds overlapping intervals within the specified range.\n\t\t *\n\t\t * @returns an array of all intervals that overlap with the specified SegOff range (includes both ends)\n\t\t */\n\t\tfindOverlappingIntervalsBySegoff(\n\t\t\tstartSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t\t\tendSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t\t);\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "2.0.0-dev.4.4.0.162574";
8
+ export declare const pkgVersion = "2.0.0-dev.5.3.2.178189";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/sequence";
8
- export const pkgVersion = "2.0.0-dev.4.4.0.162574";
8
+ export const pkgVersion = "2.0.0-dev.5.3.2.178189";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.4.4.0.162574\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.5.3.2.178189\";\n"]}
@@ -0,0 +1,104 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { LocalReferencePosition, MergeTreeDeltaRevertible, PropertySet } from "@fluidframework/merge-tree";
6
+ import { IntervalOpType, SequenceInterval } from "./intervalCollection";
7
+ import { SharedString } from "./sharedString";
8
+ import { SequenceDeltaEvent } from "./sequenceDeltaEvent";
9
+ /**
10
+ * Data for undoing edits on SharedStrings and Intervals.
11
+ *
12
+ * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
13
+ * be set as true on the underlying merge tree in order to function correctly.
14
+ *
15
+ * @alpha
16
+ */
17
+ export declare type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;
18
+ declare type IntervalOpType = typeof IntervalOpType[keyof typeof IntervalOpType];
19
+ /**
20
+ * Data for undoing edits affecting Intervals.
21
+ *
22
+ * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
23
+ * be set as true on the underlying merge tree in order to function correctly.
24
+ *
25
+ * @alpha
26
+ */
27
+ export declare type IntervalRevertible = {
28
+ event: typeof IntervalOpType.CHANGE;
29
+ interval: SequenceInterval;
30
+ start: LocalReferencePosition;
31
+ end: LocalReferencePosition;
32
+ } | {
33
+ event: typeof IntervalOpType.ADD;
34
+ interval: SequenceInterval;
35
+ } | {
36
+ event: typeof IntervalOpType.DELETE;
37
+ interval: SequenceInterval;
38
+ start: LocalReferencePosition;
39
+ end: LocalReferencePosition;
40
+ } | {
41
+ event: typeof IntervalOpType.PROPERTY_CHANGED;
42
+ interval: SequenceInterval;
43
+ propertyDeltas: PropertySet;
44
+ } | {
45
+ event: typeof IntervalOpType.POSITION_REMOVE;
46
+ intervals: {
47
+ intervalId: string;
48
+ label: string;
49
+ startOffset?: number;
50
+ endOffset?: number;
51
+ }[];
52
+ revertibleRefs: {
53
+ revertible: IntervalRevertible;
54
+ offset: number;
55
+ isStart: boolean;
56
+ }[];
57
+ mergeTreeRevertible: MergeTreeDeltaRevertible;
58
+ };
59
+ /**
60
+ * Create revertibles for adding an interval
61
+ * @alpha
62
+ */
63
+ export declare function appendAddIntervalToRevertibles(interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
64
+ /**
65
+ * Create revertibles for deleting an interval
66
+ * @alpha
67
+ */
68
+ export declare function appendDeleteIntervalToRevertibles(string: SharedString, interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
69
+ /**
70
+ * Create revertibles for moving endpoints of an interval
71
+ * @alpha
72
+ */
73
+ export declare function appendChangeIntervalToRevertibles(string: SharedString, newInterval: SequenceInterval, previousInterval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
74
+ /**
75
+ * Create revertibles for changing properties of an interval
76
+ * @alpha
77
+ */
78
+ export declare function appendIntervalPropertyChangedToRevertibles(interval: SequenceInterval, deltas: PropertySet, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
79
+ /**
80
+ * Create revertibles for SharedStringDeltas, handling indirectly modified intervals
81
+ * (e.g. reverting remove of a range that contains an interval will move the interval back)
82
+ *
83
+ * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
84
+ * be set as true on the underlying merge tree in order to function correctly.
85
+ *
86
+ * @alpha
87
+ */
88
+ export declare function appendSharedStringDeltaToRevertibles(string: SharedString, delta: SequenceDeltaEvent, revertibles: SharedStringRevertible[]): void;
89
+ /**
90
+ * Clean up resources held by revertibles that are no longer needed.
91
+ * @alpha
92
+ */
93
+ export declare function discardSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
94
+ /**
95
+ * Invoke revertibles to reverse prior edits
96
+ *
97
+ * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
98
+ * be set as true on the underlying merge tree in order to function correctly.
99
+ *
100
+ * @alpha
101
+ */
102
+ export declare function revertSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
103
+ export {};
104
+ //# sourceMappingURL=revertibles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,sBAAsB,EAEtB,wBAAwB,EAExB,WAAW,EAMX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB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