@fileverse-dev/ddoc 4.2.4-patch-yjs-1 → 4.2.4
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-B3eaAAg-.mjs → index-BHEcRC2F.mjs} +1 -1
- package/dist/{index-BJz7x8xS.mjs → index-DPuANynY.mjs} +33222 -28014
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +9 -13
- package/dist/{markdown-source-pane-BgevwwEq.mjs → markdown-source-pane-BDPSou1J.mjs} +2 -2
- package/dist/package/components/editor-bubble-menu/types.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-drawer-desktop.d.ts +2 -1
- package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +2 -1
- package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-input-field.d.ts +2 -1
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +2 -1
- package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
- package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +1 -1
- package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +1 -1
- package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +1 -1
- package/dist/package/components/inline-comment/floating-comment/types.d.ts +2 -0
- package/dist/package/components/inline-comment/types.d.ts +2 -0
- package/dist/package/hooks/use-tab-editor.d.ts +3 -3
- package/dist/package/hooks/use-yjs-setup.d.ts +1 -7
- package/dist/package/sync-local/SyncManager.d.ts +7 -40
- package/dist/package/sync-local/socketClient.d.ts +8 -78
- package/dist/package/sync-local/types/index.d.ts +12 -111
- package/dist/package/sync-local/useSyncManager.d.ts +0 -4
- package/dist/package/types.d.ts +1 -2
- package/dist/package/use-ddoc-editor.d.ts +0 -5
- package/dist/{split-view-toolbar-UOnFAMzh.mjs → split-view-toolbar-BXnE-1Ad.mjs} +2 -2
- package/package.json +5 -5
- package/dist/package/sync-local/crypto/room-key.d.ts +0 -2
- package/dist/package/sync-local/floor.d.ts +0 -6
- package/dist/package/sync-local/presence.d.ts +0 -11
- package/dist/package/sync-local/session-tools.d.ts +0 -31
package/dist/index.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export type { DdocExportModalProps, ExportFormatOption, ExportTabOption, } from
|
|
|
14
14
|
export type { VersionTabSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
|
|
15
15
|
export { Editor } from '@tiptap/react';
|
|
16
16
|
export type { CollaborationProps, CollabConnectionConfig, CollabSessionMeta, CollabServices, CollabCallbacks, CollabState, CollabError, CollabErrorCode, CollabStatus, } from './package/sync-local/types';
|
|
17
|
-
export { encryptForRoomKey, decryptForRoomKey, } from './package/sync-local/crypto/room-key';
|
|
18
|
-
export { fetchSessionState, seedSession, } from './package/sync-local/session-tools';
|
|
19
17
|
export type { CommentMutationMeta, SuggestionType } from './package/types';
|
|
20
18
|
export type { IComment } from './package/extensions/comment/comment.ts';
|
|
21
19
|
export type { FontDescriptor } from './package/types';
|
package/dist/index.es.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as e, a as o, E as t, P as d, f as r, h as i, m as n, e as E, c as m, d as u, u as C, v as l } from "./index-DPuANynY.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
e as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
5
5
|
t as Editor,
|
|
6
6
|
d as PreviewDdocEditor,
|
|
7
7
|
r as buildVersionDiffSnapshot,
|
|
8
|
-
i as
|
|
9
|
-
n as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
u as useEditorCommands,
|
|
16
|
-
C as useExportHeadlessEditorContent,
|
|
17
|
-
f as useHeadlessEditor,
|
|
18
|
-
D as validateCustomCss
|
|
8
|
+
i as handleContentPrint,
|
|
9
|
+
n as mergeTabAwareYjsUpdates,
|
|
10
|
+
E as sanitizeCustomCss,
|
|
11
|
+
m as useEditorCommands,
|
|
12
|
+
u as useExportHeadlessEditorContent,
|
|
13
|
+
C as useHeadlessEditor,
|
|
14
|
+
l as validateCustomCss
|
|
19
15
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Vr = Object.defineProperty;
|
|
2
2
|
var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: O }) : t[e] = O;
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
|
-
import { j as Cr } from "./index-
|
|
4
|
+
import { j as Cr } from "./index-DPuANynY.mjs";
|
|
5
5
|
import { useRef as pe, useEffect as St } from "react";
|
|
6
|
-
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-
|
|
6
|
+
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-BHEcRC2F.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -24,13 +24,13 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
|
|
24
24
|
commentDrawerOpen?: boolean;
|
|
25
25
|
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
|
26
26
|
isCollabDocumentPublished?: boolean | undefined;
|
|
27
|
-
enableCollaboration?: boolean;
|
|
28
27
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
29
28
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
|
30
29
|
url: string;
|
|
31
30
|
file: File;
|
|
32
31
|
}>;
|
|
33
32
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
33
|
+
enableCollaboration?: boolean;
|
|
34
34
|
isCollabDocOwner?: boolean;
|
|
35
35
|
};
|
|
36
36
|
export interface NodeSelectorProps {
|
|
@@ -9,6 +9,7 @@ interface CommentDrawerDesktopProps {
|
|
|
9
9
|
commentType: string;
|
|
10
10
|
commentTypeOptions: DrawerSelectOption[];
|
|
11
11
|
filteredComments: IComment[];
|
|
12
|
+
isCollaborationEnabled: boolean;
|
|
12
13
|
isCommentTypeSelectOpen: boolean;
|
|
13
14
|
isConnected: boolean;
|
|
14
15
|
isNavbarVisible: boolean;
|
|
@@ -30,5 +31,5 @@ interface CommentDrawerDesktopProps {
|
|
|
30
31
|
tabList: DrawerSelectOption[];
|
|
31
32
|
tabNameById: Record<string, string>;
|
|
32
33
|
}
|
|
33
|
-
export declare const CommentDrawerDesktop: ({ activeCommentId, commentType, commentTypeOptions, filteredComments, isCommentTypeSelectOpen, isConnected, isNavbarVisible, isOpen, isPresentationMode, isPreviewMode, isTabSelectOpen, newCommentTabId, onClose, onCommentFocus, onCommentTypeChange, onCommentTypeSelectOpenChange, onReset, onTabChange, onTabSelectOpenChange, sectionLabel, selectedTab, selectedTabLabel, tabList, tabNameById, }: CommentDrawerDesktopProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const CommentDrawerDesktop: ({ activeCommentId, commentType, commentTypeOptions, filteredComments, isCollaborationEnabled, isCommentTypeSelectOpen, isConnected, isNavbarVisible, isOpen, isPresentationMode, isPreviewMode, isTabSelectOpen, newCommentTabId, onClose, onCommentFocus, onCommentTypeChange, onCommentTypeSelectOpenChange, onReset, onTabChange, onTabSelectOpenChange, sectionLabel, selectedTab, selectedTabLabel, tabList, tabNameById, }: CommentDrawerDesktopProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
35
|
export {};
|
|
@@ -9,6 +9,7 @@ interface CommentDrawerMobileProps {
|
|
|
9
9
|
canGoToNextMobileComment: boolean;
|
|
10
10
|
canGoToPreviousMobileComment: boolean;
|
|
11
11
|
comments: IComment[];
|
|
12
|
+
isCollaborationEnabled: boolean;
|
|
12
13
|
isCommentMobileFocused: boolean;
|
|
13
14
|
isConnected: boolean;
|
|
14
15
|
isDiscardCommentOverlayVisible: boolean;
|
|
@@ -38,5 +39,5 @@ interface CommentDrawerMobileProps {
|
|
|
38
39
|
tabNameById: Record<string, string>;
|
|
39
40
|
username: string | null;
|
|
40
41
|
}
|
|
41
|
-
export declare const CommentDrawerMobile: ({ activeCommentId, activeDraft, activeDraftId, activeSuggestionDraftCard, canGoToNextMobileComment, canGoToPreviousMobileComment, comments, isCommentMobileFocused, isConnected, isDiscardCommentOverlayVisible, isDiscardSuggestionOverlayVisible, isInlineDraftOpen, isMobileDrawerVisible, isNavbarVisible, isPresentationMode, mobileActiveCommentsCount, mobileDraftRef, mobileFocusedCommentIndex, onAttemptCloseNewComment, onAttemptCloseSuggestionDraft, onCancelDiscardComment, onCancelDiscardSuggestion, onCloseDrawer, onCommentFocus, onCreateComment, onDiscardSuggestionDraft, onFocusSuggestionDraft, onNextMobileComment, onPreviousMobileComment, onStartNewMobileComment, onSubmitSuggestionDraft, onUpdateInlineDraftText, onViewAllComments, tabNameById, username, }: CommentDrawerMobileProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare const CommentDrawerMobile: ({ activeCommentId, activeDraft, activeDraftId, activeSuggestionDraftCard, canGoToNextMobileComment, canGoToPreviousMobileComment, comments, isCollaborationEnabled, isCommentMobileFocused, isConnected, isDiscardCommentOverlayVisible, isDiscardSuggestionOverlayVisible, isInlineDraftOpen, isMobileDrawerVisible, isNavbarVisible, isPresentationMode, mobileActiveCommentsCount, mobileDraftRef, mobileFocusedCommentIndex, onAttemptCloseNewComment, onAttemptCloseSuggestionDraft, onCancelDiscardComment, onCancelDiscardSuggestion, onCloseDrawer, onCommentFocus, onCreateComment, onDiscardSuggestionDraft, onFocusSuggestionDraft, onNextMobileComment, onPreviousMobileComment, onStartNewMobileComment, onSubmitSuggestionDraft, onUpdateInlineDraftText, onViewAllComments, tabNameById, username, }: CommentDrawerMobileProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
43
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentDrawerProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, isCollaborationEnabled, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ interface CommentReplyInputProps {
|
|
|
2
2
|
commentId: string;
|
|
3
3
|
commentUsername?: string;
|
|
4
4
|
replyCount: number;
|
|
5
|
+
isCollaborationEnabled: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const CommentReplyInput: ({ commentId, replyCount, commentUsername, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const CommentReplyInput: ({ commentId, replyCount, isCollaborationEnabled, commentUsername, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentSectionProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, isCollaborationEnabled, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentFloatingContainerProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, }: CommentFloatingContainerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, isCollaborationEnabled, }: CommentFloatingContainerProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ import { ThreadFloatingCardProps } from './types';
|
|
|
12
12
|
* uses — so once a draft is submitted, nothing else in the pipeline needs
|
|
13
13
|
* to change to show the suggestion here.
|
|
14
14
|
*/
|
|
15
|
-
export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, isCollaborationEnabled, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ThreadFloatingCardProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const ThreadFloatingCard: ({ thread, comment, tabName, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const ThreadFloatingCard: ({ thread, comment, tabName, isHidden, registerCardNode, isCollaborationEnabled, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,6 +10,7 @@ export interface CommentFloatingContainerProps {
|
|
|
10
10
|
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
11
11
|
tabName: string;
|
|
12
12
|
isHidden: boolean;
|
|
13
|
+
isCollaborationEnabled?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface FloatingCardShellProps {
|
|
15
16
|
floatingCardId: string;
|
|
@@ -29,6 +30,7 @@ export interface ThreadFloatingCardProps {
|
|
|
29
30
|
tabName: string;
|
|
30
31
|
isHidden: boolean;
|
|
31
32
|
registerCardNode: RegisterCardNode;
|
|
33
|
+
isCollaborationEnabled?: boolean;
|
|
32
34
|
}
|
|
33
35
|
export interface SuggestionDraftFloatingCardProps {
|
|
34
36
|
card: SuggestionFloatingDraftCard;
|
|
@@ -36,6 +36,7 @@ export interface CommentDrawerProps {
|
|
|
36
36
|
onTabChange?: (tabId: string) => void;
|
|
37
37
|
isPreviewMode: boolean;
|
|
38
38
|
tabs: Tab[];
|
|
39
|
+
isCollaborationEnabled: boolean;
|
|
39
40
|
}
|
|
40
41
|
export interface CommentCardProps extends IComment {
|
|
41
42
|
comment?: string;
|
|
@@ -86,6 +87,7 @@ export interface CommentSectionProps {
|
|
|
86
87
|
showNewCommentInput?: boolean;
|
|
87
88
|
onCommentFocus?: (commentId: string, tabId?: string) => void;
|
|
88
89
|
onReset?: () => void;
|
|
90
|
+
isCollaborationEnabled: boolean;
|
|
89
91
|
}
|
|
90
92
|
export interface UserDisplayProps {
|
|
91
93
|
username: string;
|
|
@@ -17,6 +17,7 @@ interface UseTabEditorArgs {
|
|
|
17
17
|
initialContent: DdocProps['initialContent'];
|
|
18
18
|
collaboration?: CollaborationProps;
|
|
19
19
|
isReady?: boolean;
|
|
20
|
+
isSyncing?: boolean;
|
|
20
21
|
awareness?: any;
|
|
21
22
|
disableInlineComment?: boolean;
|
|
22
23
|
isFocusMode?: boolean;
|
|
@@ -42,9 +43,8 @@ interface UseTabEditorArgs {
|
|
|
42
43
|
isPresentationMode?: boolean;
|
|
43
44
|
onInvalidContentError?: DdocProps['onInvalidContentError'];
|
|
44
45
|
ignoreCorruptedData?: boolean;
|
|
46
|
+
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
45
47
|
onConnect: (connectConfig: CollabConnectionConfig) => void;
|
|
46
|
-
onDisconnect: () => void;
|
|
47
|
-
isIndexeddbSynced: boolean;
|
|
48
48
|
hasCollabContentInitialised?: boolean;
|
|
49
49
|
initialiseYjsIndexedDbProvider: () => Promise<void>;
|
|
50
50
|
externalExtensions?: Record<string, AnyExtension>;
|
|
@@ -56,7 +56,7 @@ interface UseTabEditorArgs {
|
|
|
56
56
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
57
57
|
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
58
58
|
}
|
|
59
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData,
|
|
59
|
+
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, }: UseTabEditorArgs) => {
|
|
60
60
|
editor: Editor | null;
|
|
61
61
|
cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
|
|
62
62
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
@@ -6,20 +6,14 @@ interface UseYjsSetupArgs {
|
|
|
6
6
|
enableIndexeddbSync?: boolean;
|
|
7
7
|
ddocId?: string;
|
|
8
8
|
collaboration?: CollaborationProps;
|
|
9
|
-
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
10
9
|
onIndexedDbError?: (error: Error) => void;
|
|
11
10
|
}
|
|
12
|
-
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration,
|
|
11
|
+
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration, onIndexedDbError, }: UseYjsSetupArgs) => {
|
|
13
12
|
ydoc: Y.Doc;
|
|
14
13
|
onConnect: (connectConfig: import('../types').CollabConnectionConfig) => void;
|
|
15
|
-
onDisconnect: () => void;
|
|
16
14
|
isReady: boolean;
|
|
17
15
|
isSyncing: boolean;
|
|
18
16
|
terminateSession: () => void;
|
|
19
|
-
updateTitle: (args: {
|
|
20
|
-
encryptedTitle: string;
|
|
21
|
-
documentTitle: string;
|
|
22
|
-
}) => void;
|
|
23
17
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
24
18
|
hasCollabContentInitialised: boolean;
|
|
25
19
|
isIndexeddbSynced: boolean;
|
|
@@ -9,35 +9,23 @@ export declare class SyncManager {
|
|
|
9
9
|
private socketClient;
|
|
10
10
|
private roomKey;
|
|
11
11
|
private roomKeyBytes;
|
|
12
|
-
private rotating;
|
|
13
|
-
private roomKeyBytesPrev;
|
|
14
|
-
private pendingRotationKey;
|
|
15
|
-
private healingPromise;
|
|
16
|
-
private staleAckRetries;
|
|
17
|
-
private encryptMirror;
|
|
18
|
-
private fileKeyEpoch;
|
|
19
|
-
private mirrorIdleTimer;
|
|
20
|
-
private readonly MIRROR_IDLE_MS;
|
|
21
12
|
private isOwner;
|
|
22
|
-
private joinOnly;
|
|
23
13
|
private updateQueue;
|
|
14
|
+
private uncommittedUpdatesIdList;
|
|
24
15
|
private contentTobeAppliedQueue;
|
|
25
16
|
private isProcessing;
|
|
26
17
|
private syncId;
|
|
27
|
-
private floor;
|
|
28
|
-
private updatesSinceSnapshot;
|
|
29
|
-
private isAuthoringSnapshot;
|
|
30
|
-
private readonly SNAPSHOT_THRESHOLD;
|
|
31
18
|
private flushTimer;
|
|
32
19
|
private readonly FLUSH_INTERVAL_MS;
|
|
33
20
|
private readonly MAX_QUEUE_SIZE;
|
|
34
21
|
private _awarenessUpdateHandler;
|
|
35
22
|
private ydoc;
|
|
23
|
+
private servicesRef;
|
|
36
24
|
private callbacksRef;
|
|
37
25
|
private onLocalUpdate?;
|
|
38
26
|
constructor(config: SyncManagerConfig, onCollabStateChange: (state: CollabState) => void);
|
|
39
27
|
/** Called by useSyncManager on every render to keep refs fresh */
|
|
40
|
-
updateRefs(
|
|
28
|
+
updateRefs(services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
|
|
41
29
|
get isConnected(): boolean;
|
|
42
30
|
get isReady(): boolean;
|
|
43
31
|
get awareness(): Awareness | null;
|
|
@@ -50,16 +38,7 @@ export declare class SyncManager {
|
|
|
50
38
|
private runEntryActions;
|
|
51
39
|
connect(config: CollabConnectionConfig): Promise<void>;
|
|
52
40
|
disconnect(): Promise<void>;
|
|
53
|
-
/** Owner rename mid-session — see SocketClient.updateDocumentMeta. */
|
|
54
|
-
updateTitle(args: {
|
|
55
|
-
encryptedTitle: string;
|
|
56
|
-
documentTitle: string;
|
|
57
|
-
}): Promise<void>;
|
|
58
41
|
terminateSession(): Promise<void>;
|
|
59
|
-
/** In-place roomKey migration on CUTOVER: pause dispatch, swap the key, re-auth the same
|
|
60
|
-
* socket, re-broadcast awareness, then flush. See SocketClient.rekey for the wire side. */
|
|
61
|
-
rekey(newRoomKey: string, newAppLock?: string, newEditUcan?: string): Promise<void>;
|
|
62
|
-
private onDecryptMiss;
|
|
63
42
|
enqueueLocalUpdate(update: Uint8Array): void;
|
|
64
43
|
private flushUpdates;
|
|
65
44
|
private awaitFlush;
|
|
@@ -67,33 +46,21 @@ export declare class SyncManager {
|
|
|
67
46
|
* Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
|
|
68
47
|
* without awaiting the server ACK. The server broadcasts to peers immediately
|
|
69
48
|
* (before MongoDB write), so content reaches observers in near-real-time.
|
|
49
|
+
* ACK callback handles updateId tracking and auto-commit asynchronously.
|
|
70
50
|
*/
|
|
71
51
|
private sendUpdateBatch;
|
|
72
|
-
private sendUpdateBatchAttempt;
|
|
73
|
-
private isRevocationResponse;
|
|
74
|
-
private isSessionTerminatedResponse;
|
|
75
|
-
private classifyRevocation;
|
|
76
|
-
private handleWriteRevocation;
|
|
77
|
-
private surfaceSessionTerminated;
|
|
78
|
-
private maybeAuthorSnapshotAfterSend;
|
|
79
|
-
private scheduleMirror;
|
|
80
|
-
private authorMirror;
|
|
81
|
-
buildPendingBeaconPayload(): string | null;
|
|
82
|
-
fireBeacon(): void;
|
|
83
52
|
forceCleanup(): void;
|
|
84
53
|
private handleConnectionError;
|
|
85
54
|
private handleReconnection;
|
|
86
55
|
private connectSocket;
|
|
87
|
-
private
|
|
88
|
-
private decodeInto;
|
|
89
|
-
private catchUpFloor;
|
|
90
|
-
private authorSnapshot;
|
|
91
|
-
private hydrate;
|
|
56
|
+
private syncLatestCommit;
|
|
92
57
|
private initializeAwareness;
|
|
93
58
|
private cleanupAwareness;
|
|
59
|
+
private commitLocalContents;
|
|
94
60
|
private broadcastLocalContents;
|
|
95
61
|
private processUpdateQueue;
|
|
96
62
|
private processNextUpdate;
|
|
63
|
+
private processCommit;
|
|
97
64
|
private handleRemoteContentUpdate;
|
|
98
65
|
private applyRemoteYjsUpdate;
|
|
99
66
|
private applyQueuedRemoteContents;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISocketInitConfig, SocketStatusEnum, SendUpdateResponse,
|
|
1
|
+
import { ISocketInitConfig, RoomMember, SocketStatusEnum, SendUpdateResponse, CommitResponse, AckResponse } from './types';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness.js';
|
|
3
3
|
|
|
4
4
|
interface ISocketClientConfig {
|
|
@@ -8,39 +8,6 @@ interface ISocketClientConfig {
|
|
|
8
8
|
ownerEdSecret?: string;
|
|
9
9
|
contractAddress?: string;
|
|
10
10
|
ownerAddress?: string;
|
|
11
|
-
ownerIdentityDid?: string;
|
|
12
|
-
editLock?: string;
|
|
13
|
-
encryptedTitle?: string;
|
|
14
|
-
identityToken?: string;
|
|
15
|
-
identityContractAddress?: string;
|
|
16
|
-
editUcan?: string;
|
|
17
|
-
refreshEditClaim?: () => Promise<{
|
|
18
|
-
status: 'ok';
|
|
19
|
-
token: string;
|
|
20
|
-
} | {
|
|
21
|
-
status: 'demoted';
|
|
22
|
-
} | {
|
|
23
|
-
status: 'unavailable';
|
|
24
|
-
}>;
|
|
25
|
-
onRotationPrepare?: (inner: {
|
|
26
|
-
epoch: number;
|
|
27
|
-
gp: string;
|
|
28
|
-
appLock?: string;
|
|
29
|
-
}) => Promise<string | {
|
|
30
|
-
roomKey: string;
|
|
31
|
-
editUcan?: string;
|
|
32
|
-
} | null>;
|
|
33
|
-
onEpochAvailable?: (data: {
|
|
34
|
-
roomId: string;
|
|
35
|
-
epoch: number;
|
|
36
|
-
payload: string;
|
|
37
|
-
}) => void | Promise<void>;
|
|
38
|
-
onCutover?: (data: {
|
|
39
|
-
roomId: string;
|
|
40
|
-
epoch: number;
|
|
41
|
-
}) => void | Promise<void>;
|
|
42
|
-
actorHandle?: string;
|
|
43
|
-
joinOnly?: boolean;
|
|
44
11
|
onHandshakeData?: (response: {
|
|
45
12
|
data: AckResponse;
|
|
46
13
|
roomKey: string;
|
|
@@ -53,8 +20,6 @@ interface ISocketClientConfig {
|
|
|
53
20
|
}
|
|
54
21
|
export declare class SocketClient {
|
|
55
22
|
private _socketUrl;
|
|
56
|
-
private _restBase;
|
|
57
|
-
private _lastSessionToken;
|
|
58
23
|
private _socket;
|
|
59
24
|
private _webSocketStatus;
|
|
60
25
|
private _isIntentionalDisconnect;
|
|
@@ -62,73 +27,38 @@ export declare class SocketClient {
|
|
|
62
27
|
get status(): SocketStatusEnum;
|
|
63
28
|
private _websocketServiceDid;
|
|
64
29
|
private roomId;
|
|
65
|
-
roomMembers:
|
|
66
|
-
private _lastPresenceSignature;
|
|
67
|
-
private _onPresenceChange?;
|
|
68
|
-
private _pendingAwarenessUpdates;
|
|
30
|
+
roomMembers: RoomMember[];
|
|
69
31
|
private collaborationKeyPair;
|
|
70
32
|
private ownerKeyPair?;
|
|
71
33
|
private contractAddress?;
|
|
72
34
|
private ownerUcan?;
|
|
73
35
|
private collaborationUcan?;
|
|
74
36
|
private ownerAddress?;
|
|
75
|
-
private ownerIdentityDid?;
|
|
76
|
-
private editLock?;
|
|
77
|
-
private encryptedTitle?;
|
|
78
|
-
private identityToken?;
|
|
79
|
-
private identityContractAddress?;
|
|
80
|
-
private editUcan?;
|
|
81
|
-
private refreshEditClaim?;
|
|
82
|
-
private lastGoodEditUcan?;
|
|
83
|
-
private actorHandle?;
|
|
84
|
-
private joinOnly?;
|
|
85
37
|
private roomKey;
|
|
86
38
|
private roomInfo?;
|
|
87
39
|
private awareness;
|
|
88
40
|
private connectionAttemptErrorCount;
|
|
89
41
|
private _onHandshakeData;
|
|
90
|
-
private _onEpochAvailable;
|
|
91
|
-
private _onCutover;
|
|
92
|
-
private _rotating;
|
|
93
42
|
constructor(config: ISocketClientConfig);
|
|
94
43
|
registerAwareness(awareness: Awareness): void;
|
|
95
|
-
private _stampSocketId;
|
|
96
44
|
private _emitWithAck;
|
|
97
45
|
private _fetchRoomMembers;
|
|
98
|
-
private _recomputePresence;
|
|
99
46
|
sendUpdate({ update }: {
|
|
100
47
|
update: string;
|
|
101
48
|
}): Promise<SendUpdateResponse>;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
sendMirrorSnapshot({ data, fileKeyEpoch, }: {
|
|
109
|
-
data: string;
|
|
110
|
-
fileKeyEpoch: number;
|
|
111
|
-
}): Promise<AckResponse<any>>;
|
|
112
|
-
setDocumentMeta(): Promise<void>;
|
|
113
|
-
/** Owner rename mid-session: refresh the connect-frozen title artifacts (so
|
|
114
|
-
* every later /auth re-sends current values), persist server-side, and let
|
|
115
|
-
* the server broadcast /document/meta_update to room peers. */
|
|
116
|
-
updateDocumentMeta(args: {
|
|
117
|
-
encryptedTitle: string;
|
|
118
|
-
documentTitle: string;
|
|
119
|
-
}): Promise<void>;
|
|
49
|
+
commitUpdates({ updates, cid }: {
|
|
50
|
+
updates: string[];
|
|
51
|
+
cid: string;
|
|
52
|
+
}): Promise<CommitResponse>;
|
|
53
|
+
fetchLatestCommit(): Promise<AckResponse<any>>;
|
|
54
|
+
getUncommittedChanges(): Promise<AckResponse<any>>;
|
|
120
55
|
broadcastAwareness(awarenessUpdate: string): Promise<void>;
|
|
121
56
|
disconnect: () => void;
|
|
122
|
-
reauth: () => void;
|
|
123
|
-
rekey(newRoomKey: string, newAppLock?: string, newEditUcan?: string): Promise<void>;
|
|
124
|
-
ackEpochLoaded(documentId: string, epoch: number): Promise<void>;
|
|
125
57
|
terminateSession: () => Promise<void>;
|
|
126
|
-
flushBeacon(mergedUpdate: string): void;
|
|
127
58
|
private getCollaborationKeyPair;
|
|
128
59
|
private isUcanValid;
|
|
129
60
|
private getOwnerToken;
|
|
130
61
|
private buildSessionToken;
|
|
131
|
-
private _authenticate;
|
|
132
62
|
private _handleHandShake;
|
|
133
63
|
private _handleAwarenessUpdate;
|
|
134
64
|
connectSocket(config: ISocketInitConfig): Promise<void>;
|