resend 6.9.1 → 6.9.3

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.cjs CHANGED
@@ -1,8 +1,37 @@
1
- let mailparser = require("mailparser");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ let postal_mime = require("postal-mime");
30
+ postal_mime = __toESM(postal_mime);
2
31
  let svix = require("svix");
3
32
 
4
33
  //#region package.json
5
- var version = "6.9.1";
34
+ var version = "6.9.3";
6
35
 
7
36
  //#endregion
8
37
  //#region src/common/utils/build-pagination-query.ts
@@ -587,13 +616,14 @@ var Receiving = class {
587
616
  },
588
617
  headers: null
589
618
  };
590
- const parsed = await (0, mailparser.simpleParser)(await rawResponse.text(), { skipImageLinks: true });
619
+ const rawEmailContent = await rawResponse.text();
620
+ const parsed = await postal_mime.default.parse(rawEmailContent, { attachmentEncoding: "base64" });
591
621
  const attachments = parsed.attachments.map((attachment) => {
592
622
  const contentId = attachment.contentId ? attachment.contentId.replace(/^<|>$/g, "") : void 0;
593
623
  return {
594
624
  filename: attachment.filename,
595
- content: attachment.content.toString("base64"),
596
- content_type: attachment.contentType,
625
+ content: attachment.content.toString(),
626
+ content_type: attachment.mimeType,
597
627
  content_id: contentId || void 0
598
628
  };
599
629
  });
package/dist/index.d.cts CHANGED
@@ -7,6 +7,28 @@ interface ApiKey {
7
7
  name: string;
8
8
  }
9
9
  //#endregion
10
+ //#region src/common/interfaces/attachment.interface.d.ts
11
+ /**
12
+ * Attachment returned by the signed-URL endpoints:
13
+ * - GET /emails/{id}/attachments
14
+ * - GET /emails/{id}/attachments/{id}
15
+ * - GET /emails/receiving/{id}/attachments
16
+ * - GET /emails/receiving/{id}/attachments/{id}
17
+ *
18
+ * Not to be confused with InboundAttachment, which is the raw metadata
19
+ * embedded inside GET /inbounds/{id} — no signed URL, nullable DB columns.
20
+ */
21
+ interface AttachmentData {
22
+ id: string;
23
+ filename?: string;
24
+ size: number;
25
+ content_type: string;
26
+ content_disposition: 'inline' | 'attachment';
27
+ content_id?: string;
28
+ download_url: string;
29
+ expires_at: string;
30
+ }
31
+ //#endregion
10
32
  //#region src/domains/interfaces/domain.d.ts
11
33
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
12
34
  type DomainCapabilityStatus = 'enabled' | 'disabled';
@@ -352,7 +374,14 @@ type Tag = {
352
374
  };
353
375
  //#endregion
354
376
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
355
- type CreateBatchOptions = CreateEmailOptions[];
377
+ /**
378
+ * Email options for batch sending. Same as CreateEmailOptions but without attachments
379
+ * and scheduledAt, as these are not supported in the batch API.
380
+ *
381
+ * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
382
+ */
383
+ type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments' | 'scheduledAt'>;
384
+ type CreateBatchOptions = CreateBatchEmailOptions[];
356
385
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
357
386
  /**
358
387
  * @default 'strict'
@@ -709,6 +738,8 @@ interface CreateContactPropertiesOptions {
709
738
  interface LegacyCreateContactOptions {
710
739
  /**
711
740
  * @deprecated Use `segments` instead to add one or more segments to the new contact
741
+ *
742
+ * @see https://resend.com/docs/dashboard/segments/migrating-from-audiences-to-segments
712
743
  */
713
744
  audienceId: string;
714
745
  email: string;
@@ -716,8 +747,6 @@ interface LegacyCreateContactOptions {
716
747
  firstName?: string;
717
748
  lastName?: string;
718
749
  properties?: CreateContactPropertiesOptions;
719
- segments?: never;
720
- topics?: never;
721
750
  }
722
751
  interface CreateContactOptions {
723
752
  email: string;
@@ -732,10 +761,6 @@ interface CreateContactOptions {
732
761
  id: string;
733
762
  subscription: 'opt_in' | 'opt_out';
734
763
  }[];
735
- /**
736
- * @deprecated Use `segments` instead to add one or more segments to the new contact
737
- */
738
- audienceId?: never;
739
764
  }
740
765
  interface CreateContactRequestOptions extends PostOptions {}
741
766
  interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
@@ -943,18 +968,6 @@ type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
943
968
  };
944
969
  type VerifyDomainsResponse = Response<VerifyDomainsResponseSuccess>;
945
970
  //#endregion
946
- //#region src/common/interfaces/attachment.interface.d.ts
947
- interface Attachment$1 {
948
- id: string;
949
- filename?: string;
950
- size: number;
951
- content_type: string;
952
- content_disposition: 'inline' | 'attachment';
953
- content_id?: string;
954
- download_url: string;
955
- expires_at: string;
956
- }
957
- //#endregion
958
971
  //#region src/emails/attachments/interfaces/get-attachment.interface.d.ts
959
972
  interface GetAttachmentOptions {
960
973
  emailId: string;
@@ -962,22 +975,17 @@ interface GetAttachmentOptions {
962
975
  }
963
976
  type GetAttachmentResponseSuccess = {
964
977
  object: 'attachment';
965
- } & Attachment$1;
978
+ } & AttachmentData;
966
979
  type GetAttachmentResponse = Response<GetAttachmentResponseSuccess>;
967
980
  //#endregion
968
981
  //#region src/emails/attachments/interfaces/list-attachments.interface.d.ts
969
982
  type ListAttachmentsOptions = PaginationOptions & {
970
983
  emailId: string;
971
984
  };
972
- interface ListAttachmentsApiResponse {
973
- object: 'list';
974
- has_more: boolean;
975
- data: Attachment$1[];
976
- }
977
985
  interface ListAttachmentsResponseSuccess {
978
986
  object: 'list';
979
987
  has_more: boolean;
980
- data: Attachment$1[];
988
+ data: AttachmentData[];
981
989
  }
982
990
  type ListAttachmentsResponse = Response<ListAttachmentsResponseSuccess>;
983
991
  //#endregion
@@ -1011,6 +1019,16 @@ interface GetEmailResponseSuccess {
1011
1019
  }
1012
1020
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1013
1021
  //#endregion
1022
+ //#region src/emails/interfaces/list-emails-options.interface.d.ts
1023
+ type ListEmailsOptions = PaginationOptions;
1024
+ type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
1025
+ type ListEmailsResponseSuccess = {
1026
+ object: 'list';
1027
+ has_more: boolean;
1028
+ data: ListEmail[];
1029
+ };
1030
+ type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1031
+ //#endregion
1014
1032
  //#region src/emails/interfaces/update-email-options.interface.d.ts
1015
1033
  interface UpdateEmailOptions {
1016
1034
  id: string;
@@ -1043,6 +1061,22 @@ interface ForwardReceivingEmailResponseSuccess {
1043
1061
  type ForwardReceivingEmailResponse = Response<ForwardReceivingEmailResponseSuccess>;
1044
1062
  //#endregion
1045
1063
  //#region src/emails/receiving/interfaces/get-receiving-email.interface.d.ts
1064
+ /**
1065
+ * Attachment metadata embedded in the GET /inbounds/{id} response.
1066
+ * These are raw DB values — fields are nullable and content_disposition is
1067
+ * not normalized to a literal union.
1068
+ *
1069
+ * Not to be confused with AttachmentData, which is the shape returned by the
1070
+ * dedicated attachment endpoints (includes download_url and expires_at).
1071
+ */
1072
+ interface InboundAttachment {
1073
+ id: string;
1074
+ filename: string | null;
1075
+ size: number;
1076
+ content_type: string;
1077
+ content_id: string | null;
1078
+ content_disposition: string | null;
1079
+ }
1046
1080
  interface GetReceivingEmailResponseSuccess {
1047
1081
  object: 'email';
1048
1082
  id: string;
@@ -1055,20 +1089,13 @@ interface GetReceivingEmailResponseSuccess {
1055
1089
  reply_to: string[] | null;
1056
1090
  html: string | null;
1057
1091
  text: string | null;
1058
- headers: Record<string, string>;
1092
+ headers: Record<string, string> | null;
1059
1093
  message_id: string;
1060
- raw: {
1094
+ raw?: {
1061
1095
  download_url: string;
1062
1096
  expires_at: string;
1063
1097
  } | null;
1064
- attachments: Array<{
1065
- id: string;
1066
- filename: string;
1067
- size: number;
1068
- content_type: string;
1069
- content_id: string;
1070
- content_disposition: string;
1071
- }>;
1098
+ attachments: InboundAttachment[];
1072
1099
  }
1073
1100
  type GetReceivingEmailResponse = Response<GetReceivingEmailResponseSuccess>;
1074
1101
  //#endregion
@@ -1151,7 +1178,8 @@ declare class Contacts {
1151
1178
  readonly topics: ContactTopics;
1152
1179
  readonly segments: ContactSegments;
1153
1180
  constructor(resend: Resend);
1154
- create(payload: CreateContactOptions | LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1181
+ create(paylaod: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1182
+ create(paylaod: LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1155
1183
  list(options?: ListContactsOptions): Promise<ListContactsResponse>;
1156
1184
  get(options: GetContactOptions): Promise<GetContactResponse>;
1157
1185
  update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
@@ -1178,16 +1206,6 @@ declare class Attachments$1 {
1178
1206
  list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
1179
1207
  }
1180
1208
  //#endregion
1181
- //#region src/emails/interfaces/list-emails-options.interface.d.ts
1182
- type ListEmailsOptions = PaginationOptions;
1183
- type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
1184
- type ListEmailsResponseSuccess = {
1185
- object: 'list';
1186
- has_more: boolean;
1187
- data: ListEmail[];
1188
- };
1189
- type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1190
- //#endregion
1191
1209
  //#region src/emails/receiving/attachments/attachments.d.ts
1192
1210
  declare class Attachments {
1193
1211
  private readonly resend;
@@ -1395,7 +1413,7 @@ interface Topic {
1395
1413
  id: string;
1396
1414
  name: string;
1397
1415
  description?: string;
1398
- defaultSubscription: 'opt_in' | 'opt_out';
1416
+ default_subscription: 'opt_in' | 'opt_out';
1399
1417
  created_at: string;
1400
1418
  }
1401
1419
  //#endregion
@@ -1480,10 +1498,10 @@ interface EmailSuppressed {
1480
1498
  }
1481
1499
  interface ReceivedEmailAttachment {
1482
1500
  id: string;
1483
- filename: string;
1501
+ filename: string | null;
1484
1502
  content_type: string;
1485
- content_disposition: string;
1486
- content_id?: string;
1503
+ content_disposition: string | null;
1504
+ content_id: string | null;
1487
1505
  }
1488
1506
  interface ReceivedEmailEventData {
1489
1507
  email_id: string;
@@ -1729,4 +1747,4 @@ declare class Resend {
1729
1747
  delete<T>(path: string, query?: unknown): Promise<Response<T>>;
1730
1748
  }
1731
1749
  //#endregion
1732
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, ApiContactProperty, ApiKey, Attachment, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsApiResponse, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, Template, TemplateVariable, Topic, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };
1750
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, ApiContactProperty, ApiKey, Attachment, AttachmentData, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, Template, TemplateVariable, Topic, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -7,6 +7,28 @@ interface ApiKey {
7
7
  name: string;
8
8
  }
9
9
  //#endregion
10
+ //#region src/common/interfaces/attachment.interface.d.ts
11
+ /**
12
+ * Attachment returned by the signed-URL endpoints:
13
+ * - GET /emails/{id}/attachments
14
+ * - GET /emails/{id}/attachments/{id}
15
+ * - GET /emails/receiving/{id}/attachments
16
+ * - GET /emails/receiving/{id}/attachments/{id}
17
+ *
18
+ * Not to be confused with InboundAttachment, which is the raw metadata
19
+ * embedded inside GET /inbounds/{id} — no signed URL, nullable DB columns.
20
+ */
21
+ interface AttachmentData {
22
+ id: string;
23
+ filename?: string;
24
+ size: number;
25
+ content_type: string;
26
+ content_disposition: 'inline' | 'attachment';
27
+ content_id?: string;
28
+ download_url: string;
29
+ expires_at: string;
30
+ }
31
+ //#endregion
10
32
  //#region src/domains/interfaces/domain.d.ts
11
33
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
12
34
  type DomainCapabilityStatus = 'enabled' | 'disabled';
@@ -352,7 +374,14 @@ type Tag = {
352
374
  };
353
375
  //#endregion
354
376
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
355
- type CreateBatchOptions = CreateEmailOptions[];
377
+ /**
378
+ * Email options for batch sending. Same as CreateEmailOptions but without attachments
379
+ * and scheduledAt, as these are not supported in the batch API.
380
+ *
381
+ * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
382
+ */
383
+ type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments' | 'scheduledAt'>;
384
+ type CreateBatchOptions = CreateBatchEmailOptions[];
356
385
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
357
386
  /**
358
387
  * @default 'strict'
@@ -709,6 +738,8 @@ interface CreateContactPropertiesOptions {
709
738
  interface LegacyCreateContactOptions {
710
739
  /**
711
740
  * @deprecated Use `segments` instead to add one or more segments to the new contact
741
+ *
742
+ * @see https://resend.com/docs/dashboard/segments/migrating-from-audiences-to-segments
712
743
  */
713
744
  audienceId: string;
714
745
  email: string;
@@ -716,8 +747,6 @@ interface LegacyCreateContactOptions {
716
747
  firstName?: string;
717
748
  lastName?: string;
718
749
  properties?: CreateContactPropertiesOptions;
719
- segments?: never;
720
- topics?: never;
721
750
  }
722
751
  interface CreateContactOptions {
723
752
  email: string;
@@ -732,10 +761,6 @@ interface CreateContactOptions {
732
761
  id: string;
733
762
  subscription: 'opt_in' | 'opt_out';
734
763
  }[];
735
- /**
736
- * @deprecated Use `segments` instead to add one or more segments to the new contact
737
- */
738
- audienceId?: never;
739
764
  }
740
765
  interface CreateContactRequestOptions extends PostOptions {}
741
766
  interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
@@ -943,18 +968,6 @@ type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
943
968
  };
944
969
  type VerifyDomainsResponse = Response<VerifyDomainsResponseSuccess>;
945
970
  //#endregion
946
- //#region src/common/interfaces/attachment.interface.d.ts
947
- interface Attachment$1 {
948
- id: string;
949
- filename?: string;
950
- size: number;
951
- content_type: string;
952
- content_disposition: 'inline' | 'attachment';
953
- content_id?: string;
954
- download_url: string;
955
- expires_at: string;
956
- }
957
- //#endregion
958
971
  //#region src/emails/attachments/interfaces/get-attachment.interface.d.ts
959
972
  interface GetAttachmentOptions {
960
973
  emailId: string;
@@ -962,22 +975,17 @@ interface GetAttachmentOptions {
962
975
  }
963
976
  type GetAttachmentResponseSuccess = {
964
977
  object: 'attachment';
965
- } & Attachment$1;
978
+ } & AttachmentData;
966
979
  type GetAttachmentResponse = Response<GetAttachmentResponseSuccess>;
967
980
  //#endregion
968
981
  //#region src/emails/attachments/interfaces/list-attachments.interface.d.ts
969
982
  type ListAttachmentsOptions = PaginationOptions & {
970
983
  emailId: string;
971
984
  };
972
- interface ListAttachmentsApiResponse {
973
- object: 'list';
974
- has_more: boolean;
975
- data: Attachment$1[];
976
- }
977
985
  interface ListAttachmentsResponseSuccess {
978
986
  object: 'list';
979
987
  has_more: boolean;
980
- data: Attachment$1[];
988
+ data: AttachmentData[];
981
989
  }
982
990
  type ListAttachmentsResponse = Response<ListAttachmentsResponseSuccess>;
983
991
  //#endregion
@@ -1011,6 +1019,16 @@ interface GetEmailResponseSuccess {
1011
1019
  }
1012
1020
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1013
1021
  //#endregion
1022
+ //#region src/emails/interfaces/list-emails-options.interface.d.ts
1023
+ type ListEmailsOptions = PaginationOptions;
1024
+ type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
1025
+ type ListEmailsResponseSuccess = {
1026
+ object: 'list';
1027
+ has_more: boolean;
1028
+ data: ListEmail[];
1029
+ };
1030
+ type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1031
+ //#endregion
1014
1032
  //#region src/emails/interfaces/update-email-options.interface.d.ts
1015
1033
  interface UpdateEmailOptions {
1016
1034
  id: string;
@@ -1043,6 +1061,22 @@ interface ForwardReceivingEmailResponseSuccess {
1043
1061
  type ForwardReceivingEmailResponse = Response<ForwardReceivingEmailResponseSuccess>;
1044
1062
  //#endregion
1045
1063
  //#region src/emails/receiving/interfaces/get-receiving-email.interface.d.ts
1064
+ /**
1065
+ * Attachment metadata embedded in the GET /inbounds/{id} response.
1066
+ * These are raw DB values — fields are nullable and content_disposition is
1067
+ * not normalized to a literal union.
1068
+ *
1069
+ * Not to be confused with AttachmentData, which is the shape returned by the
1070
+ * dedicated attachment endpoints (includes download_url and expires_at).
1071
+ */
1072
+ interface InboundAttachment {
1073
+ id: string;
1074
+ filename: string | null;
1075
+ size: number;
1076
+ content_type: string;
1077
+ content_id: string | null;
1078
+ content_disposition: string | null;
1079
+ }
1046
1080
  interface GetReceivingEmailResponseSuccess {
1047
1081
  object: 'email';
1048
1082
  id: string;
@@ -1055,20 +1089,13 @@ interface GetReceivingEmailResponseSuccess {
1055
1089
  reply_to: string[] | null;
1056
1090
  html: string | null;
1057
1091
  text: string | null;
1058
- headers: Record<string, string>;
1092
+ headers: Record<string, string> | null;
1059
1093
  message_id: string;
1060
- raw: {
1094
+ raw?: {
1061
1095
  download_url: string;
1062
1096
  expires_at: string;
1063
1097
  } | null;
1064
- attachments: Array<{
1065
- id: string;
1066
- filename: string;
1067
- size: number;
1068
- content_type: string;
1069
- content_id: string;
1070
- content_disposition: string;
1071
- }>;
1098
+ attachments: InboundAttachment[];
1072
1099
  }
1073
1100
  type GetReceivingEmailResponse = Response<GetReceivingEmailResponseSuccess>;
1074
1101
  //#endregion
@@ -1151,7 +1178,8 @@ declare class Contacts {
1151
1178
  readonly topics: ContactTopics;
1152
1179
  readonly segments: ContactSegments;
1153
1180
  constructor(resend: Resend);
1154
- create(payload: CreateContactOptions | LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1181
+ create(paylaod: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1182
+ create(paylaod: LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1155
1183
  list(options?: ListContactsOptions): Promise<ListContactsResponse>;
1156
1184
  get(options: GetContactOptions): Promise<GetContactResponse>;
1157
1185
  update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
@@ -1178,16 +1206,6 @@ declare class Attachments$1 {
1178
1206
  list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
1179
1207
  }
1180
1208
  //#endregion
1181
- //#region src/emails/interfaces/list-emails-options.interface.d.ts
1182
- type ListEmailsOptions = PaginationOptions;
1183
- type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
1184
- type ListEmailsResponseSuccess = {
1185
- object: 'list';
1186
- has_more: boolean;
1187
- data: ListEmail[];
1188
- };
1189
- type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1190
- //#endregion
1191
1209
  //#region src/emails/receiving/attachments/attachments.d.ts
1192
1210
  declare class Attachments {
1193
1211
  private readonly resend;
@@ -1395,7 +1413,7 @@ interface Topic {
1395
1413
  id: string;
1396
1414
  name: string;
1397
1415
  description?: string;
1398
- defaultSubscription: 'opt_in' | 'opt_out';
1416
+ default_subscription: 'opt_in' | 'opt_out';
1399
1417
  created_at: string;
1400
1418
  }
1401
1419
  //#endregion
@@ -1480,10 +1498,10 @@ interface EmailSuppressed {
1480
1498
  }
1481
1499
  interface ReceivedEmailAttachment {
1482
1500
  id: string;
1483
- filename: string;
1501
+ filename: string | null;
1484
1502
  content_type: string;
1485
- content_disposition: string;
1486
- content_id?: string;
1503
+ content_disposition: string | null;
1504
+ content_id: string | null;
1487
1505
  }
1488
1506
  interface ReceivedEmailEventData {
1489
1507
  email_id: string;
@@ -1729,4 +1747,4 @@ declare class Resend {
1729
1747
  delete<T>(path: string, query?: unknown): Promise<Response<T>>;
1730
1748
  }
1731
1749
  //#endregion
1732
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, ApiContactProperty, ApiKey, Attachment, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsApiResponse, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, Template, TemplateVariable, Topic, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };
1750
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, ApiContactProperty, ApiKey, Attachment, AttachmentData, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, Template, TemplateVariable, Topic, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { simpleParser } from "mailparser";
1
+ import PostalMime from "postal-mime";
2
2
  import { Webhook } from "svix";
3
3
 
4
4
  //#region package.json
5
- var version = "6.9.1";
5
+ var version = "6.9.3";
6
6
 
7
7
  //#endregion
8
8
  //#region src/common/utils/build-pagination-query.ts
@@ -587,13 +587,14 @@ var Receiving = class {
587
587
  },
588
588
  headers: null
589
589
  };
590
- const parsed = await simpleParser(await rawResponse.text(), { skipImageLinks: true });
590
+ const rawEmailContent = await rawResponse.text();
591
+ const parsed = await PostalMime.parse(rawEmailContent, { attachmentEncoding: "base64" });
591
592
  const attachments = parsed.attachments.map((attachment) => {
592
593
  const contentId = attachment.contentId ? attachment.contentId.replace(/^<|>$/g, "") : void 0;
593
594
  return {
594
595
  filename: attachment.filename,
595
- content: attachment.content.toString("base64"),
596
- content_type: attachment.contentType,
596
+ content: attachment.content.toString(),
597
+ content_type: attachment.mimeType,
597
598
  content_id: contentId || void 0
598
599
  };
599
600
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.9.1",
3
+ "version": "6.9.3",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "homepage": "https://github.com/resend/resend-node#readme",
42
42
  "dependencies": {
43
- "mailparser": "3.9.1",
43
+ "postal-mime": "2.7.3",
44
44
  "svix": "1.84.1"
45
45
  },
46
46
  "peerDependencies": {
@@ -52,20 +52,20 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@biomejs/biome": "2.3.13",
55
+ "@biomejs/biome": "2.3.14",
56
56
  "@pollyjs/adapter-fetch": "6.0.7",
57
57
  "@pollyjs/core": "6.0.6",
58
58
  "@pollyjs/persister-fs": "6.0.6",
59
59
  "@types/mailparser": "3.4.6",
60
- "@types/node": "24.10.9",
61
- "@types/react": "19.2.10",
60
+ "@types/node": "24.10.13",
61
+ "@types/react": "19.2.13",
62
62
  "cross-env": "10.1.0",
63
- "dotenv": "17.2.3",
64
- "pkg-pr-new": "0.0.62",
63
+ "dotenv": "17.2.4",
64
+ "pkg-pr-new": "0.0.65",
65
65
  "react": "19.2.4",
66
66
  "react-dom": "19.2.4",
67
67
  "rimraf": "6.1.2",
68
- "tsdown": "0.20.1",
68
+ "tsdown": "0.20.3",
69
69
  "typescript": "5.9.3",
70
70
  "vitest": "4.0.18",
71
71
  "vitest-fetch-mock": "0.4.5"