@liveblocks/client 0.17.0-test1 → 0.17.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/README.md CHANGED
@@ -18,7 +18,8 @@
18
18
  </a>
19
19
  </p>
20
20
 
21
- A client that lets you interact with [Liveblocks](https://liveblocks.io) servers.
21
+ A client that lets you interact with [Liveblocks](https://liveblocks.io)
22
+ servers.
22
23
 
23
24
  ## Installation
24
25
 
@@ -28,25 +29,33 @@ npm install @liveblocks/client
28
29
 
29
30
  ## Documentation
30
31
 
31
- - [Read the documentation](https://liveblocks.io/docs) to start using Liveblocks.
32
- - Explore the [API Reference](https://liveblocks.io/docs/api-reference/liveblocks-client).
32
+ - [Read the documentation](https://liveblocks.io/docs) to start using
33
+ Liveblocks.
34
+ - Explore the
35
+ [API Reference](https://liveblocks.io/docs/api-reference/liveblocks-client).
33
36
 
34
37
  ## Examples
35
38
 
36
- - Browse our gallery of collaborative UI patterns. [View examples gallery](https://liveblocks.io/examples)
37
- - Explore and clone any of our open-source examples. [View code examples](https://github.com/liveblocks/liveblocks/tree/main/examples)
39
+ - Browse our gallery of collaborative UI patterns.
40
+ [View examples gallery](https://liveblocks.io/examples)
41
+ - Explore and clone any of our open-source examples.
42
+ [View code examples](https://github.com/liveblocks/liveblocks/tree/main/examples)
38
43
 
39
44
  ## Releases
40
45
 
41
- For changelog, visit [https://github.com/liveblocks/liveblocks/releases](https://github.com/liveblocks/liveblocks/releases).
46
+ For changelog, visit
47
+ [https://github.com/liveblocks/liveblocks/releases](https://github.com/liveblocks/liveblocks/releases).
42
48
 
43
49
  ## Community
44
50
 
45
- - [Discord](https://discord.gg/X4YWJuH9VY) - To get involved with the Liveblocks community, ask questions and share tips.
46
- - [Twitter](https://twitter.com/liveblocks) - To receive updates, announcements, blog posts, and general Liveblocks tips.
51
+ - [Discord](https://discord.gg/X4YWJuH9VY) - To get involved with the Liveblocks
52
+ community, ask questions and share tips.
53
+ - [Twitter](https://twitter.com/liveblocks) - To receive updates, announcements,
54
+ blog posts, and general Liveblocks tips.
47
55
 
48
56
  ## License
49
57
 
50
- Licensed under the Apache License 2.0, Copyright © 2021-present [Liveblocks](https://liveblocks.io).
58
+ Licensed under the Apache License 2.0, Copyright © 2021-present
59
+ [Liveblocks](https://liveblocks.io).
51
60
 
52
61
  See [LICENSE](../../LICENSE) for more information.
package/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  import { C as ClientOptions, a as Client } from "./shared.js";
2
2
  export {
3
- B as BroadcastOptions,
3
+ B as BaseUserMeta,
4
+ d as BroadcastOptions,
4
5
  a as Client,
5
6
  H as History,
6
7
  J as Json,
7
- d as JsonObject,
8
+ e as JsonObject,
8
9
  L as LiveList,
9
10
  b as LiveMap,
10
11
  c as LiveObject,
11
- e as LiveStructure,
12
- f as Lson,
13
- g as LsonObject,
12
+ f as LiveStructure,
13
+ g as Lson,
14
+ h as LsonObject,
14
15
  O as Others,
15
16
  P as Presence,
16
17
  R as Room,
@@ -39,7 +40,7 @@ export {
39
40
  * body: JSON.stringify({ room })
40
41
  * });
41
42
  *
42
- * return await response.json();
43
+ * return await response.json(); // should be: { token: "..." }
43
44
  * }
44
45
  * });
45
46
  */
package/index.js CHANGED
@@ -348,6 +348,10 @@ function makeStateMachine(state, context, mockedEffects) {
348
348
  }
349
349
  }
350
350
  function connect() {
351
+ var _context$polyfills$fe,
352
+ _context$polyfills,
353
+ _context$polyfills$We,
354
+ _context$polyfills2;
351
355
  if (
352
356
  "closed" !== state.connection.state &&
353
357
  "unavailable" !== state.connection.state
@@ -380,9 +384,28 @@ function makeStateMachine(state, context, mockedEffects) {
380
384
  );
381
385
  };
382
386
  }
383
- if ("custom" === authentication.type) return authentication.callback;
387
+ if ("custom" === authentication.type) {
388
+ return function (room) {
389
+ return authentication.callback(room).then(function (response) {
390
+ if (!response || !response.token)
391
+ throw new Error(
392
+ 'Authentication error. We expect the authentication callback to return a token, but it does not. Hint: the return value should look like: { token: "..." }'
393
+ );
394
+ return response;
395
+ });
396
+ };
397
+ }
384
398
  throw new Error("Internal error. Unexpected authentication type");
385
- })(context.authentication, context.fetchPolyfill),
399
+ })(
400
+ context.authentication,
401
+ null !=
402
+ (_context$polyfills$fe =
403
+ null == (_context$polyfills = context.polyfills)
404
+ ? void 0
405
+ : _context$polyfills.fetch)
406
+ ? _context$polyfills$fe
407
+ : context.fetchPolyfill
408
+ ),
386
409
  createWebSocket = (function (liveblocksServer, WebSocketPolyfill) {
387
410
  if ("undefined" == typeof window && null == WebSocketPolyfill)
388
411
  throw new Error(
@@ -390,9 +413,20 @@ function makeStateMachine(state, context, mockedEffects) {
390
413
  );
391
414
  var ws = WebSocketPolyfill || WebSocket;
392
415
  return function (token) {
393
- return new ws(liveblocksServer + "/?token=" + token);
416
+ return new ws(
417
+ liveblocksServer + "/?token=" + token + "&version=0.17.1"
418
+ );
394
419
  };
395
- })(context.liveblocksServer, context.WebSocketPolyfill);
420
+ })(
421
+ context.liveblocksServer,
422
+ null !=
423
+ (_context$polyfills$We =
424
+ null == (_context$polyfills2 = context.polyfills)
425
+ ? void 0
426
+ : _context$polyfills2.WebSocket)
427
+ ? _context$polyfills$We
428
+ : context.WebSocketPolyfill
429
+ );
396
430
  updateConnection({ state: "authenticating" }),
397
431
  effects.authenticate(auth, createWebSocket);
398
432
  }
@@ -429,6 +463,8 @@ function makeStateMachine(state, context, mockedEffects) {
429
463
  ? {
430
464
  connectionId: message.actor,
431
465
  presence: message.data,
466
+ id: void 0,
467
+ info: void 0,
432
468
  _hasReceivedInitialPresence: !0,
433
469
  }
434
470
  : {
@@ -812,46 +848,46 @@ function makeStateMachine(state, context, mockedEffects) {
812
848
  for (var _key6 in state.listeners) state.listeners[_key6] = [];
813
849
  })();
814
850
  },
815
- subscribe: function (firstParam, listener, options) {
816
- if (Json.isLiveNode(firstParam))
817
- return (function (liveValue, innerCallback, options) {
818
- return genericSubscribe(function (updates) {
819
- for (
820
- var _step,
821
- relatedUpdates = [],
822
- _iterator = Json._createForOfIteratorHelperLoose(updates);
823
- !(_step = _iterator()).done;
851
+ subscribe: function (first, second, options) {
852
+ if (void 0 === second || "function" == typeof first) {
853
+ if ("function" == typeof first) return genericSubscribe(first);
854
+ throw new Error("Please specify a listener callback");
855
+ }
856
+ if (Json.isLiveNode(first)) {
857
+ var _node = first;
858
+ return null != options && options.isDeep
859
+ ? ((node = _node),
860
+ (callback = second),
861
+ genericSubscribe(function (updates) {
862
+ var relatedUpdates = updates.filter(function (update) {
863
+ return Json.isSameNodeOrChildOf(update.node, node);
864
+ });
865
+ relatedUpdates.length > 0 && callback(relatedUpdates);
866
+ }))
867
+ : (function (node, callback) {
868
+ return genericSubscribe(function (updates) {
869
+ for (
870
+ var _step,
871
+ _iterator = Json._createForOfIteratorHelperLoose(updates);
872
+ !(_step = _iterator()).done;
824
873
 
825
- ) {
826
- var update = _step.value;
827
- null != options &&
828
- options.isDeep &&
829
- Json.isSameNodeOrChildOf(update.node, liveValue)
830
- ? relatedUpdates.push(update)
831
- : update.node._id === liveValue._id &&
832
- innerCallback(update.node);
833
- }
834
- null != options &&
835
- options.isDeep &&
836
- relatedUpdates.length > 0 &&
837
- innerCallback(relatedUpdates);
838
- });
839
- })(firstParam, listener, options);
840
- if ("function" == typeof firstParam) return genericSubscribe(firstParam);
841
- if (
842
- "my-presence" !== (value = firstParam) &&
843
- "others" !== value &&
844
- "event" !== value &&
845
- "error" !== value &&
846
- "connection" !== value
847
- )
848
- throw new Error('"' + firstParam + '" is not a valid event name');
849
- var value;
874
+ ) {
875
+ var update = _step.value;
876
+ update.node._id === node._id && callback(update.node);
877
+ }
878
+ });
879
+ })(_node, second);
880
+ }
881
+ var node, callback;
882
+ if (!Json.isRoomEventName(first))
883
+ throw new Error('"' + first + '" is not a valid event name');
884
+ var eventName = first,
885
+ eventListener = second;
850
886
  return (
851
- state.listeners[firstParam].push(listener),
887
+ state.listeners[eventName].push(eventListener),
852
888
  function () {
853
- var callbacks = state.listeners[firstParam];
854
- Json.remove(callbacks, listener);
889
+ var callbacks = state.listeners[eventName];
890
+ Json.remove(callbacks, eventListener);
855
891
  }
856
892
  );
857
893
  },
@@ -1141,18 +1177,37 @@ var AuthenticationError = (function (_Error2) {
1141
1177
  return Json._inheritsLoose(AuthenticationError, _Error2), AuthenticationError;
1142
1178
  })(Json._wrapNativeSuper(Error));
1143
1179
  function prepareAuthentication(clientOptions) {
1144
- if ("string" == typeof clientOptions.publicApiKey)
1180
+ var publicApiKey = clientOptions.publicApiKey,
1181
+ authEndpoint = clientOptions.authEndpoint;
1182
+ if (void 0 !== authEndpoint && void 0 !== publicApiKey)
1183
+ throw new Error(
1184
+ "You cannot use both publicApiKey and authEndpoint. Please use either publicApiKey or authEndpoint, but not both. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient"
1185
+ );
1186
+ if ("string" == typeof publicApiKey) {
1187
+ if (publicApiKey.startsWith("sk_"))
1188
+ throw new Error(
1189
+ "Invalid publicApiKey. You are using the secret key which is not supported. Please use the public key instead. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey"
1190
+ );
1191
+ if (!publicApiKey.startsWith("pk_"))
1192
+ throw new Error(
1193
+ "Invalid key. Please use the public key format: pk_<public key>. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey"
1194
+ );
1145
1195
  return {
1146
1196
  type: "public",
1147
- publicApiKey: clientOptions.publicApiKey,
1197
+ publicApiKey: publicApiKey,
1148
1198
  url:
1149
1199
  clientOptions.publicAuthorizeEndpoint ||
1150
1200
  "https://liveblocks.io/api/public/authorize",
1151
1201
  };
1152
- if ("string" == typeof clientOptions.authEndpoint)
1153
- return { type: "private", url: clientOptions.authEndpoint };
1154
- if ("function" == typeof clientOptions.authEndpoint)
1155
- return { type: "custom", callback: clientOptions.authEndpoint };
1202
+ }
1203
+ if ("string" == typeof authEndpoint)
1204
+ return { type: "private", url: authEndpoint };
1205
+ if ("function" == typeof authEndpoint)
1206
+ return { type: "custom", callback: authEndpoint };
1207
+ if (void 0 !== authEndpoint)
1208
+ throw new Error(
1209
+ "authEndpoint must be a string or a function. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientAuthEndpoint"
1210
+ );
1156
1211
  throw new Error(
1157
1212
  "Invalid Liveblocks client options. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient"
1158
1213
  );
@@ -1224,6 +1279,7 @@ function prepareAuthentication(clientOptions) {
1224
1279
  {
1225
1280
  roomId: roomId,
1226
1281
  throttleDelay: throttleDelay,
1282
+ polyfills: clientOptions.polyfills,
1227
1283
  WebSocketPolyfill: clientOptions.WebSocketPolyfill,
1228
1284
  fetchPolyfill: clientOptions.fetchPolyfill,
1229
1285
  liveblocksServer:
@@ -1238,11 +1294,17 @@ function prepareAuthentication(clientOptions) {
1238
1294
  !options.DO_NOT_USE_withoutConnecting)
1239
1295
  ) {
1240
1296
  if ("undefined" == typeof atob) {
1241
- if (null == clientOptions.atobPolyfill)
1297
+ var _clientOptions$polyfi;
1298
+ if (
1299
+ null ==
1300
+ (null == (_clientOptions$polyfi = clientOptions.polyfills)
1301
+ ? void 0
1302
+ : _clientOptions$polyfi.atob)
1303
+ )
1242
1304
  throw new Error(
1243
1305
  "You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
1244
1306
  );
1245
- global.atob = clientOptions.atobPolyfill;
1307
+ global.atob = clientOptions.polyfills.atob;
1246
1308
  }
1247
1309
  internalRoom.connect();
1248
1310
  }
package/index.mjs CHANGED
@@ -1,29 +1,30 @@
1
1
  import {
2
2
  _ as __rest,
3
- i as isLiveNode,
4
3
  r as remove,
4
+ i as isLiveNode,
5
+ a as isRoomEventName,
5
6
  S as ServerMsgCode,
6
7
  m as mergeStorageUpdates,
7
8
  W as WebsocketCloseCodes,
8
9
  C as ClientMsgCode,
9
10
  n as nn,
10
- a as isPlainObject,
11
+ b as isPlainObject,
11
12
  p as parseRoomAuthToken,
12
- b as isTokenExpired,
13
- c as isSameNodeOrChildOf,
13
+ c as isTokenExpired,
14
+ d as isSameNodeOrChildOf,
14
15
  L as LiveObject,
15
16
  g as getTreesDiffOperations,
16
17
  O as OpSource,
17
- d as OpCode,
18
- e as isLiveList,
18
+ e as OpCode,
19
+ f as isLiveList,
19
20
  t as tryParseJson,
20
- f as isJsonArray,
21
- h as compact,
22
- j as isRootCrdt,
23
- k as isJsonObject,
24
- l as errorIf,
21
+ h as isJsonArray,
22
+ j as compact,
23
+ k as isRootCrdt,
24
+ l as isJsonObject,
25
+ o as errorIf,
25
26
  } from "./shared.mjs";
26
- export { o as LiveList, q as LiveMap, L as LiveObject } from "./shared.mjs";
27
+ export { q as LiveList, s as LiveMap, L as LiveObject } from "./shared.mjs";
27
28
  const BACKOFF_RETRY_DELAYS = [250, 500, 1e3, 2e3, 4e3, 8e3, 1e4],
28
29
  BACKOFF_RETRY_DELAYS_SLOW = [2e3, 3e4, 6e4, 3e5];
29
30
  function makeOthers(userMap) {
@@ -280,6 +281,7 @@ function makeStateMachine(state, context, mockedEffects) {
280
281
  }
281
282
  }
282
283
  function connect() {
284
+ var _a, _b, _c, _d;
283
285
  if (
284
286
  "closed" !== state.connection.state &&
285
287
  "unavailable" !== state.connection.state
@@ -307,17 +309,45 @@ function makeStateMachine(state, context, mockedEffects) {
307
309
  room: room,
308
310
  });
309
311
  }
310
- if ("custom" === authentication.type) return authentication.callback;
312
+ if ("custom" === authentication.type) {
313
+ return (room) =>
314
+ authentication.callback(room).then((response) => {
315
+ if (!response || !response.token)
316
+ throw new Error(
317
+ 'Authentication error. We expect the authentication callback to return a token, but it does not. Hint: the return value should look like: { token: "..." }'
318
+ );
319
+ return response;
320
+ });
321
+ }
311
322
  throw new Error("Internal error. Unexpected authentication type");
312
- })(context.authentication, context.fetchPolyfill),
323
+ })(
324
+ context.authentication,
325
+ null !==
326
+ (_b =
327
+ null === (_a = context.polyfills) || void 0 === _a
328
+ ? void 0
329
+ : _a.fetch) && void 0 !== _b
330
+ ? _b
331
+ : context.fetchPolyfill
332
+ ),
313
333
  createWebSocket = (function (liveblocksServer, WebSocketPolyfill) {
314
334
  if ("undefined" == typeof window && null == WebSocketPolyfill)
315
335
  throw new Error(
316
336
  "To use Liveblocks client in a non-dom environment, you need to provide a WebSocket polyfill."
317
337
  );
318
338
  const ws = WebSocketPolyfill || WebSocket;
319
- return (token) => new ws(`${liveblocksServer}/?token=${token}`);
320
- })(context.liveblocksServer, context.WebSocketPolyfill);
339
+ return (token) =>
340
+ new ws(`${liveblocksServer}/?token=${token}&version=0.17.1`);
341
+ })(
342
+ context.liveblocksServer,
343
+ null !==
344
+ (_d =
345
+ null === (_c = context.polyfills) || void 0 === _c
346
+ ? void 0
347
+ : _c.WebSocket) && void 0 !== _d
348
+ ? _d
349
+ : context.WebSocketPolyfill
350
+ );
321
351
  updateConnection({ state: "authenticating" }),
322
352
  effects.authenticate(auth, createWebSocket);
323
353
  }
@@ -351,6 +381,8 @@ function makeStateMachine(state, context, mockedEffects) {
351
381
  ? {
352
382
  connectionId: message.actor,
353
383
  presence: message.data,
384
+ id: void 0,
385
+ info: void 0,
354
386
  _hasReceivedInitialPresence: !0,
355
387
  }
356
388
  : {
@@ -664,37 +696,41 @@ function makeStateMachine(state, context, mockedEffects) {
664
696
  for (const key in state.listeners) state.listeners[key] = [];
665
697
  })();
666
698
  },
667
- subscribe: function (firstParam, listener, options) {
668
- if (isLiveNode(firstParam))
669
- return (function (liveValue, innerCallback, options) {
699
+ subscribe: function (first, second, options) {
700
+ if (void 0 === second || "function" == typeof first) {
701
+ if ("function" == typeof first) {
702
+ return genericSubscribe(first);
703
+ }
704
+ throw new Error("Please specify a listener callback");
705
+ }
706
+ if (isLiveNode(first)) {
707
+ const node = first;
708
+ if (null == options ? void 0 : options.isDeep) {
709
+ return (function (node, callback) {
710
+ return genericSubscribe((updates) => {
711
+ const relatedUpdates = updates.filter((update) =>
712
+ isSameNodeOrChildOf(update.node, node)
713
+ );
714
+ relatedUpdates.length > 0 && callback(relatedUpdates);
715
+ });
716
+ })(node, second);
717
+ }
718
+ return (function (node, callback) {
670
719
  return genericSubscribe((updates) => {
671
- const relatedUpdates = [];
672
720
  for (const update of updates)
673
- (null == options ? void 0 : options.isDeep) &&
674
- isSameNodeOrChildOf(update.node, liveValue)
675
- ? relatedUpdates.push(update)
676
- : update.node._id === liveValue._id &&
677
- innerCallback(update.node);
678
- (null == options ? void 0 : options.isDeep) &&
679
- relatedUpdates.length > 0 &&
680
- innerCallback(relatedUpdates);
721
+ update.node._id === node._id && callback(update.node);
681
722
  });
682
- })(firstParam, listener, options);
683
- if ("function" == typeof firstParam) return genericSubscribe(firstParam);
684
- if (
685
- "my-presence" !== (value = firstParam) &&
686
- "others" !== value &&
687
- "event" !== value &&
688
- "error" !== value &&
689
- "connection" !== value
690
- )
691
- throw new Error(`"${firstParam}" is not a valid event name`);
692
- var value;
723
+ })(node, second);
724
+ }
725
+ if (!isRoomEventName(first))
726
+ throw new Error(`"${first}" is not a valid event name`);
727
+ const eventName = first,
728
+ eventListener = second;
693
729
  return (
694
- state.listeners[firstParam].push(listener),
730
+ state.listeners[eventName].push(eventListener),
695
731
  () => {
696
- const callbacks = state.listeners[firstParam];
697
- remove(callbacks, listener);
732
+ const callbacks = state.listeners[eventName];
733
+ remove(callbacks, eventListener);
698
734
  }
699
735
  );
700
736
  },
@@ -980,6 +1016,7 @@ function createClient(options) {
980
1016
  return internalRoom ? internalRoom.room : null;
981
1017
  },
982
1018
  enter: function (roomId, options = {}) {
1019
+ var _a;
983
1020
  let internalRoom = rooms.get(roomId);
984
1021
  if (internalRoom) return internalRoom.room;
985
1022
  if (
@@ -1001,6 +1038,7 @@ function createClient(options) {
1001
1038
  {
1002
1039
  roomId: roomId,
1003
1040
  throttleDelay: throttleDelay,
1041
+ polyfills: clientOptions.polyfills,
1004
1042
  WebSocketPolyfill: clientOptions.WebSocketPolyfill,
1005
1043
  fetchPolyfill: clientOptions.fetchPolyfill,
1006
1044
  liveblocksServer:
@@ -1015,11 +1053,16 @@ function createClient(options) {
1015
1053
  !options.DO_NOT_USE_withoutConnecting)
1016
1054
  ) {
1017
1055
  if ("undefined" == typeof atob) {
1018
- if (null == clientOptions.atobPolyfill)
1056
+ if (
1057
+ null ==
1058
+ (null === (_a = clientOptions.polyfills) || void 0 === _a
1059
+ ? void 0
1060
+ : _a.atob)
1061
+ )
1019
1062
  throw new Error(
1020
1063
  "You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
1021
1064
  );
1022
- global.atob = clientOptions.atobPolyfill;
1065
+ global.atob = clientOptions.polyfills.atob;
1023
1066
  }
1024
1067
  internalRoom.connect();
1025
1068
  }
@@ -1033,18 +1076,37 @@ function createClient(options) {
1033
1076
  );
1034
1077
  }
1035
1078
  function prepareAuthentication(clientOptions) {
1036
- if ("string" == typeof clientOptions.publicApiKey)
1079
+ const { publicApiKey: publicApiKey, authEndpoint: authEndpoint } =
1080
+ clientOptions;
1081
+ if (void 0 !== authEndpoint && void 0 !== publicApiKey)
1082
+ throw new Error(
1083
+ "You cannot use both publicApiKey and authEndpoint. Please use either publicApiKey or authEndpoint, but not both. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient"
1084
+ );
1085
+ if ("string" == typeof publicApiKey) {
1086
+ if (publicApiKey.startsWith("sk_"))
1087
+ throw new Error(
1088
+ "Invalid publicApiKey. You are using the secret key which is not supported. Please use the public key instead. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey"
1089
+ );
1090
+ if (!publicApiKey.startsWith("pk_"))
1091
+ throw new Error(
1092
+ "Invalid key. Please use the public key format: pk_<public key>. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey"
1093
+ );
1037
1094
  return {
1038
1095
  type: "public",
1039
- publicApiKey: clientOptions.publicApiKey,
1096
+ publicApiKey: publicApiKey,
1040
1097
  url:
1041
1098
  clientOptions.publicAuthorizeEndpoint ||
1042
1099
  "https://liveblocks.io/api/public/authorize",
1043
1100
  };
1044
- if ("string" == typeof clientOptions.authEndpoint)
1045
- return { type: "private", url: clientOptions.authEndpoint };
1046
- if ("function" == typeof clientOptions.authEndpoint)
1047
- return { type: "custom", callback: clientOptions.authEndpoint };
1101
+ }
1102
+ if ("string" == typeof authEndpoint)
1103
+ return { type: "private", url: authEndpoint };
1104
+ if ("function" == typeof authEndpoint)
1105
+ return { type: "custom", callback: authEndpoint };
1106
+ if (void 0 !== authEndpoint)
1107
+ throw new Error(
1108
+ "authEndpoint must be a string or a function. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientAuthEndpoint"
1109
+ );
1048
1110
  throw new Error(
1049
1111
  "Invalid Liveblocks client options. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient"
1050
1112
  );