@quatrain/messaging-firebase 1.0.13 → 1.1.1
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.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { AbstractMessagingAdapter, MessagingParameters, MessagingRecipient, NotificationCapableAdapter, NotificationMessage } from '@quatrain/messaging';
|
|
2
|
+
/**
|
|
3
|
+
* Implementation to send Firebase Cloud Messaging (FCM) notifications using `firebase-admin`.
|
|
4
|
+
*/
|
|
2
5
|
export declare class FirebaseMessagingAdapter extends AbstractMessagingAdapter implements NotificationCapableAdapter {
|
|
3
6
|
protected _messaging: any;
|
|
4
7
|
constructor(params?: MessagingParameters);
|
|
@@ -12,6 +15,13 @@ export declare class FirebaseMessagingAdapter extends AbstractMessagingAdapter i
|
|
|
12
15
|
* @throws Error if recipient has no message token or Firebase send fails
|
|
13
16
|
*/
|
|
14
17
|
sendNotification(recipient: MessagingRecipient, message: NotificationMessage): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Dispatches a batch push notification payload to multiple devices simultaneously.
|
|
20
|
+
*
|
|
21
|
+
* @param recipients - Array of target contacts containing their FCM tokens.
|
|
22
|
+
* @param message - The Notification schema.
|
|
23
|
+
* @returns Response summarizing successful and failed deliveries.
|
|
24
|
+
*/
|
|
15
25
|
sendNotifications(recipients: MessagingRecipient[], message: NotificationMessage): Promise<{
|
|
16
26
|
successCount: number;
|
|
17
27
|
failureCount: number;
|
|
@@ -14,6 +14,9 @@ const messaging_1 = require("@quatrain/messaging");
|
|
|
14
14
|
const firebase_admin_1 = require("firebase-admin");
|
|
15
15
|
const app_1 = require("firebase-admin/app");
|
|
16
16
|
const messaging_2 = require("firebase-admin/messaging");
|
|
17
|
+
/**
|
|
18
|
+
* Implementation to send Firebase Cloud Messaging (FCM) notifications using `firebase-admin`.
|
|
19
|
+
*/
|
|
17
20
|
class FirebaseMessagingAdapter extends messaging_1.AbstractMessagingAdapter {
|
|
18
21
|
constructor(params = {}) {
|
|
19
22
|
super(params);
|
|
@@ -71,6 +74,13 @@ class FirebaseMessagingAdapter extends messaging_1.AbstractMessagingAdapter {
|
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Dispatches a batch push notification payload to multiple devices simultaneously.
|
|
79
|
+
*
|
|
80
|
+
* @param recipients - Array of target contacts containing their FCM tokens.
|
|
81
|
+
* @param message - The Notification schema.
|
|
82
|
+
* @returns Response summarizing successful and failed deliveries.
|
|
83
|
+
*/
|
|
74
84
|
sendNotifications(recipients, message) {
|
|
75
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
86
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/messaging-firebase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "Quatrain Développement SAS <developers@quatrain.com>",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@quatrain/core": "^1.
|
|
22
|
+
"@quatrain/core": "^1.2.6"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@quatrain/core": "^1.
|
|
26
|
-
"@quatrain/messaging": "^1.
|
|
25
|
+
"@quatrain/core": "^1.2.6",
|
|
26
|
+
"@quatrain/messaging": "^1.1.3",
|
|
27
27
|
"firebase-admin": "^13.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -42,5 +42,8 @@
|
|
|
42
42
|
"wbuild": "tsc --watch",
|
|
43
43
|
"test": "jest",
|
|
44
44
|
"bump-to": "yarn version"
|
|
45
|
+
},
|
|
46
|
+
"typedoc": {
|
|
47
|
+
"entryPoint": "src/index.ts"
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -10,6 +10,9 @@ import { credential } from 'firebase-admin'
|
|
|
10
10
|
import { getApps, initializeApp, ServiceAccount } from 'firebase-admin/app'
|
|
11
11
|
import { getMessaging, Message } from 'firebase-admin/messaging'
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Implementation to send Firebase Cloud Messaging (FCM) notifications using `firebase-admin`.
|
|
15
|
+
*/
|
|
13
16
|
export class FirebaseMessagingAdapter
|
|
14
17
|
extends AbstractMessagingAdapter
|
|
15
18
|
implements NotificationCapableAdapter
|
|
@@ -84,6 +87,13 @@ export class FirebaseMessagingAdapter
|
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Dispatches a batch push notification payload to multiple devices simultaneously.
|
|
92
|
+
*
|
|
93
|
+
* @param recipients - Array of target contacts containing their FCM tokens.
|
|
94
|
+
* @param message - The Notification schema.
|
|
95
|
+
* @returns Response summarizing successful and failed deliveries.
|
|
96
|
+
*/
|
|
87
97
|
async sendNotifications(
|
|
88
98
|
recipients: MessagingRecipient[],
|
|
89
99
|
message: NotificationMessage
|