@atlaskit/collab-provider 9.15.5 → 9.16.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 +12 -0
- package/dist/cjs/document/document-service.js +39 -15
- package/dist/cjs/feature-flags/index.js +4 -2
- package/dist/cjs/helpers/const.js +2 -1
- package/dist/cjs/provider/index.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +39 -16
- package/dist/es2019/feature-flags/index.js +4 -2
- package/dist/es2019/helpers/const.js +2 -1
- package/dist/es2019/provider/index.js +2 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +39 -15
- package/dist/esm/feature-flags/index.js +4 -2
- package/dist/esm/helpers/const.js +2 -1
- package/dist/esm/provider/index.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +2 -1
- package/dist/types/feature-flags/types.d.ts +1 -0
- package/dist/types/helpers/const.d.ts +9 -2
- package/dist/types-ts4.5/document/document-service.d.ts +2 -1
- package/dist/types-ts4.5/feature-flags/types.d.ts +1 -0
- package/dist/types-ts4.5/helpers/const.d.ts +9 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 9.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43417](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43417) [`3f3c17f0273`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3f3c17f0273) - ED-20971 Upgrade adf-schema package to ^34.0.0
|
|
8
|
+
|
|
9
|
+
## 9.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#43426](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43426) [`850d2e49924`](https://bitbucket.org/atlassian/atlassian-frontend/commits/850d2e49924) - Add feature flag for send steps queue
|
|
14
|
+
|
|
3
15
|
## 9.15.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -47,6 +47,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
47
47
|
function DocumentService(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService) {
|
|
48
48
|
var _this = this;
|
|
49
49
|
var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
50
|
+
var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
50
51
|
(0, _classCallCheck2.default)(this, DocumentService);
|
|
51
52
|
// Fires analytics to editor when collab editor cannot sync up
|
|
52
53
|
(0, _defineProperty2.default)(this, "stepRejectCounter", 0);
|
|
@@ -531,6 +532,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
531
532
|
this.onErrorHandled = onErrorHandled;
|
|
532
533
|
this.metadataService = metadataService;
|
|
533
534
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
535
|
+
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
534
536
|
this.stepQueue = new _stepQueueState.StepQueueState();
|
|
535
537
|
}
|
|
536
538
|
(0, _createClass2.default)(DocumentService, [{
|
|
@@ -648,21 +650,43 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
648
650
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
649
651
|
return;
|
|
650
652
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
653
|
+
if (this.enableSendStepsQueue) {
|
|
654
|
+
// This is where we would call the sendStepsQueue instead of throttledCommitStep
|
|
655
|
+
// Only send 1% of events to avoid useless logging
|
|
656
|
+
if (Math.random() < 0.01) {
|
|
657
|
+
var _this$analyticsHelper28;
|
|
658
|
+
(_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_QUEUE, _const.EVENT_STATUS.INFO);
|
|
659
|
+
}
|
|
660
|
+
// Avoid reference issues using a
|
|
661
|
+
// method outside of the provider
|
|
662
|
+
// scope
|
|
663
|
+
(0, _commitStep.throttledCommitStep)({
|
|
664
|
+
broadcast: this.broadcast,
|
|
665
|
+
userId: this.getUserId(),
|
|
666
|
+
clientId: this.clientId,
|
|
667
|
+
steps: unconfirmedSteps,
|
|
668
|
+
version: version,
|
|
669
|
+
onStepsAdded: this.onStepsAdded,
|
|
670
|
+
onErrorHandled: this.onErrorHandled,
|
|
671
|
+
analyticsHelper: this.analyticsHelper,
|
|
672
|
+
emit: this.providerEmitCallback
|
|
673
|
+
});
|
|
674
|
+
} else {
|
|
675
|
+
// Avoid reference issues using a
|
|
676
|
+
// method outside of the provider
|
|
677
|
+
// scope
|
|
678
|
+
(0, _commitStep.throttledCommitStep)({
|
|
679
|
+
broadcast: this.broadcast,
|
|
680
|
+
userId: this.getUserId(),
|
|
681
|
+
clientId: this.clientId,
|
|
682
|
+
steps: unconfirmedSteps,
|
|
683
|
+
version: version,
|
|
684
|
+
onStepsAdded: this.onStepsAdded,
|
|
685
|
+
onErrorHandled: this.onErrorHandled,
|
|
686
|
+
analyticsHelper: this.analyticsHelper,
|
|
687
|
+
emit: this.providerEmitCallback
|
|
688
|
+
});
|
|
689
|
+
}
|
|
666
690
|
}
|
|
667
691
|
}]);
|
|
668
692
|
return DocumentService;
|
|
@@ -9,7 +9,8 @@ exports.getProductSpecificFeatureFlags = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var defaultNCSFeatureFlags = {
|
|
11
11
|
testFF: false,
|
|
12
|
-
socketMessageMetricsFF: false
|
|
12
|
+
socketMessageMetricsFF: false,
|
|
13
|
+
sendStepsQueueFF: false
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -18,7 +19,8 @@ var defaultNCSFeatureFlags = {
|
|
|
18
19
|
var productKeys = {
|
|
19
20
|
confluence: {
|
|
20
21
|
testFF: 'confluence.frontend.collab.provider.testFF',
|
|
21
|
-
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF'
|
|
22
|
+
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF',
|
|
23
|
+
sendStepsQueueFF: 'confluence.frontend.collab.provider.sendStepsQueueFF'
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
var filterFeatureFlagNames = function filterFeatureFlagNames(flags) {
|
|
@@ -23,8 +23,9 @@ var EVENT_ACTION = exports.EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
23
23
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
24
24
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
25
25
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
26
|
+
EVENT_ACTION["SEND_STEPS_QUEUE"] = "sendStepsQueue";
|
|
26
27
|
return EVENT_ACTION;
|
|
27
|
-
}({}); //
|
|
28
|
+
}({}); // Temporary, used to confirm feature flag
|
|
28
29
|
var EVENT_STATUS = exports.EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
29
30
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
30
31
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -27,6 +27,7 @@ var _namespaceService = require("../namespace/namespace-service");
|
|
|
27
27
|
var _participantsService = require("../participants/participants-service");
|
|
28
28
|
var _errorCodeMapper = require("../errors/error-code-mapper");
|
|
29
29
|
var _const = require("../helpers/const");
|
|
30
|
+
var _featureFlags = require("../feature-flags");
|
|
30
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
32
33
|
var logger = (0, _utils.createLogger)('Provider', 'black');
|
|
@@ -268,7 +269,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
268
269
|
_this.metadataService = new _metadataService.MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
269
270
|
_this.documentService = new _documentService.DocumentService(_this.participantsService, _this.analyticsHelper, _this.channel.fetchCatchup, _this.channel.fetchReconcile, _this.emitCallback, _this.channel.broadcast, function () {
|
|
270
271
|
return _this.userId;
|
|
271
|
-
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply);
|
|
272
|
+
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, (0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueueFF', _this.config.featureFlags));
|
|
272
273
|
_this.namespaceService = new _namespaceService.NamespaceService();
|
|
273
274
|
return _this;
|
|
274
275
|
}
|
|
@@ -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.16.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -31,7 +31,7 @@ export class DocumentService {
|
|
|
31
31
|
* @param metadataService
|
|
32
32
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
33
33
|
*/
|
|
34
|
-
constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false) {
|
|
34
|
+
constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false, enableSendStepsQueue = false) {
|
|
35
35
|
// Fires analytics to editor when collab editor cannot sync up
|
|
36
36
|
_defineProperty(this, "stepRejectCounter", 0);
|
|
37
37
|
_defineProperty(this, "aggressiveCatchup", false);
|
|
@@ -442,6 +442,7 @@ export class DocumentService {
|
|
|
442
442
|
this.onErrorHandled = onErrorHandled;
|
|
443
443
|
this.metadataService = metadataService;
|
|
444
444
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
445
|
+
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
445
446
|
this.stepQueue = new StepQueueState();
|
|
446
447
|
}
|
|
447
448
|
processQueue() {
|
|
@@ -547,20 +548,42 @@ export class DocumentService {
|
|
|
547
548
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
548
549
|
return;
|
|
549
550
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
551
|
+
if (this.enableSendStepsQueue) {
|
|
552
|
+
// This is where we would call the sendStepsQueue instead of throttledCommitStep
|
|
553
|
+
// Only send 1% of events to avoid useless logging
|
|
554
|
+
if (Math.random() < 0.01) {
|
|
555
|
+
var _this$analyticsHelper28;
|
|
556
|
+
(_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 ? void 0 : _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
|
|
557
|
+
}
|
|
558
|
+
// Avoid reference issues using a
|
|
559
|
+
// method outside of the provider
|
|
560
|
+
// scope
|
|
561
|
+
throttledCommitStep({
|
|
562
|
+
broadcast: this.broadcast,
|
|
563
|
+
userId: this.getUserId(),
|
|
564
|
+
clientId: this.clientId,
|
|
565
|
+
steps: unconfirmedSteps,
|
|
566
|
+
version,
|
|
567
|
+
onStepsAdded: this.onStepsAdded,
|
|
568
|
+
onErrorHandled: this.onErrorHandled,
|
|
569
|
+
analyticsHelper: this.analyticsHelper,
|
|
570
|
+
emit: this.providerEmitCallback
|
|
571
|
+
});
|
|
572
|
+
} else {
|
|
573
|
+
// Avoid reference issues using a
|
|
574
|
+
// method outside of the provider
|
|
575
|
+
// scope
|
|
576
|
+
throttledCommitStep({
|
|
577
|
+
broadcast: this.broadcast,
|
|
578
|
+
userId: this.getUserId(),
|
|
579
|
+
clientId: this.clientId,
|
|
580
|
+
steps: unconfirmedSteps,
|
|
581
|
+
version,
|
|
582
|
+
onStepsAdded: this.onStepsAdded,
|
|
583
|
+
onErrorHandled: this.onErrorHandled,
|
|
584
|
+
analyticsHelper: this.analyticsHelper,
|
|
585
|
+
emit: this.providerEmitCallback
|
|
586
|
+
});
|
|
587
|
+
}
|
|
565
588
|
}
|
|
566
589
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const defaultNCSFeatureFlags = {
|
|
2
2
|
testFF: false,
|
|
3
|
-
socketMessageMetricsFF: false
|
|
3
|
+
socketMessageMetricsFF: false,
|
|
4
|
+
sendStepsQueueFF: false
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -9,7 +10,8 @@ const defaultNCSFeatureFlags = {
|
|
|
9
10
|
const productKeys = {
|
|
10
11
|
confluence: {
|
|
11
12
|
testFF: 'confluence.frontend.collab.provider.testFF',
|
|
12
|
-
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF'
|
|
13
|
+
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF',
|
|
14
|
+
sendStepsQueueFF: 'confluence.frontend.collab.provider.sendStepsQueueFF'
|
|
13
15
|
}
|
|
14
16
|
};
|
|
15
17
|
const filterFeatureFlagNames = flags => {
|
|
@@ -17,8 +17,9 @@ export let EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
17
17
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
18
18
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
19
19
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
20
|
+
EVENT_ACTION["SEND_STEPS_QUEUE"] = "sendStepsQueue";
|
|
20
21
|
return EVENT_ACTION;
|
|
21
|
-
}({}); //
|
|
22
|
+
}({}); // Temporary, used to confirm feature flag
|
|
22
23
|
export let EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
23
24
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
24
25
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -11,6 +11,7 @@ import { NamespaceService } from '../namespace/namespace-service';
|
|
|
11
11
|
import { ParticipantsService } from '../participants/participants-service';
|
|
12
12
|
import { errorCodeMapper } from '../errors/error-code-mapper';
|
|
13
13
|
import { EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
14
|
+
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
14
15
|
const logger = createLogger('Provider', 'black');
|
|
15
16
|
const OUT_OF_SYNC_PERIOD = 3 * 1000; // 3 seconds
|
|
16
17
|
const PRELOAD_DRAFT_SYNC_PERIOD = 15 * 1000; // 15 seconds
|
|
@@ -221,7 +222,7 @@ export class Provider extends Emitter {
|
|
|
221
222
|
this.isProviderInitialized = false;
|
|
222
223
|
this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId);
|
|
223
224
|
this.metadataService = new MetadataService(this.emitCallback, this.channel.sendMetadata);
|
|
224
|
-
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);
|
|
225
|
+
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('sendStepsQueueFF', this.config.featureFlags));
|
|
225
226
|
this.namespaceService = new NamespaceService();
|
|
226
227
|
}
|
|
227
228
|
/**
|
|
@@ -40,6 +40,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
40
40
|
function DocumentService(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService) {
|
|
41
41
|
var _this = this;
|
|
42
42
|
var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
43
|
+
var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
43
44
|
_classCallCheck(this, DocumentService);
|
|
44
45
|
// Fires analytics to editor when collab editor cannot sync up
|
|
45
46
|
_defineProperty(this, "stepRejectCounter", 0);
|
|
@@ -524,6 +525,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
524
525
|
this.onErrorHandled = onErrorHandled;
|
|
525
526
|
this.metadataService = metadataService;
|
|
526
527
|
this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
|
|
528
|
+
this.enableSendStepsQueue = enableSendStepsQueue;
|
|
527
529
|
this.stepQueue = new StepQueueState();
|
|
528
530
|
}
|
|
529
531
|
_createClass(DocumentService, [{
|
|
@@ -641,21 +643,43 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
641
643
|
if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
|
|
642
644
|
return;
|
|
643
645
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
646
|
+
if (this.enableSendStepsQueue) {
|
|
647
|
+
// This is where we would call the sendStepsQueue instead of throttledCommitStep
|
|
648
|
+
// Only send 1% of events to avoid useless logging
|
|
649
|
+
if (Math.random() < 0.01) {
|
|
650
|
+
var _this$analyticsHelper28;
|
|
651
|
+
(_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
|
|
652
|
+
}
|
|
653
|
+
// Avoid reference issues using a
|
|
654
|
+
// method outside of the provider
|
|
655
|
+
// scope
|
|
656
|
+
throttledCommitStep({
|
|
657
|
+
broadcast: this.broadcast,
|
|
658
|
+
userId: this.getUserId(),
|
|
659
|
+
clientId: this.clientId,
|
|
660
|
+
steps: unconfirmedSteps,
|
|
661
|
+
version: version,
|
|
662
|
+
onStepsAdded: this.onStepsAdded,
|
|
663
|
+
onErrorHandled: this.onErrorHandled,
|
|
664
|
+
analyticsHelper: this.analyticsHelper,
|
|
665
|
+
emit: this.providerEmitCallback
|
|
666
|
+
});
|
|
667
|
+
} else {
|
|
668
|
+
// Avoid reference issues using a
|
|
669
|
+
// method outside of the provider
|
|
670
|
+
// scope
|
|
671
|
+
throttledCommitStep({
|
|
672
|
+
broadcast: this.broadcast,
|
|
673
|
+
userId: this.getUserId(),
|
|
674
|
+
clientId: this.clientId,
|
|
675
|
+
steps: unconfirmedSteps,
|
|
676
|
+
version: version,
|
|
677
|
+
onStepsAdded: this.onStepsAdded,
|
|
678
|
+
onErrorHandled: this.onErrorHandled,
|
|
679
|
+
analyticsHelper: this.analyticsHelper,
|
|
680
|
+
emit: this.providerEmitCallback
|
|
681
|
+
});
|
|
682
|
+
}
|
|
659
683
|
}
|
|
660
684
|
}]);
|
|
661
685
|
return DocumentService;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
var defaultNCSFeatureFlags = {
|
|
3
3
|
testFF: false,
|
|
4
|
-
socketMessageMetricsFF: false
|
|
4
|
+
socketMessageMetricsFF: false,
|
|
5
|
+
sendStepsQueueFF: false
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -10,7 +11,8 @@ var defaultNCSFeatureFlags = {
|
|
|
10
11
|
var productKeys = {
|
|
11
12
|
confluence: {
|
|
12
13
|
testFF: 'confluence.frontend.collab.provider.testFF',
|
|
13
|
-
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF'
|
|
14
|
+
socketMessageMetricsFF: 'confluence.frontend.collab.provider.socketMessageMetricsFF',
|
|
15
|
+
sendStepsQueueFF: 'confluence.frontend.collab.provider.sendStepsQueueFF'
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
18
|
var filterFeatureFlagNames = function filterFeatureFlagNames(flags) {
|
|
@@ -17,8 +17,9 @@ export var EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
|
|
|
17
17
|
EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
|
|
18
18
|
EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
|
|
19
19
|
EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
|
|
20
|
+
EVENT_ACTION["SEND_STEPS_QUEUE"] = "sendStepsQueue";
|
|
20
21
|
return EVENT_ACTION;
|
|
21
|
-
}({}); //
|
|
22
|
+
}({}); // Temporary, used to confirm feature flag
|
|
22
23
|
export var EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
23
24
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
24
25
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
@@ -22,6 +22,7 @@ import { NamespaceService } from '../namespace/namespace-service';
|
|
|
22
22
|
import { ParticipantsService } from '../participants/participants-service';
|
|
23
23
|
import { errorCodeMapper } from '../errors/error-code-mapper';
|
|
24
24
|
import { EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
25
|
+
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
25
26
|
var logger = createLogger('Provider', 'black');
|
|
26
27
|
var OUT_OF_SYNC_PERIOD = 3 * 1000; // 3 seconds
|
|
27
28
|
var PRELOAD_DRAFT_SYNC_PERIOD = 15 * 1000; // 15 seconds
|
|
@@ -261,7 +262,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
261
262
|
_this.metadataService = new MetadataService(_this.emitCallback, _this.channel.sendMetadata);
|
|
262
263
|
_this.documentService = new DocumentService(_this.participantsService, _this.analyticsHelper, _this.channel.fetchCatchup, _this.channel.fetchReconcile, _this.emitCallback, _this.channel.broadcast, function () {
|
|
263
264
|
return _this.userId;
|
|
264
|
-
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply);
|
|
265
|
+
}, _this.onErrorHandled, _this.metadataService, _this.config.enableErrorOnFailedDocumentApply, getCollabProviderFeatureFlag('sendStepsQueueFF', _this.config.featureFlags));
|
|
265
266
|
_this.namespaceService = new NamespaceService();
|
|
266
267
|
return _this;
|
|
267
268
|
}
|
|
@@ -19,6 +19,7 @@ export declare class DocumentService {
|
|
|
19
19
|
private onErrorHandled;
|
|
20
20
|
private metadataService;
|
|
21
21
|
private enableErrorOnFailedDocumentApply;
|
|
22
|
+
private enableSendStepsQueue;
|
|
22
23
|
private getState;
|
|
23
24
|
private onSyncUpError?;
|
|
24
25
|
private stepQueue;
|
|
@@ -39,7 +40,7 @@ export declare class DocumentService {
|
|
|
39
40
|
* @param metadataService
|
|
40
41
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
41
42
|
*/
|
|
42
|
-
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);
|
|
43
|
+
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);
|
|
43
44
|
/**
|
|
44
45
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
45
46
|
*/
|
|
@@ -17,7 +17,8 @@ export declare enum EVENT_ACTION {
|
|
|
17
17
|
WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",
|
|
18
18
|
PROVIDER_INITIALIZED = "providerInitialized",
|
|
19
19
|
PROVIDER_SETUP = "providerSetup",
|
|
20
|
-
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
|
|
20
|
+
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps",
|
|
21
|
+
SEND_STEPS_QUEUE = "sendStepsQueue"
|
|
21
22
|
}
|
|
22
23
|
export declare enum EVENT_STATUS {
|
|
23
24
|
SUCCESS = "SUCCESS",
|
|
@@ -254,7 +255,13 @@ type ProviderHasUnconfirmedStepsAnalyticsEvent = {
|
|
|
254
255
|
numUnconfirmedSteps: number;
|
|
255
256
|
};
|
|
256
257
|
};
|
|
257
|
-
|
|
258
|
+
type SendStepsQueueAnalyticsEvent = {
|
|
259
|
+
eventAction: EVENT_ACTION.SEND_STEPS_QUEUE;
|
|
260
|
+
attributes: {
|
|
261
|
+
documentAri?: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | SendStepsQueueAnalyticsEvent;
|
|
258
265
|
export declare const ACK_MAX_TRY = 60;
|
|
259
266
|
export declare const CONFLUENCE = "confluence";
|
|
260
267
|
export {};
|
|
@@ -19,6 +19,7 @@ export declare class DocumentService {
|
|
|
19
19
|
private onErrorHandled;
|
|
20
20
|
private metadataService;
|
|
21
21
|
private enableErrorOnFailedDocumentApply;
|
|
22
|
+
private enableSendStepsQueue;
|
|
22
23
|
private getState;
|
|
23
24
|
private onSyncUpError?;
|
|
24
25
|
private stepQueue;
|
|
@@ -39,7 +40,7 @@ export declare class DocumentService {
|
|
|
39
40
|
* @param metadataService
|
|
40
41
|
* @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
|
|
41
42
|
*/
|
|
42
|
-
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);
|
|
43
|
+
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);
|
|
43
44
|
/**
|
|
44
45
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
45
46
|
*/
|
|
@@ -17,7 +17,8 @@ export declare enum EVENT_ACTION {
|
|
|
17
17
|
WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",
|
|
18
18
|
PROVIDER_INITIALIZED = "providerInitialized",
|
|
19
19
|
PROVIDER_SETUP = "providerSetup",
|
|
20
|
-
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
|
|
20
|
+
HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps",
|
|
21
|
+
SEND_STEPS_QUEUE = "sendStepsQueue"
|
|
21
22
|
}
|
|
22
23
|
export declare enum EVENT_STATUS {
|
|
23
24
|
SUCCESS = "SUCCESS",
|
|
@@ -254,7 +255,13 @@ type ProviderHasUnconfirmedStepsAnalyticsEvent = {
|
|
|
254
255
|
numUnconfirmedSteps: number;
|
|
255
256
|
};
|
|
256
257
|
};
|
|
257
|
-
|
|
258
|
+
type SendStepsQueueAnalyticsEvent = {
|
|
259
|
+
eventAction: EVENT_ACTION.SEND_STEPS_QUEUE;
|
|
260
|
+
attributes: {
|
|
261
|
+
documentAri?: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | SendStepsQueueAnalyticsEvent;
|
|
258
265
|
export declare const ACK_MAX_TRY = 60;
|
|
259
266
|
export declare const CONFLUENCE = "confluence";
|
|
260
267
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.16.1",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@atlaskit/adf-schema": "^
|
|
65
|
+
"@atlaskit/adf-schema": "^34.0.0",
|
|
66
66
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
67
67
|
"typescript": "~4.9.5"
|
|
68
68
|
},
|