@quatrain/messaging-firebase 1.0.1 → 1.0.2
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,8 +1,8 @@
|
|
|
1
1
|
import { AbstractMessagingAdapter, MessagingParameters, MessagingRecipient, NotificationCapableAdapter, NotificationMessage } from '@quatrain/messaging';
|
|
2
2
|
export declare class FirebaseMessagingAdapter extends AbstractMessagingAdapter implements NotificationCapableAdapter {
|
|
3
|
-
|
|
3
|
+
protected _messaging: any;
|
|
4
4
|
constructor(params?: MessagingParameters);
|
|
5
|
-
|
|
5
|
+
protected _initializeFirebase(): void;
|
|
6
6
|
/**
|
|
7
7
|
* Sends a notification to a single recipient via Firebase Cloud Messaging
|
|
8
8
|
*
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FirebaseMessagingAdapter = void 0;
|
|
13
13
|
const messaging_1 = require("@quatrain/messaging");
|
|
14
|
+
const firebase_admin_1 = require("firebase-admin");
|
|
14
15
|
const app_1 = require("firebase-admin/app");
|
|
15
16
|
const messaging_2 = require("firebase-admin/messaging");
|
|
16
17
|
class FirebaseMessagingAdapter extends messaging_1.AbstractMessagingAdapter {
|
|
@@ -24,7 +25,11 @@ class FirebaseMessagingAdapter extends messaging_1.AbstractMessagingAdapter {
|
|
|
24
25
|
if (!this._params.config) {
|
|
25
26
|
throw new Error('Firebase config is required');
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
const serviceAccount = this._params.config;
|
|
29
|
+
(0, app_1.initializeApp)({
|
|
30
|
+
credential: firebase_admin_1.credential.cert(serviceAccount),
|
|
31
|
+
databaseURL: this._params.config.databaseURL,
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
34
|
this._messaging = (0, messaging_2.getMessaging)();
|
|
30
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/messaging-firebase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@quatrain/core": "^1.1.19"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@quatrain/messaging": "^1.0.
|
|
16
|
+
"@quatrain/messaging": "^1.0.3",
|
|
17
17
|
"firebase-admin": "^13.0.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|