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.
Files changed (65) hide show
  1. package/dist/analytics.d.ts +82 -82
  2. package/dist/analytics.js +336 -330
  3. package/dist/analytics.js.map +1 -1
  4. package/dist/base.d.ts +82 -81
  5. package/dist/base.js +261 -219
  6. package/dist/base.js.map +1 -1
  7. package/dist/counts.d.ts +81 -81
  8. package/dist/counts.js +162 -149
  9. package/dist/counts.js.map +1 -1
  10. package/dist/dailyShares.d.ts +10 -10
  11. package/dist/dailyShares.js +90 -77
  12. package/dist/dailyShares.js.map +1 -1
  13. package/dist/data.d.ts +269 -268
  14. package/dist/data.js +3 -3
  15. package/dist/eventForText.d.ts +48 -48
  16. package/dist/eventForText.js +126 -123
  17. package/dist/eventForText.js.map +1 -1
  18. package/dist/eventRegistry.d.ts +244 -224
  19. package/dist/eventRegistry.js +1098 -1018
  20. package/dist/eventRegistry.js.map +1 -1
  21. package/dist/index.d.ts +21 -20
  22. package/dist/index.js +128 -122
  23. package/dist/index.js.map +1 -1
  24. package/dist/info.d.ts +61 -61
  25. package/dist/info.js +171 -158
  26. package/dist/info.js.map +1 -1
  27. package/dist/logger.d.ts +44 -0
  28. package/dist/logger.js +144 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/query.d.ts +53 -53
  31. package/dist/query.js +333 -290
  32. package/dist/query.js.map +1 -1
  33. package/dist/queryArticle.d.ts +61 -61
  34. package/dist/queryArticle.js +183 -168
  35. package/dist/queryArticle.js.map +1 -1
  36. package/dist/queryArticles.d.ts +144 -160
  37. package/dist/queryArticles.js +729 -701
  38. package/dist/queryArticles.js.map +1 -1
  39. package/dist/queryEvent.d.ts +140 -140
  40. package/dist/queryEvent.js +587 -569
  41. package/dist/queryEvent.js.map +1 -1
  42. package/dist/queryEvents.d.ts +210 -210
  43. package/dist/queryEvents.js +825 -798
  44. package/dist/queryEvents.js.map +1 -1
  45. package/dist/queryMentions.d.ts +96 -96
  46. package/dist/queryMentions.js +637 -600
  47. package/dist/queryMentions.js.map +1 -1
  48. package/dist/queryStory.d.ts +58 -58
  49. package/dist/queryStory.js +194 -174
  50. package/dist/queryStory.js.map +1 -1
  51. package/dist/recent.d.ts +23 -23
  52. package/dist/recent.js +199 -179
  53. package/dist/recent.js.map +1 -1
  54. package/dist/returnInfo.d.ts +68 -66
  55. package/dist/returnInfo.js +332 -304
  56. package/dist/returnInfo.js.map +1 -1
  57. package/dist/topicPage.d.ts +157 -157
  58. package/dist/topicPage.js +599 -604
  59. package/dist/topicPage.js.map +1 -1
  60. package/dist/trends.d.ts +35 -35
  61. package/dist/trends.js +115 -102
  62. package/dist/trends.js.map +1 -1
  63. package/dist/types.d.ts +2453 -2155
  64. package/dist/types.js +2 -2
  65. package/package.json +13 -13
