podverse-orm 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.
Files changed (54) hide show
  1. package/dist/config/index.d.ts +2 -26
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/config/index.js +26 -25
  4. package/dist/config/types.d.ts +34 -0
  5. package/dist/config/types.d.ts.map +1 -0
  6. package/dist/config/types.js +7 -0
  7. package/dist/context.d.ts +20 -0
  8. package/dist/context.d.ts.map +1 -0
  9. package/dist/context.js +40 -0
  10. package/dist/db/entities.d.ts +101 -0
  11. package/dist/db/entities.d.ts.map +1 -0
  12. package/dist/db/entities.js +211 -0
  13. package/dist/db/index.d.ts +12 -3
  14. package/dist/db/index.d.ts.map +1 -1
  15. package/dist/db/index.js +63 -227
  16. package/dist/entities/account/accountMembershipStatus.d.ts +1 -0
  17. package/dist/entities/account/accountMembershipStatus.d.ts.map +1 -1
  18. package/dist/entities/account/accountMembershipStatus.js +4 -0
  19. package/dist/factories/loggerService.d.ts +1 -2
  20. package/dist/factories/loggerService.d.ts.map +1 -1
  21. package/dist/factories/loggerService.js +14 -4
  22. package/dist/factory.d.ts +24 -0
  23. package/dist/factory.d.ts.map +1 -0
  24. package/dist/factory.js +52 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +14 -0
  28. package/dist/services/account/account.d.ts +5 -3
  29. package/dist/services/account/account.d.ts.map +1 -1
  30. package/dist/services/account/account.js +43 -16
  31. package/dist/services/account/accountDataExport.d.ts +46 -0
  32. package/dist/services/account/accountDataExport.d.ts.map +1 -0
  33. package/dist/services/account/accountDataExport.js +251 -0
  34. package/dist/services/account/accountFollowingChannel.d.ts +4 -0
  35. package/dist/services/account/accountFollowingChannel.d.ts.map +1 -1
  36. package/dist/services/account/accountFollowingChannel.js +21 -3
  37. package/dist/services/account/accountProfile.d.ts.map +1 -1
  38. package/dist/services/account/accountProfile.js +16 -2
  39. package/dist/services/base/baseGetOnlyService.js +2 -2
  40. package/dist/services/base/baseManyService.d.ts +1 -0
  41. package/dist/services/base/baseManyService.d.ts.map +1 -1
  42. package/dist/services/base/baseManyService.js +20 -11
  43. package/dist/services/base/baseOneService.d.ts.map +1 -1
  44. package/dist/services/base/baseOneService.js +11 -11
  45. package/dist/services/clip.d.ts +2 -0
  46. package/dist/services/clip.d.ts.map +1 -1
  47. package/dist/services/clip.js +33 -0
  48. package/dist/services/playlist/playlist.d.ts +2 -0
  49. package/dist/services/playlist/playlist.d.ts.map +1 -1
  50. package/dist/services/playlist/playlist.js +14 -0
  51. package/dist/services/stats/statsAggregatedAccount.d.ts +4 -0
  52. package/dist/services/stats/statsAggregatedAccount.d.ts.map +1 -1
  53. package/dist/services/stats/statsAggregatedAccount.js +34 -0
  54. package/package.json +2 -2
@@ -10,15 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseOneService = void 0;
13
- const db_1 = require("@orm/db");
13
+ const context_1 = require("@orm/context");
14
14
  const applyProperties_1 = require("@orm/lib/applyProperties");
15
15
  const hasDifferentValues_1 = require("@orm/lib/hasDifferentValues");
16
- const loggerService_1 = require("@orm/factories/loggerService");
17
16
  class BaseOneService {
18
17
  constructor(entity, parentEntityKey, transactionalEntityManager) {
19
18
  this.parentEntityKey = parentEntityKey;
20
- this.repositoryRead = db_1.AppDataSourceRead.getRepository(entity);
21
- this.repositoryReadWrite = db_1.AppDataSourceReadWrite.getRepository(entity);
19
+ this.repositoryRead = (0, context_1.getDataSourceRead)().getRepository(entity);
20
+ this.repositoryReadWrite = (0, context_1.getDataSourceReadWrite)().getRepository(entity);
22
21
  this.transactionalEntityManager = transactionalEntityManager;
23
22
  }
24
23
  _get(parentEntity, config) {
@@ -31,11 +30,12 @@ class BaseOneService {
31
30
  return __awaiter(this, void 0, void 0, function* () {
32
31
  var _a;
33
32
  let entity = yield this._get(parentEntity, config);
34
- loggerService_1.loggerService.debug(`parentEntityKey: ${this.parentEntityKey}`);
35
- loggerService_1.loggerService.debug(`dto: ${dto ? JSON.stringify(dto) : 'null'}`);
36
- loggerService_1.loggerService.debug(`config: ${config ? JSON.stringify(config) : 'null'}`);
37
- loggerService_1.loggerService.debug(`Entity exists: ${!!entity}`);
38
- loggerService_1.loggerService.debug(`Entity has different values: ${entity ? (0, hasDifferentValues_1.hasDifferentValues)(entity, dto) : 'N/A'}`);
33
+ const loggerService = (0, context_1.getLoggerService)();
34
+ loggerService.debug(`parentEntityKey: ${this.parentEntityKey}`);
35
+ loggerService.debug(`dto: ${dto ? JSON.stringify(dto) : 'null'}`);
36
+ loggerService.debug(`config: ${config ? JSON.stringify(config) : 'null'}`);
37
+ loggerService.debug(`Entity exists: ${!!entity}`);
38
+ loggerService.debug(`Entity has different values: ${entity ? (0, hasDifferentValues_1.hasDifferentValues)(entity, dto) : 'N/A'}`);
39
39
  if (!entity) {
40
40
  entity = new this.repositoryReadWrite.target();
41
41
  entity[this.parentEntityKey] = parentEntity;
@@ -44,8 +44,8 @@ class BaseOneService {
44
44
  return entity;
45
45
  }
46
46
  entity = (0, applyProperties_1.applyProperties)(entity, dto);
47
- loggerService_1.loggerService.debug(`Updating entity ${JSON.stringify(entity)}`);
48
- loggerService_1.loggerService.debug(`With DTO ${JSON.stringify(dto)}`);
47
+ loggerService.debug(`Updating entity ${JSON.stringify(entity)}`);
48
+ loggerService.debug(`With DTO ${JSON.stringify(dto)}`);
49
49
  return ((_a = this.transactionalEntityManager) !== null && _a !== void 0 ? _a : this.repositoryReadWrite).save(entity);
50
50
  });
51
51
  }
@@ -23,6 +23,8 @@ export declare class ClipService extends BaseManyService<Clip, 'account'> {
23
23
  getManyByChannelAndCountPublic(channel_id_text: string, config: FindManyOptions<Clip>): Promise<[Clip[], number]>;
24
24
  getManyByItemAndCountPublic(item_id_text: string, config: FindManyOptions<Clip>): Promise<[Clip[], number]>;
25
25
  getManyByAccount(account_id: number): Promise<Clip[]>;
26
+ getManyByAccountIdTextAndCount(account_id_text: string, config: FindManyOptions<Clip>): Promise<[Clip[], number]>;
27
+ getManyByAccountIdTextPublicAndCount(account_id_text: string, config: FindManyOptions<Clip>): Promise<[Clip[], number]>;
26
28
  getRandomClip(medium_id: number): Promise<Clip | null>;
27
29
  }
28
30
  //# sourceMappingURL=clip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/services/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAa,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,EAA4B,iBAAiB,EAAsB,MAAM,kBAAkB,CAAC;AAGnG,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,qBAAa,WAAY,SAAQ,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC;IAC/D,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;gBAErB,0BAA0B,CAAC,EAAE,aAAa;IAMhD,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BvD,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CA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AAE,MAAM,CAAC,CAAC;IAiBtB,8BAA8B,CAClC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAiBtB,2BAA2B,CAC/B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAiBtB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IASrD,8BAA8B,CAClC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAkBtB,oCAAoC,CACxC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAmBtB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;CAa7D"}
@@ -160,6 +160,39 @@ class ClipService extends baseManyService_1.BaseManyService {
160
160
  return this._getAll(account);
161
161
  });
162
162
  }
163
+ getManyByAccountIdTextAndCount(account_id_text, config) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ return this.repositoryRead.findAndCount(Object.assign({ where: {
166
+ account: {
167
+ id_text: account_id_text
168
+ },
169
+ item: {
170
+ channel: {
171
+ feed: {
172
+ feed_flag_status: (0, typeorm_1.In)([__1.FeedFlagStatusStatusEnum.Active, __1.FeedFlagStatusStatusEnum.AlwaysParse])
173
+ }
174
+ }
175
+ }
176
+ } }, config));
177
+ });
178
+ }
179
+ getManyByAccountIdTextPublicAndCount(account_id_text, config) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ return this.repositoryRead.findAndCount(Object.assign({ where: {
182
+ account: {
183
+ id_text: account_id_text
184
+ },
185
+ sharable_status_id: podverse_helpers_1.SharableStatusEnum.Public,
186
+ item: {
187
+ channel: {
188
+ feed: {
189
+ feed_flag_status: (0, typeorm_1.In)([__1.FeedFlagStatusStatusEnum.Active, __1.FeedFlagStatusStatusEnum.AlwaysParse])
190
+ }
191
+ }
192
+ }
193
+ } }, config));
194
+ });
195
+ }
163
196
  getRandomClip(medium_id) {
164
197
  return __awaiter(this, void 0, void 0, function* () {
165
198
  let query = this.repositoryRead.createQueryBuilder('clip')
@@ -22,5 +22,7 @@ export declare class PlaylistService extends BaseManyService<Playlist, 'account'
22
22
  getOnePublic(playlist_id_text: string, options?: FindOneOptions<Playlist>): Promise<Playlist | null>;
23
23
  getOnePrivate(account_id_text: string, playlist_id_text: string, options?: FindOneOptions<Playlist>): Promise<Playlist | null>;
24
24
  getAllFavoritesPrivate(account_id: number): Promise<Playlist[]>;
25
+ getManyByAccountIdTextAndCount(account_id_text: string, options?: FindManyOptions<Playlist>): Promise<[Playlist[], number]>;
26
+ getManyByAccountIdTextPublicAndCount(account_id_text: string, options?: FindManyOptions<Playlist>): Promise<[Playlist[], number]>;
25
27
  }
26
28
  //# sourceMappingURL=playlist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playlist.d.ts","sourceRoot":"","sources":["../../../src/services/playlist/playlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAAE,sBAAsB,EACnE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAS,eAAe,EAAE,cAAc,EAAO,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAIrE,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,E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ASnE,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAOnG,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUvE,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,sBAAsB,GAAG,IAAI,EAC9C,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,GAClC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAE;IAe3B,YAAY,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAYpG,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAY9H,sBAAsB,CAAC,UAAU,EAAE,MAAM;IAuBzC,8BAA8B,CAClC,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,GAClC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IAY1B,oCAAoC,CACxC,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,GAClC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;CAYjC"}
@@ -118,5 +118,19 @@ class PlaylistService extends baseManyService_1.BaseManyService {
118
118
  return this.repositoryRead.find(options);
119
119
  });
120
120
  }
121
+ getManyByAccountIdTextAndCount(account_id_text, options) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ return this.repositoryRead.findAndCount(Object.assign(Object.assign({}, options), { where: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.where), { account: {
124
+ id_text: account_id_text
125
+ } }) }));
126
+ });
127
+ }
128
+ getManyByAccountIdTextPublicAndCount(account_id_text, options) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return this.repositoryRead.findAndCount(Object.assign(Object.assign({}, options), { where: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.where), { account: {
131
+ id_text: account_id_text
132
+ }, sharable_status_id: podverse_helpers_1.SharableStatusEnum.Public }) }));
133
+ });
134
+ }
121
135
  }
122
136
  exports.PlaylistService = PlaylistService;
@@ -1,9 +1,13 @@
1
+ import { FindManyOptions } from 'typeorm';
1
2
  import { StatsAggregatedAccount } from '@orm/entities/stats/statsAggregatedAccount';
2
3
  import { BaseStatsAggregatedService, UpdateHistoricalOptions } from './baseStatsAggregated';
3
4
  export declare class StatsAggregatedAccountService extends BaseStatsAggregatedService<StatsAggregatedAccount, number> {
4
5
  private statsTrackEventAccountService;
5
6
  constructor();
6
7
  protected getIdFieldName(): string;
8
+ private mergeWhere;
9
+ getMany(config: FindManyOptions<StatsAggregatedAccount>, profileType: 'global' | 'subscribed'): Promise<StatsAggregatedAccount[]>;
10
+ getManyByAccountsAndCount(account_ids: number[], config: FindManyOptions<StatsAggregatedAccount>, profileType: 'global' | 'subscribed'): Promise<[StatsAggregatedAccount[], number]>;
7
11
  updateAggregatedStats(account_id: number, updateAllTime?: boolean): Promise<void>;
8
12
  updateAggregatedStatsRolling(account_id: number, updateHistoricalOptions: UpdateHistoricalOptions): Promise<void>;
9
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"statsAggregatedAccount.d.ts","sourceRoot":"","sources":["../../../src/services/stats/statsAggregatedAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,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UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxH"}
@@ -10,6 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StatsAggregatedAccountService = void 0;
13
+ const podverse_helpers_1 = require("podverse-helpers");
14
+ const typeorm_1 = require("typeorm");
13
15
  const statsAggregatedAccount_1 = require("@orm/entities/stats/statsAggregatedAccount");
14
16
  const statsTrackEventAccount_1 = require("./statsTrackEventAccount");
15
17
  const baseStatsAggregated_1 = require("./baseStatsAggregated");
@@ -21,6 +23,38 @@ class StatsAggregatedAccountService extends baseStatsAggregated_1.BaseStatsAggre
21
23
  getIdFieldName() {
22
24
  return 'tracked_account_id';
23
25
  }
26
+ mergeWhere(profileWhere, configWhere) {
27
+ return Object.assign(Object.assign({}, (profileWhere || {})), (configWhere || {}));
28
+ }
29
+ getMany(config, profileType) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const sharableStatusIds = (0, podverse_helpers_1.getSharableStatusIdsForProfileType)(profileType);
32
+ const profileWhere = {
33
+ tracked_account: {
34
+ sharable_status: { id: (0, typeorm_1.In)(sharableStatusIds) },
35
+ account_profile: {
36
+ display_name: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
37
+ }
38
+ }
39
+ };
40
+ return this.repositoryRead.find(Object.assign(Object.assign({}, config), { where: this.mergeWhere(profileWhere, config.where) }));
41
+ });
42
+ }
43
+ getManyByAccountsAndCount(account_ids, config, profileType) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const sharableStatusIds = (0, podverse_helpers_1.getSharableStatusIdsForProfileType)(profileType);
46
+ const profileWhere = {
47
+ tracked_account_id: (0, typeorm_1.In)(account_ids),
48
+ tracked_account: {
49
+ sharable_status: { id: (0, typeorm_1.In)(sharableStatusIds) },
50
+ account_profile: {
51
+ display_name: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
52
+ }
53
+ }
54
+ };
55
+ return this.repositoryRead.findAndCount(Object.assign(Object.assign({}, config), { where: this.mergeWhere(profileWhere, config.where) }));
56
+ });
57
+ }
24
58
  updateAggregatedStats(account_id_1) {
25
59
  return __awaiter(this, arguments, void 0, function* (account_id, updateAllTime = false) {
26
60
  yield this._updateAggregatedStats(account_id, this.statsTrackEventAccountService, updateAllTime);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-orm",
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",
@@ -21,7 +21,7 @@
21
21
  "module-alias": "^2.2.3",
22
22
  "nanoid": "^5.1.6",
23
23
  "pg": "^8.16.3",
24
- "podverse-helpers": "^5.1.24-alpha.0",
24
+ "podverse-helpers": "^5.1.27-alpha.0",
25
25
  "typeorm": "^0.3.26",
26
26
  "typeorm-naming-strategies": "^4.1.0"
27
27
  },