@fileverse-dev/ddoc 4.1.12-durability-1 → 4.1.12-durability-2

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.
@@ -182032,6 +182032,8 @@ class RXe {
182032
182032
  ze(this, "ownerIdentityDid");
182033
182033
  ze(this, "editLock");
182034
182034
  ze(this, "encryptedTitle");
182035
+ ze(this, "identityToken");
182036
+ ze(this, "identityContractAddress");
182035
182037
  ze(this, "roomKey");
182036
182038
  ze(this, "roomInfo");
182037
182039
  ze(this, "awareness", null);
@@ -182094,7 +182096,7 @@ class RXe {
182094
182096
  this.roomInfo && (o.roomInfo = Ni.encryptData(
182095
182097
  ui(this.roomKey),
182096
182098
  new TextEncoder().encode(JSON.stringify(this.roomInfo))
182097
- )), this.ownerKeyPair && (o.ownerToken = await this.getOwnerToken()), this.ownerAddress && (o.ownerAddress = this.ownerAddress), this.contractAddress && (o.contractAddress = this.contractAddress), this.ownerIdentityDid && (o.ownerIdentityDid = this.ownerIdentityDid);
182099
+ )), this.ownerKeyPair && (o.ownerToken = await this.getOwnerToken()), this.ownerAddress && (o.ownerAddress = this.ownerAddress), this.contractAddress && (o.contractAddress = this.contractAddress), this.ownerIdentityDid && (o.ownerIdentityDid = this.ownerIdentityDid), this.identityToken && (o.identityToken = this.identityToken), this.identityContractAddress && (o.identityContractAddress = this.identityContractAddress);
182098
182100
  const i = await this._emitWithAck("/auth", o);
182099
182101
  if ((a = this._onHandshakeData) == null || a.call(this, {
182100
182102
  data: i,
@@ -182139,7 +182141,7 @@ class RXe {
182139
182141
  );
182140
182142
  this.roomKey = t.roomKey, this.roomId = t.roomId, this.collaborationKeyPair = zg.fromSecretKey(
182141
182143
  br(n)
182142
- ), t.ownerEdSecret && (this.ownerKeyPair = zg.fromSecretKey(t.ownerEdSecret)), t.contractAddress && (this.contractAddress = t.contractAddress), t.ownerAddress && (this.ownerAddress = t.ownerAddress), t.ownerIdentityDid && (this.ownerIdentityDid = t.ownerIdentityDid), t.editLock && (this.editLock = t.editLock), t.encryptedTitle && (this.encryptedTitle = t.encryptedTitle), t.onHandshakeData && (this._onHandshakeData = t.onHandshakeData), t.roomInfo && (this.roomInfo = t.roomInfo);
182144
+ ), t.ownerEdSecret && (this.ownerKeyPair = zg.fromSecretKey(t.ownerEdSecret)), t.contractAddress && (this.contractAddress = t.contractAddress), t.ownerAddress && (this.ownerAddress = t.ownerAddress), t.ownerIdentityDid && (this.ownerIdentityDid = t.ownerIdentityDid), t.editLock && (this.editLock = t.editLock), t.identityToken && (this.identityToken = t.identityToken), t.identityContractAddress && (this.identityContractAddress = t.identityContractAddress), t.encryptedTitle && (this.encryptedTitle = t.encryptedTitle), t.onHandshakeData && (this._onHandshakeData = t.onHandshakeData), t.roomInfo && (this.roomInfo = t.roomInfo);
182143
182145
  }
182144
182146
  get isConnected() {
182145
182147
  return this._webSocketStatus === wr.CONNECTED;
@@ -182613,6 +182615,8 @@ class $Xe {
182613
182615
  ownerIdentityDid: t.ownerIdentityDid,
182614
182616
  editLock: t.editLock,
182615
182617
  encryptedTitle: t.encryptedTitle,
182618
+ identityToken: t.identityToken,
182619
+ identityContractAddress: t.identityContractAddress,
182616
182620
  onHandshakeData: (r = this.callbacksRef) == null ? void 0 : r.onHandshakeData,
182617
182621
  roomInfo: t.roomInfo
182618
182622
  }), this.send({ type: "CONNECT" });
@@ -182704,17 +182708,25 @@ class $Xe {
182704
182708
  console.error("SyncManager: server rejected update", i == null ? void 0 : i.error);
182705
182709
  return;
182706
182710
  }
182707
- this.updatesSinceSnapshot += 1, PXe({
182708
- isOwner: this.isOwner,
182709
- updatesSinceLastSnapshot: this.updatesSinceSnapshot,
182710
- threshold: this.SNAPSHOT_THRESHOLD
182711
- }) && this.authorSnapshot(null, this.syncId).catch((s) => {
182712
- console.error("SyncManager: snapshot authoring failed", s);
182713
- });
182711
+ this.maybeAuthorSnapshotAfterSend();
182714
182712
  }).catch((i) => {
182715
182713
  console.error("SyncManager: update send failed", i);
182716
182714
  });
182717
182715
  }
182716
+ // Count a successfully-sent update toward the snapshot cadence and author a snapshot once
182717
+ // the threshold is crossed. Called from every send path — the live batch, the reconnect
182718
+ // drain, and the full-state rebroadcast — so the reconnect tail can bound itself instead
182719
+ // of growing forever. authorSnapshot's own isAuthoringSnapshot/syncId guards keep the
182720
+ // fire-and-forget re-entrant-safe when triggered mid-hydrate.
182721
+ maybeAuthorSnapshotAfterSend() {
182722
+ this.updatesSinceSnapshot += 1, PXe({
182723
+ isOwner: this.isOwner,
182724
+ updatesSinceLastSnapshot: this.updatesSinceSnapshot,
182725
+ threshold: this.SNAPSHOT_THRESHOLD
182726
+ }) && this.authorSnapshot(null, this.syncId).catch((t) => {
182727
+ console.error("SyncManager: snapshot authoring failed", t);
182728
+ });
182729
+ }
182718
182730
  // The final merged delta for a hard tab-close beacon: any queued-but-unsent updates,
182719
182731
  // merged and encrypted. Returns null when there is nothing pending.
182720
182732
  buildPendingBeaconPayload() {
@@ -182937,11 +182949,14 @@ class $Xe {
182937
182949
  const i = await ((s = this.socketClient) == null ? void 0 : s.sendUpdate({
182938
182950
  update: o
182939
182951
  }));
182940
- if (r() && !(i != null && i.status)) {
182941
- const a = (i == null ? void 0 : i.error) || "Server rejected update";
182942
- throw new Error(
182943
- `Failed to broadcast local contents: ${a}${i != null && i.statusCode ? ` (${i.statusCode})` : ""}`
182944
- );
182952
+ if (r()) {
182953
+ if (!(i != null && i.status)) {
182954
+ const a = (i == null ? void 0 : i.error) || "Server rejected update";
182955
+ throw new Error(
182956
+ `Failed to broadcast local contents: ${a}${i != null && i.statusCode ? ` (${i.statusCode})` : ""}`
182957
+ );
182958
+ }
182959
+ this.maybeAuthorSnapshotAfterSend();
182945
182960
  }
182946
182961
  }
182947
182962
  async processUpdateQueue() {
@@ -182977,7 +182992,7 @@ class $Xe {
182977
182992
  `Failed to send update: ${l}${a != null && a.statusCode ? ` (${a.statusCode})` : ""}`
182978
182993
  );
182979
182994
  }
182980
- this.updateQueue = this.updateQueue.slice(t);
182995
+ this.updateQueue = this.updateQueue.slice(t), this.maybeAuthorSnapshotAfterSend();
182981
182996
  return;
182982
182997
  } catch (a) {
182983
182998
  o = a instanceof Error ? a : new Error(String(a)), console.error(
@@ -194001,7 +194016,7 @@ const DJe = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], kJe = wJe("Chevro
194001
194016
  ),
194002
194017
  t && /* @__PURE__ */ x.jsx("pre", { className: "m-0 px-3 pb-2 text-[11px] leading-relaxed font-mono color-text-secondary whitespace-pre-wrap break-words max-h-40 overflow-auto select-text", children: r })
194003
194018
  ] }) : null;
