@atlaskit/collab-provider 8.3.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/dist/cjs/analytics/{index.js → analytics-helper.js} +45 -5
- package/dist/cjs/analytics/performance.js +7 -5
- package/dist/cjs/channel.js +318 -210
- package/dist/cjs/{provider → document}/catchup.js +2 -2
- package/dist/cjs/document/document-service.js +617 -0
- package/dist/cjs/document/step-queue-state.js +51 -0
- package/dist/cjs/errors/error-code-mapper.js +107 -0
- package/dist/cjs/errors/error-types.js +273 -0
- package/dist/cjs/helpers/const.js +2 -4
- package/dist/cjs/helpers/utils.js +1 -12
- package/dist/cjs/participants/participants-helper.js +51 -0
- package/dist/cjs/participants/participants-service.js +217 -0
- package/dist/cjs/participants/participants-state.js +53 -0
- package/dist/cjs/{provider/telepointers.js → participants/telepointers-helper.js} +6 -6
- package/dist/cjs/provider/commit-step.js +40 -36
- package/dist/cjs/provider/index.js +215 -762
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/{index.js → analytics-helper.js} +17 -5
- package/dist/es2019/analytics/performance.js +6 -6
- package/dist/es2019/channel.js +204 -129
- package/dist/es2019/{provider → document}/catchup.js +2 -2
- package/dist/es2019/document/document-service.js +495 -0
- package/dist/es2019/document/step-queue-state.js +30 -0
- package/dist/es2019/errors/error-code-mapper.js +102 -0
- package/dist/es2019/errors/error-types.js +151 -0
- package/dist/es2019/helpers/const.js +2 -4
- package/dist/es2019/helpers/utils.js +0 -10
- package/dist/es2019/participants/participants-helper.js +25 -0
- package/dist/es2019/participants/participants-service.js +166 -0
- package/dist/es2019/participants/participants-state.js +28 -0
- package/dist/es2019/{provider/telepointers.js → participants/telepointers-helper.js} +2 -2
- package/dist/es2019/provider/commit-step.js +38 -34
- package/dist/es2019/provider/index.js +163 -626
- package/dist/es2019/types.js +4 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/{index.js → analytics-helper.js} +45 -5
- package/dist/esm/analytics/performance.js +6 -6
- package/dist/esm/channel.js +318 -210
- package/dist/esm/{provider → document}/catchup.js +2 -2
- package/dist/esm/document/document-service.js +609 -0
- package/dist/esm/document/step-queue-state.js +43 -0
- package/dist/esm/errors/error-code-mapper.js +102 -0
- package/dist/esm/errors/error-types.js +259 -0
- package/dist/esm/helpers/const.js +2 -4
- package/dist/esm/helpers/utils.js +0 -10
- package/dist/esm/participants/participants-helper.js +43 -0
- package/dist/esm/participants/participants-service.js +209 -0
- package/dist/esm/participants/participants-state.js +45 -0
- package/dist/esm/{provider/telepointers.js → participants/telepointers-helper.js} +4 -4
- package/dist/esm/provider/commit-step.js +40 -36
- package/dist/esm/provider/index.js +214 -762
- package/dist/esm/types.js +4 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/{index.d.ts → analytics-helper.d.ts} +3 -1
- package/dist/types/analytics/performance.d.ts +5 -2
- package/dist/types/analytics/ufo.d.ts +1 -1
- package/dist/types/channel.d.ts +17 -5
- package/dist/types/document/document-service.d.ts +105 -0
- package/dist/types/document/step-queue-state.d.ts +16 -0
- package/dist/types/errors/error-code-mapper.d.ts +2 -0
- package/dist/types/errors/error-types.d.ts +443 -0
- package/dist/types/helpers/const.d.ts +31 -8
- package/dist/types/helpers/utils.d.ts +0 -6
- package/dist/types/index.d.ts +2 -1
- package/dist/types/participants/participants-helper.d.ts +15 -0
- package/dist/types/participants/participants-service.d.ts +70 -0
- package/dist/types/participants/participants-state.d.ts +13 -0
- package/dist/types/participants/telepointers-helper.d.ts +4 -0
- package/dist/types/provider/commit-step.d.ts +6 -6
- package/dist/types/provider/index.d.ts +86 -65
- package/dist/types/socket-io-provider.d.ts +2 -2
- package/dist/types/types.d.ts +65 -33
- package/package.json +4 -4
- package/report.api.md +193 -23
- package/dist/cjs/error-code-mapper.js +0 -88
- package/dist/es2019/error-code-mapper.js +0 -78
- package/dist/esm/error-code-mapper.js +0 -79
- package/dist/types/error-code-mapper.d.ts +0 -36
- package/dist/types/provider/telepointers.d.ts +0 -5
- package/error-code-mapper/package.json +0 -15
- /package/dist/types/{provider → document}/catchup.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/analytics-gas-types": "^5.0.10",
|
|
25
25
|
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
26
|
-
"@atlaskit/editor-common": "^72.
|
|
26
|
+
"@atlaskit/editor-common": "^72.7.0",
|
|
27
27
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
28
28
|
"@atlaskit/prosemirror-collab": "^0.1.0",
|
|
29
29
|
"@atlaskit/ufo": "^0.1.4",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@atlaskit/adf-schema": "^25.
|
|
52
|
+
"@atlaskit/adf-schema": "^25.4.0",
|
|
53
53
|
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
54
|
-
"@atlaskit/editor-test-helpers": "^18.
|
|
54
|
+
"@atlaskit/editor-test-helpers": "^18.2.0",
|
|
55
55
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
56
56
|
"@types/prosemirror-model": "^1.11.0",
|
|
57
57
|
"@types/prosemirror-state": "^1.2.0",
|
package/report.api.md
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
<!--SECTION START: Main Entry Types-->
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
+
/// <reference types="lodash" />
|
|
19
|
+
|
|
18
20
|
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
19
|
-
import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
|
|
20
21
|
import type { CollabEventConnectingData } from '@atlaskit/editor-common/collab';
|
|
21
22
|
import type { CollabEventConnectionData } from '@atlaskit/editor-common/collab';
|
|
22
23
|
import type { CollabEventInitData } from '@atlaskit/editor-common/collab';
|
|
23
24
|
import type { CollabEventPresenceData } from '@atlaskit/editor-common/collab';
|
|
24
25
|
import type { CollabEventRemoteData } from '@atlaskit/editor-common/collab';
|
|
25
|
-
import type { CollabEventTelepointerData } from '@atlaskit/editor-common/collab';
|
|
26
26
|
import type { CollabParticipant } from '@atlaskit/editor-common/collab';
|
|
27
27
|
import type { EditorState } from 'prosemirror-state';
|
|
28
28
|
import type { Manager } from 'socket.io-client';
|
|
@@ -31,6 +31,9 @@ import type { Step } from 'prosemirror-transform';
|
|
|
31
31
|
import type { SyncUpErrorFunction } from '@atlaskit/editor-common/types';
|
|
32
32
|
import type { Transaction } from 'prosemirror-state';
|
|
33
33
|
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
type AuthCallback = (cb: (data: InitAndAuthData) => void) => void;
|
|
36
|
+
|
|
34
37
|
// @public (undocumented)
|
|
35
38
|
type BaseEvents = Pick<
|
|
36
39
|
CollabEditProvider<CollabEvents>,
|
|
@@ -62,17 +65,37 @@ export interface CollabDisconnectedPayload {
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
// @public (undocumented)
|
|
65
|
-
export interface
|
|
68
|
+
export interface CollabEditProvider<
|
|
69
|
+
Events extends CollabEvents = CollabEvents,
|
|
70
|
+
> {
|
|
66
71
|
// (undocumented)
|
|
67
|
-
|
|
72
|
+
getFinalAcknowledgedState(): Promise<ResolvedEditorState>;
|
|
68
73
|
// (undocumented)
|
|
69
|
-
|
|
74
|
+
initialize(getState: () => any, createStep: (json: object) => Step): this;
|
|
70
75
|
// (undocumented)
|
|
71
|
-
|
|
76
|
+
off(evt: keyof Events, handler: (...args: any) => void): this;
|
|
77
|
+
// (undocumented)
|
|
78
|
+
on(evt: keyof Events, handler: (...args: any) => void): this;
|
|
79
|
+
// (undocumented)
|
|
80
|
+
send(tr: Transaction, oldState: EditorState, newState: EditorState): void;
|
|
81
|
+
// (undocumented)
|
|
82
|
+
sendMessage<K extends keyof Events>(
|
|
83
|
+
data: {
|
|
84
|
+
type: K;
|
|
85
|
+
} & Events[K],
|
|
86
|
+
): void;
|
|
87
|
+
// (undocumented)
|
|
88
|
+
setup(props: {
|
|
89
|
+
getState: () => EditorState;
|
|
90
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
91
|
+
}): this;
|
|
72
92
|
// (undocumented)
|
|
73
|
-
|
|
93
|
+
unsubscribeAll(evt: keyof Events): this;
|
|
74
94
|
}
|
|
75
95
|
|
|
96
|
+
// @public @deprecated (undocumented)
|
|
97
|
+
export type CollabErrorPayload = ProviderError;
|
|
98
|
+
|
|
76
99
|
// @public (undocumented)
|
|
77
100
|
export interface CollabEvents {
|
|
78
101
|
// (undocumented)
|
|
@@ -99,6 +122,16 @@ export interface CollabEvents {
|
|
|
99
122
|
telepointer: CollabTelepointerPayload;
|
|
100
123
|
}
|
|
101
124
|
|
|
125
|
+
// @public (undocumented)
|
|
126
|
+
interface CollabEventTelepointerData {
|
|
127
|
+
// (undocumented)
|
|
128
|
+
selection: CollabSendableSelection;
|
|
129
|
+
// (undocumented)
|
|
130
|
+
sessionId: string;
|
|
131
|
+
// (undocumented)
|
|
132
|
+
type: 'telepointer';
|
|
133
|
+
}
|
|
134
|
+
|
|
102
135
|
// @public (undocumented)
|
|
103
136
|
export interface CollabInitPayload extends CollabEventInitData {
|
|
104
137
|
// (undocumented)
|
|
@@ -108,8 +141,6 @@ export interface CollabInitPayload extends CollabEventInitData {
|
|
|
108
141
|
// (undocumented)
|
|
109
142
|
reserveCursor?: boolean;
|
|
110
143
|
// (undocumented)
|
|
111
|
-
userId?: string;
|
|
112
|
-
// (undocumented)
|
|
113
144
|
version: number;
|
|
114
145
|
}
|
|
115
146
|
|
|
@@ -124,17 +155,28 @@ export type CollabMetadataPayload = Metadata_2;
|
|
|
124
155
|
// @public (undocumented)
|
|
125
156
|
export type CollabPresencePayload = CollabEventPresenceData;
|
|
126
157
|
|
|
158
|
+
// @public (undocumented)
|
|
159
|
+
export interface CollabSendableSelection {
|
|
160
|
+
// (undocumented)
|
|
161
|
+
anchor?: number | string;
|
|
162
|
+
// (undocumented)
|
|
163
|
+
head?: number | string;
|
|
164
|
+
// (undocumented)
|
|
165
|
+
type: 'nodeSelection' | 'textSelection';
|
|
166
|
+
}
|
|
167
|
+
|
|
127
168
|
// @public (undocumented)
|
|
128
169
|
export type CollabTelepointerPayload = CollabEventTelepointerData;
|
|
129
170
|
|
|
130
171
|
// @public (undocumented)
|
|
131
172
|
interface Config {
|
|
132
|
-
// (undocumented)
|
|
133
173
|
analyticsClient?: AnalyticsWebClient;
|
|
134
174
|
// (undocumented)
|
|
175
|
+
cacheToken?: boolean;
|
|
176
|
+
// (undocumented)
|
|
135
177
|
createSocket: (
|
|
136
178
|
path: string,
|
|
137
|
-
auth?:
|
|
179
|
+
auth?: AuthCallback | InitAndAuthData,
|
|
138
180
|
productInfo?: ProductInformation,
|
|
139
181
|
) => Socket;
|
|
140
182
|
// (undocumented)
|
|
@@ -144,6 +186,8 @@ interface Config {
|
|
|
144
186
|
[key: string]: boolean;
|
|
145
187
|
};
|
|
146
188
|
// (undocumented)
|
|
189
|
+
getAnalyticsWebClient?: Promise<AnalyticsWebClient>;
|
|
190
|
+
// (undocumented)
|
|
147
191
|
getUser?(userId: string): Promise<
|
|
148
192
|
Pick<CollabParticipant, 'avatar' | 'email' | 'name'> & {
|
|
149
193
|
userId: string;
|
|
@@ -153,12 +197,12 @@ interface Config {
|
|
|
153
197
|
lifecycle?: Lifecycle;
|
|
154
198
|
// (undocumented)
|
|
155
199
|
need404?: boolean;
|
|
156
|
-
// (undocumented)
|
|
157
200
|
permissionTokenRefresh?: () => Promise<null | string>;
|
|
158
201
|
// (undocumented)
|
|
159
202
|
productInfo?: ProductInformation;
|
|
160
203
|
// (undocumented)
|
|
161
204
|
storage?: Storage_2;
|
|
205
|
+
throwOnNotConnected?: boolean;
|
|
162
206
|
// (undocumented)
|
|
163
207
|
url: string;
|
|
164
208
|
}
|
|
@@ -179,6 +223,22 @@ enum DisconnectReason {
|
|
|
179
223
|
UNKNOWN_DISCONNECT = 'UNKNOWN_DISCONNECT',
|
|
180
224
|
}
|
|
181
225
|
|
|
226
|
+
// @public
|
|
227
|
+
type DocumentNotFound = {
|
|
228
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_NOT_FOUND;
|
|
229
|
+
message: string;
|
|
230
|
+
recoverable: boolean;
|
|
231
|
+
status?: number;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// @public
|
|
235
|
+
type DocumentNotRestore = {
|
|
236
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_RESTORE_ERROR;
|
|
237
|
+
message: string;
|
|
238
|
+
recoverable: boolean;
|
|
239
|
+
status?: number;
|
|
240
|
+
};
|
|
241
|
+
|
|
182
242
|
// @public (undocumented)
|
|
183
243
|
class Emitter<T = any> {
|
|
184
244
|
protected emit<K extends keyof T>(evt: K, data: T[K]): this;
|
|
@@ -190,6 +250,67 @@ class Emitter<T = any> {
|
|
|
190
250
|
// @public (undocumented)
|
|
191
251
|
type EventHandler = () => void;
|
|
192
252
|
|
|
253
|
+
// @public
|
|
254
|
+
type FailToSave = {
|
|
255
|
+
code: PROVIDER_ERROR_CODE.FAIL_TO_SAVE;
|
|
256
|
+
message: string;
|
|
257
|
+
recoverable: boolean;
|
|
258
|
+
status?: number;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// @public (undocumented)
|
|
262
|
+
interface InitAndAuthData {
|
|
263
|
+
// (undocumented)
|
|
264
|
+
initialized: boolean;
|
|
265
|
+
// (undocumented)
|
|
266
|
+
need404?: boolean;
|
|
267
|
+
// (undocumented)
|
|
268
|
+
token?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// @public
|
|
272
|
+
type InitialisationError = {
|
|
273
|
+
code: PROVIDER_ERROR_CODE.INITIALISATION_ERROR;
|
|
274
|
+
message: string;
|
|
275
|
+
recoverable: boolean;
|
|
276
|
+
status?: number;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// @public
|
|
280
|
+
type InsufficientEditingPermission = {
|
|
281
|
+
code: PROVIDER_ERROR_CODE.NO_PERMISSION_ERROR;
|
|
282
|
+
message: string;
|
|
283
|
+
recoverable: boolean;
|
|
284
|
+
reason?: string;
|
|
285
|
+
status?: number;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// @public
|
|
289
|
+
type InternalServiceError = {
|
|
290
|
+
code: PROVIDER_ERROR_CODE.INTERNAL_SERVICE_ERROR;
|
|
291
|
+
message: string;
|
|
292
|
+
recoverable: boolean;
|
|
293
|
+
reason: string;
|
|
294
|
+
status?: number;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// @public
|
|
298
|
+
type InvalidProviderConfiguration = {
|
|
299
|
+
code: PROVIDER_ERROR_CODE.INVALID_PROVIDER_CONFIGURATION;
|
|
300
|
+
message: string;
|
|
301
|
+
recoverable: boolean;
|
|
302
|
+
reason: string;
|
|
303
|
+
status?: number;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// @public
|
|
307
|
+
type InvalidUserToken = {
|
|
308
|
+
code: PROVIDER_ERROR_CODE.INVALID_USER_TOKEN;
|
|
309
|
+
message: string;
|
|
310
|
+
recoverable: boolean;
|
|
311
|
+
status?: number;
|
|
312
|
+
};
|
|
313
|
+
|
|
193
314
|
// @public (undocumented)
|
|
194
315
|
interface Lifecycle {
|
|
195
316
|
// (undocumented)
|
|
@@ -199,6 +320,14 @@ interface Lifecycle {
|
|
|
199
320
|
// @public (undocumented)
|
|
200
321
|
type LifecycleEvents = 'restore' | 'save';
|
|
201
322
|
|
|
323
|
+
// @public
|
|
324
|
+
type Locked = {
|
|
325
|
+
code: PROVIDER_ERROR_CODE.LOCKED;
|
|
326
|
+
message: string;
|
|
327
|
+
recoverable: boolean;
|
|
328
|
+
status?: number;
|
|
329
|
+
};
|
|
330
|
+
|
|
202
331
|
// @public (undocumented)
|
|
203
332
|
type MarkJson = {
|
|
204
333
|
type: string;
|
|
@@ -213,6 +342,14 @@ interface Metadata_2 {
|
|
|
213
342
|
[key: string]: boolean | number | string;
|
|
214
343
|
}
|
|
215
344
|
|
|
345
|
+
// @public
|
|
346
|
+
type NetworkIssue = {
|
|
347
|
+
code: PROVIDER_ERROR_CODE.NETWORK_ISSUE;
|
|
348
|
+
message: string;
|
|
349
|
+
recoverable: boolean;
|
|
350
|
+
status?: number;
|
|
351
|
+
};
|
|
352
|
+
|
|
216
353
|
// @public (undocumented)
|
|
217
354
|
type NodeJson = {
|
|
218
355
|
type: string;
|
|
@@ -233,28 +370,23 @@ type ProductInformation = {
|
|
|
233
370
|
// @public (undocumented)
|
|
234
371
|
export class Provider extends Emitter<CollabEvents> implements BaseEvents {
|
|
235
372
|
constructor(config: Config);
|
|
236
|
-
// (undocumented)
|
|
237
373
|
destroy(): this;
|
|
238
|
-
//
|
|
374
|
+
// @deprecated
|
|
239
375
|
disconnect(): this;
|
|
240
|
-
// (undocumented)
|
|
241
376
|
getCurrentState: () => Promise<ResolvedEditorState>;
|
|
242
|
-
// (undocumented)
|
|
243
377
|
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
378
|
+
// @deprecated
|
|
244
379
|
initialize(getState: () => EditorState): this;
|
|
245
380
|
send(
|
|
246
381
|
_tr: Transaction | null,
|
|
247
382
|
_oldState: EditorState | null,
|
|
248
383
|
newState: EditorState,
|
|
249
384
|
): void;
|
|
250
|
-
sendMessage(data:
|
|
251
|
-
//
|
|
385
|
+
sendMessage(data: CollabEventTelepointerData): void;
|
|
386
|
+
// @deprecated
|
|
252
387
|
setEditorWidth(editorWidth: string, broadcast?: boolean): void;
|
|
253
|
-
// (undocumented)
|
|
254
388
|
setMetadata(metadata: Metadata_2): void;
|
|
255
|
-
// (undocumented)
|
|
256
389
|
setTitle(title: string, broadcast?: boolean): void;
|
|
257
|
-
// (undocumented)
|
|
258
390
|
setup({
|
|
259
391
|
getState,
|
|
260
392
|
onSyncUpError,
|
|
@@ -262,9 +394,47 @@ export class Provider extends Emitter<CollabEvents> implements BaseEvents {
|
|
|
262
394
|
getState: () => EditorState;
|
|
263
395
|
onSyncUpError?: SyncUpErrorFunction;
|
|
264
396
|
}): this;
|
|
397
|
+
// @deprecated
|
|
265
398
|
unsubscribeAll(): this;
|
|
266
399
|
}
|
|
267
400
|
|
|
401
|
+
// @public (undocumented)
|
|
402
|
+
export enum PROVIDER_ERROR_CODE {
|
|
403
|
+
// (undocumented)
|
|
404
|
+
DOCUMENT_NOT_FOUND = 'DOCUMENT_NOT_FOUND',
|
|
405
|
+
// (undocumented)
|
|
406
|
+
DOCUMENT_RESTORE_ERROR = 'DOCUMENT_RESTORE_ERROR',
|
|
407
|
+
// (undocumented)
|
|
408
|
+
FAIL_TO_SAVE = 'FAIL_TO_SAVE',
|
|
409
|
+
// (undocumented)
|
|
410
|
+
INITIALISATION_ERROR = 'INITIALISATION_ERROR',
|
|
411
|
+
// (undocumented)
|
|
412
|
+
INTERNAL_SERVICE_ERROR = 'INTERNAL_SERVICE_ERROR',
|
|
413
|
+
// (undocumented)
|
|
414
|
+
INVALID_PROVIDER_CONFIGURATION = 'INVALID_PROVIDER_CONFIGURATION',
|
|
415
|
+
// (undocumented)
|
|
416
|
+
INVALID_USER_TOKEN = 'INVALID_USER_TOKEN',
|
|
417
|
+
// (undocumented)
|
|
418
|
+
LOCKED = 'LOCKED',
|
|
419
|
+
// (undocumented)
|
|
420
|
+
NETWORK_ISSUE = 'NETWORK_ISSUE',
|
|
421
|
+
// (undocumented)
|
|
422
|
+
NO_PERMISSION_ERROR = 'NO_PERMISSION_ERROR',
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// @public
|
|
426
|
+
export type ProviderError =
|
|
427
|
+
| DocumentNotFound
|
|
428
|
+
| DocumentNotRestore
|
|
429
|
+
| FailToSave
|
|
430
|
+
| InitialisationError
|
|
431
|
+
| InsufficientEditingPermission
|
|
432
|
+
| InternalServiceError
|
|
433
|
+
| InvalidProviderConfiguration
|
|
434
|
+
| InvalidUserToken
|
|
435
|
+
| Locked
|
|
436
|
+
| NetworkIssue;
|
|
437
|
+
|
|
268
438
|
// @public (undocumented)
|
|
269
439
|
interface SimpleEventEmitter {
|
|
270
440
|
// (undocumented)
|
|
@@ -294,14 +464,14 @@ export interface Socket extends SimpleEventEmitter {
|
|
|
294
464
|
|
|
295
465
|
// @public (undocumented)
|
|
296
466
|
type StepJson = {
|
|
467
|
+
stepType?: string;
|
|
297
468
|
from?: number;
|
|
298
469
|
to?: number;
|
|
299
|
-
|
|
470
|
+
slice?: SliceJson;
|
|
300
471
|
clientId: number | string;
|
|
301
472
|
userId: string;
|
|
302
473
|
createdAt?: number;
|
|
303
474
|
structure?: boolean;
|
|
304
|
-
slice?: SliceJson;
|
|
305
475
|
};
|
|
306
476
|
|
|
307
477
|
// @public (undocumented)
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.errorCodeMapper = exports.ErrorCodeMapper = void 0;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var ErrorCodeMapper = {
|
|
10
|
-
noPermissionError: {
|
|
11
|
-
code: 'NO_PERMISSION_ERROR',
|
|
12
|
-
message: 'User does not have permissions to access this document'
|
|
13
|
-
},
|
|
14
|
-
documentNotFound: {
|
|
15
|
-
code: 'DOCUMENT_NOT_FOUND',
|
|
16
|
-
message: 'The requested document is not found'
|
|
17
|
-
},
|
|
18
|
-
hasToLogin: {
|
|
19
|
-
code: 'HAS_TO_LOGIN',
|
|
20
|
-
message: 'The user needs to login'
|
|
21
|
-
},
|
|
22
|
-
catchupFail: {
|
|
23
|
-
code: 'CATCHUP_FAILED',
|
|
24
|
-
message: 'Cannot fetch catchup from collab service'
|
|
25
|
-
},
|
|
26
|
-
serviceUnvailable: {
|
|
27
|
-
code: 'SERVICE_UNAVAILABLE',
|
|
28
|
-
message: 'Service is not available'
|
|
29
|
-
},
|
|
30
|
-
failToSave: {
|
|
31
|
-
code: 'FAIL_TO_SAVE',
|
|
32
|
-
message: 'Collab service is not able to save changes'
|
|
33
|
-
},
|
|
34
|
-
restoreError: {
|
|
35
|
-
code: 'DOCUMENT_RESTORE_ERROR',
|
|
36
|
-
message: 'Collab service unable to restore document'
|
|
37
|
-
},
|
|
38
|
-
internalError: {
|
|
39
|
-
code: 'INTERNAL_SERVICE_ERROR',
|
|
40
|
-
message: 'Collab service has experienced an internal server error'
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
exports.ErrorCodeMapper = ErrorCodeMapper;
|
|
44
|
-
var errorCodeMapper = function errorCodeMapper(error) {
|
|
45
|
-
var _error$data;
|
|
46
|
-
switch ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) {
|
|
47
|
-
case 'INSUFFICIENT_EDITING_PERMISSION':
|
|
48
|
-
return {
|
|
49
|
-
status: 403,
|
|
50
|
-
code: ErrorCodeMapper.noPermissionError.code,
|
|
51
|
-
message: ErrorCodeMapper.noPermissionError.message,
|
|
52
|
-
reason:
|
|
53
|
-
// Typescript magic so it detects the union type
|
|
54
|
-
(0, _typeof2.default)(error.data.meta) === 'object' ? error.data.meta.reason : undefined
|
|
55
|
-
};
|
|
56
|
-
case 'DOCUMENT_NOT_FOUND':
|
|
57
|
-
return {
|
|
58
|
-
status: 404,
|
|
59
|
-
code: ErrorCodeMapper.documentNotFound.code,
|
|
60
|
-
message: ErrorCodeMapper.documentNotFound.message
|
|
61
|
-
};
|
|
62
|
-
case 'FAILED_ON_S3':
|
|
63
|
-
case 'DYNAMO_ERROR':
|
|
64
|
-
return {
|
|
65
|
-
status: 500,
|
|
66
|
-
code: ErrorCodeMapper.failToSave.code,
|
|
67
|
-
message: ErrorCodeMapper.failToSave.message
|
|
68
|
-
};
|
|
69
|
-
case 'DOCUMENT_RESTORE_ERROR':
|
|
70
|
-
return {
|
|
71
|
-
status: 500,
|
|
72
|
-
code: ErrorCodeMapper.restoreError.code,
|
|
73
|
-
message: ErrorCodeMapper.restoreError.message
|
|
74
|
-
};
|
|
75
|
-
// Temporarily re-added so we don't emit errors to Confluence by default as they will disconnect the collab provider
|
|
76
|
-
case 'CATCHUP_FAILED':
|
|
77
|
-
case 'GET_QUERY_TIME_OUT':
|
|
78
|
-
case 'INIT_DATA_LOAD_FAILED':
|
|
79
|
-
return {
|
|
80
|
-
status: 500,
|
|
81
|
-
code: ErrorCodeMapper.internalError.code,
|
|
82
|
-
message: ErrorCodeMapper.internalError.message
|
|
83
|
-
};
|
|
84
|
-
default:
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
exports.errorCodeMapper = errorCodeMapper;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export const ErrorCodeMapper = {
|
|
2
|
-
noPermissionError: {
|
|
3
|
-
code: 'NO_PERMISSION_ERROR',
|
|
4
|
-
message: 'User does not have permissions to access this document'
|
|
5
|
-
},
|
|
6
|
-
documentNotFound: {
|
|
7
|
-
code: 'DOCUMENT_NOT_FOUND',
|
|
8
|
-
message: 'The requested document is not found'
|
|
9
|
-
},
|
|
10
|
-
hasToLogin: {
|
|
11
|
-
code: 'HAS_TO_LOGIN',
|
|
12
|
-
message: 'The user needs to login'
|
|
13
|
-
},
|
|
14
|
-
catchupFail: {
|
|
15
|
-
code: 'CATCHUP_FAILED',
|
|
16
|
-
message: 'Cannot fetch catchup from collab service'
|
|
17
|
-
},
|
|
18
|
-
serviceUnvailable: {
|
|
19
|
-
code: 'SERVICE_UNAVAILABLE',
|
|
20
|
-
message: 'Service is not available'
|
|
21
|
-
},
|
|
22
|
-
failToSave: {
|
|
23
|
-
code: 'FAIL_TO_SAVE',
|
|
24
|
-
message: 'Collab service is not able to save changes'
|
|
25
|
-
},
|
|
26
|
-
restoreError: {
|
|
27
|
-
code: 'DOCUMENT_RESTORE_ERROR',
|
|
28
|
-
message: 'Collab service unable to restore document'
|
|
29
|
-
},
|
|
30
|
-
internalError: {
|
|
31
|
-
code: 'INTERNAL_SERVICE_ERROR',
|
|
32
|
-
message: 'Collab service has experienced an internal server error'
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
export const errorCodeMapper = error => {
|
|
36
|
-
var _error$data;
|
|
37
|
-
switch ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) {
|
|
38
|
-
case 'INSUFFICIENT_EDITING_PERMISSION':
|
|
39
|
-
return {
|
|
40
|
-
status: 403,
|
|
41
|
-
code: ErrorCodeMapper.noPermissionError.code,
|
|
42
|
-
message: ErrorCodeMapper.noPermissionError.message,
|
|
43
|
-
reason:
|
|
44
|
-
// Typescript magic so it detects the union type
|
|
45
|
-
typeof error.data.meta === 'object' ? error.data.meta.reason : undefined
|
|
46
|
-
};
|
|
47
|
-
case 'DOCUMENT_NOT_FOUND':
|
|
48
|
-
return {
|
|
49
|
-
status: 404,
|
|
50
|
-
code: ErrorCodeMapper.documentNotFound.code,
|
|
51
|
-
message: ErrorCodeMapper.documentNotFound.message
|
|
52
|
-
};
|
|
53
|
-
case 'FAILED_ON_S3':
|
|
54
|
-
case 'DYNAMO_ERROR':
|
|
55
|
-
return {
|
|
56
|
-
status: 500,
|
|
57
|
-
code: ErrorCodeMapper.failToSave.code,
|
|
58
|
-
message: ErrorCodeMapper.failToSave.message
|
|
59
|
-
};
|
|
60
|
-
case 'DOCUMENT_RESTORE_ERROR':
|
|
61
|
-
return {
|
|
62
|
-
status: 500,
|
|
63
|
-
code: ErrorCodeMapper.restoreError.code,
|
|
64
|
-
message: ErrorCodeMapper.restoreError.message
|
|
65
|
-
};
|
|
66
|
-
// Temporarily re-added so we don't emit errors to Confluence by default as they will disconnect the collab provider
|
|
67
|
-
case 'CATCHUP_FAILED':
|
|
68
|
-
case 'GET_QUERY_TIME_OUT':
|
|
69
|
-
case 'INIT_DATA_LOAD_FAILED':
|
|
70
|
-
return {
|
|
71
|
-
status: 500,
|
|
72
|
-
code: ErrorCodeMapper.internalError.code,
|
|
73
|
-
message: ErrorCodeMapper.internalError.message
|
|
74
|
-
};
|
|
75
|
-
default:
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
export var ErrorCodeMapper = {
|
|
3
|
-
noPermissionError: {
|
|
4
|
-
code: 'NO_PERMISSION_ERROR',
|
|
5
|
-
message: 'User does not have permissions to access this document'
|
|
6
|
-
},
|
|
7
|
-
documentNotFound: {
|
|
8
|
-
code: 'DOCUMENT_NOT_FOUND',
|
|
9
|
-
message: 'The requested document is not found'
|
|
10
|
-
},
|
|
11
|
-
hasToLogin: {
|
|
12
|
-
code: 'HAS_TO_LOGIN',
|
|
13
|
-
message: 'The user needs to login'
|
|
14
|
-
},
|
|
15
|
-
catchupFail: {
|
|
16
|
-
code: 'CATCHUP_FAILED',
|
|
17
|
-
message: 'Cannot fetch catchup from collab service'
|
|
18
|
-
},
|
|
19
|
-
serviceUnvailable: {
|
|
20
|
-
code: 'SERVICE_UNAVAILABLE',
|
|
21
|
-
message: 'Service is not available'
|
|
22
|
-
},
|
|
23
|
-
failToSave: {
|
|
24
|
-
code: 'FAIL_TO_SAVE',
|
|
25
|
-
message: 'Collab service is not able to save changes'
|
|
26
|
-
},
|
|
27
|
-
restoreError: {
|
|
28
|
-
code: 'DOCUMENT_RESTORE_ERROR',
|
|
29
|
-
message: 'Collab service unable to restore document'
|
|
30
|
-
},
|
|
31
|
-
internalError: {
|
|
32
|
-
code: 'INTERNAL_SERVICE_ERROR',
|
|
33
|
-
message: 'Collab service has experienced an internal server error'
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export var errorCodeMapper = function errorCodeMapper(error) {
|
|
37
|
-
var _error$data;
|
|
38
|
-
switch ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) {
|
|
39
|
-
case 'INSUFFICIENT_EDITING_PERMISSION':
|
|
40
|
-
return {
|
|
41
|
-
status: 403,
|
|
42
|
-
code: ErrorCodeMapper.noPermissionError.code,
|
|
43
|
-
message: ErrorCodeMapper.noPermissionError.message,
|
|
44
|
-
reason:
|
|
45
|
-
// Typescript magic so it detects the union type
|
|
46
|
-
_typeof(error.data.meta) === 'object' ? error.data.meta.reason : undefined
|
|
47
|
-
};
|
|
48
|
-
case 'DOCUMENT_NOT_FOUND':
|
|
49
|
-
return {
|
|
50
|
-
status: 404,
|
|
51
|
-
code: ErrorCodeMapper.documentNotFound.code,
|
|
52
|
-
message: ErrorCodeMapper.documentNotFound.message
|
|
53
|
-
};
|
|
54
|
-
case 'FAILED_ON_S3':
|
|
55
|
-
case 'DYNAMO_ERROR':
|
|
56
|
-
return {
|
|
57
|
-
status: 500,
|
|
58
|
-
code: ErrorCodeMapper.failToSave.code,
|
|
59
|
-
message: ErrorCodeMapper.failToSave.message
|
|
60
|
-
};
|
|
61
|
-
case 'DOCUMENT_RESTORE_ERROR':
|
|
62
|
-
return {
|
|
63
|
-
status: 500,
|
|
64
|
-
code: ErrorCodeMapper.restoreError.code,
|
|
65
|
-
message: ErrorCodeMapper.restoreError.message
|
|
66
|
-
};
|
|
67
|
-
// Temporarily re-added so we don't emit errors to Confluence by default as they will disconnect the collab provider
|
|
68
|
-
case 'CATCHUP_FAILED':
|
|
69
|
-
case 'GET_QUERY_TIME_OUT':
|
|
70
|
-
case 'INIT_DATA_LOAD_FAILED':
|
|
71
|
-
return {
|
|
72
|
-
status: 500,
|
|
73
|
-
code: ErrorCodeMapper.internalError.code,
|
|
74
|
-
message: ErrorCodeMapper.internalError.message
|
|
75
|
-
};
|
|
76
|
-
default:
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { CollabErrorPayload, ErrorPayload } from './types';
|
|
2
|
-
export declare const ErrorCodeMapper: {
|
|
3
|
-
noPermissionError: {
|
|
4
|
-
code: string;
|
|
5
|
-
message: string;
|
|
6
|
-
};
|
|
7
|
-
documentNotFound: {
|
|
8
|
-
code: string;
|
|
9
|
-
message: string;
|
|
10
|
-
};
|
|
11
|
-
hasToLogin: {
|
|
12
|
-
code: string;
|
|
13
|
-
message: string;
|
|
14
|
-
};
|
|
15
|
-
catchupFail: {
|
|
16
|
-
code: string;
|
|
17
|
-
message: string;
|
|
18
|
-
};
|
|
19
|
-
serviceUnvailable: {
|
|
20
|
-
code: string;
|
|
21
|
-
message: string;
|
|
22
|
-
};
|
|
23
|
-
failToSave: {
|
|
24
|
-
code: string;
|
|
25
|
-
message: string;
|
|
26
|
-
};
|
|
27
|
-
restoreError: {
|
|
28
|
-
code: string;
|
|
29
|
-
message: string;
|
|
30
|
-
};
|
|
31
|
-
internalError: {
|
|
32
|
-
code: string;
|
|
33
|
-
message: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export declare const errorCodeMapper: (error: ErrorPayload) => CollabErrorPayload | undefined;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CollabEventTelepointerData } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import { AcknowledgementPayload, StepJson } from '../types';
|
|
3
|
-
import { ParticipantsMap } from './index';
|
|
4
|
-
export declare const telepointersFromStep: (participants: ParticipantsMap, step: StepJson) => CollabEventTelepointerData | undefined;
|
|
5
|
-
export declare const telepointerCallback: (documentAri: string) => (response: AcknowledgementPayload) => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/collab-provider/error-code-mapper",
|
|
3
|
-
"main": "../dist/cjs/error-code-mapper.js",
|
|
4
|
-
"module": "../dist/esm/error-code-mapper.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/error-code-mapper.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/error-code-mapper.d.ts",
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.0 <4.5": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.0/error-code-mapper.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
File without changes
|