podverse-orm 5.1.12 → 5.1.13-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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,eAAO,MAAM,aAAa,eAExB,CAAC"}
|
|
@@ -4,6 +4,5 @@ exports.loggerService = void 0;
|
|
|
4
4
|
const config_1 = require("@orm/config");
|
|
5
5
|
const logger_1 = require("podverse-helpers/dist/lib/backend/logger");
|
|
6
6
|
exports.loggerService = new logger_1.LoggerService({
|
|
7
|
-
logDir: config_1.config.log.dir,
|
|
8
7
|
logLevel: config_1.config.log.level
|
|
9
8
|
});
|
|
@@ -3,6 +3,7 @@ import { Channel } from '@orm/entities/channel/channel';
|
|
|
3
3
|
import { ChannelPodroll } from '@orm/entities/channel/channelPodroll';
|
|
4
4
|
import { BaseOneService } from '@orm/services/base/baseOneService';
|
|
5
5
|
import { ChannelPodrollRemoteItem } from '@orm/entities/channel/channelPodrollRemoteItem';
|
|
6
|
+
import { Item } from '@orm/entities/item/item';
|
|
6
7
|
type ChannelPodrollDto = object;
|
|
7
8
|
export declare class ChannelPodrollService extends BaseOneService<ChannelPodroll, 'channel'> {
|
|
8
9
|
constructor(transactionalEntityManager?: EntityManager);
|
|
@@ -10,10 +11,12 @@ export declare class ChannelPodrollService extends BaseOneService<ChannelPodroll
|
|
|
10
11
|
update(channel: Channel, dto: ChannelPodrollDto): Promise<ChannelPodroll>;
|
|
11
12
|
delete(channel: Channel): Promise<void>;
|
|
12
13
|
getPodrollChannels(channel_podroll_remote_items: ChannelPodrollRemoteItem[]): Promise<Channel[]>;
|
|
13
|
-
getPodrollItems(channel_podroll_remote_items: ChannelPodrollRemoteItem[]): Promise<
|
|
14
|
+
getPodrollItems(channel_podroll_remote_items: ChannelPodrollRemoteItem[]): Promise<Item[]>;
|
|
14
15
|
getPodrollForChannel(idOrIdText: string): Promise<{
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
podrollChannelsAdded: Channel[];
|
|
17
|
+
podrollChannelsUnadded: ChannelPodrollRemoteItem[];
|
|
18
|
+
podrollItemsAdded: Item[];
|
|
19
|
+
podrollItemsUnadded: ChannelPodrollRemoteItem[];
|
|
17
20
|
}>;
|
|
18
21
|
}
|
|
19
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelPodroll.d.ts","sourceRoot":"","sources":["../../../src/services/channel/channelPodroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"channelPodroll.d.ts","sourceRoot":"","sources":["../../../src/services/channel/channelPodroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,KAAK,iBAAiB,GAAG,MAAM,CAAA;AAE/B,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,cAAc,EAAE,SAAS,CAAC;gBACtE,0BAA0B,CAAC,EAAE,aAAa;IAIhD,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAIrD,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIzE,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,kBAAkB,CAAC,4BAA4B,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA0BhG,eAAe,CAAC,4BAA4B,EAAE,wBAAwB,EAAE;IA8BxE,oBAAoB,CAAC,UAAU,EAAE,MAAM;;;;;;CAgG9C"}
|
|
@@ -94,22 +94,73 @@ class ChannelPodrollService extends baseOneService_1.BaseOneService {
|
|
|
94
94
|
});
|
|
95
95
|
if (!channel) {
|
|
96
96
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
podrollChannelsAdded: [],
|
|
98
|
+
podrollChannelsUnadded: [],
|
|
99
|
+
podrollItemsAdded: [],
|
|
100
|
+
podrollItemsUnadded: []
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
const channel_podroll_remote_items = ((_a = channel.channel_podroll) === null || _a === void 0 ? void 0 : _a.channel_podroll_remote_items) || [];
|
|
102
104
|
if (!channel_podroll_remote_items || channel_podroll_remote_items.length === 0) {
|
|
103
105
|
return {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
podrollChannelsAdded: [],
|
|
107
|
+
podrollChannelsUnadded: [],
|
|
108
|
+
podrollItemsAdded: [],
|
|
109
|
+
podrollItemsUnadded: []
|
|
106
110
|
};
|
|
107
111
|
}
|
|
108
|
-
const
|
|
109
|
-
const
|
|
112
|
+
const channelFeedGuids = [];
|
|
113
|
+
const itemParams = [];
|
|
114
|
+
for (const rItem of channel_podroll_remote_items) {
|
|
115
|
+
if (rItem.feed_guid && !rItem.item_guid) {
|
|
116
|
+
channelFeedGuids.push(rItem.feed_guid);
|
|
117
|
+
}
|
|
118
|
+
if (rItem.feed_guid && rItem.item_guid) {
|
|
119
|
+
itemParams.push({ podcast_guid: rItem.feed_guid, item_guid: rItem.item_guid });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const podrollChannels = channelFeedGuids.length ? yield this.getPodrollChannels(channel_podroll_remote_items) : [];
|
|
123
|
+
const podrollItems = itemParams.length ? yield this.getPodrollItems(channel_podroll_remote_items) : [];
|
|
124
|
+
const foundChannelGuids = new Set(podrollChannels
|
|
125
|
+
.map(c => c.podcast_guid)
|
|
126
|
+
.filter((g) => !!g));
|
|
127
|
+
const foundItemKey = new Set(podrollItems
|
|
128
|
+
.filter(i => { var _a; return !!((_a = i.channel) === null || _a === void 0 ? void 0 : _a.podcast_guid) && !!i.guid; })
|
|
129
|
+
.map(i => `${i.channel.podcast_guid}||${i.guid}`));
|
|
130
|
+
const podrollChannelsAdded = [];
|
|
131
|
+
const podrollChannelsUnadded = [];
|
|
132
|
+
for (const rItem of channel_podroll_remote_items) {
|
|
133
|
+
if (rItem.feed_guid && !rItem.item_guid) {
|
|
134
|
+
if (foundChannelGuids.has(rItem.feed_guid)) {
|
|
135
|
+
const ch = podrollChannels.find(c => c.podcast_guid === rItem.feed_guid);
|
|
136
|
+
if (ch && !podrollChannelsAdded.find(pc => pc.id === ch.id))
|
|
137
|
+
podrollChannelsAdded.push(ch);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
podrollChannelsUnadded.push(rItem);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const podrollItemsAdded = [];
|
|
145
|
+
const podrollItemsUnadded = [];
|
|
146
|
+
for (const rItem of channel_podroll_remote_items) {
|
|
147
|
+
if (rItem.feed_guid && rItem.item_guid) {
|
|
148
|
+
const key = `${rItem.feed_guid}||${rItem.item_guid}`;
|
|
149
|
+
if (foundItemKey.has(key)) {
|
|
150
|
+
const it = podrollItems.find(i => { var _a; return i.guid === rItem.item_guid && ((_a = i.channel) === null || _a === void 0 ? void 0 : _a.podcast_guid) === rItem.feed_guid; });
|
|
151
|
+
if (it && !podrollItemsAdded.find(pi => pi.id === it.id))
|
|
152
|
+
podrollItemsAdded.push(it);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
podrollItemsUnadded.push(rItem);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
110
159
|
return {
|
|
111
|
-
|
|
112
|
-
|
|
160
|
+
podrollChannelsAdded,
|
|
161
|
+
podrollChannelsUnadded,
|
|
162
|
+
podrollItemsAdded,
|
|
163
|
+
podrollItemsUnadded
|
|
113
164
|
};
|
|
114
165
|
});
|
|
115
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-orm",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.13-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"module-alias": "^2.2.3",
|
|
25
25
|
"nanoid": "^5.1.6",
|
|
26
26
|
"pg": "^8.16.3",
|
|
27
|
-
"podverse-helpers": "^5.1.0",
|
|
27
|
+
"podverse-helpers": "^5.1.13-alpha.0",
|
|
28
28
|
"typeorm": "^0.3.26",
|
|
29
29
|
"typeorm-naming-strategies": "^4.1.0"
|
|
30
30
|
},
|