@liveblocks/core 3.23.1 → 3.24.0

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
@@ -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,132 +474,155 @@ type TheirOp = DistributiveOmit<Op, "opId"> & {
530
474
  opId?: undefined;
531
475
  };
532
476
 
533
- type LiveListUpdateDelta = {
534
- type: "insert";
535
- index: number;
536
- item: Lson;
537
- } | {
538
- type: "delete";
539
- index: number;
540
- deletedItem: Lson;
541
- } | {
542
- type: "move";
543
- index: number;
544
- previousIndex: number;
545
- item: Lson;
546
- } | {
547
- type: "set";
548
- index: number;
549
- item: Lson;
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;
550
501
  };
551
- /**
552
- * A LiveList notification that is sent in-client to any subscribers whenever
553
- * one or more of the items inside the LiveList instance have changed.
554
- */
555
- type LiveListUpdates<TItem extends Lson> = {
556
- type: "LiveList";
557
- node: LiveList<TItem>;
558
- updates: LiveListUpdateDelta[];
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;
559
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
+
560
608
  /**
561
- * The LiveList class represents an ordered collection of items that is synchronized across clients.
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
+ * );
562
624
  */
563
- declare class LiveList<TItem extends Lson> extends AbstractCrdt {
564
- #private;
565
- constructor(items: TItem[]);
566
- /**
567
- * Returns the number of elements.
568
- */
569
- get length(): number;
570
- /**
571
- * Adds one element to the end of the LiveList.
572
- * @param element The element to add to the end of the LiveList.
573
- */
574
- push(element: TItem): void;
575
- /**
576
- * Inserts one element at a specified index.
577
- * @param element The element to insert.
578
- * @param index The index at which you want to insert the element.
579
- */
580
- insert(element: TItem, index: number): void;
581
- /**
582
- * Move one element from one index to another.
583
- * @param index The index of the element to move
584
- * @param targetIndex The index where the element should be after moving.
585
- */
586
- move(index: number, targetIndex: number): void;
587
- /**
588
- * Deletes an element at the specified index
589
- * @param index The index of the element to delete
590
- */
591
- delete(index: number): void;
592
- clear(): void;
593
- set(index: number, item: TItem): void;
594
- /**
595
- * Tests whether all elements pass the test implemented by the provided function.
596
- * @param predicate Function to test for each element, taking two arguments (the element and its index).
597
- * @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
598
- */
599
- every(predicate: (value: TItem, index: number) => unknown): boolean;
600
- /**
601
- * Creates an array with all elements that pass the test implemented by the provided function.
602
- * @param predicate Function to test each element of the LiveList. Return a value that coerces to true to keep the element, or to false otherwise.
603
- * @returns An array with the elements that pass the test.
604
- */
605
- filter(predicate: (value: TItem, index: number) => unknown): TItem[];
606
- /**
607
- * Returns the first element that satisfies the provided testing function.
608
- * @param predicate Function to execute on each value.
609
- * @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
610
- */
611
- find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
612
- /**
613
- * Returns the index of the first element in the LiveList that satisfies the provided testing function.
614
- * @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
615
- * @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
616
- */
617
- findIndex(predicate: (value: TItem, index: number) => unknown): number;
618
- /**
619
- * Executes a provided function once for each element.
620
- * @param callbackfn Function to execute on each element.
621
- */
622
- forEach(callbackfn: (value: TItem, index: number) => void): void;
623
- /**
624
- * Get the element at the specified index.
625
- * @param index The index on the element to get.
626
- * @returns The element at the specified index or undefined.
627
- */
628
- get(index: number): TItem | undefined;
629
- /**
630
- * Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
631
- * @param searchElement Element to locate.
632
- * @param fromIndex The index to start the search at.
633
- * @returns The first index of the element in the LiveList; -1 if not found.
634
- */
635
- indexOf(searchElement: TItem, fromIndex?: number): number;
636
- /**
637
- * Returns the last index at which a given element can be found in the LiveList, or -1 if it is not present. The LiveList is searched backwards, starting at fromIndex.
638
- * @param searchElement Element to locate.
639
- * @param fromIndex The index at which to start searching backwards.
640
- * @returns The last index of the element in the LiveList; -1 if not found.
641
- */
642
- lastIndexOf(searchElement: TItem, fromIndex?: number): number;
643
- /**
644
- * Creates an array populated with the results of calling a provided function on every element.
645
- * @param callback Function that is called for every element.
646
- * @returns An array with each element being the result of the callback function.
647
- */
648
- map<U>(callback: (value: TItem, index: number) => U): U[];
649
- /**
650
- * Tests whether at least one element in the LiveList passes the test implemented by the provided function.
651
- * @param predicate Function to test for each element.
652
- * @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
653
- */
654
- some(predicate: (value: TItem, index: number) => unknown): boolean;
655
- [Symbol.iterator](): IterableIterator<TItem>;
656
- toJSON(): readonly ToJson<TItem>[];
657
- clone(): LiveList<TItem>;
658
- }
625
+ declare const kInternal: unique symbol;
659
626
 
660
627
  type UpdateDelta = {
661
628
  type: "update";
@@ -674,6 +641,7 @@ type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
674
641
  updates: {
675
642
  [key: string]: UpdateDelta;
676
643
  };
644
+ source: UpdateSource;
677
645
  };
678
646
  /**
679
647
  * The LiveMap class is similar to a JavaScript Map that is synchronized on all clients.
@@ -813,6 +781,7 @@ type LiveObjectUpdates<TData extends LsonObject> = {
813
781
  type: "LiveObject";
814
782
  node: LiveObject<TData>;
815
783
  updates: LiveObjectUpdateDelta<TData>;
784
+ source: UpdateSource;
816
785
  };
817
786
  /**
818
787
  * The LiveObject class is similar to a JavaScript object that is synchronized on all clients.
@@ -899,6 +868,364 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
899
868
  clone(): LiveObject<O>;
900
869
  }
901
870
 
871
+ /**
872
+ * The position of the ops being transformed relative to the ops they are
873
+ * transformed over, in the final (server-serialized) timeline:
874
+ *
875
+ * - "after": the transformed ops will be ordered after the `over` ops. Used
876
+ * when rebasing a not-yet-accepted op over already-accepted ops. On
877
+ * same-index insert ties, the transformed op shifts right (the earlier op
878
+ * stays left), and conflicting format attributes are kept (they will
879
+ * overwrite, since the op applies later).
880
+ * - "before": the transformed ops were ordered before the `over` ops. Used
881
+ * when applying an accepted remote op on top of locally-pending ops. On
882
+ * same-index insert ties, the transformed op stays left, and conflicting
883
+ * format attributes are dropped on overlapping ranges (the later `over` op
884
+ * wins).
885
+ */
886
+ type TransformOrder = "before" | "after";
887
+ /**
888
+ * Transform `ops` over `over` (see {@link transformTextOperationsX}),
889
+ * returning only the transformed `ops`.
890
+ */
891
+ declare function transformTextOperations(ops: readonly TextOperation[], over: readonly TextOperation[], order: TransformOrder): TextOperation[];
892
+ declare function applyLiveTextOperations(data: LiveTextData, ops: readonly TextOperation[]): LiveTextData;
893
+ /**
894
+ * Canonicalizes operations against the document state they are applied to so
895
+ * no operation boundary can split a UTF-16 surrogate pair.
896
+ *
897
+ * Operations are normalized sequentially because each one can change the
898
+ * document seen by the operations that follow it.
899
+ */
900
+ declare function normalizeLiveTextOperations(data: LiveTextData, operations: readonly TextOperation[]): TextOperation[];
901
+
902
+ type LiveTextAttributes = TextAttributes;
903
+ type LiveTextAttributesPatch = JsonObject;
904
+
905
+ type LiveTextChange = {
906
+ /** Text was inserted at {@link LiveTextChange.index}. */
907
+ readonly type: "insert";
908
+ readonly index: number;
909
+ readonly text: string;
910
+ readonly attributes?: TextAttributes;
911
+ } | {
912
+ /** Text was deleted starting at {@link LiveTextChange.index}. */
913
+ readonly type: "delete";
914
+ readonly index: number;
915
+ readonly length: number;
916
+ readonly deletedText: string;
917
+ } | {
918
+ /** Inline attributes were updated on a range of text. */
919
+ readonly type: "format";
920
+ readonly index: number;
921
+ readonly length: number;
922
+ readonly attributes: LiveTextAttributesPatch;
923
+ };
924
+ /** Notification payload when a {@link LiveText} node changes. */
925
+ type LiveTextUpdates = {
926
+ type: "LiveText";
927
+ node: LiveText;
928
+ version: number;
929
+ updates: LiveTextChange[];
930
+ source: UpdateSource;
931
+ };
932
+ /**
933
+ * @private
934
+ *
935
+ * Private methods on a LiveText node. As a user of Liveblocks, NEVER USE ANY
936
+ * OF THESE DIRECTLY, because bad things will probably happen if you do.
937
+ */
938
+ type PrivateLiveTextApi = PrivateLiveNodeApi & {
939
+ /**
940
+ * Encode a local-document index into server-confirmed coordinates suitable
941
+ * for broadcasting to peers via presence or any other side channel. Pair
942
+ * the result with {@link LiveText.version} at the same instant when
943
+ * sending.
944
+ */
945
+ encodeIndex(localIndex: number): number;
946
+ /**
947
+ * Decode an `(index, fromVersion)` pair from a peer into an offset in this
948
+ * LiveText's current local document.
949
+ */
950
+ decodeIndex(index: number, fromVersion: number): number | null;
951
+ };
952
+
953
+ /**
954
+ * LiveText is a collaborative rich-text primitive built on server-ordered
955
+ * operational transformation.
956
+ *
957
+ * Use it to store plain text with optional inline formatting attributes in
958
+ * Liveblocks Storage. Each document is a flat sequence of text segments; it
959
+ * cannot contain child Storage structures.
960
+ *
961
+ * Outbound model (one-in-flight): at most one UpdateTextOp per node is
962
+ * awaiting server acknowledgement at any time. Local edits made while an op
963
+ * is in flight are queued and sent (composed into a single op) once the ack
964
+ * arrives. This guarantees every wire op is expressed against server-state
965
+ * coordinates, so the server can transform it over exactly the (foreign)
966
+ * ops the client hadn't seen — never over the client's own pending ops.
967
+ *
968
+ * Inbound model: accepted remote ops are transformed over the local pending
969
+ * ops before being applied ("before" order: the accepted op wins ties), and
970
+ * the pending ops are re-expressed over the remote op in turn ("after"
971
+ * order), keeping them in server coordinates at all times.
972
+ *
973
+ * @example
974
+ * const text = new LiveText("Hello");
975
+ * text.insert(5, " world");
976
+ * text.format(0, 5, { bold: true });
977
+ *
978
+ * // [["Hello", { bold: true }], [" world"]]
979
+ * text.toJSON();
980
+ *
981
+ * @example
982
+ * // Use in Storage
983
+ * declare global {
984
+ * interface Liveblocks {
985
+ * Storage: { document: LiveText };
986
+ * }
987
+ * }
988
+ *
989
+ * const { root } = await room.getStorage();
990
+ * root.get("document").replace(0, root.get("document").length, "Updated");
991
+ */
992
+ declare class LiveText extends AbstractCrdt {
993
+ #private;
994
+ /**
995
+ * @private
996
+ *
997
+ * Private methods and variables used in the core internals, but as a user
998
+ * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
999
+ * will probably happen if you do.
1000
+ */
1001
+ readonly [kInternal]: PrivateLiveTextApi;
1002
+ /**
1003
+ * Creates a new LiveText document.
1004
+ *
1005
+ * @param textOrData Initial plain text, or an array of `[text]` /
1006
+ * `[text, attributes]` segments. Defaults to an empty document.
1007
+ *
1008
+ * @example
1009
+ * new LiveText();
1010
+ * new LiveText("Hello world");
1011
+ * new LiveText([["Hello ", { bold: true }], ["world"]]);
1012
+ */
1013
+ constructor(textOrData?: string | LiveTextData, version?: number);
1014
+ get version(): number;
1015
+ get length(): number;
1016
+ /**
1017
+ * Inserts text at the given index.
1018
+ *
1019
+ * @param index Character index at which to insert. Values outside the
1020
+ * document range are clipped.
1021
+ * @param text Text to insert.
1022
+ * @param attributes Optional inline attributes for the inserted text.
1023
+ *
1024
+ * @example
1025
+ * const text = new LiveText("Hello");
1026
+ * text.insert(5, " world");
1027
+ * text.insert(0, "Say: ", { italic: true });
1028
+ */
1029
+ insert(index: number, text: string, attributes?: TextAttributes): void;
1030
+ /**
1031
+ * Deletes `length` characters starting at `index`.
1032
+ *
1033
+ * @example
1034
+ * const text = new LiveText("Hello world");
1035
+ * text.delete(5, 6); // "Hello"
1036
+ */
1037
+ delete(index: number, length: number): void;
1038
+ /**
1039
+ * Replaces a range of text with new text.
1040
+ *
1041
+ * @example
1042
+ * const text = new LiveText("Hello world");
1043
+ * text.replace(0, 5, "Hi"); // "Hi world"
1044
+ */
1045
+ replace(index: number, length: number, text: string, attributes?: TextAttributes): void;
1046
+ /**
1047
+ * Applies or removes inline attributes on a range of text.
1048
+ *
1049
+ * Set an attribute to `null` to remove it from the range.
1050
+ *
1051
+ * @example
1052
+ * const text = new LiveText("Hello world");
1053
+ * text.format(0, 5, { bold: true });
1054
+ * text.format(0, 5, { bold: null });
1055
+ */
1056
+ format(index: number, length: number, attributes: LiveTextAttributesPatch): void;
1057
+ /** Returns the plain text content without attributes. Equivalent to joining the text from each segment in {@link LiveText.toJSON}. */
1058
+ toString(): string;
1059
+ /**
1060
+ * Returns a JSON-compatible snapshot of the document as a {@link LiveTextData}
1061
+ * array.
1062
+ *
1063
+ * @example
1064
+ * new LiveText([["Hello ", { bold: true }], ["world"]]).toJSON();
1065
+ * // [["Hello ", { bold: true }], ["world"]]
1066
+ */
1067
+ toJSON(): LiveTextData;
1068
+ clone(): LiveText;
1069
+ }
1070
+
1071
+ type StorageCallback = (updates: StorageUpdate[]) => void;
1072
+ type LiveMapUpdate = LiveMapUpdates<string, Lson>;
1073
+ type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
1074
+ type LiveListUpdate = LiveListUpdates<Lson>;
1075
+ type LiveTextUpdate = LiveTextUpdates;
1076
+ type Via = "edit" | "undo" | "redo";
1077
+ /**
1078
+ * Where a Storage update came from.
1079
+ *
1080
+ * Updates with `origin: "remote"` were made by another client, and reached
1081
+ * this client over the network. Updates with `origin: "local"` were made by
1082
+ * this client, and `via` says how: a regular edit, or a replay from the
1083
+ * undo/redo history.
1084
+ */
1085
+ type UpdateSource = {
1086
+ origin: "remote";
1087
+ } | {
1088
+ origin: "local";
1089
+ via: Via;
1090
+ };
1091
+ /**
1092
+ * The payload of notifications sent (in-client) when LiveStructures change.
1093
+ * Messages of this kind are not originating from the network, but are 100%
1094
+ * in-client.
1095
+ *
1096
+ * Every update carries a `source`, saying where the change came from. See
1097
+ * {@link UpdateSource}.
1098
+ */
1099
+ type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate | LiveTextUpdate;
1100
+
1101
+ type LiveListUpdateDelta = {
1102
+ type: "insert";
1103
+ index: number;
1104
+ item: Lson;
1105
+ } | {
1106
+ type: "delete";
1107
+ index: number;
1108
+ deletedItem: Lson;
1109
+ } | {
1110
+ type: "move";
1111
+ index: number;
1112
+ previousIndex: number;
1113
+ item: Lson;
1114
+ } | {
1115
+ type: "set";
1116
+ index: number;
1117
+ item: Lson;
1118
+ };
1119
+ /**
1120
+ * A LiveList notification that is sent in-client to any subscribers whenever
1121
+ * one or more of the items inside the LiveList instance have changed.
1122
+ */
1123
+ type LiveListUpdates<TItem extends Lson> = {
1124
+ type: "LiveList";
1125
+ node: LiveList<TItem>;
1126
+ updates: LiveListUpdateDelta[];
1127
+ source: UpdateSource;
1128
+ };
1129
+ /**
1130
+ * The LiveList class represents an ordered collection of items that is synchronized across clients.
1131
+ */
1132
+ declare class LiveList<TItem extends Lson> extends AbstractCrdt {
1133
+ #private;
1134
+ constructor(items: TItem[]);
1135
+ /**
1136
+ * Returns the number of elements.
1137
+ */
1138
+ get length(): number;
1139
+ /**
1140
+ * Adds one element to the end of the LiveList.
1141
+ * @param element The element to add to the end of the LiveList.
1142
+ */
1143
+ push(element: TItem): void;
1144
+ /**
1145
+ * Inserts one element at a specified index.
1146
+ * @param element The element to insert.
1147
+ * @param index The index at which you want to insert the element.
1148
+ */
1149
+ insert(element: TItem, index: number): void;
1150
+ /**
1151
+ * Move one element from one index to another.
1152
+ * @param index The index of the element to move
1153
+ * @param targetIndex The index where the element should be after moving.
1154
+ */
1155
+ move(index: number, targetIndex: number): void;
1156
+ /**
1157
+ * Deletes an element at the specified index
1158
+ * @param index The index of the element to delete
1159
+ */
1160
+ delete(index: number): void;
1161
+ clear(): void;
1162
+ set(index: number, item: TItem): void;
1163
+ /**
1164
+ * Tests whether all elements pass the test implemented by the provided function.
1165
+ * @param predicate Function to test for each element, taking two arguments (the element and its index).
1166
+ * @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
1167
+ */
1168
+ every(predicate: (value: TItem, index: number) => unknown): boolean;
1169
+ /**
1170
+ * Creates an array with all elements that pass the test implemented by the provided function.
1171
+ * @param predicate Function to test each element of the LiveList. Return a value that coerces to true to keep the element, or to false otherwise.
1172
+ * @returns An array with the elements that pass the test.
1173
+ */
1174
+ filter(predicate: (value: TItem, index: number) => unknown): TItem[];
1175
+ /**
1176
+ * Returns the first element that satisfies the provided testing function.
1177
+ * @param predicate Function to execute on each value.
1178
+ * @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
1179
+ */
1180
+ find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
1181
+ /**
1182
+ * Returns the index of the first element in the LiveList that satisfies the provided testing function.
1183
+ * @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
1184
+ * @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
1185
+ */
1186
+ findIndex(predicate: (value: TItem, index: number) => unknown): number;
1187
+ /**
1188
+ * Executes a provided function once for each element.
1189
+ * @param callbackfn Function to execute on each element.
1190
+ */
1191
+ forEach(callbackfn: (value: TItem, index: number) => void): void;
1192
+ /**
1193
+ * Get the element at the specified index.
1194
+ * @param index The index on the element to get.
1195
+ * @returns The element at the specified index or undefined.
1196
+ */
1197
+ get(index: number): TItem | undefined;
1198
+ /**
1199
+ * Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
1200
+ * @param searchElement Element to locate.
1201
+ * @param fromIndex The index to start the search at.
1202
+ * @returns The first index of the element in the LiveList; -1 if not found.
1203
+ */
1204
+ indexOf(searchElement: TItem, fromIndex?: number): number;
1205
+ /**
1206
+ * Returns the last index at which a given element can be found in the LiveList, or -1 if it is not present. The LiveList is searched backwards, starting at fromIndex.
1207
+ * @param searchElement Element to locate.
1208
+ * @param fromIndex The index at which to start searching backwards.
1209
+ * @returns The last index of the element in the LiveList; -1 if not found.
1210
+ */
1211
+ lastIndexOf(searchElement: TItem, fromIndex?: number): number;
1212
+ /**
1213
+ * Creates an array populated with the results of calling a provided function on every element.
1214
+ * @param callback Function that is called for every element.
1215
+ * @returns An array with each element being the result of the callback function.
1216
+ */
1217
+ map<U>(callback: (value: TItem, index: number) => U): U[];
1218
+ /**
1219
+ * Tests whether at least one element in the LiveList passes the test implemented by the provided function.
1220
+ * @param predicate Function to test for each element.
1221
+ * @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
1222
+ */
1223
+ some(predicate: (value: TItem, index: number) => unknown): boolean;
1224
+ [Symbol.iterator](): IterableIterator<TItem>;
1225
+ toJSON(): readonly ToJson<TItem>[];
1226
+ clone(): LiveList<TItem>;
1227
+ }
1228
+
902
1229
  /**
903
1230
  * INTERNAL
904
1231
  */
@@ -909,7 +1236,7 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
909
1236
  clone(): TValue;
910
1237
  }
