@liveblocks/core 3.20.0 → 3.21.0-exp2

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
@@ -411,6 +411,8 @@ declare const OpCode: Readonly<{
411
411
  DELETE_OBJECT_KEY: 6;
412
412
  CREATE_MAP: 7;
413
413
  CREATE_REGISTER: 8;
414
+ CREATE_TEXT: 9;
415
+ UPDATE_TEXT: 10;
414
416
  }>;
415
417
  declare namespace OpCode {
416
418
  type INIT = typeof OpCode.INIT;
@@ -422,13 +424,48 @@ declare namespace OpCode {
422
424
  type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
423
425
  type CREATE_MAP = typeof OpCode.CREATE_MAP;
424
426
  type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
427
+ type CREATE_TEXT = typeof OpCode.CREATE_TEXT;
428
+ type UPDATE_TEXT = typeof OpCode.UPDATE_TEXT;
425
429
  }
430
+ type TextAttributes = JsonObject;
431
+ /**
432
+ * A single segment in a {@link LiveTextData} document.
433
+ *
434
+ * @example
435
+ * ["Hello world"]
436
+ * ["Hello ", { bold: true }]
437
+ */
438
+ type LiveTextSegment = [text: string] | [text: string, attributes: TextAttributes];
439
+ /**
440
+ * Serialized form of a {@link LiveText} document: an ordered list of text
441
+ * segments with optional inline attributes.
442
+ *
443
+ * @example
444
+ * [["Hello world"]]
445
+ * [["Hello ", { bold: true }], ["world"]]
446
+ */
447
+ type LiveTextData = LiveTextSegment[];
448
+ type TextOperation = {
449
+ type: "insert";
450
+ index: number;
451
+ text: string;
452
+ attributes?: TextAttributes;
453
+ } | {
454
+ type: "delete";
455
+ index: number;
456
+ length: number;
457
+ } | {
458
+ type: "format";
459
+ index: number;
460
+ length: number;
461
+ attributes: JsonObject;
462
+ };
426
463
  /**
427
464
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
428
465
  * only.
429
466
  */
430
- type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
431
- type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
467
+ type Op = CreateOp | UpdateObjectOp | UpdateTextOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
468
+ type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateTextOp;
432
469
  type UpdateObjectOp = {
433
470
  readonly opId?: string;
434
471
  readonly id: string;
@@ -473,6 +510,26 @@ type CreateRegisterOp = {
473
510
  readonly intent?: "set" | "push";
474
511
  readonly deletedId?: string;
475
512
  };
513
+ type CreateTextOp = {
514
+ readonly opId?: string;
515
+ readonly id: string;
516
+ readonly type: OpCode.CREATE_TEXT;
517
+ readonly parentId: string;
518
+ readonly parentKey: string;
519
+ readonly data: LiveTextData;
520
+ readonly version: number;
521
+ readonly intent?: "set" | "push";
522
+ readonly deletedId?: string;
523
+ };
524
+ type UpdateTextOp = {
525
+ readonly opId?: string;
526
+ readonly id: string;
527
+ readonly type: OpCode.UPDATE_TEXT;
528
+ readonly baseVersion: number;
529
+ readonly version?: number;
530
+ readonly ops: TextOperation[];
531
+ readonly metadata?: JsonObject;
532
+ };
476
533
  type DeleteCrdtOp = {
477
534
  readonly opId?: string;
478
535
  readonly id: string;
@@ -601,15 +658,17 @@ declare const CrdtType: Readonly<{
601
658
  LIST: 1;
602
659
  MAP: 2;
603
660
  REGISTER: 3;
661
+ TEXT: 4;
604
662
  }>;
605
663
  declare namespace CrdtType {
606
664
  type OBJECT = typeof CrdtType.OBJECT;
607
665
  type LIST = typeof CrdtType.LIST;
608
666
  type MAP = typeof CrdtType.MAP;
609
667
  type REGISTER = typeof CrdtType.REGISTER;
668
+ type TEXT = typeof CrdtType.TEXT;
610
669
  }
611
670
  type SerializedCrdt = SerializedRootObject | SerializedChild;
612
- type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
671
+ type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedText;
613
672
  type SerializedRootObject = {
614
673
  readonly type: CrdtType.OBJECT;
615
674
  readonly data: JsonObject;
@@ -638,13 +697,21 @@ type SerializedRegister = {
638
697
  readonly parentKey: string;
639
698
  readonly data: Json;
640
699
  };
700
+ type SerializedText = {
701
+ readonly type: CrdtType.TEXT;
702
+ readonly parentId: string;
703
+ readonly parentKey: string;
704
+ readonly data: LiveTextData;
705
+ readonly version: number;
706
+ };
641
707
  type StorageNode = RootStorageNode | ChildStorageNode;
642
- type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode;
708
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | TextStorageNode;
643
709
  type RootStorageNode = [id: "root", value: SerializedRootObject];
644
710
  type ObjectStorageNode = [id: string, value: SerializedObject];
645
711
  type ListStorageNode = [id: string, value: SerializedList];
646
712
  type MapStorageNode = [id: string, value: SerializedMap];
647
713
  type RegisterStorageNode = [id: string, value: SerializedRegister];
714
+ type TextStorageNode = [id: string, value: SerializedText];
648
715
  type NodeMap = Map<string, SerializedCrdt>;
649
716
  type NodeStream = Iterable<StorageNode>;
650
717
  declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
@@ -652,8 +719,9 @@ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode
652
719
  declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
653
720
  declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
654
721
  declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
722
+ declare function isTextStorageNode(node: StorageNode): node is TextStorageNode;
655
723
  type CompactNode = CompactRootNode | CompactChildNode;
656
- type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
724
+ type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactTextNode;
657
725
  type CompactRootNode = readonly [id: "root", data: JsonObject];
658
726
  type CompactObjectNode = readonly [
659
727
  id: string,
@@ -681,6 +749,14 @@ type CompactRegisterNode = readonly [
681
749
  parentKey: string,
682
750
  data: Json
683
751
  ];
752
+ type CompactTextNode = readonly [
753
+ id: string,
754
+ type: CrdtType.TEXT,
755
+ parentId: string,
756
+ parentKey: string,
757
+ data: LiveTextData,
758
+ version: number
759
+ ];
684
760
  declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
685
761
  declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
686
762
 
@@ -846,16 +922,244 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
846
922
  clone(): LiveObject<O>;
847
923
  }
848
924
 
925
+ /**
926
+ * Use this symbol to brand an object property as internal.
927
+ *
928
+ * @example
929
+ * Object.defineProperty(
930
+ * {
931
+ * public,
932
+ * [kInternal]: {
933
+ * private
934
+ * },
935
+ * },
936
+ * kInternal,
937
+ * {
938
+ * enumerable: false,
939
+ * }
940
+ * );
941
+ */
942
+ declare const kInternal: unique symbol;
943
+ declare const kStorageUpdateSource: unique symbol;
944
+
945
+ /**
946
+ * The position of the ops being transformed relative to the ops they are
947
+ * transformed over, in the final (server-serialized) timeline:
948
+ *
949
+ * - "after": the transformed ops will be ordered after the `over` ops. Used
950
+ * when rebasing a not-yet-accepted op over already-accepted ops. On
951
+ * same-index insert ties, the transformed op shifts right (the earlier op
952
+ * stays left), and conflicting format attributes are kept (they will
953
+ * overwrite, since the op applies later).
954
+ * - "before": the transformed ops were ordered before the `over` ops. Used
955
+ * when applying an accepted remote op on top of locally-pending ops. On
956
+ * same-index insert ties, the transformed op stays left, and conflicting
957
+ * format attributes are dropped on overlapping ranges (the later `over` op
958
+ * wins).
959
+ */
960
+ type TransformOrder = "before" | "after";
961
+ /**
962
+ * Transform `ops` over `over` (see {@link transformTextOperationsX}),
963
+ * returning only the transformed `ops`.
964
+ */
965
+ declare function transformTextOperations(ops: readonly TextOperation[], over: readonly TextOperation[], order: TransformOrder): TextOperation[];
966
+ declare function applyLiveTextOperations(data: LiveTextData, ops: readonly TextOperation[]): LiveTextData;
967
+
968
+ type LiveTextAttributes = TextAttributes;
969
+ type LiveTextAttributesPatch = JsonObject;
970
+
971
+ type LiveTextChange = {
972
+ /** Text was inserted at {@link LiveTextChange.index}. */
973
+ readonly type: "insert";
974
+ readonly index: number;
975
+ readonly text: string;
976
+ readonly attributes?: TextAttributes;
977
+ } | {
978
+ /** Text was deleted starting at {@link LiveTextChange.index}. */
979
+ readonly type: "delete";
980
+ readonly index: number;
981
+ readonly length: number;
982
+ readonly deletedText: string;
983
+ } | {
984
+ /** Inline attributes were updated on a range of text. */
985
+ readonly type: "format";
986
+ readonly index: number;
987
+ readonly length: number;
988
+ readonly attributes: LiveTextAttributesPatch;
989
+ };
990
+ /** Notification payload when a {@link LiveText} node changes. */
991
+ type LiveTextUpdates = {
992
+ type: "LiveText";
993
+ node: LiveText;
994
+ version: number;
995
+ updates: LiveTextChange[];
996
+ };
997
+ /**
998
+ * @private
999
+ *
1000
+ * Private methods on a LiveText node. As a user of Liveblocks, NEVER USE ANY
1001
+ * OF THESE DIRECTLY, because bad things will probably happen if you do.
1002
+ */
1003
+ type PrivateLiveTextApi = {
1004
+ /**
1005
+ * Encode a local-document index into server-confirmed coordinates suitable
1006
+ * for broadcasting to peers via presence or any other side channel. Pair
1007
+ * the result with {@link LiveText.version} at the same instant when
1008
+ * sending.
1009
+ */
1010
+ encodeIndex(localIndex: number): number;
1011
+ /**
1012
+ * Decode an `(index, fromVersion)` pair from a peer into an offset in this
1013
+ * LiveText's current local document.
1014
+ */
1015
+ decodeIndex(index: number, fromVersion: number): number | null;
1016
+ };
1017
+
1018
+ /**
1019
+ * LiveText is a collaborative rich-text primitive built on server-ordered
1020
+ * operational transformation.
1021
+ *
1022
+ * Use it to store plain text with optional inline formatting attributes in
1023
+ * Liveblocks Storage. Each document is a flat sequence of text segments; it
1024
+ * cannot contain child Storage structures.
1025
+ *
1026
+ * Outbound model (one-in-flight): at most one UpdateTextOp per node is
1027
+ * awaiting server acknowledgement at any time. Local edits made while an op
1028
+ * is in flight are queued and sent (composed into a single op) once the ack
1029
+ * arrives. This guarantees every wire op is expressed against server-state
1030
+ * coordinates, so the server can transform it over exactly the (foreign)
1031
+ * ops the client hadn't seen — never over the client's own pending ops.
1032
+ *
1033
+ * Inbound model: accepted remote ops are transformed over the local pending
1034
+ * ops before being applied ("before" order: the accepted op wins ties), and
1035
+ * the pending ops are re-expressed over the remote op in turn ("after"
1036
+ * order), keeping them in server coordinates at all times.
1037
+ *
1038
+ * @example
1039
+ * const text = new LiveText("Hello");
1040
+ * text.insert(5, " world");
1041
+ * text.format(0, 5, { bold: true });
1042
+ *
1043
+ * // [["Hello", { bold: true }], [" world"]]
1044
+ * text.toJSON();
1045
+ *
1046
+ * @example
1047
+ * // Use in Storage
1048
+ * declare global {
1049
+ * interface Liveblocks {
1050
+ * Storage: { document: LiveText };
1051
+ * }
1052
+ * }
1053
+ *
1054
+ * const { root } = await room.getStorage();
1055
+ * root.get("document").replace(0, root.get("document").length, "Updated");
1056
+ */
1057
+ declare class LiveText extends AbstractCrdt {
1058
+ #private;
1059
+ /**
1060
+ * @private
1061
+ *
1062
+ * Private methods and variables used in the core internals, but as a user
1063
+ * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
1064
+ * will probably happen if you do.
1065
+ */
1066
+ readonly [kInternal]: PrivateLiveTextApi;
1067
+ /**
1068
+ * Creates a new LiveText document.
1069
+ *
1070
+ * @param textOrData Initial plain text, or an array of `[text]` /
1071
+ * `[text, attributes]` segments. Defaults to an empty document.
1072
+ *
1073
+ * @example
1074
+ * new LiveText();
1075
+ * new LiveText("Hello world");
1076
+ * new LiveText([["Hello ", { bold: true }], ["world"]]);
1077
+ */
1078
+ constructor(textOrData?: string | LiveTextData, version?: number);
1079
+ get version(): number;
1080
+ get length(): number;
1081
+ /**
1082
+ * Inserts text at the given index.
1083
+ *
1084
+ * @param index Character index at which to insert. Values outside the
1085
+ * document range are clipped.
1086
+ * @param text Text to insert.
1087
+ * @param attributes Optional inline attributes for the inserted text.
1088
+ *
1089
+ * @example
1090
+ * const text = new LiveText("Hello");
1091
+ * text.insert(5, " world");
1092
+ * text.insert(0, "Say: ", { italic: true });
1093
+ */
1094
+ insert(index: number, text: string, attributes?: TextAttributes): void;
1095
+ /**
1096
+ * Deletes `length` characters starting at `index`.
1097
+ *
1098
+ * @example
1099
+ * const text = new LiveText("Hello world");
1100
+ * text.delete(5, 6); // "Hello"
1101
+ */
1102
+ delete(index: number, length: number): void;
1103
+ /**
1104
+ * Replaces a range of text with new text.
1105
+ *
1106
+ * @example
1107
+ * const text = new LiveText("Hello world");
1108
+ * text.replace(0, 5, "Hi"); // "Hi world"
1109
+ */
1110
+ replace(index: number, length: number, text: string, attributes?: TextAttributes): void;
1111
+ /**
1112
+ * Applies or removes inline attributes on a range of text.
1113
+ *
1114
+ * Set an attribute to `null` to remove it from the range.
1115
+ *
1116
+ * @example
1117
+ * const text = new LiveText("Hello world");
1118
+ * text.format(0, 5, { bold: true });
1119
+ * text.format(0, 5, { bold: null });
1120
+ */
1121
+ format(index: number, length: number, attributes: LiveTextAttributesPatch): void;
1122
+ /** Returns the plain text content without attributes. Equivalent to joining the text from each segment in {@link LiveText.toJSON}. */
1123
+ toString(): string;
1124
+ /**
1125
+ * Returns a JSON-compatible snapshot of the document as a {@link LiveTextData}
1126
+ * array.
1127
+ *
1128
+ * @example
1129
+ * new LiveText([["Hello ", { bold: true }], ["world"]]).toJSON();
1130
+ * // [["Hello ", { bold: true }], ["world"]]
1131
+ */
1132
+ toJSON(): LiveTextData;
1133
+ clone(): LiveText;
1134
+ }
1135
+
849
1136
  type StorageCallback = (updates: StorageUpdate[]) => void;
850
1137
  type LiveMapUpdate = LiveMapUpdates<string, Lson>;
851
1138
  type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
852
1139
  type LiveListUpdate = LiveListUpdates<Lson>;
1140
+ type LiveTextUpdate = LiveTextUpdates;
1141
+ type StorageUpdateSource = {
1142
+ origin: "remote";
1143
+ } | {
1144
+ origin: "local";
1145
+ via: "mutation";
1146
+ } | {
1147
+ origin: "local";
1148
+ via: "history";
1149
+ action: "undo" | "redo";
1150
+ };
853
1151
  /**
854
1152
  * The payload of notifications sent (in-client) when LiveStructures change.
855
1153
  * Messages of this kind are not originating from the network, but are 100%
856
1154
  * in-client.
1155
+ *
1156
+ * Updates delivered through `room.subscribe` may carry
1157
+ * `[kStorageUpdateSource]` to distinguish where a mutation came from.
1158
+ * Undo/redo replays use `via: "history"` with `action: "undo" | "redo"`.
857
1159
  */
858
- type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
1160
+ type StorageUpdate = (LiveMapUpdate | LiveObjectUpdate | LiveListUpdate | LiveTextUpdate) & {
1161
+ [kStorageUpdateSource]?: StorageUpdateSource;
1162
+ };
859
1163
 
860
1164
  /**
861
1165
  * Read-only query surface over {@link UnacknowledgedOps}, handed to CRDTs so
@@ -881,6 +1185,16 @@ interface ReadonlyUnacknowledgedOps {
881
1185
  isPossiblyStored(opId: string): boolean;
882
1186
  }
883
1187
 
1188
+ type DispatchOptions = {
1189
+ /**
1190
+ * Whether this dispatch should clear the redo stack. Defaults to true when
1191
+ * any forward ops are included (a fresh local mutation), false otherwise.
1192
+ * LiveText uses this to dispatch queued ops after an acknowledgement
1193
+ * (which should not clear redo), and to register fresh local edits that
1194
+ * don't carry wire ops yet (which should).
1195
+ */
1196
+ clearRedoStack?: boolean;
1197
+ };
884
1198
  /**
885
1199
  * The managed pool is a namespace registry (i.e. a context) that "owns" all
886
1200
  * the individual live nodes, ensuring each one has a unique ID, and holding on
@@ -900,7 +1214,7 @@ interface ManagedPool {
900
1214
  * - Add reverse operations to the undo/redo stack
901
1215
  * - Notify room subscribers with updates (in-client, no networking)
902
1216
  */
903
- dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1217
+ dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
904
1218
  /**
905
1219
  * Ensures storage can be written to else throws an error.
906
1220
  * This is used to prevent writing to storage when the user does not have
@@ -925,7 +1239,7 @@ type CreateManagedPoolOptions = {
925
1239
  /**
926
1240
  * Will get invoked when any Live structure calls .dispatch() on the pool.
927
1241
  */
928
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1242
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
929
1243
  /**
930
1244
  * Will get invoked when any Live structure calls .assertStorageIsWritable()
931
1245
  * on the pool. Defaults to true when not provided. Return false if you want
@@ -1105,7 +1419,7 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
1105
1419
  clone(): TValue;
1106
1420
  }
1107
1421
 
1108
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
1422
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveText;
1109
1423
  /**
1110
1424
  * Think of Lson as a sibling of the Json data tree, except that the nested
1111
1425
  * data structure can contain a mix of Json values and LiveStructure instances.
@@ -1141,7 +1455,7 @@ type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Ls
1141
1455
  readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
1142
1456
  } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
1143
1457
  readonly [K in KS]: ToJson<V>;
1144
- } : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1458
+ } : L extends LiveText ? LiveTextData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1145
1459
  readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
1146
1460
  } : L extends Json ? L : never;
1147
1461
 
@@ -1973,25 +2287,6 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
1973
2287
  getGroup(groupId: string): Promise<GroupData | undefined>;
1974
2288
  }
1975
2289
 
1976
- /**
1977
- * Use this symbol to brand an object property as internal.
1978
- *
1979
- * @example
1980
- * Object.defineProperty(
1981
- * {
1982
- * public,
1983
- * [kInternal]: {
1984
- * private
1985
- * },
1986
- * },
1987
- * kInternal,
1988
- * {
1989
- * enumerable: false,
1990
- * }
1991
- * );
1992
- */
1993
- declare const kInternal: unique symbol;
1994
-
1995
2290
  /**
1996
2291
  * Back-port of TypeScript 5.4's built-in NoInfer utility type.
1997
2292
  * See https://stackoverflow.com/a/56688073/148872
@@ -4122,7 +4417,14 @@ interface SyncSource {
4122
4417
  */
4123
4418
  type PrivateRoomApi = {
4124
4419
  presenceBuffer: Json | undefined;
4125
- undoStack: readonly (readonly Readonly<Stackframe<JsonObject>>[])[];
4420
+ undoStack: readonly {
4421
+ readonly id: number;
4422
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4423
+ }[];
4424
+ redoStack: readonly {
4425
+ readonly id: number;
4426
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4427
+ }[];
4126
4428
  nodeCount: number;
4127
4429
  getYjsProvider(): IYjsProvider | undefined;
4128
4430
  setYjsProvider(provider: IYjsProvider | undefined): void;
@@ -4157,6 +4459,21 @@ type PrivateRoomApi = {
4157
4459
  incomingMessage(data: string): void;
4158
4460
  };
4159
4461
  attachmentUrlsStore: BatchStore<string, string>;
4462
+ readonly history: Observable<{
4463
+ action: "push";
4464
+ id: number;
4465
+ } | {
4466
+ action: "undo";
4467
+ id: number;
4468
+ } | {
4469
+ action: "redo";
4470
+ id: number;
4471
+ } | {
4472
+ action: "clear";
4473
+ } | {
4474
+ action: "discard";
4475
+ ids: number[];
4476
+ }>;
4160
4477
  };
4161
4478
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4162
4479
  type PresenceStackframe<P extends JsonObject> = {
@@ -5056,7 +5373,12 @@ type PlainLsonList = {
5056
5373
  liveblocksType: "LiveList";
5057
5374
  data: PlainLson[];
5058
5375
  };
5059
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
5376
+ type PlainLsonText = {
5377
+ liveblocksType: "LiveText";
5378
+ data: LiveTextData;
5379
+ version?: number;
5380
+ };
5381
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonText | Json;
5060
5382
 
5061
5383
  /**
5062
5384
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5771,4 +6093,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5771
6093
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5772
6094
  };
5773
6095
 
5774
- 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 CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, 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 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, 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 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 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 ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, 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, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, 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 };
6096
+ 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 CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type CompactTextNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, 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 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, 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 PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PlainLsonText, type Poller, type PrivateClientApi, 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 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 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 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, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, 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 };