@arkstack/notifications 0.17.20 → 0.17.22

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.ts CHANGED
@@ -5,6 +5,7 @@ import { Logger } from "nodemailer/lib/shared/index.js";
5
5
  import MailMessage from "nodemailer/lib/mailer/mail-message.js";
6
6
  import { User } from "@app/models/User";
7
7
  import { User as User$1 } from "@arkstack/auth";
8
+ import { Attachment } from "nodemailer/lib/mailer/index.js";
8
9
  import { PhoneNumber } from "@kanun-hq/plugin-phone";
9
10
  import { ArkormCollection, LengthAwarePaginator } from "arkormx";
10
11
  //#region src/Contracts/UserNotification.d.ts
@@ -299,6 +300,7 @@ declare class MailNotification extends NotificationContract {
299
300
  private htmlTemplate?;
300
301
  private textTemplate?;
301
302
  private fileDirectory?;
303
+ private attachmentList?;
302
304
  constructor(options?: MailNotificationOptions);
303
305
  /**
304
306
  * Prepare the mail driver so we can use it to relay the message
@@ -312,6 +314,18 @@ declare class MailNotification extends NotificationContract {
312
314
  * @returns
313
315
  */
314
316
  subject(subject: string): this;
317
+ /**
318
+ * Attachemnts to send with the mail
319
+ *
320
+ * @param attachments
321
+ */
322
+ attachments(attachments: Attachment[]): this;
323
+ /**
324
+ * A single attachemnt to send with the mail
325
+ *
326
+ * @param attachment
327
+ */
328
+ attachment(attachment: Attachment): this;
315
329
  /**
316
330
  * Set email the notification recipeint
317
331
  *
package/dist/index.js CHANGED
@@ -212,6 +212,7 @@ var MailNotification = class extends NotificationContract {
212
212
  htmlTemplate;
213
213
  textTemplate;
214
214
  fileDirectory;
215
+ attachmentList;
215
216
  constructor(options = {}) {
216
217
  super();
217
218
  this.driverConfig = configure("drivers.mail", {});
@@ -305,6 +306,24 @@ var MailNotification = class extends NotificationContract {
305
306
  return this;
306
307
  }
307
308
  /**
309
+ * Attachemnts to send with the mail
310
+ *
311
+ * @param attachments
312
+ */
313
+ attachments(attachments) {
314
+ this.attachmentList = attachments;
315
+ return this;
316
+ }
317
+ /**
318
+ * A single attachemnt to send with the mail
319
+ *
320
+ * @param attachment
321
+ */
322
+ attachment(attachment) {
323
+ this.attachmentList = [...this.attachmentList ?? [], attachment];
324
+ return this;
325
+ }
326
+ /**
308
327
  * Set email the notification recipeint
309
328
  *
310
329
  * @param recipient string or array of email addresses
@@ -391,6 +410,7 @@ var MailNotification = class extends NotificationContract {
391
410
  html: this.htmlTemplate ? interpolate(this.htmlTemplate, templateData) : await globalThis.view(this.ViewName, templateData)
392
411
  };
393
412
  if (this.transport === "ses") payload.ses = this.sesOptions;
413
+ if (this.attachmentList) payload.attachments = this.attachmentList;
394
414
  const result = await this.driver.sendMail(payload);
395
415
  if (this.fileDirectory) await this.storeFileMail(payload, result);
396
416
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/notifications",
3
- "version": "0.17.20",
3
+ "version": "0.17.22",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic notification module for Arkstack and Nodejs, providing support for multi-channel notification delivery.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/notifications",
@@ -34,16 +34,16 @@
34
34
  "africastalking": "^0.8.0",
35
35
  "nodemailer": "^9.0.3",
36
36
  "twilio": "^6.0.2",
37
- "@arkstack/common": "^0.17.20"
37
+ "@arkstack/common": "^0.17.22"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kanun-hq/plugin-phone": "^0.1.8",
41
41
  "firebase-admin": "^13.0.0",
42
42
  "pusher": "^5.2.0",
43
- "@arkstack/contract": "^0.17.20",
44
- "@arkstack/database": "^0.17.20",
45
- "@arkstack/driver-express": "^0.17.20",
46
- "@arkstack/driver-h3": "^0.17.20"
43
+ "@arkstack/contract": "^0.17.22",
44
+ "@arkstack/database": "^0.17.22",
45
+ "@arkstack/driver-express": "^0.17.22",
46
+ "@arkstack/driver-h3": "^0.17.22"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@arkstack/driver-express": {