podverse-external-services 5.1.26-alpha.0 → 5.1.27-alpha.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.
Files changed (37) hide show
  1. package/dist/config/index.d.ts +1 -13
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/config/index.js +15 -13
  4. package/dist/config/types.d.ts +19 -0
  5. package/dist/config/types.d.ts.map +1 -0
  6. package/dist/config/types.js +7 -0
  7. package/dist/factory.d.ts +18 -0
  8. package/dist/factory.d.ts.map +1 -0
  9. package/dist/factory.js +68 -0
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +7 -0
  13. package/dist/services/google/firebase/firebaseNotificationAndroid.d.ts +3 -2
  14. package/dist/services/google/firebase/firebaseNotificationAndroid.d.ts.map +1 -1
  15. package/dist/services/google/firebase/firebaseNotificationAndroid.js +4 -6
  16. package/dist/services/google/firebase/firebaseNotificationIOS.d.ts +3 -2
  17. package/dist/services/google/firebase/firebaseNotificationIOS.d.ts.map +1 -1
  18. package/dist/services/google/firebase/firebaseNotificationIOS.js +5 -6
  19. package/dist/services/google/firebase/firebaseNotificationOrchestrator.d.ts +3 -2
  20. package/dist/services/google/firebase/firebaseNotificationOrchestrator.d.ts.map +1 -1
  21. package/dist/services/google/firebase/firebaseNotificationOrchestrator.js +4 -4
  22. package/dist/services/google/firebase/firebaseNotificationWeb.d.ts +2 -1
  23. package/dist/services/google/firebase/firebaseNotificationWeb.d.ts.map +1 -1
  24. package/dist/services/google/firebase/firebaseNotificationWeb.js +5 -7
  25. package/dist/services/google/firebase/index.d.ts +0 -1
  26. package/dist/services/google/firebase/index.d.ts.map +1 -1
  27. package/dist/services/google/firebase/index.js +1 -3
  28. package/dist/services/podcast-index/index.d.ts +2 -0
  29. package/dist/services/podcast-index/index.d.ts.map +1 -1
  30. package/dist/services/podcast-index/index.js +99 -0
  31. package/package.json +3 -3
  32. package/dist/config/web.d.ts +0 -4
  33. package/dist/config/web.d.ts.map +0 -1
  34. package/dist/config/web.js +0 -17
  35. package/dist/services/google/firebase/firebaseAdmin.d.ts +0 -3
  36. package/dist/services/google/firebase/firebaseAdmin.d.ts.map +0 -1
  37. package/dist/services/google/firebase/firebaseAdmin.js +0 -31
@@ -1,14 +1,2 @@
1
- export declare const config: {
2
- google: {
3
- firebase: {
4
- notifications_enabled: boolean;
5
- admin_json_key_path: string;
6
- };
7
- };
8
- web: {
9
- protocol: string;
10
- host: string;
11
- icon_image_url: string;
12
- };
13
- };
1
+ export * from './types';
14
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC"}
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- exports.config = {
5
- google: {
6
- firebase: {
7
- notifications_enabled: process.env.GOOGLE_FIREBASE_NOTIFICATIONS_ENABLED === "true",
8
- admin_json_key_path: process.env.GOOGLE_FIREBASE_ADMIN_JSON_KEY_PATH || "",
9
- }
10
- },
11
- web: {
12
- protocol: process.env.WEB_PROTOCOL || "http",
13
- host: process.env.WEB_DOMAIN || "localhost",
14
- icon_image_url: process.env.WEB_ICON_IMAGE_PATH || ""
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
7
  }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
15
  };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Re-export config types for app-level use
