@fileverse-dev/dsheet 2.1.3-rtc-debug-6 → 2.1.3-rtc-debug-7

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.
@@ -47075,8 +47075,8 @@ class kE {
47075
47075
  }
47076
47076
  async syncLatestCommit(t) {
47077
47077
  await this.withRetry(async () => {
47078
- var d, h, p, m, g, w;
47079
- const n = await ((d = this.socketClient) == null ? void 0 : d.fetchLatestCommit()), r = (p = (h = n == null ? void 0 : n.data) == null ? void 0 : h.history) == null ? void 0 : p[0];
47078
+ var h, p, m, g, w, S;
47079
+ const n = await ((h = this.socketClient) == null ? void 0 : h.fetchLatestCommit()), r = (m = (p = n == null ? void 0 : n.data) == null ? void 0 : p.history) == null ? void 0 : m[0];
47080
47080
  let o;
47081
47081
  if (r != null && r.data)
47082
47082
  try {
@@ -47084,62 +47084,69 @@ class kE {
47084
47084
  this.roomKeyBytes,
47085
47085
  r.data
47086
47086
  );
47087
- } catch (S) {
47087
+ } catch (b) {
47088
47088
  console.warn(
47089
47089
  "SyncManager: failed to decrypt commit data, skipping",
47090
- S
47090
+ b
47091
47091
  );
47092
47092
  }
47093
47093
  const s = [];
47094
- if (r != null && r.cid && ((m = this.servicesRef) != null && m.fetchFromStorage)) {
47095
- const S = await this.servicesRef.fetchFromStorage(r.cid);
47096
- if (S != null && S.data)
47094
+ let a = !1;
47095
+ if (r != null && r.cid && ((g = this.servicesRef) != null && g.fetchFromStorage)) {
47096
+ const b = await this.servicesRef.fetchFromStorage(r.cid);
47097
+ if (b != null && b.data)
47097
47098
  try {
47098
- const b = On.decryptData(
47099
+ const v = On.decryptData(
47099
47100
  this.roomKeyBytes,
47100
- S.data
47101
+ b.data
47101
47102
  );
47102
- s.push(b);
47103
- } catch (b) {
47103
+ s.push(v);
47104
+ } catch (v) {
47104
47105
  console.warn(
47105
47106
  "SyncManager: failed to decrypt commit content, skipping",
47106
- b
47107
- );
47107
+ v
47108
+ ), a = !0;
47108
47109
  }
47110
+ else
47111
+ a = !0;
47109
47112
  }
47110
- const a = await ((g = this.socketClient) == null ? void 0 : g.getUncommittedChanges()), i = (w = a == null ? void 0 : a.data) == null ? void 0 : w.history, l = [];
47111
- if (t && s.push(gr(t)), o && s.push(o), i && i.length > 0) {
47113
+ const i = await ((w = this.socketClient) == null ? void 0 : w.getUncommittedChanges()), l = (S = i == null ? void 0 : i.data) == null ? void 0 : S.history, f = [];
47114
+ if (t && s.push(gr(t)), o && s.push(o), l && l.length > 0) {
47112
47115
  this.isOwner && this.send({ type: "SET_UNMERGED_UPDATES", hasUpdates: !0 });
47113
- for (const S of i)
47116
+ for (const b of l)
47114
47117
  try {
47115
- const b = On.decryptData(
47118
+ const v = On.decryptData(
47116
47119
  this.roomKeyBytes,
47117
- S.data
47120
+ b.data
47118
47121
  );
47119
- l.push(S.id), s.push(b);
47120
- } catch (b) {
47122
+ f.push(b.id), s.push(v);
47123
+ } catch (v) {
47121
47124
  console.warn(
47122
47125
  "SyncManager: failed to decrypt uncommitted update, skipping",
47123
- b
47126
+ v
47124
47127
  );
47125
47128
  }
47126
47129
  }
47127
47130
  if (s.length) {
47128
- const S = He.mergeUpdates(s);
47129
- He.applyUpdate(this.ydoc, S, "self");
47130
- }
47131
- if (!!(r != null && r.data) || !!(i && i.length > 0)) {
47132
- const S = this.ydoc.store.pendingStructs !== null, b = this.ydoc.share.size === 0;
47133
- if (S || b) {
47134
- const v = new Error(
47131
+ const b = He.mergeUpdates(s);
47132
+ He.applyUpdate(this.ydoc, b, "self");
47133
+ }
47134
+ if (!!(r != null && r.data) || !!(l && l.length > 0)) {
47135
+ const b = this.ydoc.store.pendingStructs !== null, v = this.ydoc.store.clients.size === 0;
47136
+ if (b || v) {
47137
+ if (a)
47138
+ throw new Error(
47139
+ "Failed to sync commit content from storage — retry may succeed"
47140
+ );
47141
+ const y = new Error(
47135
47142
  "Room history failed to integrate — base structs missing (poisoned room)"
47136
47143
  );
47137
- throw v.name = "PoisonedRoomError", v;
47144
+ throw y.name = "PoisonedRoomError", y;
47138
47145
  }
47139
47146
  }
47140
- this.uncommittedUpdatesIdList = l;
47141
- const c = Sr(He.encodeStateAsUpdate(this.ydoc));
47142
- this.isOwner ? await this.commitLocalContents(l, c) : await this.broadcastLocalContents(c);
47147
+ this.uncommittedUpdatesIdList = f;
47148
+ const d = Sr(He.encodeStateAsUpdate(this.ydoc));
47149
+ this.isOwner ? await this.commitLocalContents(f, d) : await this.broadcastLocalContents(d);
47143
47150
  }, "syncLatestCommit");
47144
47151
  }
47145
47152
  initializeAwareness() {
@@ -47388,7 +47395,7 @@ class kE {
47388
47395
  if (r = s instanceof Error ? s : new Error(String(s)), console.error(
47389
47396
  `SyncManager: ${n} attempt ${o + 1} failed`,
47390
47397
  s
47391
- ), o === Ul || !this.isConnected && n !== "syncLatestCommit") break;
47398
+ ), r.name === "PoisonedRoomError" || o === Ul || !this.isConnected && n !== "syncLatestCommit") break;
47392
47399
  }
47393
47400
  throw r || new Error(`${n} failed after retries`);
47394
47401
  }
@@ -51359,7 +51366,7 @@ const Do = ({
51359
51366
  }, w.readAsText(h);
51360
51367
  });
51361
51368
  }, hm = async (e, t, n, r) => {
51362
- const { handleExportToXLSX: o } = await import("./xlsx-export-impl-Dam9l-an.js");
51369
+ const { handleExportToXLSX: o } = await import("./xlsx-export-impl-DftEv8nd.js");
51363
51370
  return o(e, t, n, r);
51364
51371
  }, kT = (e) => {
51365
51372
  var n;
@@ -51434,7 +51441,7 @@ const Do = ({
51434
51441
  const [a, i] = Re(!1);
51435
51442
  return { handleXLSXUpload: Ee(
51436
51443
  async (f, c, d) => {
51437
- const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-CsVs1C5k.js");
51444
+ const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-Vz7qs0tT.js");
51438
51445
  return h(
51439
51446
  {
51440
51447
  sheetEditorRef: e,
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as s, a as o, i as t, T as r, b as l, d as n, e as d, f as i, g as S, h as c, j as h, k as m, l as p, n as u, o as C, p as E, q as g, r as F, s as x, t as R, u as f, v as L, w as b, x as w, z as A, A as T, B as v, C as I, D, E as M, F as V, G as k } from "./index-BUCwWbYX.js";
1
+ import { S as s, a as o, i as t, T as r, b as l, d as n, e as d, f as i, g as S, h as c, j as h, k as m, l as p, n as u, o as C, p as E, q as g, r as F, s as x, t as R, u as f, v as L, w as b, x as w, z as A, A as T, B as v, C as I, D, E as M, F as V, G as k } from "./index-BELrLYuY.js";
2
2
  import { bP as z, bQ as X, bR as _, bV as y, bg as B, e as G, f as O, h as U, a as j, cf as q, aq as H, cm as J } from "./executeStringFunction-BkmJj04p.js";
3
3
  import { FLVURL as N } from "@fileverse-dev/formulajs";
4
4
  import { E as Y, S as Z } from "./constants-yStXQJiK.js";
@@ -1,6 +1,6 @@
1
1
  import { g as Ue } from "./executeStringFunction-BkmJj04p.js";
2
2
  import * as qe from "yjs";
3
- import { m as Xe, y as Ze } from "./index-BUCwWbYX.js";
3
+ import { m as Xe, y as Ze } from "./index-BELrLYuY.js";
4
4
  import { n as Je } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
5
  import { toast as Be } from "@fileverse/ui";
6
6
  var We = { exports: {} };
@@ -3,7 +3,7 @@ import { Workbook as Pt } from "exceljs";
3
3
  import { toast as Ut } from "@fileverse/ui";
4
4
  import { addFortuneImagesToWorksheet as Lt } from "./xlsx-image-utils-Cvg0qxRA.js";
5
5
  import { g as jt, c as xt } from "./executeStringFunction-BkmJj04p.js";
6
- import { c as Ct } from "./index-BUCwWbYX.js";
6
+ import { c as Ct } from "./index-BELrLYuY.js";
7
7
  import { c as zt, g as Wt } from "./xlsx-hyperlink-inline-DzewAypN.js";
8
8
  const Mt = {
9
9
  1: "thin",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "2.1.3-rtc-debug-6",
5
+ "version": "2.1.3-rtc-debug-7",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {