@upyo/smtp 0.1.0-dev.10 → 0.1.0-dev.11

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/README.md CHANGED
@@ -3,7 +3,16 @@
3
3
  @upyo/smtp
4
4
  ==========
5
5
 
6
- SMTP transport implementation for the Upyo email library.
6
+ [![JSR][JSR badge]][JSR]
7
+ [![npm][npm badge]][npm]
8
+
9
+ SMTP transport implementation for the [Upyo] email library.
10
+
11
+ [JSR]: https://jsr.io/@upyo/smtp
12
+ [JSR badge]: https://jsr.io/badges/@upyo/smtp
13
+ [npm]: https://www.npmjs.com/package/@upyo/smtp
14
+ [npm badge]: https://img.shields.io/npm/v/@upyo/smtp?logo=npm
15
+ [Upyo]: https://upyo.org/
7
16
 
8
17
 
9
18
  Features
package/dist/index.cjs CHANGED
@@ -266,7 +266,7 @@ var SmtpConnection = class {
266
266
 
267
267
  //#endregion
268
268
  //#region src/message-converter.ts
269
- function convertMessage(message) {
269
+ async function convertMessage(message) {
270
270
  const envelope = {
271
271
  from: message.sender.address,
272
272
  to: [
@@ -275,13 +275,13 @@ function convertMessage(message) {
275
275
  ...message.bccRecipients.map((r) => r.address)
276
276
  ]
277
277
  };
278
- const raw = buildRawMessage(message);
278
+ const raw = await buildRawMessage(message);
279
279
  return {
280
280
  envelope,
281
281
  raw
282
282
  };
283
283
  }
284
- function buildRawMessage(message) {
284
+ async function buildRawMessage(message) {
285
285
  const lines = [];
286
286
  const boundary = generateBoundary();
287
287
  const hasAttachments = message.attachments.length > 0;
@@ -346,7 +346,7 @@ function buildRawMessage(message) {
346
346
  lines.push(`Content-ID: <${attachment.contentId}>`);
347
347
  } else lines.push(`Content-Disposition: attachment; filename="${attachment.filename}"`);
348
348
  lines.push("");
349
- lines.push(encodeBase64(attachment.content));
349
+ lines.push(encodeBase64(await attachment.content));
350
350
  }
351
351
  lines.push("");
352
352
  lines.push(`--${boundary}--`);
@@ -472,7 +472,7 @@ var SmtpTransport = class {
472
472
  const connection = await this.getConnection(options?.signal);
473
473
  try {
474
474
  options?.signal?.throwIfAborted();
475
- const smtpMessage = convertMessage(message);
475
+ const smtpMessage = await convertMessage(message);
476
476
  options?.signal?.throwIfAborted();
477
477
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
478
478
  await this.returnConnection(connection);
@@ -535,7 +535,7 @@ var SmtpTransport = class {
535
535
  continue;
536
536
  }
537
537
  try {
538
- const smtpMessage = convertMessage(message);
538
+ const smtpMessage = await convertMessage(message);
539
539
  options?.signal?.throwIfAborted();
540
540
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
541
541
  yield {
@@ -563,7 +563,7 @@ var SmtpTransport = class {
563
563
  continue;
564
564
  }
565
565
  try {
566
- const smtpMessage = convertMessage(message);
566
+ const smtpMessage = await convertMessage(message);
567
567
  options?.signal?.throwIfAborted();
568
568
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
569
569
  yield {
package/dist/index.js CHANGED
@@ -243,7 +243,7 @@ var SmtpConnection = class {
243
243
 
244
244
  //#endregion
245
245
  //#region src/message-converter.ts
246
- function convertMessage(message) {
246
+ async function convertMessage(message) {
247
247
  const envelope = {
248
248
  from: message.sender.address,
249
249
  to: [
@@ -252,13 +252,13 @@ function convertMessage(message) {
252
252
  ...message.bccRecipients.map((r) => r.address)
253
253
  ]
254
254
  };
255
- const raw = buildRawMessage(message);
255
+ const raw = await buildRawMessage(message);
256
256
  return {
257
257
  envelope,
258
258
  raw
259
259
  };
260
260
  }
261
- function buildRawMessage(message) {
261
+ async function buildRawMessage(message) {
262
262
  const lines = [];
263
263
  const boundary = generateBoundary();
264
264
  const hasAttachments = message.attachments.length > 0;
@@ -323,7 +323,7 @@ function buildRawMessage(message) {
323
323
  lines.push(`Content-ID: <${attachment.contentId}>`);
324
324
  } else lines.push(`Content-Disposition: attachment; filename="${attachment.filename}"`);
325
325
  lines.push("");
326
- lines.push(encodeBase64(attachment.content));
326
+ lines.push(encodeBase64(await attachment.content));
327
327
  }
328
328
  lines.push("");
329
329
  lines.push(`--${boundary}--`);
@@ -449,7 +449,7 @@ var SmtpTransport = class {
449
449
  const connection = await this.getConnection(options?.signal);
450
450
  try {
451
451
  options?.signal?.throwIfAborted();
452
- const smtpMessage = convertMessage(message);
452
+ const smtpMessage = await convertMessage(message);
453
453
  options?.signal?.throwIfAborted();
454
454
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
455
455
  await this.returnConnection(connection);
@@ -512,7 +512,7 @@ var SmtpTransport = class {
512
512
  continue;
513
513
  }
514
514
  try {
515
- const smtpMessage = convertMessage(message);
515
+ const smtpMessage = await convertMessage(message);
516
516
  options?.signal?.throwIfAborted();
517
517
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
518
518
  yield {
@@ -540,7 +540,7 @@ var SmtpTransport = class {
540
540
  continue;
541
541
  }
542
542
  try {
543
- const smtpMessage = convertMessage(message);
543
+ const smtpMessage = await convertMessage(message);
544
544
  options?.signal?.throwIfAborted();
545
545
  const messageId = await connection.sendMessage(smtpMessage, options?.signal);
546
546
  yield {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/smtp",
3
- "version": "0.1.0-dev.10+c222d7c6",
3
+ "version": "0.1.0-dev.11+9d41b08f",
4
4
  "description": "SMTP 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.1.0-dev.10+c222d7c6"
56
+ "@upyo/core": "0.1.0-dev.11+9d41b08f"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@dotenvx/dotenvx": "^1.47.3",