@liveblocks/core 3.22.0-rc1 → 3.23.0-file1

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,123 +217,6 @@ type BaseUserMeta = {
217
217
  info?: IUserInfo;
218
218
  };
219
219
 
220
- type RenameDataField<T, TFieldName extends string> = T extends any ? {
221
- [K in keyof T as K extends "data" ? TFieldName : K]: T[K];
222
- } : never;
223
- type AsyncLoading<F extends string = "data"> = RenameDataField<{
224
- readonly isLoading: true;
225
- readonly data?: never;
226
- readonly error?: never;
227
- }, F>;
228
- type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
229
- readonly isLoading: false;
230
- readonly data: T;
231
- readonly error?: never;
232
- }, F>;
233
- type AsyncError<F extends string = "data"> = RenameDataField<{
234
- readonly isLoading: false;
235
- readonly data?: never;
236
- readonly error: Error;
237
- }, F>;
238
- type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
239
-
240
- type Callback<T> = (event: T) => void;
241
- type UnsubscribeCallback = () => void;
242
- type Observable<T> = {
243
- /**
244
- * Register a callback function to be called whenever the event source emits
245
- * an event.
246
- */
247
- subscribe(callback: Callback<T>): UnsubscribeCallback;
248
- /**
249
- * Register a one-time callback function to be called whenever the event
250
- * source emits an event. After the event fires, the callback is
251
- * auto-unsubscribed.
252
- */
253
- subscribeOnce(callback: Callback<T>): UnsubscribeCallback;
254
- /**
255
- * Returns a promise that will resolve when an event is emitted by this
256
- * event source. Optionally, specify a predicate that has to match. The first
257
- * event matching that predicate will then resolve the promise.
258
- */
259
- waitUntil(predicate?: (event: T) => boolean): Promise<T>;
260
- };
261
- type EventSource<T> = Observable<T> & {
262
- /**
263
- * Notify all subscribers about the event. Will return `false` if there
264
- * weren't any subscribers at the time the .notify() was called, or `true` if
265
- * there was at least one subscriber.
266
- */
267
- notify(event: T): boolean;
268
- /**
269
- * Returns the number of active subscribers.
270
- */
271
- count(): number;
272
- /**
273
- * Observable instance, which can be used to subscribe to this event source
274
- * in a readonly fashion. Safe to publicly expose.
275
- */
276
- observable: Observable<T>;
277
- /**
278
- * Disposes of this event source.
279
- *
280
- * Will clears all registered event listeners. None of the registered
281
- * functions will ever get called again.
282
- *
283
- * WARNING!
284
- * Be careful when using this API, because the subscribers may not have any
285
- * idea they won't be notified anymore.
286
- */
287
- dispose(): void;
288
- };
289
- /**
290
- * makeEventSource allows you to generate a subscribe/notify pair of functions
291
- * to make subscribing easy and to get notified about events.
292
- *
293
- * The events are anonymous, so you can use it to define events, like so:
294
- *
295
- * const event1 = makeEventSource();
296
- * const event2 = makeEventSource();
297
- *
298
- * event1.subscribe(foo);
299
- * event1.subscribe(bar);
300
- * event2.subscribe(qux);
301
- *
302
- * // Unsubscription is pretty standard
303
- * const unsub = event2.subscribe(foo);
304
- * unsub();
305
- *
306
- * event1.notify(); // Now foo and bar will get called
307
- * event2.notify(); // Now qux will get called (but foo will not, since it's unsubscribed)
308
- *
309
- */
310
- declare function makeEventSource<T>(): EventSource<T>;
311
-
312
- type BatchStore<O, I> = {
313
- subscribe: (callback: Callback<void>) => UnsubscribeCallback;
314
- enqueue: (input: I) => Promise<void>;
315
- setData: (entries: [I, O][]) => void;
316
- getItemState: (input: I) => AsyncResult<O> | undefined;
317
- getData: (input: I) => O | undefined;
318
- invalidate: (inputs?: I[]) => void;
319
- };
320
-
321
- type ContextualPromptResponse = Relax<{
322
- type: "insert";
323
- text: string;
324
- } | {
325
- type: "replace";
326
- text: string;
327
- } | {
328
- type: "other";
329
- text: string;
330
- }>;
331
- type ContextualPromptContext = {
332
- beforeSelection: string;
333
- selection: string;
334
- afterSelection: string;
335
- };
336
-
337
220
  declare const brand: unique symbol;
338
221
  type Brand<T, TBrand extends string> = T & {
339
222
  [brand]: TBrand;
@@ -419,6 +302,7 @@ declare const OpCode: Readonly<{
419
302
  DELETE_OBJECT_KEY: 6;
420
303
  CREATE_MAP: 7;
421
304
  CREATE_REGISTER: 8;
305
+ CREATE_FILE: 11;
422
306
  }>;
423
307
  declare namespace OpCode {
424
308
  type INIT = typeof OpCode.INIT;
@@ -430,13 +314,14 @@ declare namespace OpCode {
430
314
  type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
431
315
  type CREATE_MAP = typeof OpCode.CREATE_MAP;
432
316
  type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
317
+ type CREATE_FILE = typeof OpCode.CREATE_FILE;
433
318
  }
434
319
  /**
435
320
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
436
321
  * only.
437
322
  */
438
323
  type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
439
- type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
324
+ type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateFileOp;
440
325
  type UpdateObjectOp = {
441
326
  readonly opId?: string;
442
327
  readonly id: string;
@@ -481,6 +366,16 @@ type CreateRegisterOp = {
481
366
  readonly intent?: "set" | "push";
482
367
  readonly deletedId?: string;
483
368
  };
369
+ type CreateFileOp = {
370
+ readonly opId?: string;
371
+ readonly id: string;
372
+ readonly type: OpCode.CREATE_FILE;
373
+ readonly parentId: string;
374
+ readonly parentKey: string;
375
+ readonly data: LiveFileData;
376
+ readonly intent?: "set" | "push";
377
+ readonly deletedId?: string;
378
+ };
484
379
  type DeleteCrdtOp = {
485
380
  readonly opId?: string;
486
381
  readonly id: string;
@@ -523,6 +418,133 @@ type TheirOp = DistributiveOmit<Op, "opId"> & {
523
418
  opId?: undefined;
524
419
  };
525
420
 
421
+ type LiveListUpdateDelta = {
422
+ type: "insert";
423
+ index: number;
424
+ item: Lson;
425
+ } | {
426
+ type: "delete";
427
+ index: number;
428
+ deletedItem: Lson;
429
+ } | {
430
+ type: "move";
431
+ index: number;
432
+ previousIndex: number;
433
+ item: Lson;
434
+ } | {
435
+ type: "set";
436
+ index: number;
437
+ item: Lson;
438
+ };
439
+ /**
440
+ * A LiveList notification that is sent in-client to any subscribers whenever
441
+ * one or more of the items inside the LiveList instance have changed.
442
+ */
443
+ type LiveListUpdates<TItem extends Lson> = {
444
+ type: "LiveList";
445
+ node: LiveList<TItem>;
446
+ updates: LiveListUpdateDelta[];
447
+ };
448
+ /**
449
+ * The LiveList class represents an ordered collection of items that is synchronized across clients.
450
+ */
451
+ declare class LiveList<TItem extends Lson> extends AbstractCrdt {
452
+ #private;
453
+ constructor(items: TItem[]);
454
+ /**
455
+ * Returns the number of elements.
456
+ */
457
+ get length(): number;
458
+ /**
459
+ * Adds one element to the end of the LiveList.
460
+ * @param element The element to add to the end of the LiveList.
461
+ */
462
+ push(element: TItem): void;
463
+ /**
464
+ * Inserts one element at a specified index.
465
+ * @param element The element to insert.
466
+ * @param index The index at which you want to insert the element.
467
+ */
468
+ insert(element: TItem, index: number): void;
469
+ /**
470
+ * Move one element from one index to another.
471
+ * @param index The index of the element to move
472
+ * @param targetIndex The index where the element should be after moving.
473
+ */
474
+ move(index: number, targetIndex: number): void;
475
+ /**
476
+ * Deletes an element at the specified index
477
+ * @param index The index of the element to delete
478
+ */
479
+ delete(index: number): void;
480
+ clear(): void;
481
+ set(index: number, item: TItem): void;
482
+ /**
483
+ * Tests whether all elements pass the test implemented by the provided function.
484
+ * @param predicate Function to test for each element, taking two arguments (the element and its index).
485
+ * @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
486
+ */
487
+ every(predicate: (value: TItem, index: number) => unknown): boolean;
488
+ /**
489
+ * Creates an array with all elements that pass the test implemented by the provided function.
490
+ * @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.
491
+ * @returns An array with the elements that pass the test.
492
+ */
493
+ filter(predicate: (value: TItem, index: number) => unknown): TItem[];
494
+ /**
495
+ * Returns the first element that satisfies the provided testing function.
496
+ * @param predicate Function to execute on each value.
497
+ * @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
498
+ */
499
+ find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
500
+ /**
501
+ * Returns the index of the first element in the LiveList that satisfies the provided testing function.
502
+ * @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
503
+ * @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
504
+ */
505
+ findIndex(predicate: (value: TItem, index: number) => unknown): number;
506
+ /**
507
+ * Executes a provided function once for each element.
508
+ * @param callbackfn Function to execute on each element.
509
+ */
510
+ forEach(callbackfn: (value: TItem, index: number) => void): void;
511
+ /**
512
+ * Get the element at the specified index.
513
+ * @param index The index on the element to get.
514
+ * @returns The element at the specified index or undefined.
515
+ */
516
+ get(index: number): TItem | undefined;
517
+ /**
518
+ * Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
519
+ * @param searchElement Element to locate.
520
+ * @param fromIndex The index to start the search at.
521
+ * @returns The first index of the element in the LiveList; -1 if not found.
522
+ */
523
+ indexOf(searchElement: TItem, fromIndex?: number): number;
524
+ /**
525
+ * 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.
526
+ * @param searchElement Element to locate.
527
+ * @param fromIndex The index at which to start searching backwards.
528
+ * @returns The last index of the element in the LiveList; -1 if not found.
529
+ */
530
+ lastIndexOf(searchElement: TItem, fromIndex?: number): number;
531
+ /**
532
+ * Creates an array populated with the results of calling a provided function on every element.
533
+ * @param callback Function that is called for every element.
534
+ * @returns An array with each element being the result of the callback function.
535
+ */
536
+ map<U>(callback: (value: TItem, index: number) => U): U[];
537
+ /**
538
+ * Tests whether at least one element in the LiveList passes the test implemented by the provided function.
539
+ * @param predicate Function to test for each element.
540
+ * @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
541
+ */
542
+ some(predicate: (value: TItem, index: number) => unknown): boolean;
543
+ [Symbol.iterator](): IterableIterator<TItem>;
544
+ toJSON(): readonly ToJson<TItem>[];
545
+ clone(): LiveList<TItem>;
546
+ }
547
+
526
548
  type UpdateDelta = {
527
549
  type: "update";
528
550
  } | {
@@ -609,15 +631,17 @@ declare const CrdtType: Readonly<{
609
631
  LIST: 1;
610
632
  MAP: 2;
611
633
  REGISTER: 3;
634
+ FILE: 5;
612
635
  }>;
613
636
  declare namespace CrdtType {
614
637
  type OBJECT = typeof CrdtType.OBJECT;
615
638
  type LIST = typeof CrdtType.LIST;
616
639
  type MAP = typeof CrdtType.MAP;
617
640
  type REGISTER = typeof CrdtType.REGISTER;
641
+ type FILE = typeof CrdtType.FILE;
618
642
  }
619
643
  type SerializedCrdt = SerializedRootObject | SerializedChild;
620
- type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
644
+ type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedFile;
621
645
  type SerializedRootObject = {
622
646
  readonly type: CrdtType.OBJECT;
623
647
  readonly data: JsonObject;
@@ -646,13 +670,20 @@ type SerializedRegister = {
646
670
  readonly parentKey: string;
647
671
  readonly data: Json;
648
672
  };
673
+ type SerializedFile = {
674
+ readonly type: CrdtType.FILE;
675
+ readonly parentId: string;
676
+ readonly parentKey: string;
677
+ readonly data: LiveFileData;
678
+ };
649
679
  type StorageNode = RootStorageNode | ChildStorageNode;
650
- type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode;
680
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | FileStorageNode;
651
681
  type RootStorageNode = [id: "root", value: SerializedRootObject];
652
682
  type ObjectStorageNode = [id: string, value: SerializedObject];
653
683
  type ListStorageNode = [id: string, value: SerializedList];
654
684
  type MapStorageNode = [id: string, value: SerializedMap];
655
685
  type RegisterStorageNode = [id: string, value: SerializedRegister];
686
+ type FileStorageNode = [id: string, value: SerializedFile];
656
687
  type NodeMap = Map<string, SerializedCrdt>;
657
688
  type NodeStream = Iterable<StorageNode>;
658
689
  declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
@@ -660,8 +691,9 @@ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode
660
691
  declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
661
692
  declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
662
693
  declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
694
+ declare function isFileStorageNode(node: StorageNode): node is FileStorageNode;
663
695
  type CompactNode = CompactRootNode | CompactChildNode;
664
- type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
696
+ type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactFileNode;
665
697
  type CompactRootNode = readonly [id: "root", data: JsonObject];
666
698
  type CompactObjectNode = readonly [
667
699
  id: string,
@@ -689,6 +721,13 @@ type CompactRegisterNode = readonly [
689
721
  parentKey: string,
690
722
  data: Json
691
723
  ];
724
+ type CompactFileNode = readonly [
725
+ id: string,
726
+ type: CrdtType.FILE,
727
+ parentId: string,
728
+ parentKey: string,
729
+ data: LiveFileData
730
+ ];
692
731
  declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
693
732
  declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
694
733
 
@@ -854,6 +893,56 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
854
893
  clone(): LiveObject<O>;
855
894
  }
856
895
 
896
+ /**
897
+ * INTERNAL
898
+ */
899
+ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
900
+ #private;
901
+ constructor(data: TValue);
902
+ get data(): TValue;
903
+ clone(): TValue;
904
+ }
905
+
906
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveFile;
907
+ /**
908
+ * Think of Lson as a sibling of the Json data tree, except that the nested
909
+ * data structure can contain a mix of Json values and LiveStructure instances.
910
+ */
911
+ type Lson = Json | LiveStructure;
912
+ /**
913
+ * LiveNode is the internal tree for managing Live data structures. The key
914
+ * difference with Lson is that all the Json values get represented in
915
+ * a LiveRegister node.
916
+ */
917
+ type LiveNode = LiveStructure | LiveRegister<Json>;
918
+ /**
919
+ * A mapping of keys to Lson values. A Lson value is any valid JSON
920
+ * value or a Live storage data structure (LiveMap, LiveList, etc.)
921
+ */
922
+ type LsonObject = Record<string, Lson | undefined>;
923
+ /**
924
+ * Helper type to convert any valid Lson type to the equivalent Json type.
925
+ *
926
+ * Examples:
927
+ *
928
+ * ToJson<42> // 42
929
+ * ToJson<'hi'> // 'hi'
930
+ * ToJson<number> // number
931
+ * ToJson<string> // string
932
+ * ToJson<string | LiveList<number>> // string | readonly number[]
933
+ * ToJson<LiveMap<string, LiveList<number>>>
934
+ * // { readonly [key: string]: readonly number[] }
935
+ * ToJson<LiveObject<{ a: number, b: LiveList<string>, c?: number }>>
936
+ * // { readonly a: null, readonly b: readonly string[], readonly c?: number }
937
+ */
938
+ type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Lson> ? Lson extends I ? readonly ReadonlyJson[] : readonly ToJson<I>[] : L extends LiveObject<infer O extends LsonObject> ? LsonObject extends O ? ReadonlyJsonObject : {
939
+ readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
940
+ } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
941
+ readonly [K in KS]: ToJson<V>;
942
+ } : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
943
+ readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
944
+ } : L extends Json ? L : never;
945
+
857
946
  type StorageCallback = (updates: StorageUpdate[]) => void;
858
947
  type LiveMapUpdate = LiveMapUpdates<string, Lson>;
859
948
  type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
@@ -895,7 +984,6 @@ interface ReadonlyUnacknowledgedOps {
895
984
  * to live nodes before and after they are inter-connected.
896
985
  */
897
986
  interface ManagedPool {
898
- readonly roomId: string;
899
987
  readonly nodes: ReadonlyMap<string, LiveNode>;
900
988
  readonly generateId: () => string;
901
989
  readonly generateOpId: () => string;
@@ -912,246 +1000,208 @@ interface ManagedPool {
912
1000
  /**
913
1001
  * Ensures storage can be written to else throws an error.
914
1002
  * This is used to prevent writing to storage when the user does not have
915
- * permission to do so.
916
- * @throws {Error} if storage is not writable
917
- * @returns {void}
918
- */
919
- assertStorageIsWritable: () => void;
920
- /**
921
- * Read-only view of the client's still-unacknowledged ops (sent or
922
- * pending-send, not yet confirmed by the server).
923
- */
924
- readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
925
- }
926
- type CreateManagedPoolOptions = {
927
- /**
928
- * Returns the current connection ID. This is used to generate unique
929
- * prefixes for nodes created by this client. This number is allowed to
930
- * change over time (for example, when the client reconnects).
931
- */
932
- getCurrentConnectionId(): number;
933
- /**
934
- * Will get invoked when any Live structure calls .dispatch() on the pool.
935
- */
936
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
937
- /**
938
- * Will get invoked when any Live structure calls .assertStorageIsWritable()
939
- * on the pool. Defaults to true when not provided. Return false if you want
940
- * to prevent writes to the pool locally early, because you know they won't
941
- * have an effect upstream.
942
- */
943
- isStorageWritable?: () => boolean;
944
- /**
945
- * Read-only view of the client's still-unacknowledged ops. Used by CRDTs
946
- * (e.g. LiveList) to know which of their optimistic mutations the server
947
- * hasn't confirmed yet. Defaults to an empty view (e.g. server-side pools
948
- * that dispatch-and-flush have no optimistic state to track).
949
- */
950
- unacknowledgedOps?: ReadonlyUnacknowledgedOps;
951
- };
952
- /**
953
- * @private Private API, never use this API directly.
954
- */
955
- declare function createManagedPool(roomId: string, options: CreateManagedPoolOptions): ManagedPool;
956
- declare abstract class AbstractCrdt {
957
- #private;
958
- get roomId(): string | null;
959
- /**
960
- * @private
961
- * Returns true if the cached JSON snapshot exists and is reference-equal
962
- * to the given value. Does not trigger a recompute.
963
- */
964
- hasCache(value: unknown): boolean;
965
- /**
966
- * Return a JSON-compatible snapshot of this Live node and its children.
967
- * LiveObject values become plain objects, LiveList values become arrays,
968
- * and LiveMap values also become plain objects (not Map instances).
969
- * The result is cached and only recomputed when the contents change.
970
- */
971
- toJSON(): ReadonlyJson;
972
- /**
973
- * Returns a deep clone of the current LiveStructure, suitable for insertion
974
- * in the tree elsewhere.
975
- */
976
- abstract clone(): Lson;
977
- }
978
-
979
- type LiveListUpdateDelta = {
980
- type: "insert";
981
- index: number;
982
- item: Lson;
983
- } | {
984
- type: "delete";
985
- index: number;
986
- deletedItem: Lson;
987
- } | {
988
- type: "move";
989
- index: number;
990
- previousIndex: number;
991
- item: Lson;
992
- } | {
993
- type: "set";
994
- index: number;
995
- item: Lson;
996
- };
997
- /**
998
- * A LiveList notification that is sent in-client to any subscribers whenever
999
- * one or more of the items inside the LiveList instance have changed.
1000
- */
1001
- type LiveListUpdates<TItem extends Lson> = {
1002
- type: "LiveList";
1003
- node: LiveList<TItem>;
1004
- updates: LiveListUpdateDelta[];
1005
- };
1006
- /**
1007
- * The LiveList class represents an ordered collection of items that is synchronized across clients.
1008
- */
1009
- declare class LiveList<TItem extends Lson> extends AbstractCrdt {
1010
- #private;
1011
- constructor(items: TItem[]);
1012
- /**
1013
- * Returns the number of elements.
1014
- */
1015
- get length(): number;
1016
- /**
1017
- * Adds one element to the end of the LiveList.
1018
- * @param element The element to add to the end of the LiveList.
1019
- */
1020
- push(element: TItem): void;
1021
- /**
1022
- * Inserts one element at a specified index.
1023
- * @param element The element to insert.
1024
- * @param index The index at which you want to insert the element.
1025
- */
1026
- insert(element: TItem, index: number): void;
1027
- /**
1028
- * Move one element from one index to another.
1029
- * @param index The index of the element to move
1030
- * @param targetIndex The index where the element should be after moving.
1031
- */
1032
- move(index: number, targetIndex: number): void;
1033
- /**
1034
- * Deletes an element at the specified index
1035
- * @param index The index of the element to delete
1036
- */
1037
- delete(index: number): void;
1038
- clear(): void;
1039
- set(index: number, item: TItem): void;
1040
- /**
1041
- * Tests whether all elements pass the test implemented by the provided function.
1042
- * @param predicate Function to test for each element, taking two arguments (the element and its index).
1043
- * @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
1044
- */
1045
- every(predicate: (value: TItem, index: number) => unknown): boolean;
1046
- /**
1047
- * Creates an array with all elements that pass the test implemented by the provided function.
1048
- * @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.
1049
- * @returns An array with the elements that pass the test.
1003
+ * permission to do so.
1004
+ * @throws {Error} if storage is not writable
1005
+ * @returns {void}
1050
1006
  */
1051
- filter(predicate: (value: TItem, index: number) => unknown): TItem[];
1007
+ assertStorageIsWritable: () => void;
1052
1008
  /**
1053
- * Returns the first element that satisfies the provided testing function.
1054
- * @param predicate Function to execute on each value.
1055
- * @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
1009
+ * Read-only view of the client's still-unacknowledged ops (sent or
1010
+ * pending-send, not yet confirmed by the server).
1056
1011
  */
1057
- find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
1012
+ readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
1013
+ }
1014
+ type CreateManagedPoolOptions = {
1058
1015
  /**
1059
- * Returns the index of the first element in the LiveList that satisfies the provided testing function.
1060
- * @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
1061
- * @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
1016
+ * Returns the current connection ID. This is used to generate unique
1017
+ * prefixes for nodes created by this client. This number is allowed to
1018
+ * change over time (for example, when the client reconnects).
1062
1019
  */
1063
- findIndex(predicate: (value: TItem, index: number) => unknown): number;
1020
+ getCurrentConnectionId(): number;
1064
1021
  /**
1065
- * Executes a provided function once for each element.
1066
- * @param callbackfn Function to execute on each element.
1022
+ * Will get invoked when any Live structure calls .dispatch() on the pool.
1067
1023
  */
1068
- forEach(callbackfn: (value: TItem, index: number) => void): void;
1024
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1069
1025
  /**
1070
- * Get the element at the specified index.
1071
- * @param index The index on the element to get.
1072
- * @returns The element at the specified index or undefined.
1026
+ * Will get invoked when any Live structure calls .assertStorageIsWritable()
1027
+ * on the pool. Defaults to true when not provided. Return false if you want
1028
+ * to prevent writes to the pool locally early, because you know they won't
1029
+ * have an effect upstream.
1073
1030
  */
1074
- get(index: number): TItem | undefined;
1031
+ isStorageWritable?: () => boolean;
1075
1032
  /**
1076
- * Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
1077
- * @param searchElement Element to locate.
1078
- * @param fromIndex The index to start the search at.
1079
- * @returns The first index of the element in the LiveList; -1 if not found.
1033
+ * Read-only view of the client's still-unacknowledged ops. Used by CRDTs
1034
+ * (e.g. LiveList) to know which of their optimistic mutations the server
1035
+ * hasn't confirmed yet. Defaults to an empty view (e.g. server-side pools
1036
+ * that dispatch-and-flush have no optimistic state to track).
1080
1037
  */
1081
- indexOf(searchElement: TItem, fromIndex?: number): number;
1038
+ unacknowledgedOps?: ReadonlyUnacknowledgedOps;
1039
+ };
1040
+ /**
1041
+ * @private Private API, never use this API directly.
1042
+ */
1043
+ declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
1044
+ declare abstract class AbstractCrdt {
1045
+ #private;
1082
1046
  /**
1083
- * 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.
1084
- * @param searchElement Element to locate.
1085
- * @param fromIndex The index at which to start searching backwards.
1086
- * @returns The last index of the element in the LiveList; -1 if not found.
1047
+ * @private
1048
+ * Returns true if the cached JSON snapshot exists and is reference-equal
1049
+ * to the given value. Does not trigger a recompute.
1087
1050
  */
1088
- lastIndexOf(searchElement: TItem, fromIndex?: number): number;
1051
+ hasCache(value: unknown): boolean;
1089
1052
  /**
1090
- * Creates an array populated with the results of calling a provided function on every element.
1091
- * @param callback Function that is called for every element.
1092
- * @returns An array with each element being the result of the callback function.
1053
+ * Return a JSON-compatible snapshot of this Live node and its children.
1054
+ * LiveObject values become plain objects, LiveList values become arrays,
1055
+ * and LiveMap values also become plain objects (not Map instances).
1056
+ * The result is cached and only recomputed when the contents change.
1093
1057
  */
1094
- map<U>(callback: (value: TItem, index: number) => U): U[];
1058
+ toJSON(): ReadonlyJson;
1095
1059
  /**
1096
- * Tests whether at least one element in the LiveList passes the test implemented by the provided function.
1097
- * @param predicate Function to test for each element.
1098
- * @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
1060
+ * Returns a deep clone of the current LiveStructure, suitable for insertion
1061
+ * in the tree elsewhere.
1099
1062
  */
1100
- some(predicate: (value: TItem, index: number) => unknown): boolean;
1101
- [Symbol.iterator](): IterableIterator<TItem>;
1102
- toJSON(): readonly ToJson<TItem>[];
1103
- clone(): LiveList<TItem>;
1063
+ abstract clone(): Lson;
1104
1064
  }
1105
1065
 
1066
+ type LiveFileData = {
1067
+ readonly id: string;
1068
+ readonly name: string;
1069
+ readonly size: number;
1070
+ readonly mimeType: string;
1071
+ };
1072
+ type LiveFileReference = LiveFile | LiveFileData | string;
1073
+ declare function getLiveFileId(file: LiveFileReference): string;
1106
1074
  /**
1107
- * INTERNAL
1075
+ * A LiveFile is an immutable Storage leaf that references file bytes stored
1076
+ * outside the realtime Storage tree.
1108
1077
  */
1109
- declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
1078
+ declare class LiveFile extends AbstractCrdt {
1110
1079
  #private;
1111
- constructor(data: TValue);
1112
- get data(): TValue;
1113
- clone(): TValue;
1080
+ constructor(data: LiveFileData);
1081
+ get data(): Readonly<LiveFileData>;
1082
+ get id(): string;
1083
+ get name(): string;
1084
+ get size(): number;
1085
+ get mimeType(): string;
1086
+ clone(): LiveFile;
1114
1087
  }
1115
1088
 
1116
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
1117
- /**
1118
- * Think of Lson as a sibling of the Json data tree, except that the nested
1119
- * data structure can contain a mix of Json values and LiveStructure instances.
1120
- */
1121
- type Lson = Json | LiveStructure;
1122
- /**
1123
- * LiveNode is the internal tree for managing Live data structures. The key
1124
- * difference with Lson is that all the Json values get represented in
1125
- * a LiveRegister node.
1126
- */
1127
- type LiveNode = LiveStructure | LiveRegister<Json>;
1128
- /**
1129
- * A mapping of keys to Lson values. A Lson value is any valid JSON
1130
- * value or a Live storage data structure (LiveMap, LiveList, etc.)
1131
- */
1132
- type LsonObject = Record<string, Lson | undefined>;
1089
+ type RenameDataField<T, TFieldName extends string> = T extends any ? {
1090
+ [K in keyof T as K extends "data" ? TFieldName : K]: T[K];
1091
+ } : never;
1092
+ type AsyncLoading<F extends string = "data"> = RenameDataField<{
1093
+ readonly isLoading: true;
1094
+ readonly data?: never;
1095
+ readonly error?: never;
1096
+ }, F>;
1097
+ type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
1098
+ readonly isLoading: false;
1099
+ readonly data: T;
1100
+ readonly error?: never;
1101
+ }, F>;
1102
+ type AsyncError<F extends string = "data"> = RenameDataField<{
1103
+ readonly isLoading: false;
1104
+ readonly data?: never;
1105
+ readonly error: Error;
1106
+ }, F>;
1107
+ type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
1108
+
1109
+ type Callback<T> = (event: T) => void;
1110
+ type UnsubscribeCallback = () => void;
1111
+ type Observable<T> = {
1112
+ /**
1113
+ * Register a callback function to be called whenever the event source emits
1114
+ * an event.
1115
+ */
1116
+ subscribe(callback: Callback<T>): UnsubscribeCallback;
1117
+ /**
1118
+ * Register a one-time callback function to be called whenever the event
1119
+ * source emits an event. After the event fires, the callback is
1120
+ * auto-unsubscribed.
1121
+ */
1122
+ subscribeOnce(callback: Callback<T>): UnsubscribeCallback;
1123
+ /**
1124
+ * Returns a promise that will resolve when an event is emitted by this
1125
+ * event source. Optionally, specify a predicate that has to match. The first
1126
+ * event matching that predicate will then resolve the promise.
1127
+ */
1128
+ waitUntil(predicate?: (event: T) => boolean): Promise<T>;
1129
+ };
1130
+ type EventSource<T> = Observable<T> & {
1131
+ /**
1132
+ * Notify all subscribers about the event. Will return `false` if there
1133
+ * weren't any subscribers at the time the .notify() was called, or `true` if
1134
+ * there was at least one subscriber.
1135
+ */
1136
+ notify(event: T): boolean;
1137
+ /**
1138
+ * Returns the number of active subscribers.
1139
+ */
1140
+ count(): number;
1141
+ /**
1142
+ * Observable instance, which can be used to subscribe to this event source
1143
+ * in a readonly fashion. Safe to publicly expose.
1144
+ */
1145
+ observable: Observable<T>;
1146
+ /**
1147
+ * Disposes of this event source.
1148
+ *
1149
+ * Will clears all registered event listeners. None of the registered
1150
+ * functions will ever get called again.
1151
+ *
1152
+ * WARNING!
1153
+ * Be careful when using this API, because the subscribers may not have any
1154
+ * idea they won't be notified anymore.
1155
+ */
1156
+ dispose(): void;
1157
+ };
1133
1158
  /**
1134
- * Helper type to convert any valid Lson type to the equivalent Json type.
1159
+ * makeEventSource allows you to generate a subscribe/notify pair of functions
1160
+ * to make subscribing easy and to get notified about events.
1135
1161
  *
1136
- * Examples:
1162
+ * The events are anonymous, so you can use it to define events, like so:
1163
+ *
1164
+ * const event1 = makeEventSource();
1165
+ * const event2 = makeEventSource();
1166
+ *
1167
+ * event1.subscribe(foo);
1168
+ * event1.subscribe(bar);
1169
+ * event2.subscribe(qux);
1170
+ *
1171
+ * // Unsubscription is pretty standard
1172
+ * const unsub = event2.subscribe(foo);
1173
+ * unsub();
1174
+ *
1175
+ * event1.notify(); // Now foo and bar will get called
1176
+ * event2.notify(); // Now qux will get called (but foo will not, since it's unsubscribed)
1137
1177
  *
1138
- * ToJson<42> // 42
1139
- * ToJson<'hi'> // 'hi'
1140
- * ToJson<number> // number
1141
- * ToJson<string> // string
1142
- * ToJson<string | LiveList<number>> // string | readonly number[]
1143
- * ToJson<LiveMap<string, LiveList<number>>>
1144
- * // { readonly [key: string]: readonly number[] }
1145
- * ToJson<LiveObject<{ a: number, b: LiveList<string>, c?: number }>>
1146
- * // { readonly a: null, readonly b: readonly string[], readonly c?: number }
1147
1178
  */
1148
- type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Lson> ? Lson extends I ? readonly ReadonlyJson[] : readonly ToJson<I>[] : L extends LiveObject<infer O extends LsonObject> ? LsonObject extends O ? ReadonlyJsonObject : {
1149
- readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
1150
- } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
1151
- readonly [K in KS]: ToJson<V>;
1152
- } : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1153
- readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
1154
- } : L extends Json ? L : never;
1179
+ declare function makeEventSource<T>(): EventSource<T>;
1180
+
1181
+ type BatchStore<O, I> = {
1182
+ subscribe: (callback: Callback<void>) => UnsubscribeCallback;
1183
+ enqueue: (input: I) => Promise<void>;
1184
+ setData: (entries: [I, O][]) => void;
1185
+ getItemState: (input: I) => AsyncResult<O> | undefined;
1186
+ getData: (input: I) => O | undefined;
1187
+ invalidate: (inputs?: I[]) => void;
1188
+ };
1189
+
1190
+ type ContextualPromptResponse = Relax<{
1191
+ type: "insert";
1192
+ text: string;
1193
+ } | {
1194
+ type: "replace";
1195
+ text: string;
1196
+ } | {
1197
+ type: "other";
1198
+ text: string;
1199
+ }>;
1200
+ type ContextualPromptContext = {
1201
+ beforeSelection: string;
1202
+ selection: string;
1203
+ afterSelection: string;
1204
+ };
1155
1205
 
1156
1206
  type DateToString<T> = {
1157
1207
  [P in keyof T]: T[P] extends Date ? string : T[P] extends Date | null ? string | null : T[P] extends Date | undefined ? string | undefined : T[P];
@@ -1847,6 +1897,16 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1847
1897
  signal?: AbortSignal;
1848
1898
  }): Promise<CommentAttachment>;
1849
1899
  getOrCreateAttachmentUrlsStore(roomId: string): BatchStore<string, string>;
1900
+ getFileUrl(options: {
1901
+ roomId: string;
1902
+ fileId: string;
1903
+ }): Promise<string>;
1904
+ uploadFile({ roomId, file, signal, }: {
1905
+ roomId: string;
1906
+ file: File;
1907
+ signal?: AbortSignal;
1908
+ }): Promise<LiveFile>;
1909
+ getOrCreateFileUrlsStore(roomId: string): BatchStore<string, string>;
1850
1910
  createTextMention({ roomId, mentionId, mention, }: {
1851
1911
  roomId: string;
1852
1912
  mentionId: string;
@@ -1856,13 +1916,21 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1856
1916
  roomId: string;
1857
1917
  mentionId: string;
1858
1918
  }): Promise<void>;
1859
- getYjsHistoryVersion({ roomId, versionId, }: {
1919
+ fetchStorageHistoryVersion({ roomId, versionId, }: {
1920
+ roomId: string;
1921
+ versionId: string;
1922
+ }): Promise<Response>;
1923
+ fetchYjsHistoryVersion({ roomId, versionId, }: {
1860
1924
  roomId: string;
1861
1925
  versionId: string;
1862
1926
  }): Promise<Response>;
1863
1927
  createVersionHistorySnapshot({ roomId }: {
1864
1928
  roomId: string;
1865
1929
  }): Promise<void>;
1930
+ deleteHistoryVersion({ roomId, versionId, }: {
1931
+ roomId: string;
1932
+ versionId: string;
1933
+ }): Promise<void>;
1866
1934
  reportTextEditor({ roomId, type, rootKey, }: {
1867
1935
  roomId: string;
1868
1936
  type: TextEditorType;
@@ -3565,6 +3633,9 @@ type GetThreadsSinceOptions = {
3565
3633
  type UploadAttachmentOptions = {
3566
3634
  signal?: AbortSignal;
3567
3635
  };
3636
+ type UploadFileOptions = {
3637
+ signal?: AbortSignal;
3638
+ };
3568
3639
  type ListTextVersionsSinceOptions = {
3569
3640
  since: Date;
3570
3641
  signal?: AbortSignal;
@@ -4073,6 +4144,23 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
4073
4144
  * await room.getAttachmentUrl("at_xxx");
4074
4145
  */
4075
4146
  getAttachmentUrl(attachmentId: string): Promise<string>;
4147
+ /**
4148
+ * Uploads a file for a `LiveFile`.
4149
+ *
4150
+ * @example
4151
+ * const liveFile = await room.uploadFile(file);
4152
+ */
4153
+ uploadFile(file: File, options?: UploadFileOptions): Promise<LiveFile>;
4154
+ /**
4155
+ * Returns a presigned URL for a `LiveFile`.
4156
+ *
4157
+ * @example
4158
+ * await getFileUrl("fl_xxx");
4159
+ *
4160
+ * @example
4161
+ * await getFileUrl(liveFile);
4162
+ */
4163
+ getFileUrl(file: LiveFileReference): Promise<string>;
4076
4164
  /**
4077
4165
  * Gets the user's subscription settings for the current room.
4078
4166
  *
@@ -4149,8 +4237,12 @@ type PrivateRoomApi = {
4149
4237
  versions: HistoryVersion[];
4150
4238
  requestedAt: Date;
4151
4239
  }>;
4152
- getYjsHistoryVersion(versionId: string): Promise<Response>;
4240
+ fetchStorageHistoryVersion(versionId: string): Promise<Response>;
4241
+ fetchYjsHistoryVersion(versionId: string): Promise<Response>;
4242
+ liveObjectFromNodeStream(nodes: NodeStream): LiveObject<LsonObject>;
4243
+ reconcileStorageWithNodes(nodes: NodeStream): void;
4153
4244
  createVersionHistorySnapshot(): Promise<void>;
4245
+ deleteHistoryVersion(versionId: string): Promise<void>;
4154
4246
  executeContextualPrompt(options: {
4155
4247
  prompt: string;
4156
4248
  context: ContextualPromptContext;
@@ -4166,6 +4258,7 @@ type PrivateRoomApi = {
4166
4258
  incomingMessage(data: string): void;
4167
4259
  };
4168
4260
  attachmentUrlsStore: BatchStore<string, string>;
4261
+ fileUrlsStore: BatchStore<string, string>;
4169
4262
  };
4170
4263
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4171
4264
  type PresenceStackframe<P extends JsonObject> = {
@@ -5065,7 +5158,11 @@ type PlainLsonList = {
5065
5158
  liveblocksType: "LiveList";
5066
5159
  data: PlainLson[];
5067
5160
  };
5068
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
5161
+ type PlainLsonFile = {
5162
+ liveblocksType: "LiveFile";
5163
+ data: LiveFileData;
5164
+ };
5165
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonFile | Json;
5069
5166
 
5070
5167
  /**
5071
5168
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5173,6 +5270,7 @@ declare function Promise_withResolvers<T>(): ControlledPromise<T>;
5173
5270
  declare function createThreadId(): string;
5174
5271
  declare function createCommentId(): string;
5175
5272
  declare function createCommentAttachmentId(): string;
5273
+ declare function createStorageFileId(): string;
5176
5274
  declare function createInboxNotificationId(): string;
5177
5275
 
5178
5276
  /**
@@ -5780,4 +5878,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5780
5878
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5781
5879
  };
5782
5880
 
5783
- 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 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 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 };
5881
+ 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 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 };