@liveblocks/core 2.0.0 → 2.0.3-test1

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.mjs 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 = "2.0.0";
9
+ var PKG_VERSION = "2.0.3-test1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -647,6 +647,7 @@ var ServerMsgCode = /* @__PURE__ */ ((ServerMsgCode2) => {
647
647
  ServerMsgCode2[ServerMsgCode2["REJECT_STORAGE_OP"] = 299] = "REJECT_STORAGE_OP";
648
648
  ServerMsgCode2[ServerMsgCode2["UPDATE_YDOC"] = 300] = "UPDATE_YDOC";
649
649
  ServerMsgCode2[ServerMsgCode2["THREAD_CREATED"] = 400] = "THREAD_CREATED";
650
+ ServerMsgCode2[ServerMsgCode2["THREAD_DELETED"] = 407] = "THREAD_DELETED";
650
651
  ServerMsgCode2[ServerMsgCode2["THREAD_METADATA_UPDATED"] = 401] = "THREAD_METADATA_UPDATED";
651
652
  ServerMsgCode2[ServerMsgCode2["COMMENT_CREATED"] = 402] = "COMMENT_CREATED";
652
653
  ServerMsgCode2[ServerMsgCode2["COMMENT_EDITED"] = 403] = "COMMENT_EDITED";
@@ -1916,39 +1917,6 @@ function createStore(initialState) {
1916
1917
  };
1917
1918
  }
1918
1919
 
1919
- // src/lib/deprecation.ts
1920
- var _emittedDeprecationWarnings = /* @__PURE__ */ new Set();
1921
- function deprecate(message, key = message) {
1922
- if (process.env.NODE_ENV !== "production") {
1923
- if (!_emittedDeprecationWarnings.has(key)) {
1924
- _emittedDeprecationWarnings.add(key);
1925
- errorWithTitle("Deprecation warning", message);
1926
- }
1927
- }
1928
- }
1929
- function deprecateIf(condition, message, key = message) {
1930
- if (process.env.NODE_ENV !== "production") {
1931
- if (condition) {
1932
- deprecate(message, key);
1933
- }
1934
- }
1935
- }
1936
- function throwUsageError(message) {
1937
- if (process.env.NODE_ENV !== "production") {
1938
- const usageError = new Error(message);
1939
- usageError.name = "Usage error";
1940
- errorWithTitle("Usage error", message);
1941
- throw usageError;
1942
- }
1943
- }
1944
- function errorIf(condition, message) {
1945
- if (process.env.NODE_ENV !== "production") {
1946
- if (condition) {
1947
- throwUsageError(message);
1948
- }
1949
- }
1950
- }
1951
-
1952
1920
  // src/convert-plain-data.ts
1953
1921
  function convertToCommentData(data) {
1954
1922
  const editedAt = data.editedAt ? new Date(data.editedAt) : void 0;
@@ -5360,8 +5328,8 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
5360
5328
  }
5361
5329
  var MARK_INBOX_NOTIFICATIONS_AS_READ_BATCH_DELAY2 = 50;
5362
5330
  function createRoom(options, config) {
5363
- const initialPresence = typeof options.initialPresence === "function" ? options.initialPresence(config.roomId) : options.initialPresence;
5364
- const initialStorage = typeof options.initialStorage === "function" ? options.initialStorage(config.roomId) : options.initialStorage;
5331
+ const initialPresence = options.initialPresence;
5332
+ const initialStorage = options.initialStorage;
5365
5333
  const [inBackgroundSince, uninstallBgTabSpy] = installBackgroundTabSpy();
5366
5334
  const delegates = {
5367
5335
  ...config.delegates,
@@ -6146,6 +6114,7 @@ ${Array.from(traces).join("\n\n")}`
6146
6114
  break;
6147
6115
  }
6148
6116
  case 400 /* THREAD_CREATED */:
6117
+ case 407 /* THREAD_DELETED */:
6149
6118
  case 401 /* THREAD_METADATA_UPDATED */:
6150
6119
  case 405 /* COMMENT_REACTION_ADDED */:
6151
6120
  case 406 /* COMMENT_REACTION_REMOVED */:
@@ -7257,15 +7226,10 @@ function createClient(options) {
7257
7226
  if (existing !== void 0) {
7258
7227
  return leaseRoom(existing);
7259
7228
  }
7260
- deprecateIf(
7261
- options2.initialPresence === null || options2.initialPresence === void 0,
7262
- "Please provide an initial presence value for the current user when entering the room."
7263
- );
7229
+ const initialPresence = (typeof options2.initialPresence === "function" ? options2.initialPresence(roomId) : options2.initialPresence) ?? {};
7230
+ const initialStorage = (typeof options2.initialStorage === "function" ? options2.initialStorage(roomId) : options2.initialStorage) ?? {};
7264
7231
  const newRoom = createRoom(
7265
- {
7266
- initialPresence: options2.initialPresence ?? {},
7267
- initialStorage: options2.initialStorage
7268
- },
7232
+ { initialPresence, initialStorage },
7269
7233
  {
7270
7234
  roomId,
7271
7235
  throttleDelay,
@@ -8082,6 +8046,39 @@ function legacy_patchImmutableNode(state, path, update) {
8082
8046
  }
8083
8047
  }
8084
8048
 
8049
+ // src/lib/deprecation.ts
8050
+ var _emittedDeprecationWarnings = /* @__PURE__ */ new Set();
8051
+ function deprecate(message, key = message) {
8052
+ if (process.env.NODE_ENV !== "production") {
8053
+ if (!_emittedDeprecationWarnings.has(key)) {
8054
+ _emittedDeprecationWarnings.add(key);
8055
+ errorWithTitle("Deprecation warning", message);
8056
+ }
8057
+ }
8058
+ }
8059
+ function deprecateIf(condition, message, key = message) {
8060
+ if (process.env.NODE_ENV !== "production") {
8061
+ if (condition) {
8062
+ deprecate(message, key);
8063
+ }
8064
+ }
8065
+ }
8066
+ function throwUsageError(message) {
8067
+ if (process.env.NODE_ENV !== "production") {
8068
+ const usageError = new Error(message);
8069
+ usageError.name = "Usage error";
8070
+ errorWithTitle("Usage error", message);
8071
+ throw usageError;
8072
+ }
8073
+ }
8074
+ function errorIf(condition, message) {
8075
+ if (process.env.NODE_ENV !== "production") {
8076
+ if (condition) {
8077
+ throwUsageError(message);
8078
+ }
8079
+ }
8080
+ }
8081
+
8085
8082
  // src/lib/Poller.ts
8086
8083
  function makePoller(callback) {
8087
8084
  let context = {