resend 0.11.1 → 0.12.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.
Files changed (32) hide show
  1. package/build/package.json +11 -11
  2. package/build/src/api-keys/api-keys.d.ts +9 -0
  3. package/build/src/api-keys/api-keys.js +35 -0
  4. package/build/src/api-keys/api-keys.spec.d.ts +1 -0
  5. package/build/src/api-keys/api-keys.spec.js +35 -0
  6. package/build/src/api-keys/interfaces/create-api-key-options.interface.d.ts +9 -0
  7. package/build/src/api-keys/interfaces/create-api-key-options.interface.js +2 -0
  8. package/build/src/api-keys/interfaces/index.d.ts +1 -0
  9. package/build/src/api-keys/interfaces/index.js +17 -0
  10. package/build/src/common/interfaces/get-option.interface.d.ts +3 -0
  11. package/build/src/common/interfaces/get-option.interface.js +2 -0
  12. package/build/src/common/interfaces/index.d.ts +4 -0
  13. package/build/src/common/interfaces/index.js +20 -0
  14. package/build/src/common/interfaces/list-option.interface.d.ts +4 -0
  15. package/build/src/common/interfaces/list-option.interface.js +2 -0
  16. package/build/src/common/interfaces/post-option.interface.d.ts +5 -0
  17. package/build/src/common/interfaces/post-option.interface.js +2 -0
  18. package/build/src/common/interfaces/put-option.interface.d.ts +5 -0
  19. package/build/src/common/interfaces/put-option.interface.js +2 -0
  20. package/build/src/domains/domains.d.ts +9 -0
  21. package/build/src/domains/domains.js +34 -0
  22. package/build/src/domains/interfaces/create-domain-options.interface.d.ts +41 -0
  23. package/build/src/domains/interfaces/create-domain-options.interface.js +2 -0
  24. package/build/src/domains/interfaces/index.d.ts +1 -0
  25. package/build/src/domains/interfaces/index.js +17 -0
  26. package/build/src/index.d.ts +2 -2
  27. package/build/src/index.js +1 -1
  28. package/build/src/interfaces.d.ts +13 -5
  29. package/build/src/resend.d.ts +12 -2
  30. package/build/src/resend.js +63 -7
  31. package/build/src/resend.spec.js +5 -5
  32. package/package.json +11 -11
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.11.1",
4
- "description": "",
3
+ "version": "0.12.1",
4
+ "description": "Node.js library for the Resend API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
7
7
  "files": [
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "homepage": "https://github.com/resend-inc/resend-node#readme",
29
29
  "dependencies": {
30
- "@react-email/render": "0.0.5",
31
- "axios": "0.27.2"
30
+ "@react-email/render": "0.0.6",
31
+ "axios": "1.3.4"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "28.1.8",
35
- "@types/node": "18.6.4",
36
- "@types/react": "18.0.27",
34
+ "@types/jest": "29.5.0",
35
+ "@types/node": "18.15.6",
36
+ "@types/react": "18.0.29",
37
37
  "axios-mock-adapter": "1.21.2",
38
- "jest": "28.1.3",
39
- "prettier": "2.8.4",
38
+ "jest": "29.5.0",
39
+ "prettier": "2.8.7",
40
40
  "supertest": "6.3.3",
41
- "ts-jest": "28.0.8",
41
+ "ts-jest": "29.0.5",
42
42
  "tslint": "6.1.3",
43
- "typescript": "4.7.4"
43
+ "typescript": "5.0.2"
44
44
  }
45
45
  }
