@atlaskit/collab-provider 9.7.0 → 9.7.1
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 +6 -0
- package/dist/cjs/disconnected-reason-mapper.js +8 -17
- package/dist/cjs/errors/error-code-mapper.js +13 -12
- package/dist/cjs/errors/error-types.js +2 -95
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/types.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/disconnected-reason-mapper.js +2 -9
- package/dist/es2019/errors/error-code-mapper.js +2 -1
- package/dist/es2019/errors/error-types.js +0 -94
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/types.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/disconnected-reason-mapper.js +2 -9
- package/dist/esm/errors/error-code-mapper.js +2 -1
- package/dist/esm/errors/error-types.js +0 -94
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/channel.d.ts +2 -1
- package/dist/types/disconnected-reason-mapper.d.ts +1 -8
- package/dist/types/document/document-service.d.ts +3 -2
- package/dist/types/errors/error-code-mapper.d.ts +2 -1
- package/dist/types/errors/error-types.d.ts +0 -190
- package/dist/types/helpers/const.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/metadata/metadata-service.d.ts +1 -1
- package/dist/types/participants/participants-helper.d.ts +2 -6
- package/dist/types/participants/participants-service.d.ts +3 -2
- package/dist/types/participants/participants-state.d.ts +2 -1
- package/dist/types/participants/telepointers-helper.d.ts +2 -2
- package/dist/types/provider/commit-step.d.ts +2 -1
- package/dist/types/provider/index.d.ts +3 -3
- package/dist/types/socket-io-provider.d.ts +1 -1
- package/dist/types/types.d.ts +2 -149
- package/dist/types-ts4.5/channel.d.ts +2 -1
- package/dist/types-ts4.5/disconnected-reason-mapper.d.ts +1 -8
- package/dist/types-ts4.5/document/document-service.d.ts +3 -2
- package/dist/types-ts4.5/errors/error-code-mapper.d.ts +2 -1
- package/dist/types-ts4.5/errors/error-types.d.ts +0 -190
- package/dist/types-ts4.5/helpers/const.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/dist/types-ts4.5/metadata/metadata-service.d.ts +1 -1
- package/dist/types-ts4.5/participants/participants-helper.d.ts +2 -6
- package/dist/types-ts4.5/participants/participants-service.d.ts +3 -2
- package/dist/types-ts4.5/participants/participants-state.d.ts +2 -1
- package/dist/types-ts4.5/participants/telepointers-helper.d.ts +2 -2
- package/dist/types-ts4.5/provider/commit-step.d.ts +2 -1
- package/dist/types-ts4.5/provider/index.d.ts +3 -3
- package/dist/types-ts4.5/socket-io-provider.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -149
- package/package.json +2 -1
- package/report.api.md +49 -390
- package/tmp/api-report-tmp.d.ts +257 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 9.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14224c3f8a4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/14224c3f8a4) - [ED-18162] Move the collab provider types to the editor common package to avoid circular dependencies
|
|
8
|
+
|
|
3
9
|
## 9.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.socketIOReasons = exports.disconnectedReasonMapper =
|
|
6
|
+
exports.socketIOReasons = exports.disconnectedReasonMapper = void 0;
|
|
7
|
+
var _collab = require("@atlaskit/editor-common/collab");
|
|
7
8
|
// See https://socket.io/docs/v3/client-socket-instance#disconnect for emitted reasons
|
|
8
9
|
var socketIOReasons = {
|
|
9
10
|
IO_CLIENT_DISCONNECT: 'io client disconnect',
|
|
@@ -17,30 +18,20 @@ var socketIOReasons = {
|
|
|
17
18
|
PING_TIMEOUT: 'ping timeout' // The connection has encountered an error (example: the server was killed during a HTTP long-polling cycle)
|
|
18
19
|
};
|
|
19
20
|
exports.socketIOReasons = socketIOReasons;
|
|
20
|
-
var DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
|
|
21
|
-
DisconnectReason["CLIENT_DISCONNECT"] = "CLIENT_DISCONNECT";
|
|
22
|
-
DisconnectReason["SERVER_DISCONNECT"] = "SERVER_DISCONNECT";
|
|
23
|
-
DisconnectReason["SOCKET_CLOSED"] = "SOCKET_CLOSED";
|
|
24
|
-
DisconnectReason["SOCKET_ERROR"] = "SOCKET_ERROR";
|
|
25
|
-
DisconnectReason["SOCKET_TIMEOUT"] = "SOCKET_TIMEOUT";
|
|
26
|
-
DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
|
|
27
|
-
return DisconnectReason;
|
|
28
|
-
}({});
|
|
29
|
-
exports.DisconnectReason = DisconnectReason;
|
|
30
21
|
var disconnectedReasonMapper = function disconnectedReasonMapper(reason) {
|
|
31
22
|
switch (reason) {
|
|
32
23
|
case socketIOReasons.IO_CLIENT_DISCONNECT:
|
|
33
|
-
return DisconnectReason.CLIENT_DISCONNECT;
|
|
24
|
+
return _collab.DisconnectReason.CLIENT_DISCONNECT;
|
|
34
25
|
case socketIOReasons.IO_SERVER_DISCONNECT:
|
|
35
|
-
return DisconnectReason.SERVER_DISCONNECT;
|
|
26
|
+
return _collab.DisconnectReason.SERVER_DISCONNECT;
|
|
36
27
|
case socketIOReasons.TRANSPORT_CLOSED:
|
|
37
|
-
return DisconnectReason.SOCKET_CLOSED;
|
|
28
|
+
return _collab.DisconnectReason.SOCKET_CLOSED;
|
|
38
29
|
case socketIOReasons.TRANSPORT_ERROR:
|
|
39
|
-
return DisconnectReason.SOCKET_ERROR;
|
|
30
|
+
return _collab.DisconnectReason.SOCKET_ERROR;
|
|
40
31
|
case socketIOReasons.PING_TIMEOUT:
|
|
41
|
-
return DisconnectReason.SOCKET_TIMEOUT;
|
|
32
|
+
return _collab.DisconnectReason.SOCKET_TIMEOUT;
|
|
42
33
|
default:
|
|
43
|
-
return DisconnectReason.UNKNOWN_DISCONNECT;
|
|
34
|
+
return _collab.DisconnectReason.UNKNOWN_DISCONNECT;
|
|
44
35
|
}
|
|
45
36
|
};
|
|
46
37
|
exports.disconnectedReasonMapper = disconnectedReasonMapper;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.errorCodeMapper = void 0;
|
|
7
7
|
var _errorTypes = require("./error-types");
|
|
8
|
+
var _collab = require("@atlaskit/editor-common/collab");
|
|
8
9
|
/*
|
|
9
10
|
* Maps internal collab provider errors to an emitted error format
|
|
10
11
|
*/
|
|
@@ -23,7 +24,7 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
23
24
|
case _errorTypes.NCS_ERROR_CODE.INSUFFICIENT_EDITING_PERMISSION:
|
|
24
25
|
case _errorTypes.INTERNAL_ERROR_CODE.TOKEN_PERMISSION_ERROR:
|
|
25
26
|
return {
|
|
26
|
-
code:
|
|
27
|
+
code: _collab.PROVIDER_ERROR_CODE.NO_PERMISSION_ERROR,
|
|
27
28
|
message: 'User does not have permissions to access this document or document is not found',
|
|
28
29
|
reason: error.data.meta.reason,
|
|
29
30
|
recoverable: true,
|
|
@@ -31,14 +32,14 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
31
32
|
};
|
|
32
33
|
case _errorTypes.NCS_ERROR_CODE.FORBIDDEN_USER_TOKEN:
|
|
33
34
|
return {
|
|
34
|
-
code:
|
|
35
|
+
code: _collab.PROVIDER_ERROR_CODE.INVALID_USER_TOKEN,
|
|
35
36
|
message: 'The user token was invalid',
|
|
36
37
|
recoverable: true,
|
|
37
38
|
status: 403
|
|
38
39
|
};
|
|
39
40
|
case _errorTypes.INTERNAL_ERROR_CODE.DOCUMENT_NOT_FOUND:
|
|
40
41
|
return {
|
|
41
|
-
code:
|
|
42
|
+
code: _collab.PROVIDER_ERROR_CODE.DOCUMENT_NOT_FOUND,
|
|
42
43
|
message: 'The requested document is not found',
|
|
43
44
|
recoverable: true,
|
|
44
45
|
status: 404
|
|
@@ -46,41 +47,41 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
46
47
|
case _errorTypes.NCS_ERROR_CODE.TENANT_INSTANCE_MAINTENANCE:
|
|
47
48
|
case _errorTypes.NCS_ERROR_CODE.LOCKED_DOCUMENT:
|
|
48
49
|
return {
|
|
49
|
-
code:
|
|
50
|
+
code: _collab.PROVIDER_ERROR_CODE.LOCKED,
|
|
50
51
|
message: 'The document is currently not available, please try again later',
|
|
51
52
|
recoverable: true
|
|
52
53
|
};
|
|
53
54
|
case _errorTypes.NCS_ERROR_CODE.DYNAMO_ERROR:
|
|
54
55
|
return {
|
|
55
|
-
code:
|
|
56
|
+
code: _collab.PROVIDER_ERROR_CODE.FAIL_TO_SAVE,
|
|
56
57
|
message: 'Collab service is not able to save changes',
|
|
57
58
|
recoverable: false,
|
|
58
59
|
status: 500
|
|
59
60
|
};
|
|
60
61
|
case _errorTypes.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR:
|
|
61
62
|
return {
|
|
62
|
-
code:
|
|
63
|
+
code: _collab.PROVIDER_ERROR_CODE.DOCUMENT_RESTORE_ERROR,
|
|
63
64
|
message: 'Collab service unable to restore document',
|
|
64
65
|
recoverable: false,
|
|
65
66
|
status: 500
|
|
66
67
|
};
|
|
67
68
|
case _errorTypes.NCS_ERROR_CODE.INIT_DATA_LOAD_FAILED:
|
|
68
69
|
return {
|
|
69
|
-
code:
|
|
70
|
+
code: _collab.PROVIDER_ERROR_CODE.INITIALISATION_ERROR,
|
|
70
71
|
message: "The initial document couldn't be loaded from the collab service",
|
|
71
72
|
recoverable: false,
|
|
72
73
|
status: 500
|
|
73
74
|
};
|
|
74
75
|
case _errorTypes.INTERNAL_ERROR_CODE.DOCUMENT_UPDATE_ERROR:
|
|
75
76
|
return {
|
|
76
|
-
code:
|
|
77
|
+
code: _collab.PROVIDER_ERROR_CODE.DOCUMENT_UPDATE_ERROR,
|
|
77
78
|
message: 'The provider failed to apply changes to the editor',
|
|
78
79
|
recoverable: false,
|
|
79
80
|
status: 500
|
|
80
81
|
};
|
|
81
82
|
case _errorTypes.INTERNAL_ERROR_CODE.RECONNECTION_NETWORK_ISSUE:
|
|
82
83
|
return {
|
|
83
|
-
code:
|
|
84
|
+
code: _collab.PROVIDER_ERROR_CODE.NETWORK_ISSUE,
|
|
84
85
|
message: "Couldn't reconnect to the collab service due to network issues",
|
|
85
86
|
recoverable: true,
|
|
86
87
|
status: 500
|
|
@@ -90,7 +91,7 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
90
91
|
case _errorTypes.NCS_ERROR_CODE.INVALID_DOCUMENT_ARI:
|
|
91
92
|
case _errorTypes.NCS_ERROR_CODE.INVALID_CLOUD_ID:
|
|
92
93
|
return {
|
|
93
|
-
code:
|
|
94
|
+
code: _collab.PROVIDER_ERROR_CODE.INVALID_PROVIDER_CONFIGURATION,
|
|
94
95
|
message: 'Invalid provider configuration',
|
|
95
96
|
recoverable: false,
|
|
96
97
|
reason: (_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code,
|
|
@@ -100,7 +101,7 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
100
101
|
case _errorTypes.NCS_ERROR_CODE.ERROR_MAPPING_ERROR:
|
|
101
102
|
case _errorTypes.NCS_ERROR_CODE.EMPTY_BROADCAST:
|
|
102
103
|
return {
|
|
103
|
-
code:
|
|
104
|
+
code: _collab.PROVIDER_ERROR_CODE.INTERNAL_SERVICE_ERROR,
|
|
104
105
|
message: 'Collab Provider experienced an unrecoverable error',
|
|
105
106
|
recoverable: false,
|
|
106
107
|
reason: (_error$data3 = error.data) === null || _error$data3 === void 0 ? void 0 : _error$data3.code,
|
|
@@ -108,7 +109,7 @@ var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
108
109
|
};
|
|
109
110
|
case _errorTypes.INTERNAL_ERROR_CODE.CATCHUP_FAILED:
|
|
110
111
|
return {
|
|
111
|
-
code:
|
|
112
|
+
code: _collab.PROVIDER_ERROR_CODE.INTERNAL_SERVICE_ERROR,
|
|
112
113
|
message: 'Collab Provider experienced an unrecoverable error',
|
|
113
114
|
recoverable: true,
|
|
114
115
|
reason: (_error$data4 = error.data) === null || _error$data4 === void 0 ? void 0 : _error$data4.code,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.UpdateDocumentError = exports.SetTitleError = exports.SetMetadataError = exports.SetEditorWidthError = exports.SendTransactionError = exports.ProviderInitialisationError = exports.
|
|
7
|
+
exports.UpdateDocumentError = exports.SetTitleError = exports.SetMetadataError = exports.SetEditorWidthError = exports.SendTransactionError = exports.ProviderInitialisationError = exports.NotInitializedError = exports.NotConnectedError = exports.NCS_ERROR_CODE = exports.INTERNAL_ERROR_CODE = exports.GetFinalAcknowledgedStateError = exports.GetCurrentStateError = exports.DestroyError = exports.CustomError = exports.CantSyncUpError = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -63,22 +63,6 @@ var NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
63
63
|
/**
|
|
64
64
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
65
65
|
*/
|
|
66
|
-
exports.NCS_ERROR_CODE = NCS_ERROR_CODE;
|
|
67
|
-
// Emitted errors
|
|
68
|
-
var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
69
|
-
PROVIDER_ERROR_CODE["NO_PERMISSION_ERROR"] = "NO_PERMISSION_ERROR";
|
|
70
|
-
PROVIDER_ERROR_CODE["INVALID_USER_TOKEN"] = "INVALID_USER_TOKEN";
|
|
71
|
-
PROVIDER_ERROR_CODE["DOCUMENT_NOT_FOUND"] = "DOCUMENT_NOT_FOUND";
|
|
72
|
-
PROVIDER_ERROR_CODE["LOCKED"] = "LOCKED";
|
|
73
|
-
PROVIDER_ERROR_CODE["FAIL_TO_SAVE"] = "FAIL_TO_SAVE";
|
|
74
|
-
PROVIDER_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
75
|
-
PROVIDER_ERROR_CODE["INITIALISATION_ERROR"] = "INITIALISATION_ERROR";
|
|
76
|
-
PROVIDER_ERROR_CODE["NETWORK_ISSUE"] = "NETWORK_ISSUE";
|
|
77
|
-
PROVIDER_ERROR_CODE["INVALID_PROVIDER_CONFIGURATION"] = "INVALID_PROVIDER_CONFIGURATION";
|
|
78
|
-
PROVIDER_ERROR_CODE["INTERNAL_SERVICE_ERROR"] = "INTERNAL_SERVICE_ERROR";
|
|
79
|
-
PROVIDER_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
80
|
-
return PROVIDER_ERROR_CODE;
|
|
81
|
-
}({});
|
|
82
66
|
/*
|
|
83
67
|
* This is what a generic ProviderError type would look like:
|
|
84
68
|
* type ProviderError = {
|
|
@@ -94,84 +78,7 @@ var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
|
94
78
|
* reason?: string;
|
|
95
79
|
* }
|
|
96
80
|
*/
|
|
97
|
-
|
|
98
|
-
* This occurs when the provided user token is considered invalid for the given document ARI.
|
|
99
|
-
* It happens during initialisation of the provider.
|
|
100
|
-
* It could mean the document has been deleted (hence not found).
|
|
101
|
-
* @message Message returned to editor, i.e User does not have permissions to access this document or document is not found
|
|
102
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* Similiar to InsufficientEditingPermission, but the user token is invalid because it has expired or been revoked.
|
|
106
|
-
* It may also be an invalid token format.
|
|
107
|
-
* This error is given to the provider by NCS.
|
|
108
|
-
* @message Message returned to editor, i.e. The user token was invalid
|
|
109
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
110
|
-
*/
|
|
111
|
-
/**
|
|
112
|
-
* Document not found error, thrown when the provider is unable to find a document with the given ARI and user token.
|
|
113
|
-
* It occurs during fetchCatchup, a function that fetches the latest document state during catchup.
|
|
114
|
-
* We need to recieve a 404 from the document service to throw this error.
|
|
115
|
-
* @message Message returned to editor, i.e. The requested document is not found
|
|
116
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
117
|
-
*/
|
|
118
|
-
/**
|
|
119
|
-
* This error is thrown when the document is locked by another user.
|
|
120
|
-
* The error is passed to us by NCS.
|
|
121
|
-
* @message Message returned to editor, i.e. The document is currently not available, please try again later
|
|
122
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
123
|
-
*/
|
|
124
|
-
/**
|
|
125
|
-
* This error is thrown when the provider is unable to save the document.
|
|
126
|
-
* This can happen when the connection to dynamoDB is lost, or when we do not have sufficient permissions (DYNAMO ERROR).
|
|
127
|
-
* This error is given to us by NCS.
|
|
128
|
-
* @message Message returned to editor, i.e. Collab service is not able to save changes
|
|
129
|
-
* @recoverable It is not recoverable, as we don't want the user to continue editing a document that is not being saved.
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* This error is thrown when the provider is unable to restore the document.
|
|
133
|
-
* It occurs during onRestore, a function that restores the document to a previous version and reapplies unconfirmed steps.
|
|
134
|
-
* onRestore is called when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
135
|
-
* It could mean we failed to update the page metadata, or we failed to reapply unconfirmed steps.
|
|
136
|
-
* @message Message returned to editor, i.e. Collab service unable to restore document
|
|
137
|
-
* @recoverable It is not recoverable, as the provider has no further options after this.
|
|
138
|
-
* The user will need to refresh the page to try again.
|
|
139
|
-
*/
|
|
140
|
-
/**
|
|
141
|
-
* The initial document couldn't be loaded from the collab service.
|
|
142
|
-
* This error is given to us by NCS.
|
|
143
|
-
* It could indicate either a network issue, or an internal service error in NCS.
|
|
144
|
-
* @message Message returned to editor, i.e. The initial document couldn't be loaded from the collab service
|
|
145
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
146
|
-
* The user will need to refresh the page to try again.
|
|
147
|
-
*/
|
|
148
|
-
/**
|
|
149
|
-
* Couldn't reconnect to the collab service (NCS) due to network issues.
|
|
150
|
-
* NCS could be down, or the user could be offline. It's also possible the url is incorrect, or the user is behind a proxy blocking the connection.
|
|
151
|
-
* Fired upon a reconnection attempt error (from Socket.IO Manager)
|
|
152
|
-
* @message Message returned to editor, i.e. Couldn't reconnect to the collab service due to network issues
|
|
153
|
-
* @recoverable It is recoverable, as the provider will try to reconnect.
|
|
154
|
-
*/
|
|
155
|
-
/**
|
|
156
|
-
* This error is thrown when the provider has an invalid configuration.
|
|
157
|
-
* It could happen due to these errors from NCS:
|
|
158
|
-
* NAMESPACE_INVALID
|
|
159
|
-
INVALID_ACTIVATION_ID
|
|
160
|
-
INVALID_DOCUMENT_ARI
|
|
161
|
-
INVALID_CLOUD_ID
|
|
162
|
-
* @message Message returned to editor, i.e. Invalid provider configuration
|
|
163
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
164
|
-
* The service using the provider will need to fix the configuration.
|
|
165
|
-
*/
|
|
166
|
-
/**
|
|
167
|
-
* This error is thrown when the provider encounters an internal service error, not otherwise accounted for.
|
|
168
|
-
* @message Message returned to editor, i.e. Collab Provider experienced an unrecoverable error
|
|
169
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
170
|
-
*/
|
|
171
|
-
/**
|
|
172
|
-
* A union of all possible provider errors that can be emitted back to the editor.
|
|
173
|
-
*/
|
|
174
|
-
exports.PROVIDER_ERROR_CODE = PROVIDER_ERROR_CODE;
|
|
81
|
+
exports.NCS_ERROR_CODE = NCS_ERROR_CODE;
|
|
175
82
|
// Custom Errors
|
|
176
83
|
var CustomError = /*#__PURE__*/function (_Error) {
|
|
177
84
|
(0, _inherits2.default)(CustomError, _Error);
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "PROVIDER_ERROR_CODE", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _collab.PROVIDER_ERROR_CODE;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "Provider", {
|
|
@@ -16,4 +16,4 @@ Object.defineProperty(exports, "Provider", {
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
var _provider = require("./provider");
|
|
19
|
-
var
|
|
19
|
+
var _collab = require("@atlaskit/editor-common/collab");
|
package/dist/cjs/types.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AcknowledgementResponseTypes = void 0;
|
|
7
|
-
// types
|
|
7
|
+
// Re-export values for the /types entry point to this package
|
|
8
8
|
// types from editor common end
|
|
9
9
|
// Initial draft
|
|
10
10
|
// Channel
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/collab-provider";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "9.7.
|
|
9
|
+
var version = "9.7.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DisconnectReason } from '@atlaskit/editor-common/collab';
|
|
2
|
+
|
|
1
3
|
// See https://socket.io/docs/v3/client-socket-instance#disconnect for emitted reasons
|
|
2
4
|
export const socketIOReasons = {
|
|
3
5
|
IO_CLIENT_DISCONNECT: 'io client disconnect',
|
|
@@ -11,15 +13,6 @@ export const socketIOReasons = {
|
|
|
11
13
|
PING_TIMEOUT: 'ping timeout' // The connection has encountered an error (example: the server was killed during a HTTP long-polling cycle)
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
export let DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
|
|
15
|
-
DisconnectReason["CLIENT_DISCONNECT"] = "CLIENT_DISCONNECT";
|
|
16
|
-
DisconnectReason["SERVER_DISCONNECT"] = "SERVER_DISCONNECT";
|
|
17
|
-
DisconnectReason["SOCKET_CLOSED"] = "SOCKET_CLOSED";
|
|
18
|
-
DisconnectReason["SOCKET_ERROR"] = "SOCKET_ERROR";
|
|
19
|
-
DisconnectReason["SOCKET_TIMEOUT"] = "SOCKET_TIMEOUT";
|
|
20
|
-
DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
|
|
21
|
-
return DisconnectReason;
|
|
22
|
-
}({});
|
|
23
16
|
export const disconnectedReasonMapper = reason => {
|
|
24
17
|
switch (reason) {
|
|
25
18
|
case socketIOReasons.IO_CLIENT_DISCONNECT:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NCS_ERROR_CODE } from './error-types';
|
|
2
|
-
import { INTERNAL_ERROR_CODE
|
|
2
|
+
import { INTERNAL_ERROR_CODE } from './error-types';
|
|
3
|
+
import { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
|
3
4
|
|
|
4
5
|
/*
|
|
5
6
|
* Maps internal collab provider errors to an emitted error format
|
|
@@ -52,22 +52,6 @@ export let NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
52
52
|
/**
|
|
53
53
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
54
54
|
*/
|
|
55
|
-
// Emitted errors
|
|
56
|
-
export let PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
57
|
-
PROVIDER_ERROR_CODE["NO_PERMISSION_ERROR"] = "NO_PERMISSION_ERROR";
|
|
58
|
-
PROVIDER_ERROR_CODE["INVALID_USER_TOKEN"] = "INVALID_USER_TOKEN";
|
|
59
|
-
PROVIDER_ERROR_CODE["DOCUMENT_NOT_FOUND"] = "DOCUMENT_NOT_FOUND";
|
|
60
|
-
PROVIDER_ERROR_CODE["LOCKED"] = "LOCKED";
|
|
61
|
-
PROVIDER_ERROR_CODE["FAIL_TO_SAVE"] = "FAIL_TO_SAVE";
|
|
62
|
-
PROVIDER_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
63
|
-
PROVIDER_ERROR_CODE["INITIALISATION_ERROR"] = "INITIALISATION_ERROR";
|
|
64
|
-
PROVIDER_ERROR_CODE["NETWORK_ISSUE"] = "NETWORK_ISSUE";
|
|
65
|
-
PROVIDER_ERROR_CODE["INVALID_PROVIDER_CONFIGURATION"] = "INVALID_PROVIDER_CONFIGURATION";
|
|
66
|
-
PROVIDER_ERROR_CODE["INTERNAL_SERVICE_ERROR"] = "INTERNAL_SERVICE_ERROR";
|
|
67
|
-
PROVIDER_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
68
|
-
return PROVIDER_ERROR_CODE;
|
|
69
|
-
}({});
|
|
70
|
-
|
|
71
55
|
/*
|
|
72
56
|
* This is what a generic ProviderError type would look like:
|
|
73
57
|
* type ProviderError = {
|
|
@@ -83,84 +67,6 @@ export let PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
|
83
67
|
* reason?: string;
|
|
84
68
|
* }
|
|
85
69
|
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* This occurs when the provided user token is considered invalid for the given document ARI.
|
|
89
|
-
* It happens during initialisation of the provider.
|
|
90
|
-
* It could mean the document has been deleted (hence not found).
|
|
91
|
-
* @message Message returned to editor, i.e User does not have permissions to access this document or document is not found
|
|
92
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
93
|
-
*/
|
|
94
|
-
/**
|
|
95
|
-
* Similiar to InsufficientEditingPermission, but the user token is invalid because it has expired or been revoked.
|
|
96
|
-
* It may also be an invalid token format.
|
|
97
|
-
* This error is given to the provider by NCS.
|
|
98
|
-
* @message Message returned to editor, i.e. The user token was invalid
|
|
99
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
100
|
-
*/
|
|
101
|
-
/**
|
|
102
|
-
* Document not found error, thrown when the provider is unable to find a document with the given ARI and user token.
|
|
103
|
-
* It occurs during fetchCatchup, a function that fetches the latest document state during catchup.
|
|
104
|
-
* We need to recieve a 404 from the document service to throw this error.
|
|
105
|
-
* @message Message returned to editor, i.e. The requested document is not found
|
|
106
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
107
|
-
*/
|
|
108
|
-
/**
|
|
109
|
-
* This error is thrown when the document is locked by another user.
|
|
110
|
-
* The error is passed to us by NCS.
|
|
111
|
-
* @message Message returned to editor, i.e. The document is currently not available, please try again later
|
|
112
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
113
|
-
*/
|
|
114
|
-
/**
|
|
115
|
-
* This error is thrown when the provider is unable to save the document.
|
|
116
|
-
* This can happen when the connection to dynamoDB is lost, or when we do not have sufficient permissions (DYNAMO ERROR).
|
|
117
|
-
* This error is given to us by NCS.
|
|
118
|
-
* @message Message returned to editor, i.e. Collab service is not able to save changes
|
|
119
|
-
* @recoverable It is not recoverable, as we don't want the user to continue editing a document that is not being saved.
|
|
120
|
-
*/
|
|
121
|
-
/**
|
|
122
|
-
* This error is thrown when the provider is unable to restore the document.
|
|
123
|
-
* It occurs during onRestore, a function that restores the document to a previous version and reapplies unconfirmed steps.
|
|
124
|
-
* onRestore is called when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
125
|
-
* It could mean we failed to update the page metadata, or we failed to reapply unconfirmed steps.
|
|
126
|
-
* @message Message returned to editor, i.e. Collab service unable to restore document
|
|
127
|
-
* @recoverable It is not recoverable, as the provider has no further options after this.
|
|
128
|
-
* The user will need to refresh the page to try again.
|
|
129
|
-
*/
|
|
130
|
-
/**
|
|
131
|
-
* The initial document couldn't be loaded from the collab service.
|
|
132
|
-
* This error is given to us by NCS.
|
|
133
|
-
* It could indicate either a network issue, or an internal service error in NCS.
|
|
134
|
-
* @message Message returned to editor, i.e. The initial document couldn't be loaded from the collab service
|
|
135
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
136
|
-
* The user will need to refresh the page to try again.
|
|
137
|
-
*/
|
|
138
|
-
/**
|
|
139
|
-
* Couldn't reconnect to the collab service (NCS) due to network issues.
|
|
140
|
-
* NCS could be down, or the user could be offline. It's also possible the url is incorrect, or the user is behind a proxy blocking the connection.
|
|
141
|
-
* Fired upon a reconnection attempt error (from Socket.IO Manager)
|
|
142
|
-
* @message Message returned to editor, i.e. Couldn't reconnect to the collab service due to network issues
|
|
143
|
-
* @recoverable It is recoverable, as the provider will try to reconnect.
|
|
144
|
-
*/
|
|
145
|
-
/**
|
|
146
|
-
* This error is thrown when the provider has an invalid configuration.
|
|
147
|
-
* It could happen due to these errors from NCS:
|
|
148
|
-
* NAMESPACE_INVALID
|
|
149
|
-
INVALID_ACTIVATION_ID
|
|
150
|
-
INVALID_DOCUMENT_ARI
|
|
151
|
-
INVALID_CLOUD_ID
|
|
152
|
-
* @message Message returned to editor, i.e. Invalid provider configuration
|
|
153
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
154
|
-
* The service using the provider will need to fix the configuration.
|
|
155
|
-
*/
|
|
156
|
-
/**
|
|
157
|
-
* This error is thrown when the provider encounters an internal service error, not otherwise accounted for.
|
|
158
|
-
* @message Message returned to editor, i.e. Collab Provider experienced an unrecoverable error
|
|
159
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
160
|
-
*/
|
|
161
|
-
/**
|
|
162
|
-
* A union of all possible provider errors that can be emitted back to the editor.
|
|
163
|
-
*/
|
|
164
70
|
// Custom Errors
|
|
165
71
|
export class CustomError extends Error {
|
|
166
72
|
constructor(message, error, extraEventAttributes) {
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Provider } from './provider';
|
|
2
|
-
export { PROVIDER_ERROR_CODE } from '
|
|
2
|
+
export { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
package/dist/es2019/types.js
CHANGED
package/dist/es2019/version.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DisconnectReason } from '@atlaskit/editor-common/collab';
|
|
2
|
+
|
|
1
3
|
// See https://socket.io/docs/v3/client-socket-instance#disconnect for emitted reasons
|
|
2
4
|
export var socketIOReasons = {
|
|
3
5
|
IO_CLIENT_DISCONNECT: 'io client disconnect',
|
|
@@ -11,15 +13,6 @@ export var socketIOReasons = {
|
|
|
11
13
|
PING_TIMEOUT: 'ping timeout' // The connection has encountered an error (example: the server was killed during a HTTP long-polling cycle)
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
export var DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
|
|
15
|
-
DisconnectReason["CLIENT_DISCONNECT"] = "CLIENT_DISCONNECT";
|
|
16
|
-
DisconnectReason["SERVER_DISCONNECT"] = "SERVER_DISCONNECT";
|
|
17
|
-
DisconnectReason["SOCKET_CLOSED"] = "SOCKET_CLOSED";
|
|
18
|
-
DisconnectReason["SOCKET_ERROR"] = "SOCKET_ERROR";
|
|
19
|
-
DisconnectReason["SOCKET_TIMEOUT"] = "SOCKET_TIMEOUT";
|
|
20
|
-
DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
|
|
21
|
-
return DisconnectReason;
|
|
22
|
-
}({});
|
|
23
16
|
export var disconnectedReasonMapper = function disconnectedReasonMapper(reason) {
|
|
24
17
|
switch (reason) {
|
|
25
18
|
case socketIOReasons.IO_CLIENT_DISCONNECT:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NCS_ERROR_CODE } from './error-types';
|
|
2
|
-
import { INTERNAL_ERROR_CODE
|
|
2
|
+
import { INTERNAL_ERROR_CODE } from './error-types';
|
|
3
|
+
import { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
|
3
4
|
|
|
4
5
|
/*
|
|
5
6
|
* Maps internal collab provider errors to an emitted error format
|
|
@@ -61,22 +61,6 @@ export var NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
61
61
|
/**
|
|
62
62
|
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
63
63
|
*/
|
|
64
|
-
// Emitted errors
|
|
65
|
-
export var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
66
|
-
PROVIDER_ERROR_CODE["NO_PERMISSION_ERROR"] = "NO_PERMISSION_ERROR";
|
|
67
|
-
PROVIDER_ERROR_CODE["INVALID_USER_TOKEN"] = "INVALID_USER_TOKEN";
|
|
68
|
-
PROVIDER_ERROR_CODE["DOCUMENT_NOT_FOUND"] = "DOCUMENT_NOT_FOUND";
|
|
69
|
-
PROVIDER_ERROR_CODE["LOCKED"] = "LOCKED";
|
|
70
|
-
PROVIDER_ERROR_CODE["FAIL_TO_SAVE"] = "FAIL_TO_SAVE";
|
|
71
|
-
PROVIDER_ERROR_CODE["DOCUMENT_RESTORE_ERROR"] = "DOCUMENT_RESTORE_ERROR";
|
|
72
|
-
PROVIDER_ERROR_CODE["INITIALISATION_ERROR"] = "INITIALISATION_ERROR";
|
|
73
|
-
PROVIDER_ERROR_CODE["NETWORK_ISSUE"] = "NETWORK_ISSUE";
|
|
74
|
-
PROVIDER_ERROR_CODE["INVALID_PROVIDER_CONFIGURATION"] = "INVALID_PROVIDER_CONFIGURATION";
|
|
75
|
-
PROVIDER_ERROR_CODE["INTERNAL_SERVICE_ERROR"] = "INTERNAL_SERVICE_ERROR";
|
|
76
|
-
PROVIDER_ERROR_CODE["DOCUMENT_UPDATE_ERROR"] = "DOCUMENT_UPDATE_ERROR";
|
|
77
|
-
return PROVIDER_ERROR_CODE;
|
|
78
|
-
}({});
|
|
79
|
-
|
|
80
64
|
/*
|
|
81
65
|
* This is what a generic ProviderError type would look like:
|
|
82
66
|
* type ProviderError = {
|
|
@@ -92,84 +76,6 @@ export var PROVIDER_ERROR_CODE = /*#__PURE__*/function (PROVIDER_ERROR_CODE) {
|
|
|
92
76
|
* reason?: string;
|
|
93
77
|
* }
|
|
94
78
|
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* This occurs when the provided user token is considered invalid for the given document ARI.
|
|
98
|
-
* It happens during initialisation of the provider.
|
|
99
|
-
* It could mean the document has been deleted (hence not found).
|
|
100
|
-
* @message Message returned to editor, i.e User does not have permissions to access this document or document is not found
|
|
101
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* Similiar to InsufficientEditingPermission, but the user token is invalid because it has expired or been revoked.
|
|
105
|
-
* It may also be an invalid token format.
|
|
106
|
-
* This error is given to the provider by NCS.
|
|
107
|
-
* @message Message returned to editor, i.e. The user token was invalid
|
|
108
|
-
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* Document not found error, thrown when the provider is unable to find a document with the given ARI and user token.
|
|
112
|
-
* It occurs during fetchCatchup, a function that fetches the latest document state during catchup.
|
|
113
|
-
* We need to recieve a 404 from the document service to throw this error.
|
|
114
|
-
* @message Message returned to editor, i.e. The requested document is not found
|
|
115
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* This error is thrown when the document is locked by another user.
|
|
119
|
-
* The error is passed to us by NCS.
|
|
120
|
-
* @message Message returned to editor, i.e. The document is currently not available, please try again later
|
|
121
|
-
* @recoverable It is recoverable, as the provider can try again later.
|
|
122
|
-
*/
|
|
123
|
-
/**
|
|
124
|
-
* This error is thrown when the provider is unable to save the document.
|
|
125
|
-
* This can happen when the connection to dynamoDB is lost, or when we do not have sufficient permissions (DYNAMO ERROR).
|
|
126
|
-
* This error is given to us by NCS.
|
|
127
|
-
* @message Message returned to editor, i.e. Collab service is not able to save changes
|
|
128
|
-
* @recoverable It is not recoverable, as we don't want the user to continue editing a document that is not being saved.
|
|
129
|
-
*/
|
|
130
|
-
/**
|
|
131
|
-
* This error is thrown when the provider is unable to restore the document.
|
|
132
|
-
* It occurs during onRestore, a function that restores the document to a previous version and reapplies unconfirmed steps.
|
|
133
|
-
* onRestore is called when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
134
|
-
* It could mean we failed to update the page metadata, or we failed to reapply unconfirmed steps.
|
|
135
|
-
* @message Message returned to editor, i.e. Collab service unable to restore document
|
|
136
|
-
* @recoverable It is not recoverable, as the provider has no further options after this.
|
|
137
|
-
* The user will need to refresh the page to try again.
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* The initial document couldn't be loaded from the collab service.
|
|
141
|
-
* This error is given to us by NCS.
|
|
142
|
-
* It could indicate either a network issue, or an internal service error in NCS.
|
|
143
|
-
* @message Message returned to editor, i.e. The initial document couldn't be loaded from the collab service
|
|
144
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
145
|
-
* The user will need to refresh the page to try again.
|
|
146
|
-
*/
|
|
147
|
-
/**
|
|
148
|
-
* Couldn't reconnect to the collab service (NCS) due to network issues.
|
|
149
|
-
* NCS could be down, or the user could be offline. It's also possible the url is incorrect, or the user is behind a proxy blocking the connection.
|
|
150
|
-
* Fired upon a reconnection attempt error (from Socket.IO Manager)
|
|
151
|
-
* @message Message returned to editor, i.e. Couldn't reconnect to the collab service due to network issues
|
|
152
|
-
* @recoverable It is recoverable, as the provider will try to reconnect.
|
|
153
|
-
*/
|
|
154
|
-
/**
|
|
155
|
-
* This error is thrown when the provider has an invalid configuration.
|
|
156
|
-
* It could happen due to these errors from NCS:
|
|
157
|
-
* NAMESPACE_INVALID
|
|
158
|
-
INVALID_ACTIVATION_ID
|
|
159
|
-
INVALID_DOCUMENT_ARI
|
|
160
|
-
INVALID_CLOUD_ID
|
|
161
|
-
* @message Message returned to editor, i.e. Invalid provider configuration
|
|
162
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
163
|
-
* The service using the provider will need to fix the configuration.
|
|
164
|
-
*/
|
|
165
|
-
/**
|
|
166
|
-
* This error is thrown when the provider encounters an internal service error, not otherwise accounted for.
|
|
167
|
-
* @message Message returned to editor, i.e. Collab Provider experienced an unrecoverable error
|
|
168
|
-
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
169
|
-
*/
|
|
170
|
-
/**
|
|
171
|
-
* A union of all possible provider errors that can be emitted back to the editor.
|
|
172
|
-
*/
|
|
173
79
|
// Custom Errors
|
|
174
80
|
export var CustomError = /*#__PURE__*/function (_Error) {
|
|
175
81
|
_inherits(CustomError, _Error);
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Provider } from './provider';
|
|
2
|
-
export { PROVIDER_ERROR_CODE } from '
|
|
2
|
+
export { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
package/dist/esm/types.js
CHANGED