194004
- }, CJe = EU(() => import("./markdown-source-pane-CHsU7nVH.mjs")), AJe = EU(() => import("./split-view-toolbar-By84Hr3e.mjs")), _Je = ({
194019
+ }, CJe = EU(() => import("./markdown-source-pane-BKjCjPre.mjs")), AJe = EU(() => import("./split-view-toolbar-COesAtId.mjs")), _Je = ({
194005
194020
  markdown: e,
194006
194021
  onMarkdownChange: t,
194007
194022
  ipfsImageUploadFn: n,
@@ -1,4 +1,4 @@
1
- import { k as Ql, b as Zl, s as eh } from "./index-CTR-epIo.mjs";
1
+ import { k as Ql, b as Zl, s as eh } from "./index-Anwb_Wtj.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.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as e, a as o, E as t, P as d, e as r, h as i, m as n, d as E, c as l, u, v as C } from "./index-CTR-epIo.mjs";
1
+ import { D as e, a as o, E as t, P as d, e as r, h as i, m as n, d as E, c as l, u, v as C } from "./index-Anwb_Wtj.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-CTR-epIo.mjs";
4
+ import { j as Cr } from "./index-Anwb_Wtj.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-DOdUt7ap.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-DbEmQ3zM.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -50,6 +50,7 @@ export declare class SyncManager {
50
50
  * (before MongoDB write), so content reaches observers in near-real-time.
51
51
  */
52
52
  private sendUpdateBatch;
53
+ private maybeAuthorSnapshotAfterSend;
53
54
  buildPendingBeaconPayload(): string | null;
54
55
  fireBeacon(): void;
55
56
  forceCleanup(): void;
@@ -11,6 +11,8 @@ interface ISocketClientConfig {
11
11
  ownerIdentityDid?: string;
12
12
  editLock?: string;
13
13
  encryptedTitle?: string;
14
+ identityToken?: string;
15
+ identityContractAddress?: string;
14
16
  onHandshakeData?: (response: {
15
17
  data: AckResponse;
16
18
  roomKey: string;
@@ -42,6 +44,8 @@ export declare class SocketClient {
42
44
  private ownerIdentityDid?;
43
45
  private editLock?;
44
46
  private encryptedTitle?;
47
+ private identityToken?;
48
+ private identityContractAddress?;
45
49
  private roomKey;
46
50
  private roomInfo?;
47
51
  private awareness;
@@ -17,6 +17,10 @@ export interface CollabConnectionConfig {
17
17
  editLock?: string;
18
18
  /** Host signal (owner-only): the document title encrypted with the roomKey, uploaded as the server title recovery artifact. Opaque to the package. */
19
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;
20
24
  ownerEdSecret?: string;
21
25
  contractAddress?: string;
22
26
  ownerAddress?: string;
@@ -222,4 +226,6 @@ export interface IAuthArgs {
222
226
  sessionDid?: string;
223
227
  roomInfo?: string;
224
228
  ownerIdentityDid?: string;
229
+ identityToken?: string;
230
+ identityContractAddress?: string;
225
231
  }
@@ -1,7 +1,7 @@
1
- import { j as d } from "./index-CTR-epIo.mjs";
1
+ import { j as d } from "./index-Anwb_Wtj.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-DOdUt7ap.mjs";
4
+ import { a3 as A, a4 as P, c as y } from "./index-DbEmQ3zM.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.1.12-durability-1",
5
+ "version": "4.1.12-durability-2",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {