eventregistry 9.1.0 → 10.0.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 (413) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/LICENSE +21 -21
  3. package/MIGRATION.md +177 -0
  4. package/README.md +292 -234
  5. package/dist/{analytics.d.ts → cjs/analytics.d.ts} +2 -1
  6. package/dist/cjs/analytics.js +174 -0
  7. package/dist/cjs/analytics.js.map +1 -0
  8. package/dist/{base.d.ts → cjs/base.d.ts} +9 -9
  9. package/dist/cjs/base.js +189 -0
  10. package/dist/cjs/base.js.map +1 -0
  11. package/dist/cjs/counts.js +120 -0
  12. package/dist/cjs/counts.js.map +1 -0
  13. package/dist/cjs/dailyShares.js +46 -0
  14. package/dist/cjs/dailyShares.js.map +1 -0
  15. package/dist/{data.d.ts → cjs/data.d.ts} +32 -5
  16. package/dist/cjs/data.js.map +1 -0
  17. package/dist/{eventForText.d.ts → cjs/eventForText.d.ts} +1 -1
  18. package/dist/cjs/eventForText.js +61 -0
  19. package/dist/cjs/eventForText.js.map +1 -0
  20. package/dist/{eventRegistry.d.ts → cjs/eventRegistry.d.ts} +127 -28
  21. package/dist/cjs/eventRegistry.js +887 -0
  22. package/dist/cjs/eventRegistry.js.map +1 -0
  23. package/dist/cjs/fluent/analytics.d.ts +24 -0
  24. package/dist/cjs/fluent/analytics.js +47 -0
  25. package/dist/cjs/fluent/analytics.js.map +1 -0
  26. package/dist/cjs/fluent/articles.d.ts +23 -0
  27. package/dist/cjs/fluent/articles.js +34 -0
  28. package/dist/cjs/fluent/articles.js.map +1 -0
  29. package/dist/cjs/fluent/counts.d.ts +8 -0
  30. package/dist/cjs/fluent/counts.js +17 -0
  31. package/dist/cjs/fluent/counts.js.map +1 -0
  32. package/dist/cjs/fluent/eventForText.d.ts +4 -0
  33. package/dist/cjs/fluent/eventForText.js +8 -0
  34. package/dist/cjs/fluent/eventForText.js.map +1 -0
  35. package/dist/cjs/fluent/events.d.ts +23 -0
  36. package/dist/cjs/fluent/events.js +34 -0
  37. package/dist/cjs/fluent/events.js.map +1 -0
  38. package/dist/cjs/fluent/info.d.ts +10 -0
  39. package/dist/cjs/fluent/info.js +23 -0
  40. package/dist/cjs/fluent/info.js.map +1 -0
  41. package/dist/cjs/fluent/mentions.d.ts +18 -0
  42. package/dist/cjs/fluent/mentions.js +31 -0
  43. package/dist/cjs/fluent/mentions.js.map +1 -0
  44. package/dist/cjs/fluent/recent.d.ts +8 -0
  45. package/dist/cjs/fluent/recent.js +17 -0
  46. package/dist/cjs/fluent/recent.js.map +1 -0
  47. package/dist/cjs/fluent/shares.d.ts +8 -0
  48. package/dist/cjs/fluent/shares.js +17 -0
  49. package/dist/cjs/fluent/shares.js.map +1 -0
  50. package/dist/cjs/fluent/stories.d.ts +8 -0
  51. package/dist/cjs/fluent/stories.js +14 -0
  52. package/dist/cjs/fluent/stories.js.map +1 -0
  53. package/dist/cjs/fluent/topicPages.d.ts +10 -0
  54. package/dist/cjs/fluent/topicPages.js +20 -0
  55. package/dist/cjs/fluent/topicPages.js.map +1 -0
  56. package/dist/cjs/fluent/trends.d.ts +11 -0
  57. package/dist/cjs/fluent/trends.js +23 -0
  58. package/dist/cjs/fluent/trends.js.map +1 -0
  59. package/dist/cjs/helpers/analytics.d.ts +68 -0
  60. package/dist/cjs/helpers/analytics.js +100 -0
  61. package/dist/cjs/helpers/analytics.js.map +1 -0
  62. package/dist/cjs/helpers/articles.d.ts +24 -0
  63. package/dist/cjs/helpers/articles.js +31 -0
  64. package/dist/cjs/helpers/articles.js.map +1 -0
  65. package/dist/cjs/helpers/counts.d.ts +4 -0
  66. package/dist/cjs/helpers/counts.js +12 -0
  67. package/dist/cjs/helpers/counts.js.map +1 -0
  68. package/dist/cjs/helpers/eventForText.d.ts +6 -0
  69. package/dist/cjs/helpers/eventForText.js +13 -0
  70. package/dist/cjs/helpers/eventForText.js.map +1 -0
  71. package/dist/cjs/helpers/events.d.ts +18 -0
  72. package/dist/cjs/helpers/events.js +31 -0
  73. package/dist/cjs/helpers/events.js.map +1 -0
  74. package/dist/cjs/helpers/info.d.ts +6 -0
  75. package/dist/cjs/helpers/info.js +20 -0
  76. package/dist/cjs/helpers/info.js.map +1 -0
  77. package/dist/cjs/helpers/mentions.d.ts +10 -0
  78. package/dist/cjs/helpers/mentions.js +21 -0
  79. package/dist/cjs/helpers/mentions.js.map +1 -0
  80. package/dist/cjs/helpers/recent.d.ts +10 -0
  81. package/dist/cjs/helpers/recent.js +18 -0
  82. package/dist/cjs/helpers/recent.js.map +1 -0
  83. package/dist/cjs/helpers/shares.d.ts +4 -0
  84. package/dist/cjs/helpers/shares.js +12 -0
  85. package/dist/cjs/helpers/shares.js.map +1 -0
  86. package/dist/cjs/helpers/stories.d.ts +7 -0
  87. package/dist/cjs/helpers/stories.js +13 -0
  88. package/dist/cjs/helpers/stories.js.map +1 -0
  89. package/dist/cjs/helpers/topicPages.d.ts +16 -0
  90. package/dist/cjs/helpers/topicPages.js +29 -0
  91. package/dist/cjs/helpers/topicPages.js.map +1 -0
  92. package/dist/cjs/helpers/trends.d.ts +7 -0
  93. package/dist/cjs/helpers/trends.js +20 -0
  94. package/dist/cjs/helpers/trends.js.map +1 -0
  95. package/dist/cjs/helpers/uri.d.ts +42 -0
  96. package/dist/cjs/helpers/uri.js +78 -0
  97. package/dist/cjs/helpers/uri.js.map +1 -0
  98. package/dist/cjs/http.d.ts +18 -0
  99. package/dist/cjs/http.js +88 -0
  100. package/dist/cjs/http.js.map +1 -0
  101. package/dist/cjs/index.d.ts +47 -0
  102. package/dist/{index.js → cjs/index.js} +90 -2
  103. package/dist/cjs/index.js.map +1 -0
  104. package/dist/cjs/info.js +115 -0
  105. package/dist/cjs/info.js.map +1 -0
  106. package/dist/{logger.d.ts → cjs/logger.d.ts} +13 -10
  107. package/dist/cjs/logger.js +179 -0
  108. package/dist/cjs/logger.js.map +1 -0
  109. package/dist/cjs/mutex.d.ts +6 -0
  110. package/dist/cjs/mutex.js +27 -0
  111. package/dist/cjs/mutex.js.map +1 -0
  112. package/dist/cjs/package.json +3 -0
  113. package/dist/{query.d.ts → cjs/query.d.ts} +5 -8
  114. package/dist/cjs/query.js +248 -0
  115. package/dist/cjs/query.js.map +1 -0
  116. package/dist/{queryArticle.d.ts → cjs/queryArticle.d.ts} +5 -5
  117. package/dist/cjs/queryArticle.js +120 -0
  118. package/dist/cjs/queryArticle.js.map +1 -0
  119. package/dist/{queryArticles.d.ts → cjs/queryArticles.d.ts} +40 -73
  120. package/dist/cjs/queryArticles.js +456 -0
  121. package/dist/cjs/queryArticles.js.map +1 -0
  122. package/dist/{queryEvent.d.ts → cjs/queryEvent.d.ts} +6 -6
  123. package/dist/cjs/queryEvent.js +417 -0
  124. package/dist/cjs/queryEvent.js.map +1 -0
  125. package/dist/{queryEvents.d.ts → cjs/queryEvents.d.ts} +30 -39
  126. package/dist/cjs/queryEvents.js +567 -0
  127. package/dist/cjs/queryEvents.js.map +1 -0
  128. package/dist/cjs/queryIterator.d.ts +34 -0
  129. package/dist/cjs/queryIterator.js +77 -0
  130. package/dist/cjs/queryIterator.js.map +1 -0
  131. package/dist/{queryMentions.d.ts → cjs/queryMentions.d.ts} +18 -18
  132. package/dist/cjs/queryMentions.js +440 -0
  133. package/dist/cjs/queryMentions.js.map +1 -0
  134. package/dist/{queryStory.d.ts → cjs/queryStory.d.ts} +23 -23
  135. package/dist/cjs/queryStory.js +120 -0
  136. package/dist/cjs/queryStory.js.map +1 -0
  137. package/dist/{recent.d.ts → cjs/recent.d.ts} +8 -8
  138. package/dist/cjs/recent.js +63 -0
  139. package/dist/cjs/recent.js.map +1 -0
  140. package/dist/{returnInfo.d.ts → cjs/returnInfo.d.ts} +21 -23
  141. package/dist/cjs/returnInfo.js +292 -0
  142. package/dist/cjs/returnInfo.js.map +1 -0
  143. package/dist/{topicPage.d.ts → cjs/topicPage.d.ts} +3 -3
  144. package/dist/cjs/topicPage.js +454 -0
  145. package/dist/cjs/topicPage.js.map +1 -0
  146. package/dist/cjs/topicPages.d.ts +13 -0
  147. package/dist/cjs/topicPages.js +22 -0
  148. package/dist/cjs/topicPages.js.map +1 -0
  149. package/dist/{trends.d.ts → cjs/trends.d.ts} +13 -13
  150. package/dist/cjs/trends.js +64 -0
  151. package/dist/cjs/trends.js.map +1 -0
  152. package/dist/{types.d.ts → cjs/types.d.ts} +135 -33
  153. package/dist/cjs/types.js.map +1 -0
  154. package/dist/cjs/version.d.ts +1 -0
  155. package/dist/cjs/version.js +5 -0
  156. package/dist/cjs/version.js.map +1 -0
  157. package/dist/esm/analytics.d.ts +83 -0
  158. package/dist/esm/analytics.js +170 -0
  159. package/dist/esm/analytics.js.map +1 -0
  160. package/dist/esm/base.d.ts +82 -0
  161. package/dist/esm/base.js +182 -0
  162. package/dist/esm/base.js.map +1 -0
  163. package/dist/esm/counts.d.ts +81 -0
  164. package/dist/esm/counts.js +114 -0
  165. package/dist/esm/counts.js.map +1 -0
  166. package/dist/esm/dailyShares.d.ts +10 -0
  167. package/dist/esm/dailyShares.js +41 -0
  168. package/dist/esm/dailyShares.js.map +1 -0
  169. package/dist/esm/data.d.ts +296 -0
  170. package/dist/esm/data.js +3 -0
  171. package/dist/esm/data.js.map +1 -0
  172. package/dist/esm/eventForText.d.ts +48 -0
  173. package/dist/esm/eventForText.js +57 -0
  174. package/dist/esm/eventForText.js.map +1 -0
  175. package/dist/esm/eventRegistry.d.ts +343 -0
  176. package/dist/esm/eventRegistry.js +849 -0
  177. package/dist/esm/eventRegistry.js.map +1 -0
  178. package/dist/esm/fluent/analytics.d.ts +24 -0
  179. package/dist/esm/fluent/analytics.js +43 -0
  180. package/dist/esm/fluent/analytics.js.map +1 -0
  181. package/dist/esm/fluent/articles.d.ts +23 -0
  182. package/dist/esm/fluent/articles.js +30 -0
  183. package/dist/esm/fluent/articles.js.map +1 -0
  184. package/dist/esm/fluent/counts.d.ts +8 -0
  185. package/dist/esm/fluent/counts.js +13 -0
  186. package/dist/esm/fluent/counts.js.map +1 -0
  187. package/dist/esm/fluent/eventForText.d.ts +4 -0
  188. package/dist/esm/fluent/eventForText.js +5 -0
  189. package/dist/esm/fluent/eventForText.js.map +1 -0
  190. package/dist/esm/fluent/events.d.ts +23 -0
  191. package/dist/esm/fluent/events.js +30 -0
  192. package/dist/esm/fluent/events.js.map +1 -0
  193. package/dist/esm/fluent/info.d.ts +10 -0
  194. package/dist/esm/fluent/info.js +19 -0
  195. package/dist/esm/fluent/info.js.map +1 -0
  196. package/dist/esm/fluent/mentions.d.ts +18 -0
  197. package/dist/esm/fluent/mentions.js +27 -0
  198. package/dist/esm/fluent/mentions.js.map +1 -0
  199. package/dist/esm/fluent/recent.d.ts +8 -0
  200. package/dist/esm/fluent/recent.js +13 -0
  201. package/dist/esm/fluent/recent.js.map +1 -0
  202. package/dist/esm/fluent/shares.d.ts +8 -0
  203. package/dist/esm/fluent/shares.js +13 -0
  204. package/dist/esm/fluent/shares.js.map +1 -0
  205. package/dist/esm/fluent/stories.d.ts +8 -0
  206. package/dist/esm/fluent/stories.js +10 -0
  207. package/dist/esm/fluent/stories.js.map +1 -0
  208. package/dist/esm/fluent/topicPages.d.ts +10 -0
  209. package/dist/esm/fluent/topicPages.js +16 -0
  210. package/dist/esm/fluent/topicPages.js.map +1 -0
  211. package/dist/esm/fluent/trends.d.ts +11 -0
  212. package/dist/esm/fluent/trends.js +19 -0
  213. package/dist/esm/fluent/trends.js.map +1 -0
  214. package/dist/esm/helpers/analytics.d.ts +68 -0
  215. package/dist/esm/helpers/analytics.js +86 -0
  216. package/dist/esm/helpers/analytics.js.map +1 -0
  217. package/dist/esm/helpers/articles.d.ts +24 -0
  218. package/dist/esm/helpers/articles.js +26 -0
  219. package/dist/esm/helpers/articles.js.map +1 -0
  220. package/dist/esm/helpers/counts.d.ts +4 -0
  221. package/dist/esm/helpers/counts.js +8 -0
  222. package/dist/esm/helpers/counts.js.map +1 -0
  223. package/dist/esm/helpers/eventForText.d.ts +6 -0
  224. package/dist/esm/helpers/eventForText.js +10 -0
  225. package/dist/esm/helpers/eventForText.js.map +1 -0
  226. package/dist/esm/helpers/events.d.ts +18 -0
  227. package/dist/esm/helpers/events.js +26 -0
  228. package/dist/esm/helpers/events.js.map +1 -0
  229. package/dist/esm/helpers/info.d.ts +6 -0
  230. package/dist/esm/helpers/info.js +14 -0
  231. package/dist/esm/helpers/info.js.map +1 -0
  232. package/dist/esm/helpers/mentions.d.ts +10 -0
  233. package/dist/esm/helpers/mentions.js +17 -0
  234. package/dist/esm/helpers/mentions.js.map +1 -0
  235. package/dist/esm/helpers/recent.d.ts +10 -0
  236. package/dist/esm/helpers/recent.js +14 -0
  237. package/dist/esm/helpers/recent.js.map +1 -0
  238. package/dist/esm/helpers/shares.d.ts +4 -0
  239. package/dist/esm/helpers/shares.js +8 -0
  240. package/dist/esm/helpers/shares.js.map +1 -0
  241. package/dist/esm/helpers/stories.d.ts +7 -0
  242. package/dist/esm/helpers/stories.js +10 -0
  243. package/dist/esm/helpers/stories.js.map +1 -0
  244. package/dist/esm/helpers/topicPages.d.ts +16 -0
  245. package/dist/esm/helpers/topicPages.js +24 -0
  246. package/dist/esm/helpers/topicPages.js.map +1 -0
  247. package/dist/esm/helpers/trends.d.ts +7 -0
  248. package/dist/esm/helpers/trends.js +14 -0
  249. package/dist/esm/helpers/trends.js.map +1 -0
  250. package/dist/esm/helpers/uri.d.ts +42 -0
  251. package/dist/esm/helpers/uri.js +68 -0
  252. package/dist/esm/helpers/uri.js.map +1 -0
  253. package/dist/esm/http.d.ts +18 -0
  254. package/dist/esm/http.js +85 -0
  255. package/dist/esm/http.js.map +1 -0
  256. package/dist/esm/index.d.ts +47 -0
  257. package/dist/esm/index.js +47 -0
  258. package/dist/esm/index.js.map +1 -0
  259. package/dist/esm/info.d.ts +61 -0
  260. package/dist/esm/info.js +108 -0
  261. package/dist/esm/info.js.map +1 -0
  262. package/dist/esm/logger.d.ts +47 -0
  263. package/dist/esm/logger.js +142 -0
  264. package/dist/esm/logger.js.map +1 -0
  265. package/dist/esm/mutex.d.ts +6 -0
  266. package/dist/esm/mutex.js +23 -0
  267. package/dist/esm/mutex.js.map +1 -0
  268. package/dist/esm/package.json +3 -0
  269. package/dist/esm/query.d.ts +50 -0
  270. package/dist/esm/query.js +240 -0
  271. package/dist/esm/query.js.map +1 -0
  272. package/dist/esm/queryArticle.d.ts +61 -0
  273. package/dist/esm/queryArticle.js +111 -0
  274. package/dist/esm/queryArticle.js.map +1 -0
  275. package/dist/esm/queryArticles.d.ts +111 -0
  276. package/dist/esm/queryArticles.js +438 -0
  277. package/dist/esm/queryArticles.js.map +1 -0
  278. package/dist/esm/queryEvent.d.ts +140 -0
  279. package/dist/esm/queryEvent.js +403 -0
  280. package/dist/esm/queryEvent.js.map +1 -0
  281. package/dist/esm/queryEvents.d.ts +201 -0
  282. package/dist/esm/queryEvents.js +545 -0
  283. package/dist/esm/queryEvents.js.map +1 -0
  284. package/dist/esm/queryIterator.d.ts +34 -0
  285. package/dist/esm/queryIterator.js +73 -0
  286. package/dist/esm/queryIterator.js.map +1 -0
  287. package/dist/esm/queryMentions.d.ts +96 -0
  288. package/dist/esm/queryMentions.js +425 -0
  289. package/dist/esm/queryMentions.js.map +1 -0
  290. package/dist/esm/queryStory.d.ts +58 -0
  291. package/dist/esm/queryStory.js +110 -0
  292. package/dist/esm/queryStory.js.map +1 -0
  293. package/dist/esm/recent.d.ts +23 -0
  294. package/dist/esm/recent.js +58 -0
  295. package/dist/esm/recent.js.map +1 -0
  296. package/dist/esm/returnInfo.d.ts +66 -0
  297. package/dist/esm/returnInfo.js +245 -0
  298. package/dist/esm/returnInfo.js.map +1 -0
  299. package/dist/esm/topicPage.d.ts +157 -0
  300. package/dist/esm/topicPage.js +417 -0
  301. package/dist/esm/topicPage.js.map +1 -0
  302. package/dist/esm/topicPages.d.ts +13 -0
  303. package/dist/esm/topicPages.js +18 -0
  304. package/dist/esm/topicPages.js.map +1 -0
  305. package/dist/esm/trends.d.ts +35 -0
  306. package/dist/esm/trends.js +56 -0
  307. package/dist/esm/trends.js.map +1 -0
  308. package/dist/esm/types.d.ts +2555 -0
  309. package/dist/esm/types.js +2 -0
  310. package/dist/esm/types.js.map +1 -0
  311. package/dist/esm/version.d.ts +1 -0
  312. package/dist/esm/version.js +2 -0
  313. package/dist/esm/version.js.map +1 -0
  314. package/package.json +71 -42
  315. package/src/analytics.ts +197 -0
  316. package/src/base.ts +200 -0
  317. package/src/counts.ts +118 -0
  318. package/src/dailyShares.ts +46 -0
  319. package/src/data.ts +310 -0
  320. package/src/eventForText.ts +60 -0
  321. package/src/eventRegistry.ts +1005 -0
  322. package/src/fluent/analytics.ts +84 -0
  323. package/src/fluent/articles.ts +40 -0
  324. package/src/fluent/counts.ts +15 -0
  325. package/src/fluent/eventForText.ts +10 -0
  326. package/src/fluent/events.ts +40 -0
  327. package/src/fluent/info.ts +23 -0
  328. package/src/fluent/mentions.ts +34 -0
  329. package/src/fluent/recent.ts +15 -0
  330. package/src/fluent/shares.ts +15 -0
  331. package/src/fluent/stories.ts +12 -0
  332. package/src/fluent/topicPages.ts +20 -0
  333. package/src/fluent/trends.ts +34 -0
  334. package/src/helpers/analytics.ts +134 -0
  335. package/src/helpers/articles.ts +42 -0
  336. package/src/helpers/counts.ts +19 -0
  337. package/src/helpers/eventForText.ts +16 -0
  338. package/src/helpers/events.ts +43 -0
  339. package/src/helpers/info.ts +31 -0
  340. package/src/helpers/mentions.ts +27 -0
  341. package/src/helpers/recent.ts +22 -0
  342. package/src/helpers/shares.ts +17 -0
  343. package/src/helpers/stories.ts +16 -0
  344. package/src/helpers/topicPages.ts +28 -0
  345. package/src/helpers/trends.ts +36 -0
  346. package/src/helpers/uri.ts +78 -0
  347. package/src/http.ts +110 -0
  348. package/src/index.ts +205 -0
  349. package/src/info.ts +120 -0
  350. package/src/logger.ts +177 -0
  351. package/src/mutex.ts +22 -0
  352. package/src/query.ts +258 -0
  353. package/src/queryArticle.ts +138 -0
  354. package/src/queryArticles.ts +576 -0
  355. package/src/queryEvent.ts +503 -0
  356. package/src/queryEvents.ts +672 -0
  357. package/src/queryIterator.ts +89 -0
  358. package/src/queryMentions.ts +552 -0
  359. package/src/queryStory.ts +152 -0
  360. package/src/recent.ts +73 -0
  361. package/src/returnInfo.ts +372 -0
  362. package/src/topicPage.ts +481 -0
  363. package/src/topicPages.ts +18 -0
  364. package/src/trends.ts +62 -0
  365. package/src/types.ts +2678 -0
  366. package/src/version.ts +1 -0
  367. package/dist/analytics.js +0 -337
  368. package/dist/analytics.js.map +0 -1
  369. package/dist/base.js +0 -262
  370. package/dist/base.js.map +0 -1
  371. package/dist/counts.js +0 -163
  372. package/dist/counts.js.map +0 -1
  373. package/dist/dailyShares.js +0 -91
  374. package/dist/dailyShares.js.map +0 -1
  375. package/dist/data.js.map +0 -1
  376. package/dist/eventForText.js +0 -127
  377. package/dist/eventForText.js.map +0 -1
  378. package/dist/eventRegistry.js +0 -1099
  379. package/dist/eventRegistry.js.map +0 -1
  380. package/dist/index.d.ts +0 -21
  381. package/dist/index.js.map +0 -1
  382. package/dist/info.js +0 -172
  383. package/dist/info.js.map +0 -1
  384. package/dist/logger.js +0 -144
  385. package/dist/logger.js.map +0 -1
  386. package/dist/query.js +0 -334
  387. package/dist/query.js.map +0 -1
  388. package/dist/queryArticle.js +0 -184
  389. package/dist/queryArticle.js.map +0 -1
  390. package/dist/queryArticles.js +0 -730
  391. package/dist/queryArticles.js.map +0 -1
  392. package/dist/queryEvent.js +0 -588
  393. package/dist/queryEvent.js.map +0 -1
  394. package/dist/queryEvents.js +0 -826
  395. package/dist/queryEvents.js.map +0 -1
  396. package/dist/queryMentions.js +0 -638
  397. package/dist/queryMentions.js.map +0 -1
  398. package/dist/queryStory.js +0 -195
  399. package/dist/queryStory.js.map +0 -1
  400. package/dist/recent.js +0 -200
  401. package/dist/recent.js.map +0 -1
  402. package/dist/returnInfo.js +0 -333
  403. package/dist/returnInfo.js.map +0 -1
  404. package/dist/topicPage.js +0 -600
  405. package/dist/topicPage.js.map +0 -1
  406. package/dist/trends.js +0 -116
  407. package/dist/trends.js.map +0 -1
  408. package/dist/types.js.map +0 -1
  409. /package/dist/{counts.d.ts → cjs/counts.d.ts} +0 -0
  410. /package/dist/{dailyShares.d.ts → cjs/dailyShares.d.ts} +0 -0
  411. /package/dist/{data.js → cjs/data.js} +0 -0
  412. /package/dist/{info.d.ts → cjs/info.d.ts} +0 -0
  413. /package/dist/{types.js → cjs/types.js} +0 -0
@@ -0,0 +1,672 @@
1
+ import { Query, QueryParamsBase } from "./base";
2
+ import { Data } from "./data";
3
+ import { EventRegistry } from "./eventRegistry";
4
+ import { ComplexEventQuery } from "./query";
5
+ import { QueryIterationEngine } from "./queryIterator";
6
+ import { ReturnInfo } from "./returnInfo";
7
+ import { ER } from "./types";
8
+ import { Logger } from "./logger";
9
+
10
+ /**
11
+ * @class QueryEvents
12
+ * Class for obtaining available info for one or more events in the Event Registry
13
+ */
14
+ export class QueryEvents extends Query<RequestEvents> {
15
+ public params: Record<string, unknown> = {};
16
+ constructor(args: ER.QueryEvents.Arguments = {}) {
17
+ super();
18
+ const {
19
+ keywords,
20
+ conceptUri,
21
+ categoryUri,
22
+ sourceUri,
23
+ sourceLocationUri,
24
+ sourceGroupUri,
25
+ authorUri,
26
+ locationUri,
27
+ lang,
28
+ dateStart,
29
+ dateEnd,
30
+ reportingDateStart,
31
+ reportingDateEnd,
32
+ minSentiment = -1,
33
+ maxSentiment = 1,
34
+ minArticlesInEvent,
35
+ maxArticlesInEvent,
36
+ dateMentionStart,
37
+ dateMentionEnd,
38
+ ignoreKeywords,
39
+ ignoreConceptUri,
40
+ ignoreCategoryUri,
41
+ ignoreSourceUri,
42
+ ignoreSourceLocationUri,
43
+ ignoreSourceGroupUri,
44
+ ignoreAuthorUri,
45
+ ignoreLocationUri,
46
+ ignoreLang,
47
+ keywordsLoc = "body",
48
+ ignoreKeywordsLoc = "body",
49
+ keywordSearchMode = "phrase",
50
+ ignoreKeywordSearchMode = "phrase",
51
+ categoryIncludeSub = true,
52
+ ignoreCategoryIncludeSub = true,
53
+ requestedResult = new RequestEventsInfo()
54
+ } = args;
55
+
56
+ this.setVal("action", "getEvents");
57
+ this.setQueryArrVal(keywords, "keyword", "keywordOper", "and");
58
+ this.setQueryArrVal(conceptUri, "conceptUri", "conceptOper", "and");
59
+ this.setQueryArrVal(categoryUri, "categoryUri", "categoryOper", "or");
60
+ this.setQueryArrVal(sourceUri, "sourceUri", undefined, "or");
61
+ this.setQueryArrVal(sourceLocationUri, "sourceLocationUri", undefined, "or");
62
+ this.setQueryArrVal(sourceGroupUri, "sourceGroupUri", undefined, "or");
63
+ this.setQueryArrVal(authorUri, "authorUri", "authorOper", "or");
64
+ this.setQueryArrVal(locationUri, "locationUri", undefined, "or");
65
+ this.setQueryArrVal(lang, "lang", undefined, "or");
66
+ if (dateStart !== undefined) {
67
+ this.setDateVal("dateStart", dateStart);
68
+ }
69
+ if (dateEnd !== undefined) {
70
+ this.setDateVal("dateEnd", dateEnd);
71
+ }
72
+ if (reportingDateStart !== undefined) {
73
+ this.setDateVal("reportingDateStart", reportingDateStart);
74
+ }
75
+ if (reportingDateEnd !== undefined) {
76
+ this.setDateVal("reportingDateEnd", reportingDateEnd);
77
+ }
78
+
79
+ if (minSentiment > -1 && minSentiment <= 1 ) {
80
+ this.setVal("minSentiment", minSentiment);
81
+ }
82
+
83
+ if (maxSentiment >= -1 && maxSentiment < 1 ) {
84
+ this.setVal("maxSentiment", maxSentiment);
85
+ }
86
+
87
+ this.setValIfNotDefault("minArticlesInEvent", minArticlesInEvent, undefined);
88
+ this.setValIfNotDefault("maxArticlesInEvent", maxArticlesInEvent, undefined);
89
+
90
+ if (dateMentionStart !== undefined) {
91
+ this.setDateVal("dateMentionStart", dateMentionStart);
92
+ }
93
+ if (dateMentionEnd !== undefined) {
94
+ this.setDateVal("dateMentionEnd", dateMentionEnd);
95
+ }
96
+
97
+ // for the negative conditions, only the OR is a valid operator type
98
+ this.setQueryArrVal(ignoreKeywords, "ignoreKeywords", undefined, "or");
99
+ this.setQueryArrVal(ignoreConceptUri, "ignoreConceptUri", undefined, "or");
100
+ this.setQueryArrVal(ignoreCategoryUri, "ignoreCategoryUri", undefined, "or");
101
+ this.setQueryArrVal(ignoreSourceUri, "ignoreSourceUri", undefined, "or");
102
+ this.setQueryArrVal(ignoreSourceLocationUri, "ignoreSourceLocationUri", undefined, "or");
103
+ this.setQueryArrVal(ignoreSourceGroupUri, "ignoreSourceGroupUri", undefined, "or");
104
+ this.setQueryArrVal(ignoreAuthorUri, "ignoreAuthorUri", undefined, "or");
105
+ this.setQueryArrVal(ignoreLocationUri, "ignoreLocationUri", undefined, "or");
106
+
107
+ this.setQueryArrVal(ignoreLang, "ignoreLang", undefined, "or");
108
+
109
+ this.setValIfNotDefault("keywordLoc", keywordsLoc, "body");
110
+ this.setValIfNotDefault("ignoreKeywordLoc", ignoreKeywordsLoc, "body");
111
+ this.setValIfNotDefault("keywordSearchMode", keywordSearchMode, "phrase");
112
+ this.setValIfNotDefault("ignoreKeywordSearchMode", ignoreKeywordSearchMode, "phrase");
113
+ this.setValIfNotDefault("categoryIncludeSub", categoryIncludeSub, true);
114
+ this.setValIfNotDefault("ignoreCategoryIncludeSub", ignoreCategoryIncludeSub, true);
115
+ this.setRequestedResult(requestedResult);
116
+ }
117
+
118
+ public get path() {
119
+ return "/api/v1/event";
120
+ }
121
+
122
+ /**
123
+ * Set the single result type that you would like to be returned. Any previously set result types will be overwritten.
124
+ * Result types can be the classes that extend RequestEvent base class (see classes below).
125
+ */
126
+ public setRequestedResult(requestEvents: RequestEvents) {
127
+ if (!(requestEvents instanceof RequestEvents)) {
128
+ throw new Error("QueryEvents class can only accept result requests that are of type RequestEvents");
129
+ }
130
+ this.resultTypeList = [
131
+ requestEvents
132
+ ];
133
+ }
134
+ /**
135
+ * Set a custom list of event uris. The results will be then computed on this list - no query will be done (all conditions will be ignored).
136
+ */
137
+ public static initWithEventUriList(uriList: string[]) {
138
+ const query = new QueryEvents();
139
+ if (!Array.isArray(uriList)) {
140
+ throw new Error("uriList has to be a list of strings that represent event uris");
141
+ }
142
+ query.params = {
143
+ action: "getEvents",
144
+ eventUriList: uriList.join(",")
145
+ };
146
+ return query;
147
+ }
148
+
149
+ /**
150
+ * Set a custom list of event uris. The results will be then computed on this list - no query will be done (all conditions will be ignored).
151
+ */
152
+ public static initWithEventUriWgtList(uriWgtList: string[]) {
153
+ const query = new QueryEvents();
154
+ if (!Array.isArray(uriWgtList)) {
155
+ throw new Error("uriWgtList has to be a list of strings that represent event uris");
156
+ }
157
+ query.params = {
158
+ action: "getEvents",
159
+ eventUriWgtList: uriWgtList.join(",")
160
+ };
161
+ return query;
162
+ }
163
+
164
+ public static initWithComplexQuery(...args: unknown[]) {
165
+ const complexQuery = args[0] as ComplexEventQuery | string | Record<string, unknown>;
166
+ const query = new QueryEvents();
167
+ if (complexQuery instanceof ComplexEventQuery) {
168
+ query.setVal("query", JSON.stringify(complexQuery.getQuery()));
169
+ } else if (typeof complexQuery === 'string') {
170
+ try {
171
+ JSON.parse(complexQuery);
172
+ } catch {
173
+ Logger.error("Failed to parse the provided string content as a JSON object. Please check the content provided as a parameter to the initWithComplexQuery() method");
174
+ }
175
+ query.setVal("query", complexQuery);
176
+ } else if (typeof complexQuery === 'object' && complexQuery !== null) {
177
+ query.setVal("query", JSON.stringify(complexQuery));
178
+ } else {
179
+ throw new Error("The instance of query parameter was not a ComplexEventQuery, a string or an object");
180
+ }
181
+ return query;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * @class QueryEventsIter
187
+ * Class for iterating through all the events via callbacks
188
+ */
189
+ export class QueryEventsIter extends QueryEvents implements AsyncIterable<Data.Event> {
190
+ private readonly er: EventRegistry;
191
+ private readonly engine: QueryIterationEngine<Data.Event>;
192
+
193
+ constructor(er: EventRegistry, args: ER.QueryEvents.IteratorArguments = {}) {
194
+ super(args as ER.QueryEvents.Arguments);
195
+ const {
196
+ sortBy = "rel",
197
+ sortByAsc = false,
198
+ returnInfo = undefined,
199
+ maxItems = -1
200
+ } = args;
201
+ this.er = er;
202
+ this.engine = new QueryIterationEngine<Data.Event>({
203
+ maxItems,
204
+ entityLabel: "events",
205
+ onError: (message) => this.er.logger.error(message),
206
+ fetchPage: async (page) => {
207
+ const requestEventsInfo = new RequestEventsInfo({ page, count: 50, sortBy, sortByAsc, returnInfo });
208
+ this.setRequestedResult(requestEventsInfo);
209
+ if (this.er.verboseOutput) {
210
+ this.er.logger.info(`Downloading event page ${page}...`);
211
+ }
212
+ const response = await this.er.execQuery(this, this.er.allowUseOfArchive);
213
+ return {
214
+ results: (response.events as ER.Results<Data.Event>)?.results || [],
215
+ pages: (response.events as ER.Results)?.pages || 0,
216
+ error: response.error || undefined
217
+ };
218
+ }
219
+ });
220
+ }
221
+
222
+ /**
223
+ * Async Iterator function that returns the next item in the list of events
224
+ */
225
+ [Symbol.asyncIterator](): AsyncIterator<Data.Event> {
226
+ return this.engine[Symbol.asyncIterator]();
227
+ }
228
+
229
+ public async count(): Promise<number> {
230
+ this.setRequestedResult(new RequestEventsInfo());
231
+ const response = await this.er.execQuery(this);
232
+ if (response?.error) {
233
+ this.er.logger.error(response.error);
234
+ }
235
+ return (response?.events as ER.Results)?.totalResults || 0;
236
+ }
237
+
238
+ /**
239
+ * Execute query and fetch batches of events of the specified size (eventBatchSize)
240
+ * @param callback callback function that'll be called every time we get a new batch of events from the backend
241
+ * @param doneCallback callback function that'll be called when everything is complete
242
+ */
243
+ public execQuery(callback: (item: Data.Event) => void, doneCallback?: (error?: string) => void): void {
244
+ this.engine.execQuery(callback, doneCallback);
245
+ }
246
+
247
+ public static initWithComplexQuery(er: EventRegistry, complexQuery: ComplexEventQuery | string | Record<string, unknown>, args: ER.QueryEvents.IteratorArguments = {}) {
248
+ const query = new QueryEventsIter(er, args);
249
+ if (complexQuery instanceof ComplexEventQuery) {
250
+ query.setVal("query", JSON.stringify(complexQuery.getQuery()));
251
+ } else if (typeof complexQuery === "string") {
252
+ query.setVal("query", complexQuery);
253
+ } else if (typeof complexQuery === "object" && complexQuery !== null) {
254
+ query.setVal("query", JSON.stringify(complexQuery));
255
+ } else {
256
+ throw new Error("The instance of query parameter was not a ComplexEventQuery, a string or an object");
257
+ }
258
+ return query;
259
+ }
260
+ }
261
+
262
+ export class RequestEvents {}
263
+
264
+ /**
265
+ * @class RequestEventsInfo
266
+ * Return event details for resulting events.
267
+ */
268
+ export class RequestEventsInfo extends RequestEvents {
269
+ public resultType = "events";
270
+ public params: Record<string, unknown>;
271
+ constructor(args: ER.QueryEvents.RequestEventsInfoArguments = {}) {
272
+ super();
273
+ const {
274
+ page = 1,
275
+ count = 50,
276
+ sortBy = "rel",
277
+ sortByAsc = false,
278
+ returnInfo = undefined
279
+ } = args;
280
+ if (page < 1) {
281
+ throw new RangeError("Page has to be >= 1");
282
+ }
283
+ if (count > 50) {
284
+ throw new RangeError("At most 50 events can be returned per call");
285
+ }
286
+ this.params = {};
287
+ this.params["eventsPage"] = page;
288
+ this.params["eventsCount"] = count;
289
+ this.params["eventsSortBy"] = sortBy;
290
+ this.params["eventsSortByAsc"] = sortByAsc;
291
+ if (!!returnInfo) {
292
+ this.params = {...this.params, ...returnInfo.getParams("events")};
293
+ }
294
+ }
295
+ }
296
+
297
+ /**
298
+ * @class RequestEventsUriList
299
+ * Return a simple list of event uris together with the scores for resulting events.
300
+ */
301
+ export class RequestEventsUriWgtList extends RequestEvents {
302
+ public resultType = "uriWgtList";
303
+ public params: Record<string, unknown>;
304
+
305
+ constructor(args: ER.QueryEvents.RequestEventsUriWgtListArguments = {}) {
306
+ super();
307
+ const {
308
+ page = 1,
309
+ count = 50000,
310
+ sortBy = "rel",
311
+ sortByAsc = false,
312
+ ...unsupported
313
+ } = args;
314
+ if (Object.keys(unsupported).length !== 0) {
315
+ Logger.warn(`RequestEventsUriWgtList: Unsupported parameters detected: ${JSON.stringify(unsupported)}. Please check the documentation.`);
316
+ }
317
+ if (page < 1) {
318
+ throw new RangeError("Page has to be >= 1");
319
+ }
320
+ if (count > 100000) {
321
+ throw new RangeError("At most 100000 results can be returned per call");
322
+ }
323
+ this.params = {};
324
+ this.params["uriWgtListPage"] = page;
325
+ this.params["uriWgtListCount"] = count;
326
+ this.params["uriWgtListSortBy"] = sortBy;
327
+ this.params["uriWgtListSortByAsc"] = sortByAsc;
328
+ }
329
+
330
+ public set page(page: number) {
331
+ if (page < 1) {
332
+ throw new RangeError("Page has to be >= 1");
333
+ }
334
+ this.params["uriWgtListPage"] = page;
335
+ }
336
+ }
337
+
338
+ /**
339
+ * @class RequestEventsTimeAggr
340
+ * Return time distribution of resulting events.
341
+ */
342
+ export class RequestEventsTimeAggr extends RequestEvents {
343
+ public resultType = "timeAggr";
344
+ }
345
+
346
+ /**
347
+ * Return keyword aggregate (tag cloud) on words in articles in resulting events.
348
+ * @class RequestEventsTimeAggr
349
+ */
350
+ export class RequestEventsKeywordAggr extends RequestEvents {
351
+ public resultType = "keywordAggr";
352
+ public params: Record<string, unknown>;
353
+ /**
354
+ * @param lang: in which language to produce the list of top keywords. If undefined, then compute on all articles
355
+ */
356
+ constructor(lang?: string | string[]) {
357
+ super();
358
+ this.params = {};
359
+ if (lang !== undefined) {
360
+ this.params["keywordAggrLang"] = lang;
361
+ }
362
+ }
363
+ }
364
+
365
+ /**
366
+ * @class RequestEventsLocAggr
367
+ * Return aggregate of locations of resulting events.
368
+ */
369
+ export class RequestEventsLocAggr extends RequestEvents {
370
+ public resultType = "locAggr";
371
+ public params: Record<string, unknown>;
372
+ constructor(args: ER.QueryEvents.RequestEventsLocAggrArguments = {}) {
373
+ super();
374
+ const {
375
+ eventsSampleSize = 100000,
376
+ returnInfo = new ReturnInfo(),
377
+ ...unsupported
378
+ } = args;
379
+ if (Object.keys(unsupported).length !== 0) {
380
+ Logger.warn(`RequestEventsLocAggr: Unsupported parameters detected: ${JSON.stringify(unsupported)}. Please check the documentation.`);
381
+ }
382
+ if (eventsSampleSize > 100000) {
383
+ throw new RangeError("At most 100000 results can be used for computing");
384
+ }
385
+ this.params = {};
386
+ this.params["locAggrSampleSize"] = eventsSampleSize;
387
+ this.params = {...this.params, ...returnInfo.getParams("locAggr")};
388
+ }
389
+ }
390
+
391
+ /**
392
+ * @class RequestEventsLocTimeAggr
393
+ * Return aggregate of locations and times of resulting events.
394
+ */
395
+ export class RequestEventsLocTimeAggr extends RequestEvents {
396
+ public resultType = "locTimeAggr";
397
+ public params: Record<string, unknown>;
398
+ constructor(args: ER.QueryEvents.RequestEventsLocTimeAggrArguments = {}) {
399
+ super();
400
+ const {
401
+ eventsSampleSize = 100000,
402
+ returnInfo = new ReturnInfo(),
403
+ ...unsupported
404
+ } = args;
405
+ if (Object.keys(unsupported).length !== 0) {
406
+ Logger.warn(`RequestEventsLocTimeAggr: Unsupported parameters detected: ${JSON.stringify(unsupported)}. Please check the documentation.`);
407
+ }
408
+ if (eventsSampleSize > 100000) {
409
+ throw new RangeError("At most 100000 results can be used for computing");
410
+ }
411
+ this.params = {};
412
+ this.params["locTimeAggrSampleSize"] = eventsSampleSize;
413
+ this.params = {...this.params, ...returnInfo.getParams("locTimeAggr")};
414
+ }
415
+ }
416
+
417
+ /**
418
+ * @class RequestEventsConceptAggr
419
+ * Compute which concept are the most frequently occurring in the list of resulting events.
420
+ */
421
+ export class RequestEventsConceptAggr extends RequestEvents {
422
+ public resultType = "conceptAggr";
423
+ public params: Record<string, unknown>;
424
+ constructor(args: ER.QueryEvents.RequestEventsConceptAggrArguments = {}) {
425
+ super();
426
+ const { conceptCount = 20, eventsSampleSize = 100000, returnInfo = new ReturnInfo() } = args;
427
+ if (conceptCount > 200) {
428
+ throw new RangeError("At most 200 top concepts can be returned");
429
+ }
430
+ if (eventsSampleSize > 300000) {
431
+ throw new RangeError("At most 300000 results can be used for computing");
432
+ }
433
+ this.params = {};
434
+ this.params["conceptAggrConceptCount"] = conceptCount;
435
+ this.params["conceptAggrSampleSize"] = eventsSampleSize;
436
+ this.params = {...this.params, ...returnInfo.getParams("conceptAggr")};
437
+ }
438
+ }
439
+
440
+ /**
441
+ * @class RequestEventsConceptGraph
442
+ * Compute which concept pairs frequently co-occur together in the resulting events.
443
+ */
444
+ export class RequestEventsConceptGraph extends RequestEvents {
445
+ public resultType = "conceptGraph";
446
+ public params: Record<string, unknown>;
447
+ constructor(args: ER.QueryEvents.RequestEventsConceptGraphArguments = {}) {
448
+ super();
449
+ const { conceptCount = 25, linkCount = 150, eventsSampleSize = 50000, returnInfo = new ReturnInfo() } = args;
450
+ if (conceptCount > 1000) {
451
+ throw new RangeError("At most 1000 top concepts can be returned");
452
+ }
453
+ if (linkCount > 2000) {
454
+ throw new RangeError("At most 2000 links between concepts can be returned");
455
+ }
456
+ if (eventsSampleSize > 300000) {
457
+ throw new RangeError("At most 300000 results can be used for computing");
458
+ }
459
+ this.params = {};
460
+ this.params["conceptGraphConceptCount"] = conceptCount;
461
+ this.params["conceptGraphLinkCount"] = linkCount;
462
+ this.params["conceptGraphSampleSize"] = eventsSampleSize;
463
+ this.params = {...this.params, ...returnInfo.getParams("conceptGraph")};
464
+ }
465
+ }
466
+
467
+ /**
468
+ * @class RequestEventsConceptMatrix
469
+ * Get a matrix of concepts and their dependencies.
470
+ * For individual concept pairs return how frequently
471
+ * they co-occur in the resulting events and how "surprising" this is,
472
+ * based on the frequency of individual concepts.
473
+ */
474
+ export class RequestEventsConceptMatrix extends RequestEvents {
475
+ public resultType = "conceptMatrix";
476
+ public params: Record<string, unknown>;
477
+ constructor(args: ER.QueryEvents.RequestEventsConceptMatrixArguments = {}) {
478
+ super();
479
+ const { conceptCount = 25, measure = "pmi", eventsSampleSize = 100000, returnInfo = new ReturnInfo() } = args;
480
+ if (conceptCount > 200) {
481
+ throw new RangeError("At most 200 top concepts can be returned");
482
+ }
483
+ if (eventsSampleSize > 300000) {
484
+ throw new RangeError("At most 300000 results can be used for computing");
485
+ }
486
+ this.params = {};
487
+ this.params["conceptMatrixConceptCount"] = conceptCount;
488
+ this.params["conceptMatrixMeasure"] = measure;
489
+ this.params["conceptMatrixSampleSize"] = eventsSampleSize;
490
+ this.params = {...this.params, ...returnInfo.getParams("conceptMatrix")};
491
+ }
492
+ }
493
+
494
+ /**
495
+ * @class RequestEventsConceptTrends
496
+ * Return a list of top trending concepts and their daily trending info over time
497
+ */
498
+ export class RequestEventsConceptTrends extends RequestEvents {
499
+ public resultType = "conceptTrends";
500
+ public params: Record<string, unknown>;
501
+ constructor(args: ER.QueryEvents.RequestEventsConceptTrendsArguments = {}) {
502
+ super();
503
+ const { conceptCount = 10, conceptUris = [], returnInfo = new ReturnInfo() } = args;
504
+ if (conceptCount > 50) {
505
+ throw new RangeError("At most 50 top concepts can be returned");
506
+ }
507
+ this.params = {};
508
+ this.params["conceptTrendsConceptCount"] = conceptCount;
509
+ if (conceptUris.length > 0) {
510
+ this.params["conceptTrendsConceptUri"] = conceptUris;
511
+ }
512
+ this.params = {...this.params, ...returnInfo.getParams("conceptTrends")};
513
+ }
514
+ }
515
+
516
+ /**
517
+ * @class RequestEventsSourceAggr
518
+ * Return top news sources that report about the events that match the search conditions
519
+ */
520
+ export class RequestEventsSourceAggr extends RequestEvents {
521
+ public resultType = "sourceAggr";
522
+ public params: Record<string, unknown>;
523
+ constructor(args: ER.QueryEvents.RequestEventsSourceAggrArguments = {}) {
524
+ super();
525
+ const { sourceCount = 30, eventsSampleSize = 50000, returnInfo = new ReturnInfo() } = args;
526
+ if (sourceCount > 200) {
527
+ throw new RangeError("At most 200 top sources can be returned");
528
+ }
529
+ if (eventsSampleSize > 100000) {
530
+ throw new RangeError("At most 100000 results can be used for computing");
531
+ }
532
+ this.params = {};
533
+ this.params["sourceAggrSourceCount"] = sourceCount;
534
+ this.params["sourceAggrSampleSize"] = eventsSampleSize;
535
+ this.params = {...this.params, ...returnInfo.getParams("sourceAggr")};
536
+ }
537
+ }
538
+
539
+ /**
540
+ * @class RequestEventsDateMentionAggr
541
+ * Return events and the dates that are mentioned in articles about these events
542
+ */
543
+ export class RequestEventsDateMentionAggr extends RequestEvents {
544
+ public resultType = "dateMentionAggr";
545
+ public params: Record<string, unknown>;
546
+ constructor(args: ER.QueryEvents.RequestEventsDateMentionAggrArguments = {}) {
547
+ super();
548
+ const {
549
+ minDaysApart = 0,
550
+ minDateMentionCount = 5,
551
+ eventsSampleSize = 100000,
552
+ returnInfo = new ReturnInfo()
553
+ } = args;
554
+ if (eventsSampleSize > 300000) {
555
+ throw new RangeError("At most 300000 results can be used for computing");
556
+ }
557
+ this.params = {};
558
+ this.params["dateMentionAggrMinDaysApart"] = minDaysApart;
559
+ this.params["dateMentionAggrMinDateMentionCount"] = minDateMentionCount;
560
+ this.params["dateMentionAggrSampleSize"] = eventsSampleSize;
561
+ this.params = {...this.params, ...returnInfo.getParams("dateMentionAggr")};
562
+ }
563
+ }
564
+
565
+ /**
566
+ * @class RequestEventsEventClusters
567
+ * Return hierarchical clustering of events into smaller clusters. 2-means clustering is applied on each node in the tree
568
+ */
569
+ export class RequestEventsEventClusters extends RequestEvents {
570
+ public resultType = "eventClusters";
571
+ public params: Record<string, unknown>;
572
+ constructor(args: ER.QueryEvents.RequestEventsEventClustersArguments = {}) {
573
+ super();
574
+ const { keywordCount = 30, maxEventsToCluster = 10000, returnInfo = new ReturnInfo() } = args;
575
+ if (keywordCount > 100) {
576
+ throw new RangeError("At most 100 keywords can be reported in each of the clusters");
577
+ }
578
+ if (maxEventsToCluster > 10000) {
579
+ throw new RangeError("At most 10000 events can be clustered together");
580
+ }
581
+ this.params = {};
582
+ this.params["eventClustersKeywordCount"] = keywordCount;
583
+ this.params["eventClustersMaxEventsToCluster"] = maxEventsToCluster;
584
+ this.params = {...this.params, ...returnInfo.getParams("eventClusters")};
585
+ }
586
+ }
587
+
588
+ /**
589
+ * @class RequestEventsCategoryAggr
590
+ * Return distribution of events into dmoz categories.
591
+ */
592
+ export class RequestEventsCategoryAggr extends RequestEvents {
593
+ public resultType = "categoryAggr";
594
+ public params: Record<string, unknown>;
595
+ constructor(returnInfo = new ReturnInfo()) {
596
+ super();
597
+ this.params = returnInfo.getParams("categoryAggr");
598
+ }
599
+ }
600
+
601
+ /**
602
+ * @class RequestEventsRecentActivity
603
+ * Return a list of recently changed events that match search conditions.
604
+ */
605
+ export class RequestEventsRecentActivity extends RequestEvents {
606
+ public resultType = "recentActivityEvents";
607
+ public params: Record<string, unknown>;
608
+ constructor(args: ER.QueryEvents.RequestEventsRecentActivityArguments = {}) {
609
+ super();
610
+ const {
611
+ maxEventCount = 50,
612
+ updatesAfterTm,
613
+ updatesAfterMinsAgo,
614
+ mandatoryLocation = true,
615
+ minAvgCosSim = 0,
616
+ returnInfo = undefined
617
+ } = args;
618
+ if (maxEventCount > 2000) {
619
+ throw new RangeError("At most 2000 events can be returned");
620
+ }
621
+ if (updatesAfterTm !== undefined && updatesAfterMinsAgo !== undefined) {
622
+ throw new Error("You should specify either updatesAfterTm or updatesAfterMinsAgo parameter, but not both");
623
+ }
624
+ this.params = {};
625
+ this.params["recentActivityEventsMaxEventCount"] = maxEventCount;
626
+ this.params["recentActivityEventsMandatoryLocation"] = mandatoryLocation;
627
+
628
+ if (updatesAfterTm !== undefined) {
629
+ this.params["recentActivityEventsUpdatesAfterTm"] = QueryParamsBase.encodeDateTime(updatesAfterTm);
630
+ }
631
+
632
+ if (updatesAfterMinsAgo !== undefined) {
633
+ this.params["recentActivityEventsUpdatesAfterMinsAgo"] = updatesAfterMinsAgo;
634
+ }
635
+
636
+ this.params["recentActivityEventsMinAvgCosSim"] = minAvgCosSim;
637
+ if (!!returnInfo) {
638
+ this.params = {...this.params, ...returnInfo.getParams("recentActivityEvents")};
639
+ }
640
+ }
641
+ }
642
+
643
+ /**
644
+ * @class RequestEventsBreakingEvents
645
+ * Return a list of events that are currently breaking.
646
+ */
647
+ export class RequestEventsBreakingEvents extends RequestEvents {
648
+ public resultType = "breakingEvents";
649
+ public params: Record<string, unknown>;
650
+ constructor(args: ER.QueryEvents.RequestEventsBreakingEventsArguments = {}) {
651
+ super();
652
+ const {
653
+ page = 1,
654
+ count = 50,
655
+ minBreakingScore = 0.2,
656
+ returnInfo = undefined
657
+ } = args;
658
+ if (page < 1) {
659
+ throw new RangeError("page has to be >= 1");
660
+ }
661
+ if (count > 50) {
662
+ throw new RangeError("At most 50 events can be returned");
663
+ }
664
+ this.params = {};
665
+ this.params["breakingEventsPage"] = page;
666
+ this.params["breakingEventsCount"] = count;
667
+ this.params["breakingEventsMinBreakingScore"] = minBreakingScore;
668
+ if (!!returnInfo) {
669
+ this.params = {...this.params, ...returnInfo.getParams("breakingEvents")};
670
+ }
671
+ }
672
+ }