@atlaskit/collab-provider 9.22.4 → 9.22.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 9.22.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572) [`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) - Upgrading @atlaskit/editor-prosemirror dependency
8
+
9
+ ## 9.22.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#70399](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70399) [`01a501a213a4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01a501a213a4) - ESS-4082: cleanup sendStepsQueue FF
14
+
3
15
  ## 9.22.4
4
16
 
5
17
  ### Patch Changes
@@ -21,7 +21,6 @@ var _provider = require("../provider");
21
21
  var _commitStep = require("../provider/commit-step");
22
22
  var _catchup = require("./catchup");
23
23
  var _stepQueueState = require("./step-queue-state");
24
- var _featureFlags = require("../feature-flags");
25
24
  var _customErrors = require("../errors/custom-errors");
26
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
26
  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; }
@@ -45,12 +44,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
45
44
  * @param onErrorHandled - Callback to handle
46
45
  * @param metadataService
47
46
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
48
- * @param enableSendStepsQueue - Enable send steps queue.
49
47
  */
50
48
  function DocumentService(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService) {
51
49
  var _this = this;
52
50
  var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
53
- var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : (0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue');
54
51
  (0, _classCallCheck2.default)(this, DocumentService);
55
52
  // Fires analytics to editor when collab editor cannot sync up
56
53
  (0, _defineProperty2.default)(this, "stepRejectCounter", 0);
@@ -115,7 +112,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
115
112
  _context.prev = 16;
116
113
  _this.stepQueue.resumeQueue();
117
114
  _this.processQueue();
118
- _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
115
+ _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStepQueue which will either catchup on onStepsAdded or onErrorHandled
119
116
  _this.stepRejectCounter = 0;
120
117
  return _context.finish(16);
121
118
  case 22:
@@ -547,7 +544,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
547
544
  this.onErrorHandled = onErrorHandled;
548
545
  this.metadataService = metadataService;
549
546
  this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
550
- this.enableSendStepsQueue = enableSendStepsQueue;
551
547
  this.stepQueue = new _stepQueueState.StepQueueState();
552
548
  }
553
549
  (0, _createClass2.default)(DocumentService, [{
@@ -665,42 +661,26 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
665
661
  if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
666
662
  return;
667
663
  }
668
- if (this.enableSendStepsQueue) {
669
- // Only send 1% of events to avoid useless logging
670
- if (Math.random() < 0.01) {
671
- var _this$analyticsHelper29;
672
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_QUEUE, _const.EVENT_STATUS.INFO);
673
- }
674
- // Avoid reference issues using a
675
- // method outside of the provider
676
- // scope
677
- (0, _commitStep.commitStepQueue)({
678
- broadcast: this.broadcast,
679
- userId: this.getUserId(),
680
- clientId: this.clientId,
681
- steps: unconfirmedSteps,
682
- version: version,
683
- onStepsAdded: this.onStepsAdded,
684
- onErrorHandled: this.onErrorHandled,
685
- analyticsHelper: this.analyticsHelper,
686
- emit: this.providerEmitCallback
687
- });
688
- } else {
689
- // Avoid reference issues using a
690
- // method outside of the provider
691
- // scope
692
- (0, _commitStep.throttledCommitStep)({
693
- broadcast: this.broadcast,
694
- userId: this.getUserId(),
695
- clientId: this.clientId,
696
- steps: unconfirmedSteps,
697
- version: version,
698
- onStepsAdded: this.onStepsAdded,
699
- onErrorHandled: this.onErrorHandled,
700
- analyticsHelper: this.analyticsHelper,
701
- emit: this.providerEmitCallback
702
- });
664
+
665
+ // Only send 1% of events to avoid useless logging
666
+ if (Math.random() < 0.01) {
667
+ var _this$analyticsHelper29;
668
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_QUEUE, _const.EVENT_STATUS.INFO);
703
669
  }
670
+ // Avoid reference issues using a
671
+ // method outside of the provider
672
+ // scope
673
+ (0, _commitStep.commitStepQueue)({
674
+ broadcast: this.broadcast,
675
+ userId: this.getUserId(),
676
+ clientId: this.clientId,
677
+ steps: unconfirmedSteps,
678
+ version: version,
679
+ onStepsAdded: this.onStepsAdded,
680
+ onErrorHandled: this.onErrorHandled,
681
+ analyticsHelper: this.analyticsHelper,
682
+ emit: this.providerEmitCallback
683
+ });
704
684
  }
705
685
  }]);
706
686
  return DocumentService;
@@ -9,7 +9,6 @@ exports.getProductSpecificFeatureFlags = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var defaultNCSFeatureFlags = {
11
11
  testFF: false,
12
- sendStepsQueue: false,
13
12
  blockViewOnly: false
14
13
  };
15
14
 
@@ -19,7 +18,6 @@ var defaultNCSFeatureFlags = {
19
18
  var productKeys = {
20
19
  confluence: {
21
20
  testFF: 'confluence.frontend.collab.provider.testFF',
22
- sendStepsQueue: 'confluence.frontend.ncs.send-steps-queue',
23
21
  blockViewOnly: 'confluence.frontend.ncs.block-view-only'
24
22
  }
25
23
  };
@@ -4,17 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.throttledCommitStep = exports.readyToCommit = exports.commitStepQueue = exports.commitStep = exports.RESET_READYTOCOMMIT_INTERVAL_MS = void 0;
7
+ exports.readyToCommit = exports.commitStepQueue = exports.RESET_READYTOCOMMIT_INTERVAL_MS = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _countBy = _interopRequireDefault(require("lodash/countBy"));
10
- var _throttle = _interopRequireDefault(require("lodash/throttle"));
11
10
  var _const = require("../helpers/const");
12
11
  var _types = require("../types");
13
12
  var _ncsErrors = require("../errors/ncs-errors");
14
13
  var _utils = require("../helpers/utils");
15
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
15
  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; }
17
- var SEND_STEPS_THROTTLE = 500; // 0.5 second
18
16
  var logger = (0, _utils.createLogger)('commit-step', 'black');
19
17
  var readyToCommit = exports.readyToCommit = true;
20
18
  var RESET_READYTOCOMMIT_INTERVAL_MS = exports.RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
@@ -118,87 +116,4 @@ var commitStepQueue = exports.commitStepQueue = function commitStepQueue(_ref) {
118
116
  version: version
119
117
  });
120
118
  }
121
- };
122
- var commitStep = exports.commitStep = function commitStep(_ref2) {
123
- var broadcast = _ref2.broadcast,
124
- steps = _ref2.steps,
125
- version = _ref2.version,
126
- userId = _ref2.userId,
127
- clientId = _ref2.clientId,
128
- onStepsAdded = _ref2.onStepsAdded,
129
- onErrorHandled = _ref2.onErrorHandled,
130
- analyticsHelper = _ref2.analyticsHelper,
131
- emit = _ref2.emit;
132
- var stepsWithClientAndUserId = steps.map(function (step) {
133
- return _objectSpread(_objectSpread({}, step.toJSON()), {}, {
134
- clientId: clientId,
135
- userId: userId
136
- });
137
- });
138
- var start = new Date().getTime();
139
- emit('commit-status', {
140
- status: 'attempt',
141
- version: version
142
- });
143
- try {
144
- broadcast('steps:commit', {
145
- steps: stepsWithClientAndUserId,
146
- version: version,
147
- userId: userId
148
- }, function (response) {
149
- var latency = new Date().getTime() - start;
150
- if (response.type === _types.AcknowledgementResponseTypes.SUCCESS) {
151
- onStepsAdded({
152
- steps: stepsWithClientAndUserId,
153
- version: response.version
154
- });
155
- // Sample only 10% of add steps events to avoid overwhelming the analytics
156
- if (Math.random() < 0.1) {
157
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendActionEvent(_const.EVENT_ACTION.ADD_STEPS, _const.EVENT_STATUS.SUCCESS_10x_SAMPLED, {
158
- type: _const.ADD_STEPS_TYPE.ACCEPTED,
159
- latency: latency,
160
- stepType: (0, _countBy.default)(stepsWithClientAndUserId, function (stepWithClientAndUserId) {
161
- return stepWithClientAndUserId.stepType;
162
- })
163
- });
164
- }
165
- emit('commit-status', {
166
- status: 'success',
167
- version: response.version
168
- });
169
- } else if (response.type === _types.AcknowledgementResponseTypes.ERROR) {
170
- onErrorHandled(response.error);
171
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendActionEvent(_const.EVENT_ACTION.ADD_STEPS, _const.EVENT_STATUS.FAILURE, {
172
- // User tried committing steps but they were rejected because:
173
- // - HEAD_VERSION_UPDATE_FAILED: the collab service's latest stored step tail version didn't correspond to the head version of the first step submitted
174
- // - VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
175
- type: response.error.data.code === _ncsErrors.NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || response.error.data.code === _ncsErrors.NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS ? _const.ADD_STEPS_TYPE.REJECTED : _const.ADD_STEPS_TYPE.ERROR,
176
- latency: latency
177
- });
178
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(response.error, 'Error while adding steps - Acknowledgement Error');
179
- emit('commit-status', {
180
- status: 'failure',
181
- version: version
182
- });
183
- } else {
184
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(
185
- // @ts-expect-error We didn't type the invalid type case
186
- new Error("Response type: ".concat((response === null || response === void 0 ? void 0 : response.type) || 'No response type')), 'Error while adding steps - Invalid Acknowledgement');
187
- emit('commit-status', {
188
- status: 'failure',
189
- version: version
190
- });
191
- }
192
- });
193
- } catch (error) {
194
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(error, 'Error while adding steps - Broadcast threw exception');
195
- emit('commit-status', {
196
- status: 'failure',
197
- version: version
198
- });
199
- }
200
- };
201
- var throttledCommitStep = exports.throttledCommitStep = (0, _throttle.default)(commitStep, SEND_STEPS_THROTTLE, {
202
- leading: false,
203
- trailing: true
204
- });
119
+ };
@@ -267,15 +267,13 @@ 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);
271
271
  _this.namespaceService = new _namespaceService.NamespaceService();
272
272
  _this.api = new _api.Api(config, _this.documentService, _this.channel);
273
- if ((0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue', _this.config.featureFlags)) {
274
- _this.sendStepsTimer = setInterval(function () {
275
- logger('Intervally sendStepsFromCurrentState');
276
- _this.documentService.sendStepsFromCurrentState(true);
277
- }, 5000);
278
- }
273
+ _this.sendStepsTimer = setInterval(function () {
274
+ logger('Intervally sendStepsFromCurrentState');
275
+ _this.documentService.sendStepsFromCurrentState(true);
276
+ }, 5000);
279
277
  return _this;
280
278
  }
281
279
  (0, _createClass2.default)(Provider, [{
@@ -463,11 +461,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
463
461
  try {
464
462
  (0, _get2.default)((0, _getPrototypeOf2.default)(Provider.prototype), "unsubscribeAll", this).call(this);
465
463
  this.channel.disconnect();
466
- if ((0, _featureFlags.getCollabProviderFeatureFlag)('sendStepsQueue', this.config.featureFlags)) {
467
- if (this.sendStepsTimer) {
468
- clearInterval(this.sendStepsTimer);
469
- this.sendStepsTimer = undefined;
470
- }
464
+ if (this.sendStepsTimer) {
465
+ clearInterval(this.sendStepsTimer);
466
+ this.sendStepsTimer = undefined;
471
467
  }
472
468
  } catch (error) {
473
469
  var _this$analyticsHelper12;
@@ -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.22.4";
8
+ var version = exports.version = "9.22.6";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -7,10 +7,9 @@ import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performanc
7
7
  import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
8
8
  import { createLogger, getStepUGCFreeDetails, sleep } from '../helpers/utils';
9
9
  import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
10
- import { commitStepQueue, throttledCommitStep } from '../provider/commit-step';
10
+ import { commitStepQueue } from '../provider/commit-step';
11
11
  import { catchup } from './catchup';
12
12
  import { StepQueueState } from './step-queue-state';
13
- import { getCollabProviderFeatureFlag } from '../feature-flags';
14
13
  import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
15
14
  const CATCHUP_THROTTLE = 1 * 1000; // 1 second
16
15
 
@@ -32,9 +31,8 @@ export class DocumentService {
32
31
  * @param onErrorHandled - Callback to handle
33
32
  * @param metadataService
34
33
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
35
- * @param enableSendStepsQueue - Enable send steps queue.
36
34
  */
37
- constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false, enableSendStepsQueue = getCollabProviderFeatureFlag('sendStepsQueue')) {
35
+ constructor(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, enableErrorOnFailedDocumentApply = false) {
38
36
  // Fires analytics to editor when collab editor cannot sync up
39
37
  _defineProperty(this, "stepRejectCounter", 0);
40
38
  _defineProperty(this, "aggressiveCatchup", false);
@@ -85,7 +83,7 @@ export class DocumentService {
85
83
  } finally {
86
84
  this.stepQueue.resumeQueue();
87
85
  this.processQueue();
88
- this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
86
+ this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStepQueue which will either catchup on onStepsAdded or onErrorHandled
89
87
  this.stepRejectCounter = 0;
90
88
  }
91
89
  });
@@ -459,7 +457,6 @@ export class DocumentService {
459
457
  this.onErrorHandled = onErrorHandled;
460
458
  this.metadataService = metadataService;
461
459
  this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
462
- this.enableSendStepsQueue = enableSendStepsQueue;
463
460
  this.stepQueue = new StepQueueState();
464
461
  }
465
462
  processQueue() {
@@ -565,41 +562,25 @@ export class DocumentService {
565
562
  if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
566
563
  return;
567
564
  }
568
- if (this.enableSendStepsQueue) {
569
- // Only send 1% of events to avoid useless logging
570
- if (Math.random() < 0.01) {
571
- var _this$analyticsHelper29;
572
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
573
- }
574
- // Avoid reference issues using a
575
- // method outside of the provider
576
- // scope
577
- commitStepQueue({
578
- broadcast: this.broadcast,
579
- userId: this.getUserId(),
580
- clientId: this.clientId,
581
- steps: unconfirmedSteps,
582
- version,
583
- onStepsAdded: this.onStepsAdded,
584
- onErrorHandled: this.onErrorHandled,
585
- analyticsHelper: this.analyticsHelper,
586
- emit: this.providerEmitCallback
587
- });
588
- } else {
589
- // Avoid reference issues using a
590
- // method outside of the provider
591
- // scope
592
- throttledCommitStep({
593
- broadcast: this.broadcast,
594
- userId: this.getUserId(),
595
- clientId: this.clientId,
596
- steps: unconfirmedSteps,
597
- version,
598
- onStepsAdded: this.onStepsAdded,
599
- onErrorHandled: this.onErrorHandled,
600
- analyticsHelper: this.analyticsHelper,
601
- emit: this.providerEmitCallback
602
- });
565
+
566
+ // Only send 1% of events to avoid useless logging
567
+ if (Math.random() < 0.01) {
568
+ var _this$analyticsHelper29;
569
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
603
570
  }
571
+ // Avoid reference issues using a
572
+ // method outside of the provider
573
+ // scope
574
+ commitStepQueue({
575
+ broadcast: this.broadcast,
576
+ userId: this.getUserId(),
577
+ clientId: this.clientId,
578
+ steps: unconfirmedSteps,
579
+ version,
580
+ onStepsAdded: this.onStepsAdded,
581
+ onErrorHandled: this.onErrorHandled,
582
+ analyticsHelper: this.analyticsHelper,
583
+ emit: this.providerEmitCallback
584
+ });
604
585
  }
605
586
  }
@@ -1,6 +1,5 @@
1
1
  const defaultNCSFeatureFlags = {
2
2
  testFF: false,
3
- sendStepsQueue: false,
4
3
  blockViewOnly: false
5
4
  };
6
5
 
@@ -10,7 +9,6 @@ const defaultNCSFeatureFlags = {
10
9
  const productKeys = {
11
10
  confluence: {
12
11
  testFF: 'confluence.frontend.collab.provider.testFF',
13
- sendStepsQueue: 'confluence.frontend.ncs.send-steps-queue',
14
12
  blockViewOnly: 'confluence.frontend.ncs.block-view-only'
15
13
  }
16
14
  };
@@ -1,10 +1,8 @@
1
1
  import countBy from 'lodash/countBy';
2
- import throttle from 'lodash/throttle';
3
2
  import { ADD_STEPS_TYPE, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
4
3
  import { AcknowledgementResponseTypes } from '../types';
5
4
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
6
5
  import { createLogger } from '../helpers/utils';
7
- const SEND_STEPS_THROTTLE = 500; // 0.5 second
8
6
  const logger = createLogger('commit-step', 'black');
9
7
  export let readyToCommit = true;
10
8
  export const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
@@ -106,85 +104,4 @@ export const commitStepQueue = ({
106
104
  version
107
105
  });
108
106
  }
109
- };
110
- export const commitStep = ({
111
- broadcast,
112
- steps,
113
- version,
114
- userId,
115
- clientId,
116
- onStepsAdded,
117
- onErrorHandled,
118
- analyticsHelper,
119
- emit
120
- }) => {
121
- const stepsWithClientAndUserId = steps.map(step => ({
122
- ...step.toJSON(),
123
- clientId,
124
- userId
125
- }));
126
- const start = new Date().getTime();
127
- emit('commit-status', {
128
- status: 'attempt',
129
- version
130
- });
131
- try {
132
- broadcast('steps:commit', {
133
- steps: stepsWithClientAndUserId,
134
- version,
135
- userId
136
- }, response => {
137
- const latency = new Date().getTime() - start;
138
- if (response.type === AcknowledgementResponseTypes.SUCCESS) {
139
- onStepsAdded({
140
- steps: stepsWithClientAndUserId,
141
- version: response.version
142
- });
143
- // Sample only 10% of add steps events to avoid overwhelming the analytics
144
- if (Math.random() < 0.1) {
145
- analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.SUCCESS_10x_SAMPLED, {
146
- type: ADD_STEPS_TYPE.ACCEPTED,
147
- latency,
148
- stepType: countBy(stepsWithClientAndUserId, stepWithClientAndUserId => stepWithClientAndUserId.stepType)
149
- });
150
- }
151
- emit('commit-status', {
152
- status: 'success',
153
- version: response.version
154
- });
155
- } else if (response.type === AcknowledgementResponseTypes.ERROR) {
156
- onErrorHandled(response.error);
157
- analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.FAILURE, {
158
- // User tried committing steps but they were rejected because:
159
- // - HEAD_VERSION_UPDATE_FAILED: the collab service's latest stored step tail version didn't correspond to the head version of the first step submitted
160
- // - VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
161
- type: response.error.data.code === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || response.error.data.code === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS ? ADD_STEPS_TYPE.REJECTED : ADD_STEPS_TYPE.ERROR,
162
- latency
163
- });
164
- analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendErrorEvent(response.error, 'Error while adding steps - Acknowledgement Error');
165
- emit('commit-status', {
166
- status: 'failure',
167
- version
168
- });
169
- } else {
170
- analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendErrorEvent(
171
- // @ts-expect-error We didn't type the invalid type case
172
- new Error(`Response type: ${(response === null || response === void 0 ? void 0 : response.type) || 'No response type'}`), 'Error while adding steps - Invalid Acknowledgement');
173
- emit('commit-status', {
174
- status: 'failure',
175
- version
176
- });
177
- }
178
- });
179
- } catch (error) {
180
- analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendErrorEvent(error, 'Error while adding steps - Broadcast threw exception');
181
- emit('commit-status', {
182
- status: 'failure',
183
- version
184
- });
185
- }
186
- };
187
- export const throttledCommitStep = throttle(commitStep, SEND_STEPS_THROTTLE, {
188
- leading: false,
189
- trailing: true
190
- });
107
+ };
@@ -220,15 +220,13 @@ 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);
224
224
  this.namespaceService = new NamespaceService();
225
225
  this.api = new Api(config, this.documentService, this.channel);
226
- if (getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags)) {
227
- this.sendStepsTimer = setInterval(() => {
228
- logger('Intervally sendStepsFromCurrentState');
229
- this.documentService.sendStepsFromCurrentState(true);
230
- }, 5000);
231
- }
226
+ this.sendStepsTimer = setInterval(() => {
227
+ logger('Intervally sendStepsFromCurrentState');
228
+ this.documentService.sendStepsFromCurrentState(true);
229
+ }, 5000);
232
230
  }
233
231
  /**
234
232
  * Initialisation logic, called by Jira with a dummy getState function, deprecated in favour of the setup method which allows more configuration
@@ -395,11 +393,9 @@ export class Provider extends Emitter {
395
393
  try {
396
394
  super.unsubscribeAll();
397
395
  this.channel.disconnect();
398
- if (getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags)) {
399
- if (this.sendStepsTimer) {
400
- clearInterval(this.sendStepsTimer);
401
- this.sendStepsTimer = undefined;
402
- }
396
+ if (this.sendStepsTimer) {
397
+ clearInterval(this.sendStepsTimer);
398
+ this.sendStepsTimer = undefined;
403
399
  }
404
400
  } catch (error) {
405
401
  var _this$analyticsHelper12;
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "9.22.4";
2
+ export const version = "9.22.6";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -13,10 +13,9 @@ import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performanc
13
13
  import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
14
14
  import { createLogger, getStepUGCFreeDetails, sleep } from '../helpers/utils';
15
15
  import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
16
- import { commitStepQueue, throttledCommitStep } from '../provider/commit-step';
16
+ import { commitStepQueue } from '../provider/commit-step';
17
17
  import { catchup } from './catchup';
18
18
  import { StepQueueState } from './step-queue-state';
19
- import { getCollabProviderFeatureFlag } from '../feature-flags';
20
19
  import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
21
20
  var CATCHUP_THROTTLE = 1 * 1000; // 1 second
22
21
 
@@ -38,12 +37,10 @@ export var DocumentService = /*#__PURE__*/function () {
38
37
  * @param onErrorHandled - Callback to handle
39
38
  * @param metadataService
40
39
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
41
- * @param enableSendStepsQueue - Enable send steps queue.
42
40
  */
43
41
  function DocumentService(participantsService, analyticsHelper, fetchCatchup, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService) {
44
42
  var _this = this;
45
43
  var enableErrorOnFailedDocumentApply = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
46
- var enableSendStepsQueue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : getCollabProviderFeatureFlag('sendStepsQueue');
47
44
  _classCallCheck(this, DocumentService);
48
45
  // Fires analytics to editor when collab editor cannot sync up
49
46
  _defineProperty(this, "stepRejectCounter", 0);
@@ -108,7 +105,7 @@ export var DocumentService = /*#__PURE__*/function () {
108
105
  _context.prev = 16;
109
106
  _this.stepQueue.resumeQueue();
110
107
  _this.processQueue();
111
- _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
108
+ _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStepQueue which will either catchup on onStepsAdded or onErrorHandled
112
109
  _this.stepRejectCounter = 0;
113
110
  return _context.finish(16);
114
111
  case 22:
@@ -540,7 +537,6 @@ export var DocumentService = /*#__PURE__*/function () {
540
537
  this.onErrorHandled = onErrorHandled;
541
538
  this.metadataService = metadataService;
542
539
  this.enableErrorOnFailedDocumentApply = enableErrorOnFailedDocumentApply;
543
- this.enableSendStepsQueue = enableSendStepsQueue;
544
540
  this.stepQueue = new StepQueueState();
545
541
  }
546
542
  _createClass(DocumentService, [{
@@ -658,42 +654,26 @@ export var DocumentService = /*#__PURE__*/function () {
658
654
  if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
659
655
  return;
660
656
  }
661
- if (this.enableSendStepsQueue) {
662
- // Only send 1% of events to avoid useless logging
663
- if (Math.random() < 0.01) {
664
- var _this$analyticsHelper29;
665
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
666
- }
667
- // Avoid reference issues using a
668
- // method outside of the provider
669
- // scope
670
- commitStepQueue({
671
- broadcast: this.broadcast,
672
- userId: this.getUserId(),
673
- clientId: this.clientId,
674
- steps: unconfirmedSteps,
675
- version: version,
676
- onStepsAdded: this.onStepsAdded,
677
- onErrorHandled: this.onErrorHandled,
678
- analyticsHelper: this.analyticsHelper,
679
- emit: this.providerEmitCallback
680
- });
681
- } else {
682
- // Avoid reference issues using a
683
- // method outside of the provider
684
- // scope
685
- throttledCommitStep({
686
- broadcast: this.broadcast,
687
- userId: this.getUserId(),
688
- clientId: this.clientId,
689
- steps: unconfirmedSteps,
690
- version: version,
691
- onStepsAdded: this.onStepsAdded,
692
- onErrorHandled: this.onErrorHandled,
693
- analyticsHelper: this.analyticsHelper,
694
- emit: this.providerEmitCallback
695
- });
657
+
658
+ // Only send 1% of events to avoid useless logging
659
+ if (Math.random() < 0.01) {
660
+ var _this$analyticsHelper29;
661
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_QUEUE, EVENT_STATUS.INFO);
696
662
  }
663
+ // Avoid reference issues using a
664
+ // method outside of the provider
665
+ // scope
666
+ commitStepQueue({
667
+ broadcast: this.broadcast,
668
+ userId: this.getUserId(),
669
+ clientId: this.clientId,
670
+ steps: unconfirmedSteps,
671
+ version: version,
672
+ onStepsAdded: this.onStepsAdded,
673
+ onErrorHandled: this.onErrorHandled,
674
+ analyticsHelper: this.analyticsHelper,
675
+ emit: this.providerEmitCallback
676
+ });
697
677
  }
698
678
  }]);
699
679
  return DocumentService;
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  var defaultNCSFeatureFlags = {
3
3
  testFF: false,
4
- sendStepsQueue: false,
5
4
  blockViewOnly: false
6
5
  };
7
6
 
@@ -11,7 +10,6 @@ var defaultNCSFeatureFlags = {
11
10
  var productKeys = {
12
11
  confluence: {
13
12
  testFF: 'confluence.frontend.collab.provider.testFF',
14
- sendStepsQueue: 'confluence.frontend.ncs.send-steps-queue',
15
13
  blockViewOnly: 'confluence.frontend.ncs.block-view-only'
16
14
  }
17
15
  };
@@ -2,12 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  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) { _defineProperty(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; }
4
4
  import countBy from 'lodash/countBy';
5
- import throttle from 'lodash/throttle';
6
5
  import { ADD_STEPS_TYPE, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
7
6
  import { AcknowledgementResponseTypes } from '../types';
8
7
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
9
8
  import { createLogger } from '../helpers/utils';
10
- var SEND_STEPS_THROTTLE = 500; // 0.5 second
11
9
  var logger = createLogger('commit-step', 'black');
12
10
  export var readyToCommit = true;
13
11
  export var RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
@@ -111,87 +109,4 @@ export var commitStepQueue = function commitStepQueue(_ref) {
111
109
  version: version
112
110
  });
113
111
  }
114
- };
115
- export var commitStep = function commitStep(_ref2) {
116
- var broadcast = _ref2.broadcast,
117
- steps = _ref2.steps,
118
- version = _ref2.version,
119
- userId = _ref2.userId,
120
- clientId = _ref2.clientId,
121
- onStepsAdded = _ref2.onStepsAdded,
122
- onErrorHandled = _ref2.onErrorHandled,
123
- analyticsHelper = _ref2.analyticsHelper,
124
- emit = _ref2.emit;
125
- var stepsWithClientAndUserId = steps.map(function (step) {
126
- return _objectSpread(_objectSpread({}, step.toJSON()), {}, {
127
- clientId: clientId,
128
- userId: userId
129
- });
130
- });
131
- var start = new Date().getTime();
132
- emit('commit-status', {
133
- status: 'attempt',
134
- version: version
135
- });
136
- try {
137
- broadcast('steps:commit', {
138
- steps: stepsWithClientAndUserId,
139
- version: version,
140
- userId: userId
141
- }, function (response) {
142
- var latency = new Date().getTime() - start;
143
- if (response.type === AcknowledgementResponseTypes.SUCCESS) {
144
- onStepsAdded({
145
- steps: stepsWithClientAndUserId,
146
- version: response.version
147
- });
148
- // Sample only 10% of add steps events to avoid overwhelming the analytics
149
- if (Math.random() < 0.1) {
150
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.SUCCESS_10x_SAMPLED, {
151
- type: ADD_STEPS_TYPE.ACCEPTED,
152
- latency: latency,
153
- stepType: countBy(stepsWithClientAndUserId, function (stepWithClientAndUserId) {
154
- return stepWithClientAndUserId.stepType;
155
- })
156
- });
157
- }
158
- emit('commit-status', {
159
- status: 'success',
160
- version: response.version
161
- });
162
- } else if (response.type === AcknowledgementResponseTypes.ERROR) {
163
- onErrorHandled(response.error);
164
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.FAILURE, {
165
- // User tried committing steps but they were rejected because:
166
- // - HEAD_VERSION_UPDATE_FAILED: the collab service's latest stored step tail version didn't correspond to the head version of the first step submitted
167
- // - VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
168
- type: response.error.data.code === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || response.error.data.code === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS ? ADD_STEPS_TYPE.REJECTED : ADD_STEPS_TYPE.ERROR,
169
- latency: latency
170
- });
171
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(response.error, 'Error while adding steps - Acknowledgement Error');
172
- emit('commit-status', {
173
- status: 'failure',
174
- version: version
175
- });
176
- } else {
177
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(
178
- // @ts-expect-error We didn't type the invalid type case
179
- new Error("Response type: ".concat((response === null || response === void 0 ? void 0 : response.type) || 'No response type')), 'Error while adding steps - Invalid Acknowledgement');
180
- emit('commit-status', {
181
- status: 'failure',
182
- version: version
183
- });
184
- }
185
- });
186
- } catch (error) {
187
- analyticsHelper === null || analyticsHelper === void 0 || analyticsHelper.sendErrorEvent(error, 'Error while adding steps - Broadcast threw exception');
188
- emit('commit-status', {
189
- status: 'failure',
190
- version: version
191
- });
192
- }
193
- };
194
- export var throttledCommitStep = throttle(commitStep, SEND_STEPS_THROTTLE, {
195
- leading: false,
196
- trailing: true
197
- });
112
+ };
@@ -260,15 +260,13 @@ 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);
264
264
  _this.namespaceService = new NamespaceService();
265
265
  _this.api = new Api(config, _this.documentService, _this.channel);
266
- if (getCollabProviderFeatureFlag('sendStepsQueue', _this.config.featureFlags)) {
267
- _this.sendStepsTimer = setInterval(function () {
268
- logger('Intervally sendStepsFromCurrentState');
269
- _this.documentService.sendStepsFromCurrentState(true);
270
- }, 5000);
271
- }
266
+ _this.sendStepsTimer = setInterval(function () {
267
+ logger('Intervally sendStepsFromCurrentState');
268
+ _this.documentService.sendStepsFromCurrentState(true);
269
+ }, 5000);
272
270
  return _this;
273
271
  }
274
272
  _createClass(Provider, [{
@@ -456,11 +454,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
456
454
  try {
457
455
  _get(_getPrototypeOf(Provider.prototype), "unsubscribeAll", this).call(this);
458
456
  this.channel.disconnect();
459
- if (getCollabProviderFeatureFlag('sendStepsQueue', this.config.featureFlags)) {
460
- if (this.sendStepsTimer) {
461
- clearInterval(this.sendStepsTimer);
462
- this.sendStepsTimer = undefined;
463
- }
457
+ if (this.sendStepsTimer) {
458
+ clearInterval(this.sendStepsTimer);
459
+ this.sendStepsTimer = undefined;
464
460
  }
465
461
  } catch (error) {
466
462
  var _this$analyticsHelper12;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "9.22.4";
2
+ export var version = "9.22.6";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -19,7 +19,6 @@ export declare class DocumentService {
19
19
  private onErrorHandled;
20
20
  private metadataService;
21
21
  private enableErrorOnFailedDocumentApply;
22
- private enableSendStepsQueue;
23
22
  private getState;
24
23
  private onSyncUpError?;
25
24
  private stepQueue;
@@ -39,9 +38,8 @@ export declare class DocumentService {
39
38
  * @param onErrorHandled - Callback to handle
40
39
  * @param metadataService
41
40
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
42
- * @param enableSendStepsQueue - Enable send steps queue.
43
41
  */
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?: boolean, enableSendStepsQueue?: boolean);
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);
45
43
  /**
46
44
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
47
45
  */
@@ -1,6 +1,5 @@
1
1
  export interface NCSFeatureFlags {
2
2
  testFF?: boolean;
3
- sendStepsQueue?: boolean;
4
3
  blockViewOnly?: boolean;
5
4
  }
6
5
  export interface WithNCSFeatureFlags {
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import type { ChannelEvent, StepsPayload } from '../types';
3
2
  import type { CollabCommitStatusEventPayload, CollabEvents } from '@atlaskit/editor-common/collab';
4
3
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
@@ -17,25 +16,3 @@ export declare const commitStepQueue: ({ broadcast, steps, version, userId, clie
17
16
  analyticsHelper?: AnalyticsHelper | undefined;
18
17
  emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
19
18
  }) => void;
20
- export declare const commitStep: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, }: {
21
- broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
22
- steps: readonly ProseMirrorStep[];
23
- version: number;
24
- userId: string;
25
- clientId: number | string;
26
- onStepsAdded: (data: StepsPayload) => void;
27
- onErrorHandled: (error: InternalError) => void;
28
- analyticsHelper?: AnalyticsHelper | undefined;
29
- emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
30
- }) => void;
31
- export declare const throttledCommitStep: import("lodash").DebouncedFunc<({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, }: {
32
- broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
33
- steps: readonly ProseMirrorStep[];
34
- version: number;
35
- userId: string;
36
- clientId: number | string;
37
- onStepsAdded: (data: StepsPayload) => void;
38
- onErrorHandled: (error: InternalError) => void;
39
- analyticsHelper?: AnalyticsHelper | undefined;
40
- emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
41
- }) => void>;
@@ -19,7 +19,6 @@ export declare class DocumentService {
19
19
  private onErrorHandled;
20
20
  private metadataService;
21
21
  private enableErrorOnFailedDocumentApply;
22
- private enableSendStepsQueue;
23
22
  private getState;
24
23
  private onSyncUpError?;
25
24
  private stepQueue;
@@ -39,9 +38,8 @@ export declare class DocumentService {
39
38
  * @param onErrorHandled - Callback to handle
40
39
  * @param metadataService
41
40
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
42
- * @param enableSendStepsQueue - Enable send steps queue.
43
41
  */
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?: boolean, enableSendStepsQueue?: boolean);
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);
45
43
  /**
46
44
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
47
45
  */
@@ -1,6 +1,5 @@
1
1
  export interface NCSFeatureFlags {
2
2
  testFF?: boolean;
3
- sendStepsQueue?: boolean;
4
3
  blockViewOnly?: boolean;
5
4
  }
6
5
  export interface WithNCSFeatureFlags {
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import type { ChannelEvent, StepsPayload } from '../types';
3
2
  import type { CollabCommitStatusEventPayload, CollabEvents } from '@atlaskit/editor-common/collab';
4
3
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
@@ -17,25 +16,3 @@ export declare const commitStepQueue: ({ broadcast, steps, version, userId, clie
17
16
  analyticsHelper?: AnalyticsHelper | undefined;
18
17
  emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
19
18
  }) => void;
20
- export declare const commitStep: ({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, }: {
21
- broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
22
- steps: readonly ProseMirrorStep[];
23
- version: number;
24
- userId: string;
25
- clientId: number | string;
26
- onStepsAdded: (data: StepsPayload) => void;
27
- onErrorHandled: (error: InternalError) => void;
28
- analyticsHelper?: AnalyticsHelper | undefined;
29
- emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
30
- }) => void;
31
- export declare const throttledCommitStep: import("lodash").DebouncedFunc<({ broadcast, steps, version, userId, clientId, onStepsAdded, onErrorHandled, analyticsHelper, emit, }: {
32
- broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
33
- steps: readonly ProseMirrorStep[];
34
- version: number;
35
- userId: string;
36
- clientId: number | string;
37
- onStepsAdded: (data: StepsPayload) => void;
38
- onErrorHandled: (error: InternalError) => void;
39
- analyticsHelper?: AnalyticsHelper | undefined;
40
- emit: (evt: keyof CollabEvents, data: CollabCommitStatusEventPayload) => void;
41
- }) => void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "9.22.4",
3
+ "version": "9.22.6",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,9 +36,9 @@
36
36
  "dependencies": {
37
37
  "@atlaskit/analytics-gas-types": "^5.1.0",
38
38
  "@atlaskit/analytics-listeners": "^8.9.0",
39
- "@atlaskit/editor-common": "^77.2.0",
39
+ "@atlaskit/editor-common": "^77.3.0",
40
40
  "@atlaskit/editor-json-transformer": "^8.10.0",
41
- "@atlaskit/editor-prosemirror": "1.1.0",
41
+ "@atlaskit/editor-prosemirror": "3.0.0",
42
42
  "@atlaskit/ufo": "^0.2.0",
43
43
  "@atlaskit/util-service-support": "^6.2.0",
44
44
  "@babel/runtime": "^7.0.0",
package/tsconfig.json CHANGED
@@ -1,255 +1,7 @@
1
1
  {
2
2
  "extends": "../../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "./",
5
- "paths": {
6
- "@atlaskit/analytics-gas-types": [
7
- "../../analytics/analytics-gas-types/src/index.ts"
8
- ],
9
- "@atlaskit/analytics-listeners/FabricAnalyticsListeners": [
10
- "../../analytics/analytics-listeners/src/FabricAnalyticsListeners.tsx"
11
- ],
12
- "@atlaskit/analytics-listeners/GenericAnalyticsListener": [
13
- "../../analytics/analytics-listeners/src/GenericAnalyticsListener.tsx"
14
- ],
15
- "@atlaskit/analytics-listeners/analytics-web-client-wrapper": [
16
- "../../analytics/analytics-listeners/src/analytics-web-client-wrapper.ts"
17
- ],
18
- "@atlaskit/analytics-listeners/types": [
19
- "../../analytics/analytics-listeners/src/types.ts"
20
- ],
21
- "@atlaskit/analytics-listeners": [
22
- "../../analytics/analytics-listeners/src/index.ts"
23
- ],
24
- "@atlaskit/editor-common/event-dispatcher": [
25
- "../editor-common/src/event-dispatcher/index.ts"
26
- ],
27
- "@atlaskit/editor-common/extensions": [
28
- "../editor-common/src/extensions.ts"
29
- ],
30
- "@atlaskit/editor-common/extensibility": [
31
- "../editor-common/src/extensibility/index.ts"
32
- ],
33
- "@atlaskit/editor-common/normalize-feature-flags": [
34
- "../editor-common/src/normalize-feature-flags.ts"
35
- ],
36
- "@atlaskit/editor-common/messages": [
37
- "../editor-common/src/messages/index.ts"
38
- ],
39
- "@atlaskit/editor-common/provider-factory": [
40
- "../editor-common/src/provider-factory.ts"
41
- ],
42
- "@atlaskit/editor-common/styles": [
43
- "../editor-common/src/styles/index.ts"
44
- ],
45
- "@atlaskit/editor-common/validator": [
46
- "../editor-common/src/validator.ts"
47
- ],
48
- "@atlaskit/editor-common/in-product": [
49
- "../editor-common/src/in-product.ts"
50
- ],
51
- "@atlaskit/editor-common/type-ahead": [
52
- "../editor-common/src/type-ahead/index.ts"
53
- ],
54
- "@atlaskit/editor-common/ufo": [
55
- "../editor-common/src/ufo/index.ts"
56
- ],
57
- "@atlaskit/editor-common/insert": [
58
- "../editor-common/src/insert/index.ts"
59
- ],
60
- "@atlaskit/editor-common/types": [
61
- "../editor-common/src/types/index.ts"
62
- ],
63
- "@atlaskit/editor-common/ui": [
64
- "../editor-common/src/ui/index.tsx"
65
- ],
66
- "@atlaskit/editor-common/utils": [
67
- "../editor-common/src/utils/index.ts"
68
- ],
69
- "@atlaskit/editor-common/card": [
70
- "../editor-common/src/card/index.ts"
71
- ],
72
- "@atlaskit/editor-common/collab": [
73
- "../editor-common/src/collab/index.ts"
74
- ],
75
- "@atlaskit/editor-common/emoji": [
76
- "../editor-common/src/emoji.ts"
77
- ],
78
- "@atlaskit/editor-common/mention": [
79
- "../editor-common/src/mention.ts"
80
- ],
81
- "@atlaskit/editor-common/provider-helpers": [
82
- "../editor-common/src/provider-helpers/index.ts"
83
- ],
84
- "@atlaskit/editor-common/icons": [
85
- "../editor-common/src/icons/index.ts"
86
- ],
87
- "@atlaskit/editor-common/safe-plugin": [
88
- "../editor-common/src/safe-plugin/index.ts"
89
- ],
90
- "@atlaskit/editor-common/panel": [
91
- "../editor-common/src/panel.ts"
92
- ],
93
- "@atlaskit/editor-common/analytics": [
94
- "../editor-common/src/analytics/index.ts"
95
- ],
96
- "@atlaskit/editor-common/error-boundary": [
97
- "../editor-common/src/ui/ErrorBoundary/index.tsx"
98
- ],
99
- "@atlaskit/editor-common/portal-provider": [
100
- "../editor-common/src/ui/PortalProvider/index.tsx"
101
- ],
102
- "@atlaskit/editor-common/react-node-view": [
103
- "../editor-common/src/react-node-view/index.tsx"
104
- ],
105
- "@atlaskit/editor-common/with-plugin-state": [
106
- "../editor-common/src/with-plugin-state/index.tsx"
107
- ],
108
- "@atlaskit/editor-common/node-width": [
109
- "../editor-common/src/node-width/index.ts"
110
- ],
111
- "@atlaskit/editor-common/keymaps": [
112
- "../editor-common/src/keymaps/index.tsx"
113
- ],
114
- "@atlaskit/editor-common/ui-menu": [
115
- "../editor-common/src/ui-menu/index.tsx"
116
- ],
117
- "@atlaskit/editor-common/ui-react": [
118
- "../editor-common/src/ui-react/index.ts"
119
- ],
120
- "@atlaskit/editor-common/ui-color": [
121
- "../editor-common/src/ui-color/index.ts"
122
- ],
123
- "@atlaskit/editor-common/transforms": [
124
- "../editor-common/src/transforms/index.ts"
125
- ],
126
- "@atlaskit/editor-common/core-utils": [
127
- "../editor-common/src/core-utils/index.ts"
128
- ],
129
- "@atlaskit/editor-common/selection": [
130
- "../editor-common/src/selection/index.ts"
131
- ],
132
- "@atlaskit/editor-common/preset": [
133
- "../editor-common/src/preset/index.ts"
134
- ],
135
- "@atlaskit/editor-common/hooks": [
136
- "../editor-common/src/hooks/index.ts"
137
- ],
138
- "@atlaskit/editor-common/media-inline": [
139
- "../editor-common/src/media-inline/index.ts"
140
- ],
141
- "@atlaskit/editor-common/media-single": [
142
- "../editor-common/src/media-single/index.ts"
143
- ],
144
- "@atlaskit/editor-common/monitoring": [
145
- "../editor-common/src/monitoring/index.ts"
146
- ],
147
- "@atlaskit/editor-common/paste": [
148
- "../editor-common/src/paste/index.ts"
149
- ],
150
- "@atlaskit/editor-common/resizer": [
151
- "../editor-common/src/resizer/index.ts"
152
- ],
153
- "@atlaskit/editor-common/editor-analytics": [
154
- "../editor-common/src/editor-analytics/index.ts"
155
- ],
156
- "@atlaskit/editor-common/selection-based-node-view": [
157
- "../editor-common/src/selection-based-node-view/index.ts"
158
- ],
159
- "@atlaskit/editor-common/guideline": [
160
- "../editor-common/src/guideline/index.ts"
161
- ],
162
- "@atlaskit/editor-common/quick-insert": [
163
- "../editor-common/src/quick-insert/index.ts"
164
- ],
165
- "@atlaskit/editor-common/link": [
166
- "../editor-common/src/link/index.ts"
167
- ],
168
- "@atlaskit/editor-common/mark": [
169
- "../editor-common/src/mark/index.ts"
170
- ],
171
- "@atlaskit/editor-common/commands": [
172
- "../editor-common/src/commands/index.ts"
173
- ],
174
- "@atlaskit/editor-common/clipboard": [
175
- "../editor-common/src/clipboard/index.ts"
176
- ],
177
- "@atlaskit/editor-common/lists": [
178
- "../editor-common/src/lists/index.ts"
179
- ],
180
- "@atlaskit/editor-common/element-browser": [
181
- "../editor-common/src/element-browser/index.ts"
182
- ],
183
- "@atlaskit/editor-common/floating-toolbar": [
184
- "../editor-common/src/floating-toolbar/index.ts"
185
- ],
186
- "@atlaskit/editor-common/copy-button": [
187
- "../editor-common/src/copy-button/index.ts"
188
- ],
189
- "@atlaskit/editor-common/legacy-rank-plugins": [
190
- "../editor-common/src/rank.ts"
191
- ],
192
- "@atlaskit/editor-common/indentation": [
193
- "../editor-common/src/indentation/index.ts"
194
- ],
195
- "@atlaskit/editor-common/annotation": [
196
- "../editor-common/src/annotation/index.ts"
197
- ],
198
- "@atlaskit/editor-common": [
199
- "../editor-common/src"
200
- ],
201
- "@atlaskit/editor-json-transformer/markOverrideRules": [
202
- "../editor-json-transformer/src/markOverrideRules.ts"
203
- ],
204
- "@atlaskit/editor-json-transformer/sanitize": [
205
- "../editor-json-transformer/src/sanitize.ts"
206
- ],
207
- "@atlaskit/editor-json-transformer/types": [
208
- "../editor-json-transformer/src/types.ts"
209
- ],
210
- "@atlaskit/editor-json-transformer": [
211
- "../editor-json-transformer/src/index.ts"
212
- ],
213
- "@atlaskit/ufo/global-stream-buffer": [
214
- "../../data/ufo-external/src/global-stream-buffer/index.ts"
215
- ],
216
- "@atlaskit/ufo/logger": [
217
- "../../data/ufo-external/src/logger/index.ts"
218
- ],
219
- "@atlaskit/ufo/platform-client": [
220
- "../../data/ufo-external/src/platform-client/index.ts"
221
- ],
222
- "@atlaskit/ufo/types": [
223
- "../../data/ufo-external/src/types.ts"
224
- ],
225
- "@atlaskit/ufo": [
226
- "../../data/ufo-external/src/index.ts"
227
- ],
228
- "@atlaskit/util-service-support/serviceResources": [
229
- "../../elements/util-service-support/src/serviceResources.ts"
230
- ],
231
- "@atlaskit/util-service-support/serviceUtils": [
232
- "../../elements/util-service-support/src/serviceUtils.ts"
233
- ],
234
- "@atlaskit/util-service-support/types": [
235
- "../../elements/util-service-support/src/types.ts"
236
- ],
237
- "@atlaskit/util-service-support": [
238
- "../../elements/util-service-support/src/index.ts"
239
- ],
240
- "@atlaskit/collab-provider/socket-io-provider": [
241
- "src/socket-io-provider.ts"
242
- ],
243
- "@atlaskit/collab-provider/types": [
244
- "src/types.ts"
245
- ],
246
- "@atlaskit/collab-provider/version-wrapper": [
247
- "src/version-wrapper.ts"
248
- ],
249
- "@atlaskit/collab-provider": [
250
- "./src"
251
- ]
252
- }
4
+ "baseUrl": "./"
253
5
  },
254
6
  "include": [
255
7
  "./src/**/*.ts",