911
1238
 
912
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveFile;
1239
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveText | LiveFile;
913
1240
  /**
914
1241
  * Think of Lson as a sibling of the Json data tree, except that the nested
915
1242
  * data structure can contain a mix of Json values and LiveStructure instances.
@@ -945,21 +1272,10 @@ type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Ls
945
1272
  readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
946
1273
  } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
947
1274
  readonly [K in KS]: ToJson<V>;
948
- } : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1275
+ } : L extends LiveText ? LiveTextData : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
949
1276
  readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
950
1277
  } : L extends Json ? L : never;
951
1278
 
952
- type StorageCallback = (updates: StorageUpdate[]) => void;
953
- type LiveMapUpdate = LiveMapUpdates<string, Lson>;
954
- type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
955
- type LiveListUpdate = LiveListUpdates<Lson>;
956
- /**
957
- * The payload of notifications sent (in-client) when LiveStructures change.
958
- * Messages of this kind are not originating from the network, but are 100%
959
- * in-client.
960
- */
961
- type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
962
-
963
1279
  /**
964
1280
  * Read-only query surface over {@link UnacknowledgedOps}, handed to CRDTs so
965
1281
  * they can look up their own still-pending Create ops without being able to
@@ -984,6 +1300,27 @@ interface ReadonlyUnacknowledgedOps {
984
1300
  isPossiblyStored(opId: string): boolean;
985
1301
  }
986
1302
 
1303
+ type DispatchOptions = {
1304
+ /**
1305
+ * Whether this dispatch should clear the redo stack. Defaults to true when
1306
+ * any forward ops are included (a fresh local mutation), false otherwise.
1307
+ * LiveText uses this to dispatch queued ops after an acknowledgement
1308
+ * (which should not clear redo), and to register fresh local edits that
1309
+ * don't carry wire ops yet (which should).
1310
+ */
1311
+ clearRedoStack?: boolean;
1312
+ };
1313
+ /**
1314
+ * Private methods on any Liveblocks CRDT node. As a user of Liveblocks, NEVER
1315
+ * USE ANY OF THESE DIRECTLY, because bad things will probably happen if you do.
1316
+ */
1317
+ type PrivateLiveNodeApi = {
1318
+ /**
1319
+ * Returns the CRDT node id once attached to the room pool. Detached nodes
1320
+ * that have not entered storage yet return `undefined`.
1321
+ */
1322
+ getId(): string | undefined;
1323
+ };
987
1324
  /**
988
1325
  * The managed pool is a namespace registry (i.e. a context) that "owns" all
989
1326
  * the individual live nodes, ensuring each one has a unique ID, and holding on
@@ -1002,7 +1339,7 @@ interface ManagedPool {
1002
1339
  * - Add reverse operations to the undo/redo stack
1003
1340
  * - Notify room subscribers with updates (in-client, no networking)
1004
1341
  */
1005
- dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1342
+ dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
1006
1343
  /**
1007
1344
  * Ensures storage can be written to else throws an error.
1008
1345
  * This is used to prevent writing to storage when the user does not have
@@ -1027,7 +1364,7 @@ type CreateManagedPoolOptions = {
1027
1364
  /**
1028
1365
  * Will get invoked when any Live structure calls .dispatch() on the pool.
1029
1366
  */
1030
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1367
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
1031
1368
  /**
1032
1369
  * Will get invoked when any Live structure calls .assertStorageIsWritable()
1033
1370
  * on the pool. Defaults to true when not provided. Return false if you want
@@ -1049,6 +1386,8 @@ type CreateManagedPoolOptions = {
1049
1386
  declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
1050
1387
  declare abstract class AbstractCrdt {
1051
1388
  #private;
1389
+ readonly [kInternal]: PrivateLiveNodeApi;
1390
+ constructor();
1052
1391
  /**
1053
1392
  * @private
1054
1393
  * Returns true if the cached JSON snapshot exists and is reference-equal
@@ -2061,25 +2400,6 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
2061
2400
  getGroup(groupId: string): Promise<GroupData | undefined>;
2062
2401
  }
2063
2402
 
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
2403
  /**
2084
2404
  * Back-port of TypeScript 5.4's built-in NoInfer utility type.
2085
2405
  * See https://stackoverflow.com/a/56688073/148872
@@ -4230,7 +4550,14 @@ interface SyncSource {
4230
4550
  */
4231
4551
  type PrivateRoomApi = {
4232
4552
  presenceBuffer: Json | undefined;
4233
- undoStack: readonly (readonly Readonly<Stackframe<JsonObject>>[])[];
4553
+ undoStack: readonly {
4554
+ readonly id: number;
4555
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4556
+ }[];
4557
+ redoStack: readonly {
4558
+ readonly id: number;
4559
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4560
+ }[];
4234
4561
  nodeCount: number;
4235
4562
  getYjsProvider(): IYjsProvider | undefined;
4236
4563
  setYjsProvider(provider: IYjsProvider | undefined): void;
@@ -4271,6 +4598,21 @@ type PrivateRoomApi = {
4271
4598
  };
4272
4599
  attachmentUrlsStore: BatchStore<string, string>;
4273
4600
  fileUrlsStore: BatchStore<FileUrlData, string>;
4601
+ readonly history: Observable<{
4602
+ action: "push";
4603
+ id: number;
4604
+ } | {
4605
+ action: "undo";
4606
+ id: number;
4607
+ } | {
4608
+ action: "redo";
4609
+ id: number;
4610
+ } | {
4611
+ action: "clear";
4612
+ } | {
4613
+ action: "discard";
4614
+ ids: number[];
4615
+ }>;
4274
4616
  };
4275
4617
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4276
4618
  type PresenceStackframe<P extends JsonObject> = {
@@ -5170,11 +5512,16 @@ type PlainLsonList = {
5170
5512
  liveblocksType: "LiveList";
5171
5513
  data: PlainLson[];
5172
5514
  };
5515
+ type PlainLsonText = {
5516
+ liveblocksType: "LiveText";
5517
+ data: LiveTextData;
5518
+ version?: number;
5519
+ };
5173
5520
  type PlainLsonFile = {
5174
5521
  liveblocksType: "LiveFile";
5175
5522
  data: LiveFileData;
5176
5523
  };
5177
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonFile | Json;
5524
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonText | PlainLsonFile | Json;
5178
5525
 
5179
5526
  /**
5180
5527
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5890,4 +6237,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5890
6237
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5891
6238
  };
5892
6239
 
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 };
6240
+ 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 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 UpdateSource, 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, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeLiveTextOperations, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, transformTextOperations, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };