resend 0.9.0 → 0.10.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.0",
3
+ "version": "0.10.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
36
  "@types/react": "18.0.17",
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.2",
40
+ "supertest": "6.3.3",
41
41
  "ts-jest": "28.0.8",
42
42
  "tslint": "6.1.3",
43
43
  "typescript": "4.7.4"
@@ -9,7 +9,7 @@ export interface SendEmailData {
9
9
  /** Cc recipient email address. Max 50. */
10
10
  cc?: string | string[];
11
11
  /** Reply-to email address. Max 50. */
12
- reply_to?: string | string[];
12
+ replyTo?: string | string[];
13
13
  /** Email subject. */
14
14
  subject?: string;
15
15
  /** The HTML version of the message. */
@@ -18,4 +18,26 @@ export interface SendEmailData {
18
18
  html?: string;
19
19
  /** The React version of the message. */
20
20
  react?: ReactElement;
21
+ /** Attachments */
22
+ attachments?: any[];
23
+ }
24
+ export interface SendEmailRequest {
25
+ /** Sender email address. */
26
+ from: string;
27
+ /** Recipient email address. Max 50. */
28
+ to: string | string[];
29
+ /** Bcc recipient email address. Max 50. */
30
+ bcc?: string | string[];
31
+ /** Cc recipient email address. Max 50. */
32
+ cc?: string | string[];
33
+ /** Reply-to email address. Max 50. */
34
+ reply_to?: string | string[];
35
+ /** Email subject. */
36
+ subject?: string;
37
+ /** The HTML version of the message. */
38
+ text?: string;
39
+ /** The plain text version of the message. */
40
+ html?: string;
41
+ /** Attachments */
42
+ attachments?: any[];
21
43
  }
@@ -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) {
@@ -45,7 +47,21 @@ class Resend {
45
47
  data.html = (0, render_1.render)(data.react);
46
48
  delete data.react;
47
49
  }
48
- const response = yield this.request(path, { method: 'POST', data });
50
+ const requestData = {
51
+ from: data.from,
52
+ to: data.to,
53
+ bcc: data.bcc,
54
+ cc: data.cc,
55
+ reply_to: data.replyTo,
56
+ subject: data.subject,
57
+ text: data.text,
58
+ html: data.html,
59
+ attachments: data.attachments,
60
+ };
61
+ const response = yield this.request(path, {
62
+ method: 'POST',
63
+ data: requestData,
64
+ });
49
65
  return response.data;
50
66
  }
51
67
  catch (error) {
@@ -86,20 +86,26 @@ describe('Resend', () => {
86
86
  const data = yield resend.sendEmail(payload);
87
87
  expect(data).toMatchSnapshot();
88
88
  }));
89
- it('sends email with multiple reply_to emails', () => __awaiter(void 0, void 0, void 0, function* () {
90
- const payload = {
89
+ it('sends email with multiple replyTo emails', () => __awaiter(void 0, void 0, void 0, function* () {
90
+ const apiPayload = {
91
91
  from: 'admin@resend.com',
92
92
  to: 'bu@resend.com',
93
93
  reply_to: ['foo@resend.com', 'bar@resend.com'],
94
94
  subject: 'Hello World',
95
95
  };
96
- mock.onPost('https://api.resend.com/email', payload).replyOnce(200, {
96
+ mock.onPost('https://api.resend.com/email', apiPayload).replyOnce(200, {
97
97
  id: '1234',
98
98
  from: 'admin@resend.com',
99
99
  to: 'bu@resend.com',
100
100
  reply_to: ['foo@resend.com', 'bar@resend.com'],
101
101
  created_at: '123',
102
102
  });
103
+ const payload = {
104
+ from: 'admin@resend.com',
105
+ to: 'bu@resend.com',
106
+ replyTo: ['foo@resend.com', 'bar@resend.com'],
107
+ subject: 'Hello World',
108
+ };
103
109
  const data = yield resend.sendEmail(payload);
104
110
  expect(data).toMatchSnapshot();
105
111
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.9.0",
3
+ "version": "0.10.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
36
  "@types/react": "18.0.17",
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.2",
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
+ }