@atlaskit/collab-provider 10.4.0 → 10.4.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 +8 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +6 -0
- package/dist/cjs/analytics/analytics-helper.js +0 -2
- package/dist/cjs/api/api.js +26 -14
- package/dist/cjs/channel.js +0 -2
- package/dist/cjs/document/catchupv2.js +1 -4
- package/dist/cjs/document/document-service.js +33 -32
- package/dist/cjs/helpers/utils.js +80 -1
- package/dist/cjs/participants/participants-service.js +0 -2
- package/dist/cjs/provider/commit-step.js +12 -1
- package/dist/cjs/provider/index.js +69 -33
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/analytics/analytics-helper.js +0 -2
- package/dist/es2019/api/api.js +13 -1
- package/dist/es2019/channel.js +0 -2
- package/dist/es2019/document/catchupv2.js +1 -4
- package/dist/es2019/document/document-service.js +6 -5
- package/dist/es2019/helpers/utils.js +30 -1
- package/dist/es2019/participants/participants-service.js +0 -2
- package/dist/es2019/provider/commit-step.js +13 -1
- package/dist/es2019/provider/index.js +40 -17
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/analytics/analytics-helper.js +0 -2
- package/dist/esm/api/api.js +26 -14
- package/dist/esm/channel.js +0 -2
- package/dist/esm/document/catchupv2.js +1 -4
- package/dist/esm/document/document-service.js +33 -32
- package/dist/esm/helpers/utils.js +78 -1
- package/dist/esm/participants/participants-service.js +0 -2
- package/dist/esm/provider/commit-step.js +12 -1
- package/dist/esm/provider/index.js +71 -35
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +1 -0
- package/dist/types/errors/custom-errors.d.ts +1 -1
- package/dist/types/helpers/utils.d.ts +9 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/provider/commit-step.d.ts +2 -1
- package/dist/types-ts4.5/document/document-service.d.ts +1 -0
- package/dist/types-ts4.5/errors/custom-errors.d.ts +1 -1
- package/dist/types-ts4.5/helpers/utils.d.ts +9 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/provider/commit-step.d.ts +2 -1
- package/package.json +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#104569](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104569)
|
|
8
|
+
[`b79a89c03faf9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b79a89c03faf9) -
|
|
9
|
+
log obfuscated steps for transactions in view only
|
|
10
|
+
|
|
3
11
|
## 10.4.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"../src/**/test.*"
|
|
18
18
|
],
|
|
19
19
|
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../adf-utils/afm-jira/tsconfig.json"
|
|
22
|
+
},
|
|
20
23
|
{
|
|
21
24
|
"path": "../../../analytics/analytics-gas-types/afm-jira/tsconfig.json"
|
|
22
25
|
},
|
|
@@ -38,6 +41,9 @@
|
|
|
38
41
|
{
|
|
39
42
|
"path": "../../prosemirror-collab/afm-jira/tsconfig.json"
|
|
40
43
|
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../../react-ufo/atlaskit/afm-jira/tsconfig.json"
|
|
46
|
+
},
|
|
41
47
|
{
|
|
42
48
|
"path": "../../../data/ufo-external/afm-jira/tsconfig.json"
|
|
43
49
|
},
|
|
@@ -71,8 +71,6 @@ var triggerAnalyticsEvent = function triggerAnalyticsEvent(analyticsEvent, analy
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
var AnalyticsHelper = exports.default = /*#__PURE__*/function () {
|
|
74
|
-
// Ignored via go/ees005
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
76
74
|
function AnalyticsHelper(documentAri, subProduct, analyticsClient, getAnalyticsClient) {
|
|
77
75
|
(0, _classCallCheck2.default)(this, AnalyticsHelper);
|
|
78
76
|
this.documentAri = documentAri;
|
package/dist/cjs/api/api.js
CHANGED
|
@@ -15,6 +15,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
15
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
16
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
17
17
|
var _utils = require("../helpers/utils");
|
|
18
|
+
var _experienceTraceIdContext = require("@atlaskit/react-ufo/experience-trace-id-context");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
|
+
var _featureFlagsAccessed = require("@atlaskit/react-ufo/feature-flags-accessed");
|
|
18
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -46,7 +49,7 @@ var Api = exports.Api = /*#__PURE__*/function () {
|
|
|
46
49
|
(0, _classCallCheck2.default)(this, Api);
|
|
47
50
|
(0, _defineProperty2.default)(this, "submitComment", /*#__PURE__*/function () {
|
|
48
51
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(steps, version) {
|
|
49
|
-
var reqBody, url, fetchOptions;
|
|
52
|
+
var reqBody, url, tracingHeaderEnabled, tracingHeaders, fetchOptions;
|
|
50
53
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
54
|
while (1) switch (_context.prev = _context.next) {
|
|
52
55
|
case 0:
|
|
@@ -57,25 +60,33 @@ var Api = exports.Api = /*#__PURE__*/function () {
|
|
|
57
60
|
});
|
|
58
61
|
url = "".concat(_this2.config.url, "/document/").concat(encodeURIComponent(_this2.config.documentAri), "/comment");
|
|
59
62
|
logger("Request url: ", url);
|
|
63
|
+
|
|
64
|
+
//Get tracing headers from UFO
|
|
65
|
+
tracingHeaderEnabled = (0, _platformFeatureFlags.fg)('platform_collab_provider_tracingheaders');
|
|
66
|
+
(0, _featureFlagsAccessed.addFeatureFlagAccessed)('platform_collab_provider_tracingheaders', tracingHeaderEnabled);
|
|
67
|
+
tracingHeaders = {};
|
|
68
|
+
if (tracingHeaderEnabled) {
|
|
69
|
+
tracingHeaders = (0, _experienceTraceIdContext.getActiveTraceHttpRequestHeaders)(url);
|
|
70
|
+
}
|
|
60
71
|
_context.t0 = _objectSpread;
|
|
61
72
|
_context.t1 = _objectSpread;
|
|
62
73
|
_context.t2 = {};
|
|
63
74
|
if (!_this2.config.permissionTokenRefresh) {
|
|
64
|
-
_context.next =
|
|
75
|
+
_context.next = 17;
|
|
65
76
|
break;
|
|
66
77
|
}
|
|
67
|
-
_context.next =
|
|
78
|
+
_context.next = 13;
|
|
68
79
|
return _this2.channel.getChannelToken();
|
|
69
|
-
case
|
|
80
|
+
case 13:
|
|
70
81
|
_context.t4 = _context.sent;
|
|
71
82
|
_context.t3 = {
|
|
72
83
|
'x-token': _context.t4
|
|
73
84
|
};
|
|
74
|
-
_context.next =
|
|
85
|
+
_context.next = 18;
|
|
75
86
|
break;
|
|
76
|
-
case
|
|
87
|
+
case 17:
|
|
77
88
|
_context.t3 = {};
|
|
78
|
-
case
|
|
89
|
+
case 18:
|
|
79
90
|
_context.t5 = _context.t3;
|
|
80
91
|
_context.t6 = (0, _context.t1)(_context.t2, _context.t5);
|
|
81
92
|
_context.t7 = {};
|
|
@@ -84,19 +95,20 @@ var Api = exports.Api = /*#__PURE__*/function () {
|
|
|
84
95
|
'x-subproduct': (0, _utils.getSubProduct)(_this2.config.productInfo),
|
|
85
96
|
'Content-Type': 'application/json'
|
|
86
97
|
};
|
|
87
|
-
_context.t9 =
|
|
88
|
-
_context.t10 =
|
|
98
|
+
_context.t9 = tracingHeaders;
|
|
99
|
+
_context.t10 = (0, _context.t0)(_context.t6, _context.t7, _context.t8, _context.t9);
|
|
100
|
+
_context.t11 = reqBody;
|
|
89
101
|
fetchOptions = {
|
|
90
102
|
credentials: 'include',
|
|
91
|
-
headers: _context.
|
|
103
|
+
headers: _context.t10,
|
|
92
104
|
method: 'POST',
|
|
93
|
-
body: _context.
|
|
105
|
+
body: _context.t11
|
|
94
106
|
};
|
|
95
|
-
_context.next =
|
|
107
|
+
_context.next = 28;
|
|
96
108
|
return fetch(url, fetchOptions);
|
|
97
|
-
case
|
|
109
|
+
case 28:
|
|
98
110
|
return _context.abrupt("return", _context.sent);
|
|
99
|
-
case
|
|
111
|
+
case 29:
|
|
100
112
|
case "end":
|
|
101
113
|
return _context.stop();
|
|
102
114
|
}
|
package/dist/cjs/channel.js
CHANGED
|
@@ -235,8 +235,6 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
235
235
|
_this.emit('steps:added', data);
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
|
-
// Ignored via go/ees005
|
|
239
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
240
238
|
(0, _defineProperty2.default)(_this, "fetchCatchupv2", /*#__PURE__*/function () {
|
|
241
239
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(fromVersion, clientId, catchUpOutofSync, reason) {
|
|
242
240
|
var _yield$utils$requestS, steps, metadata, errorNotFound, errorCatchupv2;
|
|
@@ -96,10 +96,7 @@ var logObfuscatedSteps = function logObfuscatedSteps(steps, opt) {
|
|
|
96
96
|
* @param clientId The ID of the currently connected session (one user can have multiple if theu have multiple tabs open)
|
|
97
97
|
* @returns True if we're out of sync, false if not.
|
|
98
98
|
*/
|
|
99
|
-
var isOutOfSync = exports.isOutOfSync = function isOutOfSync(fromVersion, currentVersion, steps, clientId
|
|
100
|
-
// Ignored via go/ees005
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
102
|
-
) {
|
|
99
|
+
var isOutOfSync = exports.isOutOfSync = function isOutOfSync(fromVersion, currentVersion, steps, clientId) {
|
|
103
100
|
return (
|
|
104
101
|
// If version number hasn't increased, and steps are not from our client, we're out of sync
|
|
105
102
|
Boolean(fromVersion >= currentVersion && steps.some(function (step) {
|
|
@@ -47,8 +47,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
47
47
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
48
48
|
* @param getConnected - if the channel is currently connected
|
|
49
49
|
*/
|
|
50
|
-
// Ignored via go/ees005
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
52
50
|
function DocumentService(participantsService, analyticsHelper, fetchCatchupv2, fetchReconcile,
|
|
53
51
|
// Ignored via go/ees005
|
|
54
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -64,6 +62,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
64
62
|
(0, _defineProperty2.default)(this, "stepRejectCounter", 0);
|
|
65
63
|
(0, _defineProperty2.default)(this, "aggressiveCatchup", false);
|
|
66
64
|
(0, _defineProperty2.default)(this, "catchUpOutofSync", false);
|
|
65
|
+
(0, _defineProperty2.default)(this, "hasRecovered", false);
|
|
67
66
|
/**
|
|
68
67
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
69
68
|
* @param reason - optional reason to attach.
|
|
@@ -315,21 +314,24 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
315
314
|
while (1) switch (_context3.prev = _context3.next) {
|
|
316
315
|
case 0:
|
|
317
316
|
doc = _ref6.doc, version = _ref6.version, metadata = _ref6.metadata, targetClientId = _ref6.targetClientId;
|
|
317
|
+
if (!targetClientId) {
|
|
318
|
+
_this.hasRecovered = true;
|
|
319
|
+
}
|
|
318
320
|
if (!(targetClientId && _this.clientId !== targetClientId)) {
|
|
319
|
-
_context3.next =
|
|
321
|
+
_context3.next = 4;
|
|
320
322
|
break;
|
|
321
323
|
}
|
|
322
324
|
return _context3.abrupt("return");
|
|
323
|
-
case
|
|
325
|
+
case 4:
|
|
324
326
|
// We preserve these as they will be lost apon this.updateDocument. This is because we are using document recovery.
|
|
325
327
|
// We can then reconcile the document with the preserved state.
|
|
326
328
|
unconfirmedSteps = _this.getUnconfirmedSteps();
|
|
327
|
-
_context3.next =
|
|
329
|
+
_context3.next = 7;
|
|
328
330
|
return _this.getCurrentState();
|
|
329
|
-
case
|
|
331
|
+
case 7:
|
|
330
332
|
currentState = _context3.sent;
|
|
331
333
|
useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
|
|
332
|
-
_context3.prev =
|
|
334
|
+
_context3.prev = 9;
|
|
333
335
|
// Reset the editor,
|
|
334
336
|
// - Replace the document, keep in sync with the server
|
|
335
337
|
// - Replace the version number, so editor is in sync with NCS server and can commit new changes.
|
|
@@ -344,10 +346,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
344
346
|
});
|
|
345
347
|
_this.metadataService.updateMetadata(metadata);
|
|
346
348
|
if (!(0, _platformFeatureFlags.fg)('restore_localstep_fallback_reconcile')) {
|
|
347
|
-
_context3.next =
|
|
349
|
+
_context3.next = 26;
|
|
348
350
|
break;
|
|
349
351
|
}
|
|
350
|
-
_context3.prev =
|
|
352
|
+
_context3.prev = 13;
|
|
351
353
|
(_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
|
|
352
354
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
353
355
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -358,35 +360,35 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
358
360
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
359
361
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
360
362
|
}
|
|
361
|
-
_context3.next =
|
|
363
|
+
_context3.next = 24;
|
|
362
364
|
break;
|
|
363
|
-
case
|
|
364
|
-
_context3.prev =
|
|
365
|
-
_context3.t0 = _context3["catch"](
|
|
365
|
+
case 18:
|
|
366
|
+
_context3.prev = 18;
|
|
367
|
+
_context3.t0 = _context3["catch"](13);
|
|
366
368
|
(_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
|
|
367
369
|
useReconcile = true;
|
|
368
|
-
_context3.next =
|
|
370
|
+
_context3.next = 24;
|
|
369
371
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
370
|
-
case
|
|
371
|
-
_context3.next =
|
|
372
|
+
case 24:
|
|
373
|
+
_context3.next = 32;
|
|
372
374
|
break;
|
|
373
|
-
case
|
|
375
|
+
case 26:
|
|
374
376
|
if (!(useReconcile && currentState)) {
|
|
375
|
-
_context3.next =
|
|
377
|
+
_context3.next = 31;
|
|
376
378
|
break;
|
|
377
379
|
}
|
|
378
|
-
_context3.next =
|
|
380
|
+
_context3.next = 29;
|
|
379
381
|
return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
|
|
380
|
-
case
|
|
381
|
-
_context3.next =
|
|
382
|
+
case 29:
|
|
383
|
+
_context3.next = 32;
|
|
382
384
|
break;
|
|
383
|
-
case
|
|
385
|
+
case 31:
|
|
384
386
|
if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
|
|
385
387
|
// we don't want to use reconcile for restore triggered by catchup client out of sync (when targetClientId is provided)
|
|
386
388
|
// as this results in all changes made while the client was out of sync being lost
|
|
387
389
|
_this.applyLocalSteps(unconfirmedSteps);
|
|
388
390
|
}
|
|
389
|
-
case
|
|
391
|
+
case 32:
|
|
390
392
|
(_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
|
|
391
393
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
392
394
|
hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
|
|
@@ -395,11 +397,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
395
397
|
targetClientId: targetClientId,
|
|
396
398
|
triggeredByCatchup: targetClientId ? true : false
|
|
397
399
|
});
|
|
398
|
-
_context3.next =
|
|
400
|
+
_context3.next = 40;
|
|
399
401
|
break;
|
|
400
|
-
case
|
|
401
|
-
_context3.prev =
|
|
402
|
-
_context3.t1 = _context3["catch"](
|
|
402
|
+
case 35:
|
|
403
|
+
_context3.prev = 35;
|
|
404
|
+
_context3.t1 = _context3["catch"](9);
|
|
403
405
|
(_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
|
|
404
406
|
numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
|
|
405
407
|
useReconcile: useReconcile,
|
|
@@ -416,11 +418,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
416
418
|
code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
|
|
417
419
|
}
|
|
418
420
|
});
|
|
419
|
-
case
|
|
421
|
+
case 40:
|
|
420
422
|
case "end":
|
|
421
423
|
return _context3.stop();
|
|
422
424
|
}
|
|
423
|
-
}, _callee3, null, [[
|
|
425
|
+
}, _callee3, null, [[9, 35], [13, 18]]);
|
|
424
426
|
}));
|
|
425
427
|
return function (_x3) {
|
|
426
428
|
return _ref7.apply(this, arguments);
|
|
@@ -831,8 +833,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
831
833
|
* Send steps from transaction to other participants
|
|
832
834
|
* It needs the superfluous arguments because we keep the interface of the send API the same as the Synchrony plugin
|
|
833
835
|
*/
|
|
834
|
-
// Ignored via go/ees005
|
|
835
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
836
836
|
function send(_tr, _oldState, newState, sendAnalyticsEvent) {
|
|
837
837
|
var unconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
|
|
838
838
|
var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
@@ -890,7 +890,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
890
890
|
onErrorHandled: this.onErrorHandled,
|
|
891
891
|
analyticsHelper: this.analyticsHelper,
|
|
892
892
|
emit: this.providerEmitCallback,
|
|
893
|
-
__livePage: this.options.__livePage
|
|
893
|
+
__livePage: this.options.__livePage,
|
|
894
|
+
hasRecovered: this.hasRecovered
|
|
894
895
|
});
|
|
895
896
|
}
|
|
896
897
|
}]);
|
|
@@ -5,9 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.isAIProviderID = exports.getSubProduct = exports.getStepsAdfWithObfuscation = exports.getStepUGCFreeDetails = exports.getStepTypes = exports.getStepPositions = exports.getProduct = exports.getObfuscatedSteps = exports.getDocAdfWithObfuscation = exports.createLogger = void 0;
|
|
8
|
+
exports.logObfuscatedSteps = logObfuscatedSteps;
|
|
8
9
|
exports.sleep = sleep;
|
|
10
|
+
exports.toObfuscatedSteps = toObfuscatedSteps;
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
14
|
var _scrub = require("@atlaskit/adf-utils/scrub");
|
|
15
|
+
var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
|
|
16
|
+
var _customErrors = require("../errors/custom-errors");
|
|
11
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
19
|
var createLogger = exports.createLogger = function createLogger(prefix) {
|
|
@@ -199,4 +205,77 @@ var stepToAdf = function stepToAdf(step) {
|
|
|
199
205
|
});
|
|
200
206
|
}
|
|
201
207
|
return [];
|
|
202
|
-
};
|
|
208
|
+
};
|
|
209
|
+
function logObfuscatedSteps(_x, _x2) {
|
|
210
|
+
return _logObfuscatedSteps.apply(this, arguments);
|
|
211
|
+
}
|
|
212
|
+
function _logObfuscatedSteps() {
|
|
213
|
+
_logObfuscatedSteps = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(oldState, newState) {
|
|
214
|
+
var _states$new, _states$old, stepsFromOldState, stepsFromNewState, states;
|
|
215
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
216
|
+
while (1) switch (_context.prev = _context.next) {
|
|
217
|
+
case 0:
|
|
218
|
+
_context.prev = 0;
|
|
219
|
+
stepsFromOldState = '', stepsFromNewState = '';
|
|
220
|
+
states = {
|
|
221
|
+
old: oldState ? (0, _prosemirrorCollab.sendableSteps)(oldState) : null,
|
|
222
|
+
new: (0, _prosemirrorCollab.sendableSteps)(newState)
|
|
223
|
+
};
|
|
224
|
+
if (!((_states$new = states.new) !== null && _states$new !== void 0 && _states$new.steps)) {
|
|
225
|
+
_context.next = 7;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
_context.next = 6;
|
|
229
|
+
return toObfuscatedSteps(states.new.steps);
|
|
230
|
+
case 6:
|
|
231
|
+
stepsFromNewState = _context.sent;
|
|
232
|
+
case 7:
|
|
233
|
+
if (!((_states$old = states.old) !== null && _states$old !== void 0 && _states$old.steps)) {
|
|
234
|
+
_context.next = 11;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
_context.next = 10;
|
|
238
|
+
return toObfuscatedSteps(states.old.steps);
|
|
239
|
+
case 10:
|
|
240
|
+
stepsFromOldState = _context.sent;
|
|
241
|
+
case 11:
|
|
242
|
+
return _context.abrupt("return", {
|
|
243
|
+
stepsFromOldState: stepsFromOldState,
|
|
244
|
+
stepsFromNewState: stepsFromNewState
|
|
245
|
+
});
|
|
246
|
+
case 14:
|
|
247
|
+
_context.prev = 14;
|
|
248
|
+
_context.t0 = _context["catch"](0);
|
|
249
|
+
return _context.abrupt("return", new _customErrors.CustomError('Failed to obfuscate steps', _context.t0));
|
|
250
|
+
case 17:
|
|
251
|
+
case "end":
|
|
252
|
+
return _context.stop();
|
|
253
|
+
}
|
|
254
|
+
}, _callee, null, [[0, 14]]);
|
|
255
|
+
}));
|
|
256
|
+
return _logObfuscatedSteps.apply(this, arguments);
|
|
257
|
+
}
|
|
258
|
+
function toObfuscatedSteps(_x3) {
|
|
259
|
+
return _toObfuscatedSteps.apply(this, arguments);
|
|
260
|
+
}
|
|
261
|
+
function _toObfuscatedSteps() {
|
|
262
|
+
_toObfuscatedSteps = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(steps) {
|
|
263
|
+
var _steps;
|
|
264
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
265
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
266
|
+
case 0:
|
|
267
|
+
_context2.next = 2;
|
|
268
|
+
return Promise.resolve(steps.slice().map(function (s) {
|
|
269
|
+
return s.toJSON();
|
|
270
|
+
}));
|
|
271
|
+
case 2:
|
|
272
|
+
_steps = _context2.sent;
|
|
273
|
+
return _context2.abrupt("return", JSON.stringify(getObfuscatedSteps(_steps)));
|
|
274
|
+
case 4:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context2.stop();
|
|
277
|
+
}
|
|
278
|
+
}, _callee2);
|
|
279
|
+
}));
|
|
280
|
+
return _toObfuscatedSteps.apply(this, arguments);
|
|
281
|
+
}
|
|
@@ -31,8 +31,6 @@ var SEND_PRESENCE_INTERVAL = 150 * 1000; // 150 seconds
|
|
|
31
31
|
* @param sendPresenceJoined Callback to Channel class
|
|
32
32
|
*/
|
|
33
33
|
var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function () {
|
|
34
|
-
// Ignored via go/ees005
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
36
34
|
function ParticipantsService(analyticsHelper) {
|
|
37
35
|
var _this = this;
|
|
38
36
|
var participantsState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _participantsState.ParticipantsState();
|
|
@@ -27,7 +27,8 @@ var commitStepQueue = exports.commitStepQueue = function commitStepQueue(_ref) {
|
|
|
27
27
|
onErrorHandled = _ref.onErrorHandled,
|
|
28
28
|
analyticsHelper = _ref.analyticsHelper,
|
|
29
29
|
emit = _ref.emit,
|
|
30
|
-
__livePage = _ref.__livePage
|
|
30
|
+
__livePage = _ref.__livePage,
|
|
31
|
+
hasRecovered = _ref.hasRecovered;
|
|
31
32
|
if (!readyToCommit) {
|
|
32
33
|
logger('Not ready to commit, skip');
|
|
33
34
|
return;
|
|
@@ -69,6 +70,16 @@ var commitStepQueue = exports.commitStepQueue = function commitStepQueue(_ref) {
|
|
|
69
70
|
return step;
|
|
70
71
|
});
|
|
71
72
|
}
|
|
73
|
+
|
|
74
|
+
// tag unconfirmed steps sent after page has been recovered during client's editing session
|
|
75
|
+
if (hasRecovered && (0, _platformFeatureFlags.fg)('tag_unconfirmed_steps_after_recovery')) {
|
|
76
|
+
stepsWithClientAndUserId = stepsWithClientAndUserId.map(function (step) {
|
|
77
|
+
step.metadata = _objectSpread(_objectSpread({}, step.metadata), {}, {
|
|
78
|
+
unconfirmedStepAfterRecovery: true
|
|
79
|
+
});
|
|
80
|
+
return step;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
72
83
|
var start = new Date().getTime();
|
|
73
84
|
emit('commit-status', {
|
|
74
85
|
status: 'attempt',
|
|
@@ -15,6 +15,7 @@ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
|
15
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _uuid = require("uuid");
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _emitter = require("../emitter");
|
|
19
20
|
var _channel = require("../channel");
|
|
20
21
|
var _utils = require("../helpers/utils");
|
|
@@ -162,7 +163,29 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
162
163
|
_this.emit('permission', permit);
|
|
163
164
|
}).on('steps:added', _this.documentService.onStepsAdded).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
|
|
164
165
|
return _this.participantsService.onParticipantTelepointer(payload, _this.sessionId);
|
|
165
|
-
}).on('participant:activity-join', _this.participantsService.onParticipantActivityJoin).on('participant:activity-ack', _this.participantsService.onParticipantActivityAck).on('presence:joined', _this.participantsService.onPresenceJoined).on('presence', _this.participantsService.onPresence).on('participant:left', _this.participantsService.onParticipantLeft).on('participant:updated', _this.participantsService.onParticipantUpdated).on('disconnect', _this.onDisconnected.bind(_this)).on('error', _this.onErrorHandled).on('status',
|
|
166
|
+
}).on('participant:activity-join', _this.participantsService.onParticipantActivityJoin).on('participant:activity-ack', _this.participantsService.onParticipantActivityAck).on('presence:joined', _this.participantsService.onPresenceJoined).on('presence', _this.participantsService.onPresence).on('participant:left', _this.participantsService.onParticipantLeft).on('participant:updated', _this.participantsService.onParticipantUpdated).on('disconnect', _this.onDisconnected.bind(_this)).on('error', _this.onErrorHandled).on('status', /*#__PURE__*/function () {
|
|
167
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(status) {
|
|
168
|
+
var isLocked;
|
|
169
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
170
|
+
while (1) switch (_context.prev = _context.next) {
|
|
171
|
+
case 0:
|
|
172
|
+
_context.next = 2;
|
|
173
|
+
return _this.namespaceService.onNamespaceStatusChanged(status);
|
|
174
|
+
case 2:
|
|
175
|
+
isLocked = _this.namespaceService.getIsNamespaceLocked();
|
|
176
|
+
_this.emit('namespace-lock:check', {
|
|
177
|
+
isLocked: isLocked
|
|
178
|
+
});
|
|
179
|
+
case 4:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee);
|
|
184
|
+
}));
|
|
185
|
+
return function (_x) {
|
|
186
|
+
return _ref4.apply(this, arguments);
|
|
187
|
+
};
|
|
188
|
+
}()).connect(shouldSkipDocumentInit);
|
|
166
189
|
});
|
|
167
190
|
(0, _defineProperty2.default)(_this, "setUserId", function (id) {
|
|
168
191
|
_this.userId = id;
|
|
@@ -209,8 +232,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
209
232
|
return _this.aiProviderActiveIds;
|
|
210
233
|
});
|
|
211
234
|
// Note: this gets triggered on page reload for Firefox (not other browsers) because of closeOnBeforeunload: false
|
|
212
|
-
(0, _defineProperty2.default)(_this, "onDisconnected", function (
|
|
213
|
-
var reason =
|
|
235
|
+
(0, _defineProperty2.default)(_this, "onDisconnected", function (_ref5) {
|
|
236
|
+
var reason = _ref5.reason;
|
|
214
237
|
_this.disconnectedAt = Date.now();
|
|
215
238
|
_this.participantsService.disconnect(reason, _this.sessionId);
|
|
216
239
|
});
|
|
@@ -225,52 +248,52 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
225
248
|
* Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
|
|
226
249
|
* @throws {GetCurrentStateError} Something went wrong while returning the current state
|
|
227
250
|
*/
|
|
228
|
-
(0, _defineProperty2.default)(_this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
251
|
+
(0, _defineProperty2.default)(_this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
229
252
|
var _this$analyticsHelper4;
|
|
230
|
-
return _regenerator.default.wrap(function
|
|
231
|
-
while (1) switch (
|
|
253
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
254
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
232
255
|
case 0:
|
|
233
|
-
|
|
234
|
-
|
|
256
|
+
_context2.prev = 0;
|
|
257
|
+
_context2.next = 3;
|
|
235
258
|
return _this.documentService.getCurrentState();
|
|
236
259
|
case 3:
|
|
237
|
-
return
|
|
260
|
+
return _context2.abrupt("return", _context2.sent);
|
|
238
261
|
case 6:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
(_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(
|
|
242
|
-
throw new _customErrors.GetCurrentStateError('Error while returning the current state of the draft document',
|
|
262
|
+
_context2.prev = 6;
|
|
263
|
+
_context2.t0 = _context2["catch"](0);
|
|
264
|
+
(_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
|
|
265
|
+
throw new _customErrors.GetCurrentStateError('Error while returning the current state of the draft document', _context2.t0);
|
|
243
266
|
case 10:
|
|
244
267
|
case "end":
|
|
245
|
-
return
|
|
268
|
+
return _context2.stop();
|
|
246
269
|
}
|
|
247
|
-
},
|
|
270
|
+
}, _callee2, null, [[0, 6]]);
|
|
248
271
|
})));
|
|
249
272
|
/**
|
|
250
273
|
* Return the final acknowledged (by NCS) ADF version of the current draft document, together with it's title and the current step version.
|
|
251
274
|
* Used when returning the document to Confluence on publish.
|
|
252
275
|
* @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
|
|
253
276
|
*/
|
|
254
|
-
(0, _defineProperty2.default)(_this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
277
|
+
(0, _defineProperty2.default)(_this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
255
278
|
var _this$analyticsHelper5;
|
|
256
|
-
return _regenerator.default.wrap(function
|
|
257
|
-
while (1) switch (
|
|
279
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
280
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
258
281
|
case 0:
|
|
259
|
-
|
|
260
|
-
|
|
282
|
+
_context3.prev = 0;
|
|
283
|
+
_context3.next = 3;
|
|
261
284
|
return _this.documentService.getFinalAcknowledgedState();
|
|
262
285
|
case 3:
|
|
263
|
-
return
|
|
286
|
+
return _context3.abrupt("return", _context3.sent);
|
|
264
287
|
case 6:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(
|
|
268
|
-
throw new _customErrors.GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document',
|
|
288
|
+
_context3.prev = 6;
|
|
289
|
+
_context3.t0 = _context3["catch"](0);
|
|
290
|
+
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context3.t0, 'Error while returning ADF version of the final draft document');
|
|
291
|
+
throw new _customErrors.GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', _context3.t0);
|
|
269
292
|
case 10:
|
|
270
293
|
case "end":
|
|
271
|
-
return
|
|
294
|
+
return _context3.stop();
|
|
272
295
|
}
|
|
273
|
-
},
|
|
296
|
+
}, _callee3, null, [[0, 6]]);
|
|
274
297
|
})));
|
|
275
298
|
(0, _defineProperty2.default)(_this, "getUnconfirmedSteps", function () {
|
|
276
299
|
return _this.documentService.getUnconfirmedSteps();
|
|
@@ -359,10 +382,10 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
359
382
|
*/
|
|
360
383
|
}, {
|
|
361
384
|
key: "setup",
|
|
362
|
-
value: function setup(
|
|
363
|
-
var getState =
|
|
364
|
-
editorApi =
|
|
365
|
-
onSyncUpError =
|
|
385
|
+
value: function setup(_ref8) {
|
|
386
|
+
var getState = _ref8.getState,
|
|
387
|
+
editorApi = _ref8.editorApi,
|
|
388
|
+
onSyncUpError = _ref8.onSyncUpError;
|
|
366
389
|
this.checkForCookies();
|
|
367
390
|
try {
|
|
368
391
|
// Ignored via go/ees005
|
|
@@ -456,16 +479,29 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
456
479
|
}, {
|
|
457
480
|
key: "send",
|
|
458
481
|
value: function send(_tr, _oldState, newState) {
|
|
482
|
+
var _this2 = this;
|
|
459
483
|
try {
|
|
460
484
|
if (this.isViewOnly()) {
|
|
461
|
-
var _this$analyticsHelper10;
|
|
462
485
|
var error = {
|
|
463
486
|
message: 'Attempted to send steps in view only mode',
|
|
464
487
|
data: {
|
|
465
488
|
code: _internalErrors.INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
466
489
|
}
|
|
467
490
|
};
|
|
468
|
-
(
|
|
491
|
+
if ((0, _platformFeatureFlags.fg)('log_obfuscated_steps_for_view_only')) {
|
|
492
|
+
(0, _utils.logObfuscatedSteps)(_oldState, newState).then(function (attributes) {
|
|
493
|
+
var _this2$analyticsHelpe;
|
|
494
|
+
var stepAttributes = attributes instanceof _customErrors.CustomError ? {} : _objectSpread({}, attributes);
|
|
495
|
+
var stepsError = new _customErrors.CustomError(error.message, error, _objectSpread({}, stepAttributes));
|
|
496
|
+
(_this2$analyticsHelpe = _this2.analyticsHelper) === null || _this2$analyticsHelpe === void 0 || _this2$analyticsHelpe.sendErrorEvent(stepsError, stepsError.message);
|
|
497
|
+
}).catch(function (err) {
|
|
498
|
+
var _this2$analyticsHelpe2;
|
|
499
|
+
return (_this2$analyticsHelpe2 = _this2.analyticsHelper) === null || _this2$analyticsHelpe2 === void 0 ? void 0 : _this2$analyticsHelpe2.sendErrorEvent(err, err.message);
|
|
500
|
+
});
|
|
501
|
+
} else {
|
|
502
|
+
var _this$analyticsHelper10;
|
|
503
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(error, error.message);
|
|
504
|
+
}
|
|
469
505
|
return;
|
|
470
506
|
}
|
|
471
507
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -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.4.
|
|
8
|
+
var version = exports.version = "10.4.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|