@fileverse-dev/ddoc 3.0.97 → 3.0.98

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.
@@ -48,7 +48,7 @@ interface UseTabEditorArgs {
48
48
  theme?: 'dark' | 'light';
49
49
  editorRef?: MutableRefObject<Editor | null>;
50
50
  }
51
- export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
51
+ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
52
52
  editor: Editor | null;
53
53
  ref: import('react').RefObject<HTMLDivElement>;
54
54
  slides: string[];
@@ -14,6 +14,9 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ private flushTimer;
18
+ private readonly FLUSH_INTERVAL_MS;
19
+ private readonly MAX_QUEUE_SIZE;
17
20
  private _awarenessUpdateHandler;
18
21
  private ydoc;
19
22
  private servicesRef;
@@ -34,6 +37,15 @@ export declare class SyncManager {
34
37
  disconnect(): Promise<void>;
35
38
  terminateSession(): Promise<void>;
36
39
  enqueueLocalUpdate(update: Uint8Array): void;
40
+ private flushUpdates;
41
+ private awaitFlush;
42
+ /**
43
+ * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
44
+ * without awaiting the server ACK. The server broadcasts to peers immediately
45
+ * (before MongoDB write), so content reaches observers in near-real-time.
46
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
47
+ */
48
+ private sendUpdateBatch;
37
49
  forceCleanup(): void;
38
50
  private handleConnectionError;
39
51
  private handleReconnection;
@@ -109,6 +109,10 @@ export interface SyncManagerConfig {
109
109
  services?: CollabServices;
110
110
  callbacks?: CollabCallbacks;
111
111
  onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
112
+ /** Origins to ignore in the ydoc update handler (e.g. IndexedDB provider) */
113
+ ignoredOrigins?: Array<{
114
+ current: unknown;
115
+ }>;
112
116
  }
113
117
  export declare enum ServerErrorCode {
114
118
  AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",