podverse-parser 5.0.9 → 5.1.0-alpha.1

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 (129) hide show
  1. package/dist/config/index.d.ts +11 -0
  2. package/dist/config/index.d.ts.map +1 -0
  3. package/dist/config/index.js +13 -0
  4. package/dist/factories/podcastIndex.d.ts +3 -0
  5. package/dist/factories/podcastIndex.d.ts.map +1 -0
  6. package/dist/factories/podcastIndex.js +9 -0
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +3 -2
  10. package/dist/lib/chapters/chapters.d.ts.map +1 -1
  11. package/dist/lib/compat/chapters/chapters.d.ts.map +1 -1
  12. package/dist/lib/compat/chapters/chapters.js +3 -2
  13. package/dist/lib/compat/partytime/channel.d.ts +6 -3
  14. package/dist/lib/compat/partytime/channel.d.ts.map +1 -1
  15. package/dist/lib/compat/partytime/channel.js +48 -37
  16. package/dist/lib/compat/partytime/item.d.ts +30 -9
  17. package/dist/lib/compat/partytime/item.d.ts.map +1 -1
  18. package/dist/lib/compat/partytime/item.js +66 -35
  19. package/dist/lib/compat/partytime/liveItem.d.ts.map +1 -1
  20. package/dist/lib/compat/partytime/liveItem.js +8 -1
  21. package/dist/lib/compat/partytime/value.d.ts.map +1 -1
  22. package/dist/lib/compat/partytime/value.js +1 -1
  23. package/dist/lib/notifications/index.d.ts +8 -0
  24. package/dist/lib/notifications/index.d.ts.map +1 -0
  25. package/dist/lib/notifications/index.js +48 -0
  26. package/dist/lib/rss/base/handleParsedManyData.d.ts.map +1 -1
  27. package/dist/lib/rss/base/handleParsedOneData.d.ts.map +1 -1
  28. package/dist/lib/rss/channel/channel.d.ts.map +1 -1
  29. package/dist/lib/rss/channel/channel.js +32 -27
  30. package/dist/lib/rss/channel/channelAbout.d.ts +1 -1
  31. package/dist/lib/rss/channel/channelAbout.d.ts.map +1 -1
  32. package/dist/lib/rss/channel/channelAbout.js +3 -0
  33. package/dist/lib/rss/channel/channelCategory.d.ts +4 -0
  34. package/dist/lib/rss/channel/channelCategory.d.ts.map +1 -0
  35. package/dist/lib/rss/channel/channelCategory.js +28 -0
  36. package/dist/lib/rss/channel/channelChat.d.ts +1 -1
  37. package/dist/lib/rss/channel/channelChat.d.ts.map +1 -1
  38. package/dist/lib/rss/channel/channelChat.js +3 -0
  39. package/dist/lib/rss/channel/channelDescription.d.ts +1 -1
  40. package/dist/lib/rss/channel/channelDescription.d.ts.map +1 -1
  41. package/dist/lib/rss/channel/channelDescription.js +3 -0
  42. package/dist/lib/rss/channel/channelFunding.d.ts +1 -1
  43. package/dist/lib/rss/channel/channelFunding.d.ts.map +1 -1
  44. package/dist/lib/rss/channel/channelFunding.js +3 -0
  45. package/dist/lib/rss/channel/channelImage.d.ts +1 -1
  46. package/dist/lib/rss/channel/channelImage.d.ts.map +1 -1
  47. package/dist/lib/rss/channel/channelImage.js +3 -0
  48. package/dist/lib/rss/channel/channelLicense.d.ts +1 -1
  49. package/dist/lib/rss/channel/channelLicense.d.ts.map +1 -1
  50. package/dist/lib/rss/channel/channelLicense.js +3 -0
  51. package/dist/lib/rss/channel/channelLocation.d.ts +1 -1
  52. package/dist/lib/rss/channel/channelLocation.d.ts.map +1 -1
  53. package/dist/lib/rss/channel/channelLocation.js +3 -0
  54. package/dist/lib/rss/channel/channelPerson.d.ts +1 -1
  55. package/dist/lib/rss/channel/channelPerson.d.ts.map +1 -1
  56. package/dist/lib/rss/channel/channelPerson.js +3 -0
  57. package/dist/lib/rss/channel/channelPodroll.d.ts +1 -1
  58. package/dist/lib/rss/channel/channelPodroll.d.ts.map +1 -1
  59. package/dist/lib/rss/channel/channelPodroll.js +3 -0
  60. package/dist/lib/rss/channel/channelPublisher.d.ts +4 -0
  61. package/dist/lib/rss/channel/channelPublisher.d.ts.map +1 -0
  62. package/dist/lib/rss/channel/channelPublisher.js +31 -0
  63. package/dist/lib/rss/channel/channelRemoteItem.d.ts +1 -1
  64. package/dist/lib/rss/channel/channelRemoteItem.d.ts.map +1 -1
  65. package/dist/lib/rss/channel/channelRemoteItem.js +3 -0
  66. package/dist/lib/rss/channel/channelSeason.d.ts.map +1 -1
  67. package/dist/lib/rss/channel/channelSeason.js +3 -0
  68. package/dist/lib/rss/channel/channelSocialInteract.d.ts +1 -1
  69. package/dist/lib/rss/channel/channelSocialInteract.d.ts.map +1 -1
  70. package/dist/lib/rss/channel/channelSocialInteract.js +3 -0
  71. package/dist/lib/rss/channel/channelTrailer.d.ts +1 -1
  72. package/dist/lib/rss/channel/channelTrailer.d.ts.map +1 -1
  73. package/dist/lib/rss/channel/channelTrailer.js +4 -1
  74. package/dist/lib/rss/channel/channelTxt.d.ts +1 -1
  75. package/dist/lib/rss/channel/channelTxt.d.ts.map +1 -1
  76. package/dist/lib/rss/channel/channelTxt.js +3 -0
  77. package/dist/lib/rss/channel/channelValue.d.ts +1 -1
  78. package/dist/lib/rss/channel/channelValue.d.ts.map +1 -1
  79. package/dist/lib/rss/channel/channelValue.js +3 -0
  80. package/dist/lib/rss/feed/feed.d.ts +2 -1
  81. package/dist/lib/rss/feed/feed.d.ts.map +1 -1
  82. package/dist/lib/rss/feed/feed.js +33 -14
  83. package/dist/lib/rss/hash/parsedFeed.d.ts.map +1 -1
  84. package/dist/lib/rss/item/item.d.ts +36 -3
  85. package/dist/lib/rss/item/item.d.ts.map +1 -1
  86. package/dist/lib/rss/item/item.js +153 -22
  87. package/dist/lib/rss/item/itemAbout.d.ts +1 -1
  88. package/dist/lib/rss/item/itemAbout.d.ts.map +1 -1
  89. package/dist/lib/rss/item/itemChaptersFeed.d.ts +1 -1
  90. package/dist/lib/rss/item/itemChaptersFeed.d.ts.map +1 -1
  91. package/dist/lib/rss/item/itemChat.d.ts +1 -1
  92. package/dist/lib/rss/item/itemChat.d.ts.map +1 -1
  93. package/dist/lib/rss/item/itemDescription.d.ts +1 -1
  94. package/dist/lib/rss/item/itemDescription.d.ts.map +1 -1
  95. package/dist/lib/rss/item/itemEnclosure.d.ts +1 -1
  96. package/dist/lib/rss/item/itemEnclosure.d.ts.map +1 -1
  97. package/dist/lib/rss/item/itemImage.d.ts +1 -1
  98. package/dist/lib/rss/item/itemImage.d.ts.map +1 -1
  99. package/dist/lib/rss/item/itemLicense.d.ts +1 -1
  100. package/dist/lib/rss/item/itemLicense.d.ts.map +1 -1
  101. package/dist/lib/rss/item/itemLocation.d.ts +1 -1
  102. package/dist/lib/rss/item/itemLocation.d.ts.map +1 -1
  103. package/dist/lib/rss/item/itemPerson.d.ts +1 -1
  104. package/dist/lib/rss/item/itemPerson.d.ts.map +1 -1
  105. package/dist/lib/rss/item/itemSeason.d.ts +1 -1
  106. package/dist/lib/rss/item/itemSeason.d.ts.map +1 -1
  107. package/dist/lib/rss/item/itemSeasonEpisode.d.ts +1 -1
  108. package/dist/lib/rss/item/itemSeasonEpisode.d.ts.map +1 -1
  109. package/dist/lib/rss/item/itemSocialInteract.d.ts +1 -1
  110. package/dist/lib/rss/item/itemSocialInteract.d.ts.map +1 -1
  111. package/dist/lib/rss/item/itemSoundbite.d.ts +1 -1
  112. package/dist/lib/rss/item/itemSoundbite.d.ts.map +1 -1
  113. package/dist/lib/rss/item/itemTranscript.d.ts +1 -1
  114. package/dist/lib/rss/item/itemTranscript.d.ts.map +1 -1
  115. package/dist/lib/rss/item/itemTxt.d.ts +1 -1
  116. package/dist/lib/rss/item/itemTxt.d.ts.map +1 -1
  117. package/dist/lib/rss/item/itemValue.d.ts +2 -2
  118. package/dist/lib/rss/item/itemValue.d.ts.map +1 -1
  119. package/dist/lib/rss/item/itemValue.js +7 -1
  120. package/dist/lib/rss/liveItem/liveItem.d.ts +4 -1
  121. package/dist/lib/rss/liveItem/liveItem.d.ts.map +1 -1
  122. package/dist/lib/rss/liveItem/liveItem.js +45 -14
  123. package/dist/lib/rss/parser.d.ts +0 -1
  124. package/dist/lib/rss/parser.d.ts.map +1 -1
  125. package/dist/lib/rss/parser.js +50 -45
  126. package/dist/lib/rss/remoteItemParser.d.ts +3 -0
  127. package/dist/lib/rss/remoteItemParser.d.ts.map +1 -0
  128. package/dist/lib/rss/remoteItemParser.js +121 -0
  129. package/package.json +4 -4
