resend 6.9.1 → 6.9.2

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,36 @@
1
- let mailparser = require("mailparser");
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let postal_mime = require("postal-mime");
29
+ postal_mime = __toESM(postal_mime);
2
30
  let svix = require("svix");
3
31
 
4
32
  //#region package.json
5
- var version = "6.9.1";
33
+ var version = "6.9.2";
6
34
 
7
35
  //#endregion
8
36
  //#region src/common/utils/build-pagination-query.ts
@@ -587,13 +615,14 @@ var Receiving = class {
587
615
  },
588
616
  headers: null
589
617
  };
590
- const parsed = await (0, mailparser.simpleParser)(await rawResponse.text(), { skipImageLinks: true });
618
+ const rawEmailContent = await rawResponse.text();
619
+ const parsed = await postal_mime.default.parse(rawEmailContent, { attachmentEncoding: "base64" });
591
620
  const attachments = parsed.attachments.map((attachment) => {
592
621
  const contentId = attachment.contentId ? attachment.contentId.replace(/^<|>$/g, "") : void 0;
593
622
  return {
594
623
  filename: attachment.filename,
595
- content: attachment.content.toString("base64"),
596
- content_type: attachment.contentType,
624
+ content: attachment.content.toString(),
625
+ content_type: attachment.mimeType,
597
626
  content_id: contentId || void 0
598
627
  };
599
628
  });
package/dist/index.d.cts CHANGED
@@ -709,6 +709,8 @@ interface CreateContactPropertiesOptions {
709
709
  interface LegacyCreateContactOptions {
710
710
  /**
711
711
  * @deprecated Use `segments` instead to add one or more segments to the new contact
712
+ *
713
+ * @see https://resend.com/docs/dashboard/segments/migrating-from-audiences-to-segments
712
714
  */
713
715
  audienceId: string;
714
716
  email: string;
@@ -716,8 +718,6 @@ interface LegacyCreateContactOptions {
716
718
  firstName?: string;
717
719
  lastName?: string;
718
720
  properties?: CreateContactPropertiesOptions;
719
- segments?: never;
720
- topics?: never;
721
721
  }
722
722
  interface CreateContactOptions {
723
723
  email: string;
@@ -732,10 +732,6 @@ interface CreateContactOptions {
732
732
  id: string;
733
733
  subscription: 'opt_in' | 'opt_out';
734
734
  }[];
735
- /**
736
- * @deprecated Use `segments` instead to add one or more segments to the new contact
737
- */
738
- audienceId?: never;
739
735
  }
740
736
  interface CreateContactRequestOptions extends PostOptions {}
741
737
  interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
@@ -1063,11 +1059,11 @@ interface GetReceivingEmailResponseSuccess {
1063
1059
  } | null;
1064
1060
  attachments: Array<{
1065
1061
  id: string;
1066
- filename: string;
1062
+ filename: string | null;
1067
1063
  size: number;
1068
1064
  content_type: string;
1069
- content_id: string;
1070
- content_disposition: string;
1065
+ content_id: string | null;
1066
+ content_disposition: string | null;
1071
1067
  }>;
1072
1068
  }
1073
1069
  type GetReceivingEmailResponse = Response<GetReceivingEmailResponseSuccess>;
@@ -1151,7 +1147,8 @@ declare class Contacts {
1151
1147
  readonly topics: ContactTopics;
1152
1148
  readonly segments: ContactSegments;
1153
1149
  constructor(resend: Resend);
1154
- create(payload: CreateContactOptions | LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1150
+ create(paylaod: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1151
+ create(paylaod: LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1155
1152
  list(options?: ListContactsOptions): Promise<ListContactsResponse>;
1156
1153
  get(options: GetContactOptions): Promise<GetContactResponse>;
1157
1154
  update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
@@ -1395,7 +1392,7 @@ interface Topic {
1395
1392
  id: string;
1396
1393
  name: string;
1397
1394
  description?: string;
1398
- defaultSubscription: 'opt_in' | 'opt_out';
1395
+ default_subscription: 'opt_in' | 'opt_out';
1399
1396
  created_at: string;
1400
1397
  }
1401
1398
  //#endregion
@@ -1480,10 +1477,10 @@ interface EmailSuppressed {
1480
1477
  }
1481
1478
  interface ReceivedEmailAttachment {
1482
1479
  id: string;
1483
- filename: string;
1480
+ filename: string | null;
1484
1481
  content_type: string;
1485
- content_disposition: string;
1486
- content_id?: string;
1482
+ content_disposition: string | null;
1483
+ content_id: string | null;
1487
1484
  }
1488
1485
  interface ReceivedEmailEventData {
1489
1486
  email_id: string;
package/dist/index.d.mts CHANGED
@@ -709,6 +709,8 @@ interface CreateContactPropertiesOptions {
709
709
  interface LegacyCreateContactOptions {
710
710
  /**
711
711
  * @deprecated Use `segments` instead to add one or more segments to the new contact
712
+ *
713
+ * @see https://resend.com/docs/dashboard/segments/migrating-from-audiences-to-segments
712
714
  */
713
715
  audienceId: string;
714
716
  email: string;
@@ -716,8 +718,6 @@ interface LegacyCreateContactOptions {
716
718
  firstName?: string;
717
719
  lastName?: string;
718
720
  properties?: CreateContactPropertiesOptions;
719
- segments?: never;
720
- topics?: never;
721
721
  }
722
722
  interface CreateContactOptions {
723
723
  email: string;
@@ -732,10 +732,6 @@ interface CreateContactOptions {
732
732
  id: string;
733
733
  subscription: 'opt_in' | 'opt_out';
734
734
  }[];
735
- /**
736
- * @deprecated Use `segments` instead to add one or more segments to the new contact
737
- */
738
- audienceId?: never;
739
735
  }
740
736
  interface CreateContactRequestOptions extends PostOptions {}
741
737
  interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
@@ -1063,11 +1059,11 @@ interface GetReceivingEmailResponseSuccess {
1063
1059
  } | null;
1064
1060
  attachments: Array<{
1065
1061
  id: string;
1066
- filename: string;
1062
+ filename: string | null;
1067
1063
  size: number;
1068
1064
  content_type: string;
1069
- content_id: string;
1070
- content_disposition: string;
1065
+ content_id: string | null;
1066
+ content_disposition: string | null;
1071
1067
  }>;
1072
1068
  }
1073
1069
  type GetReceivingEmailResponse = Response<GetReceivingEmailResponseSuccess>;
@@ -1151,7 +1147,8 @@ declare class Contacts {
1151
1147
  readonly topics: ContactTopics;
1152
1148
  readonly segments: ContactSegments;
1153
1149
  constructor(resend: Resend);
1154
- create(payload: CreateContactOptions | LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1150
+ create(paylaod: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1151
+ create(paylaod: LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1155
1152
  list(options?: ListContactsOptions): Promise<ListContactsResponse>;
1156
1153
  get(options: GetContactOptions): Promise<GetContactResponse>;
1157
1154
  update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
@@ -1395,7 +1392,7 @@ interface Topic {
1395
1392
  id: string;
1396
1393
  name: string;
1397
1394
  description?: string;
1398
- defaultSubscription: 'opt_in' | 'opt_out';
1395
+ default_subscription: 'opt_in' | 'opt_out';
1399
1396
  created_at: string;
1400
1397
  }
1401
1398
  //#endregion
@@ -1480,10 +1477,10 @@ interface EmailSuppressed {
1480
1477
  }
1481
1478
  interface ReceivedEmailAttachment {
1482
1479
  id: string;
1483
- filename: string;
1480
+ filename: string | null;
1484
1481
  content_type: string;
1485
- content_disposition: string;
1486
- content_id?: string;
1482
+ content_disposition: string | null;
1483
+ content_id: string | null;
1487
1484
  }
1488
1485
  interface ReceivedEmailEventData {
1489
1486
  email_id: string;
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.2";
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.2",
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": {