@upyo/mailtrap 0.6.0-dev.327 → 0.6.0-dev.336

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
@@ -22,6 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
 
23
23
  //#endregion
24
24
  const __upyo_core = __toESM(require("@upyo/core"));
25
+ const __upyo_core_calendar = __toESM(require("@upyo/core/calendar"));
25
26
 
26
27
  //#region src/config.ts
27
28
  const DEFAULT_SEND_BASE_URL = "https://send.api.mailtrap.io";
@@ -320,6 +321,7 @@ const STANDARD_HEADERS = new Set([
320
321
  */
321
322
  async function convertMessage(message, config, signal) {
322
323
  signal?.throwIfAborted();
324
+ const attachments = message.calendar == null ? message.attachments : [(0, __upyo_core_calendar.createCalendarAttachment)(message.calendar), ...message.attachments];
323
325
  const emailData = {
324
326
  from: formatAddress(message.sender),
325
327
  to: message.recipients.map(formatAddress),
@@ -350,11 +352,11 @@ async function convertMessage(message, config, signal) {
350
352
  for (const [key, value] of message.headers.entries()) if (!isStandardHeader(key) && !ownedHeaders.has(key.toLowerCase())) headers[key] = value;
351
353
  for (const [name, value] of threading) if (value != null) headers[name] = value;
352
354
  if (Object.keys(headers).length > 0) emailData.headers = headers;
353
- if (message.attachments.length > 0) {
355
+ if (attachments.length > 0) {
354
356
  const cancellation = new AbortController();
355
357
  const combined = (0, __upyo_core.combineSignals)(cancellation.signal, signal);
356
358
  try {
357
- emailData.attachments = await Promise.all(message.attachments.map((attachment) => convertAttachment(attachment, combined.signal)));
359
+ emailData.attachments = await Promise.all(attachments.map((attachment) => convertAttachment(attachment, combined.signal)));
358
360
  } finally {
359
361
  cancellation.abort();
360
362
  combined.cleanup();
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { combineSignals, createFailedReceipt, readAttachmentContent, resolveThreadingHeaders } from "@upyo/core";
2
+ import { createCalendarAttachment } from "@upyo/core/calendar";
2
3
 
3
4
  //#region src/config.ts
4
5
  const DEFAULT_SEND_BASE_URL = "https://send.api.mailtrap.io";
@@ -297,6 +298,7 @@ const STANDARD_HEADERS = new Set([
297
298
  */
298
299
  async function convertMessage(message, config, signal) {
299
300
  signal?.throwIfAborted();
301
+ const attachments = message.calendar == null ? message.attachments : [createCalendarAttachment(message.calendar), ...message.attachments];
300
302
  const emailData = {
301
303
  from: formatAddress(message.sender),
302
304
  to: message.recipients.map(formatAddress),
@@ -327,11 +329,11 @@ async function convertMessage(message, config, signal) {
327
329
  for (const [key, value] of message.headers.entries()) if (!isStandardHeader(key) && !ownedHeaders.has(key.toLowerCase())) headers[key] = value;
328
330
  for (const [name, value] of threading) if (value != null) headers[name] = value;
329
331
  if (Object.keys(headers).length > 0) emailData.headers = headers;
330
- if (message.attachments.length > 0) {
332
+ if (attachments.length > 0) {
331
333
  const cancellation = new AbortController();
332
334
  const combined = combineSignals(cancellation.signal, signal);
333
335
  try {
334
- emailData.attachments = await Promise.all(message.attachments.map((attachment) => convertAttachment(attachment, combined.signal)));
336
+ emailData.attachments = await Promise.all(attachments.map((attachment) => convertAttachment(attachment, combined.signal)));
335
337
  } finally {
336
338
  cancellation.abort();
337
339
  combined.cleanup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/mailtrap",
3
- "version": "0.6.0-dev.327",
3
+ "version": "0.6.0-dev.336",
4
4
  "description": "Mailtrap 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.327+0aa1111f"
56
+ "@upyo/core": "0.6.0-dev.336+ec6e189b"
57
57
  },
58
58
  "devDependencies": {
59
59
  "tsdown": "^0.12.7",