@@ -0,0 +1,11 @@
1
+ export declare const config: {
2
+ nodeEnv: string;
3
+ shouldLogTimer: boolean;
4
+ userAgent: string;
5
+ podcastIndex: {
6
+ authKey: string;
7
+ baseUrl: string;
8
+ secretKey: string;
9
+ };
10
+ };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;CASlB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ exports.config = {
5
+ nodeEnv: process.env.NODE_ENV || 'development',
6
+ shouldLogTimer: process.env.LOG_TIMER === 'true',
7
+ userAgent: process.env.USER_AGENT || '',
8
+ podcastIndex: {
9
+ authKey: process.env.PODCAST_INDEX_AUTH_KEY || '',
10
+ baseUrl: process.env.PODCAST_INDEX_BASE_URL || '',
11
+ secretKey: process.env.PODCAST_INDEX_SECRET_KEY || ''
12
+ }
13
+ };
@@ -0,0 +1,3 @@
1
+ import { PodcastIndexService } from 'podverse-external-services';
2
+ export declare const podcastIndexService: PodcastIndexService;
3
+ //# sourceMappingURL=podcastIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"podcastIndex.d.ts","sourceRoot":"","sources":["../../src/factories/podcastIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE,eAAO,MAAM,mBAAmB,qBAA2D,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.podcastIndexService = void 0;
4
+ const podverse_external_services_1 = require("podverse-external-services");
5
+ const config_1 = require("@parser/config");
6
+ const authKey = config_1.config.podcastIndex.authKey || '';
7
+ const baseUrl = config_1.config.podcastIndex.baseUrl || '';
8
+ const secretKey = config_1.config.podcastIndex.secretKey || '';
9
+ exports.podcastIndexService = new podverse_external_services_1.PodcastIndexService({ authKey, baseUrl, secretKey });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import './module-alias-config';
2
- export { parseAllRSSFeeds, parseRSSFeedAndSaveToDatabase } from './lib/rss/parser';
2
+ export { parseChapters } from './lib/chapters/chapters';
3
+ export { parseRSSFeedAndSaveToDatabase } from './lib/rss/parser';
3
4
  //# 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,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC"}
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,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRSSFeedAndSaveToDatabase = exports.parseAllRSSFeeds = void 0;
3
+ exports.parseRSSFeedAndSaveToDatabase = exports.parseChapters = void 0;
4
4
  require("./module-alias-config");
