podverse-external-services 5.1.1-alpha.9 → 5.1.3-alpha.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.
Files changed (39) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +0 -1
  4. package/dist/services/google/fcm.d.ts +11 -3
  5. package/dist/services/google/fcm.d.ts.map +1 -1
  6. package/dist/services/google/fcm.js +14 -8
  7. package/dist/services/google/firebaseAccessTokenService.d.ts +9 -0
  8. package/dist/services/google/firebaseAccessTokenService.d.ts.map +1 -0
  9. package/dist/services/google/{firebaseGenerateAccessToken.js → firebaseAccessTokenService.js} +21 -16
  10. package/dist/services/index.d.ts +1 -1
  11. package/dist/services/index.d.ts.map +1 -1
  12. package/dist/services/index.js +3 -3
  13. package/dist/services/notifications/index.d.ts +5 -1
  14. package/dist/services/notifications/index.d.ts.map +1 -1
  15. package/dist/services/notifications/index.js +5 -3
  16. package/dist/services/paypal/index.d.ts +9 -1
  17. package/dist/services/paypal/index.d.ts.map +1 -1
  18. package/dist/services/paypal/index.js +11 -7
  19. package/dist/services/podcast-index/index.d.ts +22 -3
  20. package/dist/services/podcast-index/index.d.ts.map +1 -1
  21. package/dist/services/podcast-index/index.js +75 -23
  22. package/package.json +15 -15
  23. package/dist/config/index.d.ts +0 -15
  24. package/dist/config/index.d.ts.map +0 -1
  25. package/dist/config/index.js +0 -17
  26. package/dist/services/google/firebaseGenerateAccessToken.d.ts +0 -2
  27. package/dist/services/google/firebaseGenerateAccessToken.d.ts.map +0 -1
  28. package/dist/services/podcast-index/types/podcastByGuid.d.ts +0 -73
  29. package/dist/services/podcast-index/types/podcastByGuid.d.ts.map +0 -1
  30. package/dist/services/podcast-index/types/podcastByGuid.js +0 -2
  31. package/dist/services/podcast-index/types/podcastsByTag.d.ts +0 -68
  32. package/dist/services/podcast-index/types/podcastsByTag.d.ts.map +0 -1
  33. package/dist/services/podcast-index/types/podcastsByTag.js +0 -2
  34. package/dist/services/podcast-index/types/valueBatchByEpisodeGuid.d.ts +0 -37
  35. package/dist/services/podcast-index/types/valueBatchByEpisodeGuid.d.ts.map +0 -1
  36. package/dist/services/podcast-index/types/valueBatchByEpisodeGuid.js +0 -2
  37. package/dist/services/podcast-index/types/valueByEpisodeGuid.d.ts +0 -32
  38. package/dist/services/podcast-index/types/valueByEpisodeGuid.d.ts.map +0 -1
  39. package/dist/services/podcast-index/types/valueByEpisodeGuid.js +0 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import './module-alias-config';
2
- export * from './config';
3
2
  export * from './services/index';
4
3
  //# 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,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,cAAc,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  require("./module-alias-config");
18
- __exportStar(require("./config"), exports);
19
18
  __exportStar(require("./services/index"), exports);
@@ -1,10 +1,18 @@
1
+ import { LoggerService } from 'podverse-helpers/dist/lib/backend/logger';
1
2
  import { SendNotificationOptions } from '@external-services/services/notifications';
2
- type Constructor = {
3
+ type GoogleFCMServiceParams = {
4
+ userAgent: string;
3
5
  authToken: string;
6
+ firebaseProjectId: string;
7
+ loggerService: LoggerService;
4
8
  };
5
9
  export declare class GoogleFCMService {
6
- authToken: string;
7
- constructor({ authToken }: Constructor);
10
+ private userAgent;
11
+ private authToken;
12
+ private firebaseProjectId;
13
+ private loggerService;
14
+ constructor({ userAgent, authToken, firebaseProjectId, loggerService }: GoogleFCMServiceParams);
15
+ private getFcmGoogleApiPath;
8
16
  sendFcmNewItemDetectedNotification: (account_fcm_tokens: string[], options: SendNotificationOptions) => Promise<void>;
9
17
  sendFcmLiveItemLiveDetectedNotification: (account_fcm_tokens: string[], options: SendNotificationOptions) => Promise<void>;
10
18
  sendFCMGoogleApiNotification: (fcmTokens: string[], title: string, body: string, channelIdText: string, notificationType: "live" | "new-item", channelTitle: string, itemTitle: string, channelImage?: string | null, itemImage?: string | null, itemIdText?: string) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"fcm.d.ts","sourceRoot":"","sources":["../../../src/services/google/fcm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAIpF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,gBAAgB;IACnB,SAAS,EAAE,MAAM,CAAA;gBAEZ,EAAE,SAAS,EAAE,EAAE,WAAW;IAIvC,kCAAkC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,mBAsBzG;IAED,uCAAuC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,mBAsB9G;IAED,4BAA4B,GAC1B,WAAW,MAAM,EAAE,EACnB,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,eAAe,MAAM,EACrB,kBAAkB,MAAM,GAAG,UAAU,EACrC,cAAc,MAAM,EACpB,WAAW,MAAM,EACjB,eAAe,MAAM,GAAG,IAAI,EAC5B,YAAY,MAAM,GAAG,IAAI,EACzB,aAAa,MAAM,mBAoEpB;CACF"}
1
+ {"version":3,"file":"fcm.d.ts","sourceRoot":"","sources":["../../../src/services/google/fcm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,sBAAsB;IAO9F,OAAO,CAAC,mBAAmB;IAI3B,kCAAkC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,mBAsBxG;IAEF,uCAAuC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,mBAsB7G;IAEF,4BAA4B,GAC1B,WAAW,MAAM,EAAE,EACnB,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,eAAe,MAAM,EACrB,kBAAkB,MAAM,GAAG,UAAU,EACrC,cAAc,MAAM,EACpB,WAAW,MAAM,EACjB,eAAe,MAAM,GAAG,IAAI,EAC5B,YAAY,MAAM,GAAG,IAAI,EACzB,aAAa,MAAM,mBAuEnB;CACH"}
@@ -11,27 +11,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GoogleFCMService = void 0;
13
13
  const podverse_helpers_1 = require("podverse-helpers");
14
- const config_1 = require("@external-services/config");
15
- const fcmGoogleApiPath = `https://fcm.googleapis.com/v1/projects/${config_1.config.google.firebase.projectId}/messages:send`;
16
14
  class GoogleFCMService {
17
- constructor({ authToken }) {
15
+ constructor({ userAgent, authToken, firebaseProjectId, loggerService }) {
18
16
  this.sendFcmNewItemDetectedNotification = (account_fcm_tokens, options) => __awaiter(this, void 0, void 0, function* () {
19
- const { channelIdText, /* podcastShrunkImageUrl, */ channelFullImageUrl, itemFullImageUrl, itemIdText } = options;
17
+ const { channelIdText, channelFullImageUrl, itemFullImageUrl, itemIdText } = options;
20
18
  const channelTitle = options.channelTitle || 'Untitled';
21
19
  const itemTitle = options.itemTitle || 'Untitled';
22
20
  const title = channelTitle;
23
21
  const body = itemTitle;
24
- const finalPodcastImageUrl = /* podcastShrunkImageUrl || */ channelFullImageUrl;
22
+ const finalPodcastImageUrl = channelFullImageUrl;
25
23
  const finalEpisodeImageUrl = itemFullImageUrl;
26
24
  return this.sendFCMGoogleApiNotification(account_fcm_tokens, title, body, channelIdText, 'new-item', channelTitle, itemTitle, finalPodcastImageUrl, finalEpisodeImageUrl, itemIdText);
27
25
  });
28
26
  this.sendFcmLiveItemLiveDetectedNotification = (account_fcm_tokens, options) => __awaiter(this, void 0, void 0, function* () {
29
- const { channelIdText, /* podcastShrunkImageUrl, */ channelFullImageUrl, itemFullImageUrl, itemIdText } = options;
27
+ const { channelIdText, channelFullImageUrl, itemFullImageUrl, itemIdText } = options;
30
28
  const channelTitle = options.channelTitle || 'Untitled';
31
29
  const itemTitle = options.itemTitle || 'Livestream starting';
32
30
  const title = `LIVE: ${channelTitle}`;
33
31
  const body = itemTitle;
34
- const finalPodcastImageUrl = /* podcastShrunkImageUrl ||*/ channelFullImageUrl;
32
+ const finalPodcastImageUrl = channelFullImageUrl;
35
33
  const finalEpisodeImageUrl = itemFullImageUrl;
36
34
  return this.sendFCMGoogleApiNotification(account_fcm_tokens, title, body, channelIdText, 'live', channelTitle, itemTitle, finalPodcastImageUrl, finalEpisodeImageUrl, itemIdText);
37
35
  });
@@ -43,6 +41,7 @@ class GoogleFCMService {
43
41
  for (let i = 0; i < fcmTokens.length; i += size) {
44
42
  fcmTokenBatches.push(fcmTokens.slice(i, i + size));
45
43
  }
44
+ const fcmGoogleApiPath = this.getFcmGoogleApiPath();
46
45
  for (const fcmTokenBatch of fcmTokenBatches) {
47
46
  if ((fcmTokenBatch === null || fcmTokenBatch === void 0 ? void 0 : fcmTokenBatch.length) > 0) {
48
47
  const imageUrl = itemImage || channelImage;
@@ -51,6 +50,7 @@ class GoogleFCMService {
51
50
  yield (0, podverse_helpers_1.request)(fcmGoogleApiPath, {
52
51
  method: 'POST',
53
52
  headers: {
53
+ 'User-Agent': this.userAgent,
54
54
  Authorization: `Bearer ${this.authToken}`,
55
55
  'Content-Type': 'application/json'
56
56
  },
@@ -97,12 +97,18 @@ class GoogleFCMService {
97
97
  }
98
98
  }
99
99
  catch (error) {
100
- (0, podverse_helpers_1.logError)('sendFCMGoogleApiNotification error', error);
100
+ this.loggerService.logError('sendFCMGoogleApiNotification error', error);
101
101
  }
102
102
  }
103
103
  }
104
104
  });
105
+ this.userAgent = userAgent;
105
106
  this.authToken = authToken;
107
+ this.firebaseProjectId = firebaseProjectId;
108
+ this.loggerService = loggerService;
109
+ }
110
+ getFcmGoogleApiPath() {
111
+ return `https://fcm.googleapis.com/v1/projects/${this.firebaseProjectId}/messages:send`;
106
112
  }
107
113
  }
108
114
  exports.GoogleFCMService = GoogleFCMService;
@@ -0,0 +1,9 @@
1
+ export interface FirebaseAccessTokenServiceParams {
2
+ keyFilePath: string;
3
+ }
4
+ export declare class FirebaseAccessTokenService {
5
+ private serviceAccount;
6
+ constructor({ keyFilePath }: FirebaseAccessTokenServiceParams);
7
+ generateAccessToken(): Promise<string>;
8
+ }
9
+ //# sourceMappingURL=firebaseAccessTokenService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebaseAccessTokenService.d.ts","sourceRoot":"","sources":["../../../src/services/google/firebaseAccessTokenService.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gCAAgC;IAC/C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,0BAA0B;IACrC,OAAO,CAAC,cAAc,CAAM;gBAEhB,EAAE,WAAW,EAAE,EAAE,gCAAgC;IAavD,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;CAI7C"}
@@ -42,21 +42,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.firebaseGenerateAccessToken = firebaseGenerateAccessToken;
45
+ exports.FirebaseAccessTokenService = void 0;
46
46
  const admin = __importStar(require("firebase-admin"));
47
- const config_1 = require("@external-services/config");
48
- const fs = require('fs');
49
- const keyFilePath = config_1.config.google.firebase.patoToAuthJson;
50
- let serviceAccount = null;
51
- if (keyFilePath) {
52
- serviceAccount = JSON.parse(fs.readFileSync(keyFilePath, 'utf8'));
53
- admin.initializeApp({
54
- credential: admin.credential.cert(serviceAccount),
55
- });
56
- }
57
- function firebaseGenerateAccessToken() {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const token = yield admin.credential.cert(serviceAccount).getAccessToken();
60
- return token.access_token;
61
- });
47
+ const fs = __importStar(require("fs"));
48
+ class FirebaseAccessTokenService {
49
+ constructor({ keyFilePath }) {
50
+ if (!keyFilePath) {
51
+ throw new Error('keyFilePath is required');
52
+ }
53
+ this.serviceAccount = JSON.parse(fs.readFileSync(keyFilePath, 'utf8'));
54
+ if (!admin.apps.length) {
55
+ admin.initializeApp({
56
+ credential: admin.credential.cert(this.serviceAccount),
57
+ });
58
+ }
59
+ }
60
+ generateAccessToken() {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const token = yield admin.credential.cert(this.serviceAccount).getAccessToken();
63
+ return token.access_token;
64
+ });
65
+ }
62
66
  }
67
+ exports.FirebaseAccessTokenService = FirebaseAccessTokenService;
@@ -1,4 +1,4 @@
1
- export { firebaseGenerateAccessToken } from './google/firebaseGenerateAccessToken';
1
+ export { FirebaseAccessTokenService } from './google/firebaseAccessTokenService';
2
2
  export { NotificationsService } from './notifications';
3
3
  export { PayPalService } from './paypal';
4
4
  export { PodcastIndexService } from './podcast-index';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PodcastIndexService = exports.PayPalService = exports.NotificationsService = exports.firebaseGenerateAccessToken = void 0;
3
+ exports.PodcastIndexService = exports.PayPalService = exports.NotificationsService = exports.FirebaseAccessTokenService = void 0;
4
4
  // export { AWSS3Service, AWSSQSService } from './aws'
5
- var firebaseGenerateAccessToken_1 = require("./google/firebaseGenerateAccessToken");
6
- Object.defineProperty(exports, "firebaseGenerateAccessToken", { enumerable: true, get: function () { return firebaseGenerateAccessToken_1.firebaseGenerateAccessToken; } });
5
+ var firebaseAccessTokenService_1 = require("./google/firebaseAccessTokenService");
6
+ Object.defineProperty(exports, "FirebaseAccessTokenService", { enumerable: true, get: function () { return firebaseAccessTokenService_1.FirebaseAccessTokenService; } });
7
7
  var notifications_1 = require("./notifications");
8
8
  Object.defineProperty(exports, "NotificationsService", { enumerable: true, get: function () { return notifications_1.NotificationsService; } });
9
9
  var paypal_1 = require("./paypal");
@@ -1,4 +1,5 @@
1
1
  import { GoogleFCMService } from '@external-services/services/google/fcm';
2
+ import { LoggerService } from 'podverse-helpers/dist/lib/backend/logger';
2
3
  export interface SendNotificationOptions {
3
4
  itemFullImageUrl?: string | null;
4
5
  itemGuid?: string | null;
@@ -9,11 +10,14 @@ export interface SendNotificationOptions {
9
10
  channelTitle?: string | null;
10
11
  }
11
12
  type Constructor = {
13
+ userAgent: string;
12
14
  googleAuthToken: string;
15
+ firebaseProjectId: string;
16
+ loggerService: LoggerService;
13
17
  };
14
18
  export declare class NotificationsService {
15
19
  GoogleFCMService: GoogleFCMService;
16
- constructor({ googleAuthToken }: Constructor);
20
+ constructor({ userAgent, googleAuthToken, firebaseProjectId, loggerService }: Constructor);
17
21
  sendNewItemDetectedNotifications: (account_fcm_tokens: string[], options: SendNotificationOptions) => Promise<void>;
18
22
  sendLiveItemLiveDetectedNotifications: (account_fcm_tokens: string[], options: SendNotificationOptions) => Promise<void>;
19
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAEzE,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEnC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,qBAAa,oBAAoB;IACvB,gBAAgB,EAAE,gBAAgB,CAAA;gBAG7B,EAAE,eAAe,EAAE,EAAE,WAAW;IAQ7C,gCAAgC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAAC,CAKvH;IAED,qCAAqC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAAC,CAK5H;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEnC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AAED,qBAAa,oBAAoB;IACvB,gBAAgB,EAAE,gBAAgB,CAAA;gBAG7B,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,WAAW;IAW1F,gCAAgC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAAC,CAKvH;IAED,qCAAqC,GAAU,oBAAoB,MAAM,EAAE,EAAE,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CAAC,CAK5H;CACF"}
@@ -10,11 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.NotificationsService = void 0;
13
- // import { UnifiedPushService } from '..'
14
13
  const fcm_1 = require("@external-services/services/google/fcm");
15
14
  class NotificationsService {
16
15
  // declare UnifiedPushService: UnifiedPushService
17
- constructor({ googleAuthToken }) {
16
+ constructor({ userAgent, googleAuthToken, firebaseProjectId, loggerService }) {
18
17
  this.sendNewItemDetectedNotifications = (account_fcm_tokens, options) => __awaiter(this, void 0, void 0, function* () {
19
18
  yield Promise.all([
20
19
  this.GoogleFCMService.sendFcmNewItemDetectedNotification(account_fcm_tokens, options),
@@ -28,7 +27,10 @@ class NotificationsService {
28
27
  ]);
29
28
  });
30
29
  this.GoogleFCMService = new fcm_1.GoogleFCMService({
31
- authToken: googleAuthToken
30
+ userAgent,
31
+ authToken: googleAuthToken,
32
+ firebaseProjectId,
33
+ loggerService
32
34
  });
33
35
  // this.UnifiedPushService = new UnifiedPushService()
34
36
  }
@@ -1,6 +1,14 @@
1
+ export interface PayPalServiceParams {
2
+ clientId: string;
3
+ clientSecret: string;
4
+ nodeEnv?: string;
5
+ }
1
6
  export declare class PayPalService {
2
7
  private client;
3
- constructor();
8
+ private clientId;
9
+ private clientSecret;
10
+ private nodeEnv;
11
+ constructor({ clientId, clientSecret, nodeEnv }: PayPalServiceParams);
4
12
  private getEnvironment;
5
13
  getPaymentInfo(paymentId: string): Promise<any>;
6
14
  getCaptureInfo(paymentId: string): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/paypal/index.ts"],"names":[],"mappings":"AAIA,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAM;;IAMpB,OAAO,CAAC,cAAc;IAQhB,cAAc,CAAC,SAAS,EAAE,MAAM;IAMhC,cAAc,CAAC,SAAS,EAAE,MAAM;CAKvC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/paypal/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAuB,EAAE,EAAE,mBAAmB;IAOpF,OAAO,CAAC,cAAc;IAQhB,cAAc,CAAC,SAAS,EAAE,MAAM;IAMhC,cAAc,CAAC,SAAS,EAAE,MAAM;CAKvC"}
@@ -10,33 +10,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PayPalService = void 0;
13
- const config_1 = require("@external-services/config");
14
13
  const paypalRestSdk = require('paypal-rest-sdk');
15
14
  const payments = paypalRestSdk.v1.payments;
16
15
  class PayPalService {
17
- constructor() {
16
+ constructor({ clientId, clientSecret, nodeEnv = 'development' }) {
17
+ this.clientId = clientId;
18
+ this.clientSecret = clientSecret;
19
+ this.nodeEnv = nodeEnv;
18
20
  this.client = new paypalRestSdk.core.PayPalHttpClient(this.getEnvironment());
19
21
  }
20
22
  getEnvironment() {
21
- if (config_1.config.nodeEnv === 'production') {
22
- return new paypalRestSdk.core.LiveEnvironment(config_1.config.paypal.clientId, config_1.config.paypal.clientSecret);
23
+ if (this.nodeEnv === 'production') {
24
+ return new paypalRestSdk.core.LiveEnvironment(this.clientId, this.clientSecret);
23
25
  }
24
26
  else {
25
- return new paypalRestSdk.core.SandboxEnvironment(config_1.config.paypal.clientId, config_1.config.paypal.clientSecret);
27
+ return new paypalRestSdk.core.SandboxEnvironment(this.clientId, this.clientSecret);
26
28
  }
27
29
  }
28
30
  getPaymentInfo(paymentId) {
29
31
  return __awaiter(this, void 0, void 0, function* () {
32
+ var _a;
30
33
  const request = new payments.PaymentGetRequest(paymentId);
31
34
  const response = yield this.client.execute(request);
32
- return response.result;
35
+ return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result;
33
36
  });
34
37
  }
35
38
  getCaptureInfo(paymentId) {
36
39
  return __awaiter(this, void 0, void 0, function* () {
40
+ var _a;
37
41
  const request = new payments.CaptureGetRequest(paymentId);
38
42
  const response = yield this.client.execute(request);
39
- return response.result;
43
+ return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result;
40
44
  });
41
45
  }
42
46
  }
@@ -1,19 +1,38 @@
1
- import { PodcastByGuidResponse } from './types/podcastByGuid';
1
+ import type { PodcastByGuidResponse, PodcastIndexSearchPodcastsResponse } from 'podverse-helpers';
2
+ import { LoggerService } from 'podverse-helpers/dist/lib/backend/logger';
2
3
  type Constructor = {
4
+ userAgent: string;
3
5
  authKey: string;
4
6
  baseUrl: string;
5
7
  secretKey: string;
8
+ loggerService: LoggerService;
6
9
  };
7
10
  export declare class PodcastIndexService {
11
+ userAgent: string;
8
12
  authKey: string;
9
13
  baseUrl: string;
10
14
  secretKey: string;
11
- constructor({ authKey, baseUrl, secretKey }: Constructor);
15
+ loggerService: LoggerService;
16
+ constructor({ userAgent, authKey, baseUrl, secretKey, loggerService }: Constructor);
12
17
  podcastIndexAPIRequest: (url: string, config?: any) => Promise<any>;
13
- deadFeedsDownloadAndExtractCSV: () => Promise<any[]>;
18
+ deadFeedsDownloadAndExtractCSV: (resolveHandler: (row: string[]) => void) => Promise<void>;
19
+ deadFeedsExtractRow: (row: string[]) => {
20
+ id_to_archive: number;
21
+ duplicate_id_to_keep: number | null;
22
+ };
14
23
  podcastGetById: (podcastIndexId: number) => Promise<any | null>;
15
24
  podcastGetByGuid: (podcastGuid: string) => Promise<PodcastByGuidResponse | null>;
25
+ podcastsByMedium: (medium: string, max?: number) => Promise<any>;
16
26
  recentGetData: (sinceRange: number) => Promise<any[]>;
27
+ searchPodcasts: (term: string, options?: {
28
+ max?: number;
29
+ val?: "any" | "lightning" | "hive" | "webmonetization";
30
+ aponly?: boolean;
31
+ clean?: boolean;
32
+ similar?: boolean;
33
+ fulltext?: boolean;
34
+ pretty?: boolean;
35
+ }) => Promise<PodcastIndexSearchPodcastsResponse | null>;
17
36
  trendingGetPodcasts: (max?: number, since?: number, lang?: string, cat?: string) => Promise<{
18
37
  feeds: any[];
19
38
  nextSince?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AASD,qBAAa,mBAAmB;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;gBAEZ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,WAAW;IAQzD,sBAAsB,GAAU,KAAK,MAAM,EAAE,SAAS,GAAG,kBA+BxD;IAID,8BAA8B,QAAa,OAAO,CAAC,GAAG,EAAE,CAAC,CAwCxD;IAID,cAAc,GAAU,gBAAgB,MAAM,KAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAQnE;IAED,gBAAgB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAYpF;IAID,aAAa,GAAU,YAAY,MAAM,oBA4BxC;IAID,mBAAmB,GACjB,MAAK,MAAW,EAChB,QAAQ,MAAM,EACd,OAAO,MAAM,EACb,MAAM,MAAM,KACX,OAAO,CAAC;QAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAoB/C;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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/podcast-index/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kCAAkC,EAC9C,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AASD,qBAAa,mBAAmB;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,aAAa,CAAC;gBAExB,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,WAAW;IAUnF,sBAAsB,GAAU,KAAK,MAAM,EAAE,SAAS,GAAG,kBAgCxD;IAID,8BAA8B,GAAU,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,KAAG,OAAO,CAAC,IAAI,CAAC,CAsC9F;IAED,mBAAmB,GAAI,KAAK,MAAM,EAAE;;;MAOnC;IAID,cAAc,GAAU,gBAAgB,MAAM,KAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAQnE;IAED,gBAAgB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAYpF;IAED,gBAAgB,GAAU,QAAQ,MAAM,EAAE,MAAK,MAAY,kBAK1D;IAID,aAAa,GAAU,YAAY,MAAM,oBA4BxC;IAID,cAAc,GACZ,MAAM,MAAM,EACZ,UAAS;QACP,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,MAAM,GAAG,iBAAiB,CAAA;QACtD,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,MAAM,CAAC,EAAE,OAAO,CAAA;KACZ,KACL,OAAO,CAAC,kCAAkC,GAAG,IAAI,CAAC,CAsCpD;IAID,mBAAmB,GACjB,MAAK,MAAW,EAChB,QAAQ,MAAM,EACd,OAAO,MAAM,EACb,MAAM,MAAM,KACX,OAAO,CAAC;QAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAoB/C;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"}
@@ -26,7 +26,7 @@ const podverse_helpers_1 = require("podverse-helpers");
26
26
  encoded once again before sending the request to PI API.
27
27
  */
28
28
  class PodcastIndexService {
29
- constructor({ authKey, baseUrl, secretKey }) {
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
32
  var _a, _b, _c;
@@ -37,15 +37,16 @@ class PodcastIndexService {
37
37
  try {
38
38
  const response = yield (0, podverse_helpers_1.request)(url, Object.assign(Object.assign({}, (shouldPreventHeaders ? {} : {
39
39
  headers: {
40
+ 'User-Agent': this.userAgent,
40
41
  'X-Auth-Key': this.authKey,
41
42
  'X-Auth-Date': apiHeaderTime,
42
43
  Authorization: hash
43
44
  }
44
45
  })), config));
45
- return response;
46
+ return response === null || response === void 0 ? void 0 : response.data;
46
47
  }
47
48
  catch (error) {
48
- podverse_helpers_1.logger.error('[PodcastIndex] Request failed', {
49
+ this.loggerService.logError('[PodcastIndex] Request failed', {
49
50
  url,
50
51
  errorMessage: error === null || error === void 0 ? void 0 : error.message,
51
52
  errorStack: error === null || error === void 0 ? void 0 : error.stack,
@@ -57,7 +58,7 @@ class PodcastIndexService {
57
58
  }
58
59
  });
59
60
  // Dead Feeds
60
- this.deadFeedsDownloadAndExtractCSV = () => __awaiter(this, void 0, void 0, function* () {
61
+ this.deadFeedsDownloadAndExtractCSV = (resolveHandler) => __awaiter(this, void 0, void 0, function* () {
61
62
  const url = 'https://public.podcastindex.org/podcastindex_dead_feeds.csv';
62
63
  const tmpDir = path_1.default.join(__dirname, 'tmp');
63
64
  const filePath = path_1.default.join(tmpDir, 'podcastindex_dead_feeds.csv');
@@ -71,24 +72,33 @@ class PodcastIndexService {
71
72
  writer.on('finish', () => resolve());
72
73
  writer.on('error', reject);
73
74
  });
74
- const results = [];
75
75
  yield new Promise((resolve, reject) => {
76
- fs_1.default.createReadStream(filePath)
77
- .pipe((0, csv_parser_1.default)())
78
- .on('data', (data) => results.push(data))
79
- .on('end', resolve)
80
- .on('error', reject);
76
+ const stream = fs_1.default.createReadStream(filePath)
77
+ .pipe((0, csv_parser_1.default)({ headers: false, skipLines: 0 }));
78
+ stream.on('data', (row) => __awaiter(this, void 0, void 0, function* () {
79
+ stream.pause();
80
+ try {
81
+ yield resolveHandler(row);
82
+ stream.resume();
83
+ }
84
+ catch (err) {
85
+ stream.destroy(err instanceof Error ? err : new Error(String(err)));
86
+ }
87
+ }));
88
+ stream.on('end', () => resolve());
89
+ stream.on('error', reject);
90
+ stream.on('close', () => resolve());
81
91
  });
82
92
  fs_1.default.unlinkSync(filePath);
83
- const parsedResults = results.map((row) => {
84
- const [id_to_archive, duplicate_id_to_keep] = Object.values(row).map((value) => value.trim());
85
- return {
86
- id_to_archive: parseInt(id_to_archive, 10),
87
- duplicate_id_to_keep: duplicate_id_to_keep ? parseInt(duplicate_id_to_keep, 10) : null
88
- };
89
- });
90
- return parsedResults;
91
93
  });
94
+ this.deadFeedsExtractRow = (row) => {
95
+ const id_to_archive = row[0];
96
+ const duplicate_id_to_keep = row[1] || null;
97
+ return {
98
+ id_to_archive: parseInt(id_to_archive, 10),
99
+ duplicate_id_to_keep: duplicate_id_to_keep ? parseInt(duplicate_id_to_keep, 10) : null
100
+ };
101
+ };
92
102
  // Podcast
93
103
  this.podcastGetById = (podcastIndexId) => __awaiter(this, void 0, void 0, function* () {
94
104
  const url = `${this.baseUrl}/podcasts/byfeedid?id=${podcastIndexId}`;
@@ -112,13 +122,19 @@ class PodcastIndexService {
112
122
  }
113
123
  return podcastIndexPodcast || null;
114
124
  });
125
+ this.podcastsByMedium = (medium_1, ...args_1) => __awaiter(this, [medium_1, ...args_1], void 0, function* (medium, max = 100) {
126
+ const safeMax = Math.min(max, 1000);
127
+ const url = `${this.baseUrl}/podcasts/bymedium?medium=${encodeURIComponent(medium)}&max=${safeMax}`;
128
+ const response = yield this.podcastIndexAPIRequest(url);
129
+ return response.feeds || [];
130
+ });
115
131
  // Recent
116
132
  this.recentGetData = (sinceRange) => __awaiter(this, void 0, void 0, function* () {
117
- podverse_helpers_1.logger.info('recentGetData beginning...');
133
+ this.loggerService.info('recentGetData beginning...');
118
134
  const currentTimeInSeconds = Math.floor(Date.now() / 1000);
119
135
  const sinceTimeInSeconds = currentTimeInSeconds - sinceRange;
120
136
  const fetchData = (since_1, ...args_1) => __awaiter(this, [since_1, ...args_1], void 0, function* (since, allData = []) {
121
- podverse_helpers_1.logger.info(`fetchData since: ${since}, allData.length: ${allData.length}`);
137
+ this.loggerService.info(`fetchData since: ${since}, allData.length: ${allData.length}`);
122
138
  const url = `${this.baseUrl}/recent/data?max=5000&since=${since}`;
123
139
  const response = yield this.podcastIndexAPIRequest(url);
124
140
  const updatedFeeds = response.data.feeds;
@@ -126,17 +142,51 @@ class PodcastIndexService {
126
142
  allData = allData.concat(updatedFeeds);
127
143
  if (nextSince && nextSince <= currentTimeInSeconds) {
128
144
  if (nextSince <= since) {
129
- podverse_helpers_1.logger.info(`nextSince (${nextSince}) is not greater than since (${since}). Exiting to avoid infinite loop.`);
145
+ this.loggerService.info(`nextSince (${nextSince}) is not greater than since (${since}). Exiting to avoid infinite loop.`);
130
146
  return allData;
131
147
  }
132
148
  const timeLeft = currentTimeInSeconds - nextSince;
133
- podverse_helpers_1.logger.info(`Time remaining: ${timeLeft} seconds`);
149
+ this.loggerService.info(`Time remaining: ${timeLeft} seconds`);
134
150
  return fetchData(nextSince, allData);
135
151
  }
136
152
  return allData;
137
153
  });
138
154
  return fetchData(sinceTimeInSeconds);
139
155
  });
156
+ // Search
157
+ this.searchPodcasts = (term_1, ...args_1) => __awaiter(this, [term_1, ...args_1], void 0, function* (term, options = {}) {
158
+ const { max = 25, val, aponly, clean, similar, fulltext, pretty } = options;
159
+ const safeMax = Math.min(Math.max(max, 1), 1000);
160
+ const params = [
161
+ `q=${encodeURIComponent(term)}`,
162
+ `max=${safeMax}`
163
+ ];
164
+ if (val) {
165
+ params.push(`val=${encodeURIComponent(val)}`);
166
+ }
167
+ // Boolean flags: if true, include param name without value per Podcast Index docs
168
+ if (aponly)
169
+ params.push('aponly');
170
+ if (clean)
171
+ params.push('clean');
172
+ if (similar)
173
+ params.push('similar');
174
+ if (fulltext)
175
+ params.push('fulltext');
176
+ if (pretty)
177
+ params.push('pretty');
178
+ const query = params.join('&');
179
+ const url = `${this.baseUrl}/search/byterm?${query}`;
180
+ this.loggerService.info(`[PodcastIndex] Searching podcasts: term="${term}" max=${safeMax} val=${val || 'none'} flags=${[aponly && 'aponly', clean && 'clean', similar && 'similar', fulltext && 'fulltext', pretty && 'pretty'].filter(Boolean).join(',')}`);
181
+ try {
182
+ const response = yield this.podcastIndexAPIRequest(url);
183
+ return response || [];
184
+ }
185
+ catch (error) {
186
+ this.loggerService.logError('[PodcastIndex] searchPodcasts failed', { term, error });
187
+ return null;
188
+ }
189
+ });
140
190
  // Trending
141
191
  this.trendingGetPodcasts = (...args_1) => __awaiter(this, [...args_1], void 0, function* (max = 25, since, lang, cat) {
142
192
  const safeMax = Math.min(max, 1000);
@@ -150,7 +200,7 @@ class PodcastIndexService {
150
200
  if (cat) {
151
201
  url += `&cat=${encodeURIComponent(cat)}`;
152
202
  }
153
- podverse_helpers_1.logger.info(`[PodcastIndex] Fetching trending feeds (max: ${safeMax}, since: ${since}, lang: ${lang}, cat: ${cat})`);
203
+ this.loggerService.info(`[PodcastIndex] Fetching trending feeds (max: ${safeMax}, since: ${since}, lang: ${lang}, cat: ${cat})`);
154
204
  const response = yield this.podcastIndexAPIRequest(url);
155
205
  return {
156
206
  feeds: response.feeds || [],
@@ -175,9 +225,11 @@ class PodcastIndexService {
175
225
  }
176
226
  return accumulatedPodcastIndexIds;
177
227
  });
228
+ this.userAgent = userAgent;
178
229
  this.authKey = authKey;
179
230
  this.baseUrl = baseUrl;
180
231
  this.secretKey = secretKey;
232
+ this.loggerService = loggerService;
181
233
  }
182
234
  }
183
235
  exports.PodcastIndexService = PodcastIndexService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-external-services",
3
- "version": "5.1.1-alpha.9",
3
+ "version": "5.1.3-alpha.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,25 +16,25 @@
16
16
  "author": "",
17
17
  "license": "AGPLv3",
18
18
  "devDependencies": {
19
- "@types/crypto-js": "^4.2.1",
20
- "@types/http-errors": "^2.0.4",
21
- "@types/node": "^20.10.4",
22
- "@types/web-push": "^3.3.2",
23
- "@typescript-eslint/eslint-plugin": "^6.13.0",
24
- "@typescript-eslint/parser": "^6.13.0",
25
- "eslint": "^8.54.0",
26
- "nodemon": "^3.0.2",
27
- "typescript": "^5.3.2"
19
+ "@types/crypto-js": "^4.2.2",
20
+ "@types/http-errors": "^2.0.5",
21
+ "@types/node": "^24.4.0",
22
+ "@types/web-push": "^3.6.4",
23
+ "@typescript-eslint/eslint-plugin": "^8.44.0",
24
+ "@typescript-eslint/parser": "^8.44.0",
25
+ "eslint": "^9.35.0",
26
+ "nodemon": "^3.1.10",
27
+ "typescript": "^5.9.2"
28
28
  },
29
29
  "dependencies": {
30
30
  "crypto-js": "^4.2.0",
31
31
  "csv-parser": "^3.2.0",
32
- "firebase-admin": "^13.2.0",
33
- "http-errors": "1.7.3",
32
+ "firebase-admin": "^13.5.0",
33
+ "http-errors": "2.0.0",
34
34
  "module-alias": "^2.2.3",
35
35
  "paypal-rest-sdk": "2.0.0-rc.2",
36
- "podcast-partytime": "^4.8.3",
37
- "podverse-helpers": "^5.1.2-alpha.4",
38
- "web-push": "^3.6.3"
36
+ "podcast-partytime": "^4.9.1",
37
+ "podverse-helpers": "^5.1.3-alpha.1",
38
+ "web-push": "^3.6.7"
39
39
  }
40
40
  }
@@ -1,15 +0,0 @@
1
- export declare const config: {
2
- nodeEnv: string;
3
- google: {
4
- firebase: {
5
- projectId: string;
6
- patoToAuthJson: string;
7
- };
8
- };
9
- paypal: {
10
- clientId: string;
11
- clientSecret: string;
12
- mode: string;
13
- };
14
- };
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAalB,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- exports.config = {
5
- nodeEnv: process.env.NODE_ENV || 'development',
6
- google: {
7
- firebase: {
8
- projectId: process.env.GOOGLE_FIREBASE_PROJECT_ID || '',
9
- patoToAuthJson: process.env.GOOGLE_FIREBASE_PATH_TO_AUTH_JSON || '',
10
- }
11
- },
12
- paypal: {
13
- clientId: process.env.PAYPAL_CLIENT_ID || '',
14
- clientSecret: process.env.PAYPAL_CLIENT_SECRET || '',
15
- mode: process.env.PAYPAL_MODE || 'sandbox'
16
- }
17
- };
@@ -1,2 +0,0 @@
1
- export declare function firebaseGenerateAccessToken(): Promise<string>;
2
- //# sourceMappingURL=firebaseGenerateAccessToken.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebaseGenerateAccessToken.d.ts","sourceRoot":"","sources":["../../../src/services/google/firebaseGenerateAccessToken.ts"],"names":[],"mappings":"AAgBA,wBAAsB,2BAA2B,oBAGhD"}
@@ -1,73 +0,0 @@
1
- type Query = {
2
- guid: string;
3
- id: string;
4
- };
5
- type Model = {
6
- type: string;
7
- method: string;
8
- suggested: string;
9
- };
10
- type Destination = {
11
- name: string;
12
- address: string;
13
- type: string;
14
- split: number;
15
- fee: boolean;
16
- customKey: string;
17
- customValue: string;
18
- };
19
- type Value = {
20
- model: Model;
21
- destinations: Destination[];
22
- };
23
- type Funding = {
24
- url: string;
25
- message: string;
26
- };
27
- type Categories = {
28
- [key: string]: string;
29
- };
30
- type Feed = {
31
- id: number;
32
- podcastGuid: string;
33
- title: string;
34
- url: string;
35
- originalUrl: string;
36
- link: string;
37
- description: string;
38
- author: string;
39
- ownerName: string;
40
- image: string;
41
- artwork: string;
42
- lastUpdateTime: number;
43
- lastCrawlTime: number;
44
- lastParseTime: number;
45
- lastGoodHttpStatusTime: number;
46
- lastHttpStatus: number;
47
- contentType: string;
48
- itunesId: number;
49
- itunesType: string;
50
- generator: string;
51
- language: string;
52
- explicit: boolean;
53
- type: number;
54
- medium: string;
55
- dead: number;
56
- chash: string;
57
- episodeCount: number;
58
- crawlErrors: number;
59
- parseErrors: number;
60
- categories: Categories;
61
- locked: number;
62
- imageUrlHash: number;
63
- value: Value;
64
- funding: Funding;
65
- };
66
- export type PodcastByGuidResponse = {
67
- status: string;
68
- query: Query;
69
- feed: Feed;
70
- description: string;
71
- };
72
- export {};
73
- //# sourceMappingURL=podcastByGuid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"podcastByGuid.d.ts","sourceRoot":"","sources":["../../../../src/services/podcast-index/types/podcastByGuid.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,IAAI,GAAG;IACV,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,68 +0,0 @@
1
- type Model = {
2
- type: string;
3
- method: string;
4
- suggested: string;
5
- };
6
- type Destination = {
7
- name: string;
8
- address: string;
9
- type: string;
10
- split: number;
11
- fee: boolean;
12
- customKey: string;
13
- customValue: string;
14
- };
15
- type Value = {
16
- model: Model;
17
- destinations: Destination[];
18
- };
19
- type Funding = {
20
- url: string;
21
- message: string;
22
- };
23
- type Categories = {
24
- [key: string]: string;
25
- };
26
- type Feed = {
27
- id: number;
28
- title: string;
29
- url: string;
30
- originalUrl: string;
31
- link: string;
32
- description: string;
33
- author: string;
34
- ownerName: string;
35
- image: string;
36
- artwork: string;
37
- lastUpdateTime: number;
38
- lastCrawlTime: number;
39
- lastParseTime: number;
40
- lastGoodHttpStatusTime: number;
41
- lastHttpStatus: number;
42
- contentType: string;
43
- itunesId: number;
44
- generator: string;
45
- language: string;
46
- type: number;
47
- dead: number;
48
- crawlErrors: number;
49
- parseErrors: number;
50
- categories: Categories;
51
- locked: number;
52
- popularity: number;
53
- imageUrlHash: number;
54
- value: Value;
55
- funding: Funding;
56
- podcastGuid: string;
57
- valueCreatedOn: number;
58
- };
59
- export type PodcastsByTagResponse = {
60
- status: string;
61
- feeds: Feed[];
62
- count: number;
63
- total: number;
64
- nextStartAt: number;
65
- description: string;
66
- };
67
- export {};
68
- //# sourceMappingURL=podcastsByTag.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"podcastsByTag.d.ts","sourceRoot":"","sources":["../../../../src/services/podcast-index/types/podcastsByTag.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,IAAI,GAAG;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +0,0 @@
1
- type QueryGuids = {
2
- [key: string]: string[];
3
- };
4
- type Model = {
5
- type: string;
6
- method: string;
7
- suggested: string;
8
- };
9
- type Destination = {
10
- name: string;
11
- address: string;
12
- type: string;
13
- split: number;
14
- fee: boolean;
15
- customKey: string;
16
- customValue: string;
17
- };
18
- type ValueItem = {
19
- podcastGUID: string;
20
- guid: string;
21
- title: string;
22
- feedTitle: string;
23
- model: Model;
24
- destinations: Destination[];
25
- };
26
- export type ValueBatchByEpisodeGuidResponse = {
27
- status: string;
28
- query: {
29
- guids: QueryGuids;
30
- };
31
- value: ValueItem[];
32
- description: string;
33
- allFound: boolean;
34
- found: number;
35
- };
36
- export {};
37
- //# sourceMappingURL=valueBatchByEpisodeGuid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"valueBatchByEpisodeGuid.d.ts","sourceRoot":"","sources":["../../../../src/services/podcast-index/types/valueBatchByEpisodeGuid.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,32 +0,0 @@
1
- type Query = {
2
- podcastguid: string;
3
- episodeguid: string;
4
- };
5
- type Model = {
6
- type: string;
7
- method: string;
8
- suggested: string;
9
- };
10
- type Destination = {
11
- name: string;
12
- address: string;
13
- type: string;
14
- split: number;
15
- fee: boolean;
16
- customKey: string;
17
- customValue: string;
18
- };
19
- type Value = {
20
- model: Model;
21
- destinations: Destination[];
22
- title: string;
23
- feedTitle: string;
24
- };
25
- export type ValueByEpisodeGuidResponse = {
26
- status: string;
27
- query: Query;
28
- value: Value;
29
- description: string;
30
- };
31
- export {};
32
- //# sourceMappingURL=valueByEpisodeGuid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"valueByEpisodeGuid.d.ts","sourceRoot":"","sources":["../../../../src/services/podcast-index/types/valueByEpisodeGuid.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });