@liveblocks/core 2.15.2 → 2.16.0-rc1
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.mts +396 -305
- package/dist/index.d.ts +396 -305
- package/dist/index.js +311 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -5,18 +5,72 @@
|
|
|
5
5
|
declare function detectDupes(pkgName: string, pkgVersion: string | false, // false if not built yet
|
|
6
6
|
pkgFormat: string | false): void;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This helper type is effectively a no-op, but will force TypeScript to
|
|
10
|
+
* "evaluate" any named helper types in its definition. This can sometimes make
|
|
11
|
+
* API signatures clearer in IDEs.
|
|
12
|
+
*
|
|
13
|
+
* For example, in:
|
|
14
|
+
*
|
|
15
|
+
* type Payload<T> = { data: T };
|
|
16
|
+
*
|
|
17
|
+
* let r1: Payload<string>;
|
|
18
|
+
* let r2: Resolve<Payload<string>>;
|
|
19
|
+
*
|
|
20
|
+
* The inferred type of `r1` is going to be `Payload<string>` which shows up in
|
|
21
|
+
* editor hints, and it may be unclear what's inside if you don't know the
|
|
22
|
+
* definition of `Payload`.
|
|
23
|
+
*
|
|
24
|
+
* The inferred type of `r2` is going to be `{ data: string }`, which may be
|
|
25
|
+
* more helpful.
|
|
26
|
+
*
|
|
27
|
+
* This trick comes from:
|
|
28
|
+
* https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
|
29
|
+
*/
|
|
30
|
+
type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Relaxes a discriminated union type definition, by explicitly adding
|
|
36
|
+
* properties defined in any other member as 'never'.
|
|
37
|
+
*
|
|
38
|
+
* This makes accessing the members much more relaxed in TypeScript.
|
|
39
|
+
*
|
|
40
|
+
* For example:
|
|
41
|
+
* type MyUnion = Relax<
|
|
42
|
+
* | { foo: string }
|
|
43
|
+
* | { foo: number; bar: string; }
|
|
44
|
+
* | { qux: boolean }
|
|
45
|
+
* >;
|
|
46
|
+
*
|
|
47
|
+
* // With Relax, accessing is much easier:
|
|
48
|
+
* union.foo; // string | number | undefined
|
|
49
|
+
* union.bar; // string | undefined
|
|
50
|
+
* union.qux; // boolean
|
|
51
|
+
* union.whatever; // Error: Property 'whatever' does not exist on type 'MyUnion'
|
|
52
|
+
*
|
|
53
|
+
* // Without Relax, these would all be type errors:
|
|
54
|
+
* union.foo; // Error: Property 'foo' does not exist on type 'MyUnion'
|
|
55
|
+
* union.bar; // Error: Property 'bar' does not exist on type 'MyUnion'
|
|
56
|
+
* union.qux; // Error: Property 'qux' does not exist on type 'MyUnion'
|
|
57
|
+
*/
|
|
58
|
+
type Relax<T> = DistributiveRelax<T, T extends any ? keyof T : never>;
|
|
59
|
+
type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ? Resolve<{
|
|
60
|
+
[K in keyof T]: T[K];
|
|
61
|
+
} & {
|
|
62
|
+
[K in Exclude<Ks, keyof T>]?: never;
|
|
63
|
+
}> : never;
|
|
64
|
+
|
|
65
|
+
type CustomAuthenticationResult = Relax<{
|
|
9
66
|
token: string;
|
|
10
|
-
error?: never;
|
|
11
67
|
} | {
|
|
12
|
-
token?: never;
|
|
13
68
|
error: "forbidden";
|
|
14
69
|
reason: string;
|
|
15
70
|
} | {
|
|
16
|
-
token?: never;
|
|
17
71
|
error: string;
|
|
18
72
|
reason: string;
|
|
19
|
-
}
|
|
73
|
+
}>;
|
|
20
74
|
|
|
21
75
|
/**
|
|
22
76
|
* Represents an indefinitely deep arbitrary JSON data structure. There are
|
|
@@ -28,13 +82,13 @@ declare type CustomAuthenticationResult = {
|
|
|
28
82
|
* - JsonObject a JSON value whose outer type is an object
|
|
29
83
|
*
|
|
30
84
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
85
|
+
type Json = JsonScalar | JsonArray | JsonObject;
|
|
86
|
+
type JsonScalar = string | number | boolean | null;
|
|
87
|
+
type JsonArray = Json[];
|
|
34
88
|
/**
|
|
35
89
|
* Any valid JSON object.
|
|
36
90
|
*/
|
|
37
|
-
|
|
91
|
+
type JsonObject = {
|
|
38
92
|
[key: string]: Json | undefined;
|
|
39
93
|
};
|
|
40
94
|
declare function isJsonScalar(data: Json): data is JsonScalar;
|
|
@@ -46,7 +100,7 @@ declare function isJsonObject(data: Json): data is JsonObject;
|
|
|
46
100
|
* object is fine, but _if_ it has a name field, it _must_ be a string."
|
|
47
101
|
* (Ditto for avatar.)
|
|
48
102
|
*/
|
|
49
|
-
|
|
103
|
+
type IUserInfo = {
|
|
50
104
|
[key: string]: Json | undefined;
|
|
51
105
|
name?: string;
|
|
52
106
|
avatar?: string;
|
|
@@ -54,7 +108,7 @@ declare type IUserInfo = {
|
|
|
54
108
|
/**
|
|
55
109
|
* This type is used by clients to define the metadata for a user.
|
|
56
110
|
*/
|
|
57
|
-
|
|
111
|
+
type BaseUserMeta = {
|
|
58
112
|
/**
|
|
59
113
|
* The id of the user that has been set in the authentication endpoint.
|
|
60
114
|
* Useful to get additional information about the connected user.
|
|
@@ -74,9 +128,9 @@ declare enum Permission {
|
|
|
74
128
|
CommentsRead = "comments:read"
|
|
75
129
|
}
|
|
76
130
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
131
|
+
type Callback<T> = (event: T) => void;
|
|
132
|
+
type UnsubscribeCallback = () => void;
|
|
133
|
+
type Observable<T> = {
|
|
80
134
|
/**
|
|
81
135
|
* Register a callback function to be called whenever the event source emits
|
|
82
136
|
* an event.
|
|
@@ -95,11 +149,13 @@ declare type Observable<T> = {
|
|
|
95
149
|
*/
|
|
96
150
|
waitUntil(predicate?: (event: T) => boolean): Promise<T>;
|
|
97
151
|
};
|
|
98
|
-
|
|
152
|
+
type EventSource<T> = Observable<T> & {
|
|
99
153
|
/**
|
|
100
|
-
* Notify all subscribers about the event.
|
|
154
|
+
* Notify all subscribers about the event. Will return `false` if there
|
|
155
|
+
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
156
|
+
* there was at least one subscriber.
|
|
101
157
|
*/
|
|
102
|
-
notify(event: T):
|
|
158
|
+
notify(event: T): boolean;
|
|
103
159
|
/**
|
|
104
160
|
* Returns the number of active subscribers.
|
|
105
161
|
*/
|
|
@@ -227,7 +283,7 @@ declare enum WebsocketCloseCodes {
|
|
|
227
283
|
* a Room, as returned by `room.getStatus()`. Can be used to implement
|
|
228
284
|
* a connection status badge.
|
|
229
285
|
*/
|
|
230
|
-
|
|
286
|
+
type Status = "initial" | "connecting" | "connected" | "reconnecting" | "disconnected";
|
|
231
287
|
/**
|
|
232
288
|
* Used to report about app-level reconnection issues.
|
|
233
289
|
*
|
|
@@ -237,7 +293,7 @@ declare type Status = "initial" | "connecting" | "connected" | "reconnecting" |
|
|
|
237
293
|
* to inform your users about, for example, by throwing a toast message on
|
|
238
294
|
* screen, or show a "trying to reconnect" banner.
|
|
239
295
|
*/
|
|
240
|
-
|
|
296
|
+
type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
241
297
|
/**
|
|
242
298
|
* Arbitrary record that will be used as the authentication "authValue". It's the
|
|
243
299
|
* value that is returned by calling the authentication delegate, and will get
|
|
@@ -245,11 +301,8 @@ declare type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
|
245
301
|
* the connection manager, but its value will not be interpreted, so it can be
|
|
246
302
|
* any value (except null).
|
|
247
303
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
code: number;
|
|
251
|
-
}
|
|
252
|
-
declare type Delegates<T extends BaseAuthResult> = {
|
|
304
|
+
type BaseAuthResult = NonNullable<Json>;
|
|
305
|
+
type Delegates<T extends BaseAuthResult> = {
|
|
253
306
|
authenticate: () => Promise<T>;
|
|
254
307
|
createSocket: (authValue: T) => IWebSocketInstance;
|
|
255
308
|
canZombie: () => boolean;
|
|
@@ -270,15 +323,15 @@ declare enum OpCode {
|
|
|
270
323
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
271
324
|
* only.
|
|
272
325
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
326
|
+
type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
327
|
+
type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
328
|
+
type UpdateObjectOp = {
|
|
276
329
|
readonly opId?: string;
|
|
277
330
|
readonly id: string;
|
|
278
331
|
readonly type: OpCode.UPDATE_OBJECT;
|
|
279
332
|
readonly data: Partial<JsonObject>;
|
|
280
333
|
};
|
|
281
|
-
|
|
334
|
+
type CreateObjectOp = {
|
|
282
335
|
readonly opId?: string;
|
|
283
336
|
readonly id: string;
|
|
284
337
|
readonly intent?: "set";
|
|
@@ -288,7 +341,7 @@ declare type CreateObjectOp = {
|
|
|
288
341
|
readonly parentKey: string;
|
|
289
342
|
readonly data: JsonObject;
|
|
290
343
|
};
|
|
291
|
-
|
|
344
|
+
type CreateListOp = {
|
|
292
345
|
readonly opId?: string;
|
|
293
346
|
readonly id: string;
|
|
294
347
|
readonly intent?: "set";
|
|
@@ -297,7 +350,7 @@ declare type CreateListOp = {
|
|
|
297
350
|
readonly parentId: string;
|
|
298
351
|
readonly parentKey: string;
|
|
299
352
|
};
|
|
300
|
-
|
|
353
|
+
type CreateMapOp = {
|
|
301
354
|
readonly opId?: string;
|
|
302
355
|
readonly id: string;
|
|
303
356
|
readonly intent?: "set";
|
|
@@ -306,7 +359,7 @@ declare type CreateMapOp = {
|
|
|
306
359
|
readonly parentId: string;
|
|
307
360
|
readonly parentKey: string;
|
|
308
361
|
};
|
|
309
|
-
|
|
362
|
+
type CreateRegisterOp = {
|
|
310
363
|
readonly opId?: string;
|
|
311
364
|
readonly id: string;
|
|
312
365
|
readonly intent?: "set";
|
|
@@ -316,12 +369,12 @@ declare type CreateRegisterOp = {
|
|
|
316
369
|
readonly parentKey: string;
|
|
317
370
|
readonly data: Json;
|
|
318
371
|
};
|
|
319
|
-
|
|
372
|
+
type DeleteCrdtOp = {
|
|
320
373
|
readonly opId?: string;
|
|
321
374
|
readonly id: string;
|
|
322
375
|
readonly type: OpCode.DELETE_CRDT;
|
|
323
376
|
};
|
|
324
|
-
|
|
377
|
+
type AckOp = {
|
|
325
378
|
readonly type: OpCode.DELETE_CRDT;
|
|
326
379
|
readonly id: "ACK";
|
|
327
380
|
readonly opId: string;
|
|
@@ -345,13 +398,13 @@ declare type AckOp = {
|
|
|
345
398
|
* node does not exist, but as a side-effect the Op will get acknowledged.
|
|
346
399
|
*/
|
|
347
400
|
declare function ackOp(opId: string): AckOp;
|
|
348
|
-
|
|
401
|
+
type SetParentKeyOp = {
|
|
349
402
|
readonly opId?: string;
|
|
350
403
|
readonly id: string;
|
|
351
404
|
readonly type: OpCode.SET_PARENT_KEY;
|
|
352
405
|
readonly parentKey: string;
|
|
353
406
|
};
|
|
354
|
-
|
|
407
|
+
type DeleteObjectKeyOp = {
|
|
355
408
|
readonly opId?: string;
|
|
356
409
|
readonly id: string;
|
|
357
410
|
readonly type: OpCode.DELETE_OBJECT_KEY;
|
|
@@ -362,15 +415,15 @@ declare type DeleteObjectKeyOp = {
|
|
|
362
415
|
* Represents an indefinitely deep arbitrary immutable data
|
|
363
416
|
* structure, as returned by the .toImmutable().
|
|
364
417
|
*/
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
418
|
+
type Immutable = Scalar | ImmutableList | ImmutableObject | ImmutableMap;
|
|
419
|
+
type Scalar = string | number | boolean | null;
|
|
420
|
+
type ImmutableList = readonly Immutable[];
|
|
421
|
+
type ImmutableObject = {
|
|
369
422
|
readonly [key: string]: Immutable | undefined;
|
|
370
423
|
};
|
|
371
|
-
|
|
424
|
+
type ImmutableMap = ReadonlyMap<string, Immutable>;
|
|
372
425
|
|
|
373
|
-
|
|
426
|
+
type UpdateDelta = {
|
|
374
427
|
type: "update";
|
|
375
428
|
} | {
|
|
376
429
|
type: "delete";
|
|
@@ -418,20 +471,20 @@ declare type UpdateDelta = {
|
|
|
418
471
|
*
|
|
419
472
|
*/
|
|
420
473
|
|
|
421
|
-
|
|
422
|
-
|
|
474
|
+
type PlainLsonFields = Record<string, PlainLson>;
|
|
475
|
+
type PlainLsonObject = {
|
|
423
476
|
liveblocksType: "LiveObject";
|
|
424
477
|
data: PlainLsonFields;
|
|
425
478
|
};
|
|
426
|
-
|
|
479
|
+
type PlainLsonMap = {
|
|
427
480
|
liveblocksType: "LiveMap";
|
|
428
481
|
data: PlainLsonFields;
|
|
429
482
|
};
|
|
430
|
-
|
|
483
|
+
type PlainLsonList = {
|
|
431
484
|
liveblocksType: "LiveList";
|
|
432
485
|
data: PlainLson[];
|
|
433
486
|
};
|
|
434
|
-
|
|
487
|
+
type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
|
|
435
488
|
|
|
436
489
|
/**
|
|
437
490
|
* Helper type to convert any valid Lson type to the equivalent Json type.
|
|
@@ -449,7 +502,7 @@ declare type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
|
|
|
449
502
|
* // { readonly a: null, readonly b: readonly string[], readonly c?: number }
|
|
450
503
|
*
|
|
451
504
|
*/
|
|
452
|
-
|
|
505
|
+
type ToImmutable<L extends Lson | LsonObject> = L extends LiveList<infer I> ? readonly ToImmutable<I>[] : L extends LiveObject<infer O> ? ToImmutable<O> : L extends LiveMap<infer K, infer V> ? ReadonlyMap<K, ToImmutable<V>> : L extends LsonObject ? {
|
|
453
506
|
readonly [K in keyof L]: ToImmutable<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
|
|
454
507
|
} : L extends Json ? L : never;
|
|
455
508
|
/**
|
|
@@ -461,7 +514,7 @@ declare function toPlainLson(lson: Lson): PlainLson;
|
|
|
461
514
|
* A LiveMap notification that is sent in-client to any subscribers whenever
|
|
462
515
|
* one or more of the values inside the LiveMap instance have changed.
|
|
463
516
|
*/
|
|
464
|
-
|
|
517
|
+
type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
|
|
465
518
|
type: "LiveMap";
|
|
466
519
|
node: LiveMap<TKey, TValue>;
|
|
467
520
|
updates: {
|
|
@@ -528,16 +581,16 @@ declare class LiveMap<TKey extends string, TValue extends Lson> extends Abstract
|
|
|
528
581
|
clone(): LiveMap<TKey, TValue>;
|
|
529
582
|
}
|
|
530
583
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
584
|
+
type StorageCallback = (updates: StorageUpdate[]) => void;
|
|
585
|
+
type LiveMapUpdate = LiveMapUpdates<string, Lson>;
|
|
586
|
+
type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
|
|
587
|
+
type LiveListUpdate = LiveListUpdates<Lson>;
|
|
535
588
|
/**
|
|
536
589
|
* The payload of notifications sent (in-client) when LiveStructures change.
|
|
537
590
|
* Messages of this kind are not originating from the network, but are 100%
|
|
538
591
|
* in-client.
|
|
539
592
|
*/
|
|
540
|
-
|
|
593
|
+
type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
|
|
541
594
|
|
|
542
595
|
declare abstract class AbstractCrdt {
|
|
543
596
|
#private;
|
|
@@ -553,7 +606,7 @@ declare abstract class AbstractCrdt {
|
|
|
553
606
|
abstract clone(): Lson;
|
|
554
607
|
}
|
|
555
608
|
|
|
556
|
-
|
|
609
|
+
type LiveListUpdateDelta = {
|
|
557
610
|
type: "insert";
|
|
558
611
|
index: number;
|
|
559
612
|
item: Lson;
|
|
@@ -575,7 +628,7 @@ declare type LiveListUpdateDelta = {
|
|
|
575
628
|
* A LiveList notification that is sent in-client to any subscribers whenever
|
|
576
629
|
* one or more of the items inside the LiveList instance have changed.
|
|
577
630
|
*/
|
|
578
|
-
|
|
631
|
+
type LiveListUpdates<TItem extends Lson> = {
|
|
579
632
|
type: "LiveList";
|
|
580
633
|
node: LiveList<TItem>;
|
|
581
634
|
updates: LiveListUpdateDelta[];
|
|
@@ -694,23 +747,23 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
|
|
|
694
747
|
clone(): TValue;
|
|
695
748
|
}
|
|
696
749
|
|
|
697
|
-
|
|
750
|
+
type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
|
|
698
751
|
/**
|
|
699
752
|
* Think of Lson as a sibling of the Json data tree, except that the nested
|
|
700
753
|
* data structure can contain a mix of Json values and LiveStructure instances.
|
|
701
754
|
*/
|
|
702
|
-
|
|
755
|
+
type Lson = Json | LiveStructure;
|
|
703
756
|
/**
|
|
704
757
|
* LiveNode is the internal tree for managing Live data structures. The key
|
|
705
758
|
* difference with Lson is that all the Json values get represented in
|
|
706
759
|
* a LiveRegister node.
|
|
707
760
|
*/
|
|
708
|
-
|
|
761
|
+
type LiveNode = LiveStructure | LiveRegister<Json>;
|
|
709
762
|
/**
|
|
710
763
|
* A mapping of keys to Lson values. A Lson value is any valid JSON
|
|
711
764
|
* value or a Live storage data structure (LiveMap, LiveList, etc.)
|
|
712
765
|
*/
|
|
713
|
-
|
|
766
|
+
type LsonObject = {
|
|
714
767
|
[key: string]: Lson | undefined;
|
|
715
768
|
};
|
|
716
769
|
/**
|
|
@@ -729,13 +782,13 @@ declare type LsonObject = {
|
|
|
729
782
|
* // { a: null, b: string[], c?: number }
|
|
730
783
|
*
|
|
731
784
|
*/
|
|
732
|
-
|
|
785
|
+
type ToJson<T extends Lson | LsonObject> = T extends Json ? T : T extends LsonObject ? {
|
|
733
786
|
[K in keyof T]: ToJson<Exclude<T[K], undefined>> | (undefined extends T[K] ? undefined : never);
|
|
734
787
|
} : T extends LiveList<infer I> ? ToJson<I>[] : T extends LiveObject<infer O> ? ToJson<O> : T extends LiveMap<infer KS, infer V> ? {
|
|
735
788
|
[K in KS]: ToJson<V>;
|
|
736
789
|
} : never;
|
|
737
790
|
|
|
738
|
-
|
|
791
|
+
type LiveObjectUpdateDelta<O extends {
|
|
739
792
|
[key: string]: unknown;
|
|
740
793
|
}> = {
|
|
741
794
|
[K in keyof O]?: UpdateDelta | undefined;
|
|
@@ -744,7 +797,7 @@ declare type LiveObjectUpdateDelta<O extends {
|
|
|
744
797
|
* A LiveObject notification that is sent in-client to any subscribers whenever
|
|
745
798
|
* one or more of the entries inside the LiveObject instance have changed.
|
|
746
799
|
*/
|
|
747
|
-
|
|
800
|
+
type LiveObjectUpdates<TData extends LsonObject> = {
|
|
748
801
|
type: "LiveObject";
|
|
749
802
|
node: LiveObject<TData>;
|
|
750
803
|
updates: LiveObjectUpdateDelta<TData>;
|
|
@@ -786,11 +839,11 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
|
786
839
|
clone(): LiveObject<O>;
|
|
787
840
|
}
|
|
788
841
|
|
|
789
|
-
|
|
842
|
+
type DateToString<T> = {
|
|
790
843
|
[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];
|
|
791
844
|
};
|
|
792
845
|
|
|
793
|
-
|
|
846
|
+
type InboxNotificationThreadData = {
|
|
794
847
|
kind: "thread";
|
|
795
848
|
id: string;
|
|
796
849
|
roomId: string;
|
|
@@ -798,7 +851,7 @@ declare type InboxNotificationThreadData = {
|
|
|
798
851
|
notifiedAt: Date;
|
|
799
852
|
readAt: Date | null;
|
|
800
853
|
};
|
|
801
|
-
|
|
854
|
+
type InboxNotificationTextMentionData = {
|
|
802
855
|
kind: "textMention";
|
|
803
856
|
id: string;
|
|
804
857
|
roomId: string;
|
|
@@ -807,14 +860,14 @@ declare type InboxNotificationTextMentionData = {
|
|
|
807
860
|
createdBy: string;
|
|
808
861
|
mentionId: string;
|
|
809
862
|
};
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
863
|
+
type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
|
|
864
|
+
type ActivityData = Record<string, string | boolean | number | undefined>;
|
|
865
|
+
type InboxNotificationActivity<K extends keyof DAD = keyof DAD> = {
|
|
813
866
|
id: string;
|
|
814
867
|
createdAt: Date;
|
|
815
868
|
data: DAD[K];
|
|
816
869
|
};
|
|
817
|
-
|
|
870
|
+
type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
|
|
818
871
|
kind: K;
|
|
819
872
|
id: string;
|
|
820
873
|
roomId?: string;
|
|
@@ -823,24 +876,24 @@ declare type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
|
|
|
823
876
|
readAt: Date | null;
|
|
824
877
|
activities: InboxNotificationActivity<K>[];
|
|
825
878
|
};
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
879
|
+
type InboxNotificationData = InboxNotificationThreadData | InboxNotificationCustomData | InboxNotificationTextMentionData;
|
|
880
|
+
type InboxNotificationThreadDataPlain = DateToString<InboxNotificationThreadData>;
|
|
881
|
+
type InboxNotificationCustomDataPlain = Omit<DateToString<InboxNotificationCustomData>, "activities"> & {
|
|
829
882
|
activities: DateToString<InboxNotificationActivity>[];
|
|
830
883
|
};
|
|
831
|
-
|
|
832
|
-
|
|
884
|
+
type InboxNotificationDataPlain = InboxNotificationThreadDataPlain | InboxNotificationCustomDataPlain | InboxNotificationTextMentionDataPlain;
|
|
885
|
+
type InboxNotificationDeleteInfo = {
|
|
833
886
|
type: "deletedInboxNotification";
|
|
834
887
|
id: string;
|
|
835
888
|
roomId: string;
|
|
836
889
|
deletedAt: Date;
|
|
837
890
|
};
|
|
838
891
|
|
|
839
|
-
|
|
892
|
+
type BaseActivitiesData = {
|
|
840
893
|
[key: `$${string}`]: ActivityData;
|
|
841
894
|
};
|
|
842
895
|
|
|
843
|
-
|
|
896
|
+
type BaseRoomInfo = {
|
|
844
897
|
[key: string]: Json | undefined;
|
|
845
898
|
/**
|
|
846
899
|
* The name of the room.
|
|
@@ -852,22 +905,22 @@ declare type BaseRoomInfo = {
|
|
|
852
905
|
url?: string;
|
|
853
906
|
};
|
|
854
907
|
|
|
855
|
-
|
|
856
|
-
|
|
908
|
+
type BaseMetadata = Record<string, string | boolean | number | undefined>;
|
|
909
|
+
type CommentReaction = {
|
|
857
910
|
emoji: string;
|
|
858
911
|
createdAt: Date;
|
|
859
912
|
users: {
|
|
860
913
|
id: string;
|
|
861
914
|
}[];
|
|
862
915
|
};
|
|
863
|
-
|
|
916
|
+
type CommentAttachment = {
|
|
864
917
|
type: "attachment";
|
|
865
918
|
id: string;
|
|
866
919
|
name: string;
|
|
867
920
|
size: number;
|
|
868
921
|
mimeType: string;
|
|
869
922
|
};
|
|
870
|
-
|
|
923
|
+
type CommentLocalAttachmentIdle = {
|
|
871
924
|
type: "localAttachment";
|
|
872
925
|
status: "idle";
|
|
873
926
|
id: string;
|
|
@@ -876,7 +929,7 @@ declare type CommentLocalAttachmentIdle = {
|
|
|
876
929
|
mimeType: string;
|
|
877
930
|
file: File;
|
|
878
931
|
};
|
|
879
|
-
|
|
932
|
+
type CommentLocalAttachmentUploading = {
|
|
880
933
|
type: "localAttachment";
|
|
881
934
|
status: "uploading";
|
|
882
935
|
id: string;
|
|
@@ -885,7 +938,7 @@ declare type CommentLocalAttachmentUploading = {
|
|
|
885
938
|
mimeType: string;
|
|
886
939
|
file: File;
|
|
887
940
|
};
|
|
888
|
-
|
|
941
|
+
type CommentLocalAttachmentUploaded = {
|
|
889
942
|
type: "localAttachment";
|
|
890
943
|
status: "uploaded";
|
|
891
944
|
id: string;
|
|
@@ -894,7 +947,7 @@ declare type CommentLocalAttachmentUploaded = {
|
|
|
894
947
|
mimeType: string;
|
|
895
948
|
file: File;
|
|
896
949
|
};
|
|
897
|
-
|
|
950
|
+
type CommentLocalAttachmentError = {
|
|
898
951
|
type: "localAttachment";
|
|
899
952
|
status: "error";
|
|
900
953
|
id: string;
|
|
@@ -904,12 +957,12 @@ declare type CommentLocalAttachmentError = {
|
|
|
904
957
|
file: File;
|
|
905
958
|
error: Error;
|
|
906
959
|
};
|
|
907
|
-
|
|
908
|
-
|
|
960
|
+
type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
|
|
961
|
+
type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
909
962
|
/**
|
|
910
963
|
* Represents a comment.
|
|
911
964
|
*/
|
|
912
|
-
|
|
965
|
+
type CommentData = {
|
|
913
966
|
type: "comment";
|
|
914
967
|
id: string;
|
|
915
968
|
threadId: string;
|
|
@@ -919,59 +972,55 @@ declare type CommentData = {
|
|
|
919
972
|
editedAt?: Date;
|
|
920
973
|
reactions: CommentReaction[];
|
|
921
974
|
attachments: CommentAttachment[];
|
|
922
|
-
} &
|
|
975
|
+
} & Relax<{
|
|
923
976
|
body: CommentBody;
|
|
924
|
-
deletedAt?: never;
|
|
925
977
|
} | {
|
|
926
|
-
body?: never;
|
|
927
978
|
deletedAt: Date;
|
|
928
|
-
}
|
|
929
|
-
|
|
979
|
+
}>;
|
|
980
|
+
type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
|
|
930
981
|
reactions: DateToString<CommentReaction>[];
|
|
931
|
-
} &
|
|
982
|
+
} & Relax<{
|
|
932
983
|
body: CommentBody;
|
|
933
|
-
deletedAt?: never;
|
|
934
984
|
} | {
|
|
935
|
-
body?: never;
|
|
936
985
|
deletedAt: string;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
986
|
+
}>;
|
|
987
|
+
type CommentBodyBlockElement = CommentBodyParagraph;
|
|
988
|
+
type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
|
|
989
|
+
type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
|
|
990
|
+
type CommentBodyParagraph = {
|
|
942
991
|
type: "paragraph";
|
|
943
992
|
children: CommentBodyInlineElement[];
|
|
944
993
|
};
|
|
945
|
-
|
|
994
|
+
type CommentBodyMention = {
|
|
946
995
|
type: "mention";
|
|
947
996
|
id: string;
|
|
948
997
|
};
|
|
949
|
-
|
|
998
|
+
type CommentBodyLink = {
|
|
950
999
|
type: "link";
|
|
951
1000
|
url: string;
|
|
952
1001
|
text?: string;
|
|
953
1002
|
};
|
|
954
|
-
|
|
1003
|
+
type CommentBodyText = {
|
|
955
1004
|
bold?: boolean;
|
|
956
1005
|
italic?: boolean;
|
|
957
1006
|
strikethrough?: boolean;
|
|
958
1007
|
code?: boolean;
|
|
959
1008
|
text: string;
|
|
960
1009
|
};
|
|
961
|
-
|
|
1010
|
+
type CommentBody = {
|
|
962
1011
|
version: 1;
|
|
963
1012
|
content: CommentBodyBlockElement[];
|
|
964
1013
|
};
|
|
965
|
-
|
|
1014
|
+
type CommentUserReaction = {
|
|
966
1015
|
emoji: string;
|
|
967
1016
|
createdAt: Date;
|
|
968
1017
|
userId: string;
|
|
969
1018
|
};
|
|
970
|
-
|
|
1019
|
+
type CommentUserReactionPlain = DateToString<CommentUserReaction>;
|
|
971
1020
|
/**
|
|
972
1021
|
* Represents a thread of comments.
|
|
973
1022
|
*/
|
|
974
|
-
|
|
1023
|
+
type ThreadData<M extends BaseMetadata = DM> = {
|
|
975
1024
|
type: "thread";
|
|
976
1025
|
id: string;
|
|
977
1026
|
roomId: string;
|
|
@@ -984,17 +1033,17 @@ declare type ThreadData<M extends BaseMetadata = DM> = {
|
|
|
984
1033
|
interface ThreadDataWithDeleteInfo<M extends BaseMetadata = DM> extends ThreadData<M> {
|
|
985
1034
|
deletedAt?: Date;
|
|
986
1035
|
}
|
|
987
|
-
|
|
1036
|
+
type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>, "comments" | "metadata"> & {
|
|
988
1037
|
comments: CommentDataPlain[];
|
|
989
1038
|
metadata: M;
|
|
990
1039
|
};
|
|
991
|
-
|
|
1040
|
+
type ThreadDeleteInfo = {
|
|
992
1041
|
type: "deletedThread";
|
|
993
1042
|
id: string;
|
|
994
1043
|
roomId: string;
|
|
995
1044
|
deletedAt: Date;
|
|
996
1045
|
};
|
|
997
|
-
|
|
1046
|
+
type StringOperators<T> = T | {
|
|
998
1047
|
startsWith: string;
|
|
999
1048
|
};
|
|
1000
1049
|
/**
|
|
@@ -1005,8 +1054,8 @@ declare type StringOperators<T> = T | {
|
|
|
1005
1054
|
* - to strings:
|
|
1006
1055
|
* - `startsWith` (`^` in query string)
|
|
1007
1056
|
*/
|
|
1008
|
-
|
|
1009
|
-
[K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
|
|
1057
|
+
type QueryMetadata<M extends BaseMetadata> = {
|
|
1058
|
+
[K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
|
|
1010
1059
|
};
|
|
1011
1060
|
|
|
1012
1061
|
declare global {
|
|
@@ -1017,20 +1066,20 @@ declare global {
|
|
|
1017
1066
|
[key: string]: unknown;
|
|
1018
1067
|
}
|
|
1019
1068
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1069
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
|
|
1070
|
+
type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
|
|
1071
|
+
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1072
|
+
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
1073
|
+
type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
|
|
1074
|
+
type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
|
|
1075
|
+
type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
|
|
1076
|
+
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1077
|
+
type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1078
|
+
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1079
|
+
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
1031
1080
|
[K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
1032
1081
|
}>;
|
|
1033
|
-
|
|
1082
|
+
type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
1034
1083
|
|
|
1035
1084
|
/**
|
|
1036
1085
|
* Use this symbol to brand an object property as internal.
|
|
@@ -1051,27 +1100,27 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
|
|
|
1051
1100
|
*/
|
|
1052
1101
|
declare const kInternal: unique symbol;
|
|
1053
1102
|
|
|
1054
|
-
|
|
1103
|
+
type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1055
1104
|
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1056
1105
|
} : never;
|
|
1057
|
-
|
|
1106
|
+
type AsyncLoading<F extends string = "data"> = RenameDataField<{
|
|
1058
1107
|
readonly isLoading: true;
|
|
1059
1108
|
readonly data?: never;
|
|
1060
1109
|
readonly error?: never;
|
|
1061
1110
|
}, F>;
|
|
1062
|
-
|
|
1111
|
+
type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
|
|
1063
1112
|
readonly isLoading: false;
|
|
1064
1113
|
readonly data: T;
|
|
1065
1114
|
readonly error?: never;
|
|
1066
1115
|
}, F>;
|
|
1067
|
-
|
|
1116
|
+
type AsyncError<F extends string = "data"> = RenameDataField<{
|
|
1068
1117
|
readonly isLoading: false;
|
|
1069
1118
|
readonly data?: never;
|
|
1070
1119
|
readonly error: Error;
|
|
1071
1120
|
}, F>;
|
|
1072
|
-
|
|
1121
|
+
type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
|
|
1073
1122
|
|
|
1074
|
-
|
|
1123
|
+
type BatchStore<O, I> = {
|
|
1075
1124
|
subscribe: (callback: Callback<void>) => UnsubscribeCallback;
|
|
1076
1125
|
enqueue: (input: I) => Promise<void>;
|
|
1077
1126
|
getItemState: (input: I) => AsyncResult<O> | undefined;
|
|
@@ -1089,12 +1138,12 @@ declare enum ClientMsgCode {
|
|
|
1089
1138
|
/**
|
|
1090
1139
|
* Messages that can be sent from the client to the server.
|
|
1091
1140
|
*/
|
|
1092
|
-
|
|
1093
|
-
|
|
1141
|
+
type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
|
|
1142
|
+
type BroadcastEventClientMsg<E extends Json> = {
|
|
1094
1143
|
type: ClientMsgCode.BROADCAST_EVENT;
|
|
1095
1144
|
event: E;
|
|
1096
1145
|
};
|
|
1097
|
-
|
|
1146
|
+
type UpdatePresenceClientMsg<P extends JsonObject> = {
|
|
1098
1147
|
readonly type: ClientMsgCode.UPDATE_PRESENCE;
|
|
1099
1148
|
/**
|
|
1100
1149
|
* Set this to any number to signify that this is a Full Presence™
|
|
@@ -1120,56 +1169,56 @@ declare type UpdatePresenceClientMsg<P extends JsonObject> = {
|
|
|
1120
1169
|
readonly targetActor?: undefined;
|
|
1121
1170
|
readonly data: Partial<P>;
|
|
1122
1171
|
};
|
|
1123
|
-
|
|
1172
|
+
type UpdateStorageClientMsg = {
|
|
1124
1173
|
readonly type: ClientMsgCode.UPDATE_STORAGE;
|
|
1125
1174
|
readonly ops: Op[];
|
|
1126
1175
|
};
|
|
1127
|
-
|
|
1176
|
+
type FetchStorageClientMsg = {
|
|
1128
1177
|
readonly type: ClientMsgCode.FETCH_STORAGE;
|
|
1129
1178
|
};
|
|
1130
|
-
|
|
1179
|
+
type FetchYDocClientMsg = {
|
|
1131
1180
|
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1132
1181
|
readonly vector: string;
|
|
1133
1182
|
readonly guid?: string;
|
|
1134
1183
|
};
|
|
1135
|
-
|
|
1184
|
+
type UpdateYDocClientMsg = {
|
|
1136
1185
|
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1137
1186
|
readonly update: string;
|
|
1138
1187
|
readonly guid?: string;
|
|
1139
1188
|
};
|
|
1140
1189
|
|
|
1141
|
-
|
|
1190
|
+
type IdTuple<T> = [id: string, value: T];
|
|
1142
1191
|
declare enum CrdtType {
|
|
1143
1192
|
OBJECT = 0,
|
|
1144
1193
|
LIST = 1,
|
|
1145
1194
|
MAP = 2,
|
|
1146
1195
|
REGISTER = 3
|
|
1147
1196
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1197
|
+
type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
1198
|
+
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
1199
|
+
type SerializedRootObject = {
|
|
1151
1200
|
readonly type: CrdtType.OBJECT;
|
|
1152
1201
|
readonly data: JsonObject;
|
|
1153
1202
|
readonly parentId?: never;
|
|
1154
1203
|
readonly parentKey?: never;
|
|
1155
1204
|
};
|
|
1156
|
-
|
|
1205
|
+
type SerializedObject = {
|
|
1157
1206
|
readonly type: CrdtType.OBJECT;
|
|
1158
1207
|
readonly parentId: string;
|
|
1159
1208
|
readonly parentKey: string;
|
|
1160
1209
|
readonly data: JsonObject;
|
|
1161
1210
|
};
|
|
1162
|
-
|
|
1211
|
+
type SerializedList = {
|
|
1163
1212
|
readonly type: CrdtType.LIST;
|
|
1164
1213
|
readonly parentId: string;
|
|
1165
1214
|
readonly parentKey: string;
|
|
1166
1215
|
};
|
|
1167
|
-
|
|
1216
|
+
type SerializedMap = {
|
|
1168
1217
|
readonly type: CrdtType.MAP;
|
|
1169
1218
|
readonly parentId: string;
|
|
1170
1219
|
readonly parentKey: string;
|
|
1171
1220
|
};
|
|
1172
|
-
|
|
1221
|
+
type SerializedRegister = {
|
|
1173
1222
|
readonly type: CrdtType.REGISTER;
|
|
1174
1223
|
readonly parentId: string;
|
|
1175
1224
|
readonly parentKey: string;
|
|
@@ -1201,46 +1250,46 @@ declare enum ServerMsgCode {
|
|
|
1201
1250
|
/**
|
|
1202
1251
|
* Messages that can be sent from the server to the client.
|
|
1203
1252
|
*/
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1253
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdateServerMsg | CommentsEventServerMsg;
|
|
1254
|
+
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
1255
|
+
type ThreadCreatedEvent = {
|
|
1207
1256
|
type: ServerMsgCode.THREAD_CREATED;
|
|
1208
1257
|
threadId: string;
|
|
1209
1258
|
};
|
|
1210
|
-
|
|
1259
|
+
type ThreadDeletedEvent = {
|
|
1211
1260
|
type: ServerMsgCode.THREAD_DELETED;
|
|
1212
1261
|
threadId: string;
|
|
1213
1262
|
};
|
|
1214
|
-
|
|
1263
|
+
type ThreadMetadataUpdatedEvent = {
|
|
1215
1264
|
type: ServerMsgCode.THREAD_METADATA_UPDATED;
|
|
1216
1265
|
threadId: string;
|
|
1217
1266
|
};
|
|
1218
|
-
|
|
1267
|
+
type ThreadUpdatedEvent = {
|
|
1219
1268
|
type: ServerMsgCode.THREAD_UPDATED;
|
|
1220
1269
|
threadId: string;
|
|
1221
1270
|
};
|
|
1222
|
-
|
|
1271
|
+
type CommentCreatedEvent = {
|
|
1223
1272
|
type: ServerMsgCode.COMMENT_CREATED;
|
|
1224
1273
|
threadId: string;
|
|
1225
1274
|
commentId: string;
|
|
1226
1275
|
};
|
|
1227
|
-
|
|
1276
|
+
type CommentEditedEvent = {
|
|
1228
1277
|
type: ServerMsgCode.COMMENT_EDITED;
|
|
1229
1278
|
threadId: string;
|
|
1230
1279
|
commentId: string;
|
|
1231
1280
|
};
|
|
1232
|
-
|
|
1281
|
+
type CommentDeletedEvent = {
|
|
1233
1282
|
type: ServerMsgCode.COMMENT_DELETED;
|
|
1234
1283
|
threadId: string;
|
|
1235
1284
|
commentId: string;
|
|
1236
1285
|
};
|
|
1237
|
-
|
|
1286
|
+
type CommentReactionAdded = {
|
|
1238
1287
|
type: ServerMsgCode.COMMENT_REACTION_ADDED;
|
|
1239
1288
|
threadId: string;
|
|
1240
1289
|
commentId: string;
|
|
1241
1290
|
emoji: string;
|
|
1242
1291
|
};
|
|
1243
|
-
|
|
1292
|
+
type CommentReactionRemoved = {
|
|
1244
1293
|
type: ServerMsgCode.COMMENT_REACTION_REMOVED;
|
|
1245
1294
|
threadId: string;
|
|
1246
1295
|
commentId: string;
|
|
@@ -1257,7 +1306,7 @@ declare type CommentReactionRemoved = {
|
|
|
1257
1306
|
* those cases, the `targetActor` field indicates the newly connected client,
|
|
1258
1307
|
* so all other existing clients can ignore this broadcasted message.
|
|
1259
1308
|
*/
|
|
1260
|
-
|
|
1309
|
+
type UpdatePresenceServerMsg<P extends JsonObject> = {
|
|
1261
1310
|
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
1262
1311
|
/**
|
|
1263
1312
|
* The User whose Presence has changed.
|
|
@@ -1302,7 +1351,7 @@ declare type UpdatePresenceServerMsg<P extends JsonObject> = {
|
|
|
1302
1351
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1303
1352
|
* a new User has joined the Room.
|
|
1304
1353
|
*/
|
|
1305
|
-
|
|
1354
|
+
type UserJoinServerMsg<U extends BaseUserMeta> = {
|
|
1306
1355
|
readonly type: ServerMsgCode.USER_JOINED;
|
|
1307
1356
|
readonly actor: number;
|
|
1308
1357
|
/**
|
|
@@ -1324,7 +1373,7 @@ declare type UserJoinServerMsg<U extends BaseUserMeta> = {
|
|
|
1324
1373
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1325
1374
|
* a new User has left the Room.
|
|
1326
1375
|
*/
|
|
1327
|
-
|
|
1376
|
+
type UserLeftServerMsg = {
|
|
1328
1377
|
readonly type: ServerMsgCode.USER_LEFT;
|
|
1329
1378
|
readonly actor: number;
|
|
1330
1379
|
};
|
|
@@ -1332,7 +1381,7 @@ declare type UserLeftServerMsg = {
|
|
|
1332
1381
|
* Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
|
|
1333
1382
|
* Contains a base64 encoded update
|
|
1334
1383
|
*/
|
|
1335
|
-
|
|
1384
|
+
type YDocUpdateServerMsg = {
|
|
1336
1385
|
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
1337
1386
|
readonly update: string;
|
|
1338
1387
|
readonly isSync: boolean;
|
|
@@ -1343,7 +1392,7 @@ declare type YDocUpdateServerMsg = {
|
|
|
1343
1392
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1344
1393
|
* a User broadcasted an Event to everyone in the Room.
|
|
1345
1394
|
*/
|
|
1346
|
-
|
|
1395
|
+
type BroadcastedEventServerMsg<E extends Json> = {
|
|
1347
1396
|
readonly type: ServerMsgCode.BROADCASTED_EVENT;
|
|
1348
1397
|
/**
|
|
1349
1398
|
* The User who broadcast the Event. Absent when this event is broadcast from
|
|
@@ -1361,7 +1410,7 @@ declare type BroadcastedEventServerMsg<E extends Json> = {
|
|
|
1361
1410
|
* joining the Room, to provide the initial state of the Room. The payload
|
|
1362
1411
|
* includes a list of all other Users that already are in the Room.
|
|
1363
1412
|
*/
|
|
1364
|
-
|
|
1413
|
+
type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
1365
1414
|
readonly type: ServerMsgCode.ROOM_STATE;
|
|
1366
1415
|
/**
|
|
1367
1416
|
* Informs the client what their actor ID is going to be.
|
|
@@ -1389,7 +1438,7 @@ declare type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
|
1389
1438
|
* joining the Room, to provide the initial Storage state of the Room. The
|
|
1390
1439
|
* payload includes the entire Storage document.
|
|
1391
1440
|
*/
|
|
1392
|
-
|
|
1441
|
+
type InitialDocumentStateServerMsg = {
|
|
1393
1442
|
readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
|
|
1394
1443
|
readonly items: IdTuple<SerializedCrdt>[];
|
|
1395
1444
|
};
|
|
@@ -1400,7 +1449,7 @@ declare type InitialDocumentStateServerMsg = {
|
|
|
1400
1449
|
* The payload of this message contains a list of Ops (aka incremental
|
|
1401
1450
|
* mutations to make to the initially loaded document).
|
|
1402
1451
|
*/
|
|
1403
|
-
|
|
1452
|
+
type UpdateStorageServerMsg = {
|
|
1404
1453
|
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
1405
1454
|
readonly ops: Op[];
|
|
1406
1455
|
};
|
|
@@ -1409,13 +1458,13 @@ declare type UpdateStorageServerMsg = {
|
|
|
1409
1458
|
* have been received but were rejected because they caused mutations that are
|
|
1410
1459
|
* incompatible with the Room's schema.
|
|
1411
1460
|
*/
|
|
1412
|
-
|
|
1461
|
+
type RejectedStorageOpServerMsg = {
|
|
1413
1462
|
readonly type: ServerMsgCode.REJECT_STORAGE_OP;
|
|
1414
1463
|
readonly opIds: string[];
|
|
1415
1464
|
readonly reason: string;
|
|
1416
1465
|
};
|
|
1417
1466
|
|
|
1418
|
-
|
|
1467
|
+
type HistoryVersion = {
|
|
1419
1468
|
type: "historyVersion";
|
|
1420
1469
|
kind: "yjs";
|
|
1421
1470
|
createdAt: Date;
|
|
@@ -1425,20 +1474,20 @@ declare type HistoryVersion = {
|
|
|
1425
1474
|
}[];
|
|
1426
1475
|
};
|
|
1427
1476
|
|
|
1428
|
-
|
|
1477
|
+
type JsonTreeNode = {
|
|
1429
1478
|
readonly type: "Json";
|
|
1430
1479
|
readonly id: string;
|
|
1431
1480
|
readonly key: string;
|
|
1432
1481
|
readonly payload: Json;
|
|
1433
1482
|
};
|
|
1434
|
-
|
|
1483
|
+
type LiveTreeNode<TName extends `Live${string}` = `Live${string}`> = {
|
|
1435
1484
|
readonly type: TName;
|
|
1436
1485
|
readonly id: string;
|
|
1437
1486
|
readonly key: string;
|
|
1438
1487
|
readonly payload: LsonTreeNode[];
|
|
1439
1488
|
};
|
|
1440
|
-
|
|
1441
|
-
|
|
1489
|
+
type LsonTreeNode = LiveTreeNode | JsonTreeNode;
|
|
1490
|
+
type UserTreeNode = {
|
|
1442
1491
|
readonly type: "User";
|
|
1443
1492
|
readonly id: string;
|
|
1444
1493
|
readonly key: string;
|
|
@@ -1450,14 +1499,14 @@ declare type UserTreeNode = {
|
|
|
1450
1499
|
readonly isReadOnly: boolean;
|
|
1451
1500
|
};
|
|
1452
1501
|
};
|
|
1453
|
-
|
|
1502
|
+
type CustomEventTreeNode = {
|
|
1454
1503
|
readonly type: "CustomEvent";
|
|
1455
1504
|
readonly id: string;
|
|
1456
1505
|
readonly key: string;
|
|
1457
1506
|
readonly connectionId: number;
|
|
1458
1507
|
readonly payload: Json;
|
|
1459
1508
|
};
|
|
1460
|
-
|
|
1509
|
+
type TreeNode = LsonTreeNode | UserTreeNode | CustomEventTreeNode;
|
|
1461
1510
|
|
|
1462
1511
|
type DevToolsTreeNode_CustomEventTreeNode = CustomEventTreeNode;
|
|
1463
1512
|
type DevToolsTreeNode_JsonTreeNode = JsonTreeNode;
|
|
@@ -1469,36 +1518,88 @@ declare namespace DevToolsTreeNode {
|
|
|
1469
1518
|
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 };
|
|
1470
1519
|
}
|
|
1471
1520
|
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1521
|
+
type OptionalKeys<T> = {
|
|
1522
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
1523
|
+
}[keyof T];
|
|
1524
|
+
type MakeOptionalFieldsNullable<T> = {
|
|
1525
|
+
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1526
|
+
};
|
|
1527
|
+
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1528
|
+
|
|
1529
|
+
type RoomConnectionErrorContext = {
|
|
1530
|
+
type: "ROOM_CONNECTION_ERROR";
|
|
1531
|
+
code: -1 | 4001 | 4005 | 4006 | (number & {});
|
|
1532
|
+
roomId: string;
|
|
1533
|
+
};
|
|
1534
|
+
type CommentsOrNotificationsErrorContext = {
|
|
1535
|
+
type: "CREATE_THREAD_ERROR";
|
|
1536
|
+
roomId: string;
|
|
1537
|
+
threadId: string;
|
|
1538
|
+
commentId: string;
|
|
1539
|
+
body: CommentBody;
|
|
1540
|
+
metadata: BaseMetadata;
|
|
1541
|
+
} | {
|
|
1542
|
+
type: "DELETE_THREAD_ERROR";
|
|
1543
|
+
roomId: string;
|
|
1544
|
+
threadId: string;
|
|
1545
|
+
} | {
|
|
1546
|
+
type: "EDIT_THREAD_METADATA_ERROR";
|
|
1547
|
+
roomId: string;
|
|
1548
|
+
threadId: string;
|
|
1549
|
+
metadata: Patchable<BaseMetadata>;
|
|
1550
|
+
} | {
|
|
1551
|
+
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR";
|
|
1552
|
+
roomId: string;
|
|
1553
|
+
threadId: string;
|
|
1554
|
+
} | {
|
|
1555
|
+
type: "CREATE_COMMENT_ERROR" | "EDIT_COMMENT_ERROR";
|
|
1556
|
+
roomId: string;
|
|
1557
|
+
threadId: string;
|
|
1558
|
+
commentId: string;
|
|
1559
|
+
body: CommentBody;
|
|
1560
|
+
} | {
|
|
1561
|
+
type: "DELETE_COMMENT_ERROR";
|
|
1562
|
+
roomId: string;
|
|
1563
|
+
threadId: string;
|
|
1564
|
+
commentId: string;
|
|
1565
|
+
} | {
|
|
1566
|
+
type: "ADD_REACTION_ERROR" | "REMOVE_REACTION_ERROR";
|
|
1567
|
+
roomId: string;
|
|
1568
|
+
threadId: string;
|
|
1569
|
+
commentId: string;
|
|
1570
|
+
emoji: string;
|
|
1571
|
+
} | {
|
|
1572
|
+
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR";
|
|
1573
|
+
inboxNotificationId: string;
|
|
1574
|
+
roomId?: string;
|
|
1575
|
+
} | {
|
|
1576
|
+
type: "DELETE_INBOX_NOTIFICATION_ERROR";
|
|
1577
|
+
inboxNotificationId: string;
|
|
1578
|
+
} | {
|
|
1579
|
+
type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" | "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR";
|
|
1580
|
+
} | {
|
|
1581
|
+
type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
|
|
1582
|
+
roomId: string;
|
|
1496
1583
|
};
|
|
1584
|
+
type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
|
|
1585
|
+
declare class LiveblocksError extends Error {
|
|
1586
|
+
readonly context: LiveblocksErrorContext;
|
|
1587
|
+
constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
|
|
1588
|
+
/** Convenience accessor for error.context.roomId (if available) */
|
|
1589
|
+
get roomId(): LiveblocksErrorContext["roomId"];
|
|
1590
|
+
/** @deprecated Prefer using `context.code` instead, to enable type narrowing */
|
|
1591
|
+
get code(): LiveblocksErrorContext["code"];
|
|
1592
|
+
/**
|
|
1593
|
+
* Creates a LiveblocksError from a generic error, by attaching Liveblocks
|
|
1594
|
+
* contextual information like room ID, thread ID, etc.
|
|
1595
|
+
*/
|
|
1596
|
+
static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
|
|
1597
|
+
}
|
|
1497
1598
|
|
|
1498
1599
|
/**
|
|
1499
1600
|
* Represents a user connected in a room. Treated as immutable.
|
|
1500
1601
|
*/
|
|
1501
|
-
|
|
1602
|
+
type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
|
|
1502
1603
|
/**
|
|
1503
1604
|
* The connection ID of the User. It is unique and increment at every new connection.
|
|
1504
1605
|
*/
|
|
@@ -1527,7 +1628,7 @@ declare type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
|
|
|
1527
1628
|
readonly canComment: boolean;
|
|
1528
1629
|
};
|
|
1529
1630
|
|
|
1530
|
-
|
|
1631
|
+
type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = Relax<{
|
|
1531
1632
|
type: "leave";
|
|
1532
1633
|
user: User<P, U>;
|
|
1533
1634
|
} | {
|
|
@@ -1539,9 +1640,8 @@ declare type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> =
|
|
|
1539
1640
|
updates: Partial<P>;
|
|
1540
1641
|
} | {
|
|
1541
1642
|
type: "reset";
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
declare type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
|
|
1643
|
+
}>;
|
|
1644
|
+
type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
|
|
1545
1645
|
others: readonly User<P, U>[];
|
|
1546
1646
|
}>;
|
|
1547
1647
|
declare enum TextEditorType {
|
|
@@ -1549,20 +1649,12 @@ declare enum TextEditorType {
|
|
|
1549
1649
|
TipTap = "tiptap"
|
|
1550
1650
|
}
|
|
1551
1651
|
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}[keyof T];
|
|
1555
|
-
declare type MakeOptionalFieldsNullable<T> = {
|
|
1556
|
-
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1557
|
-
};
|
|
1558
|
-
declare type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1559
|
-
|
|
1560
|
-
declare type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1561
|
-
declare type RoomNotificationSettings = {
|
|
1652
|
+
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1653
|
+
type RoomNotificationSettings = {
|
|
1562
1654
|
threads: RoomThreadsNotificationSettings;
|
|
1563
1655
|
};
|
|
1564
1656
|
|
|
1565
|
-
|
|
1657
|
+
type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
1566
1658
|
type: "leave";
|
|
1567
1659
|
user: User<P, U>;
|
|
1568
1660
|
} | {
|
|
@@ -1575,8 +1667,8 @@ declare type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
|
1575
1667
|
} | {
|
|
1576
1668
|
type: "reset";
|
|
1577
1669
|
};
|
|
1578
|
-
|
|
1579
|
-
|
|
1670
|
+
type LegacyOthersEventCallback<P extends JsonObject, U extends BaseUserMeta> = (others: readonly User<P, U>[], event: LegacyOthersEvent<P, U>) => void;
|
|
1671
|
+
type RoomEventMessage<P extends JsonObject, U extends BaseUserMeta, E extends Json> = {
|
|
1580
1672
|
/**
|
|
1581
1673
|
* The connection ID of the client that sent the event.
|
|
1582
1674
|
* If this message was broadcast from the server (via the REST API), then
|
|
@@ -1591,7 +1683,7 @@ declare type RoomEventMessage<P extends JsonObject, U extends BaseUserMeta, E ex
|
|
|
1591
1683
|
user: User<P, U> | null;
|
|
1592
1684
|
event: E;
|
|
1593
1685
|
};
|
|
1594
|
-
|
|
1686
|
+
type StorageStatus = "not-loaded" | "loading" | "synchronizing" | "synchronized";
|
|
1595
1687
|
interface History {
|
|
1596
1688
|
/**
|
|
1597
1689
|
* Undoes the last operation executed by the current client.
|
|
@@ -1669,11 +1761,11 @@ interface History {
|
|
|
1669
1761
|
*/
|
|
1670
1762
|
resume: () => void;
|
|
1671
1763
|
}
|
|
1672
|
-
|
|
1764
|
+
type HistoryEvent = {
|
|
1673
1765
|
canUndo: boolean;
|
|
1674
1766
|
canRedo: boolean;
|
|
1675
1767
|
};
|
|
1676
|
-
|
|
1768
|
+
type BroadcastOptions = {
|
|
1677
1769
|
/**
|
|
1678
1770
|
* Whether or not event is queued if the connection is currently closed.
|
|
1679
1771
|
*
|
|
@@ -1681,7 +1773,7 @@ declare type BroadcastOptions = {
|
|
|
1681
1773
|
*/
|
|
1682
1774
|
shouldQueueEventIfNotReady: boolean;
|
|
1683
1775
|
};
|
|
1684
|
-
|
|
1776
|
+
type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U extends BaseUserMeta, E extends Json> = {
|
|
1685
1777
|
/**
|
|
1686
1778
|
* Subscribe to the current user presence updates.
|
|
1687
1779
|
*
|
|
@@ -1814,25 +1906,25 @@ declare type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U e
|
|
|
1814
1906
|
(type: "storage-status", listener: Callback<StorageStatus>): () => void;
|
|
1815
1907
|
(type: "comments", listener: Callback<CommentsEventServerMsg>): () => void;
|
|
1816
1908
|
};
|
|
1817
|
-
|
|
1909
|
+
type GetThreadsOptions<M extends BaseMetadata> = {
|
|
1818
1910
|
cursor?: string;
|
|
1819
1911
|
query?: {
|
|
1820
1912
|
resolved?: boolean;
|
|
1821
1913
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1822
1914
|
};
|
|
1823
1915
|
};
|
|
1824
|
-
|
|
1916
|
+
type GetThreadsSinceOptions = {
|
|
1825
1917
|
since: Date;
|
|
1826
1918
|
signal?: AbortSignal;
|
|
1827
1919
|
};
|
|
1828
|
-
|
|
1920
|
+
type UploadAttachmentOptions = {
|
|
1829
1921
|
signal?: AbortSignal;
|
|
1830
1922
|
};
|
|
1831
|
-
|
|
1923
|
+
type ListTextVersionsSinceOptions = {
|
|
1832
1924
|
since: Date;
|
|
1833
1925
|
signal?: AbortSignal;
|
|
1834
1926
|
};
|
|
1835
|
-
|
|
1927
|
+
type GetNotificationSettingsOptions = {
|
|
1836
1928
|
signal?: AbortSignal;
|
|
1837
1929
|
};
|
|
1838
1930
|
/**
|
|
@@ -1840,8 +1932,8 @@ declare type GetNotificationSettingsOptions = {
|
|
|
1840
1932
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
1841
1933
|
* a Room instance using globally augmented types only, which is narrower.
|
|
1842
1934
|
*/
|
|
1843
|
-
|
|
1844
|
-
|
|
1935
|
+
type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
|
|
1936
|
+
type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM> = {
|
|
1845
1937
|
/**
|
|
1846
1938
|
* @private
|
|
1847
1939
|
*
|
|
@@ -1961,7 +2053,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1961
2053
|
readonly self: Observable<User<P, U>>;
|
|
1962
2054
|
readonly myPresence: Observable<P>;
|
|
1963
2055
|
readonly others: Observable<OthersEvent<P, U>>;
|
|
1964
|
-
readonly error: Observable<LiveblocksError>;
|
|
1965
2056
|
/**
|
|
1966
2057
|
* @deprecated Renamed to `storageBatch`. The `storage` event source will
|
|
1967
2058
|
* soon be replaced by another/incompatible API.
|
|
@@ -2255,7 +2346,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2255
2346
|
*/
|
|
2256
2347
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2257
2348
|
};
|
|
2258
|
-
|
|
2349
|
+
type YjsSyncStatus = "loading" | "synchronizing" | "synchronized";
|
|
2259
2350
|
/**
|
|
2260
2351
|
* Interface that @liveblocks/yjs must respect.
|
|
2261
2352
|
* This interface type is declare in @liveblocks/core, so we don't have to
|
|
@@ -2288,7 +2379,7 @@ interface SyncSource {
|
|
|
2288
2379
|
* Liveblocks, NEVER USE ANY OF THESE METHODS DIRECTLY, because bad things
|
|
2289
2380
|
* will probably happen if you do.
|
|
2290
2381
|
*/
|
|
2291
|
-
|
|
2382
|
+
type PrivateRoomApi = {
|
|
2292
2383
|
presenceBuffer: Json | undefined;
|
|
2293
2384
|
undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
|
|
2294
2385
|
nodeCount: number;
|
|
@@ -2316,11 +2407,11 @@ declare type PrivateRoomApi = {
|
|
|
2316
2407
|
};
|
|
2317
2408
|
attachmentUrlsStore: BatchStore<string, string>;
|
|
2318
2409
|
};
|
|
2319
|
-
|
|
2410
|
+
type HistoryOp<P extends JsonObject> = Op | {
|
|
2320
2411
|
readonly type: "presence";
|
|
2321
2412
|
readonly data: P;
|
|
2322
2413
|
};
|
|
2323
|
-
|
|
2414
|
+
type Polyfills = {
|
|
2324
2415
|
atob?: (data: string) => string;
|
|
2325
2416
|
fetch?: typeof fetch;
|
|
2326
2417
|
WebSocket?: IWebSocket;
|
|
@@ -2332,19 +2423,19 @@ declare type Polyfills = {
|
|
|
2332
2423
|
* into:
|
|
2333
2424
|
* [foo?: string; bar?: number]
|
|
2334
2425
|
*/
|
|
2335
|
-
|
|
2426
|
+
type OptionalTuple<T extends any[]> = {
|
|
2336
2427
|
[K in keyof T]?: T[K];
|
|
2337
2428
|
};
|
|
2338
2429
|
/**
|
|
2339
2430
|
* Returns Partial<T> if all fields on C are optional, T otherwise.
|
|
2340
2431
|
*/
|
|
2341
|
-
|
|
2432
|
+
type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
|
|
2342
2433
|
C
|
|
2343
2434
|
] extends [never] ? Partial<T> : T;
|
|
2344
2435
|
/**
|
|
2345
2436
|
* Returns OptionalTupleUnless<T> if all fields on C are optional, T otherwise.
|
|
2346
2437
|
*/
|
|
2347
|
-
|
|
2438
|
+
type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
|
|
2348
2439
|
C
|
|
2349
2440
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2350
2441
|
|
|
@@ -2588,7 +2679,7 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2588
2679
|
* Back-port of TypeScript 5.4's built-in NoInfer utility type.
|
|
2589
2680
|
* See https://stackoverflow.com/a/56688073/148872
|
|
2590
2681
|
*/
|
|
2591
|
-
|
|
2682
|
+
type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2592
2683
|
|
|
2593
2684
|
declare const kTrigger: unique symbol;
|
|
2594
2685
|
/**
|
|
@@ -2598,7 +2689,7 @@ declare const kTrigger: unique symbol;
|
|
|
2598
2689
|
* Nesting batches is supported.
|
|
2599
2690
|
*/
|
|
2600
2691
|
declare function batch(callback: Callback<void>): void;
|
|
2601
|
-
|
|
2692
|
+
type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
|
|
2602
2693
|
interface ISignal<T> {
|
|
2603
2694
|
get(): T;
|
|
2604
2695
|
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
@@ -2674,9 +2765,9 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
|
|
|
2674
2765
|
mutate(callback?: (state: T) => void | boolean): void;
|
|
2675
2766
|
}
|
|
2676
2767
|
|
|
2677
|
-
|
|
2768
|
+
type OptionalPromise<T> = T | Promise<T>;
|
|
2678
2769
|
|
|
2679
|
-
|
|
2770
|
+
type ResolveMentionSuggestionsArgs = {
|
|
2680
2771
|
/**
|
|
2681
2772
|
* The ID of the current room.
|
|
2682
2773
|
*/
|
|
@@ -2686,19 +2777,19 @@ declare type ResolveMentionSuggestionsArgs = {
|
|
|
2686
2777
|
*/
|
|
2687
2778
|
text: string;
|
|
2688
2779
|
};
|
|
2689
|
-
|
|
2780
|
+
type ResolveUsersArgs = {
|
|
2690
2781
|
/**
|
|
2691
2782
|
* The IDs of the users to resolve.
|
|
2692
2783
|
*/
|
|
2693
2784
|
userIds: string[];
|
|
2694
2785
|
};
|
|
2695
|
-
|
|
2786
|
+
type ResolveRoomsInfoArgs = {
|
|
2696
2787
|
/**
|
|
2697
2788
|
* The IDs of the rooms to resolve.
|
|
2698
2789
|
*/
|
|
2699
2790
|
roomIds: string[];
|
|
2700
2791
|
};
|
|
2701
|
-
|
|
2792
|
+
type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolve<{
|
|
2702
2793
|
/**
|
|
2703
2794
|
* Whether or not the room automatically connects to Liveblock servers.
|
|
2704
2795
|
* Default is true.
|
|
@@ -2719,7 +2810,7 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2719
2810
|
*/
|
|
2720
2811
|
initialStorage: S | ((roomId: string) => S);
|
|
2721
2812
|
}>>;
|
|
2722
|
-
|
|
2813
|
+
type SyncStatus = "synchronizing" | "synchronized";
|
|
2723
2814
|
/**
|
|
2724
2815
|
* "synchronizing" - Liveblocks is in the process of writing changes
|
|
2725
2816
|
* "synchronized" - Liveblocks has persisted all pending changes
|
|
@@ -2727,7 +2818,7 @@ declare type SyncStatus = "synchronizing" | "synchronized";
|
|
|
2727
2818
|
* we're not yet "synchronizing" it until a user
|
|
2728
2819
|
* interaction, like the draft text in a comment box.
|
|
2729
2820
|
*/
|
|
2730
|
-
|
|
2821
|
+
type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
2731
2822
|
/**
|
|
2732
2823
|
* @private
|
|
2733
2824
|
*
|
|
@@ -2735,7 +2826,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2735
2826
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2736
2827
|
* will probably happen if you do.
|
|
2737
2828
|
*/
|
|
2738
|
-
|
|
2829
|
+
type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2739
2830
|
readonly currentUserId: Signal<string | undefined>;
|
|
2740
2831
|
readonly mentionSuggestionsCache: Map<string, string[]>;
|
|
2741
2832
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
@@ -2745,8 +2836,9 @@ declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> =
|
|
|
2745
2836
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2746
2837
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2747
2838
|
createSyncSource(): SyncSource;
|
|
2839
|
+
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2748
2840
|
};
|
|
2749
|
-
|
|
2841
|
+
type NotificationsApi<M extends BaseMetadata> = {
|
|
2750
2842
|
/**
|
|
2751
2843
|
* Gets a page (or the initial page) for user inbox notifications and their
|
|
2752
2844
|
* associated threads.
|
|
@@ -2847,8 +2939,8 @@ declare type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2847
2939
|
* represents a Client instance using globally augmented types only, which is
|
|
2848
2940
|
* narrower.
|
|
2849
2941
|
*/
|
|
2850
|
-
|
|
2851
|
-
|
|
2942
|
+
type OpaqueClient = Client<BaseUserMeta>;
|
|
2943
|
+
type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
2852
2944
|
/**
|
|
2853
2945
|
* Gets a room. Returns null if {@link Client.enter} has not been called previously.
|
|
2854
2946
|
*
|
|
@@ -2937,20 +3029,18 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
|
|
|
2937
3029
|
getSyncStatus(): SyncStatus;
|
|
2938
3030
|
/**
|
|
2939
3031
|
* All possible client events, subscribable from a single place.
|
|
2940
|
-
*
|
|
2941
|
-
* @private These event sources are private for now, but will become public
|
|
2942
|
-
* once they're stable.
|
|
2943
3032
|
*/
|
|
2944
3033
|
readonly events: {
|
|
3034
|
+
readonly error: Observable<LiveblocksError>;
|
|
2945
3035
|
readonly syncStatus: Observable<void>;
|
|
2946
3036
|
};
|
|
2947
3037
|
} & NotificationsApi<M>;
|
|
2948
|
-
|
|
3038
|
+
type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2949
3039
|
/**
|
|
2950
3040
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
2951
3041
|
* Can be an url or a callback if you need to add additional headers.
|
|
2952
3042
|
*/
|
|
2953
|
-
|
|
3043
|
+
type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
2954
3044
|
throttle?: number;
|
|
2955
3045
|
lostConnectionTimeout?: number;
|
|
2956
3046
|
backgroundKeepAliveTimeout?: number;
|
|
@@ -2977,13 +3067,11 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
2977
3067
|
* the server yet.
|
|
2978
3068
|
*/
|
|
2979
3069
|
preventUnsavedChanges?: boolean;
|
|
2980
|
-
} &
|
|
3070
|
+
} & Relax<{
|
|
2981
3071
|
publicApiKey: string;
|
|
2982
|
-
authEndpoint?: never;
|
|
2983
3072
|
} | {
|
|
2984
|
-
publicApiKey?: never;
|
|
2985
3073
|
authEndpoint: AuthEndpoint;
|
|
2986
|
-
}
|
|
3074
|
+
}>;
|
|
2987
3075
|
/**
|
|
2988
3076
|
* Create a client that will be responsible to communicate with liveblocks servers.
|
|
2989
3077
|
*
|
|
@@ -3011,7 +3099,7 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
3011
3099
|
*/
|
|
3012
3100
|
declare function createClient<U extends BaseUserMeta = DU>(options: ClientOptions<U>): Client<U>;
|
|
3013
3101
|
|
|
3014
|
-
|
|
3102
|
+
type CommentBodyParagraphElementArgs = {
|
|
3015
3103
|
/**
|
|
3016
3104
|
* The paragraph element.
|
|
3017
3105
|
*/
|
|
@@ -3021,13 +3109,13 @@ declare type CommentBodyParagraphElementArgs = {
|
|
|
3021
3109
|
*/
|
|
3022
3110
|
children: string;
|
|
3023
3111
|
};
|
|
3024
|
-
|
|
3112
|
+
type CommentBodyTextElementArgs = {
|
|
3025
3113
|
/**
|
|
3026
3114
|
* The text element.
|
|
3027
3115
|
*/
|
|
3028
3116
|
element: CommentBodyText;
|
|
3029
3117
|
};
|
|
3030
|
-
|
|
3118
|
+
type CommentBodyLinkElementArgs = {
|
|
3031
3119
|
/**
|
|
3032
3120
|
* The link element.
|
|
3033
3121
|
*/
|
|
@@ -3037,7 +3125,7 @@ declare type CommentBodyLinkElementArgs = {
|
|
|
3037
3125
|
*/
|
|
3038
3126
|
href: string;
|
|
3039
3127
|
};
|
|
3040
|
-
|
|
3128
|
+
type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
|
|
3041
3129
|
/**
|
|
3042
3130
|
* The mention element.
|
|
3043
3131
|
*/
|
|
@@ -3047,7 +3135,7 @@ declare type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
|
|
|
3047
3135
|
*/
|
|
3048
3136
|
user?: U["info"];
|
|
3049
3137
|
};
|
|
3050
|
-
|
|
3138
|
+
type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
|
|
3051
3139
|
/**
|
|
3052
3140
|
* The element used to display paragraphs.
|
|
3053
3141
|
*/
|
|
@@ -3065,7 +3153,7 @@ declare type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
|
|
|
3065
3153
|
*/
|
|
3066
3154
|
mention: (args: CommentBodyMentionElementArgs<U>, index: number) => string;
|
|
3067
3155
|
};
|
|
3068
|
-
|
|
3156
|
+
type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
|
|
3069
3157
|
/**
|
|
3070
3158
|
* Which format to convert the comment to.
|
|
3071
3159
|
*/
|
|
@@ -3154,13 +3242,13 @@ declare function convertToInboxNotificationData(data: InboxNotificationDataPlain
|
|
|
3154
3242
|
/**
|
|
3155
3243
|
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
3156
3244
|
*/
|
|
3157
|
-
|
|
3245
|
+
type NodeMap = Map<string, // Node ID
|
|
3158
3246
|
SerializedCrdt>;
|
|
3159
3247
|
/**
|
|
3160
3248
|
* Reverse lookup table for all child nodes (= list of SerializedCrdt values)
|
|
3161
3249
|
* by their parent node's IDs.
|
|
3162
3250
|
*/
|
|
3163
|
-
|
|
3251
|
+
type ParentToChildNodeMap = Map<string, // Parent's node ID
|
|
3164
3252
|
IdTuple<SerializedChild>[]>;
|
|
3165
3253
|
|
|
3166
3254
|
declare function isLiveNode(value: unknown): value is LiveNode;
|
|
@@ -3214,10 +3302,14 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
3214
3302
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
3215
3303
|
|
|
3216
3304
|
declare class HttpError extends Error {
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3305
|
+
response: Response;
|
|
3306
|
+
details?: JsonObject;
|
|
3307
|
+
private constructor();
|
|
3308
|
+
static fromResponse(response: Response): Promise<HttpError>;
|
|
3309
|
+
/**
|
|
3310
|
+
* Convenience accessor for response.status.
|
|
3311
|
+
*/
|
|
3312
|
+
get status(): number;
|
|
3221
3313
|
}
|
|
3222
3314
|
/**
|
|
3223
3315
|
* Wraps a promise factory. Will create promises until one succeeds. If
|
|
@@ -3326,6 +3418,16 @@ declare namespace fancyConsole {
|
|
|
3326
3418
|
*/
|
|
3327
3419
|
declare const freeze: typeof Object.freeze;
|
|
3328
3420
|
|
|
3421
|
+
declare function isPlainObject(blob: unknown): blob is {
|
|
3422
|
+
[key: string]: unknown;
|
|
3423
|
+
};
|
|
3424
|
+
/**
|
|
3425
|
+
* Check if value is of shape { startsWith: string }
|
|
3426
|
+
*/
|
|
3427
|
+
declare function isStartsWithOperator(blob: unknown): blob is {
|
|
3428
|
+
startsWith: string;
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3329
3431
|
declare const nanoid: (t?: number) => string;
|
|
3330
3432
|
|
|
3331
3433
|
/**
|
|
@@ -3333,35 +3435,32 @@ declare const nanoid: (t?: number) => string;
|
|
|
3333
3435
|
* Example:
|
|
3334
3436
|
* ```ts
|
|
3335
3437
|
* const query = objectToQuery({
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
});
|
|
3345
|
-
|
|
3346
|
-
console.log(query);
|
|
3347
|
-
// resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3348
|
-
|
|
3349
|
-
* ```
|
|
3350
|
-
*
|
|
3438
|
+
* resolved: true,
|
|
3439
|
+
* metadata: {
|
|
3440
|
+
* status: "open",
|
|
3441
|
+
* priority: 3,
|
|
3442
|
+
* org: {
|
|
3443
|
+
* startsWith: "liveblocks:",
|
|
3444
|
+
* },
|
|
3445
|
+
* },
|
|
3446
|
+
* });
|
|
3351
3447
|
*
|
|
3448
|
+
* console.log(query);
|
|
3449
|
+
* // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3450
|
+
* ```
|
|
3352
3451
|
*/
|
|
3353
|
-
|
|
3354
|
-
|
|
3452
|
+
type SimpleFilterValue = string | number | boolean | null;
|
|
3453
|
+
type OperatorFilterValue = {
|
|
3355
3454
|
startsWith: string;
|
|
3356
3455
|
};
|
|
3357
|
-
|
|
3456
|
+
type FilterValue = SimpleFilterValue | OperatorFilterValue;
|
|
3358
3457
|
declare function objectToQuery(obj: {
|
|
3359
3458
|
[key: string]: FilterValue | {
|
|
3360
3459
|
[key: string]: FilterValue | undefined;
|
|
3361
3460
|
} | undefined;
|
|
3362
3461
|
}): string;
|
|
3363
3462
|
|
|
3364
|
-
|
|
3463
|
+
type Poller = {
|
|
3365
3464
|
/**
|
|
3366
3465
|
* Increments the subscriber count for this poller. If it becomes > 0, the
|
|
3367
3466
|
* poller will be enabled.
|
|
@@ -3414,17 +3513,14 @@ declare function makePoller(callback: (signal: AbortSignal) => Promise<void> | v
|
|
|
3414
3513
|
}): Poller;
|
|
3415
3514
|
|
|
3416
3515
|
declare const brand: unique symbol;
|
|
3417
|
-
|
|
3516
|
+
type Brand<T, TBrand extends string> = T & {
|
|
3418
3517
|
[brand]: TBrand;
|
|
3419
3518
|
};
|
|
3420
|
-
|
|
3519
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
3421
3520
|
/**
|
|
3422
3521
|
* Throw an error, but as an expression instead of a statement.
|
|
3423
3522
|
*/
|
|
3424
3523
|
declare function raise(msg: string): never;
|
|
3425
|
-
declare function isPlainObject(blob: unknown): blob is {
|
|
3426
|
-
[key: string]: unknown;
|
|
3427
|
-
};
|
|
3428
3524
|
/**
|
|
3429
3525
|
* Creates a new object by mapping a function over all values. Keys remain the
|
|
3430
3526
|
* same. Think Array.prototype.map(), but for values in an object.
|
|
@@ -3441,7 +3537,7 @@ declare function tryParseJson(rawMessage: string): Json | undefined;
|
|
|
3441
3537
|
* Decode base64 string.
|
|
3442
3538
|
*/
|
|
3443
3539
|
declare function b64decode(b64value: string): string;
|
|
3444
|
-
|
|
3540
|
+
type RemoveUndefinedValues<T> = {
|
|
3445
3541
|
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
3446
3542
|
};
|
|
3447
3543
|
/**
|
|
@@ -3518,7 +3614,7 @@ declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise
|
|
|
3518
3614
|
* A valid/verified "position" string. These values are used as "parentKey"s by
|
|
3519
3615
|
* LiveList children, and define their relative ordering.
|
|
3520
3616
|
*/
|
|
3521
|
-
|
|
3617
|
+
type Pos = Brand<string, "Pos">;
|
|
3522
3618
|
/**
|
|
3523
3619
|
* Given two positions, returns the position value that lies in the middle.
|
|
3524
3620
|
* When given only a high bound, computes the canonical position "before" it.
|
|
@@ -3588,13 +3684,8 @@ declare class SortedList<T> {
|
|
|
3588
3684
|
* nested objects are ordered.
|
|
3589
3685
|
*/
|
|
3590
3686
|
declare function stringify(value: unknown): string;
|
|
3591
|
-
/**
|
|
3592
|
-
* Like JSON.stringify(), but returns the same value no matter how keys in any
|
|
3593
|
-
* nested objects are ordered.
|
|
3594
|
-
*/
|
|
3595
|
-
declare function unstringify(value: string): unknown;
|
|
3596
3687
|
|
|
3597
|
-
|
|
3688
|
+
type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
3598
3689
|
/**
|
|
3599
3690
|
* Concatenates a path to an existing URL.
|
|
3600
3691
|
*/
|
|
@@ -3603,7 +3694,7 @@ declare function urljoin(baseUrl: string | URL, path: string, params?: QueryPara
|
|
|
3603
3694
|
* A string that is guaranteed to be URL safe (where all arguments are properly
|
|
3604
3695
|
* encoded), only obtainable as the result of using `url` template strings.
|
|
3605
3696
|
*/
|
|
3606
|
-
|
|
3697
|
+
type URLSafeString = Brand<string, "URLSafeString">;
|
|
3607
3698
|
/**
|
|
3608
3699
|
* Builds a URL where each "hole" in the template string will automatically be
|
|
3609
3700
|
* encodeURIComponent()-escaped, so it's impossible to build invalid URLs.
|
|
@@ -3613,7 +3704,7 @@ declare function url(strings: TemplateStringsArray, ...values: string[]): URLSaf
|
|
|
3613
3704
|
/**
|
|
3614
3705
|
* Definition of all messages the Panel can send to the Client.
|
|
3615
3706
|
*/
|
|
3616
|
-
|
|
3707
|
+
type PanelToClientMessage =
|
|
3617
3708
|
/**
|
|
3618
3709
|
* Initial message from the panel to the client, used for two purposes.
|
|
3619
3710
|
* 1. First, it’s eavesdropped by the background script, which uses this
|
|
@@ -3647,7 +3738,7 @@ declare type PanelToClientMessage =
|
|
|
3647
3738
|
/**
|
|
3648
3739
|
* Definition of all messages the Client can send to the Panel.
|
|
3649
3740
|
*/
|
|
3650
|
-
|
|
3741
|
+
type ClientToPanelMessage =
|
|
3651
3742
|
/**
|
|
3652
3743
|
* Initial message sent by the client to test if a dev panel is listening.
|
|
3653
3744
|
* This is necessary in cases where the dev panel is already opened and
|
|
@@ -3714,11 +3805,11 @@ declare type ClientToPanelMessage =
|
|
|
3714
3805
|
roomId: string;
|
|
3715
3806
|
update: YDocUpdateServerMsg | UpdateYDocClientMsg;
|
|
3716
3807
|
};
|
|
3717
|
-
|
|
3808
|
+
type FullPanelToClientMessage = PanelToClientMessage & {
|
|
3718
3809
|
source: "liveblocks-devtools-panel";
|
|
3719
3810
|
tabId: number;
|
|
3720
3811
|
};
|
|
3721
|
-
|
|
3812
|
+
type FullClientToPanelMessage = ClientToPanelMessage & {
|
|
3722
3813
|
source: "liveblocks-devtools-client";
|
|
3723
3814
|
};
|
|
3724
3815
|
|
|
@@ -3736,7 +3827,7 @@ declare namespace protocol {
|
|
|
3736
3827
|
* information, see
|
|
3737
3828
|
* https://liveblocks.io/docs/guides/limits#lson-constraint-and-interfaces
|
|
3738
3829
|
*/
|
|
3739
|
-
|
|
3830
|
+
type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson<I>)[] : [
|
|
3740
3831
|
unknown
|
|
3741
3832
|
] extends [T] ? Json | undefined : T extends Date ? string : T extends (...args: any[]) => any ? never : {
|
|
3742
3833
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
@@ -3747,4 +3838,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3747
3838
|
/** @deprecated Use HttpError instead. */
|
|
3748
3839
|
declare const NotificationsApiError: typeof HttpError;
|
|
3749
3840
|
|
|
3750
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, 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, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson,
|
|
3841
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, 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, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|