@upyo/plunk 0.6.0-dev.318 → 0.6.0-dev.319

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
@@ -230,6 +230,7 @@ function truncateErrorBody(text) {
230
230
  * @param message - The Upyo message to convert
231
231
  * @param config - Resolved Plunk configuration
232
232
  * @returns Promise that resolves to Plunk-formatted email data
233
+ * @throws {TypeError} If the message carries an invalid message identifier.
233
234
  */
234
235
  async function convertMessage(message, _config, signal) {
235
236
  const recipients = message.recipients.map((addr) => addr.address);
@@ -241,6 +242,8 @@ async function convertMessage(message, _config, signal) {
241
242
  if ("html" in message.content && message.content.html) body = message.content.html;
242
243
  else if ("text" in message.content && message.content.text) body = message.content.text;
243
244
  else body = "";
245
+ const threading = (0, __upyo_core.resolveThreadingHeaders)(message);
246
+ const ownedHeaders = new Set([...threading.keys()].map((name) => name.toLowerCase()));
244
247
  const customHeaders = {};
245
248
  if (message.headers) for (const [key, value] of message.headers.entries()) {
246
249
  const lowerKey = key.toLowerCase();
@@ -250,8 +253,9 @@ async function convertMessage(message, _config, signal) {
250
253
  "reply-to",
251
254
  "subject",
252
255
  "content-type"
253
- ].includes(lowerKey)) customHeaders[lowerKey] = value;
256
+ ].includes(lowerKey) && !ownedHeaders.has(lowerKey)) customHeaders[lowerKey] = value;
254
257
  }
258
+ for (const [name, value] of threading) if (value != null) customHeaders[name] = value;
255
259
  const attachments = [];
256
260
  const maxAttachments = Math.min(message.attachments.length, 5);
257
261
  for (let i = 0; i < maxAttachments; i++) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { combineSignals, createFailedReceipt, parseRetryAfter, readAttachmentContent } from "@upyo/core";
1
+ import { combineSignals, createFailedReceipt, parseRetryAfter, readAttachmentContent, resolveThreadingHeaders } from "@upyo/core";
2
2
 
3
3
  //#region src/config.ts
4
4
  /**
@@ -207,6 +207,7 @@ function truncateErrorBody(text) {
207
207
  * @param message - The Upyo message to convert
208
208
  * @param config - Resolved Plunk configuration
209
209
  * @returns Promise that resolves to Plunk-formatted email data
210
+ * @throws {TypeError} If the message carries an invalid message identifier.
210
211
  */
211
212
  async function convertMessage(message, _config, signal) {
212
213
  const recipients = message.recipients.map((addr) => addr.address);
@@ -218,6 +219,8 @@ async function convertMessage(message, _config, signal) {
218
219
  if ("html" in message.content && message.content.html) body = message.content.html;
219
220
  else if ("text" in message.content && message.content.text) body = message.content.text;
220
221
  else body = "";
222
+ const threading = resolveThreadingHeaders(message);
223
+ const ownedHeaders = new Set([...threading.keys()].map((name) => name.toLowerCase()));
221
224
  const customHeaders = {};
222
225
  if (message.headers) for (const [key, value] of message.headers.entries()) {
223
226
  const lowerKey = key.toLowerCase();
@@ -227,8 +230,9 @@ async function convertMessage(message, _config, signal) {
227
230
  "reply-to",
228
231
  "subject",
229
232
  "content-type"
230
- ].includes(lowerKey)) customHeaders[lowerKey] = value;
233
+ ].includes(lowerKey) && !ownedHeaders.has(lowerKey)) customHeaders[lowerKey] = value;
231
234
  }
235
+ for (const [name, value] of threading) if (value != null) customHeaders[name] = value;
232
236
  const attachments = [];
233
237
  const maxAttachments = Math.min(message.attachments.length, 5);
234
238
  for (let i = 0; i < maxAttachments; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/plunk",
3
- "version": "0.6.0-dev.318",
3
+ "version": "0.6.0-dev.319",
4
4
  "description": "Plunk transport for Upyo email library",
5
5
  "keywords": [
6
6
  "email",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "sideEffects": false,
55
55
  "peerDependencies": {
56
- "@upyo/core": "0.6.0-dev.318+9378b2c8"
56
+ "@upyo/core": "0.6.0-dev.319+2324fa8c"
57
57
  },
58
58
  "devDependencies": {
59
59
  "tsdown": "^0.12.7",