@fileverse-dev/ddoc 4.2.0-durability-7 → 4.2.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.
Files changed (28) hide show
  1. package/dist/{index-Cmue3Umx.mjs → index-B6VDrwIF.mjs} +1 -1
  2. package/dist/{index-BM0vGxD5.mjs → index-CTig3eis.mjs} +26727 -26882
  3. package/dist/index.es.js +1 -1
  4. package/dist/{markdown-source-pane-COOcYwSm.mjs → markdown-source-pane-ChFR9yO7.mjs} +2 -2
  5. package/dist/package/components/editor-bubble-menu/types.d.ts +1 -0
  6. package/dist/package/components/inline-comment/comment-drawer-desktop.d.ts +2 -1
  7. package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +2 -1
  8. package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
  9. package/dist/package/components/inline-comment/comment-input-field.d.ts +2 -1
  10. package/dist/package/components/inline-comment/comment-reply-input.d.ts +2 -1
  11. package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
  12. package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +1 -1
  13. package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +1 -1
  14. package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +1 -1
  15. package/dist/package/components/inline-comment/floating-comment/types.d.ts +2 -0
  16. package/dist/package/components/inline-comment/types.d.ts +2 -0
  17. package/dist/package/hooks/use-tab-editor.d.ts +3 -3
  18. package/dist/package/hooks/use-yjs-setup.d.ts +1 -7
  19. package/dist/package/sync-local/SyncManager.d.ts +7 -27
  20. package/dist/package/sync-local/socketClient.d.ts +8 -55
  21. package/dist/package/sync-local/types/index.d.ts +11 -82
  22. package/dist/package/sync-local/useSyncManager.d.ts +0 -4
  23. package/dist/package/types.d.ts +1 -2
  24. package/dist/package/use-ddoc-editor.d.ts +0 -5
  25. package/dist/{split-view-toolbar-Da3BRk-r.mjs → split-view-toolbar-Da6b1X2c.mjs} +2 -2
  26. package/package.json +3 -2
  27. package/dist/package/sync-local/floor.d.ts +0 -6
  28. package/dist/package/sync-local/presence.d.ts +0 -11
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
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-BM0vGxD5.mjs";
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-CTig3eis.mjs";
2
2
  export {
3
3
  e as DdocEditor,
4
4
  o as DdocExportModal,
@@ -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-BM0vGxD5.mjs";
4
+ import { j as Cr } from "./index-CTig3eis.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-Cmue3Umx.mjs";
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-B6VDrwIF.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -30,6 +30,7 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
30
30
  file: File;
31
31
  }>;
32
32
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
33
+ enableCollaboration?: boolean;
33
34
  isCollabDocOwner?: boolean;
34
35
  };
