@craftercms/search
Advanced tools
Comparing version 4.0.3 to 4.1.0
@@ -17,6 +17,6 @@ /* | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/operators'), require('@craftercms/utils'), require('@craftercms/classes'), require('@craftercms/search')) : | ||
typeof define === 'function' && define.amd ? define('@craftercms/search', ['exports', 'rxjs/operators', '@craftercms/utils', '@craftercms/classes', '@craftercms/search'], factory) : | ||
(global = global || self, factory((global.craftercms = global.craftercms || {}, global.craftercms.search = {}), global.rxjs.operators, global.craftercms.utils, global.craftercms.classes, global.craftercms.search)); | ||
}(this, (function (exports, operators, utils, classes, search$1) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/operators'), require('@craftercms/utils'), require('@craftercms/classes')) : | ||
typeof define === 'function' && define.amd ? define('@craftercms/search', ['exports', 'rxjs/operators', '@craftercms/utils', '@craftercms/classes'], factory) : | ||
(global = global || self, factory((global.craftercms = global.craftercms || {}, global.craftercms.search = {}), global.rxjs.operators, global.craftercms.utils, global.craftercms.classes)); | ||
}(this, (function (exports, operators, utils, classes) { 'use strict'; | ||
@@ -93,60 +93,3 @@ /* | ||
}; | ||
return Query; | ||
}()); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(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); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
/* | ||
* Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
/** | ||
* Query implementation for Elasticsearch | ||
*/ | ||
var ElasticQuery = /** @class */ (function (_super) { | ||
__extends(ElasticQuery, _super); | ||
function ElasticQuery() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
Object.defineProperty(ElasticQuery.prototype, "query", { | ||
Object.defineProperty(Query.prototype, "query", { | ||
/** | ||
@@ -162,4 +105,4 @@ * Sets the actual query. | ||
}); | ||
return ElasticQuery; | ||
}(Query)); | ||
return Query; | ||
}()); | ||
@@ -712,4 +655,4 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
: queryOrParams; | ||
if (queryOrParams instanceof search$1.ElasticQuery) { | ||
requestURL = utils.composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = utils.composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return classes.SDKService.httpPost(requestURL, params) | ||
@@ -728,3 +671,3 @@ .pipe(operators.map(function (response) { | ||
: uuid_1(); | ||
query = new search$1.ElasticQuery(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -742,3 +685,2 @@ query.uuid = queryId; | ||
exports.ElasticQuery = ElasticQuery; | ||
exports.Query = Query; | ||
@@ -745,0 +687,0 @@ exports.SearchService = SearchService; |
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("rxjs/operators"),require("@craftercms/utils"),require("@craftercms/classes"),require("@craftercms/search")):"function"==typeof define&&define.amd?define("@craftercms/search",["exports","rxjs/operators","@craftercms/utils","@craftercms/classes","@craftercms/search"],factory):factory(((global=global||self).craftercms=global.craftercms||{},global.craftercms.search={}),global.rxjs.operators,global.craftercms.utils,global.craftercms.classes,global.craftercms.search)}(this,function(exports,operators,utils,classes,search$1){"use strict";var Query=function(){function Query(params){void 0===params&&(params={}),this.params=params}return Query.prototype.setParam=function(name,value){this.params[name]=value},Query.prototype.addParam=function(name,value){this.params[name]?Array.isArray(this.params[name])?this.params[name].push(value):this.params[name]=[this.params[name],value]:this.params[name]=value},Query}(),extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])})(d,b)};var ElasticQuery=function(_super){function ElasticQuery(){return null!==_super&&_super.apply(this,arguments)||this}return function(d,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(ElasticQuery,_super),Object.defineProperty(ElasticQuery.prototype,"query",{set:function(query){this.params=query},enumerable:!1,configurable:!0}),ElasticQuery}(Query),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var module,rngBrowser=(function(module){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}}(module={exports:{}},module.exports),module.exports),byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);var _nodeId,_clockseq,bytesToUuid_1=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")},_lastMSecs=0,_lastNSecs=0;var v1_1=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rngBrowser();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid_1(b)};var v4_1=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rngBrowser)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid_1(rnds)},uuid=v4_1;uuid.v1=v1_1,uuid.v4=v4_1;var uuid_1=uuid;function search(queryOrParams,config){var requestURL;config=classes.crafterConf.mix(config);var params=queryOrParams instanceof Query?queryOrParams.params:queryOrParams;if(queryOrParams instanceof search$1.ElasticQuery)return requestURL=utils.composeUrl(config,config.endpoints.ELASTICSEARCH)+"?crafterSite="+config.site,classes.SDKService.httpPost(requestURL,params).pipe(operators.map(function(response){return response.hits}))}function createQuery(params){var query,queryId=params&¶ms.uuid?params.uuid:uuid_1();return query=new search$1.ElasticQuery,Object.assign(query.params,params),query.uuid=queryId,query}!function(self){var ampersandTest,nativeURLSearchParams=self.URLSearchParams&&self.URLSearchParams.prototype.get?self.URLSearchParams:null,isSupportObjectConstructor=nativeURLSearchParams&&"a=1"===new nativeURLSearchParams({a:1}).toString(),decodesPlusesCorrectly=nativeURLSearchParams&&"+"===new nativeURLSearchParams("s=%2B").get("s"),__URLSearchParams__="__URLSearchParams__",encodesAmpersandsCorrectly=!nativeURLSearchParams||((ampersandTest=new nativeURLSearchParams).append("s"," &"),"s=+%26"===ampersandTest.toString()),prototype=URLSearchParamsPolyfill.prototype,iterable=!(!self.Symbol||!self.Symbol.iterator);if(!(nativeURLSearchParams&&isSupportObjectConstructor&&decodesPlusesCorrectly&&encodesAmpersandsCorrectly)){prototype.append=function(name,value){appendTo(this[__URLSearchParams__],name,value)},prototype.delete=function(name){delete this[__URLSearchParams__][name]},prototype.get=function(name){var dict=this[__URLSearchParams__];return name in dict?dict[name][0]:null},prototype.getAll=function(name){var dict=this[__URLSearchParams__];return name in dict?dict[name].slice(0):[]},prototype.has=function(name){return name in this[__URLSearchParams__]},prototype.set=function(name,value){this[__URLSearchParams__][name]=[""+value]},prototype.toString=function(){var i,key,name,value,dict=this[__URLSearchParams__],query=[];for(key in dict)for(name=encode(key),i=0,value=dict[key];i<value.length;i++)query.push(name+"="+encode(value[i]));return query.join("&")};var useProxy=!!decodesPlusesCorrectly&&nativeURLSearchParams&&!isSupportObjectConstructor&&self.Proxy;Object.defineProperty(self,"URLSearchParams",{value:useProxy?new Proxy(nativeURLSearchParams,{construct:function(target,args){return new target(new URLSearchParamsPolyfill(args[0]).toString())}}):URLSearchParamsPolyfill});var USPProto=self.URLSearchParams.prototype;USPProto.polyfill=!0,USPProto.forEach=USPProto.forEach||function(callback,thisArg){var dict=parseToDict(this.toString());Object.getOwnPropertyNames(dict).forEach(function(name){dict[name].forEach(function(value){callback.call(thisArg,value,name,this)},this)},this)},USPProto.sort=USPProto.sort||function(){var k,i,j,dict=parseToDict(this.toString()),keys=[];for(k in dict)keys.push(k);for(keys.sort(),i=0;i<keys.length;i++)this.delete(keys[i]);for(i=0;i<keys.length;i++){var key=keys[i],values=dict[key];for(j=0;j<values.length;j++)this.append(key,values[j])}},USPProto.keys=USPProto.keys||function(){var items=[];return this.forEach(function(item,name){items.push(name)}),makeIterator(items)},USPProto.values=USPProto.values||function(){var items=[];return this.forEach(function(item){items.push(item)}),makeIterator(items)},USPProto.entries=USPProto.entries||function(){var items=[];return this.forEach(function(item,name){items.push([name,item])}),makeIterator(items)},iterable&&(USPProto[self.Symbol.iterator]=USPProto[self.Symbol.iterator]||USPProto.entries)}function URLSearchParamsPolyfill(search){((search=search||"")instanceof URLSearchParams||search instanceof URLSearchParamsPolyfill)&&(search=search.toString()),this[__URLSearchParams__]=parseToDict(search)}function encode(str){var replace={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g,function(match){return replace[match]})}function decode(str){return decodeURIComponent(str.replace(/\+/g," "))}function makeIterator(arr){var iterator={next:function(){var value=arr.shift();return{done:void 0===value,value:value}}};return iterable&&(iterator[self.Symbol.iterator]=function(){return iterator}),iterator}function parseToDict(search){var dict={};if("object"==typeof search)for(var key in search)search.hasOwnProperty(key)&&appendTo(dict,key,search[key]);else{0===search.indexOf("?")&&(search=search.slice(1));for(var pairs=search.split("&"),j=0;j<pairs.length;j++){var value=pairs[j],index=value.indexOf("=");-1<index?appendTo(dict,decode(value.slice(0,index)),decode(value.slice(index+1))):value&&appendTo(dict,decode(value),"")}}return dict}function appendTo(dict,name,value){var val="string"==typeof value?value:null!==value&&void 0!==value&&"function"==typeof value.toString?value.toString():JSON.stringify(value);name in dict?dict[name].push(val):dict[name]=[val]}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:commonjsGlobal);var SearchService={search:search,createQuery:createQuery};exports.ElasticQuery=ElasticQuery,exports.Query=Query,exports.SearchService=SearchService,exports.createQuery=createQuery,exports.search=search,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("rxjs/operators"),require("@craftercms/utils"),require("@craftercms/classes")):"function"==typeof define&&define.amd?define("@craftercms/search",["exports","rxjs/operators","@craftercms/utils","@craftercms/classes"],factory):factory(((global=global||self).craftercms=global.craftercms||{},global.craftercms.search={}),global.rxjs.operators,global.craftercms.utils,global.craftercms.classes)}(this,function(exports,operators,utils,classes){"use strict";var Query=function(){function Query(params){void 0===params&&(params={}),this.params=params}return Query.prototype.setParam=function(name,value){this.params[name]=value},Query.prototype.addParam=function(name,value){this.params[name]?Array.isArray(this.params[name])?this.params[name].push(value):this.params[name]=[this.params[name],value]:this.params[name]=value},Object.defineProperty(Query.prototype,"query",{set:function(query){this.params=query},enumerable:!1,configurable:!0}),Query}(),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var module,rngBrowser=(function(module){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}}(module={exports:{}},module.exports),module.exports),byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);var _nodeId,_clockseq,bytesToUuid_1=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")},_lastMSecs=0,_lastNSecs=0;var v1_1=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rngBrowser();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid_1(b)};var v4_1=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rngBrowser)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid_1(rnds)},uuid=v4_1;uuid.v1=v1_1,uuid.v4=v4_1;var uuid_1=uuid;function search(queryOrParams,config){var requestURL;config=classes.crafterConf.mix(config);var params=queryOrParams instanceof Query?queryOrParams.params:queryOrParams;if(queryOrParams instanceof Query)return requestURL=utils.composeUrl(config,config.endpoints.SEARCH)+"?crafterSite="+config.site,classes.SDKService.httpPost(requestURL,params).pipe(operators.map(function(response){return response.hits}))}function createQuery(params){var query,queryId=params&¶ms.uuid?params.uuid:uuid_1();return query=new Query,Object.assign(query.params,params),query.uuid=queryId,query}!function(self){var ampersandTest,nativeURLSearchParams=self.URLSearchParams&&self.URLSearchParams.prototype.get?self.URLSearchParams:null,isSupportObjectConstructor=nativeURLSearchParams&&"a=1"===new nativeURLSearchParams({a:1}).toString(),decodesPlusesCorrectly=nativeURLSearchParams&&"+"===new nativeURLSearchParams("s=%2B").get("s"),__URLSearchParams__="__URLSearchParams__",encodesAmpersandsCorrectly=!nativeURLSearchParams||((ampersandTest=new nativeURLSearchParams).append("s"," &"),"s=+%26"===ampersandTest.toString()),prototype=URLSearchParamsPolyfill.prototype,iterable=!(!self.Symbol||!self.Symbol.iterator);if(!(nativeURLSearchParams&&isSupportObjectConstructor&&decodesPlusesCorrectly&&encodesAmpersandsCorrectly)){prototype.append=function(name,value){appendTo(this[__URLSearchParams__],name,value)},prototype.delete=function(name){delete this[__URLSearchParams__][name]},prototype.get=function(name){var dict=this[__URLSearchParams__];return name in dict?dict[name][0]:null},prototype.getAll=function(name){var dict=this[__URLSearchParams__];return name in dict?dict[name].slice(0):[]},prototype.has=function(name){return name in this[__URLSearchParams__]},prototype.set=function(name,value){this[__URLSearchParams__][name]=[""+value]},prototype.toString=function(){var i,key,name,value,dict=this[__URLSearchParams__],query=[];for(key in dict)for(name=encode(key),i=0,value=dict[key];i<value.length;i++)query.push(name+"="+encode(value[i]));return query.join("&")};var useProxy=!!decodesPlusesCorrectly&&nativeURLSearchParams&&!isSupportObjectConstructor&&self.Proxy;Object.defineProperty(self,"URLSearchParams",{value:useProxy?new Proxy(nativeURLSearchParams,{construct:function(target,args){return new target(new URLSearchParamsPolyfill(args[0]).toString())}}):URLSearchParamsPolyfill});var USPProto=self.URLSearchParams.prototype;USPProto.polyfill=!0,USPProto.forEach=USPProto.forEach||function(callback,thisArg){var dict=parseToDict(this.toString());Object.getOwnPropertyNames(dict).forEach(function(name){dict[name].forEach(function(value){callback.call(thisArg,value,name,this)},this)},this)},USPProto.sort=USPProto.sort||function(){var k,i,j,dict=parseToDict(this.toString()),keys=[];for(k in dict)keys.push(k);for(keys.sort(),i=0;i<keys.length;i++)this.delete(keys[i]);for(i=0;i<keys.length;i++){var key=keys[i],values=dict[key];for(j=0;j<values.length;j++)this.append(key,values[j])}},USPProto.keys=USPProto.keys||function(){var items=[];return this.forEach(function(item,name){items.push(name)}),makeIterator(items)},USPProto.values=USPProto.values||function(){var items=[];return this.forEach(function(item){items.push(item)}),makeIterator(items)},USPProto.entries=USPProto.entries||function(){var items=[];return this.forEach(function(item,name){items.push([name,item])}),makeIterator(items)},iterable&&(USPProto[self.Symbol.iterator]=USPProto[self.Symbol.iterator]||USPProto.entries)}function URLSearchParamsPolyfill(search){((search=search||"")instanceof URLSearchParams||search instanceof URLSearchParamsPolyfill)&&(search=search.toString()),this[__URLSearchParams__]=parseToDict(search)}function encode(str){var replace={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g,function(match){return replace[match]})}function decode(str){return decodeURIComponent(str.replace(/\+/g," "))}function makeIterator(arr){var iterator={next:function(){var value=arr.shift();return{done:void 0===value,value:value}}};return iterable&&(iterator[self.Symbol.iterator]=function(){return iterator}),iterator}function parseToDict(search){var dict={};if("object"==typeof search)for(var key in search)search.hasOwnProperty(key)&&appendTo(dict,key,search[key]);else{0===search.indexOf("?")&&(search=search.slice(1));for(var pairs=search.split("&"),j=0;j<pairs.length;j++){var value=pairs[j],index=value.indexOf("=");-1<index?appendTo(dict,decode(value.slice(0,index)),decode(value.slice(index+1))):value&&appendTo(dict,decode(value),"")}}return dict}function appendTo(dict,name,value){var val="string"==typeof value?value:null!==value&&void 0!==value&&"function"==typeof value.toString?value.toString():JSON.stringify(value);name in dict?dict[name].push(val):dict[name]=[val]}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:commonjsGlobal);var SearchService={search:search,createQuery:createQuery};exports.Query=Query,exports.SearchService=SearchService,exports.createQuery=createQuery,exports.search=search,Object.defineProperty(exports,"__esModule",{value:!0})}); |
@@ -17,4 +17,3 @@ /* | ||
export * from './src/query'; | ||
export * from './src/elastic-query'; | ||
export * from './src/SearchService'; | ||
//# sourceMappingURL=search.js.map |
@@ -54,3 +54,10 @@ /* | ||
} | ||
/** | ||
* Sets the actual query. | ||
* @param {string} query - Query string | ||
*/ | ||
set query(query) { | ||
this.params = query; | ||
} | ||
} | ||
//# sourceMappingURL=query.js.map |
@@ -20,3 +20,2 @@ /* | ||
import { Query } from './query'; | ||
import { ElasticQuery } from '@craftercms/search'; | ||
import uuid from 'uuid'; | ||
@@ -30,4 +29,4 @@ import 'url-search-params-polyfill'; | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -46,3 +45,3 @@ .pipe(map((response) => { | ||
: uuid(); | ||
query = new ElasticQuery(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -49,0 +48,0 @@ query.uuid = queryId; |
@@ -17,4 +17,3 @@ /* | ||
export * from './src/query'; | ||
export * from './src/elastic-query'; | ||
export * from './src/SearchService'; | ||
//# sourceMappingURL=search.js.map |
@@ -55,2 +55,13 @@ /* | ||
}; | ||
Object.defineProperty(Query.prototype, "query", { | ||
/** | ||
* Sets the actual query. | ||
* @param {string} query - Query string | ||
*/ | ||
set: function (query) { | ||
this.params = query; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return Query; | ||
@@ -57,0 +68,0 @@ }()); |
@@ -20,3 +20,2 @@ /* | ||
import { Query } from './query'; | ||
import { ElasticQuery } from '@craftercms/search'; | ||
import uuid from 'uuid'; | ||
@@ -30,4 +29,4 @@ import 'url-search-params-polyfill'; | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -46,3 +45,3 @@ .pipe(map(function (response) { | ||
: uuid(); | ||
query = new ElasticQuery(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -49,0 +48,0 @@ query.uuid = queryId; |
@@ -19,3 +19,2 @@ /* | ||
import { crafterConf, SDKService } from '@craftercms/classes'; | ||
import { ElasticQuery as ElasticQuery$1 } from '@craftercms/search'; | ||
@@ -75,23 +74,2 @@ /* | ||
} | ||
} | ||
/* | ||
* Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
/** | ||
* Query implementation for Elasticsearch | ||
*/ | ||
class ElasticQuery extends Query { | ||
/** | ||
@@ -652,4 +630,4 @@ * Sets the actual query. | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery$1) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -668,3 +646,3 @@ .pipe(map((response) => { | ||
: uuid_1(); | ||
query = new ElasticQuery$1(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -682,3 +660,3 @@ query.uuid = queryId; | ||
export { ElasticQuery, Query, SearchService, createQuery, search }; | ||
export { Query, SearchService, createQuery, search }; | ||
//# sourceMappingURL=search.js.map |
@@ -19,3 +19,2 @@ /* | ||
import { crafterConf, SDKService } from '@craftercms/classes'; | ||
import { ElasticQuery as ElasticQuery$1 } from '@craftercms/search'; | ||
@@ -75,23 +74,2 @@ /* | ||
} | ||
} | ||
/* | ||
* Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
/** | ||
* Query implementation for Elasticsearch | ||
*/ | ||
class ElasticQuery extends Query { | ||
/** | ||
@@ -652,4 +630,4 @@ * Sets the actual query. | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery$1) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -668,3 +646,3 @@ .pipe(map((response) => { | ||
: uuid_1(); | ||
query = new ElasticQuery$1(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -682,3 +660,3 @@ query.uuid = queryId; | ||
export { ElasticQuery, Query, SearchService, createQuery, search }; | ||
export { Query, SearchService, createQuery, search }; | ||
//# sourceMappingURL=search.js.map |
@@ -19,3 +19,2 @@ /* | ||
import { crafterConf, SDKService } from '@craftercms/classes'; | ||
import { ElasticQuery as ElasticQuery$1 } from '@craftercms/search'; | ||
@@ -76,60 +75,3 @@ /* | ||
}; | ||
return Query; | ||
}()); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(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); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
/* | ||
* Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
/** | ||
* Query implementation for Elasticsearch | ||
*/ | ||
var ElasticQuery = /** @class */ (function (_super) { | ||
__extends(ElasticQuery, _super); | ||
function ElasticQuery() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
Object.defineProperty(ElasticQuery.prototype, "query", { | ||
Object.defineProperty(Query.prototype, "query", { | ||
/** | ||
@@ -145,4 +87,4 @@ * Sets the actual query. | ||
}); | ||
return ElasticQuery; | ||
}(Query)); | ||
return Query; | ||
}()); | ||
@@ -695,4 +637,4 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery$1) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -711,3 +653,3 @@ .pipe(map(function (response) { | ||
: uuid_1(); | ||
query = new ElasticQuery$1(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -725,3 +667,3 @@ query.uuid = queryId; | ||
export { ElasticQuery, Query, SearchService, createQuery, search }; | ||
export { Query, SearchService, createQuery, search }; | ||
//# sourceMappingURL=search.js.map |
@@ -19,3 +19,2 @@ /* | ||
import { crafterConf, SDKService } from '@craftercms/classes'; | ||
import { ElasticQuery as ElasticQuery$1 } from '@craftercms/search'; | ||
@@ -76,60 +75,3 @@ /* | ||
}; | ||
return Query; | ||
}()); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(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); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
/* | ||
* Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
/** | ||
* Query implementation for Elasticsearch | ||
*/ | ||
var ElasticQuery = /** @class */ (function (_super) { | ||
__extends(ElasticQuery, _super); | ||
function ElasticQuery() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
Object.defineProperty(ElasticQuery.prototype, "query", { | ||
Object.defineProperty(Query.prototype, "query", { | ||
/** | ||
@@ -145,4 +87,4 @@ * Sets the actual query. | ||
}); | ||
return ElasticQuery; | ||
}(Query)); | ||
return Query; | ||
}()); | ||
@@ -695,4 +637,4 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
: queryOrParams; | ||
if (queryOrParams instanceof ElasticQuery$1) { | ||
requestURL = composeUrl(config, config.endpoints.ELASTICSEARCH) + '?crafterSite=' + config.site; | ||
if (queryOrParams instanceof Query) { | ||
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site; | ||
return SDKService.httpPost(requestURL, params) | ||
@@ -711,3 +653,3 @@ .pipe(map(function (response) { | ||
: uuid_1(); | ||
query = new ElasticQuery$1(); | ||
query = new Query(); | ||
Object.assign(query.params, params); | ||
@@ -725,3 +667,3 @@ query.uuid = queryId; | ||
export { ElasticQuery, Query, SearchService, createQuery, search }; | ||
export { Query, SearchService, createQuery, search }; | ||
//# sourceMappingURL=search.js.map |
{ | ||
"name": "@craftercms/search", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "Crafter CMS search service and associated tools", | ||
@@ -29,5 +29,5 @@ "main": "./bundles/search.umd.js", | ||
"dependencies": { | ||
"@craftercms/classes": "4.0.3", | ||
"@craftercms/models": "4.0.3", | ||
"@craftercms/utils": "4.0.3", | ||
"@craftercms/classes": "4.1.0", | ||
"@craftercms/models": "4.1.0", | ||
"@craftercms/utils": "4.1.0", | ||
"rxjs": "^7.0.0", | ||
@@ -34,0 +34,0 @@ "url-search-params-polyfill": "^5.0.0", |
@@ -42,3 +42,3 @@ ![npm (scoped)](https://img.shields.io/npm/v/@craftercms/search?style=plastic) | ||
search( | ||
createQuery('elasticsearch', { | ||
createQuery({ | ||
query: { | ||
@@ -45,0 +45,0 @@ bool: { |
export * from './src/query'; | ||
export * from './src/elastic-query'; | ||
export * from './src/SearchService'; |
@@ -23,2 +23,7 @@ /** | ||
addParam(name: any, value: any): void; | ||
/** | ||
* Sets the actual query. | ||
* @param {string} query - Query string | ||
*/ | ||
set query(query: any); | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
3
362880
34
3249
+ Added@craftercms/classes@4.1.0(transitive)
+ Added@craftercms/models@4.1.0(transitive)
+ Added@craftercms/utils@4.1.0(transitive)
- Removed@craftercms/classes@4.0.3(transitive)
- Removed@craftercms/models@4.0.3(transitive)
- Removed@craftercms/utils@4.0.3(transitive)
Updated@craftercms/classes@4.1.0
Updated@craftercms/models@4.1.0
Updated@craftercms/utils@4.1.0