podverse-helpers 5.1.2-alpha.8 → 5.1.3-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 (240) hide show
  1. package/dist/dtos/betweenParams.d.ts +5 -0
  2. package/dist/dtos/betweenParams.d.ts.map +1 -0
  3. package/dist/dtos/betweenParams.js +2 -0
  4. package/dist/dtos/channel/channel.d.ts +1 -1
  5. package/dist/dtos/channel/channel.d.ts.map +1 -1
  6. package/dist/dtos/channel/channelCategory.d.ts +6 -0
  7. package/dist/dtos/channel/channelCategory.d.ts.map +1 -1
  8. package/dist/dtos/channel/channelPodroll.d.ts +2 -0
  9. package/dist/dtos/channel/channelPodroll.d.ts.map +1 -1
  10. package/dist/dtos/channel/channelValue.d.ts +2 -1
  11. package/dist/dtos/channel/channelValue.d.ts.map +1 -1
  12. package/dist/dtos/channel/channelValueRecipient.d.ts +0 -1
  13. package/dist/dtos/channel/channelValueRecipient.d.ts.map +1 -1
  14. package/dist/dtos/index.d.ts +12 -0
  15. package/dist/dtos/index.d.ts.map +1 -1
  16. package/dist/dtos/index.js +12 -0
  17. package/dist/dtos/item/item.d.ts +53 -0
  18. package/dist/dtos/item/item.d.ts.map +1 -1
  19. package/dist/dtos/item/itemChapter.d.ts +3 -0
  20. package/dist/dtos/item/itemChapter.d.ts.map +1 -1
  21. package/dist/dtos/item/itemChaptersFeed.d.ts +2 -0
  22. package/dist/dtos/item/itemChaptersFeed.d.ts.map +1 -1
  23. package/dist/dtos/item/itemEnclosure.d.ts +4 -0
  24. package/dist/dtos/item/itemEnclosure.d.ts.map +1 -1
  25. package/dist/dtos/item/itemImage.d.ts +1 -1
  26. package/dist/dtos/item/itemImage.d.ts.map +1 -1
  27. package/dist/dtos/item/itemSoundbite.d.ts +2 -0
  28. package/dist/dtos/item/itemSoundbite.d.ts.map +1 -1
  29. package/dist/dtos/item/itemTranscript.d.ts +9 -0
  30. package/dist/dtos/item/itemTranscript.d.ts.map +1 -1
  31. package/dist/dtos/item/itemValue.d.ts +2 -0
  32. package/dist/dtos/item/itemValue.d.ts.map +1 -1
  33. package/dist/dtos/liveItem/liveItem.d.ts +8 -1
  34. package/dist/dtos/liveItem/liveItem.d.ts.map +1 -1
  35. package/dist/dtos/liveItem/liveItem.js +7 -0
  36. package/dist/dtos/mediaPlayer/playbackMode.d.ts +2 -0
  37. package/dist/dtos/mediaPlayer/playbackMode.d.ts.map +1 -0
  38. package/dist/dtos/mediaPlayer/playbackMode.js +2 -0
  39. package/dist/dtos/mediaPlayer/playbackSpeed.d.ts +5 -0
  40. package/dist/dtos/mediaPlayer/playbackSpeed.d.ts.map +1 -0
  41. package/dist/dtos/mediaPlayer/playbackSpeed.js +27 -0
  42. package/dist/dtos/playlist/playlist.d.ts +38 -0
  43. package/dist/dtos/playlist/playlist.d.ts.map +1 -1
  44. package/dist/dtos/playlist/playlist.js +31 -0
  45. package/dist/dtos/playlist/playlistResource.d.ts +20 -0
  46. package/dist/dtos/playlist/playlistResource.d.ts.map +1 -1
  47. package/dist/dtos/podcast-index/podcastByGuid.d.ts +73 -0
  48. package/dist/dtos/podcast-index/podcastByGuid.d.ts.map +1 -0
  49. package/dist/dtos/podcast-index/podcastByGuid.js +2 -0
  50. package/dist/dtos/podcast-index/podcastById.d.ts +48 -0
  51. package/dist/dtos/podcast-index/podcastById.d.ts.map +1 -0
  52. package/dist/dtos/podcast-index/podcastById.js +2 -0
  53. package/dist/dtos/podcast-index/podcastsByTag.d.ts +68 -0
  54. package/dist/dtos/podcast-index/podcastsByTag.d.ts.map +1 -0
  55. package/dist/dtos/podcast-index/podcastsByTag.js +2 -0
  56. package/dist/dtos/podcast-index/searchPodcasts.d.ts +51 -0
  57. package/dist/dtos/podcast-index/searchPodcasts.d.ts.map +1 -0
  58. package/dist/dtos/podcast-index/searchPodcasts.js +2 -0
  59. package/dist/dtos/podcast-index/valueBatchByEpisodeGuid.d.ts +37 -0
  60. package/dist/dtos/podcast-index/valueBatchByEpisodeGuid.d.ts.map +1 -0
  61. package/dist/dtos/podcast-index/valueBatchByEpisodeGuid.js +2 -0
  62. package/dist/dtos/podcast-index/valueByEpisodeGuid.d.ts +32 -0
  63. package/dist/dtos/podcast-index/valueByEpisodeGuid.d.ts.map +1 -0
  64. package/dist/dtos/podcast-index/valueByEpisodeGuid.js +2 -0
  65. package/dist/dtos/podroll.d.ts +10 -0
  66. package/dist/dtos/podroll.d.ts.map +1 -0
  67. package/dist/dtos/podroll.js +3 -0
  68. package/dist/dtos/queue/queue.d.ts +4 -0
  69. package/dist/dtos/queue/queue.d.ts.map +1 -1
  70. package/dist/dtos/queue/queueResource.d.ts +17 -0
  71. package/dist/dtos/queue/queueResource.d.ts.map +1 -1
  72. package/dist/dtos/queue/queueResourceAbridged.d.ts +31 -0
  73. package/dist/dtos/queue/queueResourceAbridged.d.ts.map +1 -0
  74. package/dist/dtos/queue/queueResourceAbridged.js +2 -0
  75. package/dist/dtos/queueExtraParams.d.ts +6 -0
  76. package/dist/dtos/queueExtraParams.d.ts.map +1 -0
  77. package/dist/dtos/queueExtraParams.js +2 -0
  78. package/dist/index.d.ts +16 -8
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +17 -8
  81. package/dist/lib/backend/index.d.ts +3 -0
  82. package/dist/lib/backend/index.d.ts.map +1 -0
  83. package/dist/lib/backend/index.js +18 -0
  84. package/dist/lib/bitrate.d.ts +6 -0
  85. package/dist/lib/bitrate.d.ts.map +1 -0
  86. package/dist/lib/bitrate.js +9 -0
  87. package/dist/lib/comparison/isEqual.d.ts +2 -0
  88. package/dist/lib/comparison/isEqual.d.ts.map +1 -0
  89. package/dist/lib/comparison/isEqual.js +23 -0
  90. package/dist/lib/date.d.ts +3 -1
  91. package/dist/lib/date.d.ts.map +1 -1
  92. package/dist/lib/date.js +19 -3
  93. package/dist/lib/error/index.d.ts +2 -0
  94. package/dist/lib/error/index.d.ts.map +1 -0
  95. package/dist/lib/error/index.js +17 -0
  96. package/dist/lib/fileSize.d.ts +2 -0
  97. package/dist/lib/fileSize.d.ts.map +1 -0
  98. package/dist/lib/fileSize.js +31 -0
  99. package/dist/lib/html.d.ts +3 -0
  100. package/dist/lib/html.d.ts.map +1 -0
  101. package/dist/lib/html.js +18 -0
  102. package/dist/lib/i18n/index.d.ts +2 -0
  103. package/dist/lib/i18n/index.d.ts.map +1 -0
  104. package/dist/lib/i18n/index.js +17 -0
  105. package/dist/lib/i18n/timeFormatter.d.ts +2 -0
  106. package/dist/lib/i18n/timeFormatter.d.ts.map +1 -0
  107. package/dist/lib/i18n/timeFormatter.js +47 -0
  108. package/dist/lib/image.d.ts +12 -0
  109. package/dist/lib/image.d.ts.map +1 -0
  110. package/dist/lib/image.js +103 -0
  111. package/dist/lib/item/item.d.ts.map +1 -0
  112. package/dist/lib/{item.js → item/item.js} +1 -1
  113. package/dist/lib/item/itemEnclosure.d.ts +29 -0
  114. package/dist/lib/item/itemEnclosure.d.ts.map +1 -0
  115. package/dist/lib/item/itemEnclosure.js +139 -0
  116. package/dist/lib/liveItem/liveItemEnclosure.d.ts +8 -0
  117. package/dist/lib/liveItem/liveItemEnclosure.d.ts.map +1 -0
  118. package/dist/lib/liveItem/liveItemEnclosure.js +48 -0
  119. package/dist/lib/medium.d.ts +7 -2
  120. package/dist/lib/medium.d.ts.map +1 -1
  121. package/dist/lib/medium.js +8 -23
  122. package/dist/lib/mq/mqConstants.d.ts +11 -0
  123. package/dist/lib/mq/mqConstants.d.ts.map +1 -0
  124. package/dist/lib/mq/mqConstants.js +26 -0
  125. package/dist/lib/pagination.d.ts +5 -0
  126. package/dist/lib/pagination.d.ts.map +1 -1
  127. package/dist/lib/pagination.js +10 -1
  128. package/dist/lib/queue/queueResourceAbridged.d.ts +23 -0
  129. package/dist/lib/queue/queueResourceAbridged.d.ts.map +1 -0
  130. package/dist/lib/queue/queueResourceAbridged.js +44 -0
  131. package/dist/lib/requests/_request.d.ts +1 -0
  132. package/dist/lib/requests/_request.d.ts.map +1 -1
  133. package/dist/lib/requests/api/_request.d.ts +113 -3
  134. package/dist/lib/requests/api/_request.d.ts.map +1 -1
  135. package/dist/lib/requests/api/_request.js +283 -2
  136. package/dist/lib/requests/api/account/follow/account.d.ts +1 -0
  137. package/dist/lib/requests/api/account/follow/account.d.ts.map +1 -0
  138. package/dist/lib/requests/api/account/follow/account.js +1 -0
  139. package/dist/lib/requests/api/account/follow/addByRSSChannel.d.ts +1 -0
  140. package/dist/lib/requests/api/account/follow/addByRSSChannel.d.ts.map +1 -0
  141. package/dist/lib/requests/api/account/follow/addByRSSChannel.js +1 -0
  142. package/dist/lib/requests/api/account/follow/channel.d.ts +9 -0
  143. package/dist/lib/requests/api/account/follow/channel.d.ts.map +1 -0
  144. package/dist/lib/requests/api/account/follow/channel.js +40 -0
  145. package/dist/lib/requests/api/account/follow/playlist.d.ts +9 -0
  146. package/dist/lib/requests/api/account/follow/playlist.d.ts.map +1 -0
  147. package/dist/lib/requests/api/account/follow/playlist.js +40 -0
  148. package/dist/lib/requests/api/channel/channel.d.ts +4 -2
  149. package/dist/lib/requests/api/channel/channel.d.ts.map +1 -1
  150. package/dist/lib/requests/api/channel/channel.js +18 -0
  151. package/dist/lib/requests/api/clip/clip.d.ts +21 -0
  152. package/dist/lib/requests/api/clip/clip.d.ts.map +1 -0
  153. package/dist/lib/requests/api/clip/clip.js +87 -0
  154. package/dist/lib/requests/api/externalServices/podcastIndex/index.d.ts +8 -0
  155. package/dist/lib/requests/api/externalServices/podcastIndex/index.d.ts.map +1 -0
  156. package/dist/lib/requests/api/externalServices/podcastIndex/index.js +29 -0
  157. package/dist/lib/requests/api/item/item.d.ts +10 -0
  158. package/dist/lib/requests/api/item/item.d.ts.map +1 -0
  159. package/dist/lib/requests/api/item/item.js +69 -0
  160. package/dist/lib/requests/api/itemChapter/itemChapter.d.ts +4 -0
  161. package/dist/lib/requests/api/itemChapter/itemChapter.d.ts.map +1 -0
  162. package/dist/lib/requests/api/itemChapter/itemChapter.js +20 -0
  163. package/dist/lib/requests/api/itemSoundbite/itemSoundbite.d.ts +16 -0
  164. package/dist/lib/requests/api/itemSoundbite/itemSoundbite.d.ts.map +1 -0
  165. package/dist/lib/requests/api/itemSoundbite/itemSoundbite.js +44 -0
  166. package/dist/lib/requests/api/itemTranscript/itemTranscript.d.ts +5 -0
  167. package/dist/lib/requests/api/itemTranscript/itemTranscript.d.ts.map +1 -0
  168. package/dist/lib/requests/api/itemTranscript/itemTranscript.js +20 -0
  169. package/dist/lib/requests/api/liveItem/liveItem.d.ts +4 -0
  170. package/dist/lib/requests/api/liveItem/liveItem.d.ts.map +1 -0
  171. package/dist/lib/requests/api/liveItem/liveItem.js +20 -0
  172. package/dist/lib/requests/api/mq/mq.d.ts +7 -0
  173. package/dist/lib/requests/api/mq/mq.d.ts.map +1 -0
  174. package/dist/lib/requests/api/mq/mq.js +27 -0
  175. package/dist/lib/requests/api/playlist/playlist.d.ts +26 -0
  176. package/dist/lib/requests/api/playlist/playlist.d.ts.map +1 -0
  177. package/dist/lib/requests/api/playlist/playlist.js +116 -0
  178. package/dist/lib/requests/api/playlist/playlistResource/playlistResource.d.ts +7 -0
  179. package/dist/lib/requests/api/playlist/playlistResource/playlistResource.d.ts.map +1 -0
  180. package/dist/lib/requests/api/playlist/playlistResource/playlistResource.js +36 -0
  181. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceClip.d.ts +7 -0
  182. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceClip.d.ts.map +1 -0
  183. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceClip.js +60 -0
  184. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItem.d.ts +8 -0
  185. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItem.d.ts.map +1 -0
  186. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItem.js +60 -0
  187. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemAddByRSS.d.ts +1 -0
  188. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemAddByRSS.d.ts.map +1 -0
  189. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemAddByRSS.js +1 -0
  190. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemSoundbite.d.ts +7 -0
  191. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemSoundbite.d.ts.map +1 -0
  192. package/dist/lib/requests/api/playlist/playlistResource/playlistResourceItemSoundbite.js +60 -0
  193. package/dist/lib/requests/api/podroll/podroll.d.ts +4 -0
  194. package/dist/lib/requests/api/podroll/podroll.d.ts.map +1 -0
  195. package/dist/lib/requests/api/podroll/podroll.js +20 -0
  196. package/dist/lib/requests/api/queryParams.d.ts +72 -4
  197. package/dist/lib/requests/api/queryParams.d.ts.map +1 -1
  198. package/dist/lib/requests/api/queryParams.js +23 -3
  199. package/dist/lib/requests/api/queue/queue.d.ts +8 -0
  200. package/dist/lib/requests/api/queue/queue.d.ts.map +1 -0
  201. package/dist/lib/requests/api/queue/queue.js +38 -0
  202. package/dist/lib/requests/api/queue/queueResource/queueResource.d.ts +15 -0
  203. package/dist/lib/requests/api/queue/queueResource/queueResource.d.ts.map +1 -0
  204. package/dist/lib/requests/api/queue/queueResource/queueResource.js +60 -0
  205. package/dist/lib/requests/api/queue/queueResource/queueResourceClip.d.ts +11 -0
  206. package/dist/lib/requests/api/queue/queueResource/queueResourceClip.d.ts.map +1 -0
  207. package/dist/lib/requests/api/queue/queueResource/queueResourceClip.js +86 -0
  208. package/dist/lib/requests/api/queue/queueResource/queueResourceItem.d.ts +11 -0
  209. package/dist/lib/requests/api/queue/queueResource/queueResourceItem.d.ts.map +1 -0
  210. package/dist/lib/requests/api/queue/queueResource/queueResourceItem.js +87 -0
  211. package/dist/lib/requests/api/queue/queueResource/queueResourceItemAddByRSS.d.ts +21 -0
  212. package/dist/lib/requests/api/queue/queueResource/queueResourceItemAddByRSS.d.ts.map +1 -0
  213. package/dist/lib/requests/api/queue/queueResource/queueResourceItemAddByRSS.js +88 -0
  214. package/dist/lib/requests/api/queue/queueResource/queueResourceItemSoundbite.d.ts +11 -0
  215. package/dist/lib/requests/api/queue/queueResource/queueResourceItemSoundbite.d.ts.map +1 -0
  216. package/dist/lib/requests/api/queue/queueResource/queueResourceItemSoundbite.js +86 -0
  217. package/dist/lib/time.d.ts +5 -0
  218. package/dist/lib/time.d.ts.map +1 -1
  219. package/dist/lib/time.js +71 -0
  220. package/dist/lib/validation/databaseConstants.d.ts +2 -1
  221. package/dist/lib/validation/databaseConstants.d.ts.map +1 -1
  222. package/dist/lib/validation/databaseConstants.js +2 -1
  223. package/dist/lib/validation/index.d.ts +5 -0
  224. package/dist/lib/validation/index.d.ts.map +1 -0
  225. package/dist/lib/validation/index.js +20 -0
  226. package/dist/lib/value.d.ts +22 -0
  227. package/dist/lib/value.d.ts.map +1 -0
  228. package/dist/lib/value.js +43 -0
  229. package/dist/lib/web/clipboard.d.ts +2 -0
  230. package/dist/lib/web/clipboard.d.ts.map +1 -0
  231. package/dist/lib/web/clipboard.js +43 -0
  232. package/dist/lib/web/index.d.ts +2 -0
  233. package/dist/lib/web/index.d.ts.map +1 -0
  234. package/dist/lib/web/index.js +17 -0
  235. package/package.json +18 -16
  236. package/dist/lib/item.d.ts.map +0 -1
  237. package/dist/lib/itemImage.d.ts +0 -9
  238. package/dist/lib/itemImage.d.ts.map +0 -1
  239. package/dist/lib/itemImage.js +0 -41
  240. /package/dist/lib/{item.d.ts → item/item.d.ts} +0 -0
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEqual = isEqual;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function isEqual(a, b) {
6
+ if (a === b)
7
+ return true;
8
+ if (typeof a !== typeof b)
9
+ return false;
10
+ if (typeof a !== "object" || a === null || b === null)
11
+ return false;
12
+ const aKeys = Object.keys(a);
13
+ const bKeys = Object.keys(b);
14
+ if (aKeys.length !== bKeys.length)
15
+ return false;
16
+ for (const key of aKeys) {
17
+ if (!bKeys.includes(key))
18
+ return false;
19
+ if (!isEqual(a[key], b[key]))
20
+ return false;
21
+ }
22
+ return true;
23
+ }
@@ -1,4 +1,6 @@
1
1
  import { Locale } from "date-fns";
2
- export declare const formatDateAbbrev: (date: Date | number | string, locale?: Locale) => string;
2
+ export declare const formatDateAbbrev: (date: Date | number | string, localeString: string) => string;
3
3
  export declare const convertSecondsToDaysText: (seconds: string) => string;
4
+ export declare const dateFnsLocaleMap: Record<string, Locale>;
5
+ export declare function getDateFnsLocale(appLocale: string): Locale;
4
6
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/lib/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,SAAS,MAAM,KACd,MAGF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,WAGvD,CAAC"}
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/lib/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,cAAc,MAAM,KACnB,MAWF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,WAGvD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKnD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D"}
package/dist/lib/date.js CHANGED
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertSecondsToDaysText = exports.formatDateAbbrev = void 0;
3
+ exports.dateFnsLocaleMap = exports.convertSecondsToDaysText = exports.formatDateAbbrev = void 0;
4
+ exports.getDateFnsLocale = getDateFnsLocale;
4
5
  const date_fns_1 = require("date-fns");
5
- const formatDateAbbrev = (date, locale) => {
6
- const d = typeof date === "string" || typeof date === "number" ? new Date(date) : date;
6
+ const locale_1 = require("date-fns/locale");
7
+ const formatDateAbbrev = (date, localeString) => {
8
+ const d = typeof date === "string" || typeof date === "number"
9
+ ? new Date(typeof date === "number" && date < 1e12
10
+ ? date * 1000
11
+ : date)
12
+ : date;
13
+ const locale = getDateFnsLocale(localeString);
7
14
  return (0, date_fns_1.format)(d, "MMM d yyyy", { locale });
8
15
  };
9
16
  exports.formatDateAbbrev = formatDateAbbrev;
@@ -12,3 +19,12 @@ const convertSecondsToDaysText = (seconds) => {
12
19
  return `${totalDays > 1 ? `${totalDays} days` : '24 hours'}`;
13
20
  };
14
21
  exports.convertSecondsToDaysText = convertSecondsToDaysText;
22
+ exports.dateFnsLocaleMap = {
23
+ en: locale_1.enUS,
24
+ es: locale_1.es,
25
+ fr: locale_1.fr,
26
+ "el-GR": locale_1.el
27
+ };
28
+ function getDateFnsLocale(appLocale) {
29
+ return exports.dateFnsLocaleMap[appLocale] || locale_1.enUS;
30
+ }
@@ -0,0 +1,2 @@
1
+ export * from './errorMessages';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errorMessages"), exports);
@@ -0,0 +1,2 @@
1
+ export declare function formatFileSize(bytes: number | null | undefined): string | null;
2
+ //# sourceMappingURL=fileSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileSize.d.ts","sourceRoot":"","sources":["../../src/lib/fileSize.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAoB9E"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // Human-readable file size helper.
3
+ // Accepts bytes (number) or null/undefined and returns a string in KB, MB, or GB units.
4
+ // For values < 1KB it returns Bytes (e.g. 512 => "512 B").
5
+ // Examples: 1536 => "1.5 KB", 5_242_880 => "5 MB", 3_221_225_472 => "3 GB"
6
+ // Rounds to one decimal place for values < 10 of a unit, otherwise no decimals.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.formatFileSize = formatFileSize;
9
+ function formatFileSize(bytes) {
10
+ if (bytes == null || bytes <= 0)
11
+ return null;
12
+ const KB = 1024;
13
+ const MB = KB * 1024;
14
+ const GB = MB * 1024;
15
+ const format = (value, unit) => {
16
+ if (value >= 10)
17
+ return Math.round(value) + ' ' + unit; // no decimals if >=10
18
+ const withOne = parseFloat(value.toFixed(1));
19
+ return (withOne % 1 === 0 ? Math.round(withOne) : withOne) + ' ' + unit; // trim trailing .0
20
+ };
21
+ if (bytes >= GB)
22
+ return format(bytes / GB, 'GB');
23
+ if (bytes >= MB)
24
+ return format(bytes / MB, 'MB');
25
+ if (bytes >= KB)
26
+ return format(bytes / KB, 'KB');
27
+ // Anything less than 1KB we report in bytes.
28
+ if (bytes > 0 && bytes < KB)
29
+ return bytes + ' B';
30
+ return null;
31
+ }
@@ -0,0 +1,3 @@
1
+ export declare function decodeHtmlEntities(input?: string): string;
2
+ export declare function stripAndDecodeHtml(input?: string): string;
3
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/lib/html.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeHtmlEntities = decodeHtmlEntities;
4
+ exports.stripAndDecodeHtml = stripAndDecodeHtml;
5
+ const he_1 = require("he");
6
+ function stripHtmlTags(input) {
7
+ if (!input)
8
+ return "";
9
+ return input.replace(/<[^>]*>/g, "");
10
+ }
11
+ function decodeHtmlEntities(input) {
12
+ if (!input)
13
+ return "";
14
+ return (0, he_1.decode)(input);
15
+ }
16
+ function stripAndDecodeHtml(input) {
17
+ return stripHtmlTags(decodeHtmlEntities(input));
18
+ }
@@ -0,0 +1,2 @@
1
+ export * from './timeFormatter';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/i18n/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./timeFormatter"), exports);
@@ -0,0 +1,2 @@
1
+ export declare function formatSecondsToReadableDuration(input: string, lang?: string): string;
2
+ //# sourceMappingURL=timeFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeFormatter.d.ts","sourceRoot":"","sources":["../../../src/lib/i18n/timeFormatter.ts"],"names":[],"mappings":"AAGA,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAa,GAClB,MAAM,CA8CR"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSecondsToReadableDuration = formatSecondsToReadableDuration;
4
+ const date_fns_1 = require("date-fns");
5
+ const locale_1 = require("date-fns/locale");
6
+ function formatSecondsToReadableDuration(input, lang = "en") {
7
+ let seconds = Math.floor(parseFloat(input));
8
+ if (isNaN(seconds) || seconds < 0)
9
+ seconds = 0;
10
+ let duration = (0, date_fns_1.intervalToDuration)({ start: 0, end: seconds * 1000 });
11
+ if (!duration.years &&
12
+ !duration.months &&
13
+ !duration.days &&
14
+ !duration.hours &&
15
+ !duration.minutes &&
16
+ !duration.seconds) {
17
+ duration = Object.assign(Object.assign({}, duration), { seconds: 0 });
18
+ }
19
+ let locale;
20
+ switch (lang) {
21
+ case "es":
22
+ locale = locale_1.es;
23
+ break;
24
+ case "el":
25
+ case "el-GR":
26
+ locale = locale_1.el;
27
+ break;
28
+ case "en":
29
+ default:
30
+ locale = locale_1.enUS;
31
+ break;
32
+ }
33
+ // If under 60 seconds, only show seconds
34
+ if (seconds < 60) {
35
+ return (0, date_fns_1.formatDuration)(duration, {
36
+ format: ["seconds"],
37
+ locale,
38
+ zero: true,
39
+ });
40
+ }
41
+ // Otherwise, show hours and minutes
42
+ return (0, date_fns_1.formatDuration)(duration, {
43
+ format: ["hours", "minutes"],
44
+ locale,
45
+ zero: true,
46
+ });
47
+ }
@@ -0,0 +1,12 @@
1
+ import { DTOChannelImage, DTOItemImage } from "../dtos";
2
+ type ItemImagePartial = {
3
+ image_width_size: number | null;
4
+ url: string;
5
+ };
6
+ type Comparison = 'greater' | 'lesser' | null;
7
+ type AllowedExtension = 'png' | 'jpg' | 'gif' | 'jpeg' | 'webp';
8
+ export declare function findDTOChannelImageBySize(channelImages: DTOChannelImage[] | null | undefined, size: number | 'largest' | 'smallest', comparison?: Comparison, allowedExtensions?: AllowedExtension[]): ItemImagePartial | null;
9
+ export declare function findDTOItemImageBySize(itemImages: DTOItemImage[] | null | undefined, size: number | 'largest' | 'smallest', comparison?: Comparison, allowedExtensions?: AllowedExtension[]): ItemImagePartial | null;
10
+ export declare function findImageBySize(itemImages: ItemImagePartial[], size: number | 'largest' | 'smallest', comparison?: Comparison, allowedExtensions?: AllowedExtension[]): ItemImagePartial | null;
11
+ export {};
12
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/lib/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAExD,KAAK,gBAAgB,GAAG;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;CACb,CAAA;AAED,KAAK,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;AAC9C,KAAK,gBAAgB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAGhE,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,eAAe,EAAE,GAAG,IAAI,GAAG,SAAS,EACnD,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACrC,UAAU,GAAE,UAAiB,EAC7B,iBAAiB,GAAE,gBAAgB,EAA2B,GAC7D,gBAAgB,GAAG,IAAI,CAMzB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,EAC7C,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACrC,UAAU,GAAE,UAAiB,EAC7B,iBAAiB,GAAE,gBAAgB,EAA2B,GAC7D,gBAAgB,GAAG,IAAI,CAMzB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,gBAAgB,EAAE,EAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACrC,UAAU,GAAE,UAAiB,EAC7B,iBAAiB,GAAE,gBAAgB,EAA2B,GAC7D,gBAAgB,GAAG,IAAI,CAyFzB"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findDTOChannelImageBySize = findDTOChannelImageBySize;
4
+ exports.findDTOItemImageBySize = findDTOItemImageBySize;
5
+ exports.findImageBySize = findImageBySize;
6
+ function findDTOChannelImageBySize(channelImages, size, comparison = null, allowedExtensions = ['png', 'jpg', 'webp']) {
7
+ if (!channelImages || channelImages.length === 0) {
8
+ return null;
9
+ }
10
+ else {
11
+ return findImageBySize(channelImages, size, comparison, allowedExtensions);
12
+ }
13
+ }
14
+ function findDTOItemImageBySize(itemImages, size, comparison = null, allowedExtensions = ['png', 'jpg', 'webp']) {
15
+ if (!itemImages || itemImages.length === 0) {
16
+ return null;
17
+ }
18
+ else {
19
+ return findImageBySize(itemImages, size, comparison, allowedExtensions);
20
+ }
21
+ }
22
+ function findImageBySize(itemImages, size, comparison = null, allowedExtensions = ['png', 'jpg', 'webp']) {
23
+ const extensions = allowedExtensions.map(ext => ext === 'jpeg' ? 'jpg' : ext);
24
+ const isValidExtension = (url) => {
25
+ // Match .jpg, ?.jpg, etc. at the end of the URL (before query/hash)
26
+ const match = url.match(/(\?|\.)(jpg|jpeg|png|gif|webp)(?=($|\?|#))/i);
27
+ if (!match) {
28
+ return false;
29
+ }
30
+ const ext = match[2].toLowerCase() === 'jpeg' ? 'jpg' : match[2].toLowerCase();
31
+ return extensions.includes(ext);
32
+ };
33
+ // Helper to check if URL has no extension
34
+ const hasNoExtension = (url) => {
35
+ // Remove query/hash
36
+ const cleanUrl = url.split(/[?#]/)[0];
37
+ // Get last segment after last '/'
38
+ const lastSegment = cleanUrl.split('/').pop() || '';
39
+ // If there's no dot in last segment, it's likely no extension
40
+ return lastSegment && !lastSegment.includes('.') && lastSegment.length > 0;
41
+ };
42
+ if (size === 'largest') {
43
+ const filtered = itemImages
44
+ .filter(image => image.image_width_size !== null && isValidExtension(image.url))
45
+ .sort((a, b) => (b.image_width_size - a.image_width_size));
46
+ if (filtered.length > 0) {
47
+ return filtered[0];
48
+ }
49
+ const nullSizeImage = itemImages.find(image => image.image_width_size === null && isValidExtension(image.url));
50
+ if (nullSizeImage)
51
+ return nullSizeImage;
52
+ // Last resort: image with no extension
53
+ const noExtImage = itemImages.find(image => hasNoExtension(image.url));
54
+ return noExtImage || null;
55
+ }
56
+ if (size === 'smallest') {
57
+ const filtered = itemImages
58
+ .filter(image => image.image_width_size !== null && isValidExtension(image.url))
59
+ .sort((a, b) => (a.image_width_size - b.image_width_size));
60
+ if (filtered.length > 0) {
61
+ return filtered[0];
62
+ }
63
+ const nullSizeImage = itemImages.find(image => image.image_width_size === null && isValidExtension(image.url));
64
+ if (nullSizeImage)
65
+ return nullSizeImage;
66
+ // Last resort: image with no extension
67
+ const noExtImage = itemImages.find(image => hasNoExtension(image.url));
68
+ return noExtImage || null;
69
+ }
70
+ let filteredImages = [];
71
+ if (comparison === 'greater') {
72
+ filteredImages = itemImages
73
+ .filter(image => image.image_width_size !== null && image.image_width_size >= size && isValidExtension(image.url))
74
+ .sort((a, b) => (a.image_width_size - b.image_width_size));
75
+ }
76
+ else if (comparison === 'lesser') {
77
+ filteredImages = itemImages
78
+ .filter(image => image.image_width_size !== null && image.image_width_size <= size && isValidExtension(image.url))
79
+ .sort((b, a) => (b.image_width_size - a.image_width_size));
80
+ }
81
+ if (filteredImages.length > 0) {
82
+ return filteredImages[0];
83
+ }
84
+ if (comparison === 'greater') {
85
+ filteredImages = itemImages
86
+ .filter(image => image.image_width_size !== null && image.image_width_size < size && isValidExtension(image.url))
87
+ .sort((b, a) => (b.image_width_size - a.image_width_size));
88
+ }
89
+ else if (comparison === 'lesser') {
90
+ filteredImages = itemImages
91
+ .filter(image => image.image_width_size !== null && image.image_width_size > size && isValidExtension(image.url))
92
+ .sort((a, b) => (a.image_width_size - b.image_width_size));
93
+ }
94
+ if (filteredImages.length > 0) {
95
+ return filteredImages[0];
96
+ }
97
+ const nullSizeImage = itemImages.find(image => image.image_width_size === null && isValidExtension(image.url));
98
+ if (nullSizeImage)
99
+ return nullSizeImage;
100
+ // Last resort: image with no extension
101
+ const noExtImage = itemImages.find(image => hasNoExtension(image.url));
102
+ return noExtImage || null;
103
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/lib/item/item.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,MAEpD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatGuidEnclosureUrl = void 0;
4
- const databaseConstants_1 = require("../lib/validation/databaseConstants");
4
+ const databaseConstants_1 = require("../validation/databaseConstants");
5
5
  const formatGuidEnclosureUrl = (url) => {
6
6
  return url.slice(0, databaseConstants_1.DATABASE_CONSTANTS.varchar_url);
7
7
  };
@@ -0,0 +1,29 @@
1
+ import { DTOItemEnclosureSource } from "src/dtos";
2
+ import { DTOItemEnclosure } from "../../dtos/item/itemEnclosure";
3
+ import { FormattedBitrate } from "../bitrate";
4
+ export declare function getMediaTypeFromSource(uri: string): "audio" | "video" | undefined;
5
+ export type EnclosureSelectedParams = {
6
+ type: "default" | "audio" | "video" | null;
7
+ enclosureRowSelected: number | null;
8
+ sourceRowSelected: number | null;
9
+ };
10
+ export type SelectedLabeledItemEnclosureAndSource = {
11
+ labeledItemEnclosure: LabeledItemEnclosure | null;
12
+ source: DTOItemEnclosureSource | null;
13
+ };
14
+ export declare function getSelectedLabeledItemEnclosureAndSource({ labeledItemEnclosures, type, enclosureRowIndex, sourceRowIndex }: {
15
+ labeledItemEnclosures: LabeledItemEnclosure[];
16
+ type: "default" | "audio" | "video" | null;
17
+ enclosureRowIndex: number | null;
18
+ sourceRowIndex: number | null;
19
+ }): SelectedLabeledItemEnclosureAndSource;
20
+ export interface LabeledItemEnclosure {
21
+ enclosure: DTOItemEnclosure;
22
+ mediaType: "audio" | "video";
23
+ label: "audio" | "video";
24
+ audioBitrate?: FormattedBitrate;
25
+ videoHeight?: number;
26
+ fileExtension?: string;
27
+ }
28
+ export declare function buildLabeledItemEnclosures(enclosures: DTOItemEnclosure[]): LabeledItemEnclosure[];
29
+ //# sourceMappingURL=itemEnclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemEnclosure.d.ts","sourceRoot":"","sources":["../../../src/lib/item/itemEnclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgB7D,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAMjF;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IAC3C,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG;IAClD,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,wBAAgB,wCAAwC,CAAC,EACvD,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,cAAc,EACf,EAAE;IACD,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;IAC9C,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IAC3C,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,GAAG,qCAAqC,CA0DxC;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,gBAAgB,EAAE,GAC7B,oBAAoB,EAAE,CA6DxB"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMediaTypeFromSource = getMediaTypeFromSource;
4
+ exports.getSelectedLabeledItemEnclosureAndSource = getSelectedLabeledItemEnclosureAndSource;
5
+ exports.buildLabeledItemEnclosures = buildLabeledItemEnclosures;
6
+ const bitrate_1 = require("../bitrate");
7
+ const EXTENSION_MEDIA_TYPE_MAP = {
8
+ "mp3": "audio",
9
+ "aac": "audio",
10
+ "opus": "audio",
11
+ "m4a": "audio",
12
+ "ogg": "audio",
13
+ "wav": "audio",
14
+ "mp4": "video",
15
+ "m4v": "video",
16
+ "webm": "video",
17
+ "mov": "video",
18
+ "mkv": "video"
19
+ };
20
+ function getMediaTypeFromSource(uri) {
21
+ const urlWithoutParams = uri.split(/[?#]/)[0];
22
+ const match = urlWithoutParams.match(/\.([a-z0-9]+)$/i);
23
+ if (!match)
24
+ return undefined;
25
+ const ext = match[1].toLowerCase();
26
+ return EXTENSION_MEDIA_TYPE_MAP[ext];
27
+ }
28
+ function getSelectedLabeledItemEnclosureAndSource({ labeledItemEnclosures, type, enclosureRowIndex, sourceRowIndex }) {
29
+ if (!labeledItemEnclosures || labeledItemEnclosures.length === 0) {
30
+ return { labeledItemEnclosure: null, source: null };
31
+ }
32
+ let labeledItemEnclosure = null;
33
+ let source = null;
34
+ // Helper to get first enclosure of a given mediaType
35
+ const getFirstOfType = (mediaType) => labeledItemEnclosures.find((e) => e.mediaType === mediaType) || null;
36
+ // Helper to get enclosure by index and type
37
+ const getByTypeAndIndex = (mediaType, idx) => {
38
+ const filtered = labeledItemEnclosures.filter((e) => e.mediaType === mediaType);
39
+ return filtered[idx] || filtered[0] || null;
40
+ };
41
+ // Default type logic
42
+ if (type === "default" || !type) {
43
+ labeledItemEnclosure = labeledItemEnclosures.find((e) => e.enclosure.item_enclosure_default) || labeledItemEnclosures[0] || null;
44
+ const sources = (labeledItemEnclosure === null || labeledItemEnclosure === void 0 ? void 0 : labeledItemEnclosure.enclosure.item_enclosure_sources) || [];
45
+ const srcIdx = typeof sourceRowIndex === "number" ? sourceRowIndex : 0;
46
+ source = sources[srcIdx] || sources[0] || null;
47
+ return { labeledItemEnclosure, source };
48
+ }
49
+ // Audio type logic
50
+ if (type === "audio") {
51
+ const encIdx = typeof enclosureRowIndex === "number" ? enclosureRowIndex : 0;
52
+ labeledItemEnclosure = getByTypeAndIndex("audio", encIdx);
53
+ if (!labeledItemEnclosure) {
54
+ labeledItemEnclosure = getFirstOfType("audio");
55
+ }
56
+ const sources = (labeledItemEnclosure === null || labeledItemEnclosure === void 0 ? void 0 : labeledItemEnclosure.enclosure.item_enclosure_sources) || [];
57
+ const srcIdx = typeof sourceRowIndex === "number" ? sourceRowIndex : 0;
58
+ source = sources[srcIdx] || sources[0] || null;
59
+ return { labeledItemEnclosure, source };
60
+ }
61
+ // Video type logic
62
+ if (type === "video") {
63
+ const encIdx = typeof enclosureRowIndex === "number" ? enclosureRowIndex : 0;
64
+ labeledItemEnclosure = getByTypeAndIndex("video", encIdx);
65
+ if (!labeledItemEnclosure) {
66
+ labeledItemEnclosure = getFirstOfType("video");
67
+ }
68
+ const sources = (labeledItemEnclosure === null || labeledItemEnclosure === void 0 ? void 0 : labeledItemEnclosure.enclosure.item_enclosure_sources) || [];
69
+ const srcIdx = typeof sourceRowIndex === "number" ? sourceRowIndex : 0;
70
+ source = sources[srcIdx] || sources[0] || null;
71
+ return { labeledItemEnclosure, source };
72
+ }
73
+ // Fallback: just return first enclosure and source
74
+ labeledItemEnclosure = labeledItemEnclosures[0] || null;
75
+ const sources = (labeledItemEnclosure === null || labeledItemEnclosure === void 0 ? void 0 : labeledItemEnclosure.enclosure.item_enclosure_sources) || [];
76
+ source = sources[0] || null;
77
+ return { labeledItemEnclosure, source };
78
+ }
79
+ function buildLabeledItemEnclosures(enclosures) {
80
+ const sorted = [...enclosures].sort((a, b) => {
81
+ if (a.item_enclosure_default === b.item_enclosure_default)
82
+ return 0;
83
+ return a.item_enclosure_default ? -1 : 1;
84
+ });
85
+ return sorted.map((e) => {
86
+ var _a, _b;
87
+ let mediaType;
88
+ if (e.height != null) {
89
+ mediaType = "video";
90
+ }
91
+ else if ((_a = e.type) === null || _a === void 0 ? void 0 : _a.startsWith("video/")) {
92
+ mediaType = "video";
93
+ }
94
+ else {
95
+ mediaType = "audio";
96
+ }
97
+ const labeled = {
98
+ enclosure: e,
99
+ mediaType,
100
+ label: mediaType
101
+ };
102
+ if (mediaType === "audio" && e.bitrate) {
103
+ labeled.audioBitrate = (0, bitrate_1.formatBitrate)(e.bitrate);
104
+ }
105
+ if (mediaType === "video" && e.height) {
106
+ labeled.videoHeight = e.height;
107
+ }
108
+ // Derive file extension from first source URI if present, else fallback to mime type mapping.
109
+ const source = (_b = e.item_enclosure_sources) === null || _b === void 0 ? void 0 : _b[0];
110
+ let ext;
111
+ if (source === null || source === void 0 ? void 0 : source.uri) {
112
+ const urlWithoutParams = source.uri.split(/[?#]/)[0];
113
+ const match = urlWithoutParams.match(/\.([a-z0-9]+)$/i);
114
+ if (match) {
115
+ ext = match[1].toLowerCase();
116
+ }
117
+ }
118
+ if (!ext && e.type) {
119
+ // Map common mime types to typical file extensions.
120
+ const mime = e.type.toLowerCase();
121
+ const mimeMap = {
122
+ 'audio/mpeg': 'mp3',
123
+ 'audio/opus': 'opus',
124
+ 'audio/aac': 'aac',
125
+ 'audio/ogg': 'ogg',
126
+ 'audio/wav': 'wav',
127
+ 'video/mp4': 'mp4',
128
+ 'video/quicktime': 'mov',
129
+ 'video/x-matroska': 'mkv',
130
+ 'application/x-mpegurl': 'm3u8'
131
+ };
132
+ ext = mimeMap[mime];
133
+ }
134
+ if (ext) {
135
+ labeled.fileExtension = ext;
136
+ }
137
+ return labeled;
138
+ });
139
+ }
@@ -0,0 +1,8 @@
1
+ import { DTOItem } from "src/dtos";
2
+ export declare function getLiveItemEnclosureSource(item: DTOItem | null): {
3
+ url: string | null;
4
+ type: string;
5
+ isAudioHLS: boolean;
6
+ isVideoHLS: boolean;
7
+ } | null;
8
+ //# sourceMappingURL=liveItemEnclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liveItemEnclosure.d.ts","sourceRoot":"","sources":["../../../src/lib/liveItem/liveItemEnclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,UAAU,CAAC;AAErD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG;IAChE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,IAAI,CAqDP"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLiveItemEnclosureSource = getLiveItemEnclosureSource;
4
+ function getLiveItemEnclosureSource(item) {
5
+ var _a;
6
+ if (!(item === null || item === void 0 ? void 0 : item.live_item))
7
+ return null;
8
+ const enclosures = item.item_enclosures || [];
9
+ const defaultEnclosure = enclosures.find((e) => e.item_enclosure_default) || enclosures[0];
10
+ const source = (_a = defaultEnclosure === null || defaultEnclosure === void 0 ? void 0 : defaultEnclosure.item_enclosure_sources) === null || _a === void 0 ? void 0 : _a[0];
11
+ if (!(source === null || source === void 0 ? void 0 : source.uri))
12
+ return { url: null, type: "", isAudioHLS: false, isVideoHLS: false };
13
+ if (source.uri.endsWith(".m3u8")) {
14
+ const enclosureType = (defaultEnclosure === null || defaultEnclosure === void 0 ? void 0 : defaultEnclosure.type) || (source === null || source === void 0 ? void 0 : source.content_type) || "";
15
+ const codecs = (defaultEnclosure === null || defaultEnclosure === void 0 ? void 0 : defaultEnclosure.codecs) || "";
16
+ const isAudioHLS = (typeof enclosureType === "string" &&
17
+ enclosureType.includes("audio")) ||
18
+ (typeof codecs === "string" &&
19
+ !!codecs.match(/mp4a|aac|opus|vorbis|flac|alac|pcm/i));
20
+ return {
21
+ url: source.uri,
22
+ type: "application/x-mpegURL",
23
+ isAudioHLS,
24
+ isVideoHLS: !isAudioHLS
25
+ };
26
+ }
27
+ const enclosureType = (defaultEnclosure === null || defaultEnclosure === void 0 ? void 0 : defaultEnclosure.type) || (source === null || source === void 0 ? void 0 : source.content_type) || "audio";
28
+ if (typeof enclosureType === "string" && enclosureType.includes("video"))
29
+ return {
30
+ url: source.uri,
31
+ type: "video/mp4",
32
+ isAudioHLS: false,
33
+ isVideoHLS: true
34
+ };
35
+ if (typeof enclosureType === "string" && enclosureType.includes("audio"))
36
+ return {
37
+ url: source.uri,
38
+ type: "audio/mpeg",
39
+ isAudioHLS: true,
40
+ isVideoHLS: false
41
+ };
42
+ return {
43
+ url: source.uri,
44
+ type: "audio/mpeg",
45
+ isAudioHLS: true,
46
+ isVideoHLS: false
47
+ };
48
+ }
@@ -19,6 +19,11 @@ export declare enum MediumEnum {
19
19
  PublisherL = 18,
20
20
  CourseL = 19
21
21
  }
22
- export declare function getMediumEnumValue(input: string | null): MediumEnum | null;
23
- export declare const checkIfSupportedMedium: (mediumEnumKey: number | null) => boolean;
22
+ export declare function getMediumEnumValue(input: string | null): MediumEnum;
23
+ export declare const supportedPlaylistMediums: {
24
+ [key: number]: boolean;
25
+ };
26
+ export declare const supportedQueueMediums: {
27
+ [key: number]: boolean;
28
+ };
24
29
  //# sourceMappingURL=medium.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"medium.d.ts","sourceRoot":"","sources":["../../src/lib/medium.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,KAAK,IAAI;IACT,KAAK,IAAI;IACT,IAAI,IAAI;IACR,SAAS,IAAI;IACb,UAAU,IAAI;IACd,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,KAAK;IACV,QAAQ,KAAK;IACb,MAAM,KAAK;IACX,MAAM,KAAK;IACX,KAAK,KAAK;IACV,UAAU,KAAK;IACf,WAAW,KAAK;IAChB,KAAK,KAAK;IACV,UAAU,KAAK;IACf,OAAO,KAAK;CACb;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CA4B1E;AAwBD,eAAO,MAAM,sBAAsB,GAAI,eAAe,MAAM,GAAG,IAAI,KAAG,OAErE,CAAC"}
1
+ {"version":3,"file":"medium.d.ts","sourceRoot":"","sources":["../../src/lib/medium.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,KAAK,IAAI;IACT,KAAK,IAAI;IACT,IAAI,IAAI;IACR,SAAS,IAAI;IACb,UAAU,IAAI;IACd,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,KAAK;IACV,QAAQ,KAAK;IACb,MAAM,KAAK;IACX,MAAM,KAAK;IACX,KAAK,KAAK;IACV,UAAU,KAAK;IACf,WAAW,KAAK;IAChB,KAAK,KAAK;IACV,UAAU,KAAK;IACf,OAAO,KAAK;CACb;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CA4BnE;AAED,eAAO,MAAM,wBAAwB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAI9D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAI3D,CAAC"}