18
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Configuration types for podverse-external-services
3
+ * These types are used by the app to create the configuration object
4
+ * that gets passed to factory functions
5
+ */
6
+ export type FirebaseConfig = {
7
+ notifications_enabled: boolean;
8
+ admin_json_key_path: string;
9
+ };
10
+ export type WebConfig = {
11
+ protocol: string;
12
+ host: string;
13
+ icon_image_url: string;
14
+ };
15
+ export type ExternalServicesConfig = {
16
+ firebase: FirebaseConfig;
17
+ web: WebConfig;
18
+ };
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,GAAG,EAAE,SAAS,CAAC;CAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Configuration types for podverse-external-services
4
+ * These types are used by the app to create the configuration object
5
+ * that gets passed to factory functions
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import admin from "firebase-admin";
2
+ import { ExternalServicesConfig } from './config/types';
3
+ export type FirebaseContext = {
4
+ firebaseAdmin: typeof admin | null;
5
+ isFirebaseEnabled: boolean;
6
+ getWebBaseUrl: () => string;
7
+ getWebBaseUrlWithPath: (path: string) => string;
8
+ getWebIconImageUrl: () => string;
9
+ };
10
+ /**
11
+ * Creates a Firebase context with the provided configuration.
12
+ * This is the factory function that should be called from the app level.
13
+ *
14
+ * @param config - The external services configuration (from app-level env vars)
15
+ * @returns FirebaseContext with initialized Firebase admin and helper functions
16
+ */
17
+ export declare function createFirebaseContext(config: ExternalServicesConfig): FirebaseContext;
18
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,OAAO,KAAK,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,kBAAkB,EAAE,MAAM,MAAM,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,eAAe,CA0DrF"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createFirebaseContext = createFirebaseContext;
7
+ const firebase_admin_1 = __importDefault(require("firebase-admin"));
8
+ /**
9
+ * Creates a Firebase context with the provided configuration.
10
+ * This is the factory function that should be called from the app level.
11
+ *
12
+ * @param config - The external services configuration (from app-level env vars)
13
+ * @returns FirebaseContext with initialized Firebase admin and helper functions
14
+ */
15
+ function createFirebaseContext(config) {
16
+ let firebaseAdminInstance = null;
17
+ let isFirebaseEnabled = false;
18
+ if (!config.firebase.notifications_enabled) {
19
+ console.warn("Firebase notifications are disabled in the configuration.");
20
+ }
21
+ else {
22
+ console.log("Firebase notifications are enabled in the configuration.");
23
+ // Check if the admin JSON key path is provided
24
+ if (!config.firebase.admin_json_key_path || config.firebase.admin_json_key_path.trim() === "") {
25
+ console.error("Firebase Admin Initialization Failed: admin_json_key_path is required when firebase notifications are enabled");
26
+ firebaseAdminInstance = null;
27
+ isFirebaseEnabled = false;
28
+ }
29
+ else {
30
+ try {
31
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
32
+ const settings = require(config.firebase.admin_json_key_path);
33
+ const serviceAccount = settings;
34
+ if (!firebase_admin_1.default.apps.length) {
35
+ firebase_admin_1.default.initializeApp({
36
+ credential: firebase_admin_1.default.credential.cert(serviceAccount),
37
+ });
38
+ console.log("Firebase Admin Initialized Successfully");
39
+ }
40
+ firebaseAdminInstance = firebase_admin_1.default;
41
+ isFirebaseEnabled = true;
42
+ }
43
+ catch (error) {
44
+ console.error("Firebase Admin Initialization Failed:", error);
45
+ firebaseAdminInstance = null;
46
+ isFirebaseEnabled = false;
47
+ }
48
+ }
49
+ }
50
+ // Helper functions bound to config
51
+ const getWebBaseUrl = () => {
52
+ return `${config.web.protocol}://${config.web.host}`;
53
+ };
54
+ const getWebBaseUrlWithPath = (path) => {
55
+ const baseUrl = getWebBaseUrl();
56
+ return `${baseUrl}${path}`;
57
+ };
58
+ const getWebIconImageUrl = () => {
59
+ return `${getWebBaseUrl()}/${config.web.icon_image_url}`;
60
+ };
61
+ return {
62
+ firebaseAdmin: firebaseAdminInstance,
63
+ isFirebaseEnabled,
64
+ getWebBaseUrl,
65
+ getWebBaseUrlWithPath,
66
+ getWebIconImageUrl,
67
+ };
68
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import './module-alias-config';
2
+ export * from './config';
3
+ export { createFirebaseContext, FirebaseContext } from './factory';
2
4
  export * from './services/index';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAG/B,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnE,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createFirebaseContext = void 0;
17
18
  require("./module-alias-config");
19
+ // Config types for app-level configuration
20
+ __exportStar(require("./config"), exports);
21
+ // Factory function to create the Firebase context
22
+ var factory_1 = require("./factory");
23
+ Object.defineProperty(exports, "createFirebaseContext", { enumerable: true, get: function () { return factory_1.createFirebaseContext; } });
24
+ // Service exports
18
25
  __exportStar(require("./services/index"), exports);
@@ -1,11 +1,12 @@
1
+ import { FirebaseContext } from "../../../factory";
1
2
  type AndroidPayload = {
2
3
  fcmToken: string;
3
4
  title: string;
4
5
  body?: string;
5
6
  channelId?: string;
6
7
  image?: string;
7
- data?: Record<string, any>;
8
+ data?: Record<string, unknown>;
8
9
  };
9
- export declare function sendFirebaseNotificationBatchAndroid(tokens: string[], payload: Omit<AndroidPayload, 'fcmToken'>): Promise<any[]>;
10
+ export declare function sendFirebaseNotificationBatchAndroid(ctx: FirebaseContext, tokens: string[], payload: Omit<AndroidPayload, 'fcmToken'>): Promise<unknown[]>;
10
11
  export {};
11
12
  //# sourceMappingURL=firebaseNotificationAndroid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseNotificationAndroid.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationAndroid.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,oCAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,kBA+BrH"}
1
+ {"version":3,"file":"firebaseNotificationAndroid.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationAndroid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,oCAAoC,CACxD,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,sBAgC1C"}
@@ -11,11 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sendFirebaseNotificationBatchAndroid = sendFirebaseNotificationBatchAndroid;
13
13
  const podverse_helpers_1 = require("podverse-helpers");
14
- const web_1 = require("@external-services/config/web");
15
- const firebaseAdmin_1 = require("./firebaseAdmin");
16
- function sendFirebaseNotificationBatchAndroid(tokens, payload) {
14
+ function sendFirebaseNotificationBatchAndroid(ctx, tokens, payload) {
17
15
  return __awaiter(this, void 0, void 0, function* () {
18
- if (!firebaseAdmin_1.firebaseAdmin)
16
+ if (!ctx.firebaseAdmin)
19
17
  throw new Error("Firebase Admin is not initialized");
20
18
  const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
21
19
  const results = [];
@@ -28,13 +26,13 @@ function sendFirebaseNotificationBatchAndroid(tokens, payload) {
28
26
  title: payload.title,
29
27
  body: payload.body,
30
28
  channelId: payload.channelId || "default",
31
- image: payload.image || (0, web_1.getWebIconImageUrl)(),
29
+ image: payload.image || ctx.getWebIconImageUrl(),
32
30
  },
33
31
  },
34
32
  data: (0, podverse_helpers_1.stringifyData)(payload.data),
35
33
  };
36
34
  try {
37
- const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
35
+ const resp = yield ctx.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
38
36
  results.push(resp);
39
37
  }
40
38
  catch (err) {
@@ -1,3 +1,4 @@
1
+ import { FirebaseContext } from "../../../factory";
1
2
  type IOSPayload = {
2
3
  fcmToken: string;
3
4
  title: string;
@@ -5,8 +6,8 @@ type IOSPayload = {
5
6
  badge?: number;
6
7
  sound?: string;
7
8
  image?: string;
8
- data?: Record<string, any>;
9
+ data?: Record<string, unknown>;
9
10
  };
10
- export declare function sendFirebaseNotificationBatchIOS(tokens: string[], payload: Omit<IOSPayload, 'fcmToken'>): Promise<any[]>;
11
+ export declare function sendFirebaseNotificationBatchIOS(ctx: FirebaseContext, tokens: string[], payload: Omit<IOSPayload, 'fcmToken'>): Promise<unknown[]>;
11
12
  export {};
12
13
  //# sourceMappingURL=firebaseNotificationIOS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseNotificationIOS.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationIOS.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,kBAmC7G"}
1
+ {"version":3,"file":"firebaseNotificationIOS.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationIOS.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,sBAqCtC"}
@@ -11,11 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sendFirebaseNotificationBatchIOS = sendFirebaseNotificationBatchIOS;
13
13
  const podverse_helpers_1 = require("podverse-helpers");
14
- const web_1 = require("@external-services/config/web");
15
- const firebaseAdmin_1 = require("./firebaseAdmin");
16
- function sendFirebaseNotificationBatchIOS(tokens, payload) {
14
+ function sendFirebaseNotificationBatchIOS(ctx, tokens, payload) {
17
15
  return __awaiter(this, void 0, void 0, function* () {
18
- if (!firebaseAdmin_1.firebaseAdmin)
16
+ if (!ctx.firebaseAdmin)
19
17
  throw new Error("Firebase Admin is not initialized");
20
18
  const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
21
19
  const results = [];
@@ -29,12 +27,13 @@ function sendFirebaseNotificationBatchIOS(tokens, payload) {
29
27
  badge: payload.badge,
30
28
  sound: payload.sound || "default",
31
29
  "mutable-content": 1,
32
- } }, (payload.data || {})), { image: payload.image || (0, web_1.getWebIconImageUrl)() }),
30
+ } }, (payload.data || {})), { image: payload.image || ctx.getWebIconImageUrl() }),
33
31
  },
34
32
  data: (0, podverse_helpers_1.stringifyData)(payload.data),
35
33
  };
36
34
  try {
37
- const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ const resp = yield ctx.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
38
37
  results.push(resp);
39
38
  }
40
39
  catch (err) {
@@ -1,3 +1,4 @@
1
+ import { FirebaseContext } from '../../../factory';
1
2
  type NotificationPlatform = 'web' | 'android' | 'ios';
2
3
  type OrchestratorParams = {
3
4
  tokens: string[];
@@ -9,8 +10,8 @@ type OrchestratorParams = {
9
10
  channelId?: string;
10
11
  badge?: number;
11
12
  sound?: string;
12
- data?: Record<string, any>;
13
+ data?: Record<string, unknown>;
13
14
  };
14
- export declare function firebaseNotificationBatchOrchestrator(params: OrchestratorParams): Promise<any[]>;
15
+ export declare function firebaseNotificationBatchOrchestrator(ctx: FirebaseContext, params: OrchestratorParams): Promise<unknown[]>;
15
16
  export {};
16
17
  //# sourceMappingURL=firebaseNotificationOrchestrator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationOrchestrator.ts"],"names":[],"mappings":"AAIA,KAAK,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAEtD,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,oBAAoB,CAAC;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,qCAAqC,CAAC,MAAM,EAAE,kBAAkB,kBAyCrF"}
1
+ {"version":3,"file":"firebaseNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKnD,KAAK,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAEtD,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,oBAAoB,CAAC;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,qCAAqC,CACzD,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,kBAAkB,sBA0C3B"}
@@ -13,7 +13,7 @@ exports.firebaseNotificationBatchOrchestrator = firebaseNotificationBatchOrchest
13
13
  const firebaseNotificationWeb_1 = require("./firebaseNotificationWeb");
14
14
  const firebaseNotificationAndroid_1 = require("./firebaseNotificationAndroid");
15
15
  const firebaseNotificationIOS_1 = require("./firebaseNotificationIOS");
16
- function firebaseNotificationBatchOrchestrator(params) {
16
+ function firebaseNotificationBatchOrchestrator(ctx, params) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  const { tokens, finalText, platform } = params;
19
19
  switch (platform) {
@@ -25,7 +25,7 @@ function firebaseNotificationBatchOrchestrator(params) {
25
25
  link: params.link,
26
26
  data: params.data,
27
27
  };
28
- return yield (0, firebaseNotificationWeb_1.sendFirebaseNotificationBatchWeb)(tokens, payload);
28
+ return yield (0, firebaseNotificationWeb_1.sendFirebaseNotificationBatchWeb)(ctx, tokens, payload);
29
29
  }
30
30
  case 'android': {
31
31
  const payload = {
@@ -35,7 +35,7 @@ function firebaseNotificationBatchOrchestrator(params) {
35
35
  channelId: params.channelId,
36
36
  data: params.data,
37
37
  };
38
- return yield (0, firebaseNotificationAndroid_1.sendFirebaseNotificationBatchAndroid)(tokens, payload);
38
+ return yield (0, firebaseNotificationAndroid_1.sendFirebaseNotificationBatchAndroid)(ctx, tokens, payload);
39
39
  }
40
40
  case 'ios': {
41
41
  const payload = {
@@ -46,7 +46,7 @@ function firebaseNotificationBatchOrchestrator(params) {
46
46
  sound: params.sound,
47
47
  data: params.data,
48
48
  };
49
- return yield (0, firebaseNotificationIOS_1.sendFirebaseNotificationBatchIOS)(tokens, payload);
49
+ return yield (0, firebaseNotificationIOS_1.sendFirebaseNotificationBatchIOS)(ctx, tokens, payload);
50
50
  }
51
51
  default:
52
52
  throw new Error(`Unsupported platform: ${platform}`);
@@ -1,3 +1,4 @@
1
+ import { FirebaseContext } from "../../../factory";
1
2
  type NotificationPayload = {
2
3
  fcmToken: string;
3
4
  title: string;
@@ -6,6 +7,6 @@ type NotificationPayload = {
6
7
  link?: string;
7
8
  data?: Record<string, string>;
8
9
  };
9
- export declare function sendFirebaseNotificationBatchWeb(tokens: string[], payload: Omit<NotificationPayload, 'fcmToken'>): Promise<any[]>;
10
+ export declare function sendFirebaseNotificationBatchWeb(ctx: FirebaseContext, tokens: string[], payload: Omit<NotificationPayload, 'fcmToken'>): Promise<unknown[]>;
10
11
  export {};
11
12
  //# sourceMappingURL=firebaseNotificationWeb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseNotificationWeb.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationWeb.ts"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,wBAAsB,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,kBA8CtH"}
1
+ {"version":3,"file":"firebaseNotificationWeb.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationWeb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,sBA+C/C"}
@@ -11,11 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sendFirebaseNotificationBatchWeb = sendFirebaseNotificationBatchWeb;
13
13
  const podverse_helpers_1 = require("podverse-helpers");
14
- const web_1 = require("@external-services/config/web");
15
- const firebaseAdmin_1 = require("./firebaseAdmin");
16
- function sendFirebaseNotificationBatchWeb(tokens, payload) {
14
+ function sendFirebaseNotificationBatchWeb(ctx, tokens, payload) {
17
15
  return __awaiter(this, void 0, void 0, function* () {
18
- if (!firebaseAdmin_1.firebaseAdmin)
16
+ if (!ctx.firebaseAdmin)
19
17
  throw new Error("Firebase Admin is not initialized");
20
18
  const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
21
19
  const results = [];
@@ -23,8 +21,8 @@ function sendFirebaseNotificationBatchWeb(tokens, payload) {
23
21
  const data = {
24
22
  title: payload.title,
25
23
  body: payload.body || "",
26
- icon: (0, web_1.getWebIconImageUrl)(), // Always use app icon for branding
27
- link: payload.link ? (0, web_1.getWebBaseUrlWithPath)(payload.link) : (0, web_1.getWebBaseUrl)(),
24
+ icon: ctx.getWebIconImageUrl(), // Always use app icon for branding
25
+ link: payload.link ? ctx.getWebBaseUrlWithPath(payload.link) : ctx.getWebBaseUrl(),
28
26
  };
29
27
  // Only add image if it has a value (FCM data values must be strings, not undefined)
30
28
  if (payload.image) {
@@ -46,7 +44,7 @@ function sendFirebaseNotificationBatchWeb(tokens, payload) {
46
44
  },
47
45
  };
48
46
  try {
49
- const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
47
+ const resp = yield ctx.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
50
48
  results.push(resp);
51
49
  }
52
50
  catch (err) {
@@ -1,4 +1,3 @@
1
- export { firebaseAdmin } from './firebaseAdmin';
2
1
  export { firebaseNotificationBatchOrchestrator } from './firebaseNotificationOrchestrator';
3
2
  export { sendFirebaseNotificationBatchWeb } from './firebaseNotificationWeb';
4
3
  export { sendFirebaseNotificationBatchAndroid } from './firebaseNotificationAndroid';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendFirebaseNotificationBatchIOS = exports.sendFirebaseNotificationBatchAndroid = exports.sendFirebaseNotificationBatchWeb = exports.firebaseNotificationBatchOrchestrator = exports.firebaseAdmin = void 0;
4
- var firebaseAdmin_1 = require("./firebaseAdmin");
5
- Object.defineProperty(exports, "firebaseAdmin", { enumerable: true, get: function () { return firebaseAdmin_1.firebaseAdmin; } });
3
+ exports.sendFirebaseNotificationBatchIOS = exports.sendFirebaseNotificationBatchAndroid = exports.sendFirebaseNotificationBatchWeb = exports.firebaseNotificationBatchOrchestrator = void 0;
6
4
  var firebaseNotificationOrchestrator_1 = require("./firebaseNotificationOrchestrator");
7
5
  Object.defineProperty(exports, "firebaseNotificationBatchOrchestrator", { enumerable: true, get: function () { return firebaseNotificationOrchestrator_1.firebaseNotificationBatchOrchestrator; } });
8
6
  var firebaseNotificationWeb_1 = require("./firebaseNotificationWeb");
@@ -22,6 +22,8 @@ export declare class PodcastIndexService {
22
22
  id_to_archive: number;
23
23
  duplicate_id_to_keep: number | null;
24
24
  };
25
+ private readonly TEST_PODCAST_INDEX_ID_MIN;
26
+ private getMockTestFeed;
25
27
  podcastGetById: (podcast_index_id: number) => Promise<any | null>;
26
28
  podcastGetByGuid: (podcastGuid: string, delayMs?: number) => Promise<PodcastByGuidResponse | null>;
27
29
  podcastsByMedium: (medium: string, max?: number) => Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,kCAAkC,EAC9E,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MA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;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAoB/C;IAID,gBAAgB,GAAU,MAAM,MAAM,EAAE,eAAe,4BAA4B,KAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA6B1H;IAID,oBAAoB,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAMjD;IAED,+BAA+B,GAC7B,4BAA4B,MAAM,EAAE,EAAE,gBAAW,KAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAatE;CACF"}
@@ -99,7 +99,17 @@ class PodcastIndexService {
99
99
  };
100
100
  };
101
101
  // Podcast
102
+ // Test podcast_index_id range (only active in non-production)
103
+ this.TEST_PODCAST_INDEX_ID_MIN = 2147483640;
102
104
  this.podcastGetById = (podcast_index_id) => __awaiter(this, void 0, void 0, function* () {
105
+ // Check if this is a test podcast_index_id (only in non-production)
106
+ if (process.env.NODE_ENV !== 'production' && podcast_index_id >= this.TEST_PODCAST_INDEX_ID_MIN) {
107
+ const mockFeed = this.getMockTestFeed(podcast_index_id);
108
+ if (mockFeed) {
109
+ this.loggerService.info(`[PodcastIndex] Returning mock data for test podcast_index_id: ${podcast_index_id}`);
110
+ return mockFeed;
111
+ }
112
+ }
103
113
  const url = `${this.baseUrl}/podcasts/byfeedid?id=${podcast_index_id}`;
104
114
  try {
105
115
  const response = yield this.podcastIndexAPIRequest(url);
@@ -110,6 +120,18 @@ class PodcastIndexService {
110
120
  }
111
121
  });
112
122
  this.podcastGetByGuid = (podcastGuid, delayMs) => __awaiter(this, void 0, void 0, function* () {
123
+ // Check if this is a test feed URL (only in non-production)
124
+ if (process.env.NODE_ENV !== 'production') {
125
+ if (podcastGuid.includes('/test-assets/feed-1.rss')) {
126
+ return this.getMockTestFeed(2147483640);
127
+ }
128
+ else if (podcastGuid.includes('/test-assets/feed-2.rss')) {
129
+ return this.getMockTestFeed(2147483641);
130
+ }
131
+ else if (podcastGuid.includes('/test-assets/feed-3.rss')) {
132
+ return this.getMockTestFeed(2147483642);
133
+ }
134
+ }
113
135
  const url = `${this.baseUrl}/podcasts/byguid?guid=${podcastGuid}`;
114
136
  let podcastIndexPodcast = null;
115
137
  try {
@@ -267,5 +289,82 @@ class PodcastIndexService {
267
289
  this.secretKey = secretKey;
268
290
  this.loggerService = loggerService;
269
291
  }
292
+ getMockTestFeed(podcast_index_id) {
293
+ // Only return mock data in non-production environments
294
+ if (process.env.NODE_ENV === 'production') {
295
+ return null;
296
+ }
297
+ // Determine which test feed based on podcast_index_id
298
+ let channelId;
299
+ let channelTitle;
300
+ let medium;
301
+ let feedUrl;
302
+ if (podcast_index_id === 2147483640) {
303
+ // Feed 1 - Podcast
304
+ channelId = 'lhtest-chan-1';
305
+ channelTitle = 'Lighthouse Test Podcast';
306
+ medium = 'podcast';
307
+ feedUrl = 'http://localhost:3000/test-assets/feed-1.rss';
308
+ }
309
+ else if (podcast_index_id === 2147483641) {
310
+ // Feed 2 - Video
311
+ channelId = 'lhtest-chan-2';
312
+ channelTitle = 'Lighthouse Test Video';
313
+ medium = 'video';
314
+ feedUrl = 'http://localhost:3000/test-assets/feed-2.rss';
315
+ }
316
+ else if (podcast_index_id === 2147483642) {
317
+ // Feed 3 - Music
318
+ channelId = 'lhtest-chan-3';
319
+ channelTitle = 'Lighthouse Test Music';
320
+ medium = 'music';
321
+ feedUrl = 'http://localhost:3000/test-assets/feed-3.rss';
322
+ }
323
+ else {
324
+ return null;
325
+ }
326
+ // Return mock Podcast Index API response structure
327
+ return {
328
+ status: 'true',
329
+ query: {
330
+ id: podcast_index_id.toString()
331
+ },
332
+ feed: {
333
+ id: podcast_index_id,
334
+ podcastGuid: `test-guid-${podcast_index_id}`,
335
+ title: channelTitle,
336
+ url: feedUrl,
337
+ originalUrl: feedUrl,
338
+ link: feedUrl,
339
+ description: `Test feed for Lighthouse performance testing (${channelTitle})`,
340
+ author: 'Podverse',
341
+ ownerName: 'Podverse',
342
+ image: `http://localhost:3000/test-assets/chan-${podcast_index_id - 2147483639}-image.jpg`,
343
+ artwork: `http://localhost:3000/test-assets/chan-${podcast_index_id - 2147483639}-image.jpg`,
344
+ lastUpdateTime: Math.floor(Date.now() / 1000),
345
+ lastCrawlTime: Math.floor(Date.now() / 1000),
346
+ lastParseTime: Math.floor(Date.now() / 1000),
347
+ lastGoodHttpStatusTime: Math.floor(Date.now() / 1000),
348
+ lastHttpStatus: 200,
349
+ contentType: 'application/rss+xml',
350
+ itunesId: null,
351
+ itunesType: 'episodic',
352
+ generator: 'Podverse Test',
353
+ language: 'en',
354
+ explicit: false,
355
+ type: 0,
356
+ medium: medium,
357
+ dead: 0,
358
+ chash: '',
359
+ episodeCount: 1,
360
+ crawlErrors: 0,
361
+ parseErrors: 0,
362
+ categories: {},
363
+ locked: 0,
364
+ imageUrlHash: 0
365
+ },
366
+ description: `Mock Podcast Index API response for test feed ${podcast_index_id}`
367
+ };
368
+ }
270
369
  }
271
370
  exports.PodcastIndexService = PodcastIndexService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-external-services",
3
- "version": "5.1.26-alpha.0",
3
+ "version": "5.1.27-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,9 +35,9 @@
35
35
  "eslint": "^9.35.0",
36
36
  "nodemon": "^3.1.10",
37
37
  "typescript": "^5.9.2",
38
- "podverse-helpers": "5.1.26-alpha.0"
38
+ "podverse-helpers": "5.1.27-alpha.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "podverse-helpers": "5.1.26-alpha.0"
41
+ "podverse-helpers": "5.1.27-alpha.0"
42
42
  }
43
43
  }
@@ -1,4 +0,0 @@
1
- export declare const getWebBaseUrl: () => string;
2
- export declare const getWebBaseUrlWithPath: (path: string) => string;
3
- export declare const getWebIconImageUrl: () => string;
4
- //# sourceMappingURL=web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/config/web.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,QAAO,MAEhC,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,MAGpD,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAO,MAErC,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWebIconImageUrl = exports.getWebBaseUrlWithPath = exports.getWebBaseUrl = void 0;
4
- const index_1 = require("./index");
5
- const getWebBaseUrl = () => {
6
- return `${index_1.config.web.protocol}://${index_1.config.web.host}`;
7
- };
8
- exports.getWebBaseUrl = getWebBaseUrl;
9
- const getWebBaseUrlWithPath = (path) => {
10
- const baseUrl = (0, exports.getWebBaseUrl)();
11
- return `${baseUrl}${path}`;
12
- };
13
- exports.getWebBaseUrlWithPath = getWebBaseUrlWithPath;
14
- const getWebIconImageUrl = () => {
15
- return `${(0, exports.getWebBaseUrl)()}/${index_1.config.web.icon_image_url}`;
16
- };
17
- exports.getWebIconImageUrl = getWebIconImageUrl;
@@ -1,3 +0,0 @@
1
- import admin from "firebase-admin";
2
- export declare const firebaseAdmin: typeof admin | null;
3
- //# sourceMappingURL=firebaseAdmin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebaseAdmin.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AA6BnC,eAAO,MAAM,aAAa,qBAAqB,CAAC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.firebaseAdmin = void 0;
7
- const firebase_admin_1 = __importDefault(require("firebase-admin"));
8
- const config_1 = require("../../../config");
9
- let firebaseAdminLocal = null;
10
- if (!config_1.config.google.firebase.notifications_enabled) {
11
- console.warn("Firebase notifications are disabled in the configuration.");
12
- }
13
- else {
14
- console.log("Firebase notifications are enabled in the configuration.");
15
- try {
16
- const settings = require(config_1.config.google.firebase.admin_json_key_path);
17
- const serviceAccount = settings;
18
- if (!firebase_admin_1.default.apps.length) {
19
- firebase_admin_1.default.initializeApp({
20
- credential: firebase_admin_1.default.credential.cert(serviceAccount),
21
- });
22
- console.log("Firebase Admin Initialized Successfully");
23
- }
24
- firebaseAdminLocal = firebase_admin_1.default;
25
- }
26
- catch (error) {
27
- console.error("Firebase Admin Initialization Failed:", error);
28
- firebaseAdminLocal = null;
29
- }
30
- }
31
- exports.firebaseAdmin = firebaseAdminLocal;