resend 0.16.0 → 0.17.1
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/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"homepage": "https://github.com/resend-inc/resend-node#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@react-email/render": "0.0.7",
|
|
31
|
-
"axios": "1.4.0"
|
|
31
|
+
"axios": "1.4.0",
|
|
32
|
+
"type-fest": "3.13.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@types/jest": "29.5.
|
|
35
|
+
"@types/jest": "29.5.3",
|
|
35
36
|
"@types/node": "18.16.2",
|
|
36
37
|
"@types/react": "18.2.0",
|
|
37
38
|
"axios-mock-adapter": "1.21.5",
|
|
38
|
-
"jest": "29.
|
|
39
|
-
"prettier": "
|
|
39
|
+
"jest": "29.6.1",
|
|
40
|
+
"prettier": "3.0.0",
|
|
40
41
|
"supertest": "6.3.3",
|
|
41
|
-
"ts-jest": "29.1.
|
|
42
|
+
"ts-jest": "29.1.1",
|
|
42
43
|
"tslint": "6.1.3",
|
|
43
|
-
"typescript": "5.1.
|
|
44
|
+
"typescript": "5.1.6"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { PostOptions } from '../../common/interfaces';
|
|
4
|
-
|
|
4
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
5
|
+
interface CreateEmailBaseOptions {
|
|
5
6
|
attachments?: Attachment[];
|
|
6
7
|
bcc?: string | string[];
|
|
7
8
|
cc?: string | string[];
|
|
8
9
|
from: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
react?: React.ReactElement | React.ReactNode | null;
|
|
9
12
|
html?: string;
|
|
10
|
-
|
|
13
|
+
text?: string;
|
|
11
14
|
reply_to?: string | string[];
|
|
12
15
|
subject: string;
|
|
13
16
|
tags?: Tag[];
|
|
14
|
-
text?: string;
|
|
15
17
|
to: string | string[];
|
|
16
18
|
}
|
|
19
|
+
export type CreateEmailOptions = RequireAtLeastOne<CreateEmailBaseOptions, 'react' | 'html' | 'text'>;
|
|
17
20
|
export interface CreateEmailRequestOptions extends PostOptions {
|
|
18
21
|
}
|
|
19
22
|
export interface CreateEmailResponse {
|
package/build/src/resend.spec.js
CHANGED
|
@@ -27,6 +27,7 @@ describe('Resend', () => {
|
|
|
27
27
|
from: 'bu@resend.com',
|
|
28
28
|
to: 'zeno@resend.com',
|
|
29
29
|
subject: 'Hello World',
|
|
30
|
+
html: '<h1>Hello world</h1>',
|
|
30
31
|
};
|
|
31
32
|
mock.onPost('/emails', payload).replyOnce(200, {
|
|
32
33
|
id: '1234',
|
|
@@ -49,6 +50,7 @@ describe('Resend', () => {
|
|
|
49
50
|
from: 'admin@resend.com',
|
|
50
51
|
to: ['bu@resend.com', 'zeno@resend.com'],
|
|
51
52
|
subject: 'Hello World',
|
|
53
|
+
text: 'Hello world',
|
|
52
54
|
};
|
|
53
55
|
mock.onPost('/emails', payload).replyOnce(200, {
|
|
54
56
|
id: '1234',
|
|
@@ -75,6 +77,7 @@ describe('Resend', () => {
|
|
|
75
77
|
to: 'bu@resend.com',
|
|
76
78
|
bcc: ['foo@resend.com', 'bar@resend.com'],
|
|
77
79
|
subject: 'Hello World',
|
|
80
|
+
text: 'Hello world',
|
|
78
81
|
};
|
|
79
82
|
mock.onPost('/emails', payload).replyOnce(200, {
|
|
80
83
|
id: '1234',
|
|
@@ -103,6 +106,7 @@ describe('Resend', () => {
|
|
|
103
106
|
to: 'bu@resend.com',
|
|
104
107
|
cc: ['foo@resend.com', 'bar@resend.com'],
|
|
105
108
|
subject: 'Hello World',
|
|
109
|
+
text: 'Hello world',
|
|
106
110
|
};
|
|
107
111
|
mock.onPost('/emails', payload).replyOnce(200, {
|
|
108
112
|
id: '1234',
|
|
@@ -131,6 +135,7 @@ describe('Resend', () => {
|
|
|
131
135
|
to: 'bu@resend.com',
|
|
132
136
|
reply_to: ['foo@resend.com', 'bar@resend.com'],
|
|
133
137
|
subject: 'Hello World',
|
|
138
|
+
text: 'Hello world',
|
|
134
139
|
};
|
|
135
140
|
mock.onPost('/emails', apiPayload).replyOnce(200, {
|
|
136
141
|
id: '1234',
|
|
@@ -144,6 +149,7 @@ describe('Resend', () => {
|
|
|
144
149
|
to: 'bu@resend.com',
|
|
145
150
|
reply_to: ['foo@resend.com', 'bar@resend.com'],
|
|
146
151
|
subject: 'Hello World',
|
|
152
|
+
text: 'Hello world',
|
|
147
153
|
};
|
|
148
154
|
const data = yield resend.emails.send(payload);
|
|
149
155
|
expect(data).toMatchInlineSnapshot(`
|
|
@@ -159,4 +165,24 @@ describe('Resend', () => {
|
|
|
159
165
|
}
|
|
160
166
|
`);
|
|
161
167
|
}));
|
|
168
|
+
it('can send an email with headers', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
+
const payload = {
|
|
170
|
+
from: 'admin@resend.com',
|
|
171
|
+
headers: {
|
|
172
|
+
'X-Entity-Ref-ID': '123',
|
|
173
|
+
},
|
|
174
|
+
subject: 'Hello World',
|
|
175
|
+
text: 'Hello world',
|
|
176
|
+
to: 'bu@resend.com',
|
|
177
|
+
};
|
|
178
|
+
mock.onPost('/emails', payload).replyOnce(200, {
|
|
179
|
+
id: '1234',
|
|
180
|
+
});
|
|
181
|
+
const data = yield resend.emails.send(payload);
|
|
182
|
+
expect(data).toMatchInlineSnapshot(`
|
|
183
|
+
{
|
|
184
|
+
"id": "1234",
|
|
185
|
+
}
|
|
186
|
+
`);
|
|
187
|
+
}));
|
|
162
188
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"homepage": "https://github.com/resend-inc/resend-node#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@react-email/render": "0.0.7",
|
|
31
|
-
"axios": "1.4.0"
|
|
31
|
+
"axios": "1.4.0",
|
|
32
|
+
"type-fest": "3.13.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@types/jest": "29.5.
|
|
35
|
+
"@types/jest": "29.5.3",
|
|
35
36
|
"@types/node": "18.16.2",
|
|
36
37
|
"@types/react": "18.2.0",
|
|
37
38
|
"axios-mock-adapter": "1.21.5",
|
|
38
|
-
"jest": "29.
|
|
39
|
-
"prettier": "
|
|
39
|
+
"jest": "29.6.1",
|
|
40
|
+
"prettier": "3.0.0",
|
|
40
41
|
"supertest": "6.3.3",
|
|
41
|
-
"ts-jest": "29.1.
|
|
42
|
+
"ts-jest": "29.1.1",
|
|
42
43
|
"tslint": "6.1.3",
|
|
43
|
-
"typescript": "5.1.
|
|
44
|
+
"typescript": "5.1.6"
|
|
44
45
|
}
|
|
45
46
|
}
|