@fluidframework/merge-tree 2.4.0-294316 → 2.4.0-297385

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 (147) hide show
  1. package/api-report/merge-tree.legacy.alpha.api.md +25 -5
  2. package/dist/attributionPolicy.d.ts.map +1 -1
  3. package/dist/attributionPolicy.js +10 -3
  4. package/dist/attributionPolicy.js.map +1 -1
  5. package/dist/client.d.ts +14 -4
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +97 -9
  8. package/dist/client.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/legacy.d.ts +1 -0
  13. package/dist/localReference.d.ts +1 -1
  14. package/dist/localReference.d.ts.map +1 -1
  15. package/dist/localReference.js.map +1 -1
  16. package/dist/mergeTree.d.ts +22 -8
  17. package/dist/mergeTree.d.ts.map +1 -1
  18. package/dist/mergeTree.js +98 -24
  19. package/dist/mergeTree.js.map +1 -1
  20. package/dist/mergeTreeNodes.d.ts +27 -2
  21. package/dist/mergeTreeNodes.d.ts.map +1 -1
  22. package/dist/mergeTreeNodes.js +2 -18
  23. package/dist/mergeTreeNodes.js.map +1 -1
  24. package/dist/opBuilder.d.ts +15 -1
  25. package/dist/opBuilder.d.ts.map +1 -1
  26. package/dist/opBuilder.js +28 -1
  27. package/dist/opBuilder.js.map +1 -1
  28. package/dist/ops.d.ts +27 -1
  29. package/dist/ops.d.ts.map +1 -1
  30. package/dist/ops.js +1 -0
  31. package/dist/ops.js.map +1 -1
  32. package/dist/revertibles.d.ts.map +1 -1
  33. package/dist/revertibles.js +4 -2
  34. package/dist/revertibles.js.map +1 -1
  35. package/dist/sequencePlace.d.ts +4 -0
  36. package/dist/sequencePlace.d.ts.map +1 -1
  37. package/dist/sequencePlace.js +17 -1
  38. package/dist/sequencePlace.js.map +1 -1
  39. package/dist/snapshotV1.d.ts.map +1 -1
  40. package/dist/snapshotV1.js +0 -2
  41. package/dist/snapshotV1.js.map +1 -1
  42. package/dist/snapshotlegacy.d.ts.map +1 -1
  43. package/dist/snapshotlegacy.js +0 -1
  44. package/dist/snapshotlegacy.js.map +1 -1
  45. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  46. package/dist/test/client.applyMsg.spec.js +3 -3
  47. package/dist/test/client.applyMsg.spec.js.map +1 -1
  48. package/dist/test/client.localReference.spec.js.map +1 -1
  49. package/dist/test/client.rollback.spec.js.map +1 -1
  50. package/dist/test/mergeTree.annotate.spec.js +29 -19
  51. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  52. package/dist/test/obliterate.concurrent.spec.js +18 -0
  53. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  54. package/dist/test/obliterate.rangeExpansion.spec.js +109 -53
  55. package/dist/test/obliterate.rangeExpansion.spec.js.map +1 -1
  56. package/dist/test/obliterate.spec.js +2 -2
  57. package/dist/test/obliterate.spec.js.map +1 -1
  58. package/dist/test/reconnectHelper.d.ts +8 -6
  59. package/dist/test/reconnectHelper.d.ts.map +1 -1
  60. package/dist/test/reconnectHelper.js +14 -13
  61. package/dist/test/reconnectHelper.js.map +1 -1
  62. package/dist/test/revertibleFarm.spec.js.map +1 -1
  63. package/dist/test/testClientLogger.d.ts.map +1 -1
  64. package/dist/test/testClientLogger.js +19 -8
  65. package/dist/test/testClientLogger.js.map +1 -1
  66. package/dist/zamboni.js +2 -1
  67. package/dist/zamboni.js.map +1 -1
  68. package/lib/attributionPolicy.d.ts.map +1 -1
  69. package/lib/attributionPolicy.js +10 -3
  70. package/lib/attributionPolicy.js.map +1 -1
  71. package/lib/client.d.ts +14 -4
  72. package/lib/client.d.ts.map +1 -1
  73. package/lib/client.js +98 -10
  74. package/lib/client.js.map +1 -1
  75. package/lib/index.d.ts +2 -2
  76. package/lib/index.d.ts.map +1 -1
  77. package/lib/index.js.map +1 -1
  78. package/lib/legacy.d.ts +1 -0
  79. package/lib/localReference.d.ts +1 -1
  80. package/lib/localReference.d.ts.map +1 -1
  81. package/lib/localReference.js.map +1 -1
  82. package/lib/mergeTree.d.ts +22 -8
  83. package/lib/mergeTree.d.ts.map +1 -1
  84. package/lib/mergeTree.js +100 -26
  85. package/lib/mergeTree.js.map +1 -1
  86. package/lib/mergeTreeNodes.d.ts +27 -2
  87. package/lib/mergeTreeNodes.d.ts.map +1 -1
  88. package/lib/mergeTreeNodes.js +2 -18
  89. package/lib/mergeTreeNodes.js.map +1 -1
  90. package/lib/opBuilder.d.ts +15 -1
  91. package/lib/opBuilder.d.ts.map +1 -1
  92. package/lib/opBuilder.js +26 -0
  93. package/lib/opBuilder.js.map +1 -1
  94. package/lib/ops.d.ts +27 -1
  95. package/lib/ops.d.ts.map +1 -1
  96. package/lib/ops.js +1 -0
  97. package/lib/ops.js.map +1 -1
  98. package/lib/revertibles.d.ts.map +1 -1
  99. package/lib/revertibles.js +5 -3
  100. package/lib/revertibles.js.map +1 -1
  101. package/lib/sequencePlace.d.ts +4 -0
  102. package/lib/sequencePlace.d.ts.map +1 -1
  103. package/lib/sequencePlace.js +15 -0
  104. package/lib/sequencePlace.js.map +1 -1
  105. package/lib/snapshotV1.d.ts.map +1 -1
  106. package/lib/snapshotV1.js +0 -2
  107. package/lib/snapshotV1.js.map +1 -1
  108. package/lib/snapshotlegacy.d.ts.map +1 -1
  109. package/lib/snapshotlegacy.js +0 -1
  110. package/lib/snapshotlegacy.js.map +1 -1
  111. package/lib/test/client.annotateMarker.spec.js.map +1 -1
  112. package/lib/test/client.applyMsg.spec.js +3 -3
  113. package/lib/test/client.applyMsg.spec.js.map +1 -1
  114. package/lib/test/client.localReference.spec.js.map +1 -1
  115. package/lib/test/client.rollback.spec.js.map +1 -1
  116. package/lib/test/mergeTree.annotate.spec.js +29 -19
  117. package/lib/test/mergeTree.annotate.spec.js.map +1 -1
  118. package/lib/test/obliterate.concurrent.spec.js +18 -0
  119. package/lib/test/obliterate.concurrent.spec.js.map +1 -1
  120. package/lib/test/obliterate.rangeExpansion.spec.js +109 -53
  121. package/lib/test/obliterate.rangeExpansion.spec.js.map +1 -1
  122. package/lib/test/obliterate.spec.js +2 -2
  123. package/lib/test/obliterate.spec.js.map +1 -1
  124. package/lib/test/reconnectHelper.d.ts +8 -6
  125. package/lib/test/reconnectHelper.d.ts.map +1 -1
  126. package/lib/test/reconnectHelper.js +15 -14
  127. package/lib/test/reconnectHelper.js.map +1 -1
  128. package/lib/test/revertibleFarm.spec.js.map +1 -1
  129. package/lib/test/testClientLogger.d.ts.map +1 -1
  130. package/lib/test/testClientLogger.js +19 -8
  131. package/lib/test/testClientLogger.js.map +1 -1
  132. package/lib/zamboni.js +2 -1
  133. package/lib/zamboni.js.map +1 -1
  134. package/package.json +31 -18
  135. package/src/attributionPolicy.ts +5 -0
  136. package/src/client.ts +136 -21
  137. package/src/index.ts +2 -0
  138. package/src/localReference.ts +5 -5
  139. package/src/mergeTree.ts +200 -75
  140. package/src/mergeTreeNodes.ts +37 -23
  141. package/src/opBuilder.ts +32 -0
  142. package/src/ops.ts +23 -1
  143. package/src/revertibles.ts +12 -5
  144. package/src/sequencePlace.ts +16 -0
  145. package/src/snapshotV1.ts +0 -2
  146. package/src/snapshotlegacy.ts +0 -1
  147. package/src/zamboni.ts +3 -2
