resend 6.38.1 → 6.39.0

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/index.cjs CHANGED
@@ -57,7 +57,7 @@ const MOVE_THREAD_FOLDERS = [
57
57
  ];
58
58
  //#endregion
59
59
  //#region package.json
60
- var version = "6.38.1";
60
+ var version = "6.39.0";
61
61
  //#endregion
62
62
  //#region src/common/utils/build-pagination-query.ts
63
63
  function buildPaginationUrl(base, options) {
@@ -116,6 +116,9 @@ var AutomationRuns = class {
116
116
  const url = qs ? `/automations/${options.automationId}/runs?${qs}` : `/automations/${options.automationId}/runs`;
117
117
  return await this.resend.get(url, requestOptions);
118
118
  }
119
+ async cancel(options, requestOptions = {}) {
120
+ return await this.resend.post(`/automations/${options.automationId}/runs/${options.runId}/cancel`, void 0, requestOptions);
121
+ }
119
122
  };
120
123
  //#endregion
121
124
  //#region src/common/utils/parse-automation-to-api-options.ts
@@ -781,11 +784,22 @@ var DomainClaims = class {
781
784
  }
782
785
  };
783
786
  //#endregion
787
+ //#region src/domains/forge/forge.ts
788
+ var Forge = class {
789
+ constructor(resend) {
790
+ this.resend = resend;
791
+ }
792
+ async enable(payload, requestOptions = {}) {
793
+ return await this.resend.post(`/domains/${payload.id}/forge`, { custom_return_path: payload.customReturnPath }, requestOptions);
794
+ }
795
+ };
796
+ //#endregion
784
797
  //#region src/domains/domains.ts
