@symbo.ls/sdk 2.33.3 → 2.33.5

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.
@@ -148,16 +148,15 @@ class CollabService extends import_BaseService.BaseService {
148
148
  ...options
149
149
  };
150
150
  let { authToken: jwt } = mergedOptions;
151
- const {
152
- projectId,
153
- branch = "main",
154
- pro
155
- } = mergedOptions;
151
+ const { projectId, branch = "main", pro } = mergedOptions;
156
152
  if (!jwt && this._tokenManager) {
157
153
  try {
158
154
  jwt = await this._tokenManager.ensureValidToken();
159
155
  } catch (error) {
160
- console.warn("[CollabService] Failed to obtain auth token from token manager", error);
156
+ console.warn(
157
+ "[CollabService] Failed to obtain auth token from token manager",
158
+ error
159
+ );
161
160
  }
162
161
  if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
163
162
  jwt = this._tokenManager.getAccessToken();
@@ -256,32 +255,28 @@ class CollabService extends import_BaseService.BaseService {
256
255
  import_rootEventBus.rootBus.emit("checkpoint:done", { version, origin: "auto" });
257
256
  });
258
257
  socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
259
- socket == null ? void 0 : socket.on(
260
- "bundle:done",
261
- this._handleBundleDoneEvent.bind(this)
262
- );
263
- socket == null ? void 0 : socket.on(
264
- "bundle:error",
265
- this._handleBundleErrorEvent.bind(this)
266
- );
258
+ socket == null ? void 0 : socket.on("bundle:done", this._handleBundleDoneEvent.bind(this));
259
+ socket == null ? void 0 : socket.on("bundle:error", this._handleBundleErrorEvent.bind(this));
267
260
  if (this._pendingOps.length) {
268
261
  console.log(
269
262
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
270
263
  );
271
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
272
- const { message } = opOptions || {};
273
- const ts = Date.now();
274
- const payload = {
275
- changes,
276
- granularChanges,
277
- orders,
278
- ts
279
- };
280
- if (message) {
281
- payload.message = message;
264
+ this._pendingOps.forEach(
265
+ ({ changes, granularChanges, orders, options: opOptions }) => {
266
+ const { message } = opOptions || {};
267
+ const ts = Date.now();
268
+ const payload = {
269
+ changes,
270
+ granularChanges,
271
+ orders,
272
+ ts
273
+ };
274
+ if (message) {
275
+ payload.message = message;
276
+ }
277
+ this.socket.emit("ops", payload);
282
278
  }
283
- this.socket.emit("ops", payload);
284
- });
279
+ );
285
280
  this._pendingOps.length = 0;
286
281
  }
287
282
  await this._client.ready;
