podverse-orm 5.1.26-alpha.0 → 5.1.28-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 +2 -26
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +26 -25
- package/dist/config/types.d.ts +34 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +7 -0
- package/dist/context.d.ts +20 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +40 -0
- package/dist/db/entities.d.ts +101 -0
- package/dist/db/entities.d.ts.map +1 -0
- package/dist/db/entities.js +211 -0
- package/dist/db/index.d.ts +12 -3
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +63 -227
- package/dist/factories/loggerService.d.ts +1 -2
- package/dist/factories/loggerService.d.ts.map +1 -1
- package/dist/factories/loggerService.js +14 -4
- package/dist/factory.d.ts +24 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +52 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/services/account/account.d.ts +5 -3
- package/dist/services/account/account.d.ts.map +1 -1
- package/dist/services/account/account.js +43 -16
- package/dist/services/account/accountDataExport.d.ts +46 -0
- package/dist/services/account/accountDataExport.d.ts.map +1 -0
- package/dist/services/account/accountDataExport.js +251 -0
- package/dist/services/account/accountFollowingChannel.d.ts +4 -0
- package/dist/services/account/accountFollowingChannel.d.ts.map +1 -1
- package/dist/services/account/accountFollowingChannel.js +21 -3
- package/dist/services/account/accountProfile.d.ts.map +1 -1
- package/dist/services/account/accountProfile.js +16 -2
- package/dist/services/base/baseGetOnlyService.js +2 -2
- package/dist/services/base/baseManyService.d.ts +1 -0
- package/dist/services/base/baseManyService.d.ts.map +1 -1
- package/dist/services/base/baseManyService.js +20 -11
- package/dist/services/base/baseOneService.d.ts.map +1 -1
- package/dist/services/base/baseOneService.js +11 -11
- package/dist/services/clip.d.ts +2 -0
- package/dist/services/clip.d.ts.map +1 -1
- package/dist/services/clip.js +33 -0
- package/dist/services/playlist/playlist.d.ts +2 -0
- package/dist/services/playlist/playlist.d.ts.map +1 -1
- package/dist/services/playlist/playlist.js +14 -0
- package/dist/services/stats/statsAggregatedAccount.d.ts +4 -0
- package/dist/services/stats/statsAggregatedAccount.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedAccount.js +34 -0
- package/package.json +2 -5
package/dist/db/index.js
CHANGED
|
@@ -1,230 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppDataSourceReadWrite = exports.AppDataSourceRead = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const itemChapterLocation_1 = require("@orm/entities/item/itemChapterLocation");
|
|
58
|
-
const itemChaptersFeed_1 = require("@orm/entities/item/itemChaptersFeed");
|
|
59
|
-
const itemChaptersFeedLog_1 = require("@orm/entities/item/itemChaptersFeedLog");
|
|
60
|
-
const itemChat_1 = require("@orm/entities/item/itemChat");
|
|
61
|
-
const itemContentLink_1 = require("@orm/entities/item/itemContentLink");
|
|
62
|
-
const itemDescription_1 = require("@orm/entities/item/itemDescription");
|
|
63
|
-
const itemEnclosure_1 = require("@orm/entities/item/itemEnclosure");
|
|
64
|
-
const itemEnclosureIntegrity_1 = require("@orm/entities/item/itemEnclosureIntegrity");
|
|
65
|
-
const itemEnclosureSource_1 = require("@orm/entities/item/itemEnclosureSource");
|
|
66
|
-
const itemFlagStatus_1 = require("@orm/entities/item/itemFlagStatus");
|
|
67
|
-
const itemFunding_1 = require("@orm/entities/item/itemFunding");
|
|
68
|
-
const itemImage_1 = require("@orm/entities/item/itemImage");
|
|
69
|
-
const itemItunesEpisodeType_1 = require("@orm/entities/item/itemItunesEpisodeType");
|
|
70
|
-
const itemLicense_1 = require("@orm/entities/item/itemLicense");
|
|
71
|
-
const itemLocation_1 = require("@orm/entities/item/itemLocation");
|
|
72
|
-
const itemPerson_1 = require("@orm/entities/item/itemPerson");
|
|
73
|
-
const itemSeason_1 = require("@orm/entities/item/itemSeason");
|
|
74
|
-
const itemSeasonEpisode_1 = require("@orm/entities/item/itemSeasonEpisode");
|
|
75
|
-
const itemSocialInteract_1 = require("@orm/entities/item/itemSocialInteract");
|
|
76
|
-
const itemSoundbite_1 = require("@orm/entities/item/itemSoundbite");
|
|
77
|
-
const itemTranscript_1 = require("@orm/entities/item/itemTranscript");
|
|
78
|
-
const itemTxt_1 = require("@orm/entities/item/itemTxt");
|
|
79
|
-
const itemValue_1 = require("@orm/entities/item/itemValue");
|
|
80
|
-
const itemValueRecipient_1 = require("@orm/entities/item/itemValueRecipient");
|
|
81
|
-
const itemValueTimeSplit_1 = require("@orm/entities/item/itemValueTimeSplit");
|
|
82
|
-
const itemValueTimeSplitRecipient_1 = require("@orm/entities/item/itemValueTimeSplitRecipient");
|
|
83
|
-
const itemValueTimeSplitRemoteItem_1 = require("@orm/entities/item/itemValueTimeSplitRemoteItem");
|
|
84
|
-
const liveItem_1 = require("@orm/entities/liveItem/liveItem");
|
|
85
|
-
const liveItemStatus_1 = require("@orm/entities/liveItem/liveItemStatus");
|
|
86
|
-
const medium_1 = require("@orm/entities/medium");
|
|
87
|
-
const membershipClaimToken_1 = require("@orm/entities/membershipClaimToken");
|
|
88
|
-
const onDemandParserEvent_1 = require("@orm/entities/onDemandParserEvent");
|
|
89
|
-
const playlist_1 = require("@orm/entities/playlist/playlist");
|
|
90
|
-
const playlistResource_1 = require("@orm/entities/playlist/playlistResource");
|
|
91
|
-
const queue_1 = require("@orm/entities/queue/queue");
|
|
92
|
-
const queueResource_1 = require("@orm/entities/queue/queueResource");
|
|
93
|
-
const sharableStatus_1 = require("@orm/entities/sharableStatus");
|
|
94
|
-
const statsAggregatedChannel_1 = require("@orm/entities/stats/statsAggregatedChannel");
|
|
95
|
-
const statsTrackAccountGuid_1 = require("@orm/entities/stats/statsTrackAccountGuid");
|
|
96
|
-
const statsTrackEventChannel_1 = require("@orm/entities/stats/statsTrackEventChannel");
|
|
97
|
-
const statsAggregatedAccount_1 = require("@orm/entities/stats/statsAggregatedAccount");
|
|
98
|
-
const statsAggregatedClip_1 = require("@orm/entities/stats/statsAggregatedClip");
|
|
99
|
-
const statsAggregatedItem_1 = require("@orm/entities/stats/statsAggregatedItem");
|
|
100
|
-
const statsAggregatedPlaylist_1 = require("@orm/entities/stats/statsAggregatedPlaylist");
|
|
101
|
-
const statsTrackEventAccount_1 = require("@orm/entities/stats/statsTrackEventAccount");
|
|
102
|
-
const statsTrackEventClip_1 = require("@orm/entities/stats/statsTrackEventClip");
|
|
103
|
-
const statsTrackEventItem_1 = require("@orm/entities/stats/statsTrackEventItem");
|
|
104
|
-
const statsTrackEventPlaylist_1 = require("@orm/entities/stats/statsTrackEventPlaylist");
|
|
105
|
-
const accountNotificationChannelType_1 = require("@orm/entities/account/accountNotificationChannelType");
|
|
106
|
-
const accountSettings_1 = require("@orm/entities/account/accountSettings/accountSettings");
|
|
107
|
-
const accountSettingsNotification_1 = require("@orm/entities/account/accountSettings/accountSettingsNotification");
|
|
108
|
-
const accountSettingsNotificationType_1 = require("@orm/entities/account/accountSettings/accountSettingsNotificationType");
|
|
109
|
-
const accountSettingsLocale_1 = require("@orm/entities/account/accountSettings/accountSettingsLocale");
|
|
110
|
-
const commonConfig = {
|
|
111
|
-
type: "postgres",
|
|
112
|
-
host: config_1.config.database.host,
|
|
113
|
-
port: config_1.config.database.port,
|
|
114
|
-
database: config_1.config.database.database,
|
|
115
|
-
cache: false,
|
|
116
|
-
synchronize: false,
|
|
117
|
-
logging: false,
|
|
118
|
-
entities: [
|
|
119
|
-
account_1.Account,
|
|
120
|
-
accountAppStorePurchase_1.AccountAppStorePurchase,
|
|
121
|
-
accountCredentials_1.AccountCredentials,
|
|
122
|
-
accountEmailChangeVerification_1.AccountEmailChangeVerification,
|
|
123
|
-
accountFCMDevice_1.AccountFCMDevice,
|
|
124
|
-
accountFollowingAccount_1.AccountFollowingAccount,
|
|
125
|
-
accountFollowingAddByRSSChannel_1.AccountFollowingAddByRSSChannel,
|
|
126
|
-
accountFollowingChannel_1.AccountFollowingChannel,
|
|
127
|
-
accountFollowingPlaylist_1.AccountFollowingPlaylist,
|
|
128
|
-
accountGooglePlayPurchase_1.AccountGooglePlayPurchase,
|
|
129
|
-
accountMembership_1.AccountMembership,
|
|
130
|
-
accountMembershipStatus_1.AccountMembershipStatus,
|
|
131
|
-
accountNotificationChannel_1.AccountNotificationChannel,
|
|
132
|
-
accountNotificationChannelType_1.AccountNotificationChannelType,
|
|
133
|
-
accountPayPalOrder_1.AccountPayPalOrder,
|
|
134
|
-
accountProfile_1.AccountProfile,
|
|
135
|
-
accountResetPassword_1.AccountResetPassword,
|
|
136
|
-
accountSettings_1.AccountSettings,
|
|
137
|
-
accountSettingsLocale_1.AccountSettingsLocale,
|
|
138
|
-
accountSettingsNotification_1.AccountSettingsNotification,
|
|
139
|
-
accountSettingsNotificationType_1.AccountSettingsNotificationType,
|
|
140
|
-
accountUPDevice_1.AccountUPDevice,
|
|
141
|
-
accountWebPushDevice_1.AccountWebPushDevice,
|
|
142
|
-
accountVerification_1.AccountVerification,
|
|
143
|
-
category_1.Category,
|
|
144
|
-
channel_1.Channel,
|
|
145
|
-
channelAbout_1.ChannelAbout,
|
|
146
|
-
channelCategory_1.ChannelCategory,
|
|
147
|
-
channelChat_1.ChannelChat,
|
|
148
|
-
channelDescription_1.ChannelDescription,
|
|
149
|
-
channelFunding_1.ChannelFunding,
|
|
150
|
-
channelImage_1.ChannelImage,
|
|
151
|
-
channelInternalSettings_1.ChannelInternalSettings,
|
|
152
|
-
channelItunesType_1.ChannelItunesType,
|
|
153
|
-
channelLicense_1.ChannelLicense,
|
|
154
|
-
channelLocation_1.ChannelLocation,
|
|
155
|
-
channelPerson_1.ChannelPerson,
|
|
156
|
-
channelPodroll_1.ChannelPodroll,
|
|
157
|
-
channelPodrollRemoteItem_1.ChannelPodrollRemoteItem,
|
|
158
|
-
channelPublisher_1.ChannelPublisher,
|
|
159
|
-
channelPublisherRemoteItem_1.ChannelPublisherRemoteItem,
|
|
160
|
-
channelRemoteItem_1.ChannelRemoteItem,
|
|
161
|
-
channelSeason_1.ChannelSeason,
|
|
162
|
-
channelSocialInteract_1.ChannelSocialInteract,
|
|
163
|
-
channelTrailer_1.ChannelTrailer,
|
|
164
|
-
channelTxt_1.ChannelTxt,
|
|
165
|
-
channelValue_1.ChannelValue,
|
|
166
|
-
channelValueRecipient_1.ChannelValueRecipient,
|
|
167
|
-
clip_1.Clip,
|
|
168
|
-
feed_1.Feed,
|
|
169
|
-
feedFlagStatus_1.FeedFlagStatus,
|
|
170
|
-
feedLog_1.FeedLog,
|
|
171
|
-
item_1.Item,
|
|
172
|
-
itemAbout_1.ItemAbout,
|
|
173
|
-
itemChapter_1.ItemChapter,
|
|
174
|
-
itemChapterLocation_1.ItemChapterLocation,
|
|
175
|
-
itemChaptersFeed_1.ItemChaptersFeed,
|
|
176
|
-
itemChaptersFeedLog_1.ItemChaptersFeedLog,
|
|
177
|
-
itemChat_1.ItemChat,
|
|
178
|
-
itemContentLink_1.ItemContentLink,
|
|
179
|
-
itemDescription_1.ItemDescription,
|
|
180
|
-
itemEnclosure_1.ItemEnclosure,
|
|
181
|
-
itemEnclosureIntegrity_1.ItemEnclosureIntegrity,
|
|
182
|
-
itemEnclosureSource_1.ItemEnclosureSource,
|
|
183
|
-
itemFlagStatus_1.ItemFlagStatus,
|
|
184
|
-
itemFunding_1.ItemFunding,
|
|
185
|
-
itemImage_1.ItemImage,
|
|
186
|
-
itemItunesEpisodeType_1.ItemItunesEpisodeType,
|
|
187
|
-
itemLicense_1.ItemLicense,
|
|
188
|
-
itemLocation_1.ItemLocation,
|
|
189
|
-
itemPerson_1.ItemPerson,
|
|
190
|
-
itemSeason_1.ItemSeason,
|
|
191
|
-
itemSeasonEpisode_1.ItemSeasonEpisode,
|
|
192
|
-
itemSocialInteract_1.ItemSocialInteract,
|
|
193
|
-
itemSoundbite_1.ItemSoundbite,
|
|
194
|
-
itemTranscript_1.ItemTranscript,
|
|
195
|
-
itemTxt_1.ItemTxt,
|
|
196
|
-
itemValue_1.ItemValue,
|
|
197
|
-
itemValueRecipient_1.ItemValueRecipient,
|
|
198
|
-
itemValueTimeSplit_1.ItemValueTimeSplit,
|
|
199
|
-
itemValueTimeSplitRecipient_1.ItemValueTimeSplitRecipient,
|
|
200
|
-
itemValueTimeSplitRemoteItem_1.ItemValueTimeSplitRemoteItem,
|
|
201
|
-
liveItem_1.LiveItem,
|
|
202
|
-
liveItemStatus_1.LiveItemStatus,
|
|
203
|
-
membershipClaimToken_1.MembershipClaimToken,
|
|
204
|
-
medium_1.Medium,
|
|
205
|
-
onDemandParserEvent_1.OnDemandParserEvent,
|
|
206
|
-
playlist_1.Playlist,
|
|
207
|
-
playlistResource_1.PlaylistResource,
|
|
208
|
-
queue_1.Queue,
|
|
209
|
-
queueResource_1.QueueResource,
|
|
210
|
-
sharableStatus_1.SharableStatus,
|
|
211
|
-
statsAggregatedAccount_1.StatsAggregatedAccount,
|
|
212
|
-
statsAggregatedChannel_1.StatsAggregatedChannel,
|
|
213
|
-
statsAggregatedClip_1.StatsAggregatedClip,
|
|
214
|
-
statsAggregatedItem_1.StatsAggregatedItem,
|
|
215
|
-
statsAggregatedPlaylist_1.StatsAggregatedPlaylist,
|
|
216
|
-
statsTrackAccountGuid_1.StatsTrackAccountGuid,
|
|
217
|
-
statsTrackEventAccount_1.StatsTrackEventAccount,
|
|
218
|
-
statsTrackEventChannel_1.StatsTrackEventChannel,
|
|
219
|
-
statsTrackEventClip_1.StatsTrackEventClip,
|
|
220
|
-
statsTrackEventItem_1.StatsTrackEventItem,
|
|
221
|
-
statsTrackEventPlaylist_1.StatsTrackEventPlaylist
|
|
222
|
-
],
|
|
223
|
-
migrations: [],
|
|
224
|
-
subscribers: [],
|
|
225
|
-
namingStrategy: new typeorm_naming_strategies_1.SnakeNamingStrategy()
|
|
12
|
+
exports.AppDataSourceReadWrite = exports.AppDataSourceRead = exports.entities = void 0;
|
|
13
|
+
const context_1 = require("@orm/context");
|
|
14
|
+
// Re-export entities
|
|
15
|
+
var entities_1 = require("./entities");
|
|
16
|
+
Object.defineProperty(exports, "entities", { enumerable: true, get: function () { return entities_1.entities; } });
|
|
17
|
+
// Proxy objects that delegate to the context's DataSources
|
|
18
|
+
// This allows existing code using AppDataSourceRead.getRepository() to work
|
|
19
|
+
exports.AppDataSourceRead = {
|
|
20
|
+
get isInitialized() {
|
|
21
|
+
return (0, context_1.getDataSourceRead)().isInitialized;
|
|
22
|
+
},
|
|
23
|
+
getRepository(target) {
|
|
24
|
+
return (0, context_1.getDataSourceRead)().getRepository(target);
|
|
25
|
+
},
|
|
26
|
+
initialize() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return (0, context_1.getDataSourceRead)().initialize();
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
destroy() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return (0, context_1.getDataSourceRead)().destroy();
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
createQueryRunner() {
|
|
37
|
+
return (0, context_1.getDataSourceRead)().createQueryRunner();
|
|
38
|
+
},
|
|
39
|
+
get manager() {
|
|
40
|
+
return (0, context_1.getDataSourceRead)().manager;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.AppDataSourceReadWrite = {
|
|
44
|
+
get isInitialized() {
|
|
45
|
+
return (0, context_1.getDataSourceReadWrite)().isInitialized;
|
|
46
|
+
},
|
|
47
|
+
getRepository(target) {
|
|
48
|
+
return (0, context_1.getDataSourceReadWrite)().getRepository(target);
|
|
49
|
+
},
|
|
50
|
+
initialize() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return (0, context_1.getDataSourceReadWrite)().initialize();
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
destroy() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return (0, context_1.getDataSourceReadWrite)().destroy();
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
createQueryRunner() {
|
|
61
|
+
return (0, context_1.getDataSourceReadWrite)().createQueryRunner();
|
|
62
|
+
},
|
|
63
|
+
get manager() {
|
|
64
|
+
return (0, context_1.getDataSourceReadWrite)().manager;
|
|
65
|
+
}
|
|
226
66
|
};
|
|
227
|
-
const readConfig = Object.assign(Object.assign({}, commonConfig), { username: config_1.config.database.read_username, password: config_1.config.database.read_password });
|
|
228
|
-
const readWriteConfig = Object.assign(Object.assign({}, commonConfig), { username: config_1.config.database.read_write_username, password: config_1.config.database.read_write_password });
|
|
229
|
-
exports.AppDataSourceRead = new typeorm_1.DataSource(readConfig);
|
|
230
|
-
exports.AppDataSourceReadWrite = new typeorm_1.DataSource(readWriteConfig);
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"loggerService.d.ts","sourceRoot":"","sources":["../../src/factories/loggerService.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,gEAUxB,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loggerService = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
// Re-export logger from context for backwards compatibility
|
|
5
|
+
// Apps should use createORMContext() and access loggerService from the returned context
|
|
6
|
+
const context_1 = require("@orm/context");
|
|
7
|
+
// Export a proxy object that delegates to the context's logger service
|
|
8
|
+
exports.loggerService = new Proxy({}, {
|
|
9
|
+
get(_target, prop) {
|
|
10
|
+
const logger = (0, context_1.getLoggerService)();
|
|
11
|
+
const value = logger[prop];
|
|
12
|
+
// If it's a function, bind it to the logger instance
|
|
13
|
+
if (typeof value === 'function') {
|
|
14
|
+
return value.bind(logger);
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
8
18
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DataSource } from "typeorm";
|
|
2
|
+
import { LoggerService } from "podverse-helpers/dist/lib/backend/logger";
|
|
3
|
+
import { ORMConfig } from "./config/types";
|
|
4
|
+
export type ORMContext = {
|
|
5
|
+
config: ORMConfig;
|
|
6
|
+
dataSourceRead: DataSource;
|
|
7
|
+
dataSourceReadWrite: DataSource;
|
|
8
|
+
loggerService: LoggerService;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Creates an ORM context with the provided configuration.
|
|
12
|
+
* This is the factory function that should be called from the app level.
|
|
13
|
+
*
|
|
14
|
+
* The DataSources are NOT initialized - call dataSourceRead.initialize() and
|
|
15
|
+
* dataSourceReadWrite.initialize() after creating the context.
|
|
16
|
+
*
|
|
17
|
+
* This function also sets the module-level context so that services can access
|
|
18
|
+
* the DataSources and logger without needing to pass them explicitly.
|
|
19
|
+
*
|
|
20
|
+
* @param config - The ORM configuration (from app-level env vars)
|
|
21
|
+
* @returns ORMContext with DataSources and logger (not yet initialized)
|
|
22
|
+
*/
|
|
23
|
+
export declare function createORMContext(config: ORMConfig): ORMContext;
|
|
24
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,MAAM,SAAS,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,cAAc,EAAE,UAAU,CAAC;IAC3B,mBAAmB,EAAE,UAAU,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CA6C9D"}
|
package/dist/factory.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createORMContext = createORMContext;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const typeorm_naming_strategies_1 = require("typeorm-naming-strategies");
|
|
6
|
+
const logger_1 = require("podverse-helpers/dist/lib/backend/logger");
|
|
7
|
+
const entities_1 = require("./db/entities");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
/**
|
|
10
|
+
* Creates an ORM context with the provided configuration.
|
|
11
|
+
* This is the factory function that should be called from the app level.
|
|
12
|
+
*
|
|
13
|
+
* The DataSources are NOT initialized - call dataSourceRead.initialize() and
|
|
14
|
+
* dataSourceReadWrite.initialize() after creating the context.
|
|
15
|
+
*
|
|
16
|
+
* This function also sets the module-level context so that services can access
|
|
17
|
+
* the DataSources and logger without needing to pass them explicitly.
|
|
18
|
+
*
|
|
19
|
+
* @param config - The ORM configuration (from app-level env vars)
|
|
20
|
+
* @returns ORMContext with DataSources and logger (not yet initialized)
|
|
21
|
+
*/
|
|
22
|
+
function createORMContext(config) {
|
|
23
|
+
const commonConfig = {
|
|
24
|
+
type: "postgres",
|
|
25
|
+
host: config.database.host,
|
|
26
|
+
port: config.database.port,
|
|
27
|
+
database: config.database.database,
|
|
28
|
+
cache: false,
|
|
29
|
+
synchronize: false,
|
|
30
|
+
logging: false,
|
|
31
|
+
entities: entities_1.entities,
|
|
32
|
+
migrations: [],
|
|
33
|
+
subscribers: [],
|
|
34
|
+
namingStrategy: new typeorm_naming_strategies_1.SnakeNamingStrategy()
|
|
35
|
+
};
|
|
36
|
+
const readConfig = Object.assign(Object.assign({}, commonConfig), { username: config.database.read_username, password: config.database.read_password });
|
|
37
|
+
const readWriteConfig = Object.assign(Object.assign({}, commonConfig), { username: config.database.read_write_username, password: config.database.read_write_password });
|
|
38
|
+
const dataSourceRead = new typeorm_1.DataSource(readConfig);
|
|
39
|
+
const dataSourceReadWrite = new typeorm_1.DataSource(readWriteConfig);
|
|
40
|
+
const loggerService = new logger_1.LoggerService({
|
|
41
|
+
logLevel: config.log.level
|
|
42
|
+
});
|
|
43
|
+
const context = {
|
|
44
|
+
config,
|
|
45
|
+
dataSourceRead,
|
|
46
|
+
dataSourceReadWrite,
|
|
47
|
+
loggerService,
|
|
48
|
+
};
|
|
49
|
+
// Set the module-level context so services can access it
|
|
50
|
+
(0, context_1.setORMContext)(context);
|
|
51
|
+
return context;
|
|
52
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import './module-alias-config';
|
|
2
2
|
export type { FindManyOptions, FindOptionsWhere, FindOptionsOrder } from 'typeorm';
|
|
3
3
|
export * from './config';
|
|
4
|
+
export { createORMContext, ORMContext } from './factory';
|
|
5
|
+
export { getDataSourceRead, getDataSourceReadWrite, getLoggerService, getORMConfig } from './context';
|
|
4
6
|
export * from './db';
|
|
5
7
|
export * from './entities/account/account';
|
|
6
8
|
export * from './entities/account/accountAppStorePurchase';
|
|
@@ -108,6 +110,7 @@ export * from './lib/nanoid';
|
|
|
108
110
|
export * from './services/category';
|
|
109
111
|
export * from './services/account/account';
|
|
110
112
|
export * from './services/account/accountCredentials';
|
|
113
|
+
export * from './services/account/accountDataExport';
|
|
111
114
|
export * from './services/account/accountEmailChangeVerification';
|
|
112
115
|
export * from './services/account/accountFCMDevice';
|
|
113
116
|
export * from './services/account/accountFollowingAccount';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAE/B,YAAY,EACV,eAAe,EACf,gBA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,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAE7D,cAAc,8BAA8B,CAAC;AAE7C,cAAc,mBAAmB,CAAC;AAElC,cAAc,iCAAiC,CAAC;AAEhD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,cAAc,0BAA0B,CAAC;AAEzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getORMConfig = exports.getLoggerService = exports.getDataSourceReadWrite = exports.getDataSourceRead = exports.createORMContext = void 0;
|
|
17
18
|
require("./module-alias-config");
|
|
19
|
+
// Config types for app-level configuration
|
|
18
20
|
__exportStar(require("./config"), exports);
|
|
21
|
+
// Factory function to create the ORM context
|
|
22
|
+
var factory_1 = require("./factory");
|
|
23
|
+
Object.defineProperty(exports, "createORMContext", { enumerable: true, get: function () { return factory_1.createORMContext; } });
|
|
24
|
+
// Context accessors for advanced use cases
|
|
25
|
+
var context_1 = require("./context");
|
|
26
|
+
Object.defineProperty(exports, "getDataSourceRead", { enumerable: true, get: function () { return context_1.getDataSourceRead; } });
|
|
27
|
+
Object.defineProperty(exports, "getDataSourceReadWrite", { enumerable: true, get: function () { return context_1.getDataSourceReadWrite; } });
|
|
28
|
+
Object.defineProperty(exports, "getLoggerService", { enumerable: true, get: function () { return context_1.getLoggerService; } });
|
|
29
|
+
Object.defineProperty(exports, "getORMConfig", { enumerable: true, get: function () { return context_1.getORMConfig; } });
|
|
30
|
+
// DB exports (proxies to context for backwards compatibility)
|
|
19
31
|
__exportStar(require("./db"), exports);
|
|
20
32
|
__exportStar(require("./entities/account/account"), exports);
|
|
21
33
|
__exportStar(require("./entities/account/accountAppStorePurchase"), exports);
|
|
@@ -123,6 +135,7 @@ __exportStar(require("./lib/nanoid"), exports);
|
|
|
123
135
|
__exportStar(require("./services/category"), exports);
|
|
124
136
|
__exportStar(require("./services/account/account"), exports);
|
|
125
137
|
__exportStar(require("./services/account/accountCredentials"), exports);
|
|
138
|
+
__exportStar(require("./services/account/accountDataExport"), exports);
|
|
126
139
|
__exportStar(require("./services/account/accountEmailChangeVerification"), exports);
|
|
127
140
|
__exportStar(require("./services/account/accountFCMDevice"), exports);
|
|
128
141
|
__exportStar(require("./services/account/accountFollowingAccount"), exports);
|
|
@@ -7,9 +7,9 @@ type CreateAccountDto = {
|
|
|
7
7
|
locale: string;
|
|
8
8
|
};
|
|
9
9
|
type UpdateAccountDto = {
|
|
10
|
-
display_name
|
|
11
|
-
bio
|
|
12
|
-
sharable_status
|
|
10
|
+
display_name: string | null;
|
|
11
|
+
bio: string | null;
|
|
12
|
+
sharable_status: SharableStatusEnum;
|
|
13
13
|
locale: string;
|
|
14
14
|
};
|
|
15
15
|
export declare class AccountService {
|
|
@@ -20,6 +20,8 @@ export declare class AccountService {
|
|
|
20
20
|
getByEmail(email: string, config?: FindOneOptions<Account>): Promise<Account | null>;
|
|
21
21
|
getByIdText(id_text: string, config?: FindOneOptions<Account>): Promise<Account | null>;
|
|
22
22
|
getMany(config: FindManyOptions<Account>): Promise<Account[]>;
|
|
23
|
+
getManyPublic(config: FindManyOptions<Account>): Promise<Account[]>;
|
|
24
|
+
getManySubscribed(accountIds: number[], config: FindManyOptions<Account>): Promise<Account[]>;
|
|
23
25
|
create(dto: CreateAccountDto, qaVerified?: boolean): Promise<void>;
|
|
24
26
|
update(account_id: number, dto: UpdateAccountDto): Promise<Account | null>;
|
|
25
27
|
verifyEmail(id: number): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/services/account/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/services/account/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,kBAAkB,EACiC,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAgBxD,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,eAAe,EAAE,kBAAkB,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AASF,qBAAa,cAAc;IACzB,SAAS,CAAC,cAAc,EAA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 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AccountService = void 0;
|
|
13
13
|
const podverse_helpers_1 = require("podverse-helpers");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
14
15
|
const account_1 = require("@orm/entities/account/account");
|
|
15
16
|
const db_1 = require("@orm/db");
|
|
16
17
|
const sharableStatus_1 = require("@orm/entities/sharableStatus");
|
|
@@ -20,6 +21,7 @@ const accountMembershipStatus_1 = require("./accountMembershipStatus");
|
|
|
20
21
|
const accountVerification_1 = require("./accountVerification");
|
|
21
22
|
const accountResetPassword_1 = require("./accountResetPassword");
|
|
22
23
|
const accountProfile_1 = require("./accountProfile");
|
|
24
|
+
const accountProfile_2 = require("@orm/entities/account/accountProfile");
|
|
23
25
|
const accountSettings_1 = require("@orm/entities/account/accountSettings/accountSettings");
|
|
24
26
|
const accountSettingsLocale_1 = require("@orm/entities/account/accountSettings/accountSettingsLocale");
|
|
25
27
|
const accountSettingsNotification_1 = require("@orm/entities/account/accountSettings/accountSettingsNotification");
|
|
@@ -78,6 +80,25 @@ class AccountService {
|
|
|
78
80
|
return this.repositoryRead.find(config);
|
|
79
81
|
});
|
|
80
82
|
}
|
|
83
|
+
getManyPublic(config) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const sharableStatusIds = (0, podverse_helpers_1.getSharableStatusIdsForProfileType)('global');
|
|
86
|
+
return this.repositoryRead.find(Object.assign(Object.assign({}, config), { where: Object.assign(Object.assign({}, config.where), { sharable_status: { id: (0, typeorm_1.In)(sharableStatusIds) }, account_profile: {
|
|
87
|
+
display_name: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
|
|
88
|
+
} }) }));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
getManySubscribed(accountIds, config) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
if (accountIds.length === 0) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
const sharableStatusIds = (0, podverse_helpers_1.getSharableStatusIdsForProfileType)('subscribed');
|
|
97
|
+
return this.repositoryRead.find(Object.assign(Object.assign({}, config), { where: Object.assign(Object.assign({}, config.where), { id: (0, typeorm_1.In)(accountIds), sharable_status: { id: (0, typeorm_1.In)(sharableStatusIds) }, account_profile: {
|
|
98
|
+
display_name: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
|
|
99
|
+
} }) }));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
81
102
|
create(dto, qaVerified) {
|
|
82
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
104
|
if (!(0, podverse_helpers_1.validateEmail)(dto.email)) {
|
|
@@ -102,6 +123,13 @@ class AccountService {
|
|
|
102
123
|
});
|
|
103
124
|
const account = yield this.repositoryReadWrite.save(accountObj);
|
|
104
125
|
yield this.ensureAccountSettings(account, { alwaysCreate: true, locale: dto.locale });
|
|
126
|
+
// Create account_profile row with null display_name and bio
|
|
127
|
+
const accountProfileRepo = db_1.AppDataSourceReadWrite.getRepository(accountProfile_2.AccountProfile);
|
|
128
|
+
const accountProfile = new accountProfile_2.AccountProfile();
|
|
129
|
+
accountProfile.account = account;
|
|
130
|
+
accountProfile.display_name = null;
|
|
131
|
+
accountProfile.bio = null;
|
|
132
|
+
yield accountProfileRepo.save(accountProfile);
|
|
105
133
|
const saltedPassword = yield (0, password_1.hashPassword)(dto.password);
|
|
106
134
|
yield accountCredentialsService.update(account, {
|
|
107
135
|
email: dto.email,
|
|
@@ -122,23 +150,22 @@ class AccountService {
|
|
|
122
150
|
if (!account) {
|
|
123
151
|
throw new Error('Account not found');
|
|
124
152
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
throw new Error('SharableStatus not found');
|
|
138
|
-
}
|
|
139
|
-
account.sharable_status = sharableStatus;
|
|
140
|
-
yield this.repositoryReadWrite.save(account);
|
|
153
|
+
// Always update account profile
|
|
154
|
+
const accountProfileService = new accountProfile_1.AccountProfileService();
|
|
155
|
+
const accountProfileDto = {
|
|
156
|
+
display_name: dto.display_name,
|
|
157
|
+
bio: dto.bio
|
|
158
|
+
};
|
|
159
|
+
yield accountProfileService.update(account, accountProfileDto);
|
|
160
|
+
// Always update sharable status
|
|
161
|
+
const sharableStatusRepository = db_1.AppDataSourceRead.getRepository(sharableStatus_1.SharableStatus);
|
|
162
|
+
const sharableStatus = yield sharableStatusRepository.findOne({ where: { id: dto.sharable_status } });
|
|
163
|
+
if (!sharableStatus) {
|
|
164
|
+
throw new Error('SharableStatus not found');
|
|
141
165
|
}
|
|
166
|
+
account.sharable_status = sharableStatus;
|
|
167
|
+
yield this.repositoryReadWrite.save(account);
|
|
168
|
+
// Always update locale
|
|
142
169
|
const accountSettings = yield db_1.AppDataSourceReadWrite.getRepository(accountSettings_1.AccountSettings).findOne({
|
|
143
170
|
where: { account_id },
|
|
144
171
|
relations: ['account_settings_locale']
|