785
798
  var Domains = class {
786
799
  constructor(resend) {
787
800
  this.resend = resend;
788
801
  this.claims = new DomainClaims(this.resend);
802
+ this.forge = new Forge(this.resend);
789
803
  }
790
804
  async create(payload, requestOptions = {}) {
791
805
  return await this.resend.post("/domains", parseDomainToApiOptions(payload), requestOptions);
@@ -809,8 +823,9 @@ var Domains = class {
809
823
  async remove(id, requestOptions = {}) {
810
824
  return await this.resend.delete(`/domains/${id}`, void 0, requestOptions);
811
825
  }
812
- async verify(id, requestOptions = {}) {
813
- return await this.resend.post(`/domains/${id}/verify`, void 0, requestOptions);
826
+ async verify(id, options = {}) {
827
+ const { scope, ...requestOptions } = options;
828
+ return await this.resend.post(`/domains/${id}/verify`, scope ? { scope } : void 0, requestOptions);
814
829
  }
815
830
  };
816
831
  //#endregion
package/dist/index.d.cts CHANGED
@@ -418,6 +418,18 @@ export interface AutomationRun {
418
418
  }
419
419
  export type AutomationRunItem = Pick<AutomationRun, 'id' | 'status' | 'started_at' | 'completed_at' | 'created_at'>;
420
420
  //#endregion
421
+ //#region src/automation-runs/interfaces/cancel-automation-run.interface.d.ts
422
+ export interface CancelAutomationRunOptions {
423
+ automationId: string;
424
+ runId: string;
425
+ }
426
+ export interface CancelAutomationRunResponseSuccess {
427
+ object: 'automation_run';
428
+ id: string;
429
+ status: 'cancelled';
430
+ }
431
+ export type CancelAutomationRunResponse = Response<CancelAutomationRunResponseSuccess>;
432
+ //#endregion
421
433
  //#region src/automation-runs/interfaces/get-automation-run.interface.d.ts
422
434
  export interface GetAutomationRunOptions {
423
435
  automationId: string;
@@ -1372,6 +1384,22 @@ export interface VerifyDomainClaimResponseSuccess extends DomainClaim {
1372
1384
  }
1373
1385
  export type VerifyDomainClaimResponse = Response<VerifyDomainClaimResponseSuccess>;
1374
1386
  //#endregion
1387
+ //#region src/domains/interfaces/get-domain.interface.d.ts
1388
+ export interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capabilities' | 'open_tracking' | 'click_tracking' | 'tracking_subdomain'> {
1389
+ object: 'domain';
1390
+ records: DomainRecords[];
1391
+ }
1392
+ export type GetDomainResponse = Response<GetDomainResponseSuccess>;
1393
+ //#endregion
1394
+ //#region src/domains/forge/interfaces/enable-forge.interface.d.ts
1395
+ export interface EnableForgeOptions {
1396
+ id: string;
1397
+ customReturnPath?: string;
1398
+ }
1399
+ export interface EnableForgeRequestOptions extends PostOptions {}
1400
+ export interface EnableForgeResponseSuccess extends GetDomainResponseSuccess {}
1401
+ export type EnableForgeResponse = Response<EnableForgeResponseSuccess>;
1402
+ //#endregion
1375
1403
  //#region src/domains/interfaces/create-domain-options.interface.d.ts
1376
1404
  export interface CreateDomainOptions {
1377
1405
  name: string;
@@ -1390,13 +1418,6 @@ export interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id'
1390
1418
  }
1391
1419
  export type CreateDomainResponse = Response<CreateDomainResponseSuccess>;
1392
1420
  //#endregion
1393
- //#region src/domains/interfaces/get-domain.interface.d.ts
1394
- export interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capabilities' | 'open_tracking' | 'click_tracking' | 'tracking_subdomain'> {
1395
- object: 'domain';
1396
- records: DomainRecords[];
1397
- }
1398
- export type GetDomainResponse = Response<GetDomainResponseSuccess>;
1399
- //#endregion
1400
1421
  //#region src/domains/interfaces/list-domains.interface.d.ts
1401
1422
  export type ListDomainsOptions = PaginationOptions;
1402
1423
  export type ListDomainsResponseSuccess = {
@@ -1428,6 +1449,15 @@ export type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
1428
1449
  export type UpdateDomainsResponse = Response<UpdateDomainsResponseSuccess>;
1429
1450
  //#endregion
1430
1451
  //#region src/domains/interfaces/verify-domain.interface.d.ts
1452
+ export type VerifyDomainsScope = 'forge';
1453
+ export interface VerifyDomainsOptions extends RequestOptions {
1454
+ /**
1455
+ * Limit the check to specific records. Pass `['forge']` to verify only the
1456
+ * Forge record and leave the other records untouched. Requires Forge to be
1457
+ * enabled on the domain. When omitted, all records are checked.
1458
+ */
1459
+ scope?: VerifyDomainsScope[];
1460
+ }
1431
1461
  export type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
1432
1462
  object: 'domain';
1433
1463
  };
@@ -2392,6 +2422,7 @@ declare class AutomationRuns {
2392
2422
  constructor(resend: Resend);
2393
2423
  get(options: GetAutomationRunOptions, requestOptions?: RequestOptions): Promise<GetAutomationRunResponse>;
2394
2424
  list(options: ListAutomationRunsOptions, requestOptions?: RequestOptions): Promise<ListAutomationRunsResponse>;
2425
+ cancel(options: CancelAutomationRunOptions, requestOptions?: RequestOptions): Promise<CancelAutomationRunResponse>;
2395
2426
  }
2396
2427
  //#endregion
2397
2428
  //#region src/automations/automations.d.ts
@@ -2496,17 +2527,25 @@ declare class DomainClaims {
2496
2527
  verify(domainId: string, requestOptions?: RequestOptions): Promise<VerifyDomainClaimResponse>;
2497
2528
  }
2498
2529
  //#endregion
2530
+ //#region src/domains/forge/forge.d.ts
2531
+ declare class Forge {
2532
+ private readonly resend;
2533
+ constructor(resend: Resend);
2534
+ enable(payload: EnableForgeOptions, requestOptions?: EnableForgeRequestOptions): Promise<EnableForgeResponse>;
2535
+ }
2536
+ //#endregion
2499
2537
  //#region src/domains/domains.d.ts
2500
2538
  declare class Domains {
2501
2539
  private readonly resend;
2502
2540
  readonly claims: DomainClaims;
2541
+ readonly forge: Forge;
2503
2542
  constructor(resend: Resend);
2504
2543
  create(payload: CreateDomainOptions, requestOptions?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
2505
2544
  list(options?: ListDomainsOptions, requestOptions?: RequestOptions): Promise<ListDomainsResponse>;
2506
2545
  get(id: string, requestOptions?: RequestOptions): Promise<GetDomainResponse>;
2507
2546
  update(payload: UpdateDomainsOptions, requestOptions?: RequestOptions): Promise<UpdateDomainsResponse>;
2508
2547
  remove(id: string, requestOptions?: RequestOptions): Promise<RemoveDomainsResponse>;
2509
- verify(id: string, requestOptions?: RequestOptions): Promise<VerifyDomainsResponse>;
2548
+ verify(id: string, options?: VerifyDomainsOptions): Promise<VerifyDomainsResponse>;
2510
2549
  }
2511
2550
  //#endregion
2512
2551
  //#region src/emails/attachments/attachments.d.ts
package/dist/index.d.mts CHANGED
@@ -418,6 +418,18 @@ export interface AutomationRun {
418
418
  }
419
419
  export type AutomationRunItem = Pick<AutomationRun, 'id' | 'status' | 'started_at' | 'completed_at' | 'created_at'>;
420
420
  //#endregion
421
+ //#region src/automation-runs/interfaces/cancel-automation-run.interface.d.ts
422
+ export interface CancelAutomationRunOptions {
423
+ automationId: string;
424
+ runId: string;
425
+ }
426
+ export interface CancelAutomationRunResponseSuccess {
427
+ object: 'automation_run';
428
+ id: string;
429
+ status: 'cancelled';
430
+ }
431
+ export type CancelAutomationRunResponse = Response<CancelAutomationRunResponseSuccess>;
432
+ //#endregion
421
433
  //#region src/automation-runs/interfaces/get-automation-run.interface.d.ts
422
434
  export interface GetAutomationRunOptions {
423
435
  automationId: string;
@@ -1372,6 +1384,22 @@ export interface VerifyDomainClaimResponseSuccess extends DomainClaim {
1372
1384
  }
1373
1385
  export type VerifyDomainClaimResponse = Response<VerifyDomainClaimResponseSuccess>;
1374
1386
  //#endregion
1387
+ //#region src/domains/interfaces/get-domain.interface.d.ts
1388
+ export interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capabilities' | 'open_tracking' | 'click_tracking' | 'tracking_subdomain'> {
1389
+ object: 'domain';
1390
+ records: DomainRecords[];
1391
+ }
1392
+ export type GetDomainResponse = Response<GetDomainResponseSuccess>;
1393
+ //#endregion
1394
+ //#region src/domains/forge/interfaces/enable-forge.interface.d.ts
1395
+ export interface EnableForgeOptions {
1396
+ id: string;
1397
+ customReturnPath?: string;
1398
+ }
1399
+ export interface EnableForgeRequestOptions extends PostOptions {}
1400
+ export interface EnableForgeResponseSuccess extends GetDomainResponseSuccess {}
1401
+ export type EnableForgeResponse = Response<EnableForgeResponseSuccess>;
1402
+ //#endregion
1375
1403
  //#region src/domains/interfaces/create-domain-options.interface.d.ts
1376
1404
  export interface CreateDomainOptions {
1377
1405
  name: string;
@@ -1390,13 +1418,6 @@ export interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id'
1390
1418
  }
1391
1419
  export type CreateDomainResponse = Response<CreateDomainResponseSuccess>;
1392
1420
  //#endregion
1393
- //#region src/domains/interfaces/get-domain.interface.d.ts
1394
- export interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capabilities' | 'open_tracking' | 'click_tracking' | 'tracking_subdomain'> {
1395
- object: 'domain';
1396
- records: DomainRecords[];
1397
- }
1398
- export type GetDomainResponse = Response<GetDomainResponseSuccess>;
1399
- //#endregion
1400
1421
  //#region src/domains/interfaces/list-domains.interface.d.ts
1401
1422
  export type ListDomainsOptions = PaginationOptions;
1402
1423
  export type ListDomainsResponseSuccess = {
@@ -1428,6 +1449,15 @@ export type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
1428
1449
  export type UpdateDomainsResponse = Response<UpdateDomainsResponseSuccess>;
1429
1450
  //#endregion
1430
1451
  //#region src/domains/interfaces/verify-domain.interface.d.ts
1452
+ export type VerifyDomainsScope = 'forge';
1453
+ export interface VerifyDomainsOptions extends RequestOptions {
1454
+ /**
1455
+ * Limit the check to specific records. Pass `['forge']` to verify only the
1456
+ * Forge record and leave the other records untouched. Requires Forge to be
1457
+ * enabled on the domain. When omitted, all records are checked.
1458
+ */
1459
+ scope?: VerifyDomainsScope[];
1460
+ }
1431
1461
  export type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
1432
1462
  object: 'domain';
1433
1463
  };
@@ -2392,6 +2422,7 @@ declare class AutomationRuns {
2392
2422
  constructor(resend: Resend);
2393
2423
  get(options: GetAutomationRunOptions, requestOptions?: RequestOptions): Promise<GetAutomationRunResponse>;
2394
2424
  list(options: ListAutomationRunsOptions, requestOptions?: RequestOptions): Promise<ListAutomationRunsResponse>;
2425
+ cancel(options: CancelAutomationRunOptions, requestOptions?: RequestOptions): Promise<CancelAutomationRunResponse>;
2395
2426
  }
2396
2427
  //#endregion
2397
2428
  //#region src/automations/automations.d.ts
@@ -2496,17 +2527,25 @@ declare class DomainClaims {
2496
2527
  verify(domainId: string, requestOptions?: RequestOptions): Promise<VerifyDomainClaimResponse>;
2497
2528
  }
2498
2529
  //#endregion
2530
+ //#region src/domains/forge/forge.d.ts
2531
+ declare class Forge {
2532
+ private readonly resend;
2533
+ constructor(resend: Resend);
2534
+ enable(payload: EnableForgeOptions, requestOptions?: EnableForgeRequestOptions): Promise<EnableForgeResponse>;
2535
+ }
2536
+ //#endregion
2499
2537
  //#region src/domains/domains.d.ts
2500
2538
  declare class Domains {
2501
2539
  private readonly resend;
2502
2540
  readonly claims: DomainClaims;
2541
+ readonly forge: Forge;
2503
2542
  constructor(resend: Resend);
2504
2543
  create(payload: CreateDomainOptions, requestOptions?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
2505
2544
  list(options?: ListDomainsOptions, requestOptions?: RequestOptions): Promise<ListDomainsResponse>;
2506
2545
  get(id: string, requestOptions?: RequestOptions): Promise<GetDomainResponse>;
2507
2546
  update(payload: UpdateDomainsOptions, requestOptions?: RequestOptions): Promise<UpdateDomainsResponse>;
2508
2547
  remove(id: string, requestOptions?: RequestOptions): Promise<RemoveDomainsResponse>;
2509
- verify(id: string, requestOptions?: RequestOptions): Promise<VerifyDomainsResponse>;
2548
+ verify(id: string, options?: VerifyDomainsOptions): Promise<VerifyDomainsResponse>;
2510
2549
  }
2511
2550
  //#endregion
2512
2551
  //#region src/emails/attachments/attachments.d.ts
package/dist/index.mjs CHANGED
@@ -33,7 +33,7 @@ const MOVE_THREAD_FOLDERS = [
33
33
  ];
34
34
  //#endregion
35
35
  //#region package.json
36
- var version = "6.38.1";
36
+ var version = "6.39.0";
37
37
  //#endregion
38
38
  //#region src/common/utils/build-pagination-query.ts
39
39
  function buildPaginationUrl(base, options) {
@@ -92,6 +92,9 @@ var AutomationRuns = class {
92
92
  const url = qs ? `/automations/${options.automationId}/runs?${qs}` : `/automations/${options.automationId}/runs`;
93
93
  return await this.resend.get(url, requestOptions);
94
94
  }
95
+ async cancel(options, requestOptions = {}) {
96
+ return await this.resend.post(`/automations/${options.automationId}/runs/${options.runId}/cancel`, void 0, requestOptions);
97
+ }
95
98
  };
96
99
  //#endregion
97
100
  //#region src/common/utils/parse-automation-to-api-options.ts
@@ -757,11 +760,22 @@ var DomainClaims = class {
757
760
  }
758
761
  };
759
762
  //#endregion
763
+ //#region src/domains/forge/forge.ts
764
+ var Forge = class {
765
+ constructor(resend) {
766
+ this.resend = resend;
767
+ }
768
+ async enable(payload, requestOptions = {}) {
769
+ return await this.resend.post(`/domains/${payload.id}/forge`, { custom_return_path: payload.customReturnPath }, requestOptions);
770
+ }
771
+ };
772
+ //#endregion
760
773
  //#region src/domains/domains.ts
761
774
  var Domains = class {
762
775
  constructor(resend) {
763
776
  this.resend = resend;
764
777
  this.claims = new DomainClaims(this.resend);
778
+ this.forge = new Forge(this.resend);
765
779
  }
766
780
  async create(payload, requestOptions = {}) {
767
781
  return await this.resend.post("/domains", parseDomainToApiOptions(payload), requestOptions);
@@ -785,8 +799,9 @@ var Domains = class {
785
799
  async remove(id, requestOptions = {}) {
786
800
  return await this.resend.delete(`/domains/${id}`, void 0, requestOptions);
787
801
  }
788
- async verify(id, requestOptions = {}) {
789
- return await this.resend.post(`/domains/${id}/verify`, void 0, requestOptions);
802
+ async verify(id, options = {}) {
803
+ const { scope, ...requestOptions } = options;
804
+ return await this.resend.post(`/domains/${id}/verify`, scope ? { scope } : void 0, requestOptions);
790
805
  }
791
806
  };
792
807
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.38.1",
3
+ "version": "6.39.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/readme.md CHANGED
@@ -9,15 +9,14 @@
9
9
  Framework guides
10
10
  </p>
11
11
  <p align="center">
12
- <a
13
- - <a href="https://resend.com/docs/send-with-nextjs">Next.js</a>
14
- - <a href="https://resend.com/docs/send-with-remix">Remix</a>
15
- - <a href="https://resend.com/docs/send-with-nuxt">Nuxt</a>
16
- - <a href="https://resend.com/docs/send-with-express">Express</a>
17
- - <a href="https://resend.com/docs/send-with-redwoodjs">RedwoodJS</a>
18
- - <a href="https://resend.com/docs/send-with-hono">Hono</a>
19
- - <a href="https://resend.com/docs/send-with-bun">Bun</a>
20
- - <a href="https://resend.com/docs/send-with-astro">Astro</a>
12
+ <a href="https://resend.com/docs/send-with-nextjs">Next.js</a> ·
13
+ <a href="https://resend.com/docs/send-with-remix">Remix</a> ·
14
+ <a href="https://resend.com/docs/send-with-nuxt">Nuxt</a> ·
15
+ <a href="https://resend.com/docs/send-with-express">Express</a> ·
16
+ <a href="https://resend.com/docs/send-with-redwoodjs">RedwoodJS</a> ·
17
+ <a href="https://resend.com/docs/send-with-hono">Hono</a> ·
18
+ <a href="https://resend.com/docs/send-with-bun">Bun</a> ·
19
+ <a href="https://resend.com/docs/send-with-astro">Astro</a>
21
20
  </p>
22
21
 
23
22
  # Resend Node.js SDK