@liveblocks/node 3.13.0-vincent3 → 3.13.0
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 = {
|
|
@@ -727,11 +741,11 @@ declare class Liveblocks {
|
|
|
727
741
|
* ```
|
|
728
742
|
*/
|
|
729
743
|
query?: string | {
|
|
730
|
-
metadata?: Partial<QueryMetadata<
|
|
744
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
731
745
|
resolved?: boolean;
|
|
732
746
|
};
|
|
733
747
|
}, options?: RequestOptions): Promise<{
|
|
734
|
-
data: ThreadData<
|
|
748
|
+
data: ThreadData<TM, CM>[];
|
|
735
749
|
}>;
|
|
736
750
|
/**
|
|
737
751
|
* Gets a thread.
|
|
@@ -744,7 +758,7 @@ declare class Liveblocks {
|
|
|
744
758
|
getThread(params: {
|
|
745
759
|
roomId: string;
|
|
746
760
|
threadId: string;
|
|
747
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
761
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
748
762
|
/**
|
|
749
763
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
750
764
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -791,7 +805,7 @@ declare class Liveblocks {
|
|
|
791
805
|
roomId: string;
|
|
792
806
|
threadId: string;
|
|
793
807
|
commentId: string;
|
|
794
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
808
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
795
809
|
/**
|
|
796
810
|
* Creates a comment.
|
|
797
811
|
*
|
|
@@ -800,24 +814,18 @@ declare class Liveblocks {
|
|
|
800
814
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
801
815
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
802
816
|
* @param params.data.body The body of the comment.
|
|
817
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
803
818
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
804
819
|
* @returns The created comment.
|
|
805
820
|
*/
|
|
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>;
|
|
821
|
+
createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
815
822
|
/**
|
|
816
823
|
* Edits a comment.
|
|
817
824
|
* @param params.roomId The room ID to edit the comment in.
|
|
818
825
|
* @param params.threadId The thread ID to edit the comment in.
|
|
819
826
|
* @param params.commentId The comment ID to edit.
|
|
820
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.
|
|
821
829
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
822
830
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
823
831
|
* @returns The edited comment.
|
|
@@ -828,9 +836,10 @@ declare class Liveblocks {
|
|
|
828
836
|
commentId: string;
|
|
829
837
|
data: {
|
|
830
838
|
body: CommentBody;
|
|
839
|
+
metadata?: Patchable<CM>;
|
|
831
840
|
editedAt?: Date;
|
|
832
841
|
};
|
|
833
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
842
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
834
843
|
/**
|
|
835
844
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
836
845
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -851,10 +860,11 @@ declare class Liveblocks {
|
|
|
851
860
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
852
861
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
853
862
|
* @param params.thread.comment.body The body of the comment.
|
|
863
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
854
864
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
855
865
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
856
866
|
*/
|
|
857
|
-
createThread(params: CreateThreadOptions<
|
|
867
|
+
createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
858
868
|
/**
|
|
859
869
|
* Deletes a thread and all of its comments.
|
|
860
870
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -879,7 +889,7 @@ declare class Liveblocks {
|
|
|
879
889
|
data: {
|
|
880
890
|
userId: string;
|
|
881
891
|
};
|
|
882
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
892
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
883
893
|
/**
|
|
884
894
|
* Mark a thread as unresolved.
|
|
885
895
|
* @param params.roomId The room ID of the thread.
|
|
@@ -894,7 +904,7 @@ declare class Liveblocks {
|
|
|
894
904
|
data: {
|
|
895
905
|
userId: string;
|
|
896
906
|
};
|
|
897
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
907
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
898
908
|
/**
|
|
899
909
|
* Subscribes a user to a thread.
|
|
900
910
|
* @param params.roomId The room ID of the thread.
|
|
@@ -938,11 +948,32 @@ declare class Liveblocks {
|
|
|
938
948
|
roomId: string;
|
|
939
949
|
threadId: string;
|
|
940
950
|
data: {
|
|
941
|
-
metadata: Patchable<
|
|
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>;
|
|
942
973
|
userId: string;
|
|
943
974
|
updatedAt?: Date;
|
|
944
975
|
};
|
|
945
|
-
}, options?: RequestOptions): Promise<
|
|
976
|
+
}, options?: RequestOptions): Promise<CM>;
|
|
946
977
|
/**
|
|
947
978
|
* Adds a new comment reaction to a comment.
|
|
948
979
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1391,7 +1422,7 @@ type WebhookRequest = {
|
|
|
1391
1422
|
* as member of the augmentation
|
|
1392
1423
|
*/
|
|
1393
1424
|
type CustomKind = `$${string}`;
|
|
1394
|
-
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;
|
|
1395
1426
|
type StorageUpdatedEvent = {
|
|
1396
1427
|
type: "storageUpdated";
|
|
1397
1428
|
data: {
|
|
@@ -1563,6 +1594,25 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1563
1594
|
updatedBy: string;
|
|
1564
1595
|
};
|
|
1565
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
|
+
};
|
|
1566
1616
|
type ThreadCreatedEvent = {
|
|
1567
1617
|
type: "threadCreated";
|
|
1568
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,
|
|
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 = {
|
|
@@ -727,11 +741,11 @@ declare class Liveblocks {
|
|
|
727
741
|
* ```
|
|
728
742
|
*/
|
|
729
743
|
query?: string | {
|
|
730
|
-
metadata?: Partial<QueryMetadata<
|
|
744
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
731
745
|
resolved?: boolean;
|
|
732
746
|
};
|
|
733
747
|
}, options?: RequestOptions): Promise<{
|
|
734
|
-
data: ThreadData<
|
|
748
|
+
data: ThreadData<TM, CM>[];
|
|
735
749
|
}>;
|
|
736
750
|
/**
|
|
737
751
|
* Gets a thread.
|
|
@@ -744,7 +758,7 @@ declare class Liveblocks {
|
|
|
744
758
|
getThread(params: {
|
|
745
759
|
roomId: string;
|
|
746
760
|
threadId: string;
|
|
747
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
761
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
748
762
|
/**
|
|
749
763
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
750
764
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -791,7 +805,7 @@ declare class Liveblocks {
|
|
|
791
805
|
roomId: string;
|
|
792
806
|
threadId: string;
|
|
793
807
|
commentId: string;
|
|
794
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
808
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
795
809
|
/**
|
|
796
810
|
* Creates a comment.
|
|
797
811
|
*
|
|
@@ -800,24 +814,18 @@ declare class Liveblocks {
|
|
|
800
814
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
801
815
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
802
816
|
* @param params.data.body The body of the comment.
|
|
817
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
803
818
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
804
819
|
* @returns The created comment.
|
|
805
820
|
*/
|
|
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>;
|
|
821
|
+
createComment(params: CreateCommentOptions<CM>, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
815
822
|
/**
|
|
816
823
|
* Edits a comment.
|
|
817
824
|
* @param params.roomId The room ID to edit the comment in.
|
|
818
825
|
* @param params.threadId The thread ID to edit the comment in.
|
|
819
826
|
* @param params.commentId The comment ID to edit.
|
|
820
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.
|
|
821
829
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
822
830
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
823
831
|
* @returns The edited comment.
|
|
@@ -828,9 +836,10 @@ declare class Liveblocks {
|
|
|
828
836
|
commentId: string;
|
|
829
837
|
data: {
|
|
830
838
|
body: CommentBody;
|
|
839
|
+
metadata?: Patchable<CM>;
|
|
831
840
|
editedAt?: Date;
|
|
832
841
|
};
|
|
833
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
842
|
+
}, options?: RequestOptions): Promise<CommentData<CM>>;
|
|
834
843
|
/**
|
|
835
844
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
836
845
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -851,10 +860,11 @@ declare class Liveblocks {
|
|
|
851
860
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
852
861
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
853
862
|
* @param params.thread.comment.body The body of the comment.
|
|
863
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
854
864
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
855
865
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
856
866
|
*/
|
|
857
|
-
createThread(params: CreateThreadOptions<
|
|
867
|
+
createThread(params: CreateThreadOptions<TM, CM>, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
858
868
|
/**
|
|
859
869
|
* Deletes a thread and all of its comments.
|
|
860
870
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -879,7 +889,7 @@ declare class Liveblocks {
|
|
|
879
889
|
data: {
|
|
880
890
|
userId: string;
|
|
881
891
|
};
|
|
882
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
892
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
883
893
|
/**
|
|
884
894
|
* Mark a thread as unresolved.
|
|
885
895
|
* @param params.roomId The room ID of the thread.
|
|
@@ -894,7 +904,7 @@ declare class Liveblocks {
|
|
|
894
904
|
data: {
|
|
895
905
|
userId: string;
|
|
896
906
|
};
|
|
897
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
907
|
+
}, options?: RequestOptions): Promise<ThreadData<TM, CM>>;
|
|
898
908
|
/**
|
|
899
909
|
* Subscribes a user to a thread.
|
|
900
910
|
* @param params.roomId The room ID of the thread.
|
|
@@ -938,11 +948,32 @@ declare class Liveblocks {
|
|
|
938
948
|
roomId: string;
|
|
939
949
|
threadId: string;
|
|
940
950
|
data: {
|
|
941
|
-
metadata: Patchable<
|
|
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>;
|
|
942
973
|
userId: string;
|
|
943
974
|
updatedAt?: Date;
|
|
944
975
|
};
|
|
945
|
-
}, options?: RequestOptions): Promise<
|
|
976
|
+
}, options?: RequestOptions): Promise<CM>;
|
|
946
977
|
/**
|
|
947
978
|
* Adds a new comment reaction to a comment.
|
|
948
979
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1391,7 +1422,7 @@ type WebhookRequest = {
|
|
|
1391
1422
|
* as member of the augmentation
|
|
1392
1423
|
*/
|
|
1393
1424
|
type CustomKind = `$${string}`;
|
|
1394
|
-
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;
|
|
1395
1426
|
type StorageUpdatedEvent = {
|
|
1396
1427
|
type: "storageUpdated";
|
|
1397
1428
|
data: {
|
|
@@ -1563,6 +1594,25 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1563
1594
|
updatedBy: string;
|
|
1564
1595
|
};
|
|
1565
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
|
+
};
|
|
1566
1616
|
type ThreadCreatedEvent = {
|
|
1567
1617
|
type: "threadCreated";
|
|
1568
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
|
|
6
|
+
var PKG_VERSION = "3.13.0";
|
|
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.
|
|
@@ -2199,6 +2232,7 @@ var WebhookHandler = class _WebhookHandler {
|
|
|
2199
2232
|
"commentDeleted",
|
|
2200
2233
|
"commentReactionAdded",
|
|
2201
2234
|
"commentReactionRemoved",
|
|
2235
|
+
"commentMetadataUpdated",
|
|
2202
2236
|
"threadMetadataUpdated",
|
|
2203
2237
|
"threadCreated",
|
|
2204
2238
|
"threadDeleted",
|