@atlaskit/collab-provider 9.6.1 → 9.6.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/provider/commit-step.js +10 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/helpers/const.js +1 -0
- package/dist/es2019/provider/commit-step.js +8 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/provider/commit-step.js +10 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/helpers/const.d.ts +2 -1
- package/dist/types-ts4.5/helpers/const.d.ts +2 -1
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +581 -0
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,7 @@ var EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
|
26
26
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
27
27
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
28
28
|
EVENT_STATUS["INFO"] = "INFO";
|
|
29
|
+
EVENT_STATUS["SUCCESS_10x_SAMPLED"] = "SUCCESS_10x_SAMPLED";
|
|
29
30
|
return EVENT_STATUS;
|
|
30
31
|
}({});
|
|
31
32
|
exports.EVENT_STATUS = EVENT_STATUS;
|
|
@@ -48,13 +48,16 @@ var commitStep = function commitStep(_ref) {
|
|
|
48
48
|
steps: stepsWithClientAndUserId,
|
|
49
49
|
version: response.version
|
|
50
50
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
// Sample only 10% of add steps events to avoid overwhelming the analytics
|
|
52
|
+
if (Math.random() < 0.1) {
|
|
53
|
+
analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendActionEvent(_const.EVENT_ACTION.ADD_STEPS, _const.EVENT_STATUS.SUCCESS_10x_SAMPLED, {
|
|
54
|
+
type: _const.ADD_STEPS_TYPE.ACCEPTED,
|
|
55
|
+
latency: latency,
|
|
56
|
+
stepType: (0, _countBy.default)(stepsWithClientAndUserId, function (stepWithClientAndUserId) {
|
|
57
|
+
return stepWithClientAndUserId.stepType;
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
58
61
|
emit('commit-status', {
|
|
59
62
|
status: 'success',
|
|
60
63
|
version: response.version
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/collab-provider";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "9.6.
|
|
9
|
+
var version = "9.6.2";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -19,6 +19,7 @@ export let EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
|
19
19
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
20
20
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
21
21
|
EVENT_STATUS["INFO"] = "INFO";
|
|
22
|
+
EVENT_STATUS["SUCCESS_10x_SAMPLED"] = "SUCCESS_10x_SAMPLED";
|
|
22
23
|
return EVENT_STATUS;
|
|
23
24
|
}({});
|
|
24
25
|
export let ADD_STEPS_TYPE = /*#__PURE__*/function (ADD_STEPS_TYPE) {
|
|
@@ -38,11 +38,14 @@ export const commitStep = ({
|
|
|
38
38
|
steps: stepsWithClientAndUserId,
|
|
39
39
|
version: response.version
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
// Sample only 10% of add steps events to avoid overwhelming the analytics
|
|
42
|
+
if (Math.random() < 0.1) {
|
|
43
|
+
analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.SUCCESS_10x_SAMPLED, {
|
|
44
|
+
type: ADD_STEPS_TYPE.ACCEPTED,
|
|
45
|
+
latency,
|
|
46
|
+
stepType: countBy(stepsWithClientAndUserId, stepWithClientAndUserId => stepWithClientAndUserId.stepType)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
46
49
|
emit('commit-status', {
|
|
47
50
|
status: 'success',
|
|
48
51
|
version: response.version
|
package/dist/es2019/version.json
CHANGED
|
@@ -19,6 +19,7 @@ export var EVENT_STATUS = /*#__PURE__*/function (EVENT_STATUS) {
|
|
|
19
19
|
EVENT_STATUS["SUCCESS"] = "SUCCESS";
|
|
20
20
|
EVENT_STATUS["FAILURE"] = "FAILURE";
|
|
21
21
|
EVENT_STATUS["INFO"] = "INFO";
|
|
22
|
+
EVENT_STATUS["SUCCESS_10x_SAMPLED"] = "SUCCESS_10x_SAMPLED";
|
|
22
23
|
return EVENT_STATUS;
|
|
23
24
|
}({});
|
|
24
25
|
export var ADD_STEPS_TYPE = /*#__PURE__*/function (ADD_STEPS_TYPE) {
|
|
@@ -41,13 +41,16 @@ export var commitStep = function commitStep(_ref) {
|
|
|
41
41
|
steps: stepsWithClientAndUserId,
|
|
42
42
|
version: response.version
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
// Sample only 10% of add steps events to avoid overwhelming the analytics
|
|
45
|
+
if (Math.random() < 0.1) {
|
|
46
|
+
analyticsHelper === null || analyticsHelper === void 0 ? void 0 : analyticsHelper.sendActionEvent(EVENT_ACTION.ADD_STEPS, EVENT_STATUS.SUCCESS_10x_SAMPLED, {
|
|
47
|
+
type: ADD_STEPS_TYPE.ACCEPTED,
|
|
48
|
+
latency: latency,
|
|
49
|
+
stepType: countBy(stepsWithClientAndUserId, function (stepWithClientAndUserId) {
|
|
50
|
+
return stepWithClientAndUserId.stepType;
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
51
54
|
emit('commit-status', {
|
|
52
55
|
status: 'success',
|
|
53
56
|
version: response.version
|
package/dist/esm/version.json
CHANGED
|
@@ -18,7 +18,8 @@ export declare enum EVENT_ACTION {
|
|
|
18
18
|
export declare enum EVENT_STATUS {
|
|
19
19
|
SUCCESS = "SUCCESS",
|
|
20
20
|
FAILURE = "FAILURE",
|
|
21
|
-
INFO = "INFO"
|
|
21
|
+
INFO = "INFO",
|
|
22
|
+
SUCCESS_10x_SAMPLED = "SUCCESS_10x_SAMPLED"
|
|
22
23
|
}
|
|
23
24
|
export declare enum ADD_STEPS_TYPE {
|
|
24
25
|
ACCEPTED = "ACCEPTED",
|
|
@@ -18,7 +18,8 @@ export declare enum EVENT_ACTION {
|
|
|
18
18
|
export declare enum EVENT_STATUS {
|
|
19
19
|
SUCCESS = "SUCCESS",
|
|
20
20
|
FAILURE = "FAILURE",
|
|
21
|
-
INFO = "INFO"
|
|
21
|
+
INFO = "INFO",
|
|
22
|
+
SUCCESS_10x_SAMPLED = "SUCCESS_10x_SAMPLED"
|
|
22
23
|
}
|
|
23
24
|
export declare enum ADD_STEPS_TYPE {
|
|
24
25
|
ACCEPTED = "ACCEPTED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.2",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@atlaskit/adf-schema": "^26.1.0",
|
|
65
65
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
66
|
-
"@atlaskit/editor-test-helpers": "^18.
|
|
66
|
+
"@atlaskit/editor-test-helpers": "^18.10.0",
|
|
67
67
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
68
68
|
"prosemirror-model": "1.16.0",
|
|
69
69
|
"prosemirror-state": "1.3.4",
|
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/collab-provider"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
8
|
+
import type { EditorState } from 'prosemirror-state';
|
|
9
|
+
import { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
10
|
+
import type { Manager } from 'socket.io-client';
|
|
11
|
+
import type { Step } from 'prosemirror-transform';
|
|
12
|
+
import type { Transaction } from 'prosemirror-state';
|
|
13
|
+
|
|
14
|
+
// @public (undocumented)
|
|
15
|
+
type AuthCallback = (cb: (data: InitAndAuthData) => void) => void;
|
|
16
|
+
|
|
17
|
+
// @public (undocumented)
|
|
18
|
+
type BaseEvents = Pick<CollabEditProvider<CollabEvents>, 'send' | 'sendMessage' | 'setup'>;
|
|
19
|
+
|
|
20
|
+
// @public (undocumented)
|
|
21
|
+
type CollabCommitStatusEventPayload = {
|
|
22
|
+
status: 'attempt' | 'failure' | 'success';
|
|
23
|
+
version: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// @public (undocumented)
|
|
27
|
+
export type CollabConnectedPayload = CollabEventConnectionData;
|
|
28
|
+
|
|
29
|
+
// @public (undocumented)
|
|
30
|
+
type CollabConnectingPayload = CollabEventConnectingData;
|
|
31
|
+
|
|
32
|
+
// @public (undocumented)
|
|
33
|
+
export interface CollabDataPayload extends CollabEventRemoteData {
|
|
34
|
+
// (undocumented)
|
|
35
|
+
json: StepJson[];
|
|
36
|
+
// (undocumented)
|
|
37
|
+
userIds: (number | string)[];
|
|
38
|
+
// (undocumented)
|
|
39
|
+
version: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// @public (undocumented)
|
|
43
|
+
export interface CollabDisconnectedPayload {
|
|
44
|
+
// (undocumented)
|
|
45
|
+
reason: DisconnectReason;
|
|
46
|
+
// (undocumented)
|
|
47
|
+
sid: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// @public (undocumented)
|
|
51
|
+
export interface CollabEditProvider<Events extends CollabEvents = CollabEvents> {
|
|
52
|
+
// (undocumented)
|
|
53
|
+
getFinalAcknowledgedState(): Promise<ResolvedEditorState>;
|
|
54
|
+
// (undocumented)
|
|
55
|
+
initialize(getState: () => any, createStep: (json: object) => Step): this;
|
|
56
|
+
// (undocumented)
|
|
57
|
+
off(evt: keyof Events, handler: (...args: any) => void): this;
|
|
58
|
+
// (undocumented)
|
|
59
|
+
on(evt: keyof Events, handler: (...args: any) => void): this;
|
|
60
|
+
// (undocumented)
|
|
61
|
+
send(tr: Transaction, oldState: EditorState, newState: EditorState): void;
|
|
62
|
+
// (undocumented)
|
|
63
|
+
sendMessage<K extends keyof Events>(data: {
|
|
64
|
+
type: K;
|
|
65
|
+
} & Events[K]): void;
|
|
66
|
+
// (undocumented)
|
|
67
|
+
setup(props: {
|
|
68
|
+
getState?: () => EditorState;
|
|
69
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
70
|
+
}): this;
|
|
71
|
+
// (undocumented)
|
|
72
|
+
unsubscribeAll(evt: keyof Events): this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// @public (undocumented)
|
|
76
|
+
export interface CollabEventConnectingData {
|
|
77
|
+
// (undocumented)
|
|
78
|
+
initial: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// @public (undocumented)
|
|
82
|
+
export interface CollabEventConnectionData {
|
|
83
|
+
// (undocumented)
|
|
84
|
+
initial: boolean;
|
|
85
|
+
// (undocumented)
|
|
86
|
+
sid: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// @public (undocumented)
|
|
90
|
+
export interface CollabEventDisconnectedData {
|
|
91
|
+
// (undocumented)
|
|
92
|
+
reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
|
|
93
|
+
// (undocumented)
|
|
94
|
+
sid: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// @public (undocumented)
|
|
98
|
+
export interface CollabEventInitData {
|
|
99
|
+
// (undocumented)
|
|
100
|
+
doc?: any;
|
|
101
|
+
// (undocumented)
|
|
102
|
+
json?: any;
|
|
103
|
+
// (undocumented)
|
|
104
|
+
reserveCursor?: boolean;
|
|
105
|
+
// (undocumented)
|
|
106
|
+
sid?: string;
|
|
107
|
+
// (undocumented)
|
|
108
|
+
version?: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// @public (undocumented)
|
|
112
|
+
export interface CollabEventLocalStepData {
|
|
113
|
+
// (undocumented)
|
|
114
|
+
steps: Array<Step>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// @public (undocumented)
|
|
118
|
+
export interface CollabEventPresenceData {
|
|
119
|
+
// (undocumented)
|
|
120
|
+
joined?: CollabParticipant[];
|
|
121
|
+
// (undocumented)
|
|
122
|
+
left?: {
|
|
123
|
+
sessionId: string;
|
|
124
|
+
}[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// @public (undocumented)
|
|
128
|
+
export interface CollabEventRemoteData {
|
|
129
|
+
// (undocumented)
|
|
130
|
+
json?: any;
|
|
131
|
+
// (undocumented)
|
|
132
|
+
newState?: EditorState;
|
|
133
|
+
// (undocumented)
|
|
134
|
+
userIds?: (number | string)[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// @public (undocumented)
|
|
138
|
+
export interface CollabEvents {
|
|
139
|
+
// (undocumented)
|
|
140
|
+
'commit-status': CollabCommitStatusEventPayload;
|
|
141
|
+
// (undocumented)
|
|
142
|
+
'local-steps': CollabLocalStepsPayload;
|
|
143
|
+
// (undocumented)
|
|
144
|
+
'metadata:changed': CollabMetadataPayload;
|
|
145
|
+
// (undocumented)
|
|
146
|
+
connected: CollabConnectedPayload;
|
|
147
|
+
// (undocumented)
|
|
148
|
+
connecting: CollabConnectingPayload;
|
|
149
|
+
// (undocumented)
|
|
150
|
+
data: CollabDataPayload;
|
|
151
|
+
// (undocumented)
|
|
152
|
+
disconnected: CollabDisconnectedPayload;
|
|
153
|
+
// (undocumented)
|
|
154
|
+
entity: any;
|
|
155
|
+
// (undocumented)
|
|
156
|
+
error: ProviderError;
|
|
157
|
+
// (undocumented)
|
|
158
|
+
init: CollabInitPayload;
|
|
159
|
+
// (undocumented)
|
|
160
|
+
presence: CollabPresencePayload;
|
|
161
|
+
// (undocumented)
|
|
162
|
+
telepointer: CollabTelepointerPayload;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// @public (undocumented)
|
|
166
|
+
export interface CollabEventTelepointerData {
|
|
167
|
+
// (undocumented)
|
|
168
|
+
selection: CollabSendableSelection;
|
|
169
|
+
// (undocumented)
|
|
170
|
+
sessionId: string;
|
|
171
|
+
// (undocumented)
|
|
172
|
+
type: 'telepointer';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// @public (undocumented)
|
|
176
|
+
export interface CollabInitPayload extends CollabEventInitData {
|
|
177
|
+
// (undocumented)
|
|
178
|
+
doc: any;
|
|
179
|
+
// (undocumented)
|
|
180
|
+
metadata?: Metadata_2;
|
|
181
|
+
// (undocumented)
|
|
182
|
+
reserveCursor?: boolean;
|
|
183
|
+
// (undocumented)
|
|
184
|
+
version: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// @public (undocumented)
|
|
188
|
+
export type CollabLocalStepsPayload = {
|
|
189
|
+
steps: readonly Step[];
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// @public (undocumented)
|
|
193
|
+
export type CollabMetadataPayload = Metadata_2;
|
|
194
|
+
|
|
195
|
+
// @public (undocumented)
|
|
196
|
+
export interface CollabParticipant {
|
|
197
|
+
// (undocumented)
|
|
198
|
+
avatar: string;
|
|
199
|
+
// (undocumented)
|
|
200
|
+
cursorPos?: number;
|
|
201
|
+
// (undocumented)
|
|
202
|
+
lastActive: number;
|
|
203
|
+
// (undocumented)
|
|
204
|
+
name: string;
|
|
205
|
+
// (undocumented)
|
|
206
|
+
sessionId: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// @public (undocumented)
|
|
210
|
+
export type CollabPresencePayload = CollabEventPresenceData;
|
|
211
|
+
|
|
212
|
+
// @public (undocumented)
|
|
213
|
+
export interface CollabSendableSelection {
|
|
214
|
+
// (undocumented)
|
|
215
|
+
anchor?: number | string;
|
|
216
|
+
// (undocumented)
|
|
217
|
+
head?: number | string;
|
|
218
|
+
// (undocumented)
|
|
219
|
+
type: 'nodeSelection' | 'textSelection';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// @public (undocumented)
|
|
223
|
+
export type CollabTelepointerPayload = CollabEventTelepointerData;
|
|
224
|
+
|
|
225
|
+
// @public (undocumented)
|
|
226
|
+
interface Config {
|
|
227
|
+
analyticsClient?: AnalyticsWebClient;
|
|
228
|
+
// (undocumented)
|
|
229
|
+
cacheToken?: boolean;
|
|
230
|
+
// (undocumented)
|
|
231
|
+
createSocket: (path: string, auth?: AuthCallback | InitAndAuthData, productInfo?: ProductInformation) => Socket;
|
|
232
|
+
// (undocumented)
|
|
233
|
+
documentAri: string;
|
|
234
|
+
enableErrorOnFailedDocumentApply?: boolean;
|
|
235
|
+
failedStepLimitBeforeCatchupOnPublish?: number;
|
|
236
|
+
// (undocumented)
|
|
237
|
+
featureFlags?: {
|
|
238
|
+
[key: string]: boolean;
|
|
239
|
+
};
|
|
240
|
+
// (undocumented)
|
|
241
|
+
getAnalyticsWebClient?: Promise<AnalyticsWebClient>;
|
|
242
|
+
// (undocumented)
|
|
243
|
+
getUser?: GetUserType;
|
|
244
|
+
// (undocumented)
|
|
245
|
+
initialDraft?: InitialDraft;
|
|
246
|
+
// (undocumented)
|
|
247
|
+
lifecycle?: Lifecycle;
|
|
248
|
+
// (undocumented)
|
|
249
|
+
need404?: boolean;
|
|
250
|
+
permissionTokenRefresh?: () => Promise<null | string>;
|
|
251
|
+
// (undocumented)
|
|
252
|
+
productInfo?: ProductInformation;
|
|
253
|
+
// (undocumented)
|
|
254
|
+
storage?: Storage_2;
|
|
255
|
+
throwOnNotConnected?: boolean;
|
|
256
|
+
// (undocumented)
|
|
257
|
+
url: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// @public (undocumented)
|
|
261
|
+
enum DisconnectReason {
|
|
262
|
+
// (undocumented)
|
|
263
|
+
CLIENT_DISCONNECT = "CLIENT_DISCONNECT",
|
|
264
|
+
// (undocumented)
|
|
265
|
+
SERVER_DISCONNECT = "SERVER_DISCONNECT",
|
|
266
|
+
// (undocumented)
|
|
267
|
+
SOCKET_CLOSED = "SOCKET_CLOSED",
|
|
268
|
+
// (undocumented)
|
|
269
|
+
SOCKET_ERROR = "SOCKET_ERROR",
|
|
270
|
+
// (undocumented)
|
|
271
|
+
SOCKET_TIMEOUT = "SOCKET_TIMEOUT",
|
|
272
|
+
// (undocumented)
|
|
273
|
+
UNKNOWN_DISCONNECT = "UNKNOWN_DISCONNECT"
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// @public
|
|
277
|
+
type DocumentNotFound = {
|
|
278
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_NOT_FOUND;
|
|
279
|
+
message: string;
|
|
280
|
+
recoverable: boolean;
|
|
281
|
+
status?: number;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// @public
|
|
285
|
+
type DocumentNotRestore = {
|
|
286
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_RESTORE_ERROR;
|
|
287
|
+
message: string;
|
|
288
|
+
recoverable: boolean;
|
|
289
|
+
status?: number;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// @public (undocumented)
|
|
293
|
+
class Emitter<T = any> {
|
|
294
|
+
protected emit<K extends keyof T>(evt: K, data: T[K]): this;
|
|
295
|
+
off<K extends keyof T>(evt: K, handler: (args: T[K]) => void): this;
|
|
296
|
+
on<K extends keyof T>(evt: K, handler: (args: T[K]) => void): this;
|
|
297
|
+
unsubscribeAll<K extends keyof T>(evt?: K): this;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// @public (undocumented)
|
|
301
|
+
type EventHandler = () => void;
|
|
302
|
+
|
|
303
|
+
// @public
|
|
304
|
+
type FailToSave = {
|
|
305
|
+
code: PROVIDER_ERROR_CODE.FAIL_TO_SAVE;
|
|
306
|
+
message: string;
|
|
307
|
+
recoverable: boolean;
|
|
308
|
+
status?: number;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// @public (undocumented)
|
|
312
|
+
type GetUserType = ((userId: string) => Promise<Pick<ProviderParticipant, 'avatar' | 'email' | 'name' | 'userId'>>) | undefined;
|
|
313
|
+
|
|
314
|
+
// @public (undocumented)
|
|
315
|
+
interface InitAndAuthData {
|
|
316
|
+
// (undocumented)
|
|
317
|
+
initialized: boolean;
|
|
318
|
+
// (undocumented)
|
|
319
|
+
need404?: boolean;
|
|
320
|
+
// (undocumented)
|
|
321
|
+
token?: string;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// @public (undocumented)
|
|
325
|
+
interface InitialDraft {
|
|
326
|
+
// (undocumented)
|
|
327
|
+
document: JSONDocNode;
|
|
328
|
+
// (undocumented)
|
|
329
|
+
metadata?: Metadata_2;
|
|
330
|
+
// (undocumented)
|
|
331
|
+
timestamp?: number;
|
|
332
|
+
// (undocumented)
|
|
333
|
+
version: number;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// @public
|
|
337
|
+
type InitialisationError = {
|
|
338
|
+
code: PROVIDER_ERROR_CODE.INITIALISATION_ERROR;
|
|
339
|
+
message: string;
|
|
340
|
+
recoverable: boolean;
|
|
341
|
+
status?: number;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// @public
|
|
345
|
+
type InsufficientEditingPermission = {
|
|
346
|
+
code: PROVIDER_ERROR_CODE.NO_PERMISSION_ERROR;
|
|
347
|
+
message: string;
|
|
348
|
+
recoverable: boolean;
|
|
349
|
+
reason?: string;
|
|
350
|
+
status?: number;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// @public
|
|
354
|
+
type InternalServiceError = {
|
|
355
|
+
code: PROVIDER_ERROR_CODE.INTERNAL_SERVICE_ERROR;
|
|
356
|
+
message: string;
|
|
357
|
+
recoverable: boolean;
|
|
358
|
+
reason: string;
|
|
359
|
+
status?: number;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// @public
|
|
363
|
+
type InvalidProviderConfiguration = {
|
|
364
|
+
code: PROVIDER_ERROR_CODE.INVALID_PROVIDER_CONFIGURATION;
|
|
365
|
+
message: string;
|
|
366
|
+
recoverable: boolean;
|
|
367
|
+
reason: string;
|
|
368
|
+
status?: number;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// @public
|
|
372
|
+
type InvalidUserToken = {
|
|
373
|
+
code: PROVIDER_ERROR_CODE.INVALID_USER_TOKEN;
|
|
374
|
+
message: string;
|
|
375
|
+
recoverable: boolean;
|
|
376
|
+
status?: number;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// @public (undocumented)
|
|
380
|
+
interface Lifecycle {
|
|
381
|
+
// (undocumented)
|
|
382
|
+
on(event: LifecycleEvents, handler: EventHandler): void;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// @public (undocumented)
|
|
386
|
+
type LifecycleEvents = 'restore' | 'save';
|
|
387
|
+
|
|
388
|
+
// @public
|
|
389
|
+
type Locked = {
|
|
390
|
+
code: PROVIDER_ERROR_CODE.LOCKED;
|
|
391
|
+
message: string;
|
|
392
|
+
recoverable: boolean;
|
|
393
|
+
status?: number;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// @public (undocumented)
|
|
397
|
+
type MarkJson = {
|
|
398
|
+
type: string;
|
|
399
|
+
attrs: {
|
|
400
|
+
[key: string]: any;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// @public (undocumented)
|
|
405
|
+
interface Metadata_2 {
|
|
406
|
+
// (undocumented)
|
|
407
|
+
[key: string]: boolean | number | string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// @public
|
|
411
|
+
type NetworkIssue = {
|
|
412
|
+
code: PROVIDER_ERROR_CODE.NETWORK_ISSUE;
|
|
413
|
+
message: string;
|
|
414
|
+
recoverable: boolean;
|
|
415
|
+
status?: number;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// @public (undocumented)
|
|
419
|
+
export type NewCollabSyncUpErrorAttributes = {
|
|
420
|
+
lengthOfUnconfirmedSteps?: number;
|
|
421
|
+
tries: number;
|
|
422
|
+
maxRetries: number;
|
|
423
|
+
clientId?: number | string;
|
|
424
|
+
version: number;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// @public (undocumented)
|
|
428
|
+
type NodeJson = {
|
|
429
|
+
type: string;
|
|
430
|
+
attrs: {
|
|
431
|
+
[key: string]: any;
|
|
432
|
+
};
|
|
433
|
+
content: NodeJson[];
|
|
434
|
+
marks: MarkJson[];
|
|
435
|
+
text?: string;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// @public (undocumented)
|
|
439
|
+
type ProductInformation = {
|
|
440
|
+
product: string;
|
|
441
|
+
subProduct?: string;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
// @public (undocumented)
|
|
445
|
+
export class Provider extends Emitter<CollabEvents> implements BaseEvents {
|
|
446
|
+
constructor(config: Config);
|
|
447
|
+
destroy(): this;
|
|
448
|
+
// @deprecated
|
|
449
|
+
disconnect(): this;
|
|
450
|
+
getCurrentState: () => Promise<ResolvedEditorState>;
|
|
451
|
+
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
452
|
+
getMetadata: () => Metadata_2;
|
|
453
|
+
// (undocumented)
|
|
454
|
+
getParticipants: () => ProviderParticipant[];
|
|
455
|
+
// (undocumented)
|
|
456
|
+
getStatePromiseResolve: (value: PromiseLike<void> | void) => void;
|
|
457
|
+
// (undocumented)
|
|
458
|
+
getUnconfirmedSteps: () => readonly Step[] | undefined;
|
|
459
|
+
// @deprecated
|
|
460
|
+
initialize(getState: () => EditorState): this;
|
|
461
|
+
send(_tr: Transaction | null, _oldState: EditorState | null, newState: EditorState): void;
|
|
462
|
+
sendMessage(data: CollabTelepointerPayload): void;
|
|
463
|
+
// @deprecated
|
|
464
|
+
setEditorWidth(editorWidth: string, broadcast?: boolean): void;
|
|
465
|
+
setMetadata(metadata: Metadata_2): void;
|
|
466
|
+
// @deprecated
|
|
467
|
+
setTitle(title: string, broadcast?: boolean): void;
|
|
468
|
+
setup({ getState, onSyncUpError, }: {
|
|
469
|
+
getState?: () => EditorState;
|
|
470
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
471
|
+
}): this;
|
|
472
|
+
// @deprecated
|
|
473
|
+
unsubscribeAll(): this;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// @public (undocumented)
|
|
477
|
+
export enum PROVIDER_ERROR_CODE {
|
|
478
|
+
// (undocumented)
|
|
479
|
+
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
480
|
+
// (undocumented)
|
|
481
|
+
DOCUMENT_RESTORE_ERROR = "DOCUMENT_RESTORE_ERROR",
|
|
482
|
+
// (undocumented)
|
|
483
|
+
DOCUMENT_UPDATE_ERROR = "DOCUMENT_UPDATE_ERROR",
|
|
484
|
+
// (undocumented)
|
|
485
|
+
FAIL_TO_SAVE = "FAIL_TO_SAVE",
|
|
486
|
+
// (undocumented)
|
|
487
|
+
INITIALISATION_ERROR = "INITIALISATION_ERROR",
|
|
488
|
+
// (undocumented)
|
|
489
|
+
INTERNAL_SERVICE_ERROR = "INTERNAL_SERVICE_ERROR",
|
|
490
|
+
// (undocumented)
|
|
491
|
+
INVALID_PROVIDER_CONFIGURATION = "INVALID_PROVIDER_CONFIGURATION",
|
|
492
|
+
// (undocumented)
|
|
493
|
+
INVALID_USER_TOKEN = "INVALID_USER_TOKEN",
|
|
494
|
+
// (undocumented)
|
|
495
|
+
LOCKED = "LOCKED",
|
|
496
|
+
// (undocumented)
|
|
497
|
+
NETWORK_ISSUE = "NETWORK_ISSUE",
|
|
498
|
+
// (undocumented)
|
|
499
|
+
NO_PERMISSION_ERROR = "NO_PERMISSION_ERROR"
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// @public (undocumented)
|
|
503
|
+
type ProviderDocumentUpdateError = {
|
|
504
|
+
code: PROVIDER_ERROR_CODE.DOCUMENT_UPDATE_ERROR;
|
|
505
|
+
message: 'The provider failed to apply changes to the editor';
|
|
506
|
+
recoverable: boolean;
|
|
507
|
+
status?: number;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
// @public
|
|
511
|
+
export type ProviderError = DocumentNotFound | DocumentNotRestore | FailToSave | InitialisationError | InsufficientEditingPermission | InternalServiceError | InvalidProviderConfiguration | InvalidUserToken | Locked | NetworkIssue | ProviderDocumentUpdateError;
|
|
512
|
+
|
|
513
|
+
// @public (undocumented)
|
|
514
|
+
export type ProviderParticipant = CollabParticipant & {
|
|
515
|
+
userId: string;
|
|
516
|
+
clientId: number | string;
|
|
517
|
+
email: string;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// @public (undocumented)
|
|
521
|
+
export type ResolvedEditorState<T = any> = {
|
|
522
|
+
content: JSONDocNode | T;
|
|
523
|
+
title: null | string;
|
|
524
|
+
stepVersion: number;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
// @public (undocumented)
|
|
528
|
+
interface SimpleEventEmitter {
|
|
529
|
+
// (undocumented)
|
|
530
|
+
on(event: string, fn: Function): SimpleEventEmitter;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// @public (undocumented)
|
|
534
|
+
type SliceJson = {
|
|
535
|
+
content: NodeJson[];
|
|
536
|
+
openStart: number;
|
|
537
|
+
openEnd: number;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
// @public (undocumented)
|
|
541
|
+
export interface Socket extends SimpleEventEmitter {
|
|
542
|
+
// (undocumented)
|
|
543
|
+
close(): Socket;
|
|
544
|
+
// (undocumented)
|
|
545
|
+
connect(): Socket;
|
|
546
|
+
// (undocumented)
|
|
547
|
+
emit(event: string, ...args: any[]): Socket;
|
|
548
|
+
// (undocumented)
|
|
549
|
+
id: string;
|
|
550
|
+
// (undocumented)
|
|
551
|
+
io?: Manager;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// @public (undocumented)
|
|
555
|
+
type StepJson = {
|
|
556
|
+
stepType?: string;
|
|
557
|
+
from?: number;
|
|
558
|
+
to?: number;
|
|
559
|
+
slice?: SliceJson;
|
|
560
|
+
clientId: number | string;
|
|
561
|
+
userId: string;
|
|
562
|
+
createdAt?: number;
|
|
563
|
+
structure?: boolean;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
// @public (undocumented)
|
|
567
|
+
interface Storage_2 {
|
|
568
|
+
// (undocumented)
|
|
569
|
+
delete(key: string): Promise<void>;
|
|
570
|
+
// (undocumented)
|
|
571
|
+
get(key: string): Promise<string>;
|
|
572
|
+
// (undocumented)
|
|
573
|
+
set(key: string, value: string): Promise<void>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// @public (undocumented)
|
|
577
|
+
export type SyncUpErrorFunction = (attributes: NewCollabSyncUpErrorAttributes) => void;
|
|
578
|
+
|
|
579
|
+
// (No @packageDocumentation comment for this package)
|
|
580
|
+
|
|
581
|
+
```
|