@liveblocks/node 3.13.0-ack1 → 3.13.0-metadata2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, NotificationChannel } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, 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<M extends BaseMetadata> = {
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
- } & PartialUnless<M, {
106
- metadata: M;
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 M = DM;
225
+ type TM = DTM;
226
+ type CM = DCM;
213
227
  type S = DS;
214
228
  type U = DU;
215
229
  type RoomsQueryCriteria = {
@@ -288,6 +302,12 @@ type CreateRoomOptions = {
288
302
  usersAccesses?: RoomAccesses;
289
303
  metadata?: RoomMetadata;
290
304
  tenantId?: string;
305
+ /**
306
+ * @private Preferred storage engine version to use when creating the
307
+ * room. Only takes effect if the room doesn't exist yet. Version
308
+ * 2 supports streaming and will become the default in the future.
309
+ */
310
+ engine?: 1 | 2;
291
311
  };
292
312
  type UpdateRoomOptions = {
293
313
  defaultAccesses?: RoomPermission | null;
@@ -721,11 +741,11 @@ declare class Liveblocks {
721
741
  * ```
722
742
  */
723
743
  query?: string | {
724
- metadata?: Partial<QueryMetadata<M>>;
744
+ metadata?: Partial<QueryMetadata<TM>>;
725
745
  resolved?: boolean;
726
746
  };
727
747
  }, options?: RequestOptions): Promise<{
728
- data: ThreadData<M>[];
748
+ data: ThreadData<TM, CM>[];
729
749
  }>;
730
750
  /**
731
751
  * Gets a thread.
@@ -738,7 +758,7 @@ declare class Liveblocks {
738
758
  getThread(params: {
739
759
  roomId: string;
740
760
  threadId: string;
741
- }, options?: RequestOptions): Promise<ThreadData<M>>;
761
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
742
762
  /**
743
763
  * @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
744
764
  * from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
@@ -785,7 +805,7 @@ declare class Liveblocks {
785
805
  roomId: string;
786
806
  threadId: string;
787
807
  commentId: string;
788
- }, options?: RequestOptions): Promise<CommentData>;
808
+ }, options?: RequestOptions): Promise<CommentData<CM>>;
789
809
  /**
790
810
  * Creates a comment.
791
811
  *
@@ -794,24 +814,18 @@ declare class Liveblocks {
794
814
  * @param params.data.userId The user ID of the user who is set to create the comment.
795
815
  * @param params.data.createdAt (optional) The date the comment is set to be created.
796
816
  * @param params.data.body The body of the comment.
817
+ * @param params.data.metadata (optional) The metadata for the comment.
797
818
  * @param options.signal (optional) An abort signal to cancel the request.
798
819
  * @returns The created comment.
799
820
  */
800
- createComment(params: {
801
- roomId: string;
802
- threadId: string;
803
- data: {
804
- userId: string;
805
- createdAt?: Date;
806
- body: CommentBody;
807
- };
808
- }, options?: RequestOptions): Promise<CommentData>;
821
+ createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
809
822
  /**
810
823
  * Edits a comment.
811
824
  * @param params.roomId The room ID to edit the comment in.
812
825
  * @param params.threadId The thread ID to edit the comment in.
813
826
  * @param params.commentId The comment ID to edit.
814
827
  * @param params.data.body The body of the comment.
828
+ * @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
815
829
  * @param params.data.editedAt (optional) The date the comment was edited.
816
830
  * @param options.signal (optional) An abort signal to cancel the request.
817
831
  * @returns The edited comment.
@@ -822,9 +836,10 @@ declare class Liveblocks {
822
836
  commentId: string;
823
837
  data: {
824
838
  body: CommentBody;
839
+ metadata?: Patchable<CM>;
825
840
  editedAt?: Date;
826
841
  };
827
- }, options?: RequestOptions): Promise<CommentData>;
842
+ }, options?: RequestOptions): Promise<CommentData<CM>>;
828
843
  /**
829
844
  * Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
830
845
  * @param params.roomId The room ID to delete the comment in.
@@ -845,10 +860,11 @@ declare class Liveblocks {
845
860
  * @param params.thread.comment.userId The user ID of the user who created the comment.
846
861
  * @param params.thread.comment.createdAt (optional) The date the comment was created.
847
862
  * @param params.thread.comment.body The body of the comment.
863
+ * @param params.thread.comment.metadata (optional) The metadata for the comment.
848
864
  * @param options.signal (optional) An abort signal to cancel the request.
849
865
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
850
866
  */
851
- createThread(params: CreateThreadOptions<M>, options?: RequestOptions): Promise<ThreadData<M>>;
867
+ createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
852
868
  /**
853
869
  * Deletes a thread and all of its comments.
854
870
  * @param params.roomId The room ID to delete the thread in.
@@ -873,7 +889,7 @@ declare class Liveblocks {
873
889
  data: {
874
890
  userId: string;
875
891
  };
876
- }, options?: RequestOptions): Promise<ThreadData<M>>;
892
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
877
893
  /**
878
894
  * Mark a thread as unresolved.
879
895
  * @param params.roomId The room ID of the thread.
@@ -888,7 +904,7 @@ declare class Liveblocks {
888
904
  data: {
889
905
  userId: string;
890
906
  };
891
- }, options?: RequestOptions): Promise<ThreadData<M>>;
907
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
892
908
  /**
893
909
  * Subscribes a user to a thread.
894
910
  * @param params.roomId The room ID of the thread.
@@ -932,11 +948,32 @@ declare class Liveblocks {
932
948
  roomId: string;
933
949
  threadId: string;
934
950
  data: {
935
- metadata: Patchable<M>;
951
+ metadata: Patchable<TM>;
952
+ userId: string;
953
+ updatedAt?: Date;
954
+ };
955
+ }, options?: RequestOptions): Promise<TM>;
956
+ /**
957
+ * Updates the metadata of the specified comment in a room.
958
+ * @param params.roomId The room ID to update the comment in.
959
+ * @param params.threadId The thread ID to update the comment in.
960
+ * @param params.commentId The comment ID to update.
961
+ * @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
962
+ * @param params.data.userId The user ID of the user who updated the comment.
963
+ * @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
964
+ * @param options.signal (optional) An abort signal to cancel the request.
965
+ * @returns The updated comment metadata.
966
+ */
967
+ editCommentMetadata(params: {
968
+ roomId: string;
969
+ threadId: string;
970
+ commentId: string;
971
+ data: {
972
+ metadata: Patchable<CM>;
936
973
  userId: string;
937
974
  updatedAt?: Date;
938
975
  };
939
- }, options?: RequestOptions): Promise<M>;
976
+ }, options?: RequestOptions): Promise<CM>;
940
977
  /**
941
978
  * Adds a new comment reaction to a comment.
942
979
  * @param params.roomId The room ID to add the comment reaction in.
@@ -1385,7 +1422,7 @@ type WebhookRequest = {
1385
1422
  * as member of the augmentation
1386
1423
  */
1387
1424
  type CustomKind = `$${string}`;
1388
- type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
1425
+ type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
1389
1426
  type StorageUpdatedEvent = {
1390
1427
  type: "storageUpdated";
1391
1428
  data: {
@@ -1557,6 +1594,25 @@ type ThreadMetadataUpdatedEvent = {
1557
1594
  updatedBy: string;
1558
1595
  };
1559
1596
  };
1597
+ type CommentMetadataUpdatedEvent = {
1598
+ type: "commentMetadataUpdated";
1599
+ data: {
1600
+ projectId: string;
1601
+ roomId: string;
1602
+ threadId: string;
1603
+ commentId: string;
1604
+ /**
1605
+ * ISO 8601 datestring
1606
+ * @example "2021-03-01T12:00:00.000Z"
1607
+ */
1608
+ updatedAt: string;
1609
+ /**
1610
+ * ISO 8601 datestring
1611
+ * @example "2021-03-01T12:00:00.000Z"
1612
+ */
1613
+ updatedBy: string;
1614
+ };
1615
+ };
1560
1616
  type ThreadCreatedEvent = {
1561
1617
  type: "threadCreated";
1562
1618
  data: {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, NotificationChannel } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, 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<M extends BaseMetadata> = {
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
- } & PartialUnless<M, {
106
- metadata: M;
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 M = DM;
225
+ type TM = DTM;
226
+ type CM = DCM;
213
227
  type S = DS;
214
228
  type U = DU;
215
229
  type RoomsQueryCriteria = {
@@ -288,6 +302,12 @@ type CreateRoomOptions = {
288
302
  usersAccesses?: RoomAccesses;
289
303
  metadata?: RoomMetadata;
290
304
  tenantId?: string;
305
+ /**
306
+ * @private Preferred storage engine version to use when creating the
307
+ * room. Only takes effect if the room doesn't exist yet. Version
308
+ * 2 supports streaming and will become the default in the future.
309
+ */
310
+ engine?: 1 | 2;
291
311
  };
292
312
  type UpdateRoomOptions = {
293
313
  defaultAccesses?: RoomPermission | null;
@@ -721,11 +741,11 @@ declare class Liveblocks {
721
741
  * ```
722
742
  */
723
743
  query?: string | {
724
- metadata?: Partial<QueryMetadata<M>>;
744
+ metadata?: Partial<QueryMetadata<TM>>;
725
745
  resolved?: boolean;
726
746
  };
727
747
  }, options?: RequestOptions): Promise<{
728
- data: ThreadData<M>[];
748
+ data: ThreadData<TM, CM>[];
729
749
  }>;
730
750
  /**
731
751
  * Gets a thread.
@@ -738,7 +758,7 @@ declare class Liveblocks {
738
758
  getThread(params: {
739
759
  roomId: string;
740
760
  threadId: string;
741
- }, options?: RequestOptions): Promise<ThreadData<M>>;
761
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
742
762
  /**
743
763
  * @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
744
764
  * from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
@@ -785,7 +805,7 @@ declare class Liveblocks {
785
805
  roomId: string;
786
806
  threadId: string;
787
807
  commentId: string;
788
- }, options?: RequestOptions): Promise<CommentData>;
808
+ }, options?: RequestOptions): Promise<CommentData<CM>>;
789
809
  /**
790
810
  * Creates a comment.
791
811
  *
@@ -794,24 +814,18 @@ declare class Liveblocks {
794
814
  * @param params.data.userId The user ID of the user who is set to create the comment.
795
815
  * @param params.data.createdAt (optional) The date the comment is set to be created.
796
816
  * @param params.data.body The body of the comment.
817
+ * @param params.data.metadata (optional) The metadata for the comment.
797
818
  * @param options.signal (optional) An abort signal to cancel the request.
798
819
  * @returns The created comment.
799
820
  */
800
- createComment(params: {
801
- roomId: string;
802
- threadId: string;
803
- data: {
804
- userId: string;
805
- createdAt?: Date;
806
- body: CommentBody;
807
- };
808
- }, options?: RequestOptions): Promise<CommentData>;
821
+ createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
809
822
  /**
810
823
  * Edits a comment.
811
824
  * @param params.roomId The room ID to edit the comment in.
812
825
  * @param params.threadId The thread ID to edit the comment in.
813
826
  * @param params.commentId The comment ID to edit.
814
827
  * @param params.data.body The body of the comment.
828
+ * @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
815
829
  * @param params.data.editedAt (optional) The date the comment was edited.
816
830
  * @param options.signal (optional) An abort signal to cancel the request.
817
831
  * @returns The edited comment.
@@ -822,9 +836,10 @@ declare class Liveblocks {
822
836
  commentId: string;
823
837
  data: {
824
838
  body: CommentBody;
839
+ metadata?: Patchable<CM>;
825
840
  editedAt?: Date;
826
841
  };
827
- }, options?: RequestOptions): Promise<CommentData>;
842
+ }, options?: RequestOptions): Promise<CommentData<CM>>;
828
843
  /**
829
844
  * Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
830
845
  * @param params.roomId The room ID to delete the comment in.
@@ -845,10 +860,11 @@ declare class Liveblocks {
845
860
  * @param params.thread.comment.userId The user ID of the user who created the comment.
846
861
  * @param params.thread.comment.createdAt (optional) The date the comment was created.
847
862
  * @param params.thread.comment.body The body of the comment.
863
+ * @param params.thread.comment.metadata (optional) The metadata for the comment.
848
864
  * @param options.signal (optional) An abort signal to cancel the request.
849
865
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
850
866
  */
851
- createThread(params: CreateThreadOptions<M>, options?: RequestOptions): Promise<ThreadData<M>>;
867
+ createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
852
868
  /**
853
869
  * Deletes a thread and all of its comments.
854
870
  * @param params.roomId The room ID to delete the thread in.
@@ -873,7 +889,7 @@ declare class Liveblocks {
873
889
  data: {
874
890
  userId: string;
875
891
  };
876
- }, options?: RequestOptions): Promise<ThreadData<M>>;
892
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
877
893
  /**
878
894
  * Mark a thread as unresolved.
879
895
  * @param params.roomId The room ID of the thread.
@@ -888,7 +904,7 @@ declare class Liveblocks {
888
904
  data: {
889
905
  userId: string;
890
906
  };
891
- }, options?: RequestOptions): Promise<ThreadData<M>>;
907
+ }, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
892
908
  /**
893
909
  * Subscribes a user to a thread.
894
910
  * @param params.roomId The room ID of the thread.
@@ -932,11 +948,32 @@ declare class Liveblocks {
932
948
  roomId: string;
933
949
  threadId: string;
934
950
  data: {
935
- metadata: Patchable<M>;
951
+ metadata: Patchable<TM>;
952
+ userId: string;
953
+ updatedAt?: Date;
954
+ };
955
+ }, options?: RequestOptions): Promise<TM>;
956
+ /**
957
+ * Updates the metadata of the specified comment in a room.
958
+ * @param params.roomId The room ID to update the comment in.
959
+ * @param params.threadId The thread ID to update the comment in.
960
+ * @param params.commentId The comment ID to update.
961
+ * @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
962
+ * @param params.data.userId The user ID of the user who updated the comment.
963
+ * @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
964
+ * @param options.signal (optional) An abort signal to cancel the request.
965
+ * @returns The updated comment metadata.
966
+ */
967
+ editCommentMetadata(params: {
968
+ roomId: string;
969
+ threadId: string;
970
+ commentId: string;
971
+ data: {
972
+ metadata: Patchable<CM>;
936
973
  userId: string;
937
974
  updatedAt?: Date;
938
975
  };
939
- }, options?: RequestOptions): Promise<M>;
976
+ }, options?: RequestOptions): Promise<CM>;
940
977
  /**
941
978
  * Adds a new comment reaction to a comment.
942
979
  * @param params.roomId The room ID to add the comment reaction in.
@@ -1385,7 +1422,7 @@ type WebhookRequest = {
1385
1422
  * as member of the augmentation
1386
1423
  */
1387
1424
  type CustomKind = `$${string}`;
1388
- type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
1425
+ type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
1389
1426
  type StorageUpdatedEvent = {
1390
1427
  type: "storageUpdated";
1391
1428
  data: {
@@ -1557,6 +1594,25 @@ type ThreadMetadataUpdatedEvent = {
1557
1594
  updatedBy: string;
1558
1595
  };
1559
1596
  };
1597
+ type CommentMetadataUpdatedEvent = {
1598
+ type: "commentMetadataUpdated";
1599
+ data: {
1600
+ projectId: string;
1601
+ roomId: string;
1602
+ threadId: string;
1603
+ commentId: string;
1604
+ /**
1605
+ * ISO 8601 datestring
1606
+ * @example "2021-03-01T12:00:00.000Z"
1607
+ */
1608
+ updatedAt: string;
1609
+ /**
1610
+ * ISO 8601 datestring
1611
+ * @example "2021-03-01T12:00:00.000Z"
1612
+ */
1613
+ updatedBy: string;
1614
+ };
1615
+ };
1560
1616
  type ThreadCreatedEvent = {
1561
1617
  type: "threadCreated";
1562
1618
  data: {
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.0-ack1";
6
+ var PKG_VERSION = "3.13.0-metadata2";
7
7
  var PKG_FORMAT = "esm";
8
8
 
9
9
  // src/client.ts
@@ -559,7 +559,8 @@ var Liveblocks = class {
559
559
  groupsAccesses,
560
560
  usersAccesses,
561
561
  metadata,
562
- tenantId
562
+ tenantId,
563
+ engine
563
564
  } = params;
564
565
  const res = await this.#post(
565
566
  options?.idempotent ? url2`/v2/rooms?idempotent` : url2`/v2/rooms`,
@@ -569,7 +570,8 @@ var Liveblocks = class {
569
570
  groupsAccesses,
570
571
  usersAccesses,
571
572
  tenantId,
572
- metadata
573
+ metadata,
574
+ engine
573
575
  },
574
576
  options
575
577
  );
@@ -988,6 +990,7 @@ var Liveblocks = class {
988
990
  * @param params.data.userId The user ID of the user who is set to create the comment.
989
991
  * @param params.data.createdAt (optional) The date the comment is set to be created.
990
992
  * @param params.data.body The body of the comment.
993
+ * @param params.data.metadata (optional) The metadata for the comment.
991
994
  * @param options.signal (optional) An abort signal to cancel the request.
992
995
  * @returns The created comment.
993
996
  */
@@ -1012,6 +1015,7 @@ var Liveblocks = class {
1012
1015
  * @param params.threadId The thread ID to edit the comment in.
1013
1016
  * @param params.commentId The comment ID to edit.
1014
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.
1015
1019
  * @param params.data.editedAt (optional) The date the comment was edited.
1016
1020
  * @param options.signal (optional) An abort signal to cancel the request.
1017
1021
  * @returns The edited comment.
@@ -1020,7 +1024,11 @@ var Liveblocks = class {
1020
1024
  const { roomId, threadId, commentId, data } = params;
1021
1025
  const res = await this.#post(
1022
1026
  url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
1023
- { ...data, editedAt: data.editedAt?.toISOString() },
1027
+ {
1028
+ body: data.body,
1029
+ editedAt: data.editedAt?.toISOString(),
1030
+ metadata: data.metadata
1031
+ },
1024
1032
  options
1025
1033
  );
1026
1034
  if (!res.ok) {
@@ -1054,6 +1062,7 @@ var Liveblocks = class {
1054
1062
  * @param params.thread.comment.userId The user ID of the user who created the comment.
1055
1063
  * @param params.thread.comment.createdAt (optional) The date the comment was created.
1056
1064
  * @param params.thread.comment.body The body of the comment.
1065
+ * @param params.thread.comment.metadata (optional) The metadata for the comment.
1057
1066
  * @param options.signal (optional) An abort signal to cancel the request.
1058
1067
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
1059
1068
  */
@@ -1197,6 +1206,32 @@ var Liveblocks = class {
1197
1206
  }
1198
1207
  return await res.json();
1199
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
+ }
1200
1235
  /**
1201
1236
  * Adds a new comment reaction to a comment.
1202
1237
  * @param params.roomId The room ID to add the comment reaction in.
@@ -2197,6 +2232,7 @@ var WebhookHandler = class _WebhookHandler {
2197
2232
  "commentDeleted",
2198
2233
  "commentReactionAdded",
2199
2234
  "commentReactionRemoved",
2235
+ "commentMetadataUpdated",
2200
2236
  "threadMetadataUpdated",
2201
2237
  "threadCreated",
2202
2238
  "threadDeleted",