podverse-parser 5.1.24-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.
@@ -1,29 +1,3 @@
1
- export declare const config: {
2
- userAgent: string;
3
- log: {
4
- level: string;
5
- dir: string;
6
- timer: boolean;
7
- };
8
- firebase: {
9
- projectId: string;
10
- authJsonPath: string;
11
- };
12
- podcastIndex: {
13
- authKey: string;
14
- baseUrl: string;
15
- secretKey: string;
16
- rateLimitDelay: number;
17
- };
18
- parser: {
19
- addRemoteItemsToMQ: boolean;
20
- };
21
- defaults: {
22
- account: {
23
- settings: {
24
- locale: string;
25
- };
26
- };
27
- };
28
- };
1
+ export * from './types';
2
+ export declare const config: import("./types").ParserConfig;
29
3
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAMxB,eAAO,MAAM,MAAM,gCAIjB,CAAC"}
@@ -1,31 +1,27 @@
1
1
  "use strict";
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]; } };
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);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.config = void 0;
4
- exports.config = {
5
- userAgent: process.env.USER_AGENT || '',
6
- log: {
7
- level: process.env.LOG_LEVEL || 'info',
8
- dir: process.env.LOG_DIR || 'logs',
9
- timer: process.env.LOG_TIMER === 'true',
10
- },
11
- firebase: {
12
- projectId: process.env.FIREBASE_PROJECT_ID || '',
13
- authJsonPath: process.env.FIREBASE_PATH_TO_AUTH_JSON || '',
14
- },
15
- podcastIndex: {
16
- authKey: process.env.PODCAST_INDEX_AUTH_KEY || '',
17
- baseUrl: process.env.PODCAST_INDEX_BASE_URL || '',
18
- secretKey: process.env.PODCAST_INDEX_SECRET_KEY || '',
19
- rateLimitDelay: parseInt(process.env.PODCAST_INDEX_API_RATE_LIMIT_DELAY || '200', 10)
20
- },
21
- parser: {
22
- addRemoteItemsToMQ: process.env.PARSER_ADD_REMOTE_ITEMS_TO_MQ === 'true',
23
- },
24
- defaults: {
25
- account: {
26
- settings: {
27
- locale: process.env.DEFAULT_ACCOUNT_SETTINGS_LOCALE || 'en-US',
28
- }
29
- }
18
+ // Re-export config types for app-level use
19
+ __exportStar(require("./types"), exports);
20
+ // Re-export config from context for backwards compatibility
21
+ const context_1 = require("../context");
22
+ // Create a proxy object that delegates property access to the context's config
23
+ exports.config = new Proxy({}, {
24
+ get(_target, prop) {
25
+ return (0, context_1.getParserConfig)()[prop];
30
26
  }
31
- };
27
+ });
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Configuration types for podverse-parser
3
+ * These types are used by the app to create the configuration object
4
+ * that gets passed to createParserContext()
5
+ */
6
+ export type LogConfig = {
7
+ level: string;
8
+ dir?: string;
9
+ timer?: boolean;
10
+ };
11
+ export type FirebaseConfig = {
12
+ notifications_enabled: boolean;
13
+ authJsonPath?: string;
14
+ };
15
+ export type PodcastIndexConfig = {
16
+ authKey: string;
17
+ baseUrl: string;
18
+ secretKey: string;
19
+ rateLimitDelay?: number;
20
+ };
21
+ export type ParserSettingsConfig = {
22
+ addRemoteItemsToMQ: boolean;
23
+ };
24
+ export type DefaultsConfig = {
25
+ account: {
26
+ settings: {
27
+ locale: string;
28
+ };
29
+ };
30
+ };
31
+ export type ParserConfig = {
32
+ userAgent: string;
33
+ log: LogConfig;
34
+ firebase: FirebaseConfig;
35
+ podcastIndex: PodcastIndexConfig;
36
+ parser: ParserSettingsConfig;
37
+ defaults: DefaultsConfig;
38
+ };
39
+ //# 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,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Configuration types for podverse-parser
4
+ * These types are used by the app to create the configuration object
5
+ * that gets passed to createParserContext()
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import { ILoggerLike } from "podverse-helpers/dist/lib/backend/logger";
2
+ import { PodcastIndexService, FirebaseContext } from "podverse-external-services";
3
+ import { NotificationsContext } from "podverse-notifications";
4
+ import { TimerManager } from "podverse-helpers/dist/lib/backend/logTimer";
5
+ import { ParserConfig } from "./config/types";
6
+ export declare function setParserContext(context: {
7
+ config: ParserConfig;
8
+ loggerService: ILoggerLike;
9
+ podcastIndexService: PodcastIndexService;
10
+ timerManager: TimerManager;
11
+ notificationsContext: NotificationsContext;
12
+ firebaseContext: FirebaseContext;
13
+ }): void;
14
+ export declare function getParserContext(): {
15
+ config: ParserConfig;
16
+ loggerService: ILoggerLike;
17
+ podcastIndexService: PodcastIndexService;
18
+ timerManager: TimerManager;
19
+ notificationsContext: NotificationsContext;
20
+ firebaseContext: FirebaseContext;
21
+ };
22
+ export declare function getParserConfig(): ParserConfig;
23
+ export declare function getLoggerService(): ILoggerLike;
24
+ export declare function getPodcastIndexService(): PodcastIndexService;
25
+ export declare function getTimerManager(): TimerManager;
26
+ export declare function getNotificationsContext(): NotificationsContext;
27
+ export declare function getFirebaseContext(): FirebaseContext;
28
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAe9C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,WAAW,CAAC;IAC3B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,IAAI,CAEP;AAED,wBAAgB,gBAAgB;YAnBtB,YAAY;mBACL,WAAW;yBACL,mBAAmB;kBAC1B,YAAY;0BACJ,oBAAoB;qBACzB,eAAe;EAmBjC;AAGD,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED,wBAAgB,gBAAgB,IAAI,WAAW,CAE9C;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,CAE9D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setParserContext = setParserContext;
4
+ exports.getParserContext = getParserContext;
5
+ exports.getParserConfig = getParserConfig;
6
+ exports.getLoggerService = getLoggerService;
7
+ exports.getPodcastIndexService = getPodcastIndexService;
8
+ exports.getTimerManager = getTimerManager;
9
+ exports.getNotificationsContext = getNotificationsContext;
10
+ exports.getFirebaseContext = getFirebaseContext;
11
+ /**
12
+ * Module-level context holder for the parser.
13
+ * This is set by createParserContext() and used by parser functions.
14
+ */
15
+ let _context = null;
16
+ function setParserContext(context) {
17
+ _context = context;
18
+ }
19
+ function getParserContext() {
20
+ if (!_context) {
21
+ throw new Error("Parser context not initialized. Call createParserContext() first.");
22
+ }
23
+ return _context;
24
+ }
25
+ // Convenience accessors
26
+ function getParserConfig() {
27
+ return getParserContext().config;
28
+ }
29
+ function getLoggerService() {
30
+ return getParserContext().loggerService;
31
+ }
32
+ function getPodcastIndexService() {
33
+ return getParserContext().podcastIndexService;
34
+ }
35
+ function getTimerManager() {
36
+ return getParserContext().timerManager;
37
+ }
38
+ function getNotificationsContext() {
39
+ return getParserContext().notificationsContext;
40
+ }
41
+ function getFirebaseContext() {
42
+ return getParserContext().firebaseContext;
43
+ }
@@ -1,3 +1,2 @@
1
- import { LoggerService } from 'podverse-helpers/dist/lib/backend/logger';
2
- export declare const loggerService: LoggerService;
1
+ export declare const loggerService: import("podverse-helpers/dist/lib/backend/logger").ILoggerLike;
3
2
  //# sourceMappingURL=loggerService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,eAAO,MAAM,aAAa,eAExB,CAAC"}
1
+ {"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,gEAUxB,CAAC"}
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loggerService = void 0;
4
- const logger_1 = require("podverse-helpers/dist/lib/backend/logger");
5
- const config_1 = require("../config");
6
- exports.loggerService = new logger_1.LoggerService({
7
- logLevel: config_1.config.log.level,
4
+ // Re-export logger from context for backwards compatibility
5
+ const context_1 = require("../context");
6
+ // Export a proxy object that delegates to the context's logger service
7
+ exports.loggerService = new Proxy({}, {
8
+ get(_target, prop) {
9
+ const logger = (0, context_1.getLoggerService)();
10
+ const value = logger[prop];
11
+ // If it's a function, bind it to the logger instance
12
+ if (typeof value === 'function') {
13
+ return value.bind(logger);
14
+ }
15
+ return value;
16
+ }
8
17
  });
@@ -1,3 +1,2 @@
1
- import { PodcastIndexService } from 'podverse-external-services';
2
- export declare const podcastIndexService: PodcastIndexService;
1
+ export declare const podcastIndexService: import("podverse-external-services").PodcastIndexService;
3
2
  //# sourceMappingURL=podcastIndex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"podcastIndex.d.ts","sourceRoot":"","sources":["../../src/factories/podcastIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAIjE,eAAO,MAAM,mBAAmB,qBAM9B,CAAC"}
1
+ {"version":3,"file":"podcastIndex.d.ts","sourceRoot":"","sources":["../../src/factories/podcastIndex.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,0DAU9B,CAAC"}
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.podcastIndexService = void 0;
4
- const podverse_external_services_1 = require("podverse-external-services");
5
- const loggerService_1 = require("./loggerService");
6
- const config_1 = require("../config");
7
- exports.podcastIndexService = new podverse_external_services_1.PodcastIndexService({
8
- userAgent: config_1.config.userAgent,
9
- authKey: config_1.config.podcastIndex.authKey,
10
- baseUrl: config_1.config.podcastIndex.baseUrl,
11
- secretKey: config_1.config.podcastIndex.secretKey,
12
- loggerService: loggerService_1.loggerService
4
+ // Re-export podcastIndexService from context for backwards compatibility
5
+ const context_1 = require("../context");
6
+ // Export a proxy object that delegates to the context's podcast index service
7
+ exports.podcastIndexService = new Proxy({}, {
8
+ get(_target, prop) {
9
+ const service = (0, context_1.getPodcastIndexService)();
10
+ const value = service[prop];
11
+ // If it's a function, bind it to the service instance
12
+ if (typeof value === 'function') {
13
+ return value.bind(service);
14
+ }
15
+ return value;
16
+ }
13
17
  });
@@ -1,3 +1,2 @@
1
- import { TimerManager } from 'podverse-helpers/dist/lib/backend/logTimer';
2
- export declare const timerManager: TimerManager;
1
+ export declare const timerManager: import("podverse-helpers/dist/lib/backend/logTimer").TimerManager;
3
2
  //# sourceMappingURL=timerManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timerManager.d.ts","sourceRoot":"","sources":["../../src/factories/timerManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAI1E,eAAO,MAAM,YAAY,cAAoD,CAAC"}
1
+ {"version":3,"file":"timerManager.d.ts","sourceRoot":"","sources":["../../src/factories/timerManager.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,mEAUvB,CAAC"}
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.timerManager = void 0;
4
- const logTimer_1 = require("podverse-helpers/dist/lib/backend/logTimer");
5
- const loggerService_1 = require("./loggerService");
6
- const config_1 = require("../config");
7
- exports.timerManager = new logTimer_1.TimerManager(config_1.config.log.timer, loggerService_1.loggerService);
4
+ // Re-export timerManager from context for backwards compatibility
5
+ const context_1 = require("../context");
6
+ // Export a proxy object that delegates to the context's timer manager
7
+ exports.timerManager = new Proxy({}, {
8
+ get(_target, prop) {
9
+ const manager = (0, context_1.getTimerManager)();
10
+ const value = manager[prop];
11
+ // If it's a function, bind it to the manager instance
12
+ if (typeof value === 'function') {
13
+ return value.bind(manager);
14
+ }
15
+ return value;
16
+ }
17
+ });
@@ -0,0 +1,30 @@
1
+ import { ILoggerLike } from "podverse-helpers/dist/lib/backend/logger";
2
+ import { TimerManager } from "podverse-helpers/dist/lib/backend/logTimer";
3
+ import { PodcastIndexService, FirebaseContext } from "podverse-external-services";
4
+ import { NotificationsContext } from "podverse-notifications";
5
+ import { ParserConfig } from "./config/types";
6
+ export type ParserContext = {
7
+ config: ParserConfig;
8
+ loggerService: ILoggerLike;
9
+ podcastIndexService: PodcastIndexService;
10
+ timerManager: TimerManager;
11
+ notificationsContext: NotificationsContext;
12
+ firebaseContext: FirebaseContext;
13
+ };
14
+ export type CreateParserContextParams = {
15
+ config: ParserConfig;
16
+ notificationsContext: NotificationsContext;
17
+ firebaseContext: FirebaseContext;
18
+ };
19
+ /**
20
+ * Creates a parser context with the provided configuration.
21
+ * This is the factory function that should be called from the app level.
22
+ *
23
+ * NOTE: This requires createORMContext() to be called first, as the parser
24
+ * uses ORM services internally.
25
+ *
26
+ * @param params - The parser configuration and external contexts
27
+ * @returns ParserContext with initialized services
28
+ */
29
+ export declare function createParserContext(params: CreateParserContextParams): ParserContext;
30
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,WAAW,CAAC;IAC3B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,aAAa,CA8BpF"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createParserContext = createParserContext;
4
+ const logger_1 = require("podverse-helpers/dist/lib/backend/logger");
5
+ const logTimer_1 = require("podverse-helpers/dist/lib/backend/logTimer");
6
+ const podverse_external_services_1 = require("podverse-external-services");
7
+ const context_1 = require("./context");
8
+ /**
9
+ * Creates a parser context with the provided configuration.
10
+ * This is the factory function that should be called from the app level.
11
+ *
12
+ * NOTE: This requires createORMContext() to be called first, as the parser
13
+ * uses ORM services internally.
14
+ *
15
+ * @param params - The parser configuration and external contexts
16
+ * @returns ParserContext with initialized services
17
+ */
18
+ function createParserContext(params) {
19
+ const { config, notificationsContext, firebaseContext } = params;
20
+ const loggerService = new logger_1.LoggerService({
21
+ logLevel: config.log.level
22
+ });
23
+ const podcastIndexService = new podverse_external_services_1.PodcastIndexService({
24
+ userAgent: config.userAgent,
25
+ authKey: config.podcastIndex.authKey,
26
+ baseUrl: config.podcastIndex.baseUrl,
27
+ secretKey: config.podcastIndex.secretKey,
28
+ loggerService
29
+ });
30
+ const timerManager = new logTimer_1.TimerManager(config.log.timer || false, loggerService);
31
+ const context = {
32
+ config,
33
+ loggerService,
34
+ podcastIndexService,
35
+ timerManager,
36
+ notificationsContext,
37
+ firebaseContext,
38
+ };
39
+ // Set the module-level context so services can access it
40
+ (0, context_1.setParserContext)(context);
41
+ return context;
42
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import './module-alias-config';
2
+ export * from './config';
3
+ export { createParserContext, ParserContext } from './factory';
2
4
  export { parseChapters } from './lib/chapters/chapters';
3
5
  export { parseRSSFeedAndSaveToDatabase, ParseRSSFeedAndSaveToDatabaseOptions } from './lib/rss/parser';
4
6
  //# 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;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,kBAAkB,CAAC"}
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,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,27 @@
1
1
  "use strict";
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]; } };
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);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRSSFeedAndSaveToDatabase = exports.parseChapters = void 0;
17
+ exports.parseRSSFeedAndSaveToDatabase = exports.parseChapters = exports.createParserContext = void 0;
4
18
  require("./module-alias-config");
19
+ // Config types for app-level configuration
20
+ __exportStar(require("./config"), exports);
21
+ // Factory function to create the parser context
22
+ var factory_1 = require("./factory");
23
+ Object.defineProperty(exports, "createParserContext", { enumerable: true, get: function () { return factory_1.createParserContext; } });
24
+ // Parser exports
5
25
  var chapters_1 = require("./lib/chapters/chapters");
6
26
  Object.defineProperty(exports, "parseChapters", { enumerable: true, get: function () { return chapters_1.parseChapters; } });
7
27
  var parser_1 = require("./lib/rss/parser");
@@ -1 +1 @@
1
- {"version":3,"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AAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAAC,CAqGlM;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,iBAAiB,EAAE,oBAAoB,EAAE,EACzC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC,CAAC,EAChE,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,EACxD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,GAC7C,OAAO,CAAC,IAAI,CAAC,CA4Gf"}
@@ -21,6 +21,7 @@ const podverse_orm_1 = require("podverse-orm");
21
21
  const podverse_notifications_1 = require("podverse-notifications");
22
22
  const loggerService_1 = require("@parser/factories/loggerService");
23
23
  const config_1 = require("@parser/config");
24
+ const context_1 = require("@parser/context");
24
25
  // Minimum acceptable image size for notifications (in pixels)
25
26
  const NOTIFICATION_IMAGE_MIN_SIZE = 200;
26
27
  // Ideal image size for notifications - not too large to waste bandwidth
@@ -123,7 +124,7 @@ function loadChannelImages(channel) {
123
124
  */
124
125
  function getDevicesForNotificationType(channelIdText, notificationType) {
125
126
  return __awaiter(this, void 0, void 0, function* () {
126
- var _a, _b, _c, _d;
127
+ var _a, _b, _c, _d, _e;
127
128
  // Get all account notification channels for this channel with their types
128
129
  const accountNotificationChannelService = new podverse_orm_1.AccountNotificationChannelService();
129
130
  const notificationChannels = yield accountNotificationChannelService.getAllByChannelIdText(channelIdText, {
@@ -132,7 +133,8 @@ function getDevicesForNotificationType(channelIdText, notificationType) {
132
133
  account: {
133
134
  account_settings: {
134
135
  account_settings_locale: true
135
- }
136
+ },
137
+ account_membership_status: true
136
138
  }
137
139
  }
138
140
  });
@@ -142,10 +144,14 @@ function getDevicesForNotificationType(channelIdText, notificationType) {
142
144
  for (const notificationChannel of notificationChannels) {
143
145
  const hasType = (_a = notificationChannel.account_notification_channel_types) === null || _a === void 0 ? void 0 : _a.some((type) => type.type === notificationType);
144
146
  if (hasType) {
145
- accountIdsWithTypeEnabled.push(notificationChannel.account_id);
146
- // Store the locale for each account
147
- const locale = ((_d = (_c = (_b = notificationChannel.account) === null || _b === void 0 ? void 0 : _b.account_settings) === null || _c === void 0 ? void 0 : _c.account_settings_locale) === null || _d === void 0 ? void 0 : _d.locale) || config_1.config.defaults.account.settings.locale;
148
- accountLocaleMap.set(notificationChannel.account_id, locale);
147
+ // Check if account has a valid, non-expired membership
148
+ const membershipStatus = (_b = notificationChannel.account) === null || _b === void 0 ? void 0 : _b.account_membership_status;
149
+ if ((0, podverse_helpers_1.hasValidMembership)(membershipStatus)) {
150
+ accountIdsWithTypeEnabled.push(notificationChannel.account_id);
151
+ // Store the locale for each account
152
+ const locale = ((_e = (_d = (_c = notificationChannel.account) === null || _c === void 0 ? void 0 : _c.account_settings) === null || _d === void 0 ? void 0 : _d.account_settings_locale) === null || _e === void 0 ? void 0 : _e.locale) || config_1.config.defaults.account.settings.locale;
153
+ accountLocaleMap.set(notificationChannel.account_id, locale);
154
+ }
149
155
  }
150
156
  }
151
157
  // Early return if no accounts have this notification type enabled
@@ -209,12 +215,15 @@ function sendItemNotifications(itemNotifications, groupedDevices, webPushSubscri
209
215
  return __awaiter(this, void 0, void 0, function* () {
210
216
  for (const itemNotification of itemNotifications) {
211
217
  const messageText = itemNotification.itemTitle;
218
+ const notificationsCtx = (0, context_1.getNotificationsContext)();
219
+ const firebaseCtx = (0, context_1.getFirebaseContext)();
212
220
  // Send to FCM devices
213
221
  for (const [locale, platformMap] of groupedDevices) {
214
222
  for (const [platform, tokens] of platformMap) {
215
223
  try {
216
- yield (0, podverse_notifications_1.notificationOrchestrator)({
224
+ yield (0, podverse_notifications_1.notificationOrchestrator)(notificationsCtx, {
217
225
  service: 'firebase',
226
+ firebaseCtx,
218
227
  tokens,
219
228
  messageText,
220
229
  messageType: itemNotification.messageType,
@@ -241,7 +250,7 @@ function sendItemNotifications(itemNotifications, groupedDevices, webPushSubscri
241
250
  for (const [locale, subscriptions] of webPushSubscriptions) {
242
251
  if (subscriptions.length > 0) {
243
252
  try {
244
- yield (0, podverse_notifications_1.notificationOrchestrator)({
253
+ yield (0, podverse_notifications_1.notificationOrchestrator)(notificationsCtx, {
245
254
  service: 'webpush',
246
255
  subscriptions,
247
256
  messageText,
@@ -268,7 +277,7 @@ function sendItemNotifications(itemNotifications, groupedDevices, webPushSubscri
268
277
  for (const [locale, subscriptions] of upSubscriptions) {
269
278
  if (subscriptions.length > 0) {
270
279
  try {
271
- yield (0, podverse_notifications_1.notificationOrchestrator)({
280
+ yield (0, podverse_notifications_1.notificationOrchestrator)(notificationsCtx, {
272
281
  service: 'unifiedpush',
273
282
  subscriptions,
274
283
  messageText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-parser",
3
- "version": "5.1.24-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",
@@ -17,10 +17,10 @@
17
17
  "license": "AGPLv3",
18
18
  "dependencies": {
19
19
  "module-alias": "^2.2.3",
20
- "podverse-external-services": "^5.1.24-alpha.0",
21
- "podverse-helpers": "^5.1.24-alpha.0",
22
- "podverse-notifications": "^5.1.24-alpha.0",
23
- "podverse-orm": "^5.1.24-alpha.0",
20
+ "podverse-external-services": "^5.1.27-alpha.0",
21
+ "podverse-helpers": "^5.1.27-alpha.0",
22
+ "podverse-notifications": "^5.1.27-alpha.0",
23
+ "podverse-orm": "^5.1.27-alpha.0",
24
24
  "podverse-partytime": "^5.0.0"
25
25
  },
26
26
  "devDependencies": {