@liveblocks/node 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 +222 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -27
- package/dist/index.d.ts +202 -27
- package/dist/index.js +214 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, JsonObject, OptionalTupleUnless, PlainLsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, AgentSession, AgentMessage, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DTM, DCM, NotificationChannel } from '@liveblocks/core';
|
|
2
2
|
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -94,16 +94,29 @@ type Identity = {
|
|
|
94
94
|
type ThreadParticipants = {
|
|
95
95
|
participantIds: string[];
|
|
96
96
|
};
|
|
97
|
-
type CreateThreadOptions<
|
|
97
|
+
type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
98
98
|
roomId: string;
|
|
99
99
|
data: {
|
|
100
100
|
comment: {
|
|
101
101
|
userId: string;
|
|
102
102
|
createdAt?: Date;
|
|
103
103
|
body: CommentBody;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
} & PartialUnless<CM, {
|
|
105
|
+
metadata: CM;
|
|
106
|
+
}>;
|
|
107
|
+
} & PartialUnless<TM, {
|
|
108
|
+
metadata: TM;
|
|
109
|
+
}>;
|
|
110
|
+
};
|
|
111
|
+
type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
112
|
+
roomId: string;
|
|
113
|
+
threadId: string;
|
|
114
|
+
data: {
|
|
115
|
+
userId: string;
|
|
116
|
+
createdAt?: Date;
|
|
117
|
+
body: CommentBody;
|
|
118
|
+
} & PartialUnless<CM, {
|
|
119
|
+
metadata: CM;
|
|
107
120
|
}>;
|
|
108
121
|
};
|
|
109
122
|
type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"] | ["room:read", "room:presence:write", "comments:write"];
|
|
@@ -209,7 +222,8 @@ type MassMutateStorageOptions = MutateStorageOptions & {
|
|
|
209
222
|
concurrency?: number;
|
|
210
223
|
};
|
|
211
224
|
type E = DE;
|
|
212
|
-
type
|
|
225
|
+
type TM = DTM;
|
|
226
|
+
type CM = DCM;
|
|
213
227
|
type S = DS;
|
|
214
228
|
type U = DU;
|
|
215
229
|
type RoomsQueryCriteria = {
|
|
@@ -404,6 +418,22 @@ type GetWebKnowledgeSourceLinksOptions = {
|
|
|
404
418
|
copilotId: string;
|
|
405
419
|
knowledgeSourceId: string;
|
|
406
420
|
} & PaginationOptions;
|
|
421
|
+
type CreateAgentSessionOptions = {
|
|
422
|
+
sessionId: string;
|
|
423
|
+
metadata?: JsonObject;
|
|
424
|
+
timestamp?: number;
|
|
425
|
+
};
|
|
426
|
+
type UpdateAgentSessionOptions = {
|
|
427
|
+
metadata: JsonObject;
|
|
428
|
+
};
|
|
429
|
+
type CreateAgentMessageOptions = {
|
|
430
|
+
id?: string;
|
|
431
|
+
timestamp?: number;
|
|
432
|
+
data: JsonObject;
|
|
433
|
+
};
|
|
434
|
+
type UpdateAgentMessageOptions = {
|
|
435
|
+
data: JsonObject;
|
|
436
|
+
};
|
|
407
437
|
type KnowledgeSource = ({
|
|
408
438
|
type: "ai-knowledge-web-source";
|
|
409
439
|
link: {
|
|
@@ -727,11 +757,11 @@ declare class Liveblocks {
|
|
|
727
757
|
* ```
|
|
728
758
|
*/
|
|
729
759
|
query?: string | {
|
|
730
|
-
metadata?: Partial<QueryMetadata<
|
|
760
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
731
761
|
resolved?: boolean;
|
|
732
762
|
};
|
|
733
763
|
}, options?: RequestOptions): Promise<{
|
|
734
|
-
data: ThreadData<
|
|
764
|
+
data: ThreadData<TM, CM>[];
|
|
735
765
|
}>;
|
|
736
766
|
/**
|
|
737
767
|
* Gets a thread.
|
|
@@ -744,7 +774,7 @@ declare class Liveblocks {
|
|
|
744
774
|
getThread(params: {
|
|
745
775
|
roomId: string;
|
|
746
776
|
threadId: string;
|
|
747
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
777
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
748
778
|
/**
|
|
749
779
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
750
780
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -791,7 +821,7 @@ declare class Liveblocks {
|
|
|
791
821
|
roomId: string;
|
|
792
822
|
threadId: string;
|
|
793
823
|
commentId: string;
|
|
794
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
824
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
795
825
|
/**
|
|
796
826
|
* Creates a comment.
|
|
797
827
|
*
|
|
@@ -800,24 +830,18 @@ declare class Liveblocks {
|
|
|
800
830
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
801
831
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
802
832
|
* @param params.data.body The body of the comment.
|
|
833
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
803
834
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
804
835
|
* @returns The created comment.
|
|
805
836
|
*/
|
|
806
|
-
createComment(params:
|
|
807
|
-
roomId: string;
|
|
808
|
-
threadId: string;
|
|
809
|
-
data: {
|
|
810
|
-
userId: string;
|
|
811
|
-
createdAt?: Date;
|
|
812
|
-
body: CommentBody;
|
|
813
|
-
};
|
|
814
|
-
}, options?: RequestOptions): Promise<CommentData>;
|
|
837
|
+
createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
815
838
|
/**
|
|
816
839
|
* Edits a comment.
|
|
817
840
|
* @param params.roomId The room ID to edit the comment in.
|
|
818
841
|
* @param params.threadId The thread ID to edit the comment in.
|
|
819
842
|
* @param params.commentId The comment ID to edit.
|
|
820
843
|
* @param params.data.body The body of the comment.
|
|
844
|
+
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
821
845
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
822
846
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
823
847
|
* @returns The edited comment.
|
|
@@ -828,9 +852,10 @@ declare class Liveblocks {
|
|
|
828
852
|
commentId: string;
|
|
829
853
|
data: {
|
|
830
854
|
body: CommentBody;
|
|
855
|
+
metadata?: Patchable<CM>;
|
|
831
856
|
editedAt?: Date;
|
|
832
857
|
};
|
|
833
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
858
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
834
859
|
/**
|
|
835
860
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
836
861
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -851,10 +876,11 @@ declare class Liveblocks {
|
|
|
851
876
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
852
877
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
853
878
|
* @param params.thread.comment.body The body of the comment.
|
|
879
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
854
880
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
855
881
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
856
882
|
*/
|
|
857
|
-
createThread(params: CreateThreadOptions<
|
|
883
|
+
createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
858
884
|
/**
|
|
859
885
|
* Deletes a thread and all of its comments.
|
|
860
886
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -879,7 +905,7 @@ declare class Liveblocks {
|
|
|
879
905
|
data: {
|
|
880
906
|
userId: string;
|
|
881
907
|
};
|
|
882
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
908
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
883
909
|
/**
|
|
884
910
|
* Mark a thread as unresolved.
|
|
885
911
|
* @param params.roomId The room ID of the thread.
|
|
@@ -894,7 +920,7 @@ declare class Liveblocks {
|
|
|
894
920
|
data: {
|
|
895
921
|
userId: string;
|
|
896
922
|
};
|
|
897
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
923
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
898
924
|
/**
|
|
899
925
|
* Subscribes a user to a thread.
|
|
900
926
|
* @param params.roomId The room ID of the thread.
|
|
@@ -938,11 +964,32 @@ declare class Liveblocks {
|
|
|
938
964
|
roomId: string;
|
|
939
965
|
threadId: string;
|
|
940
966
|
data: {
|
|
941
|
-
metadata: Patchable<
|
|
967
|
+
metadata: Patchable<TM>;
|
|
942
968
|
userId: string;
|
|
943
969
|
updatedAt?: Date;
|
|
944
970
|
};
|
|
945
|
-
}, options?: RequestOptions): Promise<
|
|
971
|
+
}, options?: RequestOptions): Promise<TM>;
|
|
972
|
+
/**
|
|
973
|
+
* Updates the metadata of the specified comment in a room.
|
|
974
|
+
* @param params.roomId The room ID to update the comment in.
|
|
975
|
+
* @param params.threadId The thread ID to update the comment in.
|
|
976
|
+
* @param params.commentId The comment ID to update.
|
|
977
|
+
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
978
|
+
* @param params.data.userId The user ID of the user who updated the comment.
|
|
979
|
+
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
980
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
981
|
+
* @returns The updated comment metadata.
|
|
982
|
+
*/
|
|
983
|
+
editCommentMetadata(params: {
|
|
984
|
+
roomId: string;
|
|
985
|
+
threadId: string;
|
|
986
|
+
commentId: string;
|
|
987
|
+
data: {
|
|
988
|
+
metadata: Patchable<CM>;
|
|
989
|
+
userId: string;
|
|
990
|
+
updatedAt?: Date;
|
|
991
|
+
};
|
|
992
|
+
}, options?: RequestOptions): Promise<CM>;
|
|
946
993
|
/**
|
|
947
994
|
* Adds a new comment reaction to a comment.
|
|
948
995
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1341,6 +1388,115 @@ declare class Liveblocks {
|
|
|
1341
1388
|
* @returns A paginated list of web knowledge source links.
|
|
1342
1389
|
*/
|
|
1343
1390
|
getWebKnowledgeSourceLinks(params: GetWebKnowledgeSourceLinksOptions, options?: RequestOptions): Promise<Page<WebKnowledgeSourceLink>>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns a list of agent sessions in a room.
|
|
1393
|
+
* @param params.roomId The room ID to get the agent sessions from.
|
|
1394
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1395
|
+
* @returns A list of agent sessions.
|
|
1396
|
+
*/
|
|
1397
|
+
getAgentSessions(params: {
|
|
1398
|
+
roomId: string;
|
|
1399
|
+
}, options?: RequestOptions): Promise<{
|
|
1400
|
+
data: AgentSession[];
|
|
1401
|
+
}>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Creates a new agent session in a room.
|
|
1404
|
+
* @param params.roomId The room ID to create the agent session in.
|
|
1405
|
+
* @param params.sessionId The session ID for the agent session.
|
|
1406
|
+
* @param params.metadata (optional) The metadata for the agent session.
|
|
1407
|
+
* @param params.timestamp (optional) The timestamp for the agent session. If not provided, the current time will be used.
|
|
1408
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1409
|
+
* @returns The created agent session.
|
|
1410
|
+
*/
|
|
1411
|
+
createAgentSession(params: {
|
|
1412
|
+
roomId: string;
|
|
1413
|
+
} & CreateAgentSessionOptions, options?: RequestOptions): Promise<AgentSession>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Returns an agent session with the given id.
|
|
1416
|
+
* @param params.roomId The room ID to get the agent session from.
|
|
1417
|
+
* @param params.agentSessionId The agent session ID.
|
|
1418
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1419
|
+
* @returns The agent session.
|
|
1420
|
+
*/
|
|
1421
|
+
getAgentSession(params: {
|
|
1422
|
+
roomId: string;
|
|
1423
|
+
agentSessionId: string;
|
|
1424
|
+
}, options?: RequestOptions): Promise<AgentSession>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Updates the metadata of an agent session.
|
|
1427
|
+
* @param params.roomId The room ID to update the agent session in.
|
|
1428
|
+
* @param params.agentSessionId The agent session ID to update.
|
|
1429
|
+
* @param params.metadata The metadata for the agent session.
|
|
1430
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1431
|
+
* @returns The updated agent session.
|
|
1432
|
+
*/
|
|
1433
|
+
updateAgentSessionMetadata(params: {
|
|
1434
|
+
roomId: string;
|
|
1435
|
+
agentSessionId: string;
|
|
1436
|
+
} & UpdateAgentSessionOptions, options?: RequestOptions): Promise<AgentSession>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Deletes an agent session.
|
|
1439
|
+
* @param params.roomId The room ID to delete the agent session from.
|
|
1440
|
+
* @param params.agentSessionId The agent session ID to delete.
|
|
1441
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1442
|
+
*/
|
|
1443
|
+
deleteAgentSession(params: {
|
|
1444
|
+
roomId: string;
|
|
1445
|
+
agentSessionId: string;
|
|
1446
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns a list of agent messages in an agent session.
|
|
1449
|
+
* @param params.roomId The room ID to get the agent messages from.
|
|
1450
|
+
* @param params.agentSessionId The agent session ID to get the messages from.
|
|
1451
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1452
|
+
* @returns A list of agent messages.
|
|
1453
|
+
*/
|
|
1454
|
+
getAgentMessages(params: {
|
|
1455
|
+
roomId: string;
|
|
1456
|
+
agentSessionId: string;
|
|
1457
|
+
}, options?: RequestOptions): Promise<{
|
|
1458
|
+
data: AgentMessage[];
|
|
1459
|
+
}>;
|
|
1460
|
+
/**
|
|
1461
|
+
* Creates a new agent message in an agent session.
|
|
1462
|
+
* @param params.roomId The room ID to create the agent message in.
|
|
1463
|
+
* @param params.agentSessionId The agent session ID to create the message in.
|
|
1464
|
+
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
1465
|
+
* @param params.timestamp (optional) The message timestamp. If not provided, the current time will be used.
|
|
1466
|
+
* @param params.data The message data.
|
|
1467
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1468
|
+
* @returns The created agent message.
|
|
1469
|
+
*/
|
|
1470
|
+
createAgentMessage(params: {
|
|
1471
|
+
roomId: string;
|
|
1472
|
+
agentSessionId: string;
|
|
1473
|
+
} & CreateAgentMessageOptions, options?: RequestOptions): Promise<AgentMessage>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Updates an agent message.
|
|
1476
|
+
* @param params.roomId The room ID to update the agent message in.
|
|
1477
|
+
* @param params.agentSessionId The agent session ID to update the message in.
|
|
1478
|
+
* @param params.messageId The message ID to update.
|
|
1479
|
+
* @param params.data The message data.
|
|
1480
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1481
|
+
* @returns The updated agent message.
|
|
1482
|
+
*/
|
|
1483
|
+
updateAgentMessage(params: {
|
|
1484
|
+
roomId: string;
|
|
1485
|
+
agentSessionId: string;
|
|
1486
|
+
messageId: string;
|
|
1487
|
+
} & UpdateAgentMessageOptions, options?: RequestOptions): Promise<AgentMessage>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Deletes an agent message.
|
|
1490
|
+
* @param params.roomId The room ID to delete the agent message from.
|
|
1491
|
+
* @param params.agentSessionId The agent session ID to delete the message from.
|
|
1492
|
+
* @param params.messageId The message ID to delete.
|
|
1493
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1494
|
+
*/
|
|
1495
|
+
deleteAgentMessage(params: {
|
|
1496
|
+
roomId: string;
|
|
1497
|
+
agentSessionId: string;
|
|
1498
|
+
messageId: string;
|
|
1499
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1344
1500
|
}
|
|
1345
1501
|
declare class LiveblocksError extends Error {
|
|
1346
1502
|
readonly status: number;
|
|
@@ -1391,7 +1547,7 @@ type WebhookRequest = {
|
|
|
1391
1547
|
* as member of the augmentation
|
|
1392
1548
|
*/
|
|
1393
1549
|
type CustomKind = `$${string}`;
|
|
1394
|
-
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1550
|
+
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1395
1551
|
type StorageUpdatedEvent = {
|
|
1396
1552
|
type: "storageUpdated";
|
|
1397
1553
|
data: {
|
|
@@ -1563,6 +1719,25 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1563
1719
|
updatedBy: string;
|
|
1564
1720
|
};
|
|
1565
1721
|
};
|
|
1722
|
+
type CommentMetadataUpdatedEvent = {
|
|
1723
|
+
type: "commentMetadataUpdated";
|
|
1724
|
+
data: {
|
|
1725
|
+
projectId: string;
|
|
1726
|
+
roomId: string;
|
|
1727
|
+
threadId: string;
|
|
1728
|
+
commentId: string;
|
|
1729
|
+
/**
|
|
1730
|
+
* ISO 8601 datestring
|
|
1731
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1732
|
+
*/
|
|
1733
|
+
updatedAt: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* ISO 8601 datestring
|
|
1736
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1737
|
+
*/
|
|
1738
|
+
updatedBy: string;
|
|
1739
|
+
};
|
|
1740
|
+
};
|
|
1566
1741
|
type ThreadCreatedEvent = {
|
|
1567
1742
|
type: "threadCreated";
|
|
1568
1743
|
data: {
|
|
@@ -1732,4 +1907,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1732
1907
|
*/
|
|
1733
1908
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1734
1909
|
|
|
1735
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
|
1910
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAgentMessageOptions, type CreateAgentSessionOptions, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAgentMessageOptions, type UpdateAgentSessionOptions, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "3.13.
|
|
6
|
+
var PKG_VERSION = "3.13.1-hackathon";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -990,6 +990,7 @@ var Liveblocks = class {
|
|
|
990
990
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
991
991
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
992
992
|
* @param params.data.body The body of the comment.
|
|
993
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
993
994
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
994
995
|
* @returns The created comment.
|
|
995
996
|
*/
|
|
@@ -1014,6 +1015,7 @@ var Liveblocks = class {
|
|
|
1014
1015
|
* @param params.threadId The thread ID to edit the comment in.
|
|
1015
1016
|
* @param params.commentId The comment ID to edit.
|
|
1016
1017
|
* @param params.data.body The body of the comment.
|
|
1018
|
+
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1017
1019
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
1018
1020
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1019
1021
|
* @returns The edited comment.
|
|
@@ -1022,7 +1024,11 @@ var Liveblocks = class {
|
|
|
1022
1024
|
const { roomId, threadId, commentId, data } = params;
|
|
1023
1025
|
const res = await this.#post(
|
|
1024
1026
|
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1025
|
-
{
|
|
1027
|
+
{
|
|
1028
|
+
body: data.body,
|
|
1029
|
+
editedAt: data.editedAt?.toISOString(),
|
|
1030
|
+
metadata: data.metadata
|
|
1031
|
+
},
|
|
1026
1032
|
options
|
|
1027
1033
|
);
|
|
1028
1034
|
if (!res.ok) {
|
|
@@ -1056,6 +1062,7 @@ var Liveblocks = class {
|
|
|
1056
1062
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
1057
1063
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
1058
1064
|
* @param params.thread.comment.body The body of the comment.
|
|
1065
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
1059
1066
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1060
1067
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
1061
1068
|
*/
|
|
@@ -1199,6 +1206,32 @@ var Liveblocks = class {
|
|
|
1199
1206
|
}
|
|
1200
1207
|
return await res.json();
|
|
1201
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Updates the metadata of the specified comment in a room.
|
|
1211
|
+
* @param params.roomId The room ID to update the comment in.
|
|
1212
|
+
* @param params.threadId The thread ID to update the comment in.
|
|
1213
|
+
* @param params.commentId The comment ID to update.
|
|
1214
|
+
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1215
|
+
* @param params.data.userId The user ID of the user who updated the comment.
|
|
1216
|
+
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
1217
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1218
|
+
* @returns The updated comment metadata.
|
|
1219
|
+
*/
|
|
1220
|
+
async editCommentMetadata(params, options) {
|
|
1221
|
+
const { roomId, threadId, commentId, data } = params;
|
|
1222
|
+
const res = await this.#post(
|
|
1223
|
+
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1224
|
+
{
|
|
1225
|
+
...data,
|
|
1226
|
+
updatedAt: data.updatedAt?.toISOString()
|
|
1227
|
+
},
|
|
1228
|
+
options
|
|
1229
|
+
);
|
|
1230
|
+
if (!res.ok) {
|
|
1231
|
+
throw await LiveblocksError.from(res);
|
|
1232
|
+
}
|
|
1233
|
+
return await res.json();
|
|
1234
|
+
}
|
|
1202
1235
|
/**
|
|
1203
1236
|
* Adds a new comment reaction to a comment.
|
|
1204
1237
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -2055,6 +2088,184 @@ var Liveblocks = class {
|
|
|
2055
2088
|
data: page.data.map(inflateWebKnowledgeSourceLink)
|
|
2056
2089
|
};
|
|
2057
2090
|
}
|
|
2091
|
+
/* -------------------------------------------------------------------------------------------------
|
|
2092
|
+
* Agent Sessions
|
|
2093
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
2094
|
+
/**
|
|
2095
|
+
* Returns a list of agent sessions in a room.
|
|
2096
|
+
* @param params.roomId The room ID to get the agent sessions from.
|
|
2097
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2098
|
+
* @returns A list of agent sessions.
|
|
2099
|
+
*/
|
|
2100
|
+
async getAgentSessions(params, options) {
|
|
2101
|
+
const { roomId } = params;
|
|
2102
|
+
const res = await this.#get(
|
|
2103
|
+
url2`/v2/rooms/${roomId}/agent-sessions`,
|
|
2104
|
+
void 0,
|
|
2105
|
+
options
|
|
2106
|
+
);
|
|
2107
|
+
if (!res.ok) {
|
|
2108
|
+
throw await LiveblocksError.from(res);
|
|
2109
|
+
}
|
|
2110
|
+
return await res.json();
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Creates a new agent session in a room.
|
|
2114
|
+
* @param params.roomId The room ID to create the agent session in.
|
|
2115
|
+
* @param params.sessionId The session ID for the agent session.
|
|
2116
|
+
* @param params.metadata (optional) The metadata for the agent session.
|
|
2117
|
+
* @param params.timestamp (optional) The timestamp for the agent session. If not provided, the current time will be used.
|
|
2118
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2119
|
+
* @returns The created agent session.
|
|
2120
|
+
*/
|
|
2121
|
+
async createAgentSession(params, options) {
|
|
2122
|
+
const { roomId, sessionId, metadata, timestamp } = params;
|
|
2123
|
+
const res = await this.#post(
|
|
2124
|
+
url2`/v2/rooms/${roomId}/agent-sessions`,
|
|
2125
|
+
{ sessionId, metadata, timestamp },
|
|
2126
|
+
options
|
|
2127
|
+
);
|
|
2128
|
+
if (!res.ok) {
|
|
2129
|
+
throw await LiveblocksError.from(res);
|
|
2130
|
+
}
|
|
2131
|
+
return await res.json();
|
|
2132
|
+
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Returns an agent session with the given id.
|
|
2135
|
+
* @param params.roomId The room ID to get the agent session from.
|
|
2136
|
+
* @param params.agentSessionId The agent session ID.
|
|
2137
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2138
|
+
* @returns The agent session.
|
|
2139
|
+
*/
|
|
2140
|
+
async getAgentSession(params, options) {
|
|
2141
|
+
const { roomId, agentSessionId } = params;
|
|
2142
|
+
const res = await this.#get(
|
|
2143
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}`,
|
|
2144
|
+
void 0,
|
|
2145
|
+
options
|
|
2146
|
+
);
|
|
2147
|
+
if (!res.ok) {
|
|
2148
|
+
throw await LiveblocksError.from(res);
|
|
2149
|
+
}
|
|
2150
|
+
return await res.json();
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Updates the metadata of an agent session.
|
|
2154
|
+
* @param params.roomId The room ID to update the agent session in.
|
|
2155
|
+
* @param params.agentSessionId The agent session ID to update.
|
|
2156
|
+
* @param params.metadata The metadata for the agent session.
|
|
2157
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2158
|
+
* @returns The updated agent session.
|
|
2159
|
+
*/
|
|
2160
|
+
async updateAgentSessionMetadata(params, options) {
|
|
2161
|
+
const { roomId, agentSessionId, metadata } = params;
|
|
2162
|
+
const res = await this.#post(
|
|
2163
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}`,
|
|
2164
|
+
{ metadata },
|
|
2165
|
+
options
|
|
2166
|
+
);
|
|
2167
|
+
if (!res.ok) {
|
|
2168
|
+
throw await LiveblocksError.from(res);
|
|
2169
|
+
}
|
|
2170
|
+
return await res.json();
|
|
2171
|
+
}
|
|
2172
|
+
/**
|
|
2173
|
+
* Deletes an agent session.
|
|
2174
|
+
* @param params.roomId The room ID to delete the agent session from.
|
|
2175
|
+
* @param params.agentSessionId The agent session ID to delete.
|
|
2176
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2177
|
+
*/
|
|
2178
|
+
async deleteAgentSession(params, options) {
|
|
2179
|
+
const { roomId, agentSessionId } = params;
|
|
2180
|
+
const res = await this.#delete(
|
|
2181
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}`,
|
|
2182
|
+
void 0,
|
|
2183
|
+
options
|
|
2184
|
+
);
|
|
2185
|
+
if (!res.ok) {
|
|
2186
|
+
throw await LiveblocksError.from(res);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Returns a list of agent messages in an agent session.
|
|
2191
|
+
* @param params.roomId The room ID to get the agent messages from.
|
|
2192
|
+
* @param params.agentSessionId The agent session ID to get the messages from.
|
|
2193
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2194
|
+
* @returns A list of agent messages.
|
|
2195
|
+
*/
|
|
2196
|
+
async getAgentMessages(params, options) {
|
|
2197
|
+
const { roomId, agentSessionId } = params;
|
|
2198
|
+
const res = await this.#get(
|
|
2199
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}/messages`,
|
|
2200
|
+
void 0,
|
|
2201
|
+
options
|
|
2202
|
+
);
|
|
2203
|
+
if (!res.ok) {
|
|
2204
|
+
throw await LiveblocksError.from(res);
|
|
2205
|
+
}
|
|
2206
|
+
return await res.json();
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Creates a new agent message in an agent session.
|
|
2210
|
+
* @param params.roomId The room ID to create the agent message in.
|
|
2211
|
+
* @param params.agentSessionId The agent session ID to create the message in.
|
|
2212
|
+
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
2213
|
+
* @param params.timestamp (optional) The message timestamp. If not provided, the current time will be used.
|
|
2214
|
+
* @param params.data The message data.
|
|
2215
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2216
|
+
* @returns The created agent message.
|
|
2217
|
+
*/
|
|
2218
|
+
async createAgentMessage(params, options) {
|
|
2219
|
+
const { roomId, agentSessionId, id, timestamp, data } = params;
|
|
2220
|
+
const res = await this.#post(
|
|
2221
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}/messages`,
|
|
2222
|
+
{ id, timestamp, data },
|
|
2223
|
+
options
|
|
2224
|
+
);
|
|
2225
|
+
if (!res.ok) {
|
|
2226
|
+
throw await LiveblocksError.from(res);
|
|
2227
|
+
}
|
|
2228
|
+
return await res.json();
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Updates an agent message.
|
|
2232
|
+
* @param params.roomId The room ID to update the agent message in.
|
|
2233
|
+
* @param params.agentSessionId The agent session ID to update the message in.
|
|
2234
|
+
* @param params.messageId The message ID to update.
|
|
2235
|
+
* @param params.data The message data.
|
|
2236
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2237
|
+
* @returns The updated agent message.
|
|
2238
|
+
*/
|
|
2239
|
+
async updateAgentMessage(params, options) {
|
|
2240
|
+
const { roomId, agentSessionId, messageId, data } = params;
|
|
2241
|
+
const res = await this.#post(
|
|
2242
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}/messages/${messageId}`,
|
|
2243
|
+
{ data },
|
|
2244
|
+
options
|
|
2245
|
+
);
|
|
2246
|
+
if (!res.ok) {
|
|
2247
|
+
throw await LiveblocksError.from(res);
|
|
2248
|
+
}
|
|
2249
|
+
return await res.json();
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Deletes an agent message.
|
|
2253
|
+
* @param params.roomId The room ID to delete the agent message from.
|
|
2254
|
+
* @param params.agentSessionId The agent session ID to delete the message from.
|
|
2255
|
+
* @param params.messageId The message ID to delete.
|
|
2256
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2257
|
+
*/
|
|
2258
|
+
async deleteAgentMessage(params, options) {
|
|
2259
|
+
const { roomId, agentSessionId, messageId } = params;
|
|
2260
|
+
const res = await this.#delete(
|
|
2261
|
+
url2`/v2/rooms/${roomId}/agent-sessions/${agentSessionId}/messages/${messageId}`,
|
|
2262
|
+
void 0,
|
|
2263
|
+
options
|
|
2264
|
+
);
|
|
2265
|
+
if (!res.ok) {
|
|
2266
|
+
throw await LiveblocksError.from(res);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2058
2269
|
};
|
|
2059
2270
|
var LiveblocksError = class _LiveblocksError extends Error {
|
|
2060
2271
|
status;
|
|
@@ -2199,6 +2410,7 @@ var WebhookHandler = class _WebhookHandler {
|
|
|
2199
2410
|
"commentDeleted",
|
|
2200
2411
|
"commentReactionAdded",
|
|
2201
2412
|
"commentReactionRemoved",
|
|
2413
|
+
"commentMetadataUpdated",
|
|
2202
2414
|
"threadMetadataUpdated",
|
|
2203
2415
|
"threadCreated",
|
|
2204
2416
|
"threadDeleted",
|