@arkstack/notifications 0.17.25 → 0.18.0
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 +32 -6
- package/dist/index.js +25 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ declare class DbNotification extends NotificationContract<UserNotification> {
|
|
|
295
295
|
* @param realtime Set to false to disable realtime broadcast
|
|
296
296
|
*/
|
|
297
297
|
broadcast(realtime?: boolean): void;
|
|
298
|
-
create(user: User, payload: DbNotificationPayload): Promise<
|
|
298
|
+
create(user: User, payload: DbNotificationPayload): Promise<import("arkormx").Model<string | import("arkormx").ModelQuerySchemaLike | Record<string, unknown>, Record<string, unknown>>>;
|
|
299
299
|
/**
|
|
300
300
|
* Send the database notification
|
|
301
301
|
*
|
|
@@ -305,7 +305,7 @@ declare class DbNotification extends NotificationContract<UserNotification> {
|
|
|
305
305
|
* @param data
|
|
306
306
|
* @returns
|
|
307
307
|
*/
|
|
308
|
-
send(message: string, subject?: string, _recipient?: NotificationRecipient, data?: NotificationData): Promise<
|
|
308
|
+
send(message: string, subject?: string, _recipient?: NotificationRecipient, data?: NotificationData): Promise<import("arkormx").Model<string | import("arkormx").ModelQuerySchemaLike | Record<string, unknown>, Record<string, unknown>>>;
|
|
309
309
|
}
|
|
310
310
|
//#endregion
|
|
311
311
|
//#region src/drivers/MailNotification.d.ts
|
|
@@ -425,6 +425,31 @@ declare class FirebaseRealtimeDriver implements RealtimeDriver {
|
|
|
425
425
|
constructor(options?: FirebaseTransportConfig);
|
|
426
426
|
private messaging;
|
|
427
427
|
broadcast(channel: string | string[], event: string, payload: RealtimeNotificationPayload): Promise<string | FirebaseMulticastResult>;
|
|
428
|
+
/**
|
|
429
|
+
* Firebase channels do not require server-side authorization.
|
|
430
|
+
*
|
|
431
|
+
* @param _socketId
|
|
432
|
+
* @param _channel
|
|
433
|
+
* @param _data
|
|
434
|
+
*/
|
|
435
|
+
auth(_socketId: string, _channel: string, _data?: unknown): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Firebase does not require an authorization route.
|
|
438
|
+
*
|
|
439
|
+
* @param _authEndpoint
|
|
440
|
+
* @param _middleware
|
|
441
|
+
* @param _channelPrefix
|
|
442
|
+
* @param _config
|
|
443
|
+
*/
|
|
444
|
+
static registerAuthRoute(_authEndpoint?: string, _middleware?: unknown | unknown[], _channelPrefix?: string, _config?: FirebaseTransportConfig): Promise<void>;
|
|
445
|
+
/**
|
|
446
|
+
* Firebase does not require an authorization route.
|
|
447
|
+
*
|
|
448
|
+
* @param _authEndpoint
|
|
449
|
+
* @param _middleware
|
|
450
|
+
* @param _channelPrefix
|
|
451
|
+
*/
|
|
452
|
+
registerAuthRoute(_authEndpoint?: string, _middleware?: unknown | unknown[], _channelPrefix?: string): Promise<void>;
|
|
428
453
|
/**
|
|
429
454
|
* Send to many device tokens at once, chunked to FCM's 500-token limit, and
|
|
430
455
|
* collect the tokens FCM rejects as dead so the caller can prune them.
|
|
@@ -497,9 +522,10 @@ declare class PusherRealtimeDriver implements RealtimeDriver {
|
|
|
497
522
|
*/
|
|
498
523
|
interface RealtimeDriver {
|
|
499
524
|
broadcast(channel: string | string[], event: string, payload: RealtimeNotificationPayload): Promise<unknown>;
|
|
500
|
-
auth
|
|
525
|
+
auth(socketId: string, channel: string, data?: unknown): unknown | Promise<unknown>;
|
|
526
|
+
registerAuthRoute(authEndpoint?: string, middleware?: unknown | unknown[], channelPrefix?: string): Promise<void>;
|
|
501
527
|
}
|
|
502
|
-
type RealtimeNotificationDriver<T extends RealtimeDriverName> = T extends 'firebase' ? FirebaseRealtimeDriver : T extends '
|
|
528
|
+
type RealtimeNotificationDriver<T extends RealtimeDriverName> = T extends 'firebase' ? FirebaseRealtimeDriver : T extends 'pusher' ? PusherRealtimeDriver : RealtimeDriver;
|
|
503
529
|
//#endregion
|
|
504
530
|
//#region src/drivers/RealtimeNotification.d.ts
|
|
505
531
|
/**
|
|
@@ -698,8 +724,8 @@ declare class UserNotificationCenter {
|
|
|
698
724
|
* @param user
|
|
699
725
|
* @param payload
|
|
700
726
|
*/
|
|
701
|
-
static create(user: User, payload: DbNotificationPayload): Promise<
|
|
702
|
-
static forUser(user: User): Promise<ArkormCollection<
|
|
727
|
+
static create(user: User, payload: DbNotificationPayload): Promise<import("arkormx").Model<string | import("arkormx").ModelQuerySchemaLike | Record<string, unknown>, Record<string, unknown>>>;
|
|
728
|
+
static forUser(user: User): Promise<ArkormCollection<import("arkormx").Model<string | import("arkormx").ModelQuerySchemaLike | Record<string, unknown>, Record<string, unknown>>, import("arkormx").Model<string | import("arkormx").ModelQuerySchemaLike | Record<string, unknown>, Record<string, unknown>>[]>>;
|
|
703
729
|
/**
|
|
704
730
|
* Fetch all the users unread messages
|
|
705
731
|
*
|
package/dist/index.js
CHANGED
|
@@ -561,6 +561,31 @@ var FirebaseRealtimeDriver = class {
|
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
564
|
+
* Firebase channels do not require server-side authorization.
|
|
565
|
+
*
|
|
566
|
+
* @param _socketId
|
|
567
|
+
* @param _channel
|
|
568
|
+
* @param _data
|
|
569
|
+
*/
|
|
570
|
+
async auth(_socketId, _channel, _data) {}
|
|
571
|
+
/**
|
|
572
|
+
* Firebase does not require an authorization route.
|
|
573
|
+
*
|
|
574
|
+
* @param _authEndpoint
|
|
575
|
+
* @param _middleware
|
|
576
|
+
* @param _channelPrefix
|
|
577
|
+
* @param _config
|
|
578
|
+
*/
|
|
579
|
+
static async registerAuthRoute(_authEndpoint = "/realtime/auth", _middleware, _channelPrefix, _config = {}) {}
|
|
580
|
+
/**
|
|
581
|
+
* Firebase does not require an authorization route.
|
|
582
|
+
*
|
|
583
|
+
* @param _authEndpoint
|
|
584
|
+
* @param _middleware
|
|
585
|
+
* @param _channelPrefix
|
|
586
|
+
*/
|
|
587
|
+
async registerAuthRoute(_authEndpoint = "/realtime/auth", _middleware, _channelPrefix) {}
|
|
588
|
+
/**
|
|
564
589
|
* Send to many device tokens at once, chunked to FCM's 500-token limit, and
|
|
565
590
|
* collect the tokens FCM rejects as dead so the caller can prune them.
|
|
566
591
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/notifications",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
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,17 +34,17 @@
|
|
|
34
34
|
"africastalking": "^0.8.0",
|
|
35
35
|
"nodemailer": "^9.0.3",
|
|
36
36
|
"twilio": "^6.0.2",
|
|
37
|
-
"@arkstack/common": "^0.
|
|
37
|
+
"@arkstack/common": "^0.18.0"
|
|
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
43
|
"@arkstack/contract": "^0.17.22",
|
|
44
|
-
"@arkstack/driver-express": "^0.17.25",
|
|
45
44
|
"@arkstack/database": "^0.17.22",
|
|
46
|
-
"@arkstack/driver-h3": "^0.
|
|
47
|
-
"@arkstack/
|
|
45
|
+
"@arkstack/driver-h3": "^0.18.0",
|
|
46
|
+
"@arkstack/driver-express": "^0.18.0",
|
|
47
|
+
"@arkstack/jobs": "^0.18.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@arkstack/driver-express": {
|