resend 0.12.0 → 0.12.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,7 +1,7 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.12.0",
4
- "description": "",
3
+ "version": "0.12.2",
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": [
@@ -1,9 +1,9 @@
1
1
  import { Resend } from '../resend';
2
- import { CreateApiKeyOptions, CreateApiKeyRequestOptions } from './interfaces';
2
+ import { CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse } from './interfaces';
3
3
  export declare class ApiKeys {
4
4
  private readonly resend;
5
5
  constructor(resend: Resend);
6
- create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<void>;
6
+ create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
7
7
  list(): Promise<void>;
8
8
  remove(id: string): Promise<void>;
9
9
  }
@@ -16,8 +16,8 @@ class ApiKeys {
16
16
  }
17
17
  create(payload, options = {}) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const { data } = yield this.resend.post('/api-keys', payload, options);
20
- return data;
19
+ const { data: apiKey } = yield this.resend.post('/api-keys', payload, options);
20
+ return { token: apiKey.data };
21
21
  });
22
22
  }
23
23
  list() {
@@ -19,13 +19,16 @@ const mock = new axios_mock_adapter_1.default(axios_1.default);
19
19
  describe('API Keys', () => {
20
20
  describe('create', () => {
21
21
  it('creates an api key', () => __awaiter(void 0, void 0, void 0, function* () {
22
- mock
23
- .onPost('/api-keys', {
24
- name: 'Test',
25
- })
26
- .replyOnce(201);
27
- const resend = new resend_1.Resend('31387s51-8ce1-42f2-a3e3-cxf6327f3cb9');
28
- yield expect(resend.apiKeys.create({ name: 'Test' })).resolves.toBeUndefined();
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
+ `);
29
32
  expect(mock.history.post.length).toBe(1);
30
33
  }));
31
34
  });
@@ -4,3 +4,6 @@ export interface CreateApiKeyOptions {
4
4
  }
5
5
  export interface CreateApiKeyRequestOptions extends PostOptions {
6
6
  }
7
+ export interface CreateApiKeyResponse {
8
+ token: string;
9
+ }
@@ -1,7 +1,7 @@
1
1
  import { PostOptions } from '../../common/interfaces';
2
2
  export type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1';
3
3
  export interface CreateDomainOptions {
4
- domain: string;
4
+ name: string;
5
5
  region?: DomainRegion;
6
6
  }
7
7
  export interface CreateDomainRequestOptions extends PostOptions {
@@ -15,9 +15,9 @@ export interface DomainSpfRecord {
15
15
  type: 'MX' | 'TXT';
16
16
  ttl: string;
17
17
  status: DomainStatus;
18
- routingPolicy?: string;
18
+ routing_policy?: string;
19
19
  priority?: number;
20
- proxStatus?: 'enable' | 'disable';
20
+ proxy_status?: 'enable' | 'disable';
21
21
  }
22
22
  export interface DomainDkimRecord {
23
23
  record: 'DKIM';
@@ -26,16 +26,15 @@ export interface DomainDkimRecord {
26
26
  type: 'CNAME';
27
27
  ttl: string;
28
28
  status: DomainStatus;
29
- routingPolicy?: string;
29
+ routing_policy?: string;
30
30
  priority?: number;
31
- proxStatus?: 'enable' | 'disable';
31
+ proxy_status?: 'enable' | 'disable';
32
32
  }
33
33
  export type CreateDomainResponse = {
34
34
  name: string;
35
35
  id: string;
36
- dnsProvider: DomainNameservers;
37
36
  status: DomainStatus;
38
- createdAt: string;
37
+ created_at: string;
39
38
  records: (DomainSpfRecord | DomainDkimRecord)[];
40
39
  region: DomainRegion;
41
40
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "0.12.0",
4
- "description": "",
3
+ "version": "0.12.2",
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": [