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

@craftercms/search

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@craftercms/search - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3

328

bundles/search.umd.js

@@ -106,4 +106,2 @@ /*

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {

@@ -317,317 +315,2 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
(function(self) {
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
__URLSearchParams__ = "__URLSearchParams__",
// Fix bug in Edge which cannot encode ' &' correctly
encodesAmpersandsCorrectly = nativeURLSearchParams ? (function() {
var ampersandTest = new nativeURLSearchParams();
ampersandTest.append('s', ' &');
return ampersandTest.toString() === 's=+%26';
})() : true,
prototype = URLSearchParamsPolyfill.prototype,
iterable = !!(self.Symbol && self.Symbol.iterator);
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) {
return;
}
/**
* Make a URLSearchParams instance
*
* @param {object|string|URLSearchParams} search
* @constructor
*/
function URLSearchParamsPolyfill(search) {
search = search || "";
// support construct object with another URLSearchParams instance
if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) {
search = search.toString();
}
this [__URLSearchParams__] = parseToDict(search);
}
/**
* Appends a specified key/value pair as a new search parameter.
*
* @param {string} name
* @param {string} value
*/
prototype.append = function(name, value) {
appendTo(this [__URLSearchParams__], name, value);
};
/**
* Deletes the given search parameter, and its associated value,
* from the list of all search parameters.
*
* @param {string} name
*/
prototype['delete'] = function(name) {
delete this [__URLSearchParams__] [name];
};
/**
* Returns the first value associated to the given search parameter.
*
* @param {string} name
* @returns {string|null}
*/
prototype.get = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict[name][0] : null;
};
/**
* Returns all the values association with a given search parameter.
*
* @param {string} name
* @returns {Array}
*/
prototype.getAll = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict [name].slice(0) : [];
};
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* @param {string} name
* @returns {boolean}
*/
prototype.has = function(name) {
return name in this [__URLSearchParams__];
};
/**
* Sets the value associated to a given search parameter to
* the given value. If there were several values, delete the
* others.
*
* @param {string} name
* @param {string} value
*/
prototype.set = function set(name, value) {
this [__URLSearchParams__][name] = ['' + value];
};
/**
* Returns a string containg a query string suitable for use in a URL.
*
* @returns {string}
*/
prototype.toString = function() {
var dict = this[__URLSearchParams__], query = [], i, key, name, value;
for (key in dict) {
name = encode(key);
for (i = 0, value = dict[key]; i < value.length; i++) {
query.push(name + '=' + encode(value[i]));
}
}
return query.join('&');
};
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough.
var forSureUsePolyfill = !decodesPlusesCorrectly;
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy);
/*
* Apply polifill to global object and append other prototype into it
*/
Object.defineProperty(self, 'URLSearchParams', {
value: (useProxy ?
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0
new Proxy(nativeURLSearchParams, {
construct: function(target, args) {
return new target((new URLSearchParamsPolyfill(args[0]).toString()));
}
}) :
URLSearchParamsPolyfill)
});
var USPProto = self.URLSearchParams.prototype;
USPProto.polyfill = true;
/**
*
* @param {function} callback
* @param {object} thisArg
*/
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);
};
/**
* Sort all name-value pairs
*/
USPProto.sort = USPProto.sort || function() {
var dict = parseToDict(this.toString()), keys = [], k, i, j;
for (k in dict) {
keys.push(k);
}
keys.sort();
for (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]);
}
}
};
/**
* Returns an iterator allowing to go through all keys of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push(name);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all values of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push(item);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all key/value
* pairs contained in this object.
*
* @returns {function}
*/
USPProto.entries = USPProto.entries || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name, item]);
});
return makeIterator(items);
};
if (iterable) {
USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries;
}
function encode(str) {
var replace = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+',
'%00': '\x00'
};
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: value === undefined, value: value};
}
};
if (iterable) {
iterator[self.Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function parseToDict(search) {
var dict = {};
if (typeof search === "object") {
for (var key in search) {
if (search.hasOwnProperty(key)) {
appendTo(dict, key, search[key]);
}
}
} else {
// remove first '?'
if (search.indexOf("?") === 0) {
search = search.slice(1);
}
var pairs = search.split("&");
for (var j = 0; j < pairs.length; j++) {
var value = pairs [j],
index = value.indexOf('=');
if (-1 < index) {
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
} else {
if (value) {
appendTo(dict, decode(value), '');
}
}
}
}
return dict;
}
function appendTo(dict, name, value) {
var val = typeof value === 'string' ? value : (
value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value)
);
if (name in dict) {
dict[name].push(val);
} else {
dict[name] = [val];
}
}
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : (typeof window !== 'undefined' ? window : commonjsGlobal));
/*

@@ -651,9 +334,6 @@ * Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved.

var requestURL;
var params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
var params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = utils.composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return classes.SDKService.httpPost(requestURL, params)
.pipe(operators.map(function (response) {
return classes.SDKService.httpPost(requestURL, params).pipe(operators.map(function (response) {
return response.hits;

@@ -667,5 +347,3 @@ }));

function createQuery(params) {
var query, queryId = (params && params['uuid'])
? params['uuid']
: uuid_1();
var query, queryId = params && params['uuid'] ? params['uuid'] : uuid_1();
query = new Query();

@@ -672,0 +350,0 @@ Object.assign(query.params, params);

2

bundles/search.umd.min.js

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

!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&&params.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})});
!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}();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&&params.uuid?params.uuid:uuid_1();return query=new Query,Object.assign(query.params,params),query.uuid=queryId,query}var SearchService={search:search,createQuery:createQuery};exports.Query=Query,exports.SearchService=SearchService,exports.createQuery=createQuery,exports.search=search,Object.defineProperty(exports,"__esModule",{value:!0})});

@@ -21,13 +21,9 @@ /*

import uuid from 'uuid';
import 'url-search-params-polyfill';
export function search(queryOrParams, config) {
config = crafterConf.mix(config);
let requestURL;
const params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
const params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map((response) => {
return SDKService.httpPost(requestURL, params).pipe(map((response) => {
return response.hits;

@@ -41,5 +37,3 @@ }));

export function createQuery(params) {
let query, queryId = (params && params['uuid'])
? params['uuid']
: uuid();
let query, queryId = params && params['uuid'] ? params['uuid'] : uuid();
query = new Query();

@@ -46,0 +40,0 @@ Object.assign(query.params, params);

@@ -21,13 +21,9 @@ /*

import uuid from 'uuid';
import 'url-search-params-polyfill';
export function search(queryOrParams, config) {
config = crafterConf.mix(config);
var requestURL;
var params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
var params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map(function (response) {
return SDKService.httpPost(requestURL, params).pipe(map(function (response) {
return response.hits;

@@ -41,5 +37,3 @@ }));

export function createQuery(params) {
var query, queryId = (params && params['uuid'])
? params['uuid']
: uuid();
var query, queryId = params && params['uuid'] ? params['uuid'] : uuid();
query = new Query();

@@ -46,0 +40,0 @@ Object.assign(query.params, params);

@@ -82,4 +82,2 @@ /*

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {

@@ -293,317 +291,2 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
(function(self) {
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
__URLSearchParams__ = "__URLSearchParams__",
// Fix bug in Edge which cannot encode ' &' correctly
encodesAmpersandsCorrectly = nativeURLSearchParams ? (function() {
var ampersandTest = new nativeURLSearchParams();
ampersandTest.append('s', ' &');
return ampersandTest.toString() === 's=+%26';
})() : true,
prototype = URLSearchParamsPolyfill.prototype,
iterable = !!(self.Symbol && self.Symbol.iterator);
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) {
return;
}
/**
* Make a URLSearchParams instance
*
* @param {object|string|URLSearchParams} search
* @constructor
*/
function URLSearchParamsPolyfill(search) {
search = search || "";
// support construct object with another URLSearchParams instance
if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) {
search = search.toString();
}
this [__URLSearchParams__] = parseToDict(search);
}
/**
* Appends a specified key/value pair as a new search parameter.
*
* @param {string} name
* @param {string} value
*/
prototype.append = function(name, value) {
appendTo(this [__URLSearchParams__], name, value);
};
/**
* Deletes the given search parameter, and its associated value,
* from the list of all search parameters.
*
* @param {string} name
*/
prototype['delete'] = function(name) {
delete this [__URLSearchParams__] [name];
};
/**
* Returns the first value associated to the given search parameter.
*
* @param {string} name
* @returns {string|null}
*/
prototype.get = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict[name][0] : null;
};
/**
* Returns all the values association with a given search parameter.
*
* @param {string} name
* @returns {Array}
*/
prototype.getAll = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict [name].slice(0) : [];
};
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* @param {string} name
* @returns {boolean}
*/
prototype.has = function(name) {
return name in this [__URLSearchParams__];
};
/**
* Sets the value associated to a given search parameter to
* the given value. If there were several values, delete the
* others.
*
* @param {string} name
* @param {string} value
*/
prototype.set = function set(name, value) {
this [__URLSearchParams__][name] = ['' + value];
};
/**
* Returns a string containg a query string suitable for use in a URL.
*
* @returns {string}
*/
prototype.toString = function() {
var dict = this[__URLSearchParams__], query = [], i, key, name, value;
for (key in dict) {
name = encode(key);
for (i = 0, value = dict[key]; i < value.length; i++) {
query.push(name + '=' + encode(value[i]));
}
}
return query.join('&');
};
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough.
var forSureUsePolyfill = !decodesPlusesCorrectly;
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy);
/*
* Apply polifill to global object and append other prototype into it
*/
Object.defineProperty(self, 'URLSearchParams', {
value: (useProxy ?
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0
new Proxy(nativeURLSearchParams, {
construct: function(target, args) {
return new target((new URLSearchParamsPolyfill(args[0]).toString()));
}
}) :
URLSearchParamsPolyfill)
});
var USPProto = self.URLSearchParams.prototype;
USPProto.polyfill = true;
/**
*
* @param {function} callback
* @param {object} thisArg
*/
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);
};
/**
* Sort all name-value pairs
*/
USPProto.sort = USPProto.sort || function() {
var dict = parseToDict(this.toString()), keys = [], k, i, j;
for (k in dict) {
keys.push(k);
}
keys.sort();
for (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]);
}
}
};
/**
* Returns an iterator allowing to go through all keys of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push(name);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all values of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push(item);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all key/value
* pairs contained in this object.
*
* @returns {function}
*/
USPProto.entries = USPProto.entries || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name, item]);
});
return makeIterator(items);
};
if (iterable) {
USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries;
}
function encode(str) {
var replace = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+',
'%00': '\x00'
};
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: value === undefined, value: value};
}
};
if (iterable) {
iterator[self.Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function parseToDict(search) {
var dict = {};
if (typeof search === "object") {
for (var key in search) {
if (search.hasOwnProperty(key)) {
appendTo(dict, key, search[key]);
}
}
} else {
// remove first '?'
if (search.indexOf("?") === 0) {
search = search.slice(1);
}
var pairs = search.split("&");
for (var j = 0; j < pairs.length; j++) {
var value = pairs [j],
index = value.indexOf('=');
if (-1 < index) {
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
} else {
if (value) {
appendTo(dict, decode(value), '');
}
}
}
}
return dict;
}
function appendTo(dict, name, value) {
var val = typeof value === 'string' ? value : (
value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value)
);
if (name in dict) {
dict[name].push(val);
} else {
dict[name] = [val];
}
}
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : (typeof window !== 'undefined' ? window : commonjsGlobal));
/*

@@ -627,9 +310,6 @@ * Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved.

let requestURL;
const params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
const params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map((response) => {
return SDKService.httpPost(requestURL, params).pipe(map((response) => {
return response.hits;

@@ -643,5 +323,3 @@ }));

function createQuery(params) {
let query, queryId = (params && params['uuid'])
? params['uuid']
: uuid_1();
let query, queryId = params && params['uuid'] ? params['uuid'] : uuid_1();
query = new Query();

@@ -648,0 +326,0 @@ Object.assign(query.params, params);

@@ -82,4 +82,2 @@ /*

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {

@@ -293,317 +291,2 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
(function(self) {
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
__URLSearchParams__ = "__URLSearchParams__",
// Fix bug in Edge which cannot encode ' &' correctly
encodesAmpersandsCorrectly = nativeURLSearchParams ? (function() {
var ampersandTest = new nativeURLSearchParams();
ampersandTest.append('s', ' &');
return ampersandTest.toString() === 's=+%26';
})() : true,
prototype = URLSearchParamsPolyfill.prototype,
iterable = !!(self.Symbol && self.Symbol.iterator);
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) {
return;
}
/**
* Make a URLSearchParams instance
*
* @param {object|string|URLSearchParams} search
* @constructor
*/
function URLSearchParamsPolyfill(search) {
search = search || "";
// support construct object with another URLSearchParams instance
if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) {
search = search.toString();
}
this [__URLSearchParams__] = parseToDict(search);
}
/**
* Appends a specified key/value pair as a new search parameter.
*
* @param {string} name
* @param {string} value
*/
prototype.append = function(name, value) {
appendTo(this [__URLSearchParams__], name, value);
};
/**
* Deletes the given search parameter, and its associated value,
* from the list of all search parameters.
*
* @param {string} name
*/
prototype['delete'] = function(name) {
delete this [__URLSearchParams__] [name];
};
/**
* Returns the first value associated to the given search parameter.
*
* @param {string} name
* @returns {string|null}
*/
prototype.get = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict[name][0] : null;
};
/**
* Returns all the values association with a given search parameter.
*
* @param {string} name
* @returns {Array}
*/
prototype.getAll = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict [name].slice(0) : [];
};
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* @param {string} name
* @returns {boolean}
*/
prototype.has = function(name) {
return name in this [__URLSearchParams__];
};
/**
* Sets the value associated to a given search parameter to
* the given value. If there were several values, delete the
* others.
*
* @param {string} name
* @param {string} value
*/
prototype.set = function set(name, value) {
this [__URLSearchParams__][name] = ['' + value];
};
/**
* Returns a string containg a query string suitable for use in a URL.
*
* @returns {string}
*/
prototype.toString = function() {
var dict = this[__URLSearchParams__], query = [], i, key, name, value;
for (key in dict) {
name = encode(key);
for (i = 0, value = dict[key]; i < value.length; i++) {
query.push(name + '=' + encode(value[i]));
}
}
return query.join('&');
};
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough.
var forSureUsePolyfill = !decodesPlusesCorrectly;
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy);
/*
* Apply polifill to global object and append other prototype into it
*/
Object.defineProperty(self, 'URLSearchParams', {
value: (useProxy ?
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0
new Proxy(nativeURLSearchParams, {
construct: function(target, args) {
return new target((new URLSearchParamsPolyfill(args[0]).toString()));
}
}) :
URLSearchParamsPolyfill)
});
var USPProto = self.URLSearchParams.prototype;
USPProto.polyfill = true;
/**
*
* @param {function} callback
* @param {object} thisArg
*/
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);
};
/**
* Sort all name-value pairs
*/
USPProto.sort = USPProto.sort || function() {
var dict = parseToDict(this.toString()), keys = [], k, i, j;
for (k in dict) {
keys.push(k);
}
keys.sort();
for (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]);
}
}
};
/**
* Returns an iterator allowing to go through all keys of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push(name);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all values of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push(item);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all key/value
* pairs contained in this object.
*
* @returns {function}
*/
USPProto.entries = USPProto.entries || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name, item]);
});
return makeIterator(items);
};
if (iterable) {
USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries;
}
function encode(str) {
var replace = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+',
'%00': '\x00'
};
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: value === undefined, value: value};
}
};
if (iterable) {
iterator[self.Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function parseToDict(search) {
var dict = {};
if (typeof search === "object") {
for (var key in search) {
if (search.hasOwnProperty(key)) {
appendTo(dict, key, search[key]);
}
}
} else {
// remove first '?'
if (search.indexOf("?") === 0) {
search = search.slice(1);
}
var pairs = search.split("&");
for (var j = 0; j < pairs.length; j++) {
var value = pairs [j],
index = value.indexOf('=');
if (-1 < index) {
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
} else {
if (value) {
appendTo(dict, decode(value), '');
}
}
}
}
return dict;
}
function appendTo(dict, name, value) {
var val = typeof value === 'string' ? value : (
value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value)
);
if (name in dict) {
dict[name].push(val);
} else {
dict[name] = [val];
}
}
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : (typeof window !== 'undefined' ? window : commonjsGlobal));
/*

@@ -627,9 +310,6 @@ * Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved.

let requestURL;
const params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
const params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map((response) => {
return SDKService.httpPost(requestURL, params).pipe(map((response) => {
return response.hits;

@@ -643,5 +323,3 @@ }));

function createQuery(params) {
let query, queryId = (params && params['uuid'])
? params['uuid']
: uuid_1();
let query, queryId = params && params['uuid'] ? params['uuid'] : uuid_1();
query = new Query();

@@ -648,0 +326,0 @@ Object.assign(query.params, params);

@@ -88,4 +88,2 @@ /*

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {

@@ -299,317 +297,2 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
(function(self) {
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
__URLSearchParams__ = "__URLSearchParams__",
// Fix bug in Edge which cannot encode ' &' correctly
encodesAmpersandsCorrectly = nativeURLSearchParams ? (function() {
var ampersandTest = new nativeURLSearchParams();
ampersandTest.append('s', ' &');
return ampersandTest.toString() === 's=+%26';
})() : true,
prototype = URLSearchParamsPolyfill.prototype,
iterable = !!(self.Symbol && self.Symbol.iterator);
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) {
return;
}
/**
* Make a URLSearchParams instance
*
* @param {object|string|URLSearchParams} search
* @constructor
*/
function URLSearchParamsPolyfill(search) {
search = search || "";
// support construct object with another URLSearchParams instance
if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) {
search = search.toString();
}
this [__URLSearchParams__] = parseToDict(search);
}
/**
* Appends a specified key/value pair as a new search parameter.
*
* @param {string} name
* @param {string} value
*/
prototype.append = function(name, value) {
appendTo(this [__URLSearchParams__], name, value);
};
/**
* Deletes the given search parameter, and its associated value,
* from the list of all search parameters.
*
* @param {string} name
*/
prototype['delete'] = function(name) {
delete this [__URLSearchParams__] [name];
};
/**
* Returns the first value associated to the given search parameter.
*
* @param {string} name
* @returns {string|null}
*/
prototype.get = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict[name][0] : null;
};
/**
* Returns all the values association with a given search parameter.
*
* @param {string} name
* @returns {Array}
*/
prototype.getAll = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict [name].slice(0) : [];
};
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* @param {string} name
* @returns {boolean}
*/
prototype.has = function(name) {
return name in this [__URLSearchParams__];
};
/**
* Sets the value associated to a given search parameter to
* the given value. If there were several values, delete the
* others.
*
* @param {string} name
* @param {string} value
*/
prototype.set = function set(name, value) {
this [__URLSearchParams__][name] = ['' + value];
};
/**
* Returns a string containg a query string suitable for use in a URL.
*
* @returns {string}
*/
prototype.toString = function() {
var dict = this[__URLSearchParams__], query = [], i, key, name, value;
for (key in dict) {
name = encode(key);
for (i = 0, value = dict[key]; i < value.length; i++) {
query.push(name + '=' + encode(value[i]));
}
}
return query.join('&');
};
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough.
var forSureUsePolyfill = !decodesPlusesCorrectly;
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy);
/*
* Apply polifill to global object and append other prototype into it
*/
Object.defineProperty(self, 'URLSearchParams', {
value: (useProxy ?
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0
new Proxy(nativeURLSearchParams, {
construct: function(target, args) {
return new target((new URLSearchParamsPolyfill(args[0]).toString()));
}
}) :
URLSearchParamsPolyfill)
});
var USPProto = self.URLSearchParams.prototype;
USPProto.polyfill = true;
/**
*
* @param {function} callback
* @param {object} thisArg
*/
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);
};
/**
* Sort all name-value pairs
*/
USPProto.sort = USPProto.sort || function() {
var dict = parseToDict(this.toString()), keys = [], k, i, j;
for (k in dict) {
keys.push(k);
}
keys.sort();
for (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]);
}
}
};
/**
* Returns an iterator allowing to go through all keys of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push(name);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all values of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push(item);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all key/value
* pairs contained in this object.
*
* @returns {function}
*/
USPProto.entries = USPProto.entries || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name, item]);
});
return makeIterator(items);
};
if (iterable) {
USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries;
}
function encode(str) {
var replace = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+',
'%00': '\x00'
};
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: value === undefined, value: value};
}
};
if (iterable) {
iterator[self.Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function parseToDict(search) {
var dict = {};
if (typeof search === "object") {
for (var key in search) {
if (search.hasOwnProperty(key)) {
appendTo(dict, key, search[key]);
}
}
} else {
// remove first '?'
if (search.indexOf("?") === 0) {
search = search.slice(1);
}
var pairs = search.split("&");
for (var j = 0; j < pairs.length; j++) {
var value = pairs [j],
index = value.indexOf('=');
if (-1 < index) {
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
} else {
if (value) {
appendTo(dict, decode(value), '');
}
}
}
}
return dict;
}
function appendTo(dict, name, value) {
var val = typeof value === 'string' ? value : (
value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value)
);
if (name in dict) {
dict[name].push(val);
} else {
dict[name] = [val];
}
}
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : (typeof window !== 'undefined' ? window : commonjsGlobal));
/*

@@ -633,9 +316,6 @@ * Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved.

var requestURL;
var params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
var params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map(function (response) {
return SDKService.httpPost(requestURL, params).pipe(map(function (response) {
return response.hits;

@@ -649,5 +329,3 @@ }));

function createQuery(params) {
var query, queryId = (params && params['uuid'])
? params['uuid']
: uuid_1();
var query, queryId = params && params['uuid'] ? params['uuid'] : uuid_1();
query = new Query();

@@ -654,0 +332,0 @@ Object.assign(query.params, params);

@@ -88,4 +88,2 @@ /*

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {

@@ -299,317 +297,2 @@ return module = { exports: {} }, fn(module, module.exports), module.exports;

/**
*
*
* @author Jerry Bendy <jerry@icewingcc.com>
* @licence MIT
*
*/
(function(self) {
var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null,
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1',
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus.
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'),
__URLSearchParams__ = "__URLSearchParams__",
// Fix bug in Edge which cannot encode ' &' correctly
encodesAmpersandsCorrectly = nativeURLSearchParams ? (function() {
var ampersandTest = new nativeURLSearchParams();
ampersandTest.append('s', ' &');
return ampersandTest.toString() === 's=+%26';
})() : true,
prototype = URLSearchParamsPolyfill.prototype,
iterable = !!(self.Symbol && self.Symbol.iterator);
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly && encodesAmpersandsCorrectly) {
return;
}
/**
* Make a URLSearchParams instance
*
* @param {object|string|URLSearchParams} search
* @constructor
*/
function URLSearchParamsPolyfill(search) {
search = search || "";
// support construct object with another URLSearchParams instance
if (search instanceof URLSearchParams || search instanceof URLSearchParamsPolyfill) {
search = search.toString();
}
this [__URLSearchParams__] = parseToDict(search);
}
/**
* Appends a specified key/value pair as a new search parameter.
*
* @param {string} name
* @param {string} value
*/
prototype.append = function(name, value) {
appendTo(this [__URLSearchParams__], name, value);
};
/**
* Deletes the given search parameter, and its associated value,
* from the list of all search parameters.
*
* @param {string} name
*/
prototype['delete'] = function(name) {
delete this [__URLSearchParams__] [name];
};
/**
* Returns the first value associated to the given search parameter.
*
* @param {string} name
* @returns {string|null}
*/
prototype.get = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict[name][0] : null;
};
/**
* Returns all the values association with a given search parameter.
*
* @param {string} name
* @returns {Array}
*/
prototype.getAll = function(name) {
var dict = this [__URLSearchParams__];
return name in dict ? dict [name].slice(0) : [];
};
/**
* Returns a Boolean indicating if such a search parameter exists.
*
* @param {string} name
* @returns {boolean}
*/
prototype.has = function(name) {
return name in this [__URLSearchParams__];
};
/**
* Sets the value associated to a given search parameter to
* the given value. If there were several values, delete the
* others.
*
* @param {string} name
* @param {string} value
*/
prototype.set = function set(name, value) {
this [__URLSearchParams__][name] = ['' + value];
};
/**
* Returns a string containg a query string suitable for use in a URL.
*
* @returns {string}
*/
prototype.toString = function() {
var dict = this[__URLSearchParams__], query = [], i, key, name, value;
for (key in dict) {
name = encode(key);
for (i = 0, value = dict[key]; i < value.length; i++) {
query.push(name + '=' + encode(value[i]));
}
}
return query.join('&');
};
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough.
var forSureUsePolyfill = !decodesPlusesCorrectly;
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy);
/*
* Apply polifill to global object and append other prototype into it
*/
Object.defineProperty(self, 'URLSearchParams', {
value: (useProxy ?
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0
new Proxy(nativeURLSearchParams, {
construct: function(target, args) {
return new target((new URLSearchParamsPolyfill(args[0]).toString()));
}
}) :
URLSearchParamsPolyfill)
});
var USPProto = self.URLSearchParams.prototype;
USPProto.polyfill = true;
/**
*
* @param {function} callback
* @param {object} thisArg
*/
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);
};
/**
* Sort all name-value pairs
*/
USPProto.sort = USPProto.sort || function() {
var dict = parseToDict(this.toString()), keys = [], k, i, j;
for (k in dict) {
keys.push(k);
}
keys.sort();
for (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]);
}
}
};
/**
* Returns an iterator allowing to go through all keys of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.keys = USPProto.keys || function() {
var items = [];
this.forEach(function(item, name) {
items.push(name);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all values of
* the key/value pairs contained in this object.
*
* @returns {function}
*/
USPProto.values = USPProto.values || function() {
var items = [];
this.forEach(function(item) {
items.push(item);
});
return makeIterator(items);
};
/**
* Returns an iterator allowing to go through all key/value
* pairs contained in this object.
*
* @returns {function}
*/
USPProto.entries = USPProto.entries || function() {
var items = [];
this.forEach(function(item, name) {
items.push([name, item]);
});
return makeIterator(items);
};
if (iterable) {
USPProto[self.Symbol.iterator] = USPProto[self.Symbol.iterator] || USPProto.entries;
}
function encode(str) {
var replace = {
'!': '%21',
"'": '%27',
'(': '%28',
')': '%29',
'~': '%7E',
'%20': '+',
'%00': '\x00'
};
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: value === undefined, value: value};
}
};
if (iterable) {
iterator[self.Symbol.iterator] = function() {
return iterator;
};
}
return iterator;
}
function parseToDict(search) {
var dict = {};
if (typeof search === "object") {
for (var key in search) {
if (search.hasOwnProperty(key)) {
appendTo(dict, key, search[key]);
}
}
} else {
// remove first '?'
if (search.indexOf("?") === 0) {
search = search.slice(1);
}
var pairs = search.split("&");
for (var j = 0; j < pairs.length; j++) {
var value = pairs [j],
index = value.indexOf('=');
if (-1 < index) {
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
} else {
if (value) {
appendTo(dict, decode(value), '');
}
}
}
}
return dict;
}
function appendTo(dict, name, value) {
var val = typeof value === 'string' ? value : (
value !== null && value !== undefined && typeof value.toString === 'function' ? value.toString() : JSON.stringify(value)
);
if (name in dict) {
dict[name].push(val);
} else {
dict[name] = [val];
}
}
})(typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : (typeof window !== 'undefined' ? window : commonjsGlobal));
/*

@@ -633,9 +316,6 @@ * Copyright (C) 2007-2021 Crafter Software Corporation. All Rights Reserved.

var requestURL;
var params = (queryOrParams instanceof Query)
? queryOrParams.params
: queryOrParams;
var params = queryOrParams instanceof Query ? queryOrParams.params : queryOrParams;
if (queryOrParams instanceof Query) {
requestURL = composeUrl(config, config.endpoints.SEARCH) + '?crafterSite=' + config.site;
return SDKService.httpPost(requestURL, params)
.pipe(map(function (response) {
return SDKService.httpPost(requestURL, params).pipe(map(function (response) {
return response.hits;

@@ -649,5 +329,3 @@ }));

function createQuery(params) {
var query, queryId = (params && params['uuid'])
? params['uuid']
: uuid_1();
var query, queryId = params && params['uuid'] ? params['uuid'] : uuid_1();
query = new Query();

@@ -654,0 +332,0 @@ Object.assign(query.params, params);

{
"name": "@craftercms/search",
"version": "4.1.2",
"version": "4.1.3",
"description": "Crafter CMS search service and associated tools",

@@ -20,3 +20,2 @@ "main": "./bundles/search.umd.js",

"license": "GNU LGPL 3.0",
"private": false,
"scripts": {

@@ -30,19 +29,18 @@ "rollup": "../../node_modules/rollup/bin/rollup -c rollup.config.js",

"dependencies": {
"@craftercms/classes": "4.1.2",
"@craftercms/models": "4.1.2",
"@craftercms/utils": "4.1.2",
"rxjs": "^7.0.0",
"url-search-params-polyfill": "^5.0.0",
"@craftercms/classes": "4.1.3",
"@craftercms/models": "4.1.3",
"@craftercms/utils": "4.1.3",
"rxjs": "^7.8.1",
"uuid": "^3.4.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@types/mocha": "^7.0.1",
"mocha": "^7.0.1",
"rollup": "^1.31.1",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@types/mocha": "^7.0.2",
"mocha": "^7.2.0",
"rollup": "^1.32.1",
"rollup-plugin-sourcemaps": "^0.5.0",
"uglify-es": "^3.3.9",
"uglify-es": "^3.3.10",
"xhr-mock": "^2.5.1"
}
}
import { Observable } from 'rxjs';
import { CrafterConfig } from '@craftercms/models';
import { Query } from './query';
import 'url-search-params-polyfill';
import { SearchResult } from "@craftercms/models/src/search";
import { SearchResult } from '@craftercms/models/src/search';
/**

@@ -7,0 +6,0 @@ * Does a full-text search and returns a Map model.

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc