resend 6.5.0 → 6.5.2-batch.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
@@ -1,7 +1,7 @@
1
1
  let svix = require("svix");
2
2
 
3
3
  //#region package.json
4
- var version = "6.5.0";
4
+ var version = "6.5.2-batch.0";
5
5
 
6
6
  //#endregion
7
7
  //#region src/common/utils/build-pagination-query.ts
@@ -100,7 +100,8 @@ var Batch = class {
100
100
  }
101
101
  emails.push(parseEmailToApiOptions(email));
102
102
  }
103
- return await this.resend.post("/emails/batch", emails, {
103
+ const endpoint = (typeof process !== "undefined" && process.env ? process.env.RESEND_EXPERIMENTAL_BATCH !== "false" && process.env.RESEND_EXPERIMENTAL_BATCH !== "0" : true) ? "/experimental/emails/batch" : "/emails/batch";
104
+ return await this.resend.post(endpoint, emails, {
104
105
  ...options,
105
106
  headers: {
106
107
  "x-batch-validation": options?.batchValidation ?? "strict",
@@ -434,7 +435,10 @@ function parseDomainToApiOptions(domain) {
434
435
  name: domain.name,
435
436
  region: domain.region,
436
437
  custom_return_path: domain.customReturnPath,
437
- capabilities: domain.capabilities
438
+ capabilities: domain.capabilities,
439
+ open_tracking: domain.openTracking,
440
+ click_tracking: domain.clickTracking,
441
+ tls: domain.tls
438
442
  };
439
443
  }
440
444
 
package/dist/index.d.cts CHANGED
@@ -63,29 +63,13 @@ interface DomainApiOptions {
63
63
  region?: string;
64
64
  custom_return_path?: string;
65
65
  capabilities?: Partial<DomainCapabilities>;
66
+ open_tracking?: boolean;
67
+ click_tracking?: boolean;
68
+ tls?: 'enforced' | 'opportunistic';
66
69
  }
67
70
  //#endregion
68
71
  //#region src/interfaces.d.ts
69
- declare const RESEND_ERROR_CODES_BY_KEY: {
70
- readonly missing_required_field: 422;
71
- readonly invalid_idempotency_key: 400;
72
- readonly invalid_idempotent_request: 409;
73
- readonly concurrent_idempotent_requests: 409;
74
- readonly invalid_access: 422;
75
- readonly invalid_parameter: 422;
76
- readonly invalid_region: 422;
77
- readonly rate_limit_exceeded: 429;
78
- readonly missing_api_key: 401;
79
- readonly invalid_api_key: 403;
80
- readonly suspended_api_key: 403;
81
- readonly invalid_from_address: 403;
82
- readonly validation_error: 403;
83
- readonly not_found: 404;
84
- readonly method_not_allowed: 405;
85
- readonly application_error: 500;
86
- readonly internal_server_error: 500;
87
- };
88
- type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
72
+ type RESEND_ERROR_CODE_KEY = 'missing_required_field' | 'invalid_idempotency_key' | 'invalid_idempotent_request' | 'concurrent_idempotent_requests' | 'invalid_access' | 'invalid_parameter' | 'invalid_region' | 'rate_limit_exceeded' | 'missing_api_key' | 'invalid_api_key' | 'suspended_api_key' | 'invalid_from_address' | 'validation_error' | 'not_found' | 'method_not_allowed' | 'application_error' | 'internal_server_error';
89
73
  type Response<T> = ({
90
74
  data: T;
91
75
  error: null;
@@ -563,8 +547,8 @@ interface Contact {
563
547
  created_at: string;
564
548
  id: string;
565
549
  email: string;
566
- first_name?: string;
567
- last_name?: string;
550
+ first_name: string | null;
551
+ last_name: string | null;
568
552
  unsubscribed: boolean;
569
553
  }
570
554
  type SelectingField = {
@@ -666,8 +650,14 @@ interface UpdateContactPropertiesOptions {
666
650
  type UpdateContactOptions = {
667
651
  audienceId?: string;
668
652
  unsubscribed?: boolean;
669
- firstName?: string;
670
- lastName?: string;
653
+ /**
654
+ * Use `null` to clear the `firstName`
655
+ */
656
+ firstName?: string | null;
657
+ /**
658
+ * Use `null` to clear the `lastName`
659
+ */
660
+ lastName?: string | null;
671
661
  properties?: UpdateContactPropertiesOptions;
672
662
  } & SelectingField;
673
663
  type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
@@ -681,6 +671,9 @@ interface CreateDomainOptions {
681
671
  region?: DomainRegion;
682
672
  customReturnPath?: string;
683
673
  capabilities?: Partial<DomainCapabilities>;
674
+ openTracking?: boolean;
675
+ clickTracking?: boolean;
676
+ tls?: 'enforced' | 'opportunistic';
684
677
  }
685
678
  interface CreateDomainRequestOptions extends PostOptions {}
686
679
  interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
package/dist/index.d.mts CHANGED
@@ -63,29 +63,13 @@ interface DomainApiOptions {
63
63
  region?: string;
64
64
  custom_return_path?: string;
65
65
  capabilities?: Partial<DomainCapabilities>;
66
+ open_tracking?: boolean;
67
+ click_tracking?: boolean;
68
+ tls?: 'enforced' | 'opportunistic';
66
69
  }
67
70
  //#endregion
68
71
  //#region src/interfaces.d.ts
69
- declare const RESEND_ERROR_CODES_BY_KEY: {
70
- readonly missing_required_field: 422;
71
- readonly invalid_idempotency_key: 400;
72
- readonly invalid_idempotent_request: 409;
73
- readonly concurrent_idempotent_requests: 409;
74
- readonly invalid_access: 422;
75
- readonly invalid_parameter: 422;
76
- readonly invalid_region: 422;
77
- readonly rate_limit_exceeded: 429;
78
- readonly missing_api_key: 401;
79
- readonly invalid_api_key: 403;
80
- readonly suspended_api_key: 403;
81
- readonly invalid_from_address: 403;
82
- readonly validation_error: 403;
83
- readonly not_found: 404;
84
- readonly method_not_allowed: 405;
85
- readonly application_error: 500;
86
- readonly internal_server_error: 500;
87
- };
88
- type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
72
+ type RESEND_ERROR_CODE_KEY = 'missing_required_field' | 'invalid_idempotency_key' | 'invalid_idempotent_request' | 'concurrent_idempotent_requests' | 'invalid_access' | 'invalid_parameter' | 'invalid_region' | 'rate_limit_exceeded' | 'missing_api_key' | 'invalid_api_key' | 'suspended_api_key' | 'invalid_from_address' | 'validation_error' | 'not_found' | 'method_not_allowed' | 'application_error' | 'internal_server_error';
89
73
  type Response<T> = ({
90
74
  data: T;
91
75
  error: null;
@@ -563,8 +547,8 @@ interface Contact {
563
547
  created_at: string;
564
548
  id: string;
565
549
  email: string;
566
- first_name?: string;
567
- last_name?: string;
550
+ first_name: string | null;
551
+ last_name: string | null;
568
552
  unsubscribed: boolean;
569
553
  }
570
554
  type SelectingField = {
@@ -666,8 +650,14 @@ interface UpdateContactPropertiesOptions {
666
650
  type UpdateContactOptions = {
667
651
  audienceId?: string;
668
652
  unsubscribed?: boolean;
669
- firstName?: string;
670
- lastName?: string;
653
+ /**
654
+ * Use `null` to clear the `firstName`
655
+ */
656
+ firstName?: string | null;
657
+ /**
658
+ * Use `null` to clear the `lastName`
659
+ */
660
+ lastName?: string | null;
671
661
  properties?: UpdateContactPropertiesOptions;
672
662
  } & SelectingField;
673
663
  type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
@@ -681,6 +671,9 @@ interface CreateDomainOptions {
681
671
  region?: DomainRegion;
682
672
  customReturnPath?: string;
683
673
  capabilities?: Partial<DomainCapabilities>;
674
+ openTracking?: boolean;
675
+ clickTracking?: boolean;
676
+ tls?: 'enforced' | 'opportunistic';
684
677
  }
685
678
  interface CreateDomainRequestOptions extends PostOptions {}
686
679
  interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Webhook } from "svix";
2
2
 
3
3
  //#region package.json
4
- var version = "6.5.0";
4
+ var version = "6.5.2-batch.0";
5
5
 
6
6
  //#endregion
7
7
  //#region src/common/utils/build-pagination-query.ts
@@ -100,7 +100,8 @@ var Batch = class {
100
100
  }
101
101
  emails.push(parseEmailToApiOptions(email));
102
102
  }
103
- return await this.resend.post("/emails/batch", emails, {
103
+ const endpoint = (typeof process !== "undefined" && process.env ? process.env.RESEND_EXPERIMENTAL_BATCH !== "false" && process.env.RESEND_EXPERIMENTAL_BATCH !== "0" : true) ? "/experimental/emails/batch" : "/emails/batch";
104
+ return await this.resend.post(endpoint, emails, {
104
105
  ...options,
105
106
  headers: {
106
107
  "x-batch-validation": options?.batchValidation ?? "strict",
@@ -434,7 +435,10 @@ function parseDomainToApiOptions(domain) {
434
435
  name: domain.name,
435
436
  region: domain.region,
436
437
  custom_return_path: domain.customReturnPath,
437
- capabilities: domain.capabilities
438
+ capabilities: domain.capabilities,
439
+ open_tracking: domain.openTracking,
440
+ click_tracking: domain.clickTracking,
441
+ tls: domain.tls
438
442
  };
439
443
  }
440
444
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.5.0",
3
+ "version": "6.5.2-batch.0",
4
4
  "description": "Node.js library for the Resend API",
5
- "main": "./dist/index.js",
5
+ "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
7
+ "types": "./dist/index.d.mts",
8
8
  "files": [
9
9
  "dist/**"
10
10
  ],
@@ -31,16 +31,14 @@
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsdown src/index.ts --format esm,cjs --dts",
34
- "format": "biome format --write .",
35
- "format:apply": "biome check --write .",
36
- "format:check": "biome format .",
37
34
  "lint": "biome check .",
35
+ "lint:fix": "biome check . --write",
38
36
  "prepublishOnly": "pnpm run build",
39
37
  "test": "vitest run",
40
- "test:watch": "vitest",
41
- "typecheck": "tsc --noEmit",
38
+ "test:dev": "cross-env TEST_MODE=dev vitest run",
42
39
  "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run",
43
- "test:dev": "cross-env TEST_MODE=dev vitest run"
40
+ "test:watch": "vitest",
41
+ "typecheck": "tsc --noEmit"
44
42
  },
45
43
  "repository": {
46
44
  "type": "git",