@fileverse-dev/ddoc 3.0.56-patch-3 → 3.0.57-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 +26993 -28921
- package/dist/package/components/inline-comment/context/comment-context.d.ts +1 -1
- package/dist/package/components/inline-comment/context/types.d.ts +5 -7
- 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 +54 -0
- package/dist/package/sync-local/index.d.ts +3 -6
- package/dist/package/sync-local/socketClient.d.ts +16 -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 +2 -2
- package/dist/package/types.d.ts +4 -10
- package/dist/package/use-ddoc-editor.d.ts +2 -2
- package/package.json +3 -7
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentContextType, CommentProviderProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentProvider: ({ children, editor,
|
|
3
|
+
export declare const CommentProvider: ({ children, editor, initialComments, setInitialComments, username, setUsername, activeCommentId, setActiveCommentId, activeTabId, focusCommentWithActiveId, onNewComment, onCommentReply, ensResolutionUrl, onResolveComment, onUnresolveComment, onDeleteComment, isConnected, connectViaWallet, isLoading, connectViaUsername, isDDocOwner, onInlineComment, onComment, setCommentDrawerOpen, }: CommentProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const useComments: () => CommentContextType;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { IComment } from '../../../extensions/comment';
|
|
3
3
|
import { SetStateAction } from 'react';
|
|
4
|
-
import { CommentAccountProps
|
|
4
|
+
import { CommentAccountProps } from '../../../types';
|
|
5
5
|
import { EnsStatus } from '../types';
|
|
6
6
|
|
|
7
|
-
import * as Y from 'yjs';
|
|
8
7
|
export interface CommentContextType extends CommentAccountProps {
|
|
9
8
|
comments: IComment[];
|
|
10
9
|
setComments: React.Dispatch<SetStateAction<IComment[]>>;
|
|
@@ -69,14 +68,13 @@ export interface CommentContextType extends CommentAccountProps {
|
|
|
69
68
|
export interface CommentProviderProps extends CommentAccountProps {
|
|
70
69
|
children: React.ReactNode;
|
|
71
70
|
editor: Editor;
|
|
72
|
-
ydoc: Y.Doc;
|
|
73
71
|
initialComments?: IComment[];
|
|
74
72
|
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
|
75
73
|
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
76
|
-
onNewComment?: (newComment: IComment
|
|
77
|
-
onResolveComment?: (activeCommentId: string
|
|
78
|
-
onUnresolveComment?: (activeCommentId: string
|
|
79
|
-
onDeleteComment?: (activeCommentId: string
|
|
74
|
+
onNewComment?: (newComment: IComment) => void;
|
|
75
|
+
onResolveComment?: (activeCommentId: string) => void;
|
|
76
|
+
onUnresolveComment?: (activeCommentId: string) => void;
|
|
77
|
+
onDeleteComment?: (activeCommentId: string) => void;
|
|
80
78
|
username: string | null;
|
|
81
79
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
82
80
|
activeCommentId: string | null;
|
|
@@ -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,54 @@
|
|
|
1
|
+
import { SyncManagerConfig, ConnectConfig, SyncManagerSnapshot } from './types';
|
|
2
|
+
|
|
3
|
+
export declare class SyncManager {
|
|
4
|
+
private _status;
|
|
5
|
+
private _isConnected;
|
|
6
|
+
private _isReady;
|
|
7
|
+
private _errorMessage;
|
|
8
|
+
private _awareness;
|
|
9
|
+
private _initialDocumentDecryptionState;
|
|
10
|
+
private socketClient;
|
|
11
|
+
private roomKey;
|
|
12
|
+
private roomKeyBytes;
|
|
13
|
+
private isOwner;
|
|
14
|
+
private updateQueue;
|
|
15
|
+
private uncommittedUpdatesIdList;
|
|
16
|
+
private contentTobeAppliedQueue;
|
|
17
|
+
private isProcessing;
|
|
18
|
+
private errorCount;
|
|
19
|
+
private _awarenessUpdateHandler;
|
|
20
|
+
private ydoc;
|
|
21
|
+
private onError?;
|
|
22
|
+
private onCollaborationConnectCallback?;
|
|
23
|
+
private onCollaborationCommit?;
|
|
24
|
+
private onFetchCommitContent?;
|
|
25
|
+
private onSessionTerminated?;
|
|
26
|
+
private onUnMergedUpdates?;
|
|
27
|
+
private onLocalUpdate?;
|
|
28
|
+
private listeners;
|
|
29
|
+
private cachedSnapshot;
|
|
30
|
+
constructor(config: SyncManagerConfig);
|
|
31
|
+
subscribe: (listener: () => void) => (() => void);
|
|
32
|
+
getSnapshot: () => SyncManagerSnapshot;
|
|
33
|
+
private notify;
|
|
34
|
+
private setStatus;
|
|
35
|
+
connect(config: ConnectConfig): Promise<void>;
|
|
36
|
+
disconnect(): Promise<void>;
|
|
37
|
+
terminateSession(): Promise<void>;
|
|
38
|
+
enqueueLocalUpdate(update: Uint8Array): void;
|
|
39
|
+
initializeAwareness(): void;
|
|
40
|
+
forceCleanup(): void;
|
|
41
|
+
private connectSocket;
|
|
42
|
+
private syncLatestCommit;
|
|
43
|
+
private commitLocalContents;
|
|
44
|
+
private broadcastLocalContents;
|
|
45
|
+
private processUpdateQueue;
|
|
46
|
+
private processNextUpdate;
|
|
47
|
+
private processCommit;
|
|
48
|
+
private handleRemoteContentUpdate;
|
|
49
|
+
private applyRemoteYjsUpdate;
|
|
50
|
+
private applyQueuedRemoteContents;
|
|
51
|
+
private withRetry;
|
|
52
|
+
private disconnectInternal;
|
|
53
|
+
private reset;
|
|
54
|
+
}
|
|
@@ -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,11 @@ interface ISocketClientConfig {
|
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
export declare class SocketClient {
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private _sequenceCallbackMap;
|
|
25
|
-
_webSocketStatus: SocketStatusEnum;
|
|
26
|
-
private _webSocket;
|
|
20
|
+
private _socketUrl;
|
|
21
|
+
private _socket;
|
|
22
|
+
private _webSocketStatus;
|
|
23
|
+
get isConnected(): boolean;
|
|
24
|
+
get status(): SocketStatusEnum;
|
|
27
25
|
private _websocketServiceDid;
|
|
28
26
|
private roomId;
|
|
29
27
|
roomMembers: RoomMember[];
|
|
@@ -39,11 +37,8 @@ export declare class SocketClient {
|
|
|
39
37
|
_onError: ISocketInitConfig['onError'] | null;
|
|
40
38
|
_onCollaborationConnectCallback: ISocketClientConfig['onCollaborationConnectCallback'] | null;
|
|
41
39
|
constructor(config: ISocketClientConfig);
|
|
42
|
-
private _getSequenceIdCallback;
|
|
43
|
-
private _removeSequenceIdFromMap;
|
|
44
40
|
registerAwareness(awareness: Awareness): void;
|
|
45
|
-
private
|
|
46
|
-
private _sendNetworkRequest;
|
|
41
|
+
private _emitWithAck;
|
|
47
42
|
private _fetchRoomMembers;
|
|
48
43
|
sendUpdate({ update }: {
|
|
49
44
|
update: string;
|
|
@@ -52,24 +47,19 @@ export declare class SocketClient {
|
|
|
52
47
|
updates: string[];
|
|
53
48
|
cid: string;
|
|
54
49
|
}): Promise<CommitResponse>;
|
|
55
|
-
fetchLatestCommit(): Promise<any
|
|
56
|
-
getUncommittedChanges(): Promise<any
|
|
57
|
-
broadcastAwareness(awarenessUpdate: string): Promise<
|
|
58
|
-
disconnect: (
|
|
50
|
+
fetchLatestCommit(): Promise<AckResponse<any>>;
|
|
51
|
+
getUncommittedChanges(): Promise<AckResponse<any>>;
|
|
52
|
+
broadcastAwareness(awarenessUpdate: string): Promise<void>;
|
|
53
|
+
disconnect: () => void;
|
|
59
54
|
terminateSession: () => Promise<void>;
|
|
60
|
-
private _buildRequest;
|
|
61
55
|
private getCollaborationKeyPair;
|
|
62
56
|
private isUcanValid;
|
|
63
57
|
private getOwnerToken;
|
|
64
58
|
private buildSessionToken;
|
|
65
59
|
private _handleHandShake;
|
|
66
|
-
private
|
|
67
|
-
|
|
60
|
+
private _handleAwarenessUpdate;
|
|
61
|
+
connectSocket(config: ISocketInitConfig): Promise<void>;
|
|
68
62
|
private _onSessionTerminated;
|
|
69
|
-
private _processMessage;
|
|
70
|
-
private _clearSequenceCallbackMap;
|
|
71
|
-
connectSocket(): Promise<void> | undefined;
|
|
72
|
-
init(config: ISocketInitConfig): Promise<void>;
|
|
73
63
|
private resetSocketClient;
|
|
74
64
|
}
|
|
75
65
|
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, 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: import('./types').SyncStatus;
|
|
13
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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[];
|
package/dist/package/types.d.ts
CHANGED
|
@@ -17,12 +17,6 @@ export type InlineCommentData = {
|
|
|
17
17
|
highlightedTextContent: string;
|
|
18
18
|
handleClick: boolean;
|
|
19
19
|
};
|
|
20
|
-
export type CommentMutationType = 'create' | 'resolve' | 'unresolve' | 'delete';
|
|
21
|
-
export interface CommentMutationMeta {
|
|
22
|
-
type: CommentMutationType;
|
|
23
|
-
updateChunk: string;
|
|
24
|
-
tabId: string;
|
|
25
|
-
}
|
|
26
20
|
export interface CommentAccountProps {
|
|
27
21
|
isConnected?: boolean;
|
|
28
22
|
connectViaWallet?: () => Promise<void>;
|
|
@@ -100,10 +94,10 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
100
94
|
initialComments?: IComment[];
|
|
101
95
|
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
|
102
96
|
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
103
|
-
onNewComment?: (newComment: IComment
|
|
104
|
-
onResolveComment?: (activeCommentId: string
|
|
105
|
-
onUnresolveComment?: (activeCommentId: string
|
|
106
|
-
onDeleteComment?: (activeCommentId: string
|
|
97
|
+
onNewComment?: (newComment: IComment) => void;
|
|
98
|
+
onResolveComment?: (activeCommentId: string) => void;
|
|
99
|
+
onUnresolveComment?: (activeCommentId: string) => void;
|
|
100
|
+
onDeleteComment?: (activeCommentId: string) => void;
|
|
107
101
|
showTOC?: boolean;
|
|
108
102
|
setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
|
|
109
103
|
extensions?: Record<string, Extension | any>;
|
|
@@ -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.57-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",
|
|
@@ -156,4 +152,4 @@
|
|
|
156
152
|
"typescript": "^5.2.2",
|
|
157
153
|
"vite": "^5.0.0"
|
|
158
154
|
}
|
|
159
|
-
}
|
|
155
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useRtcWebsocketDisconnector: (syncState: any, enableCollaboration: boolean | undefined) => void;
|