@atlaskit/collab-provider 25.1.5 → 25.2.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 +21 -0
- package/dist/cjs/errors/error-code-mapper.js +14 -0
- package/dist/cjs/errors/ncs-errors.js +7 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/errors/error-code-mapper.js +14 -0
- package/dist/es2019/errors/ncs-errors.js +8 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/errors/error-code-mapper.js +14 -0
- package/dist/esm/errors/ncs-errors.js +8 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/errors/ncs-errors.d.ts +16 -1
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 25.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`23f2823b17126`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/23f2823b17126) -
|
|
8
|
+
Add a `DOCUMENT_BLOCKED` provider error and map the NCS `ARI_BLACKLISTED` (423) error to it.
|
|
9
|
+
Previously `ARI_BLACKLISTED` had no mapping and was silently dropped by the provider, so products
|
|
10
|
+
could not react to a blocked (blacklisted) document. The new mapping is gated behind
|
|
11
|
+
`platform_editor_blocked_document_ux`; when the gate is off the error is still dropped, preserving
|
|
12
|
+
existing behaviour.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 25.1.6
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 25.1.5
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.errorCodeMapper = void 0;
|
|
7
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
7
8
|
var _ncsErrors = require("./ncs-errors");
|
|
8
9
|
var _internalErrors = require("./internal-errors");
|
|
9
10
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
@@ -58,6 +59,19 @@ var errorCodeMapper = exports.errorCodeMapper = function errorCodeMapper(error)
|
|
|
58
59
|
message: 'The document is currently not available, please try again later',
|
|
59
60
|
recoverable: true
|
|
60
61
|
};
|
|
62
|
+
case _ncsErrors.NCS_ERROR_CODE.ARI_BLACKLISTED:
|
|
63
|
+
// The document ARI has been blocked (e.g. via the documentari kill switch). This is not
|
|
64
|
+
// recoverable, so emit a distinct error the product can use to disable editing and tell
|
|
65
|
+
// the user the document is blocked, rather than swallowing it as an unmapped error.
|
|
66
|
+
if ((0, _fg.fg)('platform_editor_blocked_document_ux')) {
|
|
67
|
+
return {
|
|
68
|
+
code: _collab.PROVIDER_ERROR_CODE.DOCUMENT_BLOCKED,
|
|
69
|
+
message: 'The document is blocked and cannot be edited',
|
|
70
|
+
recoverable: false,
|
|
71
|
+
status: 423
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
61
75
|
case _ncsErrors.NCS_ERROR_CODE.DYNAMO_ERROR:
|
|
62
76
|
return {
|
|
63
77
|
code: _collab.PROVIDER_ERROR_CODE.FAIL_TO_SAVE,
|
|
@@ -17,6 +17,7 @@ var NCS_ERROR_CODE = exports.NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_C
|
|
|
17
17
|
NCS_ERROR_CODE["NAMESPACE_NOT_FOUND"] = "NAMESPACE_NOT_FOUND";
|
|
18
18
|
NCS_ERROR_CODE["TENANT_INSTANCE_MAINTENANCE"] = "TENANT_INSTANCE_MAINTENANCE";
|
|
19
19
|
NCS_ERROR_CODE["LOCKED_DOCUMENT"] = "LOCKED_DOCUMENT";
|
|
20
|
+
NCS_ERROR_CODE["ARI_BLACKLISTED"] = "ARI_BLACKLISTED";
|
|
20
21
|
NCS_ERROR_CODE["EMPTY_BROADCAST"] = "EMPTY_BROADCAST";
|
|
21
22
|
NCS_ERROR_CODE["DYNAMO_ERROR"] = "DYNAMO_ERROR";
|
|
22
23
|
NCS_ERROR_CODE["INVALID_ACTIVATION_ID"] = "INVALID_ACTIVATION_ID";
|
|
@@ -36,6 +37,12 @@ var NCS_ERROR_CODE = exports.NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_C
|
|
|
36
37
|
* This might be because invalid ADF has been written to a document, as it was not validated correctly.
|
|
37
38
|
*/
|
|
38
39
|
// - Less common back-end errors
|
|
40
|
+
/**
|
|
41
|
+
* The document ARI has been blacklisted (blocked) by NCS, e.g. via the documentari kill switch
|
|
42
|
+
* https://switcheroo.atlassian.com/ui/gates/1a5f36bd-0eb6-4634-ba32-ae325174edb8/key/documentari_kill_switch
|
|
43
|
+
* NCS rejects the connection with a 423 status. Unlike a temporary namespace lock, this is not
|
|
44
|
+
* expected to clear on its own.
|
|
45
|
+
*/
|
|
39
46
|
/**
|
|
40
47
|
* The client is trying to send too many messages or messages that are too large. This not expected to be a standard
|
|
41
48
|
* operating condition and should only ever indicate a frontend bug.
|
|
@@ -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 = "25.1.
|
|
8
|
+
var version = exports.version = "25.1.6";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
1
2
|
import { NCS_ERROR_CODE } from './ncs-errors';
|
|
2
3
|
import { INTERNAL_ERROR_CODE } from './internal-errors';
|
|
3
4
|
import { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
|
@@ -53,6 +54,19 @@ export const errorCodeMapper = error => {
|
|
|
53
54
|
message: 'The document is currently not available, please try again later',
|
|
54
55
|
recoverable: true
|
|
55
56
|
};
|
|
57
|
+
case NCS_ERROR_CODE.ARI_BLACKLISTED:
|
|
58
|
+
// The document ARI has been blocked (e.g. via the documentari kill switch). This is not
|
|
59
|
+
// recoverable, so emit a distinct error the product can use to disable editing and tell
|
|
60
|
+
// the user the document is blocked, rather than swallowing it as an unmapped error.
|
|
61
|
+
if (fg('platform_editor_blocked_document_ux')) {
|
|
62
|
+
return {
|
|
63
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_BLOCKED,
|
|
64
|
+
message: 'The document is blocked and cannot be edited',
|
|
65
|
+
recoverable: false,
|
|
66
|
+
status: 423
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
56
70
|
case NCS_ERROR_CODE.DYNAMO_ERROR:
|
|
57
71
|
return {
|
|
58
72
|
code: PROVIDER_ERROR_CODE.FAIL_TO_SAVE,
|
|
@@ -11,6 +11,7 @@ export let NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
11
11
|
NCS_ERROR_CODE["NAMESPACE_NOT_FOUND"] = "NAMESPACE_NOT_FOUND";
|
|
12
12
|
NCS_ERROR_CODE["TENANT_INSTANCE_MAINTENANCE"] = "TENANT_INSTANCE_MAINTENANCE";
|
|
13
13
|
NCS_ERROR_CODE["LOCKED_DOCUMENT"] = "LOCKED_DOCUMENT";
|
|
14
|
+
NCS_ERROR_CODE["ARI_BLACKLISTED"] = "ARI_BLACKLISTED";
|
|
14
15
|
NCS_ERROR_CODE["EMPTY_BROADCAST"] = "EMPTY_BROADCAST";
|
|
15
16
|
NCS_ERROR_CODE["DYNAMO_ERROR"] = "DYNAMO_ERROR";
|
|
16
17
|
NCS_ERROR_CODE["INVALID_ACTIVATION_ID"] = "INVALID_ACTIVATION_ID";
|
|
@@ -39,6 +40,13 @@ export let NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
39
40
|
|
|
40
41
|
// - Less common back-end errors
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The document ARI has been blacklisted (blocked) by NCS, e.g. via the documentari kill switch
|
|
45
|
+
* https://switcheroo.atlassian.com/ui/gates/1a5f36bd-0eb6-4634-ba32-ae325174edb8/key/documentari_kill_switch
|
|
46
|
+
* NCS rejects the connection with a 423 status. Unlike a temporary namespace lock, this is not
|
|
47
|
+
* expected to clear on its own.
|
|
48
|
+
*/
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* The client is trying to send too many messages or messages that are too large. This not expected to be a standard
|
|
44
52
|
* operating condition and should only ever indicate a frontend bug.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
1
2
|
import { NCS_ERROR_CODE } from './ncs-errors';
|
|
2
3
|
import { INTERNAL_ERROR_CODE } from './internal-errors';
|
|
3
4
|
import { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
|
|
@@ -53,6 +54,19 @@ export var errorCodeMapper = function errorCodeMapper(error) {
|
|
|
53
54
|
message: 'The document is currently not available, please try again later',
|
|
54
55
|
recoverable: true
|
|
55
56
|
};
|
|
57
|
+
case NCS_ERROR_CODE.ARI_BLACKLISTED:
|
|
58
|
+
// The document ARI has been blocked (e.g. via the documentari kill switch). This is not
|
|
59
|
+
// recoverable, so emit a distinct error the product can use to disable editing and tell
|
|
60
|
+
// the user the document is blocked, rather than swallowing it as an unmapped error.
|
|
61
|
+
if (fg('platform_editor_blocked_document_ux')) {
|
|
62
|
+
return {
|
|
63
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_BLOCKED,
|
|
64
|
+
message: 'The document is blocked and cannot be edited',
|
|
65
|
+
recoverable: false,
|
|
66
|
+
status: 423
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
56
70
|
case NCS_ERROR_CODE.DYNAMO_ERROR:
|
|
57
71
|
return {
|
|
58
72
|
code: PROVIDER_ERROR_CODE.FAIL_TO_SAVE,
|
|
@@ -11,6 +11,7 @@ export var NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
11
11
|
NCS_ERROR_CODE["NAMESPACE_NOT_FOUND"] = "NAMESPACE_NOT_FOUND";
|
|
12
12
|
NCS_ERROR_CODE["TENANT_INSTANCE_MAINTENANCE"] = "TENANT_INSTANCE_MAINTENANCE";
|
|
13
13
|
NCS_ERROR_CODE["LOCKED_DOCUMENT"] = "LOCKED_DOCUMENT";
|
|
14
|
+
NCS_ERROR_CODE["ARI_BLACKLISTED"] = "ARI_BLACKLISTED";
|
|
14
15
|
NCS_ERROR_CODE["EMPTY_BROADCAST"] = "EMPTY_BROADCAST";
|
|
15
16
|
NCS_ERROR_CODE["DYNAMO_ERROR"] = "DYNAMO_ERROR";
|
|
16
17
|
NCS_ERROR_CODE["INVALID_ACTIVATION_ID"] = "INVALID_ACTIVATION_ID";
|
|
@@ -39,6 +40,13 @@ export var NCS_ERROR_CODE = /*#__PURE__*/function (NCS_ERROR_CODE) {
|
|
|
39
40
|
|
|
40
41
|
// - Less common back-end errors
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The document ARI has been blacklisted (blocked) by NCS, e.g. via the documentari kill switch
|
|
45
|
+
* https://switcheroo.atlassian.com/ui/gates/1a5f36bd-0eb6-4634-ba32-ae325174edb8/key/documentari_kill_switch
|
|
46
|
+
* NCS rejects the connection with a 423 status. Unlike a temporary namespace lock, this is not
|
|
47
|
+
* expected to clear on its own.
|
|
48
|
+
*/
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* The client is trying to send too many messages or messages that are too large. This not expected to be a standard
|
|
44
52
|
* operating condition and should only ever indicate a frontend bug.
|
|
@@ -10,6 +10,7 @@ export declare enum NCS_ERROR_CODE {
|
|
|
10
10
|
NAMESPACE_NOT_FOUND = "NAMESPACE_NOT_FOUND",
|
|
11
11
|
TENANT_INSTANCE_MAINTENANCE = "TENANT_INSTANCE_MAINTENANCE",
|
|
12
12
|
LOCKED_DOCUMENT = "LOCKED_DOCUMENT",
|
|
13
|
+
ARI_BLACKLISTED = "ARI_BLACKLISTED",
|
|
13
14
|
EMPTY_BROADCAST = "EMPTY_BROADCAST",
|
|
14
15
|
DYNAMO_ERROR = "DYNAMO_ERROR",
|
|
15
16
|
INVALID_ACTIVATION_ID = "INVALID_ACTIVATION_ID",
|
|
@@ -123,6 +124,20 @@ type NamespaceLockedError = {
|
|
|
123
124
|
};
|
|
124
125
|
message: string;
|
|
125
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* The document ARI has been blacklisted (blocked) by NCS, e.g. via the documentari kill switch
|
|
129
|
+
* https://switcheroo.atlassian.com/ui/gates/1a5f36bd-0eb6-4634-ba32-ae325174edb8/key/documentari_kill_switch
|
|
130
|
+
* NCS rejects the connection with a 423 status. Unlike a temporary namespace lock, this is not
|
|
131
|
+
* expected to clear on its own.
|
|
132
|
+
*/
|
|
133
|
+
type DocumentBlacklistedError = {
|
|
134
|
+
data: {
|
|
135
|
+
code: NCS_ERROR_CODE.ARI_BLACKLISTED;
|
|
136
|
+
meta?: string;
|
|
137
|
+
status: number;
|
|
138
|
+
};
|
|
139
|
+
message: string;
|
|
140
|
+
};
|
|
126
141
|
type EmptyBroadcastError = {
|
|
127
142
|
data: {
|
|
128
143
|
code: NCS_ERROR_CODE.EMPTY_BROADCAST;
|
|
@@ -180,5 +195,5 @@ export type RateLimitError = {
|
|
|
180
195
|
};
|
|
181
196
|
message: string;
|
|
182
197
|
};
|
|
183
|
-
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError;
|
|
198
|
+
export type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | DocumentBlacklistedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError | RateLimitError | ProsemirrorSchemaValidationError;
|
|
184
199
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.2.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"team": "Editor: Collaboration"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@atlaskit/adf-utils": "^20.
|
|
21
|
+
"@atlaskit/adf-utils": "^20.9.0",
|
|
22
22
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
23
23
|
"@atlaskit/analytics-listeners": "^11.3.0",
|
|
24
24
|
"@atlaskit/anonymous-assets": "^2.8.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
31
31
|
"@atlaskit/prosemirror-collab": "^1.1.0",
|
|
32
32
|
"@atlaskit/react-ufo": "^7.8.0",
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
33
|
+
"@atlaskit/tmp-editor-statsig": "^174.0.0",
|
|
34
34
|
"@atlaskit/ufo": "^1.2.0",
|
|
35
35
|
"@atlaskit/util-service-support": "^7.3.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"prosemirror-changeset": "^2.3.1",
|
|
41
41
|
"socket.io-client": "^4.7.5",
|
|
42
|
-
"uuid": "^
|
|
42
|
+
"uuid": "^11.1.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@atlaskit/adf-schema": "^57.
|
|
45
|
+
"@atlaskit/adf-schema": "^57.3.0",
|
|
46
46
|
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
47
47
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
48
48
|
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
@@ -61,9 +61,12 @@
|
|
|
61
61
|
},
|
|
62
62
|
"collab_edit_via_websocket_only_for_gcp": {
|
|
63
63
|
"type": "boolean"
|
|
64
|
+
},
|
|
65
|
+
"platform_editor_blocked_document_ux": {
|
|
66
|
+
"type": "boolean"
|
|
64
67
|
}
|
|
65
68
|
},
|
|
66
69
|
"peerDependencies": {
|
|
67
|
-
"@atlaskit/editor-common": "^120.
|
|
70
|
+
"@atlaskit/editor-common": "^120.14.0"
|
|
68
71
|
}
|
|
69
72
|
}
|