@atlaskit/collab-provider 11.3.1 → 11.3.2

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.
@@ -9,61 +9,77 @@ import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Prese
9
9
  import { type CatchupEventReason } from './helpers/const';
10
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
11
  export interface CollabEventDisconnectedData {
12
- sid: string;
13
12
  reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
13
+ sid: string;
14
14
  }
15
15
  export interface Storage {
16
+ delete: (key: string) => Promise<void>;
16
17
  get: (key: string) => Promise<string>;
17
18
  set: (key: string, value: string) => Promise<void>;
18
- delete: (key: string) => Promise<void>;
19
19
  }
20
20
  export interface InitialDraft {
21
21
  document: JSONDocNode;
22
- version: number;
23
22
  metadata?: Metadata;
23
+ version: number;
24
24
  }
25
25
  export type FetchAnonymousAsset = (presenceId: string | undefined) => Promise<AnonymousAsset | undefined>;
26
26
  export interface Config {
27
- url: string;
28
- documentAri: string;
29
- lifecycle?: Lifecycle;
30
- storage?: Storage;
31
- need404?: boolean;
32
- createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper) => SocketIOSocket;
33
- batchProps?: BatchProps;
34
- fetchAnonymousAsset?: FetchAnonymousAsset;
27
+ /**
28
+ * There is expected to be temporary divergence between Live Page editor expand behaviour and the standard expand behaviour.
29
+ *
30
+ * This is expected to be removed in Q4 as Editor and Live Page teams align on a singular behaviour.
31
+ *
32
+ * It is only supported for use by Confluence.
33
+ *
34
+ * @default false
35
+ */
36
+ __livePage?: boolean;
35
37
  /**
36
38
  * @deprecated: Use promise based getAnalyticsWebClient instead
37
39
  */
38
40
  analyticsClient?: AnalyticsWebClient;
39
- getAnalyticsWebClient?: Promise<AnalyticsWebClient>;
41
+ batchProps?: BatchProps;
42
+ createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation, isPresenceOnly?: boolean, analyticsHelper?: AnalyticsHelper) => SocketIOSocket;
43
+ documentAri: string;
44
+ /**
45
+ * Enable checking if a document update from collab-provider is being dropped by the editor,
46
+ * throwing a non-recoverable error if it's detected.
47
+ */
48
+ enableErrorOnFailedDocumentApply?: boolean;
49
+ /**
50
+ * When a page is being published this number can control the number of failed steps until a catchup is triggered.
51
+ * The default value is MAX_STEP_REJECTED_ERROR (15).
52
+ */
53
+ failedStepLimitBeforeCatchupOnPublish?: number;
40
54
  featureFlags?: {
41
55
  [key: string]: boolean;
42
56
  };
57
+ fetchAnonymousAsset?: FetchAnonymousAsset;
58
+ getAnalyticsWebClient?: Promise<AnalyticsWebClient>;
43
59
  getUser?: GetUserType;
60
+ initialDraft?: InitialDraft;
61
+ isBufferingEnabled?: boolean;
62
+ isPresenceOnly?: boolean;
63
+ lifecycle?: Lifecycle;
64
+ need404?: boolean;
44
65
  /**
45
66
  * If provided, permissionTokenRefresh is called whenever a new JWT token is required.
46
67
  */
47
68
  permissionTokenRefresh?: () => Promise<string | null>;
48
- productInfo?: ProductInformation;
49
- /**
50
- * Throws errors when trying to send data to collab but the client is not offline.
51
- * This can lead to potential dataloss and retrying should be considered. Without this flag the provider silently drops the requests.
52
- */
53
- throwOnNotConnected?: boolean;
54
- initialDraft?: InitialDraft;
55
- isBufferingEnabled?: boolean;
56
- isPresenceOnly?: boolean;
57
69
  /**
58
- * When a page is being published this number can control the number of failed steps until a catchup is triggered.
59
- * The default value is MAX_STEP_REJECTED_ERROR (15).
70
+ * Configure the provider to pass along a default activity during presence events. This activity will be used
71
+ * to display a user's activity, such as 'viewer' or 'editor'.
72
+ *
73
+ * This activity can be updated later on by the participants-service.
60
74
  */
61
- failedStepLimitBeforeCatchupOnPublish?: number;
75
+ presenceActivity?: PresenceActivity;
62
76
  /**
63
- * Enable checking if a document update from collab-provider is being dropped by the editor,
64
- * throwing a non-recoverable error if it's detected.
77
+ * Configure the provider to pass along a persistent presenceId during presence events. This presenceId will be used
78
+ * to calculate the colors of the presence avatars as well as the editors telepointers. Since these two features are split across
79
+ * multiple websocket connections, the presenceId is used to correlate the two.
65
80
  */
66
- enableErrorOnFailedDocumentApply?: boolean;
81
+ presenceId?: string;
82
+ productInfo?: ProductInformation;
67
83
  /**
68
84
  * Configure the client side circuit breaker in the event that abnormal behaviour causes the client to flood
69
85
  * NCS with too many steps or too large a volume of data. This can result in either a soft fail or a hard (fatal) fail
@@ -73,29 +89,13 @@ export interface Config {
73
89
  rateLimitStepCount?: number;
74
90
  rateLimitTotalStepSize?: number;
75
91
  rateLimitType?: number;
92
+ storage?: Storage;
76
93
  /**
77
- * There is expected to be temporary divergence between Live Page editor expand behaviour and the standard expand behaviour.
78
- *
79
- * This is expected to be removed in Q4 as Editor and Live Page teams align on a singular behaviour.
80
- *
81
- * It is only supported for use by Confluence.
82
- *
83
- * @default false
84
- */
85
- __livePage?: boolean;
86
- /**
87
- * Configure the provider to pass along a persistent presenceId during presence events. This presenceId will be used
88
- * to calculate the colors of the presence avatars as well as the editors telepointers. Since these two features are split across
89
- * multiple websocket connections, the presenceId is used to correlate the two.
90
- */
91
- presenceId?: string;
92
- /**
93
- * Configure the provider to pass along a default activity during presence events. This activity will be used
94
- * to display a user's activity, such as 'viewer' or 'editor'.
95
- *
96
- * This activity can be updated later on by the participants-service.
94
+ * Throws errors when trying to send data to collab but the client is not offline.
95
+ * This can lead to potential dataloss and retrying should be considered. Without this flag the provider silently drops the requests.
97
96
  */
98
- presenceActivity?: PresenceActivity;
97
+ throwOnNotConnected?: boolean;
98
+ url: string;
99
99
  }
