resend 0.9.1 → 0.11.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -27,17 +27,17 @@
27
27
  },
28
28
  "homepage": "https://github.com/resend-inc/resend-node#readme",
29
29
  "dependencies": {
30
- "@react-email/render": "^0.0.1",
30
+ "@react-email/render": "0.0.5",
31
31
  "axios": "0.27.2"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "28.1.7",
34
+ "@types/jest": "28.1.8",
35
35
  "@types/node": "18.6.4",
36
- "@types/react": "18.0.17",
36
+ "@types/react": "18.0.27",
37
37
  "axios-mock-adapter": "1.21.2",
38
38
  "jest": "28.1.3",
39
- "prettier": "2.7.1",
40
- "supertest": "6.2.4",
39
+ "prettier": "2.8.4",
40
+ "supertest": "6.3.3",
41
41
  "ts-jest": "28.0.8",
42
42
  "tslint": "6.1.3",
43
43
  "typescript": "4.7.4"
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { ReactElement } from 'react';
2
3
  export interface SendEmailData {
3
4
  /** Sender email address. */
@@ -9,7 +10,7 @@ export interface SendEmailData {
9
10
  /** Cc recipient email address. Max 50. */
10
11
  cc?: string | string[];
11
12
  /** Reply-to email address. Max 50. */
12
- replyTo?: string | string[];
13
+ reply_to?: string | string[];
13
14
  /** Email subject. */
14
15
  subject?: string;
15
16
  /** The HTML version of the message. */
@@ -18,6 +19,12 @@ export interface SendEmailData {
18
19
  html?: string;
19
20
  /** The React version of the message. */
20
21
  react?: ReactElement;
22
+ /** Attachments */
23
+ attachments?: Attachment[];
24
+ }
25
+ interface Attachment {
26
+ content?: string | Buffer;
27
+ filename?: string | false | undefined;
21
28
  }
22
29
  export interface SendEmailRequest {
23
30
  /** Sender email address. */
@@ -36,4 +43,19 @@ export interface SendEmailRequest {
36
43
  text?: string;
37
44
  /** The plain text version of the message. */
38
45
  html?: string;
46
+ /** Attachments */
47
+ attachments?: any[];
48
+ }
49
+ interface EmailResponse extends Pick<SendEmailRequest, 'to' | 'from'> {
50
+ id: string;
51
+ created_at: string;
52
+ }
53
+ interface ErrorResponse {
54
+ error: {
55
+ message: string;
56
+ status: number;
57
+ type: string;
58
+ };
39
59
  }
60
+ export declare type SendEmailResponse = EmailResponse | ErrorResponse;
61
+ export {};
@@ -1,9 +1,9 @@
1
- import { SendEmailData } from './interfaces';
1
+ import { SendEmailData, SendEmailResponse } from './interfaces';
2
2
  export declare class Resend {
3
3
  readonly apiKey?: string | undefined;
4
4
  readonly baseUrl: string;
5
5
  private readonly headers;
6
6
  private readonly request;
7
7
  constructor(apiKey?: string | undefined);
8
- sendEmail(data: SendEmailData): Promise<object>;
8
+ sendEmail(data: SendEmailData): Promise<SendEmailResponse>;
9
9
  }
@@ -35,6 +35,8 @@ class Resend {
35
35
  this.request = axios_1.default.create({
36
36
  baseURL: this.baseUrl,
37
37
  headers: this.headers,
38
+ maxContentLength: Infinity,
39
+ maxBodyLength: Infinity,
38
40
  });
39
41
  }
40
42
  sendEmail(data) {
@@ -50,10 +52,11 @@ class Resend {
50
52
  to: data.to,
51
53
  bcc: data.bcc,
52
54
  cc: data.cc,
53
- reply_to: data.replyTo,
55
+ reply_to: data.reply_to,
54
56
  subject: data.subject,
55
57
  text: data.text,
56
58
  html: data.html,
59
+ attachments: data.attachments,
57
60
  };
58
61
  const response = yield this.request(path, {
59
62
  method: 'POST',
@@ -103,7 +103,7 @@ describe('Resend', () => {
103
103
  const payload = {
104
104
  from: 'admin@resend.com',
105
105
  to: 'bu@resend.com',
106
- replyTo: ['foo@resend.com', 'bar@resend.com'],
106
+ reply_to: ['foo@resend.com', 'bar@resend.com'],
107
107
  subject: 'Hello World',
108
108
  };
109
109
  const data = yield resend.sendEmail(payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "homepage": "https://github.com/resend-inc/resend-node#readme",
29
29
  "dependencies": {
30
- "@react-email/render": "^0.0.1",
30
+ "@react-email/render": "0.0.5",
31
31
  "axios": "0.27.2"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "28.1.7",
34
+ "@types/jest": "28.1.8",
35
35
  "@types/node": "18.6.4",
36
- "@types/react": "18.0.17",
36
+ "@types/react": "18.0.27",
37
37
  "axios-mock-adapter": "1.21.2",
38
38
  "jest": "28.1.3",
39
- "prettier": "2.7.1",
40
- "supertest": "6.2.4",
39
+ "prettier": "2.8.4",
40
+ "supertest": "6.3.3",
41
41
  "ts-jest": "28.0.8",
42
42
  "tslint": "6.1.3",
43
43
  "typescript": "4.7.4"
44
44
  }
45
- }
45
+ }