@atlaskit/collab-provider 10.3.1 → 10.3.3

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 (55) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/analytics/analytics-helper.js +10 -0
  3. package/dist/cjs/analytics/performance.js +4 -1
  4. package/dist/cjs/api/null-api.js +3 -1
  5. package/dist/cjs/channel.js +22 -1
  6. package/dist/cjs/connectivity/network.js +8 -0
  7. package/dist/cjs/connectivity/reconnect-helper.js +4 -0
  8. package/dist/cjs/document/catchupv2.js +17 -8
  9. package/dist/cjs/document/document-service.js +133 -63
  10. package/dist/cjs/emitter.js +10 -0
  11. package/dist/cjs/helpers/utils.js +16 -7
  12. package/dist/cjs/metadata/metadata-service.js +4 -1
  13. package/dist/cjs/namespace/namespace-service.js +2 -0
  14. package/dist/cjs/participants/participants-service.js +6 -0
  15. package/dist/cjs/provider/commit-step.js +7 -2
  16. package/dist/cjs/provider/index.js +54 -35
  17. package/dist/cjs/version-wrapper.js +1 -1
  18. package/dist/es2019/analytics/analytics-helper.js +10 -0
  19. package/dist/es2019/analytics/performance.js +4 -1
  20. package/dist/es2019/api/null-api.js +2 -0
  21. package/dist/es2019/channel.js +26 -0
  22. package/dist/es2019/connectivity/network.js +8 -0
  23. package/dist/es2019/connectivity/reconnect-helper.js +4 -0
  24. package/dist/es2019/document/catchupv2.js +10 -1
  25. package/dist/es2019/document/document-service.js +144 -71
  26. package/dist/es2019/emitter.js +11 -0
  27. package/dist/es2019/helpers/utils.js +10 -2
  28. package/dist/es2019/metadata/metadata-service.js +4 -1
  29. package/dist/es2019/namespace/namespace-service.js +2 -0
  30. package/dist/es2019/participants/participants-service.js +6 -0
  31. package/dist/es2019/provider/commit-step.js +8 -3
  32. package/dist/es2019/provider/index.js +54 -35
  33. package/dist/es2019/version-wrapper.js +1 -1
  34. package/dist/esm/analytics/analytics-helper.js +10 -0
  35. package/dist/esm/analytics/performance.js +4 -1
  36. package/dist/esm/api/null-api.js +3 -1
  37. package/dist/esm/channel.js +22 -1
  38. package/dist/esm/connectivity/network.js +8 -0
  39. package/dist/esm/connectivity/reconnect-helper.js +4 -0
  40. package/dist/esm/document/catchupv2.js +17 -8
  41. package/dist/esm/document/document-service.js +137 -64
  42. package/dist/esm/emitter.js +11 -0
  43. package/dist/esm/helpers/utils.js +16 -7
  44. package/dist/esm/metadata/metadata-service.js +4 -1
  45. package/dist/esm/namespace/namespace-service.js +2 -0
  46. package/dist/esm/participants/participants-service.js +6 -0
  47. package/dist/esm/provider/commit-step.js +8 -3
  48. package/dist/esm/provider/index.js +54 -35
  49. package/dist/esm/version-wrapper.js +1 -1
  50. package/dist/types/document/document-service.d.ts +6 -4
  51. package/dist/types/types.d.ts +5 -0
  52. package/dist/types-ts4.5/document/document-service.d.ts +6 -4
  53. package/dist/types-ts4.5/types.d.ts +5 -0
  54. package/package.json +6 -3
  55. package/tsconfig.json +0 -1
@@ -1,7 +1,11 @@
1
1
  import { createLogger } from '../helpers/utils';
2
2
  const logger = createLogger('Catchupv2', 'red');
3
3
  export const catchupv2 = async opt => {
4
+ // Ignored via go/ees005
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
6
  let steps;
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
9
  let metadata;
6
10
  const fromVersion = opt.getCurrentPmVersion();
7
11
  try {
@@ -16,6 +20,8 @@ export const catchupv2 = async opt => {
16
20
  throw error;
17
21
  }
18
22
  try {
23
+ var _opt$onCatchupComplet;
24
+ (_opt$onCatchupComplet = opt.onCatchupComplete) === null || _opt$onCatchupComplet === void 0 ? void 0 : _opt$onCatchupComplet.call(opt, steps);
19
25
  // skip onStepsAdded if steps are undefined or empty
20
26
  if (!steps || steps.length === 0) {
21
27
  opt.updateMetadata(metadata);
@@ -45,6 +51,9 @@ export const catchupv2 = async opt => {
45
51
  * @param clientId The ID of the currently connected session (one user can have multiple if theu have multiple tabs open)
46
52
  * @returns True if we're out of sync, false if not.
47
53
  */
48
- export const isOutOfSync = (fromVersion, currentVersion, steps, clientId) =>
54
+ export const isOutOfSync = (fromVersion, currentVersion, steps, clientId
55
+ // Ignored via go/ees005
56
+ // eslint-disable-next-line @typescript-eslint/max-params
57
+ ) =>
49
58
  // If version number hasn't increased, and steps are not from our client, we're out of sync
50
59
  Boolean(fromVersion >= currentVersion && steps.some(step => step.clientId !== clientId));
@@ -32,10 +32,16 @@ export class DocumentService {
32
32
  * @param onErrorHandled - Callback to handle
33
33
  * @param metadataService
34
34
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
35
+ * @param getConnected - if the channel is currently connected
35
36
  */
36
- constructor(participantsService, analyticsHelper, fetchCatchupv2, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, isNameSpaceLocked, enableErrorOnFailedDocumentApply = false, options = {
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @typescript-eslint/max-params
39
+ constructor(participantsService, analyticsHelper, fetchCatchupv2, fetchReconcile,
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, isNameSpaceLocked, enableErrorOnFailedDocumentApply = false, options = {
37
43
  __livePage: false
38
- }) {
44
+ }, getConnected) {
39
45
  // Fires analytics to editor when collab editor cannot sync up
40
46
  _defineProperty(this, "stepRejectCounter", 0);
41
47
  _defineProperty(this, "aggressiveCatchup", false);
@@ -44,7 +50,7 @@ export class DocumentService {
44
50
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
45
51
  * @param reason - optional reason to attach.
46
52
  */
47
- _defineProperty(this, "throttledCatchupv2", throttle(reason => this.catchupv2(reason), CATCHUP_THROTTLE, {
53
+ _defineProperty(this, "throttledCatchupv2", throttle((reason, reconnectionMetadata) => this.catchupv2(reason, reconnectionMetadata), CATCHUP_THROTTLE, {
48
54
  leading: false,
49
55
  // TODO: why shouldn't this be leading?
50
56
  trailing: true
@@ -55,7 +61,7 @@ export class DocumentService {
55
61
  * * try to accept steps but version is behind.
56
62
  * @param reason - optional reason to attach.
57
63
  */
58
- _defineProperty(this, "catchupv2", async reason => {
64
+ _defineProperty(this, "catchupv2", async (reason, reconnectionMetadata) => {
59
65
  const start = new Date().getTime();
60
66
  // if the queue is already paused, we are busy with something else, so don't proceed.
61
67
  if (this.stepQueue.isPaused()) {
@@ -79,7 +85,7 @@ export class DocumentService {
79
85
  }
80
86
  this.stepQueue.pauseQueue();
81
87
  try {
82
- var _this$analyticsHelper;
88
+ var _this$analyticsHelper2;
83
89
  /**
84
90
  * We have two options when out of sync:
85
91
  * - Check a boolean that ensures we reset the document next time we catchup
@@ -100,16 +106,26 @@ export class DocumentService {
100
106
  clientId: this.clientId,
101
107
  onStepsAdded: this.onStepsAdded,
102
108
  catchUpOutofSync: this.catchUpOutofSync,
103
- reason
109
+ reason,
110
+ onCatchupComplete: steps => {
111
+ // We want to capture the number of steps made while offline vs. online
112
+ if (reason === CatchupEventReason.RECONNECTED) {
113
+ var _this$analyticsHelper, _steps$length;
114
+ (_this$analyticsHelper = this.analyticsHelper) === null || _this$analyticsHelper === void 0 ? void 0 : _this$analyticsHelper.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, {
115
+ ...reconnectionMetadata,
116
+ remoteStepsLength: (_steps$length = steps === null || steps === void 0 ? void 0 : steps.length) !== null && _steps$length !== void 0 ? _steps$length : 0
117
+ });
118
+ }
119
+ }
104
120
  });
105
121
  const latency = new Date().getTime() - start;
106
- (_this$analyticsHelper = this.analyticsHelper) === null || _this$analyticsHelper === void 0 ? void 0 : _this$analyticsHelper.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.SUCCESS, {
122
+ (_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.SUCCESS, {
107
123
  latency
108
124
  });
109
125
  } catch (error) {
110
- var _this$analyticsHelper2;
126
+ var _this$analyticsHelper3;
111
127
  const latency = new Date().getTime() - start;
112
- (_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
128
+ (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
113
129
  latency
114
130
  });
115
131
  } finally {
@@ -123,22 +139,26 @@ export class DocumentService {
123
139
  var _this$getState;
124
140
  const state = (_this$getState = this.getState) === null || _this$getState === void 0 ? void 0 : _this$getState.call(this);
125
141
  if (!state) {
126
- var _this$analyticsHelper3;
127
- (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
142
+ var _this$analyticsHelper4;
143
+ (_this$analyticsHelper4 = this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 ? void 0 : _this$analyticsHelper4.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
128
144
  return 0;
129
145
  }
130
146
  return this.getVersionFromCollabState(state, 'collab-provider: getCurrentPmVersion');
131
147
  });
148
+ // Ignored via go/ees005
149
+ // eslint-disable-next-line require-await
132
150
  _defineProperty(this, "getCurrentState", async () => {
133
151
  try {
134
- var _this$getState2, _this$analyticsHelper5;
152
+ var _this$getState2, _this$analyticsHelper6;
135
153
  startMeasure(MEASURE_NAME.GET_CURRENT_STATE, this.analyticsHelper);
136
154
 
137
155
  // Convert ProseMirror document in Editor state to ADF document
138
156
  if (!((_this$getState2 = this.getState) !== null && _this$getState2 !== void 0 && _this$getState2.call(this))) {
139
- var _this$analyticsHelper4;
140
- (_this$analyticsHelper4 = this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 ? void 0 : _this$analyticsHelper4.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
157
+ var _this$analyticsHelper5;
158
+ (_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
141
159
  }
160
+ // Ignored via go/ees005
161
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
142
162
  const state = this.getState();
143
163
  const adfDocument = new JSONTransformer().encode(state.doc);
144
164
  const version = this.getVersionFromCollabState(state, 'collab-provider: getCurrentState');
@@ -148,17 +168,17 @@ export class DocumentService {
148
168
  stepVersion: version
149
169
  };
150
170
  const measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, this.analyticsHelper);
151
- (_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
171
+ (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
152
172
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
153
173
  });
154
174
  return currentState;
155
175
  } catch (error) {
156
- var _this$analyticsHelper6, _this$analyticsHelper7;
176
+ var _this$analyticsHelper7, _this$analyticsHelper8;
157
177
  const measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, this.analyticsHelper);
158
- (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.FAILURE, {
178
+ (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.FAILURE, {
159
179
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
160
180
  });
161
- (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendErrorEvent(error, 'Error while returning ADF version of current draft document');
181
+ (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 ? void 0 : _this$analyticsHelper8.sendErrorEvent(error, 'Error while returning ADF version of current draft document');
162
182
  throw error; // Reject the promise so the consumer can react to it failing
163
183
  }
164
184
  });
@@ -170,18 +190,22 @@ export class DocumentService {
170
190
  const clientIds = new Set(steps.map(({
171
191
  clientId
172
192
  }) => clientId));
193
+ // Ignored via go/ees005
194
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
173
195
  if (!clientIds.has(this.clientId)) {
174
196
  const userIds = new Set(steps.map(({
175
197
  userId
176
198
  }) => userId));
199
+ // Ignored via go/ees005
200
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
177
201
  if (userIds.has(this.getUserId())) {
178
202
  return true;
179
203
  }
180
204
  }
181
205
  return false;
182
206
  } catch (err) {
183
- var _this$analyticsHelper8;
184
- (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 ? void 0 : _this$analyticsHelper8.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
207
+ var _this$analyticsHelper9;
208
+ (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
185
209
  return false;
186
210
  }
187
211
  });
@@ -189,8 +213,8 @@ export class DocumentService {
189
213
  var _this$getState3, _sendableSteps;
190
214
  const state = (_this$getState3 = this.getState) === null || _this$getState3 === void 0 ? void 0 : _this$getState3.call(this);
191
215
  if (!state) {
192
- var _this$analyticsHelper9;
193
- (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
216
+ var _this$analyticsHelper10;
217
+ (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
194
218
  return;
195
219
  }
196
220
  return (_sendableSteps = sendableSteps(state)) === null || _sendableSteps === void 0 ? void 0 : _sendableSteps.origins;
@@ -199,8 +223,8 @@ export class DocumentService {
199
223
  var _this$getState4, _sendableSteps2;
200
224
  const state = (_this$getState4 = this.getState) === null || _this$getState4 === void 0 ? void 0 : _this$getState4.call(this);
201
225
  if (!state) {
202
- var _this$analyticsHelper10;
203
- (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
226
+ var _this$analyticsHelper11;
227
+ (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
204
228
  return;
205
229
  }
206
230
  return (_sendableSteps2 = sendableSteps(state)) === null || _sendableSteps2 === void 0 ? void 0 : _sendableSteps2.steps;
@@ -239,8 +263,8 @@ export class DocumentService {
239
263
  userId
240
264
  }) => userId));
241
265
  } catch (stepsAddedError) {
242
- var _this$analyticsHelper11;
243
- (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(stepsAddedError, 'Error while adding steps in the provider');
266
+ var _this$analyticsHelper12;
267
+ (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendErrorEvent(stepsAddedError, 'Error while adding steps in the provider');
244
268
  this.onErrorHandled({
245
269
  message: 'Error while adding steps in the provider',
246
270
  data: {
@@ -267,7 +291,7 @@ export class DocumentService {
267
291
  const currentState = await this.getCurrentState();
268
292
  let useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
269
293
  try {
270
- var _this$analyticsHelper14;
294
+ var _this$analyticsHelper15;
271
295
  // Reset the editor,
272
296
  // - Replace the document, keep in sync with the server
273
297
  // - Replace the version number, so editor is in sync with NCS server and can commit new changes.
@@ -283,8 +307,8 @@ export class DocumentService {
283
307
  this.metadataService.updateMetadata(metadata);
284
308
  if (fg('restore_localstep_fallback_reconcile')) {
285
309
  try {
286
- var _this$analyticsHelper12;
287
- (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
310
+ var _this$analyticsHelper13;
311
+ (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
288
312
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
289
313
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
290
314
  clientId: this.clientId,
@@ -295,8 +319,8 @@ export class DocumentService {
295
319
  this.applyLocalSteps(unconfirmedSteps);
296
320
  }
297
321
  } catch (applyLocalStepsError) {
298
- var _this$analyticsHelper13;
299
- (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(applyLocalStepsError, `Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile`);
322
+ var _this$analyticsHelper14;
323
+ (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(applyLocalStepsError, `Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile`);
300
324
  useReconcile = true;
301
325
  await this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
302
326
  }
@@ -310,7 +334,7 @@ export class DocumentService {
310
334
  this.applyLocalSteps(unconfirmedSteps);
311
335
  }
312
336
  }
313
- (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
337
+ (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
314
338
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
315
339
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
316
340
  useReconcile,
@@ -319,15 +343,15 @@ export class DocumentService {
319
343
  triggeredByCatchup: targetClientId ? true : false
320
344
  });
321
345
  } catch (restoreError) {
322
- var _this$analyticsHelper15, _this$analyticsHelper16;
323
- (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
346
+ var _this$analyticsHelper16, _this$analyticsHelper17;
347
+ (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
324
348
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
325
349
  useReconcile,
326
350
  clientId: this.clientId,
327
351
  targetClientId,
328
352
  triggeredByCatchup: targetClientId ? true : false
329
353
  });
330
- (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(restoreError, `Error while reinitialising document. Use Reconcile: ${useReconcile}`);
354
+ (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendErrorEvent(restoreError, `Error while reinitialising document. Use Reconcile: ${useReconcile}`);
331
355
  this.onErrorHandled({
332
356
  message: 'Caught error while trying to recover the document',
333
357
  data: {
@@ -341,7 +365,7 @@ export class DocumentService {
341
365
  _defineProperty(this, "getFinalAcknowledgedState", async () => {
342
366
  this.aggressiveCatchup = true;
343
367
  try {
344
- var _this$analyticsHelper17;
368
+ var _this$analyticsHelper18;
345
369
  startMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
346
370
  let finalAcknowledgedState;
347
371
  try {
@@ -358,19 +382,19 @@ export class DocumentService {
358
382
  };
359
383
  }
360
384
  const measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
361
- (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
385
+ (_this$analyticsHelper18 = this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
362
386
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
363
387
  });
364
388
  this.aggressiveCatchup = false;
365
389
  return finalAcknowledgedState;
366
390
  } catch (error) {
367
- var _this$analyticsHelper18, _this$analyticsHelper19;
391
+ var _this$analyticsHelper19, _this$analyticsHelper20;
368
392
  this.aggressiveCatchup = false;
369
393
  const measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
370
- (_this$analyticsHelper18 = this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
394
+ (_this$analyticsHelper19 = this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
371
395
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
372
396
  });
373
- (_this$analyticsHelper19 = this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
397
+ (_this$analyticsHelper20 = this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 ? void 0 : _this$analyticsHelper20.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
374
398
  throw error; // Reject the promise so the consumer can react to it failing
375
399
  }
376
400
  });
@@ -390,13 +414,15 @@ export class DocumentService {
390
414
  });
391
415
  this.updateDocumentAnalytics(doc, version);
392
416
  });
417
+ // Ignored via go/ees005
418
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
393
419
  _defineProperty(this, "updateDocumentAnalytics", (doc, version) => {
394
420
  const updatedVersion = this.getCurrentPmVersion();
395
421
  const isDocContentValid = this.validatePMJSONDocument(doc);
396
422
  // ESS-5023: only emit error event if updated client version is still behind server version
397
423
  // client version could become higher than server version due to user editing or plugin adding steps
398
424
  if (updatedVersion < version) {
399
- var _doc$content, _this$analyticsHelper20;
425
+ var _doc$content, _this$analyticsHelper21;
400
426
  const error = new UpdateDocumentError('Failed to update the document', {
401
427
  newVersion: version,
402
428
  editorVersion: updatedVersion,
@@ -404,7 +430,7 @@ export class DocumentService {
404
430
  docHasContent: (doc === null || doc === void 0 ? void 0 : (_doc$content = doc.content) === null || _doc$content === void 0 ? void 0 : _doc$content.length) >= 1,
405
431
  isDocContentValid
406
432
  });
407
- (_this$analyticsHelper20 = this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 ? void 0 : _this$analyticsHelper20.sendErrorEvent(error, 'Failed to update the document in document service');
433
+ (_this$analyticsHelper21 = this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 ? void 0 : _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
408
434
  if (this.enableErrorOnFailedDocumentApply) {
409
435
  this.onErrorHandled({
410
436
  message: 'The provider failed to apply changes to the editor',
@@ -421,8 +447,8 @@ export class DocumentService {
421
447
  }
422
448
  // Otherwise just fail silently for now
423
449
  } else {
424
- var _this$analyticsHelper21, _doc$content2;
425
- (_this$analyticsHelper21 = this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 ? void 0 : _this$analyticsHelper21.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
450
+ var _this$analyticsHelper22, _doc$content2;
451
+ (_this$analyticsHelper22 = this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 ? void 0 : _this$analyticsHelper22.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
426
452
  newVersion: version,
427
453
  editorVersion: updatedVersion,
428
454
  isDocTruthy: !!doc,
@@ -431,14 +457,20 @@ export class DocumentService {
431
457
  });
432
458
  }
433
459
  });
460
+ // Ignored via go/ees005
461
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
434
462
  _defineProperty(this, "validatePMJSONDocument", doc => {
435
463
  try {
436
464
  var _this$getState5;
437
465
  if (!((_this$getState5 = this.getState) !== null && _this$getState5 !== void 0 && _this$getState5.call(this))) {
438
- var _this$analyticsHelper22;
439
- (_this$analyticsHelper22 = this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 ? void 0 : _this$analyticsHelper22.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
466
+ var _this$analyticsHelper23;
467
+ (_this$analyticsHelper23 = this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 ? void 0 : _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
440
468
  }
469
+ // Ignored via go/ees005
470
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
441
471
  const state = this.getState();
472
+ // Ignored via go/ees005
473
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
442
474
  const content = (doc.content || []).map(child => state.schema.nodeFromJSON(child));
443
475
  return content.every(node => {
444
476
  try {
@@ -460,7 +492,7 @@ export class DocumentService {
460
492
  const unconfirmedSteps = this.getUnconfirmedSteps();
461
493
  try {
462
494
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
463
- var _this$getState6, _this$analyticsHelper24;
495
+ var _this$getState6, _this$analyticsHelper25;
464
496
  startMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
465
497
  let count = 0;
466
498
  // We use origins here as steps can be rebased. When steps are rebased a new step is created.
@@ -471,8 +503,8 @@ export class DocumentService {
471
503
  const lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
472
504
  let isLastTrConfirmed = false;
473
505
  if (!((_this$getState6 = this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(this))) {
474
- var _this$analyticsHelper23;
475
- (_this$analyticsHelper23 = this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 ? void 0 : _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
506
+ var _this$analyticsHelper24;
507
+ (_this$analyticsHelper24 = this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 ? void 0 : _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
476
508
  }
477
509
  while (!isLastTrConfirmed) {
478
510
  this.sendStepsFromCurrentState();
@@ -487,6 +519,8 @@ export class DocumentService {
487
519
  if (!isLastTrConfirmed && count++ >= ACK_MAX_TRY) {
488
520
  var _this$getUnconfirmedS;
489
521
  if (this.onSyncUpError) {
522
+ // Ignored via go/ees005
523
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
490
524
  const state = this.getState();
491
525
  const version = this.getVersionFromCollabState(state, 'collab-provider: commitUnconfirmedSteps');
492
526
  this.onSyncUpError({
@@ -505,35 +539,35 @@ export class DocumentService {
505
539
  }
506
540
  }
507
541
  const measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
508
- (_this$analyticsHelper24 = this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 ? void 0 : _this$analyticsHelper24.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
542
+ (_this$analyticsHelper25 = this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 ? void 0 : _this$analyticsHelper25.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
509
543
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
510
544
  // upon success, emit the total number of unconfirmed steps we synced
511
545
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
512
546
  });
513
547
  }
514
548
  } catch (error) {
515
- var _this$analyticsHelper25, _this$analyticsHelper26;
549
+ var _this$analyticsHelper26, _this$analyticsHelper27;
516
550
  const measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
517
- (_this$analyticsHelper25 = this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 ? void 0 : _this$analyticsHelper25.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
551
+ (_this$analyticsHelper26 = this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 ? void 0 : _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
518
552
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
519
553
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
520
554
  });
521
- (_this$analyticsHelper26 = this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 ? void 0 : _this$analyticsHelper26.sendErrorEvent(error, 'Error while committing unconfirmed steps');
555
+ (_this$analyticsHelper27 = this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 ? void 0 : _this$analyticsHelper27.sendErrorEvent(error, 'Error while committing unconfirmed steps');
522
556
  throw error;
523
557
  }
524
558
  });
525
559
  _defineProperty(this, "onStepRejectedError", () => {
526
- var _this$analyticsHelper27;
560
+ var _this$analyticsHelper28;
527
561
  this.stepRejectCounter++;
528
562
  logger(`Steps rejected (tries=${this.stepRejectCounter})`);
529
- (_this$analyticsHelper27 = this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 ? void 0 : _this$analyticsHelper27.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
563
+ (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 ? void 0 : _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
530
564
  count: this.stepRejectCounter
531
565
  });
532
- let maxRetries = this.aggressiveCatchup ? MAX_STEP_REJECTED_ERROR_AGGRESSIVE : MAX_STEP_REJECTED_ERROR;
566
+ const maxRetries = this.aggressiveCatchup ? MAX_STEP_REJECTED_ERROR_AGGRESSIVE : MAX_STEP_REJECTED_ERROR;
533
567
  if (this.stepRejectCounter >= maxRetries) {
534
- var _this$analyticsHelper28;
568
+ var _this$analyticsHelper29;
535
569
  logger(`The steps were rejected too many times (tries=${this.stepRejectCounter}, limit=${MAX_STEP_REJECTED_ERROR}). Trying to catch-up.`);
536
- (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 ? void 0 : _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
570
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
537
571
  this.throttledCatchupv2(CatchupEventReason.STEPS_REJECTED);
538
572
  } else {
539
573
  // If committing steps failed try again automatically in 1s
@@ -554,21 +588,22 @@ export class DocumentService {
554
588
  this.isNameSpaceLocked = isNameSpaceLocked;
555
589
  this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
556
590
  this.options = options;
591
+ this.getConnected = getConnected;
557
592
  this.stepQueue = new StepQueueState();
558
593
  this.onErrorHandled = onErrorHandled;
559
594
  }
560
595
  getVersionFromCollabState(state, resource) {
561
596
  const collabState = getCollabState(state);
562
597
  if (!collabState) {
563
- var _this$analyticsHelper29;
564
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), `${resource} called without collab state`);
598
+ var _this$analyticsHelper30;
599
+ (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 ? void 0 : _this$analyticsHelper30.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), `${resource} called without collab state`);
565
600
  return 0;
566
601
  }
567
602
 
568
603
  // This should not happen in usual, just add error event in case it happens
569
604
  if (collabState.version === undefined) {
570
- var _this$analyticsHelper30;
571
- (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 ? void 0 : _this$analyticsHelper30.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), `${resource} called with collab state missing version info`);
605
+ var _this$analyticsHelper31;
606
+ (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 ? void 0 : _this$analyticsHelper31.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), `${resource} called with collab state missing version info`);
572
607
  return 0;
573
608
  }
574
609
  return collabState.version;
@@ -582,9 +617,15 @@ export class DocumentService {
582
617
  if (this.stepQueue.getQueue().length > 0) {
583
618
  const firstItem = this.stepQueue.shift();
584
619
  const currentVersion = this.getCurrentPmVersion();
620
+ // Ignored via go/ees005
621
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
585
622
  const expectedVersion = currentVersion + firstItem.steps.length;
623
+ // Ignored via go/ees005
624
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
586
625
  if (firstItem.version === expectedVersion) {
587
626
  logger(`Applying data from queue!`);
627
+ // Ignored via go/ees005
628
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
588
629
  this.processSteps(firstItem);
589
630
  // recur
590
631
  this.processQueue();
@@ -612,15 +653,17 @@ export class DocumentService {
612
653
  this.participantsService.emitTelepointersFromSteps(steps);
613
654
 
614
655
  // Resend local steps if none of the received steps originated with us!
656
+ // Ignored via go/ees005
657
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
615
658
  if (clientIds.indexOf(this.clientId) === -1) {
616
659
  setTimeout(() => this.sendStepsFromCurrentState(), 100);
617
660
  }
618
661
  } catch (error) {
619
- var _this$analyticsHelper31;
662
+ var _this$analyticsHelper32;
620
663
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
621
- let userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
664
+ const userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
622
665
  logger(`Processing steps failed with error: ${error}. Triggering catch up call.`);
623
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 ? void 0 : _this$analyticsHelper31.sendErrorEvent(error, userIdMatch ? `Error while processing steps with new clientId` : `Error while processing steps`);
666
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 ? void 0 : _this$analyticsHelper32.sendErrorEvent(error, userIdMatch ? `Error while processing steps with new clientId` : `Error while processing steps`);
624
667
  this.throttledCatchupv2(CatchupEventReason.PROCESS_STEPS);
625
668
  }
626
669
  }
@@ -650,8 +693,8 @@ export class DocumentService {
650
693
  var _this$getState7;
651
694
  const state = (_this$getState7 = this.getState) === null || _this$getState7 === void 0 ? void 0 : _this$getState7.call(this);
652
695
  if (!state) {
653
- var _this$analyticsHelper32;
654
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 ? void 0 : _this$analyticsHelper32.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
696
+ var _this$analyticsHelper33;
697
+ (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
655
698
  return;
656
699
  }
657
700
  this.send(null, null, state, sendAnalyticsEvent);
@@ -660,21 +703,29 @@ export class DocumentService {
660
703
  * Send steps from transaction to other participants
661
704
  * It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
662
705
  */
706
+ // Ignored via go/ees005
707
+ // eslint-disable-next-line @typescript-eslint/max-params
663
708
  send(_tr, _oldState, newState, sendAnalyticsEvent) {
664
709
  const unconfirmedStepsData = sendableSteps(newState);
665
710
  const version = this.getVersionFromCollabState(newState, 'collab-provider: send');
666
711
 
667
712
  // Don't send any steps before we're ready.
668
- if (!unconfirmedStepsData) {
669
- return;
713
+ if (fg('platform_editor_merge_unconfirmed_steps')) {
714
+ if (!unconfirmedStepsData || !this.getConnected()) {
715
+ return;
716
+ }
717
+ } else {
718
+ if (!unconfirmedStepsData) {
719
+ return;
720
+ }
670
721
  }
671
722
  const unconfirmedSteps = unconfirmedStepsData.steps;
672
723
  // sendAnalyticsEvent is only true when buffering is enabled,
673
724
  // to ensure that analytics events with the number of unconfirmed steps is only
674
725
  // sent once on connection (as opposed to on every step)
675
726
  if (sendAnalyticsEvent) {
676
- var _this$analyticsHelper33;
677
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
727
+ var _this$analyticsHelper34;
728
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 ? void 0 : _this$analyticsHelper34.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
678
729
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
679
730
  });
680
731
  }
@@ -682,12 +733,28 @@ export class DocumentService {
682
733
  return;
683
734
  }
684
735
 
736
+ // If we are going to commit unconfirmed steps
737
+ // we need to lock them to ensure they don't get
738
+ // mutated in: `packages/editor/editor-plugin-collab-edit/src/pm-plugins/mergeUnconfirmed.ts`
739
+ if (fg('platform_editor_merge_unconfirmed_steps')) {
740
+ unconfirmedStepsData.steps.forEach(s => {
741
+ if (isLockable(s)) {
742
+ var _s$lockStep;
743
+ (_s$lockStep = s.lockStep) === null || _s$lockStep === void 0 ? void 0 : _s$lockStep.call(s);
744
+ }
745
+ });
746
+ }
747
+
685
748
  // Avoid reference issues using a
686
749
  // method outside of the provider
687
750
  // scope
688
751
  commitStepQueue({
689
752
  broadcast: this.broadcast,
753
+ // Ignored via go/ees005
754
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
690
755
  userId: this.getUserId(),
756
+ // Ignored via go/ees005
757
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
691
758
  clientId: this.clientId,
692
759
  steps: unconfirmedSteps,
693
760
  version,
@@ -698,4 +765,10 @@ export class DocumentService {
698
765
  __livePage: this.options.__livePage
699
766
  });
700
767
  }
768
+ }
769
+
770
+ // Based on: packages/editor/editor-plugin-collab-edit/src/pm-plugins/mergeUnconfirmed.ts
771
+
772
+ function isLockable(step) {
773
+ return (step === null || step === void 0 ? void 0 : step.lockStep) !== undefined;
701
774
  }
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { EventEmitter2 } from 'eventemitter2';
3
+
4
+ // Ignored via go/ees005
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
6
  export class Emitter {
4
7
  constructor() {
5
8
  _defineProperty(this, "eventEmitter", new EventEmitter2());
@@ -8,6 +11,8 @@ export class Emitter {
8
11
  * Emit events to subscribers
9
12
  */
10
13
  emit(evt, data) {
14
+ // Ignored via go/ees005
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
16
  this.eventEmitter.emit(evt, data);
12
17
  return this;
13
18
  }
@@ -16,6 +21,8 @@ export class Emitter {
16
21
  * Subscribe to events emitted by this provider
17
22
  */
18
23
  on(evt, handler) {
24
+ // Ignored via go/ees005
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
26
  this.eventEmitter.on(evt, handler);
20
27
  return this;
21
28
  }
@@ -24,6 +31,8 @@ export class Emitter {
24
31
  * Unsubscribe from events emitted by this provider
25
32
  */
26
33
  off(evt, handler) {
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
36
  this.eventEmitter.off(evt, handler);
28
37
  return this;
29
38
  }
@@ -32,6 +41,8 @@ export class Emitter {
32
41
  * Unsubscribe from all events emitted by this provider.
33
42
  */
34
43
  unsubscribeAll(evt) {
44
+ // Ignored via go/ees005
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
46
  this.eventEmitter.removeAllListeners(evt);
36
47
  return this;
37
48
  }