@liveblocks/node 2.1.1-test1 → 2.2.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
@@ -432,7 +432,7 @@ declare class Liveblocks {
432
432
  * @example
433
433
  * ```
434
434
  * {
435
- * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['resolved']:false AND metadata['priority']:3"
435
+ * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['pinned']:false AND metadata['priority']:3 AND resolved:true"
436
436
  * }
437
437
  * ```
438
438
  * @example
@@ -441,18 +441,20 @@ declare class Liveblocks {
441
441
  * query: {
442
442
  * metadata: {
443
443
  * status: "open",
444
- * resolved: false,
444
+ * pinned: false,
445
445
  * priority: 3,
446
446
  * organization: {
447
447
  * startsWith: "liveblocks:"
448
448
  * }
449
- * }
449
+ * },
450
+ * resolved: true
450
451
  * }
451
452
  * }
452
453
  * ```
453
454
  */
454
455
  query?: string | {
455
456
  metadata?: Partial<QueryMetadata<M>>;
457
+ resolved?: boolean;
456
458
  };
457
459
  }): Promise<{
458
460
  data: ThreadData<M>[];
@@ -563,6 +565,34 @@ declare class Liveblocks {
563
565
  roomId: string;
564
566
  threadId: string;
565
567
  }): Promise<void>;
568
+ /**
569
+ * Mark a thread as resolved.
570
+ * @param params.roomId The room ID of the thread.
571
+ * @param params.threadId The thread ID to mark as resolved.
572
+ * @param params.data.userId The user ID of the user who marked the thread as resolved.
573
+ * @returns The thread marked as resolved.
574
+ */
575
+ markThreadAsResolved(params: {
576
+ roomId: string;
577
+ threadId: string;
578
+ data: {
579
+ userId: string;
580
+ };
581
+ }): Promise<ThreadData<M>>;
582
+ /**
583
+ * Mark a thread as unresolved.
584
+ * @param params.roomId The room ID of the thread.
585
+ * @param params.threadId The thread ID to mark as unresolved.
586
+ * @param params.data.userId The user ID of the user who marked the thread as unresolved.
587
+ * @returns The thread marked as unresolved.
588
+ */
589
+ markThreadAsUnresolved(params: {
590
+ roomId: string;
591
+ threadId: string;
592
+ data: {
593
+ userId: string;
594
+ };
595
+ }): Promise<ThreadData<M>>;
566
596
  /**
567
597
  * Updates the metadata of the specified thread in a room.
568
598
  * @param params.roomId The room ID to update the thread in.
@@ -570,7 +600,7 @@ declare class Liveblocks {
570
600
  * @param params.data.metadata The metadata for the thread. Value must be a string, boolean or number
571
601
  * @param params.data.userId The user ID of the user who updated the thread.
572
602
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
573
- * @returns The updated thread.
603
+ * @returns The updated thread metadata.
574
604
  */
575
605
  editThreadMetadata(params: {
576
606
  roomId: string;
@@ -736,7 +766,7 @@ declare type WebhookRequest = {
736
766
  */
737
767
  rawBody: string;
738
768
  };
739
- declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | YDocUpdatedEvent;
769
+ declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
740
770
  declare type StorageUpdatedEvent = {
741
771
  type: "storageUpdated";
742
772
  data: {
@@ -935,6 +965,34 @@ declare type ThreadDeletedEvent = {
935
965
  deletedAt: string;
936
966
  };
937
967
  };
968
+ declare type ThreadMarkedAsResolvedEvent = {
969
+ type: "threadMarkedAsResolved";
970
+ data: {
971
+ projectId: string;
972
+ roomId: string;
973
+ threadId: string;
974
+ updatedAt: string;
975
+ /**
976
+ * ISO 8601 datestring
977
+ * @example "2021-03-01T12:00:00.000Z"
978
+ */
979
+ updatedBy: string;
980
+ };
981
+ };
982
+ declare type ThreadMarkedAsUnresolvedEvent = {
983
+ type: "threadMarkedAsUnresolved";
984
+ data: {
985
+ projectId: string;
986
+ roomId: string;
987
+ threadId: string;
988
+ updatedAt: string;
989
+ /**
990
+ * ISO 8601 datestring
991
+ * @example "2021-03-01T12:00:00.000Z"
992
+ */
993
+ updatedBy: string;
994
+ };
995
+ };
938
996
  declare type ThreadNotificationEvent = {
939
997
  type: "notification";
940
998
  data: {
@@ -996,4 +1054,4 @@ declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificati
996
1054
  */
997
1055
  declare type RoomInfo = RoomData;
998
1056
 
999
- 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 ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent };
1057
+ 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 };
package/dist/index.d.ts CHANGED
@@ -432,7 +432,7 @@ declare class Liveblocks {
432
432
  * @example
433
433
  * ```
