@fileverse-dev/ddoc 4.2.4 → 4.3.1-mv-yjs-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-DPuANynY.mjs → index-Bghx3ull.mjs} +28368 -33551
- package/dist/{index-BHEcRC2F.mjs → index-BwmvbHh1.mjs} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +13 -9
- package/dist/{markdown-source-pane-BDPSou1J.mjs → markdown-source-pane-CUGwYz0i.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 +1 -2
- package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +1 -2
- package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-input-field.d.ts +1 -2
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +1 -2
- 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 +0 -2
- package/dist/package/components/inline-comment/types.d.ts +0 -2
- package/dist/package/hooks/use-tab-editor.d.ts +3 -3
- package/dist/package/hooks/use-yjs-setup.d.ts +7 -1
- package/dist/package/sync-local/SyncManager.d.ts +44 -7
- package/dist/package/sync-local/crypto/room-key.d.ts +2 -0
- package/dist/package/sync-local/floor.d.ts +8 -0
- package/dist/package/sync-local/presence.d.ts +11 -0
- package/dist/package/sync-local/session-tools.d.ts +31 -0
- package/dist/package/sync-local/socketClient.d.ts +74 -8
- package/dist/package/sync-local/types/index.d.ts +105 -12
- package/dist/package/sync-local/useSyncManager.d.ts +4 -0
- package/dist/package/types.d.ts +2 -1
- package/dist/package/use-ddoc-editor.d.ts +5 -0
- package/dist/{split-view-toolbar-BXnE-1Ad.mjs → split-view-toolbar-DCkttBMO.mjs} +2 -2
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as Ql, b as Zl, s as eh } from "./index-
|
|
1
|
+
import { k as Ql, b as Zl, s as eh } from "./index-Bghx3ull.mjs";
|
|
2
2
|
let An = [], Xr = [];
|
|
3
3
|
(() => {
|
|
4
4
|
let s = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e) => e ? parseInt(e, 36) : 1);
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ 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';
|
|
17
19
|
export type { CommentMutationMeta, SuggestionType } from './package/types';
|
|
18
20
|
export type { IComment } from './package/extensions/comment/comment.ts';
|
|
19
21
|
export type { FontDescriptor } from './package/types';
|
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as a, a as o, E as t, P as d, f as r, i, g as n, l as m, h as E, m as c, e as l, n as p, c as u, d as C, u as f, v as D } from "./index-Bghx3ull.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
a 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
|
-
|
|
8
|
+
i as decryptForRoomKey,
|
|
9
|
+
n as encryptForRoomKey,
|
|
10
|
+
m as fetchSessionState,
|
|
11
|
+
E as handleContentPrint,
|
|
12
|
+
c as mergeTabAwareYjsUpdates,
|
|
13
|
+
l as sanitizeCustomCss,
|
|
14
|
+
p as seedSession,
|
|
15
|
+
u as useEditorCommands,
|
|
16
|
+
C as useExportHeadlessEditorContent,
|
|
17
|
+
f as useHeadlessEditor,
|
|
18
|
+
D as validateCustomCss
|
|
15
19
|
};
|
|
@@ -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-Bghx3ull.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-BwmvbHh1.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;
|
|
27
28
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
28
29
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
|
29
30
|
url: string;
|
|
30
31
|
file: File;
|
|
31
32
|
}>;
|
|
32
33
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
33
|
-
enableCollaboration?: boolean;
|
|
34
34
|
isCollabDocOwner?: boolean;
|
|
35
35
|
};
|
|
36
36
|
export interface NodeSelectorProps {
|
|
@@ -9,7 +9,6 @@ interface CommentDrawerDesktopProps {
|
|
|
9
9
|
commentType: string;
|
|
10
10
|
commentTypeOptions: DrawerSelectOption[];
|
|
11
11
|
filteredComments: IComment[];
|
|
12
|
-
isCollaborationEnabled: boolean;
|
|
13
12
|
isCommentTypeSelectOpen: boolean;
|
|
14
13
|
isConnected: boolean;
|
|
15
14
|
isNavbarVisible: boolean;
|
|
@@ -31,5 +30,5 @@ interface CommentDrawerDesktopProps {
|
|
|
31
30
|
tabList: DrawerSelectOption[];
|
|
32
31
|
tabNameById: Record<string, string>;
|
|
33
32
|
}
|
|
34
|
-
export declare const CommentDrawerDesktop: ({ activeCommentId, commentType, commentTypeOptions, filteredComments,
|
|
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;
|
|
35
34
|
export {};
|
|
@@ -9,7 +9,6 @@ interface CommentDrawerMobileProps {
|
|
|
9
9
|
canGoToNextMobileComment: boolean;
|
|
10
10
|
canGoToPreviousMobileComment: boolean;
|
|
11
11
|
comments: IComment[];
|
|
12
|
-
isCollaborationEnabled: boolean;
|
|
13
12
|
isCommentMobileFocused: boolean;
|
|
14
13
|
isConnected: boolean;
|
|
15
14
|
isDiscardCommentOverlayVisible: boolean;
|
|
@@ -39,5 +38,5 @@ interface CommentDrawerMobileProps {
|
|
|
39
38
|
tabNameById: Record<string, string>;
|
|
40
39
|
username: string | null;
|
|
41
40
|
}
|
|
42
|
-
export declare const CommentDrawerMobile: ({ activeCommentId, activeDraft, activeDraftId, activeSuggestionDraftCard, canGoToNextMobileComment, canGoToPreviousMobileComment, comments,
|
|
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;
|
|
43
42
|
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,
|
|
3
|
+
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,6 @@ interface CommentReplyInputProps {
|
|
|
2
2
|
commentId: string;
|
|
3
3
|
commentUsername?: string;
|
|
4
4
|
replyCount: number;
|
|
5
|
-
isCollaborationEnabled: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare const CommentReplyInput: ({ commentId, replyCount,
|
|
6
|
+
export declare const CommentReplyInput: ({ commentId, replyCount, commentUsername, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
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,
|
|
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;
|
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,
|
|
3
|
+
export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, }: 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,
|
|
15
|
+
export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, }: 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,
|
|
3
|
+
export declare const ThreadFloatingCard: ({ thread, comment, tabName, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,6 @@ export interface CommentFloatingContainerProps {
|
|
|
10
10
|
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
11
11
|
tabName: string;
|
|
12
12
|
isHidden: boolean;
|
|
13
|
-
isCollaborationEnabled?: boolean;
|
|
14
13
|
}
|
|
15
14
|
export interface FloatingCardShellProps {
|
|
16
15
|
floatingCardId: string;
|
|
@@ -30,7 +29,6 @@ export interface ThreadFloatingCardProps {
|
|
|
30
29
|
tabName: string;
|
|
31
30
|
isHidden: boolean;
|
|
32
31
|
registerCardNode: RegisterCardNode;
|
|
33
|
-
isCollaborationEnabled?: boolean;
|
|
34
32
|
}
|
|
35
33
|
export interface SuggestionDraftFloatingCardProps {
|
|
36
34
|
card: SuggestionFloatingDraftCard;
|
|
@@ -36,7 +36,6 @@ export interface CommentDrawerProps {
|
|
|
36
36
|
onTabChange?: (tabId: string) => void;
|
|
37
37
|
isPreviewMode: boolean;
|
|
38
38
|
tabs: Tab[];
|
|
39
|
-
isCollaborationEnabled: boolean;
|
|
40
39
|
}
|
|
41
40
|
export interface CommentCardProps extends IComment {
|
|
42
41
|
comment?: string;
|
|
@@ -87,7 +86,6 @@ export interface CommentSectionProps {
|
|
|
87
86
|
showNewCommentInput?: boolean;
|
|
88
87
|
onCommentFocus?: (commentId: string, tabId?: string) => void;
|
|
89
88
|
onReset?: () => void;
|
|
90
|
-
isCollaborationEnabled: boolean;
|
|
91
89
|
}
|
|
92
90
|
export interface UserDisplayProps {
|
|
93
91
|
username: string;
|
|
@@ -17,7 +17,6 @@ interface UseTabEditorArgs {
|
|
|
17
17
|
initialContent: DdocProps['initialContent'];
|
|
18
18
|
collaboration?: CollaborationProps;
|
|
19
19
|
isReady?: boolean;
|
|
20
|
-
isSyncing?: boolean;
|
|
21
20
|
awareness?: any;
|
|
22
21
|
disableInlineComment?: boolean;
|
|
23
22
|
isFocusMode?: boolean;
|
|
@@ -43,8 +42,9 @@ interface UseTabEditorArgs {
|
|
|
43
42
|
isPresentationMode?: boolean;
|
|
44
43
|
onInvalidContentError?: DdocProps['onInvalidContentError'];
|
|
45
44
|
ignoreCorruptedData?: boolean;
|
|
46
|
-
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
47
45
|
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,
|
|
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, onConnect, onDisconnect, isIndexeddbSynced, 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,14 +6,20 @@ interface UseYjsSetupArgs {
|
|
|
6
6
|
enableIndexeddbSync?: boolean;
|
|
7
7
|
ddocId?: string;
|
|
8
8
|
collaboration?: CollaborationProps;
|
|
9
|
+
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
9
10
|
onIndexedDbError?: (error: Error) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration, onIndexedDbError, }: UseYjsSetupArgs) => {
|
|
12
|
+
export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration, onCollaboratorChange, onIndexedDbError, }: UseYjsSetupArgs) => {
|
|
12
13
|
ydoc: Y.Doc;
|
|
13
14
|
onConnect: (connectConfig: import('../types').CollabConnectionConfig) => void;
|
|
15
|
+
onDisconnect: () => void;
|
|
14
16
|
isReady: boolean;
|
|
15
17
|
isSyncing: boolean;
|
|
16
18
|
terminateSession: () => void;
|
|
19
|
+
updateTitle: (args: {
|
|
20
|
+
encryptedTitle: string;
|
|
21
|
+
documentTitle: string;
|
|
22
|
+
}) => void;
|
|
17
23
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
18
24
|
hasCollabContentInitialised: boolean;
|
|
19
25
|
isIndexeddbSynced: boolean;
|
|
@@ -9,23 +9,38 @@ 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;
|
|
12
21
|
private isOwner;
|
|
22
|
+
private joinOnly;
|
|
13
23
|
private updateQueue;
|
|
14
|
-
private uncommittedUpdatesIdList;
|
|
15
24
|
private contentTobeAppliedQueue;
|
|
16
25
|
private isProcessing;
|
|
17
26
|
private syncId;
|
|
27
|
+
private floor;
|
|
28
|
+
private updatesSinceSnapshot;
|
|
29
|
+
private isAuthoringSnapshot;
|
|
30
|
+
private readonly SNAPSHOT_THRESHOLD;
|
|
31
|
+
private tailCompactTimer;
|
|
32
|
+
private readonly TAIL_COMPACT_PAGES;
|
|
33
|
+
private readonly TAIL_COMPACT_ROWS;
|
|
18
34
|
private flushTimer;
|
|
19
35
|
private readonly FLUSH_INTERVAL_MS;
|
|
20
36
|
private readonly MAX_QUEUE_SIZE;
|
|
21
37
|
private _awarenessUpdateHandler;
|
|
22
38
|
private ydoc;
|
|
23
|
-
private servicesRef;
|
|
24
39
|
private callbacksRef;
|
|
25
40
|
private onLocalUpdate?;
|
|
26
41
|
constructor(config: SyncManagerConfig, onCollabStateChange: (state: CollabState) => void);
|
|
27
42
|
/** Called by useSyncManager on every render to keep refs fresh */
|
|
28
|
-
updateRefs(
|
|
43
|
+
updateRefs(_services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
|
|
29
44
|
get isConnected(): boolean;
|
|
30
45
|
get isReady(): boolean;
|
|
31
46
|
get awareness(): Awareness | null;
|
|
@@ -38,7 +53,16 @@ export declare class SyncManager {
|
|
|
38
53
|
private runEntryActions;
|
|
39
54
|
connect(config: CollabConnectionConfig): Promise<void>;
|
|
40
55
|
disconnect(): Promise<void>;
|
|
56
|
+
/** Owner rename mid-session — see SocketClient.updateDocumentMeta. */
|
|
57
|
+
updateTitle(args: {
|
|
58
|
+
encryptedTitle: string;
|
|
59
|
+
documentTitle: string;
|
|
60
|
+
}): Promise<void>;
|
|
41
61
|
terminateSession(): Promise<void>;
|
|
62
|
+
/** In-place roomKey migration on CUTOVER: pause dispatch, swap the key, re-auth the same
|
|
63
|
+
* socket, re-broadcast awareness, then flush. See SocketClient.rekey for the wire side. */
|
|
64
|
+
rekey(newRoomKey: string, newAppLock?: string, newEditUcan?: string): Promise<void>;
|
|
65
|
+
private onDecryptMiss;
|
|
42
66
|
enqueueLocalUpdate(update: Uint8Array): void;
|
|
43
67
|
private flushUpdates;
|
|
44
68
|
private awaitFlush;
|
|
@@ -46,21 +70,34 @@ export declare class SyncManager {
|
|
|
46
70
|
* Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
|
|
47
71
|
* without awaiting the server ACK. The server broadcasts to peers immediately
|
|
48
72
|
* (before MongoDB write), so content reaches observers in near-real-time.
|
|
49
|
-
* ACK callback handles updateId tracking and auto-commit asynchronously.
|
|
50
73
|
*/
|
|
51
74
|
private sendUpdateBatch;
|
|
75
|
+
private sendUpdateBatchAttempt;
|
|
76
|
+
private isRevocationResponse;
|
|
77
|
+
private isSessionTerminatedResponse;
|
|
78
|
+
private classifyRevocation;
|
|
79
|
+
private handleWriteRevocation;
|
|
80
|
+
private surfaceSessionTerminated;
|
|
81
|
+
private maybeAuthorSnapshotAfterSend;
|
|
82
|
+
private scheduleMirror;
|
|
83
|
+
private authorMirror;
|
|
84
|
+
buildPendingBeaconPayload(): string | null;
|
|
85
|
+
fireBeacon(): void;
|
|
52
86
|
forceCleanup(): void;
|
|
53
87
|
private handleConnectionError;
|
|
54
88
|
private handleReconnection;
|
|
55
89
|
private connectSocket;
|
|
56
|
-
private
|
|
90
|
+
private tryDecrypt;
|
|
91
|
+
private decodeInto;
|
|
92
|
+
private catchUpFloor;
|
|
93
|
+
private authorSnapshot;
|
|
94
|
+
private hydrate;
|
|
95
|
+
private maybeCompactTail;
|
|
57
96
|
private initializeAwareness;
|
|
58
97
|
private cleanupAwareness;
|
|
59
|
-
private commitLocalContents;
|
|
60
98
|
private broadcastLocalContents;
|
|
61
99
|
private processUpdateQueue;
|
|
62
100
|
private processNextUpdate;
|
|
63
|
-
private processCommit;
|
|
64
101
|
private handleRemoteContentUpdate;
|
|
65
102
|
private applyRemoteYjsUpdate;
|
|
66
103
|
private applyQueuedRemoteContents;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
export declare function advanceFloor(floor: number, pageSeqsAscending: number[]): number;
|
|
3
|
+
export declare function shouldAuthorSnapshot(p: {
|
|
4
|
+
canAuthor: boolean;
|
|
5
|
+
updatesSinceLastSnapshot: number;
|
|
6
|
+
threshold: number;
|
|
7
|
+
}): boolean;
|
|
8
|
+
export declare function computeLocalOnlyUpdate(ydoc: Y.Doc, serverMerged: Uint8Array | null): Uint8Array | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDocCollabUsers } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface AwarenessIdentity {
|
|
4
|
+
name: string;
|
|
5
|
+
color: string;
|
|
6
|
+
isEns: string | boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const PLACEHOLDER_COLOR = "#9CA3AF";
|
|
9
|
+
export declare function buildIdentityMap(states: Map<number, Record<string, unknown>>): Map<string, AwarenessIdentity>;
|
|
10
|
+
export declare function mergePresence(roomMembers: string[], identityBySocketId: Map<string, AwarenessIdentity>): IDocCollabUsers[];
|
|
11
|
+
export declare function identitySignature(roomMembers: string[], identityBySocketId: Map<string, AwarenessIdentity>): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CollabConnectionConfig } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Headless hydrate: pulls the OLD session's durable log and decrypts it with `roomKey`.
|
|
5
|
+
* The old session still exists server-side — termination only rejects writes, so a
|
|
6
|
+
* joinOnly read succeeds even after cutover. Mirrors the connect-time hydration pull
|
|
7
|
+
* (SyncManager.catchUpFloor / decodeInto), minus the Y.Doc/floor bookkeeping. Throws on
|
|
8
|
+
* connect/auth/pull failure; an individual undecryptable row is skipped, not fatal.
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchSessionState(args: {
|
|
11
|
+
ddocId: string;
|
|
12
|
+
roomKey: string;
|
|
13
|
+
ownerAuth: CollabConnectionConfig;
|
|
14
|
+
}): Promise<Uint8Array[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Headless seed: pushes `state` into a brand-new session as a single owner snapshot,
|
|
17
|
+
* encrypted under `newRoomKey`. `floorSeq: 0` — the target session is freshly created by
|
|
18
|
+
* the rotate op and holds no rows yet, so there is nothing to catch up before stamping.
|
|
19
|
+
*
|
|
20
|
+
* Caller ordering: must run AFTER the rotate op has already created the target session.
|
|
21
|
+
* This function's own owner `/auth` is create-or-join — calling it first would create the
|
|
22
|
+
* target session itself and, as an owner /auth, sweep (terminate) any other non-terminated
|
|
23
|
+
* session for this document, which is the OLD session that's supposed to keep draining
|
|
24
|
+
* stragglers during the rotation window. Seeding early collapses that drain early.
|
|
25
|
+
*/
|
|
26
|
+
export declare function seedSession(args: {
|
|
27
|
+
ddocId: string;
|
|
28
|
+
newRoomKey: string;
|
|
29
|
+
state: Uint8Array;
|
|
30
|
+
ownerAuth: CollabConnectionConfig;
|
|
31
|
+
}): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISocketInitConfig,
|
|
1
|
+
import { ISocketInitConfig, SocketStatusEnum, SendUpdateResponse, HydrationResponse, SnapshotResponse, AckResponse } from './types';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness.js';
|
|
3
3
|
|
|
4
4
|
interface ISocketClientConfig {
|
|
@@ -8,6 +8,37 @@ interface ISocketClientConfig {
|
|
|
8
8
|
ownerEdSecret?: string;
|
|
9
9
|
contractAddress?: string;
|
|
10
10
|
ownerAddress?: string;
|
|
11
|
+
editLock?: string;
|
|
12
|
+
encryptedTitle?: string;
|
|
13
|
+
identityToken?: string;
|
|
14
|
+
editUcan?: string;
|
|
15
|
+
refreshEditClaim?: () => Promise<{
|
|
16
|
+
status: 'ok';
|
|
17
|
+
token: string;
|
|
18
|
+
} | {
|
|
19
|
+
status: 'demoted';
|
|
20
|
+
} | {
|
|
21
|
+
status: 'unavailable';
|
|
22
|
+
}>;
|
|
23
|
+
onRotationPrepare?: (inner: {
|
|
24
|
+
epoch: number;
|
|
25
|
+
gp: string;
|
|
26
|
+
appLock?: string;
|
|
27
|
+
}) => Promise<string | {
|
|
28
|
+
roomKey: string;
|
|
29
|
+
editUcan?: string;
|
|
30
|
+
} | null>;
|
|
31
|
+
onEpochAvailable?: (data: {
|
|
32
|
+
roomId: string;
|
|
33
|
+
epoch: number;
|
|
34
|
+
payload: string;
|
|
35
|
+
}) => void | Promise<void>;
|
|
36
|
+
onCutover?: (data: {
|
|
37
|
+
roomId: string;
|
|
38
|
+
epoch: number;
|
|
39
|
+
}) => void | Promise<void>;
|
|
40
|
+
actorHandle?: string;
|
|
41
|
+
joinOnly?: boolean;
|
|
11
42
|
onHandshakeData?: (response: {
|
|
12
43
|
data: AckResponse;
|
|
13
44
|
roomKey: string;
|
|
@@ -20,6 +51,8 @@ interface ISocketClientConfig {
|
|
|
20
51
|
}
|
|
21
52
|
export declare class SocketClient {
|
|
22
53
|
private _socketUrl;
|
|
54
|
+
private _restBase;
|
|
55
|
+
private _lastSessionToken;
|
|
23
56
|
private _socket;
|
|
24
57
|
private _webSocketStatus;
|
|
25
58
|
private _isIntentionalDisconnect;
|
|
@@ -27,38 +60,71 @@ export declare class SocketClient {
|
|
|
27
60
|
get status(): SocketStatusEnum;
|
|
28
61
|
private _websocketServiceDid;
|
|
29
62
|
private roomId;
|
|
30
|
-
roomMembers:
|
|
63
|
+
roomMembers: string[];
|
|
64
|
+
private _lastPresenceSignature;
|
|
65
|
+
private _onPresenceChange?;
|
|
66
|
+
private _pendingAwarenessUpdates;
|
|
31
67
|
private collaborationKeyPair;
|
|
32
68
|
private ownerKeyPair?;
|
|
33
69
|
private contractAddress?;
|
|
34
70
|
private ownerUcan?;
|
|
35
71
|
private collaborationUcan?;
|
|
36
72
|
private ownerAddress?;
|
|
73
|
+
private editLock?;
|
|
74
|
+
private encryptedTitle?;
|
|
75
|
+
private identityToken?;
|
|
76
|
+
private editUcan?;
|
|
77
|
+
private refreshEditClaim?;
|
|
78
|
+
private lastGoodEditUcan?;
|
|
79
|
+
private actorHandle?;
|
|
80
|
+
private joinOnly?;
|
|
37
81
|
private roomKey;
|
|
38
82
|
private roomInfo?;
|
|
39
83
|
private awareness;
|
|
40
84
|
private connectionAttemptErrorCount;
|
|
41
85
|
private _onHandshakeData;
|
|
86
|
+
private _onEpochAvailable;
|
|
87
|
+
private _onCutover;
|
|
88
|
+
private _rotating;
|
|
42
89
|
constructor(config: ISocketClientConfig);
|
|
43
90
|
registerAwareness(awareness: Awareness): void;
|
|
91
|
+
private _stampSocketId;
|
|
44
92
|
private _emitWithAck;
|
|
45
93
|
private _fetchRoomMembers;
|
|
94
|
+
private _recomputePresence;
|
|
46
95
|
sendUpdate({ update }: {
|
|
47
96
|
update: string;
|
|
48
97
|
}): Promise<SendUpdateResponse>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
98
|
+
fetchHydrationRange(sinceSeq?: number): Promise<HydrationResponse>;
|
|
99
|
+
sendSnapshot({ data, floorSeq, publishedMarker, }: {
|
|
100
|
+
data: string;
|
|
101
|
+
floorSeq: number;
|
|
102
|
+
publishedMarker?: string | null;
|
|
103
|
+
}): Promise<SnapshotResponse>;
|
|
104
|
+
sendMirrorSnapshot({ data, fileKeyEpoch, }: {
|
|
105
|
+
data: string;
|
|
106
|
+
fileKeyEpoch: number;
|
|
107
|
+
}): Promise<AckResponse<any>>;
|
|
108
|
+
setDocumentMeta(): Promise<void>;
|
|
109
|
+
/** Owner rename mid-session: refresh the connect-frozen title artifacts (so
|
|
110
|
+
* every later /auth re-sends current values), persist server-side, and let
|
|
111
|
+
* the server broadcast /document/meta_update to room peers. */
|
|
112
|
+
updateDocumentMeta(args: {
|
|
113
|
+
encryptedTitle: string;
|
|
114
|
+
documentTitle: string;
|
|
115
|
+
}): Promise<void>;
|
|
55
116
|
broadcastAwareness(awarenessUpdate: string): Promise<void>;
|
|
56
117
|
disconnect: () => void;
|
|
118
|
+
reauth: () => void;
|
|
119
|
+
rekey(newRoomKey: string, newAppLock?: string, newEditUcan?: string): Promise<void>;
|
|
120
|
+
ackEpochLoaded(documentId: string, epoch: number): Promise<void>;
|
|
57
121
|
terminateSession: () => Promise<void>;
|
|
122
|
+
flushBeacon(mergedUpdate: string): void;
|
|
58
123
|
private getCollaborationKeyPair;
|
|
59
124
|
private isUcanValid;
|
|
60
125
|
private getOwnerToken;
|
|
61
126
|
private buildSessionToken;
|
|
127
|
+
private _authenticate;
|
|
62
128
|
private _handleHandShake;
|
|
63
129
|
private _handleAwarenessUpdate;
|
|
64
130
|
connectSocket(config: ISocketInitConfig): Promise<void>;
|