@@ -303,7 +298,9 @@ class CollabService extends import_BaseService.BaseService {
303
298
  var _a;
304
299
  if ((_a = this._client) == null ? void 0 : _a.socket) {
305
300
  if (this._pendingConnectReject) {
306
- this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
301
+ this._pendingConnectReject(
302
+ new Error("[CollabService] Connection attempt aborted")
303
+ );
307
304
  this._pendingConnectReject = null;
308
305
  }
309
306
  this._detachSocketLifecycleListeners();
@@ -376,9 +373,7 @@ class CollabService extends import_BaseService.BaseService {
376
373
  processedTuples.push(...options.append);
377
374
  }
378
375
  this._stateManager.applyChanges(tuples, { ...options });
379
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
380
- processedTuples
381
- );
376
+ const stringifiedGranularTuples = stringifyFunctionsForTransport(processedTuples);
382
377
  const stringifiedTuples = stringifyFunctionsForTransport(tuples);
383
378
  const { message } = options;
384
379
  if (!this.isConnected()) {
@@ -393,13 +388,6 @@ class CollabService extends import_BaseService.BaseService {
393
388
  }
394
389
  if ((_b = this.socket) == null ? void 0 : _b.connected) {
395
390
  const ts = Date.now();
396
- console.log("[CollabService] Sending operations to the backend", {
397
- changes: stringifiedTuples,
398
- granularChanges: stringifiedGranularTuples,
399
- orders,
400
- ts,
401
- message
402
- });
403
391
  const payload = {
404
392
  changes: stringifiedTuples,
405
393
  granularChanges: stringifiedGranularTuples,
package/dist/esm/index.js CHANGED
@@ -43239,16 +43239,15 @@ var CollabService = class extends BaseService {
43239
43239
  ...options
43240
43240
  };
43241
43241
  let { authToken: jwt } = mergedOptions;
43242
- const {
43243
- projectId,
43244
- branch = "main",
43245
- pro
43246
- } = mergedOptions;
43242
+ const { projectId, branch = "main", pro } = mergedOptions;
43247
43243
  if (!jwt && this._tokenManager) {
43248
43244
  try {
43249
43245
  jwt = await this._tokenManager.ensureValidToken();
43250
43246
  } catch (error) {
43251
- console.warn("[CollabService] Failed to obtain auth token from token manager", error);
43247
+ console.warn(
43248
+ "[CollabService] Failed to obtain auth token from token manager",
43249
+ error
43250
+ );
43252
43251
  }
43253
43252
  if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
43254
43253
  jwt = this._tokenManager.getAccessToken();
@@ -43347,32 +43346,28 @@ var CollabService = class extends BaseService {
43347
43346
  rootBus.emit("checkpoint:done", { version: version2, origin: "auto" });
43348
43347
  });
43349
43348
  socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
43350
- socket == null ? void 0 : socket.on(
43351
- "bundle:done",
43352
- this._handleBundleDoneEvent.bind(this)
43353
- );
43354
- socket == null ? void 0 : socket.on(
43355
- "bundle:error",
43356
- this._handleBundleErrorEvent.bind(this)
43357
- );
43349
+ socket == null ? void 0 : socket.on("bundle:done", this._handleBundleDoneEvent.bind(this));
43350
+ socket == null ? void 0 : socket.on("bundle:error", this._handleBundleErrorEvent.bind(this));
43358
43351
  if (this._pendingOps.length) {
43359
43352
  console.log(
43360
43353
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
43361
43354
  );
43362
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
43363
- const { message } = opOptions || {};
43364
- const ts = Date.now();
43365
- const payload = {
43366
- changes,
43367
- granularChanges,
43368
- orders,
43369
- ts
43370
- };
43371
- if (message) {
43372
- payload.message = message;
43355
+ this._pendingOps.forEach(
43356
+ ({ changes, granularChanges, orders, options: opOptions }) => {
43357
+ const { message } = opOptions || {};
43358
+ const ts = Date.now();
43359
+ const payload = {
43360
+ changes,
43361
+ granularChanges,
43362
+ orders,
43363
+ ts
43364
+ };
43365
+ if (message) {
43366
+ payload.message = message;
43367
+ }
43368
+ this.socket.emit("ops", payload);
43373
43369
  }
43374
- this.socket.emit("ops", payload);
43375
- });
43370
+ );
43376
43371
  this._pendingOps.length = 0;
43377
43372
  }
43378
43373
  await this._client.ready;
@@ -43394,7 +43389,9 @@ var CollabService = class extends BaseService {
43394
43389
  var _a2;
43395
43390
  if ((_a2 = this._client) == null ? void 0 : _a2.socket) {
43396
43391
  if (this._pendingConnectReject) {
43397
- this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
43392
+ this._pendingConnectReject(
43393
+ new Error("[CollabService] Connection attempt aborted")
43394
+ );
43398
43395
  this._pendingConnectReject = null;
43399
43396
  }
43400
43397
  this._detachSocketLifecycleListeners();
@@ -43467,9 +43464,7 @@ var CollabService = class extends BaseService {
43467
43464
  processedTuples.push(...options.append);
43468
43465
  }
43469
43466
  this._stateManager.applyChanges(tuples, { ...options });
43470
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
43471
- processedTuples
43472
- );
43467
+ const stringifiedGranularTuples = stringifyFunctionsForTransport(processedTuples);
43473
43468
  const stringifiedTuples = stringifyFunctionsForTransport(tuples);
43474
43469
  const { message } = options;
43475
43470
  if (!this.isConnected()) {
@@ -43484,13 +43479,6 @@ var CollabService = class extends BaseService {
43484
43479
  }
43485
43480
  if ((_b = this.socket) == null ? void 0 : _b.connected) {
43486
43481
  const ts = Date.now();
43487
- console.log("[CollabService] Sending operations to the backend", {
43488
- changes: stringifiedTuples,
43489
- granularChanges: stringifiedGranularTuples,
43490
- orders,
43491
- ts,
43492
- message
43493
- });
43494
43482
  const payload = {
43495
43483
  changes: stringifiedTuples,
43496
43484
  granularChanges: stringifiedGranularTuples,
@@ -25314,16 +25314,15 @@ var CollabService = class extends BaseService {
25314
25314
  ...options
25315
25315
  };
25316
25316
  let { authToken: jwt } = mergedOptions;
25317
- const {
25318
- projectId,
25319
- branch = "main",
25320
- pro
25321
- } = mergedOptions;
25317
+ const { projectId, branch = "main", pro } = mergedOptions;
25322
25318
  if (!jwt && this._tokenManager) {
25323
25319
  try {
25324
25320
  jwt = await this._tokenManager.ensureValidToken();
25325
25321
  } catch (error) {
25326
- console.warn("[CollabService] Failed to obtain auth token from token manager", error);
25322
+ console.warn(
25323
+ "[CollabService] Failed to obtain auth token from token manager",
25324
+ error
25325
+ );
25327
25326
  }
25328
25327
  if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
25329
25328
  jwt = this._tokenManager.getAccessToken();
@@ -25422,32 +25421,28 @@ var CollabService = class extends BaseService {
25422
25421
  rootBus.emit("checkpoint:done", { version: version2, origin: "auto" });
25423
25422
  });
25424
25423
  socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
25425
- socket == null ? void 0 : socket.on(
25426
- "bundle:done",
25427
- this._handleBundleDoneEvent.bind(this)
25428
- );
25429
- socket == null ? void 0 : socket.on(
25430
- "bundle:error",
25431
- this._handleBundleErrorEvent.bind(this)
25432
- );
25424
+ socket == null ? void 0 : socket.on("bundle:done", this._handleBundleDoneEvent.bind(this));
25425
+ socket == null ? void 0 : socket.on("bundle:error", this._handleBundleErrorEvent.bind(this));
25433
25426
  if (this._pendingOps.length) {
25434
25427
  console.log(
25435
25428
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
25436
25429
  );
25437
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
25438
- const { message } = opOptions || {};
25439
- const ts = Date.now();
25440
- const payload = {
25441
- changes,
25442
- granularChanges,
25443
- orders,
25444
- ts
25445
- };
25446
- if (message) {
25447
- payload.message = message;
25430
+ this._pendingOps.forEach(
25431
+ ({ changes, granularChanges, orders, options: opOptions }) => {
25432
+ const { message } = opOptions || {};
25433
+ const ts = Date.now();
25434
+ const payload = {
25435
+ changes,
25436
+ granularChanges,
25437
+ orders,
25438
+ ts
25439
+ };
25440
+ if (message) {
25441
+ payload.message = message;
25442
+ }
25443
+ this.socket.emit("ops", payload);
25448
25444
  }
25449
- this.socket.emit("ops", payload);
25450
- });
25445
+ );
25451
25446
  this._pendingOps.length = 0;
25452
25447
  }
25453
25448
  await this._client.ready;
@@ -25469,7 +25464,9 @@ var CollabService = class extends BaseService {
25469
25464
  var _a;
25470
25465
  if ((_a = this._client) == null ? void 0 : _a.socket) {
25471
25466
  if (this._pendingConnectReject) {
25472
- this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
25467
+ this._pendingConnectReject(
25468
+ new Error("[CollabService] Connection attempt aborted")
25469
+ );
25473
25470
  this._pendingConnectReject = null;
25474
25471
  }
25475
25472
  this._detachSocketLifecycleListeners();
@@ -25542,9 +25539,7 @@ var CollabService = class extends BaseService {
25542
25539
  processedTuples.push(...options.append);
25543
25540
  }
25544
25541
  this._stateManager.applyChanges(tuples, { ...options });
25545
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
25546
- processedTuples
25547
- );
25542
+ const stringifiedGranularTuples = stringifyFunctionsForTransport(processedTuples);
25548
25543
  const stringifiedTuples = stringifyFunctionsForTransport(tuples);
25549
25544
  const { message } = options;
25550
25545
  if (!this.isConnected()) {
@@ -25559,13 +25554,6 @@ var CollabService = class extends BaseService {
25559
25554
  }
25560
25555
  if ((_b = this.socket) == null ? void 0 : _b.connected) {
25561
25556
  const ts = Date.now();
25562
- console.log("[CollabService] Sending operations to the backend", {
25563
- changes: stringifiedTuples,
25564
- granularChanges: stringifiedGranularTuples,
25565
- orders,
25566
- ts,
25567
- message
25568
- });
25569
25557
  const payload = {
25570
25558
  changes: stringifiedTuples,
25571
25559
  granularChanges: stringifiedGranularTuples,
@@ -43239,16 +43239,15 @@ var CollabService = class extends BaseService {
43239
43239
  ...options
43240
43240
  };
43241
43241
  let { authToken: jwt } = mergedOptions;
43242
- const {
43243
- projectId,
43244
- branch = "main",
43245
- pro
43246
- } = mergedOptions;
43242
+ const { projectId, branch = "main", pro } = mergedOptions;
43247
43243
  if (!jwt && this._tokenManager) {
43248
43244
  try {
43249
43245
  jwt = await this._tokenManager.ensureValidToken();
43250
43246
  } catch (error) {
43251
- console.warn("[CollabService] Failed to obtain auth token from token manager", error);
43247
+ console.warn(
43248
+ "[CollabService] Failed to obtain auth token from token manager",
43249
+ error
43250
+ );
43252
43251
  }
43253
43252
  if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
43254
43253
  jwt = this._tokenManager.getAccessToken();
@@ -43347,32 +43346,28 @@ var CollabService = class extends BaseService {
43347
43346
  rootBus.emit("checkpoint:done", { version: version2, origin: "auto" });
43348
43347
  });
43349
43348
  socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
43350
- socket == null ? void 0 : socket.on(
43351
- "bundle:done",
43352
- this._handleBundleDoneEvent.bind(this)
43353
- );
43354
- socket == null ? void 0 : socket.on(
43355
- "bundle:error",
43356
- this._handleBundleErrorEvent.bind(this)
43357
- );
43349
+ socket == null ? void 0 : socket.on("bundle:done", this._handleBundleDoneEvent.bind(this));
43350
+ socket == null ? void 0 : socket.on("bundle:error", this._handleBundleErrorEvent.bind(this));
43358
43351
  if (this._pendingOps.length) {
43359
43352
  console.log(
43360
43353
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
43361
43354
  );
43362
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
43363
- const { message } = opOptions || {};
43364
- const ts = Date.now();
43365
- const payload = {
43366
- changes,
43367
- granularChanges,
43368
- orders,
43369
- ts
43370
- };
43371
- if (message) {
43372
- payload.message = message;
43355
+ this._pendingOps.forEach(
43356
+ ({ changes, granularChanges, orders, options: opOptions }) => {
43357
+ const { message } = opOptions || {};
43358
+ const ts = Date.now();
43359
+ const payload = {
43360
+ changes,
43361
+ granularChanges,
43362
+ orders,
43363
+ ts
43364
+ };
43365
+ if (message) {
43366
+ payload.message = message;
43367
+ }
43368
+ this.socket.emit("ops", payload);
43373
43369
  }
43374
- this.socket.emit("ops", payload);
43375
- });
43370
+ );
43376
43371
  this._pendingOps.length = 0;
43377
43372
  }
43378
43373
  await this._client.ready;
@@ -43394,7 +43389,9 @@ var CollabService = class extends BaseService {
43394
43389
  var _a2;
43395
43390
  if ((_a2 = this._client) == null ? void 0 : _a2.socket) {
43396
43391
  if (this._pendingConnectReject) {
43397
- this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
43392
+ this._pendingConnectReject(
43393
+ new Error("[CollabService] Connection attempt aborted")
43394
+ );
43398
43395
  this._pendingConnectReject = null;
43399
43396
  }
43400
43397
  this._detachSocketLifecycleListeners();
@@ -43467,9 +43464,7 @@ var CollabService = class extends BaseService {
43467
43464
  processedTuples.push(...options.append);
43468
43465
  }
43469
43466
  this._stateManager.applyChanges(tuples, { ...options });
43470
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
43471
- processedTuples
43472
- );
43467
+ const stringifiedGranularTuples = stringifyFunctionsForTransport(processedTuples);
43473
43468
  const stringifiedTuples = stringifyFunctionsForTransport(tuples);
43474
43469
  const { message } = options;
43475
43470
  if (!this.isConnected()) {
@@ -43484,13 +43479,6 @@ var CollabService = class extends BaseService {
43484
43479
  }
43485
43480
  if ((_b = this.socket) == null ? void 0 : _b.connected) {
43486
43481
  const ts = Date.now();
43487
- console.log("[CollabService] Sending operations to the backend", {
43488
- changes: stringifiedTuples,
43489
- granularChanges: stringifiedGranularTuples,
43490
- orders,
43491
- ts,
43492
- message
43493
- });
43494
43482
  const payload = {
43495
43483
  changes: stringifiedTuples,
43496
43484
  granularChanges: stringifiedGranularTuples,
@@ -126,16 +126,15 @@ class CollabService extends BaseService {
126
126
  ...options
127
127
  };
128
128
  let { authToken: jwt } = mergedOptions;
129
- const {
130
- projectId,
131
- branch = "main",
132
- pro
133
- } = mergedOptions;
129
+ const { projectId, branch = "main", pro } = mergedOptions;
134
130
  if (!jwt && this._tokenManager) {
135
131
  try {
136
132
  jwt = await this._tokenManager.ensureValidToken();
137
133
  } catch (error) {
138
- console.warn("[CollabService] Failed to obtain auth token from token manager", error);
134
+ console.warn(
135
+ "[CollabService] Failed to obtain auth token from token manager",
136
+ error
137
+ );
139
138
  }
140
139
  if (!jwt && typeof this._tokenManager.getAccessToken === "function") {
141
140
  jwt = this._tokenManager.getAccessToken();
@@ -234,32 +233,28 @@ class CollabService extends BaseService {
234
233
  rootBus.emit("checkpoint:done", { version, origin: "auto" });
235
234
  });
236
235
  socket == null ? void 0 : socket.on("clients", this._handleClientsEvent.bind(this));
237
- socket == null ? void 0 : socket.on(
238
- "bundle:done",
239
- this._handleBundleDoneEvent.bind(this)
240
- );
241
- socket == null ? void 0 : socket.on(
242
- "bundle:error",
243
- this._handleBundleErrorEvent.bind(this)
244
- );
236
+ socket == null ? void 0 : socket.on("bundle:done", this._handleBundleDoneEvent.bind(this));
237
+ socket == null ? void 0 : socket.on("bundle:error", this._handleBundleErrorEvent.bind(this));
245
238
  if (this._pendingOps.length) {
246
239
  console.log(
247
240
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
248
241
  );
249
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
250
- const { message } = opOptions || {};
251
- const ts = Date.now();
252
- const payload = {
253
- changes,
254
- granularChanges,
255
- orders,
256
- ts
257
- };
258
- if (message) {
259
- payload.message = message;
242
+ this._pendingOps.forEach(
243
+ ({ changes, granularChanges, orders, options: opOptions }) => {
244
+ const { message } = opOptions || {};
245
+ const ts = Date.now();
246
+ const payload = {
247
+ changes,
248
+ granularChanges,
249
+ orders,
250
+ ts
251
+ };
252
+ if (message) {
253
+ payload.message = message;
254
+ }
255
+ this.socket.emit("ops", payload);
260
256
  }
261
- this.socket.emit("ops", payload);
262
- });
257
+ );
263
258
  this._pendingOps.length = 0;
264
259
  }
265
260
  await this._client.ready;
@@ -281,7 +276,9 @@ class CollabService extends BaseService {
281
276
  var _a;
282
277
  if ((_a = this._client) == null ? void 0 : _a.socket) {
283
278
  if (this._pendingConnectReject) {
284
- this._pendingConnectReject(new Error("[CollabService] Connection attempt aborted"));
279
+ this._pendingConnectReject(
280
+ new Error("[CollabService] Connection attempt aborted")
281
+ );
285
282
  this._pendingConnectReject = null;
286
283
  }
287
284
  this._detachSocketLifecycleListeners();
@@ -354,9 +351,7 @@ class CollabService extends BaseService {
354
351
  processedTuples.push(...options.append);
355
352
  }
356
353
  this._stateManager.applyChanges(tuples, { ...options });
357
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
358
- processedTuples
359
- );
354
+ const stringifiedGranularTuples = stringifyFunctionsForTransport(processedTuples);
360
355
  const stringifiedTuples = stringifyFunctionsForTransport(tuples);
361
356
  const { message } = options;
362
357
  if (!this.isConnected()) {
@@ -371,13 +366,6 @@ class CollabService extends BaseService {
371
366
  }
372
367
  if ((_b = this.socket) == null ? void 0 : _b.connected) {
373
368
  const ts = Date.now();
374
- console.log("[CollabService] Sending operations to the backend", {
375
- changes: stringifiedTuples,
376
- granularChanges: stringifiedGranularTuples,
377
- orders,
378
- ts,
379
- message
380
- });
381
369
  const payload = {
382
370
  changes: stringifiedTuples,
383
371
  granularChanges: stringifiedGranularTuples,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/sdk",
3
- "version": "2.33.3",
3
+ "version": "2.33.5",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,12 +46,12 @@
46
46
  "test:user": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/user/*.test.js | tap-spec"
47
47
  },
48
48
  "dependencies": {
49
- "@domql/element": "^2.33.3",
50
- "@domql/utils": "^2.33.3",
49
+ "@domql/element": "^2.33.5",
50
+ "@domql/utils": "^2.33.5",
51
51
  "@grafana/faro-web-sdk": "^1.19.0",
52
52
  "@grafana/faro-web-tracing": "^1.19.0",
53
- "@symbo.ls/router": "^2.33.3",
54
- "@symbo.ls/socket": "^2.33.3",
53
+ "@symbo.ls/router": "^2.33.5",
54
+ "@symbo.ls/socket": "^2.33.5",
55
55
  "acorn": "^8.14.0",
56
56
  "acorn-walk": "^8.3.4",
57
57
  "dexie": "^4.0.11",
@@ -73,5 +73,5 @@
73
73
  "tap-spec": "^5.0.0",
74
74
  "tape": "^5.9.0"
75
75
  },
76
- "gitHead": "e3e8c02724fc4c94e3c6b268adcdbfeafee92890"
76
+ "gitHead": "3c6a0dfd1df1d7dbd53ea15676fa457622dac899"
77
77
  }
@@ -11,7 +11,7 @@ import { preprocessChanges } from '../utils/changePreprocessor.js'
11
11
  // for nested array shapes than the generic DOMQL helper.
12
12
  const FUNCTION_META_KEYS = ['node', '__ref', '__element', 'parent', 'parse']
13
13
 
14
- function stringifyFunctionsForTransport (value, seen = new WeakMap()) {
14
+ function stringifyFunctionsForTransport(value, seen = new WeakMap()) {
15
15
  if (value === null || typeof value !== 'object') {
16
16
  return typeof value === 'function' ? value.toString() : value
17
17
  }
@@ -167,17 +167,16 @@ export class CollabService extends BaseService {
167
167
  }
168
168
 
169
169
  let { authToken: jwt } = mergedOptions
170
- const {
171
- projectId,
172
- branch = 'main',
173
- pro
174
- } = mergedOptions
170
+ const { projectId, branch = 'main', pro } = mergedOptions
175
171
 
176
172
  if (!jwt && this._tokenManager) {
177
173
  try {
178
174
  jwt = await this._tokenManager.ensureValidToken()
179
175
  } catch (error) {
180
- console.warn('[CollabService] Failed to obtain auth token from token manager', error)
176
+ console.warn(
177
+ '[CollabService] Failed to obtain auth token from token manager',
178
+ error
179
+ )
181
180
  }
182
181
 
183
182
  if (!jwt && typeof this._tokenManager.getAccessToken === 'function') {
@@ -223,7 +222,7 @@ export class CollabService extends BaseService {
223
222
  // Mark as connected once the socket establishes a connection. This prevents
224
223
  // the SDK from being stuck waiting for an initial snapshot that may never
225
224
  // arrive (e.g. for new/empty documents).
226
- const {socket} = this._client
225
+ const { socket } = this._client
227
226
 
228
227
  try {
229
228
  await new Promise((resolve, reject) => {
@@ -267,7 +266,9 @@ export class CollabService extends BaseService {
267
266
  reason instanceof Error
268
267
  ? reason
269
268
  : new Error(
270
- `[CollabService] Socket disconnected before connect: ${reason || 'unknown'}`
269
+ `[CollabService] Socket disconnected before connect: ${
270
+ reason || 'unknown'
271
+ }`
271
272
  )
272
273
  )
273
274
  }
@@ -311,34 +312,30 @@ export class CollabService extends BaseService {
311
312
  socket?.on('clients', this._handleClientsEvent.bind(this))
312
313
 
313
314
  // 🗜️ Bundle events – emitted by the dependency bundler service
314
- socket?.on(
315
- 'bundle:done',
316
- this._handleBundleDoneEvent.bind(this)
317
- )
318
- socket?.on(
319
- 'bundle:error',
320
- this._handleBundleErrorEvent.bind(this)
321
- )
315
+ socket?.on('bundle:done', this._handleBundleDoneEvent.bind(this))
316
+ socket?.on('bundle:error', this._handleBundleErrorEvent.bind(this))
322
317
 
323
318
  // Flush any operations that were queued while we were offline.
324
319
  if (this._pendingOps.length) {
325
320
  console.log(
326
321
  `[CollabService] Flushing ${this._pendingOps.length} offline operation batch(es)`
327
322
  )
328
- this._pendingOps.forEach(({ changes, granularChanges, orders, options: opOptions }) => {
329
- const { message } = opOptions || {}
330
- const ts = Date.now()
331
- const payload = {
332
- changes,
333
- granularChanges,
334
- orders,
335
- ts
336
- }
337
- if (message) {
338
- payload.message = message
323
+ this._pendingOps.forEach(
324
+ ({ changes, granularChanges, orders, options: opOptions }) => {
325
+ const { message } = opOptions || {}
326
+ const ts = Date.now()
327
+ const payload = {
328
+ changes,
329
+ granularChanges,
330
+ orders,
331
+ ts
332
+ }
333
+ if (message) {
334
+ payload.message = message
335
+ }
336
+ this.socket.emit('ops', payload)
339
337
  }
340
- this.socket.emit('ops', payload)
341
- })
338
+ )
342
339
  this._pendingOps.length = 0
343
340
  }
344
341
 
@@ -364,7 +361,9 @@ export class CollabService extends BaseService {
364
361
  disconnect() {
365
362
  if (this._client?.socket) {
366
363
  if (this._pendingConnectReject) {
367
- this._pendingConnectReject(new Error('[CollabService] Connection attempt aborted'))
364
+ this._pendingConnectReject(
365
+ new Error('[CollabService] Connection attempt aborted')
366
+ )
368
367
  this._pendingConnectReject = null
369
368
  }
370
369
  this._detachSocketLifecycleListeners()
@@ -447,9 +446,8 @@ export class CollabService extends BaseService {
447
446
 
448
447
  // Use a dedicated helper that correctly handles nested array structures
449
448
  // such as granular tuples while also avoiding DOM / state metadata keys.
450
- const stringifiedGranularTuples = stringifyFunctionsForTransport(
451
- processedTuples
452
- )
449
+ const stringifiedGranularTuples =
450
+ stringifyFunctionsForTransport(processedTuples)
453
451
 
454
452
  const stringifiedTuples = stringifyFunctionsForTransport(tuples)
455
453
 
@@ -470,13 +468,13 @@ export class CollabService extends BaseService {
470
468
  // When connected, send the operations to the backend.
471
469
  if (this.socket?.connected) {
472
470
  const ts = Date.now()
473
- console.log('[CollabService] Sending operations to the backend', {
474
- changes: stringifiedTuples,
475
- granularChanges: stringifiedGranularTuples,
476
- orders,
477
- ts,
478
- message
479
- })
471
+ // console.log('[CollabService] Sending operations to the backend', {
472
+ // changes: stringifiedTuples,
473
+ // granularChanges: stringifiedGranularTuples,
474
+ // orders,
475
+ // ts,
476
+ // message
477
+ // })
480
478
  const payload = {
481
479
  changes: stringifiedTuples,
482
480
  granularChanges: stringifiedGranularTuples,