@@ -1,124 +1,127 @@
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- }
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- var __generator = (this && this.__generator) || function (thisArg, body) {
24
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
- function verb(n) { return function (v) { return step([n, v]); }; }
27
- function step(op) {
28
- if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
30
- 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;
31
- if (y = 0, t) op = [op[0] & 2, t.value];
32
- switch (op[0]) {
33
- case 0: case 1: t = op; break;
34
- case 4: _.label++; return { value: op[1], done: false };
35
- case 5: _.label++; y = op[1]; op = [0]; continue;
36
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
- default:
38
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
- if (t[2]) _.ops.pop();
43
- _.trys.pop(); continue;
44
- }
45
- op = body.call(thisArg, _);
46
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
- }
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- var _ = require("lodash");
52
- var base_1 = require("./base");
53
- /**
54
- * The GetEventForText class can be used to find the event(s) that best matches the given input text.
55
- * The request is performed asynchronously.
56
- *
57
- * Note: The functionality can only be used to find the events in the last 5 days. Older events cannot
58
- * be matched in this way
59
- *
60
- * Return info from the compute() method is in the form:
61
- *
62
- * [
63
- * {
64
- * "cosSim": 0.07660648086468567,
65
- * "eventUri": "4969",
66
- * "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-40591"
67
- * },
68
- * {
69
- * "cosSim": 0.05851939237670918,
70
- * "eventUri": "5157",
71
- * "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-56286"
72
- * },
73
- * ...
74
- * ]
75
- *
76
- * Where
77
- * - cosSim represents the cosine similarity of the document to the cluster
78
- * - eventUri is the uri of the corresponding event in the Event Registry
79
- * - storyUri is the uri of the story in the Event Registry
80
- *
81
- * You can use QueryEvent or QueryStory to obtain more information about these events/stories
82
- *
83
- */
84
- var GetEventForText = /** @class */ (function (_super) {
85
- __extends(GetEventForText, _super);
86
- /**
87
- * @param er instance of EventRegistry class
88
- * @param nrOfEventsToReturn number of events to return for the given text
89
- */
90
- function GetEventForText(er, nrOfEventsToReturn) {
91
- if (nrOfEventsToReturn === void 0) { nrOfEventsToReturn = 5; }
92
- var _this = _super.call(this) || this;
93
- _this.er = er;
94
- _this.nrOfEventsToReturn = nrOfEventsToReturn;
95
- return _this;
96
- }
97
- /**
98
- * Compute the list of most similar events for the given text
99
- * @param text text for which to find the most similar event
100
- * @param lang language in which the text is written
101
- */
102
- GetEventForText.prototype.compute = function (text, lang) {
103
- if (lang === void 0) { lang = "eng"; }
104
- return __awaiter(this, void 0, void 0, function () {
105
- var params, response;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0:
109
- params = { lang: lang, text: text, topClustersCount: this.nrOfEventsToReturn };
110
- return [4 /*yield*/, this.er.jsonRequest("/api/v1/getEventForText/getEventForText", params)];
111
- case 1:
112
- response = _a.sent();
113
- if (_.has(response, "topStories")) {
114
- return [2 /*return*/, _.get(response, "topStories", [])];
115
- }
116
- return [2 /*return*/, response];
117
- }
118
- });
119
- });
120
- };
121
- return GetEventForText;
122
- }(base_1.QueryParamsBase));
123
- exports.GetEventForText = GetEventForText;
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.GetEventForText = void 0;
55
+ var base_1 = require("./base");
56
+ /**
57
+ * The GetEventForText class can be used to find the event(s) that best matches the given input text.
58
+ * The request is performed asynchronously.
59
+ *
60
+ * Note: The functionality can only be used to find the events in the last 5 days. Older events cannot
61
+ * be matched in this way
62
+ *
63
+ * Return info from the compute() method is in the form:
64
+ *
65
+ * [
66
+ * {
67
+ * "cosSim": 0.07660648086468567,
68
+ * "eventUri": "4969",
69
+ * "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-40591"
70
+ * },
71
+ * {
72
+ * "cosSim": 0.05851939237670918,
73
+ * "eventUri": "5157",
74
+ * "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-56286"
75
+ * },
76
+ * ...
77
+ * ]
78
+ *
79
+ * Where
80
+ * - cosSim represents the cosine similarity of the document to the cluster
81
+ * - eventUri is the uri of the corresponding event in the Event Registry
82
+ * - storyUri is the uri of the story in the Event Registry
83
+ *
84
+ * You can use QueryEvent or QueryStory to obtain more information about these events/stories
85
+ *
86
+ */
87
+ var GetEventForText = /** @class */ (function (_super) {
88
+ __extends(GetEventForText, _super);
89
+ /**
90
+ * @param er instance of EventRegistry class
91
+ * @param nrOfEventsToReturn number of events to return for the given text
92
+ */
93
+ function GetEventForText(er, nrOfEventsToReturn) {
94
+ if (nrOfEventsToReturn === void 0) { nrOfEventsToReturn = 5; }
95
+ var _this = _super.call(this) || this;
96
+ _this.er = er;
97
+ _this.nrOfEventsToReturn = nrOfEventsToReturn;
98
+ return _this;
99
+ }
100
+ /**
101
+ * Compute the list of most similar events for the given text
102
+ * @param text text for which to find the most similar event
103
+ * @param lang language in which the text is written
104
+ */
105
+ GetEventForText.prototype.compute = function (text_1) {
106
+ return __awaiter(this, arguments, void 0, function (text, lang) {
107
+ var params, response;
108
+ if (lang === void 0) { lang = "eng"; }
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
+ case 0:
112
+ params = { lang: lang, text: text, topClustersCount: this.nrOfEventsToReturn };
113
+ return [4 /*yield*/, this.er.jsonRequest("/api/v1/getEventForText/getEventForText", params)];
114
+ case 1:
115
+ response = _a.sent();
116
+ if ((response === null || response === void 0 ? void 0 : response.data.topStories) !== undefined) {
117
+ return [2 /*return*/, response.data.topStories];
118
+ }
119
+ return [2 /*return*/, response];
120
+ }
121
+ });
122
+ });
123
+ };
124
+ return GetEventForText;
125
+ }(base_1.QueryParamsBase));
126
+ exports.GetEventForText = GetEventForText;
124
127
  //# sourceMappingURL=eventForText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventForText.js","sourceRoot":"","sources":["../src/eventForText.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA4B;AAC5B,+BAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IAAqC,mCAAe;IAGhD;;;OAGG;IACH,yBAAY,EAAiB,EAAE,kBAA8B;QAA9B,mCAAA,EAAA,sBAA8B;QAA7D,YACI,iBAAO,SAGV;QAFG,KAAI,CAAC,EAAE,GAAG,EAAE,CAA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