@atlaskit/collab-provider 19.0.4 → 19.0.6
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/cjs/channel.js
CHANGED
|
@@ -68,46 +68,46 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
68
68
|
// Used to retrieve the x-token for API requests
|
|
69
69
|
(0, _defineProperty2.default)(_this, "getChannelToken", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
70
70
|
var _yield$_this$config$p;
|
|
71
|
-
var token;
|
|
72
|
-
return _regenerator.default.wrap(function
|
|
71
|
+
var token, _t, _t2, _t3;
|
|
72
|
+
return _regenerator.default.wrap(function (_context) {
|
|
73
73
|
while (1) switch (_context.prev = _context.next) {
|
|
74
74
|
case 0:
|
|
75
75
|
if (!_this.token) {
|
|
76
|
-
_context.next =
|
|
76
|
+
_context.next = 1;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
return _context.abrupt("return", _this.token);
|
|
80
|
-
case
|
|
80
|
+
case 1:
|
|
81
81
|
if (_this.config.permissionTokenRefresh) {
|
|
82
|
-
_context.next =
|
|
82
|
+
_context.next = 2;
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
return _context.abrupt("return", undefined);
|
|
86
|
-
case
|
|
87
|
-
_context.next =
|
|
86
|
+
case 2:
|
|
87
|
+
_context.next = 3;
|
|
88
88
|
return _this.config.permissionTokenRefresh();
|
|
89
|
-
case
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!
|
|
93
|
-
_context.next =
|
|
89
|
+
case 3:
|
|
90
|
+
_t2 = _yield$_this$config$p = _context.sent;
|
|
91
|
+
_t = _t2 !== null;
|
|
92
|
+
if (!_t) {
|
|
93
|
+
_context.next = 4;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
case
|
|
98
|
-
if (!
|
|
99
|
-
_context.next =
|
|
96
|
+
_t = _yield$_this$config$p !== void 0;
|
|
97
|
+
case 4:
|
|
98
|
+
if (!_t) {
|
|
99
|
+
_context.next = 5;
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
_context.next =
|
|
102
|
+
_t3 = _yield$_this$config$p;
|
|
103
|
+
_context.next = 6;
|
|
104
104
|
break;
|
|
105
|
-
case
|
|
106
|
-
|
|
107
|
-
case
|
|
108
|
-
token =
|
|
105
|
+
case 5:
|
|
106
|
+
_t3 = undefined;
|
|
107
|
+
case 6:
|
|
108
|
+
token = _t3;
|
|
109
109
|
return _context.abrupt("return", token);
|
|
110
|
-
case
|
|
110
|
+
case 7:
|
|
111
111
|
case "end":
|
|
112
112
|
return _context.stop();
|
|
113
113
|
}
|
|
@@ -238,36 +238,35 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
238
238
|
});
|
|
239
239
|
(0, _defineProperty2.default)(_this, "fetchCatchupv2", /*#__PURE__*/function () {
|
|
240
240
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(fromVersion, clientId, catchUpOutofSync, reason, sessionId) {
|
|
241
|
-
var _yield$utils$requestS, steps, metadata, errorNotFound, errorCatchupv2;
|
|
242
|
-
return _regenerator.default.wrap(function
|
|
241
|
+
var _yield$utils$requestS, steps, metadata, errorNotFound, errorCatchupv2, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
242
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
243
243
|
while (1) switch (_context2.prev = _context2.next) {
|
|
244
244
|
case 0:
|
|
245
245
|
_context2.prev = 0;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
_t4 = _utilServiceSupport.utils;
|
|
247
|
+
_t5 = _this.config;
|
|
248
|
+
_t6 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/catchupv2");
|
|
249
|
+
_t7 = {
|
|
250
250
|
version: fromVersion,
|
|
251
251
|
clientId: clientId,
|
|
252
252
|
catchUpOutofSync: catchUpOutofSync,
|
|
253
253
|
reason: reason,
|
|
254
254
|
sessionId: sessionId
|
|
255
255
|
};
|
|
256
|
-
_context2.next =
|
|
256
|
+
_context2.next = 1;
|
|
257
257
|
return _this.commonHeaders();
|
|
258
|
-
case
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
headers:
|
|
258
|
+
case 1:
|
|
259
|
+
_t8 = _context2.sent;
|
|
260
|
+
_t9 = {
|
|
261
|
+
headers: _t8
|
|
262
262
|
};
|
|
263
|
-
_context2.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
case 12:
|
|
263
|
+
_context2.next = 2;
|
|
264
|
+
return _t4.requestService.call(_t4, _t5, {
|
|
265
|
+
path: _t6,
|
|
266
|
+
queryParams: _t7,
|
|
267
|
+
requestInit: _t9
|
|
268
|
+
});
|
|
269
|
+
case 2:
|
|
271
270
|
_yield$utils$requestS = _context2.sent;
|
|
272
271
|
steps = _yield$utils$requestS.steps;
|
|
273
272
|
metadata = _yield$utils$requestS.metadata;
|
|
@@ -275,38 +274,38 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
275
274
|
steps: steps,
|
|
276
275
|
metadata: metadata
|
|
277
276
|
});
|
|
278
|
-
case
|
|
279
|
-
_context2.prev =
|
|
280
|
-
|
|
281
|
-
if (!(
|
|
282
|
-
_context2.next =
|
|
277
|
+
case 3:
|
|
278
|
+
_context2.prev = 3;
|
|
279
|
+
_t0 = _context2["catch"](0);
|
|
280
|
+
if (!(_t0.code === 404)) {
|
|
281
|
+
_context2.next = 4;
|
|
283
282
|
break;
|
|
284
283
|
}
|
|
285
284
|
errorNotFound = {
|
|
286
285
|
message: 'The requested document is not found',
|
|
287
286
|
data: {
|
|
288
|
-
status:
|
|
287
|
+
status: _t0.code,
|
|
289
288
|
code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_NOT_FOUND
|
|
290
289
|
}
|
|
291
290
|
};
|
|
292
291
|
_this.emit('error', errorNotFound);
|
|
293
292
|
return _context2.abrupt("return", {});
|
|
294
|
-
case
|
|
295
|
-
logger("Can't fetch the catchupv2",
|
|
293
|
+
case 4:
|
|
294
|
+
logger("Can't fetch the catchupv2", _t0.message);
|
|
296
295
|
errorCatchupv2 = {
|
|
297
296
|
message: 'Cannot fetch catchupv2 from collab service',
|
|
298
297
|
data: {
|
|
299
|
-
status:
|
|
298
|
+
status: _t0.status,
|
|
300
299
|
code: _internalErrors.INTERNAL_ERROR_CODE.CATCHUP_FAILED
|
|
301
300
|
}
|
|
302
301
|
};
|
|
303
302
|
_this.emit('error', errorCatchupv2);
|
|
304
|
-
throw
|
|
305
|
-
case
|
|
303
|
+
throw _t0;
|
|
304
|
+
case 5:
|
|
306
305
|
case "end":
|
|
307
306
|
return _context2.stop();
|
|
308
307
|
}
|
|
309
|
-
}, _callee2, null, [[0,
|
|
308
|
+
}, _callee2, null, [[0, 3]]);
|
|
310
309
|
}));
|
|
311
310
|
return function (_x, _x2, _x3, _x4, _x5) {
|
|
312
311
|
return _ref2.apply(this, arguments);
|
|
@@ -314,8 +313,8 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
314
313
|
}());
|
|
315
314
|
(0, _defineProperty2.default)(_this, "fetchReconcile", /*#__PURE__*/function () {
|
|
316
315
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(currentStateDoc, reason) {
|
|
317
|
-
var reqBody, reconcileResponse, _this$analyticsHelper7;
|
|
318
|
-
return _regenerator.default.wrap(function
|
|
316
|
+
var reqBody, reconcileResponse, _this$analyticsHelper7, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18;
|
|
317
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
319
318
|
while (1) switch (_context3.prev = _context3.next) {
|
|
320
319
|
case 0:
|
|
321
320
|
_context3.prev = 0;
|
|
@@ -325,47 +324,42 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
325
324
|
reason: reason
|
|
326
325
|
}); // Ignored via go/ees005
|
|
327
326
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
_context3.next =
|
|
327
|
+
_t1 = _utilServiceSupport.utils;
|
|
328
|
+
_t10 = _this.config;
|
|
329
|
+
_t11 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/reconcile");
|
|
330
|
+
_t12 = _objectSpread;
|
|
331
|
+
_t13 = _objectSpread;
|
|
332
|
+
_t14 = {};
|
|
333
|
+
_context3.next = 1;
|
|
335
334
|
return _this.commonHeaders();
|
|
336
|
-
case
|
|
337
|
-
|
|
338
|
-
_context3.t7 = (0, _context3.t4)(_context3.t5, _context3.t6);
|
|
339
|
-
_context3.t8 = {};
|
|
340
|
-
_context3.t9 = {
|
|
335
|
+
case 1:
|
|
336
|
+
_t15 = _t12(_t13(_t14, _context3.sent), {}, {
|
|
341
337
|
'Content-Type': 'application/json'
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
headers: _context3.t10,
|
|
338
|
+
});
|
|
339
|
+
_t16 = reqBody;
|
|
340
|
+
_t17 = {
|
|
341
|
+
headers: _t15,
|
|
347
342
|
method: 'POST',
|
|
348
|
-
body:
|
|
349
|
-
};
|
|
350
|
-
_context3.t13 = {
|
|
351
|
-
path: _context3.t2,
|
|
352
|
-
requestInit: _context3.t12
|
|
343
|
+
body: _t16
|
|
353
344
|
};
|
|
354
|
-
_context3.next =
|
|
355
|
-
return
|
|
356
|
-
|
|
345
|
+
_context3.next = 2;
|
|
346
|
+
return _t1.requestService.call(_t1, _t10, {
|
|
347
|
+
path: _t11,
|
|
348
|
+
requestInit: _t17
|
|
349
|
+
});
|
|
350
|
+
case 2:
|
|
357
351
|
reconcileResponse = _context3.sent;
|
|
358
352
|
return _context3.abrupt("return", reconcileResponse);
|
|
359
|
-
case
|
|
360
|
-
_context3.prev =
|
|
361
|
-
|
|
362
|
-
(_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(
|
|
363
|
-
throw
|
|
364
|
-
case
|
|
353
|
+
case 3:
|
|
354
|
+
_context3.prev = 3;
|
|
355
|
+
_t18 = _context3["catch"](0);
|
|
356
|
+
(_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(_t18, 'Error while fetching reconciled document');
|
|
357
|
+
throw _t18;
|
|
358
|
+
case 4:
|
|
365
359
|
case "end":
|
|
366
360
|
return _context3.stop();
|
|
367
361
|
}
|
|
368
|
-
}, _callee3, null, [[0,
|
|
362
|
+
}, _callee3, null, [[0, 3]]);
|
|
369
363
|
}));
|
|
370
364
|
return function (_x6, _x7) {
|
|
371
365
|
return _ref3.apply(this, arguments);
|
|
@@ -379,8 +373,8 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
379
373
|
*/
|
|
380
374
|
(0, _defineProperty2.default)(_this, "fetchGeneratedDiffSteps", /*#__PURE__*/function () {
|
|
381
375
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(currentStateDoc, reason) {
|
|
382
|
-
var reqBody, reconcileResponse, _this$analyticsHelper8;
|
|
383
|
-
return _regenerator.default.wrap(function
|
|
376
|
+
var reqBody, reconcileResponse, _this$analyticsHelper8, _t19, _t20, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28;
|
|
377
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
384
378
|
while (1) switch (_context4.prev = _context4.next) {
|
|
385
379
|
case 0:
|
|
386
380
|
_context4.prev = 0;
|
|
@@ -389,47 +383,42 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
389
383
|
productId: 'ccollab',
|
|
390
384
|
reason: reason
|
|
391
385
|
});
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
_context4.next =
|
|
386
|
+
_t19 = _utilServiceSupport.utils;
|
|
387
|
+
_t20 = _this.config;
|
|
388
|
+
_t21 = "document/".concat(encodeURIComponent(_this.config.documentAri), "/generate-diff-steps");
|
|
389
|
+
_t22 = _objectSpread;
|
|
390
|
+
_t23 = _objectSpread;
|
|
391
|
+
_t24 = {};
|
|
392
|
+
_context4.next = 1;
|
|
399
393
|
return _this.commonHeaders();
|
|
400
|
-
case
|
|
401
|
-
|
|
402
|
-
_context4.t7 = (0, _context4.t4)(_context4.t5, _context4.t6);
|
|
403
|
-
_context4.t8 = {};
|
|
404
|
-
_context4.t9 = {
|
|
394
|
+
case 1:
|
|
395
|
+
_t25 = _t22(_t23(_t24, _context4.sent), {}, {
|
|
405
396
|
'Content-Type': 'application/json'
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
headers: _context4.t10,
|
|
397
|
+
});
|
|
398
|
+
_t26 = reqBody;
|
|
399
|
+
_t27 = {
|
|
400
|
+
headers: _t25,
|
|
411
401
|
method: 'POST',
|
|
412
|
-
body:
|
|
413
|
-
};
|
|
414
|
-
_context4.t13 = {
|
|
415
|
-
path: _context4.t2,
|
|
416
|
-
requestInit: _context4.t12
|
|
402
|
+
body: _t26
|
|
417
403
|
};
|
|
418
|
-
_context4.next =
|
|
419
|
-
return
|
|
420
|
-
|
|
404
|
+
_context4.next = 2;
|
|
405
|
+
return _t19.requestService.call(_t19, _t20, {
|
|
406
|
+
path: _t21,
|
|
407
|
+
requestInit: _t27
|
|
408
|
+
});
|
|
409
|
+
case 2:
|
|
421
410
|
reconcileResponse = _context4.sent;
|
|
422
411
|
return _context4.abrupt("return", reconcileResponse);
|
|
423
|
-
case
|
|
424
|
-
_context4.prev =
|
|
425
|
-
|
|
426
|
-
(_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(
|
|
427
|
-
throw
|
|
428
|
-
case
|
|
412
|
+
case 3:
|
|
413
|
+
_context4.prev = 3;
|
|
414
|
+
_t28 = _context4["catch"](0);
|
|
415
|
+
(_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_t28, 'Error while fetching generated steps from the BE server');
|
|
416
|
+
throw _t28;
|
|
417
|
+
case 4:
|
|
429
418
|
case "end":
|
|
430
419
|
return _context4.stop();
|
|
431
420
|
}
|
|
432
|
-
}, _callee4, null, [[0,
|
|
421
|
+
}, _callee4, null, [[0, 3]]);
|
|
433
422
|
}));
|
|
434
423
|
return function (_x8, _x9) {
|
|
435
424
|
return _ref4.apply(this, arguments);
|
|
@@ -554,8 +543,8 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
554
543
|
if (permissionTokenRefresh) {
|
|
555
544
|
auth = /*#__PURE__*/function () {
|
|
556
545
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(cb) {
|
|
557
|
-
var authData, token, _data, authenticationError;
|
|
558
|
-
return _regenerator.default.wrap(function
|
|
546
|
+
var authData, token, _data, authenticationError, _t29;
|
|
547
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
559
548
|
while (1) switch (_context5.prev = _context5.next) {
|
|
560
549
|
case 0:
|
|
561
550
|
// Rebuild authData to ensure values are current
|
|
@@ -566,9 +555,9 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
566
555
|
need404: _this2.config.need404
|
|
567
556
|
};
|
|
568
557
|
_context5.prev = 1;
|
|
569
|
-
_context5.next =
|
|
558
|
+
_context5.next = 2;
|
|
570
559
|
return permissionTokenRefresh();
|
|
571
|
-
case
|
|
560
|
+
case 2:
|
|
572
561
|
token = _context5.sent;
|
|
573
562
|
if (token) {
|
|
574
563
|
authData.token = token;
|
|
@@ -576,11 +565,11 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
576
565
|
authData.token = undefined;
|
|
577
566
|
}
|
|
578
567
|
cb(authData);
|
|
579
|
-
_context5.next =
|
|
568
|
+
_context5.next = 4;
|
|
580
569
|
break;
|
|
581
|
-
case
|
|
582
|
-
_context5.prev =
|
|
583
|
-
|
|
570
|
+
case 3:
|
|
571
|
+
_context5.prev = 3;
|
|
572
|
+
_t29 = _context5["catch"](1);
|
|
584
573
|
// Pass the error back to the consumers so they can deal with exceptional cases themselves (eg. no permissions because the page was deleted)
|
|
585
574
|
authenticationError = {
|
|
586
575
|
message: 'Insufficient editing permissions',
|
|
@@ -588,20 +577,20 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
588
577
|
status: 403,
|
|
589
578
|
code: _internalErrors.INTERNAL_ERROR_CODE.TOKEN_PERMISSION_ERROR,
|
|
590
579
|
meta: {
|
|
591
|
-
originalError:
|
|
580
|
+
originalError: _t29,
|
|
592
581
|
// Ignored via go/ees005
|
|
593
582
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
594
|
-
reason:
|
|
583
|
+
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
|
|
595
584
|
// https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/browse/next/packages/native-collab/src/fetchCollabPermissionToken.ts#37
|
|
596
585
|
}
|
|
597
586
|
}
|
|
598
587
|
};
|
|
599
588
|
_this2.emit('error', authenticationError);
|
|
600
|
-
case
|
|
589
|
+
case 4:
|
|
601
590
|
case "end":
|
|
602
591
|
return _context5.stop();
|
|
603
592
|
}
|
|
604
|
-
}, _callee5, null, [[1,
|
|
593
|
+
}, _callee5, null, [[1, 3]]);
|
|
605
594
|
}));
|
|
606
595
|
return function auth(_x0) {
|
|
607
596
|
return _ref5.apply(this, arguments);
|
|
@@ -613,7 +602,7 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
613
602
|
auth = /*#__PURE__*/function () {
|
|
614
603
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(cb) {
|
|
615
604
|
var authData;
|
|
616
|
-
return _regenerator.default.wrap(function
|
|
605
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
617
606
|
while (1) switch (_context6.prev = _context6.next) {
|
|
618
607
|
case 0:
|
|
619
608
|
// Rebuild authData to ensure values are current
|
|
@@ -624,7 +613,7 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
624
613
|
need404: _this2.config.need404
|
|
625
614
|
};
|
|
626
615
|
cb(authData);
|
|
627
|
-
case
|
|
616
|
+
case 1:
|
|
628
617
|
case "end":
|
|
629
618
|
return _context6.stop();
|
|
630
619
|
}
|
|
@@ -689,7 +678,7 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
689
678
|
this.socket.on('disconnect', /*#__PURE__*/function () {
|
|
690
679
|
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(reason) {
|
|
691
680
|
var _this2$analyticsHelpe, reconnectionError;
|
|
692
|
-
return _regenerator.default.wrap(function
|
|
681
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
693
682
|
while (1) switch (_context7.prev = _context7.next) {
|
|
694
683
|
case 0:
|
|
695
684
|
_this2.connected = false;
|
|
@@ -713,7 +702,7 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
713
702
|
_this2.emit('error', reconnectionError);
|
|
714
703
|
}
|
|
715
704
|
}
|
|
716
|
-
case
|
|
705
|
+
case 1:
|
|
717
706
|
case "end":
|
|
718
707
|
return _context7.stop();
|
|
719
708
|
}
|
|
@@ -833,37 +822,34 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
833
822
|
key: "commonHeaders",
|
|
834
823
|
value: function () {
|
|
835
824
|
var _commonHeaders = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
836
|
-
|
|
825
|
+
var _t30, _t31, _t32, _t33, _t34;
|
|
826
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
837
827
|
while (1) switch (_context8.prev = _context8.next) {
|
|
838
828
|
case 0:
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
829
|
+
_t30 = _objectSpread;
|
|
830
|
+
_t31 = _objectSpread;
|
|
831
|
+
_t32 = {};
|
|
842
832
|
if (!this.config.permissionTokenRefresh) {
|
|
843
|
-
_context8.next =
|
|
833
|
+
_context8.next = 2;
|
|
844
834
|
break;
|
|
845
835
|
}
|
|
846
|
-
_context8.next =
|
|
836
|
+
_context8.next = 1;
|
|
847
837
|
return this.getChannelToken();
|
|
848
|
-
case
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
'x-token':
|
|
838
|
+
case 1:
|
|
839
|
+
_t34 = _context8.sent;
|
|
840
|
+
_t33 = {
|
|
841
|
+
'x-token': _t34
|
|
852
842
|
};
|
|
853
|
-
_context8.next =
|
|
843
|
+
_context8.next = 3;
|
|
854
844
|
break;
|
|
855
|
-
case
|
|
856
|
-
|
|
857
|
-
case
|
|
858
|
-
_context8.
|
|
859
|
-
_context8.t6 = (0, _context8.t1)(_context8.t2, _context8.t5);
|
|
860
|
-
_context8.t7 = {};
|
|
861
|
-
_context8.t8 = {
|
|
845
|
+
case 2:
|
|
846
|
+
_t33 = {};
|
|
847
|
+
case 3:
|
|
848
|
+
return _context8.abrupt("return", _t30(_t31(_t32, _t33), {}, {
|
|
862
849
|
'x-product': (0, _utils.getProduct)(this.config.productInfo),
|
|
863
850
|
'x-subproduct': (0, _utils.getSubProduct)(this.config.productInfo)
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
case 16:
|
|
851
|
+
}));
|
|
852
|
+
case 4:
|
|
867
853
|
case "end":
|
|
868
854
|
return _context8.stop();
|
|
869
855
|
}
|
|
@@ -12,8 +12,8 @@ var _utils = require("../helpers/utils");
|
|
|
12
12
|
var logger = (0, _utils.createLogger)('Catchupv2', 'red');
|
|
13
13
|
var catchupv2 = exports.catchupv2 = /*#__PURE__*/function () {
|
|
14
14
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(opt) {
|
|
15
|
-
var steps, metadata, fromVersion, _yield$opt$fetchCatch, _opt$analyticsHelper, _opt$onCatchupComplet, version, stepsPayload, clientOutOfSync, _opt$analyticsHelper2;
|
|
16
|
-
return _regenerator.default.wrap(function
|
|
15
|
+
var steps, metadata, fromVersion, _yield$opt$fetchCatch, _opt$analyticsHelper, _opt$onCatchupComplet, version, stepsPayload, clientOutOfSync, _opt$analyticsHelper2, _t, _t2;
|
|
16
|
+
return _regenerator.default.wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -22,31 +22,31 @@ var catchupv2 = exports.catchupv2 = /*#__PURE__*/function () {
|
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
23
|
fromVersion = opt.getCurrentPmVersion();
|
|
24
24
|
_context.prev = 1;
|
|
25
|
-
_context.next =
|
|
25
|
+
_context.next = 2;
|
|
26
26
|
return opt.fetchCatchupv2(fromVersion, opt.clientId, opt.catchUpOutofSync, opt.reason, opt.sessionId);
|
|
27
|
-
case
|
|
27
|
+
case 2:
|
|
28
28
|
_yield$opt$fetchCatch = _context.sent;
|
|
29
29
|
steps = _yield$opt$fetchCatch.steps;
|
|
30
30
|
metadata = _yield$opt$fetchCatch.metadata;
|
|
31
|
-
_context.next =
|
|
31
|
+
_context.next = 4;
|
|
32
32
|
break;
|
|
33
|
-
case
|
|
34
|
-
_context.prev =
|
|
35
|
-
|
|
36
|
-
(_opt$analyticsHelper = opt.analyticsHelper) === null || _opt$analyticsHelper === void 0 || _opt$analyticsHelper.sendErrorEvent(
|
|
37
|
-
logger("Fetch catchupv2 from server failed:",
|
|
38
|
-
throw
|
|
39
|
-
case
|
|
40
|
-
_context.prev =
|
|
33
|
+
case 3:
|
|
34
|
+
_context.prev = 3;
|
|
35
|
+
_t = _context["catch"](1);
|
|
36
|
+
(_opt$analyticsHelper = opt.analyticsHelper) === null || _opt$analyticsHelper === void 0 || _opt$analyticsHelper.sendErrorEvent(_t, 'Error while fetching catchupv2 from server');
|
|
37
|
+
logger("Fetch catchupv2 from server failed:", _t.message);
|
|
38
|
+
throw _t;
|
|
39
|
+
case 4:
|
|
40
|
+
_context.prev = 4;
|
|
41
41
|
(_opt$onCatchupComplet = opt.onCatchupComplete) === null || _opt$onCatchupComplet === void 0 || _opt$onCatchupComplet.call(opt, steps);
|
|
42
42
|
// skip onStepsAdded if steps are undefined or empty
|
|
43
43
|
if (!(!steps || steps.length === 0)) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 5;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
opt.updateMetadata(metadata);
|
|
48
48
|
return _context.abrupt("return", false);
|
|
49
|
-
case
|
|
49
|
+
case 5:
|
|
50
50
|
version = fromVersion + steps.length;
|
|
51
51
|
stepsPayload = {
|
|
52
52
|
version: version,
|
|
@@ -59,17 +59,17 @@ var catchupv2 = exports.catchupv2 = /*#__PURE__*/function () {
|
|
|
59
59
|
logObfuscatedSteps(steps, opt);
|
|
60
60
|
}
|
|
61
61
|
return _context.abrupt("return", clientOutOfSync);
|
|
62
|
-
case
|
|
63
|
-
_context.prev =
|
|
64
|
-
|
|
65
|
-
(_opt$analyticsHelper2 = opt.analyticsHelper) === null || _opt$analyticsHelper2 === void 0 || _opt$analyticsHelper2.sendErrorEvent(
|
|
66
|
-
logger("Apply catchupv2 steps failed:",
|
|
67
|
-
throw
|
|
68
|
-
case
|
|
62
|
+
case 6:
|
|
63
|
+
_context.prev = 6;
|
|
64
|
+
_t2 = _context["catch"](4);
|
|
65
|
+
(_opt$analyticsHelper2 = opt.analyticsHelper) === null || _opt$analyticsHelper2 === void 0 || _opt$analyticsHelper2.sendErrorEvent(_t2, 'Failed to apply catchupv2 result in the editor');
|
|
66
|
+
logger("Apply catchupv2 steps failed:", _t2.message);
|
|
67
|
+
throw _t2;
|
|
68
|
+
case 7:
|
|
69
69
|
case "end":
|
|
70
70
|
return _context.stop();
|
|
71
71
|
}
|
|
72
|
-
}, _callee, null, [[1,
|
|
72
|
+
}, _callee, null, [[1, 3], [4, 6]]);
|
|
73
73
|
}));
|
|
74
74
|
return function catchupv2(_x) {
|
|
75
75
|
return _ref.apply(this, arguments);
|