@liveblocks/core 1.3.3 → 1.3.5

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.mts CHANGED
@@ -1129,6 +1129,11 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
1129
1129
  * @since v1.2 (WS API v7)
1130
1130
  */
1131
1131
  readonly actor: number;
1132
+ /**
1133
+ * Secure nonce for the current session.
1134
+ * @since v1.2 (WS API v7)
1135
+ */
1136
+ readonly nonce: string;
1132
1137
  /**
1133
1138
  * Informs the client what permissions the current User (self) has.
1134
1139
  * @since v1.2 (WS API v7)
@@ -1767,6 +1772,20 @@ declare type ClientOptions = {
1767
1772
  */
1768
1773
  declare function createClient(options: ClientOptions): Client;
1769
1774
 
1775
+ /**
1776
+ * Lookup table for nodes (= SerializedCrdt values) by their IDs.
1777
+ */
1778
+ declare type NodeMap = Map<string, // Node ID
1779
+ SerializedCrdt>;
1780
+ /**
1781
+ * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
1782
+ * by their parent node's IDs.
1783
+ */
1784
+ declare type ParentToChildNodeMap = Map<string, // Parent's node ID
1785
+ IdTuple<SerializedChild>[]>;
1786
+
1787
+ declare function isLiveNode(value: unknown): value is LiveNode;
1788
+
1770
1789
  declare function lsonToJson(value: Lson): Json;
1771
1790
  declare function patchLiveObjectKey<O extends LsonObject, K extends keyof O, V extends Json>(liveObject: LiveObject<O>, key: K, prev?: V, next?: V): void;
1772
1791
  declare function legacy_patchImmutableObject<S extends JsonObject>(state: S, updates: StorageUpdate[]): S;
@@ -2117,18 +2136,6 @@ declare type UpdateYDocClientMsg = {
2117
2136
  readonly update: string;
2118
2137
  };
2119
2138
 
2120
- /**
2121
- * Lookup table for nodes (= SerializedCrdt values) by their IDs.
2122
- */
2123
- declare type NodeMap = Map<string, // Node ID
2124
- SerializedCrdt>;
2125
- /**
2126
- * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
2127
- * by their parent node's IDs.
2128
- */
2129
- declare type ParentToChildNodeMap = Map<string, // Parent's node ID
2130
- IdTuple<SerializedChild>[]>;
2131
-
2132
2139
  declare type JsonTreeNode = {
2133
2140
  readonly type: "Json";
2134
2141
  readonly id: string;
@@ -2292,4 +2299,4 @@ declare type EnsureJson<T> = [
2292
2299
  [K in keyof T]: EnsureJson<T[K]>;
2293
2300
  };
2294
2301
 
2295
- export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
2302
+ export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
package/dist/index.d.ts CHANGED
@@ -1129,6 +1129,11 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
1129
1129
  * @since v1.2 (WS API v7)
1130
1130
  */
1131
1131
  readonly actor: number;
1132
+ /**
1133
+ * Secure nonce for the current session.
1134
+ * @since v1.2 (WS API v7)
1135
+ */
1136
+ readonly nonce: string;
1132
1137
  /**
1133
1138
  * Informs the client what permissions the current User (self) has.
1134
1139
  * @since v1.2 (WS API v7)
@@ -1767,6 +1772,20 @@ declare type ClientOptions = {
1767
1772
  */
1768
1773
  declare function createClient(options: ClientOptions): Client;
1769
1774
 
1775
+ /**
1776
+ * Lookup table for nodes (= SerializedCrdt values) by their IDs.
1777
+ */
1778
+ declare type NodeMap = Map<string, // Node ID
1779
+ SerializedCrdt>;
1780
+ /**
1781
+ * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
1782
+ * by their parent node's IDs.
1783
+ */
1784
+ declare type ParentToChildNodeMap = Map<string, // Parent's node ID
1785
+ IdTuple<SerializedChild>[]>;
1786
+
1787
+ declare function isLiveNode(value: unknown): value is LiveNode;
1788
+
1770
1789
  declare function lsonToJson(value: Lson): Json;
1771
1790
  declare function patchLiveObjectKey<O extends LsonObject, K extends keyof O, V extends Json>(liveObject: LiveObject<O>, key: K, prev?: V, next?: V): void;
1772
1791
  declare function legacy_patchImmutableObject<S extends JsonObject>(state: S, updates: StorageUpdate[]): S;
@@ -2117,18 +2136,6 @@ declare type UpdateYDocClientMsg = {
2117
2136
  readonly update: string;
2118
2137
  };
2119
2138
 
2120
- /**
2121
- * Lookup table for nodes (= SerializedCrdt values) by their IDs.
2122
- */
2123
- declare type NodeMap = Map<string, // Node ID
2124
- SerializedCrdt>;
2125
- /**
2126
- * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
2127
- * by their parent node's IDs.
2128
- */
2129
- declare type ParentToChildNodeMap = Map<string, // Parent's node ID
2130
- IdTuple<SerializedChild>[]>;
2131
-
2132
2139
  declare type JsonTreeNode = {
2133
2140
  readonly type: "Json";
2134
2141
  readonly id: string;
@@ -2292,4 +2299,4 @@ declare type EnsureJson<T> = [
2292
2299
  [K in keyof T]: EnsureJson<T[K]>;
2293
2300
  };
2294
2301
 
2295
- export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
2302
+ export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
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 = "1.3.3";
9
+ var PKG_VERSION = "1.3.5";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -5718,7 +5718,10 @@ function makeClassicSubscribeFn(events) {
5718
5718
  callback
5719
5719
  );
5720
5720
  default:
5721
- return assertNever(first, "Unknown event");
5721
+ return assertNever(
5722
+ first,
5723
+ `"${String(first)}" is not a valid event name`
5724
+ );
5722
5725
  }
5723
5726
  }
5724
5727
  if (second === void 0 || typeof first === "function") {
@@ -5739,7 +5742,9 @@ function makeClassicSubscribeFn(events) {
5739
5742
  return subscribeToLiveStructureShallowly(node, nodeCallback);
5740
5743
  }
5741
5744
  }
5742
- throw new Error(`"${String(first)}" is not a valid event name`);
5745
+ throw new Error(
5746
+ `${String(first)} is not a value that can be subscribed to.`
5747
+ );
5743
5748
  }
5744
5749
  return subscribe;
5745
5750
  }
@@ -6535,5 +6540,6 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
6535
6540
 
6536
6541
 
6537
6542
 
6538
- exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.console = fancy_console_exports; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
6543
+
6544
+ exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.console = fancy_console_exports; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
6539
6545
  //# sourceMappingURL=index.js.map