@liveblocks/node 1.10.0-beta1 → 1.10.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +52 -3
- package/dist/index.d.ts +52 -3
- package/dist/index.js +56 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData } from '@liveblocks/core';
|
|
1
|
+
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } 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, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -621,10 +621,44 @@ declare class Liveblocks {
|
|
|
621
621
|
removedAt?: Date;
|
|
622
622
|
};
|
|
623
623
|
}): Promise<void>;
|
|
624
|
+
/**
|
|
625
|
+
* Returns the inbox notifications for a user.
|
|
626
|
+
* @param params.userId The user ID to get the inbox notifications from.
|
|
627
|
+
* @param params.inboxNotificationId The ID of the inbox notification to get.
|
|
628
|
+
*/
|
|
624
629
|
getInboxNotification(params: {
|
|
625
630
|
userId: string;
|
|
626
631
|
inboxNotificationId: string;
|
|
627
632
|
}): Promise<InboxNotificationData>;
|
|
633
|
+
/**
|
|
634
|
+
* Gets the user's room notification settings.
|
|
635
|
+
* @param params.userId The user ID to get the room notifications from.
|
|
636
|
+
* @param params.roomId The room ID to get the room notification settings from.
|
|
637
|
+
*/
|
|
638
|
+
getRoomNotificationSettings(params: {
|
|
639
|
+
userId: string;
|
|
640
|
+
roomId: string;
|
|
641
|
+
}): Promise<RoomNotificationSettings>;
|
|
642
|
+
/**
|
|
643
|
+
* Updates the user's room notification settings.
|
|
644
|
+
* @param params.userId The user ID to update the room notification settings for.
|
|
645
|
+
* @param params.roomId The room ID to update the room notification settings for.
|
|
646
|
+
* @param params.data The new room notification settings for the user.
|
|
647
|
+
*/
|
|
648
|
+
updateRoomNotificationSettings(params: {
|
|
649
|
+
userId: string;
|
|
650
|
+
roomId: string;
|
|
651
|
+
data: RoomNotificationSettings;
|
|
652
|
+
}): Promise<RoomNotificationSettings>;
|
|
653
|
+
/**
|
|
654
|
+
* Delete the user's room notification settings.
|
|
655
|
+
* @param params.userId The user ID to delete the room notification settings from.
|
|
656
|
+
* @param params.roomId The room ID to delete the room notification settings from.
|
|
657
|
+
*/
|
|
658
|
+
deleteRoomNotificationSettings(params: {
|
|
659
|
+
userId: string;
|
|
660
|
+
roomId: string;
|
|
661
|
+
}): Promise<void>;
|
|
628
662
|
}
|
|
629
663
|
|
|
630
664
|
declare class WebhookHandler {
|
|
@@ -683,7 +717,7 @@ declare type WebhookRequest = {
|
|
|
683
717
|
*/
|
|
684
718
|
rawBody: string;
|
|
685
719
|
};
|
|
686
|
-
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | ThreadCreatedEvent | YDocUpdatedEvent;
|
|
720
|
+
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | ThreadEmailNotificationEvent | ThreadCreatedEvent | YDocUpdatedEvent;
|
|
687
721
|
declare type StorageUpdatedEvent = {
|
|
688
722
|
type: "storageUpdated";
|
|
689
723
|
data: {
|
|
@@ -864,5 +898,20 @@ declare type ThreadCreatedEvent = {
|
|
|
864
898
|
createdBy: string;
|
|
865
899
|
};
|
|
866
900
|
};
|
|
901
|
+
declare type ThreadEmailNotificationEvent = {
|
|
902
|
+
type: "threadEmailNotification";
|
|
903
|
+
data: {
|
|
904
|
+
projectId: string;
|
|
905
|
+
roomId: string;
|
|
906
|
+
userId: string;
|
|
907
|
+
threadId: string;
|
|
908
|
+
inboxNotificationId: string;
|
|
909
|
+
/**
|
|
910
|
+
* ISO 8601 datestring
|
|
911
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
912
|
+
*/
|
|
913
|
+
createdAt: string;
|
|
914
|
+
};
|
|
915
|
+
};
|
|
867
916
|
|
|
868
|
-
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, type LiveblocksOptions, type RoomAccesses, type RoomCreatedEvent, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, authorize };
|
|
917
|
+
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, type LiveblocksOptions, type RoomAccesses, type RoomCreatedEvent, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadEmailNotificationEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, authorize };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData } from '@liveblocks/core';
|
|
1
|
+
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } 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, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -621,10 +621,44 @@ declare class Liveblocks {
|
|
|
621
621
|
removedAt?: Date;
|
|
622
622
|
};
|
|
623
623
|
}): Promise<void>;
|
|
624
|
+
/**
|
|
625
|
+
* Returns the inbox notifications for a user.
|
|
626
|
+
* @param params.userId The user ID to get the inbox notifications from.
|
|
627
|
+
* @param params.inboxNotificationId The ID of the inbox notification to get.
|
|
628
|
+
*/
|
|
624
629
|
getInboxNotification(params: {
|
|
625
630
|
userId: string;
|
|
626
631
|
inboxNotificationId: string;
|
|
627
632
|
}): Promise<InboxNotificationData>;
|
|
633
|
+
/**
|
|
634
|
+
* Gets the user's room notification settings.
|
|
635
|
+
* @param params.userId The user ID to get the room notifications from.
|
|
636
|
+
* @param params.roomId The room ID to get the room notification settings from.
|
|
637
|
+
*/
|
|
638
|
+
getRoomNotificationSettings(params: {
|
|
639
|
+
userId: string;
|
|
640
|
+
roomId: string;
|
|
641
|
+
}): Promise<RoomNotificationSettings>;
|
|
642
|
+
/**
|
|
643
|
+
* Updates the user's room notification settings.
|
|
644
|
+
* @param params.userId The user ID to update the room notification settings for.
|
|
645
|
+
* @param params.roomId The room ID to update the room notification settings for.
|
|
646
|
+
* @param params.data The new room notification settings for the user.
|
|
647
|
+
*/
|
|
648
|
+
updateRoomNotificationSettings(params: {
|
|
649
|
+
userId: string;
|
|
650
|
+
roomId: string;
|
|
651
|
+
data: RoomNotificationSettings;
|
|
652
|
+
}): Promise<RoomNotificationSettings>;
|
|
653
|
+
/**
|
|
654
|
+
* Delete the user's room notification settings.
|
|
655
|
+
* @param params.userId The user ID to delete the room notification settings from.
|
|
656
|
+
* @param params.roomId The room ID to delete the room notification settings from.
|
|
657
|
+
*/
|
|
658
|
+
deleteRoomNotificationSettings(params: {
|
|
659
|
+
userId: string;
|
|
660
|
+
roomId: string;
|
|
661
|
+
}): Promise<void>;
|
|
628
662
|
}
|
|
629
663
|
|
|
630
664
|
declare class WebhookHandler {
|
|
@@ -683,7 +717,7 @@ declare type WebhookRequest = {
|
|
|
683
717
|
*/
|
|
684
718
|
rawBody: string;
|
|
685
719
|
};
|
|
686
|
-
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | ThreadCreatedEvent | YDocUpdatedEvent;
|
|
720
|
+
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | ThreadEmailNotificationEvent | ThreadCreatedEvent | YDocUpdatedEvent;
|
|
687
721
|
declare type StorageUpdatedEvent = {
|
|
688
722
|
type: "storageUpdated";
|
|
689
723
|
data: {
|
|
@@ -864,5 +898,20 @@ declare type ThreadCreatedEvent = {
|
|
|
864
898
|
createdBy: string;
|
|
865
899
|
};
|
|
866
900
|
};
|
|
901
|
+
declare type ThreadEmailNotificationEvent = {
|
|
902
|
+
type: "threadEmailNotification";
|
|
903
|
+
data: {
|
|
904
|
+
projectId: string;
|
|
905
|
+
roomId: string;
|
|
906
|
+
userId: string;
|
|
907
|
+
threadId: string;
|
|
908
|
+
inboxNotificationId: string;
|
|
909
|
+
/**
|
|
910
|
+
* ISO 8601 datestring
|
|
911
|
+
* @example "2021-03-01T12:00:00.000Z"
|
|
912
|
+
*/
|
|
913
|
+
createdAt: string;
|
|
914
|
+
};
|
|
915
|
+
};
|
|
867
916
|
|
|
868
|
-
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, type LiveblocksOptions, type RoomAccesses, type RoomCreatedEvent, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, authorize };
|
|
917
|
+
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, type LiveblocksOptions, type RoomAccesses, type RoomCreatedEvent, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadEmailNotificationEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, authorize };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "1.10.0-
|
|
6
|
+
var PKG_VERSION = "1.10.0-beta2";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/utils.ts
|
|
@@ -1015,6 +1015,11 @@ var Liveblocks = class {
|
|
|
1015
1015
|
throw new LiveblocksError(res.status, text);
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Returns the inbox notifications for a user.
|
|
1020
|
+
* @param params.userId The user ID to get the inbox notifications from.
|
|
1021
|
+
* @param params.inboxNotificationId The ID of the inbox notification to get.
|
|
1022
|
+
*/
|
|
1018
1023
|
async getInboxNotification(params) {
|
|
1019
1024
|
const { userId, inboxNotificationId } = params;
|
|
1020
1025
|
const res = await this.get(
|
|
@@ -1031,6 +1036,55 @@ var Liveblocks = class {
|
|
|
1031
1036
|
readAt: data.readAt ? new Date(data.readAt) : null
|
|
1032
1037
|
};
|
|
1033
1038
|
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Gets the user's room notification settings.
|
|
1041
|
+
* @param params.userId The user ID to get the room notifications from.
|
|
1042
|
+
* @param params.roomId The room ID to get the room notification settings from.
|
|
1043
|
+
*/
|
|
1044
|
+
async getRoomNotificationSettings(params) {
|
|
1045
|
+
const { userId, roomId } = params;
|
|
1046
|
+
const res = await this.get(
|
|
1047
|
+
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1048
|
+
);
|
|
1049
|
+
if (!res.ok) {
|
|
1050
|
+
const text = await res.text();
|
|
1051
|
+
throw new LiveblocksError(res.status, text);
|
|
1052
|
+
}
|
|
1053
|
+
return await res.json();
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Updates the user's room notification settings.
|
|
1057
|
+
* @param params.userId The user ID to update the room notification settings for.
|
|
1058
|
+
* @param params.roomId The room ID to update the room notification settings for.
|
|
1059
|
+
* @param params.data The new room notification settings for the user.
|
|
1060
|
+
*/
|
|
1061
|
+
async updateRoomNotificationSettings(params) {
|
|
1062
|
+
const { userId, roomId, data } = params;
|
|
1063
|
+
const res = await this.post(
|
|
1064
|
+
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`,
|
|
1065
|
+
data
|
|
1066
|
+
);
|
|
1067
|
+
if (!res.ok) {
|
|
1068
|
+
const text = await res.text();
|
|
1069
|
+
throw new LiveblocksError(res.status, text);
|
|
1070
|
+
}
|
|
1071
|
+
return await res.json();
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Delete the user's room notification settings.
|
|
1075
|
+
* @param params.userId The user ID to delete the room notification settings from.
|
|
1076
|
+
* @param params.roomId The room ID to delete the room notification settings from.
|
|
1077
|
+
*/
|
|
1078
|
+
async deleteRoomNotificationSettings(params) {
|
|
1079
|
+
const { userId, roomId } = params;
|
|
1080
|
+
const res = await this.delete(
|
|
1081
|
+
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1082
|
+
);
|
|
1083
|
+
if (!res.ok) {
|
|
1084
|
+
const text = await res.text();
|
|
1085
|
+
throw new LiveblocksError(res.status, text);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1034
1088
|
};
|
|
1035
1089
|
var LiveblocksError = class extends Error {
|
|
1036
1090
|
constructor(status, message = "") {
|
|
@@ -1145,6 +1199,7 @@ var _WebhookHandler = class _WebhookHandler {
|
|
|
1145
1199
|
"commentReactionAdded",
|
|
1146
1200
|
"commentReactionRemoved",
|
|
1147
1201
|
"threadMetadataUpdated",
|
|
1202
|
+
"threadEmailNotification",
|
|
1148
1203
|
"threadCreated",
|
|
1149
1204
|
"ydocUpdated"
|
|
1150
1205
|
].includes(event.type))
|