@liveblocks/core 3.22.0 → 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>;
@@ -909,247 +998,210 @@ interface ManagedPool {
909
998
  */
910
999
  dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
911
1000
  /**
912
- * Ensures storage can be written to else throws an error.
913
- * This is used to prevent writing to storage when the user does not have
914
- * permission to do so.
915
- * @throws {Error} if storage is not writable
916
- * @returns {void}
917
- */
918
- assertStorageIsWritable: () => void;
919
- /**
920
- * Read-only view of the client's still-unacknowledged ops (sent or
921
- * pending-send, not yet confirmed by the server).
922
- */
923
- readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
924
- }
925
- type CreateManagedPoolOptions = {
926
- /**
927
- * Returns the current connection ID. This is used to generate unique
928
- * prefixes for nodes created by this client. This number is allowed to
929
- * change over time (for example, when the client reconnects).
930
- */
931
- getCurrentConnectionId(): number;
932
- /**
933
- * Will get invoked when any Live structure calls .dispatch() on the pool.
934
- */
935
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
936
- /**
937
- * Will get invoked when any Live structure calls .assertStorageIsWritable()
938
- * on the pool. Defaults to true when not provided. Return false if you want
939
- * to prevent writes to the pool locally early, because you know they won't
940
- * have an effect upstream.
941
- */
942
- isStorageWritable?: () => boolean;
943
- /**
944
- * Read-only view of the client's still-unacknowledged ops. Used by CRDTs
945
- * (e.g. LiveList) to know which of their optimistic mutations the server
946
- * hasn't confirmed yet. Defaults to an empty view (e.g. server-side pools
947
- * that dispatch-and-flush have no optimistic state to track).
948
- */
949
- unacknowledgedOps?: ReadonlyUnacknowledgedOps;
950
- };
951
- /**
952
- * @private Private API, never use this API directly.
953
- */
954
- declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
955
- declare abstract class AbstractCrdt {
956
- #private;
957
- /**
958
- * @private
959
- * Returns true if the cached JSON snapshot exists and is reference-equal
960
- * to the given value. Does not trigger a recompute.
961
- */
962
- hasCache(value: unknown): boolean;
963
- /**
964
- * Return a JSON-compatible snapshot of this Live node and its children.
965
- * LiveObject values become plain objects, LiveList values become arrays,
966
- * and LiveMap values also become plain objects (not Map instances).
967
- * The result is cached and only recomputed when the contents change.
968
- */
969
- toJSON(): ReadonlyJson;
970
- /**
971
- * Returns a deep clone of the current LiveStructure, suitable for insertion
972
- * in the tree elsewhere.
973
- */
974
- abstract clone(): Lson;
975
- }
976
-
977
- type LiveListUpdateDelta = {
978
- type: "insert";
979
- index: number;
980
- item: Lson;
981
- } | {
982
- type: "delete";
983
- index: number;
984
- deletedItem: Lson;
985
- } | {
986
- type: "move";
987
- index: number;
988
- previousIndex: number;
989
- item: Lson;
990
- } | {
991
- type: "set";
992
- index: number;
993
- item: Lson;
994
- };
995
- /**
996
- * A LiveList notification that is sent in-client to any subscribers whenever
997
- * one or more of the items inside the LiveList instance have changed.
998
- */
999
- type LiveListUpdates<TItem extends Lson> = {
1000
- type: "LiveList";
1001
- node: LiveList<TItem>;
1002
- updates: LiveListUpdateDelta[];
1003
- };
1004
- /**
1005
- * The LiveList class represents an ordered collection of items that is synchronized across clients.
1006
- */
1007
- declare class LiveList<TItem extends Lson> extends AbstractCrdt {
1008
- #private;
1009
- constructor(items: TItem[]);
1010
- /**
1011
- * Returns the number of elements.
1012
- */
1013
- get length(): number;
1014
- /**
1015
- * Adds one element to the end of the LiveList.
1016
- * @param element The element to add to the end of the LiveList.
1017
- */
1018
- push(element: TItem): void;
1019
- /**
1020
- * Inserts one element at a specified index.
1021
- * @param element The element to insert.
1022
- * @param index The index at which you want to insert the element.
1023
- */
1024
- insert(element: TItem, index: number): void;
1025
- /**
1026
- * Move one element from one index to another.
1027
- * @param index The index of the element to move
1028
- * @param targetIndex The index where the element should be after moving.
1029
- */
1030
- move(index: number, targetIndex: number): void;
1031
- /**
1032
- * Deletes an element at the specified index
1033
- * @param index The index of the element to delete
1034
- */
1035
- delete(index: number): void;
1036
- clear(): void;
1037
- set(index: number, item: TItem): void;
1038
- /**
1039
- * Tests whether all elements pass the test implemented by the provided function.
1040
- * @param predicate Function to test for each element, taking two arguments (the element and its index).
1041
- * @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
1042
- */
1043
- every(predicate: (value: TItem, index: number) => unknown): boolean;
1044
- /**
1045
- * Creates an array with all elements that pass the test implemented by the provided function.
1046
- * @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.
1047
- * @returns An array with the elements that pass the test.
1001
+ * Ensures storage can be written to else throws an error.
1002
+ * This is used to prevent writing to storage when the user does not have
1003
+ * permission to do so.
1004
+ * @throws {Error} if storage is not writable
1005
+ * @returns {void}
1048
1006
  */
1049
- filter(predicate: (value: TItem, index: number) => unknown): TItem[];
1007
+ assertStorageIsWritable: () => void;
1050
1008
  /**
1051
- * Returns the first element that satisfies the provided testing function.
1052
- * @param predicate Function to execute on each value.
1053
- * @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).
1054
1011
  */
1055
- find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
1012
+ readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
1013
+ }
1014
+ type CreateManagedPoolOptions = {
1056
1015
  /**
1057
- * Returns the index of the first element in the LiveList that satisfies the provided testing function.
1058
- * @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
1059
- * @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).
1060
1019
  */
1061
- findIndex(predicate: (value: TItem, index: number) => unknown): number;
1020
+ getCurrentConnectionId(): number;
1062
1021
  /**
1063
- * Executes a provided function once for each element.
1064
- * @param callbackfn Function to execute on each element.
1022
+ * Will get invoked when any Live structure calls .dispatch() on the pool.
1065
1023
  */
1066
- forEach(callbackfn: (value: TItem, index: number) => void): void;
1024
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1067
1025
  /**
1068
- * Get the element at the specified index.
1069
- * @param index The index on the element to get.
1070
- * @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.
1071
1030
  */
1072
- get(index: number): TItem | undefined;
1031
+ isStorageWritable?: () => boolean;
1073
1032
  /**
1074
- * Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
1075
- * @param searchElement Element to locate.
1076
- * @param fromIndex The index to start the search at.
1077
- * @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).
1078
1037
  */
1079
- 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;
1080
1046
  /**
1081
- * 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.
1082
- * @param searchElement Element to locate.
1083
- * @param fromIndex The index at which to start searching backwards.
1084
- * @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.
1085
1050
  */
1086
- lastIndexOf(searchElement: TItem, fromIndex?: number): number;
1051
+ hasCache(value: unknown): boolean;
1087
1052
  /**
1088
- * Creates an array populated with the results of calling a provided function on every element.
1089
- * @param callback Function that is called for every element.
1090
- * @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.
1091
1057
  */
1092
- map<U>(callback: (value: TItem, index: number) => U): U[];
1058
+ toJSON(): ReadonlyJson;
1093
1059
  /**
1094
- * Tests whether at least one element in the LiveList passes the test implemented by the provided function.
1095
- * @param predicate Function to test for each element.
1096
- * @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.
1097
1062
  */
1098
- some(predicate: (value: TItem, index: number) => unknown): boolean;
1099
- [Symbol.iterator](): IterableIterator<TItem>;
1100
- toJSON(): readonly ToJson<TItem>[];
1101
- clone(): LiveList<TItem>;
1063
+ abstract clone(): Lson;
1102
1064
  }
