@liveblocks/node 2.24.0-sub1 → 2.24.1
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 +88 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +88 -1
- 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, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, 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, 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.
|
|
@@ -832,6 +875,16 @@ declare class Liveblocks {
|
|
|
832
875
|
userId: string;
|
|
833
876
|
roomId: string;
|
|
834
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>>;
|
|
835
888
|
/**
|
|
836
889
|
* Gets the user's room subscription settings.
|
|
837
890
|
* @param params.userId The user ID to get the room subscription settings from.
|
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, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, 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, 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.
|
|
@@ -832,6 +875,16 @@ declare class Liveblocks {
|
|
|
832
875
|
userId: string;
|
|
833
876
|
roomId: string;
|
|
834
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>>;
|
|
835
888
|
/**
|
|
836
889
|
* Gets the user's room subscription settings.
|
|
837
890
|
* @param params.userId The user ID to get the room subscription settings from.
|
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.
|
|
6
|
+
var PKG_VERSION = "2.24.1";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -13,7 +13,9 @@ 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,
|
|
@@ -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.
|
|
@@ -1360,6 +1425,28 @@ var Liveblocks = class {
|
|
|
1360
1425
|
async getRoomNotificationSettings(params, options) {
|
|
1361
1426
|
return this.getRoomSubscriptionSettings(params, options);
|
|
1362
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
|
+
}
|
|
1363
1450
|
/**
|
|
1364
1451
|
* Gets the user's room subscription settings.
|
|
1365
1452
|
* @param params.userId The user ID to get the room subscription settings from.
|