@liveblocks/node 3.15.3 → 3.15.5

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.cts CHANGED
@@ -104,6 +104,15 @@ type Identity = {
104
104
  type ThreadParticipants = {
105
105
  participantIds: string[];
106
106
  };
107
+ type AttachmentWithUrl = {
108
+ type: "attachment";
109
+ id: string;
110
+ mimeType: string;
111
+ name: string;
112
+ size: number;
113
+ url: string;
114
+ expiresAt: string;
115
+ };
107
116
  type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = {
108
117
  roomId: string;
109
118
  data: {
@@ -901,6 +910,18 @@ declare class Liveblocks {
901
910
  threadId: string;
902
911
  commentId: string;
903
912
  }, options?: RequestOptions): Promise<void>;
913
+ /**
914
+ * Gets an attachment's metadata and a presigned download URL.
915
+ *
916
+ * @param params.roomId The room ID the attachment belongs to.
917
+ * @param params.attachmentId The attachment ID (starts with "at_").
918
+ * @param options.signal (optional) An abort signal to cancel the request.
919
+ * @returns The attachment metadata including a presigned download URL.
920
+ */
921
+ getAttachment(params: {
922
+ roomId: string;
923
+ attachmentId: string;
924
+ }, options?: RequestOptions): Promise<AttachmentWithUrl>;
904
925
  /**
905
926
  * Creates a new thread. The thread will be created with the specified comment as its first comment.
906
927
  * If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
package/dist/index.d.ts CHANGED
@@ -104,6 +104,15 @@ type Identity = {
104
104
  type ThreadParticipants = {
105
105
  participantIds: string[];
106
106
  };
107
+ type AttachmentWithUrl = {
108
+ type: "attachment";
109
+ id: string;
110
+ mimeType: string;
111
+ name: string;
112
+ size: number;
113
+ url: string;
114
+ expiresAt: string;
115
+ };
107
116
  type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = {
108
117
  roomId: string;
109
118
  data: {
@@ -901,6 +910,18 @@ declare class Liveblocks {
901
910
  threadId: string;
902
911
  commentId: string;
903
912
  }, options?: RequestOptions): Promise<void>;
913
+ /**
914
+ * Gets an attachment's metadata and a presigned download URL.
915
+ *
916
+ * @param params.roomId The room ID the attachment belongs to.
917
+ * @param params.attachmentId The attachment ID (starts with "at_").
918
+ * @param options.signal (optional) An abort signal to cancel the request.
919
+ * @returns The attachment metadata including a presigned download URL.
920
+ */
921
+ getAttachment(params: {
922
+ roomId: string;
923
+ attachmentId: string;
924
+ }, options?: RequestOptions): Promise<AttachmentWithUrl>;
904
925
  /**
905
926
  * Creates a new thread. The thread will be created with the specified comment as its first comment.
906
927
  * If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
3
3
 
4
4
  // src/version.ts
5
5
  var PKG_NAME = "@liveblocks/node";
6
- var PKG_VERSION = "3.15.3";
6
+ var PKG_VERSION = "3.15.5";
7
7
  var PKG_FORMAT = "esm";
8
8
 
9
9
  // src/client.ts
@@ -1126,6 +1126,26 @@ var Liveblocks = class {
1126
1126
  throw await LiveblocksError.from(res);
1127
1127
  }
1128
1128
  }
1129
+ /**
1130
+ * Gets an attachment's metadata and a presigned download URL.
1131
+ *
1132
+ * @param params.roomId The room ID the attachment belongs to.
1133
+ * @param params.attachmentId The attachment ID (starts with "at_").
1134
+ * @param options.signal (optional) An abort signal to cancel the request.
1135
+ * @returns The attachment metadata including a presigned download URL.
1136
+ */
1137
+ async getAttachment(params, options) {
1138
+ const { roomId, attachmentId } = params;
1139
+ const res = await this.#get(
1140
+ url2`/v2/rooms/${roomId}/attachments/${attachmentId}`,
1141
+ void 0,
1142
+ options
1143
+ );
1144
+ if (!res.ok) {
1145
+ throw await LiveblocksError.from(res);
1146
+ }
1147
+ return await res.json();
1148
+ }
1129
1149
  /**
1130
1150
  * Creates a new thread. The thread will be created with the specified comment as its first comment.
1131
1151
  * If the thread already exists, a `LiveblocksError` will be thrown with status code 409.