@fileverse-dev/dsheet 2.1.3-rtc-debug-3 → 2.1.3-rtc-debug-4

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.
@@ -47106,13 +47106,13 @@ class kE {
47106
47106
  }
47107
47107
  async syncLatestCommit(t) {
47108
47108
  await this.withRetry(async () => {
47109
- var c, d, h, p, m, g, w, S, b, v;
47109
+ var d, h, p, m, g, w, S, b, v, y;
47110
47110
  console.log("[RTC] syncLatestCommit: fetchLatestCommit() start");
47111
- const n = await ((c = this.socketClient) == null ? void 0 : c.fetchLatestCommit());
47111
+ const n = await ((d = this.socketClient) == null ? void 0 : d.fetchLatestCommit());
47112
47112
  console.log("[RTC] syncLatestCommit: fetchLatestCommit() done", {
47113
- hasHistory: !!((h = (d = n == null ? void 0 : n.data) == null ? void 0 : d.history) != null && h.length)
47113
+ hasHistory: !!((p = (h = n == null ? void 0 : n.data) == null ? void 0 : h.history) != null && p.length)
47114
47114
  });
47115
- const o = (m = (p = n == null ? void 0 : n.data) == null ? void 0 : p.history) == null ? void 0 : m[0];
47115
+ const o = (g = (m = n == null ? void 0 : n.data) == null ? void 0 : m.history) == null ? void 0 : g[0];
47116
47116
  let r;
47117
47117
  if (o != null && o.data)
47118
47118
  try {
@@ -47120,63 +47120,81 @@ class kE {
47120
47120
  this.roomKeyBytes,
47121
47121
  o.data
47122
47122
  );
47123
- } catch (y) {
47123
+ } catch (C) {
47124
47124
  console.warn(
47125
47125
  "[RTC] syncLatestCommit: failed to decrypt commit data (bad roomKey?), skipping",
47126
- y
47126
+ C
47127
47127
  );
47128
47128
  }
47129
47129
  const s = [];
47130
- if (o != null && o.cid && ((g = this.servicesRef) != null && g.fetchFromStorage)) {
47130
+ if (o != null && o.cid && ((w = this.servicesRef) != null && w.fetchFromStorage)) {
47131
47131
  console.log("[RTC] syncLatestCommit: fetchFromStorage() start", {
47132
47132
  cid: o.cid
47133
47133
  });
47134
- const y = await this.servicesRef.fetchFromStorage(o.cid);
47134
+ const C = await this.servicesRef.fetchFromStorage(o.cid);
47135
47135
  if (console.log("[RTC] syncLatestCommit: fetchFromStorage() done", {
47136
- hasData: !!(y != null && y.data)
47137
- }), y != null && y.data)
47136
+ hasData: !!(C != null && C.data)
47137
+ }), C != null && C.data)
47138
47138
  try {
47139
- const C = On.decryptData(
47139
+ const k = On.decryptData(
47140
47140
  this.roomKeyBytes,
47141
- y.data
47141
+ C.data
47142
47142
  );
47143
- s.push(C);
47144
- } catch (C) {
47143
+ s.push(k);
47144
+ } catch (k) {
47145
47145
  console.warn(
47146
47146
  "[RTC] syncLatestCommit: failed to decrypt commit content (bad roomKey?), skipping",
47147
- C
47147
+ k
47148
47148
  );
47149
47149
  }
47150
47150
  }
47151
47151
  console.log("[RTC] syncLatestCommit: getUncommittedChanges() start");
47152
- const a = await ((w = this.socketClient) == null ? void 0 : w.getUncommittedChanges());
47152
+ const a = await ((S = this.socketClient) == null ? void 0 : S.getUncommittedChanges());
47153
47153
  console.log("[RTC] syncLatestCommit: getUncommittedChanges() done", {
47154
- count: ((b = (S = a == null ? void 0 : a.data) == null ? void 0 : S.history) == null ? void 0 : b.length) ?? 0
47154
+ count: ((v = (b = a == null ? void 0 : a.data) == null ? void 0 : b.history) == null ? void 0 : v.length) ?? 0
47155
47155
  });
47156
- const i = (v = a == null ? void 0 : a.data) == null ? void 0 : v.history, l = [];
47157
- if (t && s.push(yo(t)), r && s.push(r), i && i.length > 0) {
47156
+ const i = (y = a == null ? void 0 : a.data) == null ? void 0 : y.history, l = [];
47157
+ t && s.push(yo(t)), r && s.push(r);
47158
+ let f = 0;
47159
+ if (i && i.length > 0) {
47158
47160
  this.isOwner && this.send({ type: "SET_UNMERGED_UPDATES", hasUpdates: !0 });
47159
- for (const y of i)
47161
+ for (const C of i)
47160
47162
  try {
47161
- const C = On.decryptData(
47163
+ const k = On.decryptData(
47162
47164
  this.roomKeyBytes,
47163
- y.data
47165
+ C.data
47164
47166
  );
47165
- l.push(y.id), s.push(C);
47166
- } catch (C) {
47167
- console.warn(
47168
- "SyncManager: failed to decrypt uncommitted update, skipping",
47169
- C
47167
+ l.push(C.id), s.push(k);
47168
+ } catch (k) {
47169
+ f++, console.warn(
47170
+ "[RTC] syncLatestCommit: failed to decrypt uncommitted update, skipping",
47171
+ k
47170
47172
  );
47171
47173
  }
47174
+ console.log("[RTC] syncLatestCommit: uncommitted update decrypt tally", {
47175
+ total: i.length,
47176
+ failed: f,
47177
+ succeeded: i.length - f
47178
+ });
47172
47179
  }
47173
- if (s.length) {
47174
- const y = He.mergeUpdates(s);
47175
- He.applyUpdate(this.ydoc, y, "self");
47180
+ if (console.log("[RTC] syncLatestCommit: ydoc share keys BEFORE merge apply", {
47181
+ keys: Array.from(this.ydoc.share.keys()),
47182
+ updatesToMergeCount: s.length
47183
+ }), s.length) {
47184
+ const C = He.mergeUpdates(s);
47185
+ He.applyUpdate(this.ydoc, C, "self");
47176
47186
  }
47177
- this.uncommittedUpdatesIdList = l;
47178
- const f = Eo(He.encodeStateAsUpdate(this.ydoc));
47179
- this.isOwner ? (console.log("[RTC] syncLatestCommit: commitLocalContents() start"), await this.commitLocalContents(l, f), console.log("[RTC] syncLatestCommit: commitLocalContents() done")) : (console.log("[RTC] syncLatestCommit: broadcastLocalContents() start"), await this.broadcastLocalContents(f), console.log("[RTC] syncLatestCommit: broadcastLocalContents() done"));
47187
+ console.log("[RTC] syncLatestCommit: ydoc share keys AFTER merge apply", {
47188
+ keys: Array.from(this.ydoc.share.keys()).map((C) => {
47189
+ var k;
47190
+ return {
47191
+ key: C,
47192
+ length: (k = this.ydoc.share.get(C)) == null ? void 0 : k.length
47193
+ };
47194
+ })
47195
+ }), this.uncommittedUpdatesIdList = l;
47196
+ const c = Eo(He.encodeStateAsUpdate(this.ydoc));
47197
+ this.isOwner ? (console.log("[RTC] syncLatestCommit: commitLocalContents() start"), await this.commitLocalContents(l, c), console.log("[RTC] syncLatestCommit: commitLocalContents() done")) : (console.log("[RTC] syncLatestCommit: broadcastLocalContents() start"), await this.broadcastLocalContents(c), console.log("[RTC] syncLatestCommit: broadcastLocalContents() done"));
47180
47198
  }, "syncLatestCommit");
47181
47199
  }
47182
47200
  initializeAwareness() {
@@ -49162,8 +49180,16 @@ const tT = (e, t, n, o, r, s = !1, a, i, l, f, c, d = !1, h, p, m, g, w = !1) =>
49162
49180
  alreadyInitialized: P.current
49163
49181
  }), !(!g || !e.current || !t) && !P.current)
49164
49182
  try {
49183
+ console.log("[RTC] use-editor-data: reading ydoc.getArray(dsheetId)", {
49184
+ dsheetId: t,
49185
+ allShareKeys: Array.from(e.current.share.keys())
49186
+ });
49165
49187
  const L = e.current.getArray(t);
49166
- Tu(e.current, L);
49188
+ console.log("[RTC] use-editor-data: sheetArray length BEFORE migrate", {
49189
+ length: L.length
49190
+ }), Tu(e.current, L), console.log("[RTC] use-editor-data: sheetArray length AFTER migrate", {
49191
+ length: L.length
49192
+ });
49167
49193
  const A = zo(L);
49168
49194
  C.current = A, I(A);
49169
49195
  const U = {};
@@ -51411,7 +51437,7 @@ const Dr = ({
51411
51437
  }, w.readAsText(h);
51412
51438
  });
51413
51439
  }, hm = async (e, t, n, o) => {
51414
- const { handleExportToXLSX: r } = await import("./xlsx-export-impl-DIpQaIgT.js");
51440
+ const { handleExportToXLSX: r } = await import("./xlsx-export-impl-fSEKx8cP.js");
51415
51441
  return r(e, t, n, o);
51416
51442
  }, kT = (e) => {
51417
51443
  var n;
@@ -51486,7 +51512,7 @@ const Dr = ({
51486
51512
  const [a, i] = Re(!1);
51487
51513
  return { handleXLSXUpload: Ee(
51488
51514
  async (f, c, d) => {
51489
- const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-Caq6017s.js");
51515
+ const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-fZX_vLfm.js");
51490
51516
  return h(
51491
51517
  {
51492
51518
  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-DGDfkhOR.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-DRDqGVKo.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-DGDfkhOR.js";
3
+ import { m as Xe, y as Ze } from "./index-DRDqGVKo.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-DGDfkhOR.js";
6
+ import { c as Ct } from "./index-DRDqGVKo.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-3",
5
+ "version": "2.1.3-rtc-debug-4",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {