@liveblocks/node 2.24.0-deque1 → 2.24.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 +137 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -17
- package/dist/index.d.ts +108 -17
- package/dist/index.js +138 -17
- 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, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, RoomSubscriptionSettings, UserRoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, 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, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -612,6 +612,20 @@ declare class Liveblocks {
|
|
|
612
612
|
roomId: string;
|
|
613
613
|
threadId: string;
|
|
614
614
|
}, options?: RequestOptions): Promise<ThreadParticipants>;
|
|
615
|
+
/**
|
|
616
|
+
* Gets a thread's subscriptions.
|
|
617
|
+
*
|
|
618
|
+
* @param params.roomId The room ID to get the thread subscriptions from.
|
|
619
|
+
* @param params.threadId The thread ID to get the subscriptions from.
|
|
620
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
621
|
+
* @returns An array of subscriptions.
|
|
622
|
+
*/
|
|
623
|
+
getThreadSubscriptions(params: {
|
|
624
|
+
roomId: string;
|
|
625
|
+
threadId: string;
|
|
626
|
+
}, options?: RequestOptions): Promise<{
|
|
627
|
+
data: UserSubscriptionData[];
|
|
628
|
+
}>;
|
|
615
629
|
/**
|
|
616
630
|
* Gets a thread's comment.
|
|
617
631
|
*
|
|
@@ -729,6 +743,35 @@ declare class Liveblocks {
|
|
|
729
743
|
userId: string;
|
|
730
744
|
};
|
|
731
745
|
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
746
|
+
/**
|
|
747
|
+
* Subscribes a user to a thread.
|
|
748
|
+
* @param params.roomId The room ID of the thread.
|
|
749
|
+
* @param params.threadId The thread ID to subscribe to.
|
|
750
|
+
* @param params.data.userId The user ID of the user to subscribe to the thread.
|
|
751
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
752
|
+
* @returns The thread subscription.
|
|
753
|
+
*/
|
|
754
|
+
subscribeToThread(params: {
|
|
755
|
+
roomId: string;
|
|
756
|
+
threadId: string;
|
|
757
|
+
data: {
|
|
758
|
+
userId: string;
|
|
759
|
+
};
|
|
760
|
+
}, options?: RequestOptions): Promise<SubscriptionData>;
|
|
761
|
+
/**
|
|
762
|
+
* Unsubscribes a user from a thread.
|
|
763
|
+
* @param params.roomId The room ID of the thread.
|
|
764
|
+
* @param params.threadId The thread ID to unsubscribe from.
|
|
765
|
+
* @param params.data.userId The user ID of the user to unsubscribe from the thread.
|
|
766
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
767
|
+
*/
|
|
768
|
+
unsubscribeFromThread(params: {
|
|
769
|
+
roomId: string;
|
|
770
|
+
threadId: string;
|
|
771
|
+
data: {
|
|
772
|
+
userId: string;
|
|
773
|
+
};
|
|
774
|
+
}, options?: RequestOptions): Promise<void>;
|
|
732
775
|
/**
|
|
733
776
|
* Updates the metadata of the specified thread in a room.
|
|
734
777
|
* @param params.roomId The room ID to update the thread in.
|
|
@@ -821,37 +864,85 @@ declare class Liveblocks {
|
|
|
821
864
|
pageSize?: number;
|
|
822
865
|
}): AsyncGenerator<InboxNotificationData>;
|
|
823
866
|
/**
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
867
|
+
* @deprecated Renamed to `getRoomSubscriptionSettings`
|
|
868
|
+
*
|
|
869
|
+
* Gets the user's room subscription settings.
|
|
870
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
871
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
827
872
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
828
873
|
*/
|
|
829
874
|
getRoomNotificationSettings(params: {
|
|
830
875
|
userId: string;
|
|
831
876
|
roomId: string;
|
|
832
|
-
}, options?: RequestOptions): Promise<
|
|
877
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
878
|
+
/**
|
|
879
|
+
* Returns all room subscription settings for a user.
|
|
880
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
881
|
+
* @param params.startingAfter (optional) The cursor to start the pagination from.
|
|
882
|
+
* @param params.limit (optional) The number of items to return.
|
|
883
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
884
|
+
*/
|
|
885
|
+
getUserRoomSubscriptionSettings(params: {
|
|
886
|
+
userId: string;
|
|
887
|
+
} & PaginationOptions, options?: RequestOptions): Promise<Page<UserRoomSubscriptionSettings>>;
|
|
833
888
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @param params.userId The user ID to
|
|
836
|
-
* @param params.roomId The room ID to
|
|
837
|
-
* @param
|
|
889
|
+
* Gets the user's room subscription settings.
|
|
890
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
891
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
892
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
893
|
+
*/
|
|
894
|
+
getRoomSubscriptionSettings(params: {
|
|
895
|
+
userId: string;
|
|
896
|
+
roomId: string;
|
|
897
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
898
|
+
/**
|
|
899
|
+
* @deprecated Renamed to `updateRoomSubscriptionSettings`
|
|
900
|
+
*
|
|
901
|
+
* Updates the user's room subscription settings.
|
|
902
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
903
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
904
|
+
* @param params.data The new room subscription settings for the user.
|
|
838
905
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
839
906
|
*/
|
|
840
907
|
updateRoomNotificationSettings(params: {
|
|
841
908
|
userId: string;
|
|
842
909
|
roomId: string;
|
|
843
|
-
data:
|
|
844
|
-
}, options?: RequestOptions): Promise<
|
|
910
|
+
data: Partial<RoomSubscriptionSettings>;
|
|
911
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
845
912
|
/**
|
|
846
|
-
*
|
|
847
|
-
* @param params.userId The user ID to
|
|
848
|
-
* @param params.roomId The room ID to
|
|
913
|
+
* Updates the user's room subscription settings.
|
|
914
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
915
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
916
|
+
* @param params.data The new room subscription settings for the user.
|
|
917
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
918
|
+
*/
|
|
919
|
+
updateRoomSubscriptionSettings(params: {
|
|
920
|
+
userId: string;
|
|
921
|
+
roomId: string;
|
|
922
|
+
data: Partial<RoomSubscriptionSettings>;
|
|
923
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
924
|
+
/**
|
|
925
|
+
* @deprecated Renamed to `deleteRoomSubscriptionSettings`
|
|
926
|
+
*
|
|
927
|
+
* Delete the user's room subscription settings.
|
|
928
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
929
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
849
930
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
850
931
|
*/
|
|
851
932
|
deleteRoomNotificationSettings(params: {
|
|
852
933
|
userId: string;
|
|
853
934
|
roomId: string;
|
|
854
935
|
}, options?: RequestOptions): Promise<void>;
|
|
936
|
+
/**
|
|
937
|
+
* Delete the user's room subscription settings.
|
|
938
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
939
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
940
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
941
|
+
*/
|
|
942
|
+
deleteRoomSubscriptionSettings(params: {
|
|
943
|
+
userId: string;
|
|
944
|
+
roomId: string;
|
|
945
|
+
}, options?: RequestOptions): Promise<void>;
|
|
855
946
|
/**
|
|
856
947
|
* Update a room ID.
|
|
857
948
|
* @param params.roomId The current ID of the room.
|
|
@@ -894,7 +985,7 @@ declare class Liveblocks {
|
|
|
894
985
|
*/
|
|
895
986
|
getNotificationSettings(params: {
|
|
896
987
|
userId: string;
|
|
897
|
-
}, options?: RequestOptions): Promise<
|
|
988
|
+
}, options?: RequestOptions): Promise<NotificationSettings>;
|
|
898
989
|
/**
|
|
899
990
|
* Update the user's notification settings.
|
|
900
991
|
* @param params.userId The user ID to update the notification settings for.
|
|
@@ -903,8 +994,8 @@ declare class Liveblocks {
|
|
|
903
994
|
*/
|
|
904
995
|
updateNotificationSettings(params: {
|
|
905
996
|
userId: string;
|
|
906
|
-
data:
|
|
907
|
-
}, options?: RequestOptions): Promise<
|
|
997
|
+
data: PartialNotificationSettings;
|
|
998
|
+
}, options?: RequestOptions): Promise<NotificationSettings>;
|
|
908
999
|
/**
|
|
909
1000
|
* Delete the user's notification settings
|
|
910
1001
|
* @param params.userId The user ID to update the notification settings for.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, RoomSubscriptionSettings, UserRoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, 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, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -612,6 +612,20 @@ declare class Liveblocks {
|
|
|
612
612
|
roomId: string;
|
|
613
613
|
threadId: string;
|
|
614
614
|
}, options?: RequestOptions): Promise<ThreadParticipants>;
|
|
615
|
+
/**
|
|
616
|
+
* Gets a thread's subscriptions.
|
|
617
|
+
*
|
|
618
|
+
* @param params.roomId The room ID to get the thread subscriptions from.
|
|
619
|
+
* @param params.threadId The thread ID to get the subscriptions from.
|
|
620
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
621
|
+
* @returns An array of subscriptions.
|
|
622
|
+
*/
|
|
623
|
+
getThreadSubscriptions(params: {
|
|
624
|
+
roomId: string;
|
|
625
|
+
threadId: string;
|
|
626
|
+
}, options?: RequestOptions): Promise<{
|
|
627
|
+
data: UserSubscriptionData[];
|
|
628
|
+
}>;
|
|
615
629
|
/**
|
|
616
630
|
* Gets a thread's comment.
|
|
617
631
|
*
|
|
@@ -729,6 +743,35 @@ declare class Liveblocks {
|
|
|
729
743
|
userId: string;
|
|
730
744
|
};
|
|
731
745
|
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
746
|
+
/**
|
|
747
|
+
* Subscribes a user to a thread.
|
|
748
|
+
* @param params.roomId The room ID of the thread.
|
|
749
|
+
* @param params.threadId The thread ID to subscribe to.
|
|
750
|
+
* @param params.data.userId The user ID of the user to subscribe to the thread.
|
|
751
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
752
|
+
* @returns The thread subscription.
|
|
753
|
+
*/
|
|
754
|
+
subscribeToThread(params: {
|
|
755
|
+
roomId: string;
|
|
756
|
+
threadId: string;
|
|
757
|
+
data: {
|
|
758
|
+
userId: string;
|
|
759
|
+
};
|
|
760
|
+
}, options?: RequestOptions): Promise<SubscriptionData>;
|
|
761
|
+
/**
|
|
762
|
+
* Unsubscribes a user from a thread.
|
|
763
|
+
* @param params.roomId The room ID of the thread.
|
|
764
|
+
* @param params.threadId The thread ID to unsubscribe from.
|
|
765
|
+
* @param params.data.userId The user ID of the user to unsubscribe from the thread.
|
|
766
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
767
|
+
*/
|
|
768
|
+
unsubscribeFromThread(params: {
|
|
769
|
+
roomId: string;
|
|
770
|
+
threadId: string;
|
|
771
|
+
data: {
|
|
772
|
+
userId: string;
|
|
773
|
+
};
|
|
774
|
+
}, options?: RequestOptions): Promise<void>;
|
|
732
775
|
/**
|
|
733
776
|
* Updates the metadata of the specified thread in a room.
|
|
734
777
|
* @param params.roomId The room ID to update the thread in.
|
|
@@ -821,37 +864,85 @@ declare class Liveblocks {
|
|
|
821
864
|
pageSize?: number;
|
|
822
865
|
}): AsyncGenerator<InboxNotificationData>;
|
|
823
866
|
/**
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
867
|
+
* @deprecated Renamed to `getRoomSubscriptionSettings`
|
|
868
|
+
*
|
|
869
|
+
* Gets the user's room subscription settings.
|
|
870
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
871
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
827
872
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
828
873
|
*/
|
|
829
874
|
getRoomNotificationSettings(params: {
|
|
830
875
|
userId: string;
|
|
831
876
|
roomId: string;
|
|
832
|
-
}, options?: RequestOptions): Promise<
|
|
877
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
878
|
+
/**
|
|
879
|
+
* Returns all room subscription settings for a user.
|
|
880
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
881
|
+
* @param params.startingAfter (optional) The cursor to start the pagination from.
|
|
882
|
+
* @param params.limit (optional) The number of items to return.
|
|
883
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
884
|
+
*/
|
|
885
|
+
getUserRoomSubscriptionSettings(params: {
|
|
886
|
+
userId: string;
|
|
887
|
+
} & PaginationOptions, options?: RequestOptions): Promise<Page<UserRoomSubscriptionSettings>>;
|
|
833
888
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @param params.userId The user ID to
|
|
836
|
-
* @param params.roomId The room ID to
|
|
837
|
-
* @param
|
|
889
|
+
* Gets the user's room subscription settings.
|
|
890
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
891
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
892
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
893
|
+
*/
|
|
894
|
+
getRoomSubscriptionSettings(params: {
|
|
895
|
+
userId: string;
|
|
896
|
+
roomId: string;
|
|
897
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
898
|
+
/**
|
|
899
|
+
* @deprecated Renamed to `updateRoomSubscriptionSettings`
|
|
900
|
+
*
|
|
901
|
+
* Updates the user's room subscription settings.
|
|
902
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
903
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
904
|
+
* @param params.data The new room subscription settings for the user.
|
|
838
905
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
839
906
|
*/
|
|
840
907
|
updateRoomNotificationSettings(params: {
|
|
841
908
|
userId: string;
|
|
842
909
|
roomId: string;
|
|
843
|
-
data:
|
|
844
|
-
}, options?: RequestOptions): Promise<
|
|
910
|
+
data: Partial<RoomSubscriptionSettings>;
|
|
911
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
845
912
|
/**
|
|
846
|
-
*
|
|
847
|
-
* @param params.userId The user ID to
|
|
848
|
-
* @param params.roomId The room ID to
|
|
913
|
+
* Updates the user's room subscription settings.
|
|
914
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
915
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
916
|
+
* @param params.data The new room subscription settings for the user.
|
|
917
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
918
|
+
*/
|
|
919
|
+
updateRoomSubscriptionSettings(params: {
|
|
920
|
+
userId: string;
|
|
921
|
+
roomId: string;
|
|
922
|
+
data: Partial<RoomSubscriptionSettings>;
|
|
923
|
+
}, options?: RequestOptions): Promise<RoomSubscriptionSettings>;
|
|
924
|
+
/**
|
|
925
|
+
* @deprecated Renamed to `deleteRoomSubscriptionSettings`
|
|
926
|
+
*
|
|
927
|
+
* Delete the user's room subscription settings.
|
|
928
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
929
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
849
930
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
850
931
|
*/
|
|
851
932
|
deleteRoomNotificationSettings(params: {
|
|
852
933
|
userId: string;
|
|
853
934
|
roomId: string;
|
|
854
935
|
}, options?: RequestOptions): Promise<void>;
|
|
936
|
+
/**
|
|
937
|
+
* Delete the user's room subscription settings.
|
|
938
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
939
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
940
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
941
|
+
*/
|
|
942
|
+
deleteRoomSubscriptionSettings(params: {
|
|
943
|
+
userId: string;
|
|
944
|
+
roomId: string;
|
|
945
|
+
}, options?: RequestOptions): Promise<void>;
|
|
855
946
|
/**
|
|
856
947
|
* Update a room ID.
|
|
857
948
|
* @param params.roomId The current ID of the room.
|
|
@@ -894,7 +985,7 @@ declare class Liveblocks {
|
|
|
894
985
|
*/
|
|
895
986
|
getNotificationSettings(params: {
|
|
896
987
|
userId: string;
|
|
897
|
-
}, options?: RequestOptions): Promise<
|
|
988
|
+
}, options?: RequestOptions): Promise<NotificationSettings>;
|
|
898
989
|
/**
|
|
899
990
|
* Update the user's notification settings.
|
|
900
991
|
* @param params.userId The user ID to update the notification settings for.
|
|
@@ -903,8 +994,8 @@ declare class Liveblocks {
|
|
|
903
994
|
*/
|
|
904
995
|
updateNotificationSettings(params: {
|
|
905
996
|
userId: string;
|
|
906
|
-
data:
|
|
907
|
-
}, options?: RequestOptions): Promise<
|
|
997
|
+
data: PartialNotificationSettings;
|
|
998
|
+
}, options?: RequestOptions): Promise<NotificationSettings>;
|
|
908
999
|
/**
|
|
909
1000
|
* Delete the user's notification settings
|
|
910
1001
|
* @param params.userId The user ID to update the notification settings for.
|
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 = "2.24.0
|
|
6
|
+
var PKG_VERSION = "2.24.0";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
convertToCommentData,
|
|
14
14
|
convertToCommentUserReaction,
|
|
15
15
|
convertToInboxNotificationData,
|
|
16
|
+
convertToSubscriptionData,
|
|
16
17
|
convertToThreadData,
|
|
18
|
+
convertToUserSubscriptionData,
|
|
17
19
|
createManagedPool,
|
|
18
|
-
|
|
20
|
+
createNotificationSettings,
|
|
19
21
|
isPlainObject,
|
|
20
22
|
LiveObject,
|
|
21
23
|
makeAbortController,
|
|
@@ -1021,6 +1023,29 @@ var Liveblocks = class {
|
|
|
1021
1023
|
}
|
|
1022
1024
|
return await res.json();
|
|
1023
1025
|
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Gets a thread's subscriptions.
|
|
1028
|
+
*
|
|
1029
|
+
* @param params.roomId The room ID to get the thread subscriptions from.
|
|
1030
|
+
* @param params.threadId The thread ID to get the subscriptions from.
|
|
1031
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1032
|
+
* @returns An array of subscriptions.
|
|
1033
|
+
*/
|
|
1034
|
+
async getThreadSubscriptions(params, options) {
|
|
1035
|
+
const { roomId, threadId } = params;
|
|
1036
|
+
const res = await this.#get(
|
|
1037
|
+
url2`/v2/rooms/${roomId}/threads/${threadId}/subscriptions`,
|
|
1038
|
+
void 0,
|
|
1039
|
+
options
|
|
1040
|
+
);
|
|
1041
|
+
if (!res.ok) {
|
|
1042
|
+
throw await LiveblocksError.from(res);
|
|
1043
|
+
}
|
|
1044
|
+
const { data } = await res.json();
|
|
1045
|
+
return {
|
|
1046
|
+
data: data.map(convertToUserSubscriptionData)
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1024
1049
|
/**
|
|
1025
1050
|
* Gets a thread's comment.
|
|
1026
1051
|
*
|
|
@@ -1192,6 +1217,46 @@ var Liveblocks = class {
|
|
|
1192
1217
|
}
|
|
1193
1218
|
return convertToThreadData(await res.json());
|
|
1194
1219
|
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Subscribes a user to a thread.
|
|
1222
|
+
* @param params.roomId The room ID of the thread.
|
|
1223
|
+
* @param params.threadId The thread ID to subscribe to.
|
|
1224
|
+
* @param params.data.userId The user ID of the user to subscribe to the thread.
|
|
1225
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1226
|
+
* @returns The thread subscription.
|
|
1227
|
+
*/
|
|
1228
|
+
async subscribeToThread(params, options) {
|
|
1229
|
+
const { roomId, threadId } = params;
|
|
1230
|
+
const res = await this.#post(
|
|
1231
|
+
url2`/v2/rooms/${roomId}/threads/${threadId}/subscribe`,
|
|
1232
|
+
{ userId: params.data.userId },
|
|
1233
|
+
options
|
|
1234
|
+
);
|
|
1235
|
+
if (!res.ok) {
|
|
1236
|
+
throw await LiveblocksError.from(res);
|
|
1237
|
+
}
|
|
1238
|
+
return convertToSubscriptionData(
|
|
1239
|
+
await res.json()
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Unsubscribes a user from a thread.
|
|
1244
|
+
* @param params.roomId The room ID of the thread.
|
|
1245
|
+
* @param params.threadId The thread ID to unsubscribe from.
|
|
1246
|
+
* @param params.data.userId The user ID of the user to unsubscribe from the thread.
|
|
1247
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1248
|
+
*/
|
|
1249
|
+
async unsubscribeFromThread(params, options) {
|
|
1250
|
+
const { roomId, threadId } = params;
|
|
1251
|
+
const res = await this.#post(
|
|
1252
|
+
url2`/v2/rooms/${roomId}/threads/${threadId}/unsubscribe`,
|
|
1253
|
+
{ userId: params.data.userId },
|
|
1254
|
+
options
|
|
1255
|
+
);
|
|
1256
|
+
if (!res.ok) {
|
|
1257
|
+
throw await LiveblocksError.from(res);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1195
1260
|
/**
|
|
1196
1261
|
* Updates the metadata of the specified thread in a room.
|
|
1197
1262
|
* @param params.roomId The room ID to update the thread in.
|
|
@@ -1350,15 +1415,48 @@ var Liveblocks = class {
|
|
|
1350
1415
|
}
|
|
1351
1416
|
}
|
|
1352
1417
|
/**
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1418
|
+
* @deprecated Renamed to `getRoomSubscriptionSettings`
|
|
1419
|
+
*
|
|
1420
|
+
* Gets the user's room subscription settings.
|
|
1421
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
1422
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
1356
1423
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1357
1424
|
*/
|
|
1358
1425
|
async getRoomNotificationSettings(params, options) {
|
|
1426
|
+
return this.getRoomSubscriptionSettings(params, options);
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Returns all room subscription settings for a user.
|
|
1430
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
1431
|
+
* @param params.startingAfter (optional) The cursor to start the pagination from.
|
|
1432
|
+
* @param params.limit (optional) The number of items to return.
|
|
1433
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1434
|
+
*/
|
|
1435
|
+
async getUserRoomSubscriptionSettings(params, options) {
|
|
1436
|
+
const { userId, startingAfter, limit } = params;
|
|
1437
|
+
const res = await this.#get(
|
|
1438
|
+
url2`/v2/users/${userId}/room-subscription-settings`,
|
|
1439
|
+
{
|
|
1440
|
+
startingAfter,
|
|
1441
|
+
limit
|
|
1442
|
+
},
|
|
1443
|
+
options
|
|
1444
|
+
);
|
|
1445
|
+
if (!res.ok) {
|
|
1446
|
+
throw await LiveblocksError.from(res);
|
|
1447
|
+
}
|
|
1448
|
+
return await res.json();
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Gets the user's room subscription settings.
|
|
1452
|
+
* @param params.userId The user ID to get the room subscription settings from.
|
|
1453
|
+
* @param params.roomId The room ID to get the room subscription settings from.
|
|
1454
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1455
|
+
*/
|
|
1456
|
+
async getRoomSubscriptionSettings(params, options) {
|
|
1359
1457
|
const { userId, roomId } = params;
|
|
1360
1458
|
const res = await this.#get(
|
|
1361
|
-
url2`/v2/rooms/${roomId}/users/${userId}/
|
|
1459
|
+
url2`/v2/rooms/${roomId}/users/${userId}/subscription-settings`,
|
|
1362
1460
|
void 0,
|
|
1363
1461
|
options
|
|
1364
1462
|
);
|
|
@@ -1368,16 +1466,28 @@ var Liveblocks = class {
|
|
|
1368
1466
|
return await res.json();
|
|
1369
1467
|
}
|
|
1370
1468
|
/**
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
-
* @param params.
|
|
1469
|
+
* @deprecated Renamed to `updateRoomSubscriptionSettings`
|
|
1470
|
+
*
|
|
1471
|
+
* Updates the user's room subscription settings.
|
|
1472
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
1473
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
1474
|
+
* @param params.data The new room subscription settings for the user.
|
|
1375
1475
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1376
1476
|
*/
|
|
1377
1477
|
async updateRoomNotificationSettings(params, options) {
|
|
1478
|
+
return this.updateRoomSubscriptionSettings(params, options);
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Updates the user's room subscription settings.
|
|
1482
|
+
* @param params.userId The user ID to update the room subscription settings for.
|
|
1483
|
+
* @param params.roomId The room ID to update the room subscription settings for.
|
|
1484
|
+
* @param params.data The new room subscription settings for the user.
|
|
1485
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1486
|
+
*/
|
|
1487
|
+
async updateRoomSubscriptionSettings(params, options) {
|
|
1378
1488
|
const { userId, roomId, data } = params;
|
|
1379
1489
|
const res = await this.#post(
|
|
1380
|
-
url2`/v2/rooms/${roomId}/users/${userId}/
|
|
1490
|
+
url2`/v2/rooms/${roomId}/users/${userId}/subscription-settings`,
|
|
1381
1491
|
data,
|
|
1382
1492
|
options
|
|
1383
1493
|
);
|
|
@@ -1387,15 +1497,26 @@ var Liveblocks = class {
|
|
|
1387
1497
|
return await res.json();
|
|
1388
1498
|
}
|
|
1389
1499
|
/**
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1500
|
+
* @deprecated Renamed to `deleteRoomSubscriptionSettings`
|
|
1501
|
+
*
|
|
1502
|
+
* Delete the user's room subscription settings.
|
|
1503
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
1504
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
1393
1505
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1394
1506
|
*/
|
|
1395
1507
|
async deleteRoomNotificationSettings(params, options) {
|
|
1508
|
+
return this.deleteRoomSubscriptionSettings(params, options);
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Delete the user's room subscription settings.
|
|
1512
|
+
* @param params.userId The user ID to delete the room subscription settings from.
|
|
1513
|
+
* @param params.roomId The room ID to delete the room subscription settings from.
|
|
1514
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1515
|
+
*/
|
|
1516
|
+
async deleteRoomSubscriptionSettings(params, options) {
|
|
1396
1517
|
const { userId, roomId } = params;
|
|
1397
1518
|
const res = await this.#delete(
|
|
1398
|
-
url2`/v2/rooms/${roomId}/users/${userId}/
|
|
1519
|
+
url2`/v2/rooms/${roomId}/users/${userId}/subscription-settings`,
|
|
1399
1520
|
options
|
|
1400
1521
|
);
|
|
1401
1522
|
if (!res.ok) {
|
|
@@ -1478,7 +1599,7 @@ var Liveblocks = class {
|
|
|
1478
1599
|
throw await LiveblocksError.from(res);
|
|
1479
1600
|
}
|
|
1480
1601
|
const plainSettings = await res.json();
|
|
1481
|
-
const settings =
|
|
1602
|
+
const settings = createNotificationSettings(plainSettings);
|
|
1482
1603
|
return settings;
|
|
1483
1604
|
}
|
|
1484
1605
|
/**
|
|
@@ -1498,7 +1619,7 @@ var Liveblocks = class {
|
|
|
1498
1619
|
throw await LiveblocksError.from(res);
|
|
1499
1620
|
}
|
|
1500
1621
|
const plainSettings = await res.json();
|
|
1501
|
-
const settings =
|
|
1622
|
+
const settings = createNotificationSettings(plainSettings);
|
|
1502
1623
|
return settings;
|
|
1503
1624
|
}
|
|
1504
1625
|
/**
|