@liveblocks/node 2.17.0-usrnotsettings3 → 2.17.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { BaseUserMeta, DU, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, UserNotificationSettings, PartialUserNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, DS, NotificationChannel } 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, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, DS } 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
  declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
@@ -755,29 +755,6 @@ declare class Liveblocks {
755
755
  deleteAllInboxNotifications(params: {
756
756
  userId: string;
757
757
  }): Promise<void>;
758
- /**
759
- * Get notification settings for a user for a project.
760
- * @param params.userId The user ID to get the notifications settings for.
761
- */
762
- getNotificationSettings(params: {
763
- userId: string;
764
- }): Promise<UserNotificationSettings>;
765
- /**
766
- * Update the user's notification settings.
767
- * @param params.userId The user ID to update the notification settings for.
768
- * @param params.data The new notification settings for the user.
769
- */
770
- updateNotificationSettings(params: {
771
- userId: string;
772
- data: PartialUserNotificationSettings;
773
- }): Promise<UserNotificationSettings>;
774
- /**
775
- * Delete the user's notification settings
776
- * @param params.userId The user ID to update the notification settings for.
777
- */
778
- deleteNotificationSettings(params: {
779
- userId: string;
780
- }): Promise<void>;
781
758
  }
782
759
  declare class LiveblocksError extends Error {
783
760
  status: number;
@@ -1050,7 +1027,7 @@ type ThreadMarkedAsUnresolvedEvent = {
1050
1027
  type ThreadNotificationEvent = {
1051
1028
  type: "notification";
1052
1029
  data: {
1053
- channel: NotificationChannel;
1030
+ channel: "email";
1054
1031
  kind: "thread";
1055
1032
  projectId: string;
1056
1033
  roomId: string;
@@ -1067,7 +1044,7 @@ type ThreadNotificationEvent = {
1067
1044
  type TextMentionNotificationEvent = {
1068
1045
  type: "notification";
1069
1046
  data: {
1070
- channel: NotificationChannel;
1047
+ channel: "email";
1071
1048
  kind: "textMention";
1072
1049
  projectId: string;
1073
1050
  roomId: string;
@@ -1081,10 +1058,11 @@ type TextMentionNotificationEvent = {
1081
1058
  createdAt: string;
1082
1059
  };
1083
1060
  };
1061
+ type CustomKind = `$${string}`;
1084
1062
  type CustomNotificationEvent = {
1085
1063
  type: "notification";
1086
1064
  data: {
1087
- channel: NotificationChannel;
1065
+ channel: "email";
1088
1066
  kind: CustomKind;
1089
1067
  projectId: string;
1090
1068
  roomId: string | null;
@@ -1122,17 +1100,6 @@ declare function isThreadNotificationEvent(event: WebhookEvent): event is Thread
1122
1100
  * @returns A boolean type predicate.
1123
1101
  */
1124
1102
  declare function isTextMentionNotificationEvent(event: WebhookEvent): event is TextMentionNotificationEvent;
1125
- /**
1126
- * Type guard to check if a webhook event is a `CustomNotificationEvent`
1127
- *
1128
- * The check is made against the event type and event data kind.
1129
- * You should use this guard to safely check the webhook event you received
1130
- * when you're expecting a `CustomNotificationEvent`.
1131
- *
1132
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1133
- * @returns A boolean type predicate.
1134
- */
1135
- declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
1136
1103
 
1137
1104
  /**
1138
1105
  * @deprecated RoomInfo was renamed to RoomData, to avoid
@@ -1141,4 +1108,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
1141
1108
  */
1142
1109
  type RoomInfo = RoomData;
1143
1110
 
1144
- export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
1111
+ export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BaseUserMeta, DU, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, UserNotificationSettings, PartialUserNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, DS, NotificationChannel } 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, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, DS } 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
  declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
@@ -755,29 +755,6 @@ declare class Liveblocks {
755
755
  deleteAllInboxNotifications(params: {
756
756
  userId: string;
757
757
  }): Promise<void>;
758
- /**
759
- * Get notification settings for a user for a project.
760
- * @param params.userId The user ID to get the notifications settings for.
761
- */
762
- getNotificationSettings(params: {
763
- userId: string;
764
- }): Promise<UserNotificationSettings>;
765
- /**
766
- * Update the user's notification settings.
767
- * @param params.userId The user ID to update the notification settings for.
768
- * @param params.data The new notification settings for the user.
769
- */
770
- updateNotificationSettings(params: {
771
- userId: string;
772
- data: PartialUserNotificationSettings;
773
- }): Promise<UserNotificationSettings>;
774
- /**
775
- * Delete the user's notification settings
776
- * @param params.userId The user ID to update the notification settings for.
777
- */
778
- deleteNotificationSettings(params: {
779
- userId: string;
780
- }): Promise<void>;
781
758
  }
782
759
  declare class LiveblocksError extends Error {
783
760
  status: number;
@@ -1050,7 +1027,7 @@ type ThreadMarkedAsUnresolvedEvent = {
1050
1027
  type ThreadNotificationEvent = {
1051
1028
  type: "notification";
1052
1029
  data: {
1053
- channel: NotificationChannel;
1030
+ channel: "email";
1054
1031
  kind: "thread";
1055
1032
  projectId: string;
1056
1033
  roomId: string;
@@ -1067,7 +1044,7 @@ type ThreadNotificationEvent = {
1067
1044
  type TextMentionNotificationEvent = {
1068
1045
  type: "notification";
1069
1046
  data: {
1070
- channel: NotificationChannel;
1047
+ channel: "email";
1071
1048
  kind: "textMention";
1072
1049
  projectId: string;
1073
1050
  roomId: string;
@@ -1081,10 +1058,11 @@ type TextMentionNotificationEvent = {
1081
1058
  createdAt: string;
1082
1059
  };
1083
1060
  };
1061
+ type CustomKind = `$${string}`;
1084
1062
  type CustomNotificationEvent = {
1085
1063
  type: "notification";
1086
1064
  data: {
1087
- channel: NotificationChannel;
1065
+ channel: "email";
1088
1066
  kind: CustomKind;
1089
1067
  projectId: string;
1090
1068
  roomId: string | null;
@@ -1122,17 +1100,6 @@ declare function isThreadNotificationEvent(event: WebhookEvent): event is Thread
1122
1100
  * @returns A boolean type predicate.
1123
1101
  */
1124
1102
  declare function isTextMentionNotificationEvent(event: WebhookEvent): event is TextMentionNotificationEvent;
1125
- /**
1126
- * Type guard to check if a webhook event is a `CustomNotificationEvent`
1127
- *
1128
- * The check is made against the event type and event data kind.
1129
- * You should use this guard to safely check the webhook event you received
1130
- * when you're expecting a `CustomNotificationEvent`.
1131
- *
1132
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1133
- * @returns A boolean type predicate.
1134
- */
1135
- declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
1136
1103
 
1137
1104
  /**
1138
1105
  * @deprecated RoomInfo was renamed to RoomData, to avoid
@@ -1141,4 +1108,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
1141
1108
  */
1142
1109
  type RoomInfo = RoomData;
1143
1110
 
1144
- export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
1111
+ export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
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 = "2.17.0-usrnotsettings3";
6
+ var PKG_VERSION = "2.17.0";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // src/client.ts
@@ -1201,50 +1201,6 @@ var Liveblocks = class {
1201
1201
  throw new LiveblocksError(res.status, text);
1202
1202
  }
1203
1203
  }
1204
- /**
1205
- * Get notification settings for a user for a project.
1206
- * @param params.userId The user ID to get the notifications settings for.
1207
- */
1208
- async getNotificationSettings(params) {
1209
- const { userId } = params;
1210
- const res = await this.#get(_core.url`/v2/users/${userId}/notification-settings`);
1211
- if (!res.ok) {
1212
- const text = await res.text();
1213
- throw new LiveblocksError(res.status, text);
1214
- }
1215
- return await res.json();
1216
- }
1217
- /**
1218
- * Update the user's notification settings.
1219
- * @param params.userId The user ID to update the notification settings for.
1220
- * @param params.data The new notification settings for the user.
1221
- */
1222
- async updateNotificationSettings(params) {
1223
- const { userId, data } = params;
1224
- const res = await this.#post(
1225
- _core.url`/v2/users/${userId}/notification-settings`,
1226
- data
1227
- );
1228
- if (!res.ok) {
1229
- const text = await res.text();
1230
- throw new LiveblocksError(res.status, text);
1231
- }
1232
- return await res.json();
1233
- }
1234
- /**
1235
- * Delete the user's notification settings
1236
- * @param params.userId The user ID to update the notification settings for.
1237
- */
1238
- async deleteNotificationSettings(params) {
1239
- const { userId } = params;
1240
- const res = await this.#delete(
1241
- _core.url`/v2/users/${userId}/notification-settings`
1242
- );
1243
- if (!res.ok) {
1244
- const text = await res.text();
1245
- throw new LiveblocksError(res.status, text);
1246
- }
1247
- }
1248
1204
  };
1249
1205
  var LiveblocksError = class extends Error {
1250
1206
 
@@ -1369,11 +1325,11 @@ var WebhookHandler = class _WebhookHandler {
1369
1325
  ].includes(event.type)) {
1370
1326
  if (event.type === "notification") {
1371
1327
  const notification = event;
1372
- if (notification.data.kind === "thread" || notification.data.kind === "textMention" || isCustomKind(notification.data.kind)) {
1328
+ if (notification.data.kind === "thread" || notification.data.kind === "textMention" || notification.data.kind.startsWith("$")) {
1373
1329
  return;
1374
1330
  } else {
1375
1331
  throw new Error(
1376
- `Unknown notification kind: ${JSON.stringify(notification.data.kind)}`
1332
+ `Unknown notification kind: ${notification.data.kind}`
1377
1333
  );
1378
1334
  }
1379
1335
  }
@@ -1386,25 +1342,18 @@ var WebhookHandler = class _WebhookHandler {
1386
1342
  };
1387
1343
  var WEBHOOK_TOLERANCE_IN_SECONDS = 5 * 60;
1388
1344
  var isNotUndefined = (value) => value !== void 0;
1389
- var isCustomKind = (value) => {
1390
- return isString(value) && value.startsWith("$");
1391
- };
1392
1345
  function isThreadNotificationEvent(event) {
1393
1346
  return event.type === "notification" && event.data.kind === "thread";
1394
1347
  }
1395
1348
  function isTextMentionNotificationEvent(event) {
1396
1349
  return event.type === "notification" && event.data.kind === "textMention";
1397
1350
  }
1398
- function isCustomNotificationEvent(event) {
1399
- return event.type === "notification" && isCustomKind(event.data.kind);
1400
- }
1401
1351
 
1402
1352
  // src/index.ts
1403
1353
 
1404
1354
 
1405
1355
 
1406
1356
 
1407
-
1408
1357
  _core.detectDupes.call(void 0, PKG_NAME, PKG_VERSION, PKG_FORMAT);
1409
1358
 
1410
1359
 
@@ -1414,7 +1363,5 @@ _core.detectDupes.call(void 0, PKG_NAME, PKG_VERSION, PKG_FORMAT);
1414
1363
 
1415
1364
 
1416
1365
 
1417
-
1418
-
1419
- exports.Liveblocks = Liveblocks; exports.LiveblocksError = LiveblocksError; exports.WebhookHandler = WebhookHandler; exports.getMentionedIdsFromCommentBody = _core.getMentionedIdsFromCommentBody; exports.isCustomNotificationEvent = isCustomNotificationEvent; exports.isNotificationChannelEnabled = _core.isNotificationChannelEnabled; exports.isTextMentionNotificationEvent = isTextMentionNotificationEvent; exports.isThreadNotificationEvent = isThreadNotificationEvent; exports.stringifyCommentBody = _core.stringifyCommentBody;
1366
+ exports.Liveblocks = Liveblocks; exports.LiveblocksError = LiveblocksError; exports.WebhookHandler = WebhookHandler; exports.getMentionedIdsFromCommentBody = _core.getMentionedIdsFromCommentBody; exports.isTextMentionNotificationEvent = isTextMentionNotificationEvent; exports.isThreadNotificationEvent = isThreadNotificationEvent; exports.stringifyCommentBody = _core.stringifyCommentBody;
1420
1367
  //# sourceMappingURL=index.js.map