podverse-parser 5.1.17-alpha.0 → 5.1.20-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.
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +7 -0
- package/dist/lib/notifications/handleNewItemNotifications.d.ts.map +1 -1
- package/dist/lib/notifications/handleNewItemNotifications.js +5 -3
- package/dist/lib/notifications/handleNewLiveItemNotifications.js +4 -3
- package/dist/lib/notifications/sharedNotificationHelpers.d.ts +5 -2
- package/dist/lib/notifications/sharedNotificationHelpers.d.ts.map +1 -1
- package/dist/lib/notifications/sharedNotificationHelpers.js +98 -11
- package/dist/lib/rss/parser.d.ts +1 -1
- package/dist/lib/rss/parser.d.ts.map +1 -1
- package/dist/lib/rss/parser.js +3 -0
- package/package.json +5 -4
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BlB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -19,5 +19,12 @@ exports.config = {
|
|
|
19
19
|
},
|
|
20
20
|
parser: {
|
|
21
21
|
addRemoteItemsToMQ: process.env.PARSER_ADD_REMOTE_ITEMS_TO_MQ === 'true',
|
|
22
|
+
},
|
|
23
|
+
defaults: {
|
|
24
|
+
account: {
|
|
25
|
+
settings: {
|
|
26
|
+
locale: process.env.DEFAULT_ACCOUNT_SETTINGS_LOCALE || 'en-US',
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleNewItemNotifications.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/handleNewItemNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA6B,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAuCpE;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,uBAAuB,GACzC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"handleNewItemNotifications.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/handleNewItemNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA6B,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAuCpE;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,uBAAuB,GACzC,OAAO,CAAC,IAAI,CAAC,CAiFf"}
|
|
@@ -57,7 +57,7 @@ function handleNewItemNotifications(channel, parsedItemsResult) {
|
|
|
57
57
|
if (!devicesResult) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const { devices: allDevices } = devicesResult;
|
|
60
|
+
const { devices: allDevices, webPushSubscriptions, upSubscriptions } = devicesResult;
|
|
61
61
|
// Get the items to send notifications for using batch queries
|
|
62
62
|
const itemService = new podverse_orm_1.ItemService();
|
|
63
63
|
const items = [];
|
|
@@ -98,15 +98,17 @@ function handleNewItemNotifications(channel, parsedItemsResult) {
|
|
|
98
98
|
imageUrl: (0, sharedNotificationHelpers_1.getBestImageUrl)(item, channelImages),
|
|
99
99
|
itemIdText: item.id_text,
|
|
100
100
|
channelIdText: channel.id_text,
|
|
101
|
-
messageType
|
|
101
|
+
messageType,
|
|
102
|
+
mediumId: channel.medium_id
|
|
102
103
|
}));
|
|
103
104
|
// Group devices by locale and platform
|
|
104
105
|
const groupedDevices = (0, sharedNotificationHelpers_1.groupDevicesByLocaleAndPlatform)(allDevices);
|
|
105
106
|
// Send notifications
|
|
106
|
-
yield (0, sharedNotificationHelpers_1.sendItemNotifications)(itemNotifications, groupedDevices);
|
|
107
|
+
yield (0, sharedNotificationHelpers_1.sendItemNotifications)(itemNotifications, groupedDevices, webPushSubscriptions, upSubscriptions);
|
|
107
108
|
}
|
|
108
109
|
catch (error) {
|
|
109
110
|
loggerService_1.loggerService.logError('handleNewItemNotifications', error);
|
|
111
|
+
loggerService_1.loggerService.logError(`handleNewItemNotifications: Error details - Channel: ${channel.id_text}, Error: ${error.message}`, error);
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}
|
|
@@ -53,7 +53,7 @@ function sendLiveItemNotificationsForStatus(channel, itemGuids, channelImages, m
|
|
|
53
53
|
if (!devicesResult) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
const { devices: allDevices } = devicesResult;
|
|
56
|
+
const { devices: allDevices, webPushSubscriptions, upSubscriptions } = devicesResult;
|
|
57
57
|
// Get the items to send notifications for using batch queries
|
|
58
58
|
const itemService = new podverse_orm_1.ItemService();
|
|
59
59
|
const items = yield itemService.getManyByGuid(channel, itemGuids, {
|
|
@@ -84,11 +84,12 @@ function sendLiveItemNotificationsForStatus(channel, itemGuids, channelImages, m
|
|
|
84
84
|
imageUrl: (0, sharedNotificationHelpers_1.getBestImageUrl)(item, channelImages),
|
|
85
85
|
itemIdText: item.id_text,
|
|
86
86
|
channelIdText: channel.id_text,
|
|
87
|
-
messageType
|
|
87
|
+
messageType,
|
|
88
|
+
mediumId: channel.medium_id
|
|
88
89
|
}));
|
|
89
90
|
// Group devices by locale and platform
|
|
90
91
|
const groupedDevices = (0, sharedNotificationHelpers_1.groupDevicesByLocaleAndPlatform)(allDevices);
|
|
91
92
|
// Send notifications
|
|
92
|
-
yield (0, sharedNotificationHelpers_1.sendItemNotifications)(itemNotifications, groupedDevices);
|
|
93
|
+
yield (0, sharedNotificationHelpers_1.sendItemNotifications)(itemNotifications, groupedDevices, webPushSubscriptions, upSubscriptions);
|
|
93
94
|
});
|
|
94
95
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccountFCMDevicePlatformEnum, AccountNotificationTypeEnum } from 'podverse-helpers';
|
|
2
2
|
import { Channel, ChannelImage, Item } from 'podverse-orm';
|
|
3
|
-
import { NotificationMessageType, NotificationPlatform } from 'podverse-
|
|
3
|
+
import { NotificationMessageType, NotificationPlatform, WebPushSubscription, UPSubscription } from 'podverse-notifications';
|
|
4
4
|
export type DeviceWithLocale = {
|
|
5
5
|
fcm_token: string;
|
|
6
6
|
platform: NotificationPlatform;
|
|
@@ -14,6 +14,7 @@ export type ItemNotificationData = {
|
|
|
14
14
|
itemIdText: string;
|
|
15
15
|
channelIdText: string;
|
|
16
16
|
messageType: NotificationMessageType;
|
|
17
|
+
mediumId: number;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* Selects the best image from a list based on notification requirements.
|
|
@@ -45,10 +46,12 @@ export declare function loadChannelImages(channel: Channel): Promise<ChannelImag
|
|
|
45
46
|
*/
|
|
46
47
|
export declare function getDevicesForNotificationType(channelIdText: string, notificationType: AccountNotificationTypeEnum): Promise<{
|
|
47
48
|
devices: DeviceWithLocale[];
|
|
49
|
+
webPushSubscriptions: Map<string, WebPushSubscription[]>;
|
|
50
|
+
upSubscriptions: Map<string, UPSubscription[]>;
|
|
48
51
|
accountLocaleMap: Map<number, string>;
|
|
49
52
|
} | null>;
|
|
50
53
|
/**
|
|
51
54
|
* Sends notifications for items to grouped devices
|
|
52
55
|
*/
|
|
53
|
-
export declare function sendItemNotifications(itemNotifications: ItemNotificationData[], groupedDevices: Map<string, Map<NotificationPlatform, string[]
|
|
56
|
+
export declare function sendItemNotifications(itemNotifications: ItemNotificationData[], groupedDevices: Map<string, Map<NotificationPlatform, string[]>>, webPushSubscriptions: Map<string, WebPushSubscription[]>, upSubscriptions: Map<string, UPSubscription[]>): Promise<void>;
|
|
54
57
|
//# sourceMappingURL=sharedNotificationHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedNotificationHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/sharedNotificationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,
|
|
1
|
+
{"version":3,"file":"sharedNotificationHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/notifications/sharedNotificationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAML,OAAO,EACP,YAAY,EAEZ,IAAI,EACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAA4B,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAItJ,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,uBAAuB,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAOF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACzF,MAAM,EAAE,CAAC,EAAE,GACV,MAAM,GAAG,IAAI,CA8Bf;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,GAAG,IAAI,CAexF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,4BAA4B,GAAG,oBAAoB,CAW5F;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC,CAAC,CAgB7H;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAUjF;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,2BAA2B,GAC5C,OAAO,CAAC;IAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAAC,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,CA+FlM;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,CAqGf"}
|
|
@@ -18,8 +18,9 @@ exports.getDevicesForNotificationType = getDevicesForNotificationType;
|
|
|
18
18
|
exports.sendItemNotifications = sendItemNotifications;
|
|
19
19
|
const podverse_helpers_1 = require("podverse-helpers");
|
|
20
20
|
const podverse_orm_1 = require("podverse-orm");
|
|
21
|
-
const
|
|
21
|
+
const podverse_notifications_1 = require("podverse-notifications");
|
|
22
22
|
const loggerService_1 = require("@parser/factories/loggerService");
|
|
23
|
+
const config_1 = require("@parser/config");
|
|
23
24
|
// Minimum acceptable image size for notifications (in pixels)
|
|
24
25
|
const NOTIFICATION_IMAGE_MIN_SIZE = 200;
|
|
25
26
|
// Ideal image size for notifications - not too large to waste bandwidth
|
|
@@ -81,9 +82,8 @@ function convertPlatform(platform) {
|
|
|
81
82
|
return 'android';
|
|
82
83
|
case podverse_helpers_1.AccountFCMDevicePlatformEnum.iOS:
|
|
83
84
|
return 'ios';
|
|
84
|
-
case podverse_helpers_1.AccountFCMDevicePlatformEnum.Generic:
|
|
85
85
|
default:
|
|
86
|
-
return '
|
|
86
|
+
return 'web';
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -144,7 +144,7 @@ function getDevicesForNotificationType(channelIdText, notificationType) {
|
|
|
144
144
|
if (hasType) {
|
|
145
145
|
accountIdsWithTypeEnabled.push(notificationChannel.account_id);
|
|
146
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) ||
|
|
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
148
|
accountLocaleMap.set(notificationChannel.account_id, locale);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -155,31 +155,65 @@ function getDevicesForNotificationType(channelIdText, notificationType) {
|
|
|
155
155
|
// Get all FCM devices for the filtered account IDs in a single batch query
|
|
156
156
|
const accountFCMDeviceService = new podverse_orm_1.AccountFCMDeviceService();
|
|
157
157
|
const deviceResults = yield accountFCMDeviceService.getAllForAccountIds(accountIdsWithTypeEnabled);
|
|
158
|
-
//
|
|
159
|
-
|
|
158
|
+
// Get all Web Push devices for the filtered account IDs in a single batch query
|
|
159
|
+
const accountWebPushDeviceService = new podverse_orm_1.AccountWebPushDeviceService();
|
|
160
|
+
const webPushDeviceResults = yield accountWebPushDeviceService.getAllForAccountIds(accountIdsWithTypeEnabled);
|
|
161
|
+
// Get all Unified Push devices for the filtered account IDs in a single batch query
|
|
162
|
+
const accountUPDeviceService = new podverse_orm_1.AccountUPDeviceService();
|
|
163
|
+
const upDeviceResults = yield accountUPDeviceService.getAllForAccountIds(accountIdsWithTypeEnabled);
|
|
164
|
+
// Early return if no devices to send to (FCM, Web Push, or UP)
|
|
165
|
+
if (deviceResults.length === 0 && webPushDeviceResults.length === 0 && upDeviceResults.length === 0) {
|
|
160
166
|
return null;
|
|
161
167
|
}
|
|
162
|
-
// Map devices to DeviceWithLocale format
|
|
168
|
+
// Map FCM devices to DeviceWithLocale format
|
|
163
169
|
const devices = deviceResults.map(device => ({
|
|
164
170
|
fcm_token: device.fcm_token,
|
|
165
171
|
platform: convertPlatform(device.platform),
|
|
166
|
-
locale: device.locale || accountLocaleMap.get(device.account_id) ||
|
|
172
|
+
locale: device.locale || accountLocaleMap.get(device.account_id) || config_1.config.defaults.account.settings.locale,
|
|
167
173
|
account_id: device.account_id
|
|
168
174
|
}));
|
|
169
|
-
|
|
175
|
+
// Map Web Push devices to WebPushSubscription format, grouped by locale
|
|
176
|
+
const webPushSubscriptions = new Map();
|
|
177
|
+
for (const device of webPushDeviceResults) {
|
|
178
|
+
const locale = device.locale || accountLocaleMap.get(device.account_id) || 'en-US';
|
|
179
|
+
if (!webPushSubscriptions.has(locale)) {
|
|
180
|
+
webPushSubscriptions.set(locale, []);
|
|
181
|
+
}
|
|
182
|
+
webPushSubscriptions.get(locale).push({
|
|
183
|
+
endpoint: device.endpoint,
|
|
184
|
+
keys: {
|
|
185
|
+
p256dh: device.p256dh,
|
|
186
|
+
auth: device.auth
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
// Map UP devices to UPSubscription format, grouped by locale
|
|
191
|
+
const upSubscriptions = new Map();
|
|
192
|
+
for (const device of upDeviceResults) {
|
|
193
|
+
const locale = device.locale || accountLocaleMap.get(device.account_id) || 'en-US';
|
|
194
|
+
if (!upSubscriptions.has(locale)) {
|
|
195
|
+
upSubscriptions.set(locale, []);
|
|
196
|
+
}
|
|
197
|
+
upSubscriptions.get(locale).push({
|
|
198
|
+
up_endpoint: device.up_endpoint,
|
|
199
|
+
up_auth_key: device.up_auth_key
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return { devices, webPushSubscriptions, upSubscriptions, accountLocaleMap };
|
|
170
203
|
});
|
|
171
204
|
}
|
|
172
205
|
/**
|
|
173
206
|
* Sends notifications for items to grouped devices
|
|
174
207
|
*/
|
|
175
|
-
function sendItemNotifications(itemNotifications, groupedDevices) {
|
|
208
|
+
function sendItemNotifications(itemNotifications, groupedDevices, webPushSubscriptions, upSubscriptions) {
|
|
176
209
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
210
|
for (const itemNotification of itemNotifications) {
|
|
178
211
|
const messageText = `${itemNotification.channelTitle} - ${itemNotification.itemTitle}`;
|
|
212
|
+
// Send to FCM devices
|
|
179
213
|
for (const [locale, platformMap] of groupedDevices) {
|
|
180
214
|
for (const [platform, tokens] of platformMap) {
|
|
181
215
|
try {
|
|
182
|
-
yield (0,
|
|
216
|
+
yield (0, podverse_notifications_1.notificationOrchestrator)({
|
|
183
217
|
service: 'firebase',
|
|
184
218
|
tokens,
|
|
185
219
|
messageText,
|
|
@@ -188,6 +222,7 @@ function sendItemNotifications(itemNotifications, groupedDevices) {
|
|
|
188
222
|
platform,
|
|
189
223
|
icon: itemNotification.imageUrl || undefined,
|
|
190
224
|
linkIdText: itemNotification.itemIdText,
|
|
225
|
+
mediumId: itemNotification.mediumId,
|
|
191
226
|
data: {
|
|
192
227
|
itemIdText: itemNotification.itemIdText,
|
|
193
228
|
channelIdText: itemNotification.channelIdText,
|
|
@@ -201,6 +236,58 @@ function sendItemNotifications(itemNotifications, groupedDevices) {
|
|
|
201
236
|
}
|
|
202
237
|
}
|
|
203
238
|
}
|
|
239
|
+
// Send to Web Push subscriptions
|
|
240
|
+
for (const [locale, subscriptions] of webPushSubscriptions) {
|
|
241
|
+
if (subscriptions.length > 0) {
|
|
242
|
+
try {
|
|
243
|
+
yield (0, podverse_notifications_1.notificationOrchestrator)({
|
|
244
|
+
service: 'webpush',
|
|
245
|
+
subscriptions,
|
|
246
|
+
messageText,
|
|
247
|
+
messageType: itemNotification.messageType,
|
|
248
|
+
locale,
|
|
249
|
+
icon: itemNotification.imageUrl || undefined,
|
|
250
|
+
linkIdText: itemNotification.itemIdText,
|
|
251
|
+
mediumId: itemNotification.mediumId,
|
|
252
|
+
data: {
|
|
253
|
+
itemIdText: itemNotification.itemIdText,
|
|
254
|
+
channelIdText: itemNotification.channelIdText,
|
|
255
|
+
type: itemNotification.messageType
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
loggerService_1.loggerService.info(`Sent ${itemNotification.messageType} Web Push notification to ${subscriptions.length} subscription(s) (${locale}) for item: ${itemNotification.itemIdText}`);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
loggerService_1.loggerService.logError(`Failed to send Web Push notification for item ${itemNotification.itemIdText} to ${subscriptions.length} subscription(s) (${locale})`, error);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// Send to Unified Push subscriptions
|
|
266
|
+
for (const [locale, subscriptions] of upSubscriptions) {
|
|
267
|
+
if (subscriptions.length > 0) {
|
|
268
|
+
try {
|
|
269
|
+
yield (0, podverse_notifications_1.notificationOrchestrator)({
|
|
270
|
+
service: 'unifiedpush',
|
|
271
|
+
subscriptions,
|
|
272
|
+
messageText,
|
|
273
|
+
messageType: itemNotification.messageType,
|
|
274
|
+
locale,
|
|
275
|
+
icon: itemNotification.imageUrl || undefined,
|
|
276
|
+
linkIdText: itemNotification.itemIdText,
|
|
277
|
+
mediumId: itemNotification.mediumId,
|
|
278
|
+
data: {
|
|
279
|
+
itemIdText: itemNotification.itemIdText,
|
|
280
|
+
channelIdText: itemNotification.channelIdText,
|
|
281
|
+
type: itemNotification.messageType
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
loggerService_1.loggerService.info(`Sent ${itemNotification.messageType} Unified Push notification to ${subscriptions.length} subscription(s) (${locale}) for item: ${itemNotification.itemIdText}`);
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
loggerService_1.loggerService.logError(`Failed to send Unified Push notification for item ${itemNotification.itemIdText} to ${subscriptions.length} subscription(s) (${locale})`, error);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
204
291
|
}
|
|
205
292
|
});
|
|
206
293
|
}
|
package/dist/lib/rss/parser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAKxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAmC3D,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,wBAUnD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACtC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,EAAE,2BAA2B,CAAC;CAClD,CAAA;AAgBD,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,EACX,kBAAkB,MAAM,EACxB,SAAS,oCAAoC;;;;;;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAKxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAmC3D,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,wBAUnD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACtC,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,EAAE,2BAA2B,CAAC;CAClD,CAAA;AAgBD,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,EACX,kBAAkB,MAAM,EACxB,SAAS,oCAAoC;;;;;;cAuI9C,CAAC"}
|
package/dist/lib/rss/parser.js
CHANGED
|
@@ -96,6 +96,7 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
96
96
|
}
|
|
97
97
|
parsedFeed = yield (0, feed_1.handleRequestRSSFeed)(feed);
|
|
98
98
|
feed = yield (0, feed_1.handleParsedFeed)(parsedFeed, feed, options);
|
|
99
|
+
// A race condition is possible. Save "is_parsing" state to valkey instead?
|
|
99
100
|
yield feedService.update(feed.id, { is_parsing: new Date() });
|
|
100
101
|
if ((0, podverse_orm_1.checkIfSpamFeed)(parsedFeed)) {
|
|
101
102
|
yield feedService.updateFlagStatus(feed, podverse_orm_1.FeedFlagStatusStatusEnum.Spam);
|
|
@@ -125,6 +126,8 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id, options) => __awai
|
|
|
125
126
|
catch (error) {
|
|
126
127
|
if (error instanceof errors_1.FeedIsParsingError) {
|
|
127
128
|
loggerService_1.loggerService.warn(`Feed ${feed === null || feed === void 0 ? void 0 : feed.id} is already parsing.`);
|
|
129
|
+
// return so the is_parsing flag is not reset
|
|
130
|
+
return;
|
|
128
131
|
}
|
|
129
132
|
else if (error instanceof errors_1.FeedNoChangesSinceLastParsedError) {
|
|
130
133
|
loggerService_1.loggerService.warn(`Feed ${feed === null || feed === void 0 ? void 0 : feed.id} has no changes since last parsed.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-parser",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.20-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
"license": "AGPLv3",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"module-alias": "^2.2.3",
|
|
20
|
-
"podverse-external-services": "^5.1.
|
|
21
|
-
"podverse-helpers": "^5.1.
|
|
22
|
-
"podverse-
|
|
20
|
+
"podverse-external-services": "^5.1.20-alpha.0",
|
|
21
|
+
"podverse-helpers": "^5.1.20-alpha.0",
|
|
22
|
+
"podverse-notifications": "^5.1.20-alpha.0",
|
|
23
|
+
"podverse-orm": "^5.1.20-alpha.0",
|
|
23
24
|
"podverse-partytime": "^5.0.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|