@liveblocks/core 1.10.0 → 1.10.2

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 = "1.10.0";
9
+ var PKG_VERSION = "1.10.2";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -742,11 +742,13 @@ var LiveblocksError = class extends Error {
742
742
  this.code = code;
743
743
  }
744
744
  };
745
- function nextBackoffDelay(currentDelay, delays = BACKOFF_DELAYS) {
745
+ function nextBackoffDelay(currentDelay, delays) {
746
746
  return delays.find((delay) => delay > currentDelay) ?? delays[delays.length - 1];
747
747
  }
748
748
  function increaseBackoffDelay(context) {
749
- context.patch({ backoffDelay: nextBackoffDelay(context.backoffDelay) });
749
+ context.patch({
750
+ backoffDelay: nextBackoffDelay(context.backoffDelay, BACKOFF_DELAYS)
751
+ });
750
752
  }
751
753
  function increaseBackoffDelayAggressively(context) {
752
754
  context.patch({
@@ -893,8 +895,7 @@ function createConnectionStateMachine(delegates, options) {
893
895
  (okEvent) => ({
894
896
  target: "@connecting.busy",
895
897
  effect: assign({
896
- authValue: okEvent.data,
897
- backoffDelay: RESET_DELAY
898
+ authValue: okEvent.data
898
899
  })
899
900
  }),
900
901
  // Auth failed
@@ -3979,15 +3980,14 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3979
3980
  constructor(obj = {}) {
3980
3981
  super();
3981
3982
  this._propToLastUpdate = /* @__PURE__ */ new Map();
3982
- for (const key in obj) {
3983
- const value = obj[key];
3984
- if (value === void 0) {
3985
- continue;
3986
- } else if (isLiveNode(value)) {
3983
+ const o = compactObject(obj);
3984
+ for (const key of Object.keys(o)) {
3985
+ const value = o[key];
3986
+ if (isLiveNode(value)) {
3987
3987
  value._setParentLink(this, key);
3988
3988
  }
3989
3989
  }
3990
- this._map = new Map(Object.entries(obj));
3990
+ this._map = new Map(Object.entries(o));
3991
3991
  }
3992
3992
  /** @internal */
3993
3993
  static _buildRootAndParentToChildren(items) {
@@ -7066,12 +7066,10 @@ var MAX_LOST_CONNECTION_TIMEOUT = 3e4;
7066
7066
  var DEFAULT_LOST_CONNECTION_TIMEOUT = 5e3;
7067
7067
  var RESOLVE_USERS_BATCH_DELAY = 50;
7068
7068
  var RESOLVE_ROOMS_INFO_BATCH_DELAY = 50;
7069
- function getBaseUrlFromClientOptions(clientOptions) {
7070
- if ("liveblocksServer" in clientOptions) {
7071
- throw new Error("Client option no longer supported");
7072
- }
7073
- if (typeof clientOptions.baseUrl === "string" && clientOptions.baseUrl.startsWith("http")) {
7074
- return clientOptions.baseUrl;
7069
+ function getBaseUrl(baseUrl) {
7070
+ baseUrl || (baseUrl = process.env.LIVEBLOCKS_BASE_URL || process.env.NEXT_PUBLIC_LIVEBLOCKS_BASE_URL || process.env.VITE_LIVEBLOCKS_BASE_URL || void 0);
7071
+ if (typeof baseUrl === "string" && baseUrl.startsWith("http")) {
7072
+ return baseUrl;
7075
7073
  } else {
7076
7074
  return DEFAULT_BASE_URL;
7077
7075
  }
@@ -7092,7 +7090,7 @@ function createClient(options) {
7092
7090
  const backgroundKeepAliveTimeout = getBackgroundKeepAliveTimeout(
7093
7091
  clientOptions.backgroundKeepAliveTimeout
7094
7092
  );
7095
- const baseUrl = getBaseUrlFromClientOptions(clientOptions);
7093
+ const baseUrl = getBaseUrl(clientOptions.baseUrl);
7096
7094
  const authManager = createAuthManager(options);
7097
7095
  const roomsById = /* @__PURE__ */ new Map();
7098
7096
  function teardownRoom(room) {