@atlaskit/collab-provider 9.20.5 → 9.20.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/afm-cc/tsconfig.json +0 -3
- package/dist/cjs/document/document-service.js +9 -9
- package/dist/cjs/errors/internal-errors.js +4 -0
- package/dist/cjs/participants/participants-service.js +1 -1
- package/dist/cjs/provider/index.js +21 -12
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +11 -9
- package/dist/es2019/errors/internal-errors.js +5 -0
- package/dist/es2019/participants/participants-service.js +1 -1
- package/dist/es2019/provider/index.js +21 -12
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +9 -9
- package/dist/esm/errors/internal-errors.js +5 -0
- package/dist/esm/participants/participants-service.js +1 -1
- package/dist/esm/provider/index.js +21 -12
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +4 -4
- package/dist/types/errors/internal-errors.d.ts +11 -1
- package/dist/types/participants/participants-service.d.ts +3 -3
- package/dist/types-ts4.5/document/document-service.d.ts +4 -4
- package/dist/types-ts4.5/errors/internal-errors.d.ts +11 -1
- package/dist/types-ts4.5/participants/participants-service.d.ts +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 9.20.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#63759](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63759) [`ebfe2794e306`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ebfe2794e306) - Add error for view only steps
|
|
8
|
+
|
|
9
|
+
## 9.20.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#62968](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62968) [`53208d15e680`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53208d15e680) - NO-ISSUE Unforked the ProseMirror collab library
|
|
14
|
+
|
|
3
15
|
## 9.20.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -11,16 +11,16 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _const = require("../helpers/const");
|
|
14
|
-
var _prosemirrorCollab = require("
|
|
15
|
-
var
|
|
14
|
+
var _prosemirrorCollab = require("prosemirror-collab");
|
|
15
|
+
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
16
16
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
17
|
-
var _commitStep = require("../provider/commit-step");
|
|
18
17
|
var _performance = require("../analytics/performance");
|
|
19
|
-
var
|
|
18
|
+
var _internalErrors = require("../errors/internal-errors");
|
|
19
|
+
var _utils = require("../helpers/utils");
|
|
20
20
|
var _provider = require("../provider");
|
|
21
|
+
var _commitStep = require("../provider/commit-step");
|
|
21
22
|
var _catchup = require("./catchup");
|
|
22
23
|
var _stepQueueState = require("./step-queue-state");
|
|
23
|
-
var _internalErrors = require("../errors/internal-errors");
|
|
24
24
|
var _featureFlags = require("../feature-flags");
|
|
25
25
|
var _customErrors = require("../errors/custom-errors");
|
|
26
26
|
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; }
|
|
@@ -132,7 +132,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
132
132
|
(_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
|
|
133
133
|
return 0;
|
|
134
134
|
}
|
|
135
|
-
return (0, _prosemirrorCollab.getVersion)(state);
|
|
135
|
+
return (0, _prosemirrorCollab.getVersion)(state) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
136
136
|
});
|
|
137
137
|
(0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
138
138
|
var _this$getState2, _this$analyticsHelper5, _this$analyticsHelper4, state, adfDocument, currentState, measure, _this$analyticsHelper6, _this$analyticsHelper7, _measure;
|
|
@@ -151,7 +151,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
151
151
|
currentState = {
|
|
152
152
|
content: adfDocument,
|
|
153
153
|
title: _this.metadataService.getTitle(),
|
|
154
|
-
stepVersion: (0, _prosemirrorCollab.getVersion)(state)
|
|
154
|
+
stepVersion: (0, _prosemirrorCollab.getVersion)(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
155
155
|
};
|
|
156
156
|
measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
|
|
157
157
|
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
|
|
@@ -475,7 +475,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
475
475
|
tries: count,
|
|
476
476
|
maxRetries: _const.ACK_MAX_TRY,
|
|
477
477
|
clientId: _this.clientId,
|
|
478
|
-
version: (0, _prosemirrorCollab.getVersion)(state)
|
|
478
|
+
version: (0, _prosemirrorCollab.getVersion)(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
481
|
unconfirmedStepsInfoUGCRemoved = (_this$getUnconfirmedS = _this.getUnconfirmedSteps()) === null || _this$getUnconfirmedS === void 0 ? void 0 : _this$getUnconfirmedS.map(function (step) {
|
|
@@ -646,7 +646,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
646
646
|
*/
|
|
647
647
|
function send(_tr, _oldState, newState, sendAnalyticsEvent) {
|
|
648
648
|
var unconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
|
|
649
|
-
var version = (0, _prosemirrorCollab.getVersion)(newState);
|
|
649
|
+
var version = (0, _prosemirrorCollab.getVersion)(newState) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
650
650
|
|
|
651
651
|
// Don't send any steps before we're ready.
|
|
652
652
|
if (!unconfirmedStepsData) {
|
|
@@ -14,12 +14,16 @@ var INTERNAL_ERROR_CODE = exports.INTERNAL_ERROR_CODE = /*#__PURE__*/function (I
|
|
|
14
14
|
INTERNAL_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
15
15
|
INTERNAL_ERROR_CODE["ADD_STEPS_ERROR"] = "ADD_STEPS_ERROR";
|
|
16
16
|
INTERNAL_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
17
|
+
INTERNAL_ERROR_CODE["VIEW_ONLY_STEPS_ERROR"] = "VIEW_ONLY_STEPS_ERROR";
|
|
17
18
|
return INTERNAL_ERROR_CODE;
|
|
18
19
|
}({}); // Channel Errors
|
|
19
20
|
/**
|
|
20
21
|
* When we try to apply state updates to the editor, if that fails to apply the user can enter an invalid state where no
|
|
21
22
|
* changes can be saved to NCS.
|
|
22
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* When in view only mode, we should not generate any steps whatsoever.
|
|
26
|
+
*/
|
|
23
27
|
/**
|
|
24
28
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
25
29
|
*/
|
|
@@ -126,7 +126,7 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
|
|
|
126
126
|
} catch (error) {
|
|
127
127
|
var _this$analyticsHelper2;
|
|
128
128
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
129
|
-
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'emitting disconnected data');
|
|
129
|
+
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error while emitting disconnected data');
|
|
130
130
|
}
|
|
131
131
|
if (left.length) {
|
|
132
132
|
_this.emitPresence({
|
|
@@ -27,6 +27,7 @@ var _documentService = require("../document/document-service");
|
|
|
27
27
|
var _namespaceService = require("../namespace/namespace-service");
|
|
28
28
|
var _participantsService = require("../participants/participants-service");
|
|
29
29
|
var _errorCodeMapper = require("../errors/error-code-mapper");
|
|
30
|
+
var _internalErrors = require("../errors/internal-errors");
|
|
30
31
|
var _const = require("../helpers/const");
|
|
31
32
|
var _featureFlags = require("../feature-flags");
|
|
32
33
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -367,6 +368,14 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
367
368
|
value: function send(_tr, _oldState, newState) {
|
|
368
369
|
try {
|
|
369
370
|
if (this.isViewOnly()) {
|
|
371
|
+
var _this$analyticsHelper9;
|
|
372
|
+
var error = {
|
|
373
|
+
message: 'Attempted to send steps in view only mode',
|
|
374
|
+
data: {
|
|
375
|
+
code: _internalErrors.INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(error, error.message);
|
|
370
379
|
return;
|
|
371
380
|
}
|
|
372
381
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -376,8 +385,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
376
385
|
}
|
|
377
386
|
this.documentService.send(_tr, _oldState, newState);
|
|
378
387
|
} catch (error) {
|
|
379
|
-
var _this$
|
|
380
|
-
(_this$
|
|
388
|
+
var _this$analyticsHelper10;
|
|
389
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
381
390
|
throw new _customErrors.SendTransactionError('Error while sending steps for a transaction', error);
|
|
382
391
|
}
|
|
383
392
|
}
|
|
@@ -412,9 +421,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
412
421
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
413
422
|
}
|
|
414
423
|
} catch (error) {
|
|
415
|
-
var _this$
|
|
424
|
+
var _this$analyticsHelper11;
|
|
416
425
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
417
|
-
(_this$
|
|
426
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
418
427
|
}
|
|
419
428
|
}
|
|
420
429
|
}, {
|
|
@@ -459,8 +468,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
459
468
|
}
|
|
460
469
|
}
|
|
461
470
|
} catch (error) {
|
|
462
|
-
var _this$
|
|
463
|
-
(_this$
|
|
471
|
+
var _this$analyticsHelper12;
|
|
472
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
464
473
|
throw new _customErrors.DestroyError('Error while shutting down the collab provider', error);
|
|
465
474
|
}
|
|
466
475
|
this.clearTimers();
|
|
@@ -483,8 +492,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
483
492
|
}
|
|
484
493
|
this.metadataService.setTitle(title, broadcast);
|
|
485
494
|
} catch (error) {
|
|
486
|
-
var _this$
|
|
487
|
-
(_this$
|
|
495
|
+
var _this$analyticsHelper13;
|
|
496
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while setting title');
|
|
488
497
|
throw new _customErrors.SetTitleError('Error while setting title', error);
|
|
489
498
|
}
|
|
490
499
|
}
|
|
@@ -502,8 +511,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
502
511
|
try {
|
|
503
512
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
504
513
|
} catch (error) {
|
|
505
|
-
var _this$
|
|
506
|
-
(_this$
|
|
514
|
+
var _this$analyticsHelper14;
|
|
515
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting editor width');
|
|
507
516
|
throw new _customErrors.SetEditorWidthError('Error while setting editor width', error);
|
|
508
517
|
}
|
|
509
518
|
}
|
|
@@ -522,8 +531,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
522
531
|
}
|
|
523
532
|
this.metadataService.setMetadata(metadata);
|
|
524
533
|
} catch (error) {
|
|
525
|
-
var _this$
|
|
526
|
-
(_this$
|
|
534
|
+
var _this$analyticsHelper15;
|
|
535
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting metadata');
|
|
527
536
|
throw new _customErrors.SetMetadataError('Error while setting metadata', error);
|
|
528
537
|
}
|
|
529
538
|
}
|
|
@@ -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.20.
|
|
8
|
+
var version = exports.version = "9.20.7";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
3
|
-
import { getVersion, sendableSteps } from '
|
|
4
|
-
import {
|
|
3
|
+
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
4
|
+
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
5
5
|
import throttle from 'lodash/throttle';
|
|
6
|
-
import { throttledCommitStep, commitStepQueue } from '../provider/commit-step';
|
|
7
6
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
8
|
-
import {
|
|
7
|
+
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
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
11
|
import { catchup } from './catchup';
|
|
11
12
|
import { StepQueueState } from './step-queue-state';
|
|
12
|
-
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
13
13
|
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
14
14
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
15
15
|
const CATCHUP_THROTTLE = 1 * 1000; // 1 second
|
|
@@ -97,7 +97,7 @@ export class DocumentService {
|
|
|
97
97
|
(_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
|
|
98
98
|
return 0;
|
|
99
99
|
}
|
|
100
|
-
return getVersion(state);
|
|
100
|
+
return getVersion(state) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
101
101
|
});
|
|
102
102
|
_defineProperty(this, "getCurrentState", async () => {
|
|
103
103
|
try {
|
|
@@ -114,8 +114,9 @@ export class DocumentService {
|
|
|
114
114
|
const currentState = {
|
|
115
115
|
content: adfDocument,
|
|
116
116
|
title: this.metadataService.getTitle(),
|
|
117
|
-
stepVersion: getVersion(state)
|
|
117
|
+
stepVersion: getVersion(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
118
118
|
};
|
|
119
|
+
|
|
119
120
|
const measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, this.analyticsHelper);
|
|
120
121
|
(_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
|
|
121
122
|
latency: measure === null || measure === void 0 ? void 0 : measure.duration
|
|
@@ -398,9 +399,10 @@ export class DocumentService {
|
|
|
398
399
|
tries: count,
|
|
399
400
|
maxRetries: ACK_MAX_TRY,
|
|
400
401
|
clientId: this.clientId,
|
|
401
|
-
version: getVersion(state)
|
|
402
|
+
version: getVersion(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
402
403
|
});
|
|
403
404
|
}
|
|
405
|
+
|
|
404
406
|
const unconfirmedStepsInfoUGCRemoved = (_this$getUnconfirmedS = this.getUnconfirmedSteps()) === null || _this$getUnconfirmedS === void 0 ? void 0 : _this$getUnconfirmedS.map(step => getStepUGCFreeDetails(step));
|
|
405
407
|
const error = new CantSyncUpError("Can't sync up with Collab Service: unable to send unconfirmed steps and max retry reached", {
|
|
406
408
|
unconfirmedStepsInfo: unconfirmedStepsInfoUGCRemoved ? JSON.stringify(unconfirmedStepsInfoUGCRemoved) : 'Unable to generate UGC removed step info'
|
|
@@ -544,7 +546,7 @@ export class DocumentService {
|
|
|
544
546
|
*/
|
|
545
547
|
send(_tr, _oldState, newState, sendAnalyticsEvent) {
|
|
546
548
|
const unconfirmedStepsData = sendableSteps(newState);
|
|
547
|
-
const version = getVersion(newState);
|
|
549
|
+
const version = getVersion(newState) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
548
550
|
|
|
549
551
|
// Don't send any steps before we're ready.
|
|
550
552
|
if (!unconfirmedStepsData) {
|
|
@@ -8,6 +8,7 @@ export let INTERNAL_ERROR_CODE = /*#__PURE__*/function (INTERNAL_ERROR_CODE) {
|
|
|
8
8
|
INTERNAL_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
9
9
|
INTERNAL_ERROR_CODE["ADD_STEPS_ERROR"] = "ADD_STEPS_ERROR";
|
|
10
10
|
INTERNAL_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
11
|
+
INTERNAL_ERROR_CODE["VIEW_ONLY_STEPS_ERROR"] = "VIEW_ONLY_STEPS_ERROR";
|
|
11
12
|
return INTERNAL_ERROR_CODE;
|
|
12
13
|
}({});
|
|
13
14
|
|
|
@@ -18,6 +19,10 @@ export let INTERNAL_ERROR_CODE = /*#__PURE__*/function (INTERNAL_ERROR_CODE) {
|
|
|
18
19
|
* changes can be saved to NCS.
|
|
19
20
|
*/
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* When in view only mode, we should not generate any steps whatsoever.
|
|
24
|
+
*/
|
|
25
|
+
|
|
21
26
|
/**
|
|
22
27
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
23
28
|
*/
|
|
@@ -84,7 +84,7 @@ export class ParticipantsService {
|
|
|
84
84
|
} catch (error) {
|
|
85
85
|
var _this$analyticsHelper2;
|
|
86
86
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
87
|
-
(_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendErrorEvent(error, 'emitting disconnected data');
|
|
87
|
+
(_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendErrorEvent(error, 'Error while emitting disconnected data');
|
|
88
88
|
}
|
|
89
89
|
if (left.length) {
|
|
90
90
|
this.emitPresence({
|
|
@@ -11,6 +11,7 @@ import { DocumentService } from '../document/document-service';
|
|
|
11
11
|
import { NamespaceService } from '../namespace/namespace-service';
|
|
12
12
|
import { ParticipantsService } from '../participants/participants-service';
|
|
13
13
|
import { errorCodeMapper } from '../errors/error-code-mapper';
|
|
14
|
+
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
14
15
|
import { EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
15
16
|
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
16
17
|
const logger = createLogger('Provider', 'black');
|
|
@@ -310,6 +311,14 @@ export class Provider extends Emitter {
|
|
|
310
311
|
send(_tr, _oldState, newState) {
|
|
311
312
|
try {
|
|
312
313
|
if (this.isViewOnly()) {
|
|
314
|
+
var _this$analyticsHelper9;
|
|
315
|
+
const error = {
|
|
316
|
+
message: 'Attempted to send steps in view only mode',
|
|
317
|
+
data: {
|
|
318
|
+
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(error, error.message);
|
|
313
322
|
return;
|
|
314
323
|
}
|
|
315
324
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -319,8 +328,8 @@ export class Provider extends Emitter {
|
|
|
319
328
|
}
|
|
320
329
|
this.documentService.send(_tr, _oldState, newState);
|
|
321
330
|
} catch (error) {
|
|
322
|
-
var _this$
|
|
323
|
-
(_this$
|
|
331
|
+
var _this$analyticsHelper10;
|
|
332
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
324
333
|
throw new SendTransactionError('Error while sending steps for a transaction', error);
|
|
325
334
|
}
|
|
326
335
|
}
|
|
@@ -351,9 +360,9 @@ export class Provider extends Emitter {
|
|
|
351
360
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
352
361
|
}
|
|
353
362
|
} catch (error) {
|
|
354
|
-
var _this$
|
|
363
|
+
var _this$analyticsHelper11;
|
|
355
364
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
356
|
-
(_this$
|
|
365
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
357
366
|
}
|
|
358
367
|
}
|
|
359
368
|
/**
|
|
@@ -391,8 +400,8 @@ export class Provider extends Emitter {
|
|
|
391
400
|
}
|
|
392
401
|
}
|
|
393
402
|
} catch (error) {
|
|
394
|
-
var _this$
|
|
395
|
-
(_this$
|
|
403
|
+
var _this$analyticsHelper12;
|
|
404
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
396
405
|
throw new DestroyError('Error while shutting down the collab provider', error);
|
|
397
406
|
}
|
|
398
407
|
this.clearTimers();
|
|
@@ -413,8 +422,8 @@ export class Provider extends Emitter {
|
|
|
413
422
|
}
|
|
414
423
|
this.metadataService.setTitle(title, broadcast);
|
|
415
424
|
} catch (error) {
|
|
416
|
-
var _this$
|
|
417
|
-
(_this$
|
|
425
|
+
var _this$analyticsHelper13;
|
|
426
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(error, 'Error while setting title');
|
|
418
427
|
throw new SetTitleError('Error while setting title', error);
|
|
419
428
|
}
|
|
420
429
|
}
|
|
@@ -430,8 +439,8 @@ export class Provider extends Emitter {
|
|
|
430
439
|
try {
|
|
431
440
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
432
441
|
} catch (error) {
|
|
433
|
-
var _this$
|
|
434
|
-
(_this$
|
|
442
|
+
var _this$analyticsHelper14;
|
|
443
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting editor width');
|
|
435
444
|
throw new SetEditorWidthError('Error while setting editor width', error);
|
|
436
445
|
}
|
|
437
446
|
}
|
|
@@ -448,8 +457,8 @@ export class Provider extends Emitter {
|
|
|
448
457
|
}
|
|
449
458
|
this.metadataService.setMetadata(metadata);
|
|
450
459
|
} catch (error) {
|
|
451
|
-
var _this$
|
|
452
|
-
(_this$
|
|
460
|
+
var _this$analyticsHelper15;
|
|
461
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting metadata');
|
|
453
462
|
throw new SetMetadataError('Error while setting metadata', error);
|
|
454
463
|
}
|
|
455
464
|
}
|
|
@@ -6,16 +6,16 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
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; }
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
9
|
-
import { getVersion, sendableSteps } from '
|
|
10
|
-
import {
|
|
9
|
+
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
10
|
+
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
11
11
|
import throttle from 'lodash/throttle';
|
|
12
|
-
import { throttledCommitStep, commitStepQueue } from '../provider/commit-step';
|
|
13
12
|
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
14
|
-
import {
|
|
13
|
+
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
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
17
|
import { catchup } from './catchup';
|
|
17
18
|
import { StepQueueState } from './step-queue-state';
|
|
18
|
-
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
19
19
|
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
20
20
|
import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
|
|
21
21
|
var CATCHUP_THROTTLE = 1 * 1000; // 1 second
|
|
@@ -125,7 +125,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
125
125
|
(_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
|
|
126
126
|
return 0;
|
|
127
127
|
}
|
|
128
|
-
return getVersion(state);
|
|
128
|
+
return getVersion(state) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
129
129
|
});
|
|
130
130
|
_defineProperty(this, "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
131
131
|
var _this$getState2, _this$analyticsHelper5, _this$analyticsHelper4, state, adfDocument, currentState, measure, _this$analyticsHelper6, _this$analyticsHelper7, _measure;
|
|
@@ -144,7 +144,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
144
144
|
currentState = {
|
|
145
145
|
content: adfDocument,
|
|
146
146
|
title: _this.metadataService.getTitle(),
|
|
147
|
-
stepVersion: getVersion(state)
|
|
147
|
+
stepVersion: getVersion(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
148
148
|
};
|
|
149
149
|
measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
|
|
150
150
|
(_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
|
|
@@ -468,7 +468,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
468
468
|
tries: count,
|
|
469
469
|
maxRetries: ACK_MAX_TRY,
|
|
470
470
|
clientId: _this.clientId,
|
|
471
|
-
version: getVersion(state)
|
|
471
|
+
version: getVersion(state) || 0 // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
unconfirmedStepsInfoUGCRemoved = (_this$getUnconfirmedS = _this.getUnconfirmedSteps()) === null || _this$getUnconfirmedS === void 0 ? void 0 : _this$getUnconfirmedS.map(function (step) {
|
|
@@ -639,7 +639,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
639
639
|
*/
|
|
640
640
|
function send(_tr, _oldState, newState, sendAnalyticsEvent) {
|
|
641
641
|
var unconfirmedStepsData = sendableSteps(newState);
|
|
642
|
-
var version = getVersion(newState);
|
|
642
|
+
var version = getVersion(newState) || 0; // To mimic the default value customisation introduced in the prosemirror-collab fork
|
|
643
643
|
|
|
644
644
|
// Don't send any steps before we're ready.
|
|
645
645
|
if (!unconfirmedStepsData) {
|
|
@@ -8,6 +8,7 @@ export var INTERNAL_ERROR_CODE = /*#__PURE__*/function (INTERNAL_ERROR_CODE) {
|
|
|
8
8
|
INTERNAL_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
9
9
|
INTERNAL_ERROR_CODE["ADD_STEPS_ERROR"] = "ADD_STEPS_ERROR";
|
|
10
10
|
INTERNAL_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
11
|
+
INTERNAL_ERROR_CODE["VIEW_ONLY_STEPS_ERROR"] = "VIEW_ONLY_STEPS_ERROR";
|
|
11
12
|
return INTERNAL_ERROR_CODE;
|
|
12
13
|
}({});
|
|
13
14
|
|
|
@@ -18,6 +19,10 @@ export var INTERNAL_ERROR_CODE = /*#__PURE__*/function (INTERNAL_ERROR_CODE) {
|
|
|
18
19
|
* changes can be saved to NCS.
|
|
19
20
|
*/
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* When in view only mode, we should not generate any steps whatsoever.
|
|
24
|
+
*/
|
|
25
|
+
|
|
21
26
|
/**
|
|
22
27
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
23
28
|
*/
|
|
@@ -119,7 +119,7 @@ export var ParticipantsService = /*#__PURE__*/function () {
|
|
|
119
119
|
} catch (error) {
|
|
120
120
|
var _this$analyticsHelper2;
|
|
121
121
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
122
|
-
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'emitting disconnected data');
|
|
122
|
+
(_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error while emitting disconnected data');
|
|
123
123
|
}
|
|
124
124
|
if (left.length) {
|
|
125
125
|
_this.emitPresence({
|
|
@@ -22,6 +22,7 @@ import { DocumentService } from '../document/document-service';
|
|
|
22
22
|
import { NamespaceService } from '../namespace/namespace-service';
|
|
23
23
|
import { ParticipantsService } from '../participants/participants-service';
|
|
24
24
|
import { errorCodeMapper } from '../errors/error-code-mapper';
|
|
25
|
+
import { INTERNAL_ERROR_CODE } from '../errors/internal-errors';
|
|
25
26
|
import { EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
26
27
|
import { getCollabProviderFeatureFlag } from '../feature-flags';
|
|
27
28
|
var logger = createLogger('Provider', 'black');
|
|
@@ -360,6 +361,14 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
360
361
|
value: function send(_tr, _oldState, newState) {
|
|
361
362
|
try {
|
|
362
363
|
if (this.isViewOnly()) {
|
|
364
|
+
var _this$analyticsHelper9;
|
|
365
|
+
var error = {
|
|
366
|
+
message: 'Attempted to send steps in view only mode',
|
|
367
|
+
data: {
|
|
368
|
+
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
(_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(error, error.message);
|
|
363
372
|
return;
|
|
364
373
|
}
|
|
365
374
|
// Don't send steps while the document is locked (eg. when restoring the document)
|
|
@@ -369,8 +378,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
369
378
|
}
|
|
370
379
|
this.documentService.send(_tr, _oldState, newState);
|
|
371
380
|
} catch (error) {
|
|
372
|
-
var _this$
|
|
373
|
-
(_this$
|
|
381
|
+
var _this$analyticsHelper10;
|
|
382
|
+
(_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(error, 'Error while sending steps for a transaction');
|
|
374
383
|
throw new SendTransactionError('Error while sending steps for a transaction', error);
|
|
375
384
|
}
|
|
376
385
|
}
|
|
@@ -405,9 +414,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
405
414
|
this.channel.broadcast('participant:telepointer', payload, callback);
|
|
406
415
|
}
|
|
407
416
|
} catch (error) {
|
|
408
|
-
var _this$
|
|
417
|
+
var _this$analyticsHelper11;
|
|
409
418
|
// We don't want to throw errors for Presence features as they tend to self-restore
|
|
410
|
-
(_this$
|
|
419
|
+
(_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending message - telepointer');
|
|
411
420
|
}
|
|
412
421
|
}
|
|
413
422
|
}, {
|
|
@@ -452,8 +461,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
452
461
|
}
|
|
453
462
|
}
|
|
454
463
|
} catch (error) {
|
|
455
|
-
var _this$
|
|
456
|
-
(_this$
|
|
464
|
+
var _this$analyticsHelper12;
|
|
465
|
+
(_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while shutting down the collab provider');
|
|
457
466
|
throw new DestroyError('Error while shutting down the collab provider', error);
|
|
458
467
|
}
|
|
459
468
|
this.clearTimers();
|
|
@@ -476,8 +485,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
476
485
|
}
|
|
477
486
|
this.metadataService.setTitle(title, broadcast);
|
|
478
487
|
} catch (error) {
|
|
479
|
-
var _this$
|
|
480
|
-
(_this$
|
|
488
|
+
var _this$analyticsHelper13;
|
|
489
|
+
(_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while setting title');
|
|
481
490
|
throw new SetTitleError('Error while setting title', error);
|
|
482
491
|
}
|
|
483
492
|
}
|
|
@@ -495,8 +504,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
495
504
|
try {
|
|
496
505
|
this.metadataService.setEditorWidth(editorWidth, broadcast);
|
|
497
506
|
} catch (error) {
|
|
498
|
-
var _this$
|
|
499
|
-
(_this$
|
|
507
|
+
var _this$analyticsHelper14;
|
|
508
|
+
(_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting editor width');
|
|
500
509
|
throw new SetEditorWidthError('Error while setting editor width', error);
|
|
501
510
|
}
|
|
502
511
|
}
|
|
@@ -515,8 +524,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
515
524
|
}
|
|
516
525
|
this.metadataService.setMetadata(metadata);
|
|
517
526
|
} catch (error) {
|
|
518
|
-
var _this$
|
|
519
|
-
(_this$
|
|
527
|
+
var _this$analyticsHelper15;
|
|
528
|
+
(_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting metadata');
|
|
520
529
|
throw new SetMetadataError('Error while setting metadata', error);
|
|
521
530
|
}
|
|
522
531
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import type
|
|
3
|
-
import type { CatchupResponse, ReconcileResponse, ChannelEvent, StepsPayload } from '../types';
|
|
4
|
-
import type { SyncUpErrorFunction, ResolvedEditorState } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { ResolvedEditorState, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
5
3
|
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
6
5
|
import type { MetadataService } from '../metadata/metadata-service';
|
|
6
|
+
import type { CatchupResponse, ChannelEvent, ReconcileResponse, StepsPayload } from '../types';
|
|
7
7
|
import type { CollabEvents, CollabInitPayload } from '@atlaskit/editor-common/collab';
|
|
8
8
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import type { ParticipantsService } from '../participants/participants-service';
|
|
10
9
|
import type { InternalError } from '../errors/internal-errors';
|
|
10
|
+
import type { ParticipantsService } from '../participants/participants-service';
|
|
11
11
|
export declare class DocumentService {
|
|
12
12
|
private participantsService;
|
|
13
13
|
private analyticsHelper;
|
|
@@ -8,7 +8,8 @@ export declare enum INTERNAL_ERROR_CODE {
|
|
|
8
8
|
CATCHUP_FAILED = "CATCHUP_FAILED",
|
|
9
9
|
DOCUMENT_RESTORE_ERROR = "DOCUMENT_RESTORE_ERROR",
|
|
10
10
|
ADD_STEPS_ERROR = "ADD_STEPS_ERROR",
|
|
11
|
-
DOCUMENT_UPDATE_ERROR = "DOCUMENT_UPDATE_ERROR"
|
|
11
|
+
DOCUMENT_UPDATE_ERROR = "DOCUMENT_UPDATE_ERROR",
|
|
12
|
+
VIEW_ONLY_STEPS_ERROR = "VIEW_ONLY_STEPS_ERROR"
|
|
12
13
|
}
|
|
13
14
|
type DocumentRecoveryError = {
|
|
14
15
|
message: string;
|
|
@@ -83,6 +84,15 @@ export type InternalDocumentUpdateFailure = {
|
|
|
83
84
|
status: 500;
|
|
84
85
|
};
|
|
85
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* When in view only mode, we should not generate any steps whatsoever.
|
|
89
|
+
*/
|
|
90
|
+
export type ViewOnlyStepsError = {
|
|
91
|
+
message: 'Attempted to send steps in view only mode';
|
|
92
|
+
data: {
|
|
93
|
+
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
86
96
|
/**
|
|
87
97
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
88
98
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import AnalyticsHelper from '../analytics/analytics-helper';
|
|
1
|
+
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
2
2
|
import type { CollabEventDisconnectedData, ChannelEvent, PresenceData, PresencePayload, TelepointerPayload } from '../types';
|
|
3
|
-
import { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
|
-
import { GetUserType } from './participants-helper';
|
|
3
|
+
import type { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
|
+
import type { GetUserType } from './participants-helper';
|
|
5
5
|
import { ParticipantsState } from './participants-state';
|
|
6
6
|
/**
|
|
7
7
|
* This service is responsible for handling presence and participant events, as well as sending them on to the editor or NCS.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import type
|
|
3
|
-
import type { CatchupResponse, ReconcileResponse, ChannelEvent, StepsPayload } from '../types';
|
|
4
|
-
import type { SyncUpErrorFunction, ResolvedEditorState } from '@atlaskit/editor-common/collab';
|
|
2
|
+
import type { ResolvedEditorState, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
5
3
|
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
6
5
|
import type { MetadataService } from '../metadata/metadata-service';
|
|
6
|
+
import type { CatchupResponse, ChannelEvent, ReconcileResponse, StepsPayload } from '../types';
|
|
7
7
|
import type { CollabEvents, CollabInitPayload } from '@atlaskit/editor-common/collab';
|
|
8
8
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import type { ParticipantsService } from '../participants/participants-service';
|
|
10
9
|
import type { InternalError } from '../errors/internal-errors';
|
|
10
|
+
import type { ParticipantsService } from '../participants/participants-service';
|
|
11
11
|
export declare class DocumentService {
|
|
12
12
|
private participantsService;
|
|
13
13
|
private analyticsHelper;
|
|
@@ -8,7 +8,8 @@ export declare enum INTERNAL_ERROR_CODE {
|
|
|
8
8
|
CATCHUP_FAILED = "CATCHUP_FAILED",
|
|
9
9
|
DOCUMENT_RESTORE_ERROR = "DOCUMENT_RESTORE_ERROR",
|
|
10
10
|
ADD_STEPS_ERROR = "ADD_STEPS_ERROR",
|
|
11
|
-
DOCUMENT_UPDATE_ERROR = "DOCUMENT_UPDATE_ERROR"
|
|
11
|
+
DOCUMENT_UPDATE_ERROR = "DOCUMENT_UPDATE_ERROR",
|
|
12
|
+
VIEW_ONLY_STEPS_ERROR = "VIEW_ONLY_STEPS_ERROR"
|
|
12
13
|
}
|
|
13
14
|
type DocumentRecoveryError = {
|
|
14
15
|
message: string;
|
|
@@ -83,6 +84,15 @@ export type InternalDocumentUpdateFailure = {
|
|
|
83
84
|
status: 500;
|
|
84
85
|
};
|
|
85
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* When in view only mode, we should not generate any steps whatsoever.
|
|
89
|
+
*/
|
|
90
|
+
export type ViewOnlyStepsError = {
|
|
91
|
+
message: 'Attempted to send steps in view only mode';
|
|
92
|
+
data: {
|
|
93
|
+
code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
86
96
|
/**
|
|
87
97
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
88
98
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import AnalyticsHelper from '../analytics/analytics-helper';
|
|
1
|
+
import type AnalyticsHelper from '../analytics/analytics-helper';
|
|
2
2
|
import type { CollabEventDisconnectedData, ChannelEvent, PresenceData, PresencePayload, TelepointerPayload } from '../types';
|
|
3
|
-
import { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
|
-
import { GetUserType } from './participants-helper';
|
|
3
|
+
import type { CollabEventPresenceData, CollabTelepointerPayload, StepJson } from '@atlaskit/editor-common/collab';
|
|
4
|
+
import type { GetUserType } from './participants-helper';
|
|
5
5
|
import { ParticipantsState } from './participants-state';
|
|
6
6
|
/**
|
|
7
7
|
* This service is responsible for handling presence and participant events, as well as sending them on to the editor or NCS.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.20.
|
|
3
|
+
"version": "9.20.7",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
38
38
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
39
|
-
"@atlaskit/editor-common": "^76.
|
|
39
|
+
"@atlaskit/editor-common": "^76.29.0",
|
|
40
40
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
42
|
-
"@atlaskit/prosemirror-collab": "^0.2.0",
|
|
43
42
|
"@atlaskit/ufo": "^0.2.0",
|
|
44
43
|
"@atlaskit/util-service-support": "^6.2.0",
|
|
45
44
|
"@babel/runtime": "^7.0.0",
|
|
46
45
|
"eventemitter2": "^4.1.0",
|
|
47
46
|
"lodash": "^4.17.21",
|
|
47
|
+
"prosemirror-collab": "1.3.1",
|
|
48
48
|
"socket.io-client": "^4.7.1"
|
|
49
49
|
},
|
|
50
50
|
"techstack": {
|