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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
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",
@@ -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;
@@ -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': `node:${package_json_1.version}`,
38
+ 'User-Agent': userAgent,
38
39
  'Content-Type': 'application/json',
39
40
  };
40
41
  this.request = axios_1.default.create({
41
- baseURL: this.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 = `${this.baseUrl}/email`;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
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",