@liveblocks/core 1.0.2-test4 → 1.0.2-test5

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.ts CHANGED
@@ -1460,6 +1460,63 @@ SerializedCrdt>;
1460
1460
  declare type ParentToChildNodeMap = Map<string, // Parent's node ID
1461
1461
  IdTuple<SerializedChild>[]>;
1462
1462
 
1463
+ /**
1464
+ * "Plain LSON" is a JSON-based format that's used when serializing Live structures
1465
+ * to send them over HTTP (e.g. in the API endpoint to let users upload their initial
1466
+ * Room storage, in the API endpoint to fetch a Room's storage, ...).
1467
+ *
1468
+ * In the client, you would typically create LSON values using:
1469
+ *
1470
+ * new LiveObject({ x: 0, y: 0 })
1471
+ *
1472
+ * But over HTTP, this has to be serialized somehow. The "Plain LSON" format
1473
+ * is what's used in the POST /init-storage-new endpoint, to allow users to
1474
+ * control which parts of their data structure should be considered "Live"
1475
+ * objects, and which parts are "normal" objects.
1476
+ *
1477
+ * So if they have a structure like:
1478
+ *
1479
+ * { x: 0, y: 0 }
1480
+ *
1481
+ * And want to make it a Live object, they can serialize it by wrapping it in
1482
+ * a special "annotation":
1483
+ *
1484
+ * {
1485
+ * "liveblocksType": "LiveObject",
1486
+ * "data": { x: 0, y: 0 },
1487
+ * }
1488
+ *
1489
+ * This "Plain LSON" data format defines exactly those wrappings.
1490
+ *
1491
+ * To summarize:
1492
+ *
1493
+ * LSON value | Plain LSON equivalent
1494
+ * ----------------------+----------------------------------------------
1495
+ * 42 | 42
1496
+ * [1, 2, 3] | [1, 2, 3]
1497
+ * { x: 0, y: 0 } | { x: 0, y: 0 }
1498
+ * ----------------------+----------------------------------------------
1499
+ * new LiveList(...) | { liveblocksType: "LiveList", data: ... }
1500
+ * new LiveMap(...) | { liveblocksType: "LiveMap", data: ... }
1501
+ * new LiveObject(...) | { liveblocksType: "LiveObject", data: ... }
1502
+ *
1503
+ */
1504
+
1505
+ declare type PlainLsonFields = Record<string, PlainLson>;
1506
+ declare type PlainLsonObject = {
1507
+ liveblocksType: "LiveObject";
1508
+ data: PlainLsonFields;
1509
+ };
1510
+ declare type PlainLsonMap = {
1511
+ liveblocksType: "LiveMap";
1512
+ data: PlainLsonFields;
1513
+ };
1514
+ declare type PlainLsonList = {
1515
+ liveblocksType: "LiveList";
1516
+ data: PlainLson[];
1517
+ };
1518
+ declare type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
1519
+
1463
1520
  declare enum WebsocketCloseCodes {
1464
1521
  CLOSE_ABNORMAL = 1006,
1465
1522
  INVALID_MESSAGE_FORMAT = 4000,
@@ -1605,4 +1662,4 @@ declare type EnsureJson<T> = [
1605
1662
  [K in keyof T]: EnsureJson<T[K]>;
1606
1663
  };
1607
1664
 
1608
- export { AckOp, AppOnlyAuthToken, AuthToken, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, ConnectionState, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchStorageClientMsg, History, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveNode, LiveObject, LiveStructure, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, RejectedStorageOpServerMsg, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, assert, assertNever, b64decode, comparePosition, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, tryParseJson };
1665
+ export { AckOp, AppOnlyAuthToken, AuthToken, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, ConnectionState, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchStorageClientMsg, History, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveNode, LiveObject, LiveStructure, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, assert, assertNever, b64decode, comparePosition, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, tryParseJson };
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
113
113
  var onMessageFromPanel = eventSource.observable;
114
114
 
115
115
  // src/devtools/index.ts
116
- var VERSION = true ? "1.0.2-test4" : "dev";
116
+ var VERSION = true ? "1.0.2-test5" : "dev";
117
117
  var _devtoolsSetupHasRun = false;
118
118
  function setupDevTools(getAllRooms) {
119
119
  if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
@@ -4178,7 +4178,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
4178
4178
  const ws = WebSocketPolyfill || WebSocket;
4179
4179
  return (token) => {
4180
4180
  return new ws(
4181
- `${liveblocksServer}/?token=${token}&version=${true ? "1.0.2-test4" : "dev"}`
4181
+ `${liveblocksServer}/?token=${token}&version=${true ? "1.0.2-test5" : "dev"}`
4182
4182
  );
4183
4183
  };
4184
4184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "1.0.2-test4",
3
+ "version": "1.0.2-test5",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",