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

meilisearch

Package Overview
Dependencies
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meilisearch - npm Package Compare versions

Comparing version 0.32.4 to 0.32.5

2

dist/bundles/meilisearch.esm.min.js

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

import t from"crypto";var e={ALL:"all",LAST:"last"},n={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){return s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},s.apply(this,arguments)};function o(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function u(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}c((i=i.apply(t,e||[])).next())}))}function u(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var c=function(t){function e(n,i,r,s){var o,u,c,a=this;return a=t.call(this,n)||this,Object.setPrototypeOf(a,e.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),s?(a.stack=s,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(u=a.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(r," failed, reason: connect ECONNREFUSED")),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(r))):Error.captureStackTrace&&Error.captureStackTrace(a,e),a}return r(e,t),e}(Error),a=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,a.prototype),i.name="MeiliSearchApiError",i.code=e.code,i.type=e.type,i.link=e.link,i.message=e.message,i.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(i,a),i}return r(e,t),e}(Error);function h(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new c(t.statusText,t,t.url);case 4:throw new a(e,t.status);case 5:return[2,t]}}))}))}function d(t,e,n){if("MeiliSearchApiError"!==t.name)throw new c(t.message,t,n,e);throw t}var l=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),p=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error);function f(t){return Object.entries(t).reduce((function(t,e){var n=e[0],i=e[1];return void 0!==i&&(t[n]=i),t}),{})}function v(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function y(t){return Object.keys(t).reduce((function(e,n){var i,r,o,u=t[n];return void 0===u?e:Array.isArray(u)?s(s({},e),((i={})[n]=u.join(","),i)):u instanceof Date?s(s({},e),((r={})[n]=u.toISOString(),r)):s(s({},e),((o={})[n]=u,o))}),{})}function w(t){var e,n,i="X-Meilisearch-Client",r="Meilisearch JavaScript (v".concat("0.32.4",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var o=t.clientAgents.concat(r);s[i]=o.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new l('Meilisearch: The header "'.concat(i,'" should be an array of string(s).\n'));s[i]=r}return s}var b=function(){function t(t){this.headers=w(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new l("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new l("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,i=t.url,r=t.params,c=t.body,a=t.config,l=void 0===a?{}:a;return o(this,void 0,void 0,(function(){var t,o,a,p,f,v,y;return u(this,(function(u){switch(u.label){case 0:"undefined"==typeof fetch&&require("cross-fetch/dist/node-polyfill"),t=new URL(i,this.url),r&&(o=new URLSearchParams,Object.keys(r).filter((function(t){return null!==r[t]})).map((function(t){return o.set(t,r[t])})),t.search=o.toString()),(null===(e=l.headers)||void 0===e?void 0:e["Content-Type"])||(c=JSON.stringify(c)),a=s(s({},this.headers),l.headers),u.label=1;case 1:return u.trys.push([1,6,,7]),p=this.httpClient?this.httpClient:fetch,f=p(t.toString(),s(s(s({},l),this.requestConfig),{method:n,body:c,headers:a})),this.httpClient?[4,f]:[3,3];case 2:return[2,u.sent()];case 3:return[4,f.then((function(t){return h(t)}))];case 4:return[4,u.sent().json().catch((function(){}))];case 5:return[2,u.sent()];case 6:return v=u.sent(),y=v.stack,d(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),g=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},q=function(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)},m=function(){function t(t){this.httpRequest=new b(t)}return t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=i.sent(),[2,new q(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",y(t))];case 1:return e=n.sent(),[2,s(s({},e),{results:e.results.map((function(t){return new q(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:e=Date.now(),i.label=1;case 1:return Date.now()-e<r?[4,this.getTask(t)]:[3,4];case 2:return n=i.sent(),["enqueued","processing"].includes(n.status)?[4,v(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new p("timeout of ".concat(r,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n,i,s,o;return u(this,(function(u){switch(u.label){case 0:e=[],n=0,i=t,u.label=1;case 1:return n<i.length?(s=i[n],[4,this.waitForTask(s,{timeOutMs:r,intervalMs:c})]):[3,4];case 2:o=u.sent(),e.push(o),u.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},y(t))];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},y(t))];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t}(),k=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new b(t),this.tasks=new m(t)}return t.prototype.search=function(t,e,n){return o(this,void 0,void 0,(function(){var i;return u(this,(function(r){switch(r.label){case 0:return i="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(i,f(s({q:t},e)),void 0,n)];case 1:return[2,r.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var i,r,c,a,h;return o(this,void 0,void 0,(function(){var o,d,p;return u(this,(function(u){switch(u.label){case 0:return o="indexes/".concat(this.uid,"/search"),d=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new l("The filter query parameter should be in string format when using searchGet")},p=s(s({q:t},e),{filter:d(null==e?void 0:e.filter),sort:null===(i=null==e?void 0:e.sort)||void 0===i?void 0:i.join(","),facets:null===(r=null==e?void 0:e.facets)||void 0===r?void 0:r.join(","),attributesToRetrieve:null===(c=null==e?void 0:e.attributesToRetrieve)||void 0===c?void 0:c.join(","),attributesToCrop:null===(a=null==e?void 0:e.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(o,f(p),n)];case 1:return[2,u.sent()]}}))}))},t.prototype.getRawInfo=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var i;return u(this,(function(r){switch(r.label){case 0:return"indexes",[4,new b(n).post("indexes",s(s({},e),{uid:t}))];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.update=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(s(s({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,f(s(s({},t),{fields:n})))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),i=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,f(s(s({},e),{fields:i})))];case 1:return[2,r.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r;return u(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new g(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var i,r,s,o;return u(this,(function(u){switch(u.label){case 0:i=[],r=0,u.label=1;case 1:return r<t.length?(o=(s=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var i,r,s,o;return u(this,(function(u){switch(u.label){case 0:i=[],r=0,u.label=1;case 1:return r<t.length?(o=(s=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r;return u(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new g(r)]}}))}))},t.prototype.deleteDocument=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetPagination=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.getSynonyms=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSynonyms=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetStopWords=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetRankingRules=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetFaceting=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t}(),A=function(){function t(t){this.config=t,this.httpRequest=new b(t),this.tasks=new m(t)}return t.prototype.index=function(t){return new k(this.config,t)},t.prototype.getIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new k(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new k(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n,i=this;return u(this,(function(r){switch(r.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=r.sent(),n=e.results.map((function(t){return new k(i.config,t.uid,t.primaryKey)})),[2,s(s({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"indexes",[4,this.httpRequest.get("indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,k.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,new k(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new k(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"/swap-indexes",[4,this.httpRequest.post("/swap-indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return"multi-search",[4,this.httpRequest.post("multi-search",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"keys",[4,this.httpRequest.get("keys",t)];case 1:return(e=n.sent()).results=e.results.map((function(t){return s(s({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"keys",[4,this.httpRequest.post("keys",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateKey=function(t,e){return o(this,void 0,void 0,(function(){var n;return u(this,(function(i){switch(i.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"health",[4,this.httpRequest.get("health")];case 1:return[2,t.sent()]}}))}))},t.prototype.isHealthy=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),"health",[4,this.httpRequest.get("health")];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"stats",[4,this.httpRequest.get("stats")];case 1:return[2,t.sent()]}}))}))},t.prototype.getVersion=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"version",[4,this.httpRequest.get("version")];case 1:return[2,t.sent()]}}))}))},t.prototype.createDump=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return t=e.sent(),[2,new g(t)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var i=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(i.stack,"."))},t}();function x(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var R=function(){function e(t){this.config=t}return e.prototype.generateTenantToken=function(e,n,i){var r=(null==i?void 0:i.apiKey)||this.config.apiKey||"",s=e||"",o=null==i?void 0:i.expiresAt;!function(t){var e=t.searchRules,n=t.uid,i=t.apiKey,r=t.expiresAt;if(r){if(!(r instanceof Date))throw new l("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new l("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new l("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new l("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new l("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(n))throw new l("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}({apiKey:r,uid:s,expiresAt:o,searchRules:n});var u=x({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return x({searchRules:e,apiKeyUid:n,exp:null==i?void 0:i.getTime()}).replace(/=/g,"")}({searchRules:n,uid:s,expiresAt:o}),a=function(e,n,i){return t.createHmac("sha256",e).update("".concat(n,".").concat(i)).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}(r,u,c);return"".concat(u,".").concat(c,".").concat(a)},e}(),T=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new R(e),n}return r(e,t),e.prototype.generateTenantToken=function(e,n,i){return"undefined"==typeof window?this.tokens.generateTenantToken(e,n,i):t.prototype.generateTenantToken.call(this,e,n,i)},e}(A);export{n as ContentTypeEnum,g as EnqueuedTask,k as Index,e as MatchingStrategies,T as MeiliSearch,a as MeiliSearchApiError,c as MeiliSearchCommunicationError,l as MeiliSearchError,p as MeiliSearchTimeOutError,q as Task,m as TaskClient,T as default,d as httpErrorHandler,h as httpResponseErrorHandler};
import"cross-fetch/polyfill";import t from"crypto";var e={ALL:"all",LAST:"last"},n={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){return s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},s.apply(this,arguments)};function o(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function u(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}c((i=i.apply(t,e||[])).next())}))}function u(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var c=function(t){function e(n,i,r,s){var o,u,c,a=this;return a=t.call(this,n)||this,Object.setPrototypeOf(a,e.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),s?(a.stack=s,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(u=a.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(r," failed, reason: connect ECONNREFUSED")),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(r))):Error.captureStackTrace&&Error.captureStackTrace(a,e),a}return r(e,t),e}(Error),a=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,a.prototype),i.name="MeiliSearchApiError",i.code=e.code,i.type=e.type,i.link=e.link,i.message=e.message,i.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(i,a),i}return r(e,t),e}(Error);function h(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new c(t.statusText,t,t.url);case 4:throw new a(e,t.status);case 5:return[2,t]}}))}))}function d(t,e,n){if("MeiliSearchApiError"!==t.name)throw new c(t.message,t,n,e);throw t}var l=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),p=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error);function f(t){return Object.entries(t).reduce((function(t,e){var n=e[0],i=e[1];return void 0!==i&&(t[n]=i),t}),{})}function v(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function y(t){return Object.keys(t).reduce((function(e,n){var i,r,o,u=t[n];return void 0===u?e:Array.isArray(u)?s(s({},e),((i={})[n]=u.join(","),i)):u instanceof Date?s(s({},e),((r={})[n]=u.toISOString(),r)):s(s({},e),((o={})[n]=u,o))}),{})}function w(t){var e,n,i="X-Meilisearch-Client",r="Meilisearch JavaScript (v".concat("0.32.5",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var o=t.clientAgents.concat(r);s[i]=o.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new l('Meilisearch: The header "'.concat(i,'" should be an array of string(s).\n'));s[i]=r}return s}var b=function(){function t(t){this.headers=w(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new l("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new l("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,i=t.url,r=t.params,c=t.body,a=t.config,l=void 0===a?{}:a;return o(this,void 0,void 0,(function(){var t,o,a,p,f,v,y;return u(this,(function(u){switch(u.label){case 0:t=new URL(i,this.url),r&&(o=new URLSearchParams,Object.keys(r).filter((function(t){return null!==r[t]})).map((function(t){return o.set(t,r[t])})),t.search=o.toString()),(null===(e=l.headers)||void 0===e?void 0:e["Content-Type"])||(c=JSON.stringify(c)),a=s(s({},this.headers),l.headers),u.label=1;case 1:return u.trys.push([1,6,,7]),p=this.httpClient?this.httpClient:fetch,f=p(t.toString(),s(s(s({},l),this.requestConfig),{method:n,body:c,headers:a})),this.httpClient?[4,f]:[3,3];case 2:return[2,u.sent()];case 3:return[4,f.then((function(t){return h(t)}))];case 4:return[4,u.sent().json().catch((function(){}))];case 5:return[2,u.sent()];case 6:return v=u.sent(),y=v.stack,d(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return o(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return o(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),g=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},q=function(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)},m=function(){function t(t){this.httpRequest=new b(t)}return t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=i.sent(),[2,new q(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",y(t))];case 1:return e=n.sent(),[2,s(s({},e),{results:e.results.map((function(t){return new q(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:e=Date.now(),i.label=1;case 1:return Date.now()-e<r?[4,this.getTask(t)]:[3,4];case 2:return n=i.sent(),["enqueued","processing"].includes(n.status)?[4,v(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new p("timeout of ".concat(r,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){var e,n,i,s,o;return u(this,(function(u){switch(u.label){case 0:e=[],n=0,i=t,u.label=1;case 1:return n<i.length?(s=i[n],[4,this.waitForTask(s,{timeOutMs:r,intervalMs:c})]):[3,4];case 2:o=u.sent(),e.push(o),u.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},y(t))];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},y(t))];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t}(),k=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new b(t),this.tasks=new m(t)}return t.prototype.search=function(t,e,n){return o(this,void 0,void 0,(function(){var i;return u(this,(function(r){switch(r.label){case 0:return i="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(i,f(s({q:t},e)),void 0,n)];case 1:return[2,r.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var i,r,c,a,h;return o(this,void 0,void 0,(function(){var o,d,p;return u(this,(function(u){switch(u.label){case 0:return o="indexes/".concat(this.uid,"/search"),d=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new l("The filter query parameter should be in string format when using searchGet")},p=s(s({q:t},e),{filter:d(null==e?void 0:e.filter),sort:null===(i=null==e?void 0:e.sort)||void 0===i?void 0:i.join(","),facets:null===(r=null==e?void 0:e.facets)||void 0===r?void 0:r.join(","),attributesToRetrieve:null===(c=null==e?void 0:e.attributesToRetrieve)||void 0===c?void 0:c.join(","),attributesToCrop:null===(a=null==e?void 0:e.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(o,f(p),n)];case 1:return[2,u.sent()]}}))}))},t.prototype.getRawInfo=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var i;return u(this,(function(r){switch(r.label){case 0:return"indexes",[4,new b(n).post("indexes",s(s({},e),{uid:t}))];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.update=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(s(s({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,f(s(s({},t),{fields:n})))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),i=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,f(s(s({},e),{fields:i})))];case 1:return[2,r.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r;return u(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new g(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var i,r,s,o;return u(this,(function(u){switch(u.label){case 0:i=[],r=0,u.label=1;case 1:return r<t.length?(o=(s=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return u(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return i=r.sent(),[2,new g(i)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),o(this,void 0,void 0,(function(){var i,r,s,o;return u(this,(function(u){switch(u.label){case 0:i=[],r=0,u.label=1;case 1:return r<t.length?(o=(s=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:o.apply(s,[u.sent()]),u.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r;return u(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new g(r)]}}))}))},t.prototype.deleteDocument=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetPagination=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t.prototype.getSynonyms=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSynonyms=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetStopWords=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetRankingRules=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return o(this,void 0,void 0,(function(){var e,n;return u(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new g(n)]}}))}))},t.prototype.resetFaceting=function(){return o(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new g(e)]}}))}))},t}(),A=function(){function t(t){this.config=t,this.httpRequest=new b(t),this.tasks=new m(t)}return t.prototype.index=function(t){return new k(this.config,t)},t.prototype.getIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new k(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new k(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e,n,i=this;return u(this,(function(r){switch(r.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=r.sent(),n=e.results.map((function(t){return new k(i.config,t.uid,t.primaryKey)})),[2,s(s({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"indexes",[4,this.httpRequest.get("indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,k.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return[4,new k(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,new k(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"/swap-indexes",[4,this.httpRequest.post("/swap-indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return o(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return"multi-search",[4,this.httpRequest.post("multi-search",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,r=void 0===i?5e3:i,s=n.intervalMs,c=void 0===s?50:s;return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:r,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return"keys",[4,this.httpRequest.get("keys",t)];case 1:return(e=n.sent()).results=e.results.map((function(t){return s(s({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return"keys",[4,this.httpRequest.post("keys",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateKey=function(t,e){return o(this,void 0,void 0,(function(){var n;return u(this,(function(i){switch(i.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteKey=function(t){return o(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"health",[4,this.httpRequest.get("health")];case 1:return[2,t.sent()]}}))}))},t.prototype.isHealthy=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),"health",[4,this.httpRequest.get("health")];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"stats",[4,this.httpRequest.get("stats")];case 1:return[2,t.sent()]}}))}))},t.prototype.getVersion=function(){return o(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return"version",[4,this.httpRequest.get("version")];case 1:return[2,t.sent()]}}))}))},t.prototype.createDump=function(){return o(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return t=e.sent(),[2,new g(t)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var i=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(i.stack,"."))},t}();function x(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var R=function(){function e(t){this.config=t}return e.prototype.generateTenantToken=function(e,n,i){var r=(null==i?void 0:i.apiKey)||this.config.apiKey||"",s=e||"",o=null==i?void 0:i.expiresAt;!function(t){var e=t.searchRules,n=t.uid,i=t.apiKey,r=t.expiresAt;if(r){if(!(r instanceof Date))throw new l("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new l("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new l("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new l("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new l("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(n))throw new l("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}({apiKey:r,uid:s,expiresAt:o,searchRules:n});var u=x({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return x({searchRules:e,apiKeyUid:n,exp:null==i?void 0:i.getTime()}).replace(/=/g,"")}({searchRules:n,uid:s,expiresAt:o}),a=function(e,n,i){return t.createHmac("sha256",e).update("".concat(n,".").concat(i)).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}(r,u,c);return"".concat(u,".").concat(c,".").concat(a)},e}(),T=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new R(e),n}return r(e,t),e.prototype.generateTenantToken=function(e,n,i){return"undefined"==typeof window?this.tokens.generateTenantToken(e,n,i):t.prototype.generateTenantToken.call(this,e,n,i)},e}(A);export{n as ContentTypeEnum,g as EnqueuedTask,k as Index,e as MatchingStrategies,T as MeiliSearch,a as MeiliSearchApiError,c as MeiliSearchCommunicationError,l as MeiliSearchError,p as MeiliSearchTimeOutError,q as Task,m as TaskClient,T as default,d as httpErrorHandler,h as httpResponseErrorHandler};
//# sourceMappingURL=meilisearch.esm.min.js.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function r(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function u(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}c((i=i.apply(t,e||[])).next())}))}function s(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var o=function(t){function e(n,i,r,s){var o,u,c,a=this;return a=t.call(this,n)||this,Object.setPrototypeOf(a,e.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),s?(a.stack=s,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(u=a.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(r," failed, reason: connect ECONNREFUSED")),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(r))):Error.captureStackTrace&&Error.captureStackTrace(a,e),a}return n(e,t),e}(Error),u=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,u.prototype),i.name="MeiliSearchApiError",i.code=e.code,i.type=e.type,i.link=e.link,i.message=e.message,i.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(i,u),i}return n(e,t),e}(Error);function c(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new o(t.statusText,t,t.url);case 4:throw new u(e,t.status);case 5:return[2,t]}}))}))}function a(t,e,n){if("MeiliSearchApiError"!==t.name)throw new o(t.message,t,n,e);throw t}var h=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return n(e,t),e}(Error),d=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return n(e,t),e}(Error);function l(t){return Object.entries(t).reduce((function(t,e){var n=e[0],i=e[1];return void 0!==i&&(t[n]=i),t}),{})}function p(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function f(t){return Object.keys(t).reduce((function(e,n){var r,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?i(i({},e),((r={})[n]=u.join(","),r)):u instanceof Date?i(i({},e),((s={})[n]=u.toISOString(),s)):i(i({},e),((o={})[n]=u,o))}),{})}function v(t){var e,n,i="X-Meilisearch-Client",r="Meilisearch JavaScript (v".concat("0.32.4",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var o=t.clientAgents.concat(r);s[i]=o.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(i,'" should be an array of string(s).\n'));s[i]=r}return s}var y=function(){function t(t){this.headers=v(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,o=t.url,u=t.params,h=t.body,d=t.config,l=void 0===d?{}:d;return r(this,void 0,void 0,(function(){var t,r,d,p,f,v,y;return s(this,(function(s){switch(s.label){case 0:"undefined"==typeof fetch&&require("cross-fetch/dist/node-polyfill"),t=new URL(o,this.url),u&&(r=new URLSearchParams,Object.keys(u).filter((function(t){return null!==u[t]})).map((function(t){return r.set(t,u[t])})),t.search=r.toString()),(null===(e=l.headers)||void 0===e?void 0:e["Content-Type"])||(h=JSON.stringify(h)),d=i(i({},this.headers),l.headers),s.label=1;case 1:return s.trys.push([1,6,,7]),p=this.httpClient?this.httpClient:fetch,f=p(t.toString(),i(i(i({},l),this.requestConfig),{method:n,body:h,headers:d})),this.httpClient?[4,f]:[3,3];case 2:return[2,s.sent()];case 3:return[4,f.then((function(t){return c(t)}))];case 4:return[4,s.sent().json().catch((function(){}))];case 5:return[2,s.sent()];case 6:return v=s.sent(),y=v.stack,a(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return r(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),w=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},b=function(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)},g=function(){function t(t){this.httpRequest=new y(t)}return t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=i.sent(),[2,new b(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",f(t))];case 1:return e=n.sent(),[2,i(i({},e),{results:e.results.map((function(t){return new b(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:e=Date.now(),i.label=1;case 1:return Date.now()-e<o?[4,this.getTask(t)]:[3,4];case 2:return n=i.sent(),["enqueued","processing"].includes(n.status)?[4,p(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new d("timeout of ".concat(o,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){var e,n,i,r,u;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,i=t,s.label=1;case 1:return n<i.length?(r=i[n],[4,this.waitForTask(r,{timeOutMs:o,intervalMs:c})]):[3,4];case 2:u=s.sent(),e.push(u),s.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},f(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},f(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t}(),q=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new y(t),this.tasks=new g(t)}return t.prototype.search=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,l(i({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var o,u,c,a,d;return r(this,void 0,void 0,(function(){var r,p,f;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),p=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new h("The filter query parameter should be in string format when using searchGet")},f=i(i({q:t},e),{filter:p(null==e?void 0:e.filter),sort:null===(o=null==e?void 0:e.sort)||void 0===o?void 0:o.join(","),facets:null===(u=null==e?void 0:e.facets)||void 0===u?void 0:u.join(","),attributesToRetrieve:null===(c=null==e?void 0:e.attributesToRetrieve)||void 0===c?void 0:c.join(","),attributesToCrop:null===(a=null==e?void 0:e.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(d=null==e?void 0:e.attributesToHighlight)||void 0===d?void 0:d.join(",")}),[4,this.httpRequest.get(r,l(f),n)];case 1:return[2,s.sent()]}}))}))},t.prototype.getRawInfo=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return"indexes",[4,new y(n).post("indexes",i(i({},e),{uid:t}))];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.update=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,l(i(i({},t),{fields:n})))];case 1:return[2,r.sent()]}}))}))},t.prototype.getDocument=function(t,e){return r(this,void 0,void 0,(function(){var n,r;return s(this,(function(s){switch(s.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),r=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,l(i(i({},e),{fields:r})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return i=r.sent(),[2,new w(i)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return r(this,void 0,void 0,(function(){var i,r;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return i=r.sent(),[2,new w(i)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return r(this,void 0,void 0,(function(){var i,r;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetPagination=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.getSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSynonyms=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetStopWords=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetRankingRules=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetFaceting=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t}(),m=function(t){function e(e){return t.call(this,e)||this}return n(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new y(t),this.tasks=new g(t)}return t.prototype.index=function(t){return new q(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new q(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new q(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e,n,r=this;return s(this,(function(s){switch(s.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=s.sent(),n=e.results.map((function(t){return new q(r.config,t.uid,t.primaryKey)})),[2,i(i({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"indexes",[4,this.httpRequest.get("indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,q.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,new q(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new q(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"/swap-indexes",[4,this.httpRequest.post("/swap-indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return"multi-search",[4,this.httpRequest.post("multi-search",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"keys",[4,this.httpRequest.get("keys",t)];case 1:return(e=n.sent()).results=e.results.map((function(t){return i(i({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"keys",[4,this.httpRequest.post("keys",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateKey=function(t,e){return r(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteKey=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"health",[4,this.httpRequest.get("health")];case 1:return[2,t.sent()]}}))}))},t.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),"health",[4,this.httpRequest.get("health")];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"stats",[4,this.httpRequest.get("stats")];case 1:return[2,t.sent()]}}))}))},t.prototype.getVersion=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"version",[4,this.httpRequest.get("version")];case 1:return[2,t.sent()]}}))}))},t.prototype.createDump=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return t=e.sent(),[2,new w(t)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var i=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(i.stack,"."))},t}());t.ContentTypeEnum={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},t.Index=q,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=m,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=m,t.httpErrorHandler=a,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch/polyfill")):"function"==typeof define&&define.amd?define(["exports","cross-fetch/polyfill"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function r(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function u(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}c((i=i.apply(t,e||[])).next())}))}function s(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var o=function(t){function e(n,i,r,s){var o,u,c,a=this;return a=t.call(this,n)||this,Object.setPrototypeOf(a,e.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),s?(a.stack=s,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(u=a.stack)||void 0===u?void 0:u.replace("Failed to fetch","request to ".concat(r," failed, reason: connect ECONNREFUSED")),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(r))):Error.captureStackTrace&&Error.captureStackTrace(a,e),a}return n(e,t),e}(Error),u=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,u.prototype),i.name="MeiliSearchApiError",i.code=e.code,i.type=e.type,i.link=e.link,i.message=e.message,i.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(i,u),i}return n(e,t),e}(Error);function c(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:if(t.ok)return[3,5];e=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.json()];case 2:return e=n.sent(),[3,4];case 3:throw n.sent(),new o(t.statusText,t,t.url);case 4:throw new u(e,t.status);case 5:return[2,t]}}))}))}function a(t,e,n){if("MeiliSearchApiError"!==t.name)throw new o(t.message,t,n,e);throw t}var h=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return n(e,t),e}(Error),d=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return n(e,t),e}(Error);function l(t){return Object.entries(t).reduce((function(t,e){var n=e[0],i=e[1];return void 0!==i&&(t[n]=i),t}),{})}function p(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}function f(t){return Object.keys(t).reduce((function(e,n){var r,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?i(i({},e),((r={})[n]=u.join(","),r)):u instanceof Date?i(i({},e),((s={})[n]=u.toISOString(),s)):i(i({},e),((o={})[n]=u,o))}),{})}function v(t){var e,n,i="X-Meilisearch-Client",r="Meilisearch JavaScript (v".concat("0.32.5",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,n){return e[n]=t})),e}return Object.assign({},t)}(null!==(n=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==n?n:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var o=t.clientAgents.concat(r);s[i]=o.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(i,'" should be an array of string(s).\n'));s[i]=r}return s}var y=function(){function t(t){this.headers=v(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e,n=t.method,o=t.url,u=t.params,h=t.body,d=t.config,l=void 0===d?{}:d;return r(this,void 0,void 0,(function(){var t,r,d,p,f,v,y;return s(this,(function(s){switch(s.label){case 0:t=new URL(o,this.url),u&&(r=new URLSearchParams,Object.keys(u).filter((function(t){return null!==u[t]})).map((function(t){return r.set(t,u[t])})),t.search=r.toString()),(null===(e=l.headers)||void 0===e?void 0:e["Content-Type"])||(h=JSON.stringify(h)),d=i(i({},this.headers),l.headers),s.label=1;case 1:return s.trys.push([1,6,,7]),p=this.httpClient?this.httpClient:fetch,f=p(t.toString(),i(i(i({},l),this.requestConfig),{method:n,body:h,headers:d})),this.httpClient?[4,f]:[3,3];case 2:return[2,s.sent()];case 3:return[4,f.then((function(t){return c(t)}))];case 4:return[4,s.sent().json().catch((function(){}))];case 5:return[2,s.sent()];case 6:return v=s.sent(),y=v.stack,a(v,y,t.toString()),[3,7];case 7:return[2]}}))}))},t.prototype.get=function(t,e,n){return r(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),w=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},b=function(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)},g=function(){function t(t){this.httpRequest=new y(t)}return t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return n=i.sent(),[2,new b(n)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",f(t))];case 1:return e=n.sent(),[2,i(i({},e),{results:e.results.map((function(t){return new b(t)}))})]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:e=Date.now(),i.label=1;case 1:return Date.now()-e<o?[4,this.getTask(t)]:[3,4];case 2:return n=i.sent(),["enqueued","processing"].includes(n.status)?[4,p(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new d("timeout of ".concat(o,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."))}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){var e,n,i,r,u;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,i=t,s.label=1;case 1:return n<i.length?(r=i[n],[4,this.waitForTask(r,{timeOutMs:o,intervalMs:c})]):[3,4];case 2:u=s.sent(),e.push(u),s.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},f(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},f(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t}(),q=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new y(t),this.tasks=new g(t)}return t.prototype.search=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(r,l(i({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var o,u,c,a,d;return r(this,void 0,void 0,(function(){var r,p,f;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),p=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new h("The filter query parameter should be in string format when using searchGet")},f=i(i({q:t},e),{filter:p(null==e?void 0:e.filter),sort:null===(o=null==e?void 0:e.sort)||void 0===o?void 0:o.join(","),facets:null===(u=null==e?void 0:e.facets)||void 0===u?void 0:u.join(","),attributesToRetrieve:null===(c=null==e?void 0:e.attributesToRetrieve)||void 0===c?void 0:c.join(","),attributesToCrop:null===(a=null==e?void 0:e.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(d=null==e?void 0:e.attributesToHighlight)||void 0===d?void 0:d.join(",")}),[4,this.httpRequest.get(r,l(f),n)];case 1:return[2,s.sent()]}}))}))},t.prototype.getRawInfo=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.get(t)];case 1:return e=n.sent(),this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),[2,e]}}))}))},t.prototype.fetchInfo=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(t,e,n){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return"indexes",[4,new y(n).post("indexes",i(i({},e),{uid:t}))];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.update=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.delete=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.getStats=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/stats"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){switch(r.label){case 0:return e="indexes/".concat(this.uid,"/documents"),n=function(){var e;if(Array.isArray(null==t?void 0:t.fields))return null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}(),[4,this.httpRequest.get(e,l(i(i({},t),{fields:n})))];case 1:return[2,r.sent()]}}))}))},t.prototype.getDocument=function(t,e){return r(this,void 0,void 0,(function(){var n,r;return s(this,(function(s){switch(s.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),r=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,l(i(i({},e),{fields:r})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return i=r.sent(),[2,new w(i)]}}))}))},t.prototype.addDocumentsFromString=function(t,e,n){return r(this,void 0,void 0,(function(){var i,r;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return i=r.sent(),[2,new w(i)]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocumentsFromString=function(t,e,n){return r(this,void 0,void 0,(function(){var i,r;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(i,t,n,{headers:{"Content-Type":e}})];case 1:return r=s.sent(),[2,new w(r)]}}))}))},t.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.deleteAllDocuments=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSettings=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSettings=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueued=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetSettings=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getPagination=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updatePagination=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetPagination=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/pagination"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.getSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSynonyms=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSynonyms=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getStopWords=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateStopWords=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetStopWords=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateRankingRules=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetRankingRules=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFilterableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetFilterableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSortableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSortableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSortableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getTypoTolerance=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateTypoTolerance=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return(n=i.sent()).enqueuedAt=new Date(n.enqueuedAt),[2,n]}}))}))},t.prototype.resetTypoTolerance=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.delete(t)];case 1:return(e=n.sent()).enqueuedAt=new Date(e.enqueuedAt),[2,e]}}))}))},t.prototype.getFaceting=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFaceting=function(t){return r(this,void 0,void 0,(function(){var e,n;return s(this,(function(i){switch(i.label){case 0:return e="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.patch(e,t)];case 1:return n=i.sent(),[2,new w(n)]}}))}))},t.prototype.resetFaceting=function(){return r(this,void 0,void 0,(function(){var t,e;return s(this,(function(n){switch(n.label){case 0:return t="indexes/".concat(this.uid,"/settings/faceting"),[4,this.httpRequest.delete(t)];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t}(),m=function(t){function e(e){return t.call(this,e)||this}return n(e,t),e}(function(){function t(t){this.config=t,this.httpRequest=new y(t),this.tasks=new g(t)}return t.prototype.index=function(t){return new q(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new q(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new q(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e,n,r=this;return s(this,(function(s){switch(s.label){case 0:return[4,this.getRawIndexes(t)];case 1:return e=s.sent(),n=e.results.map((function(t){return new q(r.config,t.uid,t.primaryKey)})),[2,i(i({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"indexes",[4,this.httpRequest.get("indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,q.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,new q(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new q(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return n.sent(),[2,!0];case 2:if("index_not_found"===(e=n.sent()).code)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.swapIndexes=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"/swap-indexes",[4,this.httpRequest.post("/swap-indexes",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.multiSearch=function(t,e){return r(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return"multi-search",[4,this.httpRequest.post("multi-search",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTask(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTasks=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTasks(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,i=n.timeOutMs,o=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.waitForTask(t,{timeOutMs:o,intervalMs:c})];case 1:return[2,e.sent()]}}))}))},t.prototype.cancelTasks=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.cancelTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.deleteTasks(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKeys=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return"keys",[4,this.httpRequest.get("keys",t)];case 1:return(e=n.sent()).results=e.results.map((function(t){return i(i({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.createKey=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"keys",[4,this.httpRequest.post("keys",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateKey=function(t,e){return r(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteKey=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="keys/".concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.health=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"health",[4,this.httpRequest.get("health")];case 1:return[2,t.sent()]}}))}))},t.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),"health",[4,this.httpRequest.get("health")];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.getStats=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"stats",[4,this.httpRequest.get("stats")];case 1:return[2,t.sent()]}}))}))},t.prototype.getVersion=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"version",[4,this.httpRequest.get("version")];case 1:return[2,t.sent()]}}))}))},t.prototype.createDump=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return t=e.sent(),[2,new w(t)]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var i=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(i.stack,"."))},t}());t.ContentTypeEnum={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},t.Index=q,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=m,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=m,t.httpErrorHandler=a,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=meilisearch.umd.min.js.map

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

import 'cross-fetch/polyfill';
import { FetchError } from '../types';

@@ -2,0 +3,0 @@ declare class MeiliSearchCommunicationError extends Error {

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

import 'cross-fetch/polyfill';
import { Config, EnqueuedTaskObject } from './types';

@@ -2,0 +3,0 @@ type queryParams<T> = {

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

// Type definitions for meilisearch 0.32.4
// Type definitions for meilisearch 0.32.5
// Project: https://github.com/meilisearch/meilisearch-js

@@ -3,0 +3,0 @@ // Definitions by: cvermand <charlotte@meilisearch.com> <https://github.com/meilisearch>

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

export declare const PACKAGE_VERSION = "0.32.4";
export declare const PACKAGE_VERSION = "0.32.5";
//# sourceMappingURL=package-version.d.ts.map
{
"name": "meilisearch",
"version": "0.32.4",
"version": "0.32.5",
"description": "The Meilisearch JS client for Node.js and the browser.",

@@ -5,0 +5,0 @@ "keywords": [

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

import 'cross-fetch/polyfill'
import { FetchError } from '../types'

@@ -2,0 +3,0 @@

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

import 'cross-fetch/polyfill'
import { Config, EnqueuedTaskObject } from './types'

@@ -121,6 +123,2 @@ import { PACKAGE_VERSION } from './package-version'

}) {
if (typeof fetch === 'undefined') {
require('cross-fetch/dist/node-polyfill')
}
const constructURL = new URL(url, this.url)

@@ -127,0 +125,0 @@ if (params) {

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

export const PACKAGE_VERSION = '0.32.4'
export const PACKAGE_VERSION = '0.32.5'

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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

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