@liveblocks/node 1.11.3 → 1.12.0-lexical3

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,4 +1,4 @@
1
- import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } from '@liveblocks/core';
1
+ import { IUserInfo, Json, PlainLsonObject, JsonObject, BaseMetadata, QueryMetadata, ThreadData, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData } 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
 
@@ -175,6 +175,7 @@ declare type RoomAccesses = Record<string, [
175
175
  "room:write"
176
176
  ] | ["room:read", "room:presence:write"]>;
177
177
  declare type RoomMetadata = Record<string, string | string[]>;
178
+ declare type QueryRoomMetadata = Record<string, string>;
178
179
  declare type RoomInfo = {
179
180
  type: "room";
180
181
  id: string;
@@ -266,14 +267,46 @@ declare class Liveblocks {
266
267
  * @param params.userId (optional) A filter on users accesses.
267
268
  * @param params.metadata (optional) A filter on metadata. Multiple metadata keys can be used to filter rooms.
268
269
  * @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used.
270
+ * @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID.
269
271
  * @returns A list of rooms.
270
272
  */
271
273
  getRooms(params?: {
272
274
  limit?: number;
273
275
  startingAfter?: string;
274
- metadata?: RoomMetadata;
276
+ /**
277
+ * @deprecated Use `query` instead.
278
+ */
279
+ metadata?: QueryRoomMetadata;
275
280
  userId?: string;
276
281
  groupIds?: string[];
282
+ /**
283
+ * The query to filter rooms by. It is based on our query language.
284
+ * @example
285
+ * ```
286
+ * {
287
+ * query: 'metadata["status"]:"open" AND roomId^"liveblocks:"'
288
+ * }
289
+ * ```
290
+ * @example
291
+ * ```
292
+ * {
293
+ * query: {
294
+ * metadata: {
295
+ * status: "open",
296
+ * },
297
+ * roomId: {
298
+ * startsWith: "liveblocks:"
299
+ * }
300
+ * }
301
+ * }
302
+ * ```
303
+ */
304
+ query?: string | {
305
+ metadata?: QueryRoomMetadata;
306
+ roomId?: {
307
+ startsWith: string;
308
+ };
309
+ };
277
310
  }): Promise<{
278
311
  nextPage: string | null;
279
312
  nextCursor: string | null;
@@ -456,10 +489,39 @@ declare class Liveblocks {
456
489
  * Gets all the threads in a room.
457
490
  *
458
491
  * @param params.roomId The room ID to get the threads from.
492
+ * @param params.query The query to filter threads by. It is based on our query language and can filter by metadata.
459
493
  * @returns A list of threads.
460
494
  */
461
- getThreads(params: {
495
+ getThreads<M extends BaseMetadata>(params: {
462
496
  roomId: string;
497
+ /**
498
+ * The query to filter threads by. It is based on our query language.
499
+ *
500
+ * @example
501
+ * ```
502
+ * {
503
+ * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['resolved']:false AND metadata['priority']:3"
504
+ * }
505
+ * ```
506
+ * @example
507
+ * ```
508
+ * {
509
+ * query: {
510
+ * metadata: {
511
+ * status: "open",
512
+ * resolved: false,
513
+ * priority: 3,
514
+ * organization: {
515
+ * startsWith: "liveblocks:"
516
+ * }
517
+ * }
518
+ * }
519
+ * }
520
+ * ```
521
+ */
522
+ query?: string | {
523
+ metadata?: Partial<QueryMetadata<M>>;
524
+ };
463
525
  }): Promise<{
464
526
  data: ThreadData[];
465
527
  }>;
@@ -470,10 +532,10 @@ declare class Liveblocks {
470
532
  * @param params.threadId The thread ID.
471
533
  * @returns A thread.
472
534
  */
473
- getThread<TThreadMetadata extends BaseMetadata = never>(params: {
535
+ getThread<M extends BaseMetadata = never>(params: {
474
536
  roomId: string;
475
537
  threadId: string;
476
- }): Promise<ThreadData<TThreadMetadata>>;
538
+ }): Promise<ThreadData<M>>;
477
539
  /**
478
540
  * Gets a thread's participants.
479
541
  *
@@ -559,17 +621,17 @@ declare class Liveblocks {
559
621
  * @param params.thread.comment.body The body of the comment.
560
622
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
561
623
  */
562
- createThread<TThreadMetadata extends BaseMetadata = never>(params: {
624
+ createThread<M extends BaseMetadata = never>(params: {
563
625
  roomId: string;
564
626
  data: {
565
- metadata?: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
627
+ metadata?: [M] extends [never] ? Record<string, never> : M;
566
628
  comment: {
567
629
  userId: string;
568
630
  createdAt?: Date;
569
631
  body: CommentBody;
570
632
  };
571
633
  };
572
- }): Promise<ThreadData<TThreadMetadata>>;
634
+ }): Promise<ThreadData<M>>;
573
635
  /**
574
636
  * Updates the metadata of the specified thread in a room.
575
637
  * @param params.roomId The room ID to update the thread in.
@@ -579,7 +641,7 @@ declare class Liveblocks {
579
641
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
580
642
  * @returns The updated thread.
581
643
  */
582
- editThreadMetadata<TThreadMetadata extends BaseMetadata = never>(params: {
644
+ editThreadMetadata<M extends BaseMetadata = never>(params: {
583
645
  roomId: string;
584
646
  threadId: string;
585
647
  data: {
@@ -587,7 +649,7 @@ declare class Liveblocks {
587
649
  userId: string;
588
650
  updatedAt?: Date;
589
651
  };
590
- }): Promise<TThreadMetadata>;
652
+ }): Promise<M>;
591
653
  /**
592
654
  * Adds a new comment reaction to a comment.
593
655
  * @param params.roomId The room ID to add the comment reaction in.
@@ -674,6 +736,13 @@ declare class Liveblocks {
674
736
  currentRoomId: string;
675
737
  newRoomId: string;
676
738
  }): Promise<RoomInfo>;
739
+ triggerInboxNotification(params: {
740
+ userId: string;
741
+ kind: `$${string}`;
742
+ roomId?: string;
743
+ subjectId: string;
744
+ activityData: ActivityData;
745
+ }): Promise<void>;
677
746
  }
678
747
  declare class LiveblocksError extends Error {
679
748
  status: number;
@@ -922,7 +991,7 @@ declare type ThreadCreatedEvent = {
922
991
  createdBy: string;
923
992
  };
924
993
  };
925
- declare type NotificationEvent = {
994
+ declare type ThreadNotificationEvent = {
926
995
  type: "notification";
927
996
  data: {
928
997
  channel: "email";
@@ -939,5 +1008,41 @@ declare type NotificationEvent = {
939
1008
  createdAt: string;
940
1009
  };
941
1010
  };
1011
+ declare type TextMentionNotificationEvent = {
1012
+ type: "notification";
1013
+ data: {
1014
+ channel: "email";
1015
+ kind: "textMention";
1016
+ projectId: string;
1017
+ roomId: string;
1018
+ userId: string;
1019
+ mentionId: string;
1020
+ inboxNotificationId: string;
1021
+ /**
1022
+ * ISO 8601 datestring
1023
+ * @example "2021-03-01T12:00:00.000Z"
1024
+ */
1025
+ createdAt: string;
1026
+ };
1027
+ };
1028
+ declare type CustomKind = `$${string}`;
1029
+ declare type CustomNotificationEvent = {
1030
+ type: "notification";
1031
+ data: {
1032
+ channel: "email";
1033
+ kind: CustomKind;
1034
+ projectId: string;
1035
+ roomId: string | null;
1036
+ userId: string;
1037
+ subjectId: string;
1038
+ inboxNotificationId: string;
1039
+ /**
1040
+ * ISO 8601 datestring
1041
+ * @example "2021-03-01T12:00:00.000Z"
1042
+ */
1043
+ createdAt: string;
1044
+ };
1045
+ };
1046
+ declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificationEvent | CustomNotificationEvent;
942
1047
 
943
1048
  export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, 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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } from '@liveblocks/core';
1
+ import { IUserInfo, Json, PlainLsonObject, JsonObject, BaseMetadata, QueryMetadata, ThreadData, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData } 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
 
@@ -175,6 +175,7 @@ declare type RoomAccesses = Record<string, [
175
175
  "room:write"
176
176
  ] | ["room:read", "room:presence:write"]>;
177
177
  declare type RoomMetadata = Record<string, string | string[]>;
178
+ declare type QueryRoomMetadata = Record<string, string>;
178
179
  declare type RoomInfo = {
179
180
  type: "room";
180
181
  id: string;
@@ -266,14 +267,46 @@ declare class Liveblocks {
266
267
  * @param params.userId (optional) A filter on users accesses.
267
268
  * @param params.metadata (optional) A filter on metadata. Multiple metadata keys can be used to filter rooms.
268
269
  * @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used.
270
+ * @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID.
269
271
  * @returns A list of rooms.
270
272
  */
271
273
  getRooms(params?: {
272
274
  limit?: number;
273
275
  startingAfter?: string;
274
- metadata?: RoomMetadata;
276
+ /**
277
+ * @deprecated Use `query` instead.
278
+ */
279
+ metadata?: QueryRoomMetadata;
275
280
  userId?: string;
276
281
  groupIds?: string[];
282
+ /**
283
+ * The query to filter rooms by. It is based on our query language.
284
+ * @example
285
+ * ```
286
+ * {
287
+ * query: 'metadata["status"]:"open" AND roomId^"liveblocks:"'
288
+ * }
289
+ * ```
290
+ * @example
291
+ * ```
292
+ * {
293
+ * query: {
294
+ * metadata: {
295
+ * status: "open",
296
+ * },
297
+ * roomId: {
298
+ * startsWith: "liveblocks:"
299
+ * }
300
+ * }
301
+ * }
302
+ * ```
303
+ */
304
+ query?: string | {
305
+ metadata?: QueryRoomMetadata;
306
+ roomId?: {
307
+ startsWith: string;
308
+ };
309
+ };
277
310
  }): Promise<{
278
311
  nextPage: string | null;
279
312
  nextCursor: string | null;
@@ -456,10 +489,39 @@ declare class Liveblocks {
456
489
  * Gets all the threads in a room.
457
490
  *
458
491
  * @param params.roomId The room ID to get the threads from.
492
+ * @param params.query The query to filter threads by. It is based on our query language and can filter by metadata.
459
493
  * @returns A list of threads.
460
494
  */
461
- getThreads(params: {
495
+ getThreads<M extends BaseMetadata>(params: {
462
496
  roomId: string;
497
+ /**
498
+ * The query to filter threads by. It is based on our query language.
499
+ *
500
+ * @example
501
+ * ```
502
+ * {
503
+ * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['resolved']:false AND metadata['priority']:3"
504
+ * }
505
+ * ```
506
+ * @example
507
+ * ```
508
+ * {
509
+ * query: {
510
+ * metadata: {
511
+ * status: "open",
512
+ * resolved: false,
513
+ * priority: 3,
514
+ * organization: {
515
+ * startsWith: "liveblocks:"
516
+ * }
517
+ * }
518
+ * }
519
+ * }
520
+ * ```
521
+ */
522
+ query?: string | {
523
+ metadata?: Partial<QueryMetadata<M>>;
524
+ };
463
525
  }): Promise<{
464
526
  data: ThreadData[];
465
527
  }>;
@@ -470,10 +532,10 @@ declare class Liveblocks {
470
532
  * @param params.threadId The thread ID.
471
533
  * @returns A thread.
472
534
  */
473
- getThread<TThreadMetadata extends BaseMetadata = never>(params: {
535
+ getThread<M extends BaseMetadata = never>(params: {
474
536
  roomId: string;
475
537
  threadId: string;
476
- }): Promise<ThreadData<TThreadMetadata>>;
538
+ }): Promise<ThreadData<M>>;
477
539
  /**
478
540
  * Gets a thread's participants.
479
541
  *
@@ -559,17 +621,17 @@ declare class Liveblocks {
559
621
  * @param params.thread.comment.body The body of the comment.
560
622
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
561
623
  */
562
- createThread<TThreadMetadata extends BaseMetadata = never>(params: {
624
+ createThread<M extends BaseMetadata = never>(params: {
563
625
  roomId: string;
564
626
  data: {
565
- metadata?: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
627
+ metadata?: [M] extends [never] ? Record<string, never> : M;
566
628
  comment: {
567
629
  userId: string;
568
630
  createdAt?: Date;
569
631
  body: CommentBody;
570
632
  };
571
633
  };
572
- }): Promise<ThreadData<TThreadMetadata>>;
634
+ }): Promise<ThreadData<M>>;
573
635
  /**
574
636
  * Updates the metadata of the specified thread in a room.
575
637
  * @param params.roomId The room ID to update the thread in.
@@ -579,7 +641,7 @@ declare class Liveblocks {
579
641
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
580
642
  * @returns The updated thread.
581
643
  */
582
- editThreadMetadata<TThreadMetadata extends BaseMetadata = never>(params: {
644
+ editThreadMetadata<M extends BaseMetadata = never>(params: {
583
645
  roomId: string;
584
646
  threadId: string;
585
647
  data: {
@@ -587,7 +649,7 @@ declare class Liveblocks {
587
649
  userId: string;
588
650
  updatedAt?: Date;
589
651
  };
590
- }): Promise<TThreadMetadata>;
652
+ }): Promise<M>;
591
653
  /**
592
654
  * Adds a new comment reaction to a comment.
593
655
  * @param params.roomId The room ID to add the comment reaction in.
@@ -674,6 +736,13 @@ declare class Liveblocks {
674
736
  currentRoomId: string;
675
737
  newRoomId: string;
676
738
  }): Promise<RoomInfo>;
739
+ triggerInboxNotification(params: {
740
+ userId: string;
741
+ kind: `$${string}`;
742
+ roomId?: string;
743
+ subjectId: string;
744
+ activityData: ActivityData;
745
+ }): Promise<void>;
677
746
  }
678
747
  declare class LiveblocksError extends Error {
679
748
  status: number;
@@ -922,7 +991,7 @@ declare type ThreadCreatedEvent = {
922
991
  createdBy: string;
923
992
  };
924
993
  };
925
- declare type NotificationEvent = {
994
+ declare type ThreadNotificationEvent = {
926
995
  type: "notification";
927
996
  data: {
928
997
  channel: "email";
@@ -939,5 +1008,41 @@ declare type NotificationEvent = {
939
1008
  createdAt: string;
940
1009
  };
941
1010
  };
1011
+ declare type TextMentionNotificationEvent = {
1012
+ type: "notification";
1013
+ data: {
1014
+ channel: "email";
1015
+ kind: "textMention";
1016
+ projectId: string;
1017
+ roomId: string;
1018
+ userId: string;
1019
+ mentionId: string;
1020
+ inboxNotificationId: string;
1021
+ /**
1022
+ * ISO 8601 datestring
1023
+ * @example "2021-03-01T12:00:00.000Z"
1024
+ */
1025
+ createdAt: string;
1026
+ };
1027
+ };
1028
+ declare type CustomKind = `$${string}`;
1029
+ declare type CustomNotificationEvent = {
1030
+ type: "notification";
1031
+ data: {
1032
+ channel: "email";
1033
+ kind: CustomKind;
1034
+ projectId: string;
1035
+ roomId: string | null;
1036
+ userId: string;
1037
+ subjectId: string;
1038
+ inboxNotificationId: string;
1039
+ /**
1040
+ * ISO 8601 datestring
1041
+ * @example "2021-03-01T12:00:00.000Z"
1042
+ */
1043
+ createdAt: string;
1044
+ };
1045
+ };
1046
+ declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificationEvent | CustomNotificationEvent;
942
1047
 
943
1048
  export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, 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 };
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.11.3";
6
+ var PKG_VERSION = "1.12.0-lexical3";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // src/utils.ts
@@ -115,6 +115,8 @@ function buildLiveblocksAuthorizeEndpoint(options, roomId) {
115
115
 
116
116
 
117
117
 
118
+
119
+
118
120
  // src/Session.ts
119
121
  var ALL_PERMISSIONS = Object.freeze([
120
122
  "room:write",
@@ -405,10 +407,17 @@ var Liveblocks = class {
405
407
  * @param params.userId (optional) A filter on users accesses.
406
408
  * @param params.metadata (optional) A filter on metadata. Multiple metadata keys can be used to filter rooms.
407
409
  * @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used.
410
+ * @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID.
408
411
  * @returns A list of rooms.
409
412
  */
410
413
  async getRooms(params = {}) {
411
414
  const path = url`/v2/rooms`;
415
+ let query;
416
+ if (typeof params.query === "string") {
417
+ query = params.query;
418
+ } else if (typeof params.query === "object") {
419
+ query = _core.objectToQuery.call(void 0, params.query);
420
+ }
412
421
  const queryParams = {
413
422
  limit: params.limit,
414
423
  startingAfter: params.startingAfter,
@@ -416,11 +425,12 @@ var Liveblocks = class {
416
425
  groupIds: params.groupIds ? params.groupIds.join(",") : void 0,
417
426
  // "Flatten" {metadata: {foo: "bar"}} to {"metadata.foo": "bar"}
418
427
  ...Object.fromEntries(
419
- Object.entries(_nullishCoalesce(params.metadata, () => ( {}))).map(([key, val]) => {
420
- const value = Array.isArray(val) ? val.join(",") : val;
421
- return [`metadata.${key}`, value];
422
- })
423
- )
428
+ Object.entries(_nullishCoalesce(params.metadata, () => ( {}))).map(([key, val]) => [
429
+ `metadata.${key}`,
430
+ val
431
+ ])
432
+ ),
433
+ query
424
434
  };
425
435
  const res = await this.get(path, queryParams);
426
436
  if (!res.ok) {
@@ -791,11 +801,20 @@ var Liveblocks = class {
791
801
  * Gets all the threads in a room.
792
802
  *
793
803
  * @param params.roomId The room ID to get the threads from.
804
+ * @param params.query The query to filter threads by. It is based on our query language and can filter by metadata.
794
805
  * @returns A list of threads.
795
806
  */
796
807
  async getThreads(params) {
797
808
  const { roomId } = params;
798
- const res = await this.get(url`/v2/rooms/${roomId}/threads`);
809
+ let query;
810
+ if (typeof params.query === "string") {
811
+ query = params.query;
812
+ } else if (typeof params.query === "object") {
813
+ query = _core.objectToQuery.call(void 0, params.query);
814
+ }
815
+ const res = await this.get(url`/v2/rooms/${roomId}/threads`, {
816
+ query
817
+ });
799
818
  if (!res.ok) {
800
819
  const text = await res.text();
801
820
  throw new LiveblocksError(res.status, text);
@@ -819,9 +838,7 @@ var Liveblocks = class {
819
838
  const text = await res.text();
820
839
  throw new LiveblocksError(res.status, text);
821
840
  }
822
- return _core.convertToThreadData.call(void 0,
823
- await res.json()
824
- );
841
+ return _core.convertToThreadData.call(void 0, await res.json());
825
842
  }
826
843
  /**
827
844
  * Gets a thread's participants.
@@ -951,9 +968,7 @@ var Liveblocks = class {
951
968
  const text = await res.text();
952
969
  throw new LiveblocksError(res.status, text);
953
970
  }
954
- return _core.convertToThreadData.call(void 0,
955
- await res.json()
956
- );
971
+ return _core.convertToThreadData.call(void 0, await res.json());
957
972
  }
958
973
  /**
959
974
  * Updates the metadata of the specified thread in a room.
@@ -1042,12 +1057,9 @@ var Liveblocks = class {
1042
1057
  const text = await res.text();
1043
1058
  throw new LiveblocksError(res.status, text);
1044
1059
  }
1045
- const data = await res.json();
1046
- return {
1047
- ...data,
1048
- notifiedAt: new Date(data.notifiedAt),
1049
- readAt: data.readAt ? new Date(data.readAt) : null
1050
- };
1060
+ return _core.convertToInboxNotificationData.call(void 0,
1061
+ await res.json()
1062
+ );
1051
1063
  }
1052
1064
  /**
1053
1065
  * Gets the user's room notification settings.
@@ -1122,6 +1134,13 @@ var Liveblocks = class {
1122
1134
  lastConnectionAt: data.lastConnectionAt ? new Date(data.lastConnectionAt) : void 0
1123
1135
  };
1124
1136
  }
1137
+ async triggerInboxNotification(params) {
1138
+ const res = await this.post(url`/v2/inbox-notifications/trigger`, params);
1139
+ if (!res.ok) {
1140
+ const text = await res.text();
1141
+ throw new LiveblocksError(res.status, text);
1142
+ }
1143
+ }
1125
1144
  };
1126
1145
  var LiveblocksError = class extends Error {
1127
1146
  constructor(status, message = "") {
@@ -1239,8 +1258,19 @@ var _WebhookHandler = class _WebhookHandler {
1239
1258
  "threadCreated",
1240
1259
  "ydocUpdated",
1241
1260
  "notification"
1242
- ].includes(event.type))
1261
+ ].includes(event.type)) {
1262
+ if (event.type === "notification") {
1263
+ const notification = event;
1264
+ if (notification.data.kind === "thread" || notification.data.kind === "textMention" || notification.data.kind.startsWith("$")) {
1265
+ return;
1266
+ } else {
1267
+ throw new Error(
1268
+ `Unknown notification kind: ${notification.data.kind}`
1269
+ );
1270
+ }
1271
+ }
1243
1272
  return;
1273
+ }
1244
1274
  throw new Error(
1245
1275
  "Unknown event type, please upgrade to a higher version of @liveblocks/node"
1246
1276
  );