@liveblocks/core 3.1.4 → 3.2.0

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);
@@ -3575,7 +3578,7 @@ type ClearChatPair = DefineCmd<"clear-chat", {
3575
3578
  }>;
3576
3579
  type AiGenerationOptions = {
3577
3580
  /**
3578
- * The Copilot ID to use for this request. If not provided, a built-in
3581
+ * The copilot ID to use for this request. If not provided, a built-in
3579
3582
  * default Copilot will be used instead of one that you configured via the
3580
3583
  * dashboard.
3581
3584
  */
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);
@@ -3575,7 +3578,7 @@ type ClearChatPair = DefineCmd<"clear-chat", {
3575
3578
  }>;
3576
3579
  type AiGenerationOptions = {
3577
3580
  /**
3578
- * The Copilot ID to use for this request. If not provided, a built-in
3581
+ * The copilot ID to use for this request. If not provided, a built-in
3579
3582
  * default Copilot will be used instead of one that you configured via the
3580
3583
  * dashboard.
3581
3584
  */
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.0";
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": {