eventregistry 8.11.2 → 9.1.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.
- 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 +44 -0
- package/dist/logger.js +144 -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/queryEvent.js
CHANGED
|
@@ -1,570 +1,588 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
}
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
d
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
case
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (t
|
|
53
|
-
if (t[
|
|
54
|
-
_.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
if (
|
|
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
|
-
_this
|
|
150
|
-
_this.
|
|
151
|
-
_this.
|
|
152
|
-
_this.
|
|
153
|
-
_this.
|
|
154
|
-
_this.
|
|
155
|
-
_this.
|
|
156
|
-
_this.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_this.
|
|
161
|
-
_this.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
_this.
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
if (
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
if (
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
if (
|
|
185
|
-
_this.
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
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
|
-
this.returnedSoFar
|
|
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
|
-
var
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
_this.
|
|
386
|
-
_this.
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
_this.
|
|
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
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
_this.
|
|
464
|
-
_this
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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
|
-
_this.
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
if (
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
|
+
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;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
65
|
+
var t = {};
|
|
66
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
69
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
71
|
+
t[p[i]] = s[p[i]];
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
};
|
|
75
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
76
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
77
|
+
if (!m) return o;
|
|
78
|
+
var i = m.call(o), r, ar = [], e;
|
|
79
|
+
try {
|
|
80
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
81
|
+
}
|
|
82
|
+
catch (error) { e = { error: error }; }
|
|
83
|
+
finally {
|
|
84
|
+
try {
|
|
85
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
86
|
+
}
|
|
87
|
+
finally { if (e) throw e.error; }
|
|
88
|
+
}
|
|
89
|
+
return ar;
|
|
90
|
+
};
|
|
91
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
92
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
93
|
+
if (ar || !(i in from)) {
|
|
94
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
95
|
+
ar[i] = from[i];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
99
|
+
};
|
|
100
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
101
|
+
exports.RequestEventSimilarEvents = exports.RequestEventArticleTrend = exports.RequestEventDateMentionAggr = exports.RequestEventSourceAggr = exports.RequestEventKeywordAggr = exports.RequestEventArticleUriWgts = exports.RequestEventArticles = exports.RequestEventInfo = exports.RequestEvent = exports.QueryEventArticlesIter = exports.QueryEvent = void 0;
|
|
102
|
+
var base_1 = require("./base");
|
|
103
|
+
var returnInfo_1 = require("./returnInfo");
|
|
104
|
+
var logger_1 = require("./logger");
|
|
105
|
+
/**
|
|
106
|
+
* @class QueryEvent
|
|
107
|
+
* Class for obtaining available info for one or more events in the Event Registry
|
|
108
|
+
*/
|
|
109
|
+
var QueryEvent = /** @class */ (function (_super) {
|
|
110
|
+
__extends(QueryEvent, _super);
|
|
111
|
+
/**
|
|
112
|
+
* @param eventUriOrList A single event uri or a list of event uris (max 50)
|
|
113
|
+
* @param requestedResult The information to return as the result of the query. By default return the details of the event
|
|
114
|
+
*/
|
|
115
|
+
function QueryEvent(eventUriOrList, requestedResult) {
|
|
116
|
+
if (requestedResult === void 0) { requestedResult = new RequestEventInfo(); }
|
|
117
|
+
var _this = _super.call(this) || this;
|
|
118
|
+
_this.setVal("eventUri", eventUriOrList);
|
|
119
|
+
_this.setRequestedResult(requestedResult);
|
|
120
|
+
return _this;
|
|
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
|
+
QueryEvent.prototype.setRequestedResult = function (requestEvent) {
|
|
127
|
+
if (!(requestEvent instanceof RequestEvent)) {
|
|
128
|
+
throw Error("QueryEvent class can only accept result requests that are of type RequestEvent");
|
|
129
|
+
}
|
|
130
|
+
this.path = requestEvent.path;
|
|
131
|
+
this.resultTypeList = [requestEvent];
|
|
132
|
+
};
|
|
133
|
+
return QueryEvent;
|
|
134
|
+
}(base_1.Query));
|
|
135
|
+
exports.QueryEvent = QueryEvent;
|
|
136
|
+
/**
|
|
137
|
+
* @class QueryEventArticlesIter
|
|
138
|
+
* Class for iterating through all the articles in the event via callbacks
|
|
139
|
+
*/
|
|
140
|
+
var QueryEventArticlesIter = /** @class */ (function (_super) {
|
|
141
|
+
__extends(QueryEventArticlesIter, _super);
|
|
142
|
+
/**
|
|
143
|
+
* @param er instance of EventRegistry class. used to obtain the necessary data
|
|
144
|
+
* @param eventUri a single event for which we want to obtain the list of articles in it
|
|
145
|
+
* @param args Object which contains a host of optional parameters
|
|
146
|
+
*/
|
|
147
|
+
function QueryEventArticlesIter(er, eventUri, args) {
|
|
148
|
+
if (args === void 0) { args = {}; }
|
|
149
|
+
var _this = _super.call(this, eventUri) || this;
|
|
150
|
+
_this.page = 0;
|
|
151
|
+
_this.pages = 1;
|
|
152
|
+
_this.items = [];
|
|
153
|
+
_this.returnedSoFar = 0;
|
|
154
|
+
_this.index = 0;
|
|
155
|
+
_this.callback = function () { return undefined; };
|
|
156
|
+
_this.doneCallback = function () { return undefined; };
|
|
157
|
+
var _a = args.lang, lang = _a === void 0 ? undefined : _a, _b = args.sortBy, sortBy = _b === void 0 ? "cosSim" : _b, _c = args.sortByAsc, sortByAsc = _c === void 0 ? false : _c, _d = args.returnInfo, returnInfo = _d === void 0 ? undefined : _d, _e = args.maxItems, maxItems = _e === void 0 ? -1 : _e, _f = args.keywords, keywords = _f === void 0 ? undefined : _f, _g = args.conceptUri, conceptUri = _g === void 0 ? undefined : _g, _h = args.categoryUri, categoryUri = _h === void 0 ? undefined : _h, _j = args.sourceUri, sourceUri = _j === void 0 ? undefined : _j, _k = args.sourceLocationUri, sourceLocationUri = _k === void 0 ? undefined : _k, _l = args.sourceGroupUri, sourceGroupUri = _l === void 0 ? undefined : _l, _m = args.authorUri, authorUri = _m === void 0 ? undefined : _m, _o = args.locationUri, locationUri = _o === void 0 ? undefined : _o, _p = args.dateStart, dateStart = _p === void 0 ? undefined : _p, _q = args.dateEnd, dateEnd = _q === void 0 ? undefined : _q, _r = args.dateMentionStart, dateMentionStart = _r === void 0 ? undefined : _r, _s = args.dateMentionEnd, dateMentionEnd = _s === void 0 ? undefined : _s, _t = args.keywordsLoc, keywordsLoc = _t === void 0 ? "body" : _t, _u = args.keywordSearchMode, keywordSearchMode = _u === void 0 ? "phrase" : _u, // "simple", "exact", "phrase"]
|
|
158
|
+
_v = args.startSourceRankPercentile, // "simple", "exact", "phrase"]
|
|
159
|
+
startSourceRankPercentile = _v === void 0 ? 0 : _v, _w = args.endSourceRankPercentile, endSourceRankPercentile = _w === void 0 ? 100 : _w, _x = args.minSentiment, minSentiment = _x === void 0 ? -1 : _x, _y = args.maxSentiment, maxSentiment = _y === void 0 ? 1 : _y;
|
|
160
|
+
_this.er = er;
|
|
161
|
+
_this.sortBy = sortBy;
|
|
162
|
+
_this.sortByAsc = sortByAsc;
|
|
163
|
+
_this.returnInfo = returnInfo;
|
|
164
|
+
_this.maxItems = maxItems;
|
|
165
|
+
_this.eventUri = eventUri;
|
|
166
|
+
_this.setQueryArrVal(keywords, "keyword", "keywordOper", "and");
|
|
167
|
+
_this.setQueryArrVal(conceptUri, "conceptUri", "conceptOper", "and");
|
|
168
|
+
_this.setQueryArrVal(categoryUri, "categoryUri", "categoryOper", "or");
|
|
169
|
+
_this.setQueryArrVal(sourceUri, "sourceUri", "sourceOper", "or");
|
|
170
|
+
_this.setQueryArrVal(sourceLocationUri, "sourceLocationUri", undefined, "or");
|
|
171
|
+
_this.setQueryArrVal(sourceGroupUri, "sourceGroupUri", "sourceGroupOper", "or");
|
|
172
|
+
_this.setQueryArrVal(authorUri, "authorUri", "authorOper", "or");
|
|
173
|
+
_this.setQueryArrVal(locationUri, "locationUri", undefined, "or");
|
|
174
|
+
_this.setQueryArrVal(lang, "lang", undefined, "or");
|
|
175
|
+
if (dateStart !== undefined) {
|
|
176
|
+
_this.setDateVal("dateStart", dateStart);
|
|
177
|
+
}
|
|
178
|
+
if (dateEnd !== undefined) {
|
|
179
|
+
_this.setDateVal("dateEnd", dateEnd);
|
|
180
|
+
}
|
|
181
|
+
if (dateMentionStart !== undefined) {
|
|
182
|
+
_this.setDateVal("dateMentionStart", dateMentionStart);
|
|
183
|
+
}
|
|
184
|
+
if (dateMentionEnd !== undefined) {
|
|
185
|
+
_this.setDateVal("dateMentionEnd", dateMentionEnd);
|
|
186
|
+
}
|
|
187
|
+
_this.setValIfNotDefault("keywordLoc", keywordsLoc, "body");
|
|
188
|
+
_this.setValIfNotDefault("keywordSearchMode", keywordSearchMode, "phrase");
|
|
189
|
+
if (startSourceRankPercentile < 0 || startSourceRankPercentile % 10 !== 0 || startSourceRankPercentile > 100) {
|
|
190
|
+
throw new Error("StartSourceRankPercentile: Value should be in range 0-90 and divisible by 10.");
|
|
191
|
+
}
|
|
192
|
+
if (endSourceRankPercentile < 0 || endSourceRankPercentile % 10 !== 0 || endSourceRankPercentile > 100) {
|
|
193
|
+
throw new Error("EndSourceRankPercentile: Value should be in range 0-90 and divisible by 10.");
|
|
194
|
+
}
|
|
195
|
+
if (startSourceRankPercentile > endSourceRankPercentile) {
|
|
196
|
+
throw new Error("SourceRankPercentile: startSourceRankPercentile should be less than endSourceRankPercentile");
|
|
197
|
+
}
|
|
198
|
+
if (startSourceRankPercentile !== 0) {
|
|
199
|
+
_this.setVal("startSourceRankPercentile", startSourceRankPercentile);
|
|
200
|
+
}
|
|
201
|
+
if (endSourceRankPercentile !== 100) {
|
|
202
|
+
_this.setVal("endSourceRankPercentile", endSourceRankPercentile);
|
|
203
|
+
}
|
|
204
|
+
if (minSentiment > -1 && minSentiment <= 1) {
|
|
205
|
+
_this.setVal("minSentiment", minSentiment);
|
|
206
|
+
}
|
|
207
|
+
if (maxSentiment >= -1 && maxSentiment < 1) {
|
|
208
|
+
_this.setVal("maxSentiment", maxSentiment);
|
|
209
|
+
}
|
|
210
|
+
return _this;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Async Iterator function that returns the next item in the list of articles
|
|
214
|
+
*/
|
|
215
|
+
QueryEventArticlesIter.prototype[Symbol.asyncIterator] = function () {
|
|
216
|
+
var _this = this;
|
|
217
|
+
return {
|
|
218
|
+
next: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
219
|
+
var item;
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
switch (_a.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
if (!(this.index >= this.items.length)) return [3 /*break*/, 2];
|
|
224
|
+
return [4 /*yield*/, this.getNextBatch()];
|
|
225
|
+
case 1:
|
|
226
|
+
_a.sent();
|
|
227
|
+
_a.label = 2;
|
|
228
|
+
case 2:
|
|
229
|
+
item = this.items[this.index];
|
|
230
|
+
this.index++;
|
|
231
|
+
return [2 /*return*/, { value: item, done: !item }];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}); },
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
QueryEventArticlesIter.prototype.count = function () {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
+
var response;
|
|
240
|
+
var _a, _b, _c, _d;
|
|
241
|
+
return __generator(this, function (_e) {
|
|
242
|
+
switch (_e.label) {
|
|
243
|
+
case 0:
|
|
244
|
+
this.setRequestedResult(new RequestEventArticles(this.getQueryParams()));
|
|
245
|
+
return [4 /*yield*/, this.er.execQuery(this)];
|
|
246
|
+
case 1:
|
|
247
|
+
response = _e.sent();
|
|
248
|
+
if (!!(response === null || response === void 0 ? void 0 : response.error)) {
|
|
249
|
+
this.er.logger.error((_a = response === null || response === void 0 ? void 0 : response.error) !== null && _a !== void 0 ? _a : "Error while obtaining a list of articles");
|
|
250
|
+
}
|
|
251
|
+
return [2 /*return*/, (_d = (_c = (_b = response[this.eventUri]) === null || _b === void 0 ? void 0 : _b.articles) === null || _c === void 0 ? void 0 : _c.totalResults) !== null && _d !== void 0 ? _d : 0];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Execute query and fetch batches of articles of the specified size (articleBatchSize)
|
|
258
|
+
* @param callback callback function that'll be called every time we get a new batch of articles from the backend
|
|
259
|
+
* @param doneCallback callback function that'll be called when everything is complete
|
|
260
|
+
*/
|
|
261
|
+
QueryEventArticlesIter.prototype.execQuery = function (callback, doneCallback) {
|
|
262
|
+
if (callback) {
|
|
263
|
+
this.callback = callback;
|
|
264
|
+
}
|
|
265
|
+
if (doneCallback) {
|
|
266
|
+
this.doneCallback = doneCallback;
|
|
267
|
+
}
|
|
268
|
+
this.iterate();
|
|
269
|
+
};
|
|
270
|
+
QueryEventArticlesIter.prototype.iterate = function () {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
272
|
+
return __generator(this, function (_a) {
|
|
273
|
+
switch (_a.label) {
|
|
274
|
+
case 0:
|
|
275
|
+
if (!this.current) return [3 /*break*/, 1];
|
|
276
|
+
this.callback(this.current);
|
|
277
|
+
this.index += 1;
|
|
278
|
+
return [3 /*break*/, 3];
|
|
279
|
+
case 1: return [4 /*yield*/, this.getNextBatch()];
|
|
280
|
+
case 2:
|
|
281
|
+
if (!(_a.sent())) {
|
|
282
|
+
this.doneCallback(this.errorMessage);
|
|
283
|
+
return [2 /*return*/];
|
|
284
|
+
}
|
|
285
|
+
_a.label = 3;
|
|
286
|
+
case 3: return [2 /*return*/, this.iterate()];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Extract the results according to maxItems
|
|
293
|
+
* @param response response from the backend
|
|
294
|
+
*/
|
|
295
|
+
QueryEventArticlesIter.prototype.extractResults = function (response) {
|
|
296
|
+
var _a, _b;
|
|
297
|
+
var results = ((_b = (_a = response[this.eventUri]) === null || _a === void 0 ? void 0 : _a.articles) === null || _b === void 0 ? void 0 : _b.results) || [];
|
|
298
|
+
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : results.length;
|
|
299
|
+
var extractedResults = results.slice(0, extractedSize);
|
|
300
|
+
return extractedResults.filter(Boolean);
|
|
301
|
+
};
|
|
302
|
+
Object.defineProperty(QueryEventArticlesIter.prototype, "current", {
|
|
303
|
+
get: function () {
|
|
304
|
+
return this.items[this.index] || undefined;
|
|
305
|
+
},
|
|
306
|
+
enumerable: false,
|
|
307
|
+
configurable: true
|
|
308
|
+
});
|
|
309
|
+
QueryEventArticlesIter.prototype.getNextBatch = function () {
|
|
310
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
311
|
+
var response, error, results, error_1;
|
|
312
|
+
var _a, _b, _c, _d;
|
|
313
|
+
return __generator(this, function (_e) {
|
|
314
|
+
switch (_e.label) {
|
|
315
|
+
case 0:
|
|
316
|
+
_e.trys.push([0, 2, , 3]);
|
|
317
|
+
this.page += 1;
|
|
318
|
+
if (this.page > this.pages || (this.maxItems !== -1 && this.returnedSoFar >= this.maxItems)) {
|
|
319
|
+
return [2 /*return*/, false];
|
|
320
|
+
}
|
|
321
|
+
this.setRequestedResult(new RequestEventArticles(__assign({ page: this.page, sortBy: this.sortBy, sortByAsc: this.sortByAsc, returnInfo: this.returnInfo }, this.getQueryParams())));
|
|
322
|
+
if (this.er.verboseOutput) {
|
|
323
|
+
this.er.logger.info("Downloading page ".concat(this.page, "..."));
|
|
324
|
+
}
|
|
325
|
+
return [4 /*yield*/, this.er.execQuery(this, this.er.allowUseOfArchive)];
|
|
326
|
+
case 1:
|
|
327
|
+
response = _e.sent();
|
|
328
|
+
error = ((_a = response[this.eventUri]) === null || _a === void 0 ? void 0 : _a.error) || "";
|
|
329
|
+
if (error) {
|
|
330
|
+
this.errorMessage = "Error while obtaining a list of articles: ".concat((_b = response[this.eventUri]) === null || _b === void 0 ? void 0 : _b.error);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
this.pages = ((_d = (_c = response[this.eventUri]) === null || _c === void 0 ? void 0 : _c.articles) === null || _d === void 0 ? void 0 : _d.pages) || 0;
|
|
334
|
+
}
|
|
335
|
+
results = this.extractResults(response);
|
|
336
|
+
this.returnedSoFar += results.length;
|
|
337
|
+
this.items = __spreadArray(__spreadArray([], __read(this.items), false), __read(results), false);
|
|
338
|
+
return [2 /*return*/, true];
|
|
339
|
+
case 2:
|
|
340
|
+
error_1 = _e.sent();
|
|
341
|
+
this.er.logger.error(error_1);
|
|
342
|
+
return [2 /*return*/, false];
|
|
343
|
+
case 3: return [2 /*return*/];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
return QueryEventArticlesIter;
|
|
349
|
+
}(QueryEvent));
|
|
350
|
+
exports.QueryEventArticlesIter = QueryEventArticlesIter;
|
|
351
|
+
var RequestEvent = /** @class */ (function (_super) {
|
|
352
|
+
__extends(RequestEvent, _super);
|
|
353
|
+
function RequestEvent() {
|
|
354
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
355
|
+
_this.path = "/api/v1/event/getEvent";
|
|
356
|
+
return _this;
|
|
357
|
+
}
|
|
358
|
+
return RequestEvent;
|
|
359
|
+
}(base_1.QueryParamsBase));
|
|
360
|
+
exports.RequestEvent = RequestEvent;
|
|
361
|
+
/**
|
|
362
|
+
* @class RequestEventInfo
|
|
363
|
+
* Return details about an event
|
|
364
|
+
*/
|
|
365
|
+
var RequestEventInfo = /** @class */ (function (_super) {
|
|
366
|
+
__extends(RequestEventInfo, _super);
|
|
367
|
+
function RequestEventInfo(returnInfo) {
|
|
368
|
+
if (returnInfo === void 0) { returnInfo = new returnInfo_1.ReturnInfo(); }
|
|
369
|
+
var _this = _super.call(this) || this;
|
|
370
|
+
_this.resultType = "info";
|
|
371
|
+
_this.params = returnInfo.getParams("info");
|
|
372
|
+
return _this;
|
|
373
|
+
}
|
|
374
|
+
return RequestEventInfo;
|
|
375
|
+
}(RequestEvent));
|
|
376
|
+
exports.RequestEventInfo = RequestEventInfo;
|
|
377
|
+
/**
|
|
378
|
+
* @class RequestEventArticles
|
|
379
|
+
* Return articles about the event
|
|
380
|
+
*/
|
|
381
|
+
var RequestEventArticles = /** @class */ (function (_super) {
|
|
382
|
+
__extends(RequestEventArticles, _super);
|
|
383
|
+
function RequestEventArticles(args) {
|
|
384
|
+
if (args === void 0) { args = {}; }
|
|
385
|
+
var _this = _super.call(this) || this;
|
|
386
|
+
_this.resultType = "articles";
|
|
387
|
+
var _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 100 : _b, _c = args.lang, lang = _c === void 0 ? undefined : _c, _d = args.keywords, keywords = _d === void 0 ? undefined : _d, _e = args.conceptUri, conceptUri = _e === void 0 ? undefined : _e, _f = args.categoryUri, categoryUri = _f === void 0 ? undefined : _f, _g = args.sourceUri, sourceUri = _g === void 0 ? undefined : _g, _h = args.sourceLocationUri, sourceLocationUri = _h === void 0 ? undefined : _h, _j = args.sourceGroupUri, sourceGroupUri = _j === void 0 ? undefined : _j, _k = args.authorUri, authorUri = _k === void 0 ? undefined : _k, _l = args.locationUri, locationUri = _l === void 0 ? undefined : _l, _m = args.dateStart, dateStart = _m === void 0 ? undefined : _m, _o = args.dateEnd, dateEnd = _o === void 0 ? undefined : _o, _p = args.dateMentionStart, dateMentionStart = _p === void 0 ? undefined : _p, _q = args.dateMentionEnd, dateMentionEnd = _q === void 0 ? undefined : _q, _r = args.keywordsLoc, keywordsLoc = _r === void 0 ? "body" : _r, _s = args.startSourceRankPercentile, startSourceRankPercentile = _s === void 0 ? 0 : _s, _t = args.endSourceRankPercentile, endSourceRankPercentile = _t === void 0 ? 100 : _t, _u = args.sortBy, sortBy = _u === void 0 ? "cosSim" : _u, _v = args.sortByAsc, sortByAsc = _v === void 0 ? false : _v, _w = args.returnInfo, returnInfo = _w === void 0 ? undefined : _w;
|
|
388
|
+
if (page < 1) {
|
|
389
|
+
throw new RangeError("Page has to be >= 1");
|
|
390
|
+
}
|
|
391
|
+
if (count > 100) {
|
|
392
|
+
throw new RangeError("At most 100 articles can be returned per call");
|
|
393
|
+
}
|
|
394
|
+
_this.params = {};
|
|
395
|
+
_this.params["articlesPage"] = page;
|
|
396
|
+
_this.params["articlesCount"] = count;
|
|
397
|
+
_this.params["articlesSortBy"] = sortBy;
|
|
398
|
+
_this.params["articlesSortByAsc"] = sortByAsc;
|
|
399
|
+
_this.setQueryArrVal(keywords, "keyword", "keywordOper", "and");
|
|
400
|
+
_this.setQueryArrVal(conceptUri, "conceptUri", "conceptOper", "and");
|
|
401
|
+
_this.setQueryArrVal(categoryUri, "categoryUri", "categoryOper", "or");
|
|
402
|
+
_this.setQueryArrVal(sourceUri, "sourceUri", "sourceOper", "or");
|
|
403
|
+
_this.setQueryArrVal(sourceLocationUri, "sourceLocationUri", undefined, "or");
|
|
404
|
+
_this.setQueryArrVal(sourceGroupUri, "sourceGroupUri", "sourceGroupOper", "or");
|
|
405
|
+
_this.setQueryArrVal(authorUri, "authorUri", "authorOper", "or");
|
|
406
|
+
_this.setQueryArrVal(locationUri, "locationUri", undefined, "or");
|
|
407
|
+
_this.setQueryArrVal(lang, "articlesLang", undefined, "or");
|
|
408
|
+
if (dateStart !== undefined) {
|
|
409
|
+
_this.setDateVal("dateStart", dateStart);
|
|
410
|
+
}
|
|
411
|
+
if (dateEnd !== undefined) {
|
|
412
|
+
_this.setDateVal("dateEnd", dateEnd);
|
|
413
|
+
}
|
|
414
|
+
if (dateMentionStart !== undefined) {
|
|
415
|
+
_this.setDateVal("dateMentionStart", dateMentionStart);
|
|
416
|
+
}
|
|
417
|
+
if (dateMentionEnd !== undefined) {
|
|
418
|
+
_this.setDateVal("dateMentionEnd", dateMentionEnd);
|
|
419
|
+
}
|
|
420
|
+
_this.setValIfNotDefault("keywordLoc", keywordsLoc, "body");
|
|
421
|
+
if (startSourceRankPercentile < 0 || startSourceRankPercentile % 10 !== 0 || startSourceRankPercentile > 100) {
|
|
422
|
+
throw new Error("StartSourceRankPercentile: Value should be in range 0-90 and divisible by 10.");
|
|
423
|
+
}
|
|
424
|
+
if (endSourceRankPercentile < 0 || endSourceRankPercentile % 10 !== 0 || endSourceRankPercentile > 100) {
|
|
425
|
+
throw new Error("EndSourceRankPercentile: Value should be in range 0-90 and divisible by 10.");
|
|
426
|
+
}
|
|
427
|
+
if (startSourceRankPercentile > endSourceRankPercentile) {
|
|
428
|
+
throw new Error("SourceRankPercentile: startSourceRankPercentile should be less than endSourceRankPercentile");
|
|
429
|
+
}
|
|
430
|
+
if (startSourceRankPercentile !== 0) {
|
|
431
|
+
_this.setVal("startSourceRankPercentile", startSourceRankPercentile);
|
|
432
|
+
}
|
|
433
|
+
if (endSourceRankPercentile !== 100) {
|
|
434
|
+
_this.setVal("endSourceRankPercentile", endSourceRankPercentile);
|
|
435
|
+
}
|
|
436
|
+
if (returnInfo) {
|
|
437
|
+
_this.params = __assign(__assign(__assign({}, _this.params), _this.getQueryParams()), returnInfo.getParams("articles"));
|
|
438
|
+
}
|
|
439
|
+
return _this;
|
|
440
|
+
}
|
|
441
|
+
return RequestEventArticles;
|
|
442
|
+
}(RequestEvent));
|
|
443
|
+
exports.RequestEventArticles = RequestEventArticles;
|
|
444
|
+
/**
|
|
445
|
+
* @class RequestEventArticleUriWgts
|
|
446
|
+
* Return just a list of article uris
|
|
447
|
+
*/
|
|
448
|
+
var RequestEventArticleUriWgts = /** @class */ (function (_super) {
|
|
449
|
+
__extends(RequestEventArticleUriWgts, _super);
|
|
450
|
+
function RequestEventArticleUriWgts(args) {
|
|
451
|
+
if (args === void 0) { args = {}; }
|
|
452
|
+
var _this = _super.call(this) || this;
|
|
453
|
+
_this.resultType = "uriWgtList";
|
|
454
|
+
var _a = args.lang, lang = _a === void 0 ? undefined : _a, _b = args.sortBy, sortBy = _b === void 0 ? "cosSim" : _b, _c = args.sortByAsc, sortByAsc = _c === void 0 ? false : _c, unsupported = __rest(args, ["lang", "sortBy", "sortByAsc"]);
|
|
455
|
+
if (Object.keys(unsupported).length > 0) {
|
|
456
|
+
logger_1.Logger.warn("RequestEventArticleUriWgts: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
|
|
457
|
+
}
|
|
458
|
+
_this.params = {};
|
|
459
|
+
if (lang !== undefined) {
|
|
460
|
+
_this.params["articlesLang"] = lang;
|
|
461
|
+
}
|
|
462
|
+
_this.params["uriWgtListSortBy"] = sortBy;
|
|
463
|
+
_this.params["uriWgtListSortByAsc"] = sortByAsc;
|
|
464
|
+
return _this;
|
|
465
|
+
}
|
|
466
|
+
return RequestEventArticleUriWgts;
|
|
467
|
+
}(RequestEvent));
|
|
468
|
+
exports.RequestEventArticleUriWgts = RequestEventArticleUriWgts;
|
|
469
|
+
/**
|
|
470
|
+
* @class RequestEventKeywordAggr
|
|
471
|
+
* Return keyword aggregate (tag-cloud) from articles in the event.
|
|
472
|
+
*/
|
|
473
|
+
var RequestEventKeywordAggr = /** @class */ (function (_super) {
|
|
474
|
+
__extends(RequestEventKeywordAggr, _super);
|
|
475
|
+
/**
|
|
476
|
+
* @param lang: language for which to compute the keywords
|
|
477
|
+
*/
|
|
478
|
+
function RequestEventKeywordAggr(lang) {
|
|
479
|
+
if (lang === void 0) { lang = "eng"; }
|
|
480
|
+
var _this = _super.call(this) || this;
|
|
481
|
+
_this.resultType = "keywordAggr";
|
|
482
|
+
_this.params = {};
|
|
483
|
+
_this.params["articlesLang"] = lang;
|
|
484
|
+
return _this;
|
|
485
|
+
}
|
|
486
|
+
return RequestEventKeywordAggr;
|
|
487
|
+
}(RequestEvent));
|
|
488
|
+
exports.RequestEventKeywordAggr = RequestEventKeywordAggr;
|
|
489
|
+
/**
|
|
490
|
+
* @class RequestEventSourceAggr
|
|
491
|
+
* Get news source distribution of articles in the event.
|
|
492
|
+
*/
|
|
493
|
+
var RequestEventSourceAggr = /** @class */ (function (_super) {
|
|
494
|
+
__extends(RequestEventSourceAggr, _super);
|
|
495
|
+
function RequestEventSourceAggr() {
|
|
496
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
497
|
+
_this.resultType = "sourceExAggr";
|
|
498
|
+
return _this;
|
|
499
|
+
}
|
|
500
|
+
return RequestEventSourceAggr;
|
|
501
|
+
}(RequestEvent));
|
|
502
|
+
exports.RequestEventSourceAggr = RequestEventSourceAggr;
|
|
503
|
+
/**
|
|
504
|
+
* @class RequestEventDateMentionAggr
|
|
505
|
+
* Get dates that we found mentioned in the event articles and their frequencies.
|
|
506
|
+
*/
|
|
507
|
+
var RequestEventDateMentionAggr = /** @class */ (function (_super) {
|
|
508
|
+
__extends(RequestEventDateMentionAggr, _super);
|
|
509
|
+
function RequestEventDateMentionAggr() {
|
|
510
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
511
|
+
_this.resultType = "dateMentionAggr";
|
|
512
|
+
return _this;
|
|
513
|
+
}
|
|
514
|
+
return RequestEventDateMentionAggr;
|
|
515
|
+
}(RequestEvent));
|
|
516
|
+
exports.RequestEventDateMentionAggr = RequestEventDateMentionAggr;
|
|
517
|
+
/**
|
|
518
|
+
* @class RequestEventArticleTrend
|
|
519
|
+
* Return trending information for the articles about the event.
|
|
520
|
+
*/
|
|
521
|
+
var RequestEventArticleTrend = /** @class */ (function (_super) {
|
|
522
|
+
__extends(RequestEventArticleTrend, _super);
|
|
523
|
+
function RequestEventArticleTrend(args) {
|
|
524
|
+
if (args === void 0) { args = {}; }
|
|
525
|
+
var _this = _super.call(this) || this;
|
|
526
|
+
_this.resultType = "articleTrend";
|
|
527
|
+
var _a = args.lang, lang = _a === void 0 ? undefined : _a, _b = args.page, page = _b === void 0 ? 1 : _b, _c = args.count, count = _c === void 0 ? 100 : _c, _d = args.minArticleCosSim, minArticleCosSim = _d === void 0 ? -1 : _d, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo({ articleInfo: new returnInfo_1.ArticleInfoFlags({ bodyLen: 0 }) }) : _e, unsupported = __rest(args, ["lang", "page", "count", "minArticleCosSim", "returnInfo"]);
|
|
528
|
+
if (Object.keys(unsupported).length > 0) {
|
|
529
|
+
logger_1.Logger.warn("RequestEventArticleTrend: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
|
|
530
|
+
}
|
|
531
|
+
if (page < 1) {
|
|
532
|
+
throw new RangeError("Page has to be >= 1");
|
|
533
|
+
}
|
|
534
|
+
if (count > 100) {
|
|
535
|
+
throw new RangeError("At most 100 articles can be returned per call");
|
|
536
|
+
}
|
|
537
|
+
_this.params = {};
|
|
538
|
+
_this.params["articlesLang"] = lang;
|
|
539
|
+
_this.params["articleTrendPage"] = page;
|
|
540
|
+
_this.params["articleTrendCount"] = count;
|
|
541
|
+
_this.params["articleTrendMinArticleCosSim"] = minArticleCosSim;
|
|
542
|
+
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articleTrend"));
|
|
543
|
+
return _this;
|
|
544
|
+
}
|
|
545
|
+
return RequestEventArticleTrend;
|
|
546
|
+
}(RequestEvent));
|
|
547
|
+
exports.RequestEventArticleTrend = RequestEventArticleTrend;
|
|
548
|
+
/**
|
|
549
|
+
* @class RequestEventSimilarEvents
|
|
550
|
+
* Compute and return a list of similar events.
|
|
551
|
+
*/
|
|
552
|
+
var RequestEventSimilarEvents = /** @class */ (function (_super) {
|
|
553
|
+
__extends(RequestEventSimilarEvents, _super);
|
|
554
|
+
function RequestEventSimilarEvents(args) {
|
|
555
|
+
if (args === void 0) { args = {}; }
|
|
556
|
+
var _this = _super.call(this) || this;
|
|
557
|
+
_this.path = "/api/v1/event/getSimilarEvents";
|
|
558
|
+
var conceptInfoList = args.conceptInfoList, _a = args.count, count = _a === void 0 ? 50 : _a, _b = args.dateStart, dateStart = _b === void 0 ? undefined : _b, _c = args.dateEnd, dateEnd = _c === void 0 ? undefined : _c, _d = args.addArticleTrendInfo, addArticleTrendInfo = _d === void 0 ? false : _d, _e = args.aggrHours, aggrHours = _e === void 0 ? 6 : _e, _f = args.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, unsupported = __rest(args, ["conceptInfoList", "count", "dateStart", "dateEnd", "addArticleTrendInfo", "aggrHours", "returnInfo"]);
|
|
559
|
+
if (Object.keys(unsupported).length > 0) {
|
|
560
|
+
logger_1.Logger.warn("RequestEventSimilarEvents: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
|
|
561
|
+
}
|
|
562
|
+
if (count > 50) {
|
|
563
|
+
throw new RangeError("At most 50 similar events can be returned per call");
|
|
564
|
+
}
|
|
565
|
+
if (!Array.isArray(conceptInfoList)) {
|
|
566
|
+
throw new Error("Concept info list is not an array");
|
|
567
|
+
}
|
|
568
|
+
_this.params = {};
|
|
569
|
+
_this.params["action"] = "getSimilarEvents";
|
|
570
|
+
_this.params["concepts"] = JSON.stringify(conceptInfoList);
|
|
571
|
+
// Potential problem, verify that output corresponds the REST API docs.
|
|
572
|
+
_this.params["eventsCount"] = count;
|
|
573
|
+
if (dateStart) {
|
|
574
|
+
_this.params["dateStart"] = base_1.QueryParamsBase.encodeDateTime(dateStart, "YYYY-MM-DD");
|
|
575
|
+
}
|
|
576
|
+
if (dateEnd) {
|
|
577
|
+
_this.params["dateEnd"] = base_1.QueryParamsBase.encodeDateTime(dateEnd, "YYYY-MM-DD");
|
|
578
|
+
}
|
|
579
|
+
_this.params["addArticleTrendInfo"] = addArticleTrendInfo;
|
|
580
|
+
_this.params["aggrHours"] = aggrHours;
|
|
581
|
+
_this.params["resultType"] = "similarEvents";
|
|
582
|
+
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
|
|
583
|
+
return _this;
|
|
584
|
+
}
|
|
585
|
+
return RequestEventSimilarEvents;
|
|
586
|
+
}(RequestEvent));
|
|
587
|
+
exports.RequestEventSimilarEvents = RequestEventSimilarEvents;
|
|
570
588
|
//# sourceMappingURL=queryEvent.js.map
|