35
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;
@@ -1,3 +1,4 @@
1
- export declare const CommentInputField: ({ tabId }: {
1
+ export declare const CommentInputField: ({ tabId, isCollaborationEnabled, }: {
2
2
  tabId?: string;
3
+ isCollaborationEnabled: boolean;
3
4
  }) => 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;
@@ -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;
@@ -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, onConnect, onDisconnect, isIndexeddbSynced, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, }: UseTabEditorArgs) => {
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, onCollaboratorChange, onIndexedDbError, }: UseYjsSetupArgs) => {
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,30 +9,23 @@ export declare class SyncManager {
9
9
  private socketClient;
10
10
  private roomKey;
11
11
  private roomKeyBytes;
12
- private encryptMirror;
13
- private fileKeyEpoch;
14
- private mirrorIdleTimer;
15
- private readonly MIRROR_IDLE_MS;
16
12
  private isOwner;
17
- private joinOnly;
18
13
  private updateQueue;
14
+ private uncommittedUpdatesIdList;
19
15
  private contentTobeAppliedQueue;
20
16
  private isProcessing;
21
17
  private syncId;
22
- private floor;
23
- private updatesSinceSnapshot;
24
- private isAuthoringSnapshot;
25
- private readonly SNAPSHOT_THRESHOLD;
26
18
  private flushTimer;
27
19
  private readonly FLUSH_INTERVAL_MS;
28
20
  private readonly MAX_QUEUE_SIZE;
29
21
  private _awarenessUpdateHandler;
30
22
  private ydoc;
23
+ private servicesRef;
31
24
  private callbacksRef;
32
25
  private onLocalUpdate?;
33
26
  constructor(config: SyncManagerConfig, onCollabStateChange: (state: CollabState) => void);
34
27
  /** Called by useSyncManager on every render to keep refs fresh */
35
- updateRefs(_services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
28
+ updateRefs(services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
36
29
  get isConnected(): boolean;
37
30
  get isReady(): boolean;
38
31
  get awareness(): Awareness | null;
@@ -45,11 +38,6 @@ export declare class SyncManager {
45
38
  private runEntryActions;
46
39
  connect(config: CollabConnectionConfig): Promise<void>;
47
40
  disconnect(): Promise<void>;
48
- /** Owner rename mid-session — see SocketClient.updateDocumentMeta. */
49
- updateTitle(args: {
50
- encryptedTitle: string;
51
- documentTitle: string;
52
- }): Promise<void>;
53
41
  terminateSession(): Promise<void>;
54
42
  enqueueLocalUpdate(update: Uint8Array): void;
55
43
  private flushUpdates;
@@ -58,29 +46,21 @@ export declare class SyncManager {
58
46
  * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
59
47
  * without awaiting the server ACK. The server broadcasts to peers immediately
60
48
  * (before MongoDB write), so content reaches observers in near-real-time.
49
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
61
50
  */
62
51
  private sendUpdateBatch;
63
- private isRevocationResponse;
64
- private classifyRevocation;
65
- private handleWriteRevocation;
66
- private maybeAuthorSnapshotAfterSend;
67
- private scheduleMirror;
68
- private authorMirror;
69
- buildPendingBeaconPayload(): string | null;
70
- fireBeacon(): void;
71
52
  forceCleanup(): void;
72
53
  private handleConnectionError;
73
54
  private handleReconnection;
74
55
  private connectSocket;
75
- private decodeInto;
76
- private catchUpFloor;
77
- private authorSnapshot;
78
- private hydrate;
56
+ private syncLatestCommit;
79
57
  private initializeAwareness;
80
58
  private cleanupAwareness;
59
+ private commitLocalContents;
81
60
  private broadcastLocalContents;
82
61
  private processUpdateQueue;
83
62
  private processNextUpdate;
63
+ private processCommit;
84
64
  private handleRemoteContentUpdate;
85
65
  private applyRemoteYjsUpdate;
86
66
  private applyQueuedRemoteContents;
@@ -1,4 +1,4 @@
1
- import { ISocketInitConfig, SocketStatusEnum, SendUpdateResponse, HydrationResponse, SnapshotResponse, AckResponse } from './types';
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,22 +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
- actorHandle?: string;
26
- joinOnly?: boolean;
27
11
  onHandshakeData?: (response: {
28
12
  data: AckResponse;
29
13
  roomKey: string;
@@ -36,8 +20,6 @@ interface ISocketClientConfig {
36
20
  }
37
21
  export declare class SocketClient {
38
22
  private _socketUrl;
39
- private _restBase;
40
- private _lastSessionToken;
41
23
  private _socket;
42
24
  private _webSocketStatus;
43
25
  private _isIntentionalDisconnect;
@@ -45,26 +27,13 @@ export declare class SocketClient {
45
27
  get status(): SocketStatusEnum;
46
28
  private _websocketServiceDid;
47
29
  private roomId;
48
- roomMembers: string[];
49
- private _lastPresenceSignature;
50
- private _onPresenceChange?;
51
- private _pendingAwarenessUpdates;
30
+ roomMembers: RoomMember[];
52
31
  private collaborationKeyPair;
53
32
  private ownerKeyPair?;
54
33
  private contractAddress?;
55
34
  private ownerUcan?;
56
35
  private collaborationUcan?;
57
36
  private ownerAddress?;
58
- private ownerIdentityDid?;
59
- private editLock?;
60
- private encryptedTitle?;
61
- private identityToken?;
62
- private identityContractAddress?;
63
- private editUcan?;
64
- private refreshEditClaim?;
65
- private lastGoodEditUcan?;
66
- private actorHandle?;
67
- private joinOnly?;
68
37
  private roomKey;
69
38
  private roomInfo?;
70
39
  private awareness;
@@ -72,36 +41,20 @@ export declare class SocketClient {
72
41
  private _onHandshakeData;
73
42
  constructor(config: ISocketClientConfig);
74
43
  registerAwareness(awareness: Awareness): void;
75
- private _stampSocketId;
76
44
  private _emitWithAck;
77
45
  private _fetchRoomMembers;
78
- private _recomputePresence;
79
46
  sendUpdate({ update }: {
80
47
  update: string;
81
48
  }): Promise<SendUpdateResponse>;
82
- fetchHydrationRange(sinceSeq?: number): Promise<HydrationResponse>;
83
- sendSnapshot({ data, floorSeq, publishedMarker, }: {
84
- data: string;
85
- floorSeq: number;
86
- publishedMarker?: string | null;
87
- }): Promise<SnapshotResponse>;
88
- sendMirrorSnapshot({ data, fileKeyEpoch, }: {
89
- data: string;
90
- fileKeyEpoch: number;
91
- }): Promise<AckResponse<any>>;
92
- setDocumentMeta(): Promise<void>;
93
- /** Owner rename mid-session: refresh the connect-frozen title artifacts (so
94
- * every later /auth re-sends current values), persist server-side, and let
95
- * the server broadcast /document/meta_update to room peers. */
96
- updateDocumentMeta(args: {
97
- encryptedTitle: string;
98
- documentTitle: string;
99
- }): 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>>;
100
55
  broadcastAwareness(awarenessUpdate: string): Promise<void>;
101
56
  disconnect: () => void;
102
- reauth: () => void;
103
57
  terminateSession: () => Promise<void>;
104
- flushBeacon(mergedUpdate: string): void;
105
58
  private getCollaborationKeyPair;
106
59
  private isUcanValid;
107
60
  private getOwnerToken;
@@ -7,49 +7,6 @@ export interface CollabConnectionConfig {
7
7
  roomId: string;
8
8
  wsUrl: string;
9
9
  isOwner: boolean;
10
- /** Host signal: doc is in an active live-collaboration context (shared / peers present). Keeps the socket connected. */
11
- livePresence?: boolean;
12
- /** Host signal: connect once on open to initialise durability even without an edit. */
13
- connectOnOpen?: boolean;
14
- /** Host signal (owner-only): the owner identity signingKey DID. Recorded by the durable server on the first owner /auth as the R3 owner binding. */
15
- ownerIdentityDid?: string;
16
- /** Host signal (owner-only): wrapped roomKey bytes (owner-lock construction), uploaded as the server editLock recovery artifact. Opaque to the package. */
17
- editLock?: string;
18
- /** Host signal (owner-only): the document title encrypted with the roomKey, uploaded as the server title recovery artifact. Opaque to the package. */
19
- encryptedTitle?: string;
20
- /** Host signal (owner-only): Ed25519 UCAN proving the owner identity, sent on /auth so the server binds the CRYPTOGRAPHICALLY PROVEN owner DID (not a bare asserted string). Opaque to the package. */
21
- identityToken?: string;
22
- /** Host signal (owner-only): the identity contract address the server reads to resolve the on-chain signingDid that verifies identityToken. */
23
- identityContractAddress?: string;
24
- /** Host signal (non-owner editor): the gate-minted edit-admission UCAN, forwarded on /auth so the
25
- * server admits this connection as a GP-rail editor. Opaque to the package. */
26
- editUcan?: string;
27
- /** Host signal (non-owner editor): re-mints a CURRENT-epoch editUcan. Called at every /auth
28
- * (incl. reconnect after a force-drop). Tri-state: `ok` (fresh token; overrides the static
29
- * `editUcan`), `demoted` (no longer an editor → terminal, drop to viewer), or `unavailable`
30
- * (transient/network → retry on the last-good claim). Opaque to the package. */
31
- refreshEditClaim?: () => Promise<{
32
- status: 'ok';
33
- token: string;
34
- } | {
35
- status: 'demoted';
36
- } | {
37
- status: 'unavailable';
38
- }>;
39
- /** Host signal: an anonymous per-connection actor handle (public rail). Record-only; opaque. */
40
- actorHandle?: string;
41
- /** Host signal (non-creator workspace member): join-only. The server never creates or
42
- * binds a session for this connection and caps the role at editor; every handshake
43
- * rejection resolves to a quiet terminated state ('ROOM_NOT_ESTABLISHED' when the room
44
- * was never established, 'JOIN_REJECTED' otherwise) instead of an error. */
45
- joinOnly?: boolean;
46
- /** Host signal (editor): produces the view-plane mirror ciphertext from the live Yjs state. The app
47
- * AES-GCM-encrypts `{ file: base64(yjsUpdate), source }` under the fileKey in the publish wire
48
- * format. Absent ⇒ the mirror is not written. The package never sees the fileKey or the crypto. */
49
- encryptMirror?: (yjsUpdate: Uint8Array) => Promise<string>;
50
- /** Host signal: the fileKey's rotation epoch (the gate `currentEpoch` / fileKey version — NOT
51
- * `editGrantEpoch`; default 0 for non-rotating plain-public docs). */
52
- fileKeyEpoch?: number;
53
10
  ownerEdSecret?: string;
54
11
  contractAddress?: string;
55
12
  ownerAddress?: string;
@@ -64,7 +21,11 @@ export interface CollabSessionMeta {
64
21
  username: string;
65
22
  isEns?: boolean;
66
23
  }
67
- export type CollabServices = Record<string, never>;
24
+ /** Storage integrations the sync engine depends on */
25
+ export interface CollabServices {
26
+ commitToStorage?: (file: File) => Promise<string>;
27
+ fetchFromStorage?: (cid: string) => Promise<any>;
28
+ }
68
29
  export type CollabErrorCode = 'CONNECTION_FAILED' | 'AUTH_FAILED' | 'SYNC_FAILED' | 'TIMEOUT' | 'UNKNOWN';
69
30
  export type CollabError = {
70
31
  code: CollabErrorCode;
@@ -132,8 +93,6 @@ export interface CollabCallbacks {
132
93
  data: AckResponse;
133
94
  roomKey: string;
134
95
  }) => void;
135
- /** Live rename from the room owner; title is roomKey-encrypted. */
136
- onTitleUpdate?: (encryptedTitle: string | null) => void;
137
96
  }
138
97
  /** Discriminated union — TypeScript enforces config+services only when enabled */
139
98
  export type CollaborationProps = {
@@ -168,10 +127,7 @@ export declare enum ServerErrorCode {
168
127
  INVALID_ADDRESS = "INVALID_ADDRESS",
169
128
  NOT_AUTHENTICATED = "NOT_AUTHENTICATED",
170
129
  DB_ERROR = "DB_ERROR",
171
- INTERNAL_ERROR = "INTERNAL_ERROR",
172
- JOIN_DISABLED = "JOIN_DISABLED",
173
- EDIT_REVOKED = "EDIT_REVOKED",
174
- ROOM_NOT_ESTABLISHED = "ROOM_NOT_ESTABLISHED"
130
+ INTERNAL_ERROR = "INTERNAL_ERROR"
175
131
  }
176
132
  export interface AckResponse<T = Record<string, any>> {
177
133
  status: boolean;
@@ -189,30 +145,11 @@ export interface SendUpdateResponse extends AckResponse<{
189
145
  createdAt: number;
190
146
  }> {
191
147
  }
192
- export interface HydrationRow {
193
- id: string;
148
+ export interface CommitResponse extends AckResponse<{
149
+ cid: string;
150
+ createdAt: number;
194
151
  documentId: string;
195
- seq: number;
196
- data: string;
197
- updateType: string;
198
- committed?: boolean;
199
- commitCid?: string | null;
200
- createdAt?: number;
201
- sessionDid?: string;
202
- publishedMarker?: string | null;
203
- floorSeq?: number | null;
204
- }
205
- export interface HydrationResponse extends AckResponse<{
206
- history: HydrationRow[];
207
- total: number;
208
- snapshot: HydrationRow | null;
209
- nextSeq: number | null;
210
- hasMore: boolean;
211
- }> {
212
- }
213
- export interface SnapshotResponse extends AckResponse<{
214
- id: string;
215
- seq: number;
152
+ updates: string[];
216
153
  }> {
217
154
  }
218
155
  export interface ISocketInitConfig {
@@ -220,7 +157,7 @@ export interface ISocketInitConfig {
220
157
  onDisconnect: () => void;
221
158
  onSocketDropped: () => void;
222
159
  onError: (err: Error) => void;
223
- onHandShakeError: (err: Error, statusCode?: number, errorCode?: ServerErrorCode) => void;
160
+ onHandShakeError: (err: Error, statusCode?: number) => void;
224
161
  onContentUpdate: (data: {
225
162
  id: string;
226
163
  data: string;
@@ -234,8 +171,6 @@ export interface ISocketInitConfig {
234
171
  };
235
172
  roomId: string;
236
173
  }) => void;
237
- onPresenceChange?: (collaborators: IDocCollabUsers[]) => void;
238
- onTitleUpdate?: (encryptedTitle: string | null) => void;
239
174
  onSessionTerminated: (data: {
240
175
  roomId: string;
241
176
  }) => void;
@@ -261,10 +196,4 @@ export interface IAuthArgs {
261
196
  contractAddress?: string;
262
197
  sessionDid?: string;
263
198
  roomInfo?: string;
264
- ownerIdentityDid?: string;
265
- identityToken?: string;
266
- identityContractAddress?: string;
267
- editUcan?: string;
268
- actorHandle?: string;
269
- joinOnly?: boolean;
270
199
  }
@@ -5,10 +5,6 @@ export declare const useSyncManager: (config: SyncManagerConfig) => {
5
5
  connect: (connectConfig: CollabConnectionConfig) => void;
6
6
  disconnect: () => void;
7
7
  terminateSession: () => void;
8
- updateTitle: (args: {
9
- encryptedTitle: string;
10
- documentTitle: string;
11
- }) => void;
12
8
  isReady: boolean;
13
9
  isSyncing: boolean;
14
10
  awareness: import('y-protocols/awareness.js').Awareness | null;
@@ -9,11 +9,10 @@ import { CollaborationProps } from './sync-local/types';
9
9
  export type { CollaborationProps, CollabConnectionConfig, CollabSessionMeta, CollabServices, CollabCallbacks, CollabState, CollabError, CollabErrorCode, CollabStatus, } from './sync-local/types';
10
10
  export declare const DdocEditorProps: EditorProps;
11
11
  export interface IDocCollabUsers {
12
- clientId: string | number;
12
+ clientId: number;
13
13
  name: string;
14
14
  isEns: string;
15
15
  color: string;
16
- isPlaceholder?: boolean;
17
16
  }
18
17
  export type InlineCommentData = {
19
18
  inlineCommentText: string;
@@ -28,13 +28,8 @@ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent
28
28
  duplicateTab: (tabId: string) => string | undefined;
29
29
  orderTab: (destinationTabId: string, movedTabId: string) => void;
30
30
  onConnect: (connectConfig: import('./types').CollabConnectionConfig) => void;
31
- onDisconnect: () => void;
32
31
  isReady: boolean;
33
32
  isSyncing: boolean;
34
- updateTitle: (args: {
35
- encryptedTitle: string;
36
- documentTitle: string;
37
- }) => void;
38
33
  hasCollabContentInitialised: boolean;
39
34
  isIndexeddbSynced: boolean;
40
35
  initialiseYjsIndexedDbProvider: () => Promise<void>;
@@ -1,7 +1,7 @@
1
- import { j as d } from "./index-BM0vGxD5.mjs";
1
+ import { j as d } from "./index-CTig3eis.mjs";
2
2
  import { useRef as I, useState as N, useEffect as D } from "react";
3
3
  import { DynamicDropdown as E, Tooltip as R, IconButton as O } from "@fileverse/ui";
4
- import { a3 as A, a4 as P, c as y } from "./index-Cmue3Umx.mjs";
4
+ import { a3 as A, a4 as P, c as y } from "./index-B6VDrwIF.mjs";
5
5
  const p = (e, t, o = t) => {
6
6
  const { state: s } = e, l = s.changeByRange((n) => {
7
7
  const u = s.sliceDoc(n.from, n.to), r = s.sliceDoc(
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "4.2.0-durability-7",
5
+ "version": "4.2.1",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -121,6 +121,7 @@
121
121
  "y-indexeddb": "^9.0.12",
122
122
  "y-prosemirror": "^1.2.5",
123
123
  "y-protocols": "^1.0.6",
124
+ "y-webrtc": "^10.3.0",
124
125
  "yjs": "^13.6.15",
125
126
  "zustand": "^5.0.12"
126
127
  },
@@ -166,4 +167,4 @@
166
167
  "vite": "^5.0.0",
167
168
  "vitest": "^2.1.0"
168
169
  }
169
- }
170
+ }
@@ -1,6 +0,0 @@
1
- export declare function advanceFloor(floor: number, pageSeqsAscending: number[]): number;
2
- export declare function shouldAuthorSnapshot(p: {
3
- isOwner: boolean;
4
- updatesSinceLastSnapshot: number;
5
- threshold: number;
6
- }): boolean;
@@ -1,11 +0,0 @@
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;