@liveblocks/core 3.23.0 → 3.23.1-exp1

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.cts CHANGED
@@ -217,118 +217,6 @@ type BaseUserMeta = {
217
217
  info?: IUserInfo;
218
218
  };
219
219
 
220
- type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
221
- declare const CrdtType: Readonly<{
222
- OBJECT: 0;
223
- LIST: 1;
224
- MAP: 2;
225
- REGISTER: 3;
226
- FILE: 5;
227
- }>;
228
- declare namespace CrdtType {
229
- type OBJECT = typeof CrdtType.OBJECT;
230
- type LIST = typeof CrdtType.LIST;
231
- type MAP = typeof CrdtType.MAP;
232
- type REGISTER = typeof CrdtType.REGISTER;
233
- type FILE = typeof CrdtType.FILE;
234
- }
235
- type SerializedCrdt = SerializedRootObject | SerializedChild;
236
- type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedFile;
237
- type LiveFileData = {
238
- readonly id: string;
239
- readonly name: string;
240
- readonly size: number;
241
- readonly mimeType: string;
242
- };
243
- type SerializedRootObject = {
244
- readonly type: CrdtType.OBJECT;
245
- readonly data: JsonObject;
246
- readonly parentId?: never;
247
- readonly parentKey?: never;
248
- };
249
- type SerializedObject = {
250
- readonly type: CrdtType.OBJECT;
251
- readonly parentId: string;
252
- readonly parentKey: string;
253
- readonly data: JsonObject;
254
- };
255
- type SerializedList = {
256
- readonly type: CrdtType.LIST;
257
- readonly parentId: string;
258
- readonly parentKey: string;
259
- };
260
- type SerializedMap = {
261
- readonly type: CrdtType.MAP;
262
- readonly parentId: string;
263
- readonly parentKey: string;
264
- };
265
- type SerializedRegister = {
266
- readonly type: CrdtType.REGISTER;
267
- readonly parentId: string;
268
- readonly parentKey: string;
269
- readonly data: Json;
270
- };
271
- type SerializedFile = {
272
- readonly type: CrdtType.FILE;
273
- readonly parentId: string;
274
- readonly parentKey: string;
275
- readonly data: LiveFileData;
276
- };
277
- type StorageNode = RootStorageNode | ChildStorageNode;
278
- type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | FileStorageNode;
279
- type RootStorageNode = [id: "root", value: SerializedRootObject];
280
- type ObjectStorageNode = [id: string, value: SerializedObject];
281
- type ListStorageNode = [id: string, value: SerializedList];
282
- type MapStorageNode = [id: string, value: SerializedMap];
283
- type RegisterStorageNode = [id: string, value: SerializedRegister];
284
- type FileStorageNode = [id: string, value: SerializedFile];
285
- type NodeMap = Map<string, SerializedCrdt>;
286
- type NodeStream = Iterable<StorageNode>;
287
- declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
288
- declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
289
- declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
290
- declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
291
- declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
292
- declare function isFileStorageNode(node: StorageNode): node is FileStorageNode;
293
- type CompactNode = CompactRootNode | CompactChildNode;
294
- type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactFileNode;
295
- type CompactRootNode = readonly [id: "root", data: JsonObject];
296
- type CompactObjectNode = readonly [
297
- id: string,
298
- type: CrdtType.OBJECT,
299
- parentId: string,
300
- parentKey: string,
301
- data: JsonObject
302
- ];
303
- type CompactListNode = readonly [
304
- id: string,
305
- type: CrdtType.LIST,
306
- parentId: string,
307
- parentKey: string
308
- ];
309
- type CompactMapNode = readonly [
310
- id: string,
311
- type: CrdtType.MAP,
312
- parentId: string,
313
- parentKey: string
314
- ];
315
- type CompactRegisterNode = readonly [
316
- id: string,
317
- type: CrdtType.REGISTER,
318
- parentId: string,
319
- parentKey: string,
320
- data: Json
321
- ];
322
- type CompactFileNode = readonly [
323
- id: string,
324
- type: CrdtType.FILE,
325
- parentId: string,
326
- parentKey: string,
327
- data: LiveFileData
328
- ];
329
- declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
330
- declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
331
-
332
220
  declare const brand: unique symbol;
333
221
  type Brand<T, TBrand extends string> = T & {
334
222
  [brand]: TBrand;
@@ -414,6 +302,8 @@ declare const OpCode: Readonly<{
414
302
  DELETE_OBJECT_KEY: 6;
415
303
  CREATE_MAP: 7;
416
304
  CREATE_REGISTER: 8;
305
+ CREATE_TEXT: 9;
306
+ UPDATE_TEXT: 10;
417
307
  CREATE_FILE: 11;
418
308
  }>;
419
309
  declare namespace OpCode {
@@ -426,14 +316,49 @@ declare namespace OpCode {
426
316
  type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
427
317
  type CREATE_MAP = typeof OpCode.CREATE_MAP;
428
318
  type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
319
+ type CREATE_TEXT = typeof OpCode.CREATE_TEXT;
320
+ type UPDATE_TEXT = typeof OpCode.UPDATE_TEXT;
429
321
  type CREATE_FILE = typeof OpCode.CREATE_FILE;
430
322
  }
323
+ type TextAttributes = JsonObject;
324
+ /**
325
+ * A single segment in a {@link LiveTextData} document.
326
+ *
327
+ * @example
328
+ * ["Hello world"]
329
+ * ["Hello ", { bold: true }]
330
+ */
331
+ type LiveTextSegment = [text: string] | [text: string, attributes: TextAttributes];
332
+ /**
333
+ * Serialized form of a {@link LiveText} document: an ordered list of text
334
+ * segments with optional inline attributes.
335
+ *
336
+ * @example
337
+ * [["Hello world"]]
338
+ * [["Hello ", { bold: true }], ["world"]]
339
+ */
340
+ type LiveTextData = LiveTextSegment[];
341
+ type TextOperation = {
342
+ type: "insert";
343
+ index: number;
344
+ text: string;
345
+ attributes?: TextAttributes;
346
+ } | {
347
+ type: "delete";
348
+ index: number;
349
+ length: number;
350
+ } | {
351
+ type: "format";
352
+ index: number;
353
+ length: number;
354
+ attributes: JsonObject;
355
+ };
431
356
  /**
432
357
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
433
358
  * only.
434
359
  */
435
- type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
436
- type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateFileOp;
360
+ type Op = CreateOp | UpdateObjectOp | UpdateTextOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
361
+ type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateTextOp | CreateFileOp;
437
362
  type UpdateObjectOp = {
438
363
  readonly opId?: string;
439
364
  readonly id: string;
@@ -478,6 +403,17 @@ type CreateRegisterOp = {
478
403
  readonly intent?: "set" | "push";
479
404
  readonly deletedId?: string;
480
405
  };
406
+ type CreateTextOp = {
407
+ readonly opId?: string;
408
+ readonly id: string;
409
+ readonly type: OpCode.CREATE_TEXT;
410
+ readonly parentId: string;
411
+ readonly parentKey: string;
412
+ readonly data: LiveTextData;
413
+ readonly version: number;
414
+ readonly intent?: "set" | "push";
415
+ readonly deletedId?: string;
416
+ };
481
417
  type CreateFileOp = {
482
418
  readonly opId?: string;
483
419
  readonly id: string;
@@ -488,6 +424,14 @@ type CreateFileOp = {
488
424
  readonly intent?: "set" | "push";
489
425
  readonly deletedId?: string;
490
426
  };
427
+ type UpdateTextOp = {
428
+ readonly opId?: string;
429
+ readonly id: string;
430
+ readonly type: OpCode.UPDATE_TEXT;
431
+ readonly baseVersion: number;
432
+ readonly version?: number;
433
+ readonly ops: TextOperation[];
434
+ };
491
435
  type DeleteCrdtOp = {
492
436
  readonly opId?: string;
493
437
  readonly id: string;
@@ -530,6 +474,157 @@ type TheirOp = DistributiveOmit<Op, "opId"> & {
530
474
  opId?: undefined;
531
475
  };
532
476
 
477
+ type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
478
+ declare const CrdtType: Readonly<{
479
+ OBJECT: 0;
480
+ LIST: 1;
481
+ MAP: 2;
482
+ REGISTER: 3;
483
+ TEXT: 4;
484
+ FILE: 5;
485
+ }>;
486
+ declare namespace CrdtType {
487
+ type OBJECT = typeof CrdtType.OBJECT;
488
+ type LIST = typeof CrdtType.LIST;
489
+ type MAP = typeof CrdtType.MAP;
490
+ type REGISTER = typeof CrdtType.REGISTER;
491
+ type TEXT = typeof CrdtType.TEXT;
492
+ type FILE = typeof CrdtType.FILE;
493
+ }
494
+ type SerializedCrdt = SerializedRootObject | SerializedChild;
495
+ type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedText | SerializedFile;
496
+ type LiveFileData = {
497
+ readonly id: string;
498
+ readonly name: string;
499
+ readonly size: number;
500
+ readonly mimeType: string;
501
+ };
502
+ type SerializedRootObject = {
503
+ readonly type: CrdtType.OBJECT;
504
+ readonly data: JsonObject;
505
+ readonly parentId?: never;
506
+ readonly parentKey?: never;
507
+ };
508
+ type SerializedObject = {
509
+ readonly type: CrdtType.OBJECT;
510
+ readonly parentId: string;
511
+ readonly parentKey: string;
512
+ readonly data: JsonObject;
513
+ };
514
+ type SerializedList = {
515
+ readonly type: CrdtType.LIST;
516
+ readonly parentId: string;
517
+ readonly parentKey: string;
518
+ };
519
+ type SerializedMap = {
520
+ readonly type: CrdtType.MAP;
521
+ readonly parentId: string;
522
+ readonly parentKey: string;
523
+ };
524
+ type SerializedRegister = {
525
+ readonly type: CrdtType.REGISTER;
526
+ readonly parentId: string;
527
+ readonly parentKey: string;
528
+ readonly data: Json;
529
+ };
530
+ type SerializedText = {
531
+ readonly type: CrdtType.TEXT;
532
+ readonly parentId: string;
533
+ readonly parentKey: string;
534
+ readonly data: LiveTextData;
535
+ readonly version: number;
536
+ };
537
+ type SerializedFile = {
538
+ readonly type: CrdtType.FILE;
539
+ readonly parentId: string;
540
+ readonly parentKey: string;
541
+ readonly data: LiveFileData;
542
+ };
543
+ type StorageNode = RootStorageNode | ChildStorageNode;
544
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | TextStorageNode | FileStorageNode;
545
+ type RootStorageNode = [id: "root", value: SerializedRootObject];
546
+ type ObjectStorageNode = [id: string, value: SerializedObject];
547
+ type ListStorageNode = [id: string, value: SerializedList];
548
+ type MapStorageNode = [id: string, value: SerializedMap];
549
+ type RegisterStorageNode = [id: string, value: SerializedRegister];
550
+ type TextStorageNode = [id: string, value: SerializedText];
551
+ type FileStorageNode = [id: string, value: SerializedFile];
552
+ type NodeMap = Map<string, SerializedCrdt>;
553
+ type NodeStream = Iterable<StorageNode>;
554
+ declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
555
+ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
556
+ declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
557
+ declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
558
+ declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
559
+ declare function isTextStorageNode(node: StorageNode): node is TextStorageNode;
560
+ declare function isFileStorageNode(node: StorageNode): node is FileStorageNode;
561
+ type CompactNode = CompactRootNode | CompactChildNode;
562
+ type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactTextNode | CompactFileNode;
563
+ type CompactRootNode = readonly [id: "root", data: JsonObject];
564
+ type CompactObjectNode = readonly [
565
+ id: string,
566
+ type: CrdtType.OBJECT,
567
+ parentId: string,
568
+ parentKey: string,
569
+ data: JsonObject
570
+ ];
571
+ type CompactListNode = readonly [
572
+ id: string,
573
+ type: CrdtType.LIST,
574
+ parentId: string,
575
+ parentKey: string
576
+ ];
577
+ type CompactMapNode = readonly [
578
+ id: string,
579
+ type: CrdtType.MAP,
580
+ parentId: string,
581
+ parentKey: string
582
+ ];
583
+ type CompactRegisterNode = readonly [
584
+ id: string,
585
+ type: CrdtType.REGISTER,
586
+ parentId: string,
587
+ parentKey: string,
588
+ data: Json
589
+ ];
590
+ type CompactTextNode = readonly [
591
+ id: string,
592
+ type: CrdtType.TEXT,
593
+ parentId: string,
594
+ parentKey: string,
595
+ data: LiveTextData,
596
+ version: number
597
+ ];
598
+ type CompactFileNode = readonly [
599
+ id: string,
600
+ type: CrdtType.FILE,
601
+ parentId: string,
602
+ parentKey: string,
603
+ data: LiveFileData
604
+ ];
605
+ declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
606
+ declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
607
+
608
+ /**
609
+ * Use this symbol to brand an object property as internal.
610
+ *
611
+ * @example
612
+ * Object.defineProperty(
613
+ * {
614
+ * public,
615
+ * [kInternal]: {
616
+ * private
617
+ * },
618
+ * },
619
+ * kInternal,
620
+ * {
621
+ * enumerable: false,
622
+ * }
623
+ * );
624
+ */
625
+ declare const kInternal: unique symbol;
626
+ declare const kStorageUpdateSource: unique symbol;
627
+
533
628
  type LiveListUpdateDelta = {
534
629
  type: "insert";
535
630
  index: number;
@@ -909,7 +1004,198 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
909
1004
  clone(): TValue;
910
1005
  }
911
1006
 
912
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveFile;
1007
+ /**
1008
+ * The position of the ops being transformed relative to the ops they are
1009
+ * transformed over, in the final (server-serialized) timeline:
1010
+ *
1011
+ * - "after": the transformed ops will be ordered after the `over` ops. Used
1012
+ * when rebasing a not-yet-accepted op over already-accepted ops. On
1013
+ * same-index insert ties, the transformed op shifts right (the earlier op
1014
+ * stays left), and conflicting format attributes are kept (they will
1015
+ * overwrite, since the op applies later).
1016
+ * - "before": the transformed ops were ordered before the `over` ops. Used
1017
+ * when applying an accepted remote op on top of locally-pending ops. On
1018
+ * same-index insert ties, the transformed op stays left, and conflicting
1019
+ * format attributes are dropped on overlapping ranges (the later `over` op
1020
+ * wins).
1021
+ */
1022
+ type TransformOrder = "before" | "after";
1023
+ /**
1024
+ * Transform `ops` over `over` (see {@link transformTextOperationsX}),
1025
+ * returning only the transformed `ops`.
1026
+ */
1027
+ declare function transformTextOperations(ops: readonly TextOperation[], over: readonly TextOperation[], order: TransformOrder): TextOperation[];
1028
+ declare function applyLiveTextOperations(data: LiveTextData, ops: readonly TextOperation[]): LiveTextData;
1029
+
1030
+ type LiveTextAttributes = TextAttributes;
1031
+ type LiveTextAttributesPatch = JsonObject;
1032
+
1033
+ type LiveTextChange = {
1034
+ /** Text was inserted at {@link LiveTextChange.index}. */
1035
+ readonly type: "insert";
1036
+ readonly index: number;
1037
+ readonly text: string;
1038
+ readonly attributes?: TextAttributes;
1039
+ } | {
1040
+ /** Text was deleted starting at {@link LiveTextChange.index}. */
1041
+ readonly type: "delete";
1042
+ readonly index: number;
1043
+ readonly length: number;
1044
+ readonly deletedText: string;
1045
+ } | {
1046
+ /** Inline attributes were updated on a range of text. */
1047
+ readonly type: "format";
1048
+ readonly index: number;
1049
+ readonly length: number;
1050
+ readonly attributes: LiveTextAttributesPatch;
1051
+ };
1052
+ /** Notification payload when a {@link LiveText} node changes. */
1053
+ type LiveTextUpdates = {
1054
+ type: "LiveText";
1055
+ node: LiveText;
1056
+ version: number;
1057
+ updates: LiveTextChange[];
1058
+ };
1059
+ /**
1060
+ * @private
1061
+ *
1062
+ * Private methods on a LiveText node. As a user of Liveblocks, NEVER USE ANY
1063
+ * OF THESE DIRECTLY, because bad things will probably happen if you do.
1064
+ */
1065
+ type PrivateLiveTextApi = PrivateLiveNodeApi & {
1066
+ /**
1067
+ * Encode a local-document index into server-confirmed coordinates suitable
1068
+ * for broadcasting to peers via presence or any other side channel. Pair
1069
+ * the result with {@link LiveText.version} at the same instant when
1070
+ * sending.
1071
+ */
1072
+ encodeIndex(localIndex: number): number;
1073
+ /**
1074
+ * Decode an `(index, fromVersion)` pair from a peer into an offset in this
1075
+ * LiveText's current local document.
1076
+ */
1077
+ decodeIndex(index: number, fromVersion: number): number | null;
1078
+ };
1079
+
1080
+ /**
1081
+ * LiveText is a collaborative rich-text primitive built on server-ordered
1082
+ * operational transformation.
1083
+ *
1084
+ * Use it to store plain text with optional inline formatting attributes in
1085
+ * Liveblocks Storage. Each document is a flat sequence of text segments; it
1086
+ * cannot contain child Storage structures.
1087
+ *
1088
+ * Outbound model (one-in-flight): at most one UpdateTextOp per node is
1089
+ * awaiting server acknowledgement at any time. Local edits made while an op
1090
+ * is in flight are queued and sent (composed into a single op) once the ack
1091
+ * arrives. This guarantees every wire op is expressed against server-state
1092
+ * coordinates, so the server can transform it over exactly the (foreign)
1093
+ * ops the client hadn't seen — never over the client's own pending ops.
1094
+ *
1095
+ * Inbound model: accepted remote ops are transformed over the local pending
1096
+ * ops before being applied ("before" order: the accepted op wins ties), and
1097
+ * the pending ops are re-expressed over the remote op in turn ("after"
1098
+ * order), keeping them in server coordinates at all times.
1099
+ *
1100
+ * @example
1101
+ * const text = new LiveText("Hello");
1102
+ * text.insert(5, " world");
1103
+ * text.format(0, 5, { bold: true });
1104
+ *
1105
+ * // [["Hello", { bold: true }], [" world"]]
1106
+ * text.toJSON();
1107
+ *
1108
+ * @example
1109
+ * // Use in Storage
1110
+ * declare global {
1111
+ * interface Liveblocks {
1112
+ * Storage: { document: LiveText };
1113
+ * }
1114
+ * }
1115
+ *
1116
+ * const { root } = await room.getStorage();
1117
+ * root.get("document").replace(0, root.get("document").length, "Updated");
1118
+ */
1119
+ declare class LiveText extends AbstractCrdt {
1120
+ #private;
1121
+ /**
1122
+ * @private
1123
+ *
1124
+ * Private methods and variables used in the core internals, but as a user
1125
+ * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
1126
+ * will probably happen if you do.
1127
+ */
1128
+ readonly [kInternal]: PrivateLiveTextApi;
1129
+ /**
1130
+ * Creates a new LiveText document.
1131
+ *
1132
+ * @param textOrData Initial plain text, or an array of `[text]` /
1133
+ * `[text, attributes]` segments. Defaults to an empty document.
1134
+ *
1135
+ * @example
1136
+ * new LiveText();
1137
+ * new LiveText("Hello world");
1138
+ * new LiveText([["Hello ", { bold: true }], ["world"]]);
1139
+ */
1140
+ constructor(textOrData?: string | LiveTextData, version?: number);
1141
+ get version(): number;
1142
+ get length(): number;
1143
+ /**
1144
+ * Inserts text at the given index.
1145
+ *
1146
+ * @param index Character index at which to insert. Values outside the
1147
+ * document range are clipped.
1148
+ * @param text Text to insert.
1149
+ * @param attributes Optional inline attributes for the inserted text.
1150
+ *
1151
+ * @example
1152
+ * const text = new LiveText("Hello");
1153
+ * text.insert(5, " world");
1154
+ * text.insert(0, "Say: ", { italic: true });
1155
+ */
1156
+ insert(index: number, text: string, attributes?: TextAttributes): void;
1157
+ /**
1158
+ * Deletes `length` characters starting at `index`.
1159
+ *
1160
+ * @example
1161
+ * const text = new LiveText("Hello world");
1162
+ * text.delete(5, 6); // "Hello"
1163
+ */
1164
+ delete(index: number, length: number): void;
1165
+ /**
1166
+ * Replaces a range of text with new text.
1167
+ *
1168
+ * @example
1169
+ * const text = new LiveText("Hello world");
1170
+ * text.replace(0, 5, "Hi"); // "Hi world"
1171
+ */
1172
+ replace(index: number, length: number, text: string, attributes?: TextAttributes): void;
1173
+ /**
1174
+ * Applies or removes inline attributes on a range of text.
1175
+ *
1176
+ * Set an attribute to `null` to remove it from the range.
1177
+ *
1178
+ * @example
1179
+ * const text = new LiveText("Hello world");
1180
+ * text.format(0, 5, { bold: true });
1181
+ * text.format(0, 5, { bold: null });
1182
+ */
1183
+ format(index: number, length: number, attributes: LiveTextAttributesPatch): void;
1184
+ /** Returns the plain text content without attributes. Equivalent to joining the text from each segment in {@link LiveText.toJSON}. */
1185
+ toString(): string;
1186
+ /**
1187
+ * Returns a JSON-compatible snapshot of the document as a {@link LiveTextData}
1188
+ * array.
1189
+ *
1190
+ * @example
1191
+ * new LiveText([["Hello ", { bold: true }], ["world"]]).toJSON();
1192
+ * // [["Hello ", { bold: true }], ["world"]]
1193
+ */
1194
+ toJSON(): LiveTextData;
1195
+ clone(): LiveText;
1196
+ }
1197
+
1198
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveText | LiveFile;
913
1199
  /**
914
1200
  * Think of Lson as a sibling of the Json data tree, except that the nested
915
1201
  * data structure can contain a mix of Json values and LiveStructure instances.
@@ -945,7 +1231,7 @@ type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Ls
945
1231
  readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
946
1232
  } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
947
1233
  readonly [K in KS]: ToJson<V>;
948
- } : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1234
+ } : L extends LiveText ? LiveTextData : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
949
1235
  readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
950
1236
  } : L extends Json ? L : never;
951
1237
 
@@ -953,12 +1239,29 @@ type StorageCallback = (updates: StorageUpdate[]) => void;
953
1239
  type LiveMapUpdate = LiveMapUpdates<string, Lson>;
954
1240
  type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
955
1241
  type LiveListUpdate = LiveListUpdates<Lson>;
1242
+ type LiveTextUpdate = LiveTextUpdates;
1243
+ type StorageUpdateSource = {
1244
+ origin: "remote";
1245
+ } | {
1246
+ origin: "local";
1247
+ via: "mutation";
1248
+ } | {
1249
+ origin: "local";
1250
+ via: "history";
1251
+ action: "undo" | "redo";
1252
+ };
956
1253
  /**
957
1254
  * The payload of notifications sent (in-client) when LiveStructures change.
958
1255
  * Messages of this kind are not originating from the network, but are 100%
959
1256
  * in-client.
1257
+ *
1258
+ * Updates delivered through `room.subscribe` may carry
1259
+ * `[kStorageUpdateSource]` to distinguish where a mutation came from.
1260
+ * Undo/redo replays use `via: "history"` with `action: "undo" | "redo"`.
960
1261
  */
961
- type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
1262
+ type StorageUpdate = (LiveMapUpdate | LiveObjectUpdate | LiveListUpdate | LiveTextUpdate) & {
1263
+ [kStorageUpdateSource]?: StorageUpdateSource;
1264
+ };
962
1265
 
963
1266
  /**
964
1267
  * Read-only query surface over {@link UnacknowledgedOps}, handed to CRDTs so
@@ -984,6 +1287,27 @@ interface ReadonlyUnacknowledgedOps {
984
1287
  isPossiblyStored(opId: string): boolean;
985
1288
  }
986
1289
 
1290
+ type DispatchOptions = {
1291
+ /**
1292
+ * Whether this dispatch should clear the redo stack. Defaults to true when
1293
+ * any forward ops are included (a fresh local mutation), false otherwise.
1294
+ * LiveText uses this to dispatch queued ops after an acknowledgement
1295
+ * (which should not clear redo), and to register fresh local edits that
1296
+ * don't carry wire ops yet (which should).
1297
+ */
1298
+ clearRedoStack?: boolean;
1299
+ };
1300
+ /**
1301
+ * Private methods on any Liveblocks CRDT node. As a user of Liveblocks, NEVER
1302
+ * USE ANY OF THESE DIRECTLY, because bad things will probably happen if you do.
1303
+ */
1304
+ type PrivateLiveNodeApi = {
1305
+ /**
1306
+ * Returns the CRDT node id once attached to the room pool. Detached nodes
1307
+ * that have not entered storage yet return `undefined`.
1308
+ */
1309
+ getId(): string | undefined;
1310
+ };
987
1311
  /**
988
1312
  * The managed pool is a namespace registry (i.e. a context) that "owns" all
989
1313
  * the individual live nodes, ensuring each one has a unique ID, and holding on
@@ -1002,7 +1326,7 @@ interface ManagedPool {
1002
1326
  * - Add reverse operations to the undo/redo stack
1003
1327
  * - Notify room subscribers with updates (in-client, no networking)
1004
1328
  */
1005
- dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1329
+ dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
1006
1330
  /**
1007
1331
  * Ensures storage can be written to else throws an error.
1008
1332
  * This is used to prevent writing to storage when the user does not have
@@ -1027,7 +1351,7 @@ type CreateManagedPoolOptions = {
1027
1351
  /**
1028
1352
  * Will get invoked when any Live structure calls .dispatch() on the pool.
1029
1353
  */
1030
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1354
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
1031
1355
  /**
1032
1356
  * Will get invoked when any Live structure calls .assertStorageIsWritable()
1033
1357
  * on the pool. Defaults to true when not provided. Return false if you want
@@ -1049,6 +1373,8 @@ type CreateManagedPoolOptions = {
1049
1373
  declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
1050
1374
  declare abstract class AbstractCrdt {
1051
1375
  #private;
1376
+ readonly [kInternal]: PrivateLiveNodeApi;
1377
+ constructor();
1052
1378
  /**
1053
1379
  * @private
1054
1380
  * Returns true if the cached JSON snapshot exists and is reference-equal
@@ -2061,25 +2387,6 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
2061
2387
  getGroup(groupId: string): Promise<GroupData | undefined>;
2062
2388
  }
2063
2389
 
2064
- /**
2065
- * Use this symbol to brand an object property as internal.
2066
- *
2067
- * @example
2068
- * Object.defineProperty(
2069
- * {
2070
- * public,
2071
- * [kInternal]: {
2072
- * private
2073
- * },
2074
- * },
2075
- * kInternal,
2076
- * {
2077
- * enumerable: false,
2078
- * }
2079
- * );
2080
- */
2081
- declare const kInternal: unique symbol;
2082
-
2083
2390
  /**
2084
2391
  * Back-port of TypeScript 5.4's built-in NoInfer utility type.
2085
2392
  * See https://stackoverflow.com/a/56688073/148872
@@ -4230,7 +4537,14 @@ interface SyncSource {
4230
4537
  */
4231
4538
  type PrivateRoomApi = {
4232
4539
  presenceBuffer: Json | undefined;
4233
- undoStack: readonly (readonly Readonly<Stackframe<JsonObject>>[])[];
4540
+ undoStack: readonly {
4541
+ readonly id: number;
4542
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4543
+ }[];
4544
+ redoStack: readonly {
4545
+ readonly id: number;
4546
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4547
+ }[];
4234
4548
  nodeCount: number;
4235
4549
  getYjsProvider(): IYjsProvider | undefined;
4236
4550
  setYjsProvider(provider: IYjsProvider | undefined): void;
@@ -4271,6 +4585,21 @@ type PrivateRoomApi = {
4271
4585
  };
4272
4586
  attachmentUrlsStore: BatchStore<string, string>;
4273
4587
  fileUrlsStore: BatchStore<FileUrlData, string>;
4588
+ readonly history: Observable<{
4589
+ action: "push";
4590
+ id: number;
4591
+ } | {
4592
+ action: "undo";
4593
+ id: number;
4594
+ } | {
4595
+ action: "redo";
4596
+ id: number;
4597
+ } | {
4598
+ action: "clear";
4599
+ } | {
4600
+ action: "discard";
4601
+ ids: number[];
4602
+ }>;
4274
4603
  };
4275
4604
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4276
4605
  type PresenceStackframe<P extends JsonObject> = {
@@ -5170,11 +5499,16 @@ type PlainLsonList = {
5170
5499
  liveblocksType: "LiveList";
5171
5500
  data: PlainLson[];
5172
5501
  };
5502
+ type PlainLsonText = {
5503
+ liveblocksType: "LiveText";
5504
+ data: LiveTextData;
5505
+ version?: number;
5506
+ };
5173
5507
  type PlainLsonFile = {
5174
5508
  liveblocksType: "LiveFile";
5175
5509
  data: LiveFileData;
5176
5510
  };
5177
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonFile | Json;
5511
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonText | PlainLsonFile | Json;
5178
5512
 
5179
5513
  /**
5180
5514
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5890,4 +6224,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5890
6224
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5891
6225
  };
5892
6226
 
5893
- export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactFileNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateFileOp, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type FileStorageNode, type FileUrlData, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveFile, type LiveFileData, type LiveFileReference, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonFile, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomEventMessage, type RoomPermissions, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedFile, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ThreadVisibility, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UploadFileOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createStorageFileId, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getLiveFileId, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isFileStorageNode, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };
6227
+ export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactFileNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type CompactTextNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateFileOp, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CreateTextOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type FileStorageNode, type FileUrlData, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveFile, type LiveFileData, type LiveFileReference, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveText, type LiveTextAttributes, type LiveTextAttributesPatch, type LiveTextChange, type LiveTextData, type TextOperation as LiveTextOperation, type LiveTextSegment, type LiveTextUpdate, type LiveTextUpdates, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonFile, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PlainLsonText, type Poller, type PrivateClientApi, type PrivateLiveNodeApi, type PrivateLiveTextApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomEventMessage, type RoomPermissions, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedFile, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type SerializedText, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StorageUpdateSource, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, type TextAttributes, TextEditorType, type TextOperation, type TextStorageNode, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ThreadVisibility, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateTextOp, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UploadFileOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, applyLiveTextOperations, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createStorageFileId, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getLiveFileId, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isFileStorageNode, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isTextStorageNode, isUrl, kInternal, kStorageUpdateSource, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, transformTextOperations, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };