@atlaskit/collab-provider 10.5.2 → 10.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/document/document-service.js +51 -25
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +29 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +52 -26
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +28 -0
- package/dist/types-ts4.5/document/document-service.d.ts +28 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#112186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112186)
|
|
8
|
+
[`9462d8ca2405a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9462d8ca2405a) -
|
|
9
|
+
Bump adf-schema to 47.2.1
|
|
10
|
+
|
|
11
|
+
## 10.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#105322](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105322)
|
|
16
|
+
[`8876083532adc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8876083532adc) -
|
|
17
|
+
Bumped editor-prosemirror version to 7.0.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 10.5.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -129,7 +129,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
129
129
|
_this.catchUpOutofSync = _context.sent;
|
|
130
130
|
latency = new Date().getTime() - start;
|
|
131
131
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
|
|
132
|
-
latency: latency
|
|
132
|
+
latency: latency,
|
|
133
|
+
version: _this.getCurrentPmVersion()
|
|
133
134
|
});
|
|
134
135
|
_context.next = 20;
|
|
135
136
|
break;
|
|
@@ -307,10 +308,32 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
310
|
});
|
|
311
|
+
(0, _defineProperty2.default)(this, "obfuscateStepsAndState", function (unconfirmedSteps, currentState) {
|
|
312
|
+
var obfuscatedSteps;
|
|
313
|
+
try {
|
|
314
|
+
obfuscatedSteps = unconfirmedSteps ? (0, _utils.getObfuscatedSteps)(unconfirmedSteps.map(function (pmStep) {
|
|
315
|
+
return pmStep.toJSON();
|
|
316
|
+
})) : 'None';
|
|
317
|
+
} catch (error) {
|
|
318
|
+
// Note that we do not log this error immediately - this string will be logged later.
|
|
319
|
+
// This avoids double logging and keeps this function pure.
|
|
320
|
+
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
321
|
+
}
|
|
322
|
+
var obfuscatedDoc;
|
|
323
|
+
try {
|
|
324
|
+
obfuscatedDoc = (0, _utils.getDocAdfWithObfuscation)(currentState.content);
|
|
325
|
+
} catch (error) {
|
|
326
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
330
|
+
obfuscatedDoc: obfuscatedDoc
|
|
331
|
+
};
|
|
332
|
+
});
|
|
310
333
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
311
334
|
(0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
|
|
312
335
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
|
|
313
|
-
var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$analyticsHelper15, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
|
|
336
|
+
var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper15, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
|
|
314
337
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
315
338
|
while (1) switch (_context3.prev = _context3.next) {
|
|
316
339
|
case 0:
|
|
@@ -332,7 +355,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
332
355
|
case 7:
|
|
333
356
|
currentState = _context3.sent;
|
|
334
357
|
useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
335
|
-
|
|
358
|
+
_this$obfuscateStepsA = _this.obfuscateStepsAndState(unconfirmedSteps, currentState), obfuscatedSteps = _this$obfuscateStepsA.obfuscatedSteps, obfuscatedDoc = _this$obfuscateStepsA.obfuscatedDoc;
|
|
359
|
+
_context3.prev = 10;
|
|
336
360
|
// Reset the editor,
|
|
337
361
|
// - Replace the document, keep in sync with the server
|
|
338
362
|
// - Replace the version number, so editor is in sync with NCS server and can commit new changes.
|
|
@@ -347,12 +371,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
347
371
|
});
|
|
348
372
|
_this.metadataService.updateMetadata(metadata);
|
|
349
373
|
if (!(0, _platformFeatureFlags.fg)('restore_localstep_fallback_reconcile')) {
|
|
350
|
-
_context3.next =
|
|
374
|
+
_context3.next = 27;
|
|
351
375
|
break;
|
|
352
376
|
}
|
|
353
|
-
_context3.prev =
|
|
377
|
+
_context3.prev = 14;
|
|
354
378
|
(_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
|
|
355
379
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
380
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
381
|
+
obfuscatedDoc: obfuscatedDoc,
|
|
356
382
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
357
383
|
clientId: _this.clientId,
|
|
358
384
|
targetClientId: targetClientId,
|
|
@@ -361,35 +387,35 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
361
387
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
362
388
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
363
389
|
}
|
|
364
|
-
_context3.next =
|
|
390
|
+
_context3.next = 25;
|
|
365
391
|
break;
|
|
366
|
-
case
|
|
367
|
-
_context3.prev =
|
|
368
|
-
_context3.t0 = _context3["catch"](
|
|
392
|
+
case 19:
|
|
393
|
+
_context3.prev = 19;
|
|
394
|
+
_context3.t0 = _context3["catch"](14);
|
|
369
395
|
(_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
|
|
370
396
|
useReconcile = true;
|
|
371
|
-
_context3.next =
|
|
397
|
+
_context3.next = 25;
|
|
372
398
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
373
|
-
case
|
|
374
|
-
_context3.next =
|
|
399
|
+
case 25:
|
|
400
|
+
_context3.next = 33;
|
|
375
401
|
break;
|
|
376
|
-
case
|
|
402
|
+
case 27:
|
|
377
403
|
if (!(useReconcile && currentState)) {
|
|
378
|
-
_context3.next =
|
|
404
|
+
_context3.next = 32;
|
|
379
405
|
break;
|
|
380
406
|
}
|
|
381
|
-
_context3.next =
|
|
407
|
+
_context3.next = 30;
|
|
382
408
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
383
|
-
case
|
|
384
|
-
_context3.next =
|
|
409
|
+
case 30:
|
|
410
|
+
_context3.next = 33;
|
|
385
411
|
break;
|
|
386
|
-
case
|
|
412
|
+
case 32:
|
|
387
413
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
388
414
|
// we don't want to use reconcile for restore triggered by catchup client out of sync (when targetClientId is provided)
|
|
389
415
|
// as this results in all changes made while the client was out of sync being lost
|
|
390
416
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
391
417
|
}
|
|
392
|
-
case
|
|
418
|
+
case 33:
|
|
393
419
|
(_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
|
|
394
420
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
395
421
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -398,11 +424,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
398
424
|
targetClientId: targetClientId,
|
|
399
425
|
triggeredByCatchup: targetClientId ? true : false
|
|
400
426
|
});
|
|
401
|
-
_context3.next =
|
|
427
|
+
_context3.next = 41;
|
|
402
428
|
break;
|
|
403
|
-
case
|
|
404
|
-
_context3.prev =
|
|
405
|
-
_context3.t1 = _context3["catch"](
|
|
429
|
+
case 36:
|
|
430
|
+
_context3.prev = 36;
|
|
431
|
+
_context3.t1 = _context3["catch"](10);
|
|
406
432
|
(_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
|
|
407
433
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
408
434
|
useReconcile: useReconcile,
|
|
@@ -419,11 +445,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
419
445
|
code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
|
|
420
446
|
}
|
|
421
447
|
});
|
|
422
|
-
case
|
|
448
|
+
case 41:
|
|
423
449
|
case "end":
|
|
424
450
|
return _context3.stop();
|
|
425
451
|
}
|
|
426
|
-
}, _callee3, null, [[
|
|
452
|
+
}, _callee3, null, [[10, 36], [14, 19]]);
|
|
427
453
|
}));
|
|
428
454
|
return function (_x3) {
|
|
429
455
|
return _ref7.apply(this, arguments);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/collab-provider";
|
|
8
|
-
var version = exports.version = "10.
|
|
8
|
+
var version = exports.version = "10.6.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -6,7 +6,7 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
|
6
6
|
import throttle from 'lodash/throttle';
|
|
7
7
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
8
8
|
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
9
|
-
import { createLogger, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
9
|
+
import { createLogger, getDocAdfWithObfuscation, getObfuscatedSteps, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
10
10
|
import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
|
|
11
11
|
import { commitStepQueue } from '../provider/commit-step';
|
|
12
12
|
import { catchupv2 } from './catchupv2';
|
|
@@ -121,7 +121,8 @@ export class DocumentService {
|
|
|
121
121
|
});
|
|
122
122
|
const latency = new Date().getTime() - start;
|
|
123
123
|
(_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.SUCCESS, {
|
|
124
|
-
latency
|
|
124
|
+
latency,
|
|
125
|
+
version: this.getCurrentPmVersion()
|
|
125
126
|
});
|
|
126
127
|
} catch (error) {
|
|
127
128
|
var _this$analyticsHelper3;
|
|
@@ -276,6 +277,26 @@ export class DocumentService {
|
|
|
276
277
|
});
|
|
277
278
|
}
|
|
278
279
|
});
|
|
280
|
+
_defineProperty(this, "obfuscateStepsAndState", (unconfirmedSteps, currentState) => {
|
|
281
|
+
let obfuscatedSteps;
|
|
282
|
+
try {
|
|
283
|
+
obfuscatedSteps = unconfirmedSteps ? getObfuscatedSteps(unconfirmedSteps.map(pmStep => pmStep.toJSON())) : 'None';
|
|
284
|
+
} catch (error) {
|
|
285
|
+
// Note that we do not log this error immediately - this string will be logged later.
|
|
286
|
+
// This avoids double logging and keeps this function pure.
|
|
287
|
+
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
288
|
+
}
|
|
289
|
+
let obfuscatedDoc;
|
|
290
|
+
try {
|
|
291
|
+
obfuscatedDoc = getDocAdfWithObfuscation(currentState.content);
|
|
292
|
+
} catch (error) {
|
|
293
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
obfuscatedSteps,
|
|
297
|
+
obfuscatedDoc
|
|
298
|
+
};
|
|
299
|
+
});
|
|
279
300
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
280
301
|
_defineProperty(this, "onRestore", async ({
|
|
281
302
|
doc,
|
|
@@ -294,6 +315,10 @@ export class DocumentService {
|
|
|
294
315
|
const unconfirmedSteps = this.getUnconfirmedSteps();
|
|
295
316
|
const currentState = await this.getCurrentState();
|
|
296
317
|
let useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
318
|
+
const {
|
|
319
|
+
obfuscatedSteps,
|
|
320
|
+
obfuscatedDoc
|
|
321
|
+
} = this.obfuscateStepsAndState(unconfirmedSteps, currentState);
|
|
297
322
|
try {
|
|
298
323
|
var _this$analyticsHelper15;
|
|
299
324
|
// Reset the editor,
|
|
@@ -314,6 +339,8 @@ export class DocumentService {
|
|
|
314
339
|
var _this$analyticsHelper13;
|
|
315
340
|
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
|
|
316
341
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
342
|
+
obfuscatedSteps,
|
|
343
|
+
obfuscatedDoc,
|
|
317
344
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
318
345
|
clientId: this.clientId,
|
|
319
346
|
targetClientId,
|
|
@@ -12,7 +12,7 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
|
12
12
|
import throttle from 'lodash/throttle';
|
|
13
13
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
14
14
|
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
15
|
-
import { createLogger, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
15
|
+
import { createLogger, getDocAdfWithObfuscation, getObfuscatedSteps, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
16
16
|
import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
|
|
17
17
|
import { commitStepQueue } from '../provider/commit-step';
|
|
18
18
|
import { catchupv2 } from './catchupv2';
|
|
@@ -122,7 +122,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
122
122
|
_this.catchUpOutofSync = _context.sent;
|
|
123
123
|
latency = new Date().getTime() - start;
|
|
124
124
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.SUCCESS, {
|
|
125
|
-
latency: latency
|
|
125
|
+
latency: latency,
|
|
126
|
+
version: _this.getCurrentPmVersion()
|
|
126
127
|
});
|
|
127
128
|
_context.next = 20;
|
|
128
129
|
break;
|
|
@@ -300,10 +301,32 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
300
301
|
});
|
|
301
302
|
}
|
|
302
303
|
});
|
|
304
|
+
_defineProperty(this, "obfuscateStepsAndState", function (unconfirmedSteps, currentState) {
|
|
305
|
+
var obfuscatedSteps;
|
|
306
|
+
try {
|
|
307
|
+
obfuscatedSteps = unconfirmedSteps ? getObfuscatedSteps(unconfirmedSteps.map(function (pmStep) {
|
|
308
|
+
return pmStep.toJSON();
|
|
309
|
+
})) : 'None';
|
|
310
|
+
} catch (error) {
|
|
311
|
+
// Note that we do not log this error immediately - this string will be logged later.
|
|
312
|
+
// This avoids double logging and keeps this function pure.
|
|
313
|
+
obfuscatedSteps = 'Failed to obfuscate steps';
|
|
314
|
+
}
|
|
315
|
+
var obfuscatedDoc;
|
|
316
|
+
try {
|
|
317
|
+
obfuscatedDoc = getDocAdfWithObfuscation(currentState.content);
|
|
318
|
+
} catch (error) {
|
|
319
|
+
obfuscatedDoc = 'Failed to obfuscate doc';
|
|
320
|
+
}
|
|
321
|
+
return {
|
|
322
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
323
|
+
obfuscatedDoc: obfuscatedDoc
|
|
324
|
+
};
|
|
325
|
+
});
|
|
303
326
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
304
327
|
_defineProperty(this, "onRestore", /*#__PURE__*/function () {
|
|
305
328
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
|
|
306
|
-
var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$analyticsHelper15, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
|
|
329
|
+
var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper15, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
|
|
307
330
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
308
331
|
while (1) switch (_context3.prev = _context3.next) {
|
|
309
332
|
case 0:
|
|
@@ -325,7 +348,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
325
348
|
case 7:
|
|
326
349
|
currentState = _context3.sent;
|
|
327
350
|
useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
328
|
-
|
|
351
|
+
_this$obfuscateStepsA = _this.obfuscateStepsAndState(unconfirmedSteps, currentState), obfuscatedSteps = _this$obfuscateStepsA.obfuscatedSteps, obfuscatedDoc = _this$obfuscateStepsA.obfuscatedDoc;
|
|
352
|
+
_context3.prev = 10;
|
|
329
353
|
// Reset the editor,
|
|
330
354
|
// - Replace the document, keep in sync with the server
|
|
331
355
|
// - Replace the version number, so editor is in sync with NCS server and can commit new changes.
|
|
@@ -340,12 +364,14 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
340
364
|
});
|
|
341
365
|
_this.metadataService.updateMetadata(metadata);
|
|
342
366
|
if (!fg('restore_localstep_fallback_reconcile')) {
|
|
343
|
-
_context3.next =
|
|
367
|
+
_context3.next = 27;
|
|
344
368
|
break;
|
|
345
369
|
}
|
|
346
|
-
_context3.prev =
|
|
370
|
+
_context3.prev = 14;
|
|
347
371
|
(_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
|
|
348
372
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
373
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
374
|
+
obfuscatedDoc: obfuscatedDoc,
|
|
349
375
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
350
376
|
clientId: _this.clientId,
|
|
351
377
|
targetClientId: targetClientId,
|
|
@@ -354,35 +380,35 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
354
380
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
355
381
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
356
382
|
}
|
|
357
|
-
_context3.next =
|
|
383
|
+
_context3.next = 25;
|
|
358
384
|
break;
|
|
359
|
-
case
|
|
360
|
-
_context3.prev =
|
|
361
|
-
_context3.t0 = _context3["catch"](
|
|
385
|
+
case 19:
|
|
386
|
+
_context3.prev = 19;
|
|
387
|
+
_context3.t0 = _context3["catch"](14);
|
|
362
388
|
(_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
|
|
363
389
|
useReconcile = true;
|
|
364
|
-
_context3.next =
|
|
390
|
+
_context3.next = 25;
|
|
365
391
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
366
|
-
case
|
|
367
|
-
_context3.next =
|
|
392
|
+
case 25:
|
|
393
|
+
_context3.next = 33;
|
|
368
394
|
break;
|
|
369
|
-
case
|
|
395
|
+
case 27:
|
|
370
396
|
if (!(useReconcile && currentState)) {
|
|
371
|
-
_context3.next =
|
|
397
|
+
_context3.next = 32;
|
|
372
398
|
break;
|
|
373
399
|
}
|
|
374
|
-
_context3.next =
|
|
400
|
+
_context3.next = 30;
|
|
375
401
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
376
|
-
case
|
|
377
|
-
_context3.next =
|
|
402
|
+
case 30:
|
|
403
|
+
_context3.next = 33;
|
|
378
404
|
break;
|
|
379
|
-
case
|
|
405
|
+
case 32:
|
|
380
406
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
381
407
|
// we don't want to use reconcile for restore triggered by catchup client out of sync (when targetClientId is provided)
|
|
382
408
|
// as this results in all changes made while the client was out of sync being lost
|
|
383
409
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
384
410
|
}
|
|
385
|
-
case
|
|
411
|
+
case 33:
|
|
386
412
|
(_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
|
|
387
413
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
388
414
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -391,11 +417,11 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
391
417
|
targetClientId: targetClientId,
|
|
392
418
|
triggeredByCatchup: targetClientId ? true : false
|
|
393
419
|
});
|
|
394
|
-
_context3.next =
|
|
420
|
+
_context3.next = 41;
|
|
395
421
|
break;
|
|
396
|
-
case
|
|
397
|
-
_context3.prev =
|
|
398
|
-
_context3.t1 = _context3["catch"](
|
|
422
|
+
case 36:
|
|
423
|
+
_context3.prev = 36;
|
|
424
|
+
_context3.t1 = _context3["catch"](10);
|
|
399
425
|
(_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
|
|
400
426
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
401
427
|
useReconcile: useReconcile,
|
|
@@ -412,11 +438,11 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
412
438
|
code: INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
|
|
413
439
|
}
|
|
414
440
|
});
|
|
415
|
-
case
|
|
441
|
+
case 41:
|
|
416
442
|
case "end":
|
|
417
443
|
return _context3.stop();
|
|
418
444
|
}
|
|
419
|
-
}, _callee3, null, [[
|
|
445
|
+
}, _callee3, null, [[10, 36], [14, 19]]);
|
|
420
446
|
}));
|
|
421
447
|
return function (_x3) {
|
|
422
448
|
return _ref7.apply(this, arguments);
|
|
@@ -80,6 +80,34 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
80
80
|
* Called when we receive steps from the service
|
|
81
81
|
*/
|
|
82
82
|
onStepsAdded: (data: StepsPayload) => void;
|
|
83
|
+
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState: ResolvedEditorState) => {
|
|
84
|
+
obfuscatedSteps: string | {
|
|
85
|
+
stepType: {
|
|
86
|
+
type: string;
|
|
87
|
+
contentTypes: string | null;
|
|
88
|
+
};
|
|
89
|
+
stepContent: import("@atlaskit/adf-utils/types").ADFEntity[] | null;
|
|
90
|
+
stepPositions: {
|
|
91
|
+
pos?: number | undefined;
|
|
92
|
+
insert?: number | undefined;
|
|
93
|
+
gapFrom?: number | undefined;
|
|
94
|
+
gapTo?: number | undefined;
|
|
95
|
+
from?: number | undefined;
|
|
96
|
+
to?: number | undefined;
|
|
97
|
+
};
|
|
98
|
+
stepMetadata: {
|
|
99
|
+
source?: string | undefined;
|
|
100
|
+
stepId?: string | undefined;
|
|
101
|
+
prevStepId?: string | undefined;
|
|
102
|
+
rebased?: boolean | undefined;
|
|
103
|
+
traceId?: string | undefined;
|
|
104
|
+
reqId?: string | undefined;
|
|
105
|
+
schemaVersion?: string | undefined;
|
|
106
|
+
unconfirmedStepAfterRecovery?: boolean | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null;
|
|
110
|
+
};
|
|
83
111
|
onRestore: ({ doc, version, metadata, targetClientId }: CollabInitPayload) => Promise<void>;
|
|
84
112
|
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
85
113
|
getIsNamespaceLocked(): boolean;
|
|
@@ -80,6 +80,34 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
80
80
|
* Called when we receive steps from the service
|
|
81
81
|
*/
|
|
82
82
|
onStepsAdded: (data: StepsPayload) => void;
|
|
83
|
+
obfuscateStepsAndState: (unconfirmedSteps: readonly ProseMirrorStep[] | undefined, currentState: ResolvedEditorState) => {
|
|
84
|
+
obfuscatedSteps: string | {
|
|
85
|
+
stepType: {
|
|
86
|
+
type: string;
|
|
87
|
+
contentTypes: string | null;
|
|
88
|
+
};
|
|
89
|
+
stepContent: import("@atlaskit/adf-utils/types").ADFEntity[] | null;
|
|
90
|
+
stepPositions: {
|
|
91
|
+
pos?: number | undefined;
|
|
92
|
+
insert?: number | undefined;
|
|
93
|
+
gapFrom?: number | undefined;
|
|
94
|
+
gapTo?: number | undefined;
|
|
95
|
+
from?: number | undefined;
|
|
96
|
+
to?: number | undefined;
|
|
97
|
+
};
|
|
98
|
+
stepMetadata: {
|
|
99
|
+
source?: string | undefined;
|
|
100
|
+
stepId?: string | undefined;
|
|
101
|
+
prevStepId?: string | undefined;
|
|
102
|
+
rebased?: boolean | undefined;
|
|
103
|
+
traceId?: string | undefined;
|
|
104
|
+
reqId?: string | undefined;
|
|
105
|
+
schemaVersion?: string | undefined;
|
|
106
|
+
unconfirmedStepAfterRecovery?: boolean | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null;
|
|
110
|
+
};
|
|
83
111
|
onRestore: ({ doc, version, metadata, targetClientId }: CollabInitPayload) => Promise<void>;
|
|
84
112
|
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
85
113
|
getIsNamespaceLocked(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.1",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@atlaskit/adf-utils": "^19.18.0",
|
|
36
36
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
37
37
|
"@atlaskit/analytics-listeners": "^8.14.0",
|
|
38
|
-
"@atlaskit/editor-common": "^99.
|
|
39
|
-
"@atlaskit/editor-json-transformer": "^8.
|
|
40
|
-
"@atlaskit/editor-prosemirror": "
|
|
38
|
+
"@atlaskit/editor-common": "^99.14.0",
|
|
39
|
+
"@atlaskit/editor-json-transformer": "^8.23.0",
|
|
40
|
+
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^4.22.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.0.0",
|
|
43
|
-
"@atlaskit/prosemirror-collab": "^0.
|
|
43
|
+
"@atlaskit/prosemirror-collab": "^0.12.0",
|
|
44
44
|
"@atlaskit/react-ufo": "^2.14.0",
|
|
45
45
|
"@atlaskit/ufo": "^0.3.0",
|
|
46
46
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@atlaskit/adf-schema": "^
|
|
68
|
+
"@atlaskit/adf-schema": "^47.2.1",
|
|
69
69
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
70
70
|
"typescript": "~5.4.2"
|
|
71
71
|
},
|