eventregistry 8.11.2 → 9.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.
- package/dist/analytics.d.ts +82 -82
- package/dist/analytics.js +336 -330
- package/dist/analytics.js.map +1 -1
- package/dist/base.d.ts +82 -81
- package/dist/base.js +261 -219
- package/dist/base.js.map +1 -1
- package/dist/counts.d.ts +81 -81
- package/dist/counts.js +162 -149
- package/dist/counts.js.map +1 -1
- package/dist/dailyShares.d.ts +10 -10
- package/dist/dailyShares.js +90 -77
- package/dist/dailyShares.js.map +1 -1
- package/dist/data.d.ts +269 -268
- package/dist/data.js +3 -3
- package/dist/eventForText.d.ts +48 -48
- package/dist/eventForText.js +126 -123
- package/dist/eventForText.js.map +1 -1
- package/dist/eventRegistry.d.ts +244 -224
- package/dist/eventRegistry.js +1098 -1018
- package/dist/eventRegistry.js.map +1 -1
- package/dist/index.d.ts +21 -20
- package/dist/index.js +128 -122
- package/dist/index.js.map +1 -1
- package/dist/info.d.ts +61 -61
- package/dist/info.js +171 -158
- package/dist/info.js.map +1 -1
- package/dist/logger.d.ts +45 -0
- package/dist/logger.js +156 -0
- package/dist/logger.js.map +1 -0
- package/dist/query.d.ts +53 -53
- package/dist/query.js +333 -290
- package/dist/query.js.map +1 -1
- package/dist/queryArticle.d.ts +61 -61
- package/dist/queryArticle.js +183 -168
- package/dist/queryArticle.js.map +1 -1
- package/dist/queryArticles.d.ts +144 -160
- package/dist/queryArticles.js +729 -701
- package/dist/queryArticles.js.map +1 -1
- package/dist/queryEvent.d.ts +140 -140
- package/dist/queryEvent.js +587 -569
- package/dist/queryEvent.js.map +1 -1
- package/dist/queryEvents.d.ts +210 -210
- package/dist/queryEvents.js +825 -798
- package/dist/queryEvents.js.map +1 -1
- package/dist/queryMentions.d.ts +96 -96
- package/dist/queryMentions.js +637 -600
- package/dist/queryMentions.js.map +1 -1
- package/dist/queryStory.d.ts +58 -58
- package/dist/queryStory.js +194 -174
- package/dist/queryStory.js.map +1 -1
- package/dist/recent.d.ts +23 -23
- package/dist/recent.js +199 -179
- package/dist/recent.js.map +1 -1
- package/dist/returnInfo.d.ts +68 -66
- package/dist/returnInfo.js +332 -304
- package/dist/returnInfo.js.map +1 -1
- package/dist/topicPage.d.ts +157 -157
- package/dist/topicPage.js +599 -604
- package/dist/topicPage.js.map +1 -1
- package/dist/trends.d.ts +35 -35
- package/dist/trends.js +115 -102
- package/dist/trends.js.map +1 -1
- package/dist/types.d.ts +2453 -2155
- package/dist/types.js +2 -2
- package/package.json +13 -13
package/dist/eventRegistry.js
CHANGED
|
@@ -1,1019 +1,1099 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
step(
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function step(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case
|
|
33
|
-
case
|
|
34
|
-
case
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
if (op[0] ===
|
|
39
|
-
if (
|
|
40
|
-
if (t[2]) _.ops.
|
|
41
|
-
_.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
};
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
return [
|
|
229
|
-
case
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
case
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
params = {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
case
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
*
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
*
|
|
948
|
-
*/
|
|
949
|
-
EventRegistry.prototype.
|
|
950
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
951
|
-
var request;
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
case
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
var
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
return
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.ArticleMapper = exports.EventRegistry = void 0;
|
|
62
|
+
var axios_1 = require("axios");
|
|
63
|
+
var fs = require("fs");
|
|
64
|
+
var moment = require("moment");
|
|
65
|
+
var semaphore_async_await_1 = require("semaphore-async-await");
|
|
66
|
+
var returnInfo_1 = require("./returnInfo");
|
|
67
|
+
var base_1 = require("./base");
|
|
68
|
+
var logger_1 = require("./logger");
|
|
69
|
+
/**
|
|
70
|
+
* @class EventRegistry
|
|
71
|
+
* Main class responsible for obtaining results form the Event Registry
|
|
72
|
+
*/
|
|
73
|
+
var EventRegistry = /** @class */ (function () {
|
|
74
|
+
function EventRegistry(config) {
|
|
75
|
+
if (config === void 0) { config = {}; }
|
|
76
|
+
var _this = this;
|
|
77
|
+
var _a, _b;
|
|
78
|
+
this.config = {
|
|
79
|
+
host: "http://eventregistry.org",
|
|
80
|
+
hostAnalytics: "http://analytics.eventregistry.org",
|
|
81
|
+
logging: false,
|
|
82
|
+
minDelayBetweenRequests: 1,
|
|
83
|
+
repeatFailedRequestCount: 2,
|
|
84
|
+
verboseOutput: false,
|
|
85
|
+
allowUseOfArchive: true,
|
|
86
|
+
};
|
|
87
|
+
this.headers = {};
|
|
88
|
+
this.dailyAvailableRequests = -1;
|
|
89
|
+
this.remainingAvailableRequests = -1;
|
|
90
|
+
this.lastQueryTime = 0;
|
|
91
|
+
this._logRequests = false;
|
|
92
|
+
this.stopStatusCodes = [
|
|
93
|
+
204,
|
|
94
|
+
400,
|
|
95
|
+
401,
|
|
96
|
+
403,
|
|
97
|
+
530,
|
|
98
|
+
];
|
|
99
|
+
this.lock = new semaphore_async_await_1.default(1);
|
|
100
|
+
this._logRequests = this.config.logging;
|
|
101
|
+
this.logger = logger_1.Logger.createInstance({ logging: this.config.logging, logRequests: this._logRequests });
|
|
102
|
+
if (fs && fs.existsSync(this.config.settingsFName || "settings.json")) {
|
|
103
|
+
var localConfig = JSON.parse(fs.readFileSync(this.config.settingsFName || "settings.json", "utf8"));
|
|
104
|
+
this.config = __assign(__assign(__assign({}, this.config), localConfig), config);
|
|
105
|
+
if ((config === null || config === void 0 ? void 0 : config.apiKey) !== undefined) {
|
|
106
|
+
this.logger.debug("found apiKey in settings file which will be used for making requests");
|
|
107
|
+
this.config.apiKey = config.apiKey;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.config = __assign(__assign({}, this.config), config);
|
|
112
|
+
if (!!config.apiKey) {
|
|
113
|
+
this.logger.debug("using user provided API key for making requests");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.apiKey) === undefined || ((_b = this.config) === null || _b === void 0 ? void 0 : _b.apiKey) === null) {
|
|
117
|
+
this.logger.info("No API key was provided. You will be allowed to perform only a very limited number of requests per day.");
|
|
118
|
+
}
|
|
119
|
+
this.logger.debug("Event Registry host: ".concat(this.config.host));
|
|
120
|
+
this.logger.debug("Text analytics host: ".concat(this.config.hostAnalytics));
|
|
121
|
+
this.config.minDelayBetweenRequests *= 1000;
|
|
122
|
+
axios_1.default.interceptors.response.use(undefined, function (err) {
|
|
123
|
+
// If config does not exist or the retry option is not set, reject
|
|
124
|
+
if (!err.config || !err.config.retry) {
|
|
125
|
+
return Promise.reject(err);
|
|
126
|
+
}
|
|
127
|
+
if (_this.stopStatusCodes.includes(err.response.status)) {
|
|
128
|
+
return Promise.reject(err);
|
|
129
|
+
}
|
|
130
|
+
// Set the variable for keeping track of the retry count
|
|
131
|
+
err.config.__retryCount = err.config.__retryCount || 0;
|
|
132
|
+
// Check if we've maxed out the total number of retries
|
|
133
|
+
if (err.config.__retryCount >= err.config.retry) {
|
|
134
|
+
// Reject with the error
|
|
135
|
+
return Promise.reject(err);
|
|
136
|
+
}
|
|
137
|
+
err.config.__retryCount += 1;
|
|
138
|
+
return new Promise(function (resolve) {
|
|
139
|
+
setTimeout(function () { return resolve(); }, err.config.retryDelay || 1);
|
|
140
|
+
}).then(function () { return (0, axios_1.default)(err.config); });
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Should all requests be logged to a file or not?
|
|
145
|
+
*/
|
|
146
|
+
EventRegistry.prototype.setLogging = function (logging) {
|
|
147
|
+
this._logRequests = logging;
|
|
148
|
+
this.logger.toggleRequestLogging(logging);
|
|
149
|
+
};
|
|
150
|
+
Object.defineProperty(EventRegistry.prototype, "allowUseOfArchive", {
|
|
151
|
+
get: function () {
|
|
152
|
+
return this.config.allowUseOfArchive;
|
|
153
|
+
},
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(EventRegistry.prototype, "verboseOutput", {
|
|
158
|
+
get: function () {
|
|
159
|
+
return this.config.verboseOutput;
|
|
160
|
+
},
|
|
161
|
+
enumerable: false,
|
|
162
|
+
configurable: true
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* Main method for executing the search queries.
|
|
166
|
+
* @param query instance of Query class
|
|
167
|
+
*/
|
|
168
|
+
EventRegistry.prototype.execQuery = function (query_1) {
|
|
169
|
+
return __awaiter(this, arguments, void 0, function (query, allowUseOfArchive) {
|
|
170
|
+
var params, request;
|
|
171
|
+
var _a;
|
|
172
|
+
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
|
|
173
|
+
return __generator(this, function (_b) {
|
|
174
|
+
switch (_b.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
params = query.getQueryParams();
|
|
177
|
+
return [4 /*yield*/, this.jsonRequest(query.path, params, allowUseOfArchive)];
|
|
178
|
+
case 1:
|
|
179
|
+
request = _b.sent();
|
|
180
|
+
if (!(request === null || request === void 0 ? void 0 : request.data) && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.verboseOutput)) {
|
|
181
|
+
this.logger.error("Request did not return with the 'data' property.");
|
|
182
|
+
}
|
|
183
|
+
return [2 /*return*/, ((request === null || request === void 0 ? void 0 : request.data) || {})];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
EventRegistry.prototype.jsonRequestAnalytics = function (path, parameters, headers, cookies) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
+
var request, args, cookieString, errorMessage, error_1;
|
|
191
|
+
var _a, _b, _c, _d, _e, _f;
|
|
192
|
+
return __generator(this, function (_g) {
|
|
193
|
+
switch (_g.label) {
|
|
194
|
+
case 0: return [4 /*yield*/, this.lock.acquire()];
|
|
195
|
+
case 1:
|
|
196
|
+
_g.sent();
|
|
197
|
+
_g.label = 2;
|
|
198
|
+
case 2:
|
|
199
|
+
_g.trys.push([2, 4, 5, 6]);
|
|
200
|
+
parameters = __assign(__assign({}, parameters), { apiKey: (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiKey });
|
|
201
|
+
args = {
|
|
202
|
+
url: path,
|
|
203
|
+
method: "POST",
|
|
204
|
+
baseURL: this.config.hostAnalytics,
|
|
205
|
+
data: parameters,
|
|
206
|
+
timeout: 600000,
|
|
207
|
+
responseType: "json",
|
|
208
|
+
maxRedirects: 5,
|
|
209
|
+
};
|
|
210
|
+
if (!!headers) {
|
|
211
|
+
args = __assign(__assign({}, args), { headers: headers });
|
|
212
|
+
}
|
|
213
|
+
if (!!cookies) {
|
|
214
|
+
cookieString = Object.keys(cookies).map(function (key) { return key + "=" + cookies[key]; }).join(";") + ";";
|
|
215
|
+
args = __assign(__assign({}, args), { headers: __assign(__assign({}, args.headers), { Cookie: cookieString }) });
|
|
216
|
+
}
|
|
217
|
+
return [4 /*yield*/, axios_1.default.request(args)];
|
|
218
|
+
case 3:
|
|
219
|
+
request = _g.sent();
|
|
220
|
+
this.headers = (request === null || request === void 0 ? void 0 : request.headers) || {};
|
|
221
|
+
if ((request === null || request === void 0 ? void 0 : request.status) !== 200) {
|
|
222
|
+
throw new Error(request === null || request === void 0 ? void 0 : request.statusText);
|
|
223
|
+
}
|
|
224
|
+
errorMessage = ((_b = request === null || request === void 0 ? void 0 : request.data) === null || _b === void 0 ? void 0 : _b.error) || "";
|
|
225
|
+
if (errorMessage) {
|
|
226
|
+
throw new Error(errorMessage);
|
|
227
|
+
}
|
|
228
|
+
return [3 /*break*/, 6];
|
|
229
|
+
case 4:
|
|
230
|
+
error_1 = _g.sent();
|
|
231
|
+
request = { data: { error: error_1 } };
|
|
232
|
+
if (this.config.verboseOutput) {
|
|
233
|
+
this.logger.error("Event Registry Analytics exception while executing the request.");
|
|
234
|
+
if (error_1 && error_1.stack && error_1.message) {
|
|
235
|
+
this.logger.error(error_1.message);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
this.logger.error("".concat((_c = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null || _c === void 0 ? void 0 : _c.status, ": ").concat((_d = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null || _d === void 0 ? void 0 : _d.statusText, " => ").concat((_e = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null || _e === void 0 ? void 0 : _e.data));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// try to print out the error that should be passed by in case the server is down or responds with errors
|
|
242
|
+
if ((_f = this.config) === null || _f === void 0 ? void 0 : _f.logging) {
|
|
243
|
+
this.logger.error((error_1 === null || error_1 === void 0 ? void 0 : error_1.errno) || error_1);
|
|
244
|
+
}
|
|
245
|
+
return [3 /*break*/, 6];
|
|
246
|
+
case 5:
|
|
247
|
+
this.lock.release();
|
|
248
|
+
return [7 /*endfinally*/];
|
|
249
|
+
case 6: return [2 /*return*/, request];
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Make a request for json data
|
|
256
|
+
* @param path url on er (e.g. "/api/v1/article")
|
|
257
|
+
* @param parameters Optional parameters to be included in the request
|
|
258
|
+
*/
|
|
259
|
+
EventRegistry.prototype.jsonRequest = function (path_1, parameters_1) {
|
|
260
|
+
return __awaiter(this, arguments, void 0, function (path, parameters, allowUseOfArchive) {
|
|
261
|
+
var request, current, errorMessage, error_2;
|
|
262
|
+
var _a, _b, _c, _d, _e, _f;
|
|
263
|
+
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
|
|
264
|
+
return __generator(this, function (_g) {
|
|
265
|
+
switch (_g.label) {
|
|
266
|
+
case 0:
|
|
267
|
+
current = moment.utc().milliseconds();
|
|
268
|
+
if (!(this.lastQueryTime && current - this.lastQueryTime < this.config.minDelayBetweenRequests)) return [3 /*break*/, 2];
|
|
269
|
+
return [4 /*yield*/, (0, base_1.sleep)(this.config.minDelayBetweenRequests - (current - this.lastQueryTime))];
|
|
270
|
+
case 1:
|
|
271
|
+
_g.sent();
|
|
272
|
+
_g.label = 2;
|
|
273
|
+
case 2: return [4 /*yield*/, this.lock.acquire()];
|
|
274
|
+
case 3:
|
|
275
|
+
_g.sent();
|
|
276
|
+
if (this._logRequests) {
|
|
277
|
+
if (Object.keys(parameters || {}).length > 0) {
|
|
278
|
+
this.logger.logRequest("# " + JSON.stringify(parameters) + "\n");
|
|
279
|
+
}
|
|
280
|
+
this.logger.logRequest(path + "\n\n");
|
|
281
|
+
}
|
|
282
|
+
this.lastQueryTime = current;
|
|
283
|
+
_g.label = 4;
|
|
284
|
+
case 4:
|
|
285
|
+
_g.trys.push([4, 6, 7, 8]);
|
|
286
|
+
parameters = __assign(__assign({}, parameters), { apiKey: (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiKey });
|
|
287
|
+
if (!allowUseOfArchive) {
|
|
288
|
+
parameters = __assign(__assign({}, parameters), { forceMaxDataTimeWindow: 31 });
|
|
289
|
+
}
|
|
290
|
+
return [4 /*yield*/, axios_1.default.request({
|
|
291
|
+
url: path,
|
|
292
|
+
method: "POST",
|
|
293
|
+
baseURL: this.config.host,
|
|
294
|
+
data: parameters,
|
|
295
|
+
timeout: 600000,
|
|
296
|
+
responseType: "json",
|
|
297
|
+
maxRedirects: 5,
|
|
298
|
+
retry: this.config.repeatFailedRequestCount,
|
|
299
|
+
})];
|
|
300
|
+
case 5:
|
|
301
|
+
request = _g.sent();
|
|
302
|
+
this.headers = (request === null || request === void 0 ? void 0 : request.headers) || {};
|
|
303
|
+
if ((request === null || request === void 0 ? void 0 : request.status) !== 200) {
|
|
304
|
+
throw new Error(request === null || request === void 0 ? void 0 : request.statusText);
|
|
305
|
+
}
|
|
306
|
+
if (this.getLastHeader("warning")) {
|
|
307
|
+
this.logger.warn("WARNING: ".concat(this.getLastHeader("warning")));
|
|
308
|
+
}
|
|
309
|
+
this.dailyAvailableRequests = Number(this.getLastHeader("x-ratelimit-limit", "-1"));
|
|
310
|
+
this.remainingAvailableRequests = Number(this.getLastHeader("x-ratelimit-remaining", "-1"));
|
|
311
|
+
errorMessage = ((_b = request === null || request === void 0 ? void 0 : request.data) === null || _b === void 0 ? void 0 : _b.error) || "";
|
|
312
|
+
if (errorMessage) {
|
|
313
|
+
throw new Error(errorMessage);
|
|
314
|
+
}
|
|
315
|
+
return [3 /*break*/, 8];
|
|
316
|
+
case 6:
|
|
317
|
+
error_2 = _g.sent();
|
|
318
|
+
request = { data: { error: error_2 } };
|
|
319
|
+
// try to print out the error that should be passed by in case the server is down or responds with errors
|
|
320
|
+
if (this.config.verboseOutput) {
|
|
321
|
+
this.logger.error("Event Registry exception while executing the request.");
|
|
322
|
+
if (error_2 && error_2.stack && error_2.message) {
|
|
323
|
+
this.logger.error(error_2.message);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
this.logger.error("".concat((_c = error_2 === null || error_2 === void 0 ? void 0 : error_2.response) === null || _c === void 0 ? void 0 : _c.status, ": ").concat((_d = error_2 === null || error_2 === void 0 ? void 0 : error_2.response) === null || _d === void 0 ? void 0 : _d.statusText, " => ").concat((_e = error_2 === null || error_2 === void 0 ? void 0 : error_2.response) === null || _e === void 0 ? void 0 : _e.data));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if ((_f = this.config) === null || _f === void 0 ? void 0 : _f.logging) {
|
|
330
|
+
this.logger.error((error_2 === null || error_2 === void 0 ? void 0 : error_2.errno) || error_2);
|
|
331
|
+
}
|
|
332
|
+
return [3 /*break*/, 8];
|
|
333
|
+
case 7:
|
|
334
|
+
this.lock.release();
|
|
335
|
+
return [7 /*endfinally*/];
|
|
336
|
+
case 8: return [2 /*return*/, request];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* get the number of requests that are still available for the user today. Information is only accessible after you make some query.
|
|
343
|
+
*/
|
|
344
|
+
EventRegistry.prototype.getRemainingAvailableRequests = function () {
|
|
345
|
+
return this.remainingAvailableRequests;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* get the total number of requests that the user can make in a day. Information is only accessible after you make some query.
|
|
349
|
+
*/
|
|
350
|
+
EventRegistry.prototype.getDailyAvailableRequests = function () {
|
|
351
|
+
return this.dailyAvailableRequests;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Return the headers returned in the response object of the last executed request
|
|
355
|
+
*/
|
|
356
|
+
EventRegistry.prototype.getLastHeaders = function () {
|
|
357
|
+
return this.headers;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Get a value of the header headerName that was set in the headers in the last response object
|
|
361
|
+
*/
|
|
362
|
+
EventRegistry.prototype.getLastHeader = function (headerName, dfltVal) {
|
|
363
|
+
var _a, _b;
|
|
364
|
+
return (_b = (_a = this.headers) === null || _a === void 0 ? void 0 : _a[headerName]) !== null && _b !== void 0 ? _b : dfltVal;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* print some statistics about the last executed request
|
|
368
|
+
*/
|
|
369
|
+
EventRegistry.prototype.printLastReqStats = function () {
|
|
370
|
+
this.logger.info("Tokens used by the request: ".concat(this.getLastHeader("req-tokens")));
|
|
371
|
+
this.logger.info("Performed action: ".concat(this.getLastHeader("req-action")));
|
|
372
|
+
this.logger.info("Was archive used for the query: ".concat(this.getLastReqArchiveUse() ? "Yes" : "No"));
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* return true or false depending on whether the last request used the archive or not
|
|
376
|
+
*/
|
|
377
|
+
EventRegistry.prototype.getLastReqArchiveUse = function () {
|
|
378
|
+
return this.getLastHeader("req-archive", "0") === "1";
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* Return the number of used and total available tokens. Can be used at any time (also before making queries)
|
|
382
|
+
*/
|
|
383
|
+
EventRegistry.prototype.getUsageInfo = function () {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
385
|
+
var request;
|
|
386
|
+
return __generator(this, function (_a) {
|
|
387
|
+
switch (_a.label) {
|
|
388
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/usage")];
|
|
389
|
+
case 1:
|
|
390
|
+
request = _a.sent();
|
|
391
|
+
return [2 /*return*/, request.data];
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
EventRegistry.prototype.getServiceStatus = function () {
|
|
397
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
398
|
+
var request;
|
|
399
|
+
return __generator(this, function (_a) {
|
|
400
|
+
switch (_a.label) {
|
|
401
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/getServiceStatus")];
|
|
402
|
+
case 1:
|
|
403
|
+
request = _a.sent();
|
|
404
|
+
return [2 /*return*/, request.data];
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
EventRegistry.prototype.getUrl = function (query) {
|
|
410
|
+
var _a;
|
|
411
|
+
if (!(query instanceof base_1.QueryParamsBase)) {
|
|
412
|
+
if (this.config.verboseOutput) {
|
|
413
|
+
this.logger.warn("query parameter should be an instance of a class that has Query as a base class, such as QueryArticles or QueryEvents");
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
var allParams = query.getQueryParams();
|
|
417
|
+
return "".concat((_a = this.config) === null || _a === void 0 ? void 0 : _a.host).concat(query === null || query === void 0 ? void 0 : query.path, "?").concat(Object.keys(allParams).map(function (key) { return "".concat(key, "=").concat(allParams[key]); }).join("&"));
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Return a list of concepts that contain the given prefix.
|
|
421
|
+
* Returned matching concepts are sorted based on their frequency of occurrence in news (from most to least frequent)
|
|
422
|
+
* @param prefix input text that should be contained in the concept
|
|
423
|
+
* @param args Object which contains a host of optional parameters
|
|
424
|
+
*/
|
|
425
|
+
EventRegistry.prototype.suggestConcepts = function (prefix_1) {
|
|
426
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
427
|
+
var _a, sources, _b, lang, _c, conceptLang, _d, page, _e, count, _f, returnInfo, otherParams, params, request;
|
|
428
|
+
if (args === void 0) { args = {}; }
|
|
429
|
+
return __generator(this, function (_g) {
|
|
430
|
+
switch (_g.label) {
|
|
431
|
+
case 0:
|
|
432
|
+
_a = args.sources, sources = _a === void 0 ? ["concepts"] : _a, _b = args.lang, lang = _b === void 0 ? "eng" : _b, _c = args.conceptLang, conceptLang = _c === void 0 ? "eng" : _c, _d = args.page, page = _d === void 0 ? 1 : _d, _e = args.count, count = _e === void 0 ? 20 : _e, _f = args.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, otherParams = __rest(args, ["sources", "lang", "conceptLang", "page", "count", "returnInfo"]);
|
|
433
|
+
if (page <= 0) {
|
|
434
|
+
throw new RangeError("page parameter should be above 0");
|
|
435
|
+
}
|
|
436
|
+
params = {
|
|
437
|
+
prefix: prefix,
|
|
438
|
+
source: sources,
|
|
439
|
+
lang: lang,
|
|
440
|
+
conceptLang: conceptLang,
|
|
441
|
+
page: page,
|
|
442
|
+
count: count,
|
|
443
|
+
};
|
|
444
|
+
params = __assign(__assign(__assign({}, params), otherParams), returnInfo.getParams());
|
|
445
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestConceptsFast", params)];
|
|
446
|
+
case 1:
|
|
447
|
+
request = _g.sent();
|
|
448
|
+
return [2 /*return*/, request.data];
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Return a list of dmoz categories that contain the prefix
|
|
455
|
+
* @param prefix input text that should be contained in the category name
|
|
456
|
+
* @param args Object which contains a host of optional parameters
|
|
457
|
+
*/
|
|
458
|
+
EventRegistry.prototype.suggestCategories = function (prefix_1) {
|
|
459
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
460
|
+
var _a, page, _b, count, _c, returnInfo, otherParams, params, request;
|
|
461
|
+
if (args === void 0) { args = {}; }
|
|
462
|
+
return __generator(this, function (_d) {
|
|
463
|
+
switch (_d.label) {
|
|
464
|
+
case 0:
|
|
465
|
+
_a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, _c = args.returnInfo, returnInfo = _c === void 0 ? new returnInfo_1.ReturnInfo() : _c, otherParams = __rest(args, ["page", "count", "returnInfo"]);
|
|
466
|
+
if (page <= 0) {
|
|
467
|
+
throw new RangeError("page parameter should be above 0");
|
|
468
|
+
}
|
|
469
|
+
params = { prefix: prefix, page: page, count: count };
|
|
470
|
+
params = __assign(__assign(__assign({}, params), otherParams), returnInfo.getParams());
|
|
471
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestCategoriesFast", params)];
|
|
472
|
+
case 1:
|
|
473
|
+
request = _d.sent();
|
|
474
|
+
return [2 /*return*/, request.data];
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* Return a list of news sources that match the prefix
|
|
481
|
+
* @param prefix input text that should be contained in the source name or uri
|
|
482
|
+
* @param args Object which contains a host of optional parameters
|
|
483
|
+
*/
|
|
484
|
+
EventRegistry.prototype.suggestNewsSources = function (prefix_1) {
|
|
485
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
486
|
+
var _a, page, _b, count, _c, dataType, otherParams, request;
|
|
487
|
+
if (args === void 0) { args = {}; }
|
|
488
|
+
return __generator(this, function (_d) {
|
|
489
|
+
switch (_d.label) {
|
|
490
|
+
case 0:
|
|
491
|
+
_a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, _c = args.dataType, dataType = _c === void 0 ? ["news", "pr", "blog"] : _c, otherParams = __rest(args, ["page", "count", "dataType"]);
|
|
492
|
+
if (page <= 0) {
|
|
493
|
+
throw new RangeError("page parameter should be above 0");
|
|
494
|
+
}
|
|
495
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestSourcesFast", __assign({ prefix: prefix, page: page, dataType: dataType, count: count }, otherParams))];
|
|
496
|
+
case 1:
|
|
497
|
+
request = _d.sent();
|
|
498
|
+
return [2 /*return*/, request.data];
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* Return a list of news source groups that match the prefix
|
|
505
|
+
* @param prefix input text that should be contained in the source group name or uri
|
|
506
|
+
* @param args Object which contains a host of optional parameters
|
|
507
|
+
*/
|
|
508
|
+
EventRegistry.prototype.suggestSourceGroups = function (prefix_1) {
|
|
509
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
510
|
+
var _a, page, _b, count, otherParams, request;
|
|
511
|
+
if (args === void 0) { args = {}; }
|
|
512
|
+
return __generator(this, function (_c) {
|
|
513
|
+
switch (_c.label) {
|
|
514
|
+
case 0:
|
|
515
|
+
_a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, otherParams = __rest(args, ["page", "count"]);
|
|
516
|
+
if (page <= 0) {
|
|
517
|
+
throw new RangeError("page parameter should be above 0");
|
|
518
|
+
}
|
|
519
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestSourceGroups", __assign({ prefix: prefix, page: page, count: count }, otherParams))];
|
|
520
|
+
case 1:
|
|
521
|
+
request = _c.sent();
|
|
522
|
+
return [2 /*return*/, request.data];
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Return a list of geo locations (cities or countries) that contain the prefix
|
|
529
|
+
* @param prefix input text that should be contained in the location name
|
|
530
|
+
* @param args Object which contains a host of optional parameters
|
|
531
|
+
*/
|
|
532
|
+
EventRegistry.prototype.suggestLocations = function (prefix_1) {
|
|
533
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
534
|
+
var _a, sources, _b, lang, _c, count, _d, countryUri, sortByDistanceTo, _e, returnInfo, otherParams, params, request;
|
|
535
|
+
if (args === void 0) { args = {}; }
|
|
536
|
+
return __generator(this, function (_f) {
|
|
537
|
+
switch (_f.label) {
|
|
538
|
+
case 0:
|
|
539
|
+
_a = args.sources, sources = _a === void 0 ? ["place", "country"] : _a, _b = args.lang, lang = _b === void 0 ? "eng" : _b, _c = args.count, count = _c === void 0 ? 20 : _c, _d = args.countryUri, countryUri = _d === void 0 ? "" : _d, sortByDistanceTo = args.sortByDistanceTo, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo() : _e, otherParams = __rest(args, ["sources", "lang", "count", "countryUri", "sortByDistanceTo", "returnInfo"]);
|
|
540
|
+
params = {
|
|
541
|
+
prefix: prefix,
|
|
542
|
+
count: count,
|
|
543
|
+
source: sources,
|
|
544
|
+
lang: lang,
|
|
545
|
+
countryUri: countryUri,
|
|
546
|
+
};
|
|
547
|
+
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
|
|
548
|
+
if (sortByDistanceTo) {
|
|
549
|
+
if (!Array.isArray(sortByDistanceTo)) {
|
|
550
|
+
throw new Error("sortByDistanceTo has to contain a tuple with latitude and longitude of the location");
|
|
551
|
+
}
|
|
552
|
+
if (sortByDistanceTo.length !== 2) {
|
|
553
|
+
throw new Error("The sortByDistanceTo should contain two numbers");
|
|
554
|
+
}
|
|
555
|
+
params["closeToLat"] = sortByDistanceTo[0];
|
|
556
|
+
params["closeToLon"] = sortByDistanceTo[1];
|
|
557
|
+
}
|
|
558
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestLocationsFast", params)];
|
|
559
|
+
case 1:
|
|
560
|
+
request = _f.sent();
|
|
561
|
+
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Return a list of geo locations (cities or places) that are close to the provided (lat, long) values
|
|
568
|
+
* @param latitude latitude part of the coordinate
|
|
569
|
+
* @param longitude longitude part of the coordinate
|
|
570
|
+
* @param radiusKm radius in kilometers around the coordinates inside which the locations should be returned
|
|
571
|
+
* @param args Object which contains a host of optional parameters
|
|
572
|
+
*/
|
|
573
|
+
EventRegistry.prototype.suggestLocationsAtCoordinate = function (latitude_1, longitude_1, radiusKm_1) {
|
|
574
|
+
return __awaiter(this, arguments, void 0, function (latitude, longitude, radiusKm, args) {
|
|
575
|
+
var _a, limitToCities, _b, lang, _c, count, _d, ignoreNonWiki, _e, returnInfo, otherParams, params, request;
|
|
576
|
+
if (args === void 0) { args = {}; }
|
|
577
|
+
return __generator(this, function (_f) {
|
|
578
|
+
switch (_f.label) {
|
|
579
|
+
case 0:
|
|
580
|
+
_a = args.limitToCities, limitToCities = _a === void 0 ? false : _a, _b = args.lang, lang = _b === void 0 ? "eng" : _b, _c = args.count, count = _c === void 0 ? 20 : _c, _d = args.ignoreNonWiki, ignoreNonWiki = _d === void 0 ? true : _d, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo() : _e, otherParams = __rest(args, ["limitToCities", "lang", "count", "ignoreNonWiki", "returnInfo"]);
|
|
581
|
+
if (typeof latitude !== "number") {
|
|
582
|
+
throw new Error("The 'latitude' should be a number");
|
|
583
|
+
}
|
|
584
|
+
if (typeof longitude !== "number") {
|
|
585
|
+
throw new Error("The 'longitude' should be a number");
|
|
586
|
+
}
|
|
587
|
+
params = {
|
|
588
|
+
action: "getLocationsAtCoordinate",
|
|
589
|
+
lat: latitude,
|
|
590
|
+
lon: longitude,
|
|
591
|
+
radius: radiusKm,
|
|
592
|
+
limitToCities: limitToCities,
|
|
593
|
+
count: count,
|
|
594
|
+
lang: lang,
|
|
595
|
+
};
|
|
596
|
+
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
|
|
597
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestLocationsFast", params)];
|
|
598
|
+
case 1:
|
|
599
|
+
request = _f.sent();
|
|
600
|
+
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* Return a list of news sources that are close to the provided (lat, long) values
|
|
607
|
+
* @param latitude latitude part of the coordinate
|
|
608
|
+
* @param longitude longitude part of the coordinate
|
|
609
|
+
* @param radiusKm radius in kilometers around the coordinates inside which the news sources should be located
|
|
610
|
+
* @param count number of returned suggestions
|
|
611
|
+
*/
|
|
612
|
+
EventRegistry.prototype.suggestSourcesAtCoordinate = function (latitude_1, longitude_1, radiusKm_1) {
|
|
613
|
+
return __awaiter(this, arguments, void 0, function (latitude, longitude, radiusKm, count) {
|
|
614
|
+
var _i, params, request;
|
|
615
|
+
if (count === void 0) { count = 20; }
|
|
616
|
+
var otherParams = [];
|
|
617
|
+
for (_i = 4; _i < arguments.length; _i++) {
|
|
618
|
+
otherParams[_i - 4] = arguments[_i];
|
|
619
|
+
}
|
|
620
|
+
return __generator(this, function (_a) {
|
|
621
|
+
switch (_a.label) {
|
|
622
|
+
case 0:
|
|
623
|
+
if (typeof latitude !== "number") {
|
|
624
|
+
throw new Error("The 'latitude' should be a number");
|
|
625
|
+
}
|
|
626
|
+
if (typeof longitude !== "number") {
|
|
627
|
+
throw new Error("The 'longitude' should be a number");
|
|
628
|
+
}
|
|
629
|
+
params = __assign({ action: "getSourcesAtCoordinate", lat: latitude, lon: longitude, radius: radiusKm, count: count }, otherParams);
|
|
630
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestSourcesFast", params)];
|
|
631
|
+
case 1:
|
|
632
|
+
request = _a.sent();
|
|
633
|
+
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Return a list of news sources that are close to the provided (lat, long) values
|
|
640
|
+
* @param conceptUri concept that represents a geographic location for which we would like to obtain a list of sources located at the place
|
|
641
|
+
* @param args Object which contains a host of optional parameters
|
|
642
|
+
*/
|
|
643
|
+
EventRegistry.prototype.suggestSourcesAtPlace = function (conceptUri_1) {
|
|
644
|
+
return __awaiter(this, arguments, void 0, function (conceptUri, args) {
|
|
645
|
+
var _a, page, _b, count, _c, dataType, otherParams, params, request;
|
|
646
|
+
if (args === void 0) { args = {}; }
|
|
647
|
+
return __generator(this, function (_d) {
|
|
648
|
+
switch (_d.label) {
|
|
649
|
+
case 0:
|
|
650
|
+
_a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, _c = args.dataType, dataType = _c === void 0 ? "news" : _c, otherParams = __rest(args, ["page", "count", "dataType"]);
|
|
651
|
+
params = __assign({ action: "getSourcesAtPlace", conceptUri: conceptUri, page: page, count: count, dataType: dataType }, otherParams);
|
|
652
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestSourcesFast", params)];
|
|
653
|
+
case 1:
|
|
654
|
+
request = _d.sent();
|
|
655
|
+
return [2 /*return*/, request.data];
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
};
|
|
660
|
+
/**
|
|
661
|
+
* Return a list of news sources that match the prefix
|
|
662
|
+
* @param prefix: input text that should be contained in the author name and source url
|
|
663
|
+
* @param page: page of results
|
|
664
|
+
* @param count: number of returned suggestions
|
|
665
|
+
*/
|
|
666
|
+
EventRegistry.prototype.suggestAuthors = function (prefix_1) {
|
|
667
|
+
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
|
|
668
|
+
var _i, params, request;
|
|
669
|
+
if (page === void 0) { page = 1; }
|
|
670
|
+
if (count === void 0) { count = 20; }
|
|
671
|
+
var otherParams = [];
|
|
672
|
+
for (_i = 3; _i < arguments.length; _i++) {
|
|
673
|
+
otherParams[_i - 3] = arguments[_i];
|
|
674
|
+
}
|
|
675
|
+
return __generator(this, function (_a) {
|
|
676
|
+
switch (_a.label) {
|
|
677
|
+
case 0:
|
|
678
|
+
if (page <= 0) {
|
|
679
|
+
throw new Error("Page parameter should be above 0.");
|
|
680
|
+
}
|
|
681
|
+
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
|
|
682
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestAuthorsFast", params)];
|
|
683
|
+
case 1:
|
|
684
|
+
request = _a.sent();
|
|
685
|
+
return [2 /*return*/, request.data];
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Return a list of event types that match the prefix
|
|
692
|
+
* @param prefix: input text that should be contained in the industry name
|
|
693
|
+
* @param page: page of results
|
|
694
|
+
* @param count: number of returned suggestions
|
|
695
|
+
*/
|
|
696
|
+
EventRegistry.prototype.suggestEventTypes = function (prefix_1) {
|
|
697
|
+
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
|
|
698
|
+
var _i, params, request;
|
|
699
|
+
if (page === void 0) { page = 1; }
|
|
700
|
+
if (count === void 0) { count = 20; }
|
|
701
|
+
var otherParams = [];
|
|
702
|
+
for (_i = 3; _i < arguments.length; _i++) {
|
|
703
|
+
otherParams[_i - 3] = arguments[_i];
|
|
704
|
+
}
|
|
705
|
+
return __generator(this, function (_a) {
|
|
706
|
+
switch (_a.label) {
|
|
707
|
+
case 0:
|
|
708
|
+
if (page <= 0) {
|
|
709
|
+
throw new Error("Page parameter should be above 0.");
|
|
710
|
+
}
|
|
711
|
+
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
|
|
712
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/suggestEventTypes", params)];
|
|
713
|
+
case 1:
|
|
714
|
+
request = _a.sent();
|
|
715
|
+
return [2 /*return*/, request.data];
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Return a list of industries that match the prefix. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
|
|
722
|
+
* @param prefix: input text that should be contained in the industry name
|
|
723
|
+
* @param page: page of results
|
|
724
|
+
* @param count: number of returned suggestions
|
|
725
|
+
*/
|
|
726
|
+
EventRegistry.prototype.suggestIndustries = function (prefix_1) {
|
|
727
|
+
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
|
|
728
|
+
var _i, params, request;
|
|
729
|
+
if (page === void 0) { page = 1; }
|
|
730
|
+
if (count === void 0) { count = 20; }
|
|
731
|
+
var otherParams = [];
|
|
732
|
+
for (_i = 3; _i < arguments.length; _i++) {
|
|
733
|
+
otherParams[_i - 3] = arguments[_i];
|
|
734
|
+
}
|
|
735
|
+
return __generator(this, function (_a) {
|
|
736
|
+
switch (_a.label) {
|
|
737
|
+
case 0:
|
|
738
|
+
if (page <= 0) {
|
|
739
|
+
throw new Error("Page parameter should be above 0.");
|
|
740
|
+
}
|
|
741
|
+
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
|
|
742
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/suggestIndustries", params)];
|
|
743
|
+
case 1:
|
|
744
|
+
request = _a.sent();
|
|
745
|
+
return [2 /*return*/, request.data];
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Return a list of SDG uris. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
|
|
752
|
+
*/
|
|
753
|
+
EventRegistry.prototype.getSdgUris = function () {
|
|
754
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
755
|
+
var request;
|
|
756
|
+
return __generator(this, function (_a) {
|
|
757
|
+
switch (_a.label) {
|
|
758
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/sdg/getItems")];
|
|
759
|
+
case 1:
|
|
760
|
+
request = _a.sent();
|
|
761
|
+
return [2 /*return*/, request.data];
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Return a list of SASB uris. Note: SASB uris can only be used when querying mentions (QueryMentions, QueryMentionsIter)
|
|
768
|
+
*/
|
|
769
|
+
EventRegistry.prototype.getSasbUris = function () {
|
|
770
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
771
|
+
var request;
|
|
772
|
+
return __generator(this, function (_a) {
|
|
773
|
+
switch (_a.label) {
|
|
774
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/sasb/getItems")];
|
|
775
|
+
case 1:
|
|
776
|
+
request = _a.sent();
|
|
777
|
+
return [2 /*return*/, request.data];
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
/**
|
|
783
|
+
* Return a list of concept classes that match the given prefix
|
|
784
|
+
* @param prefix input text that should be contained in the category name
|
|
785
|
+
* @param args Object which contains a host of optional parameters
|
|
786
|
+
*/
|
|
787
|
+
EventRegistry.prototype.suggestConceptClasses = function (prefix_1) {
|
|
788
|
+
return __awaiter(this, arguments, void 0, function (prefix, args) {
|
|
789
|
+
var _a, lang, _b, conceptLang, _c, source, _d, page, _e, count, _f, returnInfo, otherParams, params, request;
|
|
790
|
+
if (args === void 0) { args = {}; }
|
|
791
|
+
return __generator(this, function (_g) {
|
|
792
|
+
switch (_g.label) {
|
|
793
|
+
case 0:
|
|
794
|
+
_a = args.lang, lang = _a === void 0 ? "eng" : _a, _b = args.conceptLang, conceptLang = _b === void 0 ? "eng" : _b, _c = args.source, source = _c === void 0 ? ["dbpedia", "custom"] : _c, _d = args.page, page = _d === void 0 ? 1 : _d, _e = args.count, count = _e === void 0 ? 20 : _e, _f = args.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, otherParams = __rest(args, ["lang", "conceptLang", "source", "page", "count", "returnInfo"]);
|
|
795
|
+
if (page < 1) {
|
|
796
|
+
throw new Error("page parameter should be above 0");
|
|
797
|
+
}
|
|
798
|
+
params = { prefix: prefix, lang: lang, conceptLang: conceptLang, source: source, page: page, count: count };
|
|
799
|
+
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
|
|
800
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestConceptClasses", params)];
|
|
801
|
+
case 1:
|
|
802
|
+
request = _g.sent();
|
|
803
|
+
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* return a concept uri that is the best match for the given concept label
|
|
810
|
+
* if there are multiple matches for the given conceptLabel,
|
|
811
|
+
* they are sorted based on their frequency of occurrence in news (most to least frequent)
|
|
812
|
+
* @param conceptLabel partial or full name of the concept for which to return the concept uri
|
|
813
|
+
* @param args Object which contains a host of optional parameters
|
|
814
|
+
*/
|
|
815
|
+
EventRegistry.prototype.getConceptUri = function (conceptLabel_1) {
|
|
816
|
+
return __awaiter(this, arguments, void 0, function (conceptLabel, args) {
|
|
817
|
+
var _a, lang, _b, sources, matches;
|
|
818
|
+
var _c;
|
|
819
|
+
if (args === void 0) { args = {}; }
|
|
820
|
+
return __generator(this, function (_d) {
|
|
821
|
+
switch (_d.label) {
|
|
822
|
+
case 0:
|
|
823
|
+
_a = args.lang, lang = _a === void 0 ? "eng" : _a, _b = args.sources, sources = _b === void 0 ? ["concepts"] : _b;
|
|
824
|
+
return [4 /*yield*/, this.suggestConcepts(conceptLabel, { lang: lang, sources: sources })];
|
|
825
|
+
case 1:
|
|
826
|
+
matches = _d.sent();
|
|
827
|
+
return [2 /*return*/, (_c = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _c === void 0 ? void 0 : _c.uri];
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
});
|
|
831
|
+
};
|
|
832
|
+
/**
|
|
833
|
+
* Return a location uri that is the best match for the given location label
|
|
834
|
+
* @param locationLabel partial or full location name for which to return the location uri
|
|
835
|
+
* @param args Object which contains a host of optional parameters
|
|
836
|
+
*/
|
|
837
|
+
EventRegistry.prototype.getLocationUri = function (locationLabel_1) {
|
|
838
|
+
return __awaiter(this, arguments, void 0, function (locationLabel, args) {
|
|
839
|
+
var _a, lang, _b, sources, countryUri, sortByDistanceTo, matches;
|
|
840
|
+
var _c;
|
|
841
|
+
if (args === void 0) { args = {}; }
|
|
842
|
+
return __generator(this, function (_d) {
|
|
843
|
+
switch (_d.label) {
|
|
844
|
+
case 0:
|
|
845
|
+
_a = args.lang, lang = _a === void 0 ? "eng" : _a, _b = args.sources, sources = _b === void 0 ? ["place", "country"] : _b, countryUri = args.countryUri, sortByDistanceTo = args.sortByDistanceTo;
|
|
846
|
+
return [4 /*yield*/, this.suggestLocations(locationLabel, { lang: lang, sources: sources, countryUri: countryUri, sortByDistanceTo: sortByDistanceTo })];
|
|
847
|
+
case 1:
|
|
848
|
+
matches = _d.sent();
|
|
849
|
+
return [2 /*return*/, (_c = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _c === void 0 ? void 0 : _c.wikiUri];
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
};
|
|
854
|
+
/**
|
|
855
|
+
* Return a category uri that is the best match for the given label
|
|
856
|
+
* @param categoryLabel partial or full name of the category for which to return category uri
|
|
857
|
+
*/
|
|
858
|
+
EventRegistry.prototype.getCategoryUri = function (categoryLabel) {
|
|
859
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
860
|
+
var matches;
|
|
861
|
+
var _a;
|
|
862
|
+
return __generator(this, function (_b) {
|
|
863
|
+
switch (_b.label) {
|
|
864
|
+
case 0: return [4 /*yield*/, this.suggestCategories(categoryLabel)];
|
|
865
|
+
case 1:
|
|
866
|
+
matches = _b.sent();
|
|
867
|
+
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
};
|
|
872
|
+
/**
|
|
873
|
+
* Return the news source that best matches the source name
|
|
874
|
+
* @param sourceName partial or full name of the source or source uri for which to return source uri
|
|
875
|
+
* @param dataType: return the source uri that provides content of these data types
|
|
876
|
+
*/
|
|
877
|
+
EventRegistry.prototype.getNewsSourceUri = function (sourceName_1) {
|
|
878
|
+
return __awaiter(this, arguments, void 0, function (sourceName, dataType) {
|
|
879
|
+
var matches;
|
|
880
|
+
var _a;
|
|
881
|
+
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
|
|
882
|
+
return __generator(this, function (_b) {
|
|
883
|
+
switch (_b.label) {
|
|
884
|
+
case 0: return [4 /*yield*/, this.suggestNewsSources(sourceName, { dataType: dataType })];
|
|
885
|
+
case 1:
|
|
886
|
+
matches = _b.sent();
|
|
887
|
+
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* alternative (shorter) name for the method getNewsSourceUri()
|
|
894
|
+
*/
|
|
895
|
+
EventRegistry.prototype.getSourceUri = function (sourceName_1) {
|
|
896
|
+
return __awaiter(this, arguments, void 0, function (sourceName, dataType) {
|
|
897
|
+
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
|
|
898
|
+
return __generator(this, function (_a) {
|
|
899
|
+
switch (_a.label) {
|
|
900
|
+
case 0: return [4 /*yield*/, this.getNewsSourceUri(sourceName, dataType)];
|
|
901
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
};
|
|
906
|
+
/**
|
|
907
|
+
* Return the URI of the source group that best matches the name
|
|
908
|
+
* @param sourceGroupName partial or full name of the source group
|
|
909
|
+
*/
|
|
910
|
+
EventRegistry.prototype.getSourceGroupUri = function (sourceGroupName) {
|
|
911
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
912
|
+
var matches;
|
|
913
|
+
var _a;
|
|
914
|
+
return __generator(this, function (_b) {
|
|
915
|
+
switch (_b.label) {
|
|
916
|
+
case 0: return [4 /*yield*/, this.suggestSourceGroups(sourceGroupName)];
|
|
917
|
+
case 1:
|
|
918
|
+
matches = _b.sent();
|
|
919
|
+
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* Return a uri of the concept class that is the best match for the given label
|
|
926
|
+
* @param classLabel partial or full name of the concept class for which to return class uri
|
|
927
|
+
* @param lang language in which the class label is specified
|
|
928
|
+
*/
|
|
929
|
+
EventRegistry.prototype.getConceptClassUri = function (classLabel_1) {
|
|
930
|
+
return __awaiter(this, arguments, void 0, function (classLabel, lang) {
|
|
931
|
+
var matches;
|
|
932
|
+
var _a;
|
|
933
|
+
if (lang === void 0) { lang = "eng"; }
|
|
934
|
+
return __generator(this, function (_b) {
|
|
935
|
+
switch (_b.label) {
|
|
936
|
+
case 0: return [4 /*yield*/, this.suggestConceptClasses(classLabel, { lang: lang })];
|
|
937
|
+
case 1:
|
|
938
|
+
matches = _b.sent();
|
|
939
|
+
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
});
|
|
943
|
+
};
|
|
944
|
+
/**
|
|
945
|
+
* Return detailed information about a particular concept
|
|
946
|
+
* @param conceptUri uri of the concept
|
|
947
|
+
* @param returnInfo what details about the concept should be included in the returned information
|
|
948
|
+
*/
|
|
949
|
+
EventRegistry.prototype.getConceptInfo = function (conceptUri, returnInfo) {
|
|
950
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
951
|
+
var conceptInfo, params, request;
|
|
952
|
+
var _a;
|
|
953
|
+
return __generator(this, function (_b) {
|
|
954
|
+
switch (_b.label) {
|
|
955
|
+
case 0:
|
|
956
|
+
if (!returnInfo) {
|
|
957
|
+
conceptInfo = new returnInfo_1.ConceptInfoFlags({ synonyms: true, image: true, description: true });
|
|
958
|
+
returnInfo = new returnInfo_1.ReturnInfo({ conceptInfo: conceptInfo });
|
|
959
|
+
}
|
|
960
|
+
params = {
|
|
961
|
+
uri: conceptUri,
|
|
962
|
+
action: "getInfo",
|
|
963
|
+
};
|
|
964
|
+
params = __assign(__assign({}, params), ((_a = returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams()) !== null && _a !== void 0 ? _a : {}));
|
|
965
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/concept/getInfo", params)];
|
|
966
|
+
case 1:
|
|
967
|
+
request = _b.sent();
|
|
968
|
+
return [2 /*return*/, request.data];
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
});
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* return author uri that is the best match for the given author name (and potentially source url)
|
|
975
|
+
* if there are multiple matches for the given author name, they are sorted based on the number of articles they have written (from most to least frequent)
|
|
976
|
+
* @param authorName: partial or full name of the author, potentially also containing the source url (e.g. "george brown nytimes")
|
|
977
|
+
*/
|
|
978
|
+
EventRegistry.prototype.getAuthorUri = function (authorName) {
|
|
979
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
980
|
+
var matches;
|
|
981
|
+
var _a;
|
|
982
|
+
return __generator(this, function (_b) {
|
|
983
|
+
switch (_b.label) {
|
|
984
|
+
case 0: return [4 /*yield*/, this.suggestAuthors(authorName)];
|
|
985
|
+
case 1:
|
|
986
|
+
matches = _b.sent();
|
|
987
|
+
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
});
|
|
991
|
+
};
|
|
992
|
+
EventRegistry.getUriFromUriWgt = function (uriWgtList) {
|
|
993
|
+
if (!Array.isArray(uriWgtList)) {
|
|
994
|
+
throw new Error("uriWgtList has to be a list of strings that represent article uris");
|
|
995
|
+
}
|
|
996
|
+
return uriWgtList.map(function (uriWgt) { return uriWgt.split(":")[0]; });
|
|
997
|
+
};
|
|
998
|
+
// Additional utility functions
|
|
999
|
+
/**
|
|
1000
|
+
* If you have article urls and you want to query them in ER you first have to obtain their uris in the ER.
|
|
1001
|
+
* @param articleUrls a single article url or a list of article urls
|
|
1002
|
+
*/
|
|
1003
|
+
EventRegistry.prototype.getArticleUris = function (articleUrls) {
|
|
1004
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1005
|
+
var request;
|
|
1006
|
+
return __generator(this, function (_a) {
|
|
1007
|
+
switch (_a.label) {
|
|
1008
|
+
case 0:
|
|
1009
|
+
if (!Array.isArray(articleUrls) && typeof articleUrls !== "string") {
|
|
1010
|
+
throw new Error("Expected a single article url or a list of urls");
|
|
1011
|
+
}
|
|
1012
|
+
return [4 /*yield*/, this.jsonRequest("/api/v1/articleMapper", { articleUrl: articleUrls })];
|
|
1013
|
+
case 1:
|
|
1014
|
+
request = _a.sent();
|
|
1015
|
+
return [2 /*return*/, request.data];
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
/**
|
|
1021
|
+
* Return information about the latest imported article
|
|
1022
|
+
*/
|
|
1023
|
+
EventRegistry.prototype.getSourceGroups = function () {
|
|
1024
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1025
|
+
var request;
|
|
1026
|
+
return __generator(this, function (_a) {
|
|
1027
|
+
switch (_a.label) {
|
|
1028
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/sourceGroup/getSourceGroups", { action: "getSourceGroups" })];
|
|
1029
|
+
case 1:
|
|
1030
|
+
request = _a.sent();
|
|
1031
|
+
return [2 /*return*/, request.data];
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
});
|
|
1035
|
+
};
|
|
1036
|
+
/**
|
|
1037
|
+
* Return info about the source group
|
|
1038
|
+
*/
|
|
1039
|
+
EventRegistry.prototype.getSourceGroup = function (sourceGroupUri) {
|
|
1040
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1041
|
+
var request;
|
|
1042
|
+
return __generator(this, function (_a) {
|
|
1043
|
+
switch (_a.label) {
|
|
1044
|
+
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/sourceGroup/getSourceGroupInfo", { action: "getSourceGroupInfo", uri: sourceGroupUri })];
|
|
1045
|
+
case 1:
|
|
1046
|
+
request = _a.sent();
|
|
1047
|
+
return [2 /*return*/, request.data];
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
return EventRegistry;
|
|
1053
|
+
}());
|
|
1054
|
+
exports.EventRegistry = EventRegistry;
|
|
1055
|
+
/**
|
|
1056
|
+
* @class ArticleMapper
|
|
1057
|
+
* Create instance of article mapper it will map from article urls to article uris
|
|
1058
|
+
* the mappings can be remembered so it will not repeat requests for the same article urls
|
|
1059
|
+
*/
|
|
1060
|
+
var ArticleMapper = /** @class */ (function () {
|
|
1061
|
+
function ArticleMapper(er, rememberMapping) {
|
|
1062
|
+
if (rememberMapping === void 0) { rememberMapping = true; }
|
|
1063
|
+
this.articleUrlToUri = {};
|
|
1064
|
+
this.rememberMappings = true;
|
|
1065
|
+
this.er = er;
|
|
1066
|
+
this.rememberMappings = rememberMapping;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Given the article url, return an array with 0, 1 or more article uris.
|
|
1070
|
+
* Not all returned article uris are necessarily valid anymore.
|
|
1071
|
+
* For news sources of lower importance we remove the duplicated articles and just keep the latest content
|
|
1072
|
+
* @param articleUrl string containing the article url
|
|
1073
|
+
*/
|
|
1074
|
+
ArticleMapper.prototype.getArticleUri = function (articleUrl) {
|
|
1075
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1076
|
+
var response, value;
|
|
1077
|
+
var _a;
|
|
1078
|
+
return __generator(this, function (_b) {
|
|
1079
|
+
switch (_b.label) {
|
|
1080
|
+
case 0:
|
|
1081
|
+
if (this.articleUrlToUri.hasOwnProperty(articleUrl)) {
|
|
1082
|
+
return [2 /*return*/, this.articleUrlToUri[articleUrl]];
|
|
1083
|
+
}
|
|
1084
|
+
return [4 /*yield*/, this.er.getArticleUris(articleUrl)];
|
|
1085
|
+
case 1:
|
|
1086
|
+
response = _b.sent();
|
|
1087
|
+
value = response === null || response === void 0 ? void 0 : response[articleUrl];
|
|
1088
|
+
if (this.rememberMappings && value) {
|
|
1089
|
+
this.articleUrlToUri = __assign(__assign({}, this.articleUrlToUri), (_a = {}, _a[articleUrl] = value, _a));
|
|
1090
|
+
}
|
|
1091
|
+
return [2 /*return*/, value];
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
};
|
|
1096
|
+
return ArticleMapper;
|
|
1097
|
+
}());
|
|
1098
|
+
exports.ArticleMapper = ArticleMapper;
|
|
1019
1099
|
//# sourceMappingURL=eventRegistry.js.map
|