resend 2.0.0 → 2.0.1-canary.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.
Files changed (77) hide show
  1. package/dist/index.d.mts +353 -0
  2. package/dist/index.d.ts +353 -0
  3. package/dist/index.js +300 -0
  4. package/dist/index.mjs +276 -0
  5. package/package.json +19 -5
  6. package/build/package.json +0 -50
  7. package/build/src/__snapshots__/resend.spec.js.snap +0 -3
  8. package/build/src/api-keys/api-keys.d.ts +0 -9
  9. package/build/src/api-keys/api-keys.js +0 -36
  10. package/build/src/api-keys/api-keys.spec.d.ts +0 -1
  11. package/build/src/api-keys/api-keys.spec.js +0 -349
  12. package/build/src/api-keys/interfaces/create-api-key-options.interface.d.ts +0 -17
  13. package/build/src/api-keys/interfaces/create-api-key-options.interface.js +0 -2
  14. package/build/src/api-keys/interfaces/index.d.ts +0 -3
  15. package/build/src/api-keys/interfaces/index.js +0 -19
  16. package/build/src/api-keys/interfaces/list-api-keys.interface.d.ts +0 -10
  17. package/build/src/api-keys/interfaces/list-api-keys.interface.js +0 -2
  18. package/build/src/api-keys/interfaces/remove-api-keys.interface.d.ts +0 -8
  19. package/build/src/api-keys/interfaces/remove-api-keys.interface.js +0 -2
  20. package/build/src/batch/batch.d.ts +0 -8
  21. package/build/src/batch/batch.js +0 -36
  22. package/build/src/batch/batch.spec.d.ts +0 -1
  23. package/build/src/batch/batch.spec.js +0 -122
  24. package/build/src/batch/interfaces/create-batch-options.interface.d.ts +0 -16
  25. package/build/src/batch/interfaces/create-batch-options.interface.js +0 -2
  26. package/build/src/batch/interfaces/index.d.ts +0 -1
  27. package/build/src/batch/interfaces/index.js +0 -17
  28. package/build/src/common/interfaces/get-option.interface.d.ts +0 -3
  29. package/build/src/common/interfaces/get-option.interface.js +0 -2
  30. package/build/src/common/interfaces/index.d.ts +0 -4
  31. package/build/src/common/interfaces/index.js +0 -20
  32. package/build/src/common/interfaces/list-option.interface.d.ts +0 -4
  33. package/build/src/common/interfaces/list-option.interface.js +0 -2
  34. package/build/src/common/interfaces/post-option.interface.d.ts +0 -5
  35. package/build/src/common/interfaces/post-option.interface.js +0 -2
  36. package/build/src/common/interfaces/put-option.interface.d.ts +0 -5
  37. package/build/src/common/interfaces/put-option.interface.js +0 -2
  38. package/build/src/domains/domains.d.ts +0 -11
  39. package/build/src/domains/domains.js +0 -48
  40. package/build/src/domains/domains.spec.d.ts +0 -1
  41. package/build/src/domains/domains.spec.js +0 -496
  42. package/build/src/domains/interfaces/create-domain-options.interface.d.ts +0 -16
  43. package/build/src/domains/interfaces/create-domain-options.interface.js +0 -2
  44. package/build/src/domains/interfaces/domain.d.ts +0 -33
  45. package/build/src/domains/interfaces/domain.js +0 -2
  46. package/build/src/domains/interfaces/get-domain.interface.d.ts +0 -10
  47. package/build/src/domains/interfaces/get-domain.interface.js +0 -2
  48. package/build/src/domains/interfaces/index.d.ts +0 -5
  49. package/build/src/domains/interfaces/index.js +0 -21
  50. package/build/src/domains/interfaces/list-domains.interface.d.ts +0 -7
  51. package/build/src/domains/interfaces/list-domains.interface.js +0 -2
  52. package/build/src/domains/interfaces/remove-domain.interface.d.ts +0 -7
  53. package/build/src/domains/interfaces/remove-domain.interface.js +0 -2
  54. package/build/src/domains/interfaces/verify-domain.interface.d.ts +0 -7
  55. package/build/src/domains/interfaces/verify-domain.interface.js +0 -2
  56. package/build/src/emails/emails.d.ts +0 -9
  57. package/build/src/emails/emails.js +0 -40
  58. package/build/src/emails/emails.spec.d.ts +0 -1
  59. package/build/src/emails/emails.spec.js +0 -190
  60. package/build/src/emails/interfaces/create-email-options.interface.d.ts +0 -113
  61. package/build/src/emails/interfaces/create-email-options.interface.js +0 -2
  62. package/build/src/emails/interfaces/get-email-options.interface.d.ts +0 -19
  63. package/build/src/emails/interfaces/get-email-options.interface.js +0 -2
  64. package/build/src/emails/interfaces/index.d.ts +0 -2
  65. package/build/src/emails/interfaces/index.js +0 -18
  66. package/build/src/error.d.ts +0 -7
  67. package/build/src/error.js +0 -21
  68. package/build/src/guards.d.ts +0 -9
  69. package/build/src/guards.js +0 -36
  70. package/build/src/index.d.ts +0 -2
  71. package/build/src/index.js +0 -5
  72. package/build/src/interfaces.d.ts +0 -24
  73. package/build/src/interfaces.js +0 -18
  74. package/build/src/resend.d.ts +0 -35
  75. package/build/src/resend.js +0 -83
  76. package/build/src/resend.spec.d.ts +0 -1
  77. package/build/src/resend.spec.js +0 -267
package/dist/index.js ADDED
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, { get: all[name], enumerable: true });
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
+ }
30
+ return to;
31
+ };
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
53
+
54
+ // src/index.ts
55
+ var src_exports = {};
56
+ __export(src_exports, {
57
+ Resend: () => Resend
58
+ });
59
+ module.exports = __toCommonJS(src_exports);
60
+
61
+ // package.json
62
+ var version = "2.0.1-canary.0";
63
+
64
+ // src/api-keys/api-keys.ts
65
+ var ApiKeys = class {
66
+ constructor(resend) {
67
+ this.resend = resend;
68
+ }
69
+ create(_0) {
70
+ return __async(this, arguments, function* (payload, options = {}) {
71
+ const data = yield this.resend.post(
72
+ "/api-keys",
73
+ payload,
74
+ options
75
+ );
76
+ return data;
77
+ });
78
+ }
79
+ list() {
80
+ return __async(this, null, function* () {
81
+ const data = yield this.resend.get("/api-keys");
82
+ return data;
83
+ });
84
+ }
85
+ remove(id) {
86
+ return __async(this, null, function* () {
87
+ const data = yield this.resend.delete(
88
+ `/api-keys/${id}`
89
+ );
90
+ return data;
91
+ });
92
+ }
93
+ };
94
+
95
+ // src/batch/batch.ts
96
+ var import_render = require("@react-email/render");
97
+ var Batch = class {
98
+ constructor(resend) {
99
+ this.resend = resend;
100
+ }
101
+ send(_0) {
102
+ return __async(this, arguments, function* (payload, options = {}) {
103
+ return this.create(payload, options);
104
+ });
105
+ }
106
+ create(_0) {
107
+ return __async(this, arguments, function* (payload, options = {}) {
108
+ for (const email of payload) {
109
+ if (email.react) {
110
+ email.html = yield (0, import_render.renderAsync)(email.react);
111
+ delete email.react;
112
+ }
113
+ }
114
+ const data = yield this.resend.post(
115
+ "/emails/batch",
116
+ payload,
117
+ options
118
+ );
119
+ return data;
120
+ });
121
+ }
122
+ };
123
+
124
+ // src/domains/domains.ts
125
+ var Domains = class {
126
+ constructor(resend) {
127
+ this.resend = resend;
128
+ }
129
+ create(_0) {
130
+ return __async(this, arguments, function* (payload, options = {}) {
131
+ const data = yield this.resend.post(
132
+ "/domains",
133
+ payload,
134
+ options
135
+ );
136
+ return data;
137
+ });
138
+ }
139
+ list() {
140
+ return __async(this, null, function* () {
141
+ const data = yield this.resend.get("/domains");
142
+ return data;
143
+ });
144
+ }
145
+ get(id) {
146
+ return __async(this, null, function* () {
147
+ const data = yield this.resend.get(
148
+ `/domains/${id}`
149
+ );
150
+ return data;
151
+ });
152
+ }
153
+ remove(id) {
154
+ return __async(this, null, function* () {
155
+ const data = yield this.resend.delete(
156
+ `/domains/${id}`
157
+ );
158
+ return data;
159
+ });
160
+ }
161
+ verify(id) {
162
+ return __async(this, null, function* () {
163
+ const data = yield this.resend.post(
164
+ `/domains/${id}/verify`
165
+ );
166
+ return data;
167
+ });
168
+ }
169
+ };
170
+
171
+ // src/emails/emails.ts
172
+ var import_render2 = require("@react-email/render");
173
+ var Emails = class {
174
+ constructor(resend) {
175
+ this.resend = resend;
176
+ }
177
+ send(_0) {
178
+ return __async(this, arguments, function* (payload, options = {}) {
179
+ return this.create(payload, options);
180
+ });
181
+ }
182
+ create(_0) {
183
+ return __async(this, arguments, function* (payload, options = {}) {
184
+ if (payload.react) {
185
+ payload.html = yield (0, import_render2.renderAsync)(payload.react);
186
+ delete payload.react;
187
+ }
188
+ const data = yield this.resend.post(
189
+ "/emails",
190
+ payload,
191
+ options
192
+ );
193
+ return data;
194
+ });
195
+ }
196
+ get(id) {
197
+ return __async(this, null, function* () {
198
+ const data = yield this.resend.get(
199
+ `/emails/${id}`
200
+ );
201
+ return data;
202
+ });
203
+ }
204
+ };
205
+
206
+ // src/guards.ts
207
+ var isResendErrorResponse = (response) => {
208
+ if (typeof response !== "object" || response === null) {
209
+ return false;
210
+ }
211
+ const error = response;
212
+ if (typeof error !== "object" || error === null) {
213
+ return false;
214
+ }
215
+ const { message, name } = error;
216
+ return typeof message === "string" && typeof name === "string";
217
+ };
218
+
219
+ // src/resend.ts
220
+ var baseUrl = process.env.RESEND_BASE_URL || "https://api.resend.com";
221
+ var userAgent = process.env.RESEND_USER_AGENT || `resend-node:${version}`;
222
+ var Resend = class {
223
+ constructor(key) {
224
+ this.key = key;
225
+ this.apiKeys = new ApiKeys(this);
226
+ this.domains = new Domains(this);
227
+ this.emails = new Emails(this);
228
+ this.batch = new Batch(this);
229
+ if (!key) {
230
+ this.key = process.env.RESEND_API_KEY;
231
+ if (!this.key) {
232
+ throw new Error(
233
+ 'Missing API key. Pass it to the constructor `new Resend("re_123")`'
234
+ );
235
+ }
236
+ }
237
+ this.headers = new Headers({
238
+ Authorization: `Bearer ${this.key}`,
239
+ "User-Agent": userAgent,
240
+ "Content-Type": "application/json"
241
+ });
242
+ }
243
+ fetchRequest(_0) {
244
+ return __async(this, arguments, function* (path, options = {}) {
245
+ const response = yield fetch(`${baseUrl}${path}`, options);
246
+ if (!response.ok) {
247
+ const error = yield response.json();
248
+ if (isResendErrorResponse(error)) {
249
+ return { data: null, error };
250
+ }
251
+ return { data: null, error };
252
+ }
253
+ const data = yield response.json();
254
+ return { data, error: null };
255
+ });
256
+ }
257
+ post(_0, _1) {
258
+ return __async(this, arguments, function* (path, entity, options = {}) {
259
+ const requestOptions = __spreadValues({
260
+ method: "POST",
261
+ headers: this.headers,
262
+ body: JSON.stringify(entity)
263
+ }, options);
264
+ return this.fetchRequest(path, requestOptions);
265
+ });
266
+ }
267
+ get(_0) {
268
+ return __async(this, arguments, function* (path, options = {}) {
269
+ const requestOptions = __spreadValues({
270
+ method: "GET",
271
+ headers: this.headers
272
+ }, options);
273
+ return this.fetchRequest(path, requestOptions);
274
+ });
275
+ }
276
+ put(_0, _1) {
277
+ return __async(this, arguments, function* (path, entity, options = {}) {
278
+ const requestOptions = __spreadValues({
279
+ method: "PUT",
280
+ headers: this.headers,
281
+ body: JSON.stringify(entity)
282
+ }, options);
283
+ return this.fetchRequest(path, requestOptions);
284
+ });
285
+ }
286
+ delete(path, query) {
287
+ return __async(this, null, function* () {
288
+ const requestOptions = {
289
+ method: "DELETE",
290
+ headers: this.headers,
291
+ body: JSON.stringify(query)
292
+ };
293
+ return this.fetchRequest(path, requestOptions);
294
+ });
295
+ }
296
+ };
297
+ // Annotate the CommonJS export names for ESM import in node:
298
+ 0 && (module.exports = {
299
+ Resend
300
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,276 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __async = (__this, __arguments, generator) => {
18
+ return new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
+ try {
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ };
26
+ var rejected = (value) => {
27
+ try {
28
+ step(generator.throw(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
+ step((generator = generator.apply(__this, __arguments)).next());
35
+ });
36
+ };
37
+
38
+ // package.json
39
+ var version = "2.0.1-canary.0";
40
+
41
+ // src/api-keys/api-keys.ts
42
+ var ApiKeys = class {
43
+ constructor(resend) {
44
+ this.resend = resend;
45
+ }
46
+ create(_0) {
47
+ return __async(this, arguments, function* (payload, options = {}) {
48
+ const data = yield this.resend.post(
49
+ "/api-keys",
50
+ payload,
51
+ options
52
+ );
53
+ return data;
54
+ });
55
+ }
56
+ list() {
57
+ return __async(this, null, function* () {
58
+ const data = yield this.resend.get("/api-keys");
59
+ return data;
60
+ });
61
+ }
62
+ remove(id) {
63
+ return __async(this, null, function* () {
64
+ const data = yield this.resend.delete(
65
+ `/api-keys/${id}`
66
+ );
67
+ return data;
68
+ });
69
+ }
70
+ };
71
+
72
+ // src/batch/batch.ts
73
+ import { renderAsync } from "@react-email/render";
74
+ var Batch = class {
75
+ constructor(resend) {
76
+ this.resend = resend;
77
+ }
78
+ send(_0) {
79
+ return __async(this, arguments, function* (payload, options = {}) {
80
+ return this.create(payload, options);
81
+ });
82
+ }
83
+ create(_0) {
84
+ return __async(this, arguments, function* (payload, options = {}) {
85
+ for (const email of payload) {
86
+ if (email.react) {
87
+ email.html = yield renderAsync(email.react);
88
+ delete email.react;
89
+ }
90
+ }
91
+ const data = yield this.resend.post(
92
+ "/emails/batch",
93
+ payload,
94
+ options
95
+ );
96
+ return data;
97
+ });
98
+ }
99
+ };
100
+
101
+ // src/domains/domains.ts
102
+ var Domains = class {
103
+ constructor(resend) {
104
+ this.resend = resend;
105
+ }
106
+ create(_0) {
107
+ return __async(this, arguments, function* (payload, options = {}) {
108
+ const data = yield this.resend.post(
109
+ "/domains",
110
+ payload,
111
+ options
112
+ );
113
+ return data;
114
+ });
115
+ }
116
+ list() {
117
+ return __async(this, null, function* () {
118
+ const data = yield this.resend.get("/domains");
119
+ return data;
120
+ });
121
+ }
122
+ get(id) {
123
+ return __async(this, null, function* () {
124
+ const data = yield this.resend.get(
125
+ `/domains/${id}`
126
+ );
127
+ return data;
128
+ });
129
+ }
130
+ remove(id) {
131
+ return __async(this, null, function* () {
132
+ const data = yield this.resend.delete(
133
+ `/domains/${id}`
134
+ );
135
+ return data;
136
+ });
137
+ }
138
+ verify(id) {
139
+ return __async(this, null, function* () {
140
+ const data = yield this.resend.post(
141
+ `/domains/${id}/verify`
142
+ );
143
+ return data;
144
+ });
145
+ }
146
+ };
147
+
148
+ // src/emails/emails.ts
149
+ import { renderAsync as renderAsync2 } from "@react-email/render";
150
+ var Emails = class {
151
+ constructor(resend) {
152
+ this.resend = resend;
153
+ }
154
+ send(_0) {
155
+ return __async(this, arguments, function* (payload, options = {}) {
156
+ return this.create(payload, options);
157
+ });
158
+ }
159
+ create(_0) {
160
+ return __async(this, arguments, function* (payload, options = {}) {
161
+ if (payload.react) {
162
+ payload.html = yield renderAsync2(payload.react);
163
+ delete payload.react;
164
+ }
165
+ const data = yield this.resend.post(
166
+ "/emails",
167
+ payload,
168
+ options
169
+ );
170
+ return data;
171
+ });
172
+ }
173
+ get(id) {
174
+ return __async(this, null, function* () {
175
+ const data = yield this.resend.get(
176
+ `/emails/${id}`
177
+ );
178
+ return data;
179
+ });
180
+ }
181
+ };
182
+
183
+ // src/guards.ts
184
+ var isResendErrorResponse = (response) => {
185
+ if (typeof response !== "object" || response === null) {
186
+ return false;
187
+ }
188
+ const error = response;
189
+ if (typeof error !== "object" || error === null) {
190
+ return false;
191
+ }
192
+ const { message, name } = error;
193
+ return typeof message === "string" && typeof name === "string";
194
+ };
195
+
196
+ // src/resend.ts
197
+ var baseUrl = process.env.RESEND_BASE_URL || "https://api.resend.com";
198
+ var userAgent = process.env.RESEND_USER_AGENT || `resend-node:${version}`;
199
+ var Resend = class {
200
+ constructor(key) {
201
+ this.key = key;
202
+ this.apiKeys = new ApiKeys(this);
203
+ this.domains = new Domains(this);
204
+ this.emails = new Emails(this);
205
+ this.batch = new Batch(this);
206
+ if (!key) {
207
+ this.key = process.env.RESEND_API_KEY;
208
+ if (!this.key) {
209
+ throw new Error(
210
+ 'Missing API key. Pass it to the constructor `new Resend("re_123")`'
211
+ );
212
+ }
213
+ }
214
+ this.headers = new Headers({
215
+ Authorization: `Bearer ${this.key}`,
216
+ "User-Agent": userAgent,
217
+ "Content-Type": "application/json"
218
+ });
219
+ }
220
+ fetchRequest(_0) {
221
+ return __async(this, arguments, function* (path, options = {}) {
222
+ const response = yield fetch(`${baseUrl}${path}`, options);
223
+ if (!response.ok) {
224
+ const error = yield response.json();
225
+ if (isResendErrorResponse(error)) {
226
+ return { data: null, error };
227
+ }
228
+ return { data: null, error };
229
+ }
230
+ const data = yield response.json();
231
+ return { data, error: null };
232
+ });
233
+ }
234
+ post(_0, _1) {
235
+ return __async(this, arguments, function* (path, entity, options = {}) {
236
+ const requestOptions = __spreadValues({
237
+ method: "POST",
238
+ headers: this.headers,
239
+ body: JSON.stringify(entity)
240
+ }, options);
241
+ return this.fetchRequest(path, requestOptions);
242
+ });
243
+ }
244
+ get(_0) {
245
+ return __async(this, arguments, function* (path, options = {}) {
246
+ const requestOptions = __spreadValues({
247
+ method: "GET",
248
+ headers: this.headers
249
+ }, options);
250
+ return this.fetchRequest(path, requestOptions);
251
+ });
252
+ }
253
+ put(_0, _1) {
254
+ return __async(this, arguments, function* (path, entity, options = {}) {
255
+ const requestOptions = __spreadValues({
256
+ method: "PUT",
257
+ headers: this.headers,
258
+ body: JSON.stringify(entity)
259
+ }, options);
260
+ return this.fetchRequest(path, requestOptions);
261
+ });
262
+ }
263
+ delete(path, query) {
264
+ return __async(this, null, function* () {
265
+ const requestOptions = {
266
+ method: "DELETE",
267
+ headers: this.headers,
268
+ body: JSON.stringify(query)
269
+ };
270
+ return this.fetchRequest(path, requestOptions);
271
+ });
272
+ }
273
+ };
274
+ export {
275
+ Resend
276
+ };
package/package.json CHANGED
@@ -1,18 +1,31 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-canary.0",
4
4
  "description": "Node.js library for the Resend API",
5
- "main": "build/src/index.js",
6
- "typings": "build/src/index.d.ts",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
7
8
  "files": [
8
- "build/"
9
+ "dist/**"
9
10
  ],
10
11
  "engines": {
11
12
  "node": ">=18"
12
13
  },
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.mjs"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ }
25
+ },
13
26
  "packageManager": "yarn@3.6.4",
14
27
  "scripts": {
15
- "build": "tsc -p .",
28
+ "build": "tsup src/index.ts --format esm,cjs --dts",
16
29
  "test": "jest",
17
30
  "test:watch": "jest --watch",
18
31
  "lint": "eslint --fix --ext .ts ./src",
@@ -45,6 +58,7 @@
45
58
  "prettier": "3.0.3",
46
59
  "ts-jest": "29.1.1",
47
60
  "ts-node": "10.9.1",
61
+ "tsup": "7.2.0",
48
62
  "typescript": "5.2.2"
49
63
  }
50
64
  }
@@ -1,50 +0,0 @@
1
- {
2
- "name": "resend",
3
- "version": "2.0.0",
4
- "description": "Node.js library for the Resend API",
5
- "main": "build/src/index.js",
6
- "typings": "build/src/index.d.ts",
7
- "files": [
8
- "build/"
9
- ],
10
- "engines": {
11
- "node": ">=18"
12
- },
13
- "packageManager": "yarn@3.6.4",
14
- "scripts": {
15
- "build": "tsc -p .",
16
- "test": "jest",
17
- "test:watch": "jest --watch",
18
- "lint": "eslint --fix --ext .ts ./src",
19
- "format:check": "prettier --check \"**/*.{ts,tsx}\"",
20
- "format": "prettier --write .",
21
- "prepublishOnly": "yarn run build"
22
- },
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/resendlabs/resend-node.git"
26
- },
27
- "author": "",
28
- "license": "MIT",
29
- "bugs": {
30
- "url": "https://github.com/resendlabs/resend-node/issues"
31
- },
32
- "homepage": "https://github.com/resendlabs/resend-node#readme",
33
- "dependencies": {
34
- "@react-email/render": "0.0.9"
35
- },
36
- "devDependencies": {
37
- "@types/jest": "29.5.7",
38
- "@types/node": "18.18.8",
39
- "@types/react": "18.2.33",
40
- "@typescript-eslint/eslint-plugin": "6.9.1",
41
- "@typescript-eslint/parser": "6.9.1",
42
- "eslint": "8.52.0",
43
- "jest": "29.7.0",
44
- "jest-fetch-mock": "3.0.3",
45
- "prettier": "3.0.3",
46
- "ts-jest": "29.1.1",
47
- "ts-node": "10.9.1",
48
- "typescript": "5.2.2"
49
- }
50
- }
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Resend throws API key error 1`] = `"Missing API key. Pass it to the constructor \`new Resend("re_123")\`"`;
@@ -1,9 +0,0 @@
1
- import { Resend } from '../resend';
2
- import { CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, ListApiKeysResponse, RemoveApiKeyResponse } from './interfaces';
3
- export declare class ApiKeys {
4
- private readonly resend;
5
- constructor(resend: Resend);
6
- create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
7
- list(): Promise<ListApiKeysResponse>;
8
- remove(id: string): Promise<RemoveApiKeyResponse>;
9
- }