@kipicore/dbcore 1.1.667 → 1.1.668

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,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendPushNotification = void 0;
4
- const admin = require('firebase-admin');
4
+ const app_1 = require("firebase-admin/app");
5
+ const messaging_1 = require("firebase-admin/messaging");
5
6
  const env_1 = require("../configs/env");
6
7
  // Initialize Firebase if not already initialized
7
- if (!admin.apps.length) {
8
- admin.initializeApp({
9
- credential: admin.credential.cert({
8
+ if (!(0, app_1.getApps)().length) {
9
+ (0, app_1.initializeApp)({
10
+ credential: (0, app_1.cert)({
10
11
  projectId: env_1.ENV_VARIABLE.FIREBASE_PROJECT_ID,
11
12
  clientEmail: env_1.ENV_VARIABLE.FIREBASE_CLIENT_EMAIL,
12
13
  privateKey: env_1.ENV_VARIABLE.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'),
@@ -22,13 +23,12 @@ const sendPushNotification = async (deviceToken, notification) => {
22
23
  },
23
24
  token: deviceToken,
24
25
  };
25
- const response = await admin.messaging().send(payload);
26
+ const response = await (0, messaging_1.getMessaging)().send(payload);
26
27
  return response;
27
28
  }
28
29
  catch (error) {
29
30
  console.error('Error sending push notification:', error);
30
31
  return;
31
- // throw error;
32
32
  }
33
33
  };
34
34
  exports.sendPushNotification = sendPushNotification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.667",
3
+ "version": "1.1.668",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "date-fns": "^4.1.0",
49
49
  "dotenv": "^17.2.2",
50
50
  "ejs": "^3.1.10",
51
- "firebase-admin": "^14.2.0",
51
+ "firebase-admin": "^13.4.0",
52
52
  "ioredis": "^5.11.1",
53
53
  "joi": "^18.0.1",
54
54
  "mongoose": "^8.5.2",
@@ -80,4 +80,4 @@
80
80
  "LICENSE",
81
81
  ".sequelizerc"
82
82
  ]
83
- }
83
+ }