resend 4.0.0 → 4.0.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/dist/chunk-2HHXE2I7.mjs +16534 -0
- package/dist/chunk-FPVDTWJX.mjs +2216 -0
- package/dist/chunk-RO5RSJWE.mjs +83 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +36 -7
- package/dist/index.mjs +26 -7
- package/dist/node-CCXSG6KK.mjs +11003 -0
- package/dist/node-I5GQK35D.mjs +9996 -0
- package/dist/server.node-2SV4OLOR.mjs +5 -0
- package/dist/server.node-UI4W6O6F.mjs +14327 -0
- package/package.json +4 -4
- package/readme.md +3 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
25
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
26
|
+
}) : x)(function(x) {
|
|
27
|
+
if (typeof require !== "undefined")
|
|
28
|
+
return require.apply(this, arguments);
|
|
29
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
30
|
+
});
|
|
31
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
32
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
33
|
+
};
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __copyProps = (to, from, except, desc) => {
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
42
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return to;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
47
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
48
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
49
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
50
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
51
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
52
|
+
mod
|
|
53
|
+
));
|
|
54
|
+
var __async = (__this, __arguments, generator) => {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
var fulfilled = (value) => {
|
|
57
|
+
try {
|
|
58
|
+
step(generator.next(value));
|
|
59
|
+
} catch (e) {
|
|
60
|
+
reject(e);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var rejected = (value) => {
|
|
64
|
+
try {
|
|
65
|
+
step(generator.throw(value));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
reject(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
71
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
__spreadValues,
|
|
77
|
+
__spreadProps,
|
|
78
|
+
__require,
|
|
79
|
+
__commonJS,
|
|
80
|
+
__export,
|
|
81
|
+
__toESM,
|
|
82
|
+
__async
|
|
83
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -268,6 +268,7 @@ interface CreateBatchResponse {
|
|
|
268
268
|
|
|
269
269
|
declare class Batch {
|
|
270
270
|
private readonly resend;
|
|
271
|
+
private renderAsync?;
|
|
271
272
|
constructor(resend: Resend);
|
|
272
273
|
send(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
273
274
|
create(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
@@ -531,6 +532,7 @@ interface UpdateEmailResponse {
|
|
|
531
532
|
|
|
532
533
|
declare class Emails {
|
|
533
534
|
private readonly resend;
|
|
535
|
+
private renderAsync?;
|
|
534
536
|
constructor(resend: Resend);
|
|
535
537
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
536
538
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -268,6 +268,7 @@ interface CreateBatchResponse {
|
|
|
268
268
|
|
|
269
269
|
declare class Batch {
|
|
270
270
|
private readonly resend;
|
|
271
|
+
private renderAsync?;
|
|
271
272
|
constructor(resend: Resend);
|
|
272
273
|
send(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
273
274
|
create(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
@@ -531,6 +532,7 @@ interface UpdateEmailResponse {
|
|
|
531
532
|
|
|
532
533
|
declare class Emails {
|
|
533
534
|
private readonly resend;
|
|
535
|
+
private renderAsync?;
|
|
534
536
|
constructor(resend: Resend);
|
|
535
537
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
536
538
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -32,6 +34,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
34
|
}
|
|
33
35
|
return to;
|
|
34
36
|
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
35
45
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
46
|
var __async = (__this, __arguments, generator) => {
|
|
37
47
|
return new Promise((resolve, reject) => {
|
|
@@ -62,7 +72,7 @@ __export(src_exports, {
|
|
|
62
72
|
module.exports = __toCommonJS(src_exports);
|
|
63
73
|
|
|
64
74
|
// package.json
|
|
65
|
-
var version = "4.0.
|
|
75
|
+
var version = "4.0.1";
|
|
66
76
|
|
|
67
77
|
// src/api-keys/api-keys.ts
|
|
68
78
|
var ApiKeys = class {
|
|
@@ -135,7 +145,6 @@ var Audiences = class {
|
|
|
135
145
|
};
|
|
136
146
|
|
|
137
147
|
// src/batch/batch.ts
|
|
138
|
-
var import_render = require("@react-email/render");
|
|
139
148
|
var Batch = class {
|
|
140
149
|
constructor(resend) {
|
|
141
150
|
this.resend = resend;
|
|
@@ -149,8 +158,18 @@ var Batch = class {
|
|
|
149
158
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
150
159
|
for (const email of payload) {
|
|
151
160
|
if (email.react) {
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
if (!this.renderAsync) {
|
|
162
|
+
try {
|
|
163
|
+
const { renderAsync } = yield import("@react-email/render");
|
|
164
|
+
this.renderAsync = renderAsync;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
"Failed to render React component. Make sure to install `@react-email/render`"
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
email.html = yield this.renderAsync(email.react);
|
|
172
|
+
email.react = void 0;
|
|
154
173
|
}
|
|
155
174
|
}
|
|
156
175
|
const data = yield this.resend.post(
|
|
@@ -283,7 +302,6 @@ var Domains = class {
|
|
|
283
302
|
};
|
|
284
303
|
|
|
285
304
|
// src/emails/emails.ts
|
|
286
|
-
var import_render2 = require("@react-email/render");
|
|
287
305
|
var Emails = class {
|
|
288
306
|
constructor(resend) {
|
|
289
307
|
this.resend = resend;
|
|
@@ -296,8 +314,19 @@ var Emails = class {
|
|
|
296
314
|
create(_0) {
|
|
297
315
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
298
316
|
if (payload.react) {
|
|
299
|
-
|
|
300
|
-
|
|
317
|
+
if (!this.renderAsync) {
|
|
318
|
+
try {
|
|
319
|
+
const { renderAsync } = yield import("@react-email/render");
|
|
320
|
+
this.renderAsync = renderAsync;
|
|
321
|
+
} catch (error) {
|
|
322
|
+
throw new Error(
|
|
323
|
+
"Failed to render React component. Make sure to install `@react-email/render`"
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
payload.html = yield this.renderAsync(
|
|
328
|
+
payload.react
|
|
329
|
+
);
|
|
301
330
|
}
|
|
302
331
|
const data = yield this.resend.post(
|
|
303
332
|
"/emails",
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// package.json
|
|
42
|
-
var version = "4.0.
|
|
42
|
+
var version = "4.0.1";
|
|
43
43
|
|
|
44
44
|
// src/api-keys/api-keys.ts
|
|
45
45
|
var ApiKeys = class {
|
|
@@ -112,7 +112,6 @@ var Audiences = class {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
// src/batch/batch.ts
|
|
115
|
-
import { renderAsync } from "@react-email/render";
|
|
116
115
|
var Batch = class {
|
|
117
116
|
constructor(resend) {
|
|
118
117
|
this.resend = resend;
|
|
@@ -126,8 +125,18 @@ var Batch = class {
|
|
|
126
125
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
127
126
|
for (const email of payload) {
|
|
128
127
|
if (email.react) {
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if (!this.renderAsync) {
|
|
129
|
+
try {
|
|
130
|
+
const { renderAsync } = yield import("@react-email/render");
|
|
131
|
+
this.renderAsync = renderAsync;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
"Failed to render React component. Make sure to install `@react-email/render`"
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
email.html = yield this.renderAsync(email.react);
|
|
139
|
+
email.react = void 0;
|
|
131
140
|
}
|
|
132
141
|
}
|
|
133
142
|
const data = yield this.resend.post(
|
|
@@ -260,7 +269,6 @@ var Domains = class {
|
|
|
260
269
|
};
|
|
261
270
|
|
|
262
271
|
// src/emails/emails.ts
|
|
263
|
-
import { renderAsync as renderAsync2 } from "@react-email/render";
|
|
264
272
|
var Emails = class {
|
|
265
273
|
constructor(resend) {
|
|
266
274
|
this.resend = resend;
|
|
@@ -273,8 +281,19 @@ var Emails = class {
|
|
|
273
281
|
create(_0) {
|
|
274
282
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
275
283
|
if (payload.react) {
|
|
276
|
-
|
|
277
|
-
|
|
284
|
+
if (!this.renderAsync) {
|
|
285
|
+
try {
|
|
286
|
+
const { renderAsync } = yield import("@react-email/render");
|
|
287
|
+
this.renderAsync = renderAsync;
|
|
288
|
+
} catch (error) {
|
|
289
|
+
throw new Error(
|
|
290
|
+
"Failed to render React component. Make sure to install `@react-email/render`"
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
payload.html = yield this.renderAsync(
|
|
295
|
+
payload.react
|
|
296
|
+
);
|
|
278
297
|
}
|
|
279
298
|
const data = yield this.resend.post(
|
|
280
299
|
"/emails",
|