@liveblocks/core 3.1.4 → 3.2.1

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.d.cts CHANGED
@@ -1773,6 +1773,9 @@ type RoomConnectionErrorContext = {
1773
1773
  code: -1 | 4001 | 4005 | 4006 | (number & {});
1774
1774
  roomId: string;
1775
1775
  };
1776
+ type LargeMessageErrorContext = {
1777
+ type: "LARGE_MESSAGE_ERROR";
1778
+ };
1776
1779
  type CommentsOrNotificationsErrorContext = {
1777
1780
  type: "CREATE_THREAD_ERROR";
1778
1781
  roomId: string;
@@ -1825,7 +1828,7 @@ type CommentsOrNotificationsErrorContext = {
1825
1828
  } | {
1826
1829
  type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
1827
1830
  };
1828
- type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext>;
1831
+ type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext | LargeMessageErrorContext>;
1829
1832
  declare class LiveblocksError extends Error {
1830
1833
  readonly context: LiveblocksErrorContext;
1831
1834
  constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
@@ -2482,6 +2485,7 @@ type YDocUpdateServerMsg = {
2482
2485
  readonly stateVector: string | null;
2483
2486
  readonly guid?: string;
2484
2487
  readonly v2?: boolean;
2488
+ readonly remoteSnapshotHash: string;
2485
2489
  };
2486
2490
  /**
2487
2491
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -3575,7 +3579,7 @@ type ClearChatPair = DefineCmd<"clear-chat", {
3575
3579
  }>;
3576
3580
  type AiGenerationOptions = {
3577
3581
  /**
3578
- * The Copilot ID to use for this request. If not provided, a built-in
3582
+ * The copilot ID to use for this request. If not provided, a built-in
3579
3583
  * default Copilot will be used instead of one that you configured via the
3580
3584
  * dashboard.
3581
3585
  */
package/dist/index.d.ts CHANGED
@@ -1773,6 +1773,9 @@ type RoomConnectionErrorContext = {
1773
1773
  code: -1 | 4001 | 4005 | 4006 | (number & {});
1774
1774
  roomId: string;
1775
1775
  };
1776
+ type LargeMessageErrorContext = {
1777
+ type: "LARGE_MESSAGE_ERROR";
1778
+ };
1776
1779
  type CommentsOrNotificationsErrorContext = {
1777
1780
  type: "CREATE_THREAD_ERROR";
1778
1781
  roomId: string;
@@ -1825,7 +1828,7 @@ type CommentsOrNotificationsErrorContext = {
1825
1828
  } | {
1826
1829
  type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
1827
1830
  };
1828
- type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext>;
1831
+ type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext | LargeMessageErrorContext>;
1829
1832
  declare class LiveblocksError extends Error {
1830
1833
  readonly context: LiveblocksErrorContext;
1831
1834
  constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
@@ -2482,6 +2485,7 @@ type YDocUpdateServerMsg = {
2482
2485
  readonly stateVector: string | null;
2483
2486
  readonly guid?: string;
2484
2487
  readonly v2?: boolean;
2488
+ readonly remoteSnapshotHash: string;
2485
2489
  };
2486
2490
  /**
2487
2491
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -3575,7 +3579,7 @@ type ClearChatPair = DefineCmd<"clear-chat", {
3575
3579
  }>;
3576
3580
  type AiGenerationOptions = {
3577
3581
  /**
3578
- * The Copilot ID to use for this request. If not provided, a built-in
3582
+ * The copilot ID to use for this request. If not provided, a built-in
3579
3583
  * default Copilot will be used instead of one that you configured via the
3580
3584
  * dashboard.
3581
3585
  */
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "3.1.4";
9
+ var PKG_VERSION = "3.2.1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -7936,6 +7936,8 @@ function defaultMessageFromContext(context) {
7936
7936
  return "Could not update room subscription settings";
7937
7937
  case "UPDATE_NOTIFICATION_SETTINGS_ERROR":
7938
7938
  return "Could not update notification settings";
7939
+ case "LARGE_MESSAGE_ERROR":
7940
+ return "Could not send large message";
7939
7941
  default:
7940
7942
  return assertNever(context, "Unhandled case");
7941
7943
  }
@@ -8258,7 +8260,16 @@ function createRoom(options, config) {
8258
8260
  }
8259
8261
  switch (strategy) {
8260
8262
  case "default": {
8261
- error2("Message is too large for websockets, not sending. Configure largeMessageStrategy option to deal with this.");
8263
+ const type = "LARGE_MESSAGE_ERROR";
8264
+ const err = new LiveblocksError("Message is too large for websockets", {
8265
+ type
8266
+ });
8267
+ const didNotify = config.errorEventSource.notify(err);
8268
+ if (!didNotify) {
8269
+ error2(
8270
+ "Message is too large for websockets. Configure largeMessageStrategy option or useErrorListener to handle this."
8271
+ );
8272
+ }
8262
8273
  return;
8263
8274
  }
8264
8275
  case "split": {
@@ -9208,7 +9219,7 @@ ${Array.from(traces).join("\n\n")}`
9208
9219
  const syncSourceForYjs = config.createSyncSource();
9209
9220
  function yjsStatusDidChange(status) {
9210
9221
  return syncSourceForYjs.setSyncStatus(
9211
- status === "synchronizing" ? "synchronizing" : "synchronized"
9222
+ status === "synchronizing" || status === "loading" ? "synchronizing" : "synchronized"
9212
9223
  );
9213
9224
  }
9214
9225
  return Object.defineProperty(