@atlaskit/collab-provider 11.2.0 → 11.2.2
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 +14 -0
- package/dist/cjs/document/document-service.js +6 -20
- package/dist/cjs/document/null-document-service.js +0 -1
- package/dist/cjs/errors/ncs-errors.js +0 -1
- package/dist/cjs/helpers/const.js +0 -1
- package/dist/cjs/provider/commit-step.js +1 -13
- package/dist/cjs/provider/index.js +1 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +6 -20
- package/dist/es2019/document/null-document-service.js +0 -1
- package/dist/es2019/errors/ncs-errors.js +0 -1
- package/dist/es2019/helpers/const.js +0 -1
- package/dist/es2019/provider/commit-step.js +1 -13
- package/dist/es2019/provider/index.js +1 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +6 -20
- package/dist/esm/document/null-document-service.js +0 -1
- package/dist/esm/errors/ncs-errors.js +0 -1
- package/dist/esm/helpers/const.js +0 -1
- package/dist/esm/provider/commit-step.js +1 -13
- package/dist/esm/provider/index.js +1 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/channel.d.ts +1 -2
- package/dist/types/document/document-service.d.ts +10 -19
- package/dist/types/document/null-document-service.d.ts +0 -1
- package/dist/types/errors/ncs-errors.d.ts +2 -11
- package/dist/types/helpers/const.d.ts +1 -2
- package/dist/types/helpers/utils.d.ts +8 -8
- package/dist/types/participants/participants-helper.d.ts +1 -4
- package/dist/types/participants/participants-service.d.ts +2 -2
- package/dist/types/participants/telepointers-helper.d.ts +1 -1
- package/dist/types/provider/commit-step.d.ts +1 -3
- package/dist/types/types.d.ts +5 -6
- package/dist/types-ts4.5/channel.d.ts +1 -2
- package/dist/types-ts4.5/document/document-service.d.ts +10 -19
- package/dist/types-ts4.5/document/null-document-service.d.ts +0 -1
- package/dist/types-ts4.5/errors/ncs-errors.d.ts +2 -11
- package/dist/types-ts4.5/helpers/const.d.ts +1 -2
- package/dist/types-ts4.5/helpers/utils.d.ts +8 -8
- package/dist/types-ts4.5/participants/participants-helper.d.ts +1 -4
- package/dist/types-ts4.5/participants/participants-service.d.ts +2 -2
- package/dist/types-ts4.5/participants/telepointers-helper.d.ts +1 -1
- package/dist/types-ts4.5/provider/commit-step.d.ts +1 -3
- package/dist/types-ts4.5/types.d.ts +5 -6
- package/docs/document-service-send-function-analysis.md +3 -7
- package/package.json +5 -5
- package/socket-io-provider/package.json +1 -1
- package/types/package.json +1 -1
- package/version-wrapper/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 11.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 11.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`bc0db0b86820f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bc0db0b86820f) -
|
|
14
|
+
cleanup unused skipValidation experiment code
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 11.2.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -21,7 +21,6 @@ var _const = require("../helpers/const");
|
|
|
21
21
|
var _performance = require("../analytics/performance");
|
|
22
22
|
var _internalErrors = require("../errors/internal-errors");
|
|
23
23
|
var _utils = require("../helpers/utils");
|
|
24
|
-
var _participantsService = require("../participants/participants-service");
|
|
25
24
|
var _provider = require("../provider");
|
|
26
25
|
var _commitStep = require("../provider/commit-step");
|
|
27
26
|
var _customErrors = require("../errors/custom-errors");
|
|
@@ -78,7 +77,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
78
77
|
(0, _defineProperty2.default)(this, "aggressiveCatchup", false);
|
|
79
78
|
(0, _defineProperty2.default)(this, "catchUpOutofSync", false);
|
|
80
79
|
(0, _defineProperty2.default)(this, "hasRecovered", false);
|
|
81
|
-
(0, _defineProperty2.default)(this, "numberOfStepCommitsSent", 0);
|
|
82
80
|
(0, _defineProperty2.default)(this, "timeoutExceeded", false);
|
|
83
81
|
/**
|
|
84
82
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
@@ -91,16 +89,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
91
89
|
// TODO: ED-26957 - why shouldn't this be leading?
|
|
92
90
|
trailing: true
|
|
93
91
|
}));
|
|
94
|
-
/**
|
|
95
|
-
* Updates the number of commits sent since connect/reconnect
|
|
96
|
-
* This is used to track the number of commits sent to the server.
|
|
97
|
-
* currently we are validating the first steps from a user after connect/reconnect - CEPS-710
|
|
98
|
-
* @param steps
|
|
99
|
-
* @example
|
|
100
|
-
*/
|
|
101
|
-
(0, _defineProperty2.default)(this, "setNumberOfCommitsSent", function (steps) {
|
|
102
|
-
_this.numberOfStepCommitsSent = steps;
|
|
103
|
-
});
|
|
104
92
|
/**
|
|
105
93
|
* Called when:
|
|
106
94
|
* * session established(offline -> online)
|
|
@@ -140,7 +128,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
140
128
|
analyticsHelper: _this.analyticsHelper,
|
|
141
129
|
clientId: _this.clientId,
|
|
142
130
|
onStepsAdded: _this.onStepsAdded,
|
|
143
|
-
catchUpOutofSync:
|
|
131
|
+
catchUpOutofSync: _this.catchUpOutofSync,
|
|
144
132
|
reason: reason,
|
|
145
133
|
sessionId: sessionId,
|
|
146
134
|
onCatchupComplete: function onCatchupComplete(steps) {
|
|
@@ -1026,12 +1014,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
1026
1014
|
) {
|
|
1027
1015
|
var _this3 = this;
|
|
1028
1016
|
var offlineEditingEnabled = (0, _experiments.editorExperiment)('platform_editor_offline_editing_web', true);
|
|
1029
|
-
var
|
|
1017
|
+
var onlineStepMergingEnabled = (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
|
|
1030
1018
|
|
|
1031
1019
|
// Don't send any steps before we're ready.
|
|
1032
|
-
if (offlineEditingEnabled ||
|
|
1033
|
-
var
|
|
1034
|
-
if (!this.getConnected() ||
|
|
1020
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
1021
|
+
var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
|
|
1022
|
+
if (!this.getConnected() || enableOnlineStepMerging) {
|
|
1035
1023
|
return;
|
|
1036
1024
|
}
|
|
1037
1025
|
}
|
|
@@ -1040,7 +1028,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
1040
1028
|
if (!unconfirmedStepsData) {
|
|
1041
1029
|
return;
|
|
1042
1030
|
}
|
|
1043
|
-
if (offlineEditingEnabled ||
|
|
1031
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
1044
1032
|
this.lockStepOrigins(unconfirmedStepsData.origins);
|
|
1045
1033
|
}
|
|
1046
1034
|
var unconfirmedSteps = unconfirmedStepsData.steps;
|
|
@@ -1124,8 +1112,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
1124
1112
|
hasRecovered: this.hasRecovered,
|
|
1125
1113
|
collabMode: this.participantsService.getCollabMode(),
|
|
1126
1114
|
reason: reason,
|
|
1127
|
-
numberOfStepCommitsSent: this.numberOfStepCommitsSent,
|
|
1128
|
-
setNumberOfCommitsSent: this.setNumberOfCommitsSent,
|
|
1129
1115
|
lockSteps: this.lockSteps
|
|
1130
1116
|
});
|
|
1131
1117
|
}
|
|
@@ -17,7 +17,6 @@ var NullDocumentService = exports.NullDocumentService = /*#__PURE__*/function ()
|
|
|
17
17
|
return _this;
|
|
18
18
|
});
|
|
19
19
|
(0, _defineProperty2.default)(this, "onErrorHandled", function () {});
|
|
20
|
-
(0, _defineProperty2.default)(this, "setNumberOfCommitsSent", function () {});
|
|
21
20
|
}
|
|
22
21
|
return (0, _createClass2.default)(NullDocumentService, [{
|
|
23
22
|
key: "updateDocument",
|
|
@@ -24,7 +24,6 @@ var NCS_ERROR_CODE = exports.NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_C
|
|
|
24
24
|
NCS_ERROR_CODE["INVALID_CLOUD_ID"] = "INVALID_CLOUD_ID";
|
|
25
25
|
NCS_ERROR_CODE["RATE_LIMIT_ERROR"] = "RATE_LIMIT_ERROR";
|
|
26
26
|
NCS_ERROR_CODE["PROSEMIRROR_SCHEMA_VALIDATION_ERROR"] = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR";
|
|
27
|
-
NCS_ERROR_CODE["CORRUPT_STEP_FAILED_TO_SAVE"] = "CORRUPT_STEP_FAILED_TO_SAVE";
|
|
28
27
|
return NCS_ERROR_CODE;
|
|
29
28
|
}({}); // TODO: ED-26957 - Import emitted error codes from NCS
|
|
30
29
|
// NCS Errors
|
|
@@ -75,6 +75,5 @@ var CatchupEventReason = exports.CatchupEventReason = /*#__PURE__*/function (Cat
|
|
|
75
75
|
CatchupEventReason["STEPS_REJECTED"] = "onStepsRejected";
|
|
76
76
|
CatchupEventReason["PROCESS_STEPS"] = "processSteps";
|
|
77
77
|
CatchupEventReason["RECONNECTED"] = "reconnected";
|
|
78
|
-
CatchupEventReason["CORRUPT_STEP"] = "corruptStep";
|
|
79
78
|
return CatchupEventReason;
|
|
80
79
|
}({});
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _countBy = _interopRequireDefault(require("lodash/countBy"));
|
|
12
|
-
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
13
12
|
var _const = require("../helpers/const");
|
|
14
13
|
var _types = require("../types");
|
|
15
14
|
var _ncsErrors = require("../errors/ncs-errors");
|
|
@@ -50,8 +49,6 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
|
|
|
50
49
|
hasRecovered = _ref.hasRecovered,
|
|
51
50
|
collabMode = _ref.collabMode,
|
|
52
51
|
reason = _ref.reason,
|
|
53
|
-
numberOfStepCommitsSent = _ref.numberOfStepCommitsSent,
|
|
54
|
-
setNumberOfCommitsSent = _ref.setNumberOfCommitsSent,
|
|
55
52
|
lockSteps = _ref.lockSteps;
|
|
56
53
|
// this timer is for waiting to send the next batch in between acks from the BE
|
|
57
54
|
var commitWaitTimer;
|
|
@@ -124,17 +121,11 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
|
|
|
124
121
|
version: version
|
|
125
122
|
});
|
|
126
123
|
try {
|
|
127
|
-
var _FeatureGates$getExpe;
|
|
128
|
-
var n = (_FeatureGates$getExpe = _featureGateJsClient.default.getExperimentValue('platform_editor_step_validation_on_connect', 'steps', 0)) !== null && _FeatureGates$getExpe !== void 0 ? _FeatureGates$getExpe : 0;
|
|
129
|
-
var isExperimentEnabled = n > 0;
|
|
130
|
-
// skip validation if FG is on and we have already sent n steps, or if FG is off
|
|
131
|
-
var skipValidation = isExperimentEnabled ? numberOfStepCommitsSent >= n : true;
|
|
132
124
|
this.broadcast('steps:commit', {
|
|
133
125
|
collabMode: collabMode,
|
|
134
126
|
steps: stepsWithClientAndUserId,
|
|
135
127
|
version: version,
|
|
136
|
-
userId: userId
|
|
137
|
-
skipValidation: skipValidation
|
|
128
|
+
userId: userId
|
|
138
129
|
}, function (response) {
|
|
139
130
|
_this.lastBroadcastRequestAcked = true;
|
|
140
131
|
var latency = new Date().getTime() - start;
|
|
@@ -185,9 +176,6 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
|
|
|
185
176
|
console.error(ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG);
|
|
186
177
|
}
|
|
187
178
|
});
|
|
188
|
-
if (isExperimentEnabled && numberOfStepCommitsSent < n) {
|
|
189
|
-
setNumberOfCommitsSent(numberOfStepCommitsSent + 1);
|
|
190
|
-
}
|
|
191
179
|
} catch (error) {
|
|
192
180
|
var _this$analyticsHelper2;
|
|
193
181
|
// if the broadcast failed for any reason, we shouldn't keep the queue locked as the BE has not recieved any message
|
|
@@ -117,7 +117,6 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
117
117
|
initial: !initialized
|
|
118
118
|
});
|
|
119
119
|
var unconfirmedStepsLength = (_this$documentService = _this.documentService.getUnconfirmedSteps()) === null || _this$documentService === void 0 ? void 0 : _this$documentService.length;
|
|
120
|
-
_this.documentService.setNumberOfCommitsSent(0);
|
|
121
120
|
|
|
122
121
|
// if buffering is enabled and the provider is initialized before connection,
|
|
123
122
|
// send any unconfirmed steps
|
|
@@ -220,14 +219,12 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
220
219
|
* @param {InternalError} error The error to handle
|
|
221
220
|
*/
|
|
222
221
|
(0, _defineProperty2.default)(_this, "onErrorHandled", function (error) {
|
|
223
|
-
var _error$data, _error$data2
|
|
222
|
+
var _error$data, _error$data2;
|
|
224
223
|
// User tried committing steps but they were rejected because:
|
|
225
224
|
// 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
|
|
226
225
|
// VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
|
|
227
226
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === _ncsErrors.NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === _ncsErrors.NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
228
227
|
_this.documentService.onStepRejectedError();
|
|
229
|
-
} else if (((_error$data3 = error.data) === null || _error$data3 === void 0 ? void 0 : _error$data3.code) === _ncsErrors.NCS_ERROR_CODE.CORRUPT_STEP_FAILED_TO_SAVE) {
|
|
230
|
-
_this.documentService.throttledCatchupv2(_const.CatchupEventReason.CORRUPT_STEP, undefined, (0, _platformFeatureFlags.fg)('add_session_id_to_catchup_query') ? _this.sessionId : undefined);
|
|
231
228
|
} else {
|
|
232
229
|
var _this$analyticsHelper2;
|
|
233
230
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, error.message);
|
|
@@ -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 = "11.
|
|
8
|
+
var version = exports.version = "11.2.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -10,7 +10,6 @@ import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS, CatchupEventReason } from '../
|
|
|
10
10
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
11
11
|
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
12
12
|
import { createLogger, getDocAdfWithObfuscationFromJSON, getObfuscatedSteps, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
13
|
-
import { SINGLE_COLLAB_MODE } from '../participants/participants-service';
|
|
14
13
|
import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
|
|
15
14
|
import { CommitStepService } from '../provider/commit-step';
|
|
16
15
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
@@ -60,7 +59,6 @@ export class DocumentService {
|
|
|
60
59
|
_defineProperty(this, "aggressiveCatchup", false);
|
|
61
60
|
_defineProperty(this, "catchUpOutofSync", false);
|
|
62
61
|
_defineProperty(this, "hasRecovered", false);
|
|
63
|
-
_defineProperty(this, "numberOfStepCommitsSent", 0);
|
|
64
62
|
_defineProperty(this, "timeoutExceeded", false);
|
|
65
63
|
/**
|
|
66
64
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
@@ -71,16 +69,6 @@ export class DocumentService {
|
|
|
71
69
|
// TODO: ED-26957 - why shouldn't this be leading?
|
|
72
70
|
trailing: true
|
|
73
71
|
}));
|
|
74
|
-
/**
|
|
75
|
-
* Updates the number of commits sent since connect/reconnect
|
|
76
|
-
* This is used to track the number of commits sent to the server.
|
|
77
|
-
* currently we are validating the first steps from a user after connect/reconnect - CEPS-710
|
|
78
|
-
* @param steps
|
|
79
|
-
* @example
|
|
80
|
-
*/
|
|
81
|
-
_defineProperty(this, "setNumberOfCommitsSent", steps => {
|
|
82
|
-
this.numberOfStepCommitsSent = steps;
|
|
83
|
-
});
|
|
84
72
|
/**
|
|
85
73
|
* Called when:
|
|
86
74
|
* * session established(offline -> online)
|
|
@@ -133,7 +121,7 @@ export class DocumentService {
|
|
|
133
121
|
analyticsHelper: this.analyticsHelper,
|
|
134
122
|
clientId: this.clientId,
|
|
135
123
|
onStepsAdded: this.onStepsAdded,
|
|
136
|
-
catchUpOutofSync:
|
|
124
|
+
catchUpOutofSync: this.catchUpOutofSync,
|
|
137
125
|
reason,
|
|
138
126
|
sessionId,
|
|
139
127
|
onCatchupComplete: steps => {
|
|
@@ -892,12 +880,12 @@ export class DocumentService {
|
|
|
892
880
|
send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
|
|
893
881
|
) {
|
|
894
882
|
const offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
|
|
895
|
-
const
|
|
883
|
+
const onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
|
|
896
884
|
|
|
897
885
|
// Don't send any steps before we're ready.
|
|
898
|
-
if (offlineEditingEnabled ||
|
|
899
|
-
const
|
|
900
|
-
if (!this.getConnected() ||
|
|
886
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
887
|
+
const enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
|
|
888
|
+
if (!this.getConnected() || enableOnlineStepMerging) {
|
|
901
889
|
return;
|
|
902
890
|
}
|
|
903
891
|
}
|
|
@@ -906,7 +894,7 @@ export class DocumentService {
|
|
|
906
894
|
if (!unconfirmedStepsData) {
|
|
907
895
|
return;
|
|
908
896
|
}
|
|
909
|
-
if (offlineEditingEnabled ||
|
|
897
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
910
898
|
this.lockStepOrigins(unconfirmedStepsData.origins);
|
|
911
899
|
}
|
|
912
900
|
const unconfirmedSteps = unconfirmedStepsData.steps;
|
|
@@ -990,8 +978,6 @@ export class DocumentService {
|
|
|
990
978
|
hasRecovered: this.hasRecovered,
|
|
991
979
|
collabMode: this.participantsService.getCollabMode(),
|
|
992
980
|
reason,
|
|
993
|
-
numberOfStepCommitsSent: this.numberOfStepCommitsSent,
|
|
994
|
-
setNumberOfCommitsSent: this.setNumberOfCommitsSent,
|
|
995
981
|
lockSteps: this.lockSteps
|
|
996
982
|
});
|
|
997
983
|
}
|
|
@@ -18,7 +18,6 @@ export let NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
18
18
|
NCS_ERROR_CODE["INVALID_CLOUD_ID"] = "INVALID_CLOUD_ID";
|
|
19
19
|
NCS_ERROR_CODE["RATE_LIMIT_ERROR"] = "RATE_LIMIT_ERROR";
|
|
20
20
|
NCS_ERROR_CODE["PROSEMIRROR_SCHEMA_VALIDATION_ERROR"] = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR";
|
|
21
|
-
NCS_ERROR_CODE["CORRUPT_STEP_FAILED_TO_SAVE"] = "CORRUPT_STEP_FAILED_TO_SAVE";
|
|
22
21
|
return NCS_ERROR_CODE;
|
|
23
22
|
}({});
|
|
24
23
|
|
|
@@ -69,6 +69,5 @@ export let CatchupEventReason = /*#__PURE__*/function (CatchupEventReason) {
|
|
|
69
69
|
CatchupEventReason["STEPS_REJECTED"] = "onStepsRejected";
|
|
70
70
|
CatchupEventReason["PROCESS_STEPS"] = "processSteps";
|
|
71
71
|
CatchupEventReason["RECONNECTED"] = "reconnected";
|
|
72
|
-
CatchupEventReason["CORRUPT_STEP"] = "corruptStep";
|
|
73
72
|
return CatchupEventReason;
|
|
74
73
|
}({});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import countBy from 'lodash/countBy';
|
|
2
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
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';
|
|
@@ -34,8 +33,6 @@ export class CommitStepService {
|
|
|
34
33
|
hasRecovered,
|
|
35
34
|
collabMode,
|
|
36
35
|
reason,
|
|
37
|
-
numberOfStepCommitsSent,
|
|
38
|
-
setNumberOfCommitsSent,
|
|
39
36
|
lockSteps
|
|
40
37
|
}) {
|
|
41
38
|
// this timer is for waiting to send the next batch in between acks from the BE
|
|
@@ -110,17 +107,11 @@ export class CommitStepService {
|
|
|
110
107
|
version
|
|
111
108
|
});
|
|
112
109
|
try {
|
|
113
|
-
var _FeatureGates$getExpe;
|
|
114
|
-
const n = (_FeatureGates$getExpe = FeatureGates.getExperimentValue('platform_editor_step_validation_on_connect', 'steps', 0)) !== null && _FeatureGates$getExpe !== void 0 ? _FeatureGates$getExpe : 0;
|
|
115
|
-
const isExperimentEnabled = n > 0;
|
|
116
|
-
// skip validation if FG is on and we have already sent n steps, or if FG is off
|
|
117
|
-
const skipValidation = isExperimentEnabled ? numberOfStepCommitsSent >= n : true;
|
|
118
110
|
this.broadcast('steps:commit', {
|
|
119
111
|
collabMode,
|
|
120
112
|
steps: stepsWithClientAndUserId,
|
|
121
113
|
version,
|
|
122
|
-
userId
|
|
123
|
-
skipValidation
|
|
114
|
+
userId
|
|
124
115
|
}, response => {
|
|
125
116
|
this.lastBroadcastRequestAcked = true;
|
|
126
117
|
const latency = new Date().getTime() - start;
|
|
@@ -171,9 +162,6 @@ export class CommitStepService {
|
|
|
171
162
|
console.error(ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG);
|
|
172
163
|
}
|
|
173
164
|
});
|
|
174
|
-
if (isExperimentEnabled && numberOfStepCommitsSent < n) {
|
|
175
|
-
setNumberOfCommitsSent(numberOfStepCommitsSent + 1);
|
|
176
|
-
}
|
|
177
165
|
} catch (error) {
|
|
178
166
|
var _this$analyticsHelper2;
|
|
179
167
|
// if the broadcast failed for any reason, we shouldn't keep the queue locked as the BE has not recieved any message
|
|
@@ -95,7 +95,6 @@ export class Provider extends Emitter {
|
|
|
95
95
|
initial: !initialized
|
|
96
96
|
});
|
|
97
97
|
const unconfirmedStepsLength = (_this$documentService = this.documentService.getUnconfirmedSteps()) === null || _this$documentService === void 0 ? void 0 : _this$documentService.length;
|
|
98
|
-
this.documentService.setNumberOfCommitsSent(0);
|
|
99
98
|
|
|
100
99
|
// if buffering is enabled and the provider is initialized before connection,
|
|
101
100
|
// send any unconfirmed steps
|
|
@@ -182,14 +181,12 @@ export class Provider extends Emitter {
|
|
|
182
181
|
* @param {InternalError} error The error to handle
|
|
183
182
|
*/
|
|
184
183
|
_defineProperty(this, "onErrorHandled", error => {
|
|
185
|
-
var _error$data, _error$data2
|
|
184
|
+
var _error$data, _error$data2;
|
|
186
185
|
// User tried committing steps but they were rejected because:
|
|
187
186
|
// 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
|
|
188
187
|
// VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
|
|
189
188
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
190
189
|
this.documentService.onStepRejectedError();
|
|
191
|
-
} else if (((_error$data3 = error.data) === null || _error$data3 === void 0 ? void 0 : _error$data3.code) === NCS_ERROR_CODE.CORRUPT_STEP_FAILED_TO_SAVE) {
|
|
192
|
-
this.documentService.throttledCatchupv2(CatchupEventReason.CORRUPT_STEP, undefined, fg('add_session_id_to_catchup_query') ? this.sessionId : undefined);
|
|
193
190
|
} else {
|
|
194
191
|
var _this$analyticsHelper2;
|
|
195
192
|
(_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendErrorEvent(error, error.message);
|
|
@@ -16,7 +16,6 @@ import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS, CatchupEventReason } from '../
|
|
|
16
16
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
17
17
|
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
18
18
|
import { createLogger, getDocAdfWithObfuscationFromJSON, getObfuscatedSteps, getStepUGCFreeDetails, sleep } from '../helpers/utils';
|
|
19
|
-
import { SINGLE_COLLAB_MODE } from '../participants/participants-service';
|
|
20
19
|
import { MAX_STEP_REJECTED_ERROR, MAX_STEP_REJECTED_ERROR_AGGRESSIVE } from '../provider';
|
|
21
20
|
import { CommitStepService } from '../provider/commit-step';
|
|
22
21
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
@@ -71,7 +70,6 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
71
70
|
_defineProperty(this, "aggressiveCatchup", false);
|
|
72
71
|
_defineProperty(this, "catchUpOutofSync", false);
|
|
73
72
|
_defineProperty(this, "hasRecovered", false);
|
|
74
|
-
_defineProperty(this, "numberOfStepCommitsSent", 0);
|
|
75
73
|
_defineProperty(this, "timeoutExceeded", false);
|
|
76
74
|
/**
|
|
77
75
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
@@ -84,16 +82,6 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
84
82
|
// TODO: ED-26957 - why shouldn't this be leading?
|
|
85
83
|
trailing: true
|
|
86
84
|
}));
|
|
87
|
-
/**
|
|
88
|
-
* Updates the number of commits sent since connect/reconnect
|
|
89
|
-
* This is used to track the number of commits sent to the server.
|
|
90
|
-
* currently we are validating the first steps from a user after connect/reconnect - CEPS-710
|
|
91
|
-
* @param steps
|
|
92
|
-
* @example
|
|
93
|
-
*/
|
|
94
|
-
_defineProperty(this, "setNumberOfCommitsSent", function (steps) {
|
|
95
|
-
_this.numberOfStepCommitsSent = steps;
|
|
96
|
-
});
|
|
97
85
|
/**
|
|
98
86
|
* Called when:
|
|
99
87
|
* * session established(offline -> online)
|
|
@@ -133,7 +121,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
133
121
|
analyticsHelper: _this.analyticsHelper,
|
|
134
122
|
clientId: _this.clientId,
|
|
135
123
|
onStepsAdded: _this.onStepsAdded,
|
|
136
|
-
catchUpOutofSync:
|
|
124
|
+
catchUpOutofSync: _this.catchUpOutofSync,
|
|
137
125
|
reason: reason,
|
|
138
126
|
sessionId: sessionId,
|
|
139
127
|
onCatchupComplete: function onCatchupComplete(steps) {
|
|
@@ -1019,12 +1007,12 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
1019
1007
|
) {
|
|
1020
1008
|
var _this3 = this;
|
|
1021
1009
|
var offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
|
|
1022
|
-
var
|
|
1010
|
+
var onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
|
|
1023
1011
|
|
|
1024
1012
|
// Don't send any steps before we're ready.
|
|
1025
|
-
if (offlineEditingEnabled ||
|
|
1026
|
-
var
|
|
1027
|
-
if (!this.getConnected() ||
|
|
1013
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
1014
|
+
var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
|
|
1015
|
+
if (!this.getConnected() || enableOnlineStepMerging) {
|
|
1028
1016
|
return;
|
|
1029
1017
|
}
|
|
1030
1018
|
}
|
|
@@ -1033,7 +1021,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
1033
1021
|
if (!unconfirmedStepsData) {
|
|
1034
1022
|
return;
|
|
1035
1023
|
}
|
|
1036
|
-
if (offlineEditingEnabled ||
|
|
1024
|
+
if (offlineEditingEnabled || onlineStepMergingEnabled) {
|
|
1037
1025
|
this.lockStepOrigins(unconfirmedStepsData.origins);
|
|
1038
1026
|
}
|
|
1039
1027
|
var unconfirmedSteps = unconfirmedStepsData.steps;
|
|
@@ -1117,8 +1105,6 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
1117
1105
|
hasRecovered: this.hasRecovered,
|
|
1118
1106
|
collabMode: this.participantsService.getCollabMode(),
|
|
1119
1107
|
reason: reason,
|
|
1120
|
-
numberOfStepCommitsSent: this.numberOfStepCommitsSent,
|
|
1121
|
-
setNumberOfCommitsSent: this.setNumberOfCommitsSent,
|
|
1122
1108
|
lockSteps: this.lockSteps
|
|
1123
1109
|
});
|
|
1124
1110
|
}
|
|
@@ -10,7 +10,6 @@ export var NullDocumentService = /*#__PURE__*/function () {
|
|
|
10
10
|
return _this;
|
|
11
11
|
});
|
|
12
12
|
_defineProperty(this, "onErrorHandled", function () {});
|
|
13
|
-
_defineProperty(this, "setNumberOfCommitsSent", function () {});
|
|
14
13
|
}
|
|
15
14
|
return _createClass(NullDocumentService, [{
|
|
16
15
|
key: "updateDocument",
|
|
@@ -18,7 +18,6 @@ export var NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
18
18
|
NCS_ERROR_CODE["INVALID_CLOUD_ID"] = "INVALID_CLOUD_ID";
|
|
19
19
|
NCS_ERROR_CODE["RATE_LIMIT_ERROR"] = "RATE_LIMIT_ERROR";
|
|
20
20
|
NCS_ERROR_CODE["PROSEMIRROR_SCHEMA_VALIDATION_ERROR"] = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR";
|
|
21
|
-
NCS_ERROR_CODE["CORRUPT_STEP_FAILED_TO_SAVE"] = "CORRUPT_STEP_FAILED_TO_SAVE";
|
|
22
21
|
return NCS_ERROR_CODE;
|
|
23
22
|
}({});
|
|
24
23
|
|
|
@@ -69,6 +69,5 @@ export var CatchupEventReason = /*#__PURE__*/function (CatchupEventReason) {
|
|
|
69
69
|
CatchupEventReason["STEPS_REJECTED"] = "onStepsRejected";
|
|
70
70
|
CatchupEventReason["PROCESS_STEPS"] = "processSteps";
|
|
71
71
|
CatchupEventReason["RECONNECTED"] = "reconnected";
|
|
72
|
-
CatchupEventReason["CORRUPT_STEP"] = "corruptStep";
|
|
73
72
|
return CatchupEventReason;
|
|
74
73
|
}({});
|
|
@@ -4,7 +4,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import countBy from 'lodash/countBy';
|
|
7
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
8
7
|
import { ADD_STEPS_TYPE, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
9
8
|
import { AcknowledgementResponseTypes } from '../types';
|
|
10
9
|
import { NCS_ERROR_CODE } from '../errors/ncs-errors';
|
|
@@ -43,8 +42,6 @@ export var CommitStepService = /*#__PURE__*/function () {
|
|
|
43
42
|
hasRecovered = _ref.hasRecovered,
|
|
44
43
|
collabMode = _ref.collabMode,
|
|
45
44
|
reason = _ref.reason,
|
|
46
|
-
numberOfStepCommitsSent = _ref.numberOfStepCommitsSent,
|
|
47
|
-
setNumberOfCommitsSent = _ref.setNumberOfCommitsSent,
|
|
48
45
|
lockSteps = _ref.lockSteps;
|
|
49
46
|
// this timer is for waiting to send the next batch in between acks from the BE
|
|
50
47
|
var commitWaitTimer;
|
|
@@ -117,17 +114,11 @@ export var CommitStepService = /*#__PURE__*/function () {
|
|
|
117
114
|
version: version
|
|
118
115
|
});
|
|
119
116
|
try {
|
|
120
|
-
var _FeatureGates$getExpe;
|
|
121
|
-
var n = (_FeatureGates$getExpe = FeatureGates.getExperimentValue('platform_editor_step_validation_on_connect', 'steps', 0)) !== null && _FeatureGates$getExpe !== void 0 ? _FeatureGates$getExpe : 0;
|
|
122
|
-
var isExperimentEnabled = n > 0;
|
|
123
|
-
// skip validation if FG is on and we have already sent n steps, or if FG is off
|
|
124
|
-
var skipValidation = isExperimentEnabled ? numberOfStepCommitsSent >= n : true;
|
|
125
117
|
this.broadcast('steps:commit', {
|
|
126
118
|
collabMode: collabMode,
|
|
127
119
|
steps: stepsWithClientAndUserId,
|
|
128
120
|
version: version,
|
|
129
|
-
userId: userId
|
|
130
|
-
skipValidation: skipValidation
|
|
121
|
+
userId: userId
|
|
131
122
|
}, function (response) {
|
|
132
123
|
_this.lastBroadcastRequestAcked = true;
|
|
133
124
|
var latency = new Date().getTime() - start;
|
|
@@ -178,9 +169,6 @@ export var CommitStepService = /*#__PURE__*/function () {
|
|
|
178
169
|
console.error(ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG);
|
|
179
170
|
}
|
|
180
171
|
});
|
|
181
|
-
if (isExperimentEnabled && numberOfStepCommitsSent < n) {
|
|
182
|
-
setNumberOfCommitsSent(numberOfStepCommitsSent + 1);
|
|
183
|
-
}
|
|
184
172
|
} catch (error) {
|
|
185
173
|
var _this$analyticsHelper2;
|
|
186
174
|
// if the broadcast failed for any reason, we shouldn't keep the queue locked as the BE has not recieved any message
|
|
@@ -110,7 +110,6 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
110
110
|
initial: !initialized
|
|
111
111
|
});
|
|
112
112
|
var unconfirmedStepsLength = (_this$documentService = _this.documentService.getUnconfirmedSteps()) === null || _this$documentService === void 0 ? void 0 : _this$documentService.length;
|
|
113
|
-
_this.documentService.setNumberOfCommitsSent(0);
|
|
114
113
|
|
|
115
114
|
// if buffering is enabled and the provider is initialized before connection,
|
|
116
115
|
// send any unconfirmed steps
|
|
@@ -213,14 +212,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
213
212
|
* @param {InternalError} error The error to handle
|
|
214
213
|
*/
|
|
215
214
|
_defineProperty(_this, "onErrorHandled", function (error) {
|
|
216
|
-
var _error$data, _error$data2
|
|
215
|
+
var _error$data, _error$data2;
|
|
217
216
|
// User tried committing steps but they were rejected because:
|
|
218
217
|
// 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
|
|
219
218
|
// VERSION_NUMBER_ALREADY_EXISTS: while storing the steps there was a conflict meaning someone else wrote steps into the database more quickly
|
|
220
219
|
if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
|
|
221
220
|
_this.documentService.onStepRejectedError();
|
|
222
|
-
} else if (((_error$data3 = error.data) === null || _error$data3 === void 0 ? void 0 : _error$data3.code) === NCS_ERROR_CODE.CORRUPT_STEP_FAILED_TO_SAVE) {
|
|
223
|
-
_this.documentService.throttledCatchupv2(CatchupEventReason.CORRUPT_STEP, undefined, fg('add_session_id_to_catchup_query') ? _this.sessionId : undefined);
|
|
224
221
|
} else {
|
|
225
222
|
var _this$analyticsHelper2;
|
|
226
223
|
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, error.message);
|
package/dist/types/channel.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Emitter } from './emitter';
|
|
3
2
|
import type { Config, ChannelEvent, Catchupv2Response, ReconcileResponse, GenerateDiffStepsResponseBody } from './types';
|
|
4
3
|
import { type CatchupEventReason } from './helpers/const';
|
|
@@ -56,7 +55,7 @@ export declare class Channel extends Emitter<ChannelEvent> {
|
|
|
56
55
|
* @throws {NotInitializedError} Channel not initialized
|
|
57
56
|
* @throws {NotConnectedError} Channel not connected
|
|
58
57
|
*/
|
|
59
|
-
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K],
|
|
58
|
+
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
|
|
60
59
|
/**
|
|
61
60
|
* Send metadata to the back-end service over the channel
|
|
62
61
|
* @throws {NotInitializedError} Channel not initialized
|
|
@@ -35,7 +35,6 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
35
35
|
private aggressiveCatchup;
|
|
36
36
|
private catchUpOutofSync;
|
|
37
37
|
private hasRecovered;
|
|
38
|
-
private numberOfStepCommitsSent;
|
|
39
38
|
private commitStepService;
|
|
40
39
|
private timeout;
|
|
41
40
|
private timeoutExceeded;
|
|
@@ -61,22 +60,14 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
61
60
|
* @param getConnected - if the channel is currently connected
|
|
62
61
|
* @example
|
|
63
62
|
*/
|
|
64
|
-
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean) => Promise<Catchupv2Response>, fetchReconcile: (currentStateDoc: string, reason: string) => Promise<ReconcileResponse>, fetchGeneratedDiffSteps: (currentStateDoc: string, reason: string) => Promise<GenerateDiffStepsResponseBody>, 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, isNameSpaceLocked: () => boolean, enableErrorOnFailedDocumentApply: boolean, options: {
|
|
63
|
+
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean) => Promise<Catchupv2Response>, fetchReconcile: (currentStateDoc: string, reason: string) => Promise<ReconcileResponse>, fetchGeneratedDiffSteps: (currentStateDoc: string, reason: string) => Promise<GenerateDiffStepsResponseBody>, 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, isNameSpaceLocked: () => boolean, enableErrorOnFailedDocumentApply: boolean | undefined, options: {
|
|
65
64
|
__livePage: boolean;
|
|
66
|
-
}, getConnected: () => boolean);
|
|
65
|
+
} | undefined, getConnected: () => boolean);
|
|
67
66
|
/**
|
|
68
67
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
69
68
|
* @param reason - optional reason to attach.
|
|
70
69
|
*/
|
|
71
70
|
throttledCatchupv2: import("lodash").DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
|
|
72
|
-
/**
|
|
73
|
-
* Updates the number of commits sent since connect/reconnect
|
|
74
|
-
* This is used to track the number of commits sent to the server.
|
|
75
|
-
* currently we are validating the first steps from a user after connect/reconnect - CEPS-710
|
|
76
|
-
* @param steps
|
|
77
|
-
* @example
|
|
78
|
-
*/
|
|
79
|
-
setNumberOfCommitsSent: (steps: number) => void;
|
|
80
71
|
/**
|
|
81
72
|
* Called when:
|
|
82
73
|
* * session established(offline -> online)
|
|
@@ -126,14 +117,14 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
126
117
|
to?: number | undefined;
|
|
127
118
|
};
|
|
128
119
|
stepMetadata: {
|
|
129
|
-
source?: string
|
|
130
|
-
stepId?: string
|
|
131
|
-
prevStepId?: string
|
|
132
|
-
rebased?: boolean
|
|
133
|
-
traceId?: string
|
|
134
|
-
reqId?: string
|
|
135
|
-
schemaVersion?: string
|
|
136
|
-
unconfirmedStepAfterRecovery?: boolean
|
|
120
|
+
source?: string;
|
|
121
|
+
stepId?: string;
|
|
122
|
+
prevStepId?: string;
|
|
123
|
+
rebased?: boolean;
|
|
124
|
+
traceId?: string;
|
|
125
|
+
reqId?: string;
|
|
126
|
+
schemaVersion?: string;
|
|
127
|
+
unconfirmedStepAfterRecovery?: boolean;
|
|
137
128
|
} | undefined;
|
|
138
129
|
}[];
|
|
139
130
|
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
|
|
@@ -16,8 +16,7 @@ export declare enum NCS_ERROR_CODE {
|
|
|
16
16
|
INVALID_DOCUMENT_ARI = "INVALID_DOCUMENT_ARI",
|
|
17
17
|
INVALID_CLOUD_ID = "INVALID_CLOUD_ID",
|
|
18
18
|
RATE_LIMIT_ERROR = "RATE_LIMIT_ERROR",
|
|
19
|
-
PROSEMIRROR_SCHEMA_VALIDATION_ERROR = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR"
|
|
20
|
-
CORRUPT_STEP_FAILED_TO_SAVE = "CORRUPT_STEP_FAILED_TO_SAVE"
|
|
19
|
+
PROSEMIRROR_SCHEMA_VALIDATION_ERROR = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR"
|
|
21
20
|
}
|
|
22
21
|
type HeadVersionUpdateFailedError = {
|
|
23
22
|
message: string;
|
|
@@ -164,14 +163,6 @@ type InvalidCloudIdError = {
|
|
|
164
163
|
status: number;
|
|
165
164
|
};
|
|
166
165
|
};
|
|
167
|
-
type CorruptStepFailedToApplyError = {
|
|
168
|
-
message: string;
|
|
169
|
-
data: {
|
|
170
|
-
code: NCS_ERROR_CODE.CORRUPT_STEP_FAILED_TO_SAVE;
|
|
171
|
-
meta: string;
|
|
172
|
-
status: number;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
166
|
/**
|
|
176
167
|
* The client is trying to send too many messages or messages that are too large. This not expected to be a standard
|
|
177
168
|
* operating condition and should only ever indicate a frontend bug.
|
|
@@ -189,5 +180,5 @@ export type RateLimitError = {
|
|
|
189
180
|
status: 500;
|
|
190
181
|
};
|
|
191
182
|
};
|
|
192
|
-
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError
|
|
183
|
+
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError;
|
|
193
184
|
export {};
|
|
@@ -318,7 +318,6 @@ export declare enum CatchupEventReason {
|
|
|
318
318
|
STEPS_ADDED = "onStepsAdded",
|
|
319
319
|
STEPS_REJECTED = "onStepsRejected",
|
|
320
320
|
PROCESS_STEPS = "processSteps",
|
|
321
|
-
RECONNECTED = "reconnected"
|
|
322
|
-
CORRUPT_STEP = "corruptStep"
|
|
321
|
+
RECONNECTED = "reconnected"
|
|
323
322
|
}
|
|
324
323
|
export {};
|
|
@@ -47,14 +47,14 @@ export declare const getObfuscatedSteps: (steps: StepJson[], endIndex?: number |
|
|
|
47
47
|
to?: number | undefined;
|
|
48
48
|
};
|
|
49
49
|
stepMetadata: {
|
|
50
|
-
source?: string
|
|
51
|
-
stepId?: string
|
|
52
|
-
prevStepId?: string
|
|
53
|
-
rebased?: boolean
|
|
54
|
-
traceId?: string
|
|
55
|
-
reqId?: string
|
|
56
|
-
schemaVersion?: string
|
|
57
|
-
unconfirmedStepAfterRecovery?: boolean
|
|
50
|
+
source?: string;
|
|
51
|
+
stepId?: string;
|
|
52
|
+
prevStepId?: string;
|
|
53
|
+
rebased?: boolean;
|
|
54
|
+
traceId?: string;
|
|
55
|
+
reqId?: string;
|
|
56
|
+
schemaVersion?: string;
|
|
57
|
+
unconfirmedStepAfterRecovery?: boolean;
|
|
58
58
|
} | undefined;
|
|
59
59
|
}[];
|
|
60
60
|
export declare function logObfuscatedSteps(oldState: EditorState | null, newState: EditorState): Promise<CustomError | {
|
|
@@ -16,10 +16,7 @@ export type BatchProps = {
|
|
|
16
16
|
/** when to stop fetching users. eg. if this = 5, we won't attempt to hydrate more than 5 **/
|
|
17
17
|
participantsLimit?: number;
|
|
18
18
|
};
|
|
19
|
-
export declare const createParticipantFromPayload: (payload:
|
|
20
|
-
timestamp: number;
|
|
21
|
-
data?: Record<string, any> | undefined;
|
|
22
|
-
} & {
|
|
19
|
+
export declare const createParticipantFromPayload: (payload: PresencePayload & {
|
|
23
20
|
userId: string;
|
|
24
21
|
}, getUser: GetUserType) => Promise<ProviderParticipant>;
|
|
25
22
|
/**
|
|
@@ -47,14 +47,14 @@ export declare class ParticipantsService {
|
|
|
47
47
|
* @param fetchAnonymousAsset
|
|
48
48
|
* @example
|
|
49
49
|
*/
|
|
50
|
-
constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'presence:changed', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabPresenceActivityChangePayload) => void, getUser: GetUserType, batchProps: BatchProps | undefined, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined, fetchAnonymousAsset?: FetchAnonymousAsset | undefined);
|
|
50
|
+
constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState | undefined, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'presence:changed', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabPresenceActivityChangePayload) => void, getUser: GetUserType, batchProps: BatchProps | undefined, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined, fetchAnonymousAsset?: FetchAnonymousAsset | undefined);
|
|
51
51
|
sendPresenceActivityChanged: () => void;
|
|
52
52
|
sendAIProviderChanged: (payload: {
|
|
53
53
|
userId: string;
|
|
54
54
|
sessionId: string;
|
|
55
55
|
clientId: string | number;
|
|
56
56
|
providerId?: string;
|
|
57
|
-
action:
|
|
57
|
+
action: "add" | "remove";
|
|
58
58
|
permit?: UserPermitType;
|
|
59
59
|
}) => void;
|
|
60
60
|
private buildAIProviderPresencePayload;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AcknowledgementPayload } from '../types';
|
|
2
2
|
import type { CollabTelepointerPayload, StepJson, ProviderParticipant } from '@atlaskit/editor-common/collab';
|
|
3
3
|
export declare const telepointerFromStep: (participants: ProviderParticipant[], step: StepJson) => CollabTelepointerPayload | undefined;
|
|
4
|
-
export declare const telepointerCallback: (documentAri: string) => (response: AcknowledgementPayload) => void;
|
|
4
|
+
export declare const telepointerCallback: (documentAri: string) => ((response: AcknowledgementPayload) => void);
|
|
@@ -20,7 +20,7 @@ export declare class CommitStepService {
|
|
|
20
20
|
* @param onErrorHandled - Callback to handle
|
|
21
21
|
*/
|
|
22
22
|
constructor(broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, analyticsHelper: AnalyticsHelper | undefined, emit: (evt: keyof CollabEvents, data: any) => void, onErrorHandled: (error: InternalError) => void);
|
|
23
|
-
commitStepQueue({ steps, version, userId, clientId, onStepsAdded, __livePage, hasRecovered, collabMode, reason,
|
|
23
|
+
commitStepQueue({ steps, version, userId, clientId, onStepsAdded, __livePage, hasRecovered, collabMode, reason, lockSteps, }: {
|
|
24
24
|
steps: readonly ProseMirrorStep[];
|
|
25
25
|
version: number;
|
|
26
26
|
userId: string;
|
|
@@ -30,8 +30,6 @@ export declare class CommitStepService {
|
|
|
30
30
|
hasRecovered: boolean;
|
|
31
31
|
collabMode: string;
|
|
32
32
|
reason?: GetResolvedEditorStateReason;
|
|
33
|
-
numberOfStepCommitsSent: number;
|
|
34
|
-
setNumberOfCommitsSent: (steps: number) => void;
|
|
35
33
|
lockSteps: (stepOrigins?: readonly Transaction[]) => void;
|
|
36
34
|
}): void;
|
|
37
35
|
private isExpandChangeStep;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -104,19 +104,19 @@ export interface InitAndAuthData {
|
|
|
104
104
|
}
|
|
105
105
|
export type AuthCallback = (cb: (data: InitAndAuthData) => void) => void;
|
|
106
106
|
interface SimpleEventEmitter {
|
|
107
|
-
on(event: string, fn: Function)
|
|
107
|
+
on: (event: string, fn: Function) => SimpleEventEmitter;
|
|
108
108
|
}
|
|
109
109
|
export interface Socket extends SimpleEventEmitter {
|
|
110
110
|
id: string;
|
|
111
|
-
connect()
|
|
112
|
-
emit(event: string, ...args: any[])
|
|
113
|
-
close()
|
|
111
|
+
connect: () => Socket;
|
|
112
|
+
emit: (event: string, ...args: any[]) => Socket;
|
|
113
|
+
close: () => Socket;
|
|
114
114
|
io?: Manager;
|
|
115
115
|
}
|
|
116
116
|
export type LifecycleEvents = 'save' | 'restore';
|
|
117
117
|
export type EventHandler = () => void;
|
|
118
118
|
export interface Lifecycle {
|
|
119
|
-
on(event: LifecycleEvents, handler: EventHandler)
|
|
119
|
+
on: (event: LifecycleEvents, handler: EventHandler) => void;
|
|
120
120
|
}
|
|
121
121
|
export type InitPayload = {
|
|
122
122
|
doc: any;
|
|
@@ -196,7 +196,6 @@ export type ChannelEvent = {
|
|
|
196
196
|
userId: string;
|
|
197
197
|
collabMode: string;
|
|
198
198
|
forcePublish?: boolean;
|
|
199
|
-
skipValidation: boolean;
|
|
200
199
|
};
|
|
201
200
|
'steps:added': StepsPayload;
|
|
202
201
|
'metadata:changed': Metadata;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Emitter } from './emitter';
|
|
3
2
|
import type { Config, ChannelEvent, Catchupv2Response, ReconcileResponse, GenerateDiffStepsResponseBody } from './types';
|
|
4
3
|
import { type CatchupEventReason } from './helpers/const';
|
|
@@ -56,7 +55,7 @@ export declare class Channel extends Emitter<ChannelEvent> {
|
|
|
56
55
|
* @throws {NotInitializedError} Channel not initialized
|
|
57
56
|
* @throws {NotConnectedError} Channel not connected
|
|
58
57
|
*/
|
|
59
|
-
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K],
|
|
58
|
+
broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], "timestamp">, callback?: Function) => void;
|
|
60
59
|
/**
|
|
61
60
|
* Send metadata to the back-end service over the channel
|
|
62
61
|
* @throws {NotInitializedError} Channel not initialized
|
|
@@ -35,7 +35,6 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
35
35
|
private aggressiveCatchup;
|
|
36
36
|
private catchUpOutofSync;
|
|
37
37
|
private hasRecovered;
|
|
38
|
-
private numberOfStepCommitsSent;
|
|
39
38
|
private commitStepService;
|
|
40
39
|
private timeout;
|
|
41
40
|
private timeoutExceeded;
|
|
@@ -61,22 +60,14 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
61
60
|
* @param getConnected - if the channel is currently connected
|
|
62
61
|
* @example
|
|
63
62
|
*/
|
|
64
|
-
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean) => Promise<Catchupv2Response>, fetchReconcile: (currentStateDoc: string, reason: string) => Promise<ReconcileResponse>, fetchGeneratedDiffSteps: (currentStateDoc: string, reason: string) => Promise<GenerateDiffStepsResponseBody>, 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, isNameSpaceLocked: () => boolean, enableErrorOnFailedDocumentApply: boolean, options: {
|
|
63
|
+
constructor(participantsService: ParticipantsService, analyticsHelper: AnalyticsHelper | undefined, fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean) => Promise<Catchupv2Response>, fetchReconcile: (currentStateDoc: string, reason: string) => Promise<ReconcileResponse>, fetchGeneratedDiffSteps: (currentStateDoc: string, reason: string) => Promise<GenerateDiffStepsResponseBody>, 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, isNameSpaceLocked: () => boolean, enableErrorOnFailedDocumentApply: boolean | undefined, options: {
|
|
65
64
|
__livePage: boolean;
|
|
66
|
-
}, getConnected: () => boolean);
|
|
65
|
+
} | undefined, getConnected: () => boolean);
|
|
67
66
|
/**
|
|
68
67
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
69
68
|
* @param reason - optional reason to attach.
|
|
70
69
|
*/
|
|
71
70
|
throttledCatchupv2: import("lodash").DebouncedFunc<(reason?: CatchupEventReason, reconnectionMetadata?: ReconnectionMetadata, sessionId?: string) => Promise<void>>;
|
|
72
|
-
/**
|
|
73
|
-
* Updates the number of commits sent since connect/reconnect
|
|
74
|
-
* This is used to track the number of commits sent to the server.
|
|
75
|
-
* currently we are validating the first steps from a user after connect/reconnect - CEPS-710
|
|
76
|
-
* @param steps
|
|
77
|
-
* @example
|
|
78
|
-
*/
|
|
79
|
-
setNumberOfCommitsSent: (steps: number) => void;
|
|
80
71
|
/**
|
|
81
72
|
* Called when:
|
|
82
73
|
* * session established(offline -> online)
|
|
@@ -126,14 +117,14 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
126
117
|
to?: number | undefined;
|
|
127
118
|
};
|
|
128
119
|
stepMetadata: {
|
|
129
|
-
source?: string
|
|
130
|
-
stepId?: string
|
|
131
|
-
prevStepId?: string
|
|
132
|
-
rebased?: boolean
|
|
133
|
-
traceId?: string
|
|
134
|
-
reqId?: string
|
|
135
|
-
schemaVersion?: string
|
|
136
|
-
unconfirmedStepAfterRecovery?: boolean
|
|
120
|
+
source?: string;
|
|
121
|
+
stepId?: string;
|
|
122
|
+
prevStepId?: string;
|
|
123
|
+
rebased?: boolean;
|
|
124
|
+
traceId?: string;
|
|
125
|
+
reqId?: string;
|
|
126
|
+
schemaVersion?: string;
|
|
127
|
+
unconfirmedStepAfterRecovery?: boolean;
|
|
137
128
|
} | undefined;
|
|
138
129
|
}[];
|
|
139
130
|
obfuscatedDoc: string | import("@atlaskit/adf-utils/types").ADFEntity | null | undefined;
|
|
@@ -16,8 +16,7 @@ export declare enum NCS_ERROR_CODE {
|
|
|
16
16
|
INVALID_DOCUMENT_ARI = "INVALID_DOCUMENT_ARI",
|
|
17
17
|
INVALID_CLOUD_ID = "INVALID_CLOUD_ID",
|
|
18
18
|
RATE_LIMIT_ERROR = "RATE_LIMIT_ERROR",
|
|
19
|
-
PROSEMIRROR_SCHEMA_VALIDATION_ERROR = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR"
|
|
20
|
-
CORRUPT_STEP_FAILED_TO_SAVE = "CORRUPT_STEP_FAILED_TO_SAVE"
|
|
19
|
+
PROSEMIRROR_SCHEMA_VALIDATION_ERROR = "PROSEMIRROR_SCHEMA_VALIDATION_ERROR"
|
|
21
20
|
}
|
|
22
21
|
type HeadVersionUpdateFailedError = {
|
|
23
22
|
message: string;
|
|
@@ -164,14 +163,6 @@ type InvalidCloudIdError = {
|
|
|
164
163
|
status: number;
|
|
165
164
|
};
|
|
166
165
|
};
|
|
167
|
-
type CorruptStepFailedToApplyError = {
|
|
168
|
-
message: string;
|
|
169
|
-
data: {
|
|
170
|
-
code: NCS_ERROR_CODE.CORRUPT_STEP_FAILED_TO_SAVE;
|
|
171
|
-
meta: string;
|
|
172
|
-
status: number;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
166
|
/**
|
|
176
167
|
* The client is trying to send too many messages or messages that are too large. This not expected to be a standard
|
|
177
168
|
* operating condition and should only ever indicate a frontend bug.
|
|
@@ -189,5 +180,5 @@ export type RateLimitError = {
|
|
|
189
180
|
status: 500;
|
|
190
181
|
};
|
|
191
182
|
};
|
|
192
|
-
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError
|
|
183
|
+
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError;
|
|
193
184
|
export {};
|
|
@@ -318,7 +318,6 @@ export declare enum CatchupEventReason {
|
|
|
318
318
|
STEPS_ADDED = "onStepsAdded",
|
|
319
319
|
STEPS_REJECTED = "onStepsRejected",
|
|
320
320
|
PROCESS_STEPS = "processSteps",
|
|
321
|
-
RECONNECTED = "reconnected"
|
|
322
|
-
CORRUPT_STEP = "corruptStep"
|
|
321
|
+
RECONNECTED = "reconnected"
|
|
323
322
|
}
|
|
324
323
|
export {};
|
|
@@ -47,14 +47,14 @@ export declare const getObfuscatedSteps: (steps: StepJson[], endIndex?: number |
|
|
|
47
47
|
to?: number | undefined;
|
|
48
48
|
};
|
|
49
49
|
stepMetadata: {
|
|
50
|
-
source?: string
|
|
51
|
-
stepId?: string
|
|
52
|
-
prevStepId?: string
|
|
53
|
-
rebased?: boolean
|
|
54
|
-
traceId?: string
|
|
55
|
-
reqId?: string
|
|
56
|
-
schemaVersion?: string
|
|
57
|
-
unconfirmedStepAfterRecovery?: boolean
|
|
50
|
+
source?: string;
|
|
51
|
+
stepId?: string;
|
|
52
|
+
prevStepId?: string;
|
|
53
|
+
rebased?: boolean;
|
|
54
|
+
traceId?: string;
|
|
55
|
+
reqId?: string;
|
|
56
|
+
schemaVersion?: string;
|
|
57
|
+
unconfirmedStepAfterRecovery?: boolean;
|
|
58
58
|
} | undefined;
|
|
59
59
|
}[];
|
|
60
60
|
export declare function logObfuscatedSteps(oldState: EditorState | null, newState: EditorState): Promise<CustomError | {
|
|
@@ -16,10 +16,7 @@ export type BatchProps = {
|
|
|
16
16
|
/** when to stop fetching users. eg. if this = 5, we won't attempt to hydrate more than 5 **/
|
|
17
17
|
participantsLimit?: number;
|
|
18
18
|
};
|
|
19
|
-
export declare const createParticipantFromPayload: (payload:
|
|
20
|
-
timestamp: number;
|
|
21
|
-
data?: Record<string, any> | undefined;
|
|
22
|
-
} & {
|
|
19
|
+
export declare const createParticipantFromPayload: (payload: PresencePayload & {
|
|
23
20
|
userId: string;
|
|
24
21
|
}, getUser: GetUserType) => Promise<ProviderParticipant>;
|
|
25
22
|
/**
|
|
@@ -47,14 +47,14 @@ export declare class ParticipantsService {
|
|
|
47
47
|
* @param fetchAnonymousAsset
|
|
48
48
|
* @example
|
|
49
49
|
*/
|
|
50
|
-
constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'presence:changed', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabPresenceActivityChangePayload) => void, getUser: GetUserType, batchProps: BatchProps | undefined, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined, fetchAnonymousAsset?: FetchAnonymousAsset | undefined);
|
|
50
|
+
constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState | undefined, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'presence:changed', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabPresenceActivityChangePayload) => void, getUser: GetUserType, batchProps: BatchProps | undefined, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined, fetchAnonymousAsset?: FetchAnonymousAsset | undefined);
|
|
51
51
|
sendPresenceActivityChanged: () => void;
|
|
52
52
|
sendAIProviderChanged: (payload: {
|
|
53
53
|
userId: string;
|
|
54
54
|
sessionId: string;
|
|
55
55
|
clientId: string | number;
|
|
56
56
|
providerId?: string;
|
|
57
|
-
action:
|
|
57
|
+
action: "add" | "remove";
|
|
58
58
|
permit?: UserPermitType;
|
|
59
59
|
}) => void;
|
|
60
60
|
private buildAIProviderPresencePayload;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AcknowledgementPayload } from '../types';
|
|
2
2
|
import type { CollabTelepointerPayload, StepJson, ProviderParticipant } from '@atlaskit/editor-common/collab';
|
|
3
3
|
export declare const telepointerFromStep: (participants: ProviderParticipant[], step: StepJson) => CollabTelepointerPayload | undefined;
|
|
4
|
-
export declare const telepointerCallback: (documentAri: string) => (response: AcknowledgementPayload) => void;
|
|
4
|
+
export declare const telepointerCallback: (documentAri: string) => ((response: AcknowledgementPayload) => void);
|
|
@@ -20,7 +20,7 @@ export declare class CommitStepService {
|
|
|
20
20
|
* @param onErrorHandled - Callback to handle
|
|
21
21
|
*/
|
|
22
22
|
constructor(broadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, analyticsHelper: AnalyticsHelper | undefined, emit: (evt: keyof CollabEvents, data: any) => void, onErrorHandled: (error: InternalError) => void);
|
|
23
|
-
commitStepQueue({ steps, version, userId, clientId, onStepsAdded, __livePage, hasRecovered, collabMode, reason,
|
|
23
|
+
commitStepQueue({ steps, version, userId, clientId, onStepsAdded, __livePage, hasRecovered, collabMode, reason, lockSteps, }: {
|
|
24
24
|
steps: readonly ProseMirrorStep[];
|
|
25
25
|
version: number;
|
|
26
26
|
userId: string;
|
|
@@ -30,8 +30,6 @@ export declare class CommitStepService {
|
|
|
30
30
|
hasRecovered: boolean;
|
|
31
31
|
collabMode: string;
|
|
32
32
|
reason?: GetResolvedEditorStateReason;
|
|
33
|
-
numberOfStepCommitsSent: number;
|
|
34
|
-
setNumberOfCommitsSent: (steps: number) => void;
|
|
35
33
|
lockSteps: (stepOrigins?: readonly Transaction[]) => void;
|
|
36
34
|
}): void;
|
|
37
35
|
private isExpandChangeStep;
|
|
@@ -104,19 +104,19 @@ export interface InitAndAuthData {
|
|
|
104
104
|
}
|
|
105
105
|
export type AuthCallback = (cb: (data: InitAndAuthData) => void) => void;
|
|
106
106
|
interface SimpleEventEmitter {
|
|
107
|
-
on(event: string, fn: Function)
|
|
107
|
+
on: (event: string, fn: Function) => SimpleEventEmitter;
|
|
108
108
|
}
|
|
109
109
|
export interface Socket extends SimpleEventEmitter {
|
|
110
110
|
id: string;
|
|
111
|
-
connect()
|
|
112
|
-
emit(event: string, ...args: any[])
|
|
113
|
-
close()
|
|
111
|
+
connect: () => Socket;
|
|
112
|
+
emit: (event: string, ...args: any[]) => Socket;
|
|
113
|
+
close: () => Socket;
|
|
114
114
|
io?: Manager;
|
|
115
115
|
}
|
|
116
116
|
export type LifecycleEvents = 'save' | 'restore';
|
|
117
117
|
export type EventHandler = () => void;
|
|
118
118
|
export interface Lifecycle {
|
|
119
|
-
on(event: LifecycleEvents, handler: EventHandler)
|
|
119
|
+
on: (event: LifecycleEvents, handler: EventHandler) => void;
|
|
120
120
|
}
|
|
121
121
|
export type InitPayload = {
|
|
122
122
|
doc: any;
|
|
@@ -196,7 +196,6 @@ export type ChannelEvent = {
|
|
|
196
196
|
userId: string;
|
|
197
197
|
collabMode: string;
|
|
198
198
|
forcePublish?: boolean;
|
|
199
|
-
skipValidation: boolean;
|
|
200
199
|
};
|
|
201
200
|
'steps:added': StepsPayload;
|
|
202
201
|
'metadata:changed': Metadata;
|
|
@@ -652,9 +652,7 @@ The send function and commit queue behavior is controlled by several feature fla
|
|
|
652
652
|
1. **`platform_editor_offline_editing_web`**: Enables offline editing support with step timeout
|
|
653
653
|
handling
|
|
654
654
|
2. **`platform_editor_enable_single_player_step_merging`**: Enables step merging for single users
|
|
655
|
-
3. **`
|
|
656
|
-
operations
|
|
657
|
-
4. **`platform_editor_step_validation_on_connect`**: Controls step validation for first N steps
|
|
655
|
+
3. **`platform_editor_step_validation_on_connect`**: Controls step validation for first N steps
|
|
658
656
|
after connection
|
|
659
657
|
|
|
660
658
|
### Publish Operation Optimization
|
|
@@ -662,10 +660,8 @@ The send function and commit queue behavior is controlled by several feature fla
|
|
|
662
660
|
```typescript
|
|
663
661
|
// Special handling for publish operations
|
|
664
662
|
if (reason === 'publish' && this.lastBroadcastRequestAcked) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
this.readyToCommit = true;
|
|
668
|
-
}
|
|
663
|
+
clearTimeout(commitWaitTimer);
|
|
664
|
+
this.readyToCommit = true;
|
|
669
665
|
}
|
|
670
666
|
```
|
|
671
667
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.2",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"./version-wrapper": "./src/version-wrapper.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-utils": "^19.
|
|
35
|
+
"@atlaskit/adf-utils": "^19.21.0",
|
|
36
36
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
37
37
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
38
38
|
"@atlaskit/anonymous-assets": "^0.0.4",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
43
|
"@atlaskit/prosemirror-collab": "^0.17.0",
|
|
44
|
-
"@atlaskit/react-ufo": "^4.
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
44
|
+
"@atlaskit/react-ufo": "^4.3.0",
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^10.0.0",
|
|
46
46
|
"@atlaskit/ufo": "^0.4.0",
|
|
47
47
|
"@atlaskit/util-service-support": "^6.3.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
@@ -86,6 +86,6 @@
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@atlaskit/editor-common": "^107.
|
|
89
|
+
"@atlaskit/editor-common": "^107.25.0"
|
|
90
90
|
}
|
|
91
91
|
}
|
package/types/package.json
CHANGED