Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eventregistry

Package Overview
Dependencies
Maintainers
0
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventregistry - npm Package Compare versions

Comparing version 8.11.2 to 9.1.0

dist/logger.d.ts

26

dist/analytics.d.ts
import { EventRegistry } from "./eventRegistry";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare class Analytics {

@@ -16,3 +16,3 @@ private er;

[name: string]: unknown;
}): Promise<any>;
}): Promise<ER.Analytics.Response.Annotate>;
/**

@@ -25,3 +25,3 @@ * Determine the set of up to 5 categories the text is about. Currently, only English text can be categorized!

*/
categorize(text: string, taxonomy?: "dmoz" | "news"): Promise<any>;
categorize(text: string, taxonomy?: "dmoz" | "news"): Promise<ER.Analytics.Response.Categorize>;
/**

@@ -32,4 +32,4 @@ * determine the sentiment of the provided text in English language

*/
sentiment(text: string, method?: string, sentences?: number, returnSentences?: boolean): Promise<any>;
semanticSimilarity(text1: string, text2: string, distanceMeasure?: "cosine" | "jaccard"): Promise<any>;
sentiment(text: string, method?: string, sentences?: number, returnSentences?: boolean): Promise<ER.Analytics.Response.Sentiment>;
semanticSimilarity(text1: string, text2: string, distanceMeasure?: "cosine" | "jaccard"): Promise<ER.Analytics.Response.SentimentSimilarity>;
/**

@@ -39,3 +39,3 @@ * Determine the language of the given text

*/
detectLanguage(text: string): Promise<any>;
detectLanguage(text: string): Promise<ER.Analytics.Response.DetectLanguage>;
/**

@@ -51,3 +51,3 @@ * Extract all available information about an article available at url `url`.

[name: string]: unknown;
}): Promise<any>;
}): Promise<ER.Analytics.Response.ExtractArticleInfo>;
/**

@@ -57,3 +57,3 @@ * Extract named entities from the provided text. Supported languages are English, German, Spanish and Chinese.

*/
ner(text: string): Promise<any>;
ner(text: string): Promise<unknown>;
/**

@@ -64,3 +64,3 @@ * Create a new topic and train it using the tweets that match the twitterQuery

*/
trainTopicOnTweets(twitterQuery: string, args?: EventRegistryStatic.Analytics.TrainTopicOnTweetsArguments): Promise<any>;
trainTopicOnTweets(twitterQuery: string, args?: ER.Analytics.TrainTopicOnTweetsArguments): Promise<ER.Analytics.Response>;
/**

@@ -71,3 +71,3 @@ * Create a new topic to train. The user should remember the "uri" parameter returned in the result.

*/
trainTopicCreateTopic(name: string): Promise<any>;
trainTopicCreateTopic(name: string): Promise<ER.Analytics.Response>;
/**

@@ -77,3 +77,3 @@ * If the topic is already existing, clear the definition of the topic. Use this if you want to retrain an existing topic

*/
trainTopicClearTopic(uri: string): Promise<any>;
trainTopicClearTopic(uri: string): Promise<ER.Analytics.Response>;
/**

@@ -84,3 +84,3 @@ * Add the information extracted from the provided "text" to the topic with uri "uri".

*/
trainTopicAddDocument(uri: string, text: string): Promise<any>;
trainTopicAddDocument(uri: string, text: string): Promise<ER.Analytics.Response>;
/**

@@ -91,3 +91,3 @@ * Retrieve topic for the topic for which you have already finished training

*/
trainTopicGetTrainedTopic(uri: string, args?: EventRegistryStatic.Analytics.TrainTopicGetTrainedTopicArguments): Promise<any>;
trainTopicGetTrainedTopic(uri: string, args?: ER.Analytics.TrainTopicGetTrainedTopicArguments): Promise<ER.Analytics.Response>;
}

@@ -14,6 +14,7 @@ "use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -28,3 +29,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -51,3 +52,3 @@ if (y = 0, t) op = [op[0] & 2, t.value];

Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.Analytics = void 0;
// The Analytics class can be used for access the text analytics services provided by the Event Registry.

@@ -75,13 +76,14 @@ // These include:

return __awaiter(this, void 0, void 0, function () {
var params, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var params, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
params = { lang: lang, text: text };
if (!_.isUndefined(customParams)) {
params = __assign({}, params, customParams);
if (!!customParams) {
params = __assign(__assign({}, params), customParams);
}
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/annotate", params)];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -98,12 +100,12 @@ });

*/
Analytics.prototype.categorize = function (text, taxonomy) {
if (taxonomy === void 0) { taxonomy = "dmoz"; }
return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/categorize", { text: text, taxonomy: taxonomy })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
Analytics.prototype.categorize = function (text_1) {
return __awaiter(this, arguments, void 0, function (text, taxonomy) {
var response;
if (taxonomy === void 0) { taxonomy = "dmoz"; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/categorize", { text: text, taxonomy: taxonomy })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -118,12 +120,12 @@ });

*/
Analytics.prototype.sentiment = function (text, method, sentences, returnSentences) {
if (method === void 0) { method = "vocabulary"; }
if (sentences === void 0) { sentences = 10; }
if (returnSentences === void 0) { returnSentences = true; }
return __awaiter(this, void 0, void 0, function () {
var params, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
Analytics.prototype.sentiment = function (text_1) {
return __awaiter(this, arguments, void 0, function (text, method, sentences, returnSentences) {
var params, response;
if (method === void 0) { method = "vocabulary"; }
if (sentences === void 0) { sentences = 10; }
if (returnSentences === void 0) { returnSentences = true; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!_.includes(["vocabulary", "rnn"], method)) {
if (!["vocabulary", "rnn"].includes(method)) {
throw new Error("method: Please pass in either 'vocabulary' or 'rnn'");

@@ -137,5 +139,6 @@ }

};
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/sentiment", params)];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -145,12 +148,12 @@ });

};
Analytics.prototype.semanticSimilarity = function (text1, text2, distanceMeasure) {
if (distanceMeasure === void 0) { distanceMeasure = "cosine"; }
return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/semanticSimilarity", { text1: text1, text2: text2, distanceMeasure: distanceMeasure })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
Analytics.prototype.semanticSimilarity = function (text1_1, text2_1) {
return __awaiter(this, arguments, void 0, function (text1, text2, distanceMeasure) {
var response;
if (distanceMeasure === void 0) { distanceMeasure = "cosine"; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/semanticSimilarity", { text1: text1, text2: text2, distanceMeasure: distanceMeasure })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -166,9 +169,9 @@ });

return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/detectLanguage", { text: text })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/detectLanguage", { text: text })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -186,13 +189,14 @@ });

return __awaiter(this, void 0, void 0, function () {
var params, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var params, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
params = { url: url };
if (!!proxyUrl) {
_.set(params, "proxyUrl", proxyUrl);
params.proxyUrl = proxyUrl;
}
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/extractArticleInfo", params, headers, cookies)];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -208,9 +212,9 @@ });

return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/ner", { text: text })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/ner", { text: text })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -225,8 +229,8 @@ });

*/
Analytics.prototype.trainTopicOnTweets = function (twitterQuery, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
var _a, useTweetText, _b, useIdfNormalization, _c, normalization, _d, maxTweets, _e, maxUsedLinks, _f, ignoreConceptTypes, _g, maxConcepts, _h, maxCategories, _j, notifyEmailAddress, params, _k, _l;
return __generator(this, function (_m) {
switch (_m.label) {
Analytics.prototype.trainTopicOnTweets = function (twitterQuery_1) {
return __awaiter(this, arguments, void 0, function (twitterQuery, args) {
var _a, useTweetText, _b, useIdfNormalization, _c, normalization, _d, maxTweets, _e, maxUsedLinks, _f, ignoreConceptTypes, _g, maxConcepts, _h, maxCategories, _j, notifyEmailAddress, params, response;
if (args === void 0) { args = {}; }
return __generator(this, function (_k) {
switch (_k.label) {
case 0:

@@ -248,10 +252,11 @@ _a = args.useTweetText, useTweetText = _a === void 0 ? true : _a, _b = args.useIdfNormalization, useIdfNormalization = _b === void 0 ? true : _b, _c = args.normalization, normalization = _c === void 0 ? "linear" : _c, _d = args.maxTweets, maxTweets = _d === void 0 ? 2000 : _d, _e = args.maxUsedLinks, maxUsedLinks = _e === void 0 ? 500 : _e, _f = args.ignoreConceptTypes, ignoreConceptTypes = _f === void 0 ? [] : _f, _g = args.maxConcepts, maxConcepts = _g === void 0 ? 20 : _g, _h = args.maxCategories, maxCategories = _h === void 0 ? 10 : _h, _j = args.notifyEmailAddress, notifyEmailAddress = _j === void 0 ? undefined : _j;

if (notifyEmailAddress) {
_.set(params, "notifyEmailAddress", notifyEmailAddress);
params.notifyEmailAddress = notifyEmailAddress;
}
if (!_.isEmpty(ignoreConceptTypes)) {
_.set(params, "ignoreConceptTypes", ignoreConceptTypes);
if (ignoreConceptTypes && Object.keys(ignoreConceptTypes).length > 0) {
params.ignoreConceptTypes = ignoreConceptTypes;
}
_l = (_k = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopicOnTwitter", params)];
case 1: return [2 /*return*/, _l.apply(_k, [_m.sent(), "data"])];
case 1:
response = _k.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -268,9 +273,9 @@ });

return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "createTopic", name: name })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "createTopic", name: name })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -286,9 +291,9 @@ });

return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "clearTopic", uri: uri })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "clearTopic", uri: uri })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -305,9 +310,9 @@ });

return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "addDocument", uri: uri, text: text })];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "data"])];
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "addDocument", uri: uri, text: text })];
case 1:
response = _a.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -322,8 +327,8 @@ });

*/
Analytics.prototype.trainTopicGetTrainedTopic = function (uri, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
var _a, maxConcepts, _b, maxCategories, _c, idfNormalization, params, _d, _e;
return __generator(this, function (_f) {
switch (_f.label) {
Analytics.prototype.trainTopicGetTrainedTopic = function (uri_1) {
return __awaiter(this, arguments, void 0, function (uri, args) {
var _a, maxConcepts, _b, maxCategories, _c, idfNormalization, params, response;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {
switch (_d.label) {
case 0:

@@ -338,5 +343,6 @@ _a = args.maxConcepts, maxConcepts = _a === void 0 ? 20 : _a, _b = args.maxCategories, maxCategories = _b === void 0 ? 10 : _b, _c = args.idfNormalization, idfNormalization = _c === void 0 ? true : _c;

};
_e = (_d = _).get;
return [4 /*yield*/, this.er.jsonRequestAnalytics("/api/v1/trainTopic", params)];
case 1: return [2 /*return*/, _e.apply(_d, [_f.sent(), "data"])];
case 1:
response = _d.sent();
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
}

@@ -343,0 +349,0 @@ });

@@ -20,3 +20,3 @@ export declare const mainLangs: string[];

export declare class QueryParamsBase {
protected params: {};
protected params: Record<string, unknown>;
/**

@@ -29,3 +29,3 @@ * Encode datetime into UTC ISO format which can be sent to ER.

*/
getQueryParams(): {};
getQueryParams(): Record<string, unknown>;
/**

@@ -63,3 +63,3 @@ * Set a value of a property in the query.

*/
setQueryArrVal(value: string | QueryItems | any[], propName: string, propOperName: string | undefined, defaultOperName: any): void;
setQueryArrVal(value: string | QueryItems | any[], propName: string, propOperName: string | undefined, defaultOperName: string): void;
}

@@ -72,9 +72,10 @@ export declare abstract class Query<T> extends QueryParamsBase {

protected internalPath: string;
protected params: {};
path: string;
protected params: Record<string, unknown>;
get path(): string;
set path(path: string);
/**
* Prepare the request parameters
*/
getQueryParams(): {};
getFormattedResultTypeList(): any;
getQueryParams(): any;
getFormattedResultTypeList(): string | string[];
abstract setRequestedResult(args: any): any;

@@ -85,2 +86,2 @@ }

*/
export declare function sleep(ms: any): Promise<{}>;
export declare function sleep(ms: any): Promise<unknown>;

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,2 +18,13 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {

@@ -33,9 +46,26 @@ var m = typeof Symbol === "function" && o[Symbol.iterator];

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.sleep = exports.Query = exports.QueryParamsBase = exports.QueryItems = exports.allLangs = exports.mainLangs = void 0;
var moment = require("moment");
var logger_1 = require("./logger");
exports.mainLangs = ["eng", "deu", "zho", "slv", "spa"];

@@ -79,3 +109,3 @@ exports.allLangs = ["eng", "deu", "spa", "cat", "por", "ita", "fra", "rus", "ara", "tur", "zho", "slv", "hrv", "srp"];

}
return _.isNil(format) ? datetime.toISOString() : datetime.format(format);
return (format === null || format === undefined) ? datetime.toISOString() : datetime.format(format);
};

@@ -92,3 +122,3 @@ /**

QueryParamsBase.prototype.setVal = function (key, value) {
_.set(this.params, key, value);
this.params[key] = value;
};

@@ -99,3 +129,3 @@ /**

QueryParamsBase.prototype.hasVal = function (key) {
return _.has(this.params, key);
return this.params.hasOwnProperty(key);
};

@@ -106,3 +136,3 @@ /**

QueryParamsBase.prototype.clearVal = function (key) {
_.unset(this.params, key);
delete this.params[key];
};

@@ -113,3 +143,3 @@ /**

QueryParamsBase.prototype.addArrayVal = function (key, val) {
_.update(this.params, key, function (value) { return __spread((value || []), [val]); });
this.params[key] = __spreadArray(__spreadArray([], __read((this.params[key] || [])), false), [val], false);
};

@@ -144,19 +174,19 @@ /**

this.params[propName] = value.getItems();
var formattedOperator = _.replace(value.getOper(), "$", "");
var formattedOperator = value.getOper().replace(/\$/g, "");
if (propOperName) {
this.params[propOperName] = formattedOperator;
}
if (_.isUndefined(propOperName) && formattedOperator !== defaultOperName) {
throw new Error("An invalid operator type '" + formattedOperator + "' was used for property '" + propName + "'");
if (propOperName === undefined && formattedOperator !== defaultOperName) {
throw new Error("An invalid operator type '".concat(formattedOperator, "' was used for property '").concat(propName, "'"));
}
}
else if (_.isString(value)) {
else if (typeof value === "string") {
this.params[propName] = value;
}
else if (_.isArray(value)) {
else if (Array.isArray(value)) {
this.params[propName] = value;
if (!_.isUndefined(propOperName)) {
if (propOperName !== undefined) {
this.params[propOperName] = defaultOperName;
if (_.size(value) > 1) {
console.warn("\n Warning: The value of parameter '" + propName + "' was provided as a list and '" + defaultOperName + "' operator was used implicitly between the items.\n We suggest specifying the list using the QueryItems.AND() or QueryItems.OR() to ensure the appropriate operator is used.\n ");
if (value.length > 1) {
logger_1.Logger.warn("\n Warning: The value of parameter '".concat(propName, "' was provided as a list and '").concat(defaultOperName, "' operator was used implicitly between the items.\n We suggest specifying the list using the QueryItems.AND() or QueryItems.OR() to ensure the appropriate operator is used.\n "));
}

@@ -166,3 +196,3 @@ }

else {
throw new Error("Parameter '" + propName + "' was of unsupported type. It should either be None, a string or an instance of QueryItems");
throw new Error("Parameter '".concat(propName, "' was of unsupported type. It should either be None, a string or an instance of QueryItems"));
}

@@ -176,3 +206,3 @@ };

function Query() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.params = {};

@@ -188,3 +218,3 @@ return _this;

},
enumerable: true,
enumerable: false,
configurable: true

@@ -196,24 +226,36 @@ });

Query.prototype.getQueryParams = function () {
if (_.isEmpty(this.resultTypeList)) {
var e_1, _a;
if (this.resultTypeList.length === 0) {
throw new Error("The query does not have any result type specified. No sense in performing such a query");
}
var allParams = this.params;
_.each(this.resultTypeList, function (resultType) {
_.extend(allParams, _.get(resultType, "params"));
});
try {
for (var _b = __values(this.resultTypeList), _c = _b.next(); !_c.done; _c = _b.next()) {
var resultType = _c.value;
allParams = __assign(__assign({}, allParams), resultType === null || resultType === void 0 ? void 0 : resultType.params);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
var formattedResultTypeList = this.getFormattedResultTypeList();
if (!_.isEmpty(formattedResultTypeList)) {
_.set(allParams, "resultType", formattedResultTypeList);
if ((formattedResultTypeList === null || formattedResultTypeList === void 0 ? void 0 : formattedResultTypeList.length) > 0) {
allParams = __assign(__assign({}, allParams), { resultType: formattedResultTypeList });
}
return _.cloneDeep(allParams);
return JSON.parse(JSON.stringify(allParams));
};
Query.prototype.getFormattedResultTypeList = function () {
if (!_.every(this.resultTypeList, function (result) { return _.has(result, "resultType"); })) {
var _a;
if (!this.resultTypeList.every(function (result) { return (result === null || result === void 0 ? void 0 : result.resultType) !== undefined; })) {
return [];
}
if (_.size(this.resultTypeList) === 1) {
return _.get(_.first(this.resultTypeList), "resultType");
if (this.resultTypeList.length === 1) {
return (_a = this.resultTypeList[0]) === null || _a === void 0 ? void 0 : _a.resultType;
}
else {
return _.map(this.resultTypeList, "resultType");
return this.resultTypeList.map(function (result) { return result === null || result === void 0 ? void 0 : result.resultType; });
}

@@ -220,0 +262,0 @@ };

import { QueryParamsBase } from "./base";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare abstract class CountsBase extends QueryParamsBase {
readonly path: string;
get path(): string;
}

@@ -35,3 +35,3 @@ /**

* },
* ...
* ...a
* ]

@@ -44,3 +44,3 @@ * }

export declare class GetCounts extends CountsBase {
constructor(uriOrUriList: string | string[], args?: EventRegistryStatic.Counts.Arguments);
constructor(uriOrUriList: string | string[], args?: ER.Counts.Arguments);
}

@@ -82,3 +82,3 @@ /**

export declare class GetCountsEx extends CountsBase {
constructor(uriOrUriList: string | string[], args?: EventRegistryStatic.Counts.Arguments);
constructor(uriOrUriList: string | string[], args?: ER.Counts.Arguments);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,4 +18,15 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetCountsEx = exports.GetCounts = exports.CountsBase = void 0;
var base_1 = require("./base");

@@ -32,3 +45,3 @@ var returnInfo_1 = require("./returnInfo");

},
enumerable: true,
enumerable: false,
configurable: true

@@ -68,3 +81,3 @@ });

* },
* ...
* ...a
* ]

@@ -86,9 +99,9 @@ * }

_this.setVal("uri", uriOrUriList);
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -143,9 +156,9 @@ }

_this.setVal("uri", uriOrUriList);
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -152,0 +165,0 @@ }

import { QueryParamsBase } from "./base";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare class GetTopSharedArticles extends QueryParamsBase {
constructor(args?: EventRegistryStatic.DailyShares.Arguments);
readonly path: string;
constructor(args?: ER.DailyShares.Arguments);
get path(): string;
}
export declare class GetTopSharedEvents extends QueryParamsBase {
constructor(args?: EventRegistryStatic.DailyShares.Arguments);
readonly path: string;
constructor(args?: ER.DailyShares.Arguments);
get path(): string;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,4 +18,15 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetTopSharedEvents = exports.GetTopSharedArticles = void 0;
var moment = require("moment");

@@ -41,3 +54,3 @@ var base_1 = require("./base");

_this.setDateVal("dateEnd", date);
_this.params = _.extend({}, _this.params, returnInfo.getParams("articles"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articles"));
return _this;

@@ -49,3 +62,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -69,3 +82,3 @@ });

_this.setDateVal("dateEnd", date);
_this.params = _.extend({}, _this.params, returnInfo.getParams("events"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("events"));
return _this;

@@ -77,3 +90,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -80,0 +93,0 @@ });

@@ -1,2 +0,2 @@

export declare module Data {
export declare namespace Data {
type TranslationObject = Record<string, string>;

@@ -6,7 +6,7 @@ type Label = TranslationObject;

type Shares = Record<string, number>;
interface Item {
export interface Item {
uri: string;
label: string;
}
interface Concept {
export interface Concept {
uri: string;

@@ -20,3 +20,3 @@ type: "person" | "loc" | "org" | "wiki";

}
interface Category {
export interface Category {
uri: string;

@@ -26,3 +26,3 @@ parentUri: string;

}
interface Country {
export interface Country {
area: number;

@@ -43,5 +43,5 @@ code2: string;

}
interface Location extends Country {
export interface Location extends Country {
}
interface SourceLocation {
export interface SourceLocation {
country: Country;

@@ -57,3 +57,3 @@ featureCode: string;

}
interface EventLocation extends SourceLocation {
export interface EventLocation extends SourceLocation {
}

@@ -97,3 +97,3 @@ interface Source {

}
interface Article {
export interface Article {
/**

@@ -208,7 +208,7 @@ * Article's URI (unique article's ID - not necessarily a number)

}
interface CommonDate {
export interface CommonDate {
date: string;
freq: number;
}
interface Event {
export interface Event {
/**

@@ -275,2 +275,3 @@ * Event URI

}
export {};
}

@@ -0,0 +0,0 @@ "use strict";

@@ -47,3 +47,3 @@ import { QueryParamsBase } from "./base";

*/
compute(text: string, lang?: string): Promise<any>;
compute(text: string, lang?: string): Promise<string | import("axios").AxiosResponse<Record<string, string>, any>>;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -17,6 +19,7 @@ function __() { this.constructor = d; }

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -31,3 +34,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -54,3 +57,3 @@ if (y = 0, t) op = [op[0] & 2, t.value];

Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetEventForText = void 0;
var base_1 = require("./base");

@@ -106,6 +109,6 @@ /**

*/
GetEventForText.prototype.compute = function (text, lang) {
if (lang === void 0) { lang = "eng"; }
return __awaiter(this, void 0, void 0, function () {
GetEventForText.prototype.compute = function (text_1) {
return __awaiter(this, arguments, void 0, function (text, lang) {
var params, response;
if (lang === void 0) { lang = "eng"; }
return __generator(this, function (_a) {

@@ -118,4 +121,4 @@ switch (_a.label) {

response = _a.sent();
if (_.has(response, "topStories")) {
return [2 /*return*/, _.get(response, "topStories", [])];
if ((response === null || response === void 0 ? void 0 : response.data.topStories) !== undefined) {
return [2 /*return*/, response.data.topStories];
}

@@ -122,0 +125,0 @@ return [2 /*return*/, response];

import { AxiosResponse } from "axios";
import * as winston from "winston";
import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
import { QueryArticle } from "./queryArticle";

@@ -9,2 +8,3 @@ import { QueryArticles } from "./queryArticles";

import { QueryEvent } from "./queryEvent";
import { Logger } from "./logger";
/**

@@ -15,4 +15,3 @@ * @class EventRegistry

export declare class EventRegistry {
logger: winston.Logger;
requestLogger: winston.Logger;
logger: Logger;
private config;

@@ -26,3 +25,3 @@ private headers;

private readonly stopStatusCodes;
constructor(config?: EventRegistryStatic.Config);
constructor(config?: ER.Config);
/**

@@ -32,4 +31,4 @@ * Should all requests be logged to a file or not?

setLogging(logging: boolean): void;
readonly allowUseOfArchive: boolean;
readonly verboseOutput: boolean;
get allowUseOfArchive(): boolean;
get verboseOutput(): boolean;
/**

@@ -39,4 +38,4 @@ * Main method for executing the search queries.

*/
execQuery(query: any, allowUseOfArchive?: boolean): Promise<any>;
jsonRequestAnalytics(path: string, parameters?: any, headers?: any, cookies?: any): Promise<AxiosResponse>;
execQuery<T = ER.SuccessfulResponse<unknown>>(query: any, allowUseOfArchive?: boolean): Promise<ER.Response<T>>;
jsonRequestAnalytics<T = unknown>(path: string, parameters?: any, headers?: any, cookies?: any): Promise<AxiosResponse<T>>;
/**

@@ -47,3 +46,3 @@ * Make a request for json data

*/
jsonRequest(path: string, parameters?: any, allowUseOfArchive?: boolean): Promise<any>;
jsonRequest<T = unknown>(path: string, parameters?: any, allowUseOfArchive?: boolean): Promise<AxiosResponse<T>>;
/**

@@ -64,3 +63,3 @@ * get the number of requests that are still available for the user today. Information is only accessible after you make some query.

*/
getLastHeader(headerName: string, dfltVal?: any): any;
getLastHeader(headerName: string, dfltVal?: string): any;
/**

@@ -77,4 +76,4 @@ * print some statistics about the last executed request

*/
getUsageInfo(): Promise<EventRegistryStatic.UsageInfo>;
getServiceStatus(): Promise<EventRegistryStatic.UsageInfo>;
getUsageInfo(): Promise<ER.UsageInfo>;
getServiceStatus(): Promise<ER.UsageInfo>;
getUrl(query: QueryArticles | QueryArticle | QueryEvents | QueryEvent): string;

@@ -87,3 +86,3 @@ /**

*/
suggestConcepts(prefix: string, args?: EventRegistryStatic.SuggestConceptsArguments): Promise<any>;
suggestConcepts(prefix: string, args?: ER.SuggestConceptsArguments): Promise<unknown>;
/**

@@ -94,3 +93,3 @@ * Return a list of dmoz categories that contain the prefix

*/
suggestCategories(prefix: string, args?: EventRegistryStatic.SuggestCategoriesArguments): Promise<any>;
suggestCategories(prefix: string, args?: ER.SuggestCategoriesArguments): Promise<unknown>;
/**

@@ -101,3 +100,3 @@ * Return a list of news sources that match the prefix

*/
suggestNewsSources(prefix: string, args?: EventRegistryStatic.SuggestNewsSourcesArguments): Promise<any>;
suggestNewsSources(prefix: string, args?: ER.SuggestNewsSourcesArguments): Promise<unknown>;
/**

@@ -108,3 +107,3 @@ * Return a list of news source groups that match the prefix

*/
suggestSourceGroups(prefix: string, args?: EventRegistryStatic.SuggestSourceGroupsArguments): Promise<any>;
suggestSourceGroups(prefix: string, args?: ER.SuggestSourceGroupsArguments): Promise<unknown>;
/**

@@ -115,3 +114,3 @@ * Return a list of geo locations (cities or countries) that contain the prefix

*/
suggestLocations(prefix: string, args?: EventRegistryStatic.SuggestLocationsArguments): Promise<any>;
suggestLocations(prefix: string, args?: ER.SuggestLocationsArguments): Promise<ER.Location[]>;
/**

@@ -124,3 +123,3 @@ * Return a list of geo locations (cities or places) that are close to the provided (lat, long) values

*/
suggestLocationsAtCoordinate(latitude: number, longitude: number, radiusKm: number, args?: EventRegistryStatic.SuggestLocationsAtCoordinateArguments): Promise<any>;
suggestLocationsAtCoordinate(latitude: number, longitude: number, radiusKm: number, args?: ER.SuggestLocationsAtCoordinateArguments): Promise<unknown>;
/**

@@ -133,3 +132,3 @@ * Return a list of news sources that are close to the provided (lat, long) values

*/
suggestSourcesAtCoordinate(latitude: number, longitude: number, radiusKm: number, count?: number, ...otherParams: any[]): Promise<any>;
suggestSourcesAtCoordinate(latitude: number, longitude: number, radiusKm: number, count?: number, ...otherParams: any[]): Promise<unknown>;
/**

@@ -140,3 +139,3 @@ * Return a list of news sources that are close to the provided (lat, long) values

*/
suggestSourcesAtPlace(conceptUri: string, args?: EventRegistryStatic.SuggestSourcesAtPlaceArguments): Promise<any>;
suggestSourcesAtPlace(conceptUri: string, args?: ER.SuggestSourcesAtPlaceArguments): Promise<unknown>;
/**

@@ -148,4 +147,26 @@ * Return a list of news sources that match the prefix

*/
suggestAuthors(prefix: string, page?: number, count?: number, ...otherParams: any[]): Promise<any>;
suggestAuthors(prefix: string, page?: number, count?: number, ...otherParams: any[]): Promise<unknown>;
/**
* Return a list of event types that match the prefix
* @param prefix: input text that should be contained in the industry name
* @param page: page of results
* @param count: number of returned suggestions
*/
suggestEventTypes(prefix: string, page?: number, count?: number, ...otherParams: any[]): Promise<unknown>;
/**
* Return a list of industries that match the prefix. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
* @param prefix: input text that should be contained in the industry name
* @param page: page of results
* @param count: number of returned suggestions
*/
suggestIndustries(prefix: string, page?: number, count?: number, ...otherParams: any[]): Promise<unknown>;
/**
* Return a list of SDG uris. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
*/
getSdgUris(): Promise<unknown>;
/**
* Return a list of SASB uris. Note: SASB uris can only be used when querying mentions (QueryMentions, QueryMentionsIter)
*/
getSasbUris(): Promise<unknown>;
/**
* Return a list of concept classes that match the given prefix

@@ -155,3 +176,3 @@ * @param prefix input text that should be contained in the category name

*/
suggestConceptClasses(prefix: string, args?: EventRegistryStatic.SuggestConceptClassesArguments): Promise<any>;
suggestConceptClasses(prefix: string, args?: ER.SuggestConceptClassesArguments): Promise<unknown>;
/**

@@ -164,3 +185,3 @@ * return a concept uri that is the best match for the given concept label

*/
getConceptUri(conceptLabel: string, args?: EventRegistryStatic.GetConceptUriArguments): Promise<any>;
getConceptUri(conceptLabel: string, args?: ER.GetConceptUriArguments): Promise<any>;
/**

@@ -171,3 +192,3 @@ * Return a location uri that is the best match for the given location label

*/
getLocationUri(locationLabel: string, args?: EventRegistryStatic.GetLocationUriArguments): Promise<any>;
getLocationUri(locationLabel: string, args?: ER.GetLocationUriArguments): Promise<string>;
/**

@@ -183,7 +204,7 @@ * Return a category uri that is the best match for the given label

*/
getNewsSourceUri(sourceName: string, dataType?: EventRegistryStatic.DataType[] | EventRegistryStatic.DataType): Promise<any>;
getNewsSourceUri(sourceName: string, dataType?: ER.DataType[] | ER.DataType): Promise<any>;
/**
* alternative (shorter) name for the method getNewsSourceUri()
*/
getSourceUri(sourceName: string, dataType?: EventRegistryStatic.DataType[] | EventRegistryStatic.DataType): Promise<any>;
getSourceUri(sourceName: string, dataType?: ER.DataType[] | ER.DataType): Promise<any>;
/**

@@ -205,3 +226,3 @@ * Return the URI of the source group that best matches the name

*/
getConceptInfo(conceptUri: string, returnInfo?: ReturnInfo): Promise<any>;
getConceptInfo(conceptUri: string, returnInfo?: ReturnInfo): Promise<unknown>;
/**

@@ -218,12 +239,11 @@ * return author uri that is the best match for the given author name (and potentially source url)

*/
getArticleUris(articleUrls: string | string[]): Promise<any>;
getArticleUris(articleUrls: string | string[]): Promise<unknown>;
/**
* Return information about the latest imported article
*/
getSourceGroups(): Promise<any>;
getSourceGroups(): Promise<unknown>;
/**
* Return info about the source group
*/
getSourceGroup(sourceGroupUri: string): Promise<any>;
private initRequestLogger;
getSourceGroup(sourceGroupUri: string): Promise<unknown>;
}

@@ -230,0 +250,0 @@ /**

@@ -14,6 +14,7 @@ "use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -28,3 +29,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -55,15 +56,17 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArticleMapper = exports.EventRegistry = void 0;
var axios_1 = require("axios");
var fs = require("fs");
var _ = require("lodash");
var moment = require("moment");
var semaphore_async_await_1 = require("semaphore-async-await");
var winston = require("winston");
var returnInfo_1 = require("./returnInfo");
var base_1 = require("./base");
var logger_1 = require("./logger");
/**

@@ -77,2 +80,3 @@ * @class EventRegistry

var _this = this;
var _a, _b;
this.config = {

@@ -100,12 +104,9 @@ host: "http://eventregistry.org",

this.lock = new semaphore_async_await_1.default(1);
if (!!config.apiKey && !!config.printHostInfo) {
console.log("using user provided API key for making requests");
}
this._logRequests = this.config.logging;
this.logger = logger_1.Logger.createInstance({ logging: this.config.logging, logRequests: this._logRequests });
if (fs && fs.existsSync(this.config.settingsFName || "settings.json")) {
var localConfig = JSON.parse(fs.readFileSync(this.config.settingsFName || "settings.json", "utf8"));
this.config = __assign({}, this.config, localConfig, config);
if (!_.isNil(config.apiKey)) {
if (!!config.printHostInfo) {
console.log("found apiKey in settings file which will be used for making requests");
}
this.config = __assign(__assign(__assign({}, this.config), localConfig), config);
if ((config === null || config === void 0 ? void 0 : config.apiKey) !== undefined) {
this.logger.debug("found apiKey in settings file which will be used for making requests");
this.config.apiKey = config.apiKey;

@@ -115,26 +116,12 @@ }

else {
this.config = __assign({}, this.config, config);
this.config = __assign(__assign({}, this.config), config);
if (!!config.apiKey) {
this.logger.debug("using user provided API key for making requests");
}
}
if (this.config.logging) {
this.logger = winston.createLogger({
level: "info",
format: winston.format.json(),
transports: [
new winston.transports.File({
filename: "logs/error.log",
level: "error",
}),
new winston.transports.File({ filename: "logs/info.log" }),
],
});
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) {
this.logger.info("No API key was provided. You will be allowed to perform only a very limited number of requests per day.");
}
this._logRequests = this.config.logging;
this.initRequestLogger();
if (_.isNil(this.config.apiKey)) {
console.info("No API key was provided. You will be allowed to perform only a very limited number of requests per day.");
}
if (!!config.printHostInfo) {
console.log("Event Registry host: " + config.host);
console.log("Text analytics host: " + config.hostAnalytics);
}
this.logger.debug("Event Registry host: ".concat(this.config.host));
this.logger.debug("Text analytics host: ".concat(this.config.hostAnalytics));
this.config.minDelayBetweenRequests *= 1000;

@@ -146,3 +133,3 @@ axios_1.default.interceptors.response.use(undefined, function (err) {

}
if (_.includes(_this.stopStatusCodes, err.response.status)) {
if (_this.stopStatusCodes.includes(err.response.status)) {
return Promise.reject(err);

@@ -160,3 +147,3 @@ }

setTimeout(function () { return resolve(); }, err.config.retryDelay || 1);
}).then(function () { return axios_1.default(err.config); });
}).then(function () { return (0, axios_1.default)(err.config); });
});

@@ -169,3 +156,3 @@ }

this._logRequests = logging;
this.initRequestLogger();
this.logger.toggleRequestLogging(logging);
};

@@ -176,3 +163,3 @@ Object.defineProperty(EventRegistry.prototype, "allowUseOfArchive", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -184,3 +171,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -192,8 +179,9 @@ });

*/
EventRegistry.prototype.execQuery = function (query, allowUseOfArchive) {
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.execQuery = function (query_1) {
return __awaiter(this, arguments, void 0, function (query, allowUseOfArchive) {
var params, request;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -203,7 +191,7 @@ params = query.getQueryParams();

case 1:
request = _a.sent();
if (!_.has(request, "data") && this.config.verboseOutput) {
request = _b.sent();
if (!(request === null || request === void 0 ? void 0 : request.data) && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.verboseOutput)) {
this.logger.error("Request did not return with the 'data' property.");
}
return [2 /*return*/, _.get(request, "data", {})];
return [2 /*return*/, ((request === null || request === void 0 ? void 0 : request.data) || {})];
}

@@ -216,11 +204,12 @@ });

var request, args, cookieString, errorMessage, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b, _c, _d, _e, _f;
return __generator(this, function (_g) {
switch (_g.label) {
case 0: return [4 /*yield*/, this.lock.acquire()];
case 1:
_a.sent();
_a.label = 2;
_g.sent();
_g.label = 2;
case 2:
_a.trys.push([2, 4, 5, 6]);
_.set(parameters, "apiKey", this.config.apiKey);
_g.trys.push([2, 4, 5, 6]);
parameters = __assign(__assign({}, parameters), { apiKey: (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiKey });
args = {

@@ -236,16 +225,16 @@ url: path,

if (!!headers) {
_.set(args, "headers", headers);
args = __assign(__assign({}, args), { headers: headers });
}
if (!!cookies) {
cookieString = Object.keys(cookies).map(function (key) { return key + "=" + cookies[key]; }).join(";") + ";";
_.set(args, "headers.Cookie", cookieString);
args = __assign(__assign({}, args), { headers: __assign(__assign({}, args.headers), { Cookie: cookieString }) });
}
return [4 /*yield*/, axios_1.default.request(args)];
case 3:
request = _a.sent();
this.headers = _.get(request, "headers", {});
if (_.get(request, "status") !== 200) {
throw new Error(_.get(request, "statusText"));
request = _g.sent();
this.headers = (request === null || request === void 0 ? void 0 : request.headers) || {};
if ((request === null || request === void 0 ? void 0 : request.status) !== 200) {
throw new Error(request === null || request === void 0 ? void 0 : request.statusText);
}
errorMessage = _.get(request, "data.error", "");
errorMessage = ((_b = request === null || request === void 0 ? void 0 : request.data) === null || _b === void 0 ? void 0 : _b.error) || "";
if (errorMessage) {

@@ -256,16 +245,16 @@ throw new Error(errorMessage);

case 4:
error_1 = _a.sent();
error_1 = _g.sent();
request = { data: { error: error_1 } };
if (this.config.verboseOutput) {
console.error("Event Registry Analytics exception while executing the request.");
this.logger.error("Event Registry Analytics exception while executing the request.");
if (error_1 && error_1.stack && error_1.message) {
console.error(error_1.message);
this.logger.error(error_1.message);
}
else {
console.error(_.get(error_1, "response.status") + ": " + _.get(error_1, "response.statusText") + " => " + _.get(error_1, "response.data"));
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));
}
}
// try to print out the error that should be passed by in case the server is down or responds with errors
if (this.config.logging) {
this.logger.error(_.get(error_1, "errno", error_1));
if ((_f = this.config) === null || _f === void 0 ? void 0 : _f.logging) {
this.logger.error((error_1 === null || error_1 === void 0 ? void 0 : error_1.errno) || error_1);
}

@@ -286,31 +275,32 @@ return [3 /*break*/, 6];

*/
EventRegistry.prototype.jsonRequest = function (path, parameters, allowUseOfArchive) {
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.jsonRequest = function (path_1, parameters_1) {
return __awaiter(this, arguments, void 0, function (path, parameters, allowUseOfArchive) {
var request, current, errorMessage, error_2;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b, _c, _d, _e, _f;
if (allowUseOfArchive === void 0) { allowUseOfArchive = this.config.allowUseOfArchive; }
return __generator(this, function (_g) {
switch (_g.label) {
case 0:
current = moment.utc().milliseconds();
if (!(this.lastQueryTime && current - this.lastQueryTime < this.config.minDelayBetweenRequests)) return [3 /*break*/, 2];
return [4 /*yield*/, base_1.sleep(this.config.minDelayBetweenRequests - (current - this.lastQueryTime))];
return [4 /*yield*/, (0, base_1.sleep)(this.config.minDelayBetweenRequests - (current - this.lastQueryTime))];
case 1:
_a.sent();
_a.label = 2;
_g.sent();
_g.label = 2;
case 2: return [4 /*yield*/, this.lock.acquire()];
case 3:
_a.sent();
_g.sent();
if (this._logRequests) {
if (!_.isEmpty(parameters)) {
this.requestLogger.info("# " + JSON.stringify(parameters) + "\n");
if (Object.keys(parameters || {}).length > 0) {
this.logger.logRequest("# " + JSON.stringify(parameters) + "\n");
}
this.requestLogger.info(path + "\n\n");
this.logger.logRequest(path + "\n\n");
}
this.lastQueryTime = current;
_a.label = 4;
_g.label = 4;
case 4:
_a.trys.push([4, 6, 7, 8]);
_.set(parameters, "apiKey", this.config.apiKey);
_g.trys.push([4, 6, 7, 8]);
parameters = __assign(__assign({}, parameters), { apiKey: (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiKey });
if (!allowUseOfArchive) {
_.set(parameters, "forceMaxDataTimeWindow", 31);
parameters = __assign(__assign({}, parameters), { forceMaxDataTimeWindow: 31 });
}

@@ -328,13 +318,13 @@ return [4 /*yield*/, axios_1.default.request({

case 5:
request = _a.sent();
this.headers = _.get(request, "headers", {});
if (_.get(request, "status") !== 200) {
throw new Error(_.get(request, "statusText"));
request = _g.sent();
this.headers = (request === null || request === void 0 ? void 0 : request.headers) || {};
if ((request === null || request === void 0 ? void 0 : request.status) !== 200) {
throw new Error(request === null || request === void 0 ? void 0 : request.statusText);
}
if (this.getLastHeader("warning")) {
console.warn("WARNING: " + this.getLastHeader("warning"));
this.logger.warn("WARNING: ".concat(this.getLastHeader("warning")));
}
this.dailyAvailableRequests = _.toNumber(this.getLastHeader("x-ratelimit-limit", "-1"));
this.remainingAvailableRequests = _.toNumber(this.getLastHeader("x-ratelimit-remaining", "-1"));
errorMessage = _.get(request, "data.error", "");
this.dailyAvailableRequests = Number(this.getLastHeader("x-ratelimit-limit", "-1"));
this.remainingAvailableRequests = Number(this.getLastHeader("x-ratelimit-remaining", "-1"));
errorMessage = ((_b = request === null || request === void 0 ? void 0 : request.data) === null || _b === void 0 ? void 0 : _b.error) || "";
if (errorMessage) {

@@ -345,16 +335,16 @@ throw new Error(errorMessage);

case 6:
error_2 = _a.sent();
error_2 = _g.sent();
request = { data: { error: error_2 } };
// try to print out the error that should be passed by in case the server is down or responds with errors
if (this.config.verboseOutput) {
console.error("Event Registry exception while executing the request.");
this.logger.error("Event Registry exception while executing the request.");
if (error_2 && error_2.stack && error_2.message) {
console.error(error_2.message);
this.logger.error(error_2.message);
}
else {
console.error(_.get(error_2, "response.status") + ": " + _.get(error_2, "response.statusText") + " => " + _.get(error_2, "response.data"));
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));
}
}
if (this.config.logging) {
this.logger.error(_.get(error_2, "errno", error_2));
if ((_f = this.config) === null || _f === void 0 ? void 0 : _f.logging) {
this.logger.error((error_2 === null || error_2 === void 0 ? void 0 : error_2.errno) || error_2);
}

@@ -392,3 +382,4 @@ return [3 /*break*/, 8];

EventRegistry.prototype.getLastHeader = function (headerName, dfltVal) {
return _.get(this.headers, headerName, dfltVal);
var _a, _b;
return (_b = (_a = this.headers) === null || _a === void 0 ? void 0 : _a[headerName]) !== null && _b !== void 0 ? _b : dfltVal;
};

@@ -399,5 +390,5 @@ /**

EventRegistry.prototype.printLastReqStats = function () {
console.log("Tokens used by the request: " + this.getLastHeader("req-tokens"));
console.log("Performed action: " + this.getLastHeader("req-action"));
console.log("Was archive used for the query: " + (this.getLastReqArchiveUse() ? "Yes" : "No"));
this.logger.info("Tokens used by the request: ".concat(this.getLastHeader("req-tokens")));
this.logger.info("Performed action: ".concat(this.getLastHeader("req-action")));
this.logger.info("Was archive used for the query: ".concat(this.getLastReqArchiveUse() ? "Yes" : "No"));
};

@@ -440,9 +431,10 @@ /**

EventRegistry.prototype.getUrl = function (query) {
var _a;
if (!(query instanceof base_1.QueryParamsBase)) {
if (this.config.verboseOutput) {
console.warn("query parameter should be an instance of a class that has Query as a base class, such as QueryArticles or QueryEvents");
this.logger.warn("query parameter should be an instance of a class that has Query as a base class, such as QueryArticles or QueryEvents");
}
}
var allParams = query.getQueryParams();
return this.config.host + query.path + "?" + _.join(_.map(_.keys(allParams), function (key) { return key + "=" + allParams[key]; }), "&");
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("&"));
};

@@ -455,6 +447,6 @@ /**

*/
EventRegistry.prototype.suggestConcepts = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestConcepts = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, sources, _b, lang, _c, conceptLang, _d, page, _e, count, _f, returnInfo, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_g) {

@@ -475,3 +467,3 @@ switch (_g.label) {

};
params = _.extend({}, params, otherParams, returnInfo.getParams());
params = __assign(__assign(__assign({}, params), otherParams), returnInfo.getParams());
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestConceptsFast", params)];

@@ -490,6 +482,6 @@ case 1:

*/
EventRegistry.prototype.suggestCategories = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestCategories = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, page, _b, count, _c, returnInfo, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {

@@ -503,3 +495,3 @@ switch (_d.label) {

params = { prefix: prefix, page: page, count: count };
params = _.extend({}, params, otherParams, returnInfo.getParams());
params = __assign(__assign(__assign({}, params), otherParams), returnInfo.getParams());
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestCategoriesFast", params)];

@@ -518,6 +510,6 @@ case 1:

*/
EventRegistry.prototype.suggestNewsSources = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestNewsSources = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, page, _b, count, _c, dataType, otherParams, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {

@@ -543,6 +535,6 @@ switch (_d.label) {

*/
EventRegistry.prototype.suggestSourceGroups = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestSourceGroups = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, page, _b, count, otherParams, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_c) {

@@ -568,6 +560,6 @@ switch (_c.label) {

*/
EventRegistry.prototype.suggestLocations = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestLocations = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, sources, _b, lang, _c, count, _d, countryUri, sortByDistanceTo, _e, returnInfo, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_f) {

@@ -584,8 +576,8 @@ switch (_f.label) {

};
params = _.extend({}, params, otherParams, returnInfo.getParams());
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
if (sortByDistanceTo) {
if (!_.isArray(sortByDistanceTo)) {
if (!Array.isArray(sortByDistanceTo)) {
throw new Error("sortByDistanceTo has to contain a tuple with latitude and longitude of the location");
}
if (_.size(sortByDistanceTo) !== 2) {
if (sortByDistanceTo.length !== 2) {
throw new Error("The sortByDistanceTo should contain two numbers");

@@ -599,3 +591,3 @@ }

request = _f.sent();
return [2 /*return*/, request.data];
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
}

@@ -612,6 +604,6 @@ });

*/
EventRegistry.prototype.suggestLocationsAtCoordinate = function (latitude, longitude, radiusKm, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestLocationsAtCoordinate = function (latitude_1, longitude_1, radiusKm_1) {
return __awaiter(this, arguments, void 0, function (latitude, longitude, radiusKm, args) {
var _a, limitToCities, _b, lang, _c, count, _d, ignoreNonWiki, _e, returnInfo, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_f) {

@@ -621,6 +613,6 @@ switch (_f.label) {

_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"]);
if (!_.isNumber(latitude)) {
if (typeof latitude !== "number") {
throw new Error("The 'latitude' should be a number");
}
if (!_.isNumber(longitude)) {
if (typeof longitude !== "number") {
throw new Error("The 'longitude' should be a number");

@@ -637,7 +629,7 @@ }

};
params = _.extend({}, params, otherParams, returnInfo.getParams());
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestLocationsFast", params)];
case 1:
request = _f.sent();
return [2 /*return*/, request.data];
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
}

@@ -654,17 +646,17 @@ });

*/
EventRegistry.prototype.suggestSourcesAtCoordinate = function (latitude, longitude, radiusKm, count) {
if (count === void 0) { count = 20; }
var otherParams = [];
for (var _i = 4; _i < arguments.length; _i++) {
otherParams[_i - 4] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var params, request;
EventRegistry.prototype.suggestSourcesAtCoordinate = function (latitude_1, longitude_1, radiusKm_1) {
return __awaiter(this, arguments, void 0, function (latitude, longitude, radiusKm, count) {
var _i, params, request;
if (count === void 0) { count = 20; }
var otherParams = [];
for (_i = 4; _i < arguments.length; _i++) {
otherParams[_i - 4] = arguments[_i];
}
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!_.isNumber(latitude)) {
if (typeof latitude !== "number") {
throw new Error("The 'latitude' should be a number");
}
if (!_.isNumber(longitude)) {
if (typeof longitude !== "number") {
throw new Error("The 'longitude' should be a number");

@@ -676,3 +668,3 @@ }

request = _a.sent();
return [2 /*return*/, request.data];
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
}

@@ -687,6 +679,6 @@ });

*/
EventRegistry.prototype.suggestSourcesAtPlace = function (conceptUri, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestSourcesAtPlace = function (conceptUri_1) {
return __awaiter(this, arguments, void 0, function (conceptUri, args) {
var _a, page, _b, count, _c, dataType, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {

@@ -711,11 +703,11 @@ switch (_d.label) {

*/
EventRegistry.prototype.suggestAuthors = function (prefix, page, count) {
if (page === void 0) { page = 1; }
if (count === void 0) { count = 20; }
var otherParams = [];
for (var _i = 3; _i < arguments.length; _i++) {
otherParams[_i - 3] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var params, request;
EventRegistry.prototype.suggestAuthors = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
var _i, params, request;
if (page === void 0) { page = 1; }
if (count === void 0) { count = 20; }
var otherParams = [];
for (_i = 3; _i < arguments.length; _i++) {
otherParams[_i - 3] = arguments[_i];
}
return __generator(this, function (_a) {

@@ -727,5 +719,3 @@ switch (_a.label) {

}
params = __assign({ prefix: prefix,
page: page,
count: count }, otherParams);
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestAuthorsFast", params)];

@@ -740,2 +730,94 @@ case 1:

/**
* Return a list of event types that match the prefix
* @param prefix: input text that should be contained in the industry name
* @param page: page of results
* @param count: number of returned suggestions
*/
EventRegistry.prototype.suggestEventTypes = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
var _i, params, request;
if (page === void 0) { page = 1; }
if (count === void 0) { count = 20; }
var otherParams = [];
for (_i = 3; _i < arguments.length; _i++) {
otherParams[_i - 3] = arguments[_i];
}
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (page <= 0) {
throw new Error("Page parameter should be above 0.");
}
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/suggestEventTypes", params)];
case 1:
request = _a.sent();
return [2 /*return*/, request.data];
}
});
});
};
/**
* Return a list of industries that match the prefix. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
* @param prefix: input text that should be contained in the industry name
* @param page: page of results
* @param count: number of returned suggestions
*/
EventRegistry.prototype.suggestIndustries = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, page, count) {
var _i, params, request;
if (page === void 0) { page = 1; }
if (count === void 0) { count = 20; }
var otherParams = [];
for (_i = 3; _i < arguments.length; _i++) {
otherParams[_i - 3] = arguments[_i];
}
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (page <= 0) {
throw new Error("Page parameter should be above 0.");
}
params = __assign({ prefix: prefix, page: page, count: count }, otherParams);
return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/suggestIndustries", params)];
case 1:
request = _a.sent();
return [2 /*return*/, request.data];
}
});
});
};
/**
* Return a list of SDG uris. Note: Industries can only be used when querying mentions (QueryMentions, QueryMentionsIter)
*/
EventRegistry.prototype.getSdgUris = function () {
return __awaiter(this, void 0, void 0, function () {
var request;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/sdg/getItems")];
case 1:
request = _a.sent();
return [2 /*return*/, request.data];
}
});
});
};
/**
* Return a list of SASB uris. Note: SASB uris can only be used when querying mentions (QueryMentions, QueryMentionsIter)
*/
EventRegistry.prototype.getSasbUris = function () {
return __awaiter(this, void 0, void 0, function () {
var request;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.jsonRequest("/api/v1/eventType/sasb/getItems")];
case 1:
request = _a.sent();
return [2 /*return*/, request.data];
}
});
});
};
/**
* Return a list of concept classes that match the given prefix

@@ -745,6 +827,6 @@ * @param prefix input text that should be contained in the category name

*/
EventRegistry.prototype.suggestConceptClasses = function (prefix, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.suggestConceptClasses = function (prefix_1) {
return __awaiter(this, arguments, void 0, function (prefix, args) {
var _a, lang, _b, conceptLang, _c, source, _d, page, _e, count, _f, returnInfo, otherParams, params, request;
if (args === void 0) { args = {}; }
return __generator(this, function (_g) {

@@ -758,7 +840,7 @@ switch (_g.label) {

params = { prefix: prefix, lang: lang, conceptLang: conceptLang, source: source, page: page, count: count };
params = _.extend({}, params, otherParams, returnInfo.getParams());
params = __assign(__assign(__assign({}, params), otherParams), returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams());
return [4 /*yield*/, this.jsonRequest("/api/v1/suggestConceptClasses", params)];
case 1:
request = _g.sent();
return [2 /*return*/, request.data];
return [2 /*return*/, request === null || request === void 0 ? void 0 : request.data];
}

@@ -775,8 +857,9 @@ });

*/
EventRegistry.prototype.getConceptUri = function (conceptLabel, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.getConceptUri = function (conceptLabel_1) {
return __awaiter(this, arguments, void 0, function (conceptLabel, args) {
var _a, lang, _b, sources, matches;
return __generator(this, function (_c) {
switch (_c.label) {
var _c;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {
switch (_d.label) {
case 0:

@@ -786,4 +869,4 @@ _a = args.lang, lang = _a === void 0 ? "eng" : _a, _b = args.sources, sources = _b === void 0 ? ["concepts"] : _b;

case 1:
matches = _c.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _d.sent();
return [2 /*return*/, (_c = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _c === void 0 ? void 0 : _c.uri];
}

@@ -798,8 +881,9 @@ });

*/
EventRegistry.prototype.getLocationUri = function (locationLabel, args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.getLocationUri = function (locationLabel_1) {
return __awaiter(this, arguments, void 0, function (locationLabel, args) {
var _a, lang, _b, sources, countryUri, sortByDistanceTo, matches;
return __generator(this, function (_c) {
switch (_c.label) {
var _c;
if (args === void 0) { args = {}; }
return __generator(this, function (_d) {
switch (_d.label) {
case 0:

@@ -809,4 +893,4 @@ _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;

case 1:
matches = _c.sent();
return [2 /*return*/, _.get(_.first(matches), "wikiUri", undefined)];
matches = _d.sent();
return [2 /*return*/, (_c = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _c === void 0 ? void 0 : _c.wikiUri];
}

@@ -823,8 +907,9 @@ });

var matches;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.suggestCategories(categoryLabel)];
case 1:
matches = _a.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _b.sent();
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
}

@@ -839,12 +924,13 @@ });

*/
EventRegistry.prototype.getNewsSourceUri = function (sourceName, dataType) {
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.getNewsSourceUri = function (sourceName_1) {
return __awaiter(this, arguments, void 0, function (sourceName, dataType) {
var matches;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.suggestNewsSources(sourceName, { dataType: dataType })];
case 1:
matches = _a.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _b.sent();
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
}

@@ -857,5 +943,5 @@ });

*/
EventRegistry.prototype.getSourceUri = function (sourceName, dataType) {
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.getSourceUri = function (sourceName_1) {
return __awaiter(this, arguments, void 0, function (sourceName, dataType) {
if (dataType === void 0) { dataType = ["news", "pr", "blog"]; }
return __generator(this, function (_a) {

@@ -876,8 +962,9 @@ switch (_a.label) {

var matches;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.suggestSourceGroups(sourceGroupName)];
case 1:
matches = _a.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _b.sent();
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
}

@@ -892,12 +979,13 @@ });

*/
EventRegistry.prototype.getConceptClassUri = function (classLabel, lang) {
if (lang === void 0) { lang = "eng"; }
return __awaiter(this, void 0, void 0, function () {
EventRegistry.prototype.getConceptClassUri = function (classLabel_1) {
return __awaiter(this, arguments, void 0, function (classLabel, lang) {
var matches;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
if (lang === void 0) { lang = "eng"; }
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.suggestConceptClasses(classLabel, { lang: lang })];
case 1:
matches = _a.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _b.sent();
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
}

@@ -915,4 +1003,5 @@ });

var conceptInfo, params, request;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -927,6 +1016,6 @@ if (!returnInfo) {

};
params = _.extend({}, params, returnInfo.getParams());
params = __assign(__assign({}, params), ((_a = returnInfo === null || returnInfo === void 0 ? void 0 : returnInfo.getParams()) !== null && _a !== void 0 ? _a : {}));
return [4 /*yield*/, this.jsonRequest("/api/v1/concept/getInfo", params)];
case 1:
request = _a.sent();
request = _b.sent();
return [2 /*return*/, request.data];

@@ -945,8 +1034,9 @@ }

var matches;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.suggestAuthors(authorName)];
case 1:
matches = _a.sent();
return [2 /*return*/, _.get(_.first(matches), "uri", undefined)];
matches = _b.sent();
return [2 /*return*/, (_a = matches === null || matches === void 0 ? void 0 : matches[0]) === null || _a === void 0 ? void 0 : _a.uri];
}

@@ -957,6 +1047,6 @@ });

EventRegistry.getUriFromUriWgt = function (uriWgtList) {
if (!_.isArray(uriWgtList)) {
if (!Array.isArray(uriWgtList)) {
throw new Error("uriWgtList has to be a list of strings that represent article uris");
}
return _.map(uriWgtList, function (uriWgt) { return _.first(_.split(uriWgt, ":")); });
return uriWgtList.map(function (uriWgt) { return uriWgt.split(":")[0]; });
};

@@ -974,3 +1064,3 @@ // Additional utility functions

case 0:
if (!_.isArray(articleUrls) && !_.isString(articleUrls)) {
if (!Array.isArray(articleUrls) && typeof articleUrls !== "string") {
throw new Error("Expected a single article url or a list of urls");

@@ -1018,13 +1108,2 @@ }

};
EventRegistry.prototype.initRequestLogger = function () {
if (this._logRequests && _.isUndefined(this.requestLogger)) {
this.requestLogger = winston.createLogger({
level: "info",
format: winston.format.json(),
transports: [
new winston.transports.File({ filename: "logs/requests.log" }),
],
});
}
};
return EventRegistry;

@@ -1055,14 +1134,15 @@ }());

var response, value;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (_.has(this.articleUrlToUri, articleUrl)) {
return [2 /*return*/, _.get(this.articleUrlToUri, articleUrl)];
if (this.articleUrlToUri.hasOwnProperty(articleUrl)) {
return [2 /*return*/, this.articleUrlToUri[articleUrl]];
}
return [4 /*yield*/, this.er.getArticleUris(articleUrl)];
case 1:
response = _a.sent();
value = _.get(response, articleUrl, undefined);
response = _b.sent();
value = response === null || response === void 0 ? void 0 : response[articleUrl];
if (this.rememberMappings && value) {
this.articleUrlToUri[articleUrl] = value;
this.articleUrlToUri = __assign(__assign({}, this.articleUrlToUri), (_a = {}, _a[articleUrl] = value, _a));
}

@@ -1069,0 +1149,0 @@ return [2 /*return*/, value];

@@ -8,3 +8,3 @@ export { Analytics } from "./analytics";

export { sleep, mainLangs, allLangs } from "./base";
export { EventRegistryStatic } from "./types";
export { ER } from "./types";
export { GetSourceInfo, GetConceptInfo, GetCategoryInfo, GetSourceStats, } from "./info";

@@ -22,1 +22,2 @@ export { BaseQuery, CombinedQuery, ComplexArticleQuery, ComplexEventQuery, } from "./query";

export { TopicPage, } from "./topicPage";
export { LogLevel, Logger, } from "./logger";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryEvents = exports.RequestEventSimilarEvents = exports.RequestEventArticleTrend = exports.RequestEventDateMentionAggr = exports.RequestEventSourceAggr = exports.RequestEventKeywordAggr = exports.RequestEventArticleUriWgts = exports.RequestEventArticles = exports.RequestEventInfo = exports.QueryEventArticlesIter = exports.QueryEvent = exports.RequestArticlesRecentActivity = exports.RequestArticlesDateMentionAggr = exports.RequestArticlesConceptTrends = exports.RequestArticlesConceptMatrix = exports.RequestArticlesConceptGraph = exports.RequestArticlesKeywordAggr = exports.RequestArticlesSourceAggr = exports.RequestArticlesCategoryAggr = exports.RequestArticlesConceptAggr = exports.RequestArticlesTimeAggr = exports.RequestArticlesUriWgtList = exports.RequestArticlesInfo = exports.QueryArticlesIter = exports.QueryArticles = exports.RequestArticleOriginalArticle = exports.RequestArticleDuplicatedArticles = exports.RequestArticleSimilarArticles = exports.RequestArticleInfo = exports.QueryArticle = exports.ComplexEventQuery = exports.ComplexArticleQuery = exports.CombinedQuery = exports.BaseQuery = exports.GetSourceStats = exports.GetCategoryInfo = exports.GetConceptInfo = exports.GetSourceInfo = exports.allLangs = exports.mainLangs = exports.sleep = exports.ArticleMapper = exports.EventRegistry = exports.GetEventForText = exports.GetTopSharedEvents = exports.GetTopSharedArticles = exports.GetCountsEx = exports.GetCounts = exports.QueryItems = exports.Analytics = void 0;
exports.GetTrendingConceptGroups = exports.GetTrendingCustomItems = exports.GetTrendingCategories = exports.GetTrendingConcepts = exports.ConceptFolderInfoFlags = exports.ConceptClassInfoFlags = exports.LocationInfoFlags = exports.ConceptInfoFlags = exports.CategoryInfoFlags = exports.SourceInfoFlags = exports.EventInfoFlags = exports.StoryInfoFlags = exports.ArticleInfoFlags = exports.ReturnInfo = exports.GetRecentArticles = exports.GetRecentEvents = exports.RequestStorySimilarStories = exports.RequestStoryArticleTrend = exports.RequestStoryArticleUris = exports.RequestStoryArticles = exports.RequestStoryInfo = exports.QueryStory = exports.RequestMentionsRecentActivity = exports.RequestMentionsConceptGraph = exports.RequestMentionsKeywordAggr = exports.RequestMentionsSourceAggr = exports.RequestMentionsCategoryAggr = exports.RequestMentionsConceptAggr = exports.RequestMentionsTimeAggr = exports.RequestMentionsUriWgtList = exports.RequestMentionsInfo = exports.RequestMentions = exports.QueryMentionsIter = exports.QueryMentions = exports.RequestEventsRecentActivity = exports.RequestEventsCategoryAggr = exports.RequestEventsEventClusters = exports.RequestEventsDateMentionAggr = exports.RequestEventsSourceAggr = exports.RequestEventsConceptTrends = exports.RequestEventsConceptMatrix = exports.RequestEventsConceptGraph = exports.RequestEventsConceptAggr = exports.RequestEventsLocTimeAggr = exports.RequestEventsLocAggr = exports.RequestEventsKeywordAggr = exports.RequestEventsTimeAggr = exports.RequestEventsUriWgtList = exports.RequestEventsInfo = exports.QueryEventsIter = void 0;
exports.Logger = exports.LogLevel = exports.TopicPage = void 0;
var analytics_1 = require("./analytics");
exports.Analytics = analytics_1.Analytics;
Object.defineProperty(exports, "Analytics", { enumerable: true, get: function () { return analytics_1.Analytics; } });
var base_1 = require("./base");
exports.QueryItems = base_1.QueryItems;
Object.defineProperty(exports, "QueryItems", { enumerable: true, get: function () { return base_1.QueryItems; } });
var counts_1 = require("./counts");
exports.GetCounts = counts_1.GetCounts;
exports.GetCountsEx = counts_1.GetCountsEx;
Object.defineProperty(exports, "GetCounts", { enumerable: true, get: function () { return counts_1.GetCounts; } });
Object.defineProperty(exports, "GetCountsEx", { enumerable: true, get: function () { return counts_1.GetCountsEx; } });
var dailyShares_1 = require("./dailyShares");
exports.GetTopSharedArticles = dailyShares_1.GetTopSharedArticles;
exports.GetTopSharedEvents = dailyShares_1.GetTopSharedEvents;
Object.defineProperty(exports, "GetTopSharedArticles", { enumerable: true, get: function () { return dailyShares_1.GetTopSharedArticles; } });
Object.defineProperty(exports, "GetTopSharedEvents", { enumerable: true, get: function () { return dailyShares_1.GetTopSharedEvents; } });
var eventForText_1 = require("./eventForText");
exports.GetEventForText = eventForText_1.GetEventForText;
Object.defineProperty(exports, "GetEventForText", { enumerable: true, get: function () { return eventForText_1.GetEventForText; } });
var eventRegistry_1 = require("./eventRegistry");
exports.EventRegistry = eventRegistry_1.EventRegistry;
exports.ArticleMapper = eventRegistry_1.ArticleMapper;
Object.defineProperty(exports, "EventRegistry", { enumerable: true, get: function () { return eventRegistry_1.EventRegistry; } });
Object.defineProperty(exports, "ArticleMapper", { enumerable: true, get: function () { return eventRegistry_1.ArticleMapper; } });
var base_2 = require("./base");
exports.sleep = base_2.sleep;
exports.mainLangs = base_2.mainLangs;
exports.allLangs = base_2.allLangs;
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return base_2.sleep; } });
Object.defineProperty(exports, "mainLangs", { enumerable: true, get: function () { return base_2.mainLangs; } });
Object.defineProperty(exports, "allLangs", { enumerable: true, get: function () { return base_2.allLangs; } });
var info_1 = require("./info");
exports.GetSourceInfo = info_1.GetSourceInfo;
exports.GetConceptInfo = info_1.GetConceptInfo;
exports.GetCategoryInfo = info_1.GetCategoryInfo;
exports.GetSourceStats = info_1.GetSourceStats;
Object.defineProperty(exports, "GetSourceInfo", { enumerable: true, get: function () { return info_1.GetSourceInfo; } });
Object.defineProperty(exports, "GetConceptInfo", { enumerable: true, get: function () { return info_1.GetConceptInfo; } });
Object.defineProperty(exports, "GetCategoryInfo", { enumerable: true, get: function () { return info_1.GetCategoryInfo; } });
Object.defineProperty(exports, "GetSourceStats", { enumerable: true, get: function () { return info_1.GetSourceStats; } });
var query_1 = require("./query");
exports.BaseQuery = query_1.BaseQuery;
exports.CombinedQuery = query_1.CombinedQuery;
exports.ComplexArticleQuery = query_1.ComplexArticleQuery;
exports.ComplexEventQuery = query_1.ComplexEventQuery;
Object.defineProperty(exports, "BaseQuery", { enumerable: true, get: function () { return query_1.BaseQuery; } });
Object.defineProperty(exports, "CombinedQuery", { enumerable: true, get: function () { return query_1.CombinedQuery; } });
Object.defineProperty(exports, "ComplexArticleQuery", { enumerable: true, get: function () { return query_1.ComplexArticleQuery; } });
Object.defineProperty(exports, "ComplexEventQuery", { enumerable: true, get: function () { return query_1.ComplexEventQuery; } });
var queryArticle_1 = require("./queryArticle");
exports.QueryArticle = queryArticle_1.QueryArticle;
exports.RequestArticleInfo = queryArticle_1.RequestArticleInfo;
exports.RequestArticleSimilarArticles = queryArticle_1.RequestArticleSimilarArticles;
exports.RequestArticleDuplicatedArticles = queryArticle_1.RequestArticleDuplicatedArticles;
exports.RequestArticleOriginalArticle = queryArticle_1.RequestArticleOriginalArticle;
Object.defineProperty(exports, "QueryArticle", { enumerable: true, get: function () { return queryArticle_1.QueryArticle; } });
Object.defineProperty(exports, "RequestArticleInfo", { enumerable: true, get: function () { return queryArticle_1.RequestArticleInfo; } });
Object.defineProperty(exports, "RequestArticleSimilarArticles", { enumerable: true, get: function () { return queryArticle_1.RequestArticleSimilarArticles; } });
Object.defineProperty(exports, "RequestArticleDuplicatedArticles", { enumerable: true, get: function () { return queryArticle_1.RequestArticleDuplicatedArticles; } });
Object.defineProperty(exports, "RequestArticleOriginalArticle", { enumerable: true, get: function () { return queryArticle_1.RequestArticleOriginalArticle; } });
var queryArticles_1 = require("./queryArticles");
exports.QueryArticles = queryArticles_1.QueryArticles;
exports.QueryArticlesIter = queryArticles_1.QueryArticlesIter;
exports.RequestArticlesInfo = queryArticles_1.RequestArticlesInfo;
exports.RequestArticlesUriWgtList = queryArticles_1.RequestArticlesUriWgtList;
exports.RequestArticlesTimeAggr = queryArticles_1.RequestArticlesTimeAggr;
exports.RequestArticlesConceptAggr = queryArticles_1.RequestArticlesConceptAggr;
exports.RequestArticlesCategoryAggr = queryArticles_1.RequestArticlesCategoryAggr;
exports.RequestArticlesSourceAggr = queryArticles_1.RequestArticlesSourceAggr;
exports.RequestArticlesKeywordAggr = queryArticles_1.RequestArticlesKeywordAggr;
exports.RequestArticlesConceptGraph = queryArticles_1.RequestArticlesConceptGraph;
exports.RequestArticlesConceptMatrix = queryArticles_1.RequestArticlesConceptMatrix;
exports.RequestArticlesConceptTrends = queryArticles_1.RequestArticlesConceptTrends;
exports.RequestArticlesDateMentionAggr = queryArticles_1.RequestArticlesDateMentionAggr;
exports.RequestArticlesRecentActivity = queryArticles_1.RequestArticlesRecentActivity;
Object.defineProperty(exports, "QueryArticles", { enumerable: true, get: function () { return queryArticles_1.QueryArticles; } });
Object.defineProperty(exports, "QueryArticlesIter", { enumerable: true, get: function () { return queryArticles_1.QueryArticlesIter; } });
Object.defineProperty(exports, "RequestArticlesInfo", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesInfo; } });
Object.defineProperty(exports, "RequestArticlesUriWgtList", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesUriWgtList; } });
Object.defineProperty(exports, "RequestArticlesTimeAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesTimeAggr; } });
Object.defineProperty(exports, "RequestArticlesConceptAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesConceptAggr; } });
Object.defineProperty(exports, "RequestArticlesCategoryAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesCategoryAggr; } });
Object.defineProperty(exports, "RequestArticlesSourceAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesSourceAggr; } });
Object.defineProperty(exports, "RequestArticlesKeywordAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesKeywordAggr; } });
Object.defineProperty(exports, "RequestArticlesConceptGraph", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesConceptGraph; } });
Object.defineProperty(exports, "RequestArticlesConceptMatrix", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesConceptMatrix; } });
Object.defineProperty(exports, "RequestArticlesConceptTrends", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesConceptTrends; } });
Object.defineProperty(exports, "RequestArticlesDateMentionAggr", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesDateMentionAggr; } });
Object.defineProperty(exports, "RequestArticlesRecentActivity", { enumerable: true, get: function () { return queryArticles_1.RequestArticlesRecentActivity; } });
var queryEvent_1 = require("./queryEvent");
exports.QueryEvent = queryEvent_1.QueryEvent;
exports.QueryEventArticlesIter = queryEvent_1.QueryEventArticlesIter;
exports.RequestEventInfo = queryEvent_1.RequestEventInfo;
exports.RequestEventArticles = queryEvent_1.RequestEventArticles;
exports.RequestEventArticleUriWgts = queryEvent_1.RequestEventArticleUriWgts;
exports.RequestEventKeywordAggr = queryEvent_1.RequestEventKeywordAggr;
exports.RequestEventSourceAggr = queryEvent_1.RequestEventSourceAggr;
exports.RequestEventDateMentionAggr = queryEvent_1.RequestEventDateMentionAggr;
exports.RequestEventArticleTrend = queryEvent_1.RequestEventArticleTrend;
exports.RequestEventSimilarEvents = queryEvent_1.RequestEventSimilarEvents;
Object.defineProperty(exports, "QueryEvent", { enumerable: true, get: function () { return queryEvent_1.QueryEvent; } });
Object.defineProperty(exports, "QueryEventArticlesIter", { enumerable: true, get: function () { return queryEvent_1.QueryEventArticlesIter; } });
Object.defineProperty(exports, "RequestEventInfo", { enumerable: true, get: function () { return queryEvent_1.RequestEventInfo; } });
Object.defineProperty(exports, "RequestEventArticles", { enumerable: true, get: function () { return queryEvent_1.RequestEventArticles; } });
Object.defineProperty(exports, "RequestEventArticleUriWgts", { enumerable: true, get: function () { return queryEvent_1.RequestEventArticleUriWgts; } });
Object.defineProperty(exports, "RequestEventKeywordAggr", { enumerable: true, get: function () { return queryEvent_1.RequestEventKeywordAggr; } });
Object.defineProperty(exports, "RequestEventSourceAggr", { enumerable: true, get: function () { return queryEvent_1.RequestEventSourceAggr; } });
Object.defineProperty(exports, "RequestEventDateMentionAggr", { enumerable: true, get: function () { return queryEvent_1.RequestEventDateMentionAggr; } });
Object.defineProperty(exports, "RequestEventArticleTrend", { enumerable: true, get: function () { return queryEvent_1.RequestEventArticleTrend; } });
Object.defineProperty(exports, "RequestEventSimilarEvents", { enumerable: true, get: function () { return queryEvent_1.RequestEventSimilarEvents; } });
var queryEvents_1 = require("./queryEvents");
exports.QueryEvents = queryEvents_1.QueryEvents;
exports.QueryEventsIter = queryEvents_1.QueryEventsIter;
exports.RequestEventsInfo = queryEvents_1.RequestEventsInfo;
exports.RequestEventsUriWgtList = queryEvents_1.RequestEventsUriWgtList;
exports.RequestEventsTimeAggr = queryEvents_1.RequestEventsTimeAggr;
exports.RequestEventsKeywordAggr = queryEvents_1.RequestEventsKeywordAggr;
exports.RequestEventsLocAggr = queryEvents_1.RequestEventsLocAggr;
exports.RequestEventsLocTimeAggr = queryEvents_1.RequestEventsLocTimeAggr;
exports.RequestEventsConceptAggr = queryEvents_1.RequestEventsConceptAggr;
exports.RequestEventsConceptGraph = queryEvents_1.RequestEventsConceptGraph;
exports.RequestEventsConceptMatrix = queryEvents_1.RequestEventsConceptMatrix;
exports.RequestEventsConceptTrends = queryEvents_1.RequestEventsConceptTrends;
exports.RequestEventsSourceAggr = queryEvents_1.RequestEventsSourceAggr;
exports.RequestEventsDateMentionAggr = queryEvents_1.RequestEventsDateMentionAggr;
exports.RequestEventsEventClusters = queryEvents_1.RequestEventsEventClusters;
exports.RequestEventsCategoryAggr = queryEvents_1.RequestEventsCategoryAggr;
exports.RequestEventsRecentActivity = queryEvents_1.RequestEventsRecentActivity;
Object.defineProperty(exports, "QueryEvents", { enumerable: true, get: function () { return queryEvents_1.QueryEvents; } });
Object.defineProperty(exports, "QueryEventsIter", { enumerable: true, get: function () { return queryEvents_1.QueryEventsIter; } });
Object.defineProperty(exports, "RequestEventsInfo", { enumerable: true, get: function () { return queryEvents_1.RequestEventsInfo; } });
Object.defineProperty(exports, "RequestEventsUriWgtList", { enumerable: true, get: function () { return queryEvents_1.RequestEventsUriWgtList; } });
Object.defineProperty(exports, "RequestEventsTimeAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsTimeAggr; } });
Object.defineProperty(exports, "RequestEventsKeywordAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsKeywordAggr; } });
Object.defineProperty(exports, "RequestEventsLocAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsLocAggr; } });
Object.defineProperty(exports, "RequestEventsLocTimeAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsLocTimeAggr; } });
Object.defineProperty(exports, "RequestEventsConceptAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsConceptAggr; } });
Object.defineProperty(exports, "RequestEventsConceptGraph", { enumerable: true, get: function () { return queryEvents_1.RequestEventsConceptGraph; } });
Object.defineProperty(exports, "RequestEventsConceptMatrix", { enumerable: true, get: function () { return queryEvents_1.RequestEventsConceptMatrix; } });
Object.defineProperty(exports, "RequestEventsConceptTrends", { enumerable: true, get: function () { return queryEvents_1.RequestEventsConceptTrends; } });
Object.defineProperty(exports, "RequestEventsSourceAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsSourceAggr; } });
Object.defineProperty(exports, "RequestEventsDateMentionAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsDateMentionAggr; } });
Object.defineProperty(exports, "RequestEventsEventClusters", { enumerable: true, get: function () { return queryEvents_1.RequestEventsEventClusters; } });
Object.defineProperty(exports, "RequestEventsCategoryAggr", { enumerable: true, get: function () { return queryEvents_1.RequestEventsCategoryAggr; } });
Object.defineProperty(exports, "RequestEventsRecentActivity", { enumerable: true, get: function () { return queryEvents_1.RequestEventsRecentActivity; } });
var queryMentions_1 = require("./queryMentions");
exports.QueryMentions = queryMentions_1.QueryMentions;
exports.QueryMentionsIter = queryMentions_1.QueryMentionsIter;
exports.RequestMentions = queryMentions_1.RequestMentions;
exports.RequestMentionsInfo = queryMentions_1.RequestMentionsInfo;
exports.RequestMentionsUriWgtList = queryMentions_1.RequestMentionsUriWgtList;
exports.RequestMentionsTimeAggr = queryMentions_1.RequestMentionsTimeAggr;
exports.RequestMentionsConceptAggr = queryMentions_1.RequestMentionsConceptAggr;
exports.RequestMentionsCategoryAggr = queryMentions_1.RequestMentionsCategoryAggr;
exports.RequestMentionsSourceAggr = queryMentions_1.RequestMentionsSourceAggr;
exports.RequestMentionsKeywordAggr = queryMentions_1.RequestMentionsKeywordAggr;
exports.RequestMentionsConceptGraph = queryMentions_1.RequestMentionsConceptGraph;
exports.RequestMentionsRecentActivity = queryMentions_1.RequestMentionsRecentActivity;
Object.defineProperty(exports, "QueryMentions", { enumerable: true, get: function () { return queryMentions_1.QueryMentions; } });
Object.defineProperty(exports, "QueryMentionsIter", { enumerable: true, get: function () { return queryMentions_1.QueryMentionsIter; } });
Object.defineProperty(exports, "RequestMentions", { enumerable: true, get: function () { return queryMentions_1.RequestMentions; } });
Object.defineProperty(exports, "RequestMentionsInfo", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsInfo; } });
Object.defineProperty(exports, "RequestMentionsUriWgtList", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsUriWgtList; } });
Object.defineProperty(exports, "RequestMentionsTimeAggr", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsTimeAggr; } });
Object.defineProperty(exports, "RequestMentionsConceptAggr", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsConceptAggr; } });
Object.defineProperty(exports, "RequestMentionsCategoryAggr", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsCategoryAggr; } });
Object.defineProperty(exports, "RequestMentionsSourceAggr", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsSourceAggr; } });
Object.defineProperty(exports, "RequestMentionsKeywordAggr", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsKeywordAggr; } });
Object.defineProperty(exports, "RequestMentionsConceptGraph", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsConceptGraph; } });
Object.defineProperty(exports, "RequestMentionsRecentActivity", { enumerable: true, get: function () { return queryMentions_1.RequestMentionsRecentActivity; } });
var queryStory_1 = require("./queryStory");
exports.QueryStory = queryStory_1.QueryStory;
exports.RequestStoryInfo = queryStory_1.RequestStoryInfo;
exports.RequestStoryArticles = queryStory_1.RequestStoryArticles;
exports.RequestStoryArticleUris = queryStory_1.RequestStoryArticleUris;
exports.RequestStoryArticleTrend = queryStory_1.RequestStoryArticleTrend;
exports.RequestStorySimilarStories = queryStory_1.RequestStorySimilarStories;
Object.defineProperty(exports, "QueryStory", { enumerable: true, get: function () { return queryStory_1.QueryStory; } });
Object.defineProperty(exports, "RequestStoryInfo", { enumerable: true, get: function () { return queryStory_1.RequestStoryInfo; } });
Object.defineProperty(exports, "RequestStoryArticles", { enumerable: true, get: function () { return queryStory_1.RequestStoryArticles; } });
Object.defineProperty(exports, "RequestStoryArticleUris", { enumerable: true, get: function () { return queryStory_1.RequestStoryArticleUris; } });
Object.defineProperty(exports, "RequestStoryArticleTrend", { enumerable: true, get: function () { return queryStory_1.RequestStoryArticleTrend; } });
Object.defineProperty(exports, "RequestStorySimilarStories", { enumerable: true, get: function () { return queryStory_1.RequestStorySimilarStories; } });
var recent_1 = require("./recent");
exports.GetRecentEvents = recent_1.GetRecentEvents;
exports.GetRecentArticles = recent_1.GetRecentArticles;
Object.defineProperty(exports, "GetRecentEvents", { enumerable: true, get: function () { return recent_1.GetRecentEvents; } });
Object.defineProperty(exports, "GetRecentArticles", { enumerable: true, get: function () { return recent_1.GetRecentArticles; } });
var returnInfo_1 = require("./returnInfo");
exports.ReturnInfo = returnInfo_1.ReturnInfo;
exports.ArticleInfoFlags = returnInfo_1.ArticleInfoFlags;
exports.StoryInfoFlags = returnInfo_1.StoryInfoFlags;
exports.EventInfoFlags = returnInfo_1.EventInfoFlags;
exports.SourceInfoFlags = returnInfo_1.SourceInfoFlags;
exports.CategoryInfoFlags = returnInfo_1.CategoryInfoFlags;
exports.ConceptInfoFlags = returnInfo_1.ConceptInfoFlags;
exports.LocationInfoFlags = returnInfo_1.LocationInfoFlags;
exports.ConceptClassInfoFlags = returnInfo_1.ConceptClassInfoFlags;
exports.ConceptFolderInfoFlags = returnInfo_1.ConceptFolderInfoFlags;
Object.defineProperty(exports, "ReturnInfo", { enumerable: true, get: function () { return returnInfo_1.ReturnInfo; } });
Object.defineProperty(exports, "ArticleInfoFlags", { enumerable: true, get: function () { return returnInfo_1.ArticleInfoFlags; } });
Object.defineProperty(exports, "StoryInfoFlags", { enumerable: true, get: function () { return returnInfo_1.StoryInfoFlags; } });
Object.defineProperty(exports, "EventInfoFlags", { enumerable: true, get: function () { return returnInfo_1.EventInfoFlags; } });
Object.defineProperty(exports, "SourceInfoFlags", { enumerable: true, get: function () { return returnInfo_1.SourceInfoFlags; } });
Object.defineProperty(exports, "CategoryInfoFlags", { enumerable: true, get: function () { return returnInfo_1.CategoryInfoFlags; } });
Object.defineProperty(exports, "ConceptInfoFlags", { enumerable: true, get: function () { return returnInfo_1.ConceptInfoFlags; } });
Object.defineProperty(exports, "LocationInfoFlags", { enumerable: true, get: function () { return returnInfo_1.LocationInfoFlags; } });
Object.defineProperty(exports, "ConceptClassInfoFlags", { enumerable: true, get: function () { return returnInfo_1.ConceptClassInfoFlags; } });
Object.defineProperty(exports, "ConceptFolderInfoFlags", { enumerable: true, get: function () { return returnInfo_1.ConceptFolderInfoFlags; } });
var trends_1 = require("./trends");
exports.GetTrendingConcepts = trends_1.GetTrendingConcepts;
exports.GetTrendingCategories = trends_1.GetTrendingCategories;
exports.GetTrendingCustomItems = trends_1.GetTrendingCustomItems;
exports.GetTrendingConceptGroups = trends_1.GetTrendingConceptGroups;
Object.defineProperty(exports, "GetTrendingConcepts", { enumerable: true, get: function () { return trends_1.GetTrendingConcepts; } });
Object.defineProperty(exports, "GetTrendingCategories", { enumerable: true, get: function () { return trends_1.GetTrendingCategories; } });
Object.defineProperty(exports, "GetTrendingCustomItems", { enumerable: true, get: function () { return trends_1.GetTrendingCustomItems; } });
Object.defineProperty(exports, "GetTrendingConceptGroups", { enumerable: true, get: function () { return trends_1.GetTrendingConceptGroups; } });
var topicPage_1 = require("./topicPage");
exports.TopicPage = topicPage_1.TopicPage;
Object.defineProperty(exports, "TopicPage", { enumerable: true, get: function () { return topicPage_1.TopicPage; } });
var logger_1 = require("./logger");
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return logger_1.LogLevel; } });
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
//# sourceMappingURL=index.js.map
import { QueryParamsBase } from "./base";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
/**

@@ -11,3 +11,3 @@ * @class GetSourceInfo

*/
constructor(args?: EventRegistryStatic.Info.GetSourceInfoArguments);
constructor(args?: ER.Info.GetSourceInfoArguments);
/**

@@ -21,3 +21,3 @@ * search sources by uri(s)

queryById(idOrIdList: string | string[]): void;
readonly path: string;
get path(): string;
}

@@ -29,4 +29,4 @@ /**

export declare class GetConceptInfo extends QueryParamsBase {
constructor(args?: EventRegistryStatic.Info.GetConceptInfoArguments);
readonly path: string;
constructor(args?: ER.Info.GetConceptInfoArguments);
get path(): string;
}

@@ -38,3 +38,3 @@ /**

export declare class GetCategoryInfo extends QueryParamsBase {
constructor(args?: EventRegistryStatic.Info.GetCategoryInfoArguments);
constructor(args?: ER.Info.GetCategoryInfoArguments);
/**

@@ -44,3 +44,3 @@ * search concepts by uri(s)

queryByUri(uriOrUriList: string | string[]): void;
readonly path: string;
get path(): string;
}

@@ -65,3 +65,3 @@ /**

queryByUri(uriOrUriList: string | string[]): void;
readonly path: string;
get path(): string;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,4 +18,15 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetSourceStats = exports.GetCategoryInfo = exports.GetConceptInfo = exports.GetSourceInfo = void 0;
var base_1 = require("./base");

@@ -35,6 +48,6 @@ var returnInfo_1 = require("./returnInfo");

_this.setVal("action", "getInfo");
if (!_.isUndefined(uriOrUriList)) {
if (uriOrUriList !== undefined) {
_this.queryByUri(uriOrUriList);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("source"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("source"));
return _this;

@@ -58,3 +71,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -76,6 +89,6 @@ });

_this.setVal("action", "getInfo");
if (!_.isUndefined(uriOrUriList)) {
if (uriOrUriList !== undefined) {
_this.setVal("uri", uriOrUriList);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("concept"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("concept"));
return _this;

@@ -87,3 +100,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -105,6 +118,6 @@ });

_this.setVal("action", "getInfo");
if (!_.isUndefined(uriOrUriList)) {
if (uriOrUriList !== undefined) {
_this.queryByUri(uriOrUriList);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("category"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("category"));
return _this;

@@ -122,3 +135,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -161,3 +174,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -164,0 +177,0 @@ });

import { QueryItems } from "./base";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare abstract class QueryCore {

@@ -15,4 +15,4 @@ protected queryObj: any;

*/
constructor(args?: EventRegistryStatic.Query.BaseQueryArguments);
protected setQueryArrVal(propName: any, value: string | string[] | QueryItems): void;
constructor(parameters?: ER.Query.BaseQueryArguments);
protected setQueryArrVal(propName: string, value: string | string[] | QueryItems): void;
}

@@ -44,3 +44,3 @@ export declare class CombinedQuery extends QueryCore {

*/
constructor(query: CombinedQuery | BaseQuery, args?: EventRegistryStatic.Query.ComplexArticleQueryArguments);
constructor(query: CombinedQuery | BaseQuery, args?: ER.Query.ComplexArticleQueryArguments);
}

@@ -54,3 +54,3 @@ /**

*/
constructor(query: BaseQuery | CombinedQuery, args?: EventRegistryStatic.Query.ComplexEventQueryArguments);
constructor(query: BaseQuery | CombinedQuery, args?: ER.Query.ComplexEventQueryArguments);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,2 +18,24 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {

@@ -33,8 +57,13 @@ var m = typeof Symbol === "function" && o[Symbol.iterator];

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.ComplexEventQuery = exports.ComplexArticleQuery = exports.CombinedQuery = exports.BaseQuery = exports.QueryCore = void 0;
var base_1 = require("./base");

@@ -64,9 +93,10 @@ var QueryCore = /** @class */ (function () {

*/
function BaseQuery(args) {
if (args === void 0) { args = {}; }
function BaseQuery(parameters) {
if (parameters === void 0) { parameters = {}; }
var _this = _super.call(this) || this;
_.defaults(args, {
var defaults = {
keywordLoc: "body",
categoryIncludeSub: true,
});
};
var args = __assign(__assign({}, defaults), parameters);
_this.setQueryArrVal("keyword", args.keyword);

@@ -78,11 +108,11 @@ _this.setQueryArrVal("conceptUri", args.conceptUri);

_this.setQueryArrVal("lang", args.lang);
if (!_.isNil(args.dateStart)) {
if (args.dateStart != null) {
_this.queryObj["dateStart"] = base_1.QueryParamsBase.encodeDateTime(args.dateStart, "YYYY-MM-DD");
}
if (!_.isNil(args.dateEnd)) {
if (args.dateEnd != null) {
_this.queryObj["dateEnd"] = base_1.QueryParamsBase.encodeDateTime(args.dateEnd, "YYYY-MM-DD");
}
if (!_.isNil(args.dateMention)) {
if (_.isArray(args.dateMention)) {
_this.queryObj["dateMention"] = _.map(args.dateMention, function (date) { return base_1.QueryParamsBase.encodeDateTime(date, "YYYY-MM-DD"); });
if (args.dateMention != null) {
if (Array.isArray(args.dateMention)) {
_this.queryObj["dateMention"] = args.dateMention.map(function (date) { return base_1.QueryParamsBase.encodeDateTime(date, "YYYY-MM-DD"); });
}

@@ -102,4 +132,4 @@ else {

}
if (!_.isNil(args.minMaxArticlesInEvent)) {
if (!_.isArray() || _.size(args.minMaxArticlesInEvent) !== 2) {
if (args.minMaxArticlesInEvent != null) {
if (!Array.isArray(args.minMaxArticlesInEvent) || args.minMaxArticlesInEvent.length !== 2) {
throw new Error("minMaxArticlesInEvent parameter should either be None or a tuple with two integer values");

@@ -110,3 +140,3 @@ }

}
if (!_.isNil(args.exclude)) {
if (args.exclude != null) {
if (!(args.exclude instanceof QueryCore)) {

@@ -120,13 +150,14 @@ throw new Error("exclude parameter was not a CombinedQuery or BaseQuery instance");

BaseQuery.prototype.setQueryArrVal = function (propName, value) {
if (_.isNil(value)) {
if (value === null || value === undefined) {
return;
}
if (value instanceof base_1.QueryItems) {
_.set(this.queryObj, propName + "." + value.getOper(), value.getItems());
this.queryObj[propName] = this.queryObj[propName] || {};
this.queryObj[propName][value.getOper()] = value.getItems();
}
else if (_.isString(value)) {
_.set(this.queryObj, propName, value);
else if (typeof value === "string") {
this.queryObj[propName] = value;
}
else {
throw new Error("Parameter '" + propName + "' was of unsupported type. It should either be undefined, a string or an instance of QueryItems");
throw new Error("Parameter '".concat(propName, "' was of unsupported type. It should either be undefined, a string or an instance of QueryItems"));
}

@@ -148,6 +179,7 @@ };

CombinedQuery.AND = function (queryArr, exclude) {
if (!_.isArray(queryArr)) {
var e_1, _a;
if (!Array.isArray(queryArr)) {
throw new Error("provided argument as not a list");
}
if (_.isEmpty(queryArr)) {
if (queryArr.length === 0) {
throw new Error("queryArr had an empty list");

@@ -157,9 +189,19 @@ }

query.queryObj["$and"] = [];
_.each(queryArr, function (item) {
if (!(item instanceof QueryCore)) {
throw new Error("item in the list was not a CombinedQuery or BaseQuery instance");
try {
for (var queryArr_1 = __values(queryArr), queryArr_1_1 = queryArr_1.next(); !queryArr_1_1.done; queryArr_1_1 = queryArr_1.next()) {
var item = queryArr_1_1.value;
if (!(item instanceof QueryCore)) {
throw new Error("item in the list was not a CombinedQuery or BaseQuery instance");
}
query.queryObj["$and"] = __spreadArray(__spreadArray([], __read(query.queryObj["$and"]), false), [item.getQuery()], false);
}
query.queryObj["$and"] = __spread(query.queryObj["$and"], [item.getQuery()]);
});
if (!_.isNil(exclude)) {
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (queryArr_1_1 && !queryArr_1_1.done && (_a = queryArr_1.return)) _a.call(queryArr_1);
}
finally { if (e_1) throw e_1.error; }
}
if (exclude !== null && exclude !== undefined) {
if (!(exclude instanceof QueryCore)) {

@@ -178,6 +220,6 @@ throw new Error("exclude parameter was not a CombinedQuery or BaseQuery instance");

CombinedQuery.OR = function (queryArr, exclude) {
if (!_.isArray(queryArr)) {
if (!Array.isArray(queryArr)) {
throw new Error("provided argument as not a list");
}
if (_.isEmpty(queryArr)) {
if (queryArr.length === 0) {
throw new Error("queryArr had an empty list");

@@ -187,9 +229,9 @@ }

query.queryObj["$or"] = [];
_.each(queryArr, function (item) {
queryArr.forEach(function (item) {
if (!(item instanceof QueryCore)) {
throw new Error("item in the list was not a CombinedQuery or BaseQuery instance");
}
query.queryObj["$or"] = __spread(query.queryObj["$or"], [item.getQuery()]);
query.queryObj["$or"] = __spreadArray(__spreadArray([], __read(query.queryObj["$or"]), false), [item.getQuery()], false);
});
if (!_.isNil(exclude)) {
if (exclude !== null && exclude !== undefined) {
if (!(exclude instanceof QueryCore)) {

@@ -218,3 +260,3 @@ throw new Error("exclude parameter was not a CombinedQuery or BaseQuery instance");

var _this = _super.call(this) || this;
_.defaults(args, {
var defaults = {
dataType: "news",

@@ -230,3 +272,4 @@ minSentiment: undefined,

eventFilter: "keepAll",
});
};
args = __assign(__assign({}, defaults), args);
if (!(query instanceof QueryCore)) {

@@ -237,33 +280,33 @@ throw new Error("query parameter was not a CombinedQuery or BaseQuery instance");

var filter = {};
if (_.get(args, "dataType") !== "news") {
filter["dataType"] = _.get(args, "dataType");
if (args.dataType !== "news") {
filter["dataType"] = args.dataType;
}
if (!!_.get(args, "minSentiment")) {
filter["minSentiment"] = _.get(args, "minSentiment");
if (args.minSentiment) {
filter["minSentiment"] = args.minSentiment;
}
if (!!_.get(args, "maxSentiment")) {
filter["maxSentiment"] = _.get(args, "maxSentiment");
if (args.maxSentiment) {
filter["maxSentiment"] = args.maxSentiment;
}
if (_.get(args, "minSocialScore") > 0) {
filter["minSocialScore"] = _.get(args, "minSocialScore");
if (args.minSocialScore > 0) {
filter["minSocialScore"] = args.minSocialScore;
}
if (_.get(args, "minFacebookShares") > 0) {
filter["minFacebookShares"] = _.get(args, "minFacebookShares");
if (args.minFacebookShares > 0) {
filter["minFacebookShares"] = args.minFacebookShares;
}
if (_.get(args, "startSourceRankPercentile") !== 0) {
filter["startSourceRankPercentile"] = _.get(args, "startSourceRankPercentile");
if (args.startSourceRankPercentile !== 0) {
filter["startSourceRankPercentile"] = args.startSourceRankPercentile;
}
if (_.get(args, "endSourceRankPercentile") !== 0) {
filter["endSourceRankPercentile"] = _.get(args, "endSourceRankPercentile");
if (args.endSourceRankPercentile !== 0) {
filter["endSourceRankPercentile"] = args.endSourceRankPercentile;
}
if (_.get(args, "isDuplicateFilter") !== "keepAll") {
filter["isDuplicate"] = _.get(args, "isDuplicateFilter");
if (args.isDuplicateFilter !== "keepAll") {
filter["isDuplicate"] = args.isDuplicateFilter;
}
if (_.get(args, "hasDuplicateFilter") !== "keepAll") {
filter["hasDuplicate"] = _.get(args, "hasDuplicateFilter");
if (args.hasDuplicateFilter !== "keepAll") {
filter["hasDuplicate"] = args.hasDuplicateFilter;
}
if (_.get(args, "eventFilter") !== "keepAll") {
filter["hasEvent"] = _.get(args, "eventFilter");
if (args.eventFilter !== "keepAll") {
filter["hasEvent"] = args.eventFilter;
}
if (!_.isEmpty(filter)) {
if (Object.keys(filter).length > 0) {
_this.queryObj["$filter"] = filter;

@@ -292,9 +335,9 @@ }

var filter = {};
if (!!_.get(args, "minSentiment")) {
filter["minSentiment"] = _.get(args, "minSentiment");
if (args === null || args === void 0 ? void 0 : args.minSentiment) {
filter["minSentiment"] = args.minSentiment;
}
if (!!_.get(args, "maxSentiment")) {
filter["maxSentiment"] = _.get(args, "maxSentiment");
if (args === null || args === void 0 ? void 0 : args.maxSentiment) {
filter["maxSentiment"] = args.maxSentiment;
}
if (!_.isEmpty(filter)) {
if (Object.keys(filter).length > 0) {
_this.queryObj["$filter"] = filter;

@@ -301,0 +344,0 @@ }

import { Query } from "./base";
import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
/**

@@ -14,3 +14,3 @@ * @class QueryArticle

constructor(articleUriOrUriList: string | string[], requestedResult?: RequestArticleInfo);
readonly path: string;
get path(): string;
/**

@@ -42,3 +42,3 @@ * Set the single result type that you would like to be returned.

params: any;
constructor(args?: EventRegistryStatic.QueryArticle.RequestArticleSimilarArticlesArguments);
constructor(args?: ER.QueryArticle.RequestArticleSimilarArticlesArguments);
}

@@ -51,3 +51,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryArticle.RequestArticleDuplicatedArticlesArguments);
constructor(args?: ER.QueryArticle.RequestArticleDuplicatedArticlesArguments);
}

@@ -54,0 +54,0 @@ /**

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,2 +18,13 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -22,8 +35,10 @@ var t = {};

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestArticleOriginalArticle = exports.RequestArticleDuplicatedArticles = exports.RequestArticleSimilarArticles = exports.RequestArticleInfo = exports.RequestArticle = exports.QueryArticle = void 0;
var base_1 = require("./base");

@@ -53,3 +68,3 @@ var returnInfo_1 = require("./returnInfo");

},
enumerable: true,
enumerable: false,
configurable: true

@@ -105,4 +120,4 @@ });

var _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, _c = args.lang, lang = _c === void 0 ? ["eng"] : _c, _d = args.limitPerLang, limitPerLang = _d === void 0 ? -1 : _d, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo({ articleInfo: new returnInfo_1.ArticleInfoFlags({ bodyLen: -1 }) }) : _e, unsupported = __rest(args, ["page", "count", "lang", "limitPerLang", "returnInfo"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticleSimilarArticles: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
console.warn("RequestArticleSimilarArticles: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -120,3 +135,3 @@ if (page < 1) {

_this.params["similarArticlesLimitPerLang"] = limitPerLang;
_this.params = _.extend({}, _this.params, returnInfo.getParams("similarArticles"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("similarArticles"));
return _this;

@@ -137,4 +152,4 @@ }

var _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 20 : _b, _c = args.sortBy, sortBy = _c === void 0 ? "cosSim" : _c, _d = args.sortByAsc, sortByAsc = _d === void 0 ? false : _d, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo({ articleInfo: new returnInfo_1.ArticleInfoFlags({ bodyLen: -1 }) }) : _e, unsupported = __rest(args, ["page", "count", "sortBy", "sortByAsc", "returnInfo"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticleDuplicatedArticles: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
console.warn("RequestArticleDuplicatedArticles: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -152,3 +167,3 @@ if (page < 1) {

_this.params["duplicatedArticlesSortByAsc"] = sortByAsc;
_this.params = _.extend({}, _this.params, returnInfo.getParams("duplicatedArticles"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("duplicatedArticles"));
return _this;

@@ -155,0 +170,0 @@ }

import { Query } from "./base";
import { EventRegistry } from "./eventRegistry";
import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
import { Data } from "./data";
export declare class QueryArticles extends Query<RequestArticles> {
constructor(args?: EventRegistryStatic.QueryArticles.Arguments);
readonly path: string;
constructor(args?: ER.QueryArticles.Arguments);
get path(): string;
setRequestedResult(requestArticles: any): void;

@@ -46,3 +46,3 @@ static initWithArticleUriList(...args: any[]): any;

private extractResults;
private readonly current;
private get current();
private getNextBatch;

@@ -55,9 +55,3 @@ }

params: any;
constructor({ page, count, sortBy, sortByAsc, returnInfo, ...unsupported }?: {
page?: number;
count?: number;
sortBy?: string;
sortByAsc?: boolean;
returnInfo?: any;
});
constructor(parameters?: ER.RequestArticlesInfoParameters);
}

@@ -67,8 +61,3 @@ export declare class RequestArticlesUriWgtList extends RequestArticles {

params: any;
constructor({ page, count, sortBy, sortByAsc, ...unsupported }?: {
page?: number;
count?: number;
sortBy?: string;
sortByAsc?: boolean;
});
constructor(parameters?: ER.RequestArticlesUriWgtListParameters);
setPage(page: any): void;

@@ -138,8 +127,3 @@ }

params: any;
constructor({ conceptUris, conceptCount, articlesSampleSize, returnInfo, ...unsupported }?: {
conceptUris?: any;
conceptCount?: number;
articlesSampleSize?: number;
returnInfo?: ReturnInfo;
});
constructor(parameters?: ER.RequestArticlesConceptTrendsParameters);
}

@@ -146,0 +130,0 @@ export declare class RequestArticlesDateMentionAggr extends RequestArticles {

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,7 +18,19 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -31,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -58,4 +72,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -79,11 +95,17 @@ };

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestArticlesRecentActivity = exports.RequestArticlesDateMentionAggr = exports.RequestArticlesConceptTrends = exports.RequestArticlesConceptMatrix = exports.RequestArticlesConceptGraph = exports.RequestArticlesKeywordAggr = exports.RequestArticlesSourceAggr = exports.RequestArticlesCategoryAggr = exports.RequestArticlesConceptAggr = exports.RequestArticlesTimeAggr = exports.RequestArticlesUriWgtList = exports.RequestArticlesInfo = exports.RequestArticles = exports.QueryArticlesIter = exports.QueryArticles = void 0;
var base_1 = require("./base");
var query_1 = require("./query");
var returnInfo_1 = require("./returnInfo");
var logger_1 = require("./logger");
var QueryArticles = /** @class */ (function (_super) {

@@ -94,7 +116,7 @@ __extends(QueryArticles, _super);

var _this = _super.call(this) || this;
var keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, authorUri = args.authorUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, dateMentionStart = args.dateMentionStart, dateMentionEnd = args.dateMentionEnd, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreAuthorUri = args.ignoreAuthorUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, _a = args.keywordsLoc, keywordsLoc = _a === void 0 ? "body" : _a, _b = args.ignoreKeywordsLoc, ignoreKeywordsLoc = _b === void 0 ? "body" : _b, _c = args.isDuplicateFilter, isDuplicateFilter = _c === void 0 ? "keepAll" : _c, _d = args.hasDuplicateFilter, hasDuplicateFilter = _d === void 0 ? "keepAll" : _d, _e = args.eventFilter, eventFilter = _e === void 0 ? "keepAll" : _e, _f = args.startSourceRankPercentile, startSourceRankPercentile = _f === void 0 ? 0 : _f, _g = args.endSourceRankPercentile, endSourceRankPercentile = _g === void 0 ? 100 : _g, _h = args.minSentiment, minSentiment = _h === void 0 ? -1 : _h, _j = args.maxSentiment, maxSentiment = _j === void 0 ? 1 : _j, _k = args.dataType, dataType = _k === void 0 ? "news" : _k, _l = args.requestedResult, requestedResult = _l === void 0 ? new RequestArticlesInfo() : _l, unsupported = __rest(args, ["keywords", "conceptUri", "categoryUri", "sourceUri", "sourceLocationUri", "sourceGroupUri", "authorUri", "locationUri", "lang", "dateStart", "dateEnd", "dateMentionStart", "dateMentionEnd", "ignoreKeywords", "ignoreConceptUri", "ignoreCategoryUri", "ignoreSourceUri", "ignoreSourceLocationUri", "ignoreSourceGroupUri", "ignoreAuthorUri", "ignoreLocationUri", "ignoreLang", "keywordsLoc", "ignoreKeywordsLoc", "isDuplicateFilter", "hasDuplicateFilter", "eventFilter", "startSourceRankPercentile", "endSourceRankPercentile", "minSentiment", "maxSentiment", "dataType", "requestedResult"]);
if (!_.isEmpty(unsupported)) {
// Check ["sortBy", "sortByAsc", "returnInfo", "maxItems"] for cases when we are coming from QueryArticlesIter
if (!_.some(_.keys(unsupported), function (key) { return _.includes(["sortBy", "sortByAsc", "returnInfo", "maxItems"], key); })) {
console.warn("QueryArticles: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
var keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, authorUri = args.authorUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, dateMentionStart = args.dateMentionStart, dateMentionEnd = args.dateMentionEnd, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreAuthorUri = args.ignoreAuthorUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, _a = args.keywordsLoc, keywordsLoc = _a === void 0 ? "body" : _a, _b = args.keywordSearchMode, keywordSearchMode = _b === void 0 ? "phrase" : _b, _c = args.ignoreKeywordsLoc, ignoreKeywordsLoc = _c === void 0 ? "body" : _c, _d = args.ignoreKeywordSearchMode, ignoreKeywordSearchMode = _d === void 0 ? "phrase" : _d, _e = args.isDuplicateFilter, isDuplicateFilter = _e === void 0 ? "keepAll" : _e, _f = args.hasDuplicateFilter, hasDuplicateFilter = _f === void 0 ? "keepAll" : _f, _g = args.eventFilter, eventFilter = _g === void 0 ? "keepAll" : _g, _h = args.authorsFilter, authorsFilter = _h === void 0 ? "keepAll" : _h, _j = args.videosFilter, videosFilter = _j === void 0 ? "keepAll" : _j, _k = args.linksFilter, linksFilter = _k === void 0 ? "keepAll" : _k, _l = args.startSourceRankPercentile, startSourceRankPercentile = _l === void 0 ? 0 : _l, _m = args.endSourceRankPercentile, endSourceRankPercentile = _m === void 0 ? 100 : _m, _o = args.minSentiment, minSentiment = _o === void 0 ? -1 : _o, _p = args.maxSentiment, maxSentiment = _p === void 0 ? 1 : _p, _q = args.dataType, dataType = _q === void 0 ? "news" : _q, _r = args.requestedResult, requestedResult = _r === void 0 ? new RequestArticlesInfo() : _r, unsupported = __rest(args, ["keywords", "conceptUri", "categoryUri", "sourceUri", "sourceLocationUri", "sourceGroupUri", "authorUri", "locationUri", "lang", "dateStart", "dateEnd", "dateMentionStart", "dateMentionEnd", "ignoreKeywords", "ignoreConceptUri", "ignoreCategoryUri", "ignoreSourceUri", "ignoreSourceLocationUri", "ignoreSourceGroupUri", "ignoreAuthorUri", "ignoreLocationUri", "ignoreLang", "keywordsLoc", "keywordSearchMode", "ignoreKeywordsLoc", "ignoreKeywordSearchMode", "isDuplicateFilter", "hasDuplicateFilter", "eventFilter", "authorsFilter", "videosFilter", "linksFilter", "startSourceRankPercentile", "endSourceRankPercentile", "minSentiment", "maxSentiment", "dataType", "requestedResult"]);
if (Object.keys(unsupported).length > 0) {
var unsupportedKeys_1 = ["sortBy", "sortByAsc", "returnInfo", "maxItems"];
if (!Object.keys(unsupported).some(function (key) { return unsupportedKeys_1.includes(key); })) {
console.warn("QueryArticles: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -112,12 +134,12 @@ }

_this.setQueryArrVal(lang, "lang", undefined, "or");
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
if (!_.isUndefined(dateMentionStart)) {
if (dateMentionStart !== undefined) {
_this.setDateVal("dateMentionStart", dateMentionStart);
}
if (!_.isUndefined(dateMentionEnd)) {
if (dateMentionEnd !== undefined) {
_this.setDateVal("dateMentionEnd", dateMentionEnd);

@@ -136,2 +158,4 @@ }

_this.setValIfNotDefault("ignoreKeywordLoc", ignoreKeywordsLoc, "body");
_this.setValIfNotDefault("keywordSearchMode", keywordSearchMode, "phrase");
_this.setValIfNotDefault("ignoreKeywordSearchMode", ignoreKeywordSearchMode, "phrase");
_this.setValIfNotDefault("isDuplicateFilter", isDuplicateFilter, "keepAll");

@@ -169,3 +193,3 @@ _this.setValIfNotDefault("hasDuplicateFilter", hasDuplicateFilter, "keepAll");

},
enumerable: true,
enumerable: false,
configurable: true

@@ -181,3 +205,3 @@ });

var q = new QueryArticles();
if (!_.isArray(uriList)) {
if (!Array.isArray(uriList)) {
throw new Error("uriList has to be a list of strings that represent article uris");

@@ -193,3 +217,3 @@ }

var q = new QueryArticles();
if (!_.isArray(uriWgtList)) {
if (!Array.isArray(uriWgtList)) {
throw new Error("uriList has to be a list of strings that represent article uris");

@@ -199,3 +223,3 @@ }

action: "getArticles",
articleUriWgtList: _.join(uriWgtList, ","),
articleUriWgtList: uriWgtList.join(","),
};

@@ -209,3 +233,3 @@ return q;

}
else if (_.isString(complexQuery)) {
else if (typeof complexQuery === "string") {
try {

@@ -219,3 +243,3 @@ JSON.parse(complexQuery);

}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === "object" && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -241,11 +265,5 @@ }

_this.index = 0;
_this.callback = _.noop;
_this.doneCallback = _.noop;
_.defaults(args, {
sortBy: "rel",
sortByAsc: false,
returnInfo: undefined,
maxItems: -1,
});
var sortBy = args.sortBy, sortByAsc = args.sortByAsc, returnInfo = args.returnInfo, maxItems = args.maxItems;
_this.callback = function () { };
_this.doneCallback = function () { };
var _a = args.sortBy, sortBy = _a === void 0 ? "rel" : _a, _b = args.sortByAsc, sortByAsc = _b === void 0 ? false : _b, _c = args.returnInfo, returnInfo = _c === void 0 ? undefined : _c, _d = args.maxItems, maxItems = _d === void 0 ? -1 : _d;
_this.er = er;

@@ -282,4 +300,5 @@ _this.sortBy = sortBy;

var response;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -289,7 +308,7 @@ this.setRequestedResult(new RequestArticlesInfo());

case 1:
response = _a.sent();
if (_.has(response, "error")) {
console.error(_.get(response, "error"));
response = _b.sent();
if (response.hasOwnProperty("error")) {
this.er.logger.error(response.error);
}
return [2 /*return*/, _.get(response, "articles.totalResults", 0)];
return [2 /*return*/, ((_a = response.articles) === null || _a === void 0 ? void 0 : _a.totalResults) || 0];
}

@@ -314,6 +333,6 @@ });

}
else if (_.isString(complexQuery)) {
else if (typeof complexQuery === 'string') {
query.setVal("query", complexQuery);
}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === 'object' && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -352,5 +371,6 @@ }

QueryArticlesIter.prototype.extractResults = function (response) {
var results = _.get(response, "articles.results", []);
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : _.size(results);
return _.compact(_.pullAt(results, _.range(0, extractedSize)));
var _a;
var results = ((_a = response === null || response === void 0 ? void 0 : response.articles) === null || _a === void 0 ? void 0 : _a.results) || [];
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : results.length;
return results.slice(0, extractedSize).filter(Boolean);
};

@@ -361,3 +381,3 @@ Object.defineProperty(QueryArticlesIter.prototype, "current", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -368,6 +388,7 @@ });

var requestArticles, response, error, results, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a.trys.push([0, 2, , 3]);
_b.trys.push([0, 2, , 3]);
this.page += 1;

@@ -385,21 +406,21 @@ if (this.page > this.pages || (this.maxItems !== -1 && this.returnedSoFar >= this.maxItems)) {

if (this.er.verboseOutput) {
console.log("Downloading article page " + this.page + "...");
this.er.logger.info("Downloading article page ".concat(this.page, "..."));
}
return [4 /*yield*/, this.er.execQuery(this, this.er.allowUseOfArchive)];
case 1:
response = _a.sent();
error = _.get(response, "error", "");
response = _b.sent();
error = response.error || "";
if (error) {
this.errorMessage = "Error while obtaining a list of articles: " + this.errorMessage;
this.errorMessage = "Error while obtaining a list of articles: ".concat(this.errorMessage);
}
else {
this.pages = _.get(response, "articles.pages", 0);
this.pages = ((_a = response.articles) === null || _a === void 0 ? void 0 : _a.pages) || 0;
}
results = this.extractResults(response);
this.returnedSoFar += _.size(results);
this.items = __spread(this.items, results);
this.returnedSoFar += results.length;
this.items = __spreadArray(__spreadArray([], __read(this.items), false), __read(results), false);
return [2 /*return*/, true];
case 2:
error_1 = _a.sent();
console.error(error_1);
error_1 = _b.sent();
this.er.logger.error(error_1);
return [2 /*return*/, false];

@@ -422,9 +443,9 @@ case 3: return [2 /*return*/];

__extends(RequestArticlesInfo, _super);
function RequestArticlesInfo(_a) {
if (_a === void 0) { _a = {}; }
var _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.count, count = _c === void 0 ? 100 : _c, _d = _a.sortBy, sortBy = _d === void 0 ? "date" : _d, _e = _a.sortByAsc, sortByAsc = _e === void 0 ? false : _e, _f = _a.returnInfo, returnInfo = _f === void 0 ? undefined : _f, unsupported = __rest(_a, ["page", "count", "sortBy", "sortByAsc", "returnInfo"]);
function RequestArticlesInfo(parameters) {
if (parameters === void 0) { parameters = {}; }
var _this = _super.call(this) || this;
_this.resultType = "articles";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesInfo: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
var _a = parameters.page, page = _a === void 0 ? 1 : _a, _b = parameters.count, count = _b === void 0 ? 100 : _b, _c = parameters.sortBy, sortBy = _c === void 0 ? "date" : _c, _d = parameters.sortByAsc, sortByAsc = _d === void 0 ? false : _d, returnInfo = parameters.returnInfo, unsupported = __rest(parameters, ["page", "count", "sortBy", "sortByAsc", "returnInfo"]);
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesInfo: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -442,4 +463,4 @@ if (page < 1) {

_this.params["articlesSortByAsc"] = sortByAsc;
if (!!returnInfo) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("articles"));
if (returnInfo) {
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articles"));
}

@@ -453,9 +474,9 @@ return _this;

__extends(RequestArticlesUriWgtList, _super);
function RequestArticlesUriWgtList(_a) {
if (_a === void 0) { _a = {}; }
var _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.count, count = _c === void 0 ? 10000 : _c, _d = _a.sortBy, sortBy = _d === void 0 ? "fq" : _d, _e = _a.sortByAsc, sortByAsc = _e === void 0 ? false : _e, unsupported = __rest(_a, ["page", "count", "sortBy", "sortByAsc"]);
function RequestArticlesUriWgtList(parameters) {
if (parameters === void 0) { parameters = {}; }
var _this = _super.call(this) || this;
_this.resultType = "uriWgtList";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesUriWgtList: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
var _a = parameters.page, page = _a === void 0 ? 1 : _a, _b = parameters.count, count = _b === void 0 ? 10000 : _b, _c = parameters.sortBy, sortBy = _c === void 0 ? "fq" : _c, _d = parameters.sortByAsc, sortByAsc = _d === void 0 ? false : _d, unsupported = __rest(parameters, ["page", "count", "sortBy", "sortByAsc"]);
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesUriWgtList: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -487,3 +508,3 @@ if (page < 1) {

function RequestArticlesTimeAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "timeAggr";

@@ -499,7 +520,8 @@ return _this;

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.conceptCount, conceptCount = _b === void 0 ? 25 : _b, _c = _a.conceptCountPerType, conceptCountPerType = _c === void 0 ? undefined : _c, _d = _a.conceptScoring, conceptScoring = _d === void 0 ? "importance" : _d, _e = _a.articlesSampleSize, articlesSampleSize = _e === void 0 ? 10000 : _e, _f = _a.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, unsupported = __rest(_a, ["conceptCount", "conceptCountPerType", "conceptScoring", "articlesSampleSize", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "conceptAggr";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesConceptAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesConceptAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -516,6 +538,6 @@ if (conceptCount > 500) {

_this.params["conceptAggrScoring"] = conceptScoring;
if (!_.isUndefined(conceptCountPerType)) {
if (conceptCountPerType !== undefined) {
_this.params["conceptAggrConceptCountPerType"] = conceptCountPerType;
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptAggr"));
return _this;

@@ -530,7 +552,8 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.articlesSampleSize, articlesSampleSize = _b === void 0 ? 20000 : _b, _c = _a.returnInfo, returnInfo = _c === void 0 ? new returnInfo_1.ReturnInfo() : _c, unsupported = __rest(_a, ["articlesSampleSize", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "categoryAggr";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesCategoryAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesCategoryAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -542,3 +565,3 @@ if (articlesSampleSize > 50000) {

_this.params["categoryAggrSampleSize"] = articlesSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("categoryAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("categoryAggr"));
return _this;

@@ -553,11 +576,12 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.sourceCount, sourceCount = _b === void 0 ? 50 : _b, _c = _a.normalizeBySourceArts, normalizeBySourceArts = _c === void 0 ? false : _c, _d = _a.returnInfo, returnInfo = _d === void 0 ? new returnInfo_1.ReturnInfo() : _d, unsupported = __rest(_a, ["sourceCount", "normalizeBySourceArts", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "sourceAggr";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesSourceAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesSourceAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}
_this.params = {};
_this.params["sourceAggrSourceCount"] = sourceCount;
_this.params = _.extend({}, _this.params, returnInfo.getParams("sourceAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("sourceAggr"));
return _this;

@@ -572,7 +596,8 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.articlesSampleSize, articlesSampleSize = _b === void 0 ? 2000 : _b, unsupported = __rest(_a, ["articlesSampleSize"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "keywordAggr";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesKeywordAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesKeywordAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -593,7 +618,8 @@ if (articlesSampleSize > 20000) {

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.conceptCount, conceptCount = _b === void 0 ? 25 : _b, _c = _a.linkCount, linkCount = _c === void 0 ? 50 : _c, _d = _a.articlesSampleSize, articlesSampleSize = _d === void 0 ? 10000 : _d, _e = _a.skipQueryConcepts, skipQueryConcepts = _e === void 0 ? true : _e, _f = _a.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, unsupported = __rest(_a, ["conceptCount", "linkCount", "articlesSampleSize", "skipQueryConcepts", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "conceptGraph";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesConceptGraph: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesConceptGraph: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -614,3 +640,3 @@ if (conceptCount > 1000) {

_this.params["conceptGraphSkipQueryConcepts"] = skipQueryConcepts;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptGraph"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptGraph"));
return _this;

@@ -625,7 +651,8 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.conceptCount, conceptCount = _b === void 0 ? 25 : _b, _c = _a.measure, measure = _c === void 0 ? "pmi" : _c, _d = _a.articlesSampleSize, articlesSampleSize = _d === void 0 ? 10000 : _d, _e = _a.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo() : _e, unsupported = __rest(_a, ["conceptCount", "measure", "articlesSampleSize", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "conceptMatrix";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesConceptMatrix: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesConceptMatrix: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -642,3 +669,3 @@ if (conceptCount > 200) {

_this.params["conceptMatrixSampleSize"] = articlesSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptMatrix"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptMatrix"));
return _this;

@@ -651,9 +678,9 @@ }

__extends(RequestArticlesConceptTrends, _super);
function RequestArticlesConceptTrends(_a) {
if (_a === void 0) { _a = {}; }
var _b = _a.conceptUris, conceptUris = _b === void 0 ? undefined : _b, _c = _a.conceptCount, conceptCount = _c === void 0 ? 25 : _c, _d = _a.articlesSampleSize, articlesSampleSize = _d === void 0 ? 10000 : _d, _e = _a.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo() : _e, unsupported = __rest(_a, ["conceptUris", "conceptCount", "articlesSampleSize", "returnInfo"]);
function RequestArticlesConceptTrends(parameters) {
if (parameters === void 0) { parameters = {}; }
var _this = _super.call(this) || this;
_this.resultType = "conceptTrends";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesConceptTrends: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
var conceptUris = parameters.conceptUris, _a = parameters.conceptCount, conceptCount = _a === void 0 ? 25 : _a, _b = parameters.articlesSampleSize, articlesSampleSize = _b === void 0 ? 10000 : _b, _c = parameters.returnInfo, returnInfo = _c === void 0 ? new returnInfo_1.ReturnInfo() : _c, unsupported = __rest(parameters, ["conceptUris", "conceptCount", "articlesSampleSize", "returnInfo"]);
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesConceptTrends: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -667,3 +694,3 @@ if (conceptCount > 50) {

_this.params = {};
if (!_.isUndefined(conceptUris)) {
if (conceptUris !== undefined) {
_this.params["conceptTrendsConceptUri"] = conceptUris;

@@ -673,3 +700,3 @@ }

_this.params["conceptTrendsSampleSize"] = articlesSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptTrends"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptTrends"));
return _this;

@@ -683,3 +710,3 @@ }

function RequestArticlesDateMentionAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "dateMentionAggr";

@@ -695,7 +722,8 @@ return _this;

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.maxArticleCount, maxArticleCount = _b === void 0 ? 100 : _b, _c = _a.updatesAfterNewsUri, updatesAfterNewsUri = _c === void 0 ? undefined : _c, _d = _a.updatesafterBlogUri, updatesafterBlogUri = _d === void 0 ? undefined : _d, _e = _a.updatesAfterPrUri, updatesAfterPrUri = _e === void 0 ? undefined : _e, _f = _a.updatesAfterTm, updatesAfterTm = _f === void 0 ? undefined : _f, _g = _a.updatesAfterMinsAgo, updatesAfterMinsAgo = _g === void 0 ? undefined : _g, _h = _a.updatesUntilTm, updatesUntilTm = _h === void 0 ? undefined : _h, _j = _a.updatesUntilMinsAgo, updatesUntilMinsAgo = _j === void 0 ? undefined : _j, _k = _a.mandatorySourceLocation, mandatorySourceLocation = _k === void 0 ? false : _k, _l = _a.returnInfo, returnInfo = _l === void 0 ? undefined : _l, unsupported = __rest(_a, ["maxArticleCount", "updatesAfterNewsUri", "updatesafterBlogUri", "updatesAfterPrUri", "updatesAfterTm", "updatesAfterMinsAgo", "updatesUntilTm", "updatesUntilMinsAgo", "mandatorySourceLocation", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "recentActivityArticles";
if (!_.isEmpty(unsupported)) {
console.warn("RequestArticlesRecentActivity: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestArticlesRecentActivity: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -705,6 +733,6 @@ if (maxArticleCount > 2000) {

}
if (!_.isUndefined(updatesAfterTm) && !_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterTm !== undefined && updatesAfterMinsAgo !== undefined) {
throw new Error("You should specify either updatesAfterTm or updatesAfterMinsAgo parameter, but not both");
}
if (!_.isUndefined(updatesUntilTm) && !_.isUndefined(updatesUntilMinsAgo)) {
if (updatesUntilTm !== undefined && updatesUntilMinsAgo !== undefined) {
throw new Error("You should specify either updatesUntilTm or updatesUntilMinsAgo parameter, but not both");

@@ -714,26 +742,26 @@ }

_this.params["recentActivityArticlesMaxArticleCount"] = maxArticleCount;
if (!_.isUndefined(updatesAfterTm)) {
if (updatesAfterTm !== undefined) {
_this.params["recentActivityArticlesUpdatesAfterTm"] = base_1.QueryParamsBase.encodeDateTime(updatesAfterTm);
}
if (!_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterMinsAgo !== undefined) {
_this.params["recentActivityArticlesUpdatesAfterMinsAgo"] = updatesAfterMinsAgo;
}
if (!_.isUndefined(updatesUntilTm)) {
if (updatesUntilTm !== undefined) {
_this.params["recentActivityArticlesUpdatesUntilTm"] = base_1.QueryParamsBase.encodeDateTime(updatesUntilTm);
}
if (!_.isUndefined(updatesUntilMinsAgo)) {
if (updatesUntilMinsAgo !== undefined) {
_this.params["recentActivityArticlesUpdatesUntilMinsAgo"] = updatesUntilMinsAgo;
}
if (!_.isUndefined(updatesAfterNewsUri)) {
if (updatesAfterNewsUri !== undefined) {
_this.params["recentActivityArticlesNewsUpdatesAfterUri"] = updatesAfterNewsUri;
}
if (!_.isUndefined(updatesafterBlogUri)) {
if (updatesafterBlogUri !== undefined) {
_this.params["recentActivityArticlesNewsUpdatesAfterUri"] = updatesafterBlogUri;
}
if (!_.isUndefined(updatesAfterPrUri)) {
if (updatesAfterPrUri !== undefined) {
_this.params["recentActivityArticlesNewsUpdatesAfterUri"] = updatesAfterPrUri;
}
_this.params["recentActivityArticlesMandatorySourceLocation"] = mandatorySourceLocation;
if (!!returnInfo) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("recentActivityArticles"));
if (returnInfo) {
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("recentActivityArticles"));
}

@@ -740,0 +768,0 @@ return _this;

@@ -5,3 +5,3 @@ import { Query, QueryParamsBase } from "./base";

import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
/**

@@ -47,3 +47,3 @@ * @class QueryEvent

*/
constructor(er: EventRegistry, eventUri: string, args?: EventRegistryStatic.QueryEvent.IteratorArguments);
constructor(er: EventRegistry, eventUri: string, args?: ER.QueryEvent.IteratorArguments);
/**

@@ -66,3 +66,3 @@ * Async Iterator function that returns the next item in the list of articles

private extractResults;
private readonly current;
private get current();
private getNextBatch;

@@ -89,3 +89,3 @@ }

params: any;
constructor(args?: EventRegistryStatic.QueryEvent.RequestEventArticlesArguments);
constructor(args?: ER.QueryEvent.RequestEventArticlesArguments);
}

@@ -99,3 +99,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvent.RequestEventArticleUriWgtsArguments);
constructor(args?: ER.QueryEvent.RequestEventArticleUriWgtsArguments);
}

@@ -135,3 +135,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvent.RequestEventArticleTrendArguments);
constructor(args?: ER.QueryEvent.RequestEventArticleTrendArguments);
}

@@ -145,3 +145,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvent.RequestEventSimilarEventsArguments);
constructor(args?: ER.QueryEvent.RequestEventSimilarEventsArguments);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -28,6 +30,7 @@ function __() { this.constructor = d; }

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -42,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -69,4 +72,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -90,10 +95,16 @@ };

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestEventSimilarEvents = exports.RequestEventArticleTrend = exports.RequestEventDateMentionAggr = exports.RequestEventSourceAggr = exports.RequestEventKeywordAggr = exports.RequestEventArticleUriWgts = exports.RequestEventArticles = exports.RequestEventInfo = exports.RequestEvent = exports.QueryEventArticlesIter = exports.QueryEvent = void 0;
var base_1 = require("./base");
var returnInfo_1 = require("./returnInfo");
var logger_1 = require("./logger");
/**

@@ -149,5 +160,7 @@ * @class QueryEvent

_this.index = 0;
_this.callback = _.noop;
_this.doneCallback = _.noop;
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.startSourceRankPercentile, startSourceRankPercentile = _u === void 0 ? 0 : _u, _v = args.endSourceRankPercentile, endSourceRankPercentile = _v === void 0 ? 100 : _v, _w = args.minSentiment, minSentiment = _w === void 0 ? -1 : _w, _x = args.maxSentiment, maxSentiment = _x === void 0 ? 1 : _x;
_this.callback = function () { return undefined; };
_this.doneCallback = function () { return undefined; };
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"]
_v = args.startSourceRankPercentile, // "simple", "exact", "phrase"]
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;
_this.er = er;

@@ -168,15 +181,16 @@ _this.sortBy = sortBy;

_this.setQueryArrVal(lang, "lang", undefined, "or");
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
if (!_.isUndefined(dateMentionStart)) {
if (dateMentionStart !== undefined) {
_this.setDateVal("dateMentionStart", dateMentionStart);
}
if (!_.isUndefined(dateMentionEnd)) {
if (dateMentionEnd !== undefined) {
_this.setDateVal("dateMentionEnd", dateMentionEnd);
}
_this.setValIfNotDefault("keywordLoc", keywordsLoc, "body");
_this.setValIfNotDefault("keywordSearchMode", keywordSearchMode, "phrase");
if (startSourceRankPercentile < 0 || startSourceRankPercentile % 10 !== 0 || startSourceRankPercentile > 100) {

@@ -233,4 +247,5 @@ throw new Error("StartSourceRankPercentile: Value should be in range 0-90 and divisible by 10.");

var response;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:

@@ -240,7 +255,7 @@ this.setRequestedResult(new RequestEventArticles(this.getQueryParams()));

case 1:
response = _a.sent();
if (_.has(response, "error")) {
console.error(_.get(response, "error"));
response = _e.sent();
if (!!(response === null || response === void 0 ? void 0 : response.error)) {
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");
}
return [2 /*return*/, _.get(response[this.eventUri], "articles.totalResults", 0)];
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];
}

@@ -290,5 +305,7 @@ });

QueryEventArticlesIter.prototype.extractResults = function (response) {
var results = _.get(response[this.eventUri], "articles.results", []);
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : _.size(results);
return _.compact(_.pullAt(results, _.range(0, extractedSize)));
var _a, _b;
var results = ((_b = (_a = response[this.eventUri]) === null || _a === void 0 ? void 0 : _a.articles) === null || _b === void 0 ? void 0 : _b.results) || [];
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : results.length;
var extractedResults = results.slice(0, extractedSize);
return extractedResults.filter(Boolean);
};

@@ -299,3 +316,3 @@ Object.defineProperty(QueryEventArticlesIter.prototype, "current", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -306,6 +323,7 @@ });

var response, error, results, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a.trys.push([0, 2, , 3]);
_e.trys.push([0, 2, , 3]);
this.page += 1;

@@ -317,21 +335,21 @@ if (this.page > this.pages || (this.maxItems !== -1 && this.returnedSoFar >= this.maxItems)) {

if (this.er.verboseOutput) {
console.log("Downloading page " + this.page + "...");
this.er.logger.info("Downloading page ".concat(this.page, "..."));
}
return [4 /*yield*/, this.er.execQuery(this, this.er.allowUseOfArchive)];
case 1:
response = _a.sent();
error = _.get(response[this.eventUri], "error", "");
response = _e.sent();
error = ((_a = response[this.eventUri]) === null || _a === void 0 ? void 0 : _a.error) || "";
if (error) {
this.errorMessage = "Error while obtaining a list of articles: " + _.get(response[this.eventUri], "error");
this.errorMessage = "Error while obtaining a list of articles: ".concat((_b = response[this.eventUri]) === null || _b === void 0 ? void 0 : _b.error);
}
else {
this.pages = _.get(response[this.eventUri], "articles.pages", 0);
this.pages = ((_d = (_c = response[this.eventUri]) === null || _c === void 0 ? void 0 : _c.articles) === null || _d === void 0 ? void 0 : _d.pages) || 0;
}
results = this.extractResults(response);
this.returnedSoFar += _.size(results);
this.items = __spread(this.items, results);
this.returnedSoFar += results.length;
this.items = __spreadArray(__spreadArray([], __read(this.items), false), __read(results), false);
return [2 /*return*/, true];
case 2:
error_1 = _a.sent();
console.error(error_1);
error_1 = _e.sent();
this.er.logger.error(error_1);
return [2 /*return*/, false];

@@ -349,3 +367,3 @@ case 3: return [2 /*return*/];

function RequestEvent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.path = "/api/v1/event/getEvent";

@@ -404,12 +422,12 @@ return _this;

_this.setQueryArrVal(lang, "articlesLang", undefined, "or");
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
if (!_.isUndefined(dateMentionStart)) {
if (dateMentionStart !== undefined) {
_this.setDateVal("dateMentionStart", dateMentionStart);
}
if (!_.isUndefined(dateMentionEnd)) {
if (dateMentionEnd !== undefined) {
_this.setDateVal("dateMentionEnd", dateMentionEnd);

@@ -433,4 +451,4 @@ }

}
if (!!returnInfo) {
_this.params = _.extend({}, _this.params, _this.getQueryParams(), returnInfo.getParams("articles"));
if (returnInfo) {
_this.params = __assign(__assign(__assign({}, _this.params), _this.getQueryParams()), returnInfo.getParams("articles"));
}

@@ -453,7 +471,7 @@ return _this;

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"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventArticleUriWgts: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestEventArticleUriWgts: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}
_this.params = {};
if (!_.isUndefined(lang)) {
if (lang !== undefined) {
_this.params["articlesLang"] = lang;

@@ -495,3 +513,3 @@ }

function RequestEventSourceAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "sourceExAggr";

@@ -510,3 +528,3 @@ return _this;

function RequestEventDateMentionAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "dateMentionAggr";

@@ -529,4 +547,4 @@ return _this;

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"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventArticleTrend: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestEventArticleTrend: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -544,3 +562,3 @@ if (page < 1) {

_this.params["articleTrendMinArticleCosSim"] = minArticleCosSim;
_this.params = _.extend({}, _this.params, returnInfo.getParams("articleTrend"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articleTrend"));
return _this;

@@ -562,4 +580,4 @@ }

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"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventSimilarEvents: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestEventSimilarEvents: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -569,3 +587,3 @@ if (count > 50) {

}
if (!_.isArray(conceptInfoList)) {
if (!Array.isArray(conceptInfoList)) {
throw new Error("Concept info list is not an array");

@@ -578,6 +596,6 @@ }

_this.params["eventsCount"] = count;
if (!!dateStart) {
if (dateStart) {
_this.params["dateStart"] = base_1.QueryParamsBase.encodeDateTime(dateStart, "YYYY-MM-DD");
}
if (!!dateEnd) {
if (dateEnd) {
_this.params["dateEnd"] = base_1.QueryParamsBase.encodeDateTime(dateEnd, "YYYY-MM-DD");

@@ -588,3 +606,3 @@ }

_this.params["resultType"] = "similarEvents";
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -591,0 +609,0 @@ }

@@ -5,3 +5,3 @@ import { Query } from "./base";

import { ReturnInfo } from "./returnInfo";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
/**

@@ -13,4 +13,4 @@ * @class QueryEvents

params: {};
constructor(args?: EventRegistryStatic.QueryEvents.Arguments);
readonly path: string;
constructor(args?: ER.QueryEvents.Arguments);
get path(): string;
/**

@@ -49,3 +49,3 @@ * Set the single result type that you would like to be returned. Any previously set result types will be overwritten.

private errorMessage;
constructor(er: EventRegistry, args?: EventRegistryStatic.QueryEvents.IteratorArguments);
constructor(er: EventRegistry, args?: ER.QueryEvents.IteratorArguments);
/**

@@ -62,3 +62,3 @@ * Async Iterator function that returns the next item in the list of events

execQuery(callback: (item: Data.Event) => void, doneCallback?: (error?: string) => void): void;
static initWithComplexQuery(er: any, complexQuery: any, args?: EventRegistryStatic.QueryEvents.IteratorArguments): QueryEventsIter;
static initWithComplexQuery(er: any, complexQuery: any, args?: ER.QueryEvents.IteratorArguments): QueryEventsIter;
private iterate;

@@ -70,3 +70,3 @@ /**

private extractResults;
private readonly current;
private get current();
private getNextBatch;

@@ -83,3 +83,3 @@ }

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsInfoArguments);
constructor(args?: ER.QueryEvents.RequestEventsInfoArguments);
}

@@ -93,4 +93,4 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsUriWgtListArguments);
page: any;
constructor(args?: ER.QueryEvents.RequestEventsUriWgtListArguments);
set page(page: number);
}

@@ -123,3 +123,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsLocAggrArguments);
constructor(args?: ER.QueryEvents.RequestEventsLocAggrArguments);
}

@@ -133,3 +133,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsLocTimeAggrArguments);
constructor(args?: ER.QueryEvents.RequestEventsLocTimeAggrArguments);
}

@@ -143,3 +143,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsConceptAggrArguments);
constructor(args?: ER.QueryEvents.RequestEventsConceptAggrArguments);
}

@@ -153,3 +153,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsConceptGraphArguments);
constructor(args?: ER.QueryEvents.RequestEventsConceptGraphArguments);
}

@@ -166,3 +166,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsConceptMatrixArguments);
constructor(args?: ER.QueryEvents.RequestEventsConceptMatrixArguments);
}

@@ -176,3 +176,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsConceptTrendsArguments);
constructor(args?: ER.QueryEvents.RequestEventsConceptTrendsArguments);
}

@@ -186,3 +186,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsSourceAggrArguments);
constructor(args?: ER.QueryEvents.RequestEventsSourceAggrArguments);
}

@@ -196,3 +196,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsDateMentionAggrArguments);
constructor(args?: ER.QueryEvents.RequestEventsDateMentionAggrArguments);
}

@@ -206,3 +206,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsEventClustersArguments);
constructor(args?: ER.QueryEvents.RequestEventsEventClustersArguments);
}

@@ -225,3 +225,3 @@ /**

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsRecentActivityArguments);
constructor(args?: ER.QueryEvents.RequestEventsRecentActivityArguments);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,7 +18,19 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -31,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -58,4 +72,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -79,11 +95,17 @@ };

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestEventsRecentActivity = exports.RequestEventsCategoryAggr = exports.RequestEventsEventClusters = exports.RequestEventsDateMentionAggr = exports.RequestEventsSourceAggr = exports.RequestEventsConceptTrends = exports.RequestEventsConceptMatrix = exports.RequestEventsConceptGraph = exports.RequestEventsConceptAggr = exports.RequestEventsLocTimeAggr = exports.RequestEventsLocAggr = exports.RequestEventsKeywordAggr = exports.RequestEventsTimeAggr = exports.RequestEventsUriWgtList = exports.RequestEventsInfo = exports.RequestEvents = exports.QueryEventsIter = exports.QueryEvents = void 0;
var base_1 = require("./base");
var query_1 = require("./query");
var returnInfo_1 = require("./returnInfo");
var logger_1 = require("./logger");
/**

@@ -99,3 +121,3 @@ * @class QueryEvents

_this.params = {};
var keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, authorUri = args.authorUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, reportingDateStart = args.reportingDateStart, reportingDateEnd = args.reportingDateEnd, _a = args.minSentiment, minSentiment = _a === void 0 ? -1 : _a, _b = args.maxSentiment, maxSentiment = _b === void 0 ? 1 : _b, minArticlesInEvent = args.minArticlesInEvent, maxArticlesInEvent = args.maxArticlesInEvent, dateMentionStart = args.dateMentionStart, dateMentionEnd = args.dateMentionEnd, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreAuthorUri = args.ignoreAuthorUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, _c = args.keywordsLoc, keywordsLoc = _c === void 0 ? "body" : _c, _d = args.ignoreKeywordsLoc, ignoreKeywordsLoc = _d === void 0 ? "body" : _d, _e = args.categoryIncludeSub, categoryIncludeSub = _e === void 0 ? true : _e, _f = args.ignoreCategoryIncludeSub, ignoreCategoryIncludeSub = _f === void 0 ? true : _f, _g = args.requestedResult, requestedResult = _g === void 0 ? new RequestEventsInfo() : _g;
var keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, authorUri = args.authorUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, reportingDateStart = args.reportingDateStart, reportingDateEnd = args.reportingDateEnd, _a = args.minSentiment, minSentiment = _a === void 0 ? -1 : _a, _b = args.maxSentiment, maxSentiment = _b === void 0 ? 1 : _b, minArticlesInEvent = args.minArticlesInEvent, maxArticlesInEvent = args.maxArticlesInEvent, dateMentionStart = args.dateMentionStart, dateMentionEnd = args.dateMentionEnd, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreAuthorUri = args.ignoreAuthorUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, _c = args.keywordsLoc, keywordsLoc = _c === void 0 ? "body" : _c, _d = args.ignoreKeywordsLoc, ignoreKeywordsLoc = _d === void 0 ? "body" : _d, _e = args.keywordSearchMode, keywordSearchMode = _e === void 0 ? "phrase" : _e, _f = args.ignoreKeywordSearchMode, ignoreKeywordSearchMode = _f === void 0 ? "phrase" : _f, _g = args.categoryIncludeSub, categoryIncludeSub = _g === void 0 ? true : _g, _h = args.ignoreCategoryIncludeSub, ignoreCategoryIncludeSub = _h === void 0 ? true : _h, _j = args.requestedResult, requestedResult = _j === void 0 ? new RequestEventsInfo() : _j;
_this.setVal("action", "getEvents");

@@ -111,12 +133,12 @@ _this.setQueryArrVal(keywords, "keyword", "keywordOper", "and");

_this.setQueryArrVal(lang, "lang", undefined, "or");
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);
}
if (!_.isUndefined(reportingDateStart)) {
if (reportingDateStart !== undefined) {
_this.setDateVal("reportingDateStart", reportingDateStart);
}
if (!_.isUndefined(reportingDateEnd)) {
if (reportingDateEnd !== undefined) {
_this.setDateVal("reportingDateEnd", reportingDateEnd);

@@ -132,6 +154,6 @@ }

_this.setValIfNotDefault("maxArticlesInEvent", maxArticlesInEvent, undefined);
if (!_.isUndefined(dateMentionStart)) {
if (dateMentionStart !== undefined) {
_this.setDateVal("dateMentionStart", dateMentionStart);
}
if (!_.isUndefined(dateMentionEnd)) {
if (dateMentionEnd !== undefined) {
_this.setDateVal("dateMentionEnd", dateMentionEnd);

@@ -151,2 +173,4 @@ }

_this.setValIfNotDefault("ignoreKeywordLoc", ignoreKeywordsLoc, "body");
_this.setValIfNotDefault("keywordSearchMode", keywordSearchMode, "phrase");
_this.setValIfNotDefault("ignoreKeywordSearchMode", ignoreKeywordSearchMode, "phrase");
_this.setValIfNotDefault("categoryIncludeSub", categoryIncludeSub, true);

@@ -161,3 +185,3 @@ _this.setValIfNotDefault("ignoreCategoryIncludeSub", ignoreCategoryIncludeSub, true);

},
enumerable: true,
enumerable: false,
configurable: true

@@ -182,3 +206,3 @@ });

var query = new QueryEvents();
if (!_.isArray(uriList)) {
if (!Array.isArray(uriList)) {
throw new Error("uriList has to be a list of strings that represent event uris");

@@ -188,3 +212,3 @@ }

action: "getEvents",
eventUriList: _.join(uriList, ","),
eventUriList: uriList.join(","),
};

@@ -195,3 +219,3 @@ return query;

var query = new QueryEvents();
if (!_.isArray(uriWgtList)) {
if (!Array.isArray(uriWgtList)) {
throw new Error("uriWgtList has to be a list of strings that represent event uris");

@@ -201,3 +225,3 @@ }

action: "getEvents",
eventUriWgtList: _.join(uriWgtList, ","),
eventUriWgtList: uriWgtList.join(","),
};

@@ -211,3 +235,3 @@ return query;

}
else if (_.isString(complexQuery)) {
else if (typeof complexQuery === 'string') {
try {

@@ -217,7 +241,7 @@ JSON.parse(complexQuery);

catch (_a) {
console.error("Failed to parse the provided string content as a JSON object. Please check the content provided as a parameter to the initWithComplexQuery() method");
logger_1.Logger.error("Failed to parse the provided string content as a JSON object. Please check the content provided as a parameter to the initWithComplexQuery() method");
}
query.setVal("query", complexQuery);
}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === 'object' && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -247,4 +271,4 @@ }

_this.index = 0;
_this.callback = _.noop;
_this.doneCallback = _.noop;
_this.callback = function () { return undefined; };
_this.doneCallback = function () { return undefined; };
var _a = args.sortBy, sortBy = _a === void 0 ? "rel" : _a, _b = args.sortByAsc, sortByAsc = _b === void 0 ? false : _b, _c = args.returnInfo, returnInfo = _c === void 0 ? undefined : _c, _d = args.maxItems, maxItems = _d === void 0 ? -1 : _d;

@@ -286,4 +310,5 @@ _this.er = er;

var response;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -293,7 +318,7 @@ this.setRequestedResult(new RequestEventsInfo());

case 1:
response = _a.sent();
if (_.has(response, "error")) {
console.error(_.get(response, "error"));
response = _b.sent();
if (response === null || response === void 0 ? void 0 : response.error) {
this.er.logger.error(response.error);
}
return [2 /*return*/, _.get(response, "events.totalResults", 0)];
return [2 /*return*/, ((_a = response === null || response === void 0 ? void 0 : response.events) === null || _a === void 0 ? void 0 : _a.totalResults) || 0];
}

@@ -323,6 +348,6 @@ });

}
else if (_.isString(complexQuery)) {
else if (typeof complexQuery === "string") {
query.setVal("query", complexQuery);
}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === "object" && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -361,5 +386,6 @@ }

QueryEventsIter.prototype.extractResults = function (response) {
var results = _.get(response, "events.results", []);
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : _.size(results);
return _.compact(_.pullAt(results, _.range(0, extractedSize)));
var _a;
var results = ((_a = response === null || response === void 0 ? void 0 : response.events) === null || _a === void 0 ? void 0 : _a.results) || [];
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : results.length;
return results.slice(0, extractedSize).filter(Boolean);
};

@@ -370,3 +396,3 @@ Object.defineProperty(QueryEventsIter.prototype, "current", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -377,6 +403,7 @@ });

var requestEventsInfo, response, error, results, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a.trys.push([0, 2, , 3]);
_b.trys.push([0, 2, , 3]);
this.page += 1;

@@ -395,21 +422,21 @@ if (this.page > this.pages || (this.maxItems !== -1 && this.returnedSoFar >= this.maxItems)) {

if (this.er.verboseOutput) {
console.log("Downloading event page " + this.page + "...");
this.er.logger.info("Downloading event page ".concat(this.page, "..."));
}
return [4 /*yield*/, this.er.execQuery(this, this.er.allowUseOfArchive)];
case 1:
response = _a.sent();
error = _.get(response, "error", "");
response = _b.sent();
error = response.error || "";
if (error) {
this.errorMessage = "Error while obtaining a list of events: " + _.get(response, "error");
this.errorMessage = "Error while obtaining a list of events: ".concat(response.error);
}
else {
this.pages = _.get(response, "events.pages", 0);
this.pages = ((_a = response.events) === null || _a === void 0 ? void 0 : _a.pages) || 0;
}
results = this.extractResults(response);
this.returnedSoFar += _.size(results);
this.items = __spread(this.items, results);
this.returnedSoFar += results.length;
this.items = __spreadArray(__spreadArray([], __read(this.items), false), __read(results), false);
return [2 /*return*/, true];
case 2:
error_1 = _a.sent();
console.error(error_1);
error_1 = _b.sent();
this.er.logger.error(error_1);
return [2 /*return*/, false];

@@ -453,3 +480,3 @@ case 3: return [2 /*return*/];

if (!!returnInfo) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("events"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("events"));
}

@@ -472,4 +499,4 @@ return _this;

var _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 50000 : _b, _c = args.sortBy, sortBy = _c === void 0 ? "rel" : _c, _d = args.sortByAsc, sortByAsc = _d === void 0 ? false : _d, unsupported = __rest(args, ["page", "count", "sortBy", "sortByAsc"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventsUriWgtList: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestEventsUriWgtList: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -494,5 +521,5 @@ if (page < 1) {

}
_.set(this.params, "uriWgtListPage", page);
this.params["uriWgtListPage"] = page;
},
enumerable: true,
enumerable: false,
configurable: true

@@ -510,3 +537,3 @@ });

function RequestEventsTimeAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "timeAggr";

@@ -531,3 +558,3 @@ return _this;

_this.params = {};
if (!_.isUndefined(lang)) {
if (lang !== undefined) {
_this.params["keywordAggrLang"] = lang;

@@ -551,4 +578,4 @@ }

var _a = args.eventsSampleSize, eventsSampleSize = _a === void 0 ? 100000 : _a, _b = args.returnInfo, returnInfo = _b === void 0 ? new returnInfo_1.ReturnInfo() : _b, unsupported = __rest(args, ["eventsSampleSize", "returnInfo"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventsLocAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestEventsLocAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -560,3 +587,3 @@ if (eventsSampleSize > 100000) {

_this.params["locAggrSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("locAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("locAggr"));
return _this;

@@ -578,4 +605,4 @@ }

var _a = args.eventsSampleSize, eventsSampleSize = _a === void 0 ? 100000 : _a, _b = args.returnInfo, returnInfo = _b === void 0 ? new returnInfo_1.ReturnInfo() : _b, unsupported = __rest(args, ["eventsSampleSize", "returnInfo"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestEventsLocTimeAggr: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestEventsLocTimeAggr: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -587,3 +614,3 @@ if (eventsSampleSize > 100000) {

_this.params["locTimeAggrSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("locTimeAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("locTimeAggr"));
return _this;

@@ -614,3 +641,3 @@ }

_this.params["conceptAggrSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptAggr"));
return _this;

@@ -645,3 +672,3 @@ }

_this.params["conceptGraphSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptGraph"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptGraph"));
return _this;

@@ -676,3 +703,3 @@ }

_this.params["conceptMatrixSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptMatrix"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptMatrix"));
return _this;

@@ -699,6 +726,6 @@ }

_this.params["conceptTrendsConceptCount"] = conceptCount;
if (!_.isEmpty(conceptUris)) {
if (conceptUris.length > 0) {
_this.params["conceptTrendsConceptUri"] = conceptUris;
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptTrends"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptTrends"));
return _this;

@@ -729,3 +756,3 @@ }

_this.params["sourceAggrSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("sourceAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("sourceAggr"));
return _this;

@@ -754,3 +781,3 @@ }

_this.params["dateMentionAggrSampleSize"] = eventsSampleSize;
_this.params = _.extend({}, _this.params, returnInfo.getParams("dateMentionAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("dateMentionAggr"));
return _this;

@@ -781,3 +808,3 @@ }

_this.params["eventClustersMaxEventsToCluster"] = maxEventsToCluster;
_this.params = _.extend({}, _this.params, returnInfo.getParams("eventClusters"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("eventClusters"));
return _this;

@@ -818,3 +845,3 @@ }

}
if (!_.isUndefined(updatesAfterTm) && !_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterTm !== undefined && updatesAfterMinsAgo !== undefined) {
throw new Error("You should specify either updatesAfterTm or updatesAfterMinsAgo parameter, but not both");

@@ -825,6 +852,6 @@ }

_this.params["recentActivityEventsMandatoryLocation"] = mandatoryLocation;
if (!_.isUndefined(updatesAfterTm)) {
if (updatesAfterTm !== undefined) {
_this.params["recentActivityEventsUpdatesAfterTm"] = base_1.QueryParamsBase.encodeDateTime(updatesAfterTm);
}
if (!_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterMinsAgo !== undefined) {
_this.params["recentActivityEventsUpdatesAfterMinsAgo"] = updatesAfterMinsAgo;

@@ -834,3 +861,3 @@ }

if (!!returnInfo) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("recentActivityEvents"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("recentActivityEvents"));
}

@@ -837,0 +864,0 @@ return _this;

import { Query } from "./base";
import { EventRegistry } from "./eventRegistry";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare class QueryMentions extends Query<RequestMentions> {
params: {};
constructor(args?: EventRegistryStatic.QueryMentions.Arguments);
readonly path: string;
constructor(args?: ER.QueryMentions.Arguments);
get path(): string;
/**

@@ -31,3 +31,3 @@ * Set the single result type that you would like to be returned. Any previously set result types will be overwritten.

private errorMessage;
constructor(er: EventRegistry, args?: EventRegistryStatic.QueryMentions.IteratorArguments);
constructor(er: EventRegistry, args?: ER.QueryMentions.IteratorArguments);
[Symbol.asyncIterator](): AsyncIterator<Record<string, any>>;

@@ -41,3 +41,3 @@ count(): Promise<number>;

execQuery(callback: (item: any) => void, doneCallback?: (error?: any) => void): void;
static initWithComplexQuery(er: any, complexQuery: any, args?: EventRegistryStatic.QueryMentions.IteratorArguments): QueryMentionsIter;
static initWithComplexQuery(er: any, complexQuery: any, args?: ER.QueryMentions.IteratorArguments): QueryMentionsIter;
private iterate;

@@ -49,3 +49,3 @@ /**

private extractResults;
private readonly current;
private get current();
private getNextBatch;

@@ -58,4 +58,4 @@ }

params: any;
constructor(args?: EventRegistryStatic.QueryEvents.RequestEventsInfoArguments);
page: any;
constructor(args?: ER.QueryEvents.RequestEventsInfoArguments);
set page(page: number);
}

@@ -65,4 +65,4 @@ export declare class RequestMentionsUriWgtList extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsUriWgtListArguments);
page: any;
constructor(args?: ER.QueryMentions.RequestMentionsUriWgtListArguments);
set page(page: any);
}

@@ -75,3 +75,3 @@ export declare class RequestMentionsTimeAggr extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsConceptAggrArguments);
constructor(args?: ER.QueryMentions.RequestMentionsConceptAggrArguments);
}

@@ -81,3 +81,3 @@ export declare class RequestMentionsCategoryAggr extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsCategoryAggrArguments);
constructor(args?: ER.QueryMentions.RequestMentionsCategoryAggrArguments);
}

@@ -87,3 +87,3 @@ export declare class RequestMentionsSourceAggr extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsSourceAggrArguments);
constructor(args?: ER.QueryMentions.RequestMentionsSourceAggrArguments);
}

@@ -93,3 +93,3 @@ export declare class RequestMentionsKeywordAggr extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsKeywordAggrArguments);
constructor(args?: ER.QueryMentions.RequestMentionsKeywordAggrArguments);
}

@@ -99,3 +99,3 @@ export declare class RequestMentionsConceptGraph extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsConceptGraphArguments);
constructor(args?: ER.QueryMentions.RequestMentionsConceptGraphArguments);
}

@@ -105,3 +105,3 @@ export declare class RequestMentionsRecentActivity extends RequestMentions {

params: any;
constructor(args?: EventRegistryStatic.QueryMentions.RequestMentionsRecentActivityArguments);
constructor(args?: ER.QueryMentions.RequestMentionsRecentActivityArguments);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,7 +18,19 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -31,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -58,4 +72,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -79,10 +95,16 @@ };

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestMentionsRecentActivity = exports.RequestMentionsConceptGraph = exports.RequestMentionsKeywordAggr = exports.RequestMentionsSourceAggr = exports.RequestMentionsCategoryAggr = exports.RequestMentionsConceptAggr = exports.RequestMentionsTimeAggr = exports.RequestMentionsUriWgtList = exports.RequestMentionsInfo = exports.RequestMentions = exports.QueryMentionsIter = exports.QueryMentions = void 0;
var base_1 = require("./base");
var returnInfo_1 = require("./returnInfo");
var logger_1 = require("./logger");
var QueryMentions = /** @class */ (function (_super) {

@@ -94,3 +116,3 @@ __extends(QueryMentions, _super);

_this.params = {};
var eventTypeUri = args.eventTypeUri, keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, industryUri = args.industryUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, ignoreEventTypeUri = args.ignoreEventTypeUri, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreIndustryUri = args.ignoreIndustryUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, showDuplicates = args.showDuplicates, _a = args.startSourceRankPercentile, startSourceRankPercentile = _a === void 0 ? 0 : _a, _b = args.endSourceRankPercentile, endSourceRankPercentile = _b === void 0 ? 100 : _b, _c = args.minSentiment, minSentiment = _c === void 0 ? -1 : _c, _d = args.maxSentiment, maxSentiment = _d === void 0 ? 1 : _d, _e = args.requestedResult, requestedResult = _e === void 0 ? new RequestMentions() : _e;
var eventTypeUri = args.eventTypeUri, keywords = args.keywords, conceptUri = args.conceptUri, categoryUri = args.categoryUri, sourceUri = args.sourceUri, sourceLocationUri = args.sourceLocationUri, sourceGroupUri = args.sourceGroupUri, industryUri = args.industryUri, sdgUri = args.sdgUri, sasbUri = args.sasbUri, esgUri = args.esgUri, locationUri = args.locationUri, lang = args.lang, dateStart = args.dateStart, dateEnd = args.dateEnd, ignoreEventTypeUri = args.ignoreEventTypeUri, ignoreKeywords = args.ignoreKeywords, ignoreConceptUri = args.ignoreConceptUri, ignoreCategoryUri = args.ignoreCategoryUri, ignoreSourceUri = args.ignoreSourceUri, ignoreSourceLocationUri = args.ignoreSourceLocationUri, ignoreSourceGroupUri = args.ignoreSourceGroupUri, ignoreIndustryUri = args.ignoreIndustryUri, ignoreSdgUri = args.ignoreSdgUri, ignoreSasbUri = args.ignoreSasbUri, ignoreEsgUri = args.ignoreEsgUri, ignoreLocationUri = args.ignoreLocationUri, ignoreLang = args.ignoreLang, showDuplicates = args.showDuplicates, _a = args.startSourceRankPercentile, startSourceRankPercentile = _a === void 0 ? 0 : _a, _b = args.endSourceRankPercentile, endSourceRankPercentile = _b === void 0 ? 100 : _b, _c = args.minSentiment, minSentiment = _c === void 0 ? -1 : _c, _d = args.maxSentiment, maxSentiment = _d === void 0 ? 1 : _d, minSentenceIndex = args.minSentenceIndex, maxSentenceIndex = args.maxSentenceIndex, _e = args.requestedResult, requestedResult = _e === void 0 ? new RequestMentions() : _e;
_this.setVal("action", "getMentions");

@@ -105,8 +127,11 @@ _this.setQueryArrVal(eventTypeUri, "eventTypeUri", undefined, "or");

_this.setQueryArrVal(industryUri, "industryUri", "industryOper", "or");
_this.setQueryArrVal(sdgUri, "sdgUri", undefined, "or");
_this.setQueryArrVal(sasbUri, "sasbUri", undefined, "or");
_this.setQueryArrVal(esgUri, "esgUri", undefined, "or");
_this.setQueryArrVal(locationUri, "locationUri", undefined, "or");
_this.setQueryArrVal(lang, "lang", undefined, "or");
if (!_.isUndefined(dateStart)) {
if (dateStart !== undefined) {
_this.setDateVal("dateStart", dateStart);
}
if (!_.isUndefined(dateEnd)) {
if (dateEnd !== undefined) {
_this.setDateVal("dateEnd", dateEnd);

@@ -122,2 +147,5 @@ }

_this.setQueryArrVal(ignoreIndustryUri, "ignoreIndustryUri", undefined, "or");
_this.setQueryArrVal(ignoreSdgUri, "ignoreSdgUri", undefined, "or");
_this.setQueryArrVal(ignoreSasbUri, "ignoreSasbUri", undefined, "or");
_this.setQueryArrVal(ignoreEsgUri, "ignoreEsgUri", undefined, "or");
_this.setQueryArrVal(ignoreLocationUri, "ignoreLocationUri", undefined, "or");

@@ -147,2 +175,8 @@ _this.setQueryArrVal(ignoreLang, "ignoreLang", undefined, "or");

}
if (!!minSentenceIndex && minSentenceIndex > 0) {
_this.setVal("minSentenceIndex", minSentenceIndex);
}
if (!!maxSentenceIndex && maxSentenceIndex > 0) {
_this.setVal("maxSentenceIndex", maxSentenceIndex);
}
_this.setRequestedResult(requestedResult);

@@ -155,3 +189,3 @@ return _this;

},
enumerable: true,
enumerable: false,
configurable: true

@@ -173,3 +207,3 @@ });

var q = new QueryMentions();
if (!_.isArray(uriList)) {
if (!Array.isArray(uriList)) {
throw new Error("uriList has to be a list of strings that represent mention uris");

@@ -184,3 +218,3 @@ }

var q = new QueryMentions();
if (!_.isArray(uriWgtList)) {
if (!Array.isArray(uriWgtList)) {
throw new Error("uriList has to be a list of strings that represent mention uris");

@@ -190,3 +224,3 @@ }

action: "getMentions",
mentionUriWgtList: _.join(uriWgtList, ","),
mentionUriWgtList: uriWgtList.join(","),
};

@@ -197,6 +231,6 @@ return q;

var query = new QueryMentions();
if (_.isString(complexQuery)) {
if (typeof complexQuery === "string") {
query.setVal("query", complexQuery);
}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === "object" && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -222,4 +256,4 @@ }

_this.index = 0;
_this.callback = _.noop;
_this.doneCallback = _.noop;
_this.callback = function () { };
_this.doneCallback = function () { };
var _a = args.sortBy, sortBy = _a === void 0 ? "rel" : _a, _b = args.sortByAsc, sortByAsc = _b === void 0 ? false : _b, _c = args.returnInfo, returnInfo = _c === void 0 ? undefined : _c, _d = args.maxItems, maxItems = _d === void 0 ? -1 : _d;

@@ -258,4 +292,5 @@ _this.er = er;

var response;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -265,7 +300,7 @@ this.setRequestedResult(new RequestMentionsInfo());

case 1:
response = _a.sent();
if (_.has(response, "error")) {
console.error(_.get(response, "error"));
response = _b.sent();
if (response === null || response === void 0 ? void 0 : response.error) {
this.er.logger.error(response.error);
}
return [2 /*return*/, _.get(response, "mentions.totalResults", 0)];
return [2 /*return*/, ((_a = response.mentions) === null || _a === void 0 ? void 0 : _a.totalResults) || 0];
}

@@ -292,6 +327,6 @@ });

var query = new QueryMentionsIter(er, args);
if (_.isString(complexQuery)) {
if (typeof complexQuery === "string") {
query.setVal("query", complexQuery);
}
else if (_.isObject(complexQuery)) {
else if (typeof complexQuery === "object" && complexQuery !== null) {
query.setVal("query", JSON.stringify(complexQuery));

@@ -330,5 +365,6 @@ }

QueryMentionsIter.prototype.extractResults = function (response) {
var results = _.get(response, "mentions.results", []);
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : _.size(results);
return _.compact(_.pullAt(results, _.range(0, extractedSize)));
var _a;
var results = ((_a = response.mentions) === null || _a === void 0 ? void 0 : _a.results) || [];
var extractedSize = this.maxItems !== -1 ? this.maxItems - this.returnedSoFar : results.length;
return results.slice(0, extractedSize).filter(Boolean);
};

@@ -339,3 +375,3 @@ Object.defineProperty(QueryMentionsIter.prototype, "current", {

},
enumerable: true,
enumerable: false,
configurable: true

@@ -346,6 +382,7 @@ });

var requestMentionsInfo, response, error, results, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a.trys.push([0, 2, , 3]);
_b.trys.push([0, 2, , 3]);
this.page += 1;

@@ -364,21 +401,21 @@ if (this.page > this.pages || (this.maxItems !== -1 && this.returnedSoFar >= this.maxItems)) {

if (this.er.verboseOutput) {
console.log("Downloading mentions page " + this.page + "...");
this.er.logger.info("Downloading mentions page ".concat(this.page, "..."));
}
return [4 /*yield*/, this.er.execQuery(this, this.er.allowUseOfArchive)];
case 1:
response = _a.sent();
error = _.get(response, "error", "");
response = _b.sent();
error = (response === null || response === void 0 ? void 0 : response.error) || "";
if (error) {
this.errorMessage = "Error while obtaining a list of mentions: " + _.get(response, "error");
this.errorMessage = "Error while obtaining a list of mentions: ".concat(response === null || response === void 0 ? void 0 : response.error);
}
else {
this.pages = _.get(response, "mentions.pages", 0);
this.pages = ((_a = response.mentions) === null || _a === void 0 ? void 0 : _a.pages) || 0;
}
results = this.extractResults(response);
this.returnedSoFar += _.size(results);
this.items = __spread(this.items, results);
this.returnedSoFar += results.length;
this.items = __spreadArray(__spreadArray([], __read(this.items), false), __read(results), false);
return [2 /*return*/, true];
case 2:
error_1 = _a.sent();
console.error(error_1);
error_1 = _b.sent();
this.er.logger.error(error_1);
return [2 /*return*/, false];

@@ -417,4 +454,4 @@ case 3: return [2 /*return*/];

_this.params["mentionsSortByAsc"] = sortByAsc;
if (!!returnInfo) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("mentions"));
if (returnInfo) {
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("mentions"));
}

@@ -428,5 +465,5 @@ return _this;

}
_.set(this.params, "mentionsPage", page);
this.params["mentionsPage"] = page;
},
enumerable: true,
enumerable: false,
configurable: true

@@ -444,4 +481,4 @@ });

var _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 10000 : _b, _c = args.sortBy, sortBy = _c === void 0 ? "fq" : _c, _d = args.sortByAsc, sortByAsc = _d === void 0 ? false : _d, unsupported = __rest(args, ["page", "count", "sortBy", "sortByAsc"]);
if (!_.isEmpty(unsupported)) {
console.warn("RequestMentionsUriWgtList: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length !== 0) {
logger_1.Logger.warn("RequestMentionsUriWgtList: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -466,5 +503,5 @@ if (page < 1) {

}
_.set(this.params, "uriWgtListPage", page);
this.params["uriWgtListPage"] = page;
},
enumerable: true,
enumerable: false,
configurable: true

@@ -478,3 +515,3 @@ });

function RequestMentionsTimeAggr() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.resultType = "timeAggr";

@@ -506,3 +543,3 @@ return _this;

}
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptAggr"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptAggr"));
return _this;

@@ -581,3 +618,3 @@ }

_this.params["conceptGraphSkipQueryConcepts"] = skipQueryConcepts;
_this.params = _.extend({}, _this.params, returnInfo.getParams("conceptGraph"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("conceptGraph"));
return _this;

@@ -598,6 +635,6 @@ }

}
if (!_.isUndefined(updatesAfterTm) && !_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterTm !== undefined && updatesAfterMinsAgo !== undefined) {
throw new Error("You should specify either updatesAfterTm or updatesAfterMinsAgo parameter, but not both");
}
if (!_.isUndefined(updatesUntilTm) && !_.isUndefined(updatesUntilMinsAgo)) {
if (updatesUntilTm !== undefined && updatesUntilMinsAgo !== undefined) {
throw new Error("You should specify either updatesUntilTm or updatesUntilMinsAgo parameter, but not both");

@@ -607,20 +644,20 @@ }

_this.params["recentActivityMentionsMaxMentionCount"] = maxMentionCount;
if (!_.isUndefined(updatesAfterTm)) {
if (updatesAfterTm !== undefined) {
_this.params["recentActivityMentionsUpdatesAfterTm"] = base_1.QueryParamsBase.encodeDateTime(updatesAfterTm);
}
if (!_.isUndefined(updatesAfterMinsAgo)) {
if (updatesAfterMinsAgo !== undefined) {
_this.params["recentActivityMentionsUpdatesAfterMinsAgo"] = updatesAfterMinsAgo;
}
if (!_.isUndefined(updatesUntilTm)) {
if (updatesUntilTm !== undefined) {
_this.params["recentActivityMentionsUpdatesUntilTm"] = base_1.QueryParamsBase.encodeDateTime(updatesUntilTm);
}
if (!_.isUndefined(updatesUntilMinsAgo)) {
if (updatesUntilMinsAgo !== undefined) {
_this.params["recentActivityMentionsUpdatesUntilMinsAgo"] = updatesUntilMinsAgo;
}
if (!_.isUndefined(updatesAfterUri)) {
if (updatesAfterUri !== undefined) {
_this.params["recentActivityMentionsUpdatesAfterUri"] = updatesAfterUri;
}
_this.params["recentActivityMentionsMandatorySourceLocation"] = mandatorySourceLocation;
if (!_.isUndefined(returnInfo)) {
_this.params = _.extend({}, _this.params, returnInfo.getParams("recentActivityMentions"));
if (returnInfo !== undefined) {
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("recentActivityMentions"));
}

@@ -627,0 +664,0 @@ return _this;

@@ -5,3 +5,3 @@ import { Query } from "./base";

constructor(storyUriOrList: any);
readonly path: string;
get path(): string;
/**

@@ -8,0 +8,0 @@ * Search stories by their uri(s)

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,2 +18,13 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -22,10 +35,13 @@ var t = {};

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.RequestStorySimilarStories = exports.RequestStoryArticleTrend = exports.RequestStoryArticleUris = exports.RequestStoryArticles = exports.RequestStoryInfo = exports.RequestStory = exports.QueryStory = void 0;
var base_1 = require("./base");
var returnInfo_1 = require("./returnInfo");
var logger_1 = require("./logger");
var QueryStory = /** @class */ (function (_super) {

@@ -43,3 +59,3 @@ __extends(QueryStory, _super);

},
enumerable: true,
enumerable: false,
configurable: true

@@ -84,7 +100,8 @@ });

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.count, count = _c === void 0 ? 100 : _c, _d = _a.sortBy, sortBy = _d === void 0 ? "cosSim" : _d, _e = _a.sortByAsc, sortByAsc = _e === void 0 ? false : _e, _f = _a.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo({ articleInfo: new returnInfo_1.ArticleInfoFlags({ bodyLen: 200 }) }) : _f, unsupported = __rest(_a, ["page", "count", "sortBy", "sortByAsc", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "articles";
if (!_.isEmpty(unsupported)) {
console.warn("RequestStoryArticles: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestStoryArticles: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -102,3 +119,3 @@ if (page < 1) {

_this.params["articlesSortByAsc"] = sortByAsc;
_this.params = _.extend({}, _this.params, returnInfo.getParams("articles"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articles"));
return _this;

@@ -113,7 +130,8 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.sortBy, sortBy = _b === void 0 ? "cosSim" : _b, _c = _a.sortByAsc, sortByAsc = _c === void 0 ? false : _c, unsupported = __rest(_a, ["sortBy", "sortByAsc"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "articleUris";
if (!_.isEmpty(unsupported)) {
console.warn("RequestStoryArticleUris: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestStoryArticleUris: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -132,7 +150,8 @@ _this.params = {};

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.lang, lang = _b === void 0 ? base_1.mainLangs : _b, _c = _a.minArticleCosSim, minArticleCosSim = _c === void 0 ? -1 : _c, _d = _a.returnInfo, returnInfo = _d === void 0 ? new returnInfo_1.ReturnInfo({ articleInfo: new returnInfo_1.ArticleInfoFlags({ bodyLen: 0 }) }) : _d, unsupported = __rest(_a, ["lang", "minArticleCosSim", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "articleTrend";
if (!_.isEmpty(unsupported)) {
console.warn("RequestStoryArticleTrend: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestStoryArticleTrend: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -142,3 +161,3 @@ _this.params = {};

_this.params["articleTrendMinArticleCosSim"] = minArticleCosSim;
_this.params = _.extend({}, _this.params, returnInfo.getParams("articles"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("articles"));
return _this;

@@ -153,7 +172,8 @@ }

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.conceptInfoList, conceptInfoList = _b === void 0 ? undefined : _b, _c = _a.count, count = _c === void 0 ? 50 : _c, _d = _a.dateStart, dateStart = _d === void 0 ? undefined : _d, _e = _a.dateEnd, dateEnd = _e === void 0 ? undefined : _e, _f = _a.lang, lang = _f === void 0 ? [] : _f, _g = _a.returnInfo, returnInfo = _g === void 0 ? new returnInfo_1.ReturnInfo() : _g, unsupported = __rest(_a, ["conceptInfoList", "count", "dateStart", "dateEnd", "lang", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.resultType = "similarStories";
if (!_.isEmpty(unsupported)) {
console.warn("RequestStorySimilarStories: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("RequestStorySimilarStories: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -163,3 +183,3 @@ if (count > 50) {

}
if (!_.isArray(conceptInfoList)) {
if (!Array.isArray(conceptInfoList)) {
throw new Error("Concept list is not an array!");

@@ -177,6 +197,6 @@ }

}
if (!_.isEmpty(lang)) {
if (lang.length > 0) {
_this.params["lang"] = lang;
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("similarStories"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("similarStories"));
return _this;

@@ -183,0 +203,0 @@ }

@@ -11,4 +11,4 @@ import { QueryParamsBase } from "./base";

});
readonly path: string;
getUpdates(): Promise<any>;
get path(): string;
getUpdates(): Promise<{}>;
}

@@ -22,4 +22,4 @@ export declare class GetRecentArticles extends QueryParamsBase {

});
readonly path: string;
getUpdates(): Promise<any>;
get path(): string;
getUpdates(): Promise<unknown[]>;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,7 +18,19 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -31,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -58,10 +72,12 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
return {
if (o && typeof o.length === "number") return {
next: function () {

@@ -72,2 +88,3 @@ if (o && i >= o.length) o = void 0;

};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};

@@ -91,3 +108,3 @@ var __read = (this && this.__read) || function (o, n) {

Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetRecentArticles = exports.GetRecentEvents = void 0;
var base_1 = require("./base");

@@ -102,6 +119,6 @@ var returnInfo_1 = require("./returnInfo");

_this.setVal("recentActivityEventsMandatoryLocation", mandatoryLocation);
if (!_.isUndefined(mandatoryLang)) {
if (mandatoryLang !== undefined) {
_this.setVal("recentActivityEventsMandatoryLang", mandatoryLang);
}
_this.params = _.extend({}, _this.params, returnInfo.getParams("recentActivityEvents"));
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("recentActivityEvents"));
return _this;

@@ -113,3 +130,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -120,8 +137,9 @@ });

var response;
return __generator(this, function (_a) {
switch (_a.label) {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.er.execQuery(this)];
case 1:
response = _a.sent();
return [2 /*return*/, _.get(response, "recentActivityEvents.activity", {})];
response = _b.sent();
return [2 /*return*/, ((_a = response.recentActivityEvents) === null || _a === void 0 ? void 0 : _a.activity) || {}];
}

@@ -138,11 +156,12 @@ });

if (_a === void 0) { _a = {}; }
var _this = this;
var _b = _a.mandatorySourceLocation, mandatorySourceLocation = _b === void 0 ? undefined : _b, _c = _a.lang, lang = _c === void 0 ? undefined : _c, _d = _a.returnInfo, returnInfo = _d === void 0 ? new returnInfo_1.ReturnInfo() : _d, kwargs = __rest(_a, ["mandatorySourceLocation", "lang", "returnInfo"]);
var _this = _super.call(this) || this;
_this = _super.call(this) || this;
_this.er = er;
_this.setVal("recentActivityArticlesMandatorySourceLocation", mandatorySourceLocation);
if (!_.isUndefined(lang)) {
if (lang !== undefined) {
_this.setVal("recentActivityArticlesLang", lang);
}
_this.params = _.extend({}, _this.params, kwargs);
_this.params = _.extend({}, _this.params, returnInfo.getParams("recentActivityArticles"));
_this.params = __assign(__assign({}, _this.params), kwargs);
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams("recentActivityArticles"));
return _this;

@@ -154,3 +173,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -160,3 +179,4 @@ });

return __awaiter(this, void 0, void 0, function () {
var e_1, _a, response, _b, _c, _d, key, value, splitKey;
var response, _a, _b, _c, key, value, splitKey;
var e_1, _d;
return __generator(this, function (_e) {

@@ -167,8 +187,8 @@ switch (_e.label) {

response = _e.sent();
if (_.has(response, "recentActivityArticles")) {
if (response === null || response === void 0 ? void 0 : response.recentActivityArticles) {
try {
for (_b = __values(_.entries(_.get(response, "recentActivityArticles.newestUri", {}))), _c = _b.next(); !_c.done; _c = _b.next()) {
_d = __read(_c.value, 2), key = _d[0], value = _d[1];
splitKey = _.split(key, "");
this.setVal("recentActivityArticles" + _.upperCase(splitKey[0]) + _.join(_.tail(splitKey)), value);
for (_a = __values(Object.entries(response.recentActivityArticles.newestUri || {})), _b = _a.next(); !_b.done; _b = _a.next()) {
_c = __read(_b.value, 2), key = _c[0], value = _c[1];
splitKey = key.split("");
this.setVal("recentActivityArticles" + splitKey[0].toUpperCase() + splitKey.slice(1).join(""), value);
}

@@ -179,7 +199,7 @@ }

try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
}
finally { if (e_1) throw e_1.error; }
}
return [2 /*return*/, _.get(response, "recentActivityArticles.activity", [])];
return [2 /*return*/, response.recentActivityArticles.activity || []];
}

@@ -186,0 +206,0 @@ return [2 /*return*/, []];

@@ -1,3 +0,2 @@

import * as _ from "lodash";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare abstract class ReturnInfoFlagsBase<T extends {}> {

@@ -8,3 +7,6 @@ protected type: string;

setValue(key: string, value: any, defaultValue?: any, skipKeyMod?: boolean): void;
getProperties(prefix?: string): _.Dictionary<never>;
getProperties(prefix?: string): {
[key: string]: any;
};
private camelCase;
addProperties(properties: object): void;

@@ -34,3 +36,3 @@ private setProperty;

});
getParams(prefix?: string): {};
getParams(prefix?: string): Record<string, unknown>;
/**

@@ -42,28 +44,28 @@ * load the configuration for the ReturnInfo from a filename

}
export declare class ArticleInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.ArticleInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.ArticleInfo);
export declare class ArticleInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.ArticleInfoFlags> {
constructor(params?: ER.ReturnInfo.ArticleInfo);
}
export declare class StoryInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.StoryInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.StoryInfo);
export declare class StoryInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.StoryInfoFlags> {
constructor(params?: ER.ReturnInfo.StoryInfo);
}
export declare class EventInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.EventInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.EventInfo);
export declare class EventInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.EventInfoFlags> {
constructor(params?: ER.ReturnInfo.EventInfo);
}
export declare class SourceInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.SourceInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.SourceInfo);
export declare class SourceInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.SourceInfoFlags> {
constructor(params?: ER.ReturnInfo.SourceInfo);
}
export declare class CategoryInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.CategoryInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.CategoryInfo);
export declare class CategoryInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.CategoryInfoFlags> {
constructor(params?: ER.ReturnInfo.CategoryInfo);
}
export declare class ConceptInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.ConceptInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.ConceptInfo);
export declare class ConceptInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.ConceptInfoFlags> {
constructor(params?: ER.ReturnInfo.ConceptInfo);
}
export declare class LocationInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.LocationInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.LocationInfo);
export declare class LocationInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.LocationInfoFlags> {
constructor(params?: ER.ReturnInfo.LocationInfo);
}
export declare class ConceptClassInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.ConceptClassInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.ConceptClassInfo);
export declare class ConceptClassInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.ConceptClassInfoFlags> {
constructor(params?: ER.ReturnInfo.ConceptClassInfo);
}
export declare class ConceptFolderInfoFlags extends ReturnInfoFlagsBase<EventRegistryStatic.ReturnInfo.ConceptFolderInfoFlags> {
constructor(params?: EventRegistryStatic.ReturnInfo.ConceptFolderInfo);
export declare class ConceptFolderInfoFlags extends ReturnInfoFlagsBase<ER.ReturnInfo.ConceptFolderInfoFlags> {
constructor(params?: ER.ReturnInfo.ConceptFolderInfo);
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,2 +18,13 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -22,9 +35,12 @@ var t = {};

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.ConceptFolderInfoFlags = exports.ConceptClassInfoFlags = exports.LocationInfoFlags = exports.ConceptInfoFlags = exports.CategoryInfoFlags = exports.SourceInfoFlags = exports.EventInfoFlags = exports.StoryInfoFlags = exports.ArticleInfoFlags = exports.ReturnInfo = exports.ReturnInfoFlagsBase = void 0;
var fs = require("fs");
var logger_1 = require("./logger");
var ReturnInfoFlagsBase = /** @class */ (function () {

@@ -35,7 +51,7 @@ function ReturnInfoFlagsBase() {

ReturnInfoFlagsBase.prototype.setFlag = function (key, value, defaultValue) {
this.setProperty("Include" + this.type + _.upperFirst(key), value, defaultValue);
this.setProperty("Include" + this.type + key.charAt(0).toUpperCase() + key.slice(1), value, defaultValue);
};
ReturnInfoFlagsBase.prototype.setValue = function (key, value, defaultValue, skipKeyMod) {
if (skipKeyMod === void 0) { skipKeyMod = false; }
var constructedKey = skipKeyMod ? _.upperFirst(key) : this.type + _.upperFirst(key);
var constructedKey = skipKeyMod ? key.charAt(0).toUpperCase() + key.slice(1) : this.type + key.charAt(0).toUpperCase() + key.slice(1);
this.setProperty(constructedKey, value, defaultValue);

@@ -45,11 +61,23 @@ };

if (prefix === void 0) { prefix = ""; }
return _.mapKeys(this.data, function (value, key) {
if (_.startsWith(_.toLower(key), _.toLower(prefix))) {
return _.camelCase(key);
var result = {};
for (var key in this.data) {
if (Object.prototype.hasOwnProperty.call(this.data, key)) {
var value = this.data[key];
var lowercaseKey = key.toLowerCase();
var lowercasePrefix = prefix.toLowerCase();
if (lowercaseKey.startsWith(lowercasePrefix)) {
result[this.camelCase(key)] = value;
}
else {
result[this.camelCase(prefix + key)] = value;
}
}
else {
return _.camelCase(prefix + key);
}
});
}
return result;
};
ReturnInfoFlagsBase.prototype.camelCase = function (str) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
return index === 0 ? word.toLowerCase() : word.toUpperCase();
}).replace(/\s+/g, '');
};
ReturnInfoFlagsBase.prototype.addProperties = function (properties) {

@@ -72,3 +100,3 @@ if (properties instanceof Object) {

if (value !== defaultValue) {
_.set(this.data, key, value);
this.data[key] = value;
}

@@ -84,4 +112,4 @@ };

var _b = _a.articleInfo, articleInfo = _b === void 0 ? new ArticleInfoFlags() : _b, _c = _a.eventInfo, eventInfo = _c === void 0 ? new EventInfoFlags() : _c, _d = _a.sourceInfo, sourceInfo = _d === void 0 ? new SourceInfoFlags() : _d, _e = _a.categoryInfo, categoryInfo = _e === void 0 ? new CategoryInfoFlags() : _e, _f = _a.conceptInfo, conceptInfo = _f === void 0 ? new ConceptInfoFlags() : _f, _g = _a.locationInfo, locationInfo = _g === void 0 ? new LocationInfoFlags() : _g, _h = _a.storyInfo, storyInfo = _h === void 0 ? new StoryInfoFlags() : _h, _j = _a.conceptClassInfo, conceptClassInfo = _j === void 0 ? new ConceptClassInfoFlags() : _j, _k = _a.conceptFolderInfo, conceptFolderInfo = _k === void 0 ? new ConceptFolderInfoFlags() : _k, unsupported = __rest(_a, ["articleInfo", "eventInfo", "sourceInfo", "categoryInfo", "conceptInfo", "locationInfo", "storyInfo", "conceptClassInfo", "conceptFolderInfo"]);
if (!_.isEmpty(unsupported)) {
console.warn("ReturnInfo: Unsupported parameters detected: " + JSON.stringify(unsupported) + ". Please check the documentation.");
if (Object.keys(unsupported).length > 0) {
logger_1.Logger.warn("ReturnInfo: Unsupported parameters detected: ".concat(JSON.stringify(unsupported), ". Please check the documentation."));
}

@@ -99,3 +127,3 @@ this.articleInfo = articleInfo;

ReturnInfo.prototype.getParams = function (prefix) {
return _.extend({}, this.articleInfo.getProperties(prefix), this.eventInfo.getProperties(prefix), this.sourceInfo.getProperties(prefix), this.categoryInfo.getProperties(prefix), this.conceptInfo.getProperties(prefix), this.locationInfo.getProperties(prefix), this.storyInfo.getProperties(prefix), this.conceptClassInfo.getProperties(prefix), this.conceptFolderInfo.getProperties(prefix));
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, this.articleInfo.getProperties(prefix)), this.eventInfo.getProperties(prefix)), this.sourceInfo.getProperties(prefix)), this.categoryInfo.getProperties(prefix)), this.conceptInfo.getProperties(prefix)), this.locationInfo.getProperties(prefix)), this.storyInfo.getProperties(prefix)), this.conceptClassInfo.getProperties(prefix)), this.conceptFolderInfo.getProperties(prefix));
};

@@ -108,15 +136,15 @@ /**

if (!(fs && fs.existsSync(filename))) {
throw new Error("File " + filename + " does not exist");
throw new Error("File ".concat(filename, " does not exist"));
}
var conf = JSON.parse(fs.readFileSync(filename, "utf8"));
return new ReturnInfo({
articleInfo: new ArticleInfoFlags(_.get(conf, "articleInfo", {})),
eventInfo: new EventInfoFlags(_.get(conf, "eventInfo", {})),
sourceInfo: new SourceInfoFlags(_.get(conf, "sourceInfo", {})),
categoryInfo: new CategoryInfoFlags(_.get(conf, "categoryInfo", {})),
conceptInfo: new ConceptInfoFlags(_.get(conf, "conceptInfo", {})),
locationInfo: new LocationInfoFlags(_.get(conf, "locationInfo", {})),
storyInfo: new StoryInfoFlags(_.get(conf, "storyInfo", {})),
conceptClassInfo: new ConceptClassInfoFlags(_.get(conf, "conceptClassInfo", {})),
conceptFolderInfo: new ConceptFolderInfoFlags(_.get(conf, "conceptFolderInfo", {})),
articleInfo: new ArticleInfoFlags(conf.articleInfo || {}),
eventInfo: new EventInfoFlags(conf.eventInfo || {}),
sourceInfo: new SourceInfoFlags(conf.sourceInfo || {}),
categoryInfo: new CategoryInfoFlags(conf.categoryInfo || {}),
conceptInfo: new ConceptInfoFlags(conf.conceptInfo || {}),
locationInfo: new LocationInfoFlags(conf.locationInfo || {}),
storyInfo: new StoryInfoFlags(conf.storyInfo || {}),
conceptClassInfo: new ConceptClassInfoFlags(conf.conceptClassInfo || {}),
conceptFolderInfo: new ConceptFolderInfoFlags(conf.conceptFolderInfo || {}),
});

@@ -123,0 +151,0 @@ };

import { QueryParamsBase } from "./base";
import { EventRegistry } from "./eventRegistry";
import { EventRegistryStatic } from "./types";
import { ER } from "./types";
export declare class TopicPage extends QueryParamsBase {

@@ -16,3 +16,3 @@ private eventRegistry;

*/
loadTopicPageFromER(uri: string): Promise<EventRegistryStatic.TopicPage>;
loadTopicPageFromER(uri: string): Promise<ER.TopicPage>;
/**

@@ -31,3 +31,3 @@ * Load the topic page definition from an object

*/
saveTopicPageDefinition(): EventRegistryStatic.TopicPage;
saveTopicPageDefinition(): ER.TopicPage;
/**

@@ -41,7 +41,7 @@ * Save the topic page definition to a file

*/
articleThreshold: number;
set articleThreshold(value: number);
/**
* What is the minimum total weight that an event has to have in order to get it among the results?
*/
eventThreshold: number;
set eventThreshold(value: number);
/**

@@ -53,3 +53,3 @@ * Some articles can be duplicates of other articles. What should be done with them. Possible values are:

*/
articleIsDuplicateFilter: "skipDuplicates" | "keepOnlyDuplicates" | "keepAll";
set articleIsDuplicateFilter(value: "skipDuplicates" | "keepOnlyDuplicates" | "keepAll");
/**

@@ -62,3 +62,3 @@ * Some articles describe a known event and some don't. This filter allows you to filter the resulting articles based on this criteria.

*/
articleHasEventFilter: "skipArticlesWithoutEvent" | "keepOnlyArticlesWithoutEvent" | "keepAll";
set articleHasEventFilter(value: "skipArticlesWithoutEvent" | "keepOnlyArticlesWithoutEvent" | "keepAll");
/**

@@ -70,3 +70,3 @@ * Some articles are later copied by others. What should be done with such articles. Possible values are:

*/
articleHasDuplicateFilter: "skipHasDuplicates" | "keepOnlyHasDuplicates" | "keepAll";
set articleHasDuplicateFilter(value: "skipHasDuplicates" | "keepOnlyHasDuplicates" | "keepAll");
/**

@@ -76,9 +76,9 @@ * What data types should we search? "news" (news content, default), "pr" (press releases), or "blog".

*/
dataTypes: EventRegistryStatic.DataType | EventRegistryStatic.DataType[];
sourceRankStartPercentile: number;
sourceRankEndPercentile: number;
set dataTypes(dataTypes: ER.DataType | ER.DataType[]);
set sourceRankStartPercentile(startPercentile: number);
set sourceRankEndPercentile(endPercentile: number);
/**
* What is the maximum allowed age of the results?
*/
maxDaysBack: number;
set maxDaysBack(maxDaysBack: number);
clearConcepts(): void;

@@ -96,3 +96,3 @@ clearKeywords(): void;

*/
addConcept(uri: string, wgt: number, args?: EventRegistryStatic.TopicPageAddConceptArguments): void;
addConcept(uri: string, wgt: number, args?: ER.TopicPageAddConceptArguments): void;
/**

@@ -103,3 +103,3 @@ * Add a relevant keyword to the topic page

*/
addKeyword(keyword: string, wgt: number, args?: EventRegistryStatic.TopicPageAddKeywordArguments): void;
addKeyword(keyword: string, wgt: number, args?: ER.TopicPageAddKeywordArguments): void;
/**

@@ -110,3 +110,3 @@ * Add a relevant category to the topic page

*/
addCategory(uri: string, wgt: number, args?: EventRegistryStatic.TopicPageAddCategoryArguments): void;
addCategory(uri: string, wgt: number, args?: ER.TopicPageAddCategoryArguments): void;
/**

@@ -117,3 +117,3 @@ * Add a news source to the topic page

*/
addSource(uri: string, wgt: number, args?: EventRegistryStatic.TopicPageAddSourceArguments): void;
addSource(uri: string, wgt: number, args?: ER.TopicPageAddSourceArguments): void;
/**

@@ -124,3 +124,3 @@ * Add a list of relevant sources by identifying them by their geographic location

*/
addSourceLocation(uri: string, wgt: number, args?: EventRegistryStatic.TopicPageAddSourceLocationArguments): void;
addSourceLocation(uri: string, wgt: number, args?: ER.TopicPageAddSourceLocationArguments): void;
/**

@@ -131,3 +131,3 @@ * Add a list of relevant sources by specifying a whole source group to the topic page

*/
addSourceGroup(uri: string, wgt: number, args?: EventRegistryStatic.TopicPageAddSourceGroupArguments): void;
addSourceGroup(uri: string, wgt: number, args?: ER.TopicPageAddSourceGroupArguments): void;
/**

@@ -142,11 +142,11 @@ * Add relevant location to the topic page

*/
languages: string | string[];
set languages(languages: string | string[]);
/**
* if true then the results have to mention at least one of the specified concepts or keywords
*/
restrictToSetConceptsAndKeywords: boolean;
set restrictToSetConceptsAndKeywords(restrict: boolean);
/**
* if set to true then return only results that are assigned to one of the specified categories
*/
restrictToSetCategories: boolean;
set restrictToSetCategories(restrict: boolean);
/**

@@ -156,17 +156,17 @@ * if set to true then return only results from one of the specified news sources

*/
restrictToSetSources: boolean;
set restrictToSetSources(restrict: boolean);
/**
* if set to true, then return only results that are located at one of the specified locations
*/
restrictToSetLocations: boolean;
set restrictToSetLocations(restrict: boolean);
/**
* Return a list of articles that match the topic page
* @param args {EventRegistryStatic.TopicPageArticles} Object which contains a host of optional parameters
* @param args {ER.TopicPageArticles} Object which contains a host of optional parameters
*/
getArticles(args?: EventRegistryStatic.TopicPageArticles): Promise<any>;
getArticles(args?: ER.TopicPageArticles): Promise<unknown>;
/**
* Return a list of events that match the topic page
* @param args {EventRegistryStatic.TopicPageEvents} Object which contains a host of optional parameters
* @param args {ER.TopicPageEvents} Object which contains a host of optional parameters
*/
getEvents(args?: EventRegistryStatic.TopicPageEvents): Promise<any>;
getEvents(args?: ER.TopicPageEvents): Promise<unknown>;
}

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -28,6 +30,7 @@ function __() { this.constructor = d; }

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -42,3 +45,3 @@ });

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
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;

@@ -69,4 +72,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -90,9 +95,14 @@ };

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TopicPage = void 0;
var fs = require("fs");
var _ = require("lodash");
var base_1 = require("./base");

@@ -132,3 +142,3 @@ var returnInfo_1 = require("./returnInfo");

TopicPage.prototype.isTopicPage = function (definition) {
return _.isEqual(_.keys(this.emptyTopicPage), _.keys(definition));
return Object.keys(this.emptyTopicPage).sort().toString() === Object.keys(definition).sort().toString();
};

@@ -145,4 +155,5 @@ TopicPage.prototype.createEmptyTopicPage = function () {

var params, _a;
return __generator(this, function (_b) {
switch (_b.label) {
var _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:

@@ -161,7 +172,7 @@ params = {

case 1:
_a.concept = _b.sent();
if (_.has(this.concept, "data.error")) {
throw new Error(_.get(this.concept, "data.error", ""));
_a.concept = _e.sent();
if ((_c = (_b = this.concept) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) {
throw new Error(this.concept.data.error || "");
}
this.topicPage = _.extend({}, this.topicPage, _.get(this.concept, "data.topicPage", {}));
this.topicPage = __assign(__assign({}, this.topicPage), (((_d = this.concept.data) === null || _d === void 0 ? void 0 : _d.topicPage) || {}));
return [2 /*return*/, this.topicPage];

@@ -211,7 +222,7 @@ }

set: function (value) {
if (_.isNumber(value) && value >= 0) {
if (typeof value === "number" && value >= 0) {
this.topicPage.articleTreshWgt = value;
}
},
enumerable: true,
enumerable: false,
configurable: true

@@ -224,7 +235,7 @@ });

set: function (value) {
if (_.isNumber(value) && value >= 0) {
if (typeof value === "number" && value >= 0) {
this.topicPage.eventTreshWgt = value;
}
},
enumerable: true,
enumerable: false,
configurable: true

@@ -244,3 +255,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -261,3 +272,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -277,3 +288,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -289,3 +300,3 @@ });

},
enumerable: true,
enumerable: false,
configurable: true

@@ -295,3 +306,3 @@ });

set: function (startPercentile) {
if (_.isUndefined(startPercentile)) {
if (startPercentile === undefined) {
startPercentile = 0;

@@ -302,3 +313,3 @@ }

}
if (!_.isNil(this.topicPage.endSourceRankPercentile) && _.isNumber(this.topicPage.endSourceRankPercentile) && startPercentile >= this.topicPage.endSourceRankPercentile) {
if (this.topicPage.endSourceRankPercentile !== null && typeof this.topicPage.endSourceRankPercentile === "number" && startPercentile >= this.topicPage.endSourceRankPercentile) {
throw new RangeError("startPercentile has to be smaller than endPercentile");

@@ -311,3 +322,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -317,3 +328,3 @@ });

set: function (endPercentile) {
if (_.isUndefined(endPercentile)) {
if (endPercentile === undefined) {
endPercentile = 100;

@@ -324,3 +335,3 @@ }

}
if (!_.isNil(this.topicPage.startSourceRankPercentile) && _.isNumber(this.topicPage.startSourceRankPercentile) && this.topicPage.startSourceRankPercentile >= endPercentile) {
if (this.topicPage.startSourceRankPercentile !== null && typeof this.topicPage.startSourceRankPercentile === 'number' && this.topicPage.startSourceRankPercentile >= endPercentile) {
throw new RangeError("startPercentile has to be smaller than endPercentile");

@@ -333,3 +344,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -342,3 +353,3 @@ });

set: function (maxDaysBack) {
if (!_.isNumber(maxDaysBack)) {
if (typeof maxDaysBack !== "number" || maxDaysBack < 0) {
throw new Error("maxDaysBack value has to be a positive number");

@@ -351,3 +362,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -383,3 +394,3 @@ });

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");

@@ -392,9 +403,9 @@ }

var concept = { uri: uri, wgt: wgt, required: required, excluded: excluded };
if (!_.isUndefined(label)) {
_.set(concept, "label", label);
if (label !== undefined) {
concept.label = label;
}
if (!_.isUndefined(conceptType)) {
_.set(concept, "type", conceptType);
if (conceptType !== undefined) {
concept.type = conceptType;
}
this.topicPage.concepts = __spread(this.topicPage.concepts, [concept]);
this.topicPage.concepts = __spreadArray(__spreadArray([], __read(this.topicPage.concepts), false), [concept], false);
};

@@ -408,7 +419,7 @@ /**

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
var _a = args.required, required = _a === void 0 ? false : _a, _b = args.excluded, excluded = _b === void 0 ? false : _b;
this.topicPage.keywords = __spread(this.topicPage.keywords, [{ keyword: keyword, wgt: wgt, required: required, excluded: excluded }]);
this.topicPage.keywords = __spreadArray(__spreadArray([], __read(this.topicPage.keywords), false), [{ keyword: keyword, wgt: wgt, required: required, excluded: excluded }], false);
};

@@ -422,7 +433,7 @@ /**

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
var _a = args.required, required = _a === void 0 ? false : _a, _b = args.excluded, excluded = _b === void 0 ? false : _b;
this.topicPage.categories = __spread(this.topicPage.categories, [{ uri: uri, wgt: wgt, required: required, excluded: excluded }]);
this.topicPage.categories = __spreadArray(__spreadArray([], __read(this.topicPage.categories), false), [{ uri: uri, wgt: wgt, required: required, excluded: excluded }], false);
};

@@ -436,7 +447,7 @@ /**

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
var _a = args.excluded, excluded = _a === void 0 ? false : _a;
this.topicPage.sources = __spread(this.topicPage.sources, [{ uri: uri, wgt: wgt, excluded: excluded }]);
this.topicPage.sources = __spreadArray(__spreadArray([], __read(this.topicPage.sources), false), [{ uri: uri, wgt: wgt, excluded: excluded }], false);
};

@@ -450,7 +461,7 @@ /**

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
var _a = args.excluded, excluded = _a === void 0 ? false : _a;
this.topicPage.sourceLocations = __spread(this.topicPage.sourceLocations, [{ uri: uri, wgt: wgt, excluded: excluded }]);
this.topicPage.sourceLocations = __spreadArray(__spreadArray([], __read(this.topicPage.sourceLocations), false), [{ uri: uri, wgt: wgt, excluded: excluded }], false);
};

@@ -464,7 +475,7 @@ /**

if (args === void 0) { args = {}; }
if (!_.isNumber(wgt)) {
if (typeof wgt !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
var _a = args.excluded, excluded = _a === void 0 ? false : _a;
this.topicPage.sourceGroups = __spread(this.topicPage.sourceGroups, [{ uri: uri, wgt: wgt, excluded: excluded }]);
this.topicPage.sourceGroups = __spreadArray(__spreadArray([], __read(this.topicPage.sourceGroups), false), [{ uri: uri, wgt: wgt, excluded: excluded }], false);
};

@@ -477,6 +488,6 @@ /**

TopicPage.prototype.addLocation = function (locationUri, weight) {
if (!_.isNumber(weight)) {
if (typeof weight !== "number") {
throw new Error("Weight value has to be a positive or negative number");
}
this.topicPage.locations = __spread(this.topicPage.locations, [{ uri: locationUri, wgt: weight }]);
this.topicPage.locations = __spreadArray(__spreadArray([], __read(this.topicPage.locations), false), [{ uri: locationUri, wgt: weight }], false);
};

@@ -488,6 +499,6 @@ Object.defineProperty(TopicPage.prototype, "languages", {

set: function (languages) {
if (!_.isArray(languages)) {
if (!Array.isArray(languages)) {
languages = [languages];
}
if (_.every(languages, function (language) { return _.size(language) === 3; })) {
if (languages.every(function (language) { return language.length === 3; })) {
this.topicPage.langs = languages;

@@ -499,3 +510,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -508,3 +519,3 @@ });

set: function (restrict) {
if (!_.isBoolean(restrict)) {
if (typeof restrict !== "boolean") {
throw new Error("Restrict value has to be a boolean value");

@@ -514,3 +525,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -523,3 +534,3 @@ });

set: function (restrict) {
if (!_.isBoolean(restrict)) {
if (typeof restrict !== "boolean") {
throw new Error("Restrict value has to be a boolean value");

@@ -529,3 +540,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -539,3 +550,3 @@ });

set: function (restrict) {
if (!_.isBoolean(restrict)) {
if (typeof restrict !== "boolean") {
throw new Error("Restrict value has to be a boolean value");

@@ -545,3 +556,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -554,3 +565,3 @@ });

set: function (restrict) {
if (!_.isBoolean(restrict)) {
if (typeof restrict !== "boolean") {
throw new Error("Restrict value has to be a boolean value");

@@ -560,3 +571,3 @@ }

},
enumerable: true,
enumerable: false,
configurable: true

@@ -566,10 +577,11 @@ });

* Return a list of articles that match the topic page
* @param args {EventRegistryStatic.TopicPageArticles} Object which contains a host of optional parameters
* @param args {ER.TopicPageArticles} Object which contains a host of optional parameters
*/
TopicPage.prototype.getArticles = function (args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
TopicPage.prototype.getArticles = function () {
return __awaiter(this, arguments, void 0, function (args) {
var _a, page, _b, count, _c, sortBy, _d, sortByAsc, _e, dataType, _f, returnInfo, otherParameters, params, request;
return __generator(this, function (_g) {
switch (_g.label) {
var _g;
if (args === void 0) { args = {}; }
return __generator(this, function (_h) {
switch (_h.label) {
case 0:

@@ -583,19 +595,10 @@ _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 100 : _b, _c = args.sortBy, sortBy = _c === void 0 ? "rel" : _c, _d = args.sortByAsc, sortByAsc = _d === void 0 ? false : _d, _e = args.dataType, dataType = _e === void 0 ? "news" : _e, _f = args.returnInfo, returnInfo = _f === void 0 ? new returnInfo_1.ReturnInfo() : _f, otherParameters = __rest(args, ["page", "count", "sortBy", "sortByAsc", "dataType", "returnInfo"]);

}
params = _.extend({}, {
action: "getArticlesForTopicPage",
resultType: "articles",
dataType: this.topicPage.dataType,
articlesCount: count,
articlesSortBy: sortBy,
articlesSortByAsc: sortByAsc,
articlesPage: page,
topicPage: JSON.stringify(this.topicPage),
}, returnInfo.getParams());
if (!_.isEmpty(otherParameters)) {
params = __assign({}, params, otherParameters);
params = __assign({ action: "getArticlesForTopicPage", resultType: "articles", dataType: this.topicPage.dataType, articlesCount: count, articlesSortBy: sortBy, articlesSortByAsc: sortByAsc, articlesPage: page, topicPage: JSON.stringify(this.topicPage) }, returnInfo.getParams());
if (Object.keys(otherParameters).length > 0) {
params = __assign(__assign({}, params), otherParameters);
}
return [4 /*yield*/, this.eventRegistry.jsonRequest("/api/v1/article", params)];
case 1:
request = _g.sent();
return [2 /*return*/, _.get(request, "data", { articles: { results: [] } })];
request = _h.sent();
return [2 /*return*/, (_g = request === null || request === void 0 ? void 0 : request.data) !== null && _g !== void 0 ? _g : { articles: { results: [] } }];
}

@@ -607,10 +610,11 @@ });

* Return a list of events that match the topic page
* @param args {EventRegistryStatic.TopicPageEvents} Object which contains a host of optional parameters
* @param args {ER.TopicPageEvents} Object which contains a host of optional parameters
*/
TopicPage.prototype.getEvents = function (args) {
if (args === void 0) { args = {}; }
return __awaiter(this, void 0, void 0, function () {
TopicPage.prototype.getEvents = function () {
return __awaiter(this, arguments, void 0, function (args) {
var _a, page, _b, count, _c, sortBy, _d, sortByAsc, _e, returnInfo, otherParameters, params, request;
return __generator(this, function (_f) {
switch (_f.label) {
var _f;
if (args === void 0) { args = {}; }
return __generator(this, function (_g) {
switch (_g.label) {
case 0:

@@ -624,19 +628,10 @@ _a = args.page, page = _a === void 0 ? 1 : _a, _b = args.count, count = _b === void 0 ? 50 : _b, _c = args.sortBy, sortBy = _c === void 0 ? "rel" : _c, _d = args.sortByAsc, sortByAsc = _d === void 0 ? false : _d, _e = args.returnInfo, returnInfo = _e === void 0 ? new returnInfo_1.ReturnInfo() : _e, otherParameters = __rest(args, ["page", "count", "sortBy", "sortByAsc", "returnInfo"]);

}
params = _.extend({}, {
action: "getEventsForTopicPage",
resultType: "events",
dataType: this.topicPage.dataType,
eventsCount: count,
eventsSortBy: sortBy,
eventsSortByAsc: sortByAsc,
eventsPage: page,
topicPage: JSON.stringify(this.topicPage),
}, returnInfo.getParams());
if (!_.isEmpty(otherParameters)) {
params = __assign({}, params, otherParameters);
params = __assign({ action: "getEventsForTopicPage", resultType: "events", dataType: this.topicPage.dataType, eventsCount: count, eventsSortBy: sortBy, eventsSortByAsc: sortByAsc, eventsPage: page, topicPage: JSON.stringify(this.topicPage) }, returnInfo.getParams());
if (Object.keys(otherParameters).length > 0) {
params = __assign(__assign({}, params), otherParameters);
}
return [4 /*yield*/, this.eventRegistry.jsonRequest("/api/v1/event", params)];
case 1:
request = _f.sent();
return [2 /*return*/, _.get(request, "data", { events: { results: [] } })];
request = _g.sent();
return [2 /*return*/, (_f = request === null || request === void 0 ? void 0 : request.data) !== null && _f !== void 0 ? _f : { events: { results: [] } }];
}

@@ -643,0 +638,0 @@ });

import { QueryParamsBase } from "./base";
import { ReturnInfo } from "./returnInfo";
export declare abstract class TrendsBase extends QueryParamsBase {
readonly path: string;
get path(): string;
}

@@ -6,0 +6,0 @@ export declare class GetTrendingConcepts extends TrendsBase {

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,4 +18,15 @@ function __() { this.constructor = d; }

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
exports.GetTrendingConceptGroups = exports.GetTrendingCustomItems = exports.GetTrendingCategories = exports.GetTrendingConcepts = exports.TrendsBase = void 0;
var base_1 = require("./base");

@@ -30,3 +43,3 @@ var returnInfo_1 = require("./returnInfo");

},
enumerable: true,
enumerable: false,
configurable: true

@@ -49,3 +62,3 @@ });

_this.setVal("conceptType", conceptType);
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -67,3 +80,3 @@ }

_this.setVal("categoryCount", count);
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -81,3 +94,3 @@ }

_this.setVal("conceptCount", count);
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -96,3 +109,3 @@ }

_this.setVal("conceptCount", count);
_this.params = _.extend({}, _this.params, returnInfo.getParams());
_this.params = __assign(__assign({}, _this.params), returnInfo.getParams());
return _this;

@@ -99,0 +112,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

@@ -5,3 +5,3 @@ {

"description": "Package containing wrapper functions for Event Registry API",
"version": "8.11.2",
"version": "9.1.0",
"license": "MIT",

@@ -28,17 +28,17 @@ "main": "./dist/index.js",

"devDependencies": {
"@types/jasmine": "2.8.6",
"@types/lodash": "4.14.108",
"@types/node": "8.0.50",
"@types/qs": "6.5.1",
"jasmine": "2.8.0",
"tslint": "^6.0.0",
"typescript": "3.0.1"
"@types/jasmine": "5.1.4",
"@types/node": "16.18.1",
"@types/qs": "6.9.15",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"eslint": "8.57.0",
"jasmine": "5.1.0",
"typescript": "5.4.5"
},
"dependencies": {
"axios": "^0.21.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"semaphore-async-await": "^1.5.1",
"winston": "^3.2.1"
"axios": "1.7.2",
"moment": "2.30.1",
"semaphore-async-await": "1.5.1",
"winston": "3.13.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc