@atlaskit/collab-provider 9.21.2 → 9.22.0
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/channel.js +39 -21
- package/dist/cjs/document/document-service.js +26 -14
- package/dist/cjs/provider/index.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/channel.js +9 -5
- package/dist/es2019/document/document-service.js +8 -1
- package/dist/es2019/provider/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/channel.js +39 -21
- package/dist/esm/document/document-service.js +26 -14
- package/dist/esm/provider/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +2 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/document/document-service.d.ts +2 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 9.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#67221](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67221) [`913c874e0566`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/913c874e0566) - exclude presence (jcollab) from calling catchup on reconnect
|
|
8
|
+
|
|
9
|
+
## 9.21.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#66028](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66028) [`184aba7e4984`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/184aba7e4984) - fix the auth payload when no permission token
|
|
14
|
+
|
|
3
15
|
## 9.21.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/channel.js
CHANGED
|
@@ -571,12 +571,30 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
571
571
|
};
|
|
572
572
|
}();
|
|
573
573
|
} else {
|
|
574
|
-
auth = {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
574
|
+
auth = /*#__PURE__*/function () {
|
|
575
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(cb) {
|
|
576
|
+
var authData;
|
|
577
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
578
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
579
|
+
case 0:
|
|
580
|
+
// Rebuild authData to ensure values are current
|
|
581
|
+
authData = {
|
|
582
|
+
// The initialized status. If false, BE will send document, otherwise not.
|
|
583
|
+
initialized: _this2.initialized,
|
|
584
|
+
// ESS-1009 Allow to opt-in into 404 response
|
|
585
|
+
need404: _this2.config.need404
|
|
586
|
+
};
|
|
587
|
+
cb(authData);
|
|
588
|
+
case 2:
|
|
589
|
+
case "end":
|
|
590
|
+
return _context5.stop();
|
|
591
|
+
}
|
|
592
|
+
}, _callee5);
|
|
593
|
+
}));
|
|
594
|
+
return function auth(_x5) {
|
|
595
|
+
return _ref5.apply(this, arguments);
|
|
596
|
+
};
|
|
597
|
+
}();
|
|
580
598
|
}
|
|
581
599
|
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo);
|
|
582
600
|
|
|
@@ -591,9 +609,9 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
591
609
|
this.socket.on('steps:added', function (data) {
|
|
592
610
|
_this2.emit('steps:added', data);
|
|
593
611
|
});
|
|
594
|
-
this.socket.on('participant:telepointer', function (
|
|
595
|
-
var timestamp =
|
|
596
|
-
data =
|
|
612
|
+
this.socket.on('participant:telepointer', function (_ref6) {
|
|
613
|
+
var timestamp = _ref6.timestamp,
|
|
614
|
+
data = _ref6.data;
|
|
597
615
|
// data is TelepointerPayload without timestamp
|
|
598
616
|
_this2.emit('participant:telepointer', _objectSpread({
|
|
599
617
|
timestamp: timestamp
|
|
@@ -608,11 +626,11 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
608
626
|
this.socket.on('participant:left', function (data) {
|
|
609
627
|
_this2.emit('participant:left', data);
|
|
610
628
|
});
|
|
611
|
-
this.socket.on('participant:updated', function (
|
|
612
|
-
var sessionId =
|
|
613
|
-
timestamp =
|
|
614
|
-
data =
|
|
615
|
-
clientId =
|
|
629
|
+
this.socket.on('participant:updated', function (_ref7) {
|
|
630
|
+
var sessionId = _ref7.sessionId,
|
|
631
|
+
timestamp = _ref7.timestamp,
|
|
632
|
+
data = _ref7.data,
|
|
633
|
+
clientId = _ref7.clientId;
|
|
616
634
|
_this2.emit('participant:updated', _objectSpread({
|
|
617
635
|
sessionId: sessionId,
|
|
618
636
|
timestamp: timestamp,
|
|
@@ -628,10 +646,10 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
628
646
|
_this2.emit('status', data);
|
|
629
647
|
});
|
|
630
648
|
this.socket.on('disconnect', /*#__PURE__*/function () {
|
|
631
|
-
var
|
|
649
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(reason) {
|
|
632
650
|
var _this2$analyticsHelpe, reconnectionError;
|
|
633
|
-
return _regenerator.default.wrap(function
|
|
634
|
-
while (1) switch (
|
|
651
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
652
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
635
653
|
case 0:
|
|
636
654
|
_this2.connected = false;
|
|
637
655
|
logger("disconnect reason: ".concat(reason));
|
|
@@ -656,12 +674,12 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
656
674
|
}
|
|
657
675
|
case 4:
|
|
658
676
|
case "end":
|
|
659
|
-
return
|
|
677
|
+
return _context6.stop();
|
|
660
678
|
}
|
|
661
|
-
},
|
|
679
|
+
}, _callee6);
|
|
662
680
|
}));
|
|
663
|
-
return function (
|
|
664
|
-
return
|
|
681
|
+
return function (_x6) {
|
|
682
|
+
return _ref8.apply(this, arguments);
|
|
665
683
|
};
|
|
666
684
|
}());
|
|
667
685
|
|
|
@@ -27,6 +27,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
27
27
|
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; }
|
|
28
28
|
var CATCHUP_THROTTLE = 1 * 1000; // 1 second
|
|
29
29
|
|
|
30
|
+
var RESTRICTED_PRODUCTS = ['jcollab']; // restrict presence-only products
|
|
31
|
+
|
|
30
32
|
var noop = function noop() {};
|
|
31
33
|
var logger = (0, _utils.createLogger)('documentService', 'black');
|
|
32
34
|
var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
@@ -51,6 +53,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
51
53
|
var _this = this;
|
|
52
54
|
var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
53
55
|
var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : (0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue');
|
|
56
|
+
var url = arguments.length > 11 ? arguments[11] : undefined;
|
|
54
57
|
(0, _classCallCheck2.default)(this, DocumentService);
|
|
55
58
|
// Fires analytics to editor when collab editor cannot sync up
|
|
56
59
|
(0, _defineProperty2.default)(this, "stepRejectCounter", 0);
|
|
@@ -75,17 +78,25 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
75
78
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
76
79
|
while (1) switch (_context.prev = _context.next) {
|
|
77
80
|
case 0:
|
|
81
|
+
if (!(_this.url && RESTRICTED_PRODUCTS.some(function (productId) {
|
|
82
|
+
return _this.url.endsWith(productId);
|
|
83
|
+
}))) {
|
|
84
|
+
_context.next = 2;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return _context.abrupt("return");
|
|
88
|
+
case 2:
|
|
78
89
|
start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
|
|
79
90
|
if (!_this.stepQueue.isPaused()) {
|
|
80
|
-
_context.next =
|
|
91
|
+
_context.next = 6;
|
|
81
92
|
break;
|
|
82
93
|
}
|
|
83
94
|
logger("Queue is paused. Aborting.");
|
|
84
95
|
return _context.abrupt("return");
|
|
85
|
-
case
|
|
96
|
+
case 6:
|
|
86
97
|
_this.stepQueue.pauseQueue();
|
|
87
|
-
_context.prev =
|
|
88
|
-
_context.next =
|
|
98
|
+
_context.prev = 7;
|
|
99
|
+
_context.next = 10;
|
|
89
100
|
return (0, _catchup.catchup)({
|
|
90
101
|
getCurrentPmVersion: _this.getCurrentPmVersion,
|
|
91
102
|
fetchCatchup: _this.fetchCatchup,
|
|
@@ -97,32 +108,32 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
97
108
|
analyticsHelper: _this.analyticsHelper,
|
|
98
109
|
clientId: _this.clientId
|
|
99
110
|
});
|
|
100
|
-
case
|
|
111
|
+
case 10:
|
|
101
112
|
latency = new Date().getTime() - start;
|
|
102
113
|
(_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
|
|
103
114
|
latency: latency
|
|
104
115
|
});
|
|
105
|
-
_context.next =
|
|
116
|
+
_context.next = 18;
|
|
106
117
|
break;
|
|
107
|
-
case
|
|
108
|
-
_context.prev =
|
|
109
|
-
_context.t0 = _context["catch"](
|
|
118
|
+
case 14:
|
|
119
|
+
_context.prev = 14;
|
|
120
|
+
_context.t0 = _context["catch"](7);
|
|
110
121
|
_latency = new Date().getTime() - start;
|
|
111
122
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
|
|
112
123
|
latency: _latency
|
|
113
124
|
});
|
|
114
|
-
case
|
|
115
|
-
_context.prev =
|
|
125
|
+
case 18:
|
|
126
|
+
_context.prev = 18;
|
|
116
127
|
_this.stepQueue.resumeQueue();
|
|
117
128
|
_this.processQueue();
|
|
118
129
|
_this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
|
|
119
130
|
_this.stepRejectCounter = 0;
|
|
120
|
-
return _context.finish(
|
|
121
|
-
case
|
|
131
|
+
return _context.finish(18);
|
|
132
|
+
case 24:
|
|
122
133
|
case "end":
|
|
123
134
|
return _context.stop();
|
|
124
135
|
}
|
|
125
|
-
}, _callee, null, [[
|
|
136
|
+
}, _callee, null, [[7, 14, 18, 24]]);
|
|
126
137
|
})));
|
|
127
138
|
(0, _defineProperty2.default)(this, "getCurrentPmVersion", function () {
|
|
128
139
|
var _this$getState;
|
|
@@ -548,6 +559,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
548
559
|
this.metadataService = metadataService;
|
|
549
560
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
550
561
|
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
562
|
+
this.url = url;
|
|
551
563
|
this.stepQueue = new _stepQueueState.StepQueueState();
|
|
552
564
|
}
|
|
553
565
|
(0, _createClass2.default)(DocumentService, [{
|
|
@@ -267,7 +267,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
267
267
|
_this.metadataService = new _metadataService.MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
268
268
|
_this.documentService = new _documentService.DocumentService(_this.participantsService, _this.analyticsHelper, _this.channel.fetchCatchup, _this.channel.fetchReconcile, _this.emitCallback, _this.channel.broadcast, function () {
|
|
269
269
|
return _this.userId;
|
|
270
|
-
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, (0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue', _this.config.featureFlags));
|
|
270
|
+
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, (0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue', _this.config.featureFlags), _this.config.url);
|
|
271
271
|
_this.namespaceService = new _namespaceService.NamespaceService();
|
|
272
272
|
_this.api = new _api.Api(config, _this.documentService, _this.channel);
|
|
273
273
|
if ((0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue', _this.config.featureFlags)) {
|
|
@@ -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 = "9.
|
|
8
|
+
var version = exports.version = "9.22.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
package/dist/es2019/channel.js
CHANGED
|
@@ -392,11 +392,15 @@ export class Channel extends Emitter {
|
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
} else {
|
|
395
|
-
auth = {
|
|
396
|
-
//
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
auth = async cb => {
|
|
396
|
+
// Rebuild authData to ensure values are current
|
|
397
|
+
const authData = {
|
|
398
|
+
// The initialized status. If false, BE will send document, otherwise not.
|
|
399
|
+
initialized: this.initialized,
|
|
400
|
+
// ESS-1009 Allow to opt-in into 404 response
|
|
401
|
+
need404: this.config.need404
|
|
402
|
+
};
|
|
403
|
+
cb(authData);
|
|
400
404
|
};
|
|
401
405
|
}
|
|
402
406
|
this.socket = createSocket(`${url}/session/${documentAri}`, auth, this.config.productInfo);
|
|
@@ -14,6 +14,8 @@ import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
|
14
14
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
15
15
|
const CATCHUP_THROTTLE = 1 * 1000; // 1 second
|
|
16
16
|
|
|
17
|
+
const RESTRICTED_PRODUCTS = ['jcollab']; // restrict presence-only products
|
|
18
|
+
|
|
17
19
|
const noop = () => {};
|
|
18
20
|
const logger = createLogger('documentService', 'black');
|
|
19
21
|
export class DocumentService {
|
|
@@ -34,7 +36,7 @@ export class DocumentService {
|
|
|
34
36
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
35
37
|
* @param enableSendStepsQueue - Enable send steps queue.
|
|
36
38
|
*/
|
|
37
|
-
constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false, enableSendStepsQueue = getCollabProviderFeatureFlag('sendStepsQueue')) {
|
|
39
|
+
constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false, enableSendStepsQueue = getCollabProviderFeatureFlag('sendStepsQueue'), url) {
|
|
38
40
|
// Fires analytics to editor when collab editor cannot sync up
|
|
39
41
|
_defineProperty(this, "stepRejectCounter", 0);
|
|
40
42
|
_defineProperty(this, "aggressiveCatchup", false);
|
|
@@ -52,6 +54,10 @@ export class DocumentService {
|
|
|
52
54
|
* * try to accept steps but version is behind.
|
|
53
55
|
*/
|
|
54
56
|
_defineProperty(this, "catchup", async () => {
|
|
57
|
+
// Don't call catchup for presence-only products (e.g. jcollab)
|
|
58
|
+
if (this.url && RESTRICTED_PRODUCTS.some(productId => this.url.endsWith(productId))) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
55
61
|
const start = new Date().getTime();
|
|
56
62
|
// if the queue is already paused, we are busy with something else, so don't proceed.
|
|
57
63
|
if (this.stepQueue.isPaused()) {
|
|
@@ -460,6 +466,7 @@ export class DocumentService {
|
|
|
460
466
|
this.metadataService = metadataService;
|
|
461
467
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
462
468
|
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
469
|
+
this.url = url;
|
|
463
470
|
this.stepQueue = new StepQueueState();
|
|
464
471
|
}
|
|
465
472
|
processQueue() {
|
|
@@ -220,7 +220,7 @@ export class Provider extends Emitter {
|
|
|
220
220
|
this.isProviderInitialized = false;
|
|
221
221
|
this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId);
|
|
222
222
|
this.metadataService = new MetadataService(this.emitCallback, this.channel.sendMetadata);
|
|
223
|
-
this.documentService = new DocumentService(this.participantsService, this.analyticsHelper, this.channel.fetchCatchup, this.channel.fetchReconcile, this.emitCallback, this.channel.broadcast, () => this.userId, this.onErrorHandled, this.metadataService, this.config.enableErrorOnFailedDocumentApply, getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags));
|
|
223
|
+
this.documentService = new DocumentService(this.participantsService, this.analyticsHelper, this.channel.fetchCatchup, this.channel.fetchReconcile, this.emitCallback, this.channel.broadcast, () => this.userId, this.onErrorHandled, this.metadataService, this.config.enableErrorOnFailedDocumentApply, getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags), this.config.url);
|
|
224
224
|
this.namespaceService = new NamespaceService();
|
|
225
225
|
this.api = new Api(config, this.documentService, this.channel);
|
|
226
226
|
if (getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags)) {
|
package/dist/esm/channel.js
CHANGED
|
@@ -564,12 +564,30 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
564
564
|
};
|
|
565
565
|
}();
|
|
566
566
|
} else {
|
|
567
|
-
auth = {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
567
|
+
auth = /*#__PURE__*/function () {
|
|
568
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cb) {
|
|
569
|
+
var authData;
|
|
570
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
571
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
572
|
+
case 0:
|
|
573
|
+
// Rebuild authData to ensure values are current
|
|
574
|
+
authData = {
|
|
575
|
+
// The initialized status. If false, BE will send document, otherwise not.
|
|
576
|
+
initialized: _this2.initialized,
|
|
577
|
+
// ESS-1009 Allow to opt-in into 404 response
|
|
578
|
+
need404: _this2.config.need404
|
|
579
|
+
};
|
|
580
|
+
cb(authData);
|
|
581
|
+
case 2:
|
|
582
|
+
case "end":
|
|
583
|
+
return _context5.stop();
|
|
584
|
+
}
|
|
585
|
+
}, _callee5);
|
|
586
|
+
}));
|
|
587
|
+
return function auth(_x5) {
|
|
588
|
+
return _ref5.apply(this, arguments);
|
|
589
|
+
};
|
|
590
|
+
}();
|
|
573
591
|
}
|
|
574
592
|
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo);
|
|
575
593
|
|
|
@@ -584,9 +602,9 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
584
602
|
this.socket.on('steps:added', function (data) {
|
|
585
603
|
_this2.emit('steps:added', data);
|
|
586
604
|
});
|
|
587
|
-
this.socket.on('participant:telepointer', function (
|
|
588
|
-
var timestamp =
|
|
589
|
-
data =
|
|
605
|
+
this.socket.on('participant:telepointer', function (_ref6) {
|
|
606
|
+
var timestamp = _ref6.timestamp,
|
|
607
|
+
data = _ref6.data;
|
|
590
608
|
// data is TelepointerPayload without timestamp
|
|
591
609
|
_this2.emit('participant:telepointer', _objectSpread({
|
|
592
610
|
timestamp: timestamp
|
|
@@ -601,11 +619,11 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
601
619
|
this.socket.on('participant:left', function (data) {
|
|
602
620
|
_this2.emit('participant:left', data);
|
|
603
621
|
});
|
|
604
|
-
this.socket.on('participant:updated', function (
|
|
605
|
-
var sessionId =
|
|
606
|
-
timestamp =
|
|
607
|
-
data =
|
|
608
|
-
clientId =
|
|
622
|
+
this.socket.on('participant:updated', function (_ref7) {
|
|
623
|
+
var sessionId = _ref7.sessionId,
|
|
624
|
+
timestamp = _ref7.timestamp,
|
|
625
|
+
data = _ref7.data,
|
|
626
|
+
clientId = _ref7.clientId;
|
|
609
627
|
_this2.emit('participant:updated', _objectSpread({
|
|
610
628
|
sessionId: sessionId,
|
|
611
629
|
timestamp: timestamp,
|
|
@@ -621,10 +639,10 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
621
639
|
_this2.emit('status', data);
|
|
622
640
|
});
|
|
623
641
|
this.socket.on('disconnect', /*#__PURE__*/function () {
|
|
624
|
-
var
|
|
642
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(reason) {
|
|
625
643
|
var _this2$analyticsHelpe, reconnectionError;
|
|
626
|
-
return _regeneratorRuntime.wrap(function
|
|
627
|
-
while (1) switch (
|
|
644
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
645
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
628
646
|
case 0:
|
|
629
647
|
_this2.connected = false;
|
|
630
648
|
logger("disconnect reason: ".concat(reason));
|
|
@@ -649,12 +667,12 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
649
667
|
}
|
|
650
668
|
case 4:
|
|
651
669
|
case "end":
|
|
652
|
-
return
|
|
670
|
+
return _context6.stop();
|
|
653
671
|
}
|
|
654
|
-
},
|
|
672
|
+
}, _callee6);
|
|
655
673
|
}));
|
|
656
|
-
return function (
|
|
657
|
-
return
|
|
674
|
+
return function (_x6) {
|
|
675
|
+
return _ref8.apply(this, arguments);
|
|
658
676
|
};
|
|
659
677
|
}());
|
|
660
678
|
|
|
@@ -20,6 +20,8 @@ import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
|
20
20
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
21
21
|
var CATCHUP_THROTTLE = 1 * 1000; // 1 second
|
|
22
22
|
|
|
23
|
+
var RESTRICTED_PRODUCTS = ['jcollab']; // restrict presence-only products
|
|
24
|
+
|
|
23
25
|
var noop = function noop() {};
|
|
24
26
|
var logger = createLogger('documentService', 'black');
|
|
25
27
|
export var DocumentService = /*#__PURE__*/function () {
|
|
@@ -44,6 +46,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
44
46
|
var _this = this;
|
|
45
47
|
var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
46
48
|
var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : getCollabProviderFeatureFlag('sendStepsQueue');
|
|
49
|
+
var url = arguments.length > 11 ? arguments[11] : undefined;
|
|
47
50
|
_classCallCheck(this, DocumentService);
|
|
48
51
|
// Fires analytics to editor when collab editor cannot sync up
|
|
49
52
|
_defineProperty(this, "stepRejectCounter", 0);
|
|
@@ -68,17 +71,25 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
68
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
72
|
while (1) switch (_context.prev = _context.next) {
|
|
70
73
|
case 0:
|
|
74
|
+
if (!(_this.url && RESTRICTED_PRODUCTS.some(function (productId) {
|
|
75
|
+
return _this.url.endsWith(productId);
|
|
76
|
+
}))) {
|
|
77
|
+
_context.next = 2;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return _context.abrupt("return");
|
|
81
|
+
case 2:
|
|
71
82
|
start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
|
|
72
83
|
if (!_this.stepQueue.isPaused()) {
|
|
73
|
-
_context.next =
|
|
84
|
+
_context.next = 6;
|
|
74
85
|
break;
|
|
75
86
|
}
|
|
76
87
|
logger("Queue is paused. Aborting.");
|
|
77
88
|
return _context.abrupt("return");
|
|
78
|
-
case
|
|
89
|
+
case 6:
|
|
79
90
|
_this.stepQueue.pauseQueue();
|
|
80
|
-
_context.prev =
|
|
81
|
-
_context.next =
|
|
91
|
+
_context.prev = 7;
|
|
92
|
+
_context.next = 10;
|
|
82
93
|
return catchup({
|
|
83
94
|
getCurrentPmVersion: _this.getCurrentPmVersion,
|
|
84
95
|
fetchCatchup: _this.fetchCatchup,
|
|
@@ -90,32 +101,32 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
90
101
|
analyticsHelper: _this.analyticsHelper,
|
|
91
102
|
clientId: _this.clientId
|
|
92
103
|
});
|
|
93
|
-
case
|
|
104
|
+
case 10:
|
|
94
105
|
latency = new Date().getTime() - start;
|
|
95
106
|
(_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.SUCCESS, {
|
|
96
107
|
latency: latency
|
|
97
108
|
});
|
|
98
|
-
_context.next =
|
|
109
|
+
_context.next = 18;
|
|
99
110
|
break;
|
|
100
|
-
case
|
|
101
|
-
_context.prev =
|
|
102
|
-
_context.t0 = _context["catch"](
|
|
111
|
+
case 14:
|
|
112
|
+
_context.prev = 14;
|
|
113
|
+
_context.t0 = _context["catch"](7);
|
|
103
114
|
_latency = new Date().getTime() - start;
|
|
104
115
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
|
|
105
116
|
latency: _latency
|
|
106
117
|
});
|
|
107
|
-
case
|
|
108
|
-
_context.prev =
|
|
118
|
+
case 18:
|
|
119
|
+
_context.prev = 18;
|
|
109
120
|
_this.stepQueue.resumeQueue();
|
|
110
121
|
_this.processQueue();
|
|
111
122
|
_this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
|
|
112
123
|
_this.stepRejectCounter = 0;
|
|
113
|
-
return _context.finish(
|
|
114
|
-
case
|
|
124
|
+
return _context.finish(18);
|
|
125
|
+
case 24:
|
|
115
126
|
case "end":
|
|
116
127
|
return _context.stop();
|
|
117
128
|
}
|
|
118
|
-
}, _callee, null, [[
|
|
129
|
+
}, _callee, null, [[7, 14, 18, 24]]);
|
|
119
130
|
})));
|
|
120
131
|
_defineProperty(this, "getCurrentPmVersion", function () {
|
|
121
132
|
var _this$getState;
|
|
@@ -541,6 +552,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
541
552
|
this.metadataService = metadataService;
|
|
542
553
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
543
554
|
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
555
|
+
this.url = url;
|
|
544
556
|
this.stepQueue = new StepQueueState();
|
|
545
557
|
}
|
|
546
558
|
_createClass(DocumentService, [{
|
|
@@ -260,7 +260,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
260
260
|
_this.metadataService = new MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
261
261
|
_this.documentService = new DocumentService(_this.participantsService, _this.analyticsHelper, _this.channel.fetchCatchup, _this.channel.fetchReconcile, _this.emitCallback, _this.channel.broadcast, function () {
|
|
262
262
|
return _this.userId;
|
|
263
|
-
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, getCollabProviderFeatureFlag('sendStepsQueue', _this.config.featureFlags));
|
|
263
|
+
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, getCollabProviderFeatureFlag('sendStepsQueue', _this.config.featureFlags), _this.config.url);
|
|
264
264
|
_this.namespaceService = new NamespaceService();
|
|
265
265
|
_this.api = new Api(config, _this.documentService, _this.channel);
|
|
266
266
|
if (getCollabProviderFeatureFlag('sendStepsQueue', _this.config.featureFlags)) {
|
|
@@ -20,6 +20,7 @@ export declare class DocumentService {
|
|
|
20
20
|
private metadataService;
|
|
21
21
|
private enableErrorOnFailedDocumentApply;
|
|
22
22
|
private enableSendStepsQueue;
|
|
23
|
+
private url;
|
|
23
24
|
private getState;
|
|
24
25
|
private onSyncUpError?;
|
|
25
26
|
private stepQueue;
|
|
@@ -41,7 +42,7 @@ export declare class DocumentService {
|
|
|
41
42
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
42
43
|
* @param enableSendStepsQueue - Enable send steps queue.
|
|
43
44
|
*/
|
|
44
|
-
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number, clientId: number | string | undefined) => Promise<CatchupResponse>, fetchReconcile: (currentStateDoc: string) => Promise<ReconcileResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, enableErrorOnFailedDocumentApply
|
|
45
|
+
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number, clientId: number | string | undefined) => Promise<CatchupResponse>, fetchReconcile: (currentStateDoc: string) => Promise<ReconcileResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, enableErrorOnFailedDocumentApply: boolean, enableSendStepsQueue: boolean, url: string);
|
|
45
46
|
/**
|
|
46
47
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
47
48
|
*/
|
package/dist/types/types.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export interface Config {
|
|
|
60
60
|
* throwing a non-recoverable error if it's detected.
|
|
61
61
|
*/
|
|
62
62
|
enableErrorOnFailedDocumentApply?: boolean;
|
|
63
|
+
enableSendStepsQueue?: boolean;
|
|
63
64
|
/**
|
|
64
65
|
* Configure the client side circuit breaker in the event that abnormal behaviour causes the client to flood
|
|
65
66
|
* NCS with too many steps or too large a volume of data. This can result in either a soft fail or a hard (fatal) fail
|
|
@@ -20,6 +20,7 @@ export declare class DocumentService {
|
|
|
20
20
|
private metadataService;
|
|
21
21
|
private enableErrorOnFailedDocumentApply;
|
|
22
22
|
private enableSendStepsQueue;
|
|
23
|
+
private url;
|
|
23
24
|
private getState;
|
|
24
25
|
private onSyncUpError?;
|
|
25
26
|
private stepQueue;
|
|
@@ -41,7 +42,7 @@ export declare class DocumentService {
|
|
|
41
42
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
42
43
|
* @param enableSendStepsQueue - Enable send steps queue.
|
|
43
44
|
*/
|
|
44
|
-
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number, clientId: number | string | undefined) => Promise<CatchupResponse>, fetchReconcile: (currentStateDoc: string) => Promise<ReconcileResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, enableErrorOnFailedDocumentApply
|
|
45
|
+
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchup: (fromVersion: number, clientId: number | string | undefined) => Promise<CatchupResponse>, fetchReconcile: (currentStateDoc: string) => Promise<ReconcileResponse>, providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, getUserId: () => string | undefined, onErrorHandled: (error: InternalError) => void, metadataService: MetadataService, enableErrorOnFailedDocumentApply: boolean, enableSendStepsQueue: boolean, url: string);
|
|
45
46
|
/**
|
|
46
47
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
47
48
|
*/
|
|
@@ -60,6 +60,7 @@ export interface Config {
|
|
|
60
60
|
* throwing a non-recoverable error if it's detected.
|
|
61
61
|
*/
|
|
62
62
|
enableErrorOnFailedDocumentApply?: boolean;
|
|
63
|
+
enableSendStepsQueue?: boolean;
|
|
63
64
|
/**
|
|
64
65
|
* Configure the client side circuit breaker in the event that abnormal behaviour causes the client to flood
|
|
65
66
|
* NCS with too many steps or too large a volume of data. This can result in either a soft fail or a hard (fatal) fail
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.22.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
38
38
|
"@atlaskit/analytics-listeners": "^8.9.0",
|
|
39
|
-
"@atlaskit/editor-common": "^76.
|
|
39
|
+
"@atlaskit/editor-common": "^76.40.0",
|
|
40
40
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
42
42
|
"@atlaskit/ufo": "^0.2.0",
|