@@ -0,0 +1,9 @@
1
+ import { Resend } from '../resend';
2
+ import { CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse } 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<void>;
8
+ remove(id: string): Promise<void>;
9
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ApiKeys = void 0;
13
+ class ApiKeys {
14
+ constructor(resend) {
15
+ this.resend = resend;
16
+ }
17
+ create(payload, options = {}) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { data: apiKey } = yield this.resend.post('/api-keys', payload, options);
20
+ return { token: apiKey.data };
21
+ });
22
+ }
23
+ list() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const { data } = yield this.resend.get('/api-keys');
26
+ return data;
27
+ });
28
+ }
29
+ remove(id) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ yield this.resend.delete(`/api-keys/${id}`);
32
+ });
33
+ }
34
+ }
35
+ exports.ApiKeys = ApiKeys;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const axios_1 = __importDefault(require("axios"));
16
+ const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
17
+ const resend_1 = require("../resend");
18
+ const mock = new axios_mock_adapter_1.default(axios_1.default);
19
+ describe('API Keys', () => {
20
+ describe('create', () => {
21
+ it('creates an api key', () => __awaiter(void 0, void 0, void 0, function* () {
22
+ mock.onPost('/api-keys', { name: 'Test' }).replyOnce(201, {
23
+ data: 're_PKr4RCko_Lhm9ost2YjNCctnPjbLw8Nqk',
24
+ });
25
+ const resend = new resend_1.Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
26
+ yield expect(resend.apiKeys.create({ name: 'Test' })).resolves
27
+ .toMatchInlineSnapshot(`
28
+ {
29
+ "token": "re_PKr4RCko_Lhm9ost2YjNCctnPjbLw8Nqk",
30
+ }
31
+ `);
32
+ expect(mock.history.post.length).toBe(1);
33
+ }));
34
+ });
35
+ });
@@ -0,0 +1,9 @@
1
+ import { PostOptions } from '../../common/interfaces';
2
+ export interface CreateApiKeyOptions {
3
+ name: string;
4
+ }
5
+ export interface CreateApiKeyRequestOptions extends PostOptions {
6
+ }
7
+ export interface CreateApiKeyResponse {
8
+ token: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './create-api-key-options.interface';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-api-key-options.interface"), exports);
@@ -0,0 +1,3 @@
1
+ export interface GetOptions {
2
+ query?: Record<string, any>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export * from './get-option.interface';
2
+ export * from './list-option.interface';
3
+ export * from './post-option.interface';
4
+ export * from './put-option.interface';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-option.interface"), exports);
18
+ __exportStar(require("./list-option.interface"), exports);
19
+ __exportStar(require("./post-option.interface"), exports);
20
+ __exportStar(require("./put-option.interface"), exports);
@@ -0,0 +1,4 @@
1
+ export interface List<T> {
2
+ readonly object: 'list';
3
+ data: T[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface PostOptions {
2
+ query?: {
3
+ [key: string]: any;
4
+ };
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface PutOptions {
2
+ query?: {
3
+ [key: string]: any;
4
+ };
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { Resend } from '../resend';
2
+ import { CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse } from './interfaces';
3
+ export declare class Domains {
4
+ private readonly resend;
5
+ constructor(resend: Resend);
6
+ create(payload: CreateDomainOptions, options?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
7
+ remove(id: string): Promise<void>;
8
+ verify(id: string): Promise<void>;
9
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Domains = void 0;
13
+ class Domains {
14
+ constructor(resend) {
15
+ this.resend = resend;
16
+ }
17
+ create(payload, options = {}) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { data } = yield this.resend.post('/domains', payload, options);
20
+ return data;
21
+ });
22
+ }
23
+ remove(id) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ yield this.resend.delete(`/domains/${id}`);
26
+ });
27
+ }
28
+ verify(id) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ yield this.resend.post(`/domains/${id}/verify`);
31
+ });
32
+ }
33
+ }
34
+ exports.Domains = Domains;
@@ -0,0 +1,41 @@
1
+ import { PostOptions } from '../../common/interfaces';
2
+ export type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1';
3
+ export interface CreateDomainOptions {
4
+ domain: string;
5
+ region?: DomainRegion;
6
+ }
7
+ export interface CreateDomainRequestOptions extends PostOptions {
8
+ }
9
+ export type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
10
+ export type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
11
+ export interface DomainSpfRecord {
12
+ record: 'SPF';
13
+ name: string;
14
+ value: string;
15
+ type: 'MX' | 'TXT';
16
+ ttl: string;
17
+ status: DomainStatus;
18
+ routingPolicy?: string;
19
+ priority?: number;
20
+ proxStatus?: 'enable' | 'disable';
21
+ }
22
+ export interface DomainDkimRecord {
23
+ record: 'DKIM';
24
+ name: string;
25
+ value: string;
26
+ type: 'CNAME';
27
+ ttl: string;
28
+ status: DomainStatus;
29
+ routingPolicy?: string;
30
+ priority?: number;
31
+ proxStatus?: 'enable' | 'disable';
32
+ }
33
+ export type CreateDomainResponse = {
34
+ name: string;
35
+ id: string;
36
+ dnsProvider: DomainNameservers;
37
+ status: DomainStatus;
38
+ createdAt: string;
39
+ records: (DomainSpfRecord | DomainDkimRecord)[];
40
+ region: DomainRegion;
41
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './create-domain-options.interface';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-domain-options.interface"), exports);
@@ -1,2 +1,2 @@
1
- import { Resend } from './resend';
2
- export { Resend };
1
+ export { Resend } from './resend';
2
+ export { SendEmailResponse, EmailResponse, ErrorResponse, SendEmailData, } from './interfaces';
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Resend = void 0;
4
- const resend_1 = require("./resend");
4
+ var resend_1 = require("./resend");
5
5
  Object.defineProperty(exports, "Resend", { enumerable: true, get: function () { return resend_1.Resend; } });
@@ -12,7 +12,7 @@ export interface SendEmailData {
12
12
  /** Reply-to email address. Max 50. */
13
13
  reply_to?: string | string[];
14
14
  /** Email subject. */
15
- subject?: string;
15
+ subject: string;
16
16
  /** The plain text version of the message. */
17
17
  text?: string;
18
18
  /** The HTML version of the message. */
@@ -21,6 +21,8 @@ export interface SendEmailData {
21
21
  react?: ReactElement;
22
22
  /** Attachments */
23
23
  attachments?: Attachment[];
24
+ /** Email tags */
25
+ tags?: Tag[];
24
26
  }
25
27
  interface Attachment {
26
28
  content?: string | Buffer;
@@ -38,13 +40,15 @@ export interface SendEmailRequest {
38
40
  /** Reply-to email address. Max 50. */
39
41
  reply_to?: string | string[];
40
42
  /** Email subject. */
41
- subject?: string;
43
+ subject: string;
42
44
  /** The HTML version of the message. */
43
45
  text?: string;
44
46
  /** The plain text version of the message. */
45
47
  html?: string;
46
48
  /** Attachments */
47
- attachments?: any[];
49
+ attachments?: Attachment[];
50
+ /** Email tags */
51
+ tags?: Tag[];
48
52
  }
49
53
  interface EmailResponse extends Pick<SendEmailRequest, 'to' | 'from'> {
50
54
  id: string;
@@ -57,5 +61,9 @@ interface ErrorResponse {
57
61
  type: string;
58
62
  };
59
63
  }
60
- export declare type SendEmailResponse = EmailResponse | ErrorResponse;
61
- export {};
64
+ export type SendEmailResponse = EmailResponse | ErrorResponse;
65
+ export { EmailResponse, ErrorResponse };
66
+ export type Tag = {
67
+ name: string;
68
+ value: string;
69
+ };
@@ -1,9 +1,19 @@
1
+ import { AxiosResponse } from 'axios';
1
2
  import { SendEmailData, SendEmailResponse } from './interfaces';
3
+ import { GetOptions, PostOptions, PutOptions } from './common/interfaces';
4
+ import { ApiKeys } from './api-keys/api-keys';
5
+ import { Domains } from './domains/domains';
2
6
  export declare class Resend {
3
- readonly apiKey?: string | undefined;
7
+ readonly key?: string | undefined;
4
8
  readonly baseUrl: string;
5
9
  private readonly headers;
6
10
  private readonly request;
7
- constructor(apiKey?: string | undefined);
11
+ readonly apiKeys: ApiKeys;
12
+ readonly domains: Domains;
13
+ constructor(key?: string | undefined);
14
+ post(path: string, entity?: any, options?: PostOptions): Promise<AxiosResponse>;
15
+ get(path: string, options?: GetOptions): Promise<AxiosResponse>;
16
+ put(path: string, entity: any, options?: PutOptions): Promise<AxiosResponse>;
17
+ delete(path: string, query?: any): Promise<AxiosResponse>;
8
18
  sendEmail(data: SendEmailData): Promise<SendEmailResponse>;
9
19
  }
@@ -16,19 +16,22 @@ exports.Resend = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const render_1 = require("@react-email/render");
18
18
  const package_json_1 = require("../package.json");
19
+ const api_keys_1 = require("./api-keys/api-keys");
20
+ const domains_1 = require("./domains/domains");
19
21
  class Resend {
20
- constructor(apiKey) {
21
- this.apiKey = apiKey;
22
- if (!apiKey) {
23
- this.apiKey = process.env.RESEND_API_KEY;
24
- if (!this.apiKey) {
22
+ constructor(key) {
23
+ this.key = key;
24
+ this.apiKeys = new api_keys_1.ApiKeys(this);
25
+ this.domains = new domains_1.Domains(this);
26
+ if (!key) {
27
+ this.key = process.env.RESEND_API_KEY;
28
+ if (!this.key) {
25
29
  throw new Error('Missing API key. Pass it to the constructor `new Resend("re_123")`');
26
30
  }
27
31
  }
28
- this.apiKey = apiKey;
29
32
  this.baseUrl = process.env.RESEND_BASE_URL || 'https://api.resend.com';
30
33
  this.headers = {
31
- Authorization: `Bearer ${this.apiKey}`,
34
+ Authorization: `Bearer ${this.key}`,
32
35
  'User-Agent': `node:${package_json_1.version}`,
33
36
  'Content-Type': 'application/json',
34
37
  };
@@ -51,6 +54,58 @@ class Resend {
51
54
  return Promise.reject(error);
52
55
  });
53
56
  }
57
+ post(path, entity, options) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const requestHeaders = {};
60
+ try {
61
+ return yield this.request.post(path, entity, {
62
+ params: options === null || options === void 0 ? void 0 : options.query,
63
+ headers: requestHeaders,
64
+ });
65
+ }
66
+ catch (error) {
67
+ throw error;
68
+ }
69
+ });
70
+ }
71
+ get(path, options = {}) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ try {
74
+ return yield this.request.get(path, {
75
+ params: options.query,
76
+ });
77
+ }
78
+ catch (error) {
79
+ throw error;
80
+ }
81
+ });
82
+ }
83
+ put(path, entity, options = {}) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const requestHeaders = {};
86
+ try {
87
+ return yield this.request.put(path, entity, {
88
+ params: options.query,
89
+ headers: requestHeaders,
90
+ });
91
+ }
92
+ catch (error) {
93
+ throw error;
94
+ }
95
+ });
96
+ }
97
+ delete(path, query) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ try {
100
+ return yield this.request.delete(path, {
101
+ params: query,
102
+ });
103
+ }
104
+ catch (error) {
105
+ throw error;
106
+ }
107
+ });
108
+ }
54
109
  sendEmail(data) {
55
110
  return __awaiter(this, void 0, void 0, function* () {
56
111
  try {
@@ -69,6 +124,7 @@ class Resend {
69
124
  text: data.text,
70
125
  html: data.html,
71
126
  attachments: data.attachments,
127
+ tags: data.tags,
72
128
  };
73
129
  const response = yield this.request(path, {
74
130
  method: 'POST',
@@ -28,7 +28,7 @@ describe('Resend', () => {
28
28
  to: 'zeno@resend.com',
29
29
  subject: 'Hello World',
30
30
  };
31
- mock.onPost('https://api.resend.com/email', payload).replyOnce(200, {
31
+ mock.onPost('/email', payload).replyOnce(200, {
32
32
  id: '1234',
33
33
  from: 'bu@resend.com',
34
34
  to: 'zeno@resend.com',
@@ -43,7 +43,7 @@ describe('Resend', () => {
43
43
  to: ['bu@resend.com', 'zeno@resend.com'],
44
44
  subject: 'Hello World',
45
45
  };
46
- mock.onPost('https://api.resend.com/email', payload).replyOnce(200, {
46
+ mock.onPost('/email', payload).replyOnce(200, {
47
47
  id: '1234',
48
48
  from: 'admin@resend.com',
49
49
  to: ['bu@resend.com', 'zeno@resend.com'],
@@ -59,7 +59,7 @@ describe('Resend', () => {
59
59
  bcc: ['foo@resend.com', 'bar@resend.com'],
60
60
  subject: 'Hello World',
61
61
  };
62
- mock.onPost('https://api.resend.com/email', payload).replyOnce(200, {
62
+ mock.onPost('/email', payload).replyOnce(200, {
63
63
  id: '1234',
64
64
  from: 'admin@resend.com',
65
65
  to: 'bu@resend.com',
@@ -76,7 +76,7 @@ describe('Resend', () => {
76
76
  cc: ['foo@resend.com', 'bar@resend.com'],
77
77
  subject: 'Hello World',
78
78
  };
79
- mock.onPost('https://api.resend.com/email', payload).replyOnce(200, {
79
+ mock.onPost('/email', payload).replyOnce(200, {
80
80
  id: '1234',
81
81
  from: 'admin@resend.com',
82
82
  to: 'bu@resend.com',
@@ -93,7 +93,7 @@ describe('Resend', () => {
93
93
  reply_to: ['foo@resend.com', 'bar@resend.com'],
94
94
  subject: 'Hello World',
95
95
  };
96
- mock.onPost('https://api.resend.com/email', apiPayload).replyOnce(200, {
96
+ mock.onPost('/email', apiPayload).replyOnce(200, {
97
97
  id: '1234',
98
98
  from: 'admin@resend.com',
99
99
  to: 'bu@resend.com',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.11.1",
4
- "description": "",
3
+ "version": "0.12.1",
4
+ "description": "Node.js library for the Resend API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
7
7
  "files": [
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "homepage": "https://github.com/resend-inc/resend-node#readme",
29
29
  "dependencies": {
30
- "@react-email/render": "0.0.5",
31
- "axios": "0.27.2"
30
+ "@react-email/render": "0.0.6",
31
+ "axios": "1.3.4"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "28.1.8",
35
- "@types/node": "18.6.4",
36
- "@types/react": "18.0.27",
34
+ "@types/jest": "29.5.0",
35
+ "@types/node": "18.15.6",
36
+ "@types/react": "18.0.29",
37
37
  "axios-mock-adapter": "1.21.2",
38
- "jest": "28.1.3",
39
- "prettier": "2.8.4",
38
+ "jest": "29.5.0",
39
+ "prettier": "2.8.7",
40
40
  "supertest": "6.3.3",
41
- "ts-jest": "28.0.8",
41
+ "ts-jest": "29.0.5",
42
42
  "tslint": "6.1.3",
43
- "typescript": "4.7.4"
43
+ "typescript": "5.0.2"
44
44
  }
45
45
  }