@atlaskit/collab-provider 10.6.0 → 10.6.2
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 +14 -0
- package/dist/cjs/document/document-service.js +49 -24
- package/dist/cjs/helpers/const.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +27 -1
- package/dist/es2019/helpers/const.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +50 -25
- package/dist/esm/helpers/const.js +1 -1
- 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 +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 10.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#112186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112186)
|
|
14
|
+
[`9462d8ca2405a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9462d8ca2405a) -
|
|
15
|
+
Bump adf-schema to 47.2.1
|
|
16
|
+
|
|
3
17
|
## 10.6.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -308,10 +308,32 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
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
|
+
});
|
|
311
333
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
312
334
|
(0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
|
|
313
335
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
|
|
314
|
-
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;
|
|
315
337
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
316
338
|
while (1) switch (_context3.prev = _context3.next) {
|
|
317
339
|
case 0:
|
|
@@ -333,7 +355,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
333
355
|
case 7:
|
|
334
356
|
currentState = _context3.sent;
|
|
335
357
|
useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
336
|
-
|
|
358
|
+
_this$obfuscateStepsA = _this.obfuscateStepsAndState(unconfirmedSteps, currentState), obfuscatedSteps = _this$obfuscateStepsA.obfuscatedSteps, obfuscatedDoc = _this$obfuscateStepsA.obfuscatedDoc;
|
|
359
|
+
_context3.prev = 10;
|
|
337
360
|
// Reset the editor,
|
|
338
361
|
// - Replace the document, keep in sync with the server
|
|
339
362
|
// - Replace the version number, so editor is in sync with NCS server and can commit new changes.
|
|
@@ -348,12 +371,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
348
371
|
});
|
|
349
372
|
_this.metadataService.updateMetadata(metadata);
|
|
350
373
|
if (!(0, _platformFeatureFlags.fg)('restore_localstep_fallback_reconcile')) {
|
|
351
|
-
_context3.next =
|
|
374
|
+
_context3.next = 27;
|
|
352
375
|
break;
|
|
353
376
|
}
|
|
354
|
-
_context3.prev =
|
|
377
|
+
_context3.prev = 14;
|
|
355
378
|
(_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
|
|
356
379
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
380
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
381
|
+
obfuscatedDoc: obfuscatedDoc,
|
|
357
382
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
358
383
|
clientId: _this.clientId,
|
|
359
384
|
targetClientId: targetClientId,
|
|
@@ -362,35 +387,35 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
362
387
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
363
388
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
364
389
|
}
|
|
365
|
-
_context3.next =
|
|
390
|
+
_context3.next = 25;
|
|
366
391
|
break;
|
|
367
|
-
case
|
|
368
|
-
_context3.prev =
|
|
369
|
-
_context3.t0 = _context3["catch"](
|
|
392
|
+
case 19:
|
|
393
|
+
_context3.prev = 19;
|
|
394
|
+
_context3.t0 = _context3["catch"](14);
|
|
370
395
|
(_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
|
|
371
396
|
useReconcile = true;
|
|
372
|
-
_context3.next =
|
|
397
|
+
_context3.next = 25;
|
|
373
398
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
374
|
-
case
|
|
375
|
-
_context3.next =
|
|
399
|
+
case 25:
|
|
400
|
+
_context3.next = 33;
|
|
376
401
|
break;
|
|
377
|
-
case
|
|
402
|
+
case 27:
|
|
378
403
|
if (!(useReconcile && currentState)) {
|
|
379
|
-
_context3.next =
|
|
404
|
+
_context3.next = 32;
|
|
380
405
|
break;
|
|
381
406
|
}
|
|
382
|
-
_context3.next =
|
|
407
|
+
_context3.next = 30;
|
|
383
408
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
384
|
-
case
|
|
385
|
-
_context3.next =
|
|
409
|
+
case 30:
|
|
410
|
+
_context3.next = 33;
|
|
386
411
|
break;
|
|
387
|
-
case
|
|
412
|
+
case 32:
|
|
388
413
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
389
414
|
// we don't want to use reconcile for restore triggered by catchup client out of sync (when targetClientId is provided)
|
|
390
415
|
// as this results in all changes made while the client was out of sync being lost
|
|
391
416
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
392
417
|
}
|
|
393
|
-
case
|
|
418
|
+
case 33:
|
|
394
419
|
(_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
|
|
395
420
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
396
421
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -399,11 +424,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
399
424
|
targetClientId: targetClientId,
|
|
400
425
|
triggeredByCatchup: targetClientId ? true : false
|
|
401
426
|
});
|
|
402
|
-
_context3.next =
|
|
427
|
+
_context3.next = 41;
|
|
403
428
|
break;
|
|
404
|
-
case
|
|
405
|
-
_context3.prev =
|
|
406
|
-
_context3.t1 = _context3["catch"](
|
|
429
|
+
case 36:
|
|
430
|
+
_context3.prev = 36;
|
|
431
|
+
_context3.t1 = _context3["catch"](10);
|
|
407
432
|
(_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
|
|
408
433
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
409
434
|
useReconcile: useReconcile,
|
|
@@ -420,11 +445,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
420
445
|
code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
|
|
421
446
|
}
|
|
422
447
|
});
|
|
423
|
-
case
|
|
448
|
+
case 41:
|
|
424
449
|
case "end":
|
|
425
450
|
return _context3.stop();
|
|
426
451
|
}
|
|
427
|
-
}, _callee3, null, [[
|
|
452
|
+
}, _callee3, null, [[10, 36], [14, 19]]);
|
|
428
453
|
}));
|
|
429
454
|
return function (_x3) {
|
|
430
455
|
return _ref7.apply(this, arguments);
|
|
@@ -27,7 +27,7 @@ var EVENT_ACTION = exports.EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
27
27
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
28
28
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
29
29
|
return EVENT_ACTION;
|
|
30
|
-
}({});
|
|
30
|
+
}({});
|
|
31
31
|
var EVENT_STATUS = exports.EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
32
32
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
33
33
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -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.6.
|
|
8
|
+
var version = exports.version = "10.6.2";
|
|
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';
|
|
@@ -277,6 +277,26 @@ export class DocumentService {
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
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
|
+
});
|
|
280
300
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
281
301
|
_defineProperty(this, "onRestore", async ({
|
|
282
302
|
doc,
|
|
@@ -295,6 +315,10 @@ export class DocumentService {
|
|
|
295
315
|
const unconfirmedSteps = this.getUnconfirmedSteps();
|
|
296
316
|
const currentState = await this.getCurrentState();
|
|
297
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);
|
|
298
322
|
try {
|
|
299
323
|
var _this$analyticsHelper15;
|
|
300
324
|
// Reset the editor,
|
|
@@ -315,6 +339,8 @@ export class DocumentService {
|
|
|
315
339
|
var _this$analyticsHelper13;
|
|
316
340
|
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
|
|
317
341
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
342
|
+
obfuscatedSteps,
|
|
343
|
+
obfuscatedDoc,
|
|
318
344
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
319
345
|
clientId: this.clientId,
|
|
320
346
|
targetClientId,
|
|
@@ -21,7 +21,7 @@ export let EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
21
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
22
22
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
23
23
|
return EVENT_ACTION;
|
|
24
|
-
}({});
|
|
24
|
+
}({});
|
|
25
25
|
export let EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
26
26
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
27
27
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -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';
|
|
@@ -301,10 +301,32 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
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
|
+
});
|
|
304
326
|
// Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
305
327
|
_defineProperty(this, "onRestore", /*#__PURE__*/function () {
|
|
306
328
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
|
|
307
|
-
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;
|
|
308
330
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
309
331
|
while (1) switch (_context3.prev = _context3.next) {
|
|
310
332
|
case 0:
|
|
@@ -326,7 +348,8 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
326
348
|
case 7:
|
|
327
349
|
currentState = _context3.sent;
|
|
328
350
|
useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
329
|
-
|
|
351
|
+
_this$obfuscateStepsA = _this.obfuscateStepsAndState(unconfirmedSteps, currentState), obfuscatedSteps = _this$obfuscateStepsA.obfuscatedSteps, obfuscatedDoc = _this$obfuscateStepsA.obfuscatedDoc;
|
|
352
|
+
_context3.prev = 10;
|
|
330
353
|
// Reset the editor,
|
|
331
354
|
// - Replace the document, keep in sync with the server
|
|
332
355
|
// - Replace the version number, so editor is in sync with NCS server and can commit new changes.
|
|
@@ -341,12 +364,14 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
341
364
|
});
|
|
342
365
|
_this.metadataService.updateMetadata(metadata);
|
|
343
366
|
if (!fg('restore_localstep_fallback_reconcile')) {
|
|
344
|
-
_context3.next =
|
|
367
|
+
_context3.next = 27;
|
|
345
368
|
break;
|
|
346
369
|
}
|
|
347
|
-
_context3.prev =
|
|
370
|
+
_context3.prev = 14;
|
|
348
371
|
(_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
|
|
349
372
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
373
|
+
obfuscatedSteps: obfuscatedSteps,
|
|
374
|
+
obfuscatedDoc: obfuscatedDoc,
|
|
350
375
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
351
376
|
clientId: _this.clientId,
|
|
352
377
|
targetClientId: targetClientId,
|
|
@@ -355,35 +380,35 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
355
380
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
356
381
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
357
382
|
}
|
|
358
|
-
_context3.next =
|
|
383
|
+
_context3.next = 25;
|
|
359
384
|
break;
|
|
360
|
-
case
|
|
361
|
-
_context3.prev =
|
|
362
|
-
_context3.t0 = _context3["catch"](
|
|
385
|
+
case 19:
|
|
386
|
+
_context3.prev = 19;
|
|
387
|
+
_context3.t0 = _context3["catch"](14);
|
|
363
388
|
(_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
|
|
364
389
|
useReconcile = true;
|
|
365
|
-
_context3.next =
|
|
390
|
+
_context3.next = 25;
|
|
366
391
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
367
|
-
case
|
|
368
|
-
_context3.next =
|
|
392
|
+
case 25:
|
|
393
|
+
_context3.next = 33;
|
|
369
394
|
break;
|
|
370
|
-
case
|
|
395
|
+
case 27:
|
|
371
396
|
if (!(useReconcile && currentState)) {
|
|
372
|
-
_context3.next =
|
|
397
|
+
_context3.next = 32;
|
|
373
398
|
break;
|
|
374
399
|
}
|
|
375
|
-
_context3.next =
|
|
400
|
+
_context3.next = 30;
|
|
376
401
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
377
|
-
case
|
|
378
|
-
_context3.next =
|
|
402
|
+
case 30:
|
|
403
|
+
_context3.next = 33;
|
|
379
404
|
break;
|
|
380
|
-
case
|
|
405
|
+
case 32:
|
|
381
406
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
382
407
|
// we don't want to use reconcile for restore triggered by catchup client out of sync (when targetClientId is provided)
|
|
383
408
|
// as this results in all changes made while the client was out of sync being lost
|
|
384
409
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
385
410
|
}
|
|
386
|
-
case
|
|
411
|
+
case 33:
|
|
387
412
|
(_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
|
|
388
413
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
389
414
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -392,11 +417,11 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
392
417
|
targetClientId: targetClientId,
|
|
393
418
|
triggeredByCatchup: targetClientId ? true : false
|
|
394
419
|
});
|
|
395
|
-
_context3.next =
|
|
420
|
+
_context3.next = 41;
|
|
396
421
|
break;
|
|
397
|
-
case
|
|
398
|
-
_context3.prev =
|
|
399
|
-
_context3.t1 = _context3["catch"](
|
|
422
|
+
case 36:
|
|
423
|
+
_context3.prev = 36;
|
|
424
|
+
_context3.t1 = _context3["catch"](10);
|
|
400
425
|
(_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
|
|
401
426
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
402
427
|
useReconcile: useReconcile,
|
|
@@ -413,11 +438,11 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
413
438
|
code: INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
|
|
414
439
|
}
|
|
415
440
|
});
|
|
416
|
-
case
|
|
441
|
+
case 41:
|
|
417
442
|
case "end":
|
|
418
443
|
return _context3.stop();
|
|
419
444
|
}
|
|
420
|
-
}, _callee3, null, [[
|
|
445
|
+
}, _callee3, null, [[10, 36], [14, 19]]);
|
|
421
446
|
}));
|
|
422
447
|
return function (_x3) {
|
|
423
448
|
return _ref7.apply(this, arguments);
|
|
@@ -21,7 +21,7 @@ export var EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
21
21
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
22
22
|
EVENT_ACTION["OUT_OF_SYNC"] = "outOfSync";
|
|
23
23
|
return EVENT_ACTION;
|
|
24
|
-
}({});
|
|
24
|
+
}({});
|
|
25
25
|
export var EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
26
26
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
27
27
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -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.6.
|
|
3
|
+
"version": "10.6.2",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-utils": "^19.18.0",
|
|
36
36
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
37
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
38
|
-
"@atlaskit/editor-common": "^99.
|
|
37
|
+
"@atlaskit/analytics-listeners": "^8.15.0",
|
|
38
|
+
"@atlaskit/editor-common": "^99.17.0",
|
|
39
39
|
"@atlaskit/editor-json-transformer": "^8.23.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
|
-
"@atlaskit/feature-gate-js-client": "^4.
|
|
42
|
-
"@atlaskit/platform-feature-flags": "^1.
|
|
43
|
-
"@atlaskit/prosemirror-collab": "^0.
|
|
44
|
-
"@atlaskit/react-ufo": "^2.
|
|
41
|
+
"@atlaskit/feature-gate-js-client": "^4.25.0",
|
|
42
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
|
+
"@atlaskit/prosemirror-collab": "^0.13.0",
|
|
44
|
+
"@atlaskit/react-ufo": "^2.15.0",
|
|
45
45
|
"@atlaskit/ufo": "^0.3.0",
|
|
46
46
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
47
47
|
"@babel/runtime": "^7.0.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
|
},
|