100
100
  export interface InitAndAuthData {
101
101
  initialized: boolean;
@@ -107,10 +107,10 @@ interface SimpleEventEmitter {
107
107
  on: (event: string, fn: Function) => SimpleEventEmitter;
108
108
  }
109
109
  export interface Socket extends SimpleEventEmitter {
110
- id: string;
110
+ close: () => Socket;
111
111
  connect: () => Socket;
112
112
  emit: (event: string, ...args: any[]) => Socket;
113
- close: () => Socket;
113
+ id: string;
114
114
  io?: Manager;
115
115
  }
116
116
  export type LifecycleEvents = 'save' | 'restore';
@@ -120,10 +120,10 @@ export interface Lifecycle {
120
120
  }
121
121
  export type InitPayload = {
122
122
  doc: any;
123
- version: number;
124
- userId?: string;
125
123
  metadata?: Metadata;
126
124
  targetClientId?: string;
125
+ userId?: string;
126
+ version: number;
127
127
  };
128
128
  /**
129
129
  * @description Incoming payload type from the `broadcast` route in NCS
@@ -132,21 +132,21 @@ export type InitPayload = {
132
132
  * @param data event specific data from NCS
133
133
  */
134
134
  export type BroadcastIncomingPayload = {
135
+ data: PresencePayload | TelepointerPayload | StepsPayload | any;
135
136
  sessionId?: string;
136
137
  timestamp?: number;
137
- data: PresencePayload | TelepointerPayload | StepsPayload | any;
138
138
  };
139
139
  export type PresenceData = {
140
- sessionId: string;
141
- userId: string | undefined;
142
140
  clientId: number | string;
143
141
  permit?: UserPermitType;
144
- presenceId?: string;
145
142
  presenceActivity?: PresenceActivity;
143
+ presenceId?: string;
144
+ sessionId: string;
145
+ userId: string | undefined;
146
146
  };
147
147
  export type PresencePayload = PresenceData & {
148
- timestamp: number;
149
148
  data?: Record<string, any>;
149
+ timestamp: number;
150
150
  };
151
151
  export type TelepointerPayload = PresencePayload & {
152
152
  selection: CollabSendableSelection;
@@ -160,19 +160,19 @@ export type AcknowledgementSuccessPayload = {
160
160
  };
161
161
  export type AcknowledgementPayload = AcknowledgementSuccessPayload | AcknowledgementErrorPayload;
162
162
  export type AddStepAcknowledgementSuccessPayload = {
163
+ delay?: number;
163
164
  type: AcknowledgementResponseTypes.SUCCESS;
164
165
  version: number;
165
- delay?: number;
166
166
  };
167
167
  export type AcknowledgementErrorPayload = {
168
- type: AcknowledgementResponseTypes.ERROR;
169
- error: InternalError;
170
168
  delay?: number;
169
+ error: InternalError;
170
+ type: AcknowledgementResponseTypes.ERROR;
171
171
  };
172
172
  export type AddStepAcknowledgementPayload = AddStepAcknowledgementSuccessPayload | AcknowledgementErrorPayload;
173
173
  export type StepsPayload = {
174
- version: number;
175
174
  steps: StepJson[];
175
+ version: number;
176
176
  };
177
177
  export type NamespaceStatus = {
178
178
  isLocked: boolean;
@@ -181,64 +181,64 @@ export type NamespaceStatus = {
181
181
  };
182
182
  export type ChannelEvent = {
183
183
  connected: {
184
- sid: string;
185
184
  initialized: boolean;
185
+ sid: string;
186
186
  };
187
+ disconnect: {
188
+ reason: string;
189
+ };
190
+ error: InternalError;
187
191
  init: InitPayload;
188
- restore: InitPayload;
189
- reconnected: null;
190
- 'presence:joined': PresencePayload;
191
- presence: PresencePayload;
192
+ 'metadata:changed': Metadata;
192
193
  'participant:left': PresencePayload;
193
194
  'participant:telepointer': TelepointerPayload;
194
195
  'participant:updated': PresencePayload;
196
+ permission: UserPermitType;
197
+ presence: PresencePayload;
198
+ 'presence:joined': PresencePayload;
199
+ reconnected: null;
200
+ restore: InitPayload;
201
+ status: NamespaceStatus;
202
+ 'steps:added': StepsPayload;
195
203
  'steps:commit': StepsPayload & {
196
- userId: string;
197
204
  collabMode: string;
198
205
  forcePublish?: boolean;
206
+ userId: string;
199
207
  };
200
- 'steps:added': StepsPayload;
201
- 'metadata:changed': Metadata;
202
- permission: UserPermitType;
203
- error: InternalError;
204
- disconnect: {
205
- reason: string;
206
- };
207
- status: NamespaceStatus;
208
208
  };
209
209
  export interface Catchupv2Response {
210
- steps?: StepJson[];
211
210
  metadata?: Metadata;
211
+ steps?: StepJson[];
212
212
  }
213
213
  export interface ReconcileResponse {
214
- document: string;
215
- version: number;
216
214
  ari?: string;
215
+ document: string;
217
216
  metadata?: Metadata;
217
+ version: number;
218
218
  }
219
219
  export type GenerateDiffStepsResponseBody = {
220
220
  documentAri: string;
221
221
  generatedSteps: StepJson[];
222
222
  latestDocument?: string;
223
- userId: string;
224
223
  message?: string;
224
+ userId: string;
225
225
  };
226
226
  export interface Catchupv2Options {
227
- getCurrentPmVersion: () => number;
228
- fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean, reason?: CatchupEventReason, sessionId?: string) => Promise<Catchupv2Response>;
229
- updateMetadata: (metadata: Metadata | undefined) => void;
230
227
  analyticsHelper: AnalyticsHelper | undefined;
228
+ catchUpOutofSync: boolean;
231
229
  clientId: number | string | undefined;
230
+ fetchCatchupv2: (fromVersion: number, clientId: number | string | undefined, catchUpOutofSync: boolean, reason?: CatchupEventReason, sessionId?: string) => Promise<Catchupv2Response>;
231
+ getCurrentPmVersion: () => number;
232
+ getState: (() => EditorState) | undefined;
233
+ onCatchupComplete?: (steps: StepJson[]) => void;
232
234
  onStepsAdded: (data: StepsPayload) => void;
233
- catchUpOutofSync: boolean;
234
235
  reason?: CatchupEventReason;
235
236
  sessionId?: string;
236
- onCatchupComplete?: (steps: StepJson[]) => void;
237
- getState: (() => EditorState) | undefined;
237
+ updateMetadata: (metadata: Metadata | undefined) => void;
238
238
  }
239
239
  export type ReconnectionMetadata = {
240
- unconfirmedStepsLength: number | undefined;
241
240
  disconnectionPeriodSeconds: number | undefined;
241
+ unconfirmedStepsLength: number | undefined;
242
242
  };
243
243
  export type ProductInformation = {
244
244
  product: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "11.3.1",
3
+ "version": "11.3.2",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,14 +35,14 @@
35
35
  "@atlaskit/adf-utils": "^19.21.0",
36
36
  "@atlaskit/analytics-gas-types": "^5.1.0",
37
37
  "@atlaskit/analytics-listeners": "^9.0.0",
38
- "@atlaskit/anonymous-assets": "^0.0.4",
38
+ "@atlaskit/anonymous-assets": "^0.0.5",
39
39
  "@atlaskit/editor-json-transformer": "^8.27.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/feature-gate-js-client": "^5.5.0",
42
42
  "@atlaskit/platform-feature-flags": "^1.1.0",
43
43
  "@atlaskit/prosemirror-collab": "^0.17.0",
44
44
  "@atlaskit/react-ufo": "^4.4.0",
45
- "@atlaskit/tmp-editor-statsig": "^11.5.0",
45
+ "@atlaskit/tmp-editor-statsig": "^11.6.0",
46
46
  "@atlaskit/ufo": "^0.4.0",
47
47
  "@atlaskit/util-service-support": "^6.3.0",
48
48
  "@babel/runtime": "^7.0.0",
@@ -86,6 +86,6 @@
86
86
  }
87
87
  },
88
88
  "peerDependencies": {
89
- "@atlaskit/editor-common": "^107.28.0"
89
+ "@atlaskit/editor-common": "^107.29.0"
90
90
  }
91
91
  }