@liveblocks/core 3.13.0-vincent3 → 3.13.1-hackathon
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 +502 -322
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +331 -212
- package/dist/index.d.ts +331 -212
- package/dist/index.js +434 -254
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -331,6 +331,80 @@ type ContextualPromptContext = {
|
|
|
331
331
|
afterSelection: string;
|
|
332
332
|
};
|
|
333
333
|
|
|
334
|
+
declare const brand: unique symbol;
|
|
335
|
+
type Brand<T, TBrand extends string> = T & {
|
|
336
|
+
[brand]: TBrand;
|
|
337
|
+
};
|
|
338
|
+
type ISODateString = Brand<string, "ISODateString">;
|
|
339
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
340
|
+
type WithRequired<T, K extends keyof T> = T & {
|
|
341
|
+
[P in K]-?: T[P];
|
|
342
|
+
};
|
|
343
|
+
type WithOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
344
|
+
[P in K]?: T[P];
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Throw an error, but as an expression instead of a statement.
|
|
348
|
+
*/
|
|
349
|
+
declare function raise(msg: string): never;
|
|
350
|
+
/**
|
|
351
|
+
* Drop-in replacement for Object.entries() that retains better types.
|
|
352
|
+
*/
|
|
353
|
+
declare function entries<O extends {
|
|
354
|
+
[key: string]: unknown;
|
|
355
|
+
}, K extends keyof O>(obj: O): [K, O[K]][];
|
|
356
|
+
/**
|
|
357
|
+
* Drop-in replacement for Object.keys() that retains better types.
|
|
358
|
+
*/
|
|
359
|
+
declare function keys<O extends {
|
|
360
|
+
[key: string]: unknown;
|
|
361
|
+
}, K extends keyof O>(obj: O): K[];
|
|
362
|
+
/**
|
|
363
|
+
* Creates a new object by mapping a function over all values. Keys remain the
|
|
364
|
+
* same. Think Array.prototype.map(), but for values in an object.
|
|
365
|
+
*/
|
|
366
|
+
declare function mapValues<V, O extends Record<string, unknown>>(obj: O, mapFn: (value: O[keyof O], key: keyof O) => V): {
|
|
367
|
+
[K in keyof O]: V;
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Alternative to JSON.parse() that will not throw in production. If the passed
|
|
371
|
+
* string cannot be parsed, this will return `undefined`.
|
|
372
|
+
*/
|
|
373
|
+
declare function tryParseJson(rawMessage: string): Json | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* Decode base64 string.
|
|
376
|
+
*/
|
|
377
|
+
declare function b64decode(b64value: string): string;
|
|
378
|
+
type RemoveUndefinedValues<T> = {
|
|
379
|
+
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Returns a new object instance where all explictly-undefined values are
|
|
383
|
+
* removed.
|
|
384
|
+
*/
|
|
385
|
+
declare function compactObject<O extends Record<string, unknown>>(obj: O): RemoveUndefinedValues<O>;
|
|
386
|
+
/**
|
|
387
|
+
* Returns a promise that resolves after the given number of milliseconds.
|
|
388
|
+
*/
|
|
389
|
+
declare function wait(millis: number): Promise<void>;
|
|
390
|
+
/**
|
|
391
|
+
* Returns whatever the given promise returns, but will be rejected with
|
|
392
|
+
* a "Timed out" error if the given promise does not return or reject within
|
|
393
|
+
* the given timeout period (in milliseconds).
|
|
394
|
+
*/
|
|
395
|
+
declare function withTimeout<T>(promise: Promise<T>, millis: number, errmsg: string): Promise<T>;
|
|
396
|
+
/**
|
|
397
|
+
* Memoize a promise factory, so that each subsequent call will return the same
|
|
398
|
+
* pending or success promise. If the promise rejects, will retain that failed
|
|
399
|
+
* promise for a small time period, after which the next attempt will reset the
|
|
400
|
+
* memoized value.
|
|
401
|
+
*/
|
|
402
|
+
declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise<T>;
|
|
403
|
+
/**
|
|
404
|
+
* Polyfill for Array.prototype.findLastIndex()
|
|
405
|
+
*/
|
|
406
|
+
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
407
|
+
|
|
334
408
|
type OpCode = (typeof OpCode)[keyof typeof OpCode];
|
|
335
409
|
declare const OpCode: Readonly<{
|
|
336
410
|
INIT: 0;
|
|
@@ -358,7 +432,7 @@ declare namespace OpCode {
|
|
|
358
432
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
359
433
|
* only.
|
|
360
434
|
*/
|
|
361
|
-
type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp
|
|
435
|
+
type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
362
436
|
type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
363
437
|
type UpdateObjectOp = {
|
|
364
438
|
readonly opId?: string;
|
|
@@ -426,6 +500,24 @@ type DeleteObjectKeyOp = {
|
|
|
426
500
|
readonly type: OpCode.DELETE_OBJECT_KEY;
|
|
427
501
|
readonly key: string;
|
|
428
502
|
};
|
|
503
|
+
type HasOpId = {
|
|
504
|
+
opId: string;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Ops sent from client → server. Always includes an opId so the server can
|
|
508
|
+
* acknowledge the receipt.
|
|
509
|
+
*/
|
|
510
|
+
type ClientWireOp = Op & HasOpId;
|
|
511
|
+
/**
|
|
512
|
+
* ServerWireOp: Ops sent from server → client. Three variants:
|
|
513
|
+
* 1. ClientWireOp — Full echo back of our own op, confirming it was applied
|
|
514
|
+
* 2. AckOp — Our op was seen but intentionally ignored (still counts as ack)
|
|
515
|
+
* 3. Op without opId — Another client's op being forwarded to us
|
|
516
|
+
*/
|
|
517
|
+
type ServerWireOp = ClientWireOp | AckOp | TheirOp;
|
|
518
|
+
type TheirOp = DistributiveOmit<Op, "opId"> & {
|
|
519
|
+
opId?: undefined;
|
|
520
|
+
};
|
|
429
521
|
|
|
430
522
|
type ClientMsgCode = (typeof ClientMsgCode)[keyof typeof ClientMsgCode];
|
|
431
523
|
declare const ClientMsgCode: Readonly<{
|
|
@@ -435,6 +527,8 @@ declare const ClientMsgCode: Readonly<{
|
|
|
435
527
|
UPDATE_STORAGE: 201;
|
|
436
528
|
FETCH_YDOC: 300;
|
|
437
529
|
UPDATE_YDOC: 301;
|
|
530
|
+
FETCH_AGENT_SESSIONS: 500;
|
|
531
|
+
FETCH_AGENT_MESSAGES: 502;
|
|
438
532
|
}>;
|
|
439
533
|
declare namespace ClientMsgCode {
|
|
440
534
|
type UPDATE_PRESENCE = typeof ClientMsgCode.UPDATE_PRESENCE;
|
|
@@ -443,11 +537,13 @@ declare namespace ClientMsgCode {
|
|
|
443
537
|
type UPDATE_STORAGE = typeof ClientMsgCode.UPDATE_STORAGE;
|
|
444
538
|
type FETCH_YDOC = typeof ClientMsgCode.FETCH_YDOC;
|
|
445
539
|
type UPDATE_YDOC = typeof ClientMsgCode.UPDATE_YDOC;
|
|
540
|
+
type FETCH_AGENT_SESSIONS = typeof ClientMsgCode.FETCH_AGENT_SESSIONS;
|
|
541
|
+
type FETCH_AGENT_MESSAGES = typeof ClientMsgCode.FETCH_AGENT_MESSAGES;
|
|
446
542
|
}
|
|
447
543
|
/**
|
|
448
544
|
* Messages that can be sent from the client to the server.
|
|
449
545
|
*/
|
|
450
|
-
type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
|
|
546
|
+
type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg | FetchAgentSessionsClientMsg | FetchAgentMessagesClientMsg;
|
|
451
547
|
type BroadcastEventClientMsg<E extends Json> = {
|
|
452
548
|
type: ClientMsgCode.BROADCAST_EVENT;
|
|
453
549
|
event: E;
|
|
@@ -480,7 +576,7 @@ type UpdatePresenceClientMsg<P extends JsonObject> = {
|
|
|
480
576
|
};
|
|
481
577
|
type UpdateStorageClientMsg = {
|
|
482
578
|
readonly type: ClientMsgCode.UPDATE_STORAGE;
|
|
483
|
-
readonly ops:
|
|
579
|
+
readonly ops: ClientWireOp[];
|
|
484
580
|
};
|
|
485
581
|
type FetchStorageClientMsg = {
|
|
486
582
|
readonly type: ClientMsgCode.FETCH_STORAGE;
|
|
@@ -497,6 +593,20 @@ type UpdateYDocClientMsg = {
|
|
|
497
593
|
readonly guid?: string;
|
|
498
594
|
readonly v2?: boolean;
|
|
499
595
|
};
|
|
596
|
+
type FetchAgentSessionsClientMsg = {
|
|
597
|
+
readonly type: ClientMsgCode.FETCH_AGENT_SESSIONS;
|
|
598
|
+
readonly cursor?: string;
|
|
599
|
+
readonly since?: number;
|
|
600
|
+
readonly limit?: number;
|
|
601
|
+
readonly metadata?: Record<string, string>;
|
|
602
|
+
};
|
|
603
|
+
type FetchAgentMessagesClientMsg = {
|
|
604
|
+
readonly type: ClientMsgCode.FETCH_AGENT_MESSAGES;
|
|
605
|
+
readonly sessionId: string;
|
|
606
|
+
readonly cursor?: string;
|
|
607
|
+
readonly since?: number;
|
|
608
|
+
readonly limit?: number;
|
|
609
|
+
};
|
|
500
610
|
|
|
501
611
|
/**
|
|
502
612
|
* Represents an indefinitely deep arbitrary immutable data
|
|
@@ -590,7 +700,6 @@ declare namespace CrdtType {
|
|
|
590
700
|
}
|
|
591
701
|
type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
592
702
|
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
593
|
-
type NodeStream = Iterable<IdTuple<SerializedCrdt>>;
|
|
594
703
|
type SerializedRootObject = {
|
|
595
704
|
readonly type: CrdtType.OBJECT;
|
|
596
705
|
readonly data: JsonObject;
|
|
@@ -619,36 +728,6 @@ type SerializedRegister = {
|
|
|
619
728
|
readonly parentKey: string;
|
|
620
729
|
readonly data: Json;
|
|
621
730
|
};
|
|
622
|
-
type CompactNode = CompactRootNode | CompactChildNode;
|
|
623
|
-
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
|
|
624
|
-
type CompactRootNode = readonly [id: "root", data: JsonObject];
|
|
625
|
-
type CompactObjectNode = readonly [
|
|
626
|
-
id: string,
|
|
627
|
-
type: CrdtType.OBJECT,
|
|
628
|
-
parentId: string,
|
|
629
|
-
parentKey: string,
|
|
630
|
-
data: JsonObject
|
|
631
|
-
];
|
|
632
|
-
type CompactListNode = readonly [
|
|
633
|
-
id: string,
|
|
634
|
-
type: CrdtType.LIST,
|
|
635
|
-
parentId: string,
|
|
636
|
-
parentKey: string
|
|
637
|
-
];
|
|
638
|
-
type CompactMapNode = readonly [
|
|
639
|
-
id: string,
|
|
640
|
-
type: CrdtType.MAP,
|
|
641
|
-
parentId: string,
|
|
642
|
-
parentKey: string
|
|
643
|
-
];
|
|
644
|
-
type CompactRegisterNode = readonly [
|
|
645
|
-
id: string,
|
|
646
|
-
type: CrdtType.REGISTER,
|
|
647
|
-
parentId: string,
|
|
648
|
-
parentKey: string,
|
|
649
|
-
data: Json
|
|
650
|
-
];
|
|
651
|
-
declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
|
|
652
731
|
|
|
653
732
|
type LiveObjectUpdateDelta<O extends {
|
|
654
733
|
[key: string]: unknown;
|
|
@@ -682,7 +761,7 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
|
682
761
|
*/
|
|
683
762
|
static detectLargeObjects: boolean;
|
|
684
763
|
/** @private Do not use this API directly */
|
|
685
|
-
static _fromItems<O extends LsonObject>(
|
|
764
|
+
static _fromItems<O extends LsonObject>(items: IdTuple<SerializedCrdt>[], pool: ManagedPool): LiveObject<O>;
|
|
686
765
|
constructor(obj?: O);
|
|
687
766
|
/**
|
|
688
767
|
* Transform the LiveObject into a javascript object
|
|
@@ -838,7 +917,7 @@ interface ManagedPool {
|
|
|
838
917
|
* - Add reverse operations to the undo/redo stack
|
|
839
918
|
* - Notify room subscribers with updates (in-client, no networking)
|
|
840
919
|
*/
|
|
841
|
-
dispatch: (ops:
|
|
920
|
+
dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
|
|
842
921
|
/**
|
|
843
922
|
* Ensures storage can be written to else throws an error.
|
|
844
923
|
* This is used to prevent writing to storage when the user does not have
|
|
@@ -858,7 +937,7 @@ type CreateManagedPoolOptions = {
|
|
|
858
937
|
/**
|
|
859
938
|
* Will get invoked when any Live structure calls .dispatch() on the pool.
|
|
860
939
|
*/
|
|
861
|
-
onDispatch?: (ops:
|
|
940
|
+
onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
|
|
862
941
|
/**
|
|
863
942
|
* Will get invoked when any Live structure calls .assertStorageIsWritable()
|
|
864
943
|
* on the pool. Defaults to true when not provided. Return false if you want
|
|
@@ -1169,7 +1248,7 @@ declare global {
|
|
|
1169
1248
|
[key: string]: unknown;
|
|
1170
1249
|
}
|
|
1171
1250
|
}
|
|
1172
|
-
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1251
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "CommentMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1173
1252
|
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}`;
|
|
1174
1253
|
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1175
1254
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
@@ -1177,7 +1256,8 @@ type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
|
|
|
1177
1256
|
type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
|
|
1178
1257
|
type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
|
|
1179
1258
|
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1180
|
-
type
|
|
1259
|
+
type DTM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1260
|
+
type DCM = GetOverride<"CommentMetadata", BaseMetadata>;
|
|
1181
1261
|
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1182
1262
|
type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
|
|
1183
1263
|
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
@@ -1242,7 +1322,7 @@ type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
|
1242
1322
|
/**
|
|
1243
1323
|
* Represents a comment.
|
|
1244
1324
|
*/
|
|
1245
|
-
type CommentData = {
|
|
1325
|
+
type CommentData<CM extends BaseMetadata = DCM> = {
|
|
1246
1326
|
type: "comment";
|
|
1247
1327
|
id: string;
|
|
1248
1328
|
threadId: string;
|
|
@@ -1252,13 +1332,15 @@ type CommentData = {
|
|
|
1252
1332
|
editedAt?: Date;
|
|
1253
1333
|
reactions: CommentReaction[];
|
|
1254
1334
|
attachments: CommentAttachment[];
|
|
1335
|
+
metadata: CM;
|
|
1255
1336
|
} & Relax<{
|
|
1256
1337
|
body: CommentBody;
|
|
1257
1338
|
} | {
|
|
1258
1339
|
deletedAt: Date;
|
|
1259
1340
|
}>;
|
|
1260
|
-
type CommentDataPlain = Omit<DateToString<CommentData
|
|
1341
|
+
type CommentDataPlain<CM extends BaseMetadata = DCM> = Omit<DateToString<CommentData<CM>>, "reactions" | "body" | "metadata"> & {
|
|
1261
1342
|
reactions: DateToString<CommentReaction>[];
|
|
1343
|
+
metadata: CM;
|
|
1262
1344
|
} & Relax<{
|
|
1263
1345
|
body: CommentBody;
|
|
1264
1346
|
} | {
|
|
@@ -1288,13 +1370,15 @@ type CommentBodyLink = {
|
|
|
1288
1370
|
url: string;
|
|
1289
1371
|
text?: string;
|
|
1290
1372
|
};
|
|
1291
|
-
type CommentBodyText = {
|
|
1373
|
+
type CommentBodyText = Resolve<{
|
|
1292
1374
|
bold?: boolean;
|
|
1293
1375
|
italic?: boolean;
|
|
1294
1376
|
strikethrough?: boolean;
|
|
1295
1377
|
code?: boolean;
|
|
1296
1378
|
text: string;
|
|
1297
|
-
}
|
|
1379
|
+
} & {
|
|
1380
|
+
[K in Exclude<keyof Relax<CommentBodyMention | CommentBodyLink>, "text">]?: never;
|
|
1381
|
+
}>;
|
|
1298
1382
|
type CommentBody = {
|
|
1299
1383
|
version: 1;
|
|
1300
1384
|
content: CommentBodyBlockElement[];
|
|
@@ -1313,22 +1397,22 @@ type SearchCommentsResult = {
|
|
|
1313
1397
|
/**
|
|
1314
1398
|
* Represents a thread of comments.
|
|
1315
1399
|
*/
|
|
1316
|
-
type ThreadData<
|
|
1400
|
+
type ThreadData<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
|
|
1317
1401
|
type: "thread";
|
|
1318
1402
|
id: string;
|
|
1319
1403
|
roomId: string;
|
|
1320
1404
|
createdAt: Date;
|
|
1321
1405
|
updatedAt: Date;
|
|
1322
|
-
comments: CommentData[];
|
|
1323
|
-
metadata:
|
|
1406
|
+
comments: CommentData<CM>[];
|
|
1407
|
+
metadata: TM;
|
|
1324
1408
|
resolved: boolean;
|
|
1325
1409
|
};
|
|
1326
|
-
interface ThreadDataWithDeleteInfo<
|
|
1410
|
+
interface ThreadDataWithDeleteInfo<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> extends ThreadData<TM, CM> {
|
|
1327
1411
|
deletedAt?: Date;
|
|
1328
1412
|
}
|
|
1329
|
-
type ThreadDataPlain<
|
|
1330
|
-
comments: CommentDataPlain[];
|
|
1331
|
-
metadata:
|
|
1413
|
+
type ThreadDataPlain<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = Omit<DateToString<ThreadData<TM, CM>>, "comments" | "metadata"> & {
|
|
1414
|
+
comments: CommentDataPlain<CM>[];
|
|
1415
|
+
metadata: TM;
|
|
1332
1416
|
};
|
|
1333
1417
|
type ThreadDeleteInfo = {
|
|
1334
1418
|
type: "deletedThread";
|
|
@@ -1566,17 +1650,17 @@ type MakeOptionalFieldsNullable<T> = {
|
|
|
1566
1650
|
};
|
|
1567
1651
|
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1568
1652
|
|
|
1569
|
-
interface RoomHttpApi<
|
|
1653
|
+
interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
1570
1654
|
getThreads(options: {
|
|
1571
1655
|
roomId: string;
|
|
1572
1656
|
cursor?: string;
|
|
1573
1657
|
query?: {
|
|
1574
1658
|
resolved?: boolean;
|
|
1575
1659
|
subscribed?: boolean;
|
|
1576
|
-
metadata?: Partial<QueryMetadata<
|
|
1660
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
1577
1661
|
};
|
|
1578
1662
|
}): Promise<{
|
|
1579
|
-
threads: ThreadData<
|
|
1663
|
+
threads: ThreadData<TM, CM>[];
|
|
1580
1664
|
inboxNotifications: InboxNotificationData[];
|
|
1581
1665
|
subscriptions: SubscriptionData[];
|
|
1582
1666
|
requestedAt: Date;
|
|
@@ -1589,7 +1673,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1589
1673
|
signal?: AbortSignal;
|
|
1590
1674
|
}): Promise<{
|
|
1591
1675
|
threads: {
|
|
1592
|
-
updated: ThreadData<
|
|
1676
|
+
updated: ThreadData<TM, CM>[];
|
|
1593
1677
|
deleted: ThreadDeleteInfo[];
|
|
1594
1678
|
};
|
|
1595
1679
|
inboxNotifications: {
|
|
@@ -1606,7 +1690,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1606
1690
|
searchComments(options: {
|
|
1607
1691
|
roomId: string;
|
|
1608
1692
|
query: {
|
|
1609
|
-
threadMetadata?: Partial<QueryMetadata<
|
|
1693
|
+
threadMetadata?: Partial<QueryMetadata<TM>>;
|
|
1610
1694
|
threadResolved?: boolean;
|
|
1611
1695
|
hasAttachments?: boolean;
|
|
1612
1696
|
hasMentions?: boolean;
|
|
@@ -1617,19 +1701,20 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1617
1701
|
}): Promise<{
|
|
1618
1702
|
data: Array<SearchCommentsResult>;
|
|
1619
1703
|
}>;
|
|
1620
|
-
createThread({ roomId, metadata, body, commentId, threadId, attachmentIds, }: {
|
|
1704
|
+
createThread({ roomId, metadata, body, commentId, threadId, commentMetadata, attachmentIds, }: {
|
|
1621
1705
|
roomId: string;
|
|
1622
1706
|
threadId?: string;
|
|
1623
1707
|
commentId?: string;
|
|
1624
|
-
metadata:
|
|
1708
|
+
metadata: TM | undefined;
|
|
1709
|
+
commentMetadata: CM | undefined;
|
|
1625
1710
|
body: CommentBody;
|
|
1626
1711
|
attachmentIds?: string[];
|
|
1627
|
-
}): Promise<ThreadData<
|
|
1712
|
+
}): Promise<ThreadData<TM, CM>>;
|
|
1628
1713
|
getThread(options: {
|
|
1629
1714
|
roomId: string;
|
|
1630
1715
|
threadId: string;
|
|
1631
1716
|
}): Promise<{
|
|
1632
|
-
thread?: ThreadData<
|
|
1717
|
+
thread?: ThreadData<TM, CM>;
|
|
1633
1718
|
inboxNotification?: InboxNotificationData;
|
|
1634
1719
|
subscription?: SubscriptionData;
|
|
1635
1720
|
}>;
|
|
@@ -1639,23 +1724,31 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1639
1724
|
}): Promise<void>;
|
|
1640
1725
|
editThreadMetadata({ roomId, metadata, threadId, }: {
|
|
1641
1726
|
roomId: string;
|
|
1642
|
-
metadata: Patchable<
|
|
1727
|
+
metadata: Patchable<TM>;
|
|
1728
|
+
threadId: string;
|
|
1729
|
+
}): Promise<TM>;
|
|
1730
|
+
editCommentMetadata({ roomId, threadId, commentId, metadata, }: {
|
|
1731
|
+
roomId: string;
|
|
1643
1732
|
threadId: string;
|
|
1644
|
-
|
|
1645
|
-
|
|
1733
|
+
commentId: string;
|
|
1734
|
+
metadata: Patchable<CM>;
|
|
1735
|
+
}): Promise<CM>;
|
|
1736
|
+
createComment({ roomId, threadId, commentId, body, metadata, attachmentIds, }: {
|
|
1646
1737
|
roomId: string;
|
|
1647
1738
|
threadId: string;
|
|
1648
1739
|
commentId?: string;
|
|
1649
1740
|
body: CommentBody;
|
|
1741
|
+
metadata?: CM;
|
|
1650
1742
|
attachmentIds?: string[];
|
|
1651
|
-
}): Promise<CommentData
|
|
1652
|
-
editComment({ roomId, threadId, commentId, body, attachmentIds, }: {
|
|
1743
|
+
}): Promise<CommentData<CM>>;
|
|
1744
|
+
editComment({ roomId, threadId, commentId, body, attachmentIds, metadata, }: {
|
|
1653
1745
|
roomId: string;
|
|
1654
1746
|
threadId: string;
|
|
1655
1747
|
commentId: string;
|
|
1656
1748
|
body: CommentBody;
|
|
1657
1749
|
attachmentIds?: string[];
|
|
1658
|
-
|
|
1750
|
+
metadata?: Patchable<CM>;
|
|
1751
|
+
}): Promise<CommentData<CM>>;
|
|
1659
1752
|
deleteComment({ roomId, threadId, commentId, }: {
|
|
1660
1753
|
roomId: string;
|
|
1661
1754
|
threadId: string;
|
|
@@ -1793,7 +1886,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1793
1886
|
signal: AbortSignal;
|
|
1794
1887
|
}): Promise<string>;
|
|
1795
1888
|
}
|
|
1796
|
-
interface NotificationHttpApi<
|
|
1889
|
+
interface NotificationHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
1797
1890
|
getInboxNotifications(options?: {
|
|
1798
1891
|
cursor?: string;
|
|
1799
1892
|
query?: {
|
|
@@ -1802,7 +1895,7 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
1802
1895
|
};
|
|
1803
1896
|
}): Promise<{
|
|
1804
1897
|
inboxNotifications: InboxNotificationData[];
|
|
1805
|
-
threads: ThreadData<
|
|
1898
|
+
threads: ThreadData<TM, CM>[];
|
|
1806
1899
|
subscriptions: SubscriptionData[];
|
|
1807
1900
|
nextCursor: string | null;
|
|
1808
1901
|
requestedAt: Date;
|
|
@@ -1820,7 +1913,7 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
1820
1913
|
deleted: InboxNotificationDeleteInfo[];
|
|
1821
1914
|
};
|
|
1822
1915
|
threads: {
|
|
1823
|
-
updated: ThreadData<
|
|
1916
|
+
updated: ThreadData<TM, CM>[];
|
|
1824
1917
|
deleted: ThreadDeleteInfo[];
|
|
1825
1918
|
};
|
|
1826
1919
|
subscriptions: {
|
|
@@ -1845,16 +1938,16 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
1845
1938
|
}): Promise<NotificationSettingsPlain>;
|
|
1846
1939
|
updateNotificationSettings(settings: PartialNotificationSettings): Promise<NotificationSettingsPlain>;
|
|
1847
1940
|
}
|
|
1848
|
-
interface LiveblocksHttpApi<
|
|
1941
|
+
interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> extends RoomHttpApi<TM, CM>, NotificationHttpApi<TM, CM> {
|
|
1849
1942
|
getUrlMetadata(url: string): Promise<UrlMetadata>;
|
|
1850
1943
|
getUserThreads_experimental(options?: {
|
|
1851
1944
|
cursor?: string;
|
|
1852
1945
|
query?: {
|
|
1853
1946
|
resolved?: boolean;
|
|
1854
|
-
metadata?: Partial<QueryMetadata<
|
|
1947
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
1855
1948
|
};
|
|
1856
1949
|
}): Promise<{
|
|
1857
|
-
threads: ThreadData<
|
|
1950
|
+
threads: ThreadData<TM, CM>[];
|
|
1858
1951
|
inboxNotifications: InboxNotificationData[];
|
|
1859
1952
|
subscriptions: SubscriptionData[];
|
|
1860
1953
|
nextCursor: string | null;
|
|
@@ -1870,7 +1963,7 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
1870
1963
|
deleted: InboxNotificationDeleteInfo[];
|
|
1871
1964
|
};
|
|
1872
1965
|
threads: {
|
|
1873
|
-
updated: ThreadData<
|
|
1966
|
+
updated: ThreadData<TM, CM>[];
|
|
1874
1967
|
deleted: ThreadDeleteInfo[];
|
|
1875
1968
|
};
|
|
1876
1969
|
subscriptions: {
|
|
@@ -1930,6 +2023,7 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1930
2023
|
commentId: string;
|
|
1931
2024
|
body: CommentBody;
|
|
1932
2025
|
metadata: BaseMetadata;
|
|
2026
|
+
commentMetadata: BaseMetadata;
|
|
1933
2027
|
} | {
|
|
1934
2028
|
type: "DELETE_THREAD_ERROR";
|
|
1935
2029
|
roomId: string;
|
|
@@ -1939,6 +2033,12 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1939
2033
|
roomId: string;
|
|
1940
2034
|
threadId: string;
|
|
1941
2035
|
metadata: Patchable<BaseMetadata>;
|
|
2036
|
+
} | {
|
|
2037
|
+
type: "EDIT_COMMENT_METADATA_ERROR";
|
|
2038
|
+
roomId: string;
|
|
2039
|
+
threadId: string;
|
|
2040
|
+
commentId: string;
|
|
2041
|
+
metadata: Patchable<BaseMetadata>;
|
|
1942
2042
|
} | {
|
|
1943
2043
|
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR" | "SUBSCRIBE_TO_THREAD_ERROR" | "UNSUBSCRIBE_FROM_THREAD_ERROR";
|
|
1944
2044
|
roomId: string;
|
|
@@ -1949,6 +2049,7 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1949
2049
|
threadId: string;
|
|
1950
2050
|
commentId: string;
|
|
1951
2051
|
body: CommentBody;
|
|
2052
|
+
metadata: BaseMetadata;
|
|
1952
2053
|
} | {
|
|
1953
2054
|
type: "DELETE_COMMENT_ERROR";
|
|
1954
2055
|
roomId: string;
|
|
@@ -2059,7 +2160,7 @@ type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2059
2160
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2060
2161
|
* will probably happen if you do.
|
|
2061
2162
|
*/
|
|
2062
|
-
type PrivateClientApi<U extends BaseUserMeta,
|
|
2163
|
+
type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
2063
2164
|
readonly currentUserId: Signal<string | undefined>;
|
|
2064
2165
|
readonly mentionSuggestionsCache: Map<string, MentionData[]>;
|
|
2065
2166
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
@@ -2067,13 +2168,13 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
2067
2168
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
2068
2169
|
readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
|
|
2069
2170
|
readonly getRoomIds: () => string[];
|
|
2070
|
-
readonly httpClient: LiveblocksHttpApi<
|
|
2071
|
-
as<
|
|
2171
|
+
readonly httpClient: LiveblocksHttpApi<TM, CM>;
|
|
2172
|
+
as<TM2 extends BaseMetadata, CM2 extends BaseMetadata>(): Client<U, TM2, CM2>;
|
|
2072
2173
|
createSyncSource(): SyncSource;
|
|
2073
2174
|
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2074
2175
|
ai: Ai;
|
|
2075
2176
|
};
|
|
2076
|
-
type NotificationsApi<
|
|
2177
|
+
type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
2077
2178
|
/**
|
|
2078
2179
|
* Gets a page (or the initial page) for user inbox notifications and their
|
|
2079
2180
|
* associated threads and thread subscriptions.
|
|
@@ -2100,7 +2201,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2100
2201
|
};
|
|
2101
2202
|
}): Promise<{
|
|
2102
2203
|
inboxNotifications: InboxNotificationData[];
|
|
2103
|
-
threads: ThreadData<
|
|
2204
|
+
threads: ThreadData<TM, CM>[];
|
|
2104
2205
|
subscriptions: SubscriptionData[];
|
|
2105
2206
|
nextCursor: string | null;
|
|
2106
2207
|
requestedAt: Date;
|
|
@@ -2141,7 +2242,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2141
2242
|
deleted: InboxNotificationDeleteInfo[];
|
|
2142
2243
|
};
|
|
2143
2244
|
threads: {
|
|
2144
|
-
updated: ThreadData<
|
|
2245
|
+
updated: ThreadData<TM, CM>[];
|
|
2145
2246
|
deleted: ThreadDeleteInfo[];
|
|
2146
2247
|
};
|
|
2147
2248
|
subscriptions: {
|
|
@@ -2221,23 +2322,23 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2221
2322
|
* narrower.
|
|
2222
2323
|
*/
|
|
2223
2324
|
type OpaqueClient = Client<BaseUserMeta>;
|
|
2224
|
-
type Client<U extends BaseUserMeta = DU,
|
|
2325
|
+
type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
|
|
2225
2326
|
/**
|
|
2226
2327
|
* Gets a room. Returns null if {@link Client.enter} has not been called previously.
|
|
2227
2328
|
*
|
|
2228
2329
|
* @param roomId The id of the room
|
|
2229
2330
|
*/
|
|
2230
|
-
getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE,
|
|
2331
|
+
getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM>(roomId: string): Room<P, S, U, E, TM2, CM2> | null;
|
|
2231
2332
|
/**
|
|
2232
2333
|
* Enter a room.
|
|
2233
2334
|
* @param roomId The id of the room
|
|
2234
2335
|
* @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
|
|
2235
2336
|
* @returns The room and a leave function. Call the returned leave() function when you no longer need the room.
|
|
2236
2337
|
*/
|
|
2237
|
-
enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE,
|
|
2338
|
+
enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM>(roomId: string, ...args: OptionalTupleUnless<P & S, [
|
|
2238
2339
|
options: EnterOptions<NoInfr<P>, NoInfr<S>>
|
|
2239
2340
|
]>): {
|
|
2240
|
-
room: Room<P, S, U, E,
|
|
2341
|
+
room: Room<P, S, U, E, TM2, CM2>;
|
|
2241
2342
|
leave: () => void;
|
|
2242
2343
|
};
|
|
2243
2344
|
/**
|
|
@@ -2303,7 +2404,7 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2303
2404
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2304
2405
|
* will probably happen if you do.
|
|
2305
2406
|
*/
|
|
2306
|
-
readonly [kInternal]: PrivateClientApi<U,
|
|
2407
|
+
readonly [kInternal]: PrivateClientApi<U, TM, CM>;
|
|
2307
2408
|
/**
|
|
2308
2409
|
* Returns the current global sync status of the Liveblocks client. If any
|
|
2309
2410
|
* part of Liveblocks has any local pending changes that haven't been
|
|
@@ -2327,7 +2428,7 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2327
2428
|
readonly error: Observable<LiveblocksError>;
|
|
2328
2429
|
readonly syncStatus: Observable<void>;
|
|
2329
2430
|
};
|
|
2330
|
-
} & NotificationsApi<
|
|
2431
|
+
} & NotificationsApi<TM, CM>;
|
|
2331
2432
|
type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2332
2433
|
/**
|
|
2333
2434
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
@@ -2514,6 +2615,17 @@ type Delegates<T extends BaseAuthResult> = {
|
|
|
2514
2615
|
canZombie: () => boolean;
|
|
2515
2616
|
};
|
|
2516
2617
|
|
|
2618
|
+
type AgentSession = {
|
|
2619
|
+
sessionId: string;
|
|
2620
|
+
metadata: Json;
|
|
2621
|
+
timestamp: number;
|
|
2622
|
+
};
|
|
2623
|
+
type AgentMessage = {
|
|
2624
|
+
id: string;
|
|
2625
|
+
timestamp: number;
|
|
2626
|
+
data: Json;
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2517
2629
|
type ServerMsgCode = (typeof ServerMsgCode)[keyof typeof ServerMsgCode];
|
|
2518
2630
|
declare const ServerMsgCode: Readonly<{
|
|
2519
2631
|
UPDATE_PRESENCE: 100;
|
|
@@ -2521,9 +2633,7 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2521
2633
|
USER_LEFT: 102;
|
|
2522
2634
|
BROADCASTED_EVENT: 103;
|
|
2523
2635
|
ROOM_STATE: 104;
|
|
2524
|
-
|
|
2525
|
-
STORAGE_CHUNK: 210;
|
|
2526
|
-
STORAGE_STREAM_END: 211;
|
|
2636
|
+
STORAGE_STATE: 200;
|
|
2527
2637
|
UPDATE_STORAGE: 201;
|
|
2528
2638
|
UPDATE_YDOC: 300;
|
|
2529
2639
|
THREAD_CREATED: 400;
|
|
@@ -2535,6 +2645,9 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2535
2645
|
COMMENT_DELETED: 404;
|
|
2536
2646
|
COMMENT_REACTION_ADDED: 405;
|
|
2537
2647
|
COMMENT_REACTION_REMOVED: 406;
|
|
2648
|
+
COMMENT_METADATA_UPDATED: 409;
|
|
2649
|
+
AGENT_SESSIONS: 501;
|
|
2650
|
+
AGENT_MESSAGES: 503;
|
|
2538
2651
|
REJECT_STORAGE_OP: 299;
|
|
2539
2652
|
}>;
|
|
2540
2653
|
declare namespace ServerMsgCode {
|
|
@@ -2543,9 +2656,7 @@ declare namespace ServerMsgCode {
|
|
|
2543
2656
|
type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
|
|
2544
2657
|
type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
|
|
2545
2658
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2546
|
-
type
|
|
2547
|
-
type STORAGE_CHUNK = typeof ServerMsgCode.STORAGE_CHUNK;
|
|
2548
|
-
type STORAGE_STREAM_END = typeof ServerMsgCode.STORAGE_STREAM_END;
|
|
2659
|
+
type STORAGE_STATE = typeof ServerMsgCode.STORAGE_STATE;
|
|
2549
2660
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2550
2661
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2551
2662
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
@@ -2557,13 +2668,16 @@ declare namespace ServerMsgCode {
|
|
|
2557
2668
|
type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
|
|
2558
2669
|
type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
|
|
2559
2670
|
type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
|
|
2671
|
+
type AGENT_SESSIONS = typeof ServerMsgCode.AGENT_SESSIONS;
|
|
2672
|
+
type AGENT_MESSAGES = typeof ServerMsgCode.AGENT_MESSAGES;
|
|
2673
|
+
type COMMENT_METADATA_UPDATED = typeof ServerMsgCode.COMMENT_METADATA_UPDATED;
|
|
2560
2674
|
type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
|
|
2561
2675
|
}
|
|
2562
2676
|
/**
|
|
2563
2677
|
* Messages that can be sent from the server to the client.
|
|
2564
2678
|
*/
|
|
2565
|
-
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> |
|
|
2566
|
-
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2679
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg | AgentSessionsServerMsg | AgentMessagesServerMsg;
|
|
2680
|
+
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent;
|
|
2567
2681
|
type ThreadCreatedEvent = {
|
|
2568
2682
|
type: ServerMsgCode.THREAD_CREATED;
|
|
2569
2683
|
threadId: string;
|
|
@@ -2607,6 +2721,11 @@ type CommentReactionRemoved = {
|
|
|
2607
2721
|
commentId: string;
|
|
2608
2722
|
emoji: string;
|
|
2609
2723
|
};
|
|
2724
|
+
type CommentMetadataUpdatedEvent = {
|
|
2725
|
+
type: ServerMsgCode.COMMENT_METADATA_UPDATED;
|
|
2726
|
+
threadId: string;
|
|
2727
|
+
commentId: string;
|
|
2728
|
+
};
|
|
2610
2729
|
/**
|
|
2611
2730
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2612
2731
|
* a User updated their presence. For example, when a user moves their cursor.
|
|
@@ -2726,46 +2845,39 @@ type BroadcastedEventServerMsg<E extends Json> = {
|
|
|
2726
2845
|
*/
|
|
2727
2846
|
type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
2728
2847
|
readonly type: ServerMsgCode.ROOM_STATE;
|
|
2729
|
-
/**
|
|
2848
|
+
/**
|
|
2849
|
+
* Informs the client what their actor ID is going to be.
|
|
2850
|
+
* @since v1.2 (WS API v7)
|
|
2851
|
+
*/
|
|
2730
2852
|
readonly actor: number;
|
|
2731
|
-
/**
|
|
2853
|
+
/**
|
|
2854
|
+
* Secure nonce for the current session.
|
|
2855
|
+
* @since v1.2 (WS API v7)
|
|
2856
|
+
*/
|
|
2732
2857
|
readonly nonce: string;
|
|
2733
|
-
/**
|
|
2858
|
+
/**
|
|
2859
|
+
* Informs the client what permissions the current User (self) has.
|
|
2860
|
+
* @since v1.2 (WS API v7)
|
|
2861
|
+
*/
|
|
2734
2862
|
readonly scopes: string[];
|
|
2735
2863
|
readonly users: {
|
|
2736
2864
|
readonly [otherActor: number]: U & {
|
|
2737
2865
|
scopes: string[];
|
|
2738
2866
|
};
|
|
2739
2867
|
};
|
|
2740
|
-
/**
|
|
2868
|
+
/**
|
|
2869
|
+
* Metadata sent from the server to the client.
|
|
2870
|
+
*/
|
|
2741
2871
|
readonly meta: JsonObject;
|
|
2742
2872
|
};
|
|
2743
|
-
/**
|
|
2744
|
-
* No longer used as of WS API v8.
|
|
2745
|
-
*/
|
|
2746
|
-
type StorageStateServerMsg_V7 = {
|
|
2747
|
-
readonly type: ServerMsgCode.STORAGE_STATE_V7;
|
|
2748
|
-
readonly items: IdTuple<SerializedCrdt>[];
|
|
2749
|
-
};
|
|
2750
2873
|
/**
|
|
2751
2874
|
* Sent by the WebSocket server to a single client in response to the client
|
|
2752
|
-
* sending a FetchStorageClientMsg message, to provide
|
|
2753
|
-
*
|
|
2754
|
-
*
|
|
2755
|
-
* The server will respond with 1+ STORAGE_CHUNK messages, followed by exactly
|
|
2756
|
-
* one STORAGE_STREAM_END message to mark the end of the transmission.
|
|
2757
|
-
*
|
|
2758
|
-
* If the room is using the new storage engine that supports streaming, then
|
|
2759
|
-
* potentially multiple chunks might get sent. If the room is using the old
|
|
2760
|
-
* storage engine, then all nodes will be sent in a single/large chunk
|
|
2761
|
-
* (non-streaming).
|
|
2875
|
+
* sending a FetchStorageClientMsg message, to provide the initial Storage
|
|
2876
|
+
* state of the Room. The payload includes the entire Storage document.
|
|
2762
2877
|
*/
|
|
2763
|
-
type
|
|
2764
|
-
readonly type: ServerMsgCode.
|
|
2765
|
-
readonly
|
|
2766
|
-
};
|
|
2767
|
-
type StorageEndServerMsg = {
|
|
2768
|
-
readonly type: ServerMsgCode.STORAGE_STREAM_END;
|
|
2878
|
+
type StorageStateServerMsg = {
|
|
2879
|
+
readonly type: ServerMsgCode.STORAGE_STATE;
|
|
2880
|
+
readonly items: IdTuple<SerializedCrdt>[];
|
|
2769
2881
|
};
|
|
2770
2882
|
/**
|
|
2771
2883
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
@@ -2776,7 +2888,7 @@ type StorageEndServerMsg = {
|
|
|
2776
2888
|
*/
|
|
2777
2889
|
type UpdateStorageServerMsg = {
|
|
2778
2890
|
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
2779
|
-
readonly ops:
|
|
2891
|
+
readonly ops: ServerWireOp[];
|
|
2780
2892
|
};
|
|
2781
2893
|
/**
|
|
2782
2894
|
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
@@ -2788,6 +2900,19 @@ type RejectedStorageOpServerMsg = {
|
|
|
2788
2900
|
readonly opIds: string[];
|
|
2789
2901
|
readonly reason: string;
|
|
2790
2902
|
};
|
|
2903
|
+
type AgentSessionsServerMsg = {
|
|
2904
|
+
readonly type: ServerMsgCode.AGENT_SESSIONS;
|
|
2905
|
+
readonly sessions: AgentSession[];
|
|
2906
|
+
readonly nextCursor?: string;
|
|
2907
|
+
readonly operation: "list" | "added" | "updated" | "deleted";
|
|
2908
|
+
};
|
|
2909
|
+
type AgentMessagesServerMsg = {
|
|
2910
|
+
readonly type: ServerMsgCode.AGENT_MESSAGES;
|
|
2911
|
+
readonly sessionId: string;
|
|
2912
|
+
readonly messages: AgentMessage[];
|
|
2913
|
+
readonly nextCursor?: string;
|
|
2914
|
+
readonly operation: "list" | "added" | "updated" | "deleted";
|
|
2915
|
+
};
|
|
2791
2916
|
|
|
2792
2917
|
type HistoryVersion = {
|
|
2793
2918
|
type: "historyVersion";
|
|
@@ -3095,12 +3220,12 @@ type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U extends B
|
|
|
3095
3220
|
(type: "storage-status", listener: Callback<StorageStatus>): () => void;
|
|
3096
3221
|
(type: "comments", listener: Callback<CommentsEventServerMsg>): () => void;
|
|
3097
3222
|
};
|
|
3098
|
-
type GetThreadsOptions<
|
|
3223
|
+
type GetThreadsOptions<TM extends BaseMetadata> = {
|
|
3099
3224
|
cursor?: string;
|
|
3100
3225
|
query?: {
|
|
3101
3226
|
resolved?: boolean;
|
|
3102
3227
|
subscribed?: boolean;
|
|
3103
|
-
metadata?: Partial<QueryMetadata<
|
|
3228
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
3104
3229
|
};
|
|
3105
3230
|
};
|
|
3106
3231
|
type GetThreadsSinceOptions = {
|
|
@@ -3123,7 +3248,7 @@ type GetSubscriptionSettingsOptions = {
|
|
|
3123
3248
|
* a Room instance using globally augmented types only, which is narrower.
|
|
3124
3249
|
*/
|
|
3125
3250
|
type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
|
|
3126
|
-
type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE,
|
|
3251
|
+
type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
|
|
3127
3252
|
/**
|
|
3128
3253
|
* @private
|
|
3129
3254
|
*
|
|
@@ -3196,6 +3321,29 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3196
3321
|
* Sends a request for the current document from liveblocks server
|
|
3197
3322
|
*/
|
|
3198
3323
|
fetchYDoc(stateVector: string, guid?: string, isV2?: boolean): void;
|
|
3324
|
+
/**
|
|
3325
|
+
* Fetches agent sessions for the room.
|
|
3326
|
+
*/
|
|
3327
|
+
fetchAgentSessions(options?: {
|
|
3328
|
+
cursor?: string;
|
|
3329
|
+
since?: number;
|
|
3330
|
+
limit?: number;
|
|
3331
|
+
metadata?: Record<string, string>;
|
|
3332
|
+
}): Promise<{
|
|
3333
|
+
sessions: AgentSession[];
|
|
3334
|
+
nextCursor?: string;
|
|
3335
|
+
}>;
|
|
3336
|
+
/**
|
|
3337
|
+
* Fetches agent messages for a specific session.
|
|
3338
|
+
*/
|
|
3339
|
+
fetchAgentMessages(sessionId: string, options?: {
|
|
3340
|
+
cursor?: string;
|
|
3341
|
+
since?: number;
|
|
3342
|
+
limit?: number;
|
|
3343
|
+
}): Promise<{
|
|
3344
|
+
messages: AgentMessage[];
|
|
3345
|
+
nextCursor?: string;
|
|
3346
|
+
}>;
|
|
3199
3347
|
/**
|
|
3200
3348
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
3201
3349
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -3254,6 +3402,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3254
3402
|
readonly storageStatus: Observable<StorageStatus>;
|
|
3255
3403
|
readonly ydoc: Observable<YDocUpdateServerMsg | UpdateYDocClientMsg>;
|
|
3256
3404
|
readonly comments: Observable<CommentsEventServerMsg>;
|
|
3405
|
+
readonly agentSessions: Observable<AgentSessionsServerMsg | AgentMessagesServerMsg>;
|
|
3257
3406
|
/**
|
|
3258
3407
|
* Called right before the room is destroyed. The event cannot be used to
|
|
3259
3408
|
* prevent the room from being destroyed, only to be informed that this is
|
|
@@ -3337,8 +3486,8 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3337
3486
|
* requestedAt
|
|
3338
3487
|
* } = await room.getThreads({ query: { resolved: false }});
|
|
3339
3488
|
*/
|
|
3340
|
-
getThreads(options?: GetThreadsOptions<
|
|
3341
|
-
threads: ThreadData<
|
|
3489
|
+
getThreads(options?: GetThreadsOptions<TM>): Promise<{
|
|
3490
|
+
threads: ThreadData<TM, CM>[];
|
|
3342
3491
|
inboxNotifications: InboxNotificationData[];
|
|
3343
3492
|
subscriptions: SubscriptionData[];
|
|
3344
3493
|
requestedAt: Date;
|
|
@@ -3355,7 +3504,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3355
3504
|
*/
|
|
3356
3505
|
getThreadsSince(options: GetThreadsSinceOptions): Promise<{
|
|
3357
3506
|
threads: {
|
|
3358
|
-
updated: ThreadData<
|
|
3507
|
+
updated: ThreadData<TM, CM>[];
|
|
3359
3508
|
deleted: ThreadDeleteInfo[];
|
|
3360
3509
|
};
|
|
3361
3510
|
inboxNotifications: {
|
|
@@ -3376,7 +3525,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3376
3525
|
* const { thread, inboxNotification, subscription } = await room.getThread("th_xxx");
|
|
3377
3526
|
*/
|
|
3378
3527
|
getThread(threadId: string): Promise<{
|
|
3379
|
-
thread?: ThreadData<
|
|
3528
|
+
thread?: ThreadData<TM, CM>;
|
|
3380
3529
|
inboxNotification?: InboxNotificationData;
|
|
3381
3530
|
subscription?: SubscriptionData;
|
|
3382
3531
|
}>;
|
|
@@ -3394,10 +3543,11 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3394
3543
|
createThread(options: {
|
|
3395
3544
|
threadId?: string;
|
|
3396
3545
|
commentId?: string;
|
|
3397
|
-
metadata:
|
|
3546
|
+
metadata: TM | undefined;
|
|
3398
3547
|
body: CommentBody;
|
|
3548
|
+
commentMetadata?: CM;
|
|
3399
3549
|
attachmentIds?: string[];
|
|
3400
|
-
}): Promise<ThreadData<
|
|
3550
|
+
}): Promise<ThreadData<TM, CM>>;
|
|
3401
3551
|
/**
|
|
3402
3552
|
* Deletes a thread.
|
|
3403
3553
|
*
|
|
@@ -3413,9 +3563,21 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3413
3563
|
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
3414
3564
|
*/
|
|
3415
3565
|
editThreadMetadata(options: {
|
|
3416
|
-
metadata: Patchable<
|
|
3566
|
+
metadata: Patchable<TM>;
|
|
3417
3567
|
threadId: string;
|
|
3418
|
-
}): Promise<
|
|
3568
|
+
}): Promise<TM>;
|
|
3569
|
+
/**
|
|
3570
|
+
* Edits a comment's metadata.
|
|
3571
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
3572
|
+
*
|
|
3573
|
+
* @example
|
|
3574
|
+
* await room.editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { tag: "important", externalId: 1234 } })
|
|
3575
|
+
*/
|
|
3576
|
+
editCommentMetadata(options: {
|
|
3577
|
+
threadId: string;
|
|
3578
|
+
commentId: string;
|
|
3579
|
+
metadata: Patchable<CM>;
|
|
3580
|
+
}): Promise<CM>;
|
|
3419
3581
|
/**
|
|
3420
3582
|
* Marks a thread as resolved.
|
|
3421
3583
|
*
|
|
@@ -3460,8 +3622,9 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3460
3622
|
threadId: string;
|
|
3461
3623
|
commentId?: string;
|
|
3462
3624
|
body: CommentBody;
|
|
3625
|
+
metadata?: CM;
|
|
3463
3626
|
attachmentIds?: string[];
|
|
3464
|
-
}): Promise<CommentData
|
|
3627
|
+
}): Promise<CommentData<CM>>;
|
|
3465
3628
|
/**
|
|
3466
3629
|
* Edits a comment.
|
|
3467
3630
|
*
|
|
@@ -3479,8 +3642,9 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3479
3642
|
threadId: string;
|
|
3480
3643
|
commentId: string;
|
|
3481
3644
|
body: CommentBody;
|
|
3645
|
+
metadata?: Patchable<CM>;
|
|
3482
3646
|
attachmentIds?: string[];
|
|
3483
|
-
}): Promise<CommentData
|
|
3647
|
+
}): Promise<CommentData<CM>>;
|
|
3484
3648
|
/**
|
|
3485
3649
|
* Deletes a comment.
|
|
3486
3650
|
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
@@ -3595,7 +3759,7 @@ interface SyncSource {
|
|
|
3595
3759
|
*/
|
|
3596
3760
|
type PrivateRoomApi = {
|
|
3597
3761
|
presenceBuffer: Json | undefined;
|
|
3598
|
-
undoStack: readonly (readonly Readonly<
|
|
3762
|
+
undoStack: readonly (readonly Readonly<Stackframe<JsonObject>>[])[];
|
|
3599
3763
|
nodeCount: number;
|
|
3600
3764
|
getYjsProvider(): IYjsProvider | undefined;
|
|
3601
3765
|
setYjsProvider(provider: IYjsProvider | undefined): void;
|
|
@@ -3630,7 +3794,8 @@ type PrivateRoomApi = {
|
|
|
3630
3794
|
};
|
|
3631
3795
|
attachmentUrlsStore: BatchStore<string, string>;
|
|
3632
3796
|
};
|
|
3633
|
-
type
|
|
3797
|
+
type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
|
|
3798
|
+
type PresenceStackframe<P extends JsonObject> = {
|
|
3634
3799
|
readonly type: "presence";
|
|
3635
3800
|
readonly data: P;
|
|
3636
3801
|
};
|
|
@@ -3673,80 +3838,6 @@ type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ?
|
|
|
3673
3838
|
] extends [never] ? OptionalTuple<T> : T;
|
|
3674
3839
|
type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
|
|
3675
3840
|
|
|
3676
|
-
declare const brand: unique symbol;
|
|
3677
|
-
type Brand<T, TBrand extends string> = T & {
|
|
3678
|
-
[brand]: TBrand;
|
|
3679
|
-
};
|
|
3680
|
-
type ISODateString = Brand<string, "ISODateString">;
|
|
3681
|
-
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
3682
|
-
type WithRequired<T, K extends keyof T> = T & {
|
|
3683
|
-
[P in K]-?: T[P];
|
|
3684
|
-
};
|
|
3685
|
-
type WithOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
3686
|
-
[P in K]?: T[P];
|
|
3687
|
-
};
|
|
3688
|
-
/**
|
|
3689
|
-
* Throw an error, but as an expression instead of a statement.
|
|
3690
|
-
*/
|
|
3691
|
-
declare function raise(msg: string): never;
|
|
3692
|
-
/**
|
|
3693
|
-
* Drop-in replacement for Object.entries() that retains better types.
|
|
3694
|
-
*/
|
|
3695
|
-
declare function entries<O extends {
|
|
3696
|
-
[key: string]: unknown;
|
|
3697
|
-
}, K extends keyof O>(obj: O): [K, O[K]][];
|
|
3698
|
-
/**
|
|
3699
|
-
* Drop-in replacement for Object.keys() that retains better types.
|
|
3700
|
-
*/
|
|
3701
|
-
declare function keys<O extends {
|
|
3702
|
-
[key: string]: unknown;
|
|
3703
|
-
}, K extends keyof O>(obj: O): K[];
|
|
3704
|
-
/**
|
|
3705
|
-
* Creates a new object by mapping a function over all values. Keys remain the
|
|
3706
|
-
* same. Think Array.prototype.map(), but for values in an object.
|
|
3707
|
-
*/
|
|
3708
|
-
declare function mapValues<V, O extends Record<string, unknown>>(obj: O, mapFn: (value: O[keyof O], key: keyof O) => V): {
|
|
3709
|
-
[K in keyof O]: V;
|
|
3710
|
-
};
|
|
3711
|
-
/**
|
|
3712
|
-
* Alternative to JSON.parse() that will not throw in production. If the passed
|
|
3713
|
-
* string cannot be parsed, this will return `undefined`.
|
|
3714
|
-
*/
|
|
3715
|
-
declare function tryParseJson(rawMessage: string): Json | undefined;
|
|
3716
|
-
/**
|
|
3717
|
-
* Decode base64 string.
|
|
3718
|
-
*/
|
|
3719
|
-
declare function b64decode(b64value: string): string;
|
|
3720
|
-
type RemoveUndefinedValues<T> = {
|
|
3721
|
-
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
3722
|
-
};
|
|
3723
|
-
/**
|
|
3724
|
-
* Returns a new object instance where all explictly-undefined values are
|
|
3725
|
-
* removed.
|
|
3726
|
-
*/
|
|
3727
|
-
declare function compactObject<O extends Record<string, unknown>>(obj: O): RemoveUndefinedValues<O>;
|
|
3728
|
-
/**
|
|
3729
|
-
* Returns a promise that resolves after the given number of milliseconds.
|
|
3730
|
-
*/
|
|
3731
|
-
declare function wait(millis: number): Promise<void>;
|
|
3732
|
-
/**
|
|
3733
|
-
* Returns whatever the given promise returns, but will be rejected with
|
|
3734
|
-
* a "Timed out" error if the given promise does not return or reject within
|
|
3735
|
-
* the given timeout period (in milliseconds).
|
|
3736
|
-
*/
|
|
3737
|
-
declare function withTimeout<T>(promise: Promise<T>, millis: number, errmsg: string): Promise<T>;
|
|
3738
|
-
/**
|
|
3739
|
-
* Memoize a promise factory, so that each subsequent call will return the same
|
|
3740
|
-
* pending or success promise. If the promise rejects, will retain that failed
|
|
3741
|
-
* promise for a small time period, after which the next attempt will reset the
|
|
3742
|
-
* memoized value.
|
|
3743
|
-
*/
|
|
3744
|
-
declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise<T>;
|
|
3745
|
-
/**
|
|
3746
|
-
* Polyfill for Array.prototype.findLastIndex()
|
|
3747
|
-
*/
|
|
3748
|
-
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
3749
|
-
|
|
3750
3841
|
type Cursor = Brand<string, "Cursor">;
|
|
3751
3842
|
type ChatId = string;
|
|
3752
3843
|
type MessageId = Brand<`ms_${string}`, "MessageId">;
|
|
@@ -4499,14 +4590,14 @@ declare const MENTION_CHARACTER = "@";
|
|
|
4499
4590
|
* @param data The plain comment data object (usually returned by the API)
|
|
4500
4591
|
* @returns The rich comment data object that can be used by the client.
|
|
4501
4592
|
*/
|
|
4502
|
-
declare function convertToCommentData(data: CommentDataPlain): CommentData
|
|
4593
|
+
declare function convertToCommentData<CM extends BaseMetadata>(data: CommentDataPlain<CM>): CommentData<CM>;
|
|
4503
4594
|
/**
|
|
4504
4595
|
* Converts a plain thread data object (usually returned by the API) to a thread data object that can be used by the client.
|
|
4505
4596
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
4506
4597
|
* @param data The plain thread data object (usually returned by the API)
|
|
4507
4598
|
* @returns The rich thread data object that can be used by the client.
|
|
4508
4599
|
*/
|
|
4509
|
-
declare function convertToThreadData<
|
|
4600
|
+
declare function convertToThreadData<TM extends BaseMetadata, CM extends BaseMetadata>(data: ThreadDataPlain<TM, CM>): ThreadData<TM, CM>;
|
|
4510
4601
|
/**
|
|
4511
4602
|
* Converts a plain comment reaction object (usually returned by the API) to a comment reaction object that can be used by the client.
|
|
4512
4603
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
@@ -5090,6 +5181,34 @@ declare function warnOnce(message: string, key?: string): void;
|
|
|
5090
5181
|
*/
|
|
5091
5182
|
declare function warnOnceIf(condition: boolean | (() => boolean), message: string, key?: string): void;
|
|
5092
5183
|
|
|
5184
|
+
/**
|
|
5185
|
+
* Generates operations to mutate an existing Live storage structure.
|
|
5186
|
+
*
|
|
5187
|
+
* This function attempts to merge mutation data into an existing Live structure,
|
|
5188
|
+
* preserving nested LiveObjects, LiveMaps, and LiveLists. For example, if you have
|
|
5189
|
+
* a LiveObject with a nested LiveObject (engine), and you pass a plain object
|
|
5190
|
+
* mutation, it will preserve the nested LiveObject structure and only update the
|
|
5191
|
+
* specified fields.
|
|
5192
|
+
*
|
|
5193
|
+
* @param nodes - The existing storage nodes as IdTuple<SerializedCrdt>[]
|
|
5194
|
+
* @param mutation - The mutation data (can be partial JSON or LSON)
|
|
5195
|
+
* @param actorId - Optional actor/connection ID to use for generating op IDs. Defaults to 1.
|
|
5196
|
+
* @returns Array of operations that can be applied to achieve the mutation
|
|
5197
|
+
*
|
|
5198
|
+
* @example
|
|
5199
|
+
* ```typescript
|
|
5200
|
+
* const nodes: IdTuple<SerializedCrdt>[] = [
|
|
5201
|
+
* ["0:0", { type: CrdtType.OBJECT, data: {} }],
|
|
5202
|
+
* ["0:1", { type: CrdtType.OBJECT, data: { displacement: 1 }, parentId: "0:0", parentKey: "engine" }]
|
|
5203
|
+
* ];
|
|
5204
|
+
*
|
|
5205
|
+
* const ops = generateOpsFromJson(nodes, {
|
|
5206
|
+
* engine: { displacement: 2 } // Preserves engine as LiveObject, only updates displacement
|
|
5207
|
+
* }, 42); // Use actor ID 42 for generated ops
|
|
5208
|
+
* ```
|
|
5209
|
+
*/
|
|
5210
|
+
declare function generateOpsFromJson<S extends LsonObject>(nodes: IdTuple<SerializedCrdt>[], mutation: Partial<S> | Json, actorId?: number): Op[];
|
|
5211
|
+
|
|
5093
5212
|
/**
|
|
5094
5213
|
* Definition of all messages the Panel can send to the Client.
|
|
5095
5214
|
*/
|
|
@@ -5222,4 +5341,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5222
5341
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5223
5342
|
};
|
|
5224
5343
|
|
|
5225
|
-
export { type AckOp, 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 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, type CommentsEventServerMsg, type
|
|
5344
|
+
export { type AckOp, type ActivityData, type AgentMessage, type AgentMessagesServerMsg, type AgentSession, type AgentSessionsServerMsg, 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 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 ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type 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 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 IdTuple, 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 LargeMessageStrategy, type LayerKey, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStateServerMsg, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateOpsFromJson, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isNumberOperator, isPlainObject, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
|