@liveblocks/node 3.12.1 → 3.13.0-metadata1
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 +44 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -26
- package/dist/index.d.ts +76 -26
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,
|
|
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<
|
|
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 = {
|
|
@@ -721,11 +735,11 @@ declare class Liveblocks {
|
|
|
721
735
|
* ```
|
|
722
736
|
*/
|
|
723
737
|
query?: string | {
|
|
724
|
-
metadata?: Partial<QueryMetadata<
|
|
738
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
725
739
|
resolved?: boolean;
|
|
726
740
|
};
|
|
727
741
|
}, options?: RequestOptions): Promise<{
|
|
728
|
-
data: ThreadData<
|
|
742
|
+
data: ThreadData<TM, CM>[];
|
|
729
743
|
}>;
|
|
730
744
|
/**
|
|
731
745
|
* Gets a thread.
|
|
@@ -738,7 +752,7 @@ declare class Liveblocks {
|
|
|
738
752
|
getThread(params: {
|
|
739
753
|
roomId: string;
|
|
740
754
|
threadId: string;
|
|
741
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
755
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
742
756
|
/**
|
|
743
757
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
744
758
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -785,7 +799,7 @@ declare class Liveblocks {
|
|
|
785
799
|
roomId: string;
|
|
786
800
|
threadId: string;
|
|
787
801
|
commentId: string;
|
|
788
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
802
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
789
803
|
/**
|
|
790
804
|
* Creates a comment.
|
|
791
805
|
*
|
|
@@ -794,24 +808,18 @@ declare class Liveblocks {
|
|
|
794
808
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
795
809
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
796
810
|
* @param params.data.body The body of the comment.
|
|
811
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
797
812
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
798
813
|
* @returns The created comment.
|
|
799
814
|
*/
|
|
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>;
|
|
815
|
+
createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
809
816
|
/**
|
|
810
817
|
* Edits a comment.
|
|
811
818
|
* @param params.roomId The room ID to edit the comment in.
|
|
812
819
|
* @param params.threadId The thread ID to edit the comment in.
|
|
813
820
|
* @param params.commentId The comment ID to edit.
|
|
814
821
|
* @param params.data.body The body of the comment.
|
|
822
|
+
* @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
823
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
816
824
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
817
825
|
* @returns The edited comment.
|
|
@@ -822,9 +830,10 @@ declare class Liveblocks {
|
|
|
822
830
|
commentId: string;
|
|
823
831
|
data: {
|
|
824
832
|
body: CommentBody;
|
|
833
|
+
metadata?: Patchable<CM>;
|
|
825
834
|
editedAt?: Date;
|
|
826
835
|
};
|
|
827
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
836
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
828
837
|
/**
|
|
829
838
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
830
839
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -845,10 +854,11 @@ declare class Liveblocks {
|
|
|
845
854
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
846
855
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
847
856
|
* @param params.thread.comment.body The body of the comment.
|
|
857
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
848
858
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
849
859
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
850
860
|
*/
|
|
851
|
-
createThread(params: CreateThreadOptions<
|
|
861
|
+
createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
852
862
|
/**
|
|
853
863
|
* Deletes a thread and all of its comments.
|
|
854
864
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -873,7 +883,7 @@ declare class Liveblocks {
|
|
|
873
883
|
data: {
|
|
874
884
|
userId: string;
|
|
875
885
|
};
|
|
876
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
886
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
877
887
|
/**
|
|
878
888
|
* Mark a thread as unresolved.
|
|
879
889
|
* @param params.roomId The room ID of the thread.
|
|
@@ -888,7 +898,7 @@ declare class Liveblocks {
|
|
|
888
898
|
data: {
|
|
889
899
|
userId: string;
|
|
890
900
|
};
|
|
891
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
901
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
892
902
|
/**
|
|
893
903
|
* Subscribes a user to a thread.
|
|
894
904
|
* @param params.roomId The room ID of the thread.
|
|
@@ -932,11 +942,32 @@ declare class Liveblocks {
|
|
|
932
942
|
roomId: string;
|
|
933
943
|
threadId: string;
|
|
934
944
|
data: {
|
|
935
|
-
metadata: Patchable<
|
|
945
|
+
metadata: Patchable<TM>;
|
|
946
|
+
userId: string;
|
|
947
|
+
updatedAt?: Date;
|
|
948
|
+
};
|
|
949
|
+
}, options?: RequestOptions): Promise<TM>;
|
|
950
|
+
/**
|
|
951
|
+
* Updates the metadata of the specified comment in a room.
|
|
952
|
+
* @param params.roomId The room ID to update the comment in.
|
|
953
|
+
* @param params.threadId The thread ID to update the comment in.
|
|
954
|
+
* @param params.commentId The comment ID to update.
|
|
955
|
+
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
956
|
+
* @param params.data.userId The user ID of the user who updated the comment.
|
|
957
|
+
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
958
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
959
|
+
* @returns The updated comment metadata.
|
|
960
|
+
*/
|
|
961
|
+
editCommentMetadata(params: {
|
|
962
|
+
roomId: string;
|
|
963
|
+
threadId: string;
|
|
964
|
+
commentId: string;
|
|
965
|
+
data: {
|
|
966
|
+
metadata: Patchable<CM>;
|
|
936
967
|
userId: string;
|
|
937
968
|
updatedAt?: Date;
|
|
938
969
|
};
|
|
939
|
-
}, options?: RequestOptions): Promise<
|
|
970
|
+
}, options?: RequestOptions): Promise<CM>;
|
|
940
971
|
/**
|
|
941
972
|
* Adds a new comment reaction to a comment.
|
|
942
973
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1385,7 +1416,7 @@ type WebhookRequest = {
|
|
|
1385
1416
|
* as member of the augmentation
|
|
1386
1417
|
*/
|
|
1387
1418
|
type CustomKind = `$${string}`;
|
|
1388
|
-
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1419
|
+
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1389
1420
|
type StorageUpdatedEvent = {
|
|
1390
1421
|
type: "storageUpdated";
|
|
1391
1422
|
data: {
|
|
@@ -1557,6 +1588,25 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1557
1588
|
updatedBy: string;
|
|
1558
1589
|
};
|
|
1559
1590
|
};
|
|
1591
|
+
type CommentMetadataUpdatedEvent = {
|
|
1592
|
+
type: "commentMetadataUpdated";
|
|
1593
|
+
data: {
|
|
1594
|
+
projectId: string;
|
|
1595
|
+
roomId: string;
|
|
1596
|
+
threadId: string;
|
|
1597
|
+
commentId: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* ISO 8601 datestring
|
|
1600
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1601
|
+
*/
|
|
1602
|
+
updatedAt: string;
|
|
1603
|
+
/**
|
|
1604
|
+
* ISO 8601 datestring
|
|
1605
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1606
|
+
*/
|
|
1607
|
+
updatedBy: string;
|
|
1608
|
+
};
|
|
1609
|
+
};
|
|
1560
1610
|
type ThreadCreatedEvent = {
|
|
1561
1611
|
type: "threadCreated";
|
|
1562
1612
|
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,
|
|
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<
|
|
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 = {
|
|
@@ -721,11 +735,11 @@ declare class Liveblocks {
|
|
|
721
735
|
* ```
|
|
722
736
|
*/
|
|
723
737
|
query?: string | {
|
|
724
|
-
metadata?: Partial<QueryMetadata<
|
|
738
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
725
739
|
resolved?: boolean;
|
|
726
740
|
};
|
|
727
741
|
}, options?: RequestOptions): Promise<{
|
|
728
|
-
data: ThreadData<
|
|
742
|
+
data: ThreadData<TM, CM>[];
|
|
729
743
|
}>;
|
|
730
744
|
/**
|
|
731
745
|
* Gets a thread.
|
|
@@ -738,7 +752,7 @@ declare class Liveblocks {
|
|
|
738
752
|
getThread(params: {
|
|
739
753
|
roomId: string;
|
|
740
754
|
threadId: string;
|
|
741
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
755
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
742
756
|
/**
|
|
743
757
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
744
758
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -785,7 +799,7 @@ declare class Liveblocks {
|
|
|
785
799
|
roomId: string;
|
|
786
800
|
threadId: string;
|
|
787
801
|
commentId: string;
|
|
788
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
802
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
789
803
|
/**
|
|
790
804
|
* Creates a comment.
|
|
791
805
|
*
|
|
@@ -794,24 +808,18 @@ declare class Liveblocks {
|
|
|
794
808
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
795
809
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
796
810
|
* @param params.data.body The body of the comment.
|
|
811
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
797
812
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
798
813
|
* @returns The created comment.
|
|
799
814
|
*/
|
|
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>;
|
|
815
|
+
createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
809
816
|
/**
|
|
810
817
|
* Edits a comment.
|
|
811
818
|
* @param params.roomId The room ID to edit the comment in.
|
|
812
819
|
* @param params.threadId The thread ID to edit the comment in.
|
|
813
820
|
* @param params.commentId The comment ID to edit.
|
|
814
821
|
* @param params.data.body The body of the comment.
|
|
822
|
+
* @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
823
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
816
824
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
817
825
|
* @returns The edited comment.
|
|
@@ -822,9 +830,10 @@ declare class Liveblocks {
|
|
|
822
830
|
commentId: string;
|
|
823
831
|
data: {
|
|
824
832
|
body: CommentBody;
|
|
833
|
+
metadata?: Patchable<CM>;
|
|
825
834
|
editedAt?: Date;
|
|
826
835
|
};
|
|
827
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
836
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
828
837
|
/**
|
|
829
838
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
830
839
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -845,10 +854,11 @@ declare class Liveblocks {
|
|
|
845
854
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
846
855
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
847
856
|
* @param params.thread.comment.body The body of the comment.
|
|
857
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
848
858
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
849
859
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
850
860
|
*/
|
|
851
|
-
createThread(params: CreateThreadOptions<
|
|
861
|
+
createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
852
862
|
/**
|
|
853
863
|
* Deletes a thread and all of its comments.
|
|
854
864
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -873,7 +883,7 @@ declare class Liveblocks {
|
|
|
873
883
|
data: {
|
|
874
884
|
userId: string;
|
|
875
885
|
};
|
|
876
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
886
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
877
887
|
/**
|
|
878
888
|
* Mark a thread as unresolved.
|
|
879
889
|
* @param params.roomId The room ID of the thread.
|
|
@@ -888,7 +898,7 @@ declare class Liveblocks {
|
|
|
888
898
|
data: {
|
|
889
899
|
userId: string;
|
|
890
900
|
};
|
|
891
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
901
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
892
902
|
/**
|
|
893
903
|
* Subscribes a user to a thread.
|
|
894
904
|
* @param params.roomId The room ID of the thread.
|
|
@@ -932,11 +942,32 @@ declare class Liveblocks {
|
|
|
932
942
|
roomId: string;
|
|
933
943
|
threadId: string;
|
|
934
944
|
data: {
|
|
935
|
-
metadata: Patchable<
|
|
945
|
+
metadata: Patchable<TM>;
|
|
946
|
+
userId: string;
|
|
947
|
+
updatedAt?: Date;
|
|
948
|
+
};
|
|
949
|
+
}, options?: RequestOptions): Promise<TM>;
|
|
950
|
+
/**
|
|
951
|
+
* Updates the metadata of the specified comment in a room.
|
|
952
|
+
* @param params.roomId The room ID to update the comment in.
|
|
953
|
+
* @param params.threadId The thread ID to update the comment in.
|
|
954
|
+
* @param params.commentId The comment ID to update.
|
|
955
|
+
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
956
|
+
* @param params.data.userId The user ID of the user who updated the comment.
|
|
957
|
+
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
958
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
959
|
+
* @returns The updated comment metadata.
|
|
960
|
+
*/
|
|
961
|
+
editCommentMetadata(params: {
|
|
962
|
+
roomId: string;
|
|
963
|
+
threadId: string;
|
|
964
|
+
commentId: string;
|
|
965
|
+
data: {
|
|
966
|
+
metadata: Patchable<CM>;
|
|
936
967
|
userId: string;
|
|
937
968
|
updatedAt?: Date;
|
|
938
969
|
};
|
|
939
|
-
}, options?: RequestOptions): Promise<
|
|
970
|
+
}, options?: RequestOptions): Promise<CM>;
|
|
940
971
|
/**
|
|
941
972
|
* Adds a new comment reaction to a comment.
|
|
942
973
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1385,7 +1416,7 @@ type WebhookRequest = {
|
|
|
1385
1416
|
* as member of the augmentation
|
|
1386
1417
|
*/
|
|
1387
1418
|
type CustomKind = `$${string}`;
|
|
1388
|
-
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1419
|
+
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1389
1420
|
type StorageUpdatedEvent = {
|
|
1390
1421
|
type: "storageUpdated";
|
|
1391
1422
|
data: {
|
|
@@ -1557,6 +1588,25 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1557
1588
|
updatedBy: string;
|
|
1558
1589
|
};
|
|
1559
1590
|
};
|
|
1591
|
+
type CommentMetadataUpdatedEvent = {
|
|
1592
|
+
type: "commentMetadataUpdated";
|
|
1593
|
+
data: {
|
|
1594
|
+
projectId: string;
|
|
1595
|
+
roomId: string;
|
|
1596
|
+
threadId: string;
|
|
1597
|
+
commentId: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* ISO 8601 datestring
|
|
1600
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1601
|
+
*/
|
|
1602
|
+
updatedAt: string;
|
|
1603
|
+
/**
|
|
1604
|
+
* ISO 8601 datestring
|
|
1605
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
1606
|
+
*/
|
|
1607
|
+
updatedBy: string;
|
|
1608
|
+
};
|
|
1609
|
+
};
|
|
1560
1610
|
type ThreadCreatedEvent = {
|
|
1561
1611
|
type: "threadCreated";
|
|
1562
1612
|
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.
|
|
6
|
+
var PKG_VERSION = "3.13.0-metadata1";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -988,6 +988,7 @@ var Liveblocks = class {
|
|
|
988
988
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
989
989
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
990
990
|
* @param params.data.body The body of the comment.
|
|
991
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
991
992
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
992
993
|
* @returns The created comment.
|
|
993
994
|
*/
|
|
@@ -1012,6 +1013,7 @@ var Liveblocks = class {
|
|
|
1012
1013
|
* @param params.threadId The thread ID to edit the comment in.
|
|
1013
1014
|
* @param params.commentId The comment ID to edit.
|
|
1014
1015
|
* @param params.data.body The body of the comment.
|
|
1016
|
+
* @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
1017
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
1016
1018
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1017
1019
|
* @returns The edited comment.
|
|
@@ -1020,7 +1022,11 @@ var Liveblocks = class {
|
|
|
1020
1022
|
const { roomId, threadId, commentId, data } = params;
|
|
1021
1023
|
const res = await this.#post(
|
|
1022
1024
|
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1023
|
-
{
|
|
1025
|
+
{
|
|
1026
|
+
body: data.body,
|
|
1027
|
+
editedAt: data.editedAt?.toISOString(),
|
|
1028
|
+
metadata: data.metadata
|
|
1029
|
+
},
|
|
1024
1030
|
options
|
|
1025
1031
|
);
|
|
1026
1032
|
if (!res.ok) {
|
|
@@ -1054,6 +1060,7 @@ var Liveblocks = class {
|
|
|
1054
1060
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
1055
1061
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
1056
1062
|
* @param params.thread.comment.body The body of the comment.
|
|
1063
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
1057
1064
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1058
1065
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
1059
1066
|
*/
|
|
@@ -1197,6 +1204,32 @@ var Liveblocks = class {
|
|
|
1197
1204
|
}
|
|
1198
1205
|
return await res.json();
|
|
1199
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Updates the metadata of the specified comment in a room.
|
|
1209
|
+
* @param params.roomId The room ID to update the comment in.
|
|
1210
|
+
* @param params.threadId The thread ID to update the comment in.
|
|
1211
|
+
* @param params.commentId The comment ID to update.
|
|
1212
|
+
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1213
|
+
* @param params.data.userId The user ID of the user who updated the comment.
|
|
1214
|
+
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
1215
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1216
|
+
* @returns The updated comment metadata.
|
|
1217
|
+
*/
|
|
1218
|
+
async editCommentMetadata(params, options) {
|
|
1219
|
+
const { roomId, threadId, commentId, data } = params;
|
|
1220
|
+
const res = await this.#post(
|
|
1221
|
+
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1222
|
+
{
|
|
1223
|
+
...data,
|
|
1224
|
+
updatedAt: data.updatedAt?.toISOString()
|
|
1225
|
+
},
|
|
1226
|
+
options
|
|
1227
|
+
);
|
|
1228
|
+
if (!res.ok) {
|
|
1229
|
+
throw await LiveblocksError.from(res);
|
|
1230
|
+
}
|
|
1231
|
+
return await res.json();
|
|
1232
|
+
}
|
|
1200
1233
|
/**
|
|
1201
1234
|
* Adds a new comment reaction to a comment.
|
|
1202
1235
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -2197,6 +2230,7 @@ var WebhookHandler = class _WebhookHandler {
|
|
|
2197
2230
|
"commentDeleted",
|
|
2198
2231
|
"commentReactionAdded",
|
|
2199
2232
|
"commentReactionRemoved",
|
|
2233
|
+
"commentMetadataUpdated",
|
|
2200
2234
|
"threadMetadataUpdated",
|
|
2201
2235
|
"threadCreated",
|
|
2202
2236
|
"threadDeleted",
|