@atlaskit/collab-provider 19.0.3 → 19.0.5
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 +12 -0
- package/dist/cjs/analytics/analytics-helper.js +12 -11
- package/dist/cjs/api/api.js +43 -48
- package/dist/cjs/api/null-api.js +1 -1
- package/dist/cjs/channel.js +145 -159
- package/dist/cjs/document/catchupv2.js +23 -23
- package/dist/cjs/document/document-service.js +100 -100
- package/dist/cjs/helpers/utils.js +20 -20
- package/dist/cjs/namespace/namespace-service.js +4 -4
- package/dist/cjs/participants/participants-helper.js +10 -10
- package/dist/cjs/participants/participants-service.js +87 -87
- package/dist/cjs/provider/index.js +33 -33
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/analytics/analytics-helper.js +12 -11
- package/dist/esm/api/api.js +43 -48
- package/dist/esm/api/null-api.js +1 -1
- package/dist/esm/channel.js +145 -159
- package/dist/esm/document/catchupv2.js +23 -23
- package/dist/esm/document/document-service.js +100 -100
- package/dist/esm/helpers/utils.js +20 -20
- package/dist/esm/namespace/namespace-service.js +4 -4
- package/dist/esm/participants/participants-helper.js +10 -10
- package/dist/esm/participants/participants-service.js +87 -87
- package/dist/esm/provider/index.js +33 -33
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +7 -7
package/dist/esm/channel.js
CHANGED
|
@@ -61,46 +61,46 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
61
61
|
// Used to retrieve the x-token for API requests
|
|
62
62
|
_defineProperty(_this, "getChannelToken", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
63
63
|
var _yield$_this$config$p;
|
|
64
|
-
var token;
|
|
65
|
-
return _regeneratorRuntime.wrap(function
|
|
64
|
+
var token, _t, _t2, _t3;
|
|
65
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
66
66
|
while (1) switch (_context.prev = _context.next) {
|
|
67
67
|
case 0:
|
|
68
68
|
if (!_this.token) {
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 1;
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
return _context.abrupt("return", _this.token);
|
|
73
|
-
case
|
|
73
|
+
case 1:
|
|
74
74
|
if (_this.config.permissionTokenRefresh) {
|
|
75
|
-
_context.next =
|
|
75
|
+
_context.next = 2;
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
return _context.abrupt("return", undefined);
|
|
79
|
-
case
|
|
80
|
-
_context.next =
|
|
79
|
+
case 2:
|
|
80
|
+
_context.next = 3;
|
|
81
81
|
return _this.config.permissionTokenRefresh();
|
|
82
|
-
case
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!
|
|
86
|
-
_context.next =
|
|
82
|
+
case 3:
|
|
83
|
+
_t2 = _yield$_this$config$p = _context.sent;
|
|
84
|
+
_t = _t2 !== null;
|
|
85
|
+
if (!_t) {
|
|
86
|
+
_context.next = 4;
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
case
|
|
91
|
-
if (!
|
|
92
|
-
_context.next =
|
|
89
|
+
_t = _yield$_this$config$p !== void 0;
|
|
90
|
+
case 4:
|
|
91
|
+
if (!_t) {
|
|
92
|
+
_context.next = 5;
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
_context.next =
|
|
95
|
+
_t3 = _yield$_this$config$p;
|
|
96
|
+
_context.next = 6;
|
|
97
97
|
break;
|
|
98
|
-
case
|
|
99
|
-
|
|
100
|
-
case
|
|
101
|
-
token =
|
|
98
|
+
case 5:
|
|
99
|
+
_t3 = undefined;
|
|
100
|
+
case 6:
|
|
101
|
+
token = _t3;
|
|
102
102
|
return _context.abrupt("return", token);
|
|
103
|
-
case
|
|
103
|
+
case 7:
|
|
104
104
|
case "end":
|
|
105
105
|
return _context.stop();
|
|
106
106
|
}
|
|
@@ -231,36 +231,35 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
231
231
|
});
|
|
232
232
|
_defineProperty(_this, "fetchCatchupv2", /*#__PURE__*/function () {
|
|
233
233
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fromVersion, clientId, catchUpOutofSync, reason, sessionId) {
|
|
234
|
-
var _yield$utils$requestS, steps, metadata, errorNotFound, errorCatchupv2;
|
|
235
|
-
return _regeneratorRuntime.wrap(function
|
|
234
|
+
var _yield$utils$requestS, steps, metadata, errorNotFound, errorCatchupv2, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
235
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
236
236
|
while (1) switch (_context2.prev = _context2.next) {
|
|
237
237
|
case 0:
|
|
238
238
|
_context2.prev = 0;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
_t4 = utils;
|
|
240
|
+
_t5 = _this.config;
|
|
241
|
+
_t6 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/catchupv2");
|
|
242
|
+
_t7 = {
|
|
243
243
|
version: fromVersion,
|
|
244
244
|
clientId: clientId,
|
|
245
245
|
catchUpOutofSync: catchUpOutofSync,
|
|
246
246
|
reason: reason,
|
|
247
247
|
sessionId: sessionId
|
|
248
248
|
};
|
|
249
|
-
_context2.next =
|
|
249
|
+
_context2.next = 1;
|
|
250
250
|
return _this.commonHeaders();
|
|
251
|
-
case
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
headers:
|
|
251
|
+
case 1:
|
|
252
|
+
_t8 = _context2.sent;
|
|
253
|
+
_t9 = {
|
|
254
|
+
headers: _t8
|
|
255
255
|
};
|
|
256
|
-
_context2.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
case 12:
|
|
256
|
+
_context2.next = 2;
|
|
257
|
+
return _t4.requestService.call(_t4, _t5, {
|
|
258
|
+
path: _t6,
|
|
259
|
+
queryParams: _t7,
|
|
260
|
+
requestInit: _t9
|
|
261
|
+
});
|
|
262
|
+
case 2:
|
|
264
263
|
_yield$utils$requestS = _context2.sent;
|
|
265
264
|
steps = _yield$utils$requestS.steps;
|
|
266
265
|
metadata = _yield$utils$requestS.metadata;
|
|
@@ -268,38 +267,38 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
268
267
|
steps: steps,
|
|
269
268
|
metadata: metadata
|
|
270
269
|
});
|
|
271
|
-
case
|
|
272
|
-
_context2.prev =
|
|
273
|
-
|
|
274
|
-
if (!(
|
|
275
|
-
_context2.next =
|
|
270
|
+
case 3:
|
|
271
|
+
_context2.prev = 3;
|
|
272
|
+
_t0 = _context2["catch"](0);
|
|
273
|
+
if (!(_t0.code === 404)) {
|
|
274
|
+
_context2.next = 4;
|
|
276
275
|
break;
|
|
277
276
|
}
|
|
278
277
|
errorNotFound = {
|
|
279
278
|
message: 'The requested document is not found',
|
|
280
279
|
data: {
|
|
281
|
-
status:
|
|
280
|
+
status: _t0.code,
|
|
282
281
|
code: INTERNAL_ERROR_CODE.DOCUMENT_NOT_FOUND
|
|
283
282
|
}
|
|
284
283
|
};
|
|
285
284
|
_this.emit('error', errorNotFound);
|
|
286
285
|
return _context2.abrupt("return", {});
|
|
287
|
-
case
|
|
288
|
-
logger("Can't fetch the catchupv2",
|
|
286
|
+
case 4:
|
|
287
|
+
logger("Can't fetch the catchupv2", _t0.message);
|
|
289
288
|
errorCatchupv2 = {
|
|
290
289
|
message: 'Cannot fetch catchupv2 from collab service',
|
|
291
290
|
data: {
|
|
292
|
-
status:
|
|
291
|
+
status: _t0.status,
|
|
293
292
|
code: INTERNAL_ERROR_CODE.CATCHUP_FAILED
|
|
294
293
|
}
|
|
295
294
|
};
|
|
296
295
|
_this.emit('error', errorCatchupv2);
|
|
297
|
-
throw
|
|
298
|
-
case
|
|
296
|
+
throw _t0;
|
|
297
|
+
case 5:
|
|
299
298
|
case "end":
|
|
300
299
|
return _context2.stop();
|
|
301
300
|
}
|
|
302
|
-
}, _callee2, null, [[0,
|
|
301
|
+
}, _callee2, null, [[0, 3]]);
|
|
303
302
|
}));
|
|
304
303
|
return function (_x, _x2, _x3, _x4, _x5) {
|
|
305
304
|
return _ref2.apply(this, arguments);
|
|
@@ -307,8 +306,8 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
307
306
|
}());
|
|
308
307
|
_defineProperty(_this, "fetchReconcile", /*#__PURE__*/function () {
|
|
309
308
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(currentStateDoc, reason) {
|
|
310
|
-
var reqBody, reconcileResponse, _this$analyticsHelper7;
|
|
311
|
-
return _regeneratorRuntime.wrap(function
|
|
309
|
+
var reqBody, reconcileResponse, _this$analyticsHelper7, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18;
|
|
310
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
312
311
|
while (1) switch (_context3.prev = _context3.next) {
|
|
313
312
|
case 0:
|
|
314
313
|
_context3.prev = 0;
|
|
@@ -318,47 +317,42 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
318
317
|
reason: reason
|
|
319
318
|
}); // Ignored via go/ees005
|
|
320
319
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
_context3.next =
|
|
320
|
+
_t1 = utils;
|
|
321
|
+
_t10 = _this.config;
|
|
322
|
+
_t11 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/reconcile");
|
|
323
|
+
_t12 = _objectSpread;
|
|
324
|
+
_t13 = _objectSpread;
|
|
325
|
+
_t14 = {};
|
|
326
|
+
_context3.next = 1;
|
|
328
327
|
return _this.commonHeaders();
|
|
329
|
-
case
|
|
330
|
-
|
|
331
|
-
_context3.t7 = (0, _context3.t4)(_context3.t5, _context3.t6);
|
|
332
|
-
_context3.t8 = {};
|
|
333
|
-
_context3.t9 = {
|
|
328
|
+
case 1:
|
|
329
|
+
_t15 = _t12(_t13(_t14, _context3.sent), {}, {
|
|
334
330
|
'Content-Type': 'application/json'
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
headers: _context3.t10,
|
|
331
|
+
});
|
|
332
|
+
_t16 = reqBody;
|
|
333
|
+
_t17 = {
|
|
334
|
+
headers: _t15,
|
|
340
335
|
method: 'POST',
|
|
341
|
-
body:
|
|
342
|
-
};
|
|
343
|
-
_context3.t13 = {
|
|
344
|
-
path: _context3.t2,
|
|
345
|
-
requestInit: _context3.t12
|
|
336
|
+
body: _t16
|
|
346
337
|
};
|
|
347
|
-
_context3.next =
|
|
348
|
-
return
|
|
349
|
-
|
|
338
|
+
_context3.next = 2;
|
|
339
|
+
return _t1.requestService.call(_t1, _t10, {
|
|
340
|
+
path: _t11,
|
|
341
|
+
requestInit: _t17
|
|
342
|
+
});
|
|
343
|
+
case 2:
|
|
350
344
|
reconcileResponse = _context3.sent;
|
|
351
345
|
return _context3.abrupt("return", reconcileResponse);
|
|
352
|
-
case
|
|
353
|
-
_context3.prev =
|
|
354
|
-
|
|
355
|
-
(_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(
|
|
356
|
-
throw
|
|
357
|
-
case
|
|
346
|
+
case 3:
|
|
347
|
+
_context3.prev = 3;
|
|
348
|
+
_t18 = _context3["catch"](0);
|
|
349
|
+
(_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(_t18, 'Error while fetching reconciled document');
|
|
350
|
+
throw _t18;
|
|
351
|
+
case 4:
|
|
358
352
|
case "end":
|
|
359
353
|
return _context3.stop();
|
|
360
354
|
}
|
|
361
|
-
}, _callee3, null, [[0,
|
|
355
|
+
}, _callee3, null, [[0, 3]]);
|
|
362
356
|
}));
|
|
363
357
|
return function (_x6, _x7) {
|
|
364
358
|
return _ref3.apply(this, arguments);
|
|
@@ -372,8 +366,8 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
372
366
|
*/
|
|
373
367
|
_defineProperty(_this, "fetchGeneratedDiffSteps", /*#__PURE__*/function () {
|
|
374
368
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(currentStateDoc, reason) {
|
|
375
|
-
var reqBody, reconcileResponse, _this$analyticsHelper8;
|
|
376
|
-
return _regeneratorRuntime.wrap(function
|
|
369
|
+
var reqBody, reconcileResponse, _this$analyticsHelper8, _t19, _t20, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28;
|
|
370
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
377
371
|
while (1) switch (_context4.prev = _context4.next) {
|
|
378
372
|
case 0:
|
|
379
373
|
_context4.prev = 0;
|
|
@@ -382,47 +376,42 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
382
376
|
productId: 'ccollab',
|
|
383
377
|
reason: reason
|
|
384
378
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
_context4.next =
|
|
379
|
+
_t19 = utils;
|
|
380
|
+
_t20 = _this.config;
|
|
381
|
+
_t21 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/generate-diff-steps");
|
|
382
|
+
_t22 = _objectSpread;
|
|
383
|
+
_t23 = _objectSpread;
|
|
384
|
+
_t24 = {};
|
|
385
|
+
_context4.next = 1;
|
|
392
386
|
return _this.commonHeaders();
|
|
393
|
-
case
|
|
394
|
-
|
|
395
|
-
_context4.t7 = (0, _context4.t4)(_context4.t5, _context4.t6);
|
|
396
|
-
_context4.t8 = {};
|
|
397
|
-
_context4.t9 = {
|
|
387
|
+
case 1:
|
|
388
|
+
_t25 = _t22(_t23(_t24, _context4.sent), {}, {
|
|
398
389
|
'Content-Type': 'application/json'
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
headers: _context4.t10,
|
|
390
|
+
});
|
|
391
|
+
_t26 = reqBody;
|
|
392
|
+
_t27 = {
|
|
393
|
+
headers: _t25,
|
|
404
394
|
method: 'POST',
|
|
405
|
-
body:
|
|
406
|
-
};
|
|
407
|
-
_context4.t13 = {
|
|
408
|
-
path: _context4.t2,
|
|
409
|
-
requestInit: _context4.t12
|
|
395
|
+
body: _t26
|
|
410
396
|
};
|
|
411
|
-
_context4.next =
|
|
412
|
-
return
|
|
413
|
-
|
|
397
|
+
_context4.next = 2;
|
|
398
|
+
return _t19.requestService.call(_t19, _t20, {
|
|
399
|
+
path: _t21,
|
|
400
|
+
requestInit: _t27
|
|
401
|
+
});
|
|
402
|
+
case 2:
|
|
414
403
|
reconcileResponse = _context4.sent;
|
|
415
404
|
return _context4.abrupt("return", reconcileResponse);
|
|
416
|
-
case
|
|
417
|
-
_context4.prev =
|
|
418
|
-
|
|
419
|
-
(_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(
|
|
420
|
-
throw
|
|
421
|
-
case
|
|
405
|
+
case 3:
|
|
406
|
+
_context4.prev = 3;
|
|
407
|
+
_t28 = _context4["catch"](0);
|
|
408
|
+
(_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_t28, 'Error while fetching generated steps from the BE server');
|
|
409
|
+
throw _t28;
|
|
410
|
+
case 4:
|
|
422
411
|
case "end":
|
|
423
412
|
return _context4.stop();
|
|
424
413
|
}
|
|
425
|
-
}, _callee4, null, [[0,
|
|
414
|
+
}, _callee4, null, [[0, 3]]);
|
|
426
415
|
}));
|
|
427
416
|
return function (_x8, _x9) {
|
|
428
417
|
return _ref4.apply(this, arguments);
|
|
@@ -547,8 +536,8 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
547
536
|
if (permissionTokenRefresh) {
|
|
548
537
|
auth = /*#__PURE__*/function () {
|
|
549
538
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cb) {
|
|
550
|
-
var authData, token, _data, authenticationError;
|
|
551
|
-
return _regeneratorRuntime.wrap(function
|
|
539
|
+
var authData, token, _data, authenticationError, _t29;
|
|
540
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
552
541
|
while (1) switch (_context5.prev = _context5.next) {
|
|
553
542
|
case 0:
|
|
554
543
|
// Rebuild authData to ensure values are current
|
|
@@ -559,9 +548,9 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
559
548
|
need404: _this2.config.need404
|
|
560
549
|
};
|
|
561
550
|
_context5.prev = 1;
|
|
562
|
-
_context5.next =
|
|
551
|
+
_context5.next = 2;
|
|
563
552
|
return permissionTokenRefresh();
|
|
564
|
-
case
|
|
553
|
+
case 2:
|
|
565
554
|
token = _context5.sent;
|
|
566
555
|
if (token) {
|
|
567
556
|
authData.token = token;
|
|
@@ -569,11 +558,11 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
569
558
|
authData.token = undefined;
|
|
570
559
|
}
|
|
571
560
|
cb(authData);
|
|
572
|
-
_context5.next =
|
|
561
|
+
_context5.next = 4;
|
|
573
562
|
break;
|
|
574
|
-
case
|
|
575
|
-
_context5.prev =
|
|
576
|
-
|
|
563
|
+
case 3:
|
|
564
|
+
_context5.prev = 3;
|
|
565
|
+
_t29 = _context5["catch"](1);
|
|
577
566
|
// Pass the error back to the consumers so they can deal with exceptional cases themselves (eg. no permissions because the page was deleted)
|
|
578
567
|
authenticationError = {
|
|
579
568
|
message: 'Insufficient editing permissions',
|
|
@@ -581,20 +570,20 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
581
570
|
status: 403,
|
|
582
571
|
code: INTERNAL_ERROR_CODE.TOKEN_PERMISSION_ERROR,
|
|
583
572
|
meta: {
|
|
584
|
-
originalError:
|
|
573
|
+
originalError: _t29,
|
|
585
574
|
// Ignored via go/ees005
|
|
586
575
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
587
|
-
reason:
|
|
576
|
+
reason: _t29 === null || _t29 === void 0 || (_data = _t29.data) === null || _data === void 0 || (_data = _data.meta) === null || _data === void 0 ? void 0 : _data.reason // Should always be 'RESOURCE_DELETED' Temporary, until Confluence Cloud removes their hack
|
|
588
577
|
// https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/browse/next/packages/native-collab/src/fetchCollabPermissionToken.ts#37
|
|
589
578
|
}
|
|
590
579
|
}
|
|
591
580
|
};
|
|
592
581
|
_this2.emit('error', authenticationError);
|
|
593
|
-
case
|
|
582
|
+
case 4:
|
|
594
583
|
case "end":
|
|
595
584
|
return _context5.stop();
|
|
596
585
|
}
|
|
597
|
-
}, _callee5, null, [[1,
|
|
586
|
+
}, _callee5, null, [[1, 3]]);
|
|
598
587
|
}));
|
|
599
588
|
return function auth(_x0) {
|
|
600
589
|
return _ref5.apply(this, arguments);
|
|
@@ -606,7 +595,7 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
606
595
|
auth = /*#__PURE__*/function () {
|
|
607
596
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(cb) {
|
|
608
597
|
var authData;
|
|
609
|
-
return _regeneratorRuntime.wrap(function
|
|
598
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
610
599
|
while (1) switch (_context6.prev = _context6.next) {
|
|
611
600
|
case 0:
|
|
612
601
|
// Rebuild authData to ensure values are current
|
|
@@ -617,7 +606,7 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
617
606
|
need404: _this2.config.need404
|
|
618
607
|
};
|
|
619
608
|
cb(authData);
|
|
620
|
-
case
|
|
609
|
+
case 1:
|
|
621
610
|
case "end":
|
|
622
611
|
return _context6.stop();
|
|
623
612
|
}
|
|
@@ -682,7 +671,7 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
682
671
|
this.socket.on('disconnect', /*#__PURE__*/function () {
|
|
683
672
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(reason) {
|
|
684
673
|
var _this2$analyticsHelpe, reconnectionError;
|
|
685
|
-
return _regeneratorRuntime.wrap(function
|
|
674
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
686
675
|
while (1) switch (_context7.prev = _context7.next) {
|
|
687
676
|
case 0:
|
|
688
677
|
_this2.connected = false;
|
|
@@ -706,7 +695,7 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
706
695
|
_this2.emit('error', reconnectionError);
|
|
707
696
|
}
|
|
708
697
|
}
|
|
709
|
-
case
|
|
698
|
+
case 1:
|
|
710
699
|
case "end":
|
|
711
700
|
return _context7.stop();
|
|
712
701
|
}
|
|
@@ -826,37 +815,34 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
826
815
|
key: "commonHeaders",
|
|
827
816
|
value: function () {
|
|
828
817
|
var _commonHeaders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
829
|
-
|
|
818
|
+
var _t30, _t31, _t32, _t33, _t34;
|
|
819
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
830
820
|
while (1) switch (_context8.prev = _context8.next) {
|
|
831
821
|
case 0:
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
822
|
+
_t30 = _objectSpread;
|
|
823
|
+
_t31 = _objectSpread;
|
|
824
|
+
_t32 = {};
|
|
835
825
|
if (!this.config.permissionTokenRefresh) {
|
|
836
|
-
_context8.next =
|
|
826
|
+
_context8.next = 2;
|
|
837
827
|
break;
|
|
838
828
|
}
|
|
839
|
-
_context8.next =
|
|
829
|
+
_context8.next = 1;
|
|
840
830
|
return this.getChannelToken();
|
|
841
|
-
case
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
'x-token':
|
|
831
|
+
case 1:
|
|
832
|
+
_t34 = _context8.sent;
|
|
833
|
+
_t33 = {
|
|
834
|
+
'x-token': _t34
|
|
845
835
|
};
|
|
846
|
-
_context8.next =
|
|
836
|
+
_context8.next = 3;
|
|
847
837
|
break;
|
|
848
|
-
case
|
|
849
|
-
|
|
850
|
-
case
|
|
851
|
-
_context8.
|
|
852
|
-
_context8.t6 = (0, _context8.t1)(_context8.t2, _context8.t5);
|
|
853
|
-
_context8.t7 = {};
|
|
854
|
-
_context8.t8 = {
|
|
838
|
+
case 2:
|
|
839
|
+
_t33 = {};
|
|
840
|
+
case 3:
|
|
841
|
+
return _context8.abrupt("return", _t30(_t31(_t32, _t33), {}, {
|
|
855
842
|
'x-product': getProduct(this.config.productInfo),
|
|
856
843
|
'x-subproduct': getSubProduct(this.config.productInfo)
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
case 16:
|
|
844
|
+
}));
|
|
845
|
+
case 4:
|
|
860
846
|
case "end":
|
|
861
847
|
return _context8.stop();
|
|
862
848
|
}
|
|
@@ -5,8 +5,8 @@ import { createLogger, getObfuscatedSteps, getDocAdfWithObfuscation } from '../h
|
|
|
5
5
|
var logger = createLogger('Catchupv2', 'red');
|
|
6
6
|
export var catchupv2 = /*#__PURE__*/function () {
|
|
7
7
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(opt) {
|
|
8
|
-
var steps, metadata, fromVersion, _yield$opt$fetchCatch, _opt$analyticsHelper, _opt$onCatchupComplet, version, stepsPayload, clientOutOfSync, _opt$analyticsHelper2;
|
|
9
|
-
return _regeneratorRuntime.wrap(function
|
|
8
|
+
var steps, metadata, fromVersion, _yield$opt$fetchCatch, _opt$analyticsHelper, _opt$onCatchupComplet, version, stepsPayload, clientOutOfSync, _opt$analyticsHelper2, _t, _t2;
|
|
9
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
10
10
|
while (1) switch (_context.prev = _context.next) {
|
|
11
11
|
case 0:
|
|
12
12
|
// Ignored via go/ees005
|
|
@@ -15,31 +15,31 @@ export var catchupv2 = /*#__PURE__*/function () {
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
fromVersion = opt.getCurrentPmVersion();
|
|
17
17
|
_context.prev = 1;
|
|
18
|
-
_context.next =
|
|
18
|
+
_context.next = 2;
|
|
19
19
|
return opt.fetchCatchupv2(fromVersion, opt.clientId, opt.catchUpOutofSync, opt.reason, opt.sessionId);
|
|
20
|
-
case
|
|
20
|
+
case 2:
|
|
21
21
|
_yield$opt$fetchCatch = _context.sent;
|
|
22
22
|
steps = _yield$opt$fetchCatch.steps;
|
|
23
23
|
metadata = _yield$opt$fetchCatch.metadata;
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 4;
|
|
25
25
|
break;
|
|
26
|
-
case
|
|
27
|
-
_context.prev =
|
|
28
|
-
|
|
29
|
-
(_opt$analyticsHelper = opt.analyticsHelper) === null || _opt$analyticsHelper === void 0 || _opt$analyticsHelper.sendErrorEvent(
|
|
30
|
-
logger("Fetch catchupv2 from server failed:",
|
|
31
|
-
throw
|
|
32
|
-
case
|
|
33
|
-
_context.prev =
|
|
26
|
+
case 3:
|
|
27
|
+
_context.prev = 3;
|
|
28
|
+
_t = _context["catch"](1);
|
|
29
|
+
(_opt$analyticsHelper = opt.analyticsHelper) === null || _opt$analyticsHelper === void 0 || _opt$analyticsHelper.sendErrorEvent(_t, 'Error while fetching catchupv2 from server');
|
|
30
|
+
logger("Fetch catchupv2 from server failed:", _t.message);
|
|
31
|
+
throw _t;
|
|
32
|
+
case 4:
|
|
33
|
+
_context.prev = 4;
|
|
34
34
|
(_opt$onCatchupComplet = opt.onCatchupComplete) === null || _opt$onCatchupComplet === void 0 || _opt$onCatchupComplet.call(opt, steps);
|
|
35
35
|
// skip onStepsAdded if steps are undefined or empty
|
|
36
36
|
if (!(!steps || steps.length === 0)) {
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 5;
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
opt.updateMetadata(metadata);
|
|
41
41
|
return _context.abrupt("return", false);
|
|
42
|
-
case
|
|
42
|
+
case 5:
|
|
43
43
|
version = fromVersion + steps.length;
|
|
44
44
|
stepsPayload = {
|
|
45
45
|
version: version,
|
|
@@ -52,17 +52,17 @@ export var catchupv2 = /*#__PURE__*/function () {
|
|
|
52
52
|
logObfuscatedSteps(steps, opt);
|
|
53
53
|
}
|
|
54
54
|
return _context.abrupt("return", clientOutOfSync);
|
|
55
|
-
case
|
|
56
|
-
_context.prev =
|
|
57
|
-
|
|
58
|
-
(_opt$analyticsHelper2 = opt.analyticsHelper) === null || _opt$analyticsHelper2 === void 0 || _opt$analyticsHelper2.sendErrorEvent(
|
|
59
|
-
logger("Apply catchupv2 steps failed:",
|
|
60
|
-
throw
|
|
61
|
-
case
|
|
55
|
+
case 6:
|
|
56
|
+
_context.prev = 6;
|
|
57
|
+
_t2 = _context["catch"](4);
|
|
58
|
+
(_opt$analyticsHelper2 = opt.analyticsHelper) === null || _opt$analyticsHelper2 === void 0 || _opt$analyticsHelper2.sendErrorEvent(_t2, 'Failed to apply catchupv2 result in the editor');
|
|
59
|
+
logger("Apply catchupv2 steps failed:", _t2.message);
|
|
60
|
+
throw _t2;
|
|
61
|
+
case 7:
|
|
62
62
|
case "end":
|
|
63
63
|
return _context.stop();
|
|
64
64
|
}
|
|
65
|
-
}, _callee, null, [[1,
|
|
65
|
+
}, _callee, null, [[1, 3], [4, 6]]);
|
|
66
66
|
}));
|
|
67
67
|
return function catchupv2(_x) {
|
|
68
68
|
return _ref.apply(this, arguments);
|