5
+ var chapters_1 = require("./lib/chapters/chapters");
6
+ Object.defineProperty(exports, "parseChapters", { enumerable: true, get: function () { return chapters_1.parseChapters; } });
5
7
  var parser_1 = require("./lib/rss/parser");
6
- Object.defineProperty(exports, "parseAllRSSFeeds", { enumerable: true, get: function () { return parser_1.parseAllRSSFeeds; } });
7
8
  Object.defineProperty(exports, "parseRSSFeedAndSaveToDatabase", { enumerable: true, get: function () { return parser_1.parseRSSFeedAndSaveToDatabase; } });
@@ -1 +1 @@
1
- {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../src/lib/chapters/chapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAoE,MAAM,cAAc,CAAC;AA2BtG,eAAO,MAAM,aAAa,SAAgB,IAAI,KAAG,OAAO,CAAC,IAAI,CAyB5D,CAAC"}
1
+ {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../src/lib/chapters/chapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAoE,MAAM,cAAc,CAAC;AA2BtG,eAAO,MAAM,aAAa,GAAU,MAAM,IAAI,KAAG,OAAO,CAAC,IAAI,CAyB5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/chapters/chapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAED,eAAO,MAAM,oBAAoB,aAAc,SAAS,EAAE,KAAG,cAAc,EAW1E,CAAC"}
1
+ {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/chapters/chapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,UAAU,SAAS,EAAE,KAAG,cAAc,EAW1E,CAAC"}
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.compatParsedChapters = void 0;
4
+ const podverse_helpers_1 = require("podverse-helpers");
4
5
  const compatParsedChapters = (chapters) => {
5
6
  return chapters.map(chapter => {
6
7
  return {
7
8
  start_time: chapter.startTime,
8
9
  end_time: chapter.endTime || null,
9
10
  title: chapter.title || null,
10
- img: chapter.img || null,
11
- web_url: chapter.url || null,
11
+ img: (0, podverse_helpers_1.isValidHttpUrl)(chapter.img) && chapter.img || null,
12
+ web_url: (0, podverse_helpers_1.isValidHttpUrl)(chapter.url) && chapter.url || null,
12
13
  table_of_contents: chapter.toc || true
13
14
  };
14
15
  });
@@ -3,7 +3,7 @@ export declare const compatChannelDto: (parsedFeed: FeedObject) => {
3
3
  podcast_guid: string | null;
4
4
  title: string | null;
5
5
  sortable_title: string | null;
6
- medium: import("podverse-orm").MediumEnum | null;
6
+ medium: import("podverse-helpers").MediumEnum | null;
7
7
  };
8
8
  export declare const compatChannelAboutDto: (parsedFeed: FeedObject) => {
9
9
  author: string | null;
@@ -14,6 +14,9 @@ export declare const compatChannelAboutDto: (parsedFeed: FeedObject) => {
14
14
  episode_count: number;
15
15
  last_pub_date: Date;
16
16
  };
17
+ export declare const compatChannelCategoryDtos: (parsedFeed: FeedObject) => {
18
+ category_id: import("podverse-helpers").CategoryEnum;
19
+ }[];
17
20
  export declare const compatChannelChatDto: (parsedFeed: FeedObject) => {
18
21
  server: string | null;
19
22
  protocol: string;
@@ -28,7 +31,7 @@ export declare const compatChannelFundingDtos: (parsedFeed: FeedObject) => {
28
31
  title: string | null;
29
32
  }[];
30
33
  export declare const compatChannelImageDtos: (parsedFeed: FeedObject) => ({
31
- url: string;
34
+ url: string | undefined;
32
35
  image_width_size: null;
33
36
  } | {
34
37
  url: string;
@@ -82,7 +85,7 @@ export declare const compatChannelSeasonDtos: (parsedFeed: FeedObject) => {
82
85
  export declare const compatChannelTrailerDtos: (parsedFeed: FeedObject) => {
83
86
  url: string;
84
87
  title: null;
85
- pubdate: Date;
88
+ pub_date: Date;
86
89
  length: number | null;
87
90
  type: string | null;
88
91
  season: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAO7D,eAAO,MAAM,gBAAgB,eAAgB,UAAU;;;;;CAKrD,CAAC;AAEH,eAAO,MAAM,qBAAqB,eAAgB,UAAU;;;;;;;;CAmB1D,CAAC;AAEH,eAAO,MAAM,oBAAoB,eAAgB,UAAU;;;;;QAU1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,UAAU;;QAOjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;GAe9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAgB,UAAU;;;;;;IA8B5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;QAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;;QAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;;;;GAkB7D,CAAC;AAEF,eAAO,MAAM,kCAAkC,eAAgB,UAAU;;;;;GAiBxE,CAAC;AAEF,eAAO,MAAM,oCAAoC,eAAgB,UAAU;;;;;GAiB1E,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,UAAU;;;;;GAiBjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,eAAgB,UAAU;;;;;;GAiBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;GA0B7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;;;;;GAgB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,UAAU;;;GAY1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAgB,UAAU;;;;;;;;;;;;;;;GAiB5D,CAAC"}
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAO7D,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU;;;;;CAKrD,CAAC;AAEH,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU;;;;;;;;CAmB1D,CAAC;AAEH,eAAO,MAAM,yBAAyB,GAAI,YAAY,UAAU;;GAU/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;;;QAU1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;QAOjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;GAe9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;IA8B5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;QAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;QAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;;;;GAkB7D,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,YAAY,UAAU;;;;;GAgBxE,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAAI,YAAY,UAAU;;;;;GAa1E,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;;;;GAiBjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,YAAY,UAAU;;;;;;GAiBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;GA0B7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;;;;GAkB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;GAY1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;;;;;;;;;;GAiB5D,CAAC"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compatChannelValueDtos = exports.compatChannelTxtDtos = exports.compatChannelTrailerDtos = exports.compatChannelSeasonDtos = exports.compatChannelSocialInteractDtos = exports.compatChannelRemoteItemDtos = exports.compatChannelPublisherRemoteItemDtos = exports.compatChannelPodrollRemoteItemDtos = exports.compatChannelPersonDtos = exports.compatChannelLocationDto = exports.compatChannelLicenseDto = exports.compatChannelImageDtos = exports.compatChannelFundingDtos = exports.compatChannelDescriptionDto = exports.compatChannelChatDto = exports.compatChannelAboutDto = exports.compatChannelDto = void 0;
3
+ exports.compatChannelValueDtos = exports.compatChannelTxtDtos = exports.compatChannelTrailerDtos = exports.compatChannelSeasonDtos = exports.compatChannelSocialInteractDtos = exports.compatChannelRemoteItemDtos = exports.compatChannelPublisherRemoteItemDtos = exports.compatChannelPodrollRemoteItemDtos = exports.compatChannelPersonDtos = exports.compatChannelLocationDto = exports.compatChannelLicenseDto = exports.compatChannelImageDtos = exports.compatChannelFundingDtos = exports.compatChannelDescriptionDto = exports.compatChannelChatDto = exports.compatChannelCategoryDtos = exports.compatChannelAboutDto = exports.compatChannelDto = void 0;
4
4
  const podcast_partytime_1 = require("podcast-partytime");
5
5
  const podverse_helpers_1 = require("podverse-helpers");
6
- const podverse_helpers_2 = require("podverse-helpers");
7
6
  const podverse_orm_1 = require("podverse-orm");
8
7
  const value_1 = require("@parser/lib/compat/partytime/value");
9
8
  const compatChannelDto = (parsedFeed) => {
@@ -11,8 +10,8 @@ const compatChannelDto = (parsedFeed) => {
11
10
  return ({
12
11
  podcast_guid: ((_a = parsedFeed.guid) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid)) || null,
13
12
  title: ((_b = parsedFeed.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
14
- sortable_title: ((_c = (0, podverse_helpers_2.createSortableTitle)(parsedFeed.title)) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
15
- medium: (0, podverse_orm_1.getMediumEnumValue)((_d = parsedFeed.medium) !== null && _d !== void 0 ? _d : podcast_partytime_1.Phase4Medium.Podcast)
13
+ sortable_title: ((_c = (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title)) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
14
+ medium: (0, podverse_helpers_1.getMediumEnumValue)((_d = parsedFeed.medium) !== null && _d !== void 0 ? _d : podcast_partytime_1.Phase4Medium.Podcast)
16
15
  });
17
16
  };
18
17
  exports.compatChannelDto = compatChannelDto;
@@ -23,9 +22,9 @@ const compatChannelAboutDto = (parsedFeed) => {
23
22
  ? parsedFeed.author
24
23
  : parsedFeed.author
25
24
  ? [parsedFeed.author] : [])) === null || _a === void 0 ? void 0 : _a.join(', '))) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
26
- explicit: (0, podverse_helpers_2.getBooleanOrNull)(parsedFeed.explicit),
25
+ explicit: (0, podverse_helpers_1.getBooleanOrNull)(parsedFeed.explicit),
27
26
  language: ((_c = parsedFeed.language) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
28
- website_link_url: ((_d = parsedFeed.link) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
27
+ website_link_url: (0, podverse_helpers_1.isValidHttpUrl)(parsedFeed.link) && ((_d = parsedFeed.link) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
29
28
  itunes_type: (0, podverse_orm_1.getChannelItunesTypeItunesTypeEnumValue)(parsedFeed.itunesType || 'episodic'),
30
29
  episode_count: ((_e = parsedFeed.items) === null || _e === void 0 ? void 0 : _e.length) || 0,
31
30
  last_pub_date: ((_f = parsedFeed.items) === null || _f === void 0 ? void 0 : _f.reduce((latest, item) => {
@@ -38,6 +37,19 @@ const compatChannelAboutDto = (parsedFeed) => {
38
37
  });
39
38
  };
40
39
  exports.compatChannelAboutDto = compatChannelAboutDto;
40
+ const compatChannelCategoryDtos = (parsedFeed) => {
41
+ var _a;
42
+ return ((_a = parsedFeed.itunesCategory) === null || _a === void 0 ? void 0 : _a.map((category) => {
43
+ let processedCategory = category.toLowerCase();
44
+ if (processedCategory.includes('>')) {
45
+ processedCategory = processedCategory.split('>').pop().trim();
46
+ }
47
+ processedCategory = processedCategory.replace(/&|&/g, 'and').replace(/-/g, '').replace(/\s+/g, '');
48
+ const category_id = (0, podverse_helpers_1.getCategoryEnumValue)(processedCategory);
49
+ return category_id ? { category_id } : null;
50
+ }).filter(category => category !== null)) || [];
51
+ };
52
+ exports.compatChannelCategoryDtos = compatChannelCategoryDtos;
41
53
  const compatChannelChatDto = (parsedFeed) => {
42
54
  var _a, _b, _c;
43
55
  if (!parsedFeed.chat) {
@@ -65,7 +77,7 @@ const compatChannelFundingDtos = (parsedFeed) => {
65
77
  const dtos = [];
66
78
  if (Array.isArray(parsedFeed.podcastFunding)) {
67
79
  for (const f of parsedFeed.podcastFunding) {
68
- if (f.url) {
80
+ if ((0, podverse_helpers_1.isValidHttpUrl)(f.url)) {
69
81
  dtos.push({
70
82
  url: (_a = f.url) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
71
83
  title: ((_b = f.message) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
@@ -77,17 +89,17 @@ const compatChannelFundingDtos = (parsedFeed) => {
77
89
  };
78
90
  exports.compatChannelFundingDtos = compatChannelFundingDtos;
79
91
  const compatChannelImageDtos = (parsedFeed) => {
80
- var _a;
92
+ var _a, _b, _c;
81
93
  const dtos = [];
82
- if (parsedFeed.itunesImage) {
94
+ if ((0, podverse_helpers_1.isValidHttpUrl)(parsedFeed.itunesImage)) {
83
95
  dtos.push({
84
- url: parsedFeed.itunesImage.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
96
+ url: (_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.itunesImage) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
85
97
  image_width_size: null
86
98
  });
87
99
  }
88
- else if ((_a = parsedFeed.image) === null || _a === void 0 ? void 0 : _a.url) {
100
+ else if ((0, podverse_helpers_1.isValidHttpUrl)((_b = parsedFeed.image) === null || _b === void 0 ? void 0 : _b.url)) {
89
101
  dtos.push({
90
- url: parsedFeed.image.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
102
+ url: (_c = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.image) === null || _c === void 0 ? void 0 : _c.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
91
103
  image_width_size: null
92
104
  });
93
105
  }
@@ -114,7 +126,7 @@ const compatChannelLicenseDto = (parsedFeed) => {
114
126
  }
115
127
  return {
116
128
  identifier: parsedFeed.license.identifier.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
117
- url: ((_b = parsedFeed.license.url) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
129
+ url: (0, podverse_helpers_1.isValidHttpUrl)(parsedFeed.license.url) && ((_b = parsedFeed.license.url) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
118
130
  };
119
131
  };
120
132
  exports.compatChannelLicenseDto = compatChannelLicenseDto;
@@ -140,8 +152,8 @@ const compatChannelPersonDtos = (parsedFeed) => {
140
152
  name: p.name.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
141
153
  role: ((_b = (_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
142
154
  person_group: ((_d = (_c = p.group) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || 'cast',
143
- img: ((_e = p.img) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
144
- href: ((_f = p.href) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
155
+ img: (0, podverse_helpers_1.isValidHttpUrl)(p.img) && ((_e = p.img) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
156
+ href: (0, podverse_helpers_1.isValidHttpUrl)(p.href) && ((_f = p.href) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
145
157
  });
146
158
  }
147
159
  }
@@ -157,7 +169,7 @@ const compatChannelPodrollRemoteItemDtos = (parsedFeed) => {
157
169
  if (ri.feedGuid) {
158
170
  dtos.push({
159
171
  feed_guid: ri.feedGuid.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid),
160
- feed_url: ((_a = ri.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
172
+ feed_url: (0, podverse_helpers_1.isValidHttpUrl)(ri.feedUrl) && ((_a = ri.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
161
173
  item_guid: null,
162
174
  title: /* PTDO: ri.title || */ null
163
175
  });
@@ -170,17 +182,14 @@ exports.compatChannelPodrollRemoteItemDtos = compatChannelPodrollRemoteItemDtos;
170
182
  const compatChannelPublisherRemoteItemDtos = (parsedFeed) => {
171
183
  var _a;
172
184
  const dtos = [];
173
- if (Array.isArray(parsedFeed.podroll)) {
174
- for (const ri of parsedFeed.podroll) {
175
- if (ri.feedGuid) {
176
- dtos.push({
177
- feed_guid: ri.feedGuid.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid),
178
- feed_url: ((_a = ri.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
179
- item_guid: null,
180
- title: /* PTDO: ri.title || */ null
181
- });
182
- }
183
- }
185
+ const publisherRemoteItem = parsedFeed.podcastPublisher;
186
+ if (publisherRemoteItem === null || publisherRemoteItem === void 0 ? void 0 : publisherRemoteItem.feedGuid) {
187
+ dtos.push({
188
+ feed_guid: publisherRemoteItem.feedGuid.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid),
189
+ feed_url: (0, podverse_helpers_1.isValidHttpUrl)(publisherRemoteItem.feedUrl) && ((_a = publisherRemoteItem.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
190
+ item_guid: null,
191
+ title: /* PTDO: ri.title || */ null
192
+ });
184
193
  }
185
194
  return dtos;
186
195
  };
@@ -193,7 +202,7 @@ const compatChannelRemoteItemDtos = (parsedFeed) => {
193
202
  if (ri.feedGuid) {
194
203
  dtos.push({
195
204
  feed_guid: ri.feedGuid.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid),
196
- feed_url: ((_a = ri.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
205
+ feed_url: (0, podverse_helpers_1.isValidHttpUrl)(ri.feedUrl) && ((_a = ri.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
197
206
  item_guid: null,
198
207
  title: /* PTDO: ri.title || */ null
199
208
  });
@@ -213,7 +222,7 @@ const compatChannelSocialInteractDtos = (parsedFeed) => {
213
222
  protocol: ps.platform.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
214
223
  uri: ps.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri),
215
224
  account_id: ((_b = ps.id) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
216
- account_url: ((_c = ps.name) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
225
+ account_url: (0, podverse_helpers_1.isValidHttpUrl)(ps.url) && ((_c = ps.url) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
217
226
  priority: ps.priority || null
218
227
  });
219
228
  }
@@ -250,14 +259,16 @@ const compatChannelTrailerDtos = (parsedFeed) => {
250
259
  const dtos = [];
251
260
  if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.trailers) === null || _a === void 0 ? void 0 : _a.length) {
252
261
  for (const pt of parsedFeed.trailers) {
253
- dtos.push({
254
- url: pt.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
255
- title: /* PTDO: add pt.title || */ null,
256
- pubdate: pt.pubdate,
257
- length: pt.length || null,
258
- type: ((_b = pt.type) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
259
- season: pt.season || null
260
- });
262
+ if ((0, podverse_helpers_1.isValidHttpUrl)(pt.url)) {
263
+ dtos.push({
264
+ url: pt.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
265
+ title: /* PTDO: add pt.title || */ null,
266
+ pub_date: pt.pubdate,
267
+ length: pt.length || null,
268
+ type: ((_b = pt.type) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
269
+ season: pt.season || null
270
+ });
271
+ }
261
272
  }
262
273
  }
263
274
  return dtos;
@@ -1,8 +1,11 @@
1
1
  import type { Episode } from 'podcast-partytime';
2
- export declare const compatItemDto: (parsedItem: Episode) => {
2
+ type CompatItemDtoOptions = {
3
+ isLiveItem?: boolean;
4
+ };
5
+ export declare const compatItemDto: (parsedItem: Episode, options?: CompatItemDtoOptions) => {
3
6
  guid: string | null;
4
- guid_enclosure_url: string;
5
- pubdate: Date | null;
7
+ guid_enclosure_url: string | null;
8
+ pub_date: Date | null;
6
9
  title: string | null;
7
10
  };
8
11
  export declare const compatItemAboutDto: (parsedItem: Episode) => {
@@ -12,7 +15,7 @@ export declare const compatItemAboutDto: (parsedItem: Episode) => {
12
15
  item_itunes_episode_type: import("podverse-orm").ItemItunesEpisodeTypeEnum;
13
16
  };
14
17
  export declare const compatItemChaptersFeedDto: (parsedItem: Episode) => {
15
- url: string;
18
+ url: string | null;
16
19
  type: string;
17
20
  } | null;
18
21
  export declare const compatItemChatDto: (parsedItem: Episode) => {
@@ -24,7 +27,24 @@ export declare const compatItemChatDto: (parsedItem: Episode) => {
24
27
  export declare const compatItemDescriptionDto: (parsedItem: Episode) => {
25
28
  value: string;
26
29
  } | null;
27
- export declare const compatItemEnclosureDtos: (parsedItem: Episode) => {
30
+ export declare const compatItemEnclosureDtos: (parsedItem: Episode) => ({
31
+ item_enclosure: {
32
+ type: string;
33
+ length: number | null;
34
+ bitrate: null;
35
+ height: null;
36
+ language: null;
37
+ title: null;
38
+ rel: null;
39
+ codecs: null;
40
+ item_enclosure_default: boolean;
41
+ };
42
+ item_enclosure_integrity: null;
43
+ item_enclosure_sources: {
44
+ uri: string;
45
+ content_type: null;
46
+ }[];
47
+ } | {
28
48
  item_enclosure: {
29
49
  type: string;
30
50
  length: number | null;
@@ -41,9 +61,9 @@ export declare const compatItemEnclosureDtos: (parsedItem: Episode) => {
41
61
  uri: string;
42
62
  content_type: string;
43
63
  }[];
44
- }[];
64
+ })[];
45
65
  export declare const compatItemImageDtos: (parsedItem: Episode) => ({
46
- url: string;
66
+ url: string | undefined;
47
67
  image_width_size: null;
48
68
  } | {
49
69
  url: string;
@@ -66,12 +86,12 @@ export declare const compatItemPersonDtos: (parsedItem: Episode) => {
66
86
  href: string | null;
67
87
  }[];
68
88
  export declare const compatItemSeasonDto: (parsedItem: Episode) => {
69
- number: number;
89
+ number: number | undefined;
70
90
  title: string | null;
71
91
  } | null;
72
92
  export declare const compatItemSeasonEpisodeDto: (parsedItem: Episode) => {
73
93
  display: string | null;
74
- number: number;
94
+ number: number | undefined;
75
95
  } | null;
76
96
  export declare const compatItemSocialInteractDtos: (parsedItem: Episode) => {
77
97
  protocol: string;
@@ -143,4 +163,5 @@ export declare const compatItemValueDtos: (parsedItem: Episode) => {
143
163
  item_value_time_splits_remote_item: null;
144
164
  })[];
145
165
  }[];
166
+ export {};
146
167
  //# sourceMappingURL=item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD,eAAO,MAAM,aAAa,eAAgB,OAAO;;;;;CAK/C,CAAC;AAEH,eAAO,MAAM,kBAAkB,eAAgB,OAAO;;;;;CAKpD,CAAC;AAEH,eAAO,MAAM,yBAAyB,eAAgB,OAAO;;;QAO5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAgB,OAAO;;;;;QAUpD,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,OAAO;;QAO3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,OAAO;;;;;;;;;;;;;;;;;GAyC1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,OAAO;;;;;;IA8BtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,OAAO;;;QAQvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,eAAgB,OAAO;;;;QAUxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,OAAO;;;;;;GAkBvD,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,OAAO;;;QAStD,CAAC;AAEF,eAAO,MAAM,0BAA0B,eAAgB,OAAO;;;QAS7D,CAAC;AAEF,eAAO,MAAM,4BAA4B,eAAgB,OAAO;;;;;;GAiB/D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,OAAO;;;;GAc1D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,OAAO;;;;;GAe3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAgB,OAAO;;;GAapD,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBtD,CAAC"}
1
+ {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD,KAAK,oBAAoB,GAAG;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,YAAY,OAAO,EAAE,UAAU,oBAAoB;;;;;CAQ/E,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,YAAY,OAAO;;;;;CAKpD,CAAC;AAEH,eAAO,MAAM,yBAAyB,GAAI,YAAY,OAAO;;;QAO5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAAY,OAAO;;;;;QAUpD,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,OAAO;;QAO3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuE1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,OAAO;;;;;;IA8BtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,OAAO;;;QAQvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,OAAO;;;;QAUxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,OAAO;;;;;;GAkBvD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,OAAO;;;QAStD,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,YAAY,OAAO;;;QAS7D,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,YAAY,OAAO;;;;;;GAiB/D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,OAAO;;;;GAc1D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,OAAO;;;;;GAiB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,YAAY,OAAO;;;GAapD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBtD,CAAC"}
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.compatItemValueDtos = exports.compatItemTxtDtos = exports.compatItemTranscriptDtos = exports.compatItemSoundbiteDtos = exports.compatItemSocialInteractDtos = exports.compatItemSeasonEpisodeDto = exports.compatItemSeasonDto = exports.compatItemPersonDtos = exports.compatItemLocationDto = exports.compatItemLicenseDto = exports.compatItemImageDtos = exports.compatItemEnclosureDtos = exports.compatItemDescriptionDto = exports.compatItemChatDto = exports.compatItemChaptersFeedDto = exports.compatItemAboutDto = exports.compatItemDto = void 0;
4
4
  const podverse_helpers_1 = require("podverse-helpers");
5
5
  const podverse_orm_1 = require("podverse-orm");
6
- const value_1 = require("./value");
7
- const compatItemDto = (parsedItem) => {
6
+ const value_1 = require("@parser/lib/compat/partytime/value");
7
+ const compatItemDto = (parsedItem, options) => {
8
8
  var _a, _b;
9
9
  return ({
10
10
  guid: ((_a = parsedItem.guid) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
11
- guid_enclosure_url: parsedItem.enclosure.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
12
- pubdate: parsedItem.pubDate || null,
11
+ guid_enclosure_url: !(options === null || options === void 0 ? void 0 : options.isLiveItem)
12
+ && (0, podverse_helpers_1.isValidHttpUrl)(parsedItem.enclosure.url)
13
+ && (0, podverse_helpers_1.formatGuidEnclosureUrl)(parsedItem.enclosure.url)
14
+ || null,
15
+ pub_date: parsedItem.pubDate || null,
13
16
  title: ((_b = parsedItem.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
14
17
  });
15
18
  };
@@ -19,18 +22,18 @@ const compatItemAboutDto = (parsedItem) => {
19
22
  return ({
20
23
  duration: ((_a = parsedItem.duration) === null || _a === void 0 ? void 0 : _a.toFixed(2)) || null,
21
24
  explicit: parsedItem.explicit || false,
22
- website_link_url: ((_b = parsedItem.link) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
25
+ website_link_url: (0, podverse_helpers_1.isValidHttpUrl)(parsedItem.link) && ((_b = parsedItem.link) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
23
26
  item_itunes_episode_type: (0, podverse_orm_1.getItemItunesEpisodeTypeEnumValue)(parsedItem.itunesEpisodeType || 'full')
24
27
  });
25
28
  };
26
29
  exports.compatItemAboutDto = compatItemAboutDto;
27
30
  const compatItemChaptersFeedDto = (parsedItem) => {
28
- var _a, _b, _c, _d;
31
+ var _a, _b, _c, _d, _e;
29
32
  if (!((_a = parsedItem.podcastChapters) === null || _a === void 0 ? void 0 : _a.url) && !((_b = parsedItem.podcastChapters) === null || _b === void 0 ? void 0 : _b.type))
30
33
  return null;
31
34
  return {
32
- url: (_c = parsedItem.podcastChapters) === null || _c === void 0 ? void 0 : _c.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
33
- type: (_d = parsedItem.podcastChapters) === null || _d === void 0 ? void 0 : _d.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)
35
+ url: (0, podverse_helpers_1.isValidHttpUrl)((_c = parsedItem.podcastChapters) === null || _c === void 0 ? void 0 : _c.url) && ((_d = parsedItem.podcastChapters) === null || _d === void 0 ? void 0 : _d.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)),
36
+ type: (_e = parsedItem.podcastChapters) === null || _e === void 0 ? void 0 : _e.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)
34
37
  };
35
38
  };
36
39
  exports.compatItemChaptersFeedDto = compatItemChaptersFeedDto;
@@ -57,8 +60,33 @@ const compatItemDescriptionDto = (parsedItem) => {
57
60
  };
58
61
  exports.compatItemDescriptionDto = compatItemDescriptionDto;
59
62
  const compatItemEnclosureDtos = (parsedItem) => {
60
- var _a, _b, _c, _d;
63
+ var _a, _b, _c, _d, _e, _f;
61
64
  const dtos = [];
65
+ // Create item_enclosure_default dto separately
66
+ if ((_a = parsedItem.enclosure) === null || _a === void 0 ? void 0 : _a.url) {
67
+ const item_enclosure = {
68
+ type: (_b = parsedItem.enclosure.type) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
69
+ length: parsedItem.enclosure.length || null,
70
+ bitrate: null,
71
+ height: null,
72
+ language: null,
73
+ title: null,
74
+ rel: null,
75
+ codecs: null,
76
+ item_enclosure_default: true
77
+ };
78
+ const item_enclosure_integrity = null;
79
+ const item_enclosure_sources = [{
80
+ uri: parsedItem.enclosure.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri),
81
+ content_type: null
82
+ }];
83
+ const formattedDto = {
84
+ item_enclosure,
85
+ item_enclosure_integrity,
86
+ item_enclosure_sources
87
+ };
88
+ dtos.push(formattedDto);
89
+ }
62
90
  if (parsedItem.alternativeEnclosures && parsedItem.alternativeEnclosures.length > 0) {
63
91
  for (const alternativeEnclosure of parsedItem.alternativeEnclosures) {
64
92
  const item_enclosure = {
@@ -66,10 +94,10 @@ const compatItemEnclosureDtos = (parsedItem) => {
66
94
  length: alternativeEnclosure.length || null,
67
95
  bitrate: alternativeEnclosure.bitrate || null,
68
96
  height: alternativeEnclosure.height || null,
69
- language: ((_a = alternativeEnclosure.lang) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
70
- title: ((_b = alternativeEnclosure.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
71
- rel: ((_c = alternativeEnclosure.rel) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
72
- codecs: ((_d = alternativeEnclosure.codecs) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
97
+ language: ((_c = alternativeEnclosure.lang) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
98
+ title: ((_d = alternativeEnclosure.title) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
99
+ rel: ((_e = alternativeEnclosure.rel) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
100
+ codecs: ((_f = alternativeEnclosure.codecs) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
73
101
  item_enclosure_default: false
74
102
  };
75
103
  /*
@@ -95,16 +123,17 @@ const compatItemEnclosureDtos = (parsedItem) => {
95
123
  };
96
124
  exports.compatItemEnclosureDtos = compatItemEnclosureDtos;
97
125
  const compatItemImageDtos = (parsedItem) => {
126
+ var _a, _b;
98
127
  const dtos = [];
99
- if (parsedItem.itunesImage) {
128
+ if ((0, podverse_helpers_1.isValidHttpUrl)(parsedItem.itunesImage)) {
100
129
  dtos.push({
101
- url: parsedItem.itunesImage.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
130
+ url: (_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.itunesImage) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
102
131
  image_width_size: null
103
132
  });
104
133
  }
105
- else if (parsedItem.image) {
134
+ else if ((0, podverse_helpers_1.isValidHttpUrl)(parsedItem.image)) {
106
135
  dtos.push({
107
- url: parsedItem.image.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
136
+ url: (_b = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.image) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
108
137
  image_width_size: null
109
138
  });
110
139
  }
@@ -131,7 +160,7 @@ const compatItemLicenseDto = (parsedItem) => {
131
160
  }
132
161
  return {
133
162
  identifier: parsedItem.license.identifier.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
134
- url: ((_b = parsedItem.license.url) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
163
+ url: (0, podverse_helpers_1.isValidHttpUrl)(parsedItem.license.url) && ((_b = parsedItem.license.url) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
135
164
  };
136
165
  };
137
166
  exports.compatItemLicenseDto = compatItemLicenseDto;
@@ -157,8 +186,8 @@ const compatItemPersonDtos = (parsedItem) => {
157
186
  name: p.name.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
158
187
  role: ((_b = (_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
159
188
  person_group: ((_d = (_c = p.group) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || 'cast',
160
- img: ((_e = p.img) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
161
- href: ((_f = p.href) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
189
+ img: (0, podverse_helpers_1.isValidHttpUrl)(p.img) && ((_e = p.img) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
190
+ href: (0, podverse_helpers_1.isValidHttpUrl)(p.href) && ((_f = p.href) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
162
191
  });
163
192
  }
164
193
  }
@@ -167,24 +196,24 @@ const compatItemPersonDtos = (parsedItem) => {
167
196
  };
168
197
  exports.compatItemPersonDtos = compatItemPersonDtos;
169
198
  const compatItemSeasonDto = (parsedItem) => {
170
- var _a, _b;
171
- if (!((_a = parsedItem.podcastSeason) === null || _a === void 0 ? void 0 : _a.number)) {
199
+ var _a, _b, _c, _d;
200
+ if (!((_a = parsedItem.podcastSeason) === null || _a === void 0 ? void 0 : _a.number) && !parsedItem.itunesSeason) {
172
201
  return null;
173
202
  }
174
203
  return {
175
- number: parsedItem.podcastSeason.number,
176
- title: ((_b = parsedItem.podcastSeason.name) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
204
+ number: ((_b = parsedItem.podcastSeason) === null || _b === void 0 ? void 0 : _b.number) || parsedItem.itunesSeason,
205
+ title: ((_d = (_c = parsedItem.podcastSeason) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
177
206
  };
178
207
  };
179
208
  exports.compatItemSeasonDto = compatItemSeasonDto;
180
209
  const compatItemSeasonEpisodeDto = (parsedItem) => {
181
- var _a;
182
- if (!parsedItem.podcastEpisode) {
210
+ var _a, _b, _c;
211
+ if (!parsedItem.podcastEpisode && !parsedItem.itunesEpisode) {
183
212
  return null;
184
213
  }
185
214
  return {
186
- display: ((_a = parsedItem.podcastEpisode.display) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
187
- number: parsedItem.podcastEpisode.number
215
+ display: ((_b = (_a = parsedItem.podcastEpisode) === null || _a === void 0 ? void 0 : _a.display) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
216
+ number: ((_c = parsedItem.podcastEpisode) === null || _c === void 0 ? void 0 : _c.number) || parsedItem.itunesEpisode,
188
217
  };
189
218
  };
190
219
  exports.compatItemSeasonEpisodeDto = compatItemSeasonEpisodeDto;
@@ -198,7 +227,7 @@ const compatItemSocialInteractDtos = (parsedItem) => {
198
227
  protocol: ps.platform.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
199
228
  uri: ps.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri),
200
229
  account_id: ((_b = ps.id) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
201
- account_url: ((_c = ps.profileUrl) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
230
+ account_url: (0, podverse_helpers_1.isValidHttpUrl)(ps.profileUrl) && ((_c = ps.profileUrl) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
202
231
  priority: ps.priority || null
203
232
  });
204
233
  }
@@ -226,12 +255,14 @@ const compatItemTranscriptDtos = (parsedItem) => {
226
255
  const dtos = [];
227
256
  if ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastTranscripts) === null || _a === void 0 ? void 0 : _a.length) {
228
257
  for (const t of parsedItem.podcastTranscripts) {
229
- dtos.push({
230
- url: t.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
231
- type: t.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
232
- language: ((_b = t.language) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
233
- rel: ((_c = t.rel) === null || _c === void 0 ? void 0 : _c.slice(0, 50)) || null
234
- });
258
+ if ((0, podverse_helpers_1.isValidHttpUrl)(t.url)) {
259
+ dtos.push({
260
+ url: t.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
261
+ type: t.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
262
+ language: ((_b = t.language) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
263
+ rel: ((_c = t.rel) === null || _c === void 0 ? void 0 : _c.slice(0, 50)) || null
264
+ });
265
+ }
235
266
  }
236
267
  }
237
268
  return dtos;