resend 6.5.1 → 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 +7 -3
- package/dist/index.d.cts +17 -24
- package/dist/index.d.mts +17 -24
- package/dist/index.mjs +7 -3
- package/package.json +14 -12
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
567
|
-
last_name
|
|
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
|
-
|
|
670
|
-
|
|
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
|
-
|
|
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
|
|
567
|
-
last_name
|
|
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
|
-
|
|
670
|
-
|
|
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.
|
|
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
|
-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.2-batch.0",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsdown src/index.ts --format esm,cjs --dts",
|
|
34
|
+
"lint": "biome check .",
|
|
35
|
+
"lint:fix": "biome check . --write",
|
|
36
|
+
"prepublishOnly": "pnpm run build",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:dev": "cross-env TEST_MODE=dev vitest run",
|
|
39
|
+
"test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run",
|
|
40
|
+
"test:watch": "vitest",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
32
43
|
"repository": {
|
|
33
44
|
"type": "git",
|
|
34
45
|
"url": "git+https://github.com/resend/resend-node.git"
|
|
@@ -66,14 +77,5 @@
|
|
|
66
77
|
"vitest": "3.2.4",
|
|
67
78
|
"vitest-fetch-mock": "0.4.5"
|
|
68
79
|
},
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
"lint": "biome check .",
|
|
72
|
-
"lint:fix": "biome check . --write",
|
|
73
|
-
"test": "vitest run",
|
|
74
|
-
"test:dev": "cross-env TEST_MODE=dev vitest run",
|
|
75
|
-
"test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run",
|
|
76
|
-
"test:watch": "vitest",
|
|
77
|
-
"typecheck": "tsc --noEmit"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
+
"packageManager": "pnpm@10.18.2"
|
|
81
|
+
}
|