@atlaskit/collab-provider 10.21.0 → 10.22.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 +22 -0
- package/dist/cjs/channel.js +1 -1
- package/dist/cjs/document/document-service.js +28 -2
- package/dist/cjs/socket-io-provider.js +5 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/channel.js +1 -1
- package/dist/es2019/document/document-service.js +27 -2
- package/dist/es2019/socket-io-provider.js +5 -12
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/channel.js +1 -1
- package/dist/esm/document/document-service.js +28 -2
- package/dist/esm/socket-io-provider.js +5 -9
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/document/document-service.d.ts +2 -0
- package/dist/types/document/getConflictChanges.d.ts +3 -3
- package/dist/types/helpers/utils.d.ts +1 -1
- package/dist/types/participants/participants-helper.d.ts +1 -1
- package/dist/types/socket-io-provider.d.ts +1 -1
- package/dist/types/types.d.ts +1 -2
- package/dist/types-ts4.5/document/document-service.d.ts +2 -0
- package/dist/types-ts4.5/document/getConflictChanges.d.ts +3 -3
- package/dist/types-ts4.5/helpers/utils.d.ts +1 -1
- package/dist/types-ts4.5/participants/participants-helper.d.ts +1 -1
- package/dist/types-ts4.5/socket-io-provider.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 10.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#179240](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/179240)
|
|
8
|
+
[`cf397492aea34`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf397492aea34) -
|
|
9
|
+
Revert 179240 - to support for custom authentication headers
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 10.21.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#179865](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/179865)
|
|
20
|
+
[`33dc1bfc85993`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/33dc1bfc85993) -
|
|
21
|
+
ED-28407 Offline Editing: Add logic that will mark offline steps as regular steps after 6s of
|
|
22
|
+
being online. Added as a fallback incase there's issue with the offline storage plugin and it's
|
|
23
|
+
unable to handle the steps.
|
|
24
|
+
|
|
3
25
|
## 10.21.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/dist/cjs/channel.js
CHANGED
|
@@ -636,7 +636,7 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
636
636
|
};
|
|
637
637
|
}();
|
|
638
638
|
}
|
|
639
|
-
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper
|
|
639
|
+
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper);
|
|
640
640
|
|
|
641
641
|
// Due to https://github.com/socketio/socket.io-client/issues/1473,
|
|
642
642
|
// reconnect no longer fired on the socket.
|
|
@@ -79,6 +79,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
79
79
|
(0, _defineProperty2.default)(this, "catchUpOutofSync", false);
|
|
80
80
|
(0, _defineProperty2.default)(this, "hasRecovered", false);
|
|
81
81
|
(0, _defineProperty2.default)(this, "numberOfStepCommitsSent", 0);
|
|
82
|
+
(0, _defineProperty2.default)(this, "timeoutExceeded", false);
|
|
82
83
|
/**
|
|
83
84
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
84
85
|
* @param reason - optional reason to attach.
|
|
@@ -1001,6 +1002,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
1001
1002
|
*/
|
|
1002
1003
|
function send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
|
|
1003
1004
|
) {
|
|
1005
|
+
var _this3 = this;
|
|
1004
1006
|
var unconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
|
|
1005
1007
|
var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
1006
1008
|
|
|
@@ -1057,12 +1059,36 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
|
|
|
1057
1059
|
});
|
|
1058
1060
|
}
|
|
1059
1061
|
if ((0, _experiments.editorExperiment)('platform_editor_offline_editing_web', true)) {
|
|
1060
|
-
var
|
|
1062
|
+
var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
|
|
1061
1063
|
var _tr$getMeta;
|
|
1062
1064
|
return tr instanceof _state.Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
|
|
1063
1065
|
});
|
|
1064
|
-
if (
|
|
1066
|
+
if (containsOfflineSteps && !this.timeoutExceeded) {
|
|
1067
|
+
// Only start timer if we're online and don't already have one running
|
|
1068
|
+
if (this.getConnected() && !this.timeout) {
|
|
1069
|
+
this.timeout = setTimeout(function () {
|
|
1070
|
+
// If the timer expires and we're still online, handle the offline steps.
|
|
1071
|
+
// Otherwise, clear the timer so it can restart when we're online again.
|
|
1072
|
+
if (_this3.getConnected()) {
|
|
1073
|
+
_this3.timeoutExceeded = true;
|
|
1074
|
+
var updatedUnconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
|
|
1075
|
+
updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
|
|
1076
|
+
if (origin instanceof _state.Transaction && origin.getMeta('isOffline')) {
|
|
1077
|
+
origin.setMeta('isOffline', false);
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
} else {
|
|
1081
|
+
_this3.timeout = undefined;
|
|
1082
|
+
}
|
|
1083
|
+
}, 6000);
|
|
1084
|
+
}
|
|
1065
1085
|
return;
|
|
1086
|
+
} else if (this.timeoutExceeded) {
|
|
1087
|
+
this.timeoutExceeded = false;
|
|
1088
|
+
if (this.timeout) {
|
|
1089
|
+
clearTimeout(this.timeout);
|
|
1090
|
+
this.timeout = undefined;
|
|
1091
|
+
}
|
|
1066
1092
|
}
|
|
1067
1093
|
}
|
|
1068
1094
|
|
|
@@ -14,7 +14,7 @@ var _utils = require("./helpers/utils");
|
|
|
14
14
|
var _config = require("./config");
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper
|
|
17
|
+
function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper) {
|
|
18
18
|
var _URL = new URL(url),
|
|
19
19
|
pathname = _URL.pathname;
|
|
20
20
|
var socketIOOptions = _config.SOCKET_IO_OPTIONS;
|
|
@@ -31,13 +31,6 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsH
|
|
|
31
31
|
socketIOOptions = _config.SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
// Merge default headers with custom headers, custom headers take precedence
|
|
36
|
-
var defaultExtraHeaders = {
|
|
37
|
-
'x-product': (0, _utils.getProduct)(productInfo),
|
|
38
|
-
'x-subproduct': (0, _utils.getSubProduct)(productInfo)
|
|
39
|
-
};
|
|
40
|
-
var extraHeaders = customExtraHeaders ? _objectSpread(_objectSpread({}, defaultExtraHeaders), customExtraHeaders) : defaultExtraHeaders;
|
|
41
34
|
var client = (0, _socket.io)(url, {
|
|
42
35
|
reconnectionDelayMax: socketIOOptions.RECONNECTION_DELAY_MAX,
|
|
43
36
|
reconnectionDelay: socketIOOptions.RECONNECTION_DELAY,
|
|
@@ -47,7 +40,10 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsH
|
|
|
47
40
|
transports: transports,
|
|
48
41
|
path: "/".concat(pathname.split('/')[1], "/socket.io"),
|
|
49
42
|
auth: auth,
|
|
50
|
-
extraHeaders:
|
|
43
|
+
extraHeaders: {
|
|
44
|
+
'x-product': (0, _utils.getProduct)(productInfo),
|
|
45
|
+
'x-subproduct': (0, _utils.getSubProduct)(productInfo)
|
|
46
|
+
}
|
|
51
47
|
});
|
|
52
48
|
return client;
|
|
53
49
|
}
|
|
@@ -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 = "10.
|
|
8
|
+
var version = exports.version = "10.21.1";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
package/dist/es2019/channel.js
CHANGED
|
@@ -448,7 +448,7 @@ export class Channel extends Emitter {
|
|
|
448
448
|
cb(authData);
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
this.socket = createSocket(`${url}/session/${documentAri}`, auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper
|
|
451
|
+
this.socket = createSocket(`${url}/session/${documentAri}`, auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper);
|
|
452
452
|
|
|
453
453
|
// Due to https://github.com/socketio/socket.io-client/issues/1473,
|
|
454
454
|
// reconnect no longer fired on the socket.
|
|
@@ -61,6 +61,7 @@ export class DocumentService {
|
|
|
61
61
|
_defineProperty(this, "catchUpOutofSync", false);
|
|
62
62
|
_defineProperty(this, "hasRecovered", false);
|
|
63
63
|
_defineProperty(this, "numberOfStepCommitsSent", 0);
|
|
64
|
+
_defineProperty(this, "timeoutExceeded", false);
|
|
64
65
|
/**
|
|
65
66
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
66
67
|
* @param reason - optional reason to attach.
|
|
@@ -924,12 +925,36 @@ export class DocumentService {
|
|
|
924
925
|
});
|
|
925
926
|
}
|
|
926
927
|
if (editorExperiment('platform_editor_offline_editing_web', true)) {
|
|
927
|
-
const
|
|
928
|
+
const containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(tr => {
|
|
928
929
|
var _tr$getMeta;
|
|
929
930
|
return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
|
|
930
931
|
});
|
|
931
|
-
if (
|
|
932
|
+
if (containsOfflineSteps && !this.timeoutExceeded) {
|
|
933
|
+
// Only start timer if we're online and don't already have one running
|
|
934
|
+
if (this.getConnected() && !this.timeout) {
|
|
935
|
+
this.timeout = setTimeout(() => {
|
|
936
|
+
// If the timer expires and we're still online, handle the offline steps.
|
|
937
|
+
// Otherwise, clear the timer so it can restart when we're online again.
|
|
938
|
+
if (this.getConnected()) {
|
|
939
|
+
this.timeoutExceeded = true;
|
|
940
|
+
const updatedUnconfirmedStepsData = sendableSteps(newState);
|
|
941
|
+
updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 ? void 0 : updatedUnconfirmedStepsData.origins.forEach(origin => {
|
|
942
|
+
if (origin instanceof Transaction && origin.getMeta('isOffline')) {
|
|
943
|
+
origin.setMeta('isOffline', false);
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
} else {
|
|
947
|
+
this.timeout = undefined;
|
|
948
|
+
}
|
|
949
|
+
}, 6000);
|
|
950
|
+
}
|
|
932
951
|
return;
|
|
952
|
+
} else if (this.timeoutExceeded) {
|
|
953
|
+
this.timeoutExceeded = false;
|
|
954
|
+
if (this.timeout) {
|
|
955
|
+
clearTimeout(this.timeout);
|
|
956
|
+
this.timeout = undefined;
|
|
957
|
+
}
|
|
933
958
|
}
|
|
934
959
|
}
|
|
935
960
|
|
|
@@ -3,7 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { Provider } from './provider';
|
|
4
4
|
import { getProduct, getSubProduct } from './helpers/utils';
|
|
5
5
|
import { SOCKET_IO_OPTIONS, SOCKET_IO_OPTIONS_WITH_HIGH_JITTER } from './config';
|
|
6
|
-
export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper
|
|
6
|
+
export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper) {
|
|
7
7
|
const {
|
|
8
8
|
pathname
|
|
9
9
|
} = new URL(url);
|
|
@@ -21,16 +21,6 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
|
|
|
21
21
|
socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
// Merge default headers with custom headers, custom headers take precedence
|
|
26
|
-
const defaultExtraHeaders = {
|
|
27
|
-
'x-product': getProduct(productInfo),
|
|
28
|
-
'x-subproduct': getSubProduct(productInfo)
|
|
29
|
-
};
|
|
30
|
-
const extraHeaders = customExtraHeaders ? {
|
|
31
|
-
...defaultExtraHeaders,
|
|
32
|
-
...customExtraHeaders
|
|
33
|
-
} : defaultExtraHeaders;
|
|
34
24
|
const client = io(url, {
|
|
35
25
|
reconnectionDelayMax: socketIOOptions.RECONNECTION_DELAY_MAX,
|
|
36
26
|
reconnectionDelay: socketIOOptions.RECONNECTION_DELAY,
|
|
@@ -40,7 +30,10 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
|
|
|
40
30
|
transports,
|
|
41
31
|
path: `/${pathname.split('/')[1]}/socket.io`,
|
|
42
32
|
auth,
|
|
43
|
-
extraHeaders
|
|
33
|
+
extraHeaders: {
|
|
34
|
+
'x-product': getProduct(productInfo),
|
|
35
|
+
'x-subproduct': getSubProduct(productInfo)
|
|
36
|
+
}
|
|
44
37
|
});
|
|
45
38
|
return client;
|
|
46
39
|
}
|
package/dist/esm/channel.js
CHANGED
|
@@ -629,7 +629,7 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
|
|
|
629
629
|
};
|
|
630
630
|
}();
|
|
631
631
|
}
|
|
632
|
-
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper
|
|
632
|
+
this.socket = createSocket("".concat(url, "/session/").concat(documentAri), auth, this.config.productInfo, this.config.isPresenceOnly, this.analyticsHelper);
|
|
633
633
|
|
|
634
634
|
// Due to https://github.com/socketio/socket.io-client/issues/1473,
|
|
635
635
|
// reconnect no longer fired on the socket.
|
|
@@ -72,6 +72,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
72
72
|
_defineProperty(this, "catchUpOutofSync", false);
|
|
73
73
|
_defineProperty(this, "hasRecovered", false);
|
|
74
74
|
_defineProperty(this, "numberOfStepCommitsSent", 0);
|
|
75
|
+
_defineProperty(this, "timeoutExceeded", false);
|
|
75
76
|
/**
|
|
76
77
|
* To prevent calling catchup to often, use lodash throttle to reduce the frequency
|
|
77
78
|
* @param reason - optional reason to attach.
|
|
@@ -994,6 +995,7 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
994
995
|
*/
|
|
995
996
|
function send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
|
|
996
997
|
) {
|
|
998
|
+
var _this3 = this;
|
|
997
999
|
var unconfirmedStepsData = sendableSteps(newState);
|
|
998
1000
|
var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
|
|
999
1001
|
|
|
@@ -1050,12 +1052,36 @@ export var DocumentService = /*#__PURE__*/function () {
|
|
|
1050
1052
|
});
|
|
1051
1053
|
}
|
|
1052
1054
|
if (editorExperiment('platform_editor_offline_editing_web', true)) {
|
|
1053
|
-
var
|
|
1055
|
+
var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
|
|
1054
1056
|
var _tr$getMeta;
|
|
1055
1057
|
return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
|
|
1056
1058
|
});
|
|
1057
|
-
if (
|
|
1059
|
+
if (containsOfflineSteps && !this.timeoutExceeded) {
|
|
1060
|
+
// Only start timer if we're online and don't already have one running
|
|
1061
|
+
if (this.getConnected() && !this.timeout) {
|
|
1062
|
+
this.timeout = setTimeout(function () {
|
|
1063
|
+
// If the timer expires and we're still online, handle the offline steps.
|
|
1064
|
+
// Otherwise, clear the timer so it can restart when we're online again.
|
|
1065
|
+
if (_this3.getConnected()) {
|
|
1066
|
+
_this3.timeoutExceeded = true;
|
|
1067
|
+
var updatedUnconfirmedStepsData = sendableSteps(newState);
|
|
1068
|
+
updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
|
|
1069
|
+
if (origin instanceof Transaction && origin.getMeta('isOffline')) {
|
|
1070
|
+
origin.setMeta('isOffline', false);
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
} else {
|
|
1074
|
+
_this3.timeout = undefined;
|
|
1075
|
+
}
|
|
1076
|
+
}, 6000);
|
|
1077
|
+
}
|
|
1058
1078
|
return;
|
|
1079
|
+
} else if (this.timeoutExceeded) {
|
|
1080
|
+
this.timeoutExceeded = false;
|
|
1081
|
+
if (this.timeout) {
|
|
1082
|
+
clearTimeout(this.timeout);
|
|
1083
|
+
this.timeout = undefined;
|
|
1084
|
+
}
|
|
1059
1085
|
}
|
|
1060
1086
|
}
|
|
1061
1087
|
|
|
@@ -6,7 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
6
6
|
import { Provider } from './provider';
|
|
7
7
|
import { getProduct, getSubProduct } from './helpers/utils';
|
|
8
8
|
import { SOCKET_IO_OPTIONS, SOCKET_IO_OPTIONS_WITH_HIGH_JITTER } from './config';
|
|
9
|
-
export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper
|
|
9
|
+
export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsHelper) {
|
|
10
10
|
var _URL = new URL(url),
|
|
11
11
|
pathname = _URL.pathname;
|
|
12
12
|
var socketIOOptions = SOCKET_IO_OPTIONS;
|
|
@@ -23,13 +23,6 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
|
|
|
23
23
|
socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
// Merge default headers with custom headers, custom headers take precedence
|
|
28
|
-
var defaultExtraHeaders = {
|
|
29
|
-
'x-product': getProduct(productInfo),
|
|
30
|
-
'x-subproduct': getSubProduct(productInfo)
|
|
31
|
-
};
|
|
32
|
-
var extraHeaders = customExtraHeaders ? _objectSpread(_objectSpread({}, defaultExtraHeaders), customExtraHeaders) : defaultExtraHeaders;
|
|
33
26
|
var client = io(url, {
|
|
34
27
|
reconnectionDelayMax: socketIOOptions.RECONNECTION_DELAY_MAX,
|
|
35
28
|
reconnectionDelay: socketIOOptions.RECONNECTION_DELAY,
|
|
@@ -39,7 +32,10 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
|
|
|
39
32
|
transports: transports,
|
|
40
33
|
path: "/".concat(pathname.split('/')[1], "/socket.io"),
|
|
41
34
|
auth: auth,
|
|
42
|
-
extraHeaders:
|
|
35
|
+
extraHeaders: {
|
|
36
|
+
'x-product': getProduct(productInfo),
|
|
37
|
+
'x-subproduct': getSubProduct(productInfo)
|
|
38
|
+
}
|
|
43
39
|
});
|
|
44
40
|
return client;
|
|
45
41
|
}
|
|
@@ -37,6 +37,8 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
37
37
|
private hasRecovered;
|
|
38
38
|
private numberOfStepCommitsSent;
|
|
39
39
|
private commitStepService;
|
|
40
|
+
private timeout;
|
|
41
|
+
private timeoutExceeded;
|
|
40
42
|
private clientId?;
|
|
41
43
|
onErrorHandled: (error: InternalError) => void;
|
|
42
44
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { type Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ConflictChanges } from '@atlaskit/editor-common/collab';
|
|
4
|
-
import { Rebaseable } from '@atlaskit/prosemirror-collab';
|
|
4
|
+
import { type Rebaseable } from '@atlaskit/prosemirror-collab';
|
|
5
5
|
interface Options {
|
|
6
6
|
localSteps: readonly Rebaseable[];
|
|
7
7
|
remoteSteps: ProseMirrorStep[];
|
|
@@ -4,7 +4,7 @@ import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/trans
|
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
6
6
|
import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
7
|
-
import { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { type Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { CustomError } from '../errors/custom-errors';
|
|
9
9
|
export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
|
|
10
10
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProviderParticipant } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import type { PresencePayload } from '../types';
|
|
3
|
-
import { ParticipantsState } from './participants-state';
|
|
3
|
+
import { type ParticipantsState } from './participants-state';
|
|
4
4
|
export declare const PARTICIPANT_UPDATE_INTERVAL: number;
|
|
5
5
|
export type ParticipantsMap = Map<string, ProviderParticipant>;
|
|
6
6
|
type UserType = Pick<ProviderParticipant, 'name' | 'avatar' | 'userId' | 'email' | 'isGuest'>;
|
|
@@ -2,5 +2,5 @@ import type { Socket } from 'socket.io-client';
|
|
|
2
2
|
import { Provider } from './provider';
|
|
3
3
|
import type AnalyticsHelper from './analytics/analytics-helper';
|
|
4
4
|
import type { Config, ProductInformation, InitAndAuthData, AuthCallback } from './types';
|
|
5
|
-
export declare function createSocketIOSocket(url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper
|
|
5
|
+
export declare function createSocketIOSocket(url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper): Socket;
|
|
6
6
|
export declare function createSocketIOCollabProvider(config: Omit<Config, 'createSocket'>): Provider;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface Config {
|
|
|
29
29
|
lifecycle?: Lifecycle;
|
|
30
30
|
storage?: Storage;
|
|
31
31
|
need404?: boolean;
|
|
32
|
-
createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper
|
|
32
|
+
createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper) => SocketIOSocket;
|
|
33
33
|
batchProps?: BatchProps;
|
|
34
34
|
fetchAnonymousAsset?: FetchAnonymousAsset;
|
|
35
35
|
/**
|
|
@@ -96,7 +96,6 @@ export interface Config {
|
|
|
96
96
|
* This activity can be updated later on by the participants-service.
|
|
97
97
|
*/
|
|
98
98
|
presenceActivity?: PresenceActivity;
|
|
99
|
-
customExtraHeaders?: Record<string, string>;
|
|
100
99
|
}
|
|
101
100
|
export interface InitAndAuthData {
|
|
102
101
|
initialized: boolean;
|
|
@@ -37,6 +37,8 @@ export declare class DocumentService implements DocumentServiceInterface {
|
|
|
37
37
|
private hasRecovered;
|
|
38
38
|
private numberOfStepCommitsSent;
|
|
39
39
|
private commitStepService;
|
|
40
|
+
private timeout;
|
|
41
|
+
private timeoutExceeded;
|
|
40
42
|
private clientId?;
|
|
41
43
|
onErrorHandled: (error: InternalError) => void;
|
|
42
44
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { type Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ConflictChanges } from '@atlaskit/editor-common/collab';
|
|
4
|
-
import { Rebaseable } from '@atlaskit/prosemirror-collab';
|
|
4
|
+
import { type Rebaseable } from '@atlaskit/prosemirror-collab';
|
|
5
5
|
interface Options {
|
|
6
6
|
localSteps: readonly Rebaseable[];
|
|
7
7
|
remoteSteps: ProseMirrorStep[];
|
|
@@ -4,7 +4,7 @@ import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/trans
|
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
6
6
|
import { type JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
7
|
-
import { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { type Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { CustomError } from '../errors/custom-errors';
|
|
9
9
|
export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
|
|
10
10
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProviderParticipant } from '@atlaskit/editor-common/collab';
|
|
2
2
|
import type { PresencePayload } from '../types';
|
|
3
|
-
import { ParticipantsState } from './participants-state';
|
|
3
|
+
import { type ParticipantsState } from './participants-state';
|
|
4
4
|
export declare const PARTICIPANT_UPDATE_INTERVAL: number;
|
|
5
5
|
export type ParticipantsMap = Map<string, ProviderParticipant>;
|
|
6
6
|
type UserType = Pick<ProviderParticipant, 'name' | 'avatar' | 'userId' | 'email' | 'isGuest'>;
|
|
@@ -2,5 +2,5 @@ import type { Socket } from 'socket.io-client';
|
|
|
2
2
|
import { Provider } from './provider';
|
|
3
3
|
import type AnalyticsHelper from './analytics/analytics-helper';
|
|
4
4
|
import type { Config, ProductInformation, InitAndAuthData, AuthCallback } from './types';
|
|
5
|
-
export declare function createSocketIOSocket(url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper
|
|
5
|
+
export declare function createSocketIOSocket(url: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper): Socket;
|
|
6
6
|
export declare function createSocketIOCollabProvider(config: Omit<Config, 'createSocket'>): Provider;
|
|
@@ -29,7 +29,7 @@ export interface Config {
|
|
|
29
29
|
lifecycle?: Lifecycle;
|
|
30
30
|
storage?: Storage;
|
|
31
31
|
need404?: boolean;
|
|
32
|
-
createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper
|
|
32
|
+
createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper) => SocketIOSocket;
|
|
33
33
|
batchProps?: BatchProps;
|
|
34
34
|
fetchAnonymousAsset?: FetchAnonymousAsset;
|
|
35
35
|
/**
|
|
@@ -96,7 +96,6 @@ export interface Config {
|
|
|
96
96
|
* This activity can be updated later on by the participants-service.
|
|
97
97
|
*/
|
|
98
98
|
presenceActivity?: PresenceActivity;
|
|
99
|
-
customExtraHeaders?: Record<string, string>;
|
|
100
99
|
}
|
|
101
100
|
export interface InitAndAuthData {
|
|
102
101
|
initialized: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.22.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
37
37
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
38
38
|
"@atlaskit/anonymous-assets": "^0.0.2",
|
|
39
|
-
"@atlaskit/editor-common": "^107.
|
|
39
|
+
"@atlaskit/editor-common": "^107.6.0",
|
|
40
40
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
42
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/prosemirror-collab": "^0.17.0",
|
|
45
45
|
"@atlaskit/react-ufo": "^3.14.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^8.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^8.7.0",
|
|
47
47
|
"@atlaskit/ufo": "^0.4.0",
|
|
48
48
|
"@atlaskit/util-service-support": "^6.3.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|