meilisearch
Advanced tools
Comparing version 0.8.7 to 0.8.8
@@ -1,2 +0,2 @@ | ||
import e from"http";import t from"https";import r from"url";import n from"assert";import s from"stream";import o from"tty";import i from"util";import a from"os";import c from"zlib";var u=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},f=Object.prototype.toString;function p(e){return"[object Array]"===f.call(e)}function h(e){return void 0===e}function d(e){return null!==e&&"object"==typeof e}function l(e){return"[object Function]"===f.call(e)}function m(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),p(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}var g={isArray:p,isArrayBuffer:function(e){return"[object ArrayBuffer]"===f.call(e)},isBuffer:function(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:d,isUndefined:h,isDate:function(e){return"[object Date]"===f.call(e)},isFile:function(e){return"[object File]"===f.call(e)},isBlob:function(e){return"[object Blob]"===f.call(e)},isFunction:l,isStream:function(e){return d(e)&&l(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:m,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,s=arguments.length;n<s;n++)m(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,s=arguments.length;n<s;n++)m(arguments[n],r);return t},extend:function(e,t,r){return m(t,(function(t,n){e[n]=r&&"function"==typeof t?u(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function C(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var v=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(g.isURLSearchParams(t))n=t.toString();else{var s=[];g.forEach(t,(function(e,t){null!=e&&(g.isArray(e)?t+="[]":e=[e],g.forEach(e,(function(e){g.isDate(e)?e=e.toISOString():g.isObject(e)&&(e=JSON.stringify(e)),s.push(C(t)+"="+C(e))})))})),n=s.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function y(){this.handlers=[]}y.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},y.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},y.prototype.forEach=function(e){g.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var b=y,x=function(e,t,r){return g.forEach(r,(function(r){e=r(e,t)})),e},w=function(e){return!(!e||!e.__CANCEL__)},R=function(e,t){g.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},O=function(e,t,r,n,s){return e.config=t,r&&(e.code=r),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},E=function(e,t,r,n,s){var o=new Error(e);return O(o,t,r,n,s)},F=function(e,t,r){var n=r.config.validateStatus;!n||n(r.status)?e(r):t(E("Request failed with status code "+r.status,r.config,null,r.request,r))},_=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},T=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],A=g.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;if(/(\b)(on\w+)=|javascript|(<\s*)(\/*)script/gi.test(e))throw new Error("URL contains XSS injection attempt");return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=g.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},S=g.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var i=[];i.push(e+"="+encodeURIComponent(t)),g.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),g.isString(n)&&i.push("path="+n),g.isString(s)&&i.push("domain="+s),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},j=function(e){return new Promise((function(t,r){var n=e.data,s=e.headers;g.isFormData(n)&&delete s["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",a=e.auth.password||"";s.Authorization="Basic "+btoa(i+":"+a)}var c=_(e.baseURL,e.url);if(o.open(e.method.toUpperCase(),v(c,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var n,s,i,a,c,u="getAllResponseHeaders"in o?(n=o.getAllResponseHeaders(),c={},n?(g.forEach(n.split("\n"),(function(e){if(a=e.indexOf(":"),s=g.trim(e.substr(0,a)).toLowerCase(),i=g.trim(e.substr(a+1)),s){if(c[s]&&T.indexOf(s)>=0)return;c[s]="set-cookie"===s?(c[s]?c[s]:[]).concat([i]):c[s]?c[s]+", "+i:i}})),c):c):null,f={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:u,config:e,request:o};F(t,r,f),o=null}},o.onabort=function(){o&&(r(E("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(E("Network Error",e,null,o)),o=null},o.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(E(t,e,"ECONNABORTED",o)),o=null},g.isStandardBrowserEnv()){var u=S,f=(e.withCredentials||A(c))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;f&&(s[e.xsrfHeaderName]=f)}if("setRequestHeader"in o&&g.forEach(s,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete s[t]:o.setRequestHeader(t,e)})),g.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),r(e),o=null)})),void 0===n&&(n=null),o.send(n)}))};function k(e,t){return e(t={exports:{}},t.exports),t.exports}var U=1e3,L=6e4,B=36e5,N=24*B,q=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"days":case"day":case"d":return r*N;case"hours":case"hour":case"hrs":case"hr":case"h":return r*B;case"minutes":case"minute":case"mins":case"min":case"m":return r*L;case"seconds":case"second":case"secs":case"sec":case"s":return r*U;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return M(e,N,"day")||M(e,B,"hour")||M(e,L,"minute")||M(e,U,"second")||e+" ms"}(e):function(e){if(e>=N)return Math.round(e/N)+"d";if(e>=B)return Math.round(e/B)+"h";if(e>=L)return Math.round(e/L)+"m";if(e>=U)return Math.round(e/U)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function M(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var I=k((function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var c=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;c++;var s=t.formatters[n];if("function"==typeof s){var o=i[c];r=s.call(e,o),i.splice(c,1),c--}return r})),t.formatArgs.call(e,i);var u=s.log||t.log||console.log.bind(console);u.apply(e,i)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var o=t.instances[r];o.enabled=t.enabled(o.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=q,t.instances=[],t.names=[],t.skips=[],t.formatters={}})),P=(I.coerce,I.disable,I.enable,I.enabled,I.humanize,I.instances,I.names,I.skips,I.formatters,k((function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=I).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(o=s))})),e.splice(o,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}))),D=(P.log,P.formatArgs,P.save,P.load,P.useColors,P.storage,P.colors,(e,t)=>{t=t||process.argv;const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return-1!==n&&(-1===s||n<s)});const{env:$}=process;let z;function H(e){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(function(e){if(0===z)return 0;if(D("color=16m")||D("color=full")||D("color=truecolor"))return 3;if(D("color=256"))return 2;if(e&&!e.isTTY&&void 0===z)return 0;const t=z||0;if("dumb"===$.TERM)return t;if("win32"===process.platform){const e=a.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in $)||"codeship"===$.CI_NAME?1:t;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if("truecolor"===$.COLORTERM)return 3;if("TERM_PROGRAM"in $){const e=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)?1:"COLORTERM"in $?1:t}(e))}D("no-color")||D("no-colors")||D("color=false")||D("color=never")?z=0:(D("color")||D("colors")||D("color=true")||D("color=always"))&&(z=1),"FORCE_COLOR"in $&&(z=!0===$.FORCE_COLOR||"true"===$.FORCE_COLOR?1:!1===$.FORCE_COLOR||"false"===$.FORCE_COLOR?0:0===$.FORCE_COLOR.length?1:Math.min(parseInt($.FORCE_COLOR,10),3));var G={supportsColor:H,stdout:H(process.stdout),stderr:H(process.stderr)},V=k((function(e,t){(t=e.exports=I).init=function(e){e.inspectOpts={};for(var r=Object.keys(t.inspectOpts),n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(){return process.stderr.write(i.format.apply(i,arguments)+"\n")},t.formatArgs=function(e){var r=this.namespace;if(this.useColors){var n=this.color,s="[3"+(n<8?n:"8;5;"+n),o=" "+s+";1m"+r+" [0m";e[0]=o+e[0].split("\n").join("\n"+o),e.push(s+"m+"+t.humanize(this.diff)+"[0m")}else e[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+e[0]},t.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},t.load=r,t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):o.isatty(process.stderr.fd)},t.colors=[6,2,3,4,5,1];try{G&&G.level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}function r(){return process.env.DEBUG}t.inspectOpts=Object.keys(process.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),t.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},t.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)},t.enable(r())})),K=(V.init,V.log,V.formatArgs,V.save,V.load,V.useColors,V.colors,V.inspectOpts,k((function(e){"undefined"==typeof process||"renderer"===process.type?e.exports=P:e.exports=V}))),X=s.Writable,J=K("follow-redirects"),Y={GET:!0,HEAD:!0,OPTIONS:!0,TRACE:!0},Z=Object.create(null);function W(e,t){X.call(this),e.headers=e.headers||{},this._options=e,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e.host&&(e.hostname||(e.hostname=e.host),delete e.host),t&&this.on("response",t);var r=this;if(this._onNativeResponse=function(e){r._processResponse(e)},!e.pathname&&e.path){var n=e.path.indexOf("?");n<0?e.pathname=e.path:(e.pathname=e.path.substring(0,n),e.search=e.path.substring(n))}this._performRequest()}function Q(e){var t={maxRedirects:21,maxBodyLength:10485760},s={};return Object.keys(e).forEach((function(o){var i=o+":",a=s[i]=e[o],c=t[o]=Object.create(a);c.request=function(e,o){return"string"==typeof e?(e=r.parse(e)).maxRedirects=t.maxRedirects:e=Object.assign({protocol:i,maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e),e.nativeProtocols=s,n.equal(e.protocol,i,"protocol mismatch"),J("options",e),new W(e,o)},c.get=function(e,t){var r=c.request(e,t);return r.end(),r}})),t}["abort","aborted","error","socket","timeout"].forEach((function(e){Z[e]=function(t){this._redirectable.emit(e,t)}})),W.prototype=Object.create(X.prototype),W.prototype.write=function(e,t,r){if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new Error("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Error("Request body larger than maxBodyLength limit")),this.abort()):r&&r()},W.prototype.end=function(e,t,r){"function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null);var n=this._currentRequest;this.write(e||"",t,(function(){n.end(null,null,r)}))},W.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},W.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},["abort","flushHeaders","getHeader","setNoDelay","setSocketKeepAlive","setTimeout"].forEach((function(e){W.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(W.prototype,e,{get:function(){return this._currentRequest[e]}})})),W.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var n=e.substr(0,e.length-1);this._options.agent=this._options.agents[n]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var o in this._currentUrl=r.format(this._options),s._redirectable=this,Z)o&&s.on(o,Z[o]);if(this._isRedirect){var i=0,a=this._requestBodyBuffers;!function e(){if(i<a.length){var t=a[i++];s.write(t.data,t.encoding,e)}else s.end()}()}}else this.emit("error",new Error("Unsupported protocol "+e))},W.prototype._processResponse=function(e){this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:e.statusCode});var t=e.headers.location;if(t&&!1!==this._options.followRedirects&&e.statusCode>=300&&e.statusCode<400){if(++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Error("Max redirects exceeded."));var n,s=this._options.headers;if(307!==e.statusCode&&!(this._options.method in Y))for(n in this._options.method="GET",this._requestBodyBuffers=[],s)/^content-/i.test(n)&&delete s[n];if(!this._isRedirect)for(n in s)/^host$/i.test(n)&&delete s[n];var o=r.resolve(this._currentUrl,t);J("redirecting to",o),Object.assign(this._options,r.parse(o)),this._isRedirect=!0,this._performRequest(),e.destroy()}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var ee=Q({http:e,https:t}),te=Q;ee.wrap=te;var re,ne="Promise based HTTP client for the browser and node.js",se={test:"grunt test && bundlesize",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},oe={type:"git",url:"https://github.com/axios/axios.git"},ie=["xhr","http","ajax","promise","node"],ae={url:"https://github.com/axios/axios/issues"},ce="https://github.com/axios/axios",ue={bundlesize:"^0.17.0",coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^5.2.0",sinon:"^4.5.0",typescript:"^2.8.1","url-search-params":"^0.10.0",webpack:"^1.13.1","webpack-dev-server":"^1.14.1"},fe={"./lib/adapters/http.js":"./lib/adapters/xhr.js"},pe={"follow-redirects":"1.5.10"},he=[{path:"./dist/axios.min.js",threshold:"5kB"}],de={name:"axios",version:"0.19.1",description:ne,main:"index.js",scripts:se,repository:oe,keywords:ie,author:"Matt Zabriskie",license:"MIT",bugs:ae,homepage:ce,devDependencies:ue,browser:fe,typings:"./index.d.ts",dependencies:pe,bundlesize:he},le=(re=Object.freeze({__proto__:null,name:"axios",version:"0.19.1",description:ne,main:"index.js",scripts:se,repository:oe,keywords:ie,author:"Matt Zabriskie",license:"MIT",bugs:ae,homepage:ce,devDependencies:ue,browser:fe,typings:"./index.d.ts",dependencies:pe,bundlesize:he,default:de}))&&re.default||re,me=ee.http,ge=ee.https,Ce=/https:?/,ve=function(n){return new Promise((function(s,o){var i=function(e){s(e)},a=function(e){o(e)},u=n.data,f=n.headers;if(f["User-Agent"]||f["user-agent"]||(f["User-Agent"]="axios/"+le.version),u&&!g.isStream(u)){if(Buffer.isBuffer(u));else if(g.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else{if(!g.isString(u))return a(E("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",n));u=Buffer.from(u,"utf-8")}f["Content-Length"]=u.length}var p=void 0;n.auth&&(p=(n.auth.username||"")+":"+(n.auth.password||""));var h=_(n.baseURL,n.url),d=r.parse(h),l=d.protocol||"http:";if(!p&&d.auth){var m=d.auth.split(":");p=(m[0]||"")+":"+(m[1]||"")}p&&delete f.Authorization;var C=Ce.test(l),y=C?n.httpsAgent:n.httpAgent,b={path:v(d.path,n.params,n.paramsSerializer).replace(/^\?/,""),method:n.method.toUpperCase(),headers:f,agent:y,agents:{http:n.httpAgent,https:n.httpsAgent},auth:p};n.socketPath?b.socketPath=n.socketPath:(b.hostname=d.hostname,b.port=d.port);var x,w=n.proxy;if(!w&&!1!==w){var R=l.slice(0,-1)+"_proxy",T=process.env[R]||process.env[R.toUpperCase()];if(T){var A=r.parse(T),S=process.env.no_proxy||process.env.NO_PROXY,j=!0;if(S)j=!S.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&d.hostname.substr(d.hostname.length-e.length)===e||d.hostname===e))}));if(j&&(w={host:A.hostname,port:A.port},A.auth)){var k=A.auth.split(":");w.auth={username:k[0],password:k[1]}}}}if(w&&(b.hostname=w.host,b.host=w.host,b.headers.host=d.hostname+(d.port?":"+d.port:""),b.port=w.port,b.path=l+"//"+d.hostname+(d.port?":"+d.port:"")+b.path,w.auth)){var U=Buffer.from(w.auth.username+":"+w.auth.password,"utf8").toString("base64");b.headers["Proxy-Authorization"]="Basic "+U}var L=C&&(!w||Ce.test(w.protocol));n.transport?x=n.transport:0===n.maxRedirects?x=L?t:e:(n.maxRedirects&&(b.maxRedirects=n.maxRedirects),x=L?ge:me),n.maxContentLength&&n.maxContentLength>-1&&(b.maxBodyLength=n.maxContentLength);var B=x.request(b,(function(e){if(!B.aborted){var t=e;switch(e.headers["content-encoding"]){case"gzip":case"compress":case"deflate":t=204===e.statusCode?t:t.pipe(c.createUnzip()),delete e.headers["content-encoding"]}var r=e.req||B,s={status:e.statusCode,statusText:e.statusMessage,headers:e.headers,config:n,request:r};if("stream"===n.responseType)s.data=t,F(i,a,s);else{var o=[];t.on("data",(function(e){o.push(e),n.maxContentLength>-1&&Buffer.concat(o).length>n.maxContentLength&&(t.destroy(),a(E("maxContentLength size of "+n.maxContentLength+" exceeded",n,null,r)))})),t.on("error",(function(e){B.aborted||a(O(e,n,null,r))})),t.on("end",(function(){var e=Buffer.concat(o);"arraybuffer"!==n.responseType&&(e=e.toString(n.responseEncoding)),s.data=e,F(i,a,s)}))}}}));B.on("error",(function(e){B.aborted||a(O(e,n,null,B))})),n.timeout&&B.setTimeout(n.timeout,(function(){B.abort(),a(E("timeout of "+n.timeout+"ms exceeded",n,"ECONNABORTED",B))})),n.cancelToken&&n.cancelToken.promise.then((function(e){B.aborted||(B.abort(),a(e))})),g.isStream(u)?u.on("error",(function(e){a(O(e,n,null,B))})).pipe(B):B.end(u)}))},ye={"Content-Type":"application/x-www-form-urlencoded"};function be(e,t){!g.isUndefined(e)&&g.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var xe,we={adapter:("undefined"!=typeof XMLHttpRequest?xe=j:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(xe=ve),xe),transformRequest:[function(e,t){return R(t,"Accept"),R(t,"Content-Type"),g.isFormData(e)||g.isArrayBuffer(e)||g.isBuffer(e)||g.isStream(e)||g.isFile(e)||g.isBlob(e)?e:g.isArrayBufferView(e)?e.buffer:g.isURLSearchParams(e)?(be(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):g.isObject(e)?(be(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};we.headers={common:{Accept:"application/json, text/plain, */*"}},g.forEach(["delete","get","head"],(function(e){we.headers[e]={}})),g.forEach(["post","put","patch"],(function(e){we.headers[e]=g.merge(ye)}));var Re=we;function Oe(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ee=function(e){return Oe(e),e.headers=e.headers||{},e.data=x(e.data,e.headers,e.transformRequest),e.headers=g.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),g.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Re.adapter)(e).then((function(t){return Oe(e),t.data=x(t.data,t.headers,e.transformResponse),t}),(function(t){return w(t)||(Oe(e),t&&t.response&&(t.response.data=x(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Fe=function(e,t){t=t||{};var r={},n=["url","method","params","data"],s=["headers","auth","proxy"],o=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];g.forEach(n,(function(e){void 0!==t[e]&&(r[e]=t[e])})),g.forEach(s,(function(n){g.isObject(t[n])?r[n]=g.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:g.isObject(e[n])?r[n]=g.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),g.forEach(o,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])}));var i=n.concat(s).concat(o),a=Object.keys(t).filter((function(e){return-1===i.indexOf(e)}));return g.forEach(a,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r};function _e(e){this.defaults=e,this.interceptors={request:new b,response:new b}}_e.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Fe(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ee,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},_e.prototype.getUri=function(e){return e=Fe(this.defaults,e),v(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},g.forEach(["delete","get","head","options"],(function(e){_e.prototype[e]=function(t,r){return this.request(g.merge(r||{},{method:e,url:t}))}})),g.forEach(["post","put","patch"],(function(e){_e.prototype[e]=function(t,r,n){return this.request(g.merge(n||{},{method:e,url:t,data:r}))}}));var Te=_e;function Ae(e){this.message=e}Ae.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ae.prototype.__CANCEL__=!0;var Se=Ae;function je(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new Se(e),t(r.reason))}))}je.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},je.source=function(){var e;return{token:new je((function(t){e=t})),cancel:e}};var ke=je;function Ue(e){var t=new Te(e),r=u(Te.prototype.request,t);return g.extend(r,Te.prototype,t),g.extend(r,t),r}var Le=Ue(Re);Le.Axios=Te,Le.create=function(e){return Ue(Fe(Le.defaults,e))},Le.Cancel=Se,Le.CancelToken=ke,Le.isCancel=w,Le.all=function(e){return Promise.all(e)},Le.spread=function(e){return function(t){return e.apply(null,t)}};var Be=Le,Ne=Le;Be.default=Ne;var qe=Be;class Me{constructor(e,t){this.instance=e,this.indexUid=t,this.cancelTokenSource=qe.CancelToken.source()}getUpdate(e){const t=`/indexes/${this.indexUid}/updates/${e}`;return this.instance.get(t)}getAllUpdates(){const e=`/indexes/${this.indexUid}/updates`;return this.instance.get(e)}search(e){const t=`/indexes/${this.indexUid}/search`,r={q:e.q};return e.offset&&(r.offset=e.offset),e.limit&&(r.limit=e.limit),e.attributesToRetrieve&&(r.attributesToRetrieve=e.attributesToRetrieve.join()),e.attributesToSearchIn&&(r.attributesToSearchIn=e.attributesToSearchIn.join()),e.attributesToCrop&&(r.attributesToCrop=e.attributesToCrop.join()),e.cropLength&&(r.cropLength=e.cropLength),e.attributesToHighlight&&(r.attributesToHighlight=e.attributesToHighlight.join()),e.filters&&(r.filters=e.filters),e.timeoutMs&&(r.timeoutMs=e.timeoutMs),e.matches&&(r.matches=e.matches),this.instance.get(t,{params:r,cancelToken:this.cancelTokenSource.token})}getIndex(){const e=`/indexes/${this.indexUid}`;return this.instance.get(e)}updateIndex(e){const t=`/indexes/${this.indexUid}`;return this.instance.put(t,e)}deleteIndex(){const e=`/indexes/${this.indexUid}`;return this.instance.delete(e)}getSchema(e){const t=`/indexes/${this.indexUid}/schema`;return e?this.instance.get(t,{params:{raw:!0}}):this.instance.get(t)}updateSchema(e){const t=`/indexes/${this.indexUid}/schema`;return e.identifier?this.instance.put(t,e,{params:{raw:!0}}):this.instance.put(t,e)}getStats(){const e=`/stats/${this.indexUid}`;return this.instance.get(e)}getDocuments(e){const t=`/indexes/${this.indexUid}/documents`;let r;return e&&Array.isArray(e.attributesToRetrieve)&&(r=e.attributesToRetrieve.join(",")),this.instance.get(t,{params:{...e,...r?{attributesToRetrieve:r}:{}}})}getDocument(e){const t=`/indexes/${this.indexUid}/documents/${e}`;return this.instance.get(t)}addDocuments(e){const t=`/indexes/${this.indexUid}/documents`;return this.instance.post(t,e)}deleteDocument(e){const t=`/indexes/${this.indexUid}/documents/${e}`;return this.instance.delete(t)}deleteDocuments(e){const t=`/indexes/${this.indexUid}/documents/delete`;return this.instance.post(t,e)}deleteAllDocuments(){const e=`/indexes/${this.indexUid}/documents`;return this.instance.delete(e)}getSettings(){return this.instance.get("/settings")}updateSettings(e){return this.instance.post("/settings",e)}listSynonyms(){return this.instance.get("/synonym")}createSynonym(e,t){return this.instance.post("/synonym",{input:e,synonyms:t})}}export default class{constructor(e){this.baseURL=e.host,this.apiKey=e.apiKey,e.apiKey?this.instance=qe.create({baseURL:this.baseURL,timeout:1e3,headers:{"X-Meili-API-Key":e.apiKey}}):this.instance=qe.create({baseURL:this.baseURL,timeout:1e3}),this.instance.interceptors.response.use(e=>e.data)}Index(e){return new Me(this.instance,e)}listIndexes(){return this.instance.get("/indexes")}createIndex(e){return this.instance.post("/indexes",e)}isHealthy(){return this.instance.get("/health").then(e=>!0)}setHealthy(){return this.instance.put("/health",{health:!0})}setUnhealthy(){return this.instance.put("/health",{health:!1})}changeHealthTo(e){return this.instance.put("/health",{health:e})}databaseStats(){return this.instance.get("/stats")}version(){return this.instance.get("/version")}systemInformation(){return this.instance.get("/sys-info")}systemInformationPretty(){return this.instance.get("/sys-info/pretty")}} | ||
import e from"http";import t from"https";import r from"url";import n from"assert";import s from"stream";import o from"tty";import i from"util";import a from"os";import c from"zlib";var u=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},f=Object.prototype.toString;function p(e){return"[object Array]"===f.call(e)}function h(e){return void 0===e}function d(e){return null!==e&&"object"==typeof e}function l(e){return"[object Function]"===f.call(e)}function m(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),p(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}var g={isArray:p,isArrayBuffer:function(e){return"[object ArrayBuffer]"===f.call(e)},isBuffer:function(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:d,isUndefined:h,isDate:function(e){return"[object Date]"===f.call(e)},isFile:function(e){return"[object File]"===f.call(e)},isBlob:function(e){return"[object Blob]"===f.call(e)},isFunction:l,isStream:function(e){return d(e)&&l(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:m,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,s=arguments.length;n<s;n++)m(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,s=arguments.length;n<s;n++)m(arguments[n],r);return t},extend:function(e,t,r){return m(t,(function(t,n){e[n]=r&&"function"==typeof t?u(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function y(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var C=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(g.isURLSearchParams(t))n=t.toString();else{var s=[];g.forEach(t,(function(e,t){null!=e&&(g.isArray(e)?t+="[]":e=[e],g.forEach(e,(function(e){g.isDate(e)?e=e.toISOString():g.isObject(e)&&(e=JSON.stringify(e)),s.push(y(t)+"="+y(e))})))})),n=s.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function v(){this.handlers=[]}v.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},v.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},v.prototype.forEach=function(e){g.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var b=v,x=function(e,t,r){return g.forEach(r,(function(r){e=r(e,t)})),e},w=function(e){return!(!e||!e.__CANCEL__)},R=function(e,t){g.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},O=function(e,t,r,n,s){return e.config=t,r&&(e.code=r),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},E=function(e,t,r,n,s){var o=new Error(e);return O(o,t,r,n,s)},F=function(e,t,r){var n=r.config.validateStatus;!n||n(r.status)?e(r):t(E("Request failed with status code "+r.status,r.config,null,r.request,r))},_=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},T=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],A=g.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=g.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},S=g.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var i=[];i.push(e+"="+encodeURIComponent(t)),g.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),g.isString(n)&&i.push("path="+n),g.isString(s)&&i.push("domain="+s),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},j=function(e){return new Promise((function(t,r){var n=e.data,s=e.headers;g.isFormData(n)&&delete s["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",a=e.auth.password||"";s.Authorization="Basic "+btoa(i+":"+a)}var c=_(e.baseURL,e.url);if(o.open(e.method.toUpperCase(),C(c,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var n,s,i,a,c,u="getAllResponseHeaders"in o?(n=o.getAllResponseHeaders(),c={},n?(g.forEach(n.split("\n"),(function(e){if(a=e.indexOf(":"),s=g.trim(e.substr(0,a)).toLowerCase(),i=g.trim(e.substr(a+1)),s){if(c[s]&&T.indexOf(s)>=0)return;c[s]="set-cookie"===s?(c[s]?c[s]:[]).concat([i]):c[s]?c[s]+", "+i:i}})),c):c):null,f={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:u,config:e,request:o};F(t,r,f),o=null}},o.onabort=function(){o&&(r(E("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(E("Network Error",e,null,o)),o=null},o.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(E(t,e,"ECONNABORTED",o)),o=null},g.isStandardBrowserEnv()){var u=S,f=(e.withCredentials||A(c))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;f&&(s[e.xsrfHeaderName]=f)}if("setRequestHeader"in o&&g.forEach(s,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete s[t]:o.setRequestHeader(t,e)})),g.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),r(e),o=null)})),void 0===n&&(n=null),o.send(n)}))};function k(e,t){return e(t={exports:{}},t.exports),t.exports}var U=1e3,B=6e4,L=36e5,N=24*L,q=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"days":case"day":case"d":return r*N;case"hours":case"hour":case"hrs":case"hr":case"h":return r*L;case"minutes":case"minute":case"mins":case"min":case"m":return r*B;case"seconds":case"second":case"secs":case"sec":case"s":return r*U;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return I(e,N,"day")||I(e,L,"hour")||I(e,B,"minute")||I(e,U,"second")||e+" ms"}(e):function(e){if(e>=N)return Math.round(e/N)+"d";if(e>=L)return Math.round(e/L)+"h";if(e>=B)return Math.round(e/B)+"m";if(e>=U)return Math.round(e/U)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function I(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var M=k((function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,o=n-(r||n);e.diff=o,e.prev=r,e.curr=n,r=n;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var c=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;c++;var s=t.formatters[n];if("function"==typeof s){var o=i[c];r=s.call(e,o),i.splice(c,1),c--}return r})),t.formatArgs.call(e,i);var u=s.log||t.log||console.log.bind(console);u.apply(e,i)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var o=t.instances[r];o.enabled=t.enabled(o.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=q,t.instances=[],t.names=[],t.skips=[],t.formatters={}})),P=(M.coerce,M.disable,M.enable,M.enabled,M.humanize,M.instances,M.names,M.skips,M.formatters,k((function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=M).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(o=s))})),e.splice(o,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}))),D=(P.log,P.formatArgs,P.save,P.load,P.useColors,P.storage,P.colors,(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return-1!==n&&(-1===s||n<s)});const{env:$}=process;let z;function H(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function G(e,t){if(0===z)return 0;if(D("color=16m")||D("color=full")||D("color=truecolor"))return 3;if(D("color=256"))return 2;if(e&&!t&&void 0===z)return 0;const r=z||0;if("dumb"===$.TERM)return r;if("win32"===process.platform){const e=a.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in $)||"codeship"===$.CI_NAME?1:r;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in $)return 1;if("truecolor"===$.COLORTERM)return 3;if("TERM_PROGRAM"in $){const e=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)?1:"COLORTERM"in $?1:r}D("no-color")||D("no-colors")||D("color=false")||D("color=never")?z=0:(D("color")||D("colors")||D("color=true")||D("color=always"))&&(z=1),"FORCE_COLOR"in $&&(z="true"===$.FORCE_COLOR?1:"false"===$.FORCE_COLOR?0:0===$.FORCE_COLOR.length?1:Math.min(parseInt($.FORCE_COLOR,10),3));var V={supportsColor:function(e){return H(G(e,e&&e.isTTY))},stdout:H(G(!0,o.isatty(1))),stderr:H(G(!0,o.isatty(2)))},K=k((function(e,t){(t=e.exports=M).init=function(e){e.inspectOpts={};for(var r=Object.keys(t.inspectOpts),n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(){return process.stderr.write(i.format.apply(i,arguments)+"\n")},t.formatArgs=function(e){var r=this.namespace;if(this.useColors){var n=this.color,s="[3"+(n<8?n:"8;5;"+n),o=" "+s+";1m"+r+" [0m";e[0]=o+e[0].split("\n").join("\n"+o),e.push(s+"m+"+t.humanize(this.diff)+"[0m")}else e[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+e[0]},t.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},t.load=r,t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):o.isatty(process.stderr.fd)},t.colors=[6,2,3,4,5,1];try{V&&V.level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}function r(){return process.env.DEBUG}t.inspectOpts=Object.keys(process.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),t.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},t.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)},t.enable(r())})),J=(K.init,K.log,K.formatArgs,K.save,K.load,K.useColors,K.colors,K.inspectOpts,k((function(e){"undefined"==typeof process||"renderer"===process.type?e.exports=P:e.exports=K}))),X=s.Writable,Y=J("follow-redirects"),Z={GET:!0,HEAD:!0,OPTIONS:!0,TRACE:!0},W=Object.create(null);function Q(e,t){X.call(this),e.headers=e.headers||{},this._options=e,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e.host&&(e.hostname||(e.hostname=e.host),delete e.host),t&&this.on("response",t);var r=this;if(this._onNativeResponse=function(e){r._processResponse(e)},!e.pathname&&e.path){var n=e.path.indexOf("?");n<0?e.pathname=e.path:(e.pathname=e.path.substring(0,n),e.search=e.path.substring(n))}this._performRequest()}function ee(e){var t={maxRedirects:21,maxBodyLength:10485760},s={};return Object.keys(e).forEach((function(o){var i=o+":",a=s[i]=e[o],c=t[o]=Object.create(a);c.request=function(e,o){return"string"==typeof e?(e=r.parse(e)).maxRedirects=t.maxRedirects:e=Object.assign({protocol:i,maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e),e.nativeProtocols=s,n.equal(e.protocol,i,"protocol mismatch"),Y("options",e),new Q(e,o)},c.get=function(e,t){var r=c.request(e,t);return r.end(),r}})),t}["abort","aborted","error","socket","timeout"].forEach((function(e){W[e]=function(t){this._redirectable.emit(e,t)}})),Q.prototype=Object.create(X.prototype),Q.prototype.write=function(e,t,r){if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new Error("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Error("Request body larger than maxBodyLength limit")),this.abort()):r&&r()},Q.prototype.end=function(e,t,r){"function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null);var n=this._currentRequest;this.write(e||"",t,(function(){n.end(null,null,r)}))},Q.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Q.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},["abort","flushHeaders","getHeader","setNoDelay","setSocketKeepAlive","setTimeout"].forEach((function(e){Q.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Q.prototype,e,{get:function(){return this._currentRequest[e]}})})),Q.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var n=e.substr(0,e.length-1);this._options.agent=this._options.agents[n]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var o in this._currentUrl=r.format(this._options),s._redirectable=this,W)o&&s.on(o,W[o]);if(this._isRedirect){var i=0,a=this._requestBodyBuffers;!function e(){if(i<a.length){var t=a[i++];s.write(t.data,t.encoding,e)}else s.end()}()}}else this.emit("error",new Error("Unsupported protocol "+e))},Q.prototype._processResponse=function(e){this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:e.statusCode});var t=e.headers.location;if(t&&!1!==this._options.followRedirects&&e.statusCode>=300&&e.statusCode<400){if(++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Error("Max redirects exceeded."));var n,s=this._options.headers;if(307!==e.statusCode&&!(this._options.method in Z))for(n in this._options.method="GET",this._requestBodyBuffers=[],s)/^content-/i.test(n)&&delete s[n];if(!this._isRedirect)for(n in s)/^host$/i.test(n)&&delete s[n];var o=r.resolve(this._currentUrl,t);Y("redirecting to",o),Object.assign(this._options,r.parse(o)),this._isRedirect=!0,this._performRequest(),e.destroy()}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var te=ee({http:e,https:t}),re=ee;te.wrap=re;var ne,se="Promise based HTTP client for the browser and node.js",oe={test:"grunt test && bundlesize",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},ie={type:"git",url:"https://github.com/axios/axios.git"},ae=["xhr","http","ajax","promise","node"],ce={url:"https://github.com/axios/axios/issues"},ue="https://github.com/axios/axios",fe={bundlesize:"^0.17.0",coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^5.2.0",sinon:"^4.5.0",typescript:"^2.8.1","url-search-params":"^0.10.0",webpack:"^1.13.1","webpack-dev-server":"^1.14.1"},pe={"./lib/adapters/http.js":"./lib/adapters/xhr.js"},he={"follow-redirects":"1.5.10"},de=[{path:"./dist/axios.min.js",threshold:"5kB"}],le={name:"axios",version:"0.19.2",description:se,main:"index.js",scripts:oe,repository:ie,keywords:ae,author:"Matt Zabriskie",license:"MIT",bugs:ce,homepage:ue,devDependencies:fe,browser:pe,typings:"./index.d.ts",dependencies:he,bundlesize:de},me=(ne=Object.freeze({__proto__:null,name:"axios",version:"0.19.2",description:se,main:"index.js",scripts:oe,repository:ie,keywords:ae,author:"Matt Zabriskie",license:"MIT",bugs:ce,homepage:ue,devDependencies:fe,browser:pe,typings:"./index.d.ts",dependencies:he,bundlesize:de,default:le}))&&ne.default||ne,ge=te.http,ye=te.https,Ce=/https:?/,ve=function(n){return new Promise((function(s,o){var i=function(e){s(e)},a=function(e){o(e)},u=n.data,f=n.headers;if(f["User-Agent"]||f["user-agent"]||(f["User-Agent"]="axios/"+me.version),u&&!g.isStream(u)){if(Buffer.isBuffer(u));else if(g.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else{if(!g.isString(u))return a(E("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",n));u=Buffer.from(u,"utf-8")}f["Content-Length"]=u.length}var p=void 0;n.auth&&(p=(n.auth.username||"")+":"+(n.auth.password||""));var h=_(n.baseURL,n.url),d=r.parse(h),l=d.protocol||"http:";if(!p&&d.auth){var m=d.auth.split(":");p=(m[0]||"")+":"+(m[1]||"")}p&&delete f.Authorization;var y=Ce.test(l),v=y?n.httpsAgent:n.httpAgent,b={path:C(d.path,n.params,n.paramsSerializer).replace(/^\?/,""),method:n.method.toUpperCase(),headers:f,agent:v,agents:{http:n.httpAgent,https:n.httpsAgent},auth:p};n.socketPath?b.socketPath=n.socketPath:(b.hostname=d.hostname,b.port=d.port);var x,w=n.proxy;if(!w&&!1!==w){var R=l.slice(0,-1)+"_proxy",T=process.env[R]||process.env[R.toUpperCase()];if(T){var A=r.parse(T),S=process.env.no_proxy||process.env.NO_PROXY,j=!0;if(S)j=!S.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&d.hostname.substr(d.hostname.length-e.length)===e||d.hostname===e))}));if(j&&(w={host:A.hostname,port:A.port},A.auth)){var k=A.auth.split(":");w.auth={username:k[0],password:k[1]}}}}if(w&&(b.hostname=w.host,b.host=w.host,b.headers.host=d.hostname+(d.port?":"+d.port:""),b.port=w.port,b.path=l+"//"+d.hostname+(d.port?":"+d.port:"")+b.path,w.auth)){var U=Buffer.from(w.auth.username+":"+w.auth.password,"utf8").toString("base64");b.headers["Proxy-Authorization"]="Basic "+U}var B=y&&(!w||Ce.test(w.protocol));n.transport?x=n.transport:0===n.maxRedirects?x=B?t:e:(n.maxRedirects&&(b.maxRedirects=n.maxRedirects),x=B?ye:ge),n.maxContentLength&&n.maxContentLength>-1&&(b.maxBodyLength=n.maxContentLength);var L=x.request(b,(function(e){if(!L.aborted){var t=e;switch(e.headers["content-encoding"]){case"gzip":case"compress":case"deflate":t=204===e.statusCode?t:t.pipe(c.createUnzip()),delete e.headers["content-encoding"]}var r=e.req||L,s={status:e.statusCode,statusText:e.statusMessage,headers:e.headers,config:n,request:r};if("stream"===n.responseType)s.data=t,F(i,a,s);else{var o=[];t.on("data",(function(e){o.push(e),n.maxContentLength>-1&&Buffer.concat(o).length>n.maxContentLength&&(t.destroy(),a(E("maxContentLength size of "+n.maxContentLength+" exceeded",n,null,r)))})),t.on("error",(function(e){L.aborted||a(O(e,n,null,r))})),t.on("end",(function(){var e=Buffer.concat(o);"arraybuffer"!==n.responseType&&(e=e.toString(n.responseEncoding)),s.data=e,F(i,a,s)}))}}}));L.on("error",(function(e){L.aborted||a(O(e,n,null,L))})),n.timeout&&L.setTimeout(n.timeout,(function(){L.abort(),a(E("timeout of "+n.timeout+"ms exceeded",n,"ECONNABORTED",L))})),n.cancelToken&&n.cancelToken.promise.then((function(e){L.aborted||(L.abort(),a(e))})),g.isStream(u)?u.on("error",(function(e){a(O(e,n,null,L))})).pipe(L):L.end(u)}))},be={"Content-Type":"application/x-www-form-urlencoded"};function xe(e,t){!g.isUndefined(e)&&g.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var we,Re={adapter:("undefined"!=typeof XMLHttpRequest?we=j:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(we=ve),we),transformRequest:[function(e,t){return R(t,"Accept"),R(t,"Content-Type"),g.isFormData(e)||g.isArrayBuffer(e)||g.isBuffer(e)||g.isStream(e)||g.isFile(e)||g.isBlob(e)?e:g.isArrayBufferView(e)?e.buffer:g.isURLSearchParams(e)?(xe(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):g.isObject(e)?(xe(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};Re.headers={common:{Accept:"application/json, text/plain, */*"}},g.forEach(["delete","get","head"],(function(e){Re.headers[e]={}})),g.forEach(["post","put","patch"],(function(e){Re.headers[e]=g.merge(be)}));var Oe=Re;function Ee(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Fe=function(e){return Ee(e),e.headers=e.headers||{},e.data=x(e.data,e.headers,e.transformRequest),e.headers=g.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),g.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Oe.adapter)(e).then((function(t){return Ee(e),t.data=x(t.data,t.headers,e.transformResponse),t}),(function(t){return w(t)||(Ee(e),t&&t.response&&(t.response.data=x(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},_e=function(e,t){t=t||{};var r={},n=["url","method","params","data"],s=["headers","auth","proxy"],o=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];g.forEach(n,(function(e){void 0!==t[e]&&(r[e]=t[e])})),g.forEach(s,(function(n){g.isObject(t[n])?r[n]=g.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:g.isObject(e[n])?r[n]=g.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),g.forEach(o,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])}));var i=n.concat(s).concat(o),a=Object.keys(t).filter((function(e){return-1===i.indexOf(e)}));return g.forEach(a,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r};function Te(e){this.defaults=e,this.interceptors={request:new b,response:new b}}Te.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=_e(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Fe,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},Te.prototype.getUri=function(e){return e=_e(this.defaults,e),C(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},g.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,r){return this.request(g.merge(r||{},{method:e,url:t}))}})),g.forEach(["post","put","patch"],(function(e){Te.prototype[e]=function(t,r,n){return this.request(g.merge(n||{},{method:e,url:t,data:r}))}}));var Ae=Te;function Se(e){this.message=e}Se.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Se.prototype.__CANCEL__=!0;var je=Se;function ke(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new je(e),t(r.reason))}))}ke.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ke.source=function(){var e;return{token:new ke((function(t){e=t})),cancel:e}};var Ue=ke;function Be(e){var t=new Ae(e),r=u(Ae.prototype.request,t);return g.extend(r,Ae.prototype,t),g.extend(r,t),r}var Le=Be(Oe);Le.Axios=Ae,Le.create=function(e){return Be(_e(Le.defaults,e))},Le.Cancel=je,Le.CancelToken=Ue,Le.isCancel=w,Le.all=function(e){return Promise.all(e)},Le.spread=function(e){return function(t){return e.apply(null,t)}};var Ne=Le,qe=Le;Ne.default=qe;var Ie=Ne;class Me{constructor(e,t){this.instance=e,this.indexUid=t,this.cancelTokenSource=Ie.CancelToken.source()}getUpdate(e){const t=`/indexes/${this.indexUid}/updates/${e}`;return this.instance.get(t)}getAllUpdates(){const e=`/indexes/${this.indexUid}/updates`;return this.instance.get(e)}search(e,t){const r=`/indexes/${this.indexUid}/search`,n={q:e};return t&&(t.offset&&(n.offset=t.offset),t.limit&&(n.limit=t.limit),t.attributesToRetrieve&&(n.attributesToRetrieve=t.attributesToRetrieve.join()),t.attributesToSearchIn&&(n.attributesToSearchIn=t.attributesToSearchIn.join()),t.attributesToCrop&&(n.attributesToCrop=t.attributesToCrop.join()),t.cropLength&&(n.cropLength=t.cropLength),t.attributesToHighlight&&(n.attributesToHighlight=t.attributesToHighlight.join()),t.filters&&(n.filters=t.filters),t.timeoutMs&&(n.timeoutMs=t.timeoutMs),t.matches&&(n.matches=t.matches)),this.instance.get(r,{params:n,cancelToken:this.cancelTokenSource.token})}getIndex(){const e=`/indexes/${this.indexUid}`;return this.instance.get(e)}updateIndex(e){const t=`/indexes/${this.indexUid}`;return this.instance.put(t,e)}deleteIndex(){const e=`/indexes/${this.indexUid}`;return this.instance.delete(e)}getSchema(e){const t=`/indexes/${this.indexUid}/schema`;return e?this.instance.get(t,{params:{raw:!0}}):this.instance.get(t)}updateSchema(e){const t=`/indexes/${this.indexUid}/schema`;return e.identifier?this.instance.put(t,e,{params:{raw:!0}}):this.instance.put(t,e)}getStats(){const e=`/stats/${this.indexUid}`;return this.instance.get(e)}getDocuments(e){const t=`/indexes/${this.indexUid}/documents`;let r;return e&&Array.isArray(e.attributesToRetrieve)&&(r=e.attributesToRetrieve.join(",")),this.instance.get(t,{params:{...e,...r?{attributesToRetrieve:r}:{}}})}getDocument(e){const t=`/indexes/${this.indexUid}/documents/${e}`;return this.instance.get(t)}addDocuments(e){const t=`/indexes/${this.indexUid}/documents`;return this.instance.post(t,e)}deleteDocument(e){const t=`/indexes/${this.indexUid}/documents/${e}`;return this.instance.delete(t)}deleteDocuments(e){const t=`/indexes/${this.indexUid}/documents/delete`;return this.instance.post(t,e)}deleteAllDocuments(){const e=`/indexes/${this.indexUid}/documents`;return this.instance.delete(e)}getSettings(){return this.instance.get("/settings")}updateSettings(e){return this.instance.post("/settings",e)}listSynonyms(){return this.instance.get("/synonym")}createSynonym(e,t){return this.instance.post("/synonym",{input:e,synonyms:t})}}export default class{constructor(e){this.baseURL=e.host,this.apiKey=e.apiKey,e.apiKey?this.instance=Ie.create({baseURL:this.baseURL,headers:{"X-Meili-API-Key":e.apiKey}}):this.instance=Ie.create({baseURL:this.baseURL}),this.instance.interceptors.response.use(e=>e.data)}Index(e){return new Me(this.instance,e)}listIndexes(){return this.instance.get("/indexes")}createIndex(e){return this.instance.post("/indexes",e)}isHealthy(){return this.instance.get("/health").then(e=>!0)}setHealthy(){return this.instance.put("/health",{health:!0})}setUnhealthy(){return this.instance.put("/health",{health:!1})}changeHealthTo(e){return this.instance.put("/health",{health:e})}databaseStats(){return this.instance.get("/stats")}version(){return this.instance.get("/version")}systemInformation(){return this.instance.get("/sys-info")}systemInformationPretty(){return this.instance.get("/sys-info/pretty")}} | ||
//# sourceMappingURL=index.esm.min.js.map |
@@ -17,3 +17,2 @@ /* | ||
baseURL: this.baseURL, | ||
timeout: 1000, | ||
headers: { | ||
@@ -27,3 +26,2 @@ 'X-Meili-API-Key': config.apiKey, | ||
baseURL: this.baseURL, | ||
timeout: 1000, | ||
}); | ||
@@ -30,0 +28,0 @@ } |
@@ -44,37 +44,39 @@ /* | ||
*/ | ||
search(options) { | ||
search(query, options) { | ||
const url = `/indexes/${this.indexUid}/search`; | ||
const params = { | ||
q: options.q, | ||
q: query, | ||
}; | ||
if (options.offset) { | ||
params.offset = options.offset; | ||
if (options) { | ||
if (options.offset) { | ||
params.offset = options.offset; | ||
} | ||
if (options.limit) { | ||
params.limit = options.limit; | ||
} | ||
if (options.attributesToRetrieve) { | ||
params.attributesToRetrieve = options.attributesToRetrieve.join(); | ||
} | ||
if (options.attributesToSearchIn) { | ||
params.attributesToSearchIn = options.attributesToSearchIn.join(); | ||
} | ||
if (options.attributesToCrop) { | ||
params.attributesToCrop = options.attributesToCrop.join(); | ||
} | ||
if (options.cropLength) { | ||
params.cropLength = options.cropLength; | ||
} | ||
if (options.attributesToHighlight) { | ||
params.attributesToHighlight = options.attributesToHighlight.join(); | ||
} | ||
if (options.filters) { | ||
params.filters = options.filters; | ||
} | ||
if (options.timeoutMs) { | ||
params.timeoutMs = options.timeoutMs; | ||
} | ||
if (options.matches) { | ||
params.matches = options.matches; | ||
} | ||
} | ||
if (options.limit) { | ||
params.limit = options.limit; | ||
} | ||
if (options.attributesToRetrieve) { | ||
params.attributesToRetrieve = options.attributesToRetrieve.join(); | ||
} | ||
if (options.attributesToSearchIn) { | ||
params.attributesToSearchIn = options.attributesToSearchIn.join(); | ||
} | ||
if (options.attributesToCrop) { | ||
params.attributesToCrop = options.attributesToCrop.join(); | ||
} | ||
if (options.cropLength) { | ||
params.cropLength = options.cropLength; | ||
} | ||
if (options.attributesToHighlight) { | ||
params.attributesToHighlight = options.attributesToHighlight.join(); | ||
} | ||
if (options.filters) { | ||
params.filters = options.filters; | ||
} | ||
if (options.timeoutMs) { | ||
params.timeoutMs = options.timeoutMs; | ||
} | ||
if (options.matches) { | ||
params.matches = options.matches; | ||
} | ||
return this.instance.get(url, { | ||
@@ -81,0 +83,0 @@ params, |
@@ -17,3 +17,2 @@ /* | ||
baseURL: this.baseURL, | ||
timeout: 1000, | ||
headers: { | ||
@@ -27,3 +26,2 @@ 'X-Meili-API-Key': config.apiKey, | ||
baseURL: this.baseURL, | ||
timeout: 1000, | ||
}); | ||
@@ -30,0 +28,0 @@ } |
@@ -45,37 +45,39 @@ /* | ||
*/ | ||
Indexes.prototype.search = function (options) { | ||
Indexes.prototype.search = function (query, options) { | ||
var url = "/indexes/" + this.indexUid + "/search"; | ||
var params = { | ||
q: options.q, | ||
q: query, | ||
}; | ||
if (options.offset) { | ||
params.offset = options.offset; | ||
if (options) { | ||
if (options.offset) { | ||
params.offset = options.offset; | ||
} | ||
if (options.limit) { | ||
params.limit = options.limit; | ||
} | ||
if (options.attributesToRetrieve) { | ||
params.attributesToRetrieve = options.attributesToRetrieve.join(); | ||
} | ||
if (options.attributesToSearchIn) { | ||
params.attributesToSearchIn = options.attributesToSearchIn.join(); | ||
} | ||
if (options.attributesToCrop) { | ||
params.attributesToCrop = options.attributesToCrop.join(); | ||
} | ||
if (options.cropLength) { | ||
params.cropLength = options.cropLength; | ||
} | ||
if (options.attributesToHighlight) { | ||
params.attributesToHighlight = options.attributesToHighlight.join(); | ||
} | ||
if (options.filters) { | ||
params.filters = options.filters; | ||
} | ||
if (options.timeoutMs) { | ||
params.timeoutMs = options.timeoutMs; | ||
} | ||
if (options.matches) { | ||
params.matches = options.matches; | ||
} | ||
} | ||
if (options.limit) { | ||
params.limit = options.limit; | ||
} | ||
if (options.attributesToRetrieve) { | ||
params.attributesToRetrieve = options.attributesToRetrieve.join(); | ||
} | ||
if (options.attributesToSearchIn) { | ||
params.attributesToSearchIn = options.attributesToSearchIn.join(); | ||
} | ||
if (options.attributesToCrop) { | ||
params.attributesToCrop = options.attributesToCrop.join(); | ||
} | ||
if (options.cropLength) { | ||
params.cropLength = options.cropLength; | ||
} | ||
if (options.attributesToHighlight) { | ||
params.attributesToHighlight = options.attributesToHighlight.join(); | ||
} | ||
if (options.filters) { | ||
params.filters = options.filters; | ||
} | ||
if (options.timeoutMs) { | ||
params.timeoutMs = options.timeoutMs; | ||
} | ||
if (options.matches) { | ||
params.matches = options.matches; | ||
} | ||
return this.instance.get(url, { | ||
@@ -82,0 +84,0 @@ params: params, |
{ | ||
"name": "meilisearch", | ||
"version": "0.8.7", | ||
"version": "0.8.8", | ||
"description": "The MeiliSearch JS client for Node.js and the browser.", | ||
@@ -33,4 +33,4 @@ "keywords": [ | ||
"dependencies": { | ||
"axios": "0.19.1" | ||
"axios": "0.19.2" | ||
} | ||
} |
@@ -26,3 +26,3 @@ # MeiliSearch Javascript Client | ||
There are many easy ways to [download and run a MeiliSearch instance](https://docs.meilisearch.com/getting_started/download.html). | ||
There are many easy ways to [download and run a MeiliSearch instance](https://docs.meilisearch.com/guides/advanced_guides/binary.html#download-and-launch). | ||
@@ -54,3 +54,3 @@ For example, if you use Docker: | ||
.Index('movies') | ||
.search({ q: 'batman' }) | ||
.search('batman') | ||
.then((response) => { | ||
@@ -74,5 +74,3 @@ console.log(response.hits) | ||
.Index('movies') | ||
.search({ | ||
q: 'batman', | ||
}) | ||
.search('batman') | ||
.then((response) => { | ||
@@ -198,7 +196,7 @@ console.log(response.hits) | ||
The method `add_documents` is **[asynchronous](https://docs.meilisearch.com/advanced_guides/asynchronous_updates.html)**.<br/> | ||
The method `add_documents` is **[asynchronous](https://docs.meilisearch.com/guides/advanced_guides/asynchronous_updates.html)**.<br/> | ||
### Get some documents | ||
Browse is a method to get defaults documents without search. This method is usually used to display results when you have no input in the search bar. | ||
getDocuments is a method to get defaults documents without search. This method is usually used to display results when you have no input in the search bar. | ||
@@ -210,3 +208,3 @@ **Example:** | ||
.Index('movies') | ||
.browse({ | ||
.getDocuments({ | ||
limit: 3, | ||
@@ -253,3 +251,3 @@ }) | ||
`meili.Index('xxx').search(options: Types.SearchParams): Promise<Types.SearchResponse>` | ||
`meili.Index('xxx').search(query: string, options?: Types.SearchParams): Promise<Types.SearchResponse>` | ||
@@ -256,0 +254,0 @@ ### Indexes |
@@ -25,3 +25,3 @@ import { AxiosInstance, CancelTokenSource } from 'axios'; | ||
*/ | ||
search(options: Types.SearchParams): Promise<Types.SearchResponse>; | ||
search(query: string, options?: Types.SearchParams): Promise<Types.SearchResponse>; | ||
getIndex(): Promise<Types.Index>; | ||
@@ -28,0 +28,0 @@ updateIndex(data: Types.UpdateIndexRequest): Promise<Types.Index>; |
@@ -52,3 +52,2 @@ export interface SchemaRaw { | ||
export interface SearchParams { | ||
q: string; | ||
offset?: number; | ||
@@ -55,0 +54,0 @@ limit?: number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
1070072
10394
369
+ Addedaxios@0.19.2(transitive)
- Removedaxios@0.19.1(transitive)
Updatedaxios@0.19.2