@atlaskit/collab-provider 8.8.0 → 8.8.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/channel.js +1 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/channel.js +1 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/channel.js +1 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/helpers/const.d.ts +0 -1
- package/dist/types-ts4.0/analytics/analytics-helper.d.ts +11 -0
- package/dist/types-ts4.0/analytics/performance.d.ts +15 -0
- package/dist/types-ts4.0/analytics/ufo.d.ts +3 -0
- package/dist/types-ts4.0/channel.d.ts +47 -0
- package/dist/types-ts4.0/config.d.ts +5 -0
- package/dist/types-ts4.0/connectivity/network.d.ts +17 -0
- package/dist/types-ts4.0/connectivity/reconnect-helper.d.ts +8 -0
- package/dist/types-ts4.0/connectivity/singleton.d.ts +3 -0
- package/dist/types-ts4.0/disconnected-reason-mapper.d.ts +16 -0
- package/dist/types-ts4.0/document/catchup.d.ts +9 -0
- package/dist/types-ts4.0/document/document-service.d.ts +86 -0
- package/dist/types-ts4.0/document/step-queue-state.d.ts +16 -0
- package/dist/types-ts4.0/emitter.d.ts +19 -0
- package/dist/types-ts4.0/errors/error-code-mapper.d.ts +2 -0
- package/dist/types-ts4.0/errors/error-types.d.ts +443 -0
- package/dist/types-ts4.0/feature-flags/__test__/index.unit.d.ts +1 -0
- package/dist/types-ts4.0/feature-flags/index.d.ts +9 -0
- package/dist/types-ts4.0/feature-flags/types.d.ts +13 -0
- package/dist/types-ts4.0/helpers/const.d.ts +183 -0
- package/dist/types-ts4.0/helpers/utils.d.ts +5 -0
- package/dist/types-ts4.0/index.d.ts +4 -0
- package/dist/types-ts4.0/metadata/metadata-service.d.ts +25 -0
- package/dist/types-ts4.0/participants/participants-helper.d.ts +14 -0
- package/dist/types-ts4.0/participants/participants-service.d.ts +70 -0
- package/dist/types-ts4.0/participants/participants-state.d.ts +13 -0
- package/dist/types-ts4.0/participants/telepointers-helper.d.ts +4 -0
- package/dist/types-ts4.0/provider/commit-step.d.ts +25 -0
- package/dist/types-ts4.0/provider/index.d.ts +162 -0
- package/dist/types-ts4.0/socket-io-provider.d.ts +5 -0
- package/dist/types-ts4.0/types.d.ts +265 -0
- package/dist/types-ts4.0/version-wrapper.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
export declare enum INTERNAL_ERROR_CODE {
|
|
2
|
+
TOKEN_PERMISSION_ERROR = "TOKEN_PERMISSION_ERROR",
|
|
3
|
+
RECONNECTION_NETWORK_ISSUE = "RECONNECTION_NETWORK_ISSUE",
|
|
4
|
+
CONNECTION_ERROR = "CONNECTION_ERROR",
|
|
5
|
+
RECONNECTION_ERROR = "RECONNECTION_ERROR",
|
|
6
|
+
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
7
|
+
CATCHUP_FAILED = "CATCHUP_FAILED",
|
|
8
|
+
DOCUMENT_RESTORE_ERROR = "DOCUMENT_RESTORE_ERROR",
|
|
9
|
+
ADD_STEPS_ERROR = "ADD_STEPS_ERROR"
|
|
10
|
+
}
|
|
11
|
+
export declare enum NCS_ERROR_CODE {
|
|
12
|
+
HEAD_VERSION_UPDATE_FAILED = "HEAD_VERSION_UPDATE_FAILED",
|
|
13
|
+
VERSION_NUMBER_ALREADY_EXISTS = "VERSION_NUMBER_ALREADY_EXISTS",
|
|
14
|
+
INSUFFICIENT_EDITING_PERMISSION = "INSUFFICIENT_EDITING_PERMISSION",
|
|
15
|
+
FORBIDDEN_USER_TOKEN = "FORBIDDEN_USER_TOKEN",
|
|
16
|
+
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
17
|
+
INIT_DATA_LOAD_FAILED = "INIT_DATA_LOAD_FAILED",
|
|
18
|
+
ERROR_MAPPING_ERROR = "ERROR_MAPPING_ERROR",
|
|
19
|
+
NAMESPACE_INVALID = "NAMESPACE_INVALID",
|
|
20
|
+
NAMESPACE_NOT_FOUND = "NAMESPACE_NOT_FOUND",
|
|
21
|
+
TENANT_INSTANCE_MAINTENANCE = "TENANT_INSTANCE_MAINTENANCE",
|
|
22
|
+
LOCKED_DOCUMENT = "LOCKED_DOCUMENT",
|
|
23
|
+
EMPTY_BROADCAST = "EMPTY_BROADCAST",
|
|
24
|
+
DYNAMO_ERROR = "DYNAMO_ERROR",
|
|
25
|
+
INVALID_ACTIVATION_ID = "INVALID_ACTIVATION_ID",
|
|
26
|
+
INVALID_DOCUMENT_ARI = "INVALID_DOCUMENT_ARI",
|
|
27
|
+
INVALID_CLOUD_ID = "INVALID_CLOUD_ID"
|
|
28
|
+
}
|
|
29
|
+
declare type HeadVersionUpdateFailedError = {
|
|
30
|
+
message: string;
|
|
31
|
+
data: {
|
|
32
|
+
code: NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED;
|
|
33
|
+
meta: {
|
|
34
|
+
currentVersion: any;
|
|
35
|
+
incomingVersion: number;
|
|
36
|
+
};
|
|
37
|
+
status: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
declare type VersionAlreadyPresentInDynamoError = {
|
|
41
|
+
message: string;
|
|
42
|
+
data: {
|
|
43
|
+
code: NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS;
|
|
44
|
+
meta: string;
|
|
45
|
+
status: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
declare type InsufficientEditingPermissionError = {
|
|
49
|
+
message: string;
|
|
50
|
+
data: {
|
|
51
|
+
code: NCS_ERROR_CODE.INSUFFICIENT_EDITING_PERMISSION;
|
|
52
|
+
meta: {
|
|
53
|
+
description: string;
|
|
54
|
+
reason?: string;
|
|
55
|
+
};
|
|
56
|
+
status: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
declare type ForbiddenUserTokenError = {
|
|
60
|
+
message: string;
|
|
61
|
+
data: {
|
|
62
|
+
code: NCS_ERROR_CODE.FORBIDDEN_USER_TOKEN;
|
|
63
|
+
meta: string;
|
|
64
|
+
status: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare type NCSDocumentNotFoundError = {
|
|
68
|
+
message: string;
|
|
69
|
+
data: {
|
|
70
|
+
code: NCS_ERROR_CODE.DOCUMENT_NOT_FOUND;
|
|
71
|
+
status: number;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
declare type FailedToLoadInitDataError = {
|
|
75
|
+
message: string;
|
|
76
|
+
data: {
|
|
77
|
+
code: NCS_ERROR_CODE.INIT_DATA_LOAD_FAILED;
|
|
78
|
+
status: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
declare type ErrorMappingError = {
|
|
82
|
+
message: string;
|
|
83
|
+
data: {
|
|
84
|
+
code: NCS_ERROR_CODE.ERROR_MAPPING_ERROR;
|
|
85
|
+
status: number;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
declare type InvalidNamespaceDefinedError = {
|
|
89
|
+
message: string;
|
|
90
|
+
data: {
|
|
91
|
+
code: NCS_ERROR_CODE.NAMESPACE_INVALID;
|
|
92
|
+
meta: string;
|
|
93
|
+
status: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
declare type SocketNamespaceNotFoundError = {
|
|
97
|
+
message: string;
|
|
98
|
+
data: {
|
|
99
|
+
code: NCS_ERROR_CODE.NAMESPACE_NOT_FOUND;
|
|
100
|
+
meta: string;
|
|
101
|
+
status: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
declare type TenantInstanceMaintenanceError = {
|
|
105
|
+
message: string;
|
|
106
|
+
data: {
|
|
107
|
+
code: NCS_ERROR_CODE.TENANT_INSTANCE_MAINTENANCE;
|
|
108
|
+
meta: {
|
|
109
|
+
description: string;
|
|
110
|
+
reason: string;
|
|
111
|
+
};
|
|
112
|
+
status: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
declare type NamespaceLockedError = {
|
|
116
|
+
message: string;
|
|
117
|
+
data: {
|
|
118
|
+
code: NCS_ERROR_CODE.LOCKED_DOCUMENT;
|
|
119
|
+
meta: string;
|
|
120
|
+
status: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
declare type EmptyBroadcastError = {
|
|
124
|
+
message: string;
|
|
125
|
+
data: {
|
|
126
|
+
code: NCS_ERROR_CODE.EMPTY_BROADCAST;
|
|
127
|
+
meta: string;
|
|
128
|
+
status: number;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
declare type DynamoError = {
|
|
132
|
+
message: string;
|
|
133
|
+
data: {
|
|
134
|
+
code: NCS_ERROR_CODE.DYNAMO_ERROR;
|
|
135
|
+
meta: string;
|
|
136
|
+
status: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
declare type InvalidActivationIdError = {
|
|
140
|
+
message: string;
|
|
141
|
+
data: {
|
|
142
|
+
code: NCS_ERROR_CODE.INVALID_ACTIVATION_ID;
|
|
143
|
+
meta: string;
|
|
144
|
+
status: number;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
declare type InvalidDocumentAriError = {
|
|
148
|
+
message: string;
|
|
149
|
+
data: {
|
|
150
|
+
code: NCS_ERROR_CODE.INVALID_DOCUMENT_ARI;
|
|
151
|
+
meta: string;
|
|
152
|
+
status: number;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
declare type InvalidCloudIdError = {
|
|
156
|
+
message: string;
|
|
157
|
+
data: {
|
|
158
|
+
code: NCS_ERROR_CODE.INVALID_CLOUD_ID;
|
|
159
|
+
meta: string;
|
|
160
|
+
status: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
declare type NCSErrors = HeadVersionUpdateFailedError | VersionAlreadyPresentInDynamoError | InsufficientEditingPermissionError | ForbiddenUserTokenError | NCSDocumentNotFoundError | FailedToLoadInitDataError | ErrorMappingError | InvalidNamespaceDefinedError | SocketNamespaceNotFoundError | TenantInstanceMaintenanceError | NamespaceLockedError | EmptyBroadcastError | DynamoError | InvalidActivationIdError | InvalidDocumentAriError | InvalidCloudIdError;
|
|
164
|
+
declare type DocumentRecoveryError = {
|
|
165
|
+
message: string;
|
|
166
|
+
data: {
|
|
167
|
+
code: INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR;
|
|
168
|
+
status: number;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
declare type AddStepsError = {
|
|
172
|
+
message: string;
|
|
173
|
+
data: {
|
|
174
|
+
code: INTERNAL_ERROR_CODE.ADD_STEPS_ERROR;
|
|
175
|
+
status: number;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
export declare type CatchUpFailedError = {
|
|
179
|
+
message: string;
|
|
180
|
+
data: {
|
|
181
|
+
code: INTERNAL_ERROR_CODE.CATCHUP_FAILED;
|
|
182
|
+
status: number;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export declare type TokenPermissionError = {
|
|
186
|
+
message: string;
|
|
187
|
+
data: {
|
|
188
|
+
code: INTERNAL_ERROR_CODE.TOKEN_PERMISSION_ERROR;
|
|
189
|
+
status: number;
|
|
190
|
+
meta: {
|
|
191
|
+
originalError?: unknown;
|
|
192
|
+
reason?: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
export declare type ReconnectionError = {
|
|
197
|
+
message: string;
|
|
198
|
+
data: {
|
|
199
|
+
code: INTERNAL_ERROR_CODE.RECONNECTION_ERROR;
|
|
200
|
+
status: number;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
export declare type ConnectionError = {
|
|
204
|
+
message: string;
|
|
205
|
+
data: {
|
|
206
|
+
code: INTERNAL_ERROR_CODE.CONNECTION_ERROR;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export declare type ReconnectionNetworkError = {
|
|
210
|
+
message: string;
|
|
211
|
+
data: {
|
|
212
|
+
code: INTERNAL_ERROR_CODE.RECONNECTION_NETWORK_ISSUE;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
export declare type DocumentNotFoundError = {
|
|
216
|
+
message: string;
|
|
217
|
+
data: {
|
|
218
|
+
code: INTERNAL_ERROR_CODE.DOCUMENT_NOT_FOUND;
|
|
219
|
+
status: number;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* A union of all possible internal errors, that are mapped to another error if being emitted to the editor.
|
|
224
|
+
*/
|
|
225
|
+
export declare type InternalError = NCSErrors | DocumentRecoveryError | AddStepsError | CatchUpFailedError | TokenPermissionError | ReconnectionError | ConnectionError | ReconnectionNetworkError | DocumentNotFoundError;
|
|
226
|
+
export declare enum PROVIDER_ERROR_CODE {
|
|
227
|
+
NO_PERMISSION_ERROR = "NO_PERMISSION_ERROR",
|
|
228
|
+
INVALID_USER_TOKEN = "INVALID_USER_TOKEN",
|
|
229
|
+
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
230
|
+
LOCKED = "LOCKED",
|
|
231
|
+
FAIL_TO_SAVE = "FAIL_TO_SAVE",
|
|
232
|
+
DOCUMENT_RESTORE_ERROR = "DOCUMENT_RESTORE_ERROR",
|
|
233
|
+
INITIALISATION_ERROR = "INITIALISATION_ERROR",
|
|
234
|
+
NETWORK_ISSUE = "NETWORK_ISSUE",
|
|
235
|
+
INVALID_PROVIDER_CONFIGURATION = "INVALID_PROVIDER_CONFIGURATION",
|
|
236
|
+
INTERNAL_SERVICE_ERROR = "INTERNAL_SERVICE_ERROR"
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* This occurs when the provided user token is considered invalid for the given document ARI.
|
|
240
|
+
* It happens during initialisation of the provider.
|
|
241
|
+
* It could mean the document has been deleted (hence not found).
|
|
242
|
+
* @message Message returned to editor, i.e User does not have permissions to access this document or document is not found
|
|
243
|
+
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
244
|
+
*/
|
|
245
|
+
declare type InsufficientEditingPermission = {
|
|
246
|
+
code: PROVIDER_ERROR_CODE.NO_PERMISSION_ERROR;
|
|
247
|
+
message: string;
|
|
248
|
+
recoverable: boolean;
|
|
249
|
+
reason?: string;
|
|
250
|
+
/**
|
|
251
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
252
|
+
*/
|
|
253
|
+
status?: number;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Similiar to InsufficientEditingPermission, but the user token is invalid because it has expired or been revoked.
|
|
257
|
+
* It may also be an invalid token format.
|
|
258
|
+
* This error is given to the provider by NCS.
|
|
259
|
+
* @message Message returned to editor, i.e. The user token was invalid
|
|
260
|
+
* @recoverable It is recoverable, as we will try to refresh the token.
|
|
261
|
+
*/
|
|
262
|
+
declare type InvalidUserToken = {
|
|
263
|
+
code: PROVIDER_ERROR_CODE.INVALID_USER_TOKEN;
|
|
264
|
+
message: string;
|
|
265
|
+
recoverable: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
268
|
+
*/
|
|
269
|
+
status?: number;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Document not found error, thrown when the provider is unable to find a document with the given ARI and user token.
|
|
273
|
+
* It occurs during fetchCatchup, a function that fetches the latest document state during catchup.
|
|
274
|
+
* We need to recieve a 404 from the document service to throw this error.
|
|
275
|
+
* @message Message returned to editor, i.e. The requested document is not found
|
|
276
|
+
* @recoverable It is recoverable, as the provider can try again later.
|
|
277
|
+
*/
|
|
278
|
+
declare type DocumentNotFound = {
|
|
279
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_NOT_FOUND;
|
|
280
|
+
message: string;
|
|
281
|
+
recoverable: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
284
|
+
*/
|
|
285
|
+
status?: number;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* This error is thrown when the document is locked by another user.
|
|
289
|
+
* The error is passed to us by NCS.
|
|
290
|
+
* @message Message returned to editor, i.e. The document is currently not available, please try again later
|
|
291
|
+
* @recoverable It is recoverable, as the provider can try again later.
|
|
292
|
+
*/
|
|
293
|
+
declare type Locked = {
|
|
294
|
+
code: PROVIDER_ERROR_CODE.LOCKED;
|
|
295
|
+
message: string;
|
|
296
|
+
recoverable: boolean;
|
|
297
|
+
status?: number;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* This error is thrown when the provider is unable to save the document.
|
|
301
|
+
* This can happen when the connection to dynamoDB is lost, or when we do not have sufficient permissions (DYNAMO ERROR).
|
|
302
|
+
* This error is given to us by NCS.
|
|
303
|
+
* @message Message returned to editor, i.e. Collab service is not able to save changes
|
|
304
|
+
* @recoverable It is not recoverable, as we don't want the user to continue editing a document that is not being saved.
|
|
305
|
+
*/
|
|
306
|
+
declare type FailToSave = {
|
|
307
|
+
code: PROVIDER_ERROR_CODE.FAIL_TO_SAVE;
|
|
308
|
+
message: string;
|
|
309
|
+
recoverable: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
312
|
+
*/
|
|
313
|
+
status?: number;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* This error is thrown when the provider is unable to restore the document.
|
|
317
|
+
* It occurs during onRestore, a function that restores the document to a previous version and reapplies unconfirmed steps.
|
|
318
|
+
* onRestore is called when page recovery has emitted an 'init' event on a page client is currently connected to.
|
|
319
|
+
* It could mean we failed to update the page metadata, or we failed to reapply unconfirmed steps.
|
|
320
|
+
* @message Message returned to editor, i.e. Collab service unable to restore document
|
|
321
|
+
* @recoverable It is not recoverable, as the provider has no further options after this.
|
|
322
|
+
* The user will need to refresh the page to try again.
|
|
323
|
+
*/
|
|
324
|
+
declare type DocumentNotRestore = {
|
|
325
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_RESTORE_ERROR;
|
|
326
|
+
message: string;
|
|
327
|
+
recoverable: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
330
|
+
*/
|
|
331
|
+
status?: number;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* The initial document couldn't be loaded from the collab service.
|
|
335
|
+
* This error is given to us by NCS.
|
|
336
|
+
* It could indicate either a network issue, or an internal service error in NCS.
|
|
337
|
+
* @message Message returned to editor, i.e. The initial document couldn't be loaded from the collab service
|
|
338
|
+
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
339
|
+
* The user will need to refresh the page to try again.
|
|
340
|
+
*/
|
|
341
|
+
declare type InitialisationError = {
|
|
342
|
+
code: PROVIDER_ERROR_CODE.INITIALISATION_ERROR;
|
|
343
|
+
message: string;
|
|
344
|
+
recoverable: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
347
|
+
*/
|
|
348
|
+
status?: number;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Couldn't reconnect to the collab service (NCS) due to network issues.
|
|
352
|
+
* 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.
|
|
353
|
+
* Fired upon a reconnection attempt error (from Socket.IO Manager)
|
|
354
|
+
* @message Message returned to editor, i.e. Couldn't reconnect to the collab service due to network issues
|
|
355
|
+
* @recoverable It is recoverable, as the provider will try to reconnect.
|
|
356
|
+
*/
|
|
357
|
+
declare type NetworkIssue = {
|
|
358
|
+
code: PROVIDER_ERROR_CODE.NETWORK_ISSUE;
|
|
359
|
+
message: string;
|
|
360
|
+
recoverable: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
363
|
+
*/
|
|
364
|
+
status?: number;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* This error is thrown when the provider has an invalid configuration.
|
|
368
|
+
* It could happen due to these errors from NCS:
|
|
369
|
+
* NAMESPACE_INVALID
|
|
370
|
+
INVALID_ACTIVATION_ID
|
|
371
|
+
INVALID_DOCUMENT_ARI
|
|
372
|
+
INVALID_CLOUD_ID
|
|
373
|
+
* @message Message returned to editor, i.e. Invalid provider configuration
|
|
374
|
+
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
375
|
+
* The service using the provider will need to fix the configuration.
|
|
376
|
+
*/
|
|
377
|
+
declare type InvalidProviderConfiguration = {
|
|
378
|
+
code: PROVIDER_ERROR_CODE.INVALID_PROVIDER_CONFIGURATION;
|
|
379
|
+
message: string;
|
|
380
|
+
recoverable: boolean;
|
|
381
|
+
reason: string;
|
|
382
|
+
/**
|
|
383
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
384
|
+
*/
|
|
385
|
+
status?: number;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* This error is thrown when the provider encounters an internal service error, not otherwise accounted for.
|
|
389
|
+
* @message Message returned to editor, i.e. Collab Provider experienced an unrecoverable error
|
|
390
|
+
* @recoverable It is not recoverable, as the provider cannot do anything to fix it.
|
|
391
|
+
*/
|
|
392
|
+
declare type InternalServiceError = {
|
|
393
|
+
code: PROVIDER_ERROR_CODE.INTERNAL_SERVICE_ERROR;
|
|
394
|
+
message: string;
|
|
395
|
+
recoverable: boolean;
|
|
396
|
+
reason: string;
|
|
397
|
+
/**
|
|
398
|
+
* @deprecated switch to using either the error code or the recoverable flag
|
|
399
|
+
*/
|
|
400
|
+
status?: number;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* A union of all possible provider errors that can be emitted back to the editor.
|
|
404
|
+
*/
|
|
405
|
+
export declare type ProviderError = InsufficientEditingPermission | InvalidUserToken | DocumentNotFound | Locked | FailToSave | DocumentNotRestore | InitialisationError | NetworkIssue | InvalidProviderConfiguration | InternalServiceError;
|
|
406
|
+
declare class CustomError extends Error {
|
|
407
|
+
constructor(message: string, error?: unknown);
|
|
408
|
+
toJSON(): {
|
|
409
|
+
name: string;
|
|
410
|
+
message: string;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
export declare class NotConnectedError extends CustomError {
|
|
414
|
+
name: string;
|
|
415
|
+
}
|
|
416
|
+
export declare class NotInitializedError extends CustomError {
|
|
417
|
+
name: string;
|
|
418
|
+
}
|
|
419
|
+
export declare class ProviderInitialisationError extends CustomError {
|
|
420
|
+
name: string;
|
|
421
|
+
}
|
|
422
|
+
export declare class SendTransactionError extends CustomError {
|
|
423
|
+
name: string;
|
|
424
|
+
}
|
|
425
|
+
export declare class DestroyError extends CustomError {
|
|
426
|
+
name: string;
|
|
427
|
+
}
|
|
428
|
+
export declare class SetTitleError extends CustomError {
|
|
429
|
+
name: string;
|
|
430
|
+
}
|
|
431
|
+
export declare class SetEditorWidthError extends CustomError {
|
|
432
|
+
name: string;
|
|
433
|
+
}
|
|
434
|
+
export declare class SetMetadataError extends CustomError {
|
|
435
|
+
name: string;
|
|
436
|
+
}
|
|
437
|
+
export declare class GetCurrentStateError extends CustomError {
|
|
438
|
+
name: string;
|
|
439
|
+
}
|
|
440
|
+
export declare class GetFinalAcknowledgedStateError extends CustomError {
|
|
441
|
+
name: string;
|
|
442
|
+
}
|
|
443
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NCSFeatureFlags, RequiredNCSFeatureFlags, SupportedProduct } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Takes a record of {NCS Feature Flag Names → boolean} and a supported product name.
|
|
4
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
5
|
+
* */
|
|
6
|
+
export declare const getProductSpecificFeatureFlags: (flags: RequiredNCSFeatureFlags, product: SupportedProduct) => Array<string>;
|
|
7
|
+
export declare function getCollabProviderFeatureFlag<T = boolean>(flagName: keyof NCSFeatureFlags, featureFlags?: {
|
|
8
|
+
[key: string]: boolean;
|
|
9
|
+
}): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface NCSFeatureFlags {
|
|
2
|
+
testFF?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface WithNCSFeatureFlags {
|
|
5
|
+
featureFlags?: NCSFeatureFlags;
|
|
6
|
+
}
|
|
7
|
+
export declare type RequiredNCSFeatureFlags = Record<keyof Required<NCSFeatureFlags>, boolean>;
|
|
8
|
+
export declare type NCSFeatureFlagsMap = Record<keyof Required<NCSFeatureFlags>, string>;
|
|
9
|
+
export declare const supportedProducts: readonly [
|
|
10
|
+
"confluence"
|
|
11
|
+
];
|
|
12
|
+
export declare type SupportedProduct = (typeof supportedProducts)[number];
|
|
13
|
+
export declare type ProductKeys = Record<SupportedProduct, NCSFeatureFlagsMap>;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { ProviderError } from '../errors/error-types';
|
|
2
|
+
export declare enum EVENT_ACTION {
|
|
3
|
+
CONNECTION = "connection",
|
|
4
|
+
CATCHUP = "catchup",
|
|
5
|
+
DOCUMENT_INIT = "documentInit",
|
|
6
|
+
ADD_STEPS = "addSteps",
|
|
7
|
+
UPDATE_PARTICIPANTS = "updateParticipants",
|
|
8
|
+
COMMIT_UNCONFIRMED_STEPS = "commitUnconfirmedSteps",
|
|
9
|
+
REINITIALISE_DOCUMENT = "reinitialiseDocument",
|
|
10
|
+
ERROR = "error",
|
|
11
|
+
PUBLISH_PAGE = "publishPage",
|
|
12
|
+
GET_CURRENT_STATE = "getCurrentState",
|
|
13
|
+
INVALIDATE_TOKEN = "invalidateToken"
|
|
14
|
+
}
|
|
15
|
+
export declare enum EVENT_STATUS {
|
|
16
|
+
SUCCESS = "SUCCESS",
|
|
17
|
+
FAILURE = "FAILURE"
|
|
18
|
+
}
|
|
19
|
+
export declare enum ADD_STEPS_TYPE {
|
|
20
|
+
ACCEPTED = "ACCEPTED",
|
|
21
|
+
REJECTED = "REJECTED",
|
|
22
|
+
ERROR = "ERROR"
|
|
23
|
+
}
|
|
24
|
+
export declare type ErrorAnalyticsEvent = {
|
|
25
|
+
eventAction: EVENT_ACTION.ERROR;
|
|
26
|
+
attributes: {
|
|
27
|
+
errorMessage: string;
|
|
28
|
+
errorName?: string;
|
|
29
|
+
documentAri?: string;
|
|
30
|
+
mappedError?: ProviderError;
|
|
31
|
+
};
|
|
32
|
+
nonPrivacySafeAttributes: {
|
|
33
|
+
error: unknown;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare type InvalidateTokenAnalyticsEvent = {
|
|
37
|
+
eventAction: EVENT_ACTION.INVALIDATE_TOKEN;
|
|
38
|
+
attributes: {
|
|
39
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
40
|
+
reason?: string;
|
|
41
|
+
usedCachedToken?: boolean;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
declare type AddStepsSuccessAnalyticsEvent = {
|
|
45
|
+
eventAction: EVENT_ACTION.ADD_STEPS;
|
|
46
|
+
attributes: {
|
|
47
|
+
documentAri: string;
|
|
48
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
49
|
+
type: ADD_STEPS_TYPE.ACCEPTED;
|
|
50
|
+
latency?: number;
|
|
51
|
+
stepType?: {
|
|
52
|
+
[key: string]: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
declare type AddStepsFailureAnalyticsEvent = {
|
|
57
|
+
eventAction: EVENT_ACTION.ADD_STEPS;
|
|
58
|
+
attributes: {
|
|
59
|
+
documentAri: string;
|
|
60
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
61
|
+
type: ADD_STEPS_TYPE.REJECTED | ADD_STEPS_TYPE.ERROR;
|
|
62
|
+
latency?: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
declare type ReInitDocFailAnalyticsEvent = {
|
|
66
|
+
eventAction: EVENT_ACTION.REINITIALISE_DOCUMENT;
|
|
67
|
+
attributes: {
|
|
68
|
+
documentAri: string;
|
|
69
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
70
|
+
numUnconfirmedSteps: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
declare type ReInitDocSuccessAnalyticsEvent = {
|
|
74
|
+
eventAction: EVENT_ACTION.REINITIALISE_DOCUMENT;
|
|
75
|
+
attributes: {
|
|
76
|
+
documentAri: string;
|
|
77
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
78
|
+
numUnconfirmedSteps: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
declare type ConnectionSuccessAnalyticsEvent = {
|
|
82
|
+
eventAction: EVENT_ACTION.CONNECTION;
|
|
83
|
+
attributes: {
|
|
84
|
+
documentAri: string;
|
|
85
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
86
|
+
latency?: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
declare type ConnectionFailureAnalyticsEvent = {
|
|
90
|
+
eventAction: EVENT_ACTION.CONNECTION;
|
|
91
|
+
attributes: {
|
|
92
|
+
documentAri: string;
|
|
93
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
94
|
+
latency?: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
declare type CatchUpSuccessAnalyticsEvent = {
|
|
98
|
+
eventAction: EVENT_ACTION.CATCHUP;
|
|
99
|
+
attributes: {
|
|
100
|
+
documentAri: string;
|
|
101
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
102
|
+
latency?: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
declare type CatchUpFailureAnalyticsEvent = {
|
|
106
|
+
eventAction: EVENT_ACTION.CATCHUP;
|
|
107
|
+
attributes: {
|
|
108
|
+
documentAri: string;
|
|
109
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
110
|
+
latency?: number;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
declare type DocumentInitSuccessAnalyticsEvent = {
|
|
114
|
+
eventAction: EVENT_ACTION.DOCUMENT_INIT;
|
|
115
|
+
attributes: {
|
|
116
|
+
documentAri: string;
|
|
117
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
118
|
+
latency?: number;
|
|
119
|
+
resetReason?: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
declare type UpdateParticipantsSuccessAnalyticsEvent = {
|
|
123
|
+
eventAction: EVENT_ACTION.UPDATE_PARTICIPANTS;
|
|
124
|
+
attributes: {
|
|
125
|
+
documentAri?: string;
|
|
126
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
127
|
+
participants: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
declare type CommitUnconfirmedStepsSuccessAnalyticsEvent = {
|
|
131
|
+
eventAction: EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS;
|
|
132
|
+
attributes: {
|
|
133
|
+
documentAri: string;
|
|
134
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
135
|
+
latency?: number;
|
|
136
|
+
numUnconfirmedSteps?: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
declare type CommitUnconfirmedStepsFailureAnalyticsEvent = {
|
|
140
|
+
eventAction: EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS;
|
|
141
|
+
attributes: {
|
|
142
|
+
documentAri: string;
|
|
143
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
144
|
+
latency?: number;
|
|
145
|
+
numUnconfirmedSteps?: number;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
declare type PublishPageSuccessAnalyticsEvent = {
|
|
149
|
+
eventAction: EVENT_ACTION.PUBLISH_PAGE;
|
|
150
|
+
attributes: {
|
|
151
|
+
documentAri: string;
|
|
152
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
153
|
+
latency?: number;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
declare type PublishPageFailureAnalyticsEvent = {
|
|
157
|
+
eventAction: EVENT_ACTION.PUBLISH_PAGE;
|
|
158
|
+
attributes: {
|
|
159
|
+
documentAri: string;
|
|
160
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
161
|
+
latency?: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
declare type GetCurrentStateSuccessAnalyticsEvent = {
|
|
165
|
+
eventAction: EVENT_ACTION.GET_CURRENT_STATE;
|
|
166
|
+
attributes: {
|
|
167
|
+
documentAri: string;
|
|
168
|
+
eventStatus: EVENT_STATUS.SUCCESS;
|
|
169
|
+
latency?: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
declare type GetCurrentStateFailureAnalyticsEvent = {
|
|
173
|
+
eventAction: EVENT_ACTION.GET_CURRENT_STATE;
|
|
174
|
+
attributes: {
|
|
175
|
+
documentAri: string;
|
|
176
|
+
eventStatus: EVENT_STATUS.FAILURE;
|
|
177
|
+
latency?: number;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export declare type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent;
|
|
181
|
+
export declare const ACK_MAX_TRY = 30;
|
|
182
|
+
export declare const CONFLUENCE = "confluence";
|
|
183
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProductInformation } from '../types';
|
|
2
|
+
export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
|
|
3
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
4
|
+
export declare const getProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
5
|
+
export declare const getSubProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Provider } from './provider';
|
|
2
|
+
export type { CollabConnectedPayload, CollabDisconnectedPayload, CollabErrorPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabEvents, CollabSendableSelection, CollabEditProvider, Socket, } from './types';
|
|
3
|
+
export type { ProviderError } from './errors/error-types';
|
|
4
|
+
export { PROVIDER_ERROR_CODE } from './errors/error-types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Metadata, CollabEvents } from '../types';
|
|
2
|
+
export declare class MetadataService {
|
|
3
|
+
private providerEmitCallback;
|
|
4
|
+
private broadcastMetadata;
|
|
5
|
+
private metadata;
|
|
6
|
+
constructor(providerEmitCallback: (evt: keyof CollabEvents, data: any) => void, broadcastMetadata: (metadata: Metadata) => void);
|
|
7
|
+
getMetaData: () => Metadata;
|
|
8
|
+
getTitle: () => string;
|
|
9
|
+
/**
|
|
10
|
+
* Called when a metadata is changed externally from other clients/backend.
|
|
11
|
+
*/
|
|
12
|
+
onMetadataChanged: (metadata?: Metadata | undefined) => void;
|
|
13
|
+
setTitle(title: string, broadcast?: boolean): void;
|
|
14
|
+
setEditorWidth(editorWidth: string, broadcast?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Updates the local metadata and broadcasts the metadata to other clients/backend.
|
|
17
|
+
* @param metadata
|
|
18
|
+
*/
|
|
19
|
+
setMetadata: (metadata: Metadata) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Emits a change in document's metadata
|
|
22
|
+
* @param metadata
|
|
23
|
+
*/
|
|
24
|
+
updateMetadata: (metadata: Metadata | undefined) => void;
|
|
25
|
+
}
|