resend 0.17.1 → 0.17.2
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 +1 -1
- package/build/src/resend.d.ts +0 -1
- package/build/src/resend.js +5 -4
- package/package.json +1 -1
package/build/package.json
CHANGED
package/build/src/resend.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { Emails } from './emails/emails';
|
|
|
6
6
|
import { CreateEmailOptions, CreateEmailResponse } from './emails/interfaces';
|
|
7
7
|
export declare class Resend {
|
|
8
8
|
readonly key?: string | undefined;
|
|
9
|
-
readonly baseUrl: string;
|
|
10
9
|
private readonly headers;
|
|
11
10
|
private readonly request;
|
|
12
11
|
readonly apiKeys: ApiKeys;
|
package/build/src/resend.js
CHANGED
|
@@ -19,6 +19,8 @@ const package_json_1 = require("../package.json");
|
|
|
19
19
|
const api_keys_1 = require("./api-keys/api-keys");
|
|
20
20
|
const domains_1 = require("./domains/domains");
|
|
21
21
|
const emails_1 = require("./emails/emails");
|
|
22
|
+
const baseUrl = process.env.RESEND_BASE_URL || 'https://api.resend.com';
|
|
23
|
+
const userAgent = process.env.RESEND_USER_AGENT || `resend-node:${package_json_1.version}`;
|
|
22
24
|
class Resend {
|
|
23
25
|
constructor(key) {
|
|
24
26
|
this.key = key;
|
|
@@ -31,14 +33,13 @@ class Resend {
|
|
|
31
33
|
throw new Error('Missing API key. Pass it to the constructor `new Resend("re_123")`');
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
this.baseUrl = process.env.RESEND_BASE_URL || 'https://api.resend.com';
|
|
35
36
|
this.headers = {
|
|
36
37
|
Authorization: `Bearer ${this.key}`,
|
|
37
|
-
'User-Agent':
|
|
38
|
+
'User-Agent': userAgent,
|
|
38
39
|
'Content-Type': 'application/json',
|
|
39
40
|
};
|
|
40
41
|
this.request = axios_1.default.create({
|
|
41
|
-
baseURL:
|
|
42
|
+
baseURL: baseUrl,
|
|
42
43
|
headers: this.headers,
|
|
43
44
|
maxContentLength: Infinity,
|
|
44
45
|
maxBodyLength: Infinity,
|
|
@@ -114,7 +115,7 @@ class Resend {
|
|
|
114
115
|
sendEmail(data) {
|
|
115
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
117
|
try {
|
|
117
|
-
const path = `${
|
|
118
|
+
const path = `${baseUrl}/email`;
|
|
118
119
|
if (data.react) {
|
|
119
120
|
data.html = (0, render_1.render)(data.react);
|
|
120
121
|
delete data.react;
|