@upyo/core 0.4.0-dev.65 → 0.4.0-dev.67

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/message.cjs CHANGED
@@ -48,7 +48,8 @@ function createMessage(constructor) {
48
48
  content: constructor.content,
49
49
  priority: constructor.priority ?? "normal",
50
50
  tags: ensureArray(constructor.tags),
51
- headers: new Headers(constructor.headers ?? {})
51
+ headers: new Headers(constructor.headers ?? {}),
52
+ idempotencyKey: constructor.idempotencyKey
52
53
  };
53
54
  }
54
55
  function throwTypeError(message) {
@@ -77,6 +77,24 @@ interface Message {
77
77
  * the headers, such as `append`, `delete`, or `set`.
78
78
  */
79
79
  readonly headers: ImmutableHeaders;
80
+ /**
81
+ * An idempotency key to ensure that the same message is not sent multiple
82
+ * times. This is useful for retrying failed send operations without
83
+ * risking duplicate delivery.
84
+ *
85
+ * If provided, the transport will use this key to deduplicate requests.
86
+ * If not provided, the transport may generate its own key internally
87
+ * (behavior varies by transport implementation).
88
+ *
89
+ * The key should be unique for each distinct message you want to send.
90
+ * When retrying the same message, use the same idempotency key.
91
+ *
92
+ * Note: Not all transports support idempotency keys. Check the specific
93
+ * transport documentation for details.
94
+ *
95
+ * @since 0.4.0
96
+ */
97
+ readonly idempotencyKey?: string;
80
98
  }
81
99
  /**
82
100
  * Represents the content of an email message, which can be either HTML
@@ -182,6 +200,24 @@ interface MessageConstructor {
182
200
  * @default `{}`
183
201
  */
184
202
  readonly headers?: ImmutableHeaders | Record<string, string>;
203
+ /**
204
+ * An idempotency key to ensure that the same message is not sent multiple
205
+ * times. This is useful for retrying failed send operations without
206
+ * risking duplicate delivery.
207
+ *
208
+ * If provided, the transport will use this key to deduplicate requests.
209
+ * If not provided, the transport may generate its own key internally
210
+ * (behavior varies by transport implementation).
211
+ *
212
+ * The key should be unique for each distinct message you want to send.
213
+ * When retrying the same message, use the same idempotency key.
214
+ *
215
+ * Note: Not all transports support idempotency keys. Check the specific
216
+ * transport documentation for details.
217
+ *
218
+ * @since 0.4.0
219
+ */
220
+ readonly idempotencyKey?: string;
185
221
  }
186
222
  /**
187
223
  * Creates a new email {@link Message} based on the provided constructor
package/dist/message.d.ts CHANGED
@@ -77,6 +77,24 @@ interface Message {
77
77
  * the headers, such as `append`, `delete`, or `set`.
78
78
  */
79
79
  readonly headers: ImmutableHeaders;
80
+ /**
81
+ * An idempotency key to ensure that the same message is not sent multiple
82
+ * times. This is useful for retrying failed send operations without
83
+ * risking duplicate delivery.
84
+ *
85
+ * If provided, the transport will use this key to deduplicate requests.
86
+ * If not provided, the transport may generate its own key internally
87
+ * (behavior varies by transport implementation).
88
+ *
89
+ * The key should be unique for each distinct message you want to send.
90
+ * When retrying the same message, use the same idempotency key.
91
+ *
92
+ * Note: Not all transports support idempotency keys. Check the specific
93
+ * transport documentation for details.
94
+ *
95
+ * @since 0.4.0
96
+ */
97
+ readonly idempotencyKey?: string;
80
98
  }
81
99
  /**
82
100
  * Represents the content of an email message, which can be either HTML
@@ -182,6 +200,24 @@ interface MessageConstructor {
182
200
  * @default `{}`
183
201
  */
184
202
  readonly headers?: ImmutableHeaders | Record<string, string>;
203
+ /**
204
+ * An idempotency key to ensure that the same message is not sent multiple
205
+ * times. This is useful for retrying failed send operations without
206
+ * risking duplicate delivery.
207
+ *
208
+ * If provided, the transport will use this key to deduplicate requests.
209
+ * If not provided, the transport may generate its own key internally
210
+ * (behavior varies by transport implementation).
211
+ *
212
+ * The key should be unique for each distinct message you want to send.
213
+ * When retrying the same message, use the same idempotency key.
214
+ *
215
+ * Note: Not all transports support idempotency keys. Check the specific
216
+ * transport documentation for details.
217
+ *
218
+ * @since 0.4.0
219
+ */
220
+ readonly idempotencyKey?: string;
185
221
  }
186
222
  /**
187
223
  * Creates a new email {@link Message} based on the provided constructor
package/dist/message.js CHANGED
@@ -48,7 +48,8 @@ function createMessage(constructor) {
48
48
  content: constructor.content,
49
49
  priority: constructor.priority ?? "normal",
50
50
  tags: ensureArray(constructor.tags),
51
- headers: new Headers(constructor.headers ?? {})
51
+ headers: new Headers(constructor.headers ?? {}),
52
+ idempotencyKey: constructor.idempotencyKey
52
53
  };
53
54
  }
54
55
  function throwTypeError(message) {
@@ -37,7 +37,7 @@ interface TransportOptions {
37
37
  /**
38
38
  * The abort signal to cancel the send operation if needed.
39
39
  */
40
- signal?: AbortSignal;
40
+ readonly signal?: AbortSignal;
41
41
  }
42
42
  //#endregion
43
43
  export { Transport, TransportOptions };
@@ -37,7 +37,7 @@ interface TransportOptions {
37
37
  /**
38
38
  * The abort signal to cancel the send operation if needed.
39
39
  */
40
- signal?: AbortSignal;
40
+ readonly signal?: AbortSignal;
41
41
  }
42
42
  //#endregion
43
43
  export { Transport, TransportOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/core",
3
- "version": "0.4.0-dev.65+62f075a4",
3
+ "version": "0.4.0-dev.67+0f0eb30e",
4
4
  "description": "Simple email sending library for Node.js, Deno, Bun, and edge functions",
5
5
  "keywords": [
6
6
  "email",