@liveblocks/core 3.23.0-exp2 → 3.23.0-exp4
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.cjs +5583 -5120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +539 -439
- package/dist/index.d.ts +539 -439
- package/dist/index.js +5478 -5015
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -217,143 +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
|
-
/**
|
|
338
|
-
* Use this symbol to brand an object property as internal.
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* Object.defineProperty(
|
|
342
|
-
* {
|
|
343
|
-
* public,
|
|
344
|
-
* [kInternal]: {
|
|
345
|
-
* private
|
|
346
|
-
* },
|
|
347
|
-
* },
|
|
348
|
-
* kInternal,
|
|
349
|
-
* {
|
|
350
|
-
* enumerable: false,
|
|
351
|
-
* }
|
|
352
|
-
* );
|
|
353
|
-
*/
|
|
354
|
-
declare const kInternal: unique symbol;
|
|
355
|
-
declare const kStorageUpdateSource: unique symbol;
|
|
356
|
-
|
|
357
220
|
declare const brand: unique symbol;
|
|
358
221
|
type Brand<T, TBrand extends string> = T & {
|
|
359
222
|
[brand]: TBrand;
|
|
@@ -441,6 +304,7 @@ declare const OpCode: Readonly<{
|
|
|
441
304
|
CREATE_REGISTER: 8;
|
|
442
305
|
CREATE_TEXT: 9;
|
|
443
306
|
UPDATE_TEXT: 10;
|
|
307
|
+
CREATE_FILE: 11;
|
|
444
308
|
}>;
|
|
445
309
|
declare namespace OpCode {
|
|
446
310
|
type INIT = typeof OpCode.INIT;
|
|
@@ -454,6 +318,7 @@ declare namespace OpCode {
|
|
|
454
318
|
type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
|
|
455
319
|
type CREATE_TEXT = typeof OpCode.CREATE_TEXT;
|
|
456
320
|
type UPDATE_TEXT = typeof OpCode.UPDATE_TEXT;
|
|
321
|
+
type CREATE_FILE = typeof OpCode.CREATE_FILE;
|
|
457
322
|
}
|
|
458
323
|
type TextAttributes = JsonObject;
|
|
459
324
|
/**
|
|
@@ -493,7 +358,7 @@ type TextOperation = {
|
|
|
493
358
|
* only.
|
|
494
359
|
*/
|
|
495
360
|
type Op = CreateOp | UpdateObjectOp | UpdateTextOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
496
|
-
type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateTextOp;
|
|
361
|
+
type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateTextOp | CreateFileOp;
|
|
497
362
|
type UpdateObjectOp = {
|
|
498
363
|
readonly opId?: string;
|
|
499
364
|
readonly id: string;
|
|
@@ -549,6 +414,16 @@ type CreateTextOp = {
|
|
|
549
414
|
readonly intent?: "set" | "push";
|
|
550
415
|
readonly deletedId?: string;
|
|
551
416
|
};
|
|
417
|
+
type CreateFileOp = {
|
|
418
|
+
readonly opId?: string;
|
|
419
|
+
readonly id: string;
|
|
420
|
+
readonly type: OpCode.CREATE_FILE;
|
|
421
|
+
readonly parentId: string;
|
|
422
|
+
readonly parentKey: string;
|
|
423
|
+
readonly data: LiveFileData;
|
|
424
|
+
readonly intent?: "set" | "push";
|
|
425
|
+
readonly deletedId?: string;
|
|
426
|
+
};
|
|
552
427
|
type UpdateTextOp = {
|
|
553
428
|
readonly opId?: string;
|
|
554
429
|
readonly id: string;
|
|
@@ -600,86 +475,6 @@ type TheirOp = DistributiveOmit<Op, "opId"> & {
|
|
|
600
475
|
opId?: undefined;
|
|
601
476
|
};
|
|
602
477
|
|
|
603
|
-
type UpdateDelta = {
|
|
604
|
-
type: "update";
|
|
605
|
-
} | {
|
|
606
|
-
type: "delete";
|
|
607
|
-
deletedItem: Lson;
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* A LiveMap notification that is sent in-client to any subscribers whenever
|
|
612
|
-
* one or more of the values inside the LiveMap instance have changed.
|
|
613
|
-
*/
|
|
614
|
-
type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
|
|
615
|
-
type: "LiveMap";
|
|
616
|
-
node: LiveMap<TKey, TValue>;
|
|
617
|
-
updates: {
|
|
618
|
-
[key: string]: UpdateDelta;
|
|
619
|
-
};
|
|
620
|
-
};
|
|
621
|
-
/**
|
|
622
|
-
* The LiveMap class is similar to a JavaScript Map that is synchronized on all clients.
|
|
623
|
-
* Keys should be a string, and values should be serializable to JSON.
|
|
624
|
-
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
625
|
-
*/
|
|
626
|
-
declare class LiveMap<TKey extends string, TValue extends Lson> extends AbstractCrdt {
|
|
627
|
-
#private;
|
|
628
|
-
constructor(entries?: readonly (readonly [TKey, TValue])[] | undefined);
|
|
629
|
-
/**
|
|
630
|
-
* Returns a specified element from the LiveMap.
|
|
631
|
-
* @param key The key of the element to return.
|
|
632
|
-
* @returns The element associated with the specified key, or undefined if the key can't be found in the LiveMap.
|
|
633
|
-
*/
|
|
634
|
-
get(key: TKey): TValue | undefined;
|
|
635
|
-
/**
|
|
636
|
-
* Adds or updates an element with a specified key and a value.
|
|
637
|
-
* @param key The key of the element to add. Should be a string.
|
|
638
|
-
* @param value The value of the element to add. Should be serializable to JSON.
|
|
639
|
-
*/
|
|
640
|
-
set(key: TKey, value: TValue): void;
|
|
641
|
-
/**
|
|
642
|
-
* Returns the number of elements in the LiveMap.
|
|
643
|
-
*/
|
|
644
|
-
get size(): number;
|
|
645
|
-
/**
|
|
646
|
-
* Returns a boolean indicating whether an element with the specified key exists or not.
|
|
647
|
-
* @param key The key of the element to test for presence.
|
|
648
|
-
*/
|
|
649
|
-
has(key: TKey): boolean;
|
|
650
|
-
/**
|
|
651
|
-
* Removes the specified element by key.
|
|
652
|
-
* @param key The key of the element to remove.
|
|
653
|
-
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
654
|
-
*/
|
|
655
|
-
delete(key: TKey): boolean;
|
|
656
|
-
/**
|
|
657
|
-
* Returns a new Iterator object that contains the [key, value] pairs for each element.
|
|
658
|
-
*/
|
|
659
|
-
entries(): IterableIterator<[TKey, TValue]>;
|
|
660
|
-
/**
|
|
661
|
-
* Same function object as the initial value of the entries method.
|
|
662
|
-
*/
|
|
663
|
-
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
664
|
-
/**
|
|
665
|
-
* Returns a new Iterator object that contains the keys for each element.
|
|
666
|
-
*/
|
|
667
|
-
keys(): IterableIterator<TKey>;
|
|
668
|
-
/**
|
|
669
|
-
* Returns a new Iterator object that contains the values for each element.
|
|
670
|
-
*/
|
|
671
|
-
values(): IterableIterator<TValue>;
|
|
672
|
-
/**
|
|
673
|
-
* Executes a provided function once per each key/value pair in the Map object, in insertion order.
|
|
674
|
-
* @param callback Function to execute for each entry in the map.
|
|
675
|
-
*/
|
|
676
|
-
forEach(callback: (value: TValue, key: TKey, map: LiveMap<TKey, TValue>) => void): void;
|
|
677
|
-
toJSON(): {
|
|
678
|
-
readonly [P in TKey]: ToJson<TValue>;
|
|
679
|
-
};
|
|
680
|
-
clone(): LiveMap<TKey, TValue>;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
478
|
type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
|
|
684
479
|
declare const CrdtType: Readonly<{
|
|
685
480
|
OBJECT: 0;
|
|
@@ -687,6 +482,7 @@ declare const CrdtType: Readonly<{
|
|
|
687
482
|
MAP: 2;
|
|
688
483
|
REGISTER: 3;
|
|
689
484
|
TEXT: 4;
|
|
485
|
+
FILE: 5;
|
|
690
486
|
}>;
|
|
691
487
|
declare namespace CrdtType {
|
|
692
488
|
type OBJECT = typeof CrdtType.OBJECT;
|
|
@@ -694,9 +490,16 @@ declare namespace CrdtType {
|
|
|
694
490
|
type MAP = typeof CrdtType.MAP;
|
|
695
491
|
type REGISTER = typeof CrdtType.REGISTER;
|
|
696
492
|
type TEXT = typeof CrdtType.TEXT;
|
|
493
|
+
type FILE = typeof CrdtType.FILE;
|
|
697
494
|
}
|
|
698
495
|
type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
699
|
-
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedText;
|
|
496
|
+
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedText | SerializedFile;
|
|
497
|
+
type LiveFileData = {
|
|
498
|
+
readonly id: string;
|
|
499
|
+
readonly name: string;
|
|
500
|
+
readonly size: number;
|
|
501
|
+
readonly mimeType: string;
|
|
502
|
+
};
|
|
700
503
|
type SerializedRootObject = {
|
|
701
504
|
readonly type: CrdtType.OBJECT;
|
|
702
505
|
readonly data: JsonObject;
|
|
@@ -732,14 +535,21 @@ type SerializedText = {
|
|
|
732
535
|
readonly data: LiveTextData;
|
|
733
536
|
readonly version: number;
|
|
734
537
|
};
|
|
538
|
+
type SerializedFile = {
|
|
539
|
+
readonly type: CrdtType.FILE;
|
|
540
|
+
readonly parentId: string;
|
|
541
|
+
readonly parentKey: string;
|
|
542
|
+
readonly data: LiveFileData;
|
|
543
|
+
};
|
|
735
544
|
type StorageNode = RootStorageNode | ChildStorageNode;
|
|
736
|
-
type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | TextStorageNode;
|
|
545
|
+
type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | TextStorageNode | FileStorageNode;
|
|
737
546
|
type RootStorageNode = [id: "root", value: SerializedRootObject];
|
|
738
547
|
type ObjectStorageNode = [id: string, value: SerializedObject];
|
|
739
548
|
type ListStorageNode = [id: string, value: SerializedList];
|
|
740
549
|
type MapStorageNode = [id: string, value: SerializedMap];
|
|
741
550
|
type RegisterStorageNode = [id: string, value: SerializedRegister];
|
|
742
551
|
type TextStorageNode = [id: string, value: SerializedText];
|
|
552
|
+
type FileStorageNode = [id: string, value: SerializedFile];
|
|
743
553
|
type NodeMap = Map<string, SerializedCrdt>;
|
|
744
554
|
type NodeStream = Iterable<StorageNode>;
|
|
745
555
|
declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
|
|
@@ -748,8 +558,9 @@ declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
|
|
|
748
558
|
declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
|
|
749
559
|
declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
|
|
750
560
|
declare function isTextStorageNode(node: StorageNode): node is TextStorageNode;
|
|
561
|
+
declare function isFileStorageNode(node: StorageNode): node is FileStorageNode;
|
|
751
562
|
type CompactNode = CompactRootNode | CompactChildNode;
|
|
752
|
-
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactTextNode;
|
|
563
|
+
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactTextNode | CompactFileNode;
|
|
753
564
|
type CompactRootNode = readonly [id: "root", data: JsonObject];
|
|
754
565
|
type CompactObjectNode = readonly [
|
|
755
566
|
id: string,
|
|
@@ -785,9 +596,243 @@ type CompactTextNode = readonly [
|
|
|
785
596
|
data: LiveTextData,
|
|
786
597
|
version: number
|
|
787
598
|
];
|
|
599
|
+
type CompactFileNode = readonly [
|
|
600
|
+
id: string,
|
|
601
|
+
type: CrdtType.FILE,
|
|
602
|
+
parentId: string,
|
|
603
|
+
parentKey: string,
|
|
604
|
+
data: LiveFileData
|
|
605
|
+
];
|
|
788
606
|
declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
|
|
789
607
|
declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
|
|
790
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Use this symbol to brand an object property as internal.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* Object.defineProperty(
|
|
614
|
+
* {
|
|
615
|
+
* public,
|
|
616
|
+
* [kInternal]: {
|
|
617
|
+
* private
|
|
618
|
+
* },
|
|
619
|
+
* },
|
|
620
|
+
* kInternal,
|
|
621
|
+
* {
|
|
622
|
+
* enumerable: false,
|
|
623
|
+
* }
|
|
624
|
+
* );
|
|
625
|
+
*/
|
|
626
|
+
declare const kInternal: unique symbol;
|
|
627
|
+
declare const kStorageUpdateSource: unique symbol;
|
|
628
|
+
|
|
629
|
+
type LiveListUpdateDelta = {
|
|
630
|
+
type: "insert";
|
|
631
|
+
index: number;
|
|
632
|
+
item: Lson;
|
|
633
|
+
} | {
|
|
634
|
+
type: "delete";
|
|
635
|
+
index: number;
|
|
636
|
+
deletedItem: Lson;
|
|
637
|
+
} | {
|
|
638
|
+
type: "move";
|
|
639
|
+
index: number;
|
|
640
|
+
previousIndex: number;
|
|
641
|
+
item: Lson;
|
|
642
|
+
} | {
|
|
643
|
+
type: "set";
|
|
644
|
+
index: number;
|
|
645
|
+
item: Lson;
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* A LiveList notification that is sent in-client to any subscribers whenever
|
|
649
|
+
* one or more of the items inside the LiveList instance have changed.
|
|
650
|
+
*/
|
|
651
|
+
type LiveListUpdates<TItem extends Lson> = {
|
|
652
|
+
type: "LiveList";
|
|
653
|
+
node: LiveList<TItem>;
|
|
654
|
+
updates: LiveListUpdateDelta[];
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* The LiveList class represents an ordered collection of items that is synchronized across clients.
|
|
658
|
+
*/
|
|
659
|
+
declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
660
|
+
#private;
|
|
661
|
+
constructor(items: TItem[]);
|
|
662
|
+
/**
|
|
663
|
+
* Returns the number of elements.
|
|
664
|
+
*/
|
|
665
|
+
get length(): number;
|
|
666
|
+
/**
|
|
667
|
+
* Adds one element to the end of the LiveList.
|
|
668
|
+
* @param element The element to add to the end of the LiveList.
|
|
669
|
+
*/
|
|
670
|
+
push(element: TItem): void;
|
|
671
|
+
/**
|
|
672
|
+
* Inserts one element at a specified index.
|
|
673
|
+
* @param element The element to insert.
|
|
674
|
+
* @param index The index at which you want to insert the element.
|
|
675
|
+
*/
|
|
676
|
+
insert(element: TItem, index: number): void;
|
|
677
|
+
/**
|
|
678
|
+
* Move one element from one index to another.
|
|
679
|
+
* @param index The index of the element to move
|
|
680
|
+
* @param targetIndex The index where the element should be after moving.
|
|
681
|
+
*/
|
|
682
|
+
move(index: number, targetIndex: number): void;
|
|
683
|
+
/**
|
|
684
|
+
* Deletes an element at the specified index
|
|
685
|
+
* @param index The index of the element to delete
|
|
686
|
+
*/
|
|
687
|
+
delete(index: number): void;
|
|
688
|
+
clear(): void;
|
|
689
|
+
set(index: number, item: TItem): void;
|
|
690
|
+
/**
|
|
691
|
+
* Tests whether all elements pass the test implemented by the provided function.
|
|
692
|
+
* @param predicate Function to test for each element, taking two arguments (the element and its index).
|
|
693
|
+
* @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
|
|
694
|
+
*/
|
|
695
|
+
every(predicate: (value: TItem, index: number) => unknown): boolean;
|
|
696
|
+
/**
|
|
697
|
+
* Creates an array with all elements that pass the test implemented by the provided function.
|
|
698
|
+
* @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.
|
|
699
|
+
* @returns An array with the elements that pass the test.
|
|
700
|
+
*/
|
|
701
|
+
filter(predicate: (value: TItem, index: number) => unknown): TItem[];
|
|
702
|
+
/**
|
|
703
|
+
* Returns the first element that satisfies the provided testing function.
|
|
704
|
+
* @param predicate Function to execute on each value.
|
|
705
|
+
* @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
706
|
+
*/
|
|
707
|
+
find(predicate: (value: TItem, index: number) => unknown): TItem | undefined;
|
|
708
|
+
/**
|
|
709
|
+
* Returns the index of the first element in the LiveList that satisfies the provided testing function.
|
|
710
|
+
* @param predicate Function to execute on each value until the function returns true, indicating that the satisfying element was found.
|
|
711
|
+
* @returns The index of the first element in the LiveList that passes the test. Otherwise, -1.
|
|
712
|
+
*/
|
|
713
|
+
findIndex(predicate: (value: TItem, index: number) => unknown): number;
|
|
714
|
+
/**
|
|
715
|
+
* Executes a provided function once for each element.
|
|
716
|
+
* @param callbackfn Function to execute on each element.
|
|
717
|
+
*/
|
|
718
|
+
forEach(callbackfn: (value: TItem, index: number) => void): void;
|
|
719
|
+
/**
|
|
720
|
+
* Get the element at the specified index.
|
|
721
|
+
* @param index The index on the element to get.
|
|
722
|
+
* @returns The element at the specified index or undefined.
|
|
723
|
+
*/
|
|
724
|
+
get(index: number): TItem | undefined;
|
|
725
|
+
/**
|
|
726
|
+
* Returns the first index at which a given element can be found in the LiveList, or -1 if it is not present.
|
|
727
|
+
* @param searchElement Element to locate.
|
|
728
|
+
* @param fromIndex The index to start the search at.
|
|
729
|
+
* @returns The first index of the element in the LiveList; -1 if not found.
|
|
730
|
+
*/
|
|
731
|
+
indexOf(searchElement: TItem, fromIndex?: number): number;
|
|
732
|
+
/**
|
|
733
|
+
* 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.
|
|
734
|
+
* @param searchElement Element to locate.
|
|
735
|
+
* @param fromIndex The index at which to start searching backwards.
|
|
736
|
+
* @returns The last index of the element in the LiveList; -1 if not found.
|
|
737
|
+
*/
|
|
738
|
+
lastIndexOf(searchElement: TItem, fromIndex?: number): number;
|
|
739
|
+
/**
|
|
740
|
+
* Creates an array populated with the results of calling a provided function on every element.
|
|
741
|
+
* @param callback Function that is called for every element.
|
|
742
|
+
* @returns An array with each element being the result of the callback function.
|
|
743
|
+
*/
|
|
744
|
+
map<U>(callback: (value: TItem, index: number) => U): U[];
|
|
745
|
+
/**
|
|
746
|
+
* Tests whether at least one element in the LiveList passes the test implemented by the provided function.
|
|
747
|
+
* @param predicate Function to test for each element.
|
|
748
|
+
* @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
|
|
749
|
+
*/
|
|
750
|
+
some(predicate: (value: TItem, index: number) => unknown): boolean;
|
|
751
|
+
[Symbol.iterator](): IterableIterator<TItem>;
|
|
752
|
+
toJSON(): readonly ToJson<TItem>[];
|
|
753
|
+
clone(): LiveList<TItem>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
type UpdateDelta = {
|
|
757
|
+
type: "update";
|
|
758
|
+
} | {
|
|
759
|
+
type: "delete";
|
|
760
|
+
deletedItem: Lson;
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* A LiveMap notification that is sent in-client to any subscribers whenever
|
|
765
|
+
* one or more of the values inside the LiveMap instance have changed.
|
|
766
|
+
*/
|
|
767
|
+
type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
|
|
768
|
+
type: "LiveMap";
|
|
769
|
+
node: LiveMap<TKey, TValue>;
|
|
770
|
+
updates: {
|
|
771
|
+
[key: string]: UpdateDelta;
|
|
772
|
+
};
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* The LiveMap class is similar to a JavaScript Map that is synchronized on all clients.
|
|
776
|
+
* Keys should be a string, and values should be serializable to JSON.
|
|
777
|
+
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
778
|
+
*/
|
|
779
|
+
declare class LiveMap<TKey extends string, TValue extends Lson> extends AbstractCrdt {
|
|
780
|
+
#private;
|
|
781
|
+
constructor(entries?: readonly (readonly [TKey, TValue])[] | undefined);
|
|
782
|
+
/**
|
|
783
|
+
* Returns a specified element from the LiveMap.
|
|
784
|
+
* @param key The key of the element to return.
|
|
785
|
+
* @returns The element associated with the specified key, or undefined if the key can't be found in the LiveMap.
|
|
786
|
+
*/
|
|
787
|
+
get(key: TKey): TValue | undefined;
|
|
788
|
+
/**
|
|
789
|
+
* Adds or updates an element with a specified key and a value.
|
|
790
|
+
* @param key The key of the element to add. Should be a string.
|
|
791
|
+
* @param value The value of the element to add. Should be serializable to JSON.
|
|
792
|
+
*/
|
|
793
|
+
set(key: TKey, value: TValue): void;
|
|
794
|
+
/**
|
|
795
|
+
* Returns the number of elements in the LiveMap.
|
|
796
|
+
*/
|
|
797
|
+
get size(): number;
|
|
798
|
+
/**
|
|
799
|
+
* Returns a boolean indicating whether an element with the specified key exists or not.
|
|
800
|
+
* @param key The key of the element to test for presence.
|
|
801
|
+
*/
|
|
802
|
+
has(key: TKey): boolean;
|
|
803
|
+
/**
|
|
804
|
+
* Removes the specified element by key.
|
|
805
|
+
* @param key The key of the element to remove.
|
|
806
|
+
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
807
|
+
*/
|
|
808
|
+
delete(key: TKey): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Returns a new Iterator object that contains the [key, value] pairs for each element.
|
|
811
|
+
*/
|
|
812
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
813
|
+
/**
|
|
814
|
+
* Same function object as the initial value of the entries method.
|
|
815
|
+
*/
|
|
816
|
+
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
817
|
+
/**
|
|
818
|
+
* Returns a new Iterator object that contains the keys for each element.
|
|
819
|
+
*/
|
|
820
|
+
keys(): IterableIterator<TKey>;
|
|
821
|
+
/**
|
|
822
|
+
* Returns a new Iterator object that contains the values for each element.
|
|
823
|
+
*/
|
|
824
|
+
values(): IterableIterator<TValue>;
|
|
825
|
+
/**
|
|
826
|
+
* Executes a provided function once per each key/value pair in the Map object, in insertion order.
|
|
827
|
+
* @param callback Function to execute for each entry in the map.
|
|
828
|
+
*/
|
|
829
|
+
forEach(callback: (value: TValue, key: TKey, map: LiveMap<TKey, TValue>) => void): void;
|
|
830
|
+
toJSON(): {
|
|
831
|
+
readonly [P in TKey]: ToJson<TValue>;
|
|
832
|
+
};
|
|
833
|
+
clone(): LiveMap<TKey, TValue>;
|
|
834
|
+
}
|
|
835
|
+
|
|
791
836
|
/**
|
|
792
837
|
* Extracts only the explicitly-named string keys of a type, filtering out
|
|
793
838
|
* any index signature (e.g. `[key: string]: ...`).
|
|
@@ -950,6 +995,16 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
|
950
995
|
clone(): LiveObject<O>;
|
|
951
996
|
}
|
|
952
997
|
|
|
998
|
+
/**
|
|
999
|
+
* INTERNAL
|
|
1000
|
+
*/
|
|
1001
|
+
declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
|
|
1002
|
+
#private;
|
|
1003
|
+
constructor(data: TValue);
|
|
1004
|
+
get data(): TValue;
|
|
1005
|
+
clone(): TValue;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
953
1008
|
/**
|
|
954
1009
|
* The position of the ops being transformed relative to the ops they are
|
|
955
1010
|
* transformed over, in the final (server-serialized) timeline:
|
|
@@ -1141,6 +1196,46 @@ declare class LiveText extends AbstractCrdt {
|
|
|
1141
1196
|
clone(): LiveText;
|
|
1142
1197
|
}
|
|
1143
1198
|
|
|
1199
|
+
type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveText | LiveFile;
|
|
1200
|
+
/**
|
|
1201
|
+
* Think of Lson as a sibling of the Json data tree, except that the nested
|
|
1202
|
+
* data structure can contain a mix of Json values and LiveStructure instances.
|
|
1203
|
+
*/
|
|
1204
|
+
type Lson = Json | LiveStructure;
|
|
1205
|
+
/**
|
|
1206
|
+
* LiveNode is the internal tree for managing Live data structures. The key
|
|
1207
|
+
* difference with Lson is that all the Json values get represented in
|
|
1208
|
+
* a LiveRegister node.
|
|
1209
|
+
*/
|
|
1210
|
+
type LiveNode = LiveStructure | LiveRegister<Json>;
|
|
1211
|
+
/**
|
|
1212
|
+
* A mapping of keys to Lson values. A Lson value is any valid JSON
|
|
1213
|
+
* value or a Live storage data structure (LiveMap, LiveList, etc.)
|
|
1214
|
+
*/
|
|
1215
|
+
type LsonObject = Record<string, Lson | undefined>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Helper type to convert any valid Lson type to the equivalent Json type.
|
|
1218
|
+
*
|
|
1219
|
+
* Examples:
|
|
1220
|
+
*
|
|
1221
|
+
* ToJson<42> // 42
|
|
1222
|
+
* ToJson<'hi'> // 'hi'
|
|
1223
|
+
* ToJson<number> // number
|
|
1224
|
+
* ToJson<string> // string
|
|
1225
|
+
* ToJson<string | LiveList<number>> // string | readonly number[]
|
|
1226
|
+
* ToJson<LiveMap<string, LiveList<number>>>
|
|
1227
|
+
* // { readonly [key: string]: readonly number[] }
|
|
1228
|
+
* ToJson<LiveObject<{ a: number, b: LiveList<string>, c?: number }>>
|
|
1229
|
+
* // { readonly a: null, readonly b: readonly string[], readonly c?: number }
|
|
1230
|
+
*/
|
|
1231
|
+
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 : {
|
|
1232
|
+
readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
|
|
1233
|
+
} : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
|
|
1234
|
+
readonly [K in KS]: ToJson<V>;
|
|
1235
|
+
} : L extends LiveText ? LiveTextData : L extends LiveFile ? LiveFileData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
|
|
1236
|
+
readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
|
|
1237
|
+
} : L extends Json ? L : never;
|
|
1238
|
+
|
|
1144
1239
|
type StorageCallback = (updates: StorageUpdate[]) => void;
|
|
1145
1240
|
type LiveMapUpdate = LiveMapUpdates<string, Lson>;
|
|
1146
1241
|
type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
|
|
@@ -1235,248 +1330,206 @@ interface ManagedPool {
|
|
|
1235
1330
|
dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
|
|
1236
1331
|
/**
|
|
1237
1332
|
* Ensures storage can be written to else throws an error.
|
|
1238
|
-
* This is used to prevent writing to storage when the user does not have
|
|
1239
|
-
* permission to do so.
|
|
1240
|
-
* @throws {Error} if storage is not writable
|
|
1241
|
-
* @returns {void}
|
|
1242
|
-
*/
|
|
1243
|
-
assertStorageIsWritable: () => void;
|
|
1244
|
-
/**
|
|
1245
|
-
* Read-only view of the client's still-unacknowledged ops (sent or
|
|
1246
|
-
* pending-send, not yet confirmed by the server).
|
|
1247
|
-
*/
|
|
1248
|
-
readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
|
|
1249
|
-
}
|
|
1250
|
-
type CreateManagedPoolOptions = {
|
|
1251
|
-
/**
|
|
1252
|
-
* Returns the current connection ID. This is used to generate unique
|
|
1253
|
-
* prefixes for nodes created by this client. This number is allowed to
|
|
1254
|
-
* change over time (for example, when the client reconnects).
|
|
1255
|
-
*/
|
|
1256
|
-
getCurrentConnectionId(): number;
|
|
1257
|
-
/**
|
|
1258
|
-
* Will get invoked when any Live structure calls .dispatch() on the pool.
|
|
1259
|
-
*/
|
|
1260
|
-
onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
|
|
1261
|
-
/**
|
|
1262
|
-
* Will get invoked when any Live structure calls .assertStorageIsWritable()
|
|
1263
|
-
* on the pool. Defaults to true when not provided. Return false if you want
|
|
1264
|
-
* to prevent writes to the pool locally early, because you know they won't
|
|
1265
|
-
* have an effect upstream.
|
|
1266
|
-
*/
|
|
1267
|
-
isStorageWritable?: () => boolean;
|
|
1268
|
-
/**
|
|
1269
|
-
* Read-only view of the client's still-unacknowledged ops. Used by CRDTs
|
|
1270
|
-
* (e.g. LiveList) to know which of their optimistic mutations the server
|
|
1271
|
-
* hasn't confirmed yet. Defaults to an empty view (e.g. server-side pools
|
|
1272
|
-
* that dispatch-and-flush have no optimistic state to track).
|
|
1273
|
-
*/
|
|
1274
|
-
unacknowledgedOps?: ReadonlyUnacknowledgedOps;
|
|
1275
|
-
};
|
|
1276
|
-
/**
|
|
1277
|
-
* @private Private API, never use this API directly.
|
|
1278
|
-
*/
|
|
1279
|
-
declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
|
|
1280
|
-
declare abstract class AbstractCrdt {
|
|
1281
|
-
#private;
|
|
1282
|
-
readonly [kInternal]: PrivateLiveNodeApi;
|
|
1283
|
-
constructor();
|
|
1284
|
-
/**
|
|
1285
|
-
* @private
|
|
1286
|
-
* Returns true if the cached JSON snapshot exists and is reference-equal
|
|
1287
|
-
* to the given value. Does not trigger a recompute.
|
|
1288
|
-
*/
|
|
1289
|
-
hasCache(value: unknown): boolean;
|
|
1290
|
-
/**
|
|
1291
|
-
* Return a JSON-compatible snapshot of this Live node and its children.
|
|
1292
|
-
* LiveObject values become plain objects, LiveList values become arrays,
|
|
1293
|
-
* and LiveMap values also become plain objects (not Map instances).
|
|
1294
|
-
* The result is cached and only recomputed when the contents change.
|
|
1295
|
-
*/
|
|
1296
|
-
toJSON(): ReadonlyJson;
|
|
1297
|
-
/**
|
|
1298
|
-
* Returns a deep clone of the current LiveStructure, suitable for insertion
|
|
1299
|
-
* in the tree elsewhere.
|
|
1300
|
-
*/
|
|
1301
|
-
abstract clone(): Lson;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
type LiveListUpdateDelta = {
|
|
1305
|
-
type: "insert";
|
|
1306
|
-
index: number;
|
|
1307
|
-
item: Lson;
|
|
1308
|
-
} | {
|
|
1309
|
-
type: "delete";
|
|
1310
|
-
index: number;
|
|
1311
|
-
deletedItem: Lson;
|
|
1312
|
-
} | {
|
|
1313
|
-
type: "move";
|
|
1314
|
-
index: number;
|
|
1315
|
-
previousIndex: number;
|
|
1316
|
-
item: Lson;
|
|
1317
|
-
} | {
|
|
1318
|
-
type: "set";
|
|
1319
|
-
index: number;
|
|
1320
|
-
item: Lson;
|
|
1321
|
-
};
|
|
1322
|
-
/**
|
|
1323
|
-
* A LiveList notification that is sent in-client to any subscribers whenever
|
|
1324
|
-
* one or more of the items inside the LiveList instance have changed.
|
|
1325
|
-
*/
|
|
1326
|
-
type LiveListUpdates<TItem extends Lson> = {
|
|
1327
|
-
type: "LiveList";
|
|
1328
|
-
node: LiveList<TItem>;
|
|
1329
|
-
updates: LiveListUpdateDelta[];
|
|
1330
|
-
};
|
|
1331
|
-
/**
|
|
1332
|
-
* The LiveList class represents an ordered collection of items that is synchronized across clients.
|
|
1333
|
-
*/
|
|
1334
|
-
declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
1335
|
-
#private;
|
|
1336
|
-
constructor(items: TItem[]);
|
|
1337
|
-
/**
|
|
1338
|
-
* Returns the number of elements.
|
|
1339
|
-
*/
|
|
1340
|
-
get length(): number;
|
|
1341
|
-
/**
|
|
1342
|
-
* Adds one element to the end of the LiveList.
|
|
1343
|
-
* @param element The element to add to the end of the LiveList.
|
|
1344
|
-
*/
|
|
1345
|
-
push(element: TItem): void;
|
|
1346
|
-
/**
|
|
1347
|
-
* Inserts one element at a specified index.
|
|
1348
|
-
* @param element The element to insert.
|
|
1349
|
-
* @param index The index at which you want to insert the element.
|
|
1350
|
-
*/
|
|
1351
|
-
insert(element: TItem, index: number): void;
|
|
1352
|
-
/**
|
|
1353
|
-
* Move one element from one index to another.
|
|
1354
|
-
* @param index The index of the element to move
|
|
1355
|
-
* @param targetIndex The index where the element should be after moving.
|
|
1356
|
-
*/
|
|
1357
|
-
move(index: number, targetIndex: number): void;
|
|
1358
|
-
/**
|
|
1359
|
-
* Deletes an element at the specified index
|
|
1360
|
-
* @param index The index of the element to delete
|
|
1361
|
-
*/
|
|
1362
|
-
delete(index: number): void;
|
|
1363
|
-
clear(): void;
|
|
1364
|
-
set(index: number, item: TItem): void;
|
|
1365
|
-
/**
|
|
1366
|
-
* Tests whether all elements pass the test implemented by the provided function.
|
|
1367
|
-
* @param predicate Function to test for each element, taking two arguments (the element and its index).
|
|
1368
|
-
* @returns true if the predicate function returns a truthy value for every element. Otherwise, false.
|
|
1369
|
-
*/
|
|
1370
|
-
every(predicate: (value: TItem, index: number) => unknown): boolean;
|
|
1371
|
-
/**
|
|
1372
|
-
* Creates an array with all elements that pass the test implemented by the provided function.
|
|
1373
|
-
* @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.
|
|
1374
|
-
* @returns An array with the elements that pass the test.
|
|
1333
|
+
* This is used to prevent writing to storage when the user does not have
|
|
1334
|
+
* permission to do so.
|
|
1335
|
+
* @throws {Error} if storage is not writable
|
|
1336
|
+
* @returns {void}
|
|
1375
1337
|
*/
|
|
1376
|
-
|
|
1338
|
+
assertStorageIsWritable: () => void;
|
|
1377
1339
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
* @returns The value of the first element in the LiveList that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
1340
|
+
* Read-only view of the client's still-unacknowledged ops (sent or
|
|
1341
|
+
* pending-send, not yet confirmed by the server).
|
|
1381
1342
|
*/
|
|
1382
|
-
|
|
1343
|
+
readonly unacknowledgedOps: ReadonlyUnacknowledgedOps;
|
|
1344
|
+
}
|
|
1345
|
+
type CreateManagedPoolOptions = {
|
|
1383
1346
|
/**
|
|
1384
|
-
* Returns the
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1347
|
+
* Returns the current connection ID. This is used to generate unique
|
|
1348
|
+
* prefixes for nodes created by this client. This number is allowed to
|
|
1349
|
+
* change over time (for example, when the client reconnects).
|
|
1387
1350
|
*/
|
|
1388
|
-
|
|
1351
|
+
getCurrentConnectionId(): number;
|
|
1389
1352
|
/**
|
|
1390
|
-
*
|
|
1391
|
-
* @param callbackfn Function to execute on each element.
|
|
1353
|
+
* Will get invoked when any Live structure calls .dispatch() on the pool.
|
|
1392
1354
|
*/
|
|
1393
|
-
|
|
1355
|
+
onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
|
|
1394
1356
|
/**
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1357
|
+
* Will get invoked when any Live structure calls .assertStorageIsWritable()
|
|
1358
|
+
* on the pool. Defaults to true when not provided. Return false if you want
|
|
1359
|
+
* to prevent writes to the pool locally early, because you know they won't
|
|
1360
|
+
* have an effect upstream.
|
|
1398
1361
|
*/
|
|
1399
|
-
|
|
1362
|
+
isStorageWritable?: () => boolean;
|
|
1400
1363
|
/**
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1364
|
+
* Read-only view of the client's still-unacknowledged ops. Used by CRDTs
|
|
1365
|
+
* (e.g. LiveList) to know which of their optimistic mutations the server
|
|
1366
|
+
* hasn't confirmed yet. Defaults to an empty view (e.g. server-side pools
|
|
1367
|
+
* that dispatch-and-flush have no optimistic state to track).
|
|
1405
1368
|
*/
|
|
1406
|
-
|
|
1369
|
+
unacknowledgedOps?: ReadonlyUnacknowledgedOps;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* @private Private API, never use this API directly.
|
|
1373
|
+
*/
|
|
1374
|
+
declare function createManagedPool(options: CreateManagedPoolOptions): ManagedPool;
|
|
1375
|
+
declare abstract class AbstractCrdt {
|
|
1376
|
+
#private;
|
|
1377
|
+
readonly [kInternal]: PrivateLiveNodeApi;
|
|
1378
|
+
constructor();
|
|
1407
1379
|
/**
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1411
|
-
* @returns The last index of the element in the LiveList; -1 if not found.
|
|
1380
|
+
* @private
|
|
1381
|
+
* Returns true if the cached JSON snapshot exists and is reference-equal
|
|
1382
|
+
* to the given value. Does not trigger a recompute.
|
|
1412
1383
|
*/
|
|
1413
|
-
|
|
1384
|
+
hasCache(value: unknown): boolean;
|
|
1414
1385
|
/**
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
1386
|
+
* Return a JSON-compatible snapshot of this Live node and its children.
|
|
1387
|
+
* LiveObject values become plain objects, LiveList values become arrays,
|
|
1388
|
+
* and LiveMap values also become plain objects (not Map instances).
|
|
1389
|
+
* The result is cached and only recomputed when the contents change.
|
|
1418
1390
|
*/
|
|
1419
|
-
|
|
1391
|
+
toJSON(): ReadonlyJson;
|
|
1420
1392
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
* @returns true if the callback function returns a truthy value for at least one element. Otherwise, false.
|
|
1393
|
+
* Returns a deep clone of the current LiveStructure, suitable for insertion
|
|
1394
|
+
* in the tree elsewhere.
|
|
1424
1395
|
*/
|
|
1425
|
-
|
|
1426
|
-
[Symbol.iterator](): IterableIterator<TItem>;
|
|
1427
|
-
toJSON(): readonly ToJson<TItem>[];
|
|
1428
|
-
clone(): LiveList<TItem>;
|
|
1396
|
+
abstract clone(): Lson;
|
|
1429
1397
|
}
|
|
1430
1398
|
|
|
1399
|
+
type LiveFileReference = LiveFile | LiveFileData | string;
|
|
1400
|
+
declare function getLiveFileId(file: LiveFileReference): string;
|
|
1431
1401
|
/**
|
|
1432
|
-
*
|
|
1402
|
+
* A LiveFile is an immutable Storage leaf that references file bytes stored
|
|
1403
|
+
* outside the realtime Storage tree.
|
|
1433
1404
|
*/
|
|
1434
|
-
declare class
|
|
1405
|
+
declare class LiveFile extends AbstractCrdt {
|
|
1435
1406
|
#private;
|
|
1436
|
-
constructor(data:
|
|
1437
|
-
get data():
|
|
1438
|
-
|
|
1407
|
+
constructor(data: LiveFileData);
|
|
1408
|
+
get data(): Readonly<LiveFileData>;
|
|
1409
|
+
get id(): string;
|
|
1410
|
+
get name(): string;
|
|
1411
|
+
get size(): number;
|
|
1412
|
+
get mimeType(): string;
|
|
1413
|
+
clone(): LiveFile;
|
|
1439
1414
|
}
|
|
1440
1415
|
|
|
1441
|
-
type
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1416
|
+
type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1417
|
+
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1418
|
+
} : never;
|
|
1419
|
+
type AsyncLoading<F extends string = "data"> = RenameDataField<{
|
|
1420
|
+
readonly isLoading: true;
|
|
1421
|
+
readonly data?: never;
|
|
1422
|
+
readonly error?: never;
|
|
1423
|
+
}, F>;
|
|
1424
|
+
type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
|
|
1425
|
+
readonly isLoading: false;
|
|
1426
|
+
readonly data: T;
|
|
1427
|
+
readonly error?: never;
|
|
1428
|
+
}, F>;
|
|
1429
|
+
type AsyncError<F extends string = "data"> = RenameDataField<{
|
|
1430
|
+
readonly isLoading: false;
|
|
1431
|
+
readonly data?: never;
|
|
1432
|
+
readonly error: Error;
|
|
1433
|
+
}, F>;
|
|
1434
|
+
type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
|
|
1435
|
+
|
|
1436
|
+
type Callback<T> = (event: T) => void;
|
|
1437
|
+
type UnsubscribeCallback = () => void;
|
|
1438
|
+
type Observable<T> = {
|
|
1439
|
+
/**
|
|
1440
|
+
* Register a callback function to be called whenever the event source emits
|
|
1441
|
+
* an event.
|
|
1442
|
+
*/
|
|
1443
|
+
subscribe(callback: Callback<T>): UnsubscribeCallback;
|
|
1444
|
+
/**
|
|
1445
|
+
* Register a one-time callback function to be called whenever the event
|
|
1446
|
+
* source emits an event. After the event fires, the callback is
|
|
1447
|
+
* auto-unsubscribed.
|
|
1448
|
+
*/
|
|
1449
|
+
subscribeOnce(callback: Callback<T>): UnsubscribeCallback;
|
|
1450
|
+
/**
|
|
1451
|
+
* Returns a promise that will resolve when an event is emitted by this
|
|
1452
|
+
* event source. Optionally, specify a predicate that has to match. The first
|
|
1453
|
+
* event matching that predicate will then resolve the promise.
|
|
1454
|
+
*/
|
|
1455
|
+
waitUntil(predicate?: (event: T) => boolean): Promise<T>;
|
|
1456
|
+
};
|
|
1457
|
+
type EventSource<T> = Observable<T> & {
|
|
1458
|
+
/**
|
|
1459
|
+
* Notify all subscribers about the event. Will return `false` if there
|
|
1460
|
+
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
1461
|
+
* there was at least one subscriber.
|
|
1462
|
+
*/
|
|
1463
|
+
notify(event: T): boolean;
|
|
1464
|
+
/**
|
|
1465
|
+
* Returns the number of active subscribers.
|
|
1466
|
+
*/
|
|
1467
|
+
count(): number;
|
|
1468
|
+
/**
|
|
1469
|
+
* Observable instance, which can be used to subscribe to this event source
|
|
1470
|
+
* in a readonly fashion. Safe to publicly expose.
|
|
1471
|
+
*/
|
|
1472
|
+
observable: Observable<T>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Disposes of this event source.
|
|
1475
|
+
*
|
|
1476
|
+
* Will clears all registered event listeners. None of the registered
|
|
1477
|
+
* functions will ever get called again.
|
|
1478
|
+
*
|
|
1479
|
+
* WARNING!
|
|
1480
|
+
* Be careful when using this API, because the subscribers may not have any
|
|
1481
|
+
* idea they won't be notified anymore.
|
|
1482
|
+
*/
|
|
1483
|
+
dispose(): void;
|
|
1484
|
+
};
|
|
1458
1485
|
/**
|
|
1459
|
-
*
|
|
1486
|
+
* makeEventSource allows you to generate a subscribe/notify pair of functions
|
|
1487
|
+
* to make subscribing easy and to get notified about events.
|
|
1460
1488
|
*
|
|
1461
|
-
*
|
|
1489
|
+
* The events are anonymous, so you can use it to define events, like so:
|
|
1490
|
+
*
|
|
1491
|
+
* const event1 = makeEventSource();
|
|
1492
|
+
* const event2 = makeEventSource();
|
|
1493
|
+
*
|
|
1494
|
+
* event1.subscribe(foo);
|
|
1495
|
+
* event1.subscribe(bar);
|
|
1496
|
+
* event2.subscribe(qux);
|
|
1497
|
+
*
|
|
1498
|
+
* // Unsubscription is pretty standard
|
|
1499
|
+
* const unsub = event2.subscribe(foo);
|
|
1500
|
+
* unsub();
|
|
1501
|
+
*
|
|
1502
|
+
* event1.notify(); // Now foo and bar will get called
|
|
1503
|
+
* event2.notify(); // Now qux will get called (but foo will not, since it's unsubscribed)
|
|
1462
1504
|
*
|
|
1463
|
-
* ToJson<42> // 42
|
|
1464
|
-
* ToJson<'hi'> // 'hi'
|
|
1465
|
-
* ToJson<number> // number
|
|
1466
|
-
* ToJson<string> // string
|
|
1467
|
-
* ToJson<string | LiveList<number>> // string | readonly number[]
|
|
1468
|
-
* ToJson<LiveMap<string, LiveList<number>>>
|
|
1469
|
-
* // { readonly [key: string]: readonly number[] }
|
|
1470
|
-
* ToJson<LiveObject<{ a: number, b: LiveList<string>, c?: number }>>
|
|
1471
|
-
* // { readonly a: null, readonly b: readonly string[], readonly c?: number }
|
|
1472
1505
|
*/
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1506
|
+
declare function makeEventSource<T>(): EventSource<T>;
|
|
1507
|
+
|
|
1508
|
+
type BatchStore<O, I> = {
|
|
1509
|
+
subscribe: (callback: Callback<void>) => UnsubscribeCallback;
|
|
1510
|
+
enqueue: (input: I) => Promise<void>;
|
|
1511
|
+
setData: (entries: [I, O][]) => void;
|
|
1512
|
+
getItemState: (input: I) => AsyncResult<O> | undefined;
|
|
1513
|
+
getData: (input: I) => O | undefined;
|
|
1514
|
+
waitUntilItemCacheExpires: (input: I) => Promise<void> | undefined;
|
|
1515
|
+
invalidate: (inputs?: I[]) => void;
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
type ContextualPromptResponse = Relax<{
|
|
1519
|
+
type: "insert";
|
|
1520
|
+
text: string;
|
|
1521
|
+
} | {
|
|
1522
|
+
type: "replace";
|
|
1523
|
+
text: string;
|
|
1524
|
+
} | {
|
|
1525
|
+
type: "other";
|
|
1526
|
+
text: string;
|
|
1527
|
+
}>;
|
|
1528
|
+
type ContextualPromptContext = {
|
|
1529
|
+
beforeSelection: string;
|
|
1530
|
+
selection: string;
|
|
1531
|
+
afterSelection: string;
|
|
1532
|
+
};
|
|
1480
1533
|
|
|
1481
1534
|
type DateToString<T> = {
|
|
1482
1535
|
[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];
|
|
@@ -2006,6 +2059,10 @@ type MakeOptionalFieldsNullable<T> = {
|
|
|
2006
2059
|
*/
|
|
2007
2060
|
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
2008
2061
|
|
|
2062
|
+
type FileUrlData = {
|
|
2063
|
+
readonly url: string;
|
|
2064
|
+
readonly expiresAt: number;
|
|
2065
|
+
};
|
|
2009
2066
|
interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
2010
2067
|
getThreads(options: {
|
|
2011
2068
|
roomId: string;
|
|
@@ -2172,6 +2229,16 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
2172
2229
|
signal?: AbortSignal;
|
|
2173
2230
|
}): Promise<CommentAttachment>;
|
|
2174
2231
|
getOrCreateAttachmentUrlsStore(roomId: string): BatchStore<string, string>;
|
|
2232
|
+
getFileUrl(options: {
|
|
2233
|
+
roomId: string;
|
|
2234
|
+
fileId: string;
|
|
2235
|
+
}): Promise<string>;
|
|
2236
|
+
uploadFile({ roomId, file, signal, }: {
|
|
2237
|
+
roomId: string;
|
|
2238
|
+
file: File;
|
|
2239
|
+
signal?: AbortSignal;
|
|
2240
|
+
}): Promise<LiveFile>;
|
|
2241
|
+
getOrCreateFileUrlsStore(roomId: string): BatchStore<FileUrlData, string>;
|
|
2175
2242
|
createTextMention({ roomId, mentionId, mention, }: {
|
|
2176
2243
|
roomId: string;
|
|
2177
2244
|
mentionId: string;
|
|
@@ -3560,7 +3627,13 @@ type LiveTreeNode<TName extends `Live${string}` = `Live${string}`> = {
|
|
|
3560
3627
|
readonly key: string;
|
|
3561
3628
|
readonly payload: LsonTreeNode[];
|
|
3562
3629
|
};
|
|
3563
|
-
type
|
|
3630
|
+
type LiveFileTreeNode = {
|
|
3631
|
+
readonly type: "LiveFile";
|
|
3632
|
+
readonly id: string;
|
|
3633
|
+
readonly key: string;
|
|
3634
|
+
readonly payload: LiveFileData;
|
|
3635
|
+
};
|
|
3636
|
+
type LsonTreeNode = LiveTreeNode | LiveFileTreeNode | JsonTreeNode;
|
|
3564
3637
|
type UserTreeNode = {
|
|
3565
3638
|
readonly type: "User";
|
|
3566
3639
|
readonly id: string;
|
|
@@ -3584,12 +3657,13 @@ type TreeNode = LsonTreeNode | UserTreeNode | CustomEventTreeNode;
|
|
|
3584
3657
|
|
|
3585
3658
|
type DevToolsTreeNode_CustomEventTreeNode = CustomEventTreeNode;
|
|
3586
3659
|
type DevToolsTreeNode_JsonTreeNode = JsonTreeNode;
|
|
3660
|
+
type DevToolsTreeNode_LiveFileTreeNode = LiveFileTreeNode;
|
|
3587
3661
|
type DevToolsTreeNode_LiveTreeNode<TName extends `Live${string}` = `Live${string}`> = LiveTreeNode<TName>;
|
|
3588
3662
|
type DevToolsTreeNode_LsonTreeNode = LsonTreeNode;
|
|
3589
3663
|
type DevToolsTreeNode_TreeNode = TreeNode;
|
|
3590
3664
|
type DevToolsTreeNode_UserTreeNode = UserTreeNode;
|
|
3591
3665
|
declare namespace DevToolsTreeNode {
|
|
3592
|
-
export type { DevToolsTreeNode_CustomEventTreeNode as CustomEventTreeNode, DevToolsTreeNode_JsonTreeNode as JsonTreeNode, DevToolsTreeNode_LiveTreeNode as LiveTreeNode, DevToolsTreeNode_LsonTreeNode as LsonTreeNode, DevToolsTreeNode_TreeNode as TreeNode, DevToolsTreeNode_UserTreeNode as UserTreeNode };
|
|
3666
|
+
export type { DevToolsTreeNode_CustomEventTreeNode as CustomEventTreeNode, DevToolsTreeNode_JsonTreeNode as JsonTreeNode, DevToolsTreeNode_LiveFileTreeNode as LiveFileTreeNode, DevToolsTreeNode_LiveTreeNode as LiveTreeNode, DevToolsTreeNode_LsonTreeNode as LsonTreeNode, DevToolsTreeNode_TreeNode as TreeNode, DevToolsTreeNode_UserTreeNode as UserTreeNode };
|
|
3593
3667
|
}
|
|
3594
3668
|
|
|
3595
3669
|
type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
@@ -3879,6 +3953,9 @@ type GetThreadsSinceOptions = {
|
|
|
3879
3953
|
type UploadAttachmentOptions = {
|
|
3880
3954
|
signal?: AbortSignal;
|
|
3881
3955
|
};
|
|
3956
|
+
type UploadFileOptions = {
|
|
3957
|
+
signal?: AbortSignal;
|
|
3958
|
+
};
|
|
3882
3959
|
type ListTextVersionsSinceOptions = {
|
|
3883
3960
|
since: Date;
|
|
3884
3961
|
signal?: AbortSignal;
|
|
@@ -4387,6 +4464,23 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
4387
4464
|
* await room.getAttachmentUrl("at_xxx");
|
|
4388
4465
|
*/
|
|
4389
4466
|
getAttachmentUrl(attachmentId: string): Promise<string>;
|
|
4467
|
+
/**
|
|
4468
|
+
* Uploads a file for a `LiveFile`.
|
|
4469
|
+
*
|
|
4470
|
+
* @example
|
|
4471
|
+
* const liveFile = await room.uploadFile(file);
|
|
4472
|
+
*/
|
|
4473
|
+
uploadFile(file: File, options?: UploadFileOptions): Promise<LiveFile>;
|
|
4474
|
+
/**
|
|
4475
|
+
* Returns a presigned URL for a `LiveFile`.
|
|
4476
|
+
*
|
|
4477
|
+
* @example
|
|
4478
|
+
* await getFileUrl("fl_xxx");
|
|
4479
|
+
*
|
|
4480
|
+
* @example
|
|
4481
|
+
* await getFileUrl(liveFile);
|
|
4482
|
+
*/
|
|
4483
|
+
getFileUrl(file: LiveFileReference): Promise<string>;
|
|
4390
4484
|
/**
|
|
4391
4485
|
* Gets the user's subscription settings for the current room.
|
|
4392
4486
|
*
|
|
@@ -4491,6 +4585,7 @@ type PrivateRoomApi = {
|
|
|
4491
4585
|
incomingMessage(data: string): void;
|
|
4492
4586
|
};
|
|
4493
4587
|
attachmentUrlsStore: BatchStore<string, string>;
|
|
4588
|
+
fileUrlsStore: BatchStore<FileUrlData, string>;
|
|
4494
4589
|
readonly history: Observable<{
|
|
4495
4590
|
action: "push";
|
|
4496
4591
|
id: number;
|
|
@@ -5410,7 +5505,11 @@ type PlainLsonText = {
|
|
|
5410
5505
|
data: LiveTextData;
|
|
5411
5506
|
version?: number;
|
|
5412
5507
|
};
|
|
5413
|
-
type
|
|
5508
|
+
type PlainLsonFile = {
|
|
5509
|
+
liveblocksType: "LiveFile";
|
|
5510
|
+
data: LiveFileData;
|
|
5511
|
+
};
|
|
5512
|
+
type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonText | PlainLsonFile | Json;
|
|
5414
5513
|
|
|
5415
5514
|
/**
|
|
5416
5515
|
* Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
|
|
@@ -5518,6 +5617,7 @@ declare function Promise_withResolvers<T>(): ControlledPromise<T>;
|
|
|
5518
5617
|
declare function createThreadId(): string;
|
|
5519
5618
|
declare function createCommentId(): string;
|
|
5520
5619
|
declare function createCommentAttachmentId(): string;
|
|
5620
|
+
declare function createStorageFileId(): string;
|
|
5521
5621
|
declare function createInboxNotificationId(): string;
|
|
5522
5622
|
|
|
5523
5623
|
/**
|
|
@@ -6125,4 +6225,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
6125
6225
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
6126
6226
|
};
|
|
6127
6227
|
|
|
6128
|
-
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type CompactTextNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CreateTextOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveText, type LiveTextAttributes, type LiveTextAttributesPatch, type LiveTextChange, type LiveTextData, type TextOperation as LiveTextOperation, type LiveTextSegment, type LiveTextUpdate, type LiveTextUpdates, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PlainLsonText, type Poller, type PrivateClientApi, type PrivateLiveNodeApi, type PrivateLiveTextApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomEventMessage, type RoomPermissions, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type SerializedText, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StorageUpdateSource, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, type TextAttributes, TextEditorType, type TextOperation, type TextStorageNode, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ThreadVisibility, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateTextOp, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, applyLiveTextOperations, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isTextStorageNode, isUrl, kInternal, kStorageUpdateSource, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, transformTextOperations, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };
|
|
6228
|
+
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactFileNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type CompactTextNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateFileOp, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CreateTextOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type FileStorageNode, type FileUrlData, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveFile, type LiveFileData, type LiveFileReference, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveText, type LiveTextAttributes, type LiveTextAttributesPatch, type LiveTextChange, type LiveTextData, type TextOperation as LiveTextOperation, type LiveTextSegment, type LiveTextUpdate, type LiveTextUpdates, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonFile, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PlainLsonText, type Poller, type PrivateClientApi, type PrivateLiveNodeApi, type PrivateLiveTextApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomEventMessage, type RoomPermissions, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedFile, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type SerializedText, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StorageUpdateSource, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, type TextAttributes, TextEditorType, type TextOperation, type TextStorageNode, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ThreadVisibility, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateTextOp, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UploadFileOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, applyLiveTextOperations, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createStorageFileId, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getLiveFileId, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isFileStorageNode, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isTextStorageNode, isUrl, kInternal, kStorageUpdateSource, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, transformTextOperations, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };
|