podverse-external-services 5.1.19-alpha.0 → 5.1.21-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.
@@ -3,7 +3,8 @@ type OrchestratorParams = {
3
3
  tokens: string[];
4
4
  finalText: string;
5
5
  platform: NotificationPlatform;
6
- icon?: string;
6
+ body?: string;
7
+ image?: string;
7
8
  link?: string;
8
9
  channelId?: string;
9
10
  badge?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationOrchestrator.ts"],"names":[],"mappings":"AAKA,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,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,kBAuCrF"}
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"}
@@ -20,8 +20,8 @@ function firebaseNotificationBatchOrchestrator(params) {
20
20
  case 'web': {
21
21
  const payload = {
22
22
  title: finalText,
23
- body: '',
24
- icon: params.icon,
23
+ body: params.body,
24
+ image: params.image,
25
25
  link: params.link,
26
26
  data: params.data,
27
27
  };
@@ -30,7 +30,8 @@ function firebaseNotificationBatchOrchestrator(params) {
30
30
  case 'android': {
31
31
  const payload = {
32
32
  title: finalText,
33
- body: '',
33
+ body: params.body,
34
+ image: params.image,
34
35
  channelId: params.channelId,
35
36
  data: params.data,
36
37
  };
@@ -39,7 +40,8 @@ function firebaseNotificationBatchOrchestrator(params) {
39
40
  case 'ios': {
40
41
  const payload = {
41
42
  title: finalText,
42
- body: '',
43
+ body: params.body,
44
+ image: params.image,
43
45
  badge: params.badge,
44
46
  sound: params.sound,
45
47
  data: params.data,
@@ -2,7 +2,6 @@ type NotificationPayload = {
2
2
  fcmToken: string;
3
3
  title: string;
4
4
  body?: string;
5
- icon?: string;
6
5
  image?: string;
7
6
  link?: string;
8
7
  data?: Record<string, string>;
@@ -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,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":"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"}
@@ -23,7 +23,7 @@ function sendFirebaseNotificationBatchWeb(tokens, payload) {
23
23
  const data = {
24
24
  title: payload.title,
25
25
  body: payload.body || "",
26
- icon: payload.icon || (0, web_1.getWebIconImageUrl)(),
26
+ icon: (0, web_1.getWebIconImageUrl)(), // Always use app icon for branding
27
27
  link: payload.link ? (0, web_1.getWebBaseUrlWithPath)(payload.link) : (0, web_1.getWebBaseUrl)(),
28
28
  };
29
29
  // Only add image if it has a value (FCM data values must be strings, not undefined)
@@ -3,5 +3,4 @@ export { firebaseNotificationBatchOrchestrator } from './firebaseNotificationOrc
3
3
  export { sendFirebaseNotificationBatchWeb } from './firebaseNotificationWeb';
4
4
  export { sendFirebaseNotificationBatchAndroid } from './firebaseNotificationAndroid';
5
5
  export { sendFirebaseNotificationBatchIOS } from './firebaseNotificationIOS';
6
- export { sendFirebaseNotificationBatchGeneric } from './firebaseNotificationGeneric';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC"}
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendFirebaseNotificationBatchGeneric = exports.sendFirebaseNotificationBatchIOS = exports.sendFirebaseNotificationBatchAndroid = exports.sendFirebaseNotificationBatchWeb = exports.firebaseNotificationBatchOrchestrator = exports.firebaseAdmin = void 0;
3
+ exports.sendFirebaseNotificationBatchIOS = exports.sendFirebaseNotificationBatchAndroid = exports.sendFirebaseNotificationBatchWeb = exports.firebaseNotificationBatchOrchestrator = exports.firebaseAdmin = void 0;
4
4
  var firebaseAdmin_1 = require("./firebaseAdmin");
5
5
  Object.defineProperty(exports, "firebaseAdmin", { enumerable: true, get: function () { return firebaseAdmin_1.firebaseAdmin; } });
6
6
  var firebaseNotificationOrchestrator_1 = require("./firebaseNotificationOrchestrator");
@@ -11,5 +11,3 @@ var firebaseNotificationAndroid_1 = require("./firebaseNotificationAndroid");
11
11
  Object.defineProperty(exports, "sendFirebaseNotificationBatchAndroid", { enumerable: true, get: function () { return firebaseNotificationAndroid_1.sendFirebaseNotificationBatchAndroid; } });
12
12
  var firebaseNotificationIOS_1 = require("./firebaseNotificationIOS");
13
13
  Object.defineProperty(exports, "sendFirebaseNotificationBatchIOS", { enumerable: true, get: function () { return firebaseNotificationIOS_1.sendFirebaseNotificationBatchIOS; } });
14
- var firebaseNotificationGeneric_1 = require("./firebaseNotificationGeneric");
15
- Object.defineProperty(exports, "sendFirebaseNotificationBatchGeneric", { enumerable: true, get: function () { return firebaseNotificationGeneric_1.sendFirebaseNotificationBatchGeneric; } });
@@ -29,7 +29,7 @@ class PodcastIndexService {
29
29
  constructor({ userAgent, authKey, baseUrl, secretKey, loggerService }) {
30
30
  // Request handler
31
31
  this.podcastIndexAPIRequest = (url, config) => __awaiter(this, void 0, void 0, function* () {
32
- var _a, _b, _c;
32
+ var _a, _b;
33
33
  const apiHeaderTime = Math.floor(Date.now() / 1000);
34
34
  const hash = (0, sha1_1.default)(this.authKey + this.secretKey + apiHeaderTime).toString(enc_hex_1.default);
35
35
  try {
@@ -42,14 +42,14 @@ class PodcastIndexService {
42
42
  return response === null || response === void 0 ? void 0 : response.data;
43
43
  }
44
44
  catch (error) {
45
- this.loggerService.logError('[PodcastIndex] Request failed', {
45
+ const errorDetails = {
46
46
  url,
47
47
  errorMessage: error === null || error === void 0 ? void 0 : error.message,
48
48
  errorStack: error === null || error === void 0 ? void 0 : error.stack,
49
49
  errorResponse: (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data,
50
- errorStatus: (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status,
51
- errorHeaders: (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.headers
52
- });
50
+ errorStatus: (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status
51
+ };
52
+ this.loggerService.logError(`[PodcastIndex] Request failed: ${JSON.stringify(errorDetails, null, 2)}`);
53
53
  throw error;
54
54
  }
55
55
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-external-services",
3
- "version": "5.1.19-alpha.0",
3
+ "version": "5.1.21-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.19-alpha.0"
38
+ "podverse-helpers": "5.1.21-alpha.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "podverse-helpers": "5.1.19-alpha.0"
41
+ "podverse-helpers": "5.1.21-alpha.0"
42
42
  }
43
43
  }
@@ -1,15 +0,0 @@
1
- type GenericPayload = {
2
- fcmToken: string;
3
- title: string;
4
- body?: string;
5
- icon?: string;
6
- image?: string;
7
- link?: string;
8
- badge?: number;
9
- channelId?: string;
10
- sound?: string;
11
- data?: Record<string, any>;
12
- };
13
- export declare function sendFirebaseNotificationBatchGeneric(tokens: string[], payload: Omit<GenericPayload, 'fcmToken'>): Promise<any[]>;
14
- export {};
15
- //# sourceMappingURL=firebaseNotificationGeneric.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebaseNotificationGeneric.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationGeneric.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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,kBAuDrH"}
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.sendFirebaseNotificationBatchGeneric = sendFirebaseNotificationBatchGeneric;
13
- const podverse_helpers_1 = require("podverse-helpers");
14
- const firebaseAdmin_1 = require("./firebaseAdmin");
15
- const web_1 = require("@external-services/config/web");
16
- function sendFirebaseNotificationBatchGeneric(tokens, payload) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- if (!firebaseAdmin_1.firebaseAdmin)
19
- throw new Error("Firebase Admin is not initialized");
20
- const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
21
- const results = [];
22
- for (const chunk of chunks) {
23
- const multicastMessage = {
24
- tokens: chunk,
25
- webpush: {
26
- headers: { Urgency: "normal" },
27
- data: Object.assign({ title: payload.title, body: payload.body || "", icon: payload.icon || (0, web_1.getWebIconImageUrl)(), image: payload.image || undefined, link: payload.link ? (0, web_1.getWebBaseUrlWithPath)(payload.link) : (0, web_1.getWebBaseUrl)() }, (0, podverse_helpers_1.stringifyData)(payload.data)),
28
- },
29
- android: {
30
- priority: "high",
31
- notification: {
32
- title: payload.title,
33
- body: payload.body,
34
- channelId: payload.channelId || "default",
35
- image: payload.image || (0, web_1.getWebIconImageUrl)(),
36
- },
37
- },
38
- apns: {
39
- headers: { "apns-priority": "10" },
40
- payload: Object.assign(Object.assign({ aps: {
41
- alert: { title: payload.title, body: payload.body },
42
- badge: payload.badge,
43
- sound: payload.sound || "default",
44
- "mutable-content": 1,
45
- } }, (payload.data || {})), { image: payload.image || (0, web_1.getWebIconImageUrl)() }),
46
- },
47
- data: (0, podverse_helpers_1.stringifyData)(payload.data),
48
- };
49
- try {
50
- const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
51
- results.push(resp);
52
- }
53
- catch (err) {
54
- console.error("sendFirebaseNotificationBatchGeneric chunk error:", err);
55
- throw err;
56
- }
57
- }
58
- return results;
59
- });
60
- }