diff --git a/dist/impresso-jscommons.js b/dist/impresso-jscommons.js index 9e97545..f218c49 100644 --- a/dist/impresso-jscommons.js +++ b/dist/impresso-jscommons.js @@ -1551,7 +1551,9 @@ var query_pb = createCommonjsModule(function (module, exports) { TYPE_TEXT_REUSE_CLUSTER: 29, TYPE_MENTION_FUNCTION: 30, TYPE_NAG: 31, - TYPE_WIKIDATA_ID: 32 + TYPE_WIKIDATA_ID: 32, + TYPE_DATA_DOMAIN: 33, + TYPE_COPYRIGHT: 34 }; /** diff --git a/dist/impresso-jscommons.min.js b/dist/impresso-jscommons.min.js index 3587934..cb2d1de 100644 --- a/dist/impresso-jscommons.min.js +++ b/dist/impresso-jscommons.min.js @@ -1 +1 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("case"),require("base64-js"),require("google-protobuf")):"function"==typeof define&&define.amd?define(["exports","case","base64-js","google-protobuf"],r):r((e=e||self)["impresso-jscommons"]=e["impresso-jscommons"]||{},e.case,e["base64-js"],e.goog)}(this,(function(e,r,t,o){"use strict";function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var r=1;r{const o="set"+m(e),i=`set${m(e)}List`,s=t[o]||t[i];if(void 0===s)throw new Error(`Unknown property: "${e}"`);s.call(t,r[e])}),t}function g(e){return Object.keys(e).reduce((e,r)=>(r.endsWith("List")&&(e[r.replace(/List$/,"")]=e[r].map(g),delete e[r]),e),e)}var f={fromObject:d,omitUndefinedAndEmptyLists:function(e){return Object.keys(e).reduce((e,r)=>((void 0===e[r]||Array.isArray(e[r])&&0===e[r].length)&&delete e[r],e),e)},fixRepeatedFields:g,getEnumString:function(e,r,t=!1){if(!r||0===r)return;const o=Object.keys(e).find(t=>e[t]===r);if(!o)throw new Error("Unknown enum number: "+r);const i=l(o.split("_").slice(1).join("_"));return t?u(i):i},getEnumNumber:function(e,r){if(void 0===r)return;const t=[Object.keys(e)[0].split("_")[0],u(p(r),"_")].join("_"),o=e[t];if(void 0===o)throw new Error(`Unknown enum value: ${r} (${t})`);return o},serialize:function(e,r,t){if(void 0===r)return;const o=t?t(r):r;return c(d(e,o).serializeBinary())},deserialize:function(e,r,t){const o=g(e.deserializeBinary(y(r)).toObject());return t?t(o):o}};var R=function(e,r){return e(r={exports:{}},r.exports),r.exports}((function(e,r){var t=o,i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==i&&i||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();t.exportSymbol("proto.impresso.query.CollectionRecommender",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommender.RecommenderType",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommenderParameter",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommenderParameter.RecommenderParameterId",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommendersSettings",null,i),t.exportSymbol("proto.impresso.query.DateRange",null,i),t.exportSymbol("proto.impresso.query.Filter",null,i),t.exportSymbol("proto.impresso.query.FilterContext",null,i),t.exportSymbol("proto.impresso.query.FilterOperator",null,i),t.exportSymbol("proto.impresso.query.FilterPrecision",null,i),t.exportSymbol("proto.impresso.query.FilterType",null,i),t.exportSymbol("proto.impresso.query.GroupValue",null,i),t.exportSymbol("proto.impresso.query.SearchQuery",null,i),proto.impresso.query.DateRange=function(e){o.Message.initialize(this,e,0,-1,null,null)},t.inherits(proto.impresso.query.DateRange,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.DateRange.displayName="proto.impresso.query.DateRange"),proto.impresso.query.Filter=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.Filter.repeatedFields_,null)},t.inherits(proto.impresso.query.Filter,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.Filter.displayName="proto.impresso.query.Filter"),proto.impresso.query.SearchQuery=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.SearchQuery.repeatedFields_,null)},t.inherits(proto.impresso.query.SearchQuery,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.SearchQuery.displayName="proto.impresso.query.SearchQuery"),proto.impresso.query.CollectionRecommenderParameter=function(e){o.Message.initialize(this,e,0,-1,null,null)},t.inherits(proto.impresso.query.CollectionRecommenderParameter,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommenderParameter.displayName="proto.impresso.query.CollectionRecommenderParameter"),proto.impresso.query.CollectionRecommender=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.CollectionRecommender.repeatedFields_,null)},t.inherits(proto.impresso.query.CollectionRecommender,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommender.displayName="proto.impresso.query.CollectionRecommender"),proto.impresso.query.CollectionRecommendersSettings=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.CollectionRecommendersSettings.repeatedFields_,null)},t.inherits(proto.impresso.query.CollectionRecommendersSettings,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommendersSettings.displayName="proto.impresso.query.CollectionRecommendersSettings"),o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.DateRange.prototype.toObject=function(e){return proto.impresso.query.DateRange.toObject(e,this)},proto.impresso.query.DateRange.toObject=function(e,r){var t={from:o.Message.getFieldWithDefault(r,1,0),to:o.Message.getFieldWithDefault(r,2,0)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.DateRange.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.DateRange;return proto.impresso.query.DateRange.deserializeBinaryFromReader(t,r)},proto.impresso.query.DateRange.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readSint64();e.setFrom(t);break;case 2:t=r.readSint64();e.setTo(t);break;default:r.skipField()}}return e},proto.impresso.query.DateRange.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.DateRange.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.DateRange.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getFrom())&&r.writeSint64(1,t),0!==(t=e.getTo())&&r.writeSint64(2,t)},proto.impresso.query.DateRange.prototype.getFrom=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.DateRange.prototype.setFrom=function(e){return o.Message.setProto3IntField(this,1,e)},proto.impresso.query.DateRange.prototype.getTo=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.DateRange.prototype.setTo=function(e){return o.Message.setProto3IntField(this,2,e)},proto.impresso.query.Filter.repeatedFields_=[5,7],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.Filter.prototype.toObject=function(e){return proto.impresso.query.Filter.toObject(e,this)},proto.impresso.query.Filter.toObject=function(e,r){var t,i={context:o.Message.getFieldWithDefault(r,1,0),op:o.Message.getFieldWithDefault(r,2,0),type:o.Message.getFieldWithDefault(r,3,0),precision:o.Message.getFieldWithDefault(r,4,0),qList:null==(t=o.Message.getRepeatedField(r,5))?void 0:t,daterange:(t=r.getDaterange())&&proto.impresso.query.DateRange.toObject(e,t),uidsList:null==(t=o.Message.getRepeatedField(r,7))?void 0:t};return e&&(i.$jspbMessageInstance=r),i}),proto.impresso.query.Filter.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.Filter;return proto.impresso.query.Filter.deserializeBinaryFromReader(t,r)},proto.impresso.query.Filter.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setContext(t);break;case 2:t=r.readEnum();e.setOp(t);break;case 3:t=r.readEnum();e.setType(t);break;case 4:t=r.readEnum();e.setPrecision(t);break;case 5:t=r.readString();e.addQ(t);break;case 6:t=new proto.impresso.query.DateRange;r.readMessage(t,proto.impresso.query.DateRange.deserializeBinaryFromReader),e.setDaterange(t);break;case 7:t=r.readString();e.addUids(t);break;default:r.skipField()}}return e},proto.impresso.query.Filter.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.Filter.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.Filter.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getContext())&&r.writeEnum(1,t),0!==(t=e.getOp())&&r.writeEnum(2,t),0!==(t=e.getType())&&r.writeEnum(3,t),0!==(t=e.getPrecision())&&r.writeEnum(4,t),(t=e.getQList()).length>0&&r.writeRepeatedString(5,t),null!=(t=e.getDaterange())&&r.writeMessage(6,t,proto.impresso.query.DateRange.serializeBinaryToWriter),(t=e.getUidsList()).length>0&&r.writeRepeatedString(7,t)},proto.impresso.query.Filter.prototype.getContext=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.Filter.prototype.setContext=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.Filter.prototype.getOp=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.Filter.prototype.setOp=function(e){return o.Message.setProto3EnumField(this,2,e)},proto.impresso.query.Filter.prototype.getType=function(){return o.Message.getFieldWithDefault(this,3,0)},proto.impresso.query.Filter.prototype.setType=function(e){return o.Message.setProto3EnumField(this,3,e)},proto.impresso.query.Filter.prototype.getPrecision=function(){return o.Message.getFieldWithDefault(this,4,0)},proto.impresso.query.Filter.prototype.setPrecision=function(e){return o.Message.setProto3EnumField(this,4,e)},proto.impresso.query.Filter.prototype.getQList=function(){return o.Message.getRepeatedField(this,5)},proto.impresso.query.Filter.prototype.setQList=function(e){return o.Message.setField(this,5,e||[])},proto.impresso.query.Filter.prototype.addQ=function(e,r){return o.Message.addToRepeatedField(this,5,e,r)},proto.impresso.query.Filter.prototype.clearQList=function(){return this.setQList([])},proto.impresso.query.Filter.prototype.getDaterange=function(){return o.Message.getWrapperField(this,proto.impresso.query.DateRange,6)},proto.impresso.query.Filter.prototype.setDaterange=function(e){return o.Message.setWrapperField(this,6,e)},proto.impresso.query.Filter.prototype.clearDaterange=function(){return this.setDaterange(void 0)},proto.impresso.query.Filter.prototype.hasDaterange=function(){return null!=o.Message.getField(this,6)},proto.impresso.query.Filter.prototype.getUidsList=function(){return o.Message.getRepeatedField(this,7)},proto.impresso.query.Filter.prototype.setUidsList=function(e){return o.Message.setField(this,7,e||[])},proto.impresso.query.Filter.prototype.addUids=function(e,r){return o.Message.addToRepeatedField(this,7,e,r)},proto.impresso.query.Filter.prototype.clearUidsList=function(){return this.setUidsList([])},proto.impresso.query.SearchQuery.repeatedFields_=[1],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.SearchQuery.prototype.toObject=function(e){return proto.impresso.query.SearchQuery.toObject(e,this)},proto.impresso.query.SearchQuery.toObject=function(e,r){var t={filtersList:o.Message.toObjectList(r.getFiltersList(),proto.impresso.query.Filter.toObject,e),groupBy:o.Message.getFieldWithDefault(r,2,0)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.SearchQuery.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.SearchQuery;return proto.impresso.query.SearchQuery.deserializeBinaryFromReader(t,r)},proto.impresso.query.SearchQuery.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=new proto.impresso.query.Filter;r.readMessage(t,proto.impresso.query.Filter.deserializeBinaryFromReader),e.addFilters(t);break;case 2:t=r.readEnum();e.setGroupBy(t);break;default:r.skipField()}}return e},proto.impresso.query.SearchQuery.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.SearchQuery.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.SearchQuery.serializeBinaryToWriter=function(e,r){var t=void 0;(t=e.getFiltersList()).length>0&&r.writeRepeatedMessage(1,t,proto.impresso.query.Filter.serializeBinaryToWriter),0!==(t=e.getGroupBy())&&r.writeEnum(2,t)},proto.impresso.query.SearchQuery.prototype.getFiltersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.Filter,1)},proto.impresso.query.SearchQuery.prototype.setFiltersList=function(e){return o.Message.setRepeatedWrapperField(this,1,e)},proto.impresso.query.SearchQuery.prototype.addFilters=function(e,r){return o.Message.addToRepeatedWrapperField(this,1,e,proto.impresso.query.Filter,r)},proto.impresso.query.SearchQuery.prototype.clearFiltersList=function(){return this.setFiltersList([])},proto.impresso.query.SearchQuery.prototype.getGroupBy=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.SearchQuery.prototype.setGroupBy=function(e){return o.Message.setProto3EnumField(this,2,e)},o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommenderParameter.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommenderParameter.toObject(e,this)},proto.impresso.query.CollectionRecommenderParameter.toObject=function(e,r){var t={key:o.Message.getFieldWithDefault(r,1,0),stringValue:o.Message.getFieldWithDefault(r,2,""),numberValue:o.Message.getFieldWithDefault(r,3,0),boolValue:o.Message.getBooleanFieldWithDefault(r,4,!1)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommenderParameter.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommenderParameter;return proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setKey(t);break;case 2:t=r.readString();e.setStringValue(t);break;case 3:t=r.readSint32();e.setNumberValue(t);break;case 4:t=r.readBool();e.setBoolValue(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommenderParameter.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getKey())&&r.writeEnum(1,t),(t=e.getStringValue()).length>0&&r.writeString(2,t),0!==(t=e.getNumberValue())&&r.writeSint32(3,t),(t=e.getBoolValue())&&r.writeBool(4,t)},proto.impresso.query.CollectionRecommenderParameter.RecommenderParameterId={ID_UNSPECIFIED:0,ID_COUNT_TYPE:1,ID_MIN_OCCURRENCES:2,ID_NUMBER_TO_KEEP:3,ID_REMOVE_FULLY_MENTIONED:4,ID_NORMALIZE_MAX_SCORE:5,ID_MARGIN:6,ID_SCALING_FACTOR:7},proto.impresso.query.CollectionRecommenderParameter.prototype.getKey=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.CollectionRecommenderParameter.prototype.setKey=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getStringValue=function(){return o.Message.getFieldWithDefault(this,2,"")},proto.impresso.query.CollectionRecommenderParameter.prototype.setStringValue=function(e){return o.Message.setProto3StringField(this,2,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getNumberValue=function(){return o.Message.getFieldWithDefault(this,3,0)},proto.impresso.query.CollectionRecommenderParameter.prototype.setNumberValue=function(e){return o.Message.setProto3IntField(this,3,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getBoolValue=function(){return o.Message.getBooleanFieldWithDefault(this,4,!1)},proto.impresso.query.CollectionRecommenderParameter.prototype.setBoolValue=function(e){return o.Message.setProto3BooleanField(this,4,e)},proto.impresso.query.CollectionRecommender.repeatedFields_=[3],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommender.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommender.toObject(e,this)},proto.impresso.query.CollectionRecommender.toObject=function(e,r){var t={type:o.Message.getFieldWithDefault(r,1,0),weight:o.Message.getFieldWithDefault(r,2,0),parametersList:o.Message.toObjectList(r.getParametersList(),proto.impresso.query.CollectionRecommenderParameter.toObject,e),enabled:o.Message.getBooleanFieldWithDefault(r,4,!1)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommender.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommender;return proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setType(t);break;case 2:t=r.readSint32();e.setWeight(t);break;case 3:t=new proto.impresso.query.CollectionRecommenderParameter;r.readMessage(t,proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader),e.addParameters(t);break;case 4:t=r.readBool();e.setEnabled(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommender.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommender.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommender.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getType())&&r.writeEnum(1,t),0!==(t=e.getWeight())&&r.writeSint32(2,t),(t=e.getParametersList()).length>0&&r.writeRepeatedMessage(3,t,proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter),(t=e.getEnabled())&&r.writeBool(4,t)},proto.impresso.query.CollectionRecommender.RecommenderType={TYPE_UNSPECIFIED:0,TYPE_TIME_RANGE:1,TYPE_ENTITIES:2,TYPE_TOPICS:3,TYPE_TEXT_REUSE_CLUSTERS:4},proto.impresso.query.CollectionRecommender.prototype.getType=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.CollectionRecommender.prototype.setType=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.CollectionRecommender.prototype.getWeight=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.CollectionRecommender.prototype.setWeight=function(e){return o.Message.setProto3IntField(this,2,e)},proto.impresso.query.CollectionRecommender.prototype.getParametersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.CollectionRecommenderParameter,3)},proto.impresso.query.CollectionRecommender.prototype.setParametersList=function(e){return o.Message.setRepeatedWrapperField(this,3,e)},proto.impresso.query.CollectionRecommender.prototype.addParameters=function(e,r){return o.Message.addToRepeatedWrapperField(this,3,e,proto.impresso.query.CollectionRecommenderParameter,r)},proto.impresso.query.CollectionRecommender.prototype.clearParametersList=function(){return this.setParametersList([])},proto.impresso.query.CollectionRecommender.prototype.getEnabled=function(){return o.Message.getBooleanFieldWithDefault(this,4,!1)},proto.impresso.query.CollectionRecommender.prototype.setEnabled=function(e){return o.Message.setProto3BooleanField(this,4,e)},proto.impresso.query.CollectionRecommendersSettings.repeatedFields_=[1],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommendersSettings.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommendersSettings.toObject(e,this)},proto.impresso.query.CollectionRecommendersSettings.toObject=function(e,r){var t={recommendersList:o.Message.toObjectList(r.getRecommendersList(),proto.impresso.query.CollectionRecommender.toObject,e)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommendersSettings.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommendersSettings;return proto.impresso.query.CollectionRecommendersSettings.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommendersSettings.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=new proto.impresso.query.CollectionRecommender;r.readMessage(t,proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader),e.addRecommenders(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommendersSettings.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommendersSettings.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommendersSettings.serializeBinaryToWriter=function(e,r){var t;(t=e.getRecommendersList()).length>0&&r.writeRepeatedMessage(1,t,proto.impresso.query.CollectionRecommender.serializeBinaryToWriter)},proto.impresso.query.CollectionRecommendersSettings.prototype.getRecommendersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.CollectionRecommender,1)},proto.impresso.query.CollectionRecommendersSettings.prototype.setRecommendersList=function(e){return o.Message.setRepeatedWrapperField(this,1,e)},proto.impresso.query.CollectionRecommendersSettings.prototype.addRecommenders=function(e,r){return o.Message.addToRepeatedWrapperField(this,1,e,proto.impresso.query.CollectionRecommender,r)},proto.impresso.query.CollectionRecommendersSettings.prototype.clearRecommendersList=function(){return this.setRecommendersList([])},proto.impresso.query.FilterContext={CONTEXT_UNSPECIFIED:0,CONTEXT_INCLUDE:1,CONTEXT_EXCLUDE:2},proto.impresso.query.FilterOperator={OPERATOR_UNSPECIFIED:0,OPERATOR_AND:1,OPERATOR_OR:2},proto.impresso.query.FilterType={TYPE_UNSPECIFIED:0,TYPE_UID:1,TYPE_HAS_TEXT_CONTENTS:2,TYPE_TITLE:3,TYPE_IS_FRONT:4,TYPE_PAGE:5,TYPE_ISSUE:6,TYPE_STRING:7,TYPE_ENTITY:8,TYPE_NEWSPAPER:9,TYPE_DATERANGE:10,TYPE_YEAR:11,TYPE_LANGUAGE:12,TYPE_TYPE:13,TYPE_REGEX:14,TYPE_MENTION:15,TYPE_PERSON:16,TYPE_LOCATION:17,TYPE_TOPIC:18,TYPE_COLLECTION:19,TYPE_OCR_QUALITY:20,TYPE_CONTENT_LENGTH:21,TYPE_COUNTRY:22,TYPE_ACCESS_RIGHT:23,TYPE_PARTNER:24,TYPE_MONTH:25,TYPE_TEXT_REUSE_CLUSTER_SIZE:26,TYPE_TEXT_REUSE_CLUSTER_LEXICAL_OVERLAP:27,TYPE_TEXT_REUSE_CLUSTER_DAY_DELTA:28,TYPE_TEXT_REUSE_CLUSTER:29,TYPE_MENTION_FUNCTION:30,TYPE_NAG:31,TYPE_WIKIDATA_ID:32},proto.impresso.query.FilterPrecision={PRECISION_UNSPECIFIED:0,PRECISION_EXACT:1,PRECISION_PARTIAL:2,PRECISION_FUZZY:3,PRECISION_SOFT:4},proto.impresso.query.GroupValue={GROUPVALUE_UNSPECIFIED:0,GROUPVALUE_ARTICLES:1},t.object.extend(r,proto.impresso.query)}));const{fromObject:E,omitUndefinedAndEmptyLists:q,getEnumString:F,getEnumNumber:h,serialize:T,deserialize:C}=f,{Filter:P,FilterContext:b,FilterOperator:O,FilterType:S,FilterPrecision:_,DateRange:M,SearchQuery:D,GroupValue:B,CollectionRecommendersSettings:I,CollectionRecommender:w,CollectionRecommenderParameter:N}=R;function v(e){if(void 0!==e)return{from:Date.parse(e.from),to:Date.parse(e.to)}}function j(e){if(void 0!==e)return{from:new Date(e.from).toISOString(),to:new Date(e.to).toISOString()}}function L(e){return s(s({},e),{},{q:(r=e.q,"string"==typeof r||r instanceof String?[r]:r),context:h(b,e.context),op:h(O,e.op),type:h(S,e.type),precision:h(_,e.precision),daterange:E(M,v(e.daterange))});var r}function W(e){return q(s(s({},e),{},{q:(r=e.q,void 0!==r&&1===r.length?r[0]:r),context:F(b,e.context),op:F(O,e.op,!0),type:F(S,e.type),precision:F(_,e.precision),daterange:j(e.daterange)}));var r}function z(e){return s(s({},e),{},{filters:(e.filters||[]).map(e=>E(P,L(e))),groupBy:h(B,e.groupBy)})}function U(e){return q(s(s({},e),{},{filters:(e.filters||[]).map(W),groupBy:F(B,e.groupBy)}))}function A(e,r=2){if(null!=e)return parseFloat(e.toFixed(r))*10**r}function Y(e,r=2){if(null!=e)return e/10**r}function k(e){return q(s(s({},e),{},{type:h(w.RecommenderType,e.type),weight:A(e.weight),parameters:(e.parameters||[]).map(e=>E(N,function(e){let r,t,o;return"number"==typeof e.value&&(t=A(e.value)),"string"==typeof e.value&&(r=e.value),"boolean"==typeof e.value&&(o=e.value),{key:h(N.RecommenderParameterId,e.key),stringValue:r,numberValue:t,boolValue:o}}(e)))}))}function x(e){return q(s(s({},e),{},{recommenders:(e.recommenders||[]).map(e=>E(w,k(e)))}))}function G(e){let r;return null!=e.boolValue&&(r=e.boolValue),0!==e.numberValue&&(r=Y(e.numberValue)),""!==e.stringValue&&(r=e.stringValue),q({key:F(N.RecommenderParameterId,e.key,!1),value:r})}function Q(e){return q(s(s({},e),{},{type:F(w.RecommenderType,e.type,!1),weight:Y(e.weight)||0,parameters:(e.parameters||[]).map(G),enabled:e.enabled||void 0}))}function V(e){return q({recommenders:(e.recommenders||[]).map(Q)})}var X={filter:{serialize:e=>T(P,e,L),deserialize:e=>C(P,e,W)},searchQuery:{serialize:e=>T(D,e,z),deserialize:e=>C(D,e,U)},collectionRecommendersSettings:{serialize:e=>T(I,e,x),deserialize:e=>C(I,e,V)}};const{camel:$}=r,{FilterType:J,FilterOperator:K,FilterContext:H,FilterPrecision:Z}=R,ee=Object.freeze(Object.keys(J).filter(e=>J[e]!==J.TYPE_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")))),re=Object.freeze(Object.keys(K).filter(e=>K[e]!==K.OPERATOR_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toUpperCase())),te=Object.freeze(Object.keys(H).filter(e=>H[e]!==H.CONTEXT_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toLowerCase())),oe=Object.freeze(Object.keys(Z).filter(e=>Z[e]!==Z.PRECISION_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toLowerCase()));function ie(e){return[...e.reduce((e,r)=>{const t=(({type:e,op:r="OR",context:t="inclusive",precision:o="exact"})=>`t:${e}-o:${r}-c:${t}-p:${o}`)(r),o=e.get(t)||[];return e.set(t,o.concat([r])),e},new Map).entries()].map(([,e])=>{const{type:r,context:t,precision:o,op:i}=e[0],s=e.flatMap(({q:e})=>Array.isArray(e)?e:[e]).filter(e=>null!=e);return n={type:r,context:t,precision:o,op:i,q:s.length>1?s:s[0]},a=e=>null==e,Object.keys(n).reduce((e,r)=>{const t=n[r];return a(t)||(e[r]=t),e},{});var n,a})}var se={protobuf:X,constants:{filter:{Types:ee,Operators:re,Contexts:te,Precision:oe}},logic:{filter:{optimizeFilters:ie,mergeFilters:function(e){return ie(e.flat().map(e=>{const r=Array.isArray(e.q)&&1===e.q.length||!Array.isArray(e.q)?"AND":e.op;return s(s({},e),{},{op:r})}))}}}},ne=se.protobuf,ae=se.constants,pe=se.logic;e.constants=ae,e.default=se,e.logic=pe,e.protobuf=ne,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("case"),require("base64-js"),require("google-protobuf")):"function"==typeof define&&define.amd?define(["exports","case","base64-js","google-protobuf"],r):r((e=e||self)["impresso-jscommons"]=e["impresso-jscommons"]||{},e.case,e["base64-js"],e.goog)}(this,(function(e,r,t,o){"use strict";function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var r=1;r{const o="set"+m(e),i=`set${m(e)}List`,s=t[o]||t[i];if(void 0===s)throw new Error(`Unknown property: "${e}"`);s.call(t,r[e])}),t}function g(e){return Object.keys(e).reduce((e,r)=>(r.endsWith("List")&&(e[r.replace(/List$/,"")]=e[r].map(g),delete e[r]),e),e)}var f={fromObject:d,omitUndefinedAndEmptyLists:function(e){return Object.keys(e).reduce((e,r)=>((void 0===e[r]||Array.isArray(e[r])&&0===e[r].length)&&delete e[r],e),e)},fixRepeatedFields:g,getEnumString:function(e,r,t=!1){if(!r||0===r)return;const o=Object.keys(e).find(t=>e[t]===r);if(!o)throw new Error("Unknown enum number: "+r);const i=l(o.split("_").slice(1).join("_"));return t?u(i):i},getEnumNumber:function(e,r){if(void 0===r)return;const t=[Object.keys(e)[0].split("_")[0],u(p(r),"_")].join("_"),o=e[t];if(void 0===o)throw new Error(`Unknown enum value: ${r} (${t})`);return o},serialize:function(e,r,t){if(void 0===r)return;const o=t?t(r):r;return c(d(e,o).serializeBinary())},deserialize:function(e,r,t){const o=g(e.deserializeBinary(y(r)).toObject());return t?t(o):o}};var R=function(e,r){return e(r={exports:{}},r.exports),r.exports}((function(e,r){var t=o,i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==i&&i||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();t.exportSymbol("proto.impresso.query.CollectionRecommender",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommender.RecommenderType",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommenderParameter",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommenderParameter.RecommenderParameterId",null,i),t.exportSymbol("proto.impresso.query.CollectionRecommendersSettings",null,i),t.exportSymbol("proto.impresso.query.DateRange",null,i),t.exportSymbol("proto.impresso.query.Filter",null,i),t.exportSymbol("proto.impresso.query.FilterContext",null,i),t.exportSymbol("proto.impresso.query.FilterOperator",null,i),t.exportSymbol("proto.impresso.query.FilterPrecision",null,i),t.exportSymbol("proto.impresso.query.FilterType",null,i),t.exportSymbol("proto.impresso.query.GroupValue",null,i),t.exportSymbol("proto.impresso.query.SearchQuery",null,i),proto.impresso.query.DateRange=function(e){o.Message.initialize(this,e,0,-1,null,null)},t.inherits(proto.impresso.query.DateRange,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.DateRange.displayName="proto.impresso.query.DateRange"),proto.impresso.query.Filter=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.Filter.repeatedFields_,null)},t.inherits(proto.impresso.query.Filter,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.Filter.displayName="proto.impresso.query.Filter"),proto.impresso.query.SearchQuery=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.SearchQuery.repeatedFields_,null)},t.inherits(proto.impresso.query.SearchQuery,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.SearchQuery.displayName="proto.impresso.query.SearchQuery"),proto.impresso.query.CollectionRecommenderParameter=function(e){o.Message.initialize(this,e,0,-1,null,null)},t.inherits(proto.impresso.query.CollectionRecommenderParameter,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommenderParameter.displayName="proto.impresso.query.CollectionRecommenderParameter"),proto.impresso.query.CollectionRecommender=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.CollectionRecommender.repeatedFields_,null)},t.inherits(proto.impresso.query.CollectionRecommender,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommender.displayName="proto.impresso.query.CollectionRecommender"),proto.impresso.query.CollectionRecommendersSettings=function(e){o.Message.initialize(this,e,0,-1,proto.impresso.query.CollectionRecommendersSettings.repeatedFields_,null)},t.inherits(proto.impresso.query.CollectionRecommendersSettings,o.Message),t.DEBUG&&!COMPILED&&(proto.impresso.query.CollectionRecommendersSettings.displayName="proto.impresso.query.CollectionRecommendersSettings"),o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.DateRange.prototype.toObject=function(e){return proto.impresso.query.DateRange.toObject(e,this)},proto.impresso.query.DateRange.toObject=function(e,r){var t={from:o.Message.getFieldWithDefault(r,1,0),to:o.Message.getFieldWithDefault(r,2,0)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.DateRange.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.DateRange;return proto.impresso.query.DateRange.deserializeBinaryFromReader(t,r)},proto.impresso.query.DateRange.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readSint64();e.setFrom(t);break;case 2:t=r.readSint64();e.setTo(t);break;default:r.skipField()}}return e},proto.impresso.query.DateRange.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.DateRange.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.DateRange.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getFrom())&&r.writeSint64(1,t),0!==(t=e.getTo())&&r.writeSint64(2,t)},proto.impresso.query.DateRange.prototype.getFrom=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.DateRange.prototype.setFrom=function(e){return o.Message.setProto3IntField(this,1,e)},proto.impresso.query.DateRange.prototype.getTo=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.DateRange.prototype.setTo=function(e){return o.Message.setProto3IntField(this,2,e)},proto.impresso.query.Filter.repeatedFields_=[5,7],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.Filter.prototype.toObject=function(e){return proto.impresso.query.Filter.toObject(e,this)},proto.impresso.query.Filter.toObject=function(e,r){var t,i={context:o.Message.getFieldWithDefault(r,1,0),op:o.Message.getFieldWithDefault(r,2,0),type:o.Message.getFieldWithDefault(r,3,0),precision:o.Message.getFieldWithDefault(r,4,0),qList:null==(t=o.Message.getRepeatedField(r,5))?void 0:t,daterange:(t=r.getDaterange())&&proto.impresso.query.DateRange.toObject(e,t),uidsList:null==(t=o.Message.getRepeatedField(r,7))?void 0:t};return e&&(i.$jspbMessageInstance=r),i}),proto.impresso.query.Filter.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.Filter;return proto.impresso.query.Filter.deserializeBinaryFromReader(t,r)},proto.impresso.query.Filter.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setContext(t);break;case 2:t=r.readEnum();e.setOp(t);break;case 3:t=r.readEnum();e.setType(t);break;case 4:t=r.readEnum();e.setPrecision(t);break;case 5:t=r.readString();e.addQ(t);break;case 6:t=new proto.impresso.query.DateRange;r.readMessage(t,proto.impresso.query.DateRange.deserializeBinaryFromReader),e.setDaterange(t);break;case 7:t=r.readString();e.addUids(t);break;default:r.skipField()}}return e},proto.impresso.query.Filter.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.Filter.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.Filter.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getContext())&&r.writeEnum(1,t),0!==(t=e.getOp())&&r.writeEnum(2,t),0!==(t=e.getType())&&r.writeEnum(3,t),0!==(t=e.getPrecision())&&r.writeEnum(4,t),(t=e.getQList()).length>0&&r.writeRepeatedString(5,t),null!=(t=e.getDaterange())&&r.writeMessage(6,t,proto.impresso.query.DateRange.serializeBinaryToWriter),(t=e.getUidsList()).length>0&&r.writeRepeatedString(7,t)},proto.impresso.query.Filter.prototype.getContext=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.Filter.prototype.setContext=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.Filter.prototype.getOp=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.Filter.prototype.setOp=function(e){return o.Message.setProto3EnumField(this,2,e)},proto.impresso.query.Filter.prototype.getType=function(){return o.Message.getFieldWithDefault(this,3,0)},proto.impresso.query.Filter.prototype.setType=function(e){return o.Message.setProto3EnumField(this,3,e)},proto.impresso.query.Filter.prototype.getPrecision=function(){return o.Message.getFieldWithDefault(this,4,0)},proto.impresso.query.Filter.prototype.setPrecision=function(e){return o.Message.setProto3EnumField(this,4,e)},proto.impresso.query.Filter.prototype.getQList=function(){return o.Message.getRepeatedField(this,5)},proto.impresso.query.Filter.prototype.setQList=function(e){return o.Message.setField(this,5,e||[])},proto.impresso.query.Filter.prototype.addQ=function(e,r){return o.Message.addToRepeatedField(this,5,e,r)},proto.impresso.query.Filter.prototype.clearQList=function(){return this.setQList([])},proto.impresso.query.Filter.prototype.getDaterange=function(){return o.Message.getWrapperField(this,proto.impresso.query.DateRange,6)},proto.impresso.query.Filter.prototype.setDaterange=function(e){return o.Message.setWrapperField(this,6,e)},proto.impresso.query.Filter.prototype.clearDaterange=function(){return this.setDaterange(void 0)},proto.impresso.query.Filter.prototype.hasDaterange=function(){return null!=o.Message.getField(this,6)},proto.impresso.query.Filter.prototype.getUidsList=function(){return o.Message.getRepeatedField(this,7)},proto.impresso.query.Filter.prototype.setUidsList=function(e){return o.Message.setField(this,7,e||[])},proto.impresso.query.Filter.prototype.addUids=function(e,r){return o.Message.addToRepeatedField(this,7,e,r)},proto.impresso.query.Filter.prototype.clearUidsList=function(){return this.setUidsList([])},proto.impresso.query.SearchQuery.repeatedFields_=[1],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.SearchQuery.prototype.toObject=function(e){return proto.impresso.query.SearchQuery.toObject(e,this)},proto.impresso.query.SearchQuery.toObject=function(e,r){var t={filtersList:o.Message.toObjectList(r.getFiltersList(),proto.impresso.query.Filter.toObject,e),groupBy:o.Message.getFieldWithDefault(r,2,0)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.SearchQuery.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.SearchQuery;return proto.impresso.query.SearchQuery.deserializeBinaryFromReader(t,r)},proto.impresso.query.SearchQuery.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=new proto.impresso.query.Filter;r.readMessage(t,proto.impresso.query.Filter.deserializeBinaryFromReader),e.addFilters(t);break;case 2:t=r.readEnum();e.setGroupBy(t);break;default:r.skipField()}}return e},proto.impresso.query.SearchQuery.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.SearchQuery.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.SearchQuery.serializeBinaryToWriter=function(e,r){var t=void 0;(t=e.getFiltersList()).length>0&&r.writeRepeatedMessage(1,t,proto.impresso.query.Filter.serializeBinaryToWriter),0!==(t=e.getGroupBy())&&r.writeEnum(2,t)},proto.impresso.query.SearchQuery.prototype.getFiltersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.Filter,1)},proto.impresso.query.SearchQuery.prototype.setFiltersList=function(e){return o.Message.setRepeatedWrapperField(this,1,e)},proto.impresso.query.SearchQuery.prototype.addFilters=function(e,r){return o.Message.addToRepeatedWrapperField(this,1,e,proto.impresso.query.Filter,r)},proto.impresso.query.SearchQuery.prototype.clearFiltersList=function(){return this.setFiltersList([])},proto.impresso.query.SearchQuery.prototype.getGroupBy=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.SearchQuery.prototype.setGroupBy=function(e){return o.Message.setProto3EnumField(this,2,e)},o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommenderParameter.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommenderParameter.toObject(e,this)},proto.impresso.query.CollectionRecommenderParameter.toObject=function(e,r){var t={key:o.Message.getFieldWithDefault(r,1,0),stringValue:o.Message.getFieldWithDefault(r,2,""),numberValue:o.Message.getFieldWithDefault(r,3,0),boolValue:o.Message.getBooleanFieldWithDefault(r,4,!1)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommenderParameter.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommenderParameter;return proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setKey(t);break;case 2:t=r.readString();e.setStringValue(t);break;case 3:t=r.readSint32();e.setNumberValue(t);break;case 4:t=r.readBool();e.setBoolValue(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommenderParameter.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getKey())&&r.writeEnum(1,t),(t=e.getStringValue()).length>0&&r.writeString(2,t),0!==(t=e.getNumberValue())&&r.writeSint32(3,t),(t=e.getBoolValue())&&r.writeBool(4,t)},proto.impresso.query.CollectionRecommenderParameter.RecommenderParameterId={ID_UNSPECIFIED:0,ID_COUNT_TYPE:1,ID_MIN_OCCURRENCES:2,ID_NUMBER_TO_KEEP:3,ID_REMOVE_FULLY_MENTIONED:4,ID_NORMALIZE_MAX_SCORE:5,ID_MARGIN:6,ID_SCALING_FACTOR:7},proto.impresso.query.CollectionRecommenderParameter.prototype.getKey=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.CollectionRecommenderParameter.prototype.setKey=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getStringValue=function(){return o.Message.getFieldWithDefault(this,2,"")},proto.impresso.query.CollectionRecommenderParameter.prototype.setStringValue=function(e){return o.Message.setProto3StringField(this,2,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getNumberValue=function(){return o.Message.getFieldWithDefault(this,3,0)},proto.impresso.query.CollectionRecommenderParameter.prototype.setNumberValue=function(e){return o.Message.setProto3IntField(this,3,e)},proto.impresso.query.CollectionRecommenderParameter.prototype.getBoolValue=function(){return o.Message.getBooleanFieldWithDefault(this,4,!1)},proto.impresso.query.CollectionRecommenderParameter.prototype.setBoolValue=function(e){return o.Message.setProto3BooleanField(this,4,e)},proto.impresso.query.CollectionRecommender.repeatedFields_=[3],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommender.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommender.toObject(e,this)},proto.impresso.query.CollectionRecommender.toObject=function(e,r){var t={type:o.Message.getFieldWithDefault(r,1,0),weight:o.Message.getFieldWithDefault(r,2,0),parametersList:o.Message.toObjectList(r.getParametersList(),proto.impresso.query.CollectionRecommenderParameter.toObject,e),enabled:o.Message.getBooleanFieldWithDefault(r,4,!1)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommender.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommender;return proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=r.readEnum();e.setType(t);break;case 2:t=r.readSint32();e.setWeight(t);break;case 3:t=new proto.impresso.query.CollectionRecommenderParameter;r.readMessage(t,proto.impresso.query.CollectionRecommenderParameter.deserializeBinaryFromReader),e.addParameters(t);break;case 4:t=r.readBool();e.setEnabled(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommender.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommender.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommender.serializeBinaryToWriter=function(e,r){var t=void 0;0!==(t=e.getType())&&r.writeEnum(1,t),0!==(t=e.getWeight())&&r.writeSint32(2,t),(t=e.getParametersList()).length>0&&r.writeRepeatedMessage(3,t,proto.impresso.query.CollectionRecommenderParameter.serializeBinaryToWriter),(t=e.getEnabled())&&r.writeBool(4,t)},proto.impresso.query.CollectionRecommender.RecommenderType={TYPE_UNSPECIFIED:0,TYPE_TIME_RANGE:1,TYPE_ENTITIES:2,TYPE_TOPICS:3,TYPE_TEXT_REUSE_CLUSTERS:4},proto.impresso.query.CollectionRecommender.prototype.getType=function(){return o.Message.getFieldWithDefault(this,1,0)},proto.impresso.query.CollectionRecommender.prototype.setType=function(e){return o.Message.setProto3EnumField(this,1,e)},proto.impresso.query.CollectionRecommender.prototype.getWeight=function(){return o.Message.getFieldWithDefault(this,2,0)},proto.impresso.query.CollectionRecommender.prototype.setWeight=function(e){return o.Message.setProto3IntField(this,2,e)},proto.impresso.query.CollectionRecommender.prototype.getParametersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.CollectionRecommenderParameter,3)},proto.impresso.query.CollectionRecommender.prototype.setParametersList=function(e){return o.Message.setRepeatedWrapperField(this,3,e)},proto.impresso.query.CollectionRecommender.prototype.addParameters=function(e,r){return o.Message.addToRepeatedWrapperField(this,3,e,proto.impresso.query.CollectionRecommenderParameter,r)},proto.impresso.query.CollectionRecommender.prototype.clearParametersList=function(){return this.setParametersList([])},proto.impresso.query.CollectionRecommender.prototype.getEnabled=function(){return o.Message.getBooleanFieldWithDefault(this,4,!1)},proto.impresso.query.CollectionRecommender.prototype.setEnabled=function(e){return o.Message.setProto3BooleanField(this,4,e)},proto.impresso.query.CollectionRecommendersSettings.repeatedFields_=[1],o.Message.GENERATE_TO_OBJECT&&(proto.impresso.query.CollectionRecommendersSettings.prototype.toObject=function(e){return proto.impresso.query.CollectionRecommendersSettings.toObject(e,this)},proto.impresso.query.CollectionRecommendersSettings.toObject=function(e,r){var t={recommendersList:o.Message.toObjectList(r.getRecommendersList(),proto.impresso.query.CollectionRecommender.toObject,e)};return e&&(t.$jspbMessageInstance=r),t}),proto.impresso.query.CollectionRecommendersSettings.deserializeBinary=function(e){var r=new o.BinaryReader(e),t=new proto.impresso.query.CollectionRecommendersSettings;return proto.impresso.query.CollectionRecommendersSettings.deserializeBinaryFromReader(t,r)},proto.impresso.query.CollectionRecommendersSettings.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var t=new proto.impresso.query.CollectionRecommender;r.readMessage(t,proto.impresso.query.CollectionRecommender.deserializeBinaryFromReader),e.addRecommenders(t);break;default:r.skipField()}}return e},proto.impresso.query.CollectionRecommendersSettings.prototype.serializeBinary=function(){var e=new o.BinaryWriter;return proto.impresso.query.CollectionRecommendersSettings.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.impresso.query.CollectionRecommendersSettings.serializeBinaryToWriter=function(e,r){var t;(t=e.getRecommendersList()).length>0&&r.writeRepeatedMessage(1,t,proto.impresso.query.CollectionRecommender.serializeBinaryToWriter)},proto.impresso.query.CollectionRecommendersSettings.prototype.getRecommendersList=function(){return o.Message.getRepeatedWrapperField(this,proto.impresso.query.CollectionRecommender,1)},proto.impresso.query.CollectionRecommendersSettings.prototype.setRecommendersList=function(e){return o.Message.setRepeatedWrapperField(this,1,e)},proto.impresso.query.CollectionRecommendersSettings.prototype.addRecommenders=function(e,r){return o.Message.addToRepeatedWrapperField(this,1,e,proto.impresso.query.CollectionRecommender,r)},proto.impresso.query.CollectionRecommendersSettings.prototype.clearRecommendersList=function(){return this.setRecommendersList([])},proto.impresso.query.FilterContext={CONTEXT_UNSPECIFIED:0,CONTEXT_INCLUDE:1,CONTEXT_EXCLUDE:2},proto.impresso.query.FilterOperator={OPERATOR_UNSPECIFIED:0,OPERATOR_AND:1,OPERATOR_OR:2},proto.impresso.query.FilterType={TYPE_UNSPECIFIED:0,TYPE_UID:1,TYPE_HAS_TEXT_CONTENTS:2,TYPE_TITLE:3,TYPE_IS_FRONT:4,TYPE_PAGE:5,TYPE_ISSUE:6,TYPE_STRING:7,TYPE_ENTITY:8,TYPE_NEWSPAPER:9,TYPE_DATERANGE:10,TYPE_YEAR:11,TYPE_LANGUAGE:12,TYPE_TYPE:13,TYPE_REGEX:14,TYPE_MENTION:15,TYPE_PERSON:16,TYPE_LOCATION:17,TYPE_TOPIC:18,TYPE_COLLECTION:19,TYPE_OCR_QUALITY:20,TYPE_CONTENT_LENGTH:21,TYPE_COUNTRY:22,TYPE_ACCESS_RIGHT:23,TYPE_PARTNER:24,TYPE_MONTH:25,TYPE_TEXT_REUSE_CLUSTER_SIZE:26,TYPE_TEXT_REUSE_CLUSTER_LEXICAL_OVERLAP:27,TYPE_TEXT_REUSE_CLUSTER_DAY_DELTA:28,TYPE_TEXT_REUSE_CLUSTER:29,TYPE_MENTION_FUNCTION:30,TYPE_NAG:31,TYPE_WIKIDATA_ID:32,TYPE_DATA_DOMAIN:33,TYPE_COPYRIGHT:34},proto.impresso.query.FilterPrecision={PRECISION_UNSPECIFIED:0,PRECISION_EXACT:1,PRECISION_PARTIAL:2,PRECISION_FUZZY:3,PRECISION_SOFT:4},proto.impresso.query.GroupValue={GROUPVALUE_UNSPECIFIED:0,GROUPVALUE_ARTICLES:1},t.object.extend(r,proto.impresso.query)}));const{fromObject:E,omitUndefinedAndEmptyLists:q,getEnumString:F,getEnumNumber:T,serialize:h,deserialize:C}=f,{Filter:P,FilterContext:b,FilterOperator:O,FilterType:S,FilterPrecision:_,DateRange:M,SearchQuery:D,GroupValue:B,CollectionRecommendersSettings:I,CollectionRecommender:N,CollectionRecommenderParameter:w}=R;function v(e){if(void 0!==e)return{from:Date.parse(e.from),to:Date.parse(e.to)}}function j(e){if(void 0!==e)return{from:new Date(e.from).toISOString(),to:new Date(e.to).toISOString()}}function L(e){return s(s({},e),{},{q:(r=e.q,"string"==typeof r||r instanceof String?[r]:r),context:T(b,e.context),op:T(O,e.op),type:T(S,e.type),precision:T(_,e.precision),daterange:E(M,v(e.daterange))});var r}function W(e){return q(s(s({},e),{},{q:(r=e.q,void 0!==r&&1===r.length?r[0]:r),context:F(b,e.context),op:F(O,e.op,!0),type:F(S,e.type),precision:F(_,e.precision),daterange:j(e.daterange)}));var r}function z(e){return s(s({},e),{},{filters:(e.filters||[]).map(e=>E(P,L(e))),groupBy:T(B,e.groupBy)})}function A(e){return q(s(s({},e),{},{filters:(e.filters||[]).map(W),groupBy:F(B,e.groupBy)}))}function U(e,r=2){if(null!=e)return parseFloat(e.toFixed(r))*10**r}function Y(e,r=2){if(null!=e)return e/10**r}function k(e){return q(s(s({},e),{},{type:T(N.RecommenderType,e.type),weight:U(e.weight),parameters:(e.parameters||[]).map(e=>E(w,function(e){let r,t,o;return"number"==typeof e.value&&(t=U(e.value)),"string"==typeof e.value&&(r=e.value),"boolean"==typeof e.value&&(o=e.value),{key:T(w.RecommenderParameterId,e.key),stringValue:r,numberValue:t,boolValue:o}}(e)))}))}function x(e){return q(s(s({},e),{},{recommenders:(e.recommenders||[]).map(e=>E(N,k(e)))}))}function G(e){let r;return null!=e.boolValue&&(r=e.boolValue),0!==e.numberValue&&(r=Y(e.numberValue)),""!==e.stringValue&&(r=e.stringValue),q({key:F(w.RecommenderParameterId,e.key,!1),value:r})}function Q(e){return q(s(s({},e),{},{type:F(N.RecommenderType,e.type,!1),weight:Y(e.weight)||0,parameters:(e.parameters||[]).map(G),enabled:e.enabled||void 0}))}function V(e){return q({recommenders:(e.recommenders||[]).map(Q)})}var X={filter:{serialize:e=>h(P,e,L),deserialize:e=>C(P,e,W)},searchQuery:{serialize:e=>h(D,e,z),deserialize:e=>C(D,e,A)},collectionRecommendersSettings:{serialize:e=>h(I,e,x),deserialize:e=>C(I,e,V)}};const{camel:$}=r,{FilterType:J,FilterOperator:K,FilterContext:H,FilterPrecision:Z}=R,ee=Object.freeze(Object.keys(J).filter(e=>J[e]!==J.TYPE_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")))),re=Object.freeze(Object.keys(K).filter(e=>K[e]!==K.OPERATOR_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toUpperCase())),te=Object.freeze(Object.keys(H).filter(e=>H[e]!==H.CONTEXT_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toLowerCase())),oe=Object.freeze(Object.keys(Z).filter(e=>Z[e]!==Z.PRECISION_UNSPECIFIED).map(e=>$(e.split("_").slice(1).join("_")).toLowerCase()));function ie(e){return[...e.reduce((e,r)=>{const t=(({type:e,op:r="OR",context:t="inclusive",precision:o="exact"})=>`t:${e}-o:${r}-c:${t}-p:${o}`)(r),o=e.get(t)||[];return e.set(t,o.concat([r])),e},new Map).entries()].map(([,e])=>{const{type:r,context:t,precision:o,op:i}=e[0],s=e.flatMap(({q:e})=>Array.isArray(e)?e:[e]).filter(e=>null!=e);return n={type:r,context:t,precision:o,op:i,q:s.length>1?s:s[0]},a=e=>null==e,Object.keys(n).reduce((e,r)=>{const t=n[r];return a(t)||(e[r]=t),e},{});var n,a})}var se={protobuf:X,constants:{filter:{Types:ee,Operators:re,Contexts:te,Precision:oe}},logic:{filter:{optimizeFilters:ie,mergeFilters:function(e){return ie(e.flat().map(e=>{const r=Array.isArray(e.q)&&1===e.q.length||!Array.isArray(e.q)?"AND":e.op;return s(s({},e),{},{op:r})}))}}}},ne=se.protobuf,ae=se.constants,pe=se.logic;e.constants=ae,e.default=se,e.logic=pe,e.protobuf=ne,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/package.json b/package.json index ee15965..77b410e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impresso-jscommons", - "version": "1.4.3", + "version": "1.5.0", "description": "Code shared between the middle layer and frontend", "private": true, "main": "dist/impresso-jscommons.js", diff --git a/proto/query.proto b/proto/query.proto index 2ed127e..f103b33 100644 --- a/proto/query.proto +++ b/proto/query.proto @@ -57,6 +57,9 @@ enum FilterType { TYPE_MENTION_FUNCTION = 30; TYPE_NAG = 31; TYPE_WIKIDATA_ID = 32; + + TYPE_DATA_DOMAIN = 33; + TYPE_COPYRIGHT = 34; } enum FilterPrecision { diff --git a/src/generated/query_pb.d.ts b/src/generated/query_pb.d.ts index 8a028ab..b9d5059 100644 --- a/src/generated/query_pb.d.ts +++ b/src/generated/query_pb.d.ts @@ -264,6 +264,8 @@ export interface FilterTypeMap { TYPE_MENTION_FUNCTION: 30; TYPE_NAG: 31; TYPE_WIKIDATA_ID: 32; + TYPE_DATA_DOMAIN: 33; + TYPE_COPYRIGHT: 34; } export const FilterType: FilterTypeMap; diff --git a/src/generated/query_pb.js b/src/generated/query_pb.js index 18479c0..4f5bd3a 100644 --- a/src/generated/query_pb.js +++ b/src/generated/query_pb.js @@ -1595,7 +1595,9 @@ proto.impresso.query.FilterType = { TYPE_TEXT_REUSE_CLUSTER: 29, TYPE_MENTION_FUNCTION: 30, TYPE_NAG: 31, - TYPE_WIKIDATA_ID: 32 + TYPE_WIKIDATA_ID: 32, + TYPE_DATA_DOMAIN: 33, + TYPE_COPYRIGHT: 34 }; /**