@atlaskit/collab-provider 7.4.2 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/config/package.json +8 -0
- package/dist/cjs/analytics/index.js +17 -44
- package/dist/cjs/analytics/performance.js +32 -12
- package/dist/cjs/channel.js +76 -46
- package/dist/cjs/config.js +12 -0
- package/dist/cjs/error-code-mapper.js +39 -31
- package/dist/cjs/helpers/const.js +22 -9
- package/dist/cjs/helpers/utils.js +18 -2
- package/dist/cjs/provider/index.js +84 -23
- package/dist/cjs/socket-io-provider.js +15 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/index.js +17 -31
- package/dist/es2019/analytics/performance.js +31 -12
- package/dist/es2019/channel.js +53 -25
- package/dist/es2019/config.js +5 -0
- package/dist/es2019/error-code-mapper.js +34 -31
- package/dist/es2019/helpers/const.js +18 -4
- package/dist/es2019/helpers/utils.js +11 -1
- package/dist/es2019/provider/index.js +67 -10
- package/dist/es2019/socket-io-provider.js +13 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/index.js +16 -31
- package/dist/esm/analytics/performance.js +31 -12
- package/dist/esm/channel.js +81 -51
- package/dist/esm/config.js +5 -0
- package/dist/esm/error-code-mapper.js +35 -31
- package/dist/esm/helpers/const.js +18 -4
- package/dist/esm/helpers/utils.js +11 -1
- package/dist/esm/provider/catchup.js +1 -1
- package/dist/esm/provider/index.js +83 -24
- package/dist/esm/socket-io-provider.js +13 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/index.d.ts +3 -7
- package/dist/types/analytics/performance.d.ts +11 -4
- package/dist/types/config.d.ts +5 -0
- package/dist/types/helpers/const.d.ts +22 -4
- package/dist/types/helpers/utils.d.ts +3 -0
- package/dist/types/socket-io-provider.d.ts +2 -2
- package/dist/types/types.d.ts +11 -2
- package/package.json +5 -4
- package/report.api.md +289 -0
|
@@ -23,4 +23,14 @@ export function sleep(ms) {
|
|
|
23
23
|
return new Promise(function (resolve) {
|
|
24
24
|
setTimeout(resolve, ms);
|
|
25
25
|
});
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
export var getProduct = function getProduct(productInfo) {
|
|
28
|
+
var _productInfo$product;
|
|
29
|
+
|
|
30
|
+
return (_productInfo$product = productInfo === null || productInfo === void 0 ? void 0 : productInfo.product) !== null && _productInfo$product !== void 0 ? _productInfo$product : 'unknown';
|
|
31
|
+
};
|
|
32
|
+
export var getSubProduct = function getSubProduct(productInfo) {
|
|
33
|
+
var _productInfo$subProdu;
|
|
34
|
+
|
|
35
|
+
return (_productInfo$subProdu = productInfo === null || productInfo === void 0 ? void 0 : productInfo.subProduct) !== null && _productInfo$subProdu !== void 0 ? _productInfo$subProdu : !!(productInfo !== null && productInfo !== void 0 && productInfo.product) ? 'none' : 'unknown';
|
|
36
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
|
|
4
4
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
5
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
6
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
7
6
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -12,6 +11,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
12
11
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
13
12
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
14
13
|
var _excluded = ["type"];
|
|
14
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
15
15
|
|
|
16
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
17
|
|
|
@@ -24,14 +24,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
24
24
|
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
25
25
|
import throttle from 'lodash/throttle';
|
|
26
26
|
import isequal from 'lodash/isEqual';
|
|
27
|
+
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
27
28
|
import { Emitter } from '../emitter';
|
|
28
29
|
import { Channel } from '../channel';
|
|
29
30
|
import { createLogger, getParticipant, sleep } from '../helpers/utils';
|
|
30
|
-
import { ACK_MAX_TRY } from '../helpers/const';
|
|
31
|
-
import {
|
|
31
|
+
import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
|
|
32
|
+
import { triggerCollabAnalyticsEvent } from '../analytics';
|
|
32
33
|
import { catchup } from './catchup';
|
|
33
34
|
import { errorCodeMapper } from '../error-code-mapper';
|
|
34
35
|
import { DisconnectReason, socketIOReasons } from '../disconnected-reason-mapper';
|
|
36
|
+
import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
|
|
35
37
|
var logger = createLogger('Provider', 'black');
|
|
36
38
|
var PARTICIPANT_UPDATE_INTERVAL = 300 * 1000; // 300 seconds
|
|
37
39
|
|
|
@@ -202,22 +204,26 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
202
204
|
});
|
|
203
205
|
|
|
204
206
|
_defineProperty(_assertThisInitialized(_this), "catchup", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
207
|
+
var measure, _measure;
|
|
208
|
+
|
|
205
209
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
206
210
|
while (1) {
|
|
207
211
|
switch (_context.prev = _context.next) {
|
|
208
212
|
case 0:
|
|
213
|
+
startMeasure(MEASURE_NAME.CALLING_CATCHUP_API); // if the queue is already paused, we are busy with something else, so don't proceed.
|
|
214
|
+
|
|
209
215
|
if (!_this.pauseQueue) {
|
|
210
|
-
_context.next =
|
|
216
|
+
_context.next = 4;
|
|
211
217
|
break;
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
logger("Queue is paused. Aborting.");
|
|
215
221
|
return _context.abrupt("return");
|
|
216
222
|
|
|
217
|
-
case
|
|
223
|
+
case 4:
|
|
218
224
|
_this.pauseQueue = true;
|
|
219
|
-
_context.prev =
|
|
220
|
-
_context.next =
|
|
225
|
+
_context.prev = 5;
|
|
226
|
+
_context.next = 8;
|
|
221
227
|
return catchup({
|
|
222
228
|
getCurrentPmVersion: _this.getCurrentPmVersion,
|
|
223
229
|
fetchCatchup: _this.channel.fetchCatchup.bind(_this.channel),
|
|
@@ -227,18 +233,34 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
227
233
|
applyLocalsteps: _this.applyLocalsteps
|
|
228
234
|
});
|
|
229
235
|
|
|
230
|
-
case
|
|
231
|
-
|
|
236
|
+
case 8:
|
|
237
|
+
measure = stopMeasure(MEASURE_NAME.CALLING_CATCHUP_API);
|
|
238
|
+
triggerCollabAnalyticsEvent({
|
|
239
|
+
eventAction: EVENT_ACTION.CATCHUP,
|
|
240
|
+
attributes: {
|
|
241
|
+
eventStatus: EVENT_STATUS.SUCCESS,
|
|
242
|
+
latency: measure === null || measure === void 0 ? void 0 : measure.duration
|
|
243
|
+
}
|
|
244
|
+
}, _this.analyticsClient);
|
|
245
|
+
_context.next = 17;
|
|
232
246
|
break;
|
|
233
247
|
|
|
234
|
-
case
|
|
235
|
-
_context.prev =
|
|
236
|
-
_context.t0 = _context["catch"](
|
|
237
|
-
|
|
248
|
+
case 12:
|
|
249
|
+
_context.prev = 12;
|
|
250
|
+
_context.t0 = _context["catch"](5);
|
|
251
|
+
_measure = stopMeasure(MEASURE_NAME.CALLING_CATCHUP_API);
|
|
252
|
+
triggerCollabAnalyticsEvent({
|
|
253
|
+
eventAction: EVENT_ACTION.CATCHUP,
|
|
254
|
+
attributes: {
|
|
255
|
+
eventStatus: EVENT_STATUS.FAILURE,
|
|
256
|
+
error: _context.t0,
|
|
257
|
+
latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
|
|
258
|
+
}
|
|
259
|
+
}, _this.analyticsClient);
|
|
238
260
|
logger("Catch-Up Failed:", _context.t0.message);
|
|
239
261
|
|
|
240
|
-
case
|
|
241
|
-
_context.prev =
|
|
262
|
+
case 17:
|
|
263
|
+
_context.prev = 17;
|
|
242
264
|
_this.pauseQueue = false;
|
|
243
265
|
|
|
244
266
|
_this.processQueue();
|
|
@@ -246,20 +268,26 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
246
268
|
_this.sendStepsFromCurrentState();
|
|
247
269
|
|
|
248
270
|
_this.stepRejectCounter = 0;
|
|
249
|
-
return _context.finish(
|
|
271
|
+
return _context.finish(17);
|
|
250
272
|
|
|
251
|
-
case
|
|
273
|
+
case 23:
|
|
252
274
|
case "end":
|
|
253
275
|
return _context.stop();
|
|
254
276
|
}
|
|
255
277
|
}
|
|
256
|
-
}, _callee, null, [[
|
|
278
|
+
}, _callee, null, [[5, 12, 17, 23]]);
|
|
257
279
|
})));
|
|
258
280
|
|
|
259
281
|
_defineProperty(_assertThisInitialized(_this), "onErrorHandled", function (error) {
|
|
260
282
|
if (error && error.data) {
|
|
261
283
|
if (error.data.code === 'HEAD_VERSION_UPDATE_FAILED' || error.data.code === 'VERSION_NUMBER_ALREADY_EXISTS') {
|
|
262
|
-
|
|
284
|
+
triggerCollabAnalyticsEvent({
|
|
285
|
+
eventAction: EVENT_ACTION.ADD_STEPS,
|
|
286
|
+
attributes: {
|
|
287
|
+
eventStatus: EVENT_STATUS.FAILURE,
|
|
288
|
+
error: error
|
|
289
|
+
}
|
|
290
|
+
}, _this.analyticsClient);
|
|
263
291
|
_this.stepRejectCounter++;
|
|
264
292
|
}
|
|
265
293
|
|
|
@@ -530,7 +558,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
530
558
|
_defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
531
559
|
var _this$metadata$title;
|
|
532
560
|
|
|
533
|
-
var maxAttemptsToSync, count, unconfirmedState, state;
|
|
561
|
+
var maxAttemptsToSync, count, unconfirmedState, state, adfDocument, measure, _measure2;
|
|
562
|
+
|
|
534
563
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
535
564
|
while (1) {
|
|
536
565
|
switch (_context4.prev = _context4.next) {
|
|
@@ -614,14 +643,39 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
614
643
|
})(), "t0", 5);
|
|
615
644
|
|
|
616
645
|
case 5:
|
|
617
|
-
state = _this.getState();
|
|
646
|
+
state = _this.getState(); // Convert ProseMirror document in Editor state to ADF document
|
|
647
|
+
|
|
648
|
+
try {
|
|
649
|
+
startMeasure(MEASURE_NAME.CONVERT_PM_TO_ADF);
|
|
650
|
+
adfDocument = new JSONTransformer().encode(state.doc);
|
|
651
|
+
measure = stopMeasure(MEASURE_NAME.CONVERT_PM_TO_ADF);
|
|
652
|
+
triggerCollabAnalyticsEvent({
|
|
653
|
+
eventAction: EVENT_ACTION.CONVERT_PM_TO_ADF,
|
|
654
|
+
attributes: {
|
|
655
|
+
eventStatus: EVENT_STATUS.SUCCESS,
|
|
656
|
+
latency: measure === null || measure === void 0 ? void 0 : measure.duration
|
|
657
|
+
}
|
|
658
|
+
}, _this.analyticsClient);
|
|
659
|
+
} catch (error) {
|
|
660
|
+
_measure2 = stopMeasure(MEASURE_NAME.CONVERT_PM_TO_ADF);
|
|
661
|
+
triggerCollabAnalyticsEvent({
|
|
662
|
+
eventAction: EVENT_ACTION.CONVERT_PM_TO_ADF,
|
|
663
|
+
attributes: {
|
|
664
|
+
eventStatus: EVENT_STATUS.FAILURE,
|
|
665
|
+
latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration,
|
|
666
|
+
error: error
|
|
667
|
+
}
|
|
668
|
+
}, _this.analyticsClient);
|
|
669
|
+
logger("Error when converting PM document to ADF: ", error);
|
|
670
|
+
}
|
|
671
|
+
|
|
618
672
|
return _context4.abrupt("return", {
|
|
619
|
-
content:
|
|
673
|
+
content: adfDocument,
|
|
620
674
|
title: (_this$metadata$title = _this.metadata.title) === null || _this$metadata$title === void 0 ? void 0 : _this$metadata$title.toString(),
|
|
621
675
|
stepVersion: getVersion(state)
|
|
622
676
|
});
|
|
623
677
|
|
|
624
|
-
case
|
|
678
|
+
case 8:
|
|
625
679
|
case "end":
|
|
626
680
|
return _context4.stop();
|
|
627
681
|
}
|
|
@@ -777,7 +831,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
|
|
|
777
831
|
}); // If steps can apply to local editor sucessfully, no need to accumulate the error counter.
|
|
778
832
|
|
|
779
833
|
this.stepRejectCounter = 0;
|
|
780
|
-
|
|
834
|
+
triggerCollabAnalyticsEvent({
|
|
835
|
+
eventAction: EVENT_ACTION.ADD_STEPS,
|
|
836
|
+
attributes: {
|
|
837
|
+
eventStatus: EVENT_STATUS.SUCCESS
|
|
838
|
+
}
|
|
839
|
+
}, this.analyticsClient);
|
|
781
840
|
this.emitTelepointersFromSteps(steps); // Resend local steps if none of the received steps originated with us!
|
|
782
841
|
|
|
783
842
|
if (clientIds.indexOf(this.clientId) === -1) {
|
|
@@ -6,15 +6,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
import { Provider } from './provider';
|
|
8
8
|
import { io } from 'socket.io-client';
|
|
9
|
-
|
|
9
|
+
import { getProduct, getSubProduct } from './helpers/utils';
|
|
10
|
+
import { SOCKET_IO_OPTIONS } from './config';
|
|
11
|
+
export function createSocketIOSocket(url, auth, productInfo) {
|
|
10
12
|
var _URL = new URL(url),
|
|
11
|
-
pathname = _URL.pathname;
|
|
13
|
+
pathname = _URL.pathname; // to limit the reconnection flooding towards collab service, here we set the reconnectionDelayMax to 128s.
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
return io(url, {
|
|
17
|
+
reconnectionDelayMax: SOCKET_IO_OPTIONS.RECONNECTION_DELAY_MAX,
|
|
18
|
+
reconnectionDelay: SOCKET_IO_OPTIONS.RECONNECTION_DELAY,
|
|
19
|
+
randomizationFactor: SOCKET_IO_OPTIONS.RANDOMIZATION_FACTOR,
|
|
14
20
|
withCredentials: true,
|
|
15
21
|
transports: ['polling', 'websocket'],
|
|
16
22
|
path: "/".concat(pathname.split('/')[1], "/socket.io"),
|
|
17
|
-
auth: auth
|
|
23
|
+
auth: auth,
|
|
24
|
+
extraHeaders: {
|
|
25
|
+
'x-product': getProduct(productInfo),
|
|
26
|
+
'x-subproduct': getSubProduct(productInfo)
|
|
27
|
+
}
|
|
18
28
|
});
|
|
19
29
|
}
|
|
20
30
|
export function createSocketIOCollabProvider(config) {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
2
2
|
import { GasPurePayload } from '@atlaskit/analytics-gas-types';
|
|
3
|
-
import {
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const triggerAnalyticsForStepsAddedSuccessfully: (analyticsClient?: AnalyticsWebClient | undefined) => void;
|
|
7
|
-
export declare const triggerAnalyticsForStepsRejected: (analyticsClient?: AnalyticsWebClient | undefined, error?: ErrorPayload | undefined) => void;
|
|
8
|
-
export declare const triggerAnalyticsForCatchupFailed: (analyticsClient?: AnalyticsWebClient | undefined, error?: ErrorPayload | undefined) => void;
|
|
9
|
-
export declare const triggerAnalyticsForCatchupSuccessfulWithLatency: (analyticsClient?: AnalyticsWebClient | undefined, latency?: number | undefined) => void;
|
|
3
|
+
import { AnalyticsEvent } from '../helpers/const';
|
|
4
|
+
export declare const fireAnalyticsEvent: (analyticsClient?: AnalyticsWebClient | undefined, payload?: GasPurePayload | undefined) => void;
|
|
5
|
+
export declare const triggerCollabAnalyticsEvent: (analyticsEvent: AnalyticsEvent, analyticsClient?: AnalyticsWebClient | undefined) => void;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare enum MEASURE_NAME {
|
|
2
|
+
CALLING_CATCHUP_API = "callingCatchupApi",
|
|
3
|
+
SOCKET_CONNECT = "socketConnect",
|
|
4
|
+
DOCUMENT_INIT = "documentInit",
|
|
5
|
+
CONVERT_PM_TO_ADF = "convertPMToADF"
|
|
6
|
+
}
|
|
7
|
+
export declare function startMeasure(measureName: MEASURE_NAME): void;
|
|
8
|
+
export declare function stopMeasure(measureName: MEASURE_NAME, onMeasureComplete?: (duration: number, startTime: number) => void): {
|
|
9
|
+
duration: number;
|
|
10
|
+
startTime: number;
|
|
11
|
+
} | undefined;
|
|
4
12
|
export declare function clearMeasure(measureName: string): void;
|
|
5
|
-
export {};
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const STEPS_REJECTED = "collabStepsAddedRejected";
|
|
1
|
+
import { ErrorPayload } from '../types';
|
|
3
2
|
export declare const ATTRIBUTES_PACKAGE = "collabProvider";
|
|
4
|
-
export declare const
|
|
5
|
-
export declare
|
|
3
|
+
export declare const EVENT_SUBJECT = "collab";
|
|
4
|
+
export declare enum EVENT_ACTION {
|
|
5
|
+
CONNECTION = "connection",
|
|
6
|
+
CATCHUP = "catchup",
|
|
7
|
+
DOCUMENT_INIT = "documentInit",
|
|
8
|
+
ADD_STEPS = "addSteps",
|
|
9
|
+
CONVERT_PM_TO_ADF = "convertPMToADF"
|
|
10
|
+
}
|
|
11
|
+
export declare enum EVENT_STATUS {
|
|
12
|
+
SUCCESS = "SUCCESS",
|
|
13
|
+
FAILURE = "FAILURE"
|
|
14
|
+
}
|
|
15
|
+
export declare type AnalyticsEvent = {
|
|
16
|
+
eventAction: EVENT_ACTION;
|
|
17
|
+
attributes: {
|
|
18
|
+
eventStatus: EVENT_STATUS;
|
|
19
|
+
meetsSLO?: boolean;
|
|
20
|
+
latency?: number;
|
|
21
|
+
error?: ErrorPayload;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
6
24
|
export declare const ACK_MAX_TRY = 10;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProductInformation } from '../types';
|
|
1
2
|
export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
|
|
2
3
|
export declare const getParticipant: (userId: string) => {
|
|
3
4
|
userId: string;
|
|
@@ -6,3 +7,5 @@ export declare const getParticipant: (userId: string) => {
|
|
|
6
7
|
email: string;
|
|
7
8
|
};
|
|
8
9
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
10
|
+
export declare const getProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
11
|
+
export declare const getSubProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Provider } from './provider';
|
|
2
|
-
import { Socket, Config } from './types';
|
|
3
|
-
export declare function createSocketIOSocket(url: string, auth?: (cb: (data: object) => void) => void): Socket;
|
|
2
|
+
import { Socket, Config, ProductInformation } from './types';
|
|
3
|
+
export declare function createSocketIOSocket(url: string, auth?: (cb: (data: object) => void) => void, productInfo?: ProductInformation): Socket;
|
|
4
4
|
export declare function createSocketIOCollabProvider(config: Omit<Config, 'createSocket'>): Provider;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -15,12 +15,13 @@ export interface Config {
|
|
|
15
15
|
lifecycle?: Lifecycle;
|
|
16
16
|
storage?: Storage;
|
|
17
17
|
need404?: boolean;
|
|
18
|
-
createSocket(path: string, auth?: (cb: (data: object) => void) => void)
|
|
18
|
+
createSocket: (path: string, auth?: (cb: (data: object) => void) => void, productInfo?: ProductInformation) => Socket;
|
|
19
19
|
analyticsClient?: AnalyticsWebClient;
|
|
20
20
|
getUser?(userId: string): Promise<Pick<CollabParticipant, 'avatar' | 'email' | 'name'> & {
|
|
21
21
|
userId: string;
|
|
22
22
|
}>;
|
|
23
23
|
permissionTokenRefresh?: () => Promise<string>;
|
|
24
|
+
productInfo?: ProductInformation;
|
|
24
25
|
}
|
|
25
26
|
interface SimpleEventEmitter {
|
|
26
27
|
on(event: string, fn: Function): SimpleEventEmitter;
|
|
@@ -46,6 +47,7 @@ export interface CollabErrorPayload {
|
|
|
46
47
|
status: number;
|
|
47
48
|
code: string;
|
|
48
49
|
message: string;
|
|
50
|
+
reason?: string;
|
|
49
51
|
}
|
|
50
52
|
export interface CollabInitPayload extends EditorCollabInitData {
|
|
51
53
|
doc: any;
|
|
@@ -114,7 +116,10 @@ export declare type ErrorPayload = {
|
|
|
114
116
|
data?: {
|
|
115
117
|
status: number;
|
|
116
118
|
code?: string;
|
|
117
|
-
meta?: string
|
|
119
|
+
meta?: string | {
|
|
120
|
+
description: string;
|
|
121
|
+
reason?: string;
|
|
122
|
+
};
|
|
118
123
|
};
|
|
119
124
|
};
|
|
120
125
|
export declare type ChannelEvent = {
|
|
@@ -158,4 +163,8 @@ export interface CatchupOptions {
|
|
|
158
163
|
updateDocumentWithMetadata: ({ doc, version, metadata, reserveCursor, }: CollabInitPayload) => void;
|
|
159
164
|
applyLocalsteps: (steps: Step[]) => void;
|
|
160
165
|
}
|
|
166
|
+
export declare type ProductInformation = {
|
|
167
|
+
product: string;
|
|
168
|
+
subProduct?: string;
|
|
169
|
+
};
|
|
161
170
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/analytics-gas-types": "5.0.7",
|
|
25
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
26
|
-
"@atlaskit/editor-common": "^
|
|
25
|
+
"@atlaskit/analytics-listeners": "^8.3.0",
|
|
26
|
+
"@atlaskit/editor-common": "^69.1.0",
|
|
27
27
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
28
28
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@atlaskit/
|
|
47
|
+
"@atlaskit/adf-schema": "^23.3.0",
|
|
48
|
+
"@atlaskit/editor-test-helpers": "^17.1.0",
|
|
48
49
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
49
50
|
"@types/prosemirror-collab": "^1.1.1",
|
|
50
51
|
"@types/prosemirror-model": "^1.11.0",
|