resend 4.2.0 → 4.3.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.d.mts CHANGED
@@ -133,6 +133,15 @@ declare class Audiences {
133
133
  remove(id: string): Promise<RemoveAudiencesResponse>;
134
134
  }
135
135
 
136
+ interface IdempotentRequest {
137
+ /**
138
+ * Unique key that ensures the same operation is not processed multiple times.
139
+ * Allows for safe retries without duplicating operations.
140
+ * If provided, will be sent as the `Idempotency-Key` header.
141
+ */
142
+ idempotencyKey?: string;
143
+ }
144
+
136
145
  type RequireAtLeastOne<T> = {
137
146
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
138
147
  }[keyof T];
@@ -221,7 +230,7 @@ interface CreateEmailBaseOptions {
221
230
  scheduledAt?: string;
222
231
  }
223
232
  type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions;
224
- interface CreateEmailRequestOptions extends PostOptions {
233
+ interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
225
234
  }
226
235
  interface CreateEmailResponseSuccess {
227
236
  /** The ID of the newly created email. */
@@ -721,7 +730,7 @@ declare class Resend {
721
730
  data: T | null;
722
731
  error: ErrorResponse | null;
723
732
  }>;
724
- post<T>(path: string, entity?: unknown, options?: PostOptions): Promise<{
733
+ post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
725
734
  data: T | null;
726
735
  error: ErrorResponse | null;
727
736
  }>;
package/dist/index.d.ts CHANGED
@@ -133,6 +133,15 @@ declare class Audiences {
133
133
  remove(id: string): Promise<RemoveAudiencesResponse>;
134
134
  }
135
135
 
136
+ interface IdempotentRequest {
137
+ /**
138
+ * Unique key that ensures the same operation is not processed multiple times.
139
+ * Allows for safe retries without duplicating operations.
140
+ * If provided, will be sent as the `Idempotency-Key` header.
141
+ */
142
+ idempotencyKey?: string;
143
+ }
144
+
136
145
  type RequireAtLeastOne<T> = {
137
146
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
138
147
  }[keyof T];
@@ -221,7 +230,7 @@ interface CreateEmailBaseOptions {
221
230
  scheduledAt?: string;
222
231
  }
223
232
  type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions;
224
- interface CreateEmailRequestOptions extends PostOptions {
233
+ interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
225
234
  }
226
235
  interface CreateEmailResponseSuccess {
227
236
  /** The ID of the newly created email. */
@@ -721,7 +730,7 @@ declare class Resend {
721
730
  data: T | null;
722
731
  error: ErrorResponse | null;
723
732
  }>;
724
- post<T>(path: string, entity?: unknown, options?: PostOptions): Promise<{
733
+ post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
725
734
  data: T | null;
726
735
  error: ErrorResponse | null;
727
736
  }>;
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ __export(src_exports, {
72
72
  module.exports = __toCommonJS(src_exports);
73
73
 
74
74
  // package.json
75
- var version = "4.2.0";
75
+ var version = "4.3.0";
76
76
 
77
77
  // src/api-keys/api-keys.ts
78
78
  var ApiKeys = class {
@@ -567,6 +567,9 @@ var Resend = class {
567
567
  }
568
568
  post(_0, _1) {
569
569
  return __async(this, arguments, function* (path, entity, options = {}) {
570
+ if (options.idempotencyKey) {
571
+ this.headers.set("Idempotency-Key", options.idempotencyKey);
572
+ }
570
573
  const requestOptions = __spreadValues({
571
574
  method: "POST",
572
575
  headers: this.headers,
package/dist/index.mjs CHANGED
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
 
41
41
  // package.json
42
- var version = "4.2.0";
42
+ var version = "4.3.0";
43
43
 
44
44
  // src/api-keys/api-keys.ts
45
45
  var ApiKeys = class {
@@ -534,6 +534,9 @@ var Resend = class {
534
534
  }
535
535
  post(_0, _1) {
536
536
  return __async(this, arguments, function* (path, entity, options = {}) {
537
+ if (options.idempotencyKey) {
538
+ this.headers.set("Idempotency-Key", options.idempotencyKey);
539
+ }
537
540
  const requestOptions = __spreadValues({
538
541
  method: "POST",
539
542
  headers: this.headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -42,19 +42,19 @@
42
42
  },
43
43
  "homepage": "https://github.com/resendlabs/resend-node#readme",
44
44
  "dependencies": {
45
- "@react-email/render": "1.0.5"
45
+ "@react-email/render": "1.0.6"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@biomejs/biome": "1.9.4",
49
- "@types/jest": "29.5.12",
50
- "@types/node": "18.19.80",
51
- "@types/react": "18.3.3",
49
+ "@types/jest": "29.5.14",
50
+ "@types/node": "18.19.86",
51
+ "@types/react": "19.1.0",
52
52
  "jest": "29.7.0",
53
53
  "jest-fetch-mock": "3.0.3",
54
- "ts-jest": "29.2.6",
54
+ "ts-jest": "29.3.1",
55
55
  "ts-node": "10.9.2",
56
56
  "tsup": "7.2.0",
57
- "typescript": "5.8.2"
57
+ "typescript": "5.8.3"
58
58
  },
59
- "packageManager": "pnpm@10.6.5"
59
+ "packageManager": "pnpm@10.8.0"
60
60
  }