@ttkit/daily-hot-api 0.0.0-stage → 0.1.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 (450) hide show
  1. package/.env.example +77 -0
  2. package/LICENSE +21 -0
  3. package/README.md +317 -2
  4. package/bin/daily-hot-api.js +25 -0
  5. package/dist/app.controller.d.ts +41 -0
  6. package/dist/app.controller.js +91 -0
  7. package/dist/app.controller.js.map +1 -0
  8. package/dist/app.module.d.ts +4 -0
  9. package/dist/app.module.js +44 -0
  10. package/dist/app.module.js.map +1 -0
  11. package/dist/app.service.d.ts +19 -0
  12. package/dist/app.service.js +57 -0
  13. package/dist/app.service.js.map +1 -0
  14. package/dist/cache/cache.module.d.ts +2 -0
  15. package/dist/cache/cache.module.js +52 -0
  16. package/dist/cache/cache.module.js.map +1 -0
  17. package/dist/cache/cache.service.d.ts +26 -0
  18. package/dist/cache/cache.service.js +163 -0
  19. package/dist/cache/cache.service.js.map +1 -0
  20. package/dist/cli/args.d.ts +24 -0
  21. package/dist/cli/args.js +261 -0
  22. package/dist/cli/args.js.map +1 -0
  23. package/dist/cli/commands/logs.d.ts +3 -0
  24. package/dist/cli/commands/logs.js +55 -0
  25. package/dist/cli/commands/logs.js.map +1 -0
  26. package/dist/cli/commands/restart.d.ts +3 -0
  27. package/dist/cli/commands/restart.js +62 -0
  28. package/dist/cli/commands/restart.js.map +1 -0
  29. package/dist/cli/commands/start.d.ts +3 -0
  30. package/dist/cli/commands/start.js +280 -0
  31. package/dist/cli/commands/start.js.map +1 -0
  32. package/dist/cli/commands/status.d.ts +3 -0
  33. package/dist/cli/commands/status.js +78 -0
  34. package/dist/cli/commands/status.js.map +1 -0
  35. package/dist/cli/commands/stop.d.ts +12 -0
  36. package/dist/cli/commands/stop.js +135 -0
  37. package/dist/cli/commands/stop.js.map +1 -0
  38. package/dist/cli/context.d.ts +4 -0
  39. package/dist/cli/context.js +3 -0
  40. package/dist/cli/context.js.map +1 -0
  41. package/dist/cli/env.d.ts +2 -0
  42. package/dist/cli/env.js +80 -0
  43. package/dist/cli/env.js.map +1 -0
  44. package/dist/cli/errors.d.ts +14 -0
  45. package/dist/cli/errors.js +25 -0
  46. package/dist/cli/errors.js.map +1 -0
  47. package/dist/cli/health.d.ts +2 -0
  48. package/dist/cli/health.js +44 -0
  49. package/dist/cli/health.js.map +1 -0
  50. package/dist/cli/help.d.ts +3 -0
  51. package/dist/cli/help.js +158 -0
  52. package/dist/cli/help.js.map +1 -0
  53. package/dist/cli/index.d.ts +2 -0
  54. package/dist/cli/index.js +94 -0
  55. package/dist/cli/index.js.map +1 -0
  56. package/dist/cli/log-file.d.ts +8 -0
  57. package/dist/cli/log-file.js +58 -0
  58. package/dist/cli/log-file.js.map +1 -0
  59. package/dist/cli/output.d.ts +7 -0
  60. package/dist/cli/output.js +46 -0
  61. package/dist/cli/output.js.map +1 -0
  62. package/dist/cli/paths.d.ts +33 -0
  63. package/dist/cli/paths.js +76 -0
  64. package/dist/cli/paths.js.map +1 -0
  65. package/dist/cli/run-state.d.ts +25 -0
  66. package/dist/cli/run-state.js +159 -0
  67. package/dist/cli/run-state.js.map +1 -0
  68. package/dist/common/middlewares/logger.middleware.d.ts +7 -0
  69. package/dist/common/middlewares/logger.middleware.js +29 -0
  70. package/dist/common/middlewares/logger.middleware.js.map +1 -0
  71. package/dist/config/config.module.d.ts +2 -0
  72. package/dist/config/config.module.js +47 -0
  73. package/dist/config/config.module.js.map +1 -0
  74. package/dist/config/configuration.d.ts +3 -0
  75. package/dist/config/configuration.js +5 -0
  76. package/dist/config/configuration.js.map +1 -0
  77. package/dist/config/validation.schema.d.ts +114 -0
  78. package/dist/config/validation.schema.js +69 -0
  79. package/dist/config/validation.schema.js.map +1 -0
  80. package/dist/daily-brief/clients/ai-analysis.client.d.ts +20 -0
  81. package/dist/daily-brief/clients/ai-analysis.client.js +217 -0
  82. package/dist/daily-brief/clients/ai-analysis.client.js.map +1 -0
  83. package/dist/daily-brief/clients/brief-search.service.d.ts +11 -0
  84. package/dist/daily-brief/clients/brief-search.service.js +52 -0
  85. package/dist/daily-brief/clients/brief-search.service.js.map +1 -0
  86. package/dist/daily-brief/clients/deepseek-search.client.d.ts +11 -0
  87. package/dist/daily-brief/clients/deepseek-search.client.js +70 -0
  88. package/dist/daily-brief/clients/deepseek-search.client.js.map +1 -0
  89. package/dist/daily-brief/clients/tavily-search.client.d.ts +11 -0
  90. package/dist/daily-brief/clients/tavily-search.client.js +72 -0
  91. package/dist/daily-brief/clients/tavily-search.client.js.map +1 -0
  92. package/dist/daily-brief/daily-brief.config.d.ts +31 -0
  93. package/dist/daily-brief/daily-brief.config.js +108 -0
  94. package/dist/daily-brief/daily-brief.config.js.map +1 -0
  95. package/dist/daily-brief/daily-brief.controller.d.ts +72 -0
  96. package/dist/daily-brief/daily-brief.controller.js +169 -0
  97. package/dist/daily-brief/daily-brief.controller.js.map +1 -0
  98. package/dist/daily-brief/daily-brief.module.d.ts +2 -0
  99. package/dist/daily-brief/daily-brief.module.js +49 -0
  100. package/dist/daily-brief/daily-brief.module.js.map +1 -0
  101. package/dist/daily-brief/daily-brief.scheduler.d.ts +30 -0
  102. package/dist/daily-brief/daily-brief.scheduler.js +113 -0
  103. package/dist/daily-brief/daily-brief.scheduler.js.map +1 -0
  104. package/dist/daily-brief/daily-brief.service.d.ts +101 -0
  105. package/dist/daily-brief/daily-brief.service.js +412 -0
  106. package/dist/daily-brief/daily-brief.service.js.map +1 -0
  107. package/dist/daily-brief/dto/brief-date-param.dto.d.ts +3 -0
  108. package/dist/daily-brief/dto/brief-date-param.dto.js +23 -0
  109. package/dist/daily-brief/dto/brief-date-param.dto.js.map +1 -0
  110. package/dist/daily-brief/dto/generate-brief.dto.d.ts +6 -0
  111. package/dist/daily-brief/dto/generate-brief.dto.js +39 -0
  112. package/dist/daily-brief/dto/generate-brief.dto.js.map +1 -0
  113. package/dist/daily-brief/dto/list-briefs-query.dto.d.ts +6 -0
  114. package/dist/daily-brief/dto/list-briefs-query.dto.js +42 -0
  115. package/dist/daily-brief/dto/list-briefs-query.dto.js.map +1 -0
  116. package/dist/daily-brief/dto/stock-ranking-query.dto.d.ts +6 -0
  117. package/dist/daily-brief/dto/stock-ranking-query.dto.js +46 -0
  118. package/dist/daily-brief/dto/stock-ranking-query.dto.js.map +1 -0
  119. package/dist/daily-brief/interfaces/daily-brief.interface.d.ts +59 -0
  120. package/dist/daily-brief/interfaces/daily-brief.interface.js +3 -0
  121. package/dist/daily-brief/interfaces/daily-brief.interface.js.map +1 -0
  122. package/dist/daily-brief/interfaces/search-provider.interface.d.ts +11 -0
  123. package/dist/daily-brief/interfaces/search-provider.interface.js +3 -0
  124. package/dist/daily-brief/interfaces/search-provider.interface.js.map +1 -0
  125. package/dist/daily-brief/utils/brief-date.d.ts +2 -0
  126. package/dist/daily-brief/utils/brief-date.js +16 -0
  127. package/dist/daily-brief/utils/brief-date.js.map +1 -0
  128. package/dist/daily-brief/utils/concurrency.d.ts +1 -0
  129. package/dist/daily-brief/utils/concurrency.js +20 -0
  130. package/dist/daily-brief/utils/concurrency.js.map +1 -0
  131. package/dist/database/database.module.d.ts +2 -0
  132. package/dist/database/database.module.js +57 -0
  133. package/dist/database/database.module.js.map +1 -0
  134. package/dist/database/repositories/daily-brief.repository.d.ts +96 -0
  135. package/dist/database/repositories/daily-brief.repository.js +457 -0
  136. package/dist/database/repositories/daily-brief.repository.js.map +1 -0
  137. package/dist/database/repositories/hot-item.repository.d.ts +52 -0
  138. package/dist/database/repositories/hot-item.repository.js +255 -0
  139. package/dist/database/repositories/hot-item.repository.js.map +1 -0
  140. package/dist/database/repositories/source-config.repository.d.ts +15 -0
  141. package/dist/database/repositories/source-config.repository.js +77 -0
  142. package/dist/database/repositories/source-config.repository.js.map +1 -0
  143. package/dist/database/schemas/daily-brief.schema.d.ts +30 -0
  144. package/dist/database/schemas/daily-brief.schema.js +103 -0
  145. package/dist/database/schemas/daily-brief.schema.js.map +1 -0
  146. package/dist/database/schemas/hot-item.schema.d.ts +20 -0
  147. package/dist/database/schemas/hot-item.schema.js +72 -0
  148. package/dist/database/schemas/hot-item.schema.js.map +1 -0
  149. package/dist/database/schemas/source-config.schema.d.ts +15 -0
  150. package/dist/database/schemas/source-config.schema.js +47 -0
  151. package/dist/database/schemas/source-config.schema.js.map +1 -0
  152. package/dist/history/dto/history-response.dto.d.ts +17 -0
  153. package/dist/history/dto/history-response.dto.js +13 -0
  154. package/dist/history/dto/history-response.dto.js.map +1 -0
  155. package/dist/history/dto/search-history.dto.d.ts +10 -0
  156. package/dist/history/dto/search-history.dto.js +72 -0
  157. package/dist/history/dto/search-history.dto.js.map +1 -0
  158. package/dist/history/history.controller.d.ts +13 -0
  159. package/dist/history/history.controller.js +92 -0
  160. package/dist/history/history.controller.js.map +1 -0
  161. package/dist/history/history.module.d.ts +2 -0
  162. package/dist/history/history.module.js +25 -0
  163. package/dist/history/history.module.js.map +1 -0
  164. package/dist/history/history.service.d.ts +15 -0
  165. package/dist/history/history.service.js +68 -0
  166. package/dist/history/history.service.js.map +1 -0
  167. package/dist/host-lists/decorators/hot-source.decorator.d.ts +9 -0
  168. package/dist/host-lists/decorators/hot-source.decorator.js +11 -0
  169. package/dist/host-lists/decorators/hot-source.decorator.js.map +1 -0
  170. package/dist/host-lists/dto/hot-list.dto.d.ts +14 -0
  171. package/dist/host-lists/dto/hot-list.dto.js +94 -0
  172. package/dist/host-lists/dto/hot-list.dto.js.map +1 -0
  173. package/dist/host-lists/hot-lists.controller.d.ts +39 -0
  174. package/dist/host-lists/hot-lists.controller.js +87 -0
  175. package/dist/host-lists/hot-lists.controller.js.map +1 -0
  176. package/dist/host-lists/hot-lists.module.d.ts +2 -0
  177. package/dist/host-lists/hot-lists.module.js +36 -0
  178. package/dist/host-lists/hot-lists.module.js.map +1 -0
  179. package/dist/host-lists/hot-lists.service.d.ts +21 -0
  180. package/dist/host-lists/hot-lists.service.js +115 -0
  181. package/dist/host-lists/hot-lists.service.js.map +1 -0
  182. package/dist/host-lists/interfaces/hot-list-source.interface.d.ts +5 -0
  183. package/dist/host-lists/interfaces/hot-list-source.interface.js +3 -0
  184. package/dist/host-lists/interfaces/hot-list-source.interface.js.map +1 -0
  185. package/dist/host-lists/interfaces/hot-list.interface.d.ts +31 -0
  186. package/dist/host-lists/interfaces/hot-list.interface.js +3 -0
  187. package/dist/host-lists/interfaces/hot-list.interface.js.map +1 -0
  188. package/dist/host-lists/interfaces/router-data.interface.d.ts +19 -0
  189. package/dist/host-lists/interfaces/router-data.interface.js +3 -0
  190. package/dist/host-lists/interfaces/router-data.interface.js.map +1 -0
  191. package/dist/host-lists/sources/36kr.source.d.ts +9 -0
  192. package/dist/host-lists/sources/36kr.source.js +89 -0
  193. package/dist/host-lists/sources/36kr.source.js.map +1 -0
  194. package/dist/host-lists/sources/51cto.source.d.ts +11 -0
  195. package/dist/host-lists/sources/51cto.source.js +71 -0
  196. package/dist/host-lists/sources/51cto.source.js.map +1 -0
  197. package/dist/host-lists/sources/52pojie.source.d.ts +9 -0
  198. package/dist/host-lists/sources/52pojie.source.js +109 -0
  199. package/dist/host-lists/sources/52pojie.source.js.map +1 -0
  200. package/dist/host-lists/sources/acfun.source.d.ts +9 -0
  201. package/dist/host-lists/sources/acfun.source.js +90 -0
  202. package/dist/host-lists/sources/acfun.source.js.map +1 -0
  203. package/dist/host-lists/sources/baidu.source.d.ts +9 -0
  204. package/dist/host-lists/sources/baidu.source.js +85 -0
  205. package/dist/host-lists/sources/baidu.source.js.map +1 -0
  206. package/dist/host-lists/sources/bilibili.source.d.ts +14 -0
  207. package/dist/host-lists/sources/bilibili.source.js +188 -0
  208. package/dist/host-lists/sources/bilibili.source.js.map +1 -0
  209. package/dist/host-lists/sources/caixin.source.d.ts +9 -0
  210. package/dist/host-lists/sources/caixin.source.js +102 -0
  211. package/dist/host-lists/sources/caixin.source.js.map +1 -0
  212. package/dist/host-lists/sources/cls.source.d.ts +9 -0
  213. package/dist/host-lists/sources/cls.source.js +62 -0
  214. package/dist/host-lists/sources/cls.source.js.map +1 -0
  215. package/dist/host-lists/sources/coolapk.source.d.ts +9 -0
  216. package/dist/host-lists/sources/coolapk.source.js +57 -0
  217. package/dist/host-lists/sources/coolapk.source.js.map +1 -0
  218. package/dist/host-lists/sources/csdn.source.d.ts +9 -0
  219. package/dist/host-lists/sources/csdn.source.js +59 -0
  220. package/dist/host-lists/sources/csdn.source.js.map +1 -0
  221. package/dist/host-lists/sources/dgtle.source.d.ts +9 -0
  222. package/dist/host-lists/sources/dgtle.source.js +57 -0
  223. package/dist/host-lists/sources/dgtle.source.js.map +1 -0
  224. package/dist/host-lists/sources/douban-group.source.d.ts +11 -0
  225. package/dist/host-lists/sources/douban-group.source.js +100 -0
  226. package/dist/host-lists/sources/douban-group.source.js.map +1 -0
  227. package/dist/host-lists/sources/douban-movie.source.d.ts +10 -0
  228. package/dist/host-lists/sources/douban-movie.source.js +103 -0
  229. package/dist/host-lists/sources/douban-movie.source.js.map +1 -0
  230. package/dist/host-lists/sources/douyin.d.ts +16 -0
  231. package/dist/host-lists/sources/douyin.js +215 -0
  232. package/dist/host-lists/sources/douyin.js.map +1 -0
  233. package/dist/host-lists/sources/eastmoney-stock.source.d.ts +11 -0
  234. package/dist/host-lists/sources/eastmoney-stock.source.js +151 -0
  235. package/dist/host-lists/sources/eastmoney-stock.source.js.map +1 -0
  236. package/dist/host-lists/sources/eastmoney.source.d.ts +9 -0
  237. package/dist/host-lists/sources/eastmoney.source.js +86 -0
  238. package/dist/host-lists/sources/eastmoney.source.js.map +1 -0
  239. package/dist/host-lists/sources/geekpark.source.d.ts +9 -0
  240. package/dist/host-lists/sources/geekpark.source.js +60 -0
  241. package/dist/host-lists/sources/geekpark.source.js.map +1 -0
  242. package/dist/host-lists/sources/gelonghui.source.d.ts +9 -0
  243. package/dist/host-lists/sources/gelonghui.source.js +139 -0
  244. package/dist/host-lists/sources/gelonghui.source.js.map +1 -0
  245. package/dist/host-lists/sources/github.source.d.ts +12 -0
  246. package/dist/host-lists/sources/github.source.js +171 -0
  247. package/dist/host-lists/sources/github.source.js.map +1 -0
  248. package/dist/host-lists/sources/guokr.source.d.ts +11 -0
  249. package/dist/host-lists/sources/guokr.source.js +98 -0
  250. package/dist/host-lists/sources/guokr.source.js.map +1 -0
  251. package/dist/host-lists/sources/hackernews.source.d.ts +11 -0
  252. package/dist/host-lists/sources/hackernews.source.js +121 -0
  253. package/dist/host-lists/sources/hackernews.source.js.map +1 -0
  254. package/dist/host-lists/sources/hellogithub.source.d.ts +11 -0
  255. package/dist/host-lists/sources/hellogithub.source.js +98 -0
  256. package/dist/host-lists/sources/hellogithub.source.js.map +1 -0
  257. package/dist/host-lists/sources/history.source.d.ts +11 -0
  258. package/dist/host-lists/sources/history.source.js +92 -0
  259. package/dist/host-lists/sources/history.source.js.map +1 -0
  260. package/dist/host-lists/sources/honkai.source.d.ts +9 -0
  261. package/dist/host-lists/sources/honkai.source.js +72 -0
  262. package/dist/host-lists/sources/honkai.source.js.map +1 -0
  263. package/dist/host-lists/sources/hostloc.source.d.ts +9 -0
  264. package/dist/host-lists/sources/hostloc.source.js +75 -0
  265. package/dist/host-lists/sources/hostloc.source.js.map +1 -0
  266. package/dist/host-lists/sources/hupu.source.d.ts +9 -0
  267. package/dist/host-lists/sources/hupu.source.js +73 -0
  268. package/dist/host-lists/sources/hupu.source.js.map +1 -0
  269. package/dist/host-lists/sources/huxiu.source.d.ts +9 -0
  270. package/dist/host-lists/sources/huxiu.source.js +153 -0
  271. package/dist/host-lists/sources/huxiu.source.js.map +1 -0
  272. package/dist/host-lists/sources/ifanr.source.d.ts +9 -0
  273. package/dist/host-lists/sources/ifanr.source.js +57 -0
  274. package/dist/host-lists/sources/ifanr.source.js.map +1 -0
  275. package/dist/host-lists/sources/index.d.ts +2 -0
  276. package/dist/host-lists/sources/index.js +134 -0
  277. package/dist/host-lists/sources/index.js.map +1 -0
  278. package/dist/host-lists/sources/ithome-xijiayi.source.d.ts +9 -0
  279. package/dist/host-lists/sources/ithome-xijiayi.source.js +75 -0
  280. package/dist/host-lists/sources/ithome-xijiayi.source.js.map +1 -0
  281. package/dist/host-lists/sources/ithome.source.d.ts +9 -0
  282. package/dist/host-lists/sources/ithome.source.js +71 -0
  283. package/dist/host-lists/sources/ithome.source.js.map +1 -0
  284. package/dist/host-lists/sources/jd.source.d.ts +9 -0
  285. package/dist/host-lists/sources/jd.source.js +82 -0
  286. package/dist/host-lists/sources/jd.source.js.map +1 -0
  287. package/dist/host-lists/sources/jianshu.source.d.ts +9 -0
  288. package/dist/host-lists/sources/jianshu.source.js +72 -0
  289. package/dist/host-lists/sources/jianshu.source.js.map +1 -0
  290. package/dist/host-lists/sources/jin10.source.d.ts +9 -0
  291. package/dist/host-lists/sources/jin10.source.js +63 -0
  292. package/dist/host-lists/sources/jin10.source.js.map +1 -0
  293. package/dist/host-lists/sources/juejin.source.d.ts +10 -0
  294. package/dist/host-lists/sources/juejin.source.js +81 -0
  295. package/dist/host-lists/sources/juejin.source.js.map +1 -0
  296. package/dist/host-lists/sources/kuaishou.source.d.ts +13 -0
  297. package/dist/host-lists/sources/kuaishou.source.js +179 -0
  298. package/dist/host-lists/sources/kuaishou.source.js.map +1 -0
  299. package/dist/host-lists/sources/linuxdo.source.d.ts +9 -0
  300. package/dist/host-lists/sources/linuxdo.source.js +62 -0
  301. package/dist/host-lists/sources/linuxdo.source.js.map +1 -0
  302. package/dist/host-lists/sources/lol.source.d.ts +9 -0
  303. package/dist/host-lists/sources/lol.source.js +58 -0
  304. package/dist/host-lists/sources/lol.source.js.map +1 -0
  305. package/dist/host-lists/sources/miyoushe.source.d.ts +9 -0
  306. package/dist/host-lists/sources/miyoushe.source.js +88 -0
  307. package/dist/host-lists/sources/miyoushe.source.js.map +1 -0
  308. package/dist/host-lists/sources/netease-news.source.d.ts +9 -0
  309. package/dist/host-lists/sources/netease-news.source.js +56 -0
  310. package/dist/host-lists/sources/netease-news.source.js.map +1 -0
  311. package/dist/host-lists/sources/ngabbs.source.d.ts +9 -0
  312. package/dist/host-lists/sources/ngabbs.source.js +70 -0
  313. package/dist/host-lists/sources/ngabbs.source.js.map +1 -0
  314. package/dist/host-lists/sources/nodeseek.source.d.ts +9 -0
  315. package/dist/host-lists/sources/nodeseek.source.js +62 -0
  316. package/dist/host-lists/sources/nodeseek.source.js.map +1 -0
  317. package/dist/host-lists/sources/nytimes.source.d.ts +9 -0
  318. package/dist/host-lists/sources/nytimes.source.js +77 -0
  319. package/dist/host-lists/sources/nytimes.source.js.map +1 -0
  320. package/dist/host-lists/sources/producthunt.source.d.ts +9 -0
  321. package/dist/host-lists/sources/producthunt.source.js +75 -0
  322. package/dist/host-lists/sources/producthunt.source.js.map +1 -0
  323. package/dist/host-lists/sources/qq-news.source.d.ts +9 -0
  324. package/dist/host-lists/sources/qq-news.source.js +53 -0
  325. package/dist/host-lists/sources/qq-news.source.js.map +1 -0
  326. package/dist/host-lists/sources/sina-news.source.d.ts +9 -0
  327. package/dist/host-lists/sources/sina-news.source.js +98 -0
  328. package/dist/host-lists/sources/sina-news.source.js.map +1 -0
  329. package/dist/host-lists/sources/sina.source.d.ts +9 -0
  330. package/dist/host-lists/sources/sina.source.js +78 -0
  331. package/dist/host-lists/sources/sina.source.js.map +1 -0
  332. package/dist/host-lists/sources/smzdm.source.d.ts +9 -0
  333. package/dist/host-lists/sources/smzdm.source.js +71 -0
  334. package/dist/host-lists/sources/smzdm.source.js.map +1 -0
  335. package/dist/host-lists/sources/sspai.source.d.ts +9 -0
  336. package/dist/host-lists/sources/sspai.source.js +69 -0
  337. package/dist/host-lists/sources/sspai.source.js.map +1 -0
  338. package/dist/host-lists/sources/starrail.source.d.ts +9 -0
  339. package/dist/host-lists/sources/starrail.source.js +72 -0
  340. package/dist/host-lists/sources/starrail.source.js.map +1 -0
  341. package/dist/host-lists/sources/taobao.source.d.ts +10 -0
  342. package/dist/host-lists/sources/taobao.source.js +169 -0
  343. package/dist/host-lists/sources/taobao.source.js.map +1 -0
  344. package/dist/host-lists/sources/thepaper.source.d.ts +9 -0
  345. package/dist/host-lists/sources/thepaper.source.js +56 -0
  346. package/dist/host-lists/sources/thepaper.source.js.map +1 -0
  347. package/dist/host-lists/sources/tieba.source.d.ts +9 -0
  348. package/dist/host-lists/sources/tieba.source.js +58 -0
  349. package/dist/host-lists/sources/tieba.source.js.map +1 -0
  350. package/dist/host-lists/sources/tonghuashun.source.d.ts +9 -0
  351. package/dist/host-lists/sources/tonghuashun.source.js +112 -0
  352. package/dist/host-lists/sources/tonghuashun.source.js.map +1 -0
  353. package/dist/host-lists/sources/toutiao.source.d.ts +9 -0
  354. package/dist/host-lists/sources/toutiao.source.js +56 -0
  355. package/dist/host-lists/sources/toutiao.source.js.map +1 -0
  356. package/dist/host-lists/sources/v2ex.source.d.ts +9 -0
  357. package/dist/host-lists/sources/v2ex.source.js +67 -0
  358. package/dist/host-lists/sources/v2ex.source.js.map +1 -0
  359. package/dist/host-lists/sources/wallstreet.source.d.ts +9 -0
  360. package/dist/host-lists/sources/wallstreet.source.js +59 -0
  361. package/dist/host-lists/sources/wallstreet.source.js.map +1 -0
  362. package/dist/host-lists/sources/weatheralarm.source.d.ts +9 -0
  363. package/dist/host-lists/sources/weatheralarm.source.js +68 -0
  364. package/dist/host-lists/sources/weatheralarm.source.js.map +1 -0
  365. package/dist/host-lists/sources/weibo.source.d.ts +15 -0
  366. package/dist/host-lists/sources/weibo.source.js +180 -0
  367. package/dist/host-lists/sources/weibo.source.js.map +1 -0
  368. package/dist/host-lists/sources/weread.source.d.ts +9 -0
  369. package/dist/host-lists/sources/weread.source.js +82 -0
  370. package/dist/host-lists/sources/weread.source.js.map +1 -0
  371. package/dist/host-lists/sources/xinyu.source.d.ts +9 -0
  372. package/dist/host-lists/sources/xinyu.source.js +151 -0
  373. package/dist/host-lists/sources/xinyu.source.js.map +1 -0
  374. package/dist/host-lists/sources/yicai.source.d.ts +9 -0
  375. package/dist/host-lists/sources/yicai.source.js +113 -0
  376. package/dist/host-lists/sources/yicai.source.js.map +1 -0
  377. package/dist/host-lists/sources/yystv.source.d.ts +9 -0
  378. package/dist/host-lists/sources/yystv.source.js +57 -0
  379. package/dist/host-lists/sources/yystv.source.js.map +1 -0
  380. package/dist/host-lists/sources/zhihu-daily.source.d.ts +9 -0
  381. package/dist/host-lists/sources/zhihu-daily.source.js +60 -0
  382. package/dist/host-lists/sources/zhihu-daily.source.js.map +1 -0
  383. package/dist/host-lists/sources/zhihu.source.d.ts +12 -0
  384. package/dist/host-lists/sources/zhihu.source.js +195 -0
  385. package/dist/host-lists/sources/zhihu.source.js.map +1 -0
  386. package/dist/http/http.module.d.ts +2 -0
  387. package/dist/http/http.module.js +30 -0
  388. package/dist/http/http.module.js.map +1 -0
  389. package/dist/http/http.service.d.ts +53 -0
  390. package/dist/http/http.service.js +277 -0
  391. package/dist/http/http.service.js.map +1 -0
  392. package/dist/main.d.ts +3 -0
  393. package/dist/main.js +70 -0
  394. package/dist/main.js.map +1 -0
  395. package/dist/rss/rss.module.d.ts +2 -0
  396. package/dist/rss/rss.module.js +21 -0
  397. package/dist/rss/rss.module.js.map +1 -0
  398. package/dist/rss/rss.service.d.ts +5 -0
  399. package/dist/rss/rss.service.js +55 -0
  400. package/dist/rss/rss.service.js.map +1 -0
  401. package/dist/scheduler/dto/trigger-fetch.dto.d.ts +3 -0
  402. package/dist/scheduler/dto/trigger-fetch.dto.js +22 -0
  403. package/dist/scheduler/dto/trigger-fetch.dto.js.map +1 -0
  404. package/dist/scheduler/dto/update-source-config.dto.d.ts +4 -0
  405. package/dist/scheduler/dto/update-source-config.dto.js +29 -0
  406. package/dist/scheduler/dto/update-source-config.dto.js.map +1 -0
  407. package/dist/scheduler/scheduler.controller.d.ts +52 -0
  408. package/dist/scheduler/scheduler.controller.js +132 -0
  409. package/dist/scheduler/scheduler.controller.js.map +1 -0
  410. package/dist/scheduler/scheduler.module.d.ts +2 -0
  411. package/dist/scheduler/scheduler.module.js +34 -0
  412. package/dist/scheduler/scheduler.module.js.map +1 -0
  413. package/dist/scheduler/scheduler.service.d.ts +54 -0
  414. package/dist/scheduler/scheduler.service.js +238 -0
  415. package/dist/scheduler/scheduler.service.js.map +1 -0
  416. package/dist/scheduler/tasks/fetch-hot-data.task.d.ts +34 -0
  417. package/dist/scheduler/tasks/fetch-hot-data.task.js +175 -0
  418. package/dist/scheduler/tasks/fetch-hot-data.task.js.map +1 -0
  419. package/dist/token/coolapk.d.ts +11 -0
  420. package/dist/token/coolapk.js +40 -0
  421. package/dist/token/coolapk.js.map +1 -0
  422. package/dist/token/token.module.d.ts +2 -0
  423. package/dist/token/token.module.js +23 -0
  424. package/dist/token/token.module.js.map +1 -0
  425. package/dist/token/token.service.d.ts +19 -0
  426. package/dist/token/token.service.js +115 -0
  427. package/dist/token/token.service.js.map +1 -0
  428. package/dist/token/tools.d.ts +1 -0
  429. package/dist/token/tools.js +15 -0
  430. package/dist/token/tools.js.map +1 -0
  431. package/dist/token/weread.d.ts +2 -0
  432. package/dist/token/weread.js +55 -0
  433. package/dist/token/weread.js.map +1 -0
  434. package/dist/utils/getNum.d.ts +1 -0
  435. package/dist/utils/getNum.js +20 -0
  436. package/dist/utils/getNum.js.map +1 -0
  437. package/dist/utils/getTime.d.ts +11 -0
  438. package/dist/utils/getTime.js +134 -0
  439. package/dist/utils/getTime.js.map +1 -0
  440. package/dist/utils/headers.d.ts +16 -0
  441. package/dist/utils/headers.js +20 -0
  442. package/dist/utils/headers.js.map +1 -0
  443. package/dist/utils/index.d.ts +1 -0
  444. package/dist/utils/index.js +12 -0
  445. package/dist/utils/index.js.map +1 -0
  446. package/dist/utils/parseRSS.d.ts +11 -0
  447. package/dist/utils/parseRSS.js +47 -0
  448. package/dist/utils/parseRSS.js.map +1 -0
  449. package/package.json +148 -4
  450. package/views/home.hbs +65 -0
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var HotItemRepository_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.HotItemRepository = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const mongoose_1 = require("@nestjs/mongoose");
19
+ const mongoose_2 = require("mongoose");
20
+ const hot_item_schema_1 = require("../schemas/hot-item.schema");
21
+ const MIGRATION_DOC = 'docs/operations/hot-item-index-migration.md';
22
+ let HotItemRepository = HotItemRepository_1 = class HotItemRepository {
23
+ constructor(hotItemModel) {
24
+ this.hotItemModel = hotItemModel;
25
+ this.logger = new common_1.Logger(HotItemRepository_1.name);
26
+ this.statsVersion = 0;
27
+ }
28
+ onApplicationBootstrap() {
29
+ void this.verifyUniqueIndex();
30
+ }
31
+ async verifyUniqueIndex() {
32
+ const collection = this.hotItemModel.collection.collectionName;
33
+ try {
34
+ await this.hotItemModel.init();
35
+ }
36
+ catch (error) {
37
+ this.logger.warn(`${collection} 索引创建失败:${error instanceof Error ? error.message : String(error)}`);
38
+ }
39
+ try {
40
+ const indexes = await this.hotItemModel.collection.indexes();
41
+ const ready = indexes.some((index) => this.isSourceUrlIndex(index.key) &&
42
+ index.unique === true);
43
+ if (ready) {
44
+ this.logger.log(`${collection} 的 {source,url} 唯一索引已就绪`);
45
+ return;
46
+ }
47
+ this.logger.warn(`${collection} 的 {source,url} 不是唯一索引,并发抓取仍可能写入重复历史记录。` +
48
+ `请按 ${MIGRATION_DOC} 清理重复数据并重建 source_1_url_1 唯一索引。`);
49
+ }
50
+ catch (error) {
51
+ this.logger.warn(`无法读取 ${collection} 的索引状态:${error instanceof Error ? error.message : String(error)}`);
52
+ }
53
+ }
54
+ isSourceUrlIndex(key) {
55
+ const fields = Object.keys(key ?? {});
56
+ return fields.length === 2 && fields[0] === 'source' && fields[1] === 'url';
57
+ }
58
+ async isDuplicate(source, url) {
59
+ const existing = await this.hotItemModel.findOne({ source, url });
60
+ return !!existing;
61
+ }
62
+ async getDuplicateUrls(source, urls) {
63
+ const existingItems = await this.hotItemModel.find({ source, url: { $in: urls } }, { url: 1 });
64
+ return new Set(existingItems.map((item) => item.url));
65
+ }
66
+ validateAndCleanItem(item) {
67
+ if (!item.title ||
68
+ typeof item.title !== 'string' ||
69
+ item.title.trim() === '') {
70
+ return null;
71
+ }
72
+ if (!item.url || typeof item.url !== 'string' || !item.url.trim()) {
73
+ return null;
74
+ }
75
+ return {
76
+ ...item,
77
+ title: item.title.trim(),
78
+ desc: item.desc?.trim() || '',
79
+ url: item.url.trim(),
80
+ mobileUrl: item.mobileUrl,
81
+ author: item.author?.trim() || '',
82
+ hot: item.hot || 0,
83
+ };
84
+ }
85
+ async saveHotItems(items, source) {
86
+ if (items.length === 0)
87
+ return 0;
88
+ const originalCount = items.length;
89
+ const validItems = items
90
+ .map((item) => this.validateAndCleanItem(item))
91
+ .filter((item) => item !== null);
92
+ const validCount = validItems.length;
93
+ const invalidCount = originalCount - validCount;
94
+ if (invalidCount > 0) {
95
+ this.logger.warn(`Filtered out ${invalidCount} invalid items for source: ${source}`);
96
+ }
97
+ if (validItems.length === 0) {
98
+ this.logger.warn(`No valid items to save for source: ${source}`);
99
+ return 0;
100
+ }
101
+ const seenUrls = new Set();
102
+ const uniqueItems = validItems.filter((item) => {
103
+ if (seenUrls.has(item.url))
104
+ return false;
105
+ seenUrls.add(item.url);
106
+ return true;
107
+ });
108
+ const now = new Date();
109
+ const operations = uniqueItems.map((item) => ({
110
+ updateOne: {
111
+ filter: { source, url: item.url },
112
+ update: {
113
+ $setOnInsert: {
114
+ ...item,
115
+ source,
116
+ timestamp: item.timestamp || now.getTime(),
117
+ createdAt: now,
118
+ updatedAt: now,
119
+ },
120
+ },
121
+ upsert: true,
122
+ timestamps: false,
123
+ },
124
+ }));
125
+ try {
126
+ const result = await this.hotItemModel.bulkWrite(operations, {
127
+ ordered: false,
128
+ });
129
+ this.logger.log(`${source}: ${originalCount} fetched → ${uniqueItems.length} unique → ${result.upsertedCount} new`);
130
+ if (result.upsertedCount > 0)
131
+ this.invalidateStats();
132
+ return result.upsertedCount;
133
+ }
134
+ catch (error) {
135
+ const result = error.result;
136
+ if ((result?.upsertedCount ?? 0) > 0)
137
+ this.invalidateStats();
138
+ const writeErrors = error
139
+ ?.writeErrors;
140
+ if (writeErrors?.length &&
141
+ writeErrors.every((item) => item.code === 11000)) {
142
+ return result?.upsertedCount ?? 0;
143
+ }
144
+ this.logger.error(`Failed to save items for source ${source}:`, error);
145
+ throw error;
146
+ }
147
+ }
148
+ async searchHistory(options) {
149
+ const { source, keyword, startDate, endDate, page = 1, limit = 20, sortBy = 'timestamp', sortOrder = 'desc', } = options;
150
+ const query = {};
151
+ if (source) {
152
+ query.source = source;
153
+ }
154
+ if (keyword) {
155
+ if (keyword.length > 100) {
156
+ throw new Error('keyword must be at most 100 characters');
157
+ }
158
+ const literalKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
159
+ query.$or = [
160
+ { title: { $regex: literalKeyword, $options: 'i' } },
161
+ { desc: { $regex: literalKeyword, $options: 'i' } },
162
+ ];
163
+ }
164
+ if (startDate || endDate) {
165
+ query.timestamp = {};
166
+ if (startDate) {
167
+ query.timestamp.$gte = startDate.getTime();
168
+ }
169
+ if (endDate) {
170
+ query.timestamp.$lte = endDate.getTime();
171
+ }
172
+ }
173
+ const sort = {};
174
+ sort[sortBy] = sortOrder === 'desc' ? -1 : 1;
175
+ const skip = (page - 1) * limit;
176
+ const [data, total] = await Promise.all([
177
+ this.hotItemModel.find(query).sort(sort).skip(skip).limit(limit).lean(),
178
+ this.hotItemModel.countDocuments(query),
179
+ ]);
180
+ return {
181
+ data,
182
+ total,
183
+ page,
184
+ limit,
185
+ totalPages: Math.ceil(total / limit),
186
+ };
187
+ }
188
+ async getSources() {
189
+ const sources = await this.hotItemModel.distinct('source');
190
+ return sources.sort();
191
+ }
192
+ async getStats() {
193
+ if (this.statsCache && this.statsCache.expiresAt > Date.now()) {
194
+ return this.statsCache.value;
195
+ }
196
+ if (this.statsInFlight !== undefined)
197
+ return this.statsInFlight;
198
+ const version = this.statsVersion;
199
+ const pending = this.loadStats();
200
+ this.statsInFlight = pending;
201
+ try {
202
+ const stats = await pending;
203
+ if (version === this.statsVersion) {
204
+ this.statsCache = { value: stats, expiresAt: Date.now() + 30_000 };
205
+ }
206
+ return stats;
207
+ }
208
+ finally {
209
+ if (this.statsInFlight === pending)
210
+ this.statsInFlight = undefined;
211
+ }
212
+ }
213
+ invalidateStats() {
214
+ this.statsVersion++;
215
+ this.statsCache = undefined;
216
+ this.statsInFlight = undefined;
217
+ }
218
+ async loadStats() {
219
+ const stats = await this.hotItemModel.aggregate([
220
+ {
221
+ $group: {
222
+ _id: '$source',
223
+ count: { $sum: 1 },
224
+ latestTimestamp: { $max: '$timestamp' },
225
+ },
226
+ },
227
+ {
228
+ $sort: { count: -1 },
229
+ },
230
+ ]);
231
+ const totalCount = await this.hotItemModel.countDocuments();
232
+ const totalSources = stats.length;
233
+ return {
234
+ totalCount,
235
+ totalSources,
236
+ sources: stats,
237
+ };
238
+ }
239
+ async getDataByTimeRange(source, startTime, endTime) {
240
+ return this.hotItemModel
241
+ .find({
242
+ source,
243
+ timestamp: { $gte: startTime, $lte: endTime },
244
+ })
245
+ .sort({ timestamp: -1 })
246
+ .lean();
247
+ }
248
+ };
249
+ exports.HotItemRepository = HotItemRepository;
250
+ exports.HotItemRepository = HotItemRepository = HotItemRepository_1 = __decorate([
251
+ (0, common_1.Injectable)(),
252
+ __param(0, (0, mongoose_1.InjectModel)(hot_item_schema_1.HotItem.name)),
253
+ __metadata("design:paramtypes", [mongoose_2.Model])
254
+ ], HotItemRepository);
255
+ //# sourceMappingURL=hot-item.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot-item.repository.js","sourceRoot":"","sources":["../../../src/database/repositories/hot-item.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4E;AAC5E,+CAA+C;AAC/C,uCAAiC;AACjC,gEAAsE;AA4BtE,MAAM,aAAa,GAAG,6CAA6C,CAAC;AAG7D,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAM5B,YAC6B,YAA4C;QAApC,iBAAY,GAAZ,YAAY,CAAwB;QANxD,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QAGrD,iBAAY,GAAG,CAAC,CAAC;IAItB,CAAC;IAEJ,sBAAsB;QAEpB,KAAK,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAChC,CAAC;IAOO,KAAK,CAAC,iBAAiB;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC;QAE/D,IAAI,CAAC;YAEH,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,GAAG,UAAU,WAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACjF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAC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CAAC,CAAA;qCAAuB,gBAAK;GAP7C,iBAAiB,CA+T7B"}
@@ -0,0 +1,15 @@
1
+ import { Model } from 'mongoose';
2
+ import { SourceConfig, SourceConfigDocument } from '../schemas/source-config.schema';
3
+ export declare class SourceConfigRepository {
4
+ private sourceConfigModel;
5
+ private readonly logger;
6
+ constructor(sourceConfigModel: Model<SourceConfigDocument>);
7
+ findAll(): Promise<SourceConfig[]>;
8
+ findBySource(source: string): Promise<SourceConfig | null>;
9
+ findEnabled(): Promise<SourceConfig[]>;
10
+ upsert(source: string, config: Partial<SourceConfig>): Promise<SourceConfig>;
11
+ updateLastFetchTime(source: string): Promise<void>;
12
+ initializeConfigs(sources: string[]): Promise<void>;
13
+ setEnabled(source: string, enabled: boolean): Promise<void>;
14
+ updateInterval(source: string, interval: number): Promise<void>;
15
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var SourceConfigRepository_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.SourceConfigRepository = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const mongoose_1 = require("@nestjs/mongoose");
19
+ const mongoose_2 = require("mongoose");
20
+ const source_config_schema_1 = require("../schemas/source-config.schema");
21
+ let SourceConfigRepository = SourceConfigRepository_1 = class SourceConfigRepository {
22
+ constructor(sourceConfigModel) {
23
+ this.sourceConfigModel = sourceConfigModel;
24
+ this.logger = new common_1.Logger(SourceConfigRepository_1.name);
25
+ }
26
+ async findAll() {
27
+ return this.sourceConfigModel.find().sort({ source: 1 }).lean();
28
+ }
29
+ async findBySource(source) {
30
+ return this.sourceConfigModel.findOne({ source }).lean();
31
+ }
32
+ async findEnabled() {
33
+ return this.sourceConfigModel.find({ enabled: true }).lean();
34
+ }
35
+ async upsert(source, config) {
36
+ return this.sourceConfigModel.findOneAndUpdate({ source }, { ...config, source }, { upsert: true, new: true });
37
+ }
38
+ async updateLastFetchTime(source) {
39
+ await this.sourceConfigModel.updateOne({ source }, { lastFetchAt: new Date() });
40
+ }
41
+ async initializeConfigs(sources) {
42
+ this.logger.debug(`Initializing configs for ${sources.length} sources`);
43
+ const existingConfigs = await this.sourceConfigModel.find({
44
+ source: { $in: sources },
45
+ });
46
+ const existingSourceNames = new Set(existingConfigs.map((config) => config.source));
47
+ const newConfigs = sources
48
+ .filter((source) => !existingSourceNames.has(source))
49
+ .map((source) => ({
50
+ source,
51
+ enabled: true,
52
+ interval: 30,
53
+ createdAt: new Date(),
54
+ updatedAt: new Date(),
55
+ }));
56
+ if (newConfigs.length > 0) {
57
+ await this.sourceConfigModel.insertMany(newConfigs);
58
+ this.logger.log(`Initialized ${newConfigs.length} new source configs`);
59
+ }
60
+ else {
61
+ this.logger.debug('All source configs already exist, no initialization needed');
62
+ }
63
+ }
64
+ async setEnabled(source, enabled) {
65
+ await this.sourceConfigModel.updateOne({ source }, { enabled, updatedAt: new Date() });
66
+ }
67
+ async updateInterval(source, interval) {
68
+ await this.sourceConfigModel.updateOne({ source }, { interval, updatedAt: new Date() });
69
+ }
70
+ };
71
+ exports.SourceConfigRepository = SourceConfigRepository;
72
+ exports.SourceConfigRepository = SourceConfigRepository = SourceConfigRepository_1 = __decorate([
73
+ (0, common_1.Injectable)(),
74
+ __param(0, (0, mongoose_1.InjectModel)(source_config_schema_1.SourceConfig.name)),
75
+ __metadata("design:paramtypes", [mongoose_2.Model])
76
+ ], SourceConfigRepository);
77
+ //# sourceMappingURL=source-config.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-config.repository.js","sourceRoot":"","sources":["../../../src/database/repositories/source-config.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,+CAA+C;AAC/C,uCAAiC;AACjC,0EAGyC;AAGlC,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAGjC,YAEE,iBAAsD;QAA9C,sBAAiB,GAAjB,iBAAiB,CAA6B;QAJvC,WAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IAK/D,CAAC;IAGJ,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClE,CAAC;IAGD,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3D,CAAC;IAGD,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/D,CAAC;IAGD,KAAK,CAAC,MAAM,CACV,MAAc,EACd,MAA6B;QAE7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAC5C,EAAE,MAAM,EAAE,EACV,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EACrB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAC5B,CAAC;IACJ,CAAC;IAG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GD,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,OAAgB;QAC/C,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CACpC,EAAE,MAAM,EAAE,EACV,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CACnC,CAAC;IACJ,CAAC;IAGD,KAAK,CAAC,cAAc,CAAC,MAAc,EAAE,QAAgB;QACnD,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CACpC,EAAE,MAAM,EAAE,EACV,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CACpC,CAAC;IACJ,CAAC;CACF,CAAA;AA3FY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,sBAAW,EAAC,mCAAY,CAAC,IAAI,CAAC,CAAA;qCACJ,gBAAK;GALvB,sBAAsB,CA2FlC"}
@@ -0,0 +1,30 @@
1
+ import { Document, Schema as MongooseSchema } from 'mongoose';
2
+ export type DailyBriefDocument = DailyBrief & Document;
3
+ export declare class DailyBrief {
4
+ briefDate: string;
5
+ period: string;
6
+ status: 'generating' | 'success' | 'failed';
7
+ sources: string[];
8
+ inputWindow: {
9
+ start: Date;
10
+ end: Date;
11
+ lookbackHours: number;
12
+ };
13
+ analysis?: Record<string, unknown>;
14
+ markdown?: string;
15
+ rawInputItems: Record<string, unknown>[];
16
+ searchEvidence: Record<string, unknown>[];
17
+ model?: string;
18
+ tavilyUsed: boolean;
19
+ searchProvidersUsed: string[];
20
+ error?: string;
21
+ generationId?: string;
22
+ generationHeartbeatAt?: Date;
23
+ createdAt?: Date;
24
+ updatedAt?: Date;
25
+ }
26
+ export declare const DailyBriefSchema: MongooseSchema<DailyBrief, import("mongoose").Model<DailyBrief, any, any, any, Document<unknown, any, DailyBrief> & DailyBrief & {
27
+ _id: import("mongoose").Types.ObjectId;
28
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, DailyBrief, Document<unknown, {}, import("mongoose").FlatRecord<DailyBrief>> & import("mongoose").FlatRecord<DailyBrief> & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ }>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DailyBriefSchema = exports.DailyBrief = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const InputWindowSchema = new mongoose_2.Schema({ start: Date, end: Date, lookbackHours: Number }, { _id: false });
16
+ let DailyBrief = class DailyBrief {
17
+ };
18
+ exports.DailyBrief = DailyBrief;
19
+ __decorate([
20
+ (0, mongoose_1.Prop)({ required: true, index: true }),
21
+ __metadata("design:type", String)
22
+ ], DailyBrief.prototype, "briefDate", void 0);
23
+ __decorate([
24
+ (0, mongoose_1.Prop)({ required: true, default: 'daily', index: true }),
25
+ __metadata("design:type", String)
26
+ ], DailyBrief.prototype, "period", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)({
29
+ required: true,
30
+ enum: ['generating', 'success', 'failed'],
31
+ default: 'generating',
32
+ index: true,
33
+ }),
34
+ __metadata("design:type", String)
35
+ ], DailyBrief.prototype, "status", void 0);
36
+ __decorate([
37
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
38
+ __metadata("design:type", Array)
39
+ ], DailyBrief.prototype, "sources", void 0);
40
+ __decorate([
41
+ (0, mongoose_1.Prop)({ type: InputWindowSchema }),
42
+ __metadata("design:type", Object)
43
+ ], DailyBrief.prototype, "inputWindow", void 0);
44
+ __decorate([
45
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Mixed }),
46
+ __metadata("design:type", Object)
47
+ ], DailyBrief.prototype, "analysis", void 0);
48
+ __decorate([
49
+ (0, mongoose_1.Prop)(),
50
+ __metadata("design:type", String)
51
+ ], DailyBrief.prototype, "markdown", void 0);
52
+ __decorate([
53
+ (0, mongoose_1.Prop)({ type: [mongoose_2.Schema.Types.Mixed], default: [] }),
54
+ __metadata("design:type", Array)
55
+ ], DailyBrief.prototype, "rawInputItems", void 0);
56
+ __decorate([
57
+ (0, mongoose_1.Prop)({ type: [mongoose_2.Schema.Types.Mixed], default: [] }),
58
+ __metadata("design:type", Array)
59
+ ], DailyBrief.prototype, "searchEvidence", void 0);
60
+ __decorate([
61
+ (0, mongoose_1.Prop)(),
62
+ __metadata("design:type", String)
63
+ ], DailyBrief.prototype, "model", void 0);
64
+ __decorate([
65
+ (0, mongoose_1.Prop)({ default: false }),
66
+ __metadata("design:type", Boolean)
67
+ ], DailyBrief.prototype, "tavilyUsed", void 0);
68
+ __decorate([
69
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
70
+ __metadata("design:type", Array)
71
+ ], DailyBrief.prototype, "searchProvidersUsed", void 0);
72
+ __decorate([
73
+ (0, mongoose_1.Prop)(),
74
+ __metadata("design:type", String)
75
+ ], DailyBrief.prototype, "error", void 0);
76
+ __decorate([
77
+ (0, mongoose_1.Prop)(),
78
+ __metadata("design:type", String)
79
+ ], DailyBrief.prototype, "generationId", void 0);
80
+ __decorate([
81
+ (0, mongoose_1.Prop)(),
82
+ __metadata("design:type", Date)
83
+ ], DailyBrief.prototype, "generationHeartbeatAt", void 0);
84
+ __decorate([
85
+ (0, mongoose_1.Prop)(),
86
+ __metadata("design:type", Date)
87
+ ], DailyBrief.prototype, "createdAt", void 0);
88
+ __decorate([
89
+ (0, mongoose_1.Prop)(),
90
+ __metadata("design:type", Date)
91
+ ], DailyBrief.prototype, "updatedAt", void 0);
92
+ exports.DailyBrief = DailyBrief = __decorate([
93
+ (0, mongoose_1.Schema)({
94
+ timestamps: true,
95
+ })
96
+ ], DailyBrief);
97
+ exports.DailyBriefSchema = mongoose_1.SchemaFactory.createForClass(DailyBrief);
98
+ exports.DailyBriefSchema.index({ briefDate: 1, period: 1 }, { unique: true });
99
+ exports.DailyBriefSchema.index({ createdAt: -1 });
100
+ exports.DailyBriefSchema.index({ briefDate: -1, createdAt: -1 });
101
+ exports.DailyBriefSchema.index({ status: 1, briefDate: -1, createdAt: -1 });
102
+ exports.DailyBriefSchema.index({ status: 1, period: 1, briefDate: 1, createdAt: 1 });
103
+ //# sourceMappingURL=daily-brief.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daily-brief.schema.js","sourceRoot":"","sources":["../../../src/database/schemas/daily-brief.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAA8D;AAI9D,MAAM,iBAAiB,GAAG,IAAI,iBAAc,CAC1C,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,EACjD,EAAE,GAAG,EAAE,KAAK,EAAE,CACf,CAAC;AAKK,IAAM,UAAU,GAAhB,MAAM,UAAU;CA4DtB,CAAA;AA5DY,gCAAU;AAErB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;6CACpB;AAGlB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;0CACzC;AAQf;IANC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE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E,IAAI;KACjB,CAAC;GACW,UAAU,CA4DtB;AAEY,QAAA,gBAAgB,GAAG,wBAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;AAEzE,wBAAgB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACtE,wBAAgB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAG1C,wBAAgB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAGzD,wBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAEpE,wBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Document, Schema as MongooseSchema } from 'mongoose';
2
+ export type HotItemDocument = HotItem & Document;
3
+ export declare class HotItem {
4
+ source: string;
5
+ title: string;
6
+ desc?: string;
7
+ cover?: string;
8
+ author?: string;
9
+ hot?: number | string;
10
+ url: string;
11
+ mobileUrl?: string;
12
+ timestamp: number;
13
+ createdAt?: Date;
14
+ updatedAt?: Date;
15
+ }
16
+ export declare const HotItemSchema: MongooseSchema<HotItem, import("mongoose").Model<HotItem, any, any, any, Document<unknown, any, HotItem> & HotItem & {
17
+ _id: import("mongoose").Types.ObjectId;
18
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, HotItem, Document<unknown, {}, import("mongoose").FlatRecord<HotItem>> & import("mongoose").FlatRecord<HotItem> & {
19
+ _id: import("mongoose").Types.ObjectId;
20
+ }>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HotItemSchema = exports.HotItem = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ let HotItem = class HotItem {
16
+ };
17
+ exports.HotItem = HotItem;
18
+ __decorate([
19
+ (0, mongoose_1.Prop)({ required: true, index: true }),
20
+ __metadata("design:type", String)
21
+ ], HotItem.prototype, "source", void 0);
22
+ __decorate([
23
+ (0, mongoose_1.Prop)({ required: true }),
24
+ __metadata("design:type", String)
25
+ ], HotItem.prototype, "title", void 0);
26
+ __decorate([
27
+ (0, mongoose_1.Prop)(),
28
+ __metadata("design:type", String)
29
+ ], HotItem.prototype, "desc", void 0);
30
+ __decorate([
31
+ (0, mongoose_1.Prop)(),
32
+ __metadata("design:type", String)
33
+ ], HotItem.prototype, "cover", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)(),
36
+ __metadata("design:type", String)
37
+ ], HotItem.prototype, "author", void 0);
38
+ __decorate([
39
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Mixed }),
40
+ __metadata("design:type", Object)
41
+ ], HotItem.prototype, "hot", void 0);
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ required: true, index: true }),
44
+ __metadata("design:type", String)
45
+ ], HotItem.prototype, "url", void 0);
46
+ __decorate([
47
+ (0, mongoose_1.Prop)(),
48
+ __metadata("design:type", String)
49
+ ], HotItem.prototype, "mobileUrl", void 0);
50
+ __decorate([
51
+ (0, mongoose_1.Prop)({ required: true, index: true }),
52
+ __metadata("design:type", Number)
53
+ ], HotItem.prototype, "timestamp", void 0);
54
+ __decorate([
55
+ (0, mongoose_1.Prop)(),
56
+ __metadata("design:type", Date)
57
+ ], HotItem.prototype, "createdAt", void 0);
58
+ __decorate([
59
+ (0, mongoose_1.Prop)(),
60
+ __metadata("design:type", Date)
61
+ ], HotItem.prototype, "updatedAt", void 0);
62
+ exports.HotItem = HotItem = __decorate([
63
+ (0, mongoose_1.Schema)({
64
+ timestamps: true,
65
+ })
66
+ ], HotItem);
67
+ exports.HotItemSchema = mongoose_1.SchemaFactory.createForClass(HotItem);
68
+ exports.HotItemSchema.index({ source: 1, url: 1 }, { unique: true });
69
+ exports.HotItemSchema.index({ source: 1, timestamp: -1 });
70
+ exports.HotItemSchema.index({ timestamp: -1 });
71
+ exports.HotItemSchema.index({ title: 'text', desc: 'text' });
72
+ //# sourceMappingURL=hot-item.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot-item.schema.js","sourceRoot":"","sources":["../../../src/database/schemas/hot-item.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAA8D;AAOvD,IAAM,OAAO,GAAb,MAAM,OAAO;CAiCnB,CAAA;AAjCY,0BAAO;AAElB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;uCACvB;AAGf;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACX;AAGd;IADC,IAAA,eAAI,GAAE;;qCACO;AAGd;IADC,IAAA,eAAI,GAAE;;sCACQ;AAGf;IADC,IAAA,eAAI,GAAE;;uCACS;AAGhB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAc,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;oCACrB;AAGtB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;oCAC1B;AAGZ;IADC,IAAA,eAAI,GAAE;;0CACY;AAGnB;IADC,IAAA,eAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;0CACpB;AAGlB;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;0CAAC;AAGjB;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;0CAAC;kBAhCN,OAAO;IAHnB,IAAA,iBAAM,EAAC;QACN,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,OAAO,CAiCnB;AAEY,QAAA,aAAa,GAAG,wBAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAGnE,qBAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,qBAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAClD,qBAAa,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACvC,qBAAa,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Document } from 'mongoose';
2
+ export type SourceConfigDocument = SourceConfig & Document;
3
+ export declare class SourceConfig {
4
+ source: string;
5
+ enabled: boolean;
6
+ interval: number;
7
+ lastFetchAt?: Date;
8
+ createdAt?: Date;
9
+ updatedAt?: Date;
10
+ }
11
+ export declare const SourceConfigSchema: import("mongoose").Schema<SourceConfig, import("mongoose").Model<SourceConfig, any, any, any, Document<unknown, any, SourceConfig> & SourceConfig & {
12
+ _id: import("mongoose").Types.ObjectId;
13
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, SourceConfig, Document<unknown, {}, import("mongoose").FlatRecord<SourceConfig>> & import("mongoose").FlatRecord<SourceConfig> & {
14
+ _id: import("mongoose").Types.ObjectId;
15
+ }>;