@arkstack/notifications 0.12.10 → 0.12.12

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
@@ -1,7 +1,6 @@
1
1
  import { DotPath, DotPathValue, MergedConfig } from "@arkstack/common";
2
2
  import { Transporter } from "nodemailer";
3
3
  import { Model } from "@arkstack/database";
4
- import * as _$arkormx from "arkormx";
5
4
  import { User } from "@arkstack/auth";
6
5
  import * as _$twilio_lib_rest_api_v2010_account_message0 from "twilio/lib/rest/api/v2010/account/message.js";
7
6
 
@@ -163,8 +162,8 @@ declare class DbNotification extends NotificationContract<UserNotification> {
163
162
  type(type: DbNotificationPayload['type']): this;
164
163
  action(text?: string | null, link?: string | null): this;
165
164
  meta(meta?: NotificationData | null): this;
166
- create(user: User$1, payload: DbNotificationPayload): Promise<UserNotification & _$arkormx.Model<any, any>>;
167
- send(message: string, subject?: string, _recipient?: NotificationRecipient, data?: NotificationData): Promise<UserNotification & _$arkormx.Model<any, any>>;
165
+ create(user: User$1, payload: DbNotificationPayload): Promise<any>;
166
+ send(message: string, subject?: string, _recipient?: NotificationRecipient, data?: NotificationData): Promise<any>;
168
167
  }
169
168
  //#endregion
170
169
  //#region src/drivers/MailNotification.d.ts
@@ -280,7 +279,7 @@ declare class Notification<D extends keyof DriverMap = keyof DriverMap> {
280
279
  static email(options?: MailDriverOptions): MailNotification;
281
280
  static sms(options?: SmsDriverOptions): SmsNotification;
282
281
  static db(): DbNotification;
283
- static channel(channel?: NotificationChannel | 'email', options?: MailDriverOptions | SmsDriverOptions): MailNotification | SmsNotification | DbNotification;
282
+ static channel(channel?: NotificationChannel | 'email', options?: MailDriverOptions | SmsDriverOptions): DbNotification | MailNotification | SmsNotification;
284
283
  prepare(recipient?: null | MailRecipient | NotificationRecipient | User$1, data?: NotificationData): DriverMap[D];
285
284
  private static createDriver;
286
285
  }
@@ -288,9 +287,9 @@ declare class Notification<D extends keyof DriverMap = keyof DriverMap> {
288
287
  //#region src/UserNotificationCenter.d.ts
289
288
  declare class UserNotificationCenter {
290
289
  private static getModel;
291
- static create(user: User$1, payload: DbNotificationPayload): Promise<UserNotification & _$arkormx.Model<any, any>>;
292
- static forUser(user: User$1): Promise<_$arkormx.ArkormCollection<UserNotification & _$arkormx.Model<any, any>, (UserNotification & _$arkormx.Model<any, any>)[]>>;
293
- static unreadForUser(user: User$1): Promise<_$arkormx.ArkormCollection<UserNotification & _$arkormx.Model<any, any>, (UserNotification & _$arkormx.Model<any, any>)[]>>;
290
+ static create(user: User$1, payload: DbNotificationPayload): Promise<any>;
291
+ static forUser(user: User$1): Promise<any>;
292
+ static unreadForUser(user: User$1): Promise<any>;
294
293
  static markRead(notification: UserNotification | UserNotification['id']): Promise<void>;
295
294
  static markAllRead(user: User$1): Promise<void>;
296
295
  static delete(notification: UserNotification | UserNotification['id']): Promise<void>;
package/dist/index.js CHANGED
@@ -381,19 +381,16 @@ var SmsNotification = class extends NotificationContract {
381
381
  const driverConfig = configure("drivers.sms", {});
382
382
  const transport = options.transport ?? driverConfig.transport ?? "twilio";
383
383
  const transportConfig = configure(`transports.${transport}`, {});
384
- const legacySmsConfig = configure("sms", {});
385
- const from = options.from ?? driverConfig.from ?? legacySmsConfig.from;
384
+ const from = options.from ?? driverConfig.from;
386
385
  this.fromValue = from;
387
386
  this.driver = transport === "twilio" ? new TwilioSmsDriver({
388
- ...legacySmsConfig.twilio,
389
387
  ...transportConfig,
390
388
  ...options.twilio,
391
- from: options.twilio?.from ?? transportConfig.from ?? legacySmsConfig.twilio?.from ?? from
389
+ from: options.twilio?.from ?? transportConfig.from ?? from
392
390
  }) : new AfricasTalkingSmsDriver({
393
- ...legacySmsConfig.africastalking,
394
391
  ...transportConfig,
395
392
  ...options.africastalking,
396
- senderId: options.africastalking?.senderId ?? transportConfig.senderId ?? legacySmsConfig.africastalking?.senderId ?? from
393
+ senderId: options.africastalking?.senderId ?? transportConfig.senderId ?? from
397
394
  });
398
395
  }
399
396
  from(from) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/notifications",
3
- "version": "0.12.10",
3
+ "version": "0.12.12",
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,11 +34,11 @@
34
34
  "africastalking": "^0.8.0",
35
35
  "nodemailer": "^8.0.7",
36
36
  "twilio": "^6.0.0",
37
- "@arkstack/common": "^0.12.10"
37
+ "@arkstack/common": "^0.12.12"
38
38
  },
39
39
  "peerDependencies": {
40
- "@arkstack/database": "^0.12.10",
41
- "@arkstack/contract": "^0.12.10"
40
+ "@arkstack/database": "^0.12.12",
41
+ "@arkstack/contract": "^0.12.12"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/nodemailer": "^7.0.11"