434
434
  * {
435
- * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['resolved']:false AND metadata['priority']:3"
435
+ * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['pinned']:false AND metadata['priority']:3 AND resolved:true"
436
436
  * }
437
437
  * ```
438
438
  * @example
@@ -441,18 +441,20 @@ declare class Liveblocks {
441
441
  * query: {
442
442
  * metadata: {
443
443
  * status: "open",
444
- * resolved: false,
444
+ * pinned: false,
445
445
  * priority: 3,
446
446
  * organization: {
447
447
  * startsWith: "liveblocks:"
448
448
  * }
449
- * }
449
+ * },
450
+ * resolved: true
450
451
  * }
451
452
  * }
452
453
  * ```
453
454
  */
454
455
  query?: string | {
455
456
  metadata?: Partial<QueryMetadata<M>>;
457
+ resolved?: boolean;
456
458
  };
457
459
  }): Promise<{
458
460
  data: ThreadData<M>[];
@@ -563,6 +565,34 @@ declare class Liveblocks {
563
565
  roomId: string;
564
566
  threadId: string;
565
567
  }): Promise<void>;
568
+ /**
569
+ * Mark a thread as resolved.
570
+ * @param params.roomId The room ID of the thread.
571
+ * @param params.threadId The thread ID to mark as resolved.
572
+ * @param params.data.userId The user ID of the user who marked the thread as resolved.
573
+ * @returns The thread marked as resolved.
574
+ */
575
+ markThreadAsResolved(params: {
576
+ roomId: string;
577
+ threadId: string;
578
+ data: {
579
+ userId: string;
580
+ };
581
+ }): Promise<ThreadData<M>>;
582
+ /**
583
+ * Mark a thread as unresolved.
584
+ * @param params.roomId The room ID of the thread.
585
+ * @param params.threadId The thread ID to mark as unresolved.
586
+ * @param params.data.userId The user ID of the user who marked the thread as unresolved.
587
+ * @returns The thread marked as unresolved.
588
+ */
589
+ markThreadAsUnresolved(params: {
590
+ roomId: string;
591
+ threadId: string;
592
+ data: {
593
+ userId: string;
594
+ };
595
+ }): Promise<ThreadData<M>>;
566
596
  /**
567
597
  * Updates the metadata of the specified thread in a room.
568
598
  * @param params.roomId The room ID to update the thread in.
@@ -570,7 +600,7 @@ declare class Liveblocks {
570
600
  * @param params.data.metadata The metadata for the thread. Value must be a string, boolean or number
571
601
  * @param params.data.userId The user ID of the user who updated the thread.
572
602
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
573
- * @returns The updated thread.
603
+ * @returns The updated thread metadata.
574
604
  */
575
605
  editThreadMetadata(params: {
576
606
  roomId: string;
@@ -736,7 +766,7 @@ declare type WebhookRequest = {
736
766
  */
737
767
  rawBody: string;
738
768
  };
739
- declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | YDocUpdatedEvent;
769
+ declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
740
770
  declare type StorageUpdatedEvent = {
741
771
  type: "storageUpdated";
742
772
  data: {
@@ -935,6 +965,34 @@ declare type ThreadDeletedEvent = {
935
965
  deletedAt: string;
936
966
  };
937
967
  };
968
+ declare type ThreadMarkedAsResolvedEvent = {
969
+ type: "threadMarkedAsResolved";
970
+ data: {
971
+ projectId: string;
972
+ roomId: string;
973
+ threadId: string;
974
+ updatedAt: string;
975
+ /**
976
+ * ISO 8601 datestring
977
+ * @example "2021-03-01T12:00:00.000Z"
978
+ */
979
+ updatedBy: string;
980
+ };
981
+ };
982
+ declare type ThreadMarkedAsUnresolvedEvent = {
983
+ type: "threadMarkedAsUnresolved";
984
+ data: {
985
+ projectId: string;
986
+ roomId: string;
987
+ threadId: string;
988
+ updatedAt: string;
989
+ /**
990
+ * ISO 8601 datestring
991
+ * @example "2021-03-01T12:00:00.000Z"
992
+ */
993
+ updatedBy: string;
994
+ };
995
+ };
938
996
  declare type ThreadNotificationEvent = {
939
997
  type: "notification";
940
998
  data: {
@@ -996,4 +1054,4 @@ declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificati
996
1054
  */
997
1055
  declare type RoomInfo = RoomData;
998
1056
 
999
- 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 ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent };
1057
+ 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 };
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.1.1-test1";
6
+ var PKG_VERSION = "2.2.0";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // src/client.ts
@@ -943,6 +943,44 @@ var Liveblocks = class {
943
943
  throw new LiveblocksError(res.status, text);
944
944
  }
945
945
  }
946
+ /**
947
+ * Mark a thread as resolved.
948
+ * @param params.roomId The room ID of the thread.
949
+ * @param params.threadId The thread ID to mark as resolved.
950
+ * @param params.data.userId The user ID of the user who marked the thread as resolved.
951
+ * @returns The thread marked as resolved.
952
+ */
953
+ async markThreadAsResolved(params) {
954
+ const { roomId, threadId } = params;
955
+ const res = await this.post(
956
+ url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-resolved`,
957
+ {}
958
+ );
959
+ if (!res.ok) {
960
+ const text = await res.text();
961
+ throw new LiveblocksError(res.status, text);
962
+ }
963
+ return _core.convertToThreadData.call(void 0, await res.json());
964
+ }
965
+ /**
966
+ * Mark a thread as unresolved.
967
+ * @param params.roomId The room ID of the thread.
968
+ * @param params.threadId The thread ID to mark as unresolved.
969
+ * @param params.data.userId The user ID of the user who marked the thread as unresolved.
970
+ * @returns The thread marked as unresolved.
971
+ */
972
+ async markThreadAsUnresolved(params) {
973
+ const { roomId, threadId } = params;
974
+ const res = await this.post(
975
+ url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-unresolved`,
976
+ {}
977
+ );
978
+ if (!res.ok) {
979
+ const text = await res.text();
980
+ throw new LiveblocksError(res.status, text);
981
+ }
982
+ return _core.convertToThreadData.call(void 0, await res.json());
983
+ }
946
984
  /**
947
985
  * Updates the metadata of the specified thread in a room.
948
986
  * @param params.roomId The room ID to update the thread in.
@@ -950,7 +988,7 @@ var Liveblocks = class {
950
988
  * @param params.data.metadata The metadata for the thread. Value must be a string, boolean or number
951
989
  * @param params.data.userId The user ID of the user who updated the thread.
952
990
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
953
- * @returns The updated thread.
991
+ * @returns The updated thread metadata.
954
992
  */
955
993
  async editThreadMetadata(params) {
956
994
  const { roomId, threadId, data } = params;
@@ -1229,7 +1267,9 @@ var _WebhookHandler = class _WebhookHandler {
1229
1267
  "threadCreated",
1230
1268
  "threadDeleted",
1231
1269
  "ydocUpdated",
1232
- "notification"
1270
+ "notification",
1271
+ "threadMarkedAsResolved",
1272
+ "threadMarkedAsUnresolved"
1233
1273
  ].includes(event.type)) {
1234
1274
  if (event.type === "notification") {
1235
1275
  const notification = event;