1103
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;
1104
1074
  /**
1105
- * INTERNAL
1075
+ * A LiveFile is an immutable Storage leaf that references file bytes stored
1076
+ * outside the realtime Storage tree.
1106
1077
  */
1107
- declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
1078
+ declare class LiveFile extends AbstractCrdt {
1108
1079
  #private;
1109
- constructor(data: TValue);
1110
- get data(): TValue;
1111
- 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;
1112
1087
  }
1113
1088
 
1114
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
1115
- /**
1116
- * Think of Lson as a sibling of the Json data tree, except that the nested
1117
- * data structure can contain a mix of Json values and LiveStructure instances.
1118
- */
1119
- type Lson = Json | LiveStructure;
1120
- /**
1121
- * LiveNode is the internal tree for managing Live data structures. The key
1122
- * difference with Lson is that all the Json values get represented in
1123
- * a LiveRegister node.
1124
- */
1125
- type LiveNode = LiveStructure | LiveRegister<Json>;
1126
- /**
1127
- * A mapping of keys to Lson values. A Lson value is any valid JSON
1128
- * value or a Live storage data structure (LiveMap, LiveList, etc.)
1129
- */
1130
- 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
+ };
1131
1158
  /**
1132
- * 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.
1133
1161
  *
1134
- * 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)
1135
1177
  *
1136
- * ToJson<42> // 42
1137
- * ToJson<'hi'> // 'hi'
1138
- * ToJson<number> // number
1139
- * ToJson<string> // string
1140
- * ToJson<string | LiveList<number>> // string | readonly number[]
1141
- * ToJson<LiveMap<string, LiveList<number>>>
1142
- * // { readonly [key: string]: readonly number[] }
1143
- * ToJson<LiveObject<{ a: number, b: LiveList<string>, c?: number }>>
1144
- * // { readonly a: null, readonly b: readonly string[], readonly c?: number }
1145
1178
  */
