@fileverse-dev/ddoc 3.0.62 → 3.0.64-rtc-patch-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +25401 -27156
- package/dist/package/extensions/mardown-paste-handler/mark-down-html-guard-plugin.d.ts +3 -0
- package/dist/package/hooks/use-tab-editor.d.ts +2 -2
- package/dist/package/hooks/use-yjs-setup.d.ts +3 -3
- package/dist/package/sync-local/SyncManager.d.ts +52 -0
- package/dist/package/sync-local/index.d.ts +3 -6
- package/dist/package/sync-local/socketClient.d.ts +17 -26
- package/dist/package/sync-local/types/index.d.ts +85 -120
- package/dist/package/sync-local/useSyncManager.d.ts +13 -0
- package/dist/package/sync-local/utils/createAwarenessUpdateHandler.d.ts +3 -3
- package/dist/package/use-ddoc-editor.d.ts +2 -2
- package/package.json +2 -6
- package/dist/package/hooks/use-rtc-websocket-disconnector.d.ts +0 -1
- package/dist/package/sync-local/actions/index.d.ts +0 -137
- package/dist/package/sync-local/actions/syncMachineActions.d.ts +0 -1
- package/dist/package/sync-local/constants/config.d.ts +0 -7
- package/dist/package/sync-local/constants/index.d.ts +0 -5
- package/dist/package/sync-local/guards/syncMachineGuards.d.ts +0 -10
- package/dist/package/sync-local/services/syncMachineServices.d.ts +0 -19
- package/dist/package/sync-local/syncMachine.d.ts +0 -13
- package/dist/package/sync-local/useSyncMachine.d.ts +0 -38
|
@@ -2,7 +2,7 @@ import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
|
2
2
|
import { DdocProps } from '../types';
|
|
3
3
|
import { AnyExtension, Editor } from '@tiptap/react';
|
|
4
4
|
import { ToCItemType } from '../components/toc/types';
|
|
5
|
-
import {
|
|
5
|
+
import { ConnectConfig } from '../sync-local/types';
|
|
6
6
|
|
|
7
7
|
import * as Y from 'yjs';
|
|
8
8
|
interface UseTabEditorArgs {
|
|
@@ -38,7 +38,7 @@ interface UseTabEditorArgs {
|
|
|
38
38
|
onInvalidContentError?: DdocProps['onInvalidContentError'];
|
|
39
39
|
ignoreCorruptedData?: boolean;
|
|
40
40
|
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
41
|
-
onConnect: (connectConfig:
|
|
41
|
+
onConnect: (connectConfig: ConnectConfig) => void;
|
|
42
42
|
hasCollabContentInitialised?: boolean;
|
|
43
43
|
initialiseYjsIndexedDbProvider: () => Promise<void>;
|
|
44
44
|
externalExtensions?: Record<string, AnyExtension>;
|
|
@@ -14,12 +14,12 @@ interface UseYjsSetupArgs {
|
|
|
14
14
|
onCollabSessionTermination?: () => void;
|
|
15
15
|
onUnMergedUpdates?: (state: boolean) => void;
|
|
16
16
|
}
|
|
17
|
-
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId,
|
|
17
|
+
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, onIndexedDbError, onCollabError, onCollaborationConnectCallback, onCollaborationCommit, onFetchCommitContent, onCollabSessionTermination, onUnMergedUpdates, }: UseYjsSetupArgs) => {
|
|
18
18
|
ydoc: Y.Doc;
|
|
19
|
-
onConnect: (connectConfig: import('../sync-local
|
|
19
|
+
onConnect: (connectConfig: import('../sync-local').ConnectConfig) => void;
|
|
20
20
|
isReady: boolean;
|
|
21
21
|
terminateSession: () => void;
|
|
22
|
-
awareness:
|
|
22
|
+
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
23
23
|
hasCollabContentInitialised: boolean;
|
|
24
24
|
initialiseYjsIndexedDbProvider: () => Promise<void>;
|
|
25
25
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SyncManagerConfig, ConnectConfig, SyncManagerSnapshot } from './types';
|
|
2
|
+
|
|
3
|
+
export declare class SyncManager {
|
|
4
|
+
private onStateChange;
|
|
5
|
+
private _status;
|
|
6
|
+
private _isConnected;
|
|
7
|
+
private _isReady;
|
|
8
|
+
private _errorMessage;
|
|
9
|
+
private _awareness;
|
|
10
|
+
private _initialDocumentDecryptionState;
|
|
11
|
+
private socketClient;
|
|
12
|
+
private roomKey;
|
|
13
|
+
private roomKeyBytes;
|
|
14
|
+
private isOwner;
|
|
15
|
+
private updateQueue;
|
|
16
|
+
private uncommittedUpdatesIdList;
|
|
17
|
+
private contentTobeAppliedQueue;
|
|
18
|
+
private isProcessing;
|
|
19
|
+
private errorCount;
|
|
20
|
+
private _awarenessUpdateHandler;
|
|
21
|
+
private ydoc;
|
|
22
|
+
private onError?;
|
|
23
|
+
private onCollaborationConnectCallback?;
|
|
24
|
+
private onCollaborationCommit?;
|
|
25
|
+
private onFetchCommitContent?;
|
|
26
|
+
private onSessionTerminated?;
|
|
27
|
+
private onUnMergedUpdates?;
|
|
28
|
+
private onLocalUpdate?;
|
|
29
|
+
constructor(config: SyncManagerConfig, onStateChange: (snapshot: SyncManagerSnapshot) => void);
|
|
30
|
+
private notify;
|
|
31
|
+
private setStatus;
|
|
32
|
+
connect(config: ConnectConfig): Promise<void>;
|
|
33
|
+
disconnect(): Promise<void>;
|
|
34
|
+
terminateSession(): Promise<void>;
|
|
35
|
+
enqueueLocalUpdate(update: Uint8Array): void;
|
|
36
|
+
initializeAwareness(): void;
|
|
37
|
+
forceCleanup(): void;
|
|
38
|
+
private handleReconnection;
|
|
39
|
+
private connectSocket;
|
|
40
|
+
private syncLatestCommit;
|
|
41
|
+
private commitLocalContents;
|
|
42
|
+
private broadcastLocalContents;
|
|
43
|
+
private processUpdateQueue;
|
|
44
|
+
private processNextUpdate;
|
|
45
|
+
private processCommit;
|
|
46
|
+
private handleRemoteContentUpdate;
|
|
47
|
+
private applyRemoteYjsUpdate;
|
|
48
|
+
private applyQueuedRemoteContents;
|
|
49
|
+
private withRetry;
|
|
50
|
+
private disconnectInternal;
|
|
51
|
+
private reset;
|
|
52
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { useSyncMachine } from './useSyncMachine';
|
|
5
|
-
export { syncMachine };
|
|
6
|
-
export type { SyncMachineContext };
|
|
1
|
+
export { useSyncManager } from './useSyncManager';
|
|
2
|
+
export { SyncManager } from './SyncManager';
|
|
3
|
+
export type { SyncManagerConfig, ConnectConfig, SyncStatus, SyncManagerSnapshot, } from './types';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ISocketInitConfig, RoomMember, SocketStatusEnum, SendUpdateResponse, CommitResponse } from './types';
|
|
1
|
+
import { ISocketInitConfig, RoomMember, SocketStatusEnum, SendUpdateResponse, CommitResponse, AckResponse } from './types';
|
|
3
2
|
import { Awareness } from 'y-protocols/awareness.js';
|
|
4
3
|
|
|
5
4
|
interface ISocketClientConfig {
|
|
6
|
-
wsUrl:
|
|
5
|
+
wsUrl: string;
|
|
7
6
|
roomKey: string;
|
|
7
|
+
roomId: string;
|
|
8
8
|
ownerEdSecret?: string;
|
|
9
9
|
contractAddress?: string;
|
|
10
10
|
ownerAddress?: string;
|
|
11
11
|
onCollaborationConnectCallback: (response: any) => void;
|
|
12
|
+
onError?: (e: Error) => void;
|
|
12
13
|
roomInfo?: {
|
|
13
14
|
documentTitle: string;
|
|
14
15
|
portalAddress: string;
|
|
@@ -16,14 +17,12 @@ interface ISocketClientConfig {
|
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
export declare class SocketClient {
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_webSocketStatus: SocketStatusEnum;
|
|
26
|
-
private _webSocket;
|
|
20
|
+
private _socketUrl;
|
|
21
|
+
private _socket;
|
|
22
|
+
private _webSocketStatus;
|
|
23
|
+
private _isIntentionalDisconnect;
|
|
24
|
+
get isConnected(): boolean;
|
|
25
|
+
get status(): SocketStatusEnum;
|
|
27
26
|
private _websocketServiceDid;
|
|
28
27
|
private roomId;
|
|
29
28
|
roomMembers: RoomMember[];
|
|
@@ -39,11 +38,8 @@ export declare class SocketClient {
|
|
|
39
38
|
_onError: ISocketInitConfig['onError'] | null;
|
|
40
39
|
_onCollaborationConnectCallback: ISocketClientConfig['onCollaborationConnectCallback'] | null;
|
|
41
40
|
constructor(config: ISocketClientConfig);
|
|
42
|
-
private _getSequenceIdCallback;
|
|
43
|
-
private _removeSequenceIdFromMap;
|
|
44
41
|
registerAwareness(awareness: Awareness): void;
|
|
45
|
-
private
|
|
46
|
-
private _sendNetworkRequest;
|
|
42
|
+
private _emitWithAck;
|
|
47
43
|
private _fetchRoomMembers;
|
|
48
44
|
sendUpdate({ update }: {
|
|
49
45
|
update: string;
|
|
@@ -52,24 +48,19 @@ export declare class SocketClient {
|
|
|
52
48
|
updates: string[];
|
|
53
49
|
cid: string;
|
|
54
50
|
}): Promise<CommitResponse>;
|
|
55
|
-
fetchLatestCommit(): Promise<any
|
|
56
|
-
getUncommittedChanges(): Promise<any
|
|
57
|
-
broadcastAwareness(awarenessUpdate: string): Promise<
|
|
58
|
-
disconnect: (
|
|
51
|
+
fetchLatestCommit(): Promise<AckResponse<any>>;
|
|
52
|
+
getUncommittedChanges(): Promise<AckResponse<any>>;
|
|
53
|
+
broadcastAwareness(awarenessUpdate: string): Promise<void>;
|
|
54
|
+
disconnect: () => void;
|
|
59
55
|
terminateSession: () => Promise<void>;
|
|
60
|
-
private _buildRequest;
|
|
61
56
|
private getCollaborationKeyPair;
|
|
62
57
|
private isUcanValid;
|
|
63
58
|
private getOwnerToken;
|
|
64
59
|
private buildSessionToken;
|
|
65
60
|
private _handleHandShake;
|
|
66
|
-
private
|
|
67
|
-
|
|
61
|
+
private _handleAwarenessUpdate;
|
|
62
|
+
connectSocket(config: ISocketInitConfig): Promise<void>;
|
|
68
63
|
private _onSessionTerminated;
|
|
69
|
-
private _processMessage;
|
|
70
|
-
private _clearSequenceCallbackMap;
|
|
71
|
-
connectSocket(): Promise<void> | undefined;
|
|
72
|
-
init(config: ISocketInitConfig): Promise<void>;
|
|
73
64
|
private resetSocketClient;
|
|
74
65
|
}
|
|
75
66
|
export {};
|
|
@@ -1,130 +1,108 @@
|
|
|
1
1
|
import { Data } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
|
|
4
4
|
import * as Y from 'yjs';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export declare enum SyncStatus {
|
|
6
|
+
DISCONNECTED = "disconnected",
|
|
7
|
+
CONNECTING = "connecting",
|
|
8
|
+
SYNCING = "syncing",
|
|
9
|
+
CONNECTED = "connected",
|
|
10
|
+
PROCESSING = "processing",
|
|
11
|
+
DISCONNECTING = "disconnecting"
|
|
9
12
|
}
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
updateType: string;
|
|
20
|
-
};
|
|
21
|
-
is_handshake_response: boolean;
|
|
22
|
-
status: boolean;
|
|
23
|
-
statusCode: number;
|
|
13
|
+
export interface SyncManagerConfig {
|
|
14
|
+
ydoc: Y.Doc;
|
|
15
|
+
onError?: (e: Error) => void;
|
|
16
|
+
onCollaborationConnectCallback?: (response: any) => void;
|
|
17
|
+
onCollaborationCommit?: (file: File) => Promise<string>;
|
|
18
|
+
onFetchCommitContent?: (cid: string) => Promise<any>;
|
|
19
|
+
onSessionTerminated?: () => void;
|
|
20
|
+
onUnMergedUpdates?: (state: boolean) => void;
|
|
21
|
+
onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
|
|
24
22
|
}
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
export interface ConnectConfig {
|
|
24
|
+
username?: string;
|
|
25
|
+
roomKey: string;
|
|
26
|
+
roomId: string;
|
|
27
|
+
isOwner: boolean;
|
|
28
|
+
ownerEdSecret?: string;
|
|
29
|
+
contractAddress?: string;
|
|
30
|
+
ownerAddress?: string;
|
|
31
|
+
isEns?: boolean;
|
|
32
|
+
wsUrl: string;
|
|
33
|
+
roomInfo?: {
|
|
34
|
+
documentTitle: string;
|
|
35
|
+
portalAddress: string;
|
|
36
|
+
commentKey: string;
|
|
33
37
|
};
|
|
34
|
-
is_handshake_response: boolean;
|
|
35
|
-
status: boolean;
|
|
36
|
-
statusCode: number;
|
|
37
38
|
}
|
|
38
|
-
export interface
|
|
39
|
-
|
|
40
|
-
socketClient: SocketClient | null;
|
|
41
|
-
roomId: string;
|
|
42
|
-
username: string;
|
|
43
|
-
roomMembers: IRoomMember[];
|
|
39
|
+
export interface SyncManagerSnapshot {
|
|
40
|
+
status: SyncStatus;
|
|
44
41
|
isConnected: boolean;
|
|
45
|
-
awareness: any;
|
|
46
|
-
_awarenessUpdateHandler: (({ added, updated, removed, }: {
|
|
47
|
-
added: number[];
|
|
48
|
-
updated: number[];
|
|
49
|
-
removed: number[];
|
|
50
|
-
}) => void) | null;
|
|
51
|
-
onError: ((e: Error) => void) | null;
|
|
52
|
-
roomKey: string;
|
|
53
|
-
wsUrl: string;
|
|
54
|
-
uncommittedUpdatesIdList: string[];
|
|
55
|
-
isOwner: boolean;
|
|
56
|
-
updateQueue: Uint8Array[];
|
|
57
42
|
isReady: boolean;
|
|
58
|
-
isNewDoc: boolean;
|
|
59
|
-
contentTobeAppliedQueue: string[];
|
|
60
|
-
initialUpdate: string | null;
|
|
61
|
-
errorCount: number;
|
|
62
|
-
errorMaxRetryCount: number;
|
|
63
43
|
errorMessage: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onCollaborationCommit: (file: File) => Promise<string>;
|
|
67
|
-
onFetchCommitContent: (cid: string) => Promise<any>;
|
|
68
|
-
onSessionTerminated: () => void;
|
|
69
|
-
onUnMergedUpdates: (state: boolean) => void;
|
|
70
|
-
onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
|
|
44
|
+
awareness: Awareness | null;
|
|
45
|
+
initialDocumentDecryptionState: 'done' | 'pending';
|
|
71
46
|
}
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
export declare enum ServerErrorCode {
|
|
48
|
+
AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",
|
|
49
|
+
AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID",
|
|
50
|
+
SESSION_NOT_FOUND = "SESSION_NOT_FOUND",
|
|
51
|
+
SESSION_TERMINATED = "SESSION_TERMINATED",
|
|
52
|
+
SESSION_DID_MISSING = "SESSION_DID_MISSING",
|
|
53
|
+
DOCUMENT_ID_MISSING = "DOCUMENT_ID_MISSING",
|
|
54
|
+
UPDATE_DATA_MISSING = "UPDATE_DATA_MISSING",
|
|
55
|
+
COMMIT_UNAUTHORIZED = "COMMIT_UNAUTHORIZED",
|
|
56
|
+
COMMIT_MISSING_DATA = "COMMIT_MISSING_DATA",
|
|
57
|
+
INVALID_ADDRESS = "INVALID_ADDRESS",
|
|
58
|
+
NOT_AUTHENTICATED = "NOT_AUTHENTICATED",
|
|
59
|
+
DB_ERROR = "DB_ERROR",
|
|
60
|
+
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
81
61
|
}
|
|
82
|
-
export interface
|
|
62
|
+
export interface AckResponse<T = Record<string, any>> {
|
|
83
63
|
status: boolean;
|
|
84
64
|
statusCode: number;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
[key: string]: any;
|
|
89
|
-
};
|
|
65
|
+
data?: T;
|
|
66
|
+
error?: string;
|
|
67
|
+
errorCode?: ServerErrorCode;
|
|
90
68
|
}
|
|
91
|
-
export interface
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
export type RequestResponse = ErrorResponseMessage | SuccessResponseMessage;
|
|
100
|
-
export type OnMessagePayloadType = RequestResponse | EventMessage;
|
|
101
|
-
export type EventHandler = (message: EventMessage) => void;
|
|
102
|
-
export type DisconnectHandler = (e: CloseEvent | ErrorEvent) => void;
|
|
103
|
-
export type ConnectHandler = () => void;
|
|
104
|
-
export interface PartialRequest {
|
|
105
|
-
cmd: string;
|
|
106
|
-
args: {
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
export interface RequestPayload extends PartialRequest {
|
|
111
|
-
seqId: string;
|
|
69
|
+
export interface SendUpdateResponse extends AckResponse<{
|
|
70
|
+
id: string;
|
|
71
|
+
documentId: string;
|
|
72
|
+
data: string;
|
|
73
|
+
updateType: string;
|
|
74
|
+
commitCid: string | null;
|
|
75
|
+
createdAt: number;
|
|
76
|
+
}> {
|
|
112
77
|
}
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
78
|
+
export interface CommitResponse extends AckResponse<{
|
|
79
|
+
cid: string;
|
|
80
|
+
createdAt: number;
|
|
81
|
+
documentId: string;
|
|
82
|
+
updates: string[];
|
|
83
|
+
}> {
|
|
116
84
|
}
|
|
117
|
-
export type SequenceToRequestMap = {
|
|
118
|
-
[key: string]: SequenceToRequestMapValue;
|
|
119
|
-
};
|
|
120
|
-
export type Update = Uint8Array;
|
|
121
85
|
export interface ISocketInitConfig {
|
|
122
|
-
onConnect:
|
|
123
|
-
onDisconnect:
|
|
86
|
+
onConnect: () => void;
|
|
87
|
+
onDisconnect: () => void;
|
|
124
88
|
onError: (err: Error) => void;
|
|
125
|
-
onWsEvent: EventHandler;
|
|
126
89
|
onHandShakeError: (err: Error) => void;
|
|
127
|
-
|
|
90
|
+
onContentUpdate: (data: {
|
|
91
|
+
id: string;
|
|
92
|
+
data: string;
|
|
93
|
+
createdAt: number;
|
|
94
|
+
roomId: string;
|
|
95
|
+
}) => void;
|
|
96
|
+
onMembershipChange: (data: {
|
|
97
|
+
action: string;
|
|
98
|
+
user: {
|
|
99
|
+
role: string;
|
|
100
|
+
};
|
|
101
|
+
roomId: string;
|
|
102
|
+
}) => void;
|
|
103
|
+
onSessionTerminated: (data: {
|
|
104
|
+
roomId: string;
|
|
105
|
+
}) => void;
|
|
128
106
|
}
|
|
129
107
|
export declare enum SocketStatusEnum {
|
|
130
108
|
CLOSED = "CLOSED",
|
|
@@ -138,19 +116,6 @@ export interface RoomMember {
|
|
|
138
116
|
userId: string;
|
|
139
117
|
role: 'owner' | 'editor';
|
|
140
118
|
}
|
|
141
|
-
export type IAesKey = string;
|
|
142
|
-
export type SyncMachinEvent = {
|
|
143
|
-
type: string;
|
|
144
|
-
data: any;
|
|
145
|
-
};
|
|
146
|
-
export interface IpfsUploadResponse {
|
|
147
|
-
ipfsUrl: string;
|
|
148
|
-
ipfsHash: string;
|
|
149
|
-
ipfsStorage: string;
|
|
150
|
-
cachedUrl: string;
|
|
151
|
-
fileSize: number;
|
|
152
|
-
mimetype: string;
|
|
153
|
-
}
|
|
154
119
|
export interface IAuthArgs {
|
|
155
120
|
collaborationToken: string;
|
|
156
121
|
documentId: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SyncManagerConfig, SyncStatus, ConnectConfig } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const useSyncManager: (config: SyncManagerConfig) => {
|
|
4
|
+
connect: (connectConfig: ConnectConfig) => void;
|
|
5
|
+
disconnect: () => void;
|
|
6
|
+
terminateSession: () => void;
|
|
7
|
+
isConnected: boolean;
|
|
8
|
+
isReady: boolean;
|
|
9
|
+
error: string;
|
|
10
|
+
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
11
|
+
hasCollabContentInitialised: boolean;
|
|
12
|
+
status: SyncStatus;
|
|
13
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
2
|
-
import {
|
|
2
|
+
import { SocketClient } from '../socketClient';
|
|
3
3
|
|
|
4
|
-
export declare const createAwarenessUpdateHandler: (awareness: Awareness,
|
|
4
|
+
export declare const createAwarenessUpdateHandler: (awareness: Awareness, socketClient: SocketClient, roomKey: string) => ({ added, updated, removed }: {
|
|
5
5
|
added: number[];
|
|
6
6
|
updated: number[];
|
|
7
7
|
removed: number[];
|
|
8
|
-
}) => void;
|
|
8
|
+
}, origin: any) => void;
|
|
@@ -3,7 +3,7 @@ import { Editor } from '@tiptap/react';
|
|
|
3
3
|
|
|
4
4
|
export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHistoryState, enableCollaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, collabConfig, onIndexedDbError, disableInlineComment, ...rest }: Partial<DdocProps>) => {
|
|
5
5
|
ydoc: import('yjs').Doc;
|
|
6
|
-
awareness:
|
|
6
|
+
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
7
7
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
|
8
8
|
terminateSession: () => void;
|
|
9
9
|
isContentLoading: boolean;
|
|
@@ -21,7 +21,7 @@ export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHis
|
|
|
21
21
|
}) => void;
|
|
22
22
|
duplicateTab: (tabId: string) => string | undefined;
|
|
23
23
|
orderTab: (destinationTabId: string, movedTabId: string) => void;
|
|
24
|
-
onConnect: (connectConfig: import('./sync-local
|
|
24
|
+
onConnect: (connectConfig: import('./sync-local').ConnectConfig) => void;
|
|
25
25
|
isReady: boolean;
|
|
26
26
|
hasCollabContentInitialised: boolean;
|
|
27
27
|
initialiseYjsIndexedDbProvider: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fileverse-dev/ddoc",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "DDoc",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.64-rtc-patch-1",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"exports": {
|
|
@@ -76,8 +76,6 @@
|
|
|
76
76
|
"@tiptap/suggestion": "^3.11.0",
|
|
77
77
|
"@types/uuid": "^10.0.0",
|
|
78
78
|
"@ucans/ucans": "^0.12.0",
|
|
79
|
-
"@xstate-ninja/react": "^1.1.3",
|
|
80
|
-
"@xstate/react": "^3.2.2",
|
|
81
79
|
"base64-js": "^1.5.1",
|
|
82
80
|
"classnames": "^2.5.1",
|
|
83
81
|
"color": "^5.0.3",
|
|
@@ -95,7 +93,7 @@
|
|
|
95
93
|
"mammoth": "^1.10.0",
|
|
96
94
|
"markdown-it-footnote": "^4.0.0",
|
|
97
95
|
"ollama": "^0.5.14",
|
|
98
|
-
"
|
|
96
|
+
"socket.io-client": "^4.7.5",
|
|
99
97
|
"platform": "^1.3.6",
|
|
100
98
|
"prosemirror-model": "^1.21.0",
|
|
101
99
|
"prosemirror-state": "^1.4.3",
|
|
@@ -111,8 +109,6 @@
|
|
|
111
109
|
"vaul": "^0.9.1",
|
|
112
110
|
"vite-plugin-dts": "^3.6.3",
|
|
113
111
|
"ws": "^8.18.0",
|
|
114
|
-
"xstate": "^4.38.2",
|
|
115
|
-
"xstate-ninja": "^1.3.10",
|
|
116
112
|
"y-indexeddb": "^9.0.12",
|
|
117
113
|
"y-prosemirror": "^1.2.5",
|
|
118
114
|
"y-protocols": "^1.0.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useRtcWebsocketDisconnector: (syncState: any, enableCollaboration: boolean | undefined) => void;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { SyncMachineContext, SyncMachinEvent } from '../types';
|
|
2
|
-
import { SocketClient } from '../socketClient';
|
|
3
|
-
|
|
4
|
-
import * as awarenessProtocol from 'y-protocols/awareness';
|
|
5
|
-
export declare const initAwarenessHandler: (context: SyncMachineContext) => {
|
|
6
|
-
awareness: awarenessProtocol.Awareness;
|
|
7
|
-
_awarenessUpdateHandler: ({ added, updated, removed, }: {
|
|
8
|
-
added: number[];
|
|
9
|
-
updated: number[];
|
|
10
|
-
removed: number[];
|
|
11
|
-
}) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const updateConnectionStateHandler: (context: SyncMachineContext) => {
|
|
14
|
-
isConnected: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare const websocketInitializer: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
17
|
-
socketClient: SocketClient;
|
|
18
|
-
initialUpdate: any;
|
|
19
|
-
roomKey: any;
|
|
20
|
-
roomId: any;
|
|
21
|
-
isOwner: any;
|
|
22
|
-
isEns: any;
|
|
23
|
-
wsUrl: any;
|
|
24
|
-
onCollaborationCommit: (file: File) => Promise<string>;
|
|
25
|
-
onFetchCommitContent: (cid: string) => Promise<any>;
|
|
26
|
-
onSessionTerminated: () => void;
|
|
27
|
-
onUnMergedUpdates: (state: boolean) => void;
|
|
28
|
-
onLocalUpdate: ((updatedDocContent: import('../../types').Data["editorJSONData"], updateChunk: string) => void) | undefined;
|
|
29
|
-
};
|
|
30
|
-
export declare const yjsUpdateHandler: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
31
|
-
uncommittedUpdatesIdList?: undefined;
|
|
32
|
-
} | {
|
|
33
|
-
uncommittedUpdatesIdList: any[];
|
|
34
|
-
};
|
|
35
|
-
export declare const roomMemberUpdateHandler: (context: SyncMachineContext) => {
|
|
36
|
-
roomMembers: import('../types').RoomMember[];
|
|
37
|
-
};
|
|
38
|
-
export declare const stateResetHandler: () => {
|
|
39
|
-
roomMembers: never[];
|
|
40
|
-
isConnected: boolean;
|
|
41
|
-
awareness: null;
|
|
42
|
-
_awarenessUpdateHandler: null;
|
|
43
|
-
socketClient: null;
|
|
44
|
-
};
|
|
45
|
-
export declare const registerUpdateHandler: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
46
|
-
uncommittedUpdatesIdList?: undefined;
|
|
47
|
-
} | {
|
|
48
|
-
uncommittedUpdatesIdList: any[];
|
|
49
|
-
};
|
|
50
|
-
export declare const removeLastProcessedUpdate: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
51
|
-
updateQueue: Uint8Array<ArrayBufferLike>[];
|
|
52
|
-
};
|
|
53
|
-
export declare const clearUncommitedUpdatesHandler: () => {
|
|
54
|
-
uncommittedUpdatesIdList: never[];
|
|
55
|
-
};
|
|
56
|
-
export declare const addUpdateToQueueHandler: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
57
|
-
updateQueue: any[];
|
|
58
|
-
};
|
|
59
|
-
export declare const updateConnectionReadyStateHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
60
|
-
isReady: any;
|
|
61
|
-
};
|
|
62
|
-
export declare const setNewDocFlagHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
63
|
-
isNewDoc: any;
|
|
64
|
-
};
|
|
65
|
-
export declare const commitUncommittedIdsHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
66
|
-
uncommittedUpdatesIdList: any;
|
|
67
|
-
};
|
|
68
|
-
export declare const setConnectionActiveStateHandler: (context: SyncMachineContext) => {
|
|
69
|
-
isConnected: boolean;
|
|
70
|
-
};
|
|
71
|
-
export declare const setMachineReadyStateHandler: () => {
|
|
72
|
-
isReady: boolean;
|
|
73
|
-
};
|
|
74
|
-
export declare const addRemoteContentToQueueHandler: (context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
75
|
-
contentTobeAppliedQueue: any[];
|
|
76
|
-
};
|
|
77
|
-
export declare const applyContentsFromRemote: (context: SyncMachineContext) => {
|
|
78
|
-
contentTobeAppliedQueue?: undefined;
|
|
79
|
-
} | {
|
|
80
|
-
contentTobeAppliedQueue: never[];
|
|
81
|
-
};
|
|
82
|
-
export declare const clearErrorCountHandler: () => {
|
|
83
|
-
errorCount: number;
|
|
84
|
-
errorMessage: string;
|
|
85
|
-
};
|
|
86
|
-
export declare const updateErrorCountHandler: (context: SyncMachineContext) => {
|
|
87
|
-
errorCount: number;
|
|
88
|
-
};
|
|
89
|
-
export declare const setCommitMessageErrorHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
90
|
-
errorMessage: string;
|
|
91
|
-
};
|
|
92
|
-
export declare const setUpdateErrorMessageHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
93
|
-
errorMessage: string;
|
|
94
|
-
};
|
|
95
|
-
export declare const setConnectionErrorMessageHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
96
|
-
errorMessage: string;
|
|
97
|
-
};
|
|
98
|
-
export declare const setIpfsQueryErrorMessageHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
99
|
-
errorMessage: string;
|
|
100
|
-
};
|
|
101
|
-
export declare const setInitialCommitErrorMessageHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
102
|
-
errorMessage: string;
|
|
103
|
-
};
|
|
104
|
-
export declare const setInitialUpdateErrorMessageHandler: (_context: SyncMachineContext, event: SyncMachinEvent) => {
|
|
105
|
-
errorMessage: string;
|
|
106
|
-
};
|
|
107
|
-
export declare const disconnectedStateHandler: () => {
|
|
108
|
-
socketClient: null;
|
|
109
|
-
roomMembers: never[];
|
|
110
|
-
isConnected: boolean;
|
|
111
|
-
awareness: null;
|
|
112
|
-
_awarenessUpdateHandler: null;
|
|
113
|
-
uncommittedUpdatesIdList: never[];
|
|
114
|
-
updateQueue: never[];
|
|
115
|
-
};
|
|
116
|
-
export declare const terminateSessionHandler: (context: SyncMachineContext) => {
|
|
117
|
-
socketClient: null;
|
|
118
|
-
roomId: string;
|
|
119
|
-
roomMembers: never[];
|
|
120
|
-
isConnected: boolean;
|
|
121
|
-
awareness: null;
|
|
122
|
-
_awarenessUpdateHandler: null;
|
|
123
|
-
roomKey: string;
|
|
124
|
-
wsUrl: string;
|
|
125
|
-
uncommittedUpdatesIdList: never[];
|
|
126
|
-
updateQueue: never[];
|
|
127
|
-
isOwner: boolean;
|
|
128
|
-
isReady: boolean;
|
|
129
|
-
isNewDoc: boolean;
|
|
130
|
-
contentTobeAppliedQueue: never[];
|
|
131
|
-
initialUpdate: null;
|
|
132
|
-
errorCount: number;
|
|
133
|
-
errorMessage: string;
|
|
134
|
-
};
|
|
135
|
-
export declare const setDocumentDecryptionStateHandler: (_: SyncMachineContext, event: SyncMachinEvent) => {
|
|
136
|
-
initalDocumentDecryptionState: any;
|
|
137
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const syncMachineActions: Record<any, any>;
|