@fileverse-dev/ddoc 4.2.0-durability-2 → 4.2.0-durability-3
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-Dbf1uEo-.mjs → index-B1YYH48o.mjs} +1 -1
- package/dist/{index-Cq-xtVWh.mjs → index-Cf6WSYX5.mjs} +15007 -14905
- package/dist/index.es.js +1 -1
- package/dist/{markdown-source-pane-D9uH9r4n.mjs → markdown-source-pane-BSZ4KkCo.mjs} +2 -2
- package/dist/package/hooks/use-tab-editor.d.ts +1 -2
- package/dist/package/hooks/use-yjs-setup.d.ts +2 -1
- package/dist/package/sync-local/SyncManager.d.ts +7 -0
- package/dist/package/sync-local/presence.d.ts +11 -0
- package/dist/package/sync-local/socketClient.d.ts +15 -2
- package/dist/package/sync-local/types/index.d.ts +24 -2
- package/dist/package/types.d.ts +2 -1
- package/dist/{split-view-toolbar-Lgp_jPo7.mjs → split-view-toolbar-DZPQZsFn.mjs} +2 -2
- package/package.json +1 -1
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-
|
|
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-Cf6WSYX5.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-
|
|
4
|
+
import { j as Cr } from "./index-Cf6WSYX5.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-B1YYH48o.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -42,7 +42,6 @@ interface UseTabEditorArgs {
|
|
|
42
42
|
isPresentationMode?: boolean;
|
|
43
43
|
onInvalidContentError?: DdocProps['onInvalidContentError'];
|
|
44
44
|
ignoreCorruptedData?: boolean;
|
|
45
|
-
onCollaboratorChange?: DdocProps['onCollaboratorChange'];
|
|
46
45
|
onConnect: (connectConfig: CollabConnectionConfig) => void;
|
|
47
46
|
onDisconnect: () => void;
|
|
48
47
|
isIndexeddbSynced: boolean;
|
|
@@ -57,7 +56,7 @@ interface UseTabEditorArgs {
|
|
|
57
56
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
58
57
|
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
59
58
|
}
|
|
60
|
-
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, 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) => {
|
|
61
60
|
editor: Editor | null;
|
|
62
61
|
cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
|
|
63
62
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
@@ -6,9 +6,10 @@ 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;
|
|
14
15
|
onDisconnect: () => void;
|
|
@@ -9,6 +9,10 @@ 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;
|
|
12
16
|
private isOwner;
|
|
13
17
|
private updateQueue;
|
|
14
18
|
private contentTobeAppliedQueue;
|
|
@@ -50,7 +54,10 @@ export declare class SyncManager {
|
|
|
50
54
|
* (before MongoDB write), so content reaches observers in near-real-time.
|
|
51
55
|
*/
|
|
52
56
|
private sendUpdateBatch;
|
|
57
|
+
private isRevocationResponse;
|
|
53
58
|
private maybeAuthorSnapshotAfterSend;
|
|
59
|
+
private scheduleMirror;
|
|
60
|
+
private authorMirror;
|
|
54
61
|
buildPendingBeaconPayload(): string | null;
|
|
55
62
|
fireBeacon(): void;
|
|
56
63
|
forceCleanup(): void;
|
|
@@ -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;
|
|
@@ -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 {
|
|
@@ -13,6 +13,9 @@ interface ISocketClientConfig {
|
|
|
13
13
|
encryptedTitle?: string;
|
|
14
14
|
identityToken?: string;
|
|
15
15
|
identityContractAddress?: string;
|
|
16
|
+
editUcan?: string;
|
|
17
|
+
refreshEditClaim?: () => Promise<string | undefined>;
|
|
18
|
+
actorHandle?: string;
|
|
16
19
|
onHandshakeData?: (response: {
|
|
17
20
|
data: AckResponse;
|
|
18
21
|
roomKey: string;
|
|
@@ -34,7 +37,9 @@ export declare class SocketClient {
|
|
|
34
37
|
get status(): SocketStatusEnum;
|
|
35
38
|
private _websocketServiceDid;
|
|
36
39
|
private roomId;
|
|
37
|
-
roomMembers:
|
|
40
|
+
roomMembers: string[];
|
|
41
|
+
private _lastPresenceSignature;
|
|
42
|
+
private _onPresenceChange?;
|
|
38
43
|
private collaborationKeyPair;
|
|
39
44
|
private ownerKeyPair?;
|
|
40
45
|
private contractAddress?;
|
|
@@ -46,6 +51,9 @@ export declare class SocketClient {
|
|
|
46
51
|
private encryptedTitle?;
|
|
47
52
|
private identityToken?;
|
|
48
53
|
private identityContractAddress?;
|
|
54
|
+
private editUcan?;
|
|
55
|
+
private refreshEditClaim?;
|
|
56
|
+
private actorHandle?;
|
|
49
57
|
private roomKey;
|
|
50
58
|
private roomInfo?;
|
|
51
59
|
private awareness;
|
|
@@ -55,6 +63,7 @@ export declare class SocketClient {
|
|
|
55
63
|
registerAwareness(awareness: Awareness): void;
|
|
56
64
|
private _emitWithAck;
|
|
57
65
|
private _fetchRoomMembers;
|
|
66
|
+
private _recomputePresence;
|
|
58
67
|
sendUpdate({ update }: {
|
|
59
68
|
update: string;
|
|
60
69
|
}): Promise<SendUpdateResponse>;
|
|
@@ -64,6 +73,10 @@ export declare class SocketClient {
|
|
|
64
73
|
floorSeq: number;
|
|
65
74
|
publishedMarker?: string | null;
|
|
66
75
|
}): Promise<SnapshotResponse>;
|
|
76
|
+
sendMirrorSnapshot({ data, fileKeyEpoch, }: {
|
|
77
|
+
data: string;
|
|
78
|
+
fileKeyEpoch: number;
|
|
79
|
+
}): Promise<AckResponse<any>>;
|
|
67
80
|
setDocumentMeta(): Promise<void>;
|
|
68
81
|
broadcastAwareness(awarenessUpdate: string): Promise<void>;
|
|
69
82
|
disconnect: () => void;
|
|
@@ -21,6 +21,23 @@ export interface CollabConnectionConfig {
|
|
|
21
21
|
identityToken?: string;
|
|
22
22
|
/** Host signal (owner-only): the identity contract address the server reads to resolve the on-chain signingDid that verifies identityToken. */
|
|
23
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), so an editor whose epoch was bumped re-admits with a
|
|
29
|
+
* fresh claim and a demoted member resolves to undefined (→ dropped to viewer). If present it
|
|
30
|
+
* overrides `editUcan`; if absent, the static `editUcan` is used. Opaque to the package. */
|
|
31
|
+
refreshEditClaim?: () => Promise<string | undefined>;
|
|
32
|
+
/** Host signal: an anonymous per-connection actor handle (public rail). Record-only; opaque. */
|
|
33
|
+
actorHandle?: string;
|
|
34
|
+
/** Host signal (editor): produces the view-plane mirror ciphertext from the live Yjs state. The app
|
|
35
|
+
* AES-GCM-encrypts `{ file: base64(yjsUpdate), source }` under the fileKey in the publish wire
|
|
36
|
+
* format. Absent ⇒ the mirror is not written. The package never sees the fileKey or the crypto. */
|
|
37
|
+
encryptMirror?: (yjsUpdate: Uint8Array) => Promise<string>;
|
|
38
|
+
/** Host signal: the fileKey's rotation epoch (the gate `currentEpoch` / fileKey version — NOT
|
|
39
|
+
* `editGrantEpoch`; default 0 for non-rotating plain-public docs). */
|
|
40
|
+
fileKeyEpoch?: number;
|
|
24
41
|
ownerEdSecret?: string;
|
|
25
42
|
contractAddress?: string;
|
|
26
43
|
ownerAddress?: string;
|
|
@@ -137,7 +154,9 @@ export declare enum ServerErrorCode {
|
|
|
137
154
|
INVALID_ADDRESS = "INVALID_ADDRESS",
|
|
138
155
|
NOT_AUTHENTICATED = "NOT_AUTHENTICATED",
|
|
139
156
|
DB_ERROR = "DB_ERROR",
|
|
140
|
-
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
157
|
+
INTERNAL_ERROR = "INTERNAL_ERROR",
|
|
158
|
+
JOIN_DISABLED = "JOIN_DISABLED",
|
|
159
|
+
EDIT_REVOKED = "EDIT_REVOKED"
|
|
141
160
|
}
|
|
142
161
|
export interface AckResponse<T = Record<string, any>> {
|
|
143
162
|
status: boolean;
|
|
@@ -186,7 +205,7 @@ export interface ISocketInitConfig {
|
|
|
186
205
|
onDisconnect: () => void;
|
|
187
206
|
onSocketDropped: () => void;
|
|
188
207
|
onError: (err: Error) => void;
|
|
189
|
-
onHandShakeError: (err: Error, statusCode?: number) => void;
|
|
208
|
+
onHandShakeError: (err: Error, statusCode?: number, errorCode?: ServerErrorCode) => void;
|
|
190
209
|
onContentUpdate: (data: {
|
|
191
210
|
id: string;
|
|
192
211
|
data: string;
|
|
@@ -200,6 +219,7 @@ export interface ISocketInitConfig {
|
|
|
200
219
|
};
|
|
201
220
|
roomId: string;
|
|
202
221
|
}) => void;
|
|
222
|
+
onPresenceChange?: (collaborators: IDocCollabUsers[]) => void;
|
|
203
223
|
onSessionTerminated: (data: {
|
|
204
224
|
roomId: string;
|
|
205
225
|
}) => void;
|
|
@@ -228,4 +248,6 @@ export interface IAuthArgs {
|
|
|
228
248
|
ownerIdentityDid?: string;
|
|
229
249
|
identityToken?: string;
|
|
230
250
|
identityContractAddress?: string;
|
|
251
|
+
editUcan?: string;
|
|
252
|
+
actorHandle?: string;
|
|
231
253
|
}
|
package/dist/package/types.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ 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: number;
|
|
12
|
+
clientId: string | number;
|
|
13
13
|
name: string;
|
|
14
14
|
isEns: string;
|
|
15
15
|
color: string;
|
|
16
|
+
isPlaceholder?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export type InlineCommentData = {
|
|
18
19
|
inlineCommentText: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as d } from "./index-
|
|
1
|
+
import { j as d } from "./index-Cf6WSYX5.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-
|
|
4
|
+
import { a3 as A, a4 as P, c as y } from "./index-B1YYH48o.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(
|