@liveblocks/node 1.9.8-pre1 → 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 +57 -4
- package/dist/index.d.ts +57 -4
- package/dist/index.js +72 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction } from '@liveblocks/core';
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs,
|
|
1
|
+
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } from '@liveblocks/core';
|
|
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
|
|
|
5
5
|
/**
|
|
@@ -621,6 +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
|
+
*/
|
|
629
|
+
getInboxNotification(params: {
|
|
630
|
+
userId: string;
|
|
631
|
+
inboxNotificationId: string;
|
|
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>;
|
|
624
662
|
}
|
|
625
663
|
|
|
626
664
|
declare class WebhookHandler {
|
|
@@ -679,7 +717,7 @@ declare type WebhookRequest = {
|
|
|
679
717
|
*/
|
|
680
718
|
rawBody: string;
|
|
681
719
|
};
|
|
682
|
-
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;
|
|
683
721
|
declare type StorageUpdatedEvent = {
|
|
684
722
|
type: "storageUpdated";
|
|
685
723
|
data: {
|
|
@@ -860,5 +898,20 @@ declare type ThreadCreatedEvent = {
|
|
|
860
898
|
createdBy: string;
|
|
861
899
|
};
|
|
862
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
|
+
};
|
|
863
916
|
|
|
864
|
-
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,5 +1,5 @@
|
|
|
1
|
-
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction } from '@liveblocks/core';
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs,
|
|
1
|
+
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } from '@liveblocks/core';
|
|
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
|
|
|
5
5
|
/**
|
|
@@ -621,6 +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
|
+
*/
|
|
629
|
+
getInboxNotification(params: {
|
|
630
|
+
userId: string;
|
|
631
|
+
inboxNotificationId: string;
|
|
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>;
|
|
624
662
|
}
|
|
625
663
|
|
|
626
664
|
declare class WebhookHandler {
|
|
@@ -679,7 +717,7 @@ declare type WebhookRequest = {
|
|
|
679
717
|
*/
|
|
680
718
|
rawBody: string;
|
|
681
719
|
};
|
|
682
|
-
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;
|
|
683
721
|
declare type StorageUpdatedEvent = {
|
|
684
722
|
type: "storageUpdated";
|
|
685
723
|
data: {
|
|
@@ -860,5 +898,20 @@ declare type ThreadCreatedEvent = {
|
|
|
860
898
|
createdBy: string;
|
|
861
899
|
};
|
|
862
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
|
+
};
|
|
863
916
|
|
|
864
|
-
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.
|
|
6
|
+
var PKG_VERSION = "1.10.0-beta2";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/utils.ts
|
|
@@ -1015,6 +1015,76 @@ 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
|
+
*/
|
|
1023
|
+
async getInboxNotification(params) {
|
|
1024
|
+
const { userId, inboxNotificationId } = params;
|
|
1025
|
+
const res = await this.get(
|
|
1026
|
+
url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
|
|
1027
|
+
);
|
|
1028
|
+
if (!res.ok) {
|
|
1029
|
+
const text = await res.text();
|
|
1030
|
+
throw new LiveblocksError(res.status, text);
|
|
1031
|
+
}
|
|
1032
|
+
const data = await res.json();
|
|
1033
|
+
return {
|
|
1034
|
+
...data,
|
|
1035
|
+
notifiedAt: new Date(data.notifiedAt),
|
|
1036
|
+
readAt: data.readAt ? new Date(data.readAt) : null
|
|
1037
|
+
};
|
|
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
|
+
}
|
|
1018
1088
|
};
|
|
1019
1089
|
var LiveblocksError = class extends Error {
|
|
1020
1090
|
constructor(status, message = "") {
|
|
@@ -1129,6 +1199,7 @@ var _WebhookHandler = class _WebhookHandler {
|
|
|
1129
1199
|
"commentReactionAdded",
|
|
1130
1200
|
"commentReactionRemoved",
|
|
1131
1201
|
"threadMetadataUpdated",
|
|
1202
|
+
"threadEmailNotification",
|
|
1132
1203
|
"threadCreated",
|
|
1133
1204
|
"ydocUpdated"
|
|
1134
1205
|
].includes(event.type))
|