1146
- 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 : {
1147
- readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
1148
- } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
1149
- readonly [K in KS]: ToJson<V>;
1150
- } : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1151
- readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
1152
- } : 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
+ };
1153
1205
 
1154
1206
  type DateToString<T> = {
1155
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];
@@ -1845,6 +1897,16 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1845
1897
  signal?: AbortSignal;
1846
1898
  }): Promise<CommentAttachment>;
1847
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>;
1848
1910
  createTextMention({ roomId, mentionId, mention, }: {
1849
1911
  roomId: string;
1850
1912
  mentionId: string;
@@ -3571,6 +3633,9 @@ type GetThreadsSinceOptions = {
3571
3633
  type UploadAttachmentOptions = {
3572
3634
  signal?: AbortSignal;
3573
3635
  };
3636
+ type UploadFileOptions = {
3637
+ signal?: AbortSignal;
3638
+ };
3574
3639
  type ListTextVersionsSinceOptions = {
3575
3640
  since: Date;
3576
3641
  signal?: AbortSignal;
@@ -4079,6 +4144,23 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
4079
4144
  * await room.getAttachmentUrl("at_xxx");
4080
4145
  */
4081
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>;
4082
4164
  /**
4083
4165
  * Gets the user's subscription settings for the current room.
4084
4166
  *
@@ -4176,6 +4258,7 @@ type PrivateRoomApi = {
4176
4258
  incomingMessage(data: string): void;
4177
4259
  };
4178
4260
  attachmentUrlsStore: BatchStore<string, string>;
4261
+ fileUrlsStore: BatchStore<string, string>;
4179
4262
  };
4180
4263
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4181
4264
  type PresenceStackframe<P extends JsonObject> = {
@@ -5075,7 +5158,11 @@ type PlainLsonList = {
5075
5158
  liveblocksType: "LiveList";
5076
5159
  data: PlainLson[];
5077
5160
  };
5078
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
5161
+ type PlainLsonFile = {
5162
+ liveblocksType: "LiveFile";
5163
+ data: LiveFileData;
5164
+ };
5165
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonFile | Json;
5079
5166
 
5080
5167
  /**
5081
5168
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5183,6 +5270,7 @@ declare function Promise_withResolvers<T>(): ControlledPromise<T>;
5183
5270
  declare function createThreadId(): string;
5184
5271
  declare function createCommentId(): string;
5185
5272
  declare function createCommentAttachmentId(): string;
5273
+ declare function createStorageFileId(): string;
5186
5274
  declare function createInboxNotificationId(): string;
5187
5275
 
5188
5276
  /**
@@ -5790,4 +5878,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5790
5878
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5791
5879
  };
5792
5880
 
5793
- 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 };