@atlaskit/collab-provider 7.6.0 → 7.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 +13 -0
- package/channel/package.json +8 -1
- package/config/package.json +8 -1
- package/disconnected-reason-mapper/package.json +8 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.0/analytics/index.d.ts +5 -0
- package/dist/types-ts4.0/analytics/performance.d.ts +12 -0
- package/dist/types-ts4.0/channel.d.ts +27 -0
- package/dist/types-ts4.0/config.d.ts +5 -0
- package/dist/types-ts4.0/disconnected-reason-mapper.d.ts +15 -0
- package/dist/types-ts4.0/emitter.d.ts +19 -0
- package/dist/types-ts4.0/error-code-mapper.d.ts +32 -0
- package/dist/types-ts4.0/helpers/const.d.ts +31 -0
- package/dist/types-ts4.0/helpers/utils.d.ts +11 -0
- package/dist/types-ts4.0/index.d.ts +2 -0
- package/dist/types-ts4.0/provider/catchup.d.ts +9 -0
- package/dist/types-ts4.0/provider/index.d.ts +124 -0
- package/dist/types-ts4.0/socket-io-provider.d.ts +4 -0
- package/dist/types-ts4.0/types.d.ts +170 -0
- package/emitter/package.json +8 -1
- package/error-code-mapper/package.json +8 -1
- package/package.json +12 -5
- package/report.api.md +14 -4
- package/socket-io-provider/package.json +8 -1
- package/types/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 7.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 7.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 7.6.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/channel/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/channel.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/channel.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/channel.d.ts"
|
|
7
|
+
"types": "../dist/types/channel.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/channel.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/config/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/config.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/config.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/config.d.ts"
|
|
7
|
+
"types": "../dist/types/config.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/config.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/disconnected-reason-mapper.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/disconnected-reason-mapper.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/disconnected-reason-mapper.d.ts"
|
|
7
|
+
"types": "../dist/types/disconnected-reason-mapper.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/disconnected-reason-mapper.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
2
|
+
import { GasPurePayload } from '@atlaskit/analytics-gas-types';
|
|
3
|
+
import { AnalyticsEvent } from '../helpers/const';
|
|
4
|
+
export declare const fireAnalyticsEvent: (analyticsClient?: AnalyticsWebClient | undefined, payload?: GasPurePayload | undefined) => void;
|
|
5
|
+
export declare const triggerCollabAnalyticsEvent: (analyticsEvent: AnalyticsEvent, analyticsClient?: AnalyticsWebClient | undefined) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum MEASURE_NAME {
|
|
2
|
+
CALLING_CATCHUP_API = "callingCatchupApi",
|
|
3
|
+
SOCKET_CONNECT = "socketConnect",
|
|
4
|
+
DOCUMENT_INIT = "documentInit",
|
|
5
|
+
CONVERT_PM_TO_ADF = "convertPMToADF"
|
|
6
|
+
}
|
|
7
|
+
export declare function startMeasure(measureName: MEASURE_NAME): void;
|
|
8
|
+
export declare function stopMeasure(measureName: MEASURE_NAME, onMeasureComplete?: (duration: number, startTime: number) => void): {
|
|
9
|
+
duration: number;
|
|
10
|
+
startTime: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare function clearMeasure(measureName: string): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Emitter } from './emitter';
|
|
2
|
+
import type { Config, Socket, ChannelEvent, CatchupResponse, Metadata } from './types';
|
|
3
|
+
export declare class Channel extends Emitter<ChannelEvent> {
|
|
4
|
+
private connected;
|
|
5
|
+
private config;
|
|
6
|
+
private socket;
|
|
7
|
+
private initialized;
|
|
8
|
+
private analyticsClient?;
|
|
9
|
+
constructor(config: Config);
|
|
10
|
+
getInitialized: () => boolean;
|
|
11
|
+
getConnected: () => boolean;
|
|
12
|
+
getSocket: () => Socket | null;
|
|
13
|
+
/**
|
|
14
|
+
* Connect to collab service using websockets
|
|
15
|
+
*/
|
|
16
|
+
connect(): void;
|
|
17
|
+
private onConnect;
|
|
18
|
+
private onReceiveData;
|
|
19
|
+
fetchCatchup(fromVersion: number): Promise<CatchupResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Send message to service. Timestamp will be added server side.
|
|
22
|
+
*/
|
|
23
|
+
broadcast<K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>): void;
|
|
24
|
+
sendMetadata(metadata: Metadata): void;
|
|
25
|
+
sendPresenceJoined(): void;
|
|
26
|
+
disconnect(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const socketIOReasons: {
|
|
2
|
+
IO_CLIENT_DISCONNECT: string;
|
|
3
|
+
IO_SERVER_DISCONNECT: string;
|
|
4
|
+
TRANSPORT_CLOSED: string;
|
|
5
|
+
TRANSPORT_ERROR: string;
|
|
6
|
+
PING_TIMEOUT: string;
|
|
7
|
+
};
|
|
8
|
+
export declare enum DisconnectReason {
|
|
9
|
+
CLIENT_DISCONNECT = "CLIENT_DISCONNECT",
|
|
10
|
+
SERVER_DISCONNECT = "SERVER_DISCONNECT",
|
|
11
|
+
SOCKET_CLOSED = "SOCKET_CLOSED",
|
|
12
|
+
SOCKET_ERROR = "SOCKET_ERROR",
|
|
13
|
+
SOCKET_TIMEOUT = "SOCKET_TIMEOUT",
|
|
14
|
+
UNKNOWN_DISCONNECT = "UNKNOWN_DISCONNECT"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class Emitter<T = any> {
|
|
2
|
+
private eventEmitter;
|
|
3
|
+
/**
|
|
4
|
+
* Emit events to subscribers
|
|
5
|
+
*/
|
|
6
|
+
protected emit<K extends keyof T>(evt: K, data: T[K]): this;
|
|
7
|
+
/**
|
|
8
|
+
* Subscribe to events emitted by this provider
|
|
9
|
+
*/
|
|
10
|
+
on<K extends keyof T>(evt: K, handler: (args: T[K]) => void): this;
|
|
11
|
+
/**
|
|
12
|
+
* Unsubscribe from events emitted by this provider
|
|
13
|
+
*/
|
|
14
|
+
off<K extends keyof T>(evt: K, handler: (args: T[K]) => void): this;
|
|
15
|
+
/**
|
|
16
|
+
* Unsubscribe from all events emitted by this provider.
|
|
17
|
+
*/
|
|
18
|
+
unsubscribeAll<K extends keyof T>(evt?: K): this;
|
|
19
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
internalError: {
|
|
28
|
+
code: string;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const errorCodeMapper: (error: ErrorPayload) => CollabErrorPayload | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ErrorPayload } from '../types';
|
|
2
|
+
export declare const ATTRIBUTES_PACKAGE = "collabProvider";
|
|
3
|
+
export declare const EVENT_SUBJECT = "collab";
|
|
4
|
+
export declare enum COLLAB_SERVICE {
|
|
5
|
+
NCS = "ncs",
|
|
6
|
+
SYNCHRONY = "synchrony"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EVENT_ACTION {
|
|
9
|
+
CONNECTION = "connection",
|
|
10
|
+
CATCHUP = "catchup",
|
|
11
|
+
DOCUMENT_INIT = "documentInit",
|
|
12
|
+
ADD_STEPS = "addSteps",
|
|
13
|
+
CONVERT_PM_TO_ADF = "convertPMToADF",
|
|
14
|
+
UPDATE_PARTICIPANTS = "updateParticipants"
|
|
15
|
+
}
|
|
16
|
+
export declare enum EVENT_STATUS {
|
|
17
|
+
SUCCESS = "SUCCESS",
|
|
18
|
+
FAILURE = "FAILURE"
|
|
19
|
+
}
|
|
20
|
+
export declare type AnalyticsEvent = {
|
|
21
|
+
eventAction: EVENT_ACTION;
|
|
22
|
+
attributes: {
|
|
23
|
+
documentAri?: string;
|
|
24
|
+
eventStatus?: EVENT_STATUS;
|
|
25
|
+
meetsSLO?: boolean;
|
|
26
|
+
latency?: number;
|
|
27
|
+
error?: ErrorPayload;
|
|
28
|
+
participants?: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const ACK_MAX_TRY = 10;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProductInformation } from '../types';
|
|
2
|
+
export declare const createLogger: (prefix: string, color?: string) => (msg: string, data?: any) => void;
|
|
3
|
+
export declare const getParticipant: (userId: string) => {
|
|
4
|
+
userId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
email: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
10
|
+
export declare const getProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
11
|
+
export declare const getSubProduct: (productInfo?: ProductInformation | undefined) => string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Provider } from './provider';
|
|
2
|
+
export type { CollabConnectedPayload, CollabDisconnectedPayload, CollabErrorPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabEvents, Socket, } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CatchupOptions } from '../types';
|
|
2
|
+
import { Mapping, Step } from 'prosemirror-transform';
|
|
3
|
+
/**
|
|
4
|
+
* Rebase the steps based on the mapping pipeline.
|
|
5
|
+
* Some steps could be lost, if they are no longer
|
|
6
|
+
* invalid after rebased.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rebaseSteps(steps: Step[], mapping: Mapping): Step[];
|
|
9
|
+
export declare const catchup: (opt: CatchupOptions) => Promise<void>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { Emitter } from '../emitter';
|
|
3
|
+
import { CollabEditProvider, ResolvedEditorState } from '@atlaskit/editor-common/collab';
|
|
4
|
+
import type { Config, Metadata, CollabEvents } from '../types';
|
|
5
|
+
import { SyncUpErrorFunction } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare const CATCHUP_THROTTLE: number;
|
|
7
|
+
export declare const MAX_STEP_REJECTED_ERROR = 15;
|
|
8
|
+
declare type BaseEvents = Pick<CollabEditProvider<CollabEvents>, 'setup' | 'send' | 'sendMessage'>;
|
|
9
|
+
export declare class Provider extends Emitter<CollabEvents> implements BaseEvents {
|
|
10
|
+
private participants;
|
|
11
|
+
private channel;
|
|
12
|
+
private config;
|
|
13
|
+
private getState;
|
|
14
|
+
private metadata;
|
|
15
|
+
private stepRejectCounter;
|
|
16
|
+
private analyticsClient?;
|
|
17
|
+
private isChannelInitialized;
|
|
18
|
+
private onSyncUpError?;
|
|
19
|
+
private sessionId?;
|
|
20
|
+
private clientId?;
|
|
21
|
+
private userId?;
|
|
22
|
+
private participantUpdateTimeout?;
|
|
23
|
+
private presenceUpdateTimeout?;
|
|
24
|
+
private disconnectedAt?;
|
|
25
|
+
constructor(config: Config);
|
|
26
|
+
private initializeChannel;
|
|
27
|
+
/**
|
|
28
|
+
* Called by collab plugin in editor when it's ready to
|
|
29
|
+
* initialize a collab session.
|
|
30
|
+
*/
|
|
31
|
+
initialize(getState: () => EditorState): this;
|
|
32
|
+
setup({ getState, onSyncUpError, }: {
|
|
33
|
+
getState: () => EditorState;
|
|
34
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
35
|
+
}): this;
|
|
36
|
+
/**
|
|
37
|
+
* We can use this function to throttle/delay
|
|
38
|
+
* Any send steps operation
|
|
39
|
+
*
|
|
40
|
+
* The getState function will return the current EditorState
|
|
41
|
+
* from the EditorView.
|
|
42
|
+
*/
|
|
43
|
+
private sendStepsFromCurrentState;
|
|
44
|
+
/**
|
|
45
|
+
* Send steps from transaction to other participants
|
|
46
|
+
*/
|
|
47
|
+
send(_tr: Transaction | null, _oldState: EditorState | null, newState: EditorState): void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when we receive steps from the service
|
|
50
|
+
*/
|
|
51
|
+
private onStepsAdded;
|
|
52
|
+
private throttledCatchup;
|
|
53
|
+
private fitlerQueue;
|
|
54
|
+
private updateDocumentWithMetadata;
|
|
55
|
+
private applyLocalsteps;
|
|
56
|
+
private getCurrentPmVersion;
|
|
57
|
+
private getUnconfirmedSteps;
|
|
58
|
+
/**
|
|
59
|
+
* Called when:
|
|
60
|
+
* * session established(offline -> online)
|
|
61
|
+
* * try to accept steps but version is behind.
|
|
62
|
+
*/
|
|
63
|
+
private catchup;
|
|
64
|
+
private onErrorHandled;
|
|
65
|
+
private pauseQueue?;
|
|
66
|
+
private queue;
|
|
67
|
+
private queueSteps;
|
|
68
|
+
private processQueue;
|
|
69
|
+
private processSteps;
|
|
70
|
+
/**
|
|
71
|
+
* Send messages, such as telepointers, to other participants.
|
|
72
|
+
*/
|
|
73
|
+
sendMessage(data: any): void;
|
|
74
|
+
private sendPresence;
|
|
75
|
+
/**
|
|
76
|
+
* Called when a participant joins the session.
|
|
77
|
+
*
|
|
78
|
+
* We keep track of participants internally in this class, and emit the `presence` event to update
|
|
79
|
+
* the active avatars in the editor.
|
|
80
|
+
* This method will be triggered from backend to notify all participants to exchange presence
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
private onPresenceJoined;
|
|
84
|
+
private onPresence;
|
|
85
|
+
/**
|
|
86
|
+
* Called when a metadata is changed.
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
private onMetadataChanged;
|
|
90
|
+
/**
|
|
91
|
+
* Called when a participant leaves the session.
|
|
92
|
+
*
|
|
93
|
+
* We emit the `presence` event to update the active avatars in the editor.
|
|
94
|
+
*/
|
|
95
|
+
private onParticipantLeft;
|
|
96
|
+
/**
|
|
97
|
+
* Called when we receive an update event from another participant.
|
|
98
|
+
*/
|
|
99
|
+
private onParticipantUpdated;
|
|
100
|
+
/**
|
|
101
|
+
* Called when we receive a telepointer update from another
|
|
102
|
+
* participant.
|
|
103
|
+
*/
|
|
104
|
+
private onParticipantTelepointer;
|
|
105
|
+
private updateParticipant;
|
|
106
|
+
/**
|
|
107
|
+
* Keep list of participants up to date. Filter out inactive users etc.
|
|
108
|
+
*/
|
|
109
|
+
private updateParticipants;
|
|
110
|
+
private emitTelepointersFromSteps;
|
|
111
|
+
private disconnectedReasonMapper;
|
|
112
|
+
private onDisconnected;
|
|
113
|
+
destroy(): this;
|
|
114
|
+
disconnect(): this;
|
|
115
|
+
setTitle(title: string, broadcast?: boolean): void;
|
|
116
|
+
setEditorWidth(editorWidth: string, broadcast?: boolean): void;
|
|
117
|
+
setMetadata(metadata: Metadata): void;
|
|
118
|
+
getFinalAcknowledgedState: () => Promise<ResolvedEditorState>;
|
|
119
|
+
/**
|
|
120
|
+
* Unsubscribe from all events emitted by this provider.
|
|
121
|
+
*/
|
|
122
|
+
unsubscribeAll(): this;
|
|
123
|
+
}
|
|
124
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Provider } from './provider';
|
|
2
|
+
import { Socket, Config, ProductInformation } from './types';
|
|
3
|
+
export declare function createSocketIOSocket(url: string, auth?: (cb: (data: object) => void) => void, productInfo?: ProductInformation): Socket;
|
|
4
|
+
export declare function createSocketIOCollabProvider(config: Omit<Config, 'createSocket'>): Provider;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { Transaction } from 'prosemirror-state';
|
|
2
|
+
import type { Step } from 'prosemirror-transform';
|
|
3
|
+
import type { CollabParticipant, CollabEventTelepointerData as EditorCollabTelepointerData, CollabEventConnectionData as EditorCollabConnetedData, CollabEventInitData as EditorCollabInitData, CollabEventRemoteData as EditorCollabData, CollabEventPresenceData as EditorCollabPresenceData } from '@atlaskit/editor-common/collab';
|
|
4
|
+
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
5
|
+
import type { Manager } from 'socket.io-client';
|
|
6
|
+
import type { DisconnectReason } from './disconnected-reason-mapper';
|
|
7
|
+
export interface Storage {
|
|
8
|
+
get(key: string): Promise<string>;
|
|
9
|
+
set(key: string, value: string): Promise<void>;
|
|
10
|
+
delete(key: string): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface Config {
|
|
13
|
+
url: string;
|
|
14
|
+
documentAri: string;
|
|
15
|
+
lifecycle?: Lifecycle;
|
|
16
|
+
storage?: Storage;
|
|
17
|
+
need404?: boolean;
|
|
18
|
+
createSocket: (path: string, auth?: (cb: (data: object) => void) => void, productInfo?: ProductInformation) => Socket;
|
|
19
|
+
analyticsClient?: AnalyticsWebClient;
|
|
20
|
+
getUser?(userId: string): Promise<Pick<CollabParticipant, 'avatar' | 'email' | 'name'> & {
|
|
21
|
+
userId: string;
|
|
22
|
+
}>;
|
|
23
|
+
permissionTokenRefresh?: () => Promise<string>;
|
|
24
|
+
productInfo?: ProductInformation;
|
|
25
|
+
}
|
|
26
|
+
interface SimpleEventEmitter {
|
|
27
|
+
on(event: string, fn: Function): SimpleEventEmitter;
|
|
28
|
+
}
|
|
29
|
+
export interface Socket extends SimpleEventEmitter {
|
|
30
|
+
id: string;
|
|
31
|
+
connect(): Socket;
|
|
32
|
+
emit(event: string, ...args: any[]): Socket;
|
|
33
|
+
close(): Socket;
|
|
34
|
+
io?: Manager;
|
|
35
|
+
}
|
|
36
|
+
export declare type LifecycleEvents = 'save' | 'restore';
|
|
37
|
+
export declare type EventHandler = () => void;
|
|
38
|
+
export interface Lifecycle {
|
|
39
|
+
on(event: LifecycleEvents, handler: EventHandler): void;
|
|
40
|
+
}
|
|
41
|
+
export declare type CollabConnectedPayload = EditorCollabConnetedData;
|
|
42
|
+
export interface CollabDisconnectedPayload {
|
|
43
|
+
reason: DisconnectReason;
|
|
44
|
+
sid: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CollabErrorPayload {
|
|
47
|
+
status: number;
|
|
48
|
+
code: string;
|
|
49
|
+
message: string;
|
|
50
|
+
reason?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CollabInitPayload extends EditorCollabInitData {
|
|
53
|
+
doc: any;
|
|
54
|
+
version: number;
|
|
55
|
+
userId?: string;
|
|
56
|
+
metadata?: Metadata;
|
|
57
|
+
}
|
|
58
|
+
export interface CollabDataPayload extends EditorCollabData {
|
|
59
|
+
version: number;
|
|
60
|
+
json: StepJson[];
|
|
61
|
+
userIds: string[];
|
|
62
|
+
}
|
|
63
|
+
export declare type CollabTelepointerPayload = EditorCollabTelepointerData;
|
|
64
|
+
export declare type CollabPresencePayload = EditorCollabPresenceData;
|
|
65
|
+
export declare type CollabMetadataPayload = Metadata;
|
|
66
|
+
export declare type CollabLocalStepsPayload = {
|
|
67
|
+
steps: Step[];
|
|
68
|
+
};
|
|
69
|
+
export interface CollabEvents {
|
|
70
|
+
'metadata:changed': CollabMetadataPayload;
|
|
71
|
+
init: CollabInitPayload;
|
|
72
|
+
connected: CollabConnectedPayload;
|
|
73
|
+
disconnected: CollabDisconnectedPayload;
|
|
74
|
+
data: CollabDataPayload;
|
|
75
|
+
telepointer: CollabTelepointerPayload;
|
|
76
|
+
presence: CollabPresencePayload;
|
|
77
|
+
'local-steps': CollabLocalStepsPayload;
|
|
78
|
+
error: CollabErrorPayload;
|
|
79
|
+
entity: any;
|
|
80
|
+
}
|
|
81
|
+
export interface Metadata {
|
|
82
|
+
[key: string]: string | number | boolean;
|
|
83
|
+
}
|
|
84
|
+
export declare type InitPayload = {
|
|
85
|
+
doc: any;
|
|
86
|
+
version: number;
|
|
87
|
+
userId?: string;
|
|
88
|
+
metadata?: Metadata;
|
|
89
|
+
};
|
|
90
|
+
export declare type PresencePayload = {
|
|
91
|
+
sessionId: string;
|
|
92
|
+
userId: string;
|
|
93
|
+
clientId: string;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
};
|
|
96
|
+
export declare type TelepointerPayload = PresencePayload & {
|
|
97
|
+
selection: {
|
|
98
|
+
type: 'textSelection' | 'nodeSelection';
|
|
99
|
+
anchor: number;
|
|
100
|
+
head: number;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export declare type StepJson = {
|
|
104
|
+
from?: number;
|
|
105
|
+
to?: number;
|
|
106
|
+
stepType?: string;
|
|
107
|
+
clientId: string;
|
|
108
|
+
userId: string;
|
|
109
|
+
};
|
|
110
|
+
export declare type StepsPayload = {
|
|
111
|
+
version: number;
|
|
112
|
+
steps: StepJson[];
|
|
113
|
+
};
|
|
114
|
+
export declare type ErrorPayload = {
|
|
115
|
+
message: string;
|
|
116
|
+
data?: {
|
|
117
|
+
status: number;
|
|
118
|
+
code?: string;
|
|
119
|
+
meta?: string | {
|
|
120
|
+
description: string;
|
|
121
|
+
reason?: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export declare type ChannelEvent = {
|
|
126
|
+
connected: {
|
|
127
|
+
sid: string;
|
|
128
|
+
initialized: boolean;
|
|
129
|
+
};
|
|
130
|
+
init: InitPayload;
|
|
131
|
+
reconnected: null;
|
|
132
|
+
'presence:joined': PresencePayload;
|
|
133
|
+
presence: PresencePayload;
|
|
134
|
+
'participant:left': PresencePayload;
|
|
135
|
+
'participant:telepointer': TelepointerPayload;
|
|
136
|
+
'participant:updated': PresencePayload;
|
|
137
|
+
'steps:commit': StepsPayload & {
|
|
138
|
+
userId: string;
|
|
139
|
+
};
|
|
140
|
+
'steps:added': StepsPayload;
|
|
141
|
+
'metadata:changed': Metadata;
|
|
142
|
+
error: ErrorPayload;
|
|
143
|
+
disconnect: {
|
|
144
|
+
reason: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export interface CatchupResponse {
|
|
148
|
+
doc?: string;
|
|
149
|
+
version?: number;
|
|
150
|
+
stepMaps?: any[];
|
|
151
|
+
metadata?: Metadata;
|
|
152
|
+
}
|
|
153
|
+
export interface CatchupOptions {
|
|
154
|
+
getCurrentPmVersion: () => number;
|
|
155
|
+
fetchCatchup: (fromVersion: number) => Promise<CatchupResponse>;
|
|
156
|
+
fitlerQueue: (condition: (stepsPayload: StepsPayload) => boolean) => void;
|
|
157
|
+
getUnconfirmedSteps: () => {
|
|
158
|
+
version: number;
|
|
159
|
+
steps: Step<any>[];
|
|
160
|
+
clientID: string | number;
|
|
161
|
+
origins: Transaction<any>[];
|
|
162
|
+
} | null | undefined;
|
|
163
|
+
updateDocumentWithMetadata: ({ doc, version, metadata, reserveCursor, }: CollabInitPayload) => void;
|
|
164
|
+
applyLocalsteps: (steps: Step[]) => void;
|
|
165
|
+
}
|
|
166
|
+
export declare type ProductInformation = {
|
|
167
|
+
product: string;
|
|
168
|
+
subProduct?: string;
|
|
169
|
+
};
|
|
170
|
+
export {};
|
package/emitter/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/emitter.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/emitter.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/emitter.d.ts"
|
|
7
|
+
"types": "../dist/types/emitter.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/emitter.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/error-code-mapper.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/error-code-mapper.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/error-code-mapper.d.ts"
|
|
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
|
+
}
|
|
8
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.2",
|
|
4
4
|
"description": "A provider for collaborative editing.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
">=4.0 <4.5": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.0/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
15
22
|
"sideEffects": false,
|
|
16
23
|
"atlaskit:src": "src/index.ts",
|
|
17
24
|
"atlassian": {
|
|
@@ -21,9 +28,9 @@
|
|
|
21
28
|
"releaseModel": "scheduled"
|
|
22
29
|
},
|
|
23
30
|
"dependencies": {
|
|
24
|
-
"@atlaskit/analytics-gas-types": "5.0.
|
|
31
|
+
"@atlaskit/analytics-gas-types": "5.0.9",
|
|
25
32
|
"@atlaskit/analytics-listeners": "^8.3.0",
|
|
26
|
-
"@atlaskit/editor-common": "^
|
|
33
|
+
"@atlaskit/editor-common": "^70.0.0",
|
|
27
34
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
28
35
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
29
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -45,13 +52,13 @@
|
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
54
|
"@atlaskit/adf-schema": "^24.0.0",
|
|
48
|
-
"@atlaskit/editor-test-helpers": "^17.
|
|
55
|
+
"@atlaskit/editor-test-helpers": "^17.2.0",
|
|
49
56
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
50
57
|
"@types/prosemirror-collab": "^1.1.1",
|
|
51
58
|
"@types/prosemirror-model": "^1.11.0",
|
|
52
59
|
"@types/prosemirror-state": "^1.2.0",
|
|
53
60
|
"prosemirror-model": "1.14.3",
|
|
54
|
-
"typescript": "4.
|
|
61
|
+
"typescript": "4.5.5"
|
|
55
62
|
},
|
|
56
63
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
57
64
|
}
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/collab-provider"
|
|
1
|
+
## API Report File for "@atlaskit/collab-provider".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
import type { AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
@@ -40,6 +42,7 @@ export declare interface CollabErrorPayload {
|
|
|
40
42
|
status: number;
|
|
41
43
|
code: string;
|
|
42
44
|
message: string;
|
|
45
|
+
reason?: string;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
export declare interface CollabEvents {
|
|
@@ -78,10 +81,11 @@ declare interface Config {
|
|
|
78
81
|
lifecycle?: Lifecycle;
|
|
79
82
|
storage?: Storage_2;
|
|
80
83
|
need404?: boolean;
|
|
81
|
-
createSocket(
|
|
84
|
+
createSocket: (
|
|
82
85
|
path: string,
|
|
83
86
|
auth?: (cb: (data: object) => void) => void,
|
|
84
|
-
|
|
87
|
+
productInfo?: ProductInformation,
|
|
88
|
+
) => Socket;
|
|
85
89
|
analyticsClient?: AnalyticsWebClient;
|
|
86
90
|
getUser?(
|
|
87
91
|
userId: string,
|
|
@@ -91,6 +95,7 @@ declare interface Config {
|
|
|
91
95
|
}
|
|
92
96
|
>;
|
|
93
97
|
permissionTokenRefresh?: () => Promise<string>;
|
|
98
|
+
productInfo?: ProductInformation;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
declare enum DisconnectReason {
|
|
@@ -134,6 +139,11 @@ declare interface Metadata_2 {
|
|
|
134
139
|
[key: string]: string | number | boolean;
|
|
135
140
|
}
|
|
136
141
|
|
|
142
|
+
declare type ProductInformation = {
|
|
143
|
+
product: string;
|
|
144
|
+
subProduct?: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
137
147
|
export declare class Provider
|
|
138
148
|
extends Emitter<CollabEvents>
|
|
139
149
|
implements BaseEvents {
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/socket-io-provider.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/socket-io-provider.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/socket-io-provider.d.ts"
|
|
7
|
+
"types": "../dist/types/socket-io-provider.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/socket-io-provider.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types.d.ts"
|
|
7
|
+
"types": "../dist/types/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|