@@ -5,37 +5,35 @@
5
5
  import { strict as assert } from "node:assert";
6
6
  import { Side } from "../sequencePlace.js";
7
7
  import { ReconnectTestHelper } from "./reconnectHelper.js";
8
- function itCorrectlyObliterates({ title, action, expectedText, expectedEventCount, }) {
8
+ function itCorrectlyObliterates({ title, action, expectedText, }) {
9
9
  return it(title, () => {
10
10
  const events = [];
11
- const helper = new ReconnectTestHelper();
11
+ const helper = new ReconnectTestHelper({
12
+ mergeTreeEnableSidedObliterate: true,
13
+ });
12
14
  helper.clients.A.on("delta", (opArgs, deltaArgs) => {
13
15
  events.push(deltaArgs.operation);
14
16
  });
15
17
  action(helper);
16
18
  helper.processAllOps();
17
- assert.equal(helper.clients.A.getText(), expectedText);
18
- assert.equal(helper.clients.B.getText(), expectedText);
19
- assert.equal(helper.clients.C.getText(), expectedText);
20
- assert.equal(events.length, expectedEventCount, `events: ${events.join(", ")}`);
21
- helper.logger.validate();
19
+ helper.logger.validate({ baseText: expectedText });
22
20
  });
23
21
  }
24
- describe.skip("obliterate", () => {
22
+ itCorrectlyObliterates.skip = ({ title, }) => it.skip(title, () => { });
23
+ describe("obliterate", () => {
25
24
  itCorrectlyObliterates({
26
25
  title: "obliterate adjacent insert",
27
26
  action: (helper) => {
28
27
  helper.insertText("A", 0, "|ABC>");
29
28
  helper.processAllOps();
30
- helper.obliterateRange("A", { pos: 0, side: Side.After }, { pos: 4, side: Side.After });
29
+ helper.obliterateRange("A", { pos: 0, side: Side.After }, { pos: 4, side: Side.Before });
31
30
  // not concurrent to A's obliterate - ops on the same client are never concurrent to one another
32
31
  // because they are all sequenced locally
33
- helper.insertText("A", 1, "XYZ");
34
- helper.obliterateRange("B", { pos: 0, side: Side.After }, { pos: 4, side: Side.After });
35
- helper.insertText("B", 1, "XYZ");
32
+ helper.insertText("A", 1, "AAA");
33
+ helper.obliterateRange("B", { pos: 0, side: Side.After }, { pos: 4, side: Side.Before });
34
+ helper.insertText("B", 1, "BBB");
36
35
  },
37
- expectedText: "|XYZ>",
38
- expectedEventCount: 3,
36
+ expectedText: "|BBB>",
39
37
  });
40
38
  itCorrectlyObliterates({
41
39
  title: "does not obliterate non-adjacent insert",
@@ -46,33 +44,104 @@ describe.skip("obliterate", () => {
46
44
  // do not obliterate the XYZ - outside the obliterated range without expansion
47
45
  helper.insertText("B", 0, "XYZ");
48
46
  },
49
- expectedText: "XYZheo world",
50
- expectedEventCount: 3,
47
+ expectedText: "XYZhe world",
48
+ });
49
+ itCorrectlyObliterates({
50
+ title: "obliterate, then insert at the end of the string",
51
+ action: (helper) => {
52
+ helper.insertText("A", 0, "hello world");
53
+ helper.processAllOps();
54
+ helper.obliterateRange("A", { pos: 5, side: Side.Before }, { pos: 10, side: Side.After });
55
+ helper.insertText("B", 10, "123");
56
+ },
57
+ expectedText: "hello",
58
+ });
59
+ itCorrectlyObliterates({
60
+ title: "insert, then obliterate at the end of the string",
61
+ action: (helper) => {
62
+ helper.insertText("A", 0, "hello world");
63
+ helper.processAllOps();
64
+ helper.insertText("A", 10, "123");
65
+ helper.obliterateRange("B", { pos: 5, side: Side.Before }, { pos: 10, side: Side.After });
66
+ },
67
+ expectedText: "hello",
68
+ });
69
+ itCorrectlyObliterates({
70
+ title: "obliterate, then insert at the end of the string",
71
+ action: (helper) => {
72
+ helper.insertText("A", 0, "hello world");
73
+ helper.processAllOps();
74
+ helper.obliterateRange("A", { pos: 5, side: Side.Before }, { pos: 10, side: Side.After });
75
+ helper.insertText("B", 10, "123");
76
+ },
77
+ expectedText: "hello",
78
+ });
79
+ itCorrectlyObliterates({
80
+ title: "insert, then obliterate at the end of the string",
81
+ action: (helper) => {
82
+ helper.insertText("A", 0, "hello world");
83
+ helper.processAllOps();
84
+ helper.insertText("A", 10, "123");
85
+ helper.obliterateRange("B", { pos: 5, side: Side.Before }, { pos: 10, side: Side.After });
86
+ },
87
+ expectedText: "hello",
88
+ });
89
+ describe("zero length", () => {
90
+ // TODO: #17785: Allow start and end to be used as obliteration range endpoints.
91
+ itCorrectlyObliterates.skip({
92
+ title: "zero length obliterate at the start of the string",
93
+ action: (helper) => {
94
+ helper.insertText("A", 0, "hello world");
95
+ helper.processAllOps();
96
+ helper.obliterateRange("A", { pos: -1, side: Side.After }, { pos: 0, side: Side.Before });
97
+ helper.insertText("B", 0, "more ");
98
+ },
99
+ expectedText: "hello world",
100
+ });
101
+ itCorrectlyObliterates({
102
+ title: "zero length obliterate in the middle of the string",
103
+ action: (helper) => {
104
+ helper.insertText("A", 0, "hello world");
105
+ helper.processAllOps();
106
+ helper.obliterateRange("A", { pos: 0, side: Side.After }, { pos: 1, side: Side.Before });
107
+ helper.insertText("B", 1, "more ");
108
+ },
109
+ expectedText: "hello world",
110
+ });
111
+ // TODO: #17785: Allow start and end to be used as obliteration range endpoints.
112
+ itCorrectlyObliterates.skip({
113
+ title: "zero length obliterate at the end of the string",
114
+ action: (helper) => {
115
+ helper.insertText("A", 0, "hello world");
116
+ helper.processAllOps();
117
+ helper.obliterateRange("A", { pos: helper.clients.A.getLength() - 1, side: Side.After }, { pos: -1, side: Side.Before });
118
+ helper.insertText("B", helper.clients.B.getLength(), " more");
119
+ },
120
+ expectedText: "hello world",
121
+ });
51
122
  });
52
123
  });
53
- describe.skip("overlapping edits", () => {
124
+ describe("overlapping edits", () => {
54
125
  itCorrectlyObliterates({
55
126
  title: "overlapping obliterate and obliterate",
56
127
  action: (helper) => {
57
128
  const text = "abcdef";
58
129
  helper.insertText("A", 0, text);
59
130
  helper.processAllOps();
60
- helper.obliterateRange("A", { pos: 0, side: Side.Before }, { pos: text.length, side: Side.After });
61
- helper.obliterateRange("B", { pos: 0, side: Side.Before }, { pos: text.length, side: Side.After });
131
+ helper.obliterateRange("A", { pos: 0, side: Side.Before }, { pos: text.length - 1, side: Side.After });
132
+ helper.obliterateRange("B", { pos: 0, side: Side.Before }, { pos: text.length - 1, side: Side.After });
62
133
  },
63
134
  expectedText: "",
64
- expectedEventCount: 2,
65
135
  });
66
136
  itCorrectlyObliterates({
67
137
  title: "adjacent obliterates",
68
138
  action: (helper) => {
69
139
  helper.insertText("A", 0, "hello world");
70
140
  helper.processAllOps();
71
- helper.obliterateRange("A", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });
72
- helper.obliterateRange("B", { pos: 4, side: Side.Before }, { pos: 6, side: Side.After });
141
+ helper.obliterateRange("A", { pos: 2, side: Side.Before }, { pos: 3, side: Side.After });
142
+ helper.obliterateRange("B", { pos: 4, side: Side.Before }, { pos: 5, side: Side.After });
73
143
  },
74
144
  expectedText: "heworld",
75
- expectedEventCount: 2,
76
145
  });
77
146
  itCorrectlyObliterates({
78
147
  title: "remove within obliterated range",
@@ -82,8 +151,7 @@ describe.skip("overlapping edits", () => {
82
151
  helper.obliterateRange("A", { pos: 2, side: Side.Before }, { pos: 5, side: Side.After });
83
152
  helper.removeRange("B", 3, 4);
84
153
  },
85
- expectedText: "he world",
86
- expectedEventCount: 2,
154
+ expectedText: "heworld",
87
155
  });
88
156
  itCorrectlyObliterates({
89
157
  title: "obliterate, then remove adjacent to range start",
@@ -93,8 +161,7 @@ describe.skip("overlapping edits", () => {
93
161
  helper.obliterateRange("A", { pos: 1, side: Side.After }, { pos: 5, side: Side.After });
94
162
  helper.removeRange("B", 1, 2);
95
163
  },
96
- expectedText: "he world",
97
- expectedEventCount: 2,
164
+ expectedText: "hworld",
98
165
  });
99
166
  itCorrectlyObliterates({
100
167
  title: "obliterate, then remove adjacent to range end",
@@ -104,8 +171,7 @@ describe.skip("overlapping edits", () => {
104
171
  helper.obliterateRange("A", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });
105
172
  helper.removeRange("B", 4, 6);
106
173
  },
107
- expectedText: "he world",
108
- expectedEventCount: 2,
174
+ expectedText: "heworld",
109
175
  });
110
176
  itCorrectlyObliterates({
111
177
  title: "remove, then obliterate adjacent to range start",
@@ -116,7 +182,6 @@ describe.skip("overlapping edits", () => {
116
182
  helper.obliterateRange("B", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });
117
183
  },
118
184
  expectedText: "heworld",
119
- expectedEventCount: 3,
120
185
  });
121
186
  itCorrectlyObliterates({
122
187
  title: "remove, then obliterate adjacent to range end",
@@ -126,8 +191,7 @@ describe.skip("overlapping edits", () => {
126
191
  helper.removeRange("A", 2, 4);
127
192
  helper.obliterateRange("B", { pos: 3, side: Side.After }, { pos: 6, side: Side.After });
128
193
  },
129
- expectedText: "heworld",
130
- expectedEventCount: 3,
194
+ expectedText: "heorld",
131
195
  });
132
196
  });
133
197
  describe.skip("reconnect", () => {
@@ -145,7 +209,6 @@ describe.skip("reconnect", () => {
145
209
  helper.insertText("A", 2, "123");
146
210
  },
147
211
  expectedText: "heo world",
148
- expectedEventCount: 2,
149
212
  });
150
213
  itCorrectlyObliterates({
151
214
  title: "add text, disconnect, obliterate, insert adjacent to obliterated range, reconnect",
@@ -160,10 +223,9 @@ describe.skip("reconnect", () => {
160
223
  helper.submitDisconnectedOp("C", op);
161
224
  },
162
225
  expectedText: "heo world",
163
- expectedEventCount: 2,
164
226
  });
165
227
  });
166
- describe.skip("sided obliterates", () => {
228
+ describe("sided obliterates", () => {
167
229
  /**
168
230
  * All test cases will operate on the same numerical positions, but differ on their sidedness:
169
231
  * 1. A expand both endpoints, B expand neither endpoint = expand range on both endpoints
@@ -186,10 +248,9 @@ describe.skip("sided obliterates", () => {
186
248
  // [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d
187
249
  helper.obliterateRange("B", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });
188
250
  helper.insertText("C", 2, "123");
189
- helper.insertText("C", 5, "456");
251
+ helper.insertText("C", 8, "456");
190
252
  },
191
253
  expectedText: "he world",
192
- expectedEventCount: 2,
193
254
  });
194
255
  itCorrectlyObliterates({
195
256
  title: "2. A expand start endpoint, B expand end endpoint",
@@ -200,15 +261,14 @@ describe.skip("sided obliterates", () => {
200
261
  helper.insertText("A", 0, "ABC");
201
262
  helper.processAllOps();
202
263
  helper.insertText("A", 2, "D");
203
- // ( 1]: after 0, after 1 => A( B] C
204
- helper.obliterateRange("A", { pos: 0, side: Side.After }, { pos: 2, side: Side.After });
264
+ // ( 1]: after 0, after 1 => A( B] D C
265
+ helper.obliterateRange("A", { pos: 0, side: Side.After }, { pos: 1, side: Side.After });
205
266
  // included in the range -- should get obliterated
206
- helper.insertText("B", 2, "E");
207
- // [1 ): before 1, before 2 => A [B )C
208
- helper.obliterateRange("B", { pos: 1, side: Side.After }, { pos: 3, side: Side.Before });
267
+ helper.insertText("B", 1, "E");
268
+ // [1 ): before 1, before 2 => A E [B )C
269
+ helper.obliterateRange("B", { pos: 1, side: Side.Before }, { pos: 3, side: Side.Before });
209
270
  },
210
- expectedText: "ADC",
211
- expectedEventCount: 2,
271
+ expectedText: "AC",
212
272
  });
213
273
  itCorrectlyObliterates({
214
274
  title: "3. A expand both endpoints, B expand start",
@@ -224,7 +284,6 @@ describe.skip("sided obliterates", () => {
224
284
  helper.insertText("C", 4, "456");
225
285
  },
226
286
  expectedText: "he world",
227
- expectedEventCount: 2,
228
287
  });
229
288
  itCorrectlyObliterates({
230
289
  title: "4. A expand both endpoints, B expand end",
@@ -235,12 +294,11 @@ describe.skip("sided obliterates", () => {
235
294
  helper.obliterateRange("A", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });
236
295
  // [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d
237
296
  helper.obliterateRange("B", { pos: 2, side: Side.Before }, { pos: 5, side: Side.Before });
238
- helper.insertText("C", 2, "123");
297
+ helper.insertText("C", 2, "123"); // he123llo world
239
298
  // for this to be interesting, might want to insert at 5
240
- helper.insertText("C", 4, "456");
299
+ helper.insertText("C", 8, "456"); // he123llo456 world
241
300
  },
242
301
  expectedText: "he world",
243
- expectedEventCount: 3,
244
302
  });
245
303
  itCorrectlyObliterates({
246
304
  title: "5. A expand neither endpoint, B expand start",
@@ -251,8 +309,8 @@ describe.skip("sided obliterates", () => {
251
309
  helper.obliterateRange("A", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });
252
310
  // ( 2, 4]: after 1, after 4 => h e( l l o] _ w o r l d
253
311
  helper.obliterateRange("B", { pos: 1, side: Side.After }, { pos: 4, side: Side.After });
254
- helper.insertText("C", 2, "123");
255
- helper.insertText("C", 5, "456");
312
+ helper.insertText("C", 2, "123"); // h e( 123 l l o] _ w o r l d
313
+ helper.insertText("C", 8, "456"); // h e( 123 l l o) 456 _ w o r l d
256
314
  helper.processAllOps();
257
315
  assert.equal(helper.clients.A.getText(), "he456 world");
258
316
  assert.equal(helper.clients.B.getText(), "he456 world");
@@ -260,7 +318,6 @@ describe.skip("sided obliterates", () => {
260
318
  helper.logger.validate();
261
319
  },
262
320
  expectedText: "he456 world",
263
- expectedEventCount: 3,
264
321
  });
265
322
  itCorrectlyObliterates({
266
323
  title: "6. A expand neither endpoint, B expand end",
@@ -272,7 +329,7 @@ describe.skip("sided obliterates", () => {
272
329
  // [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d
273
330
  helper.obliterateRange("B", { pos: 2, side: Side.Before }, { pos: 5, side: Side.Before });
274
331
  helper.insertText("C", 2, "123");
275
- helper.insertText("C", 5, "456");
332
+ helper.insertText("C", 8, "456");
276
333
  helper.processAllOps();
277
334
  assert.equal(helper.clients.A.getText(), "he123 world");
278
335
  assert.equal(helper.clients.B.getText(), "he123 world");
@@ -280,7 +337,6 @@ describe.skip("sided obliterates", () => {
280
337
  helper.logger.validate();
281
338
  },
282
339
  expectedText: "he123 world",
283
- expectedEventCount: 3,
284
340
  });
285
341
  });
286
342
  //# sourceMappingURL=obliterate.rangeExpansion.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"obliterate.rangeExpansion.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.rangeExpansion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,SAAS,sBAAsB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,YAAY,EACZ,kBAAkB,GAMlB;IACA,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,MAAM,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;YAClD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,M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C,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;YAExD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC;QACD,YAAY,EAAE,aAAa;QAC3B,kBAAkB,EAAE,CAAC;KACrB,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { Side } from \"../sequencePlace.js\";\n\nimport { ReconnectTestHelper } from \"./reconnectHelper.js\";\n\nfunction itCorrectlyObliterates({\n\ttitle,\n\taction,\n\texpectedText,\n\texpectedEventCount,\n}: {\n\ttitle: string;\n\taction: (helper: ReconnectTestHelper) => void;\n\texpectedText: string;\n\texpectedEventCount: number;\n}): Mocha.Test {\n\treturn it(title, () => {\n\t\tconst events: number[] = [];\n\n\t\tconst helper = new ReconnectTestHelper();\n\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tevents.push(deltaArgs.operation);\n\t\t});\n\t\taction(helper);\n\t\thelper.processAllOps();\n\t\tassert.equal(helper.clients.A.getText(), expectedText);\n\t\tassert.equal(helper.clients.B.getText(), expectedText);\n\t\tassert.equal(helper.clients.C.getText(), expectedText);\n\t\tassert.equal(events.length, expectedEventCount, `events: ${events.join(\", \")}`);\n\n\t\thelper.logger.validate();\n\t});\n}\n\ndescribe.skip(\"obliterate\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate adjacent insert\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"|ABC>\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 0, side: Side.After }, { pos: 4, side: Side.After });\n\t\t\t// not concurrent to A's obliterate - ops on the same client are never concurrent to one another\n\t\t\t// because they are all sequenced locally\n\t\t\thelper.insertText(\"A\", 1, \"XYZ\");\n\t\t\thelper.obliterateRange(\"B\", { pos: 0, side: Side.After }, { pos: 4, side: Side.After });\n\t\t\thelper.insertText(\"B\", 1, \"XYZ\");\n\t\t},\n\t\texpectedText: \"|XYZ>\",\n\t\texpectedEventCount: 3,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"does not obliterate non-adjacent insert\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// do not obliterate the XYZ - outside the obliterated range without expansion\n\t\t\thelper.insertText(\"B\", 0, \"XYZ\");\n\t\t},\n\t\texpectedText: \"XYZheo world\",\n\t\texpectedEventCount: 3,\n\t});\n});\n\ndescribe.skip(\"overlapping edits\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"overlapping obliterate and obliterate\",\n\t\taction: (helper) => {\n\t\t\tconst text = \"abcdef\";\n\n\t\t\thelper.insertText(\"A\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"A\",\n\t\t\t\t{ pos: 0, side: Side.Before },\n\t\t\t\t{ pos: text.length, side: Side.After },\n\t\t\t);\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 0, side: Side.Before },\n\t\t\t\t{ pos: text.length, side: Side.After },\n\t\t\t);\n\t\t},\n\t\texpectedText: \"\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"adjacent obliterates\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\thelper.obliterateRange(\"B\", { pos: 4, side: Side.Before }, { pos: 6, side: Side.After });\n\t\t},\n\t\texpectedText: \"heworld\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove within obliterated range\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 5, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 3, 4);\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then remove adjacent to range start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 1, 2);\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then remove adjacent to range end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 4, 6);\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove, then obliterate adjacent to range start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.removeRange(\"A\", 4, 6);\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t},\n\t\texpectedText: \"heworld\",\n\t\texpectedEventCount: 3,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove, then obliterate adjacent to range end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.removeRange(\"A\", 2, 4);\n\t\t\thelper.obliterateRange(\"B\", { pos: 3, side: Side.After }, { pos: 6, side: Side.After });\n\t\t},\n\t\texpectedText: \"heworld\",\n\t\texpectedEventCount: 3,\n\t});\n});\n\ndescribe.skip(\"reconnect\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"add text, disconnect, obliterate, reconnect, insert adjacent to obliterated range\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.disconnect([\"C\"]);\n\t\t\tconst op = helper.obliterateRangeLocal(\n\t\t\t\t\"C\",\n\t\t\t\t{ pos: 1, side: Side.After },\n\t\t\t\t{ pos: 4, side: Side.After },\n\t\t\t);\n\t\t\thelper.reconnect([\"C\"]);\n\t\t\thelper.submitDisconnectedOp(\"C\", op);\n\t\t\thelper.processAllOps();\n\t\t\t// inserting adjacent to the obliterated range start\n\t\t\thelper.insertText(\"A\", 2, \"123\");\n\t\t},\n\t\texpectedText: \"heo world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"add text, disconnect, obliterate, insert adjacent to obliterated range, reconnect\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.disconnect([\"C\"]);\n\t\t\tconst op = helper.obliterateRangeLocal(\n\t\t\t\t\"C\",\n\t\t\t\t{ pos: 1, side: Side.After },\n\t\t\t\t{ pos: 4, side: Side.After },\n\t\t\t);\n\t\t\t// inserting adjacent to the obliterated range start\n\t\t\thelper.insertText(\"A\", 2, \"123\");\n\t\t\thelper.reconnect([\"C\"]);\n\t\t\thelper.submitDisconnectedOp(\"C\", op);\n\t\t},\n\t\texpectedText: \"heo world\",\n\t\texpectedEventCount: 2,\n\t});\n});\n\ndescribe.skip(\"sided obliterates\", () => {\n\t/**\n\t * All test cases will operate on the same numerical positions, but differ on their sidedness:\n\t * 1. A expand both endpoints, B expand neither endpoint = expand range on both endpoints\n\t * 2. A expand start endpoint, B expand end endpoint = either FWW/LWW\n\t * 3. A expand both endpoints, B expand start = expand range on both endpoints\n\t * 4. (similar to 3) A expand both endpoints, B expand end = expand range on both endpoints\n\t * 5. A expand neither endpoint, B expand start = expand start endpoint\n\t * 6. A expand neither endpoint, B expand end = expand end endpoint\n\t * before = 0, after = 1\n\t */\n\titCorrectlyObliterates({\n\t\ttitle: \"1. A expand both endpoints, B expand neither endpoint\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\t// in order to get the right behavior, the range needs to start after the previous position\n\t\t\t// if so, for a range ( 2, 4 ) itCorrectlyObliterates would need to be after 1 and before 5\n\t\t\t// h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\thelper.insertText(\"C\", 5, \"456\");\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"2. A expand start endpoint, B expand end endpoint\",\n\t\taction: (helper) => {\n\t\t\t// currently this is the example from obliterate notation loop doc\n\t\t\t// TODO: translate this into same format as others\n\t\t\t// i think this gets difficult when the range to obliterate > 1 character\n\t\t\thelper.insertText(\"A\", 0, \"ABC\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.insertText(\"A\", 2, \"D\");\n\t\t\t// ( 1]: after 0, after 1 => A( B] C\n\t\t\thelper.obliterateRange(\"A\", { pos: 0, side: Side.After }, { pos: 2, side: Side.After });\n\t\t\t// included in the range -- should get obliterated\n\t\t\thelper.insertText(\"B\", 2, \"E\");\n\t\t\t// [1 ): before 1, before 2 => A [B )C\n\t\t\thelper.obliterateRange(\"B\", { pos: 1, side: Side.After }, { pos: 3, side: Side.Before });\n\t\t},\n\t\texpectedText: \"ADC\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"3. A expand both endpoints, B expand start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// ( 2, 4 ): after 1, before 5 => h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// ( 2, 4]: after 1, after 4 => h e( l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.After }, { pos: 4, side: Side.Before });\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\t// for this to be interesting, might want to insert at 5\n\t\t\thelper.insertText(\"C\", 4, \"456\");\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 2,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"4. A expand both endpoints, B expand end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// ( 2, 4 ): after 1, before 5 => h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 2, side: Side.Before },\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t);\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\t// for this to be interesting, might want to insert at 5\n\t\t\thelper.insertText(\"C\", 4, \"456\");\n\t\t},\n\t\texpectedText: \"he world\",\n\t\texpectedEventCount: 3,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"5. A expand neither endpoint, B expand start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// ( 2, 4]: after 1, after 4 => h e( l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 1, side: Side.After }, { pos: 4, side: Side.After });\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\thelper.insertText(\"C\", 5, \"456\");\n\t\t\thelper.processAllOps();\n\n\t\t\tassert.equal(helper.clients.A.getText(), \"he456 world\");\n\t\t\tassert.equal(helper.clients.B.getText(), \"he456 world\");\n\t\t\tassert.equal(helper.clients.C.getText(), \"he456 world\");\n\n\t\t\thelper.logger.validate();\n\t\t},\n\t\texpectedText: \"he456 world\",\n\t\texpectedEventCount: 3,\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"6. A expand neither endpoint, B expand end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 2, side: Side.Before },\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t);\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\thelper.insertText(\"C\", 5, \"456\");\n\t\t\thelper.processAllOps();\n\n\t\t\tassert.equal(helper.clients.A.getText(), \"he123 world\");\n\t\t\tassert.equal(helper.clients.B.getText(), \"he123 world\");\n\t\t\tassert.equal(helper.clients.C.getText(), \"he123 world\");\n\n\t\t\thelper.logger.validate();\n\t\t},\n\t\texpectedText: \"he123 world\",\n\t\texpectedEventCount: 3,\n\t});\n});\n"]}
1
+ {"version":3,"file":"obliterate.rangeExpansion.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.rangeExpansion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,SAAS,sBAAsB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,YAAY,GAKZ;IACA,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC;YACtC,8BAA8B,EAAE,IAAI;SACpC,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;YAClD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACf,MAAM,CAAC,aAAa,EAAE,CAAC;QAEvB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACJ,CAAC;AACD,sBAAsB,CAAC,IAAI,GAAG,CAAC,EAC9B,KAAK,GAKL,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EA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C,eAAe,CACrB,GAAG,EACH,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAC7B,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAC7B,CAAC;YAEF,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;YACjC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;YAEjC,MAAM,CAAC,aAAa,EAAE,CAAC;YAEvB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;YAExD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC;QACD,YAAY,EAAE,aAAa;KAC3B,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { Side } from \"../sequencePlace.js\";\n\nimport { ReconnectTestHelper } from \"./reconnectHelper.js\";\n\nfunction itCorrectlyObliterates({\n\ttitle,\n\taction,\n\texpectedText,\n}: {\n\ttitle: string;\n\taction: (helper: ReconnectTestHelper) => void;\n\texpectedText: string;\n}): Mocha.Test {\n\treturn it(title, () => {\n\t\tconst events: number[] = [];\n\n\t\tconst helper = new ReconnectTestHelper({\n\t\t\tmergeTreeEnableSidedObliterate: true,\n\t\t});\n\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tevents.push(deltaArgs.operation);\n\t\t});\n\t\taction(helper);\n\t\thelper.processAllOps();\n\n\t\thelper.logger.validate({ baseText: expectedText });\n\t});\n}\nitCorrectlyObliterates.skip = ({\n\ttitle,\n}: {\n\ttitle: string;\n\taction: (helper: ReconnectTestHelper) => void;\n\texpectedText: string;\n}) => it.skip(title, () => {});\n\ndescribe(\"obliterate\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate adjacent insert\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"|ABC>\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 0, side: Side.After }, { pos: 4, side: Side.Before });\n\t\t\t// not concurrent to A's obliterate - ops on the same client are never concurrent to one another\n\t\t\t// because they are all sequenced locally\n\t\t\thelper.insertText(\"A\", 1, \"AAA\");\n\t\t\thelper.obliterateRange(\"B\", { pos: 0, side: Side.After }, { pos: 4, side: Side.Before });\n\t\t\thelper.insertText(\"B\", 1, \"BBB\");\n\t\t},\n\t\texpectedText: \"|BBB>\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"does not obliterate non-adjacent insert\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// do not obliterate the XYZ - outside the obliterated range without expansion\n\t\t\thelper.insertText(\"B\", 0, \"XYZ\");\n\t\t},\n\t\texpectedText: \"XYZhe world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then insert at the end of the string\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"A\",\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t\t{ pos: 10, side: Side.After },\n\t\t\t);\n\t\t\thelper.insertText(\"B\", 10, \"123\");\n\t\t},\n\t\texpectedText: \"hello\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"insert, then obliterate at the end of the string\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\thelper.insertText(\"A\", 10, \"123\");\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t\t{ pos: 10, side: Side.After },\n\t\t\t);\n\t\t},\n\t\texpectedText: \"hello\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then insert at the end of the string\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"A\",\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t\t{ pos: 10, side: Side.After },\n\t\t\t);\n\t\t\thelper.insertText(\"B\", 10, \"123\");\n\t\t},\n\t\texpectedText: \"hello\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"insert, then obliterate at the end of the string\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\thelper.insertText(\"A\", 10, \"123\");\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t\t{ pos: 10, side: Side.After },\n\t\t\t);\n\t\t},\n\t\texpectedText: \"hello\",\n\t});\n\tdescribe(\"zero length\", () => {\n\t\t// TODO: #17785: Allow start and end to be used as obliteration range endpoints.\n\t\titCorrectlyObliterates.skip({\n\t\t\ttitle: \"zero length obliterate at the start of the string\",\n\t\t\taction: (helper) => {\n\t\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\t\thelper.processAllOps();\n\n\t\t\t\thelper.obliterateRange(\n\t\t\t\t\t\"A\",\n\t\t\t\t\t{ pos: -1, side: Side.After },\n\t\t\t\t\t{ pos: 0, side: Side.Before },\n\t\t\t\t);\n\t\t\t\thelper.insertText(\"B\", 0, \"more \");\n\t\t\t},\n\t\t\texpectedText: \"hello world\",\n\t\t});\n\t\titCorrectlyObliterates({\n\t\t\ttitle: \"zero length obliterate in the middle of the string\",\n\t\t\taction: (helper) => {\n\t\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\t\thelper.processAllOps();\n\n\t\t\t\thelper.obliterateRange(\n\t\t\t\t\t\"A\",\n\t\t\t\t\t{ pos: 0, side: Side.After },\n\t\t\t\t\t{ pos: 1, side: Side.Before },\n\t\t\t\t);\n\t\t\t\thelper.insertText(\"B\", 1, \"more \");\n\t\t\t},\n\t\t\texpectedText: \"hello world\",\n\t\t});\n\t\t// TODO: #17785: Allow start and end to be used as obliteration range endpoints.\n\t\titCorrectlyObliterates.skip({\n\t\t\ttitle: \"zero length obliterate at the end of the string\",\n\t\t\taction: (helper) => {\n\t\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\t\thelper.processAllOps();\n\n\t\t\t\thelper.obliterateRange(\n\t\t\t\t\t\"A\",\n\t\t\t\t\t{ pos: helper.clients.A.getLength() - 1, side: Side.After },\n\t\t\t\t\t{ pos: -1, side: Side.Before },\n\t\t\t\t);\n\t\t\t\thelper.insertText(\"B\", helper.clients.B.getLength(), \" more\");\n\t\t\t},\n\t\t\texpectedText: \"hello world\",\n\t\t});\n\t});\n});\n\ndescribe(\"overlapping edits\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"overlapping obliterate and obliterate\",\n\t\taction: (helper) => {\n\t\t\tconst text = \"abcdef\";\n\n\t\t\thelper.insertText(\"A\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"A\",\n\t\t\t\t{ pos: 0, side: Side.Before },\n\t\t\t\t{ pos: text.length - 1, side: Side.After },\n\t\t\t);\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 0, side: Side.Before },\n\t\t\t\t{ pos: text.length - 1, side: Side.After },\n\t\t\t);\n\t\t},\n\t\texpectedText: \"\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"adjacent obliterates\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 3, side: Side.After });\n\t\t\thelper.obliterateRange(\"B\", { pos: 4, side: Side.Before }, { pos: 5, side: Side.After });\n\t\t},\n\t\texpectedText: \"heworld\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove within obliterated range\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 5, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 3, 4);\n\t\t},\n\t\texpectedText: \"heworld\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then remove adjacent to range start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 1, 2);\n\t\t},\n\t\texpectedText: \"hworld\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"obliterate, then remove adjacent to range end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\thelper.removeRange(\"B\", 4, 6);\n\t\t},\n\t\texpectedText: \"heworld\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove, then obliterate adjacent to range start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.removeRange(\"A\", 4, 6);\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t},\n\t\texpectedText: \"heworld\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"remove, then obliterate adjacent to range end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.removeRange(\"A\", 2, 4);\n\t\t\thelper.obliterateRange(\"B\", { pos: 3, side: Side.After }, { pos: 6, side: Side.After });\n\t\t},\n\t\texpectedText: \"heorld\",\n\t});\n});\n\ndescribe.skip(\"reconnect\", () => {\n\titCorrectlyObliterates({\n\t\ttitle: \"add text, disconnect, obliterate, reconnect, insert adjacent to obliterated range\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.disconnect([\"C\"]);\n\t\t\tconst op = helper.obliterateRangeLocal(\n\t\t\t\t\"C\",\n\t\t\t\t{ pos: 1, side: Side.After },\n\t\t\t\t{ pos: 4, side: Side.After },\n\t\t\t);\n\t\t\thelper.reconnect([\"C\"]);\n\t\t\thelper.submitDisconnectedOp(\"C\", op);\n\t\t\thelper.processAllOps();\n\t\t\t// inserting adjacent to the obliterated range start\n\t\t\thelper.insertText(\"A\", 2, \"123\");\n\t\t},\n\t\texpectedText: \"heo world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"add text, disconnect, obliterate, insert adjacent to obliterated range, reconnect\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.disconnect([\"C\"]);\n\t\t\tconst op = helper.obliterateRangeLocal(\n\t\t\t\t\"C\",\n\t\t\t\t{ pos: 1, side: Side.After },\n\t\t\t\t{ pos: 4, side: Side.After },\n\t\t\t);\n\t\t\t// inserting adjacent to the obliterated range start\n\t\t\thelper.insertText(\"A\", 2, \"123\");\n\t\t\thelper.reconnect([\"C\"]);\n\t\t\thelper.submitDisconnectedOp(\"C\", op);\n\t\t},\n\t\texpectedText: \"heo world\",\n\t});\n});\n\ndescribe(\"sided obliterates\", () => {\n\t/**\n\t * All test cases will operate on the same numerical positions, but differ on their sidedness:\n\t * 1. A expand both endpoints, B expand neither endpoint = expand range on both endpoints\n\t * 2. A expand start endpoint, B expand end endpoint = either FWW/LWW\n\t * 3. A expand both endpoints, B expand start = expand range on both endpoints\n\t * 4. (similar to 3) A expand both endpoints, B expand end = expand range on both endpoints\n\t * 5. A expand neither endpoint, B expand start = expand start endpoint\n\t * 6. A expand neither endpoint, B expand end = expand end endpoint\n\t * before = 0, after = 1\n\t */\n\titCorrectlyObliterates({\n\t\ttitle: \"1. A expand both endpoints, B expand neither endpoint\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\t\t\t// in order to get the right behavior, the range needs to start after the previous position\n\t\t\t// if so, for a range ( 2, 4 ) itCorrectlyObliterates would need to be after 1 and before 5\n\t\t\t// h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\thelper.insertText(\"C\", 8, \"456\");\n\t\t},\n\t\texpectedText: \"he world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"2. A expand start endpoint, B expand end endpoint\",\n\t\taction: (helper) => {\n\t\t\t// currently this is the example from obliterate notation loop doc\n\t\t\t// TODO: translate this into same format as others\n\t\t\t// i think this gets difficult when the range to obliterate > 1 character\n\t\t\thelper.insertText(\"A\", 0, \"ABC\");\n\t\t\thelper.processAllOps();\n\t\t\thelper.insertText(\"A\", 2, \"D\");\n\t\t\t// ( 1]: after 0, after 1 => A( B] D C\n\t\t\thelper.obliterateRange(\"A\", { pos: 0, side: Side.After }, { pos: 1, side: Side.After });\n\t\t\t// included in the range -- should get obliterated\n\t\t\thelper.insertText(\"B\", 1, \"E\");\n\t\t\t// [1 ): before 1, before 2 => A E [B )C\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 1, side: Side.Before },\n\t\t\t\t{ pos: 3, side: Side.Before },\n\t\t\t);\n\t\t},\n\t\texpectedText: \"AC\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"3. A expand both endpoints, B expand start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// ( 2, 4 ): after 1, before 5 => h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// ( 2, 4]: after 1, after 4 => h e( l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 2, side: Side.After }, { pos: 4, side: Side.Before });\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\t// for this to be interesting, might want to insert at 5\n\t\t\thelper.insertText(\"C\", 4, \"456\");\n\t\t},\n\t\texpectedText: \"he world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"4. A expand both endpoints, B expand end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// ( 2, 4 ): after 1, before 5 => h e( l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 1, side: Side.After }, { pos: 5, side: Side.Before });\n\t\t\t// [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 2, side: Side.Before },\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t);\n\t\t\thelper.insertText(\"C\", 2, \"123\"); // he123llo world\n\t\t\t// for this to be interesting, might want to insert at 5\n\t\t\thelper.insertText(\"C\", 8, \"456\"); // he123llo456 world\n\t\t},\n\t\texpectedText: \"he world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"5. A expand neither endpoint, B expand start\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// ( 2, 4]: after 1, after 4 => h e( l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"B\", { pos: 1, side: Side.After }, { pos: 4, side: Side.After });\n\n\t\t\thelper.insertText(\"C\", 2, \"123\"); // h e( 123 l l o] _ w o r l d\n\t\t\thelper.insertText(\"C\", 8, \"456\"); // h e( 123 l l o) 456 _ w o r l d\n\t\t\thelper.processAllOps();\n\n\t\t\tassert.equal(helper.clients.A.getText(), \"he456 world\");\n\t\t\tassert.equal(helper.clients.B.getText(), \"he456 world\");\n\t\t\tassert.equal(helper.clients.C.getText(), \"he456 world\");\n\n\t\t\thelper.logger.validate();\n\t\t},\n\t\texpectedText: \"he456 world\",\n\t});\n\titCorrectlyObliterates({\n\t\ttitle: \"6. A expand neither endpoint, B expand end\",\n\t\taction: (helper) => {\n\t\t\thelper.insertText(\"A\", 0, \"hello world\");\n\t\t\thelper.processAllOps();\n\n\t\t\t// [2, 4]: before 2, after 4 => h e [l l o] _ w o r l d\n\t\t\thelper.obliterateRange(\"A\", { pos: 2, side: Side.Before }, { pos: 4, side: Side.After });\n\t\t\t// [2, 4 ): before 2, before 5 => h e [l l o )_ w o r l d\n\t\t\thelper.obliterateRange(\n\t\t\t\t\"B\",\n\t\t\t\t{ pos: 2, side: Side.Before },\n\t\t\t\t{ pos: 5, side: Side.Before },\n\t\t\t);\n\n\t\t\thelper.insertText(\"C\", 2, \"123\");\n\t\t\thelper.insertText(\"C\", 8, \"456\");\n\n\t\t\thelper.processAllOps();\n\n\t\t\tassert.equal(helper.clients.A.getText(), \"he123 world\");\n\t\t\tassert.equal(helper.clients.B.getText(), \"he123 world\");\n\t\t\tassert.equal(helper.clients.C.getText(), \"he123 world\");\n\n\t\t\thelper.logger.validate();\n\t\t},\n\t\texpectedText: \"he123 world\",\n\t});\n});\n"]}
@@ -102,7 +102,7 @@ describe("obliterate", () => {
102
102
  obliterateRange({
103
103
  mergeTree: client.mergeTree,
104
104
  start: 5,
105
- end: "hello world".length,
105
+ end: client.getLength(),
106
106
  refSeq,
107
107
  clientId: remoteClientId,
108
108
  seq: refSeq + 1,
@@ -147,7 +147,7 @@ describe("obliterate", () => {
147
147
  });
148
148
  describe("local obliterate with concurrent inserts", () => {
149
149
  it("removes range when pending local obliterate op", () => {
150
- client.obliterateRangeLocal(0, "hello world".length);
150
+ client.obliterateRangeLocal(0, client.getLength());
151
151
  insertText({
152
152
  mergeTree: client.mergeTree,
153
153
  pos: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"obliterate.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE7D,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,IAAI,MAAkB,CAAC;IACvB,IAAI,MAAc,CAAC;IACnB,MAAM,aAAa,GAAG,EAAE,CAAC;I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nD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,6BAA6B,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport type { ObliterateInfo } from \"../mergeTreeNodes.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport { insertText, obliterateRange } from \"./testUtils.js\";\n\ndescribe(\"obliterate\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = localClientId + 1;\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tclient.obliterateRangeLocal(0, client.getLength());\n\t\tassert.equal(client.getText(), \"\");\n\t});\n\n\tdescribe(\"concurrent obliterate and insert\", () => {\n\t\tit(\"removes text for obliterate then insert\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: client.getLength(),\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate when deleting entire string\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 1,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"h\");\n\t\t});\n\t});\n\n\tdescribe(\"endpoint behavior\", () => {\n\t\tit(\"does not expand to include text inserted at start\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 5,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"helloXXX\");\n\t\t});\n\t\tit(\"does not expand to include text inserted at end\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"XXX world\");\n\t\t});\n\t});\n\n\tdescribe(\"local obliterate with concurrent inserts\", () => {\n\t\tit(\"removes range when pending local obliterate op\", () => {\n\t\t\tclient.obliterateRangeLocal(0, \"hello world\".length);\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t});\n\n\tdescribe(\"local references\", () => {\n\t\tit(\"cleans up local references once the collab window advances enough\", () => {\n\t\t\tconst client2 = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tclient2.startOrUpdateCollaboration(\"client2\");\n\n\t\t\tconst obliterateStart = 0;\n\t\t\tconst obliterateEnd = client.getLength();\n\t\t\tconst startSeg = client.getContainingSegment(obliterateStart);\n\t\t\tconst endSeg = client.getContainingSegment(obliterateEnd);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: obliterateStart,\n\t\t\t\tend: obliterateEnd,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.start !== undefined, \"start ref should NOT be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.end !== undefined, \"end ref should NOT be removed\");\n\t\t\t});\n\n\t\t\t// this will force Zamboni to run\n\t\t\tlet seq = refSeq;\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tconst insert = client.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), i.toString()),\n\t\t\t\t\t++seq,\n\t\t\t\t);\n\t\t\t\tinsert.minimumSequenceNumber = seq - 1;\n\t\t\t\tclient.applyMsg(insert);\n\t\t\t\tclient2.applyMsg(insert);\n\t\t\t}\n\n\t\t\t// want to check that the start and end segment don't have the obliterate refs on them\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.start === undefined, \"start ref should be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.end === undefined, \"end ref should be removed\");\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
1
+ {"version":3,"file":"obliterate.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AA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EAAE,CAAC,EACxD,EAAE,GAAG,CACL,CAAC;gBACF,MAAM,CAAC,qBAAqB,GAAG,GAAG,GAAG,CAAC,CAAC;gBACvC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC;YAED,sFAAsF;YACtF,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,6BAA6B,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport type { ISegmentLeaf, ObliterateInfo } from \"../mergeTreeNodes.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport { insertText, obliterateRange } from \"./testUtils.js\";\n\ndescribe(\"obliterate\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = localClientId + 1;\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tclient.obliterateRangeLocal(0, client.getLength());\n\t\tassert.equal(client.getText(), \"\");\n\t});\n\n\tdescribe(\"concurrent obliterate and insert\", () => {\n\t\tit(\"removes text for obliterate then insert\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: client.getLength(),\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate when deleting entire string\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 1,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"h\");\n\t\t});\n\t});\n\n\tdescribe(\"endpoint behavior\", () => {\n\t\tit(\"does not expand to include text inserted at start\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 5,\n\t\t\t\tend: client.getLength(),\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"helloXXX\");\n\t\t});\n\t\tit(\"does not expand to include text inserted at end\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"XXX world\");\n\t\t});\n\t});\n\n\tdescribe(\"local obliterate with concurrent inserts\", () => {\n\t\tit(\"removes range when pending local obliterate op\", () => {\n\t\t\tclient.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t});\n\n\tdescribe(\"local references\", () => {\n\t\tit(\"cleans up local references once the collab window advances enough\", () => {\n\t\t\tconst client2 = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tclient2.startOrUpdateCollaboration(\"client2\");\n\n\t\t\tconst obliterateStart = 0;\n\t\t\tconst obliterateEnd = client.getLength();\n\t\t\tconst startSeg = client.getContainingSegment<ISegmentLeaf>(obliterateStart);\n\t\t\tconst endSeg = client.getContainingSegment<ISegmentLeaf>(obliterateEnd);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: obliterateStart,\n\t\t\t\tend: obliterateEnd,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.start !== undefined, \"start ref should NOT be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.end !== undefined, \"end ref should NOT be removed\");\n\t\t\t});\n\n\t\t\t// this will force Zamboni to run\n\t\t\tlet seq = refSeq;\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tconst insert = client.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), i.toString()),\n\t\t\t\t\t++seq,\n\t\t\t\t);\n\t\t\t\tinsert.minimumSequenceNumber = seq - 1;\n\t\t\t\tclient.applyMsg(insert);\n\t\t\t\tclient2.applyMsg(insert);\n\t\t\t}\n\n\t\t\t// want to check that the start and end segment don't have the obliterate refs on them\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.start === undefined, \"start ref should be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.end === undefined, \"end ref should be removed\");\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
@@ -3,23 +3,25 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
6
- import { SegmentGroup, type SequencePlace } from "../index.js";
7
- import { IMergeTreeDeltaOp, type IMergeTreeInsertMsg, type IMergeTreeObliterateMsg, type IMergeTreeRemoveMsg } from "../ops.js";
6
+ import { SegmentGroup, type IMergeTreeOptions, type InteriorSequencePlace, type SequencePlace } from "../index.js";
7
+ import { IMergeTreeDeltaOp, type IMergeTreeInsertMsg, type IMergeTreeObliterateMsg, type IMergeTreeObliterateSidedMsg, type IMergeTreeRemoveMsg } from "../ops.js";
8
+ import type { TestClient } from "./testClient.js";
8
9
  import { TestClientLogger } from "./testClientLogger.js";
9
10
  declare const ClientIds: readonly ["A", "B", "C", "D"];
10
11
  type ClientName = (typeof ClientIds)[number];
11
12
  export declare class ReconnectTestHelper {
12
- clients: Record<"A" | "C" | "B" | "D", import("./testClient.js").TestClient> & {
13
- all: import("./testClient.js").TestClient[];
13
+ clients: Record<ClientName, TestClient> & {
14
+ all: TestClient[];
14
15
  };
15
16
  idxFromName(name: ClientName): number;
16
17
  logger: TestClientLogger;
17
18
  ops: ISequencedDocumentMessage[];
18
19
  perClientOps: ISequencedDocumentMessage[][];
19
20
  seq: number;
21
+ constructor(options?: IMergeTreeOptions);
20
22
  insertText(clientName: ClientName, pos: number, text: string): void;
21
23
  removeRange(clientName: ClientName, start: number, end: number): void;
22
- obliterateRange(clientName: ClientName, start: SequencePlace, end: SequencePlace): void;
24
+ obliterateRange(clientName: ClientName, start: number | InteriorSequencePlace, end: number | InteriorSequencePlace): void;
23
25
  insertTextLocal(clientName: ClientName, pos: number, text: string): {
24
26
  op: IMergeTreeInsertMsg;
25
27
  seg: SegmentGroup;
@@ -31,7 +33,7 @@ export declare class ReconnectTestHelper {
31
33
  refSeq: number;
32
34
  };
33
35
  obliterateRangeLocal(clientName: ClientName, start: SequencePlace, end: SequencePlace): {
34
- op: IMergeTreeObliterateMsg;
36
+ op: IMergeTreeObliterateMsg | IMergeTreeObliterateSidedMsg;
35
37
  seg: SegmentGroup;
36
38
  refSeq: number;
37
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reconnectHelper.d.ts","sourceRoot":"","sources":["../../src/test/reconnectHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAExF,OAAO,EAAE,YAAY,EAAsB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EACN,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gBAAgB,EAA+B,MAAM,uBAAuB,CAAC;AAEtF,QAAA,MAAM,SAAS,+BAAgC,CAAC;AAChD,KAAK,UAAU,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7C,qBAAa,mBAAmB;IAC/B,OAAO;;MAML;IAEF,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAIrC,MAAM,mBAA0C;IAEhD,GAAG,EAAE,yBAAyB,EAAE,CAAM;IACtC,YAAY,EAAE,yBAAyB,EAAE,EAAE,CAAkC;IAE7E,GAAG,EAAE,MAAM,CAAK;IAET,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKnE,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAKrE,eAAe,C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