@liveblocks/client 0.17.11 → 0.18.0-beta2

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/index.mjs CHANGED
@@ -5,3 +5,4 @@ export const LiveList = mod.LiveList;
5
5
  export const LiveMap = mod.LiveMap;
6
6
  export const LiveObject = mod.LiveObject;
7
7
  export const createClient = mod.createClient;
8
+ export const shallow = mod.shallow;
package/internal.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { e as JsonObject, J as Json, B as BaseUserMeta, g as Lson, h as LsonObject, c as LiveObject, S as StorageUpdate } from './index-0007883d.js';
2
- export { i as LiveNode, j as Resolve, k as RoomInitializers, W as WebsocketCloseCodes, l as isJsonArray, m as isJsonObject, n as isJsonScalar } from './index-0007883d.js';
1
+ import { i as JsonObject, J as Json, B as BaseUserMeta, k as Lson, l as LsonObject, c as LiveObject, S as StorageUpdate } from './index-60aa9677.js';
2
+ export { n as LiveNode, o as Resolve, p as RoomInitializers, q as ToImmutable, T as ToJson, W as WebsocketCloseCodes, m as asArrayWithLegacyMethods, r as isJsonArray, s as isJsonObject, t as isJsonScalar } from './index-60aa9677.js';
3
3
 
4
4
  declare enum OpCode {
5
5
  INIT = 0,
@@ -219,18 +219,40 @@ declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
219
219
  * The User whose Presence has changed.
220
220
  */
221
221
  actor: number;
222
+ /**
223
+ * When set, signifies that this is a Full Presence™ update, not a patch.
224
+ *
225
+ * The numeric value itself no longer has specific meaning. Historically,
226
+ * this field was intended so that clients could ignore these broadcasted
227
+ * full presence messages, but it turned out that getting a full presence
228
+ * "keyframe" from time to time was useful.
229
+ *
230
+ * So nowadays, the presence (pun intended) of this `targetActor` field
231
+ * is a backward-compatible way of expressing that the `data` contains
232
+ * all presence fields, and isn't a partial "patch".
233
+ */
234
+ targetActor: number;
222
235
  /**
223
236
  * The partial or full Presence of a User. If the `targetActor` field is set,
224
237
  * this will be the full Presence, otherwise it only contain the fields that
225
238
  * have changed since the last broadcast.
226
239
  */
227
240
  data: TPresence;
241
+ } | {
242
+ type: ServerMsgCode.UPDATE_PRESENCE;
243
+ /**
244
+ * The User whose Presence has changed.
245
+ */
246
+ actor: number;
228
247
  /**
229
- * If this message was sent in response to a newly joined user, this field
230
- * indicates which client this message is for. Other existing clients may
231
- * ignore this message if this message isn't targeted for them.
248
+ * Not set for partial presence updates.
232
249
  */
233
- targetActor?: number;
250
+ targetActor?: undefined;
251
+ /**
252
+ * A partial Presence patch to apply to the User. It will only contain the
253
+ * fields that have changed since the last broadcast.
254
+ */
255
+ data: Partial<TPresence>;
234
256
  };
235
257
  /**
236
258
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -397,11 +419,16 @@ declare function errorIf(condition: unknown, message: string): void;
397
419
 
398
420
  declare function lsonToJson(value: Lson): Json;
399
421
  declare function patchLiveObjectKey<O extends LsonObject, K extends keyof O, V extends Lson>(liveObject: LiveObject<O>, key: K, prev?: V, next?: V): void;
400
- declare function patchImmutableObject<S extends JsonObject>(state: S, updates: StorageUpdate[]): S;
422
+ declare function legacy_patchImmutableObject<S extends JsonObject>(state: S, updates: StorageUpdate[]): S;
401
423
 
402
424
  declare function makePosition(before?: string, after?: string): string;
403
425
  declare function comparePosition(posA: string, posB: string): number;
404
426
 
427
+ /**
428
+ * Freezes the given argument, but only in development builds. In production
429
+ * builds, this is a no-op for performance reasons.
430
+ */
431
+ declare const freeze: typeof Object.freeze;
405
432
  declare function isPlainObject(blob: unknown): blob is {
406
433
  [key: string]: unknown;
407
434
  };
@@ -415,4 +442,4 @@ declare function tryParseJson(rawMessage: string): Json | undefined;
415
442
  */
416
443
  declare function b64decode(b64value: string): string;
417
444
 
418
- export { AppOnlyAuthToken, AuthToken, BroadcastEventClientMsg, BroadcastedEventServerMsg, ClientMsg, ClientMsgCode, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, FetchStorageClientMsg, IdTuple, InitialDocumentStateServerMsg, NodeMap, Op, OpCode, ParentToChildNodeMap, RoomAuthToken, RoomStateServerMsg, Scope, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UserJoinServerMsg, UserLeftServerMsg, assertNever, b64decode, comparePosition, deprecate, deprecateIf, errorIf, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isPlainObject, isRoomAuthToken, isRootCrdt, isScope, lsonToJson, makePosition, nn, patchImmutableObject, patchLiveObjectKey, throwUsageError, tryParseJson };
445
+ export { AppOnlyAuthToken, AuthToken, BroadcastEventClientMsg, BroadcastedEventServerMsg, ClientMsg, ClientMsgCode, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, FetchStorageClientMsg, IdTuple, InitialDocumentStateServerMsg, NodeMap, Op, OpCode, ParentToChildNodeMap, RoomAuthToken, RoomStateServerMsg, Scope, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UserJoinServerMsg, UserLeftServerMsg, assertNever, b64decode, comparePosition, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isPlainObject, isRoomAuthToken, isRootCrdt, isScope, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, throwUsageError, tryParseJson };