podverse-parser 5.0.8 → 5.1.0-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 (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 +1 -2
  124. package/dist/lib/rss/parser.d.ts.map +1 -1
  125. package/dist/lib/rss/parser.js +52 -49
  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 +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"itemEnclosure.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemEnclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EACK,MAAM,cAAc,CAAC;AAGtD,eAAO,MAAM,yBAAyB,eACxB,OAAO,QACb,IAAI,8BACkB,aAAa,kBA0B1C,CAAC"}
1
+ {"version":3,"file":"itemEnclosure.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemEnclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EACK,MAAM,cAAc,CAAC;AAGtD,eAAO,MAAM,yBAAyB,GACpC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBA0B3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemImage: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemImage: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAoB,MAAM,cAAc,CAAC;AAIrE,eAAO,MAAM,qBAAqB,eACpB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAoB,MAAM,cAAc,CAAC;AAIrE,eAAO,MAAM,qBAAqB,GAChC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemLicense: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemLicense: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemLicense.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemLicense.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemLicense.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAsB,MAAM,cAAc,CAAC;AAIvE,eAAO,MAAM,uBAAuB,eACtB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemLicense.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemLicense.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAsB,MAAM,cAAc,CAAC;AAIvE,eAAO,MAAM,uBAAuB,GAClC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemLocation: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemLocation: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemLocation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemLocation.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAuB,MAAM,cAAc,CAAC;AAIxE,eAAO,MAAM,wBAAwB,eACvB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemLocation.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAuB,MAAM,cAAc,CAAC;AAIxE,eAAO,MAAM,wBAAwB,GACnC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemPerson: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemPerson: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemPerson.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemPerson.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemPerson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAqB,MAAM,cAAc,CAAC;AAItE,eAAO,MAAM,sBAAsB,eACrB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemPerson.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemPerson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAqB,MAAM,cAAc,CAAC;AAItE,eAAO,MAAM,sBAAsB,GACjC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { ChannelSeasonIndex, EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemSeason: (parsedItem: Episode, item: Item, channelSeasonIndex: ChannelSeasonIndex, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemSeason: (parsedItem: Episode, item: Item, channelSeasonIndex: ChannelSeasonIndex, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemSeason.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemSeason.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSeason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,IAAI,EAC3B,MAAM,cAAc,CAAC;AAI1C,eAAO,MAAM,sBAAsB,eACrB,OAAO,QACb,IAAI,sBACU,kBAAkB,8BACV,aAAa,kBAe1C,CAAC"}
1
+ {"version":3,"file":"itemSeason.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSeason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,IAAI,EAC3B,MAAM,cAAc,CAAC;AAI1C,eAAO,MAAM,sBAAsB,GACjC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,oBAAoB,kBAAkB,EACtC,6BAA6B,aAAa,kBAe3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemSeasonEpisode: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemSeasonEpisode: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemSeasonEpisode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemSeasonEpisode.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSeasonEpisode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAA4B,MAAM,cAAc,CAAC;AAI7E,eAAO,MAAM,6BAA6B,eAC5B,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemSeasonEpisode.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSeasonEpisode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAA4B,MAAM,cAAc,CAAC;AAI7E,eAAO,MAAM,6BAA6B,GACxC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemSocialInteract: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemSocialInteract: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemSocialInteract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemSocialInteract.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSocialInteract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAA6B,MAAM,cAAc,CAAC;AAI9E,eAAO,MAAM,8BAA8B,eAC7B,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemSocialInteract.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSocialInteract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAA6B,MAAM,cAAc,CAAC;AAI9E,eAAO,MAAM,8BAA8B,GACzC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemSoundbite: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemSoundbite: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemSoundbite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemSoundbite.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSoundbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAIzE,eAAO,MAAM,yBAAyB,eACxB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemSoundbite.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemSoundbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAIzE,eAAO,MAAM,yBAAyB,GACpC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemTranscript: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemTranscript: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemTranscript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemTranscript.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemTranscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAyB,MAAM,cAAc,CAAC;AAI1E,eAAO,MAAM,0BAA0B,eACzB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemTranscript.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemTranscript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAyB,MAAM,cAAc,CAAC;AAI1E,eAAO,MAAM,0BAA0B,GACrC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
2
  import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemTxt: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
3
+ export declare const handleParsedItemTxt: (parsedItem: Episode, item: Item, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemTxt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemTxt.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemTxt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAInE,eAAO,MAAM,mBAAmB,eAClB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAK1C,CAAC"}
1
+ {"version":3,"file":"itemTxt.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemTxt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAInE,eAAO,MAAM,mBAAmB,GAC9B,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,6BAA6B,aAAa,kBAK3C,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { Episode } from "podcast-partytime";
2
- import { EntityManager, Item } from "podverse-orm";
3
- export declare const handleParsedItemValue: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
2
+ import { EntityManager, Item, Channel } from "podverse-orm";
3
+ export declare const handleParsedItemValue: (parsedItem: Episode, item: Item, channel: Channel, transactionalEntityManager?: EntityManager) => Promise<void>;
4
4
  //# sourceMappingURL=itemValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemValue.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAE3B,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,qBAAqB,eACpB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAkD1C,CAAC"}
1
+ {"version":3,"file":"itemValue.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAG1B,OAAO,EACR,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,qBAAqB,GAChC,YAAY,OAAO,EACnB,MAAM,IAAI,EACV,SAAS,OAAO,EAChB,6BAA6B,aAAa,kBA0D3C,CAAC"}
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.handleParsedItemValue = void 0;
13
13
  const podverse_orm_1 = require("podverse-orm");
14
14
  const item_1 = require("@parser/lib/compat/partytime/item");
15
- const handleParsedItemValue = (parsedItem, item, transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const handleParsedItemValue = (parsedItem, item, channel, transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
16
16
  const itemValueService = new podverse_orm_1.ItemValueService(transactionalEntityManager);
17
17
  const itemValueDtos = (0, item_1.compatItemValueDtos)(parsedItem);
18
18
  const itemValueRecipientService = new podverse_orm_1.ItemValueRecipientService(transactionalEntityManager);
@@ -33,6 +33,12 @@ const handleParsedItemValue = (parsedItem, item, transactionalEntityManager) =>
33
33
  }
34
34
  const itemValueTimeSplitDtos = itemValueDto.item_value_time_splits;
35
35
  if (itemValueTimeSplitDtos.length > 0) {
36
+ if (!channel.has_value_time_splits) {
37
+ const channelService = new podverse_orm_1.ChannelService();
38
+ yield channelService.update(channel.id, {
39
+ has_value_time_splits: true
40
+ });
41
+ }
36
42
  for (const itemValueTimeSplitDto of itemValueTimeSplitDtos) {
37
43
  const item_value_time_split = yield itemValueTimeSplitService.update(item_value, itemValueTimeSplitDto.meta);
38
44
  const itemValueTimeSplitRecipientDtos = itemValueTimeSplitDto.item_value_time_splits_recipients;
@@ -1,4 +1,7 @@
1
1
  import { Phase4PodcastLiveItem } from "podcast-partytime/dist/parser/phase/phase-4";
2
2
  import { Channel, ChannelSeasonIndex } from "podverse-orm";
3
- export declare const handleParsedLiveItems: (parsedLiveItems: Phase4PodcastLiveItem[], channel: Channel, channelSeasonIndex: ChannelSeasonIndex) => Promise<void>;
3
+ export type HandleParsedLiveItemsResult = {
4
+ newItemGuids: string[];
5
+ };
6
+ export declare const handleParsedLiveItems: (parsedLiveItems: Phase4PodcastLiveItem[], channel: Channel, channelSeasonIndex: ChannelSeasonIndex) => Promise<HandleParsedLiveItemsResult>;
4
7
  //# sourceMappingURL=liveItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"liveItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/liveItem/liveItem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAiB,OAAO,EAAE,kBAAkB,EAAgC,MAAM,cAAc,CAAC;AAIxG,eAAO,MAAM,qBAAqB,oBAA2B,qBAAqB,EAAE,WAAW,OAAO,sBAAsB,kBAAkB,kBA2B7I,CAAC"}
1
+ {"version":3,"file":"liveItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/liveItem/liveItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF,OAAO,EAA0B,OAAO,EAAE,kBAAkB,EAA0F,MAAM,cAAc,CAAC;AAM3K,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAyDF,eAAO,MAAM,qBAAqB,GAChC,iBAAiB,qBAAqB,EAAE,EACxC,SAAS,OAAO,EAChB,oBAAoB,kBAAkB,KACrC,OAAO,CAAC,2BAA2B,CAsCrC,CAAC"}
@@ -12,30 +12,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.handleParsedLiveItems = void 0;
13
13
  const podverse_helpers_1 = require("podverse-helpers");
14
14
  const podverse_orm_1 = require("podverse-orm");
15
+ const config_1 = require("@parser/config");
15
16
  const liveItem_1 = require("@parser/lib/compat/partytime/liveItem");
16
- const item_1 = require("../item/item");
17
+ const item_1 = require("@parser/lib/rss/item/item");
18
+ const itemFlagStatus_1 = require("podverse-orm/dist/entities/item/itemFlagStatus");
19
+ const processLiveItemBatch = (liveItemObjDtosBatch, channel, channelSeasonIndex, existingLiveItemMap, updatedLiveItemIds, newItemGuids, transactionalEntityManager, timerAccumulator, liveItemService) => __awaiter(void 0, void 0, void 0, function* () {
20
+ for (const liveItemObjDto of liveItemObjDtosBatch) {
21
+ const itemDto = liveItemObjDto.item;
22
+ const item = yield (0, item_1.handleParsedItem)({
23
+ parsedItem: itemDto,
24
+ channel,
25
+ channelSeasonIndex,
26
+ transactionalEntityManager,
27
+ timerAccumulator,
28
+ isLiveItem: true
29
+ });
30
+ updatedLiveItemIds.push(item.id);
31
+ const existingLiveItem = existingLiveItemMap.get(itemDto.guid);
32
+ const itemStatusEnum = (0, podverse_orm_1.getLiveItemStatusEnumValue)(itemDto.status);
33
+ if (!existingLiveItem ||
34
+ (existingLiveItem.live_item_status.id !== podverse_orm_1.LiveItemStatusEnum.Ended && itemStatusEnum === podverse_orm_1.LiveItemStatusEnum.Ended)) {
35
+ newItemGuids.push(itemDto.guid);
36
+ }
37
+ const liveItemDto = liveItemObjDto.liveItem;
38
+ yield liveItemService.update(item, liveItemDto);
39
+ }
40
+ });
41
+ const logTimerAccumulator = (timerAccumulator) => {
42
+ if (config_1.config.shouldLogTimer) {
43
+ Object.entries(timerAccumulator).forEach(([key, value]) => {
44
+ podverse_helpers_1.logger.info(`${key} took ${value}ms`);
45
+ });
46
+ }
47
+ };
17
48
  const handleParsedLiveItems = (parsedLiveItems, channel, channelSeasonIndex) => __awaiter(void 0, void 0, void 0, function* () {
18
49
  const itemService = new podverse_orm_1.ItemService();
19
- const existingLiveItems = yield itemService.getAllItemsWithLiveItemByChannel(channel, { select: ['id'] });
50
+ const liveItemService = new podverse_orm_1.LiveItemService();
51
+ const existingLiveItems = yield liveItemService.getManyByChannel(channel, { relations: ['item', 'live_item_status'] });
52
+ const existingLiveItemMap = new Map(existingLiveItems.map(live_item => [live_item.item.guid, live_item]));
20
53
  const existingLiveItemIds = existingLiveItems.map(live_item => live_item.id);
21
54
  const updatedLiveItemIds = [];
55
+ const newItemGuids = [];
22
56
  const liveItemObjDtos = (0, liveItem_1.compatLiveItemsDtos)(parsedLiveItems);
57
+ const timerAccumulator = (0, item_1.createItemTimerAccumulator)();
23
58
  const liveItemObjDtosBatchs = (0, podverse_helpers_1.chunkArray)(liveItemObjDtos, 50);
24
59
  for (const liveItemObjDtosBatch of liveItemObjDtosBatchs) {
25
- yield podverse_orm_1.AppDataSource.manager.transaction((transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
26
- for (const liveItemObjDto of liveItemObjDtosBatch) {
27
- // PTDO: how to make any unnecessary?
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- const itemDto = liveItemObjDto.item;
30
- const item = yield (0, item_1.handleParsedItem)(itemDto, channel, channelSeasonIndex, transactionalEntityManager);
31
- updatedLiveItemIds.push(item.id);
32
- const liveItemService = new podverse_orm_1.LiveItemService();
33
- const liveItemDto = liveItemObjDto.liveItem;
34
- yield liveItemService.update(item, liveItemDto);
35
- }
60
+ yield podverse_orm_1.AppDataSourceReadWrite.manager.transaction((transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
61
+ yield processLiveItemBatch(liveItemObjDtosBatch, channel, channelSeasonIndex, existingLiveItemMap, updatedLiveItemIds, newItemGuids, transactionalEntityManager, timerAccumulator, liveItemService);
36
62
  }));
37
63
  }
64
+ logTimerAccumulator(timerAccumulator);
38
65
  const itemIdsToDelete = existingLiveItemIds.filter(id => !updatedLiveItemIds.includes(id));
39
- yield itemService.deleteMany(itemIdsToDelete);
66
+ const itemsToDelete = existingLiveItems
67
+ .filter(liveItem => itemIdsToDelete.includes(liveItem.id))
68
+ .map(liveItem => liveItem.item);
69
+ yield itemService.updateManyFlagStatus(itemsToDelete, itemFlagStatus_1.ItemFlagStatusStatusEnum.PendingArchive);
70
+ return { newItemGuids };
40
71
  });
41
72
  exports.handleParsedLiveItems = handleParsedLiveItems;
@@ -1,4 +1,3 @@
1
- export declare const parseAllRSSFeeds: () => Promise<any>;
2
1
  export declare const getAndParseRSSFeed: (url: string) => Promise<import("podcast-partytime").FeedObject>;
3
- export declare const parseRSSFeedAndSaveToDatabase: (url: string, podcast_index_id: number) => Promise<any>;
2
+ export declare const parseRSSFeedAndSaveToDatabase: (url: string, podcast_index_id: number) => Promise<void>;
4
3
  //# sourceMappingURL=parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,oBAM5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAe,MAAM,oDASnD,CAAC;AAQF,eAAO,MAAM,6BAA6B,QAAe,MAAM,oBAAoB,MAAM,iBAiExF,CAAC"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,kBAAkB,GAAU,KAAK,MAAM,oDASnD,CAAC;AAQF,eAAO,MAAM,6BAA6B,GAAU,KAAK,MAAM,EAAE,kBAAkB,MAAM,kBA6ExF,CAAC"}
@@ -9,29 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.parseRSSFeedAndSaveToDatabase = exports.getAndParseRSSFeed = exports.parseAllRSSFeeds = void 0;
12
+ exports.parseRSSFeedAndSaveToDatabase = exports.getAndParseRSSFeed = void 0;
13
13
  const podcast_partytime_1 = require("podcast-partytime");
14
+ const podverse_external_services_1 = require("podverse-external-services");
14
15
  const podverse_helpers_1 = require("podverse-helpers");
15
16
  const podverse_orm_1 = require("podverse-orm");
17
+ const config_1 = require("@parser/config");
18
+ const notifications_1 = require("@parser/lib/notifications");
16
19
  const channel_1 = require("@parser/lib/rss/channel/channel");
17
- const item_1 = require("./item/item");
18
- const channelSeason_1 = require("./channel/channelSeason");
19
- const liveItem_1 = require("./liveItem/liveItem");
20
- const feed_1 = require("./feed/feed");
20
+ const channelSeason_1 = require("@parser/lib/rss/channel/channelSeason");
21
+ const feed_1 = require("@parser/lib/rss/feed/feed");
22
+ const item_1 = require("@parser/lib/rss/item/item");
23
+ const liveItem_1 = require("@parser/lib/rss/liveItem/liveItem");
24
+ const remoteItemParser_1 = require("@parser/lib/rss/remoteItemParser");
21
25
  /*
22
26
  NOTE: All RSS feeds that have a podcast_index_id will be saved to the database.
23
27
  RSS feeds without podcast_index_id (Add By RSS feeds) will NOT be saved to the database.
24
28
  */
25
- // TEMP: exists for development purposes
26
- const parseAllRSSFeeds = () => __awaiter(void 0, void 0, void 0, function* () {
27
- var _a;
28
- const feedService = new podverse_orm_1.FeedService();
29
- const feeds = yield feedService.getAll();
30
- for (const feed of feeds) {
31
- return yield (0, exports.parseRSSFeedAndSaveToDatabase)(feed.url, (_a = feed === null || feed === void 0 ? void 0 : feed.channel) === null || _a === void 0 ? void 0 : _a.podcast_index_id);
32
- }
33
- });
34
- exports.parseAllRSSFeeds = parseAllRSSFeeds;
35
29
  const getAndParseRSSFeed = (url) => __awaiter(void 0, void 0, void 0, function* () {
36
30
  const xml = yield (0, podverse_helpers_1.request)(url);
37
31
  const parsedFeed = (0, podcast_partytime_1.parseFeed)(xml, { allowMissingGuid: true });
@@ -47,56 +41,65 @@ exports.getAndParseRSSFeed = getAndParseRSSFeed;
47
41
  // return compatData;
48
42
  // };
49
43
  const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id) => __awaiter(void 0, void 0, void 0, function* () {
50
- podverse_helpers_1.logger.info(`parseRSSFeedAndSaveToDatabase ${url} ${podcast_index_id}`);
51
44
  const feedService = new podverse_orm_1.FeedService();
52
- let feed = yield feedService.getByUrlAndPodcastIndexId({ url, podcast_index_id });
53
- if (!feed) {
54
- feed = yield feedService.getByPodcastIndexId({ podcast_index_id });
55
- if (feed) {
56
- feed.url = url;
57
- yield feedService.update(feed.id, { url });
58
- }
59
- }
60
- // TODO: we may not want to create feeds in this helper in production
61
- // but i'm adding it here for stage testing.
62
- if (!feed) {
63
- feed = yield feedService.getOrCreate({ url, podcast_index_id });
64
- }
65
- if (!feed) {
66
- throw new Error(`parseRSSFeedAndSaveToDatabase: feed not found for ${url}`);
67
- }
68
- const parsedFeed = yield (0, feed_1.handleGetRSSFeed)(feed);
69
- podverse_helpers_1.logger.info(`item count: ${parsedFeed.items.length}`);
70
- feed = yield (0, feed_1.handleParsedFeed)(parsedFeed, feed);
45
+ let feed = null;
46
+ let channel = null;
47
+ const timerFullRunLabel = `parseRSSFeedAndSaveToDatabase ${url} ${podcast_index_id}`;
48
+ podverse_helpers_1.timerManager.start(timerFullRunLabel);
71
49
  try {
50
+ podverse_helpers_1.logger.info(`parseRSSFeedAndSaveToDatabase ${url} ${podcast_index_id}`);
51
+ feed = yield (0, feed_1.handleGetRSSFeed)(url, podcast_index_id);
52
+ if (!(0, podverse_orm_1.checkIfFeedFlagStatusShouldParse)(feed.feed_flag_status.id)) {
53
+ throw new Error(`parseRSSFeedAndSaveToDatabase: feed_flag_status.status is not Active or AlwaysAllow for ${feed.id} ${feed.channel.podcast_index_id} ${feed.url}`);
54
+ }
55
+ const parsedFeed = yield (0, feed_1.handleRequestRSSFeed)(feed);
56
+ feed = yield (0, feed_1.handleParsedFeed)(parsedFeed, feed);
72
57
  yield feedService.update(feed.id, { is_parsing: new Date() });
58
+ if ((0, podverse_orm_1.checkIfSpamFeed)(parsedFeed)) {
59
+ yield feedService.updateFlagStatus(feed, podverse_orm_1.FeedFlagStatusStatusEnum.Spam);
60
+ throw new Error(`parseRSSFeedAndSaveToDatabase: feed is spam ${feed.id} ${feed.channel.podcast_index_id} ${feed.url}`);
61
+ }
73
62
  const channelService = new podverse_orm_1.ChannelService();
74
- const channel = yield channelService.getOrCreateByPodcastIndexId({ feed, podcast_index_id });
75
- // ChannelSeason must be parsed before anything else, because the channel season rows
76
- // need to be created for other data to have a foreign key to them.
63
+ channel = yield channelService.getOrCreateByPodcastIndexId({ feed, podcast_index_id });
77
64
  yield (0, channelSeason_1.handleParsedChannelSeasons)(parsedFeed, channel);
78
65
  const channelSeasonService = new podverse_orm_1.ChannelSeasonService();
79
66
  const channelSeasonIndex = yield channelSeasonService.getChannelSeasonIndex(channel);
80
67
  yield (0, channel_1.handleParsedChannel)(parsedFeed, channel, channelSeasonIndex);
81
- // PTDO: if publisher feed, handle publisher remote item data
82
- // else handle parsed items
83
- yield (0, item_1.handleParsedItems)(parsedFeed.items, channel, channelSeasonIndex);
68
+ podverse_helpers_1.logger.info(`item count: ${parsedFeed.items.length}`);
69
+ const newItemIdentifiers = yield (0, item_1.handleParsedItems)(parsedFeed.items, channel, channelSeasonIndex);
70
+ let newLiveItemIdentifiers = { newItemGuids: [] };
84
71
  if (parsedFeed.podcastLiveItems) {
85
- yield (0, liveItem_1.handleParsedLiveItems)(parsedFeed.podcastLiveItems, channel, channelSeasonIndex);
72
+ newLiveItemIdentifiers = yield (0, liveItem_1.handleParsedLiveItems)(parsedFeed.podcastLiveItems, channel, channelSeasonIndex);
73
+ }
74
+ if (newItemIdentifiers.newItemGuids.length > 0 || newLiveItemIdentifiers.newItemGuids.length > 0) {
75
+ const googleAuthToken = yield (0, podverse_external_services_1.firebaseGenerateAccessToken)();
76
+ const notificationsService = new podverse_external_services_1.NotificationsService({ googleAuthToken });
77
+ const accountFCMDeviceService = new podverse_orm_1.AccountFCMDeviceService();
78
+ const itemService = new podverse_orm_1.ItemService();
79
+ if (newItemIdentifiers.newItemGuids.length > 0) {
80
+ yield (0, notifications_1.handleNewItemsNotifications)(newItemIdentifiers, channel, notificationsService, accountFCMDeviceService, itemService);
81
+ }
82
+ if (newLiveItemIdentifiers.newItemGuids.length > 0) {
83
+ yield (0, notifications_1.handleNewLiveItemsNotifications)(newLiveItemIdentifiers, channel, notificationsService, accountFCMDeviceService, itemService);
84
+ }
86
85
  }
87
- // TODO: handle new item notifications
88
- // TODO: handle new live_item notifications
89
86
  const feedLogService = new podverse_orm_1.FeedLogService();
90
87
  yield feedLogService.update(feed, { last_finished_parse_time: new Date() });
91
88
  }
92
89
  catch (error) {
93
- const err = error;
94
- podverse_helpers_1.logger.error('parseRSSFeedAndSaveToDatabase error:', err.stack);
95
- throw err;
90
+ (0, podverse_helpers_1.logError)('parseRSSFeedAndSaveToDatabase', error);
96
91
  }
97
92
  finally {
98
- yield feedService.update(feed.id, { is_parsing: null });
93
+ podverse_helpers_1.timerManager.endAll();
94
+ if (feed) {
95
+ yield feedService.update(feed.id, { is_parsing: null });
96
+ }
97
+ }
98
+ if (config_1.config.nodeEnv === 'production') {
99
+ if (channel) {
100
+ yield (0, remoteItemParser_1.handleAllRemoteItemsFeedParsing)(channel);
101
+ }
99
102
  }
100
- return feed;
103
+ return;
101
104
  });
102
105
  exports.parseRSSFeedAndSaveToDatabase = parseRSSFeedAndSaveToDatabase;
@@ -0,0 +1,3 @@
1
+ import { Channel } from "podverse-orm";
2
+ export declare const handleAllRemoteItemsFeedParsing: (channel: Channel) => Promise<void>;
3
+ //# sourceMappingURL=remoteItemParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteItemParser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/remoteItemParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EACsD,MAAM,cAAc,CAAC;AAoD3F,eAAO,MAAM,+BAA+B,GAAU,SAAS,OAAO,kBAOrE,CAAC"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handleAllRemoteItemsFeedParsing = void 0;
13
+ const podverse_helpers_1 = require("podverse-helpers");
14
+ const podverse_orm_1 = require("podverse-orm");
15
+ const podcastIndex_1 = require("@parser/factories/podcastIndex");
16
+ const parser_1 = require("@parser/lib/rss/parser");
17
+ function handleRequestDelay(url) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const delayConfig = [
20
+ { regex: /^https?:\/\/(www\.)?wavlake\.com/, delay: 5000 },
21
+ ];
22
+ for (const { regex, delay } of delayConfig) {
23
+ if (regex.test(url)) {
24
+ yield (0, podverse_helpers_1.sleep)(delay);
25
+ break;
26
+ }
27
+ }
28
+ });
29
+ }
30
+ const handleRemoteItemsFeedParsing = (feedGuidsToParse) => __awaiter(void 0, void 0, void 0, function* () {
31
+ var _a, _b;
32
+ const piFeedDatas = [];
33
+ for (const feedGuid of feedGuidsToParse) {
34
+ const feedService = new podverse_orm_1.FeedService();
35
+ const pvExistingFeed = yield feedService.getByPodcastGuid(feedGuid);
36
+ if (!pvExistingFeed) {
37
+ const piFeedDataResponse = yield podcastIndex_1.podcastIndexService.getPodcastByGuid(feedGuid);
38
+ if (((_a = piFeedDataResponse === null || piFeedDataResponse === void 0 ? void 0 : piFeedDataResponse.feed) === null || _a === void 0 ? void 0 : _a.id) && ((_b = piFeedDataResponse === null || piFeedDataResponse === void 0 ? void 0 : piFeedDataResponse.feed) === null || _b === void 0 ? void 0 : _b.url)) {
39
+ const piFeedData = {
40
+ id: piFeedDataResponse.feed.id,
41
+ url: piFeedDataResponse.feed.url
42
+ };
43
+ piFeedDatas.push(piFeedData);
44
+ }
45
+ }
46
+ }
47
+ for (const piFeedData of piFeedDatas) {
48
+ const feedService = new podverse_orm_1.FeedService();
49
+ let feed = yield feedService.getByUrlAndPodcastIndexId({ url: piFeedData.url, podcast_index_id: piFeedData.id });
50
+ if (!feed) {
51
+ yield handleRequestDelay(piFeedData.url);
52
+ podverse_helpers_1.logger.info(`handleRemoteItemsFeedParsing: ${piFeedData.url} ${piFeedData.id}`);
53
+ yield (0, parser_1.parseRSSFeedAndSaveToDatabase)(piFeedData.url, piFeedData.id);
54
+ }
55
+ }
56
+ });
57
+ const handleAllRemoteItemsFeedParsing = (channel) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const channelService = new podverse_orm_1.ChannelService();
59
+ const latestChannel = yield channelService.get(channel.id);
60
+ yield handleRemoteItemsPodrollParsing(channel);
61
+ yield handleRemoteItemsPublisherParsing(channel);
62
+ yield handleRemoteItemsChannelParsing(channel);
63
+ yield handleRemoteItemsItemValueTimeSplitParsing(latestChannel);
64
+ });
65
+ exports.handleAllRemoteItemsFeedParsing = handleAllRemoteItemsFeedParsing;
66
+ const handleRemoteItemsPodrollParsing = (channel) => __awaiter(void 0, void 0, void 0, function* () {
67
+ const channelPodrollService = new podverse_orm_1.ChannelPodrollService();
68
+ const channelPodroll = yield channelPodrollService.get(channel);
69
+ if (channelPodroll) {
70
+ const channelPodrollRemoteItemService = new podverse_orm_1.ChannelPodrollRemoteItemService();
71
+ const channelPodrollRemoteItems = yield channelPodrollRemoteItemService.getAll(channelPodroll);
72
+ const feedGuidsToParse = channelPodrollRemoteItems.map((remoteItem) => remoteItem.feed_guid);
73
+ yield handleRemoteItemsFeedParsing(feedGuidsToParse);
74
+ }
75
+ });
76
+ const handleRemoteItemsPublisherParsing = (channel) => __awaiter(void 0, void 0, void 0, function* () {
77
+ const channelPublisherService = new podverse_orm_1.ChannelPublisherService();
78
+ const channelPublisher = yield channelPublisherService.get(channel);
79
+ if (channelPublisher) {
80
+ const channelPublisherRemoteItemService = new podverse_orm_1.ChannelPublisherRemoteItemService();
81
+ const channelPublisherRemoteItems = yield channelPublisherRemoteItemService.getAll(channelPublisher);
82
+ const feedGuidsToParse = channelPublisherRemoteItems.map((remoteItem) => remoteItem.feed_guid);
83
+ yield handleRemoteItemsFeedParsing(feedGuidsToParse);
84
+ }
85
+ });
86
+ const handleRemoteItemsChannelParsing = (channel) => __awaiter(void 0, void 0, void 0, function* () {
87
+ const channelRemoteItemService = new podverse_orm_1.ChannelRemoteItemService();
88
+ const channelRemoteItems = yield channelRemoteItemService.getAll(channel);
89
+ const feedGuidsToParse = channelRemoteItems.map((remoteItem) => remoteItem.feed_guid);
90
+ yield handleRemoteItemsFeedParsing(feedGuidsToParse);
91
+ });
92
+ const handleRemoteItemsItemValueTimeSplitParsing = (channel) => __awaiter(void 0, void 0, void 0, function* () {
93
+ var _a, _b;
94
+ if (channel.has_value_time_splits) {
95
+ const itemService = new podverse_orm_1.ItemService();
96
+ const items = yield itemService.getManyByChannel(channel, {
97
+ relations: [
98
+ 'item_values',
99
+ 'item_values.item_value_time_splits',
100
+ 'item_values.item_value_time_splits.item_value_time_split_recipients',
101
+ 'item_values.item_value_time_splits.item_value_time_split_remote_item'
102
+ ]
103
+ });
104
+ for (const item of items) {
105
+ if (item) {
106
+ if (((_a = item.item_values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
107
+ for (const itemValue of item.item_values) {
108
+ if (((_b = itemValue.item_value_time_splits) === null || _b === void 0 ? void 0 : _b.length) > 0) {
109
+ for (const itemValueTimeSplit of itemValue.item_value_time_splits) {
110
+ if (itemValueTimeSplit.item_value_time_split_remote_item) {
111
+ const feedGuid = itemValueTimeSplit.item_value_time_split_remote_item.feed_guid;
112
+ yield handleRemoteItemsFeedParsing([feedGuid]);
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-parser",
3
- "version": "5.0.8",
3
+ "version": "5.1.0-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "build:watch": "nodemon --watch 'src' --watch $(realpath node_modules/podverse-helpers) --watch $(realpath node_modules/podverse-orm) --delay 500ms -x \"npm run build\"",
12
12
  "build": "tsc",
13
13
  "lint": "eslint ./src --ext .ts",
14
- "prepare": "npm run build",
14
+ "prepublishOnly": "npm run build",
15
15
  "start": "ts-node ./dist/index.js"
16
16
  },
17
17
  "author": "",
@@ -19,8 +19,9 @@
19
19
  "dependencies": {
20
20
  "module-alias": "^2.2.3",
21
21
  "podcast-partytime": "^4.8.1",
22
- "podverse-helpers": "^5.0.0",
23
- "podverse-orm": "^5.0.0"
22
+ "podverse-external-services": "^5.1.1-alpha.0",
23
+ "podverse-helpers": "^5.1.2-alpha.1",
24
+ "podverse-orm": "^5.1.0-alpha.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@eslint/config-array": "^0.18.0",