Socket
Socket
Sign inDemoInstall

meilisearch

Package Overview
Dependencies
Maintainers
4
Versions
90
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.30.0 to 0.31.0

2

dist/bundles/meilisearch.esm.min.js

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

import"cross-fetch/polyfill";import t from"crypto";var e={ALL:"all",LAST:"last"},n=function(t,e){return n=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])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(){return r=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},r.apply(this,arguments)};function s(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 o(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 u=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 i(e,t),e}(Error),c=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,c.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,c),i}return i(e,t),e}(Error);function a(t){return s(this,void 0,void 0,(function(){var e;return o(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 u(t.statusText,t,t.url);case 4:throw new c(e,t.status);case 5:return[2,t]}}))}))}function h(t,e,n){if("MeiliSearchApiError"!==t.name)throw new u(t.message,t,n,e);throw t}var d=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 i(e,t),e}(Error),l=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 i(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 p(t){return s(this,void 0,void 0,(function(){return o(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 v(t){return Object.keys(t).reduce((function(e,n){var i,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?r(r({},e),((i={})[n]=u.join(","),i)):u instanceof Date?r(r({},e),((s={})[n]=u.toISOString(),s)):r(r({},e),((o={})[n]=u,o))}),{})}var y=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.30.0",")");t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var r=t.clientAgents.concat(n);i[e]=r.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}(t);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 d("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,i=t.params,u=t.body,c=t.config;return s(this,void 0,void 0,(function(){var t,s,d,l;return o(this,(function(o){switch(o.label){case 0:t=new URL(n,this.url),i&&(s=new URLSearchParams,Object.keys(i).filter((function(t){return null!==i[t]})).map((function(t){return s.set(t,i[t])})),t.search=s.toString()),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(t.toString(),r(r({},c),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return a(t)}))];case 2:return[4,o.sent().json().catch((function(){}))];case 3:return[2,o.sent()];case 4:return d=o.sent(),l=d.stack,h(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",v(t))];case 1:return e=n.sent(),[2,r(r({},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,r=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n;return o(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,p(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new l("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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n,i,s,u;return o(this,(function(o){switch(o.label){case 0:e=[],n=0,i=t,o.label=1;case 1:return n<i.length?(s=i[n],[4,this.waitForTask(s,{timeOutMs:r,intervalMs:c})]):[3,4];case 2:u=o.sent(),e.push(u),o.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},v(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},v(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 s(this,void 0,void 0,(function(){var i;return o(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(i,f(r({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var i,u,c,a,h;return s(this,void 0,void 0,(function(){var s,l,p;return o(this,(function(o){switch(o.label){case 0:return s="indexes/".concat(this.uid,"/search"),l=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")},p=r(r({q:t},e),{filter:l(null==e?void 0:e.filter),sort:null===(i=null==e?void 0:e.sort)||void 0===i?void 0:i.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===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(s,f(p),n)];case 1:return[2,o.sent()]}}))}))},t.prototype.getRawInfo=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var i;return o(this,(function(s){switch(s.label){case 0:return"indexes",[4,new y(n).post("indexes",r(r({},e),{uid:t}))];case 1:return i=s.sent(),[2,new w(i)]}}))}))},t.prototype.update=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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={}),s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(r(r({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var e,n;return o(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(r(r({},t),{fields:n})))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(this,(function(s){switch(s.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(r(r({},e),{fields:i})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(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.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var i,r,s,u;return o(this,(function(o){switch(o.label){case 0:i=[],r=0,o.label=1;case 1:return r<t.length?(u=(s=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(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),s(this,void 0,void 0,(function(){var i,r,s,u;return o(this,(function(o){switch(o.label){case 0:i=[],r=0,o.label=1;case 1:return r<t.length?(u=(s=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.deleteDocument=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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}(),k=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 s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new q(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new q(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,i=this;return o(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(i.config,t.uid,t.primaryKey)})),[2,r(r({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){var e;return o(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 r(r({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var n;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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}();function m(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var A=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 d("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new d("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new d("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new d("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new d("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 d("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=m({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return m({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}(),x=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new A(e),n}return i(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}(k);export{w as EnqueuedTask,q as Index,e as MatchingStrategies,x as MeiliSearch,c as MeiliSearchApiError,u as MeiliSearchCommunicationError,d as MeiliSearchError,l as MeiliSearchTimeOutError,b as Task,g as TaskClient,x as default,h as httpErrorHandler,a as httpResponseErrorHandler};
import"cross-fetch/polyfill";import t from"crypto";var e={ALL:"all",LAST:"last"},n=function(t,e){return n=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])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(){return r=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},r.apply(this,arguments)};function s(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 o(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 u=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 i(e,t),e}(Error),c=function(t){function e(e,n){var i=t.call(this,e.message)||this;return Object.setPrototypeOf(i,c.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,c),i}return i(e,t),e}(Error);function a(t){return s(this,void 0,void 0,(function(){var e;return o(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 u(t.statusText,t,t.url);case 4:throw new c(e,t.status);case 5:return[2,t]}}))}))}function h(t,e,n){if("MeiliSearchApiError"!==t.name)throw new u(t.message,t,n,e);throw t}var d=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 i(e,t),e}(Error),l=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 i(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 p(t){return s(this,void 0,void 0,(function(){return o(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 v(t){return Object.keys(t).reduce((function(e,n){var i,s,o,u=t[n];return void 0===u?e:Array.isArray(u)?r(r({},e),((i={})[n]=u.join(","),i)):u instanceof Date?r(r({},e),((s={})[n]=u.toISOString(),s)):r(r({},e),((o={})[n]=u,o))}),{})}var y=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.31.0",")");t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var r=t.clientAgents.concat(n);i[e]=r.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}(t);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 d("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,i=t.params,u=t.body,c=t.config;return s(this,void 0,void 0,(function(){var t,s,d,l;return o(this,(function(o){switch(o.label){case 0:t=new URL(n,this.url),i&&(s=new URLSearchParams,Object.keys(i).filter((function(t){return null!==i[t]})).map((function(t){return s.set(t,i[t])})),t.search=s.toString()),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(t.toString(),r(r({},c),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return a(t)}))];case 2:return[4,o.sent().json().catch((function(){}))];case 3:return[2,o.sent()];case 4:return d=o.sent(),l=d.stack,h(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.get("tasks",v(t))];case 1:return e=n.sent(),[2,r(r({},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,r=void 0===i?5e3:i,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n;return o(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,p(c)]:[2,n];case 3:return i.sent(),[3,1];case 4:throw new l("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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){var e,n,i,s,u;return o(this,(function(o){switch(o.label){case 0:e=[],n=0,i=t,o.label=1;case 1:return n<i.length?(s=i[n],[4,this.waitForTask(s,{timeOutMs:r,intervalMs:c})]):[3,4];case 2:u=o.sent(),e.push(u),o.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.cancelTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks/cancel",[4,this.httpRequest.post("tasks/cancel",{},v(t))];case 1:return e=n.sent(),[2,new w(e)]}}))}))},t.prototype.deleteTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return"tasks",[4,this.httpRequest.delete("tasks",{},v(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 s(this,void 0,void 0,(function(){var i;return o(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(i,f(r({q:t},e)),void 0,n)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,n){var i,u,c,a,h;return s(this,void 0,void 0,(function(){var s,l,p;return o(this,(function(o){switch(o.label){case 0:return s="indexes/".concat(this.uid,"/search"),l=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")},p=r(r({q:t},e),{filter:l(null==e?void 0:e.filter),sort:null===(i=null==e?void 0:e.sort)||void 0===i?void 0:i.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===(h=null==e?void 0:e.attributesToHighlight)||void 0===h?void 0:h.join(",")}),[4,this.httpRequest.get(s,f(p),n)];case 1:return[2,o.sent()]}}))}))},t.prototype.getRawInfo=function(){return s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var i;return o(this,(function(s){switch(s.label){case 0:return"indexes",[4,new y(n).post("indexes",r(r({},e),{uid:t}))];case 1:return i=s.sent(),[2,new w(i)]}}))}))},t.prototype.update=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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={}),s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(r(r({},t),{indexUids:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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={}),s(this,void 0,void 0,(function(){var e,n;return o(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(r(r({},t),{fields:n})))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(this,(function(s){switch(s.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(r(r({},e),{fields:i})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(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.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),s(this,void 0,void 0,(function(){var i,r,s,u;return o(this,(function(o){switch(o.label){case 0:i=[],r=0,o.label=1;case 1:return r<t.length?(u=(s=i).push,[4,this.addDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.updateDocuments=function(t,e){return s(this,void 0,void 0,(function(){var n,i;return o(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),s(this,void 0,void 0,(function(){var i,r,s,u;return o(this,(function(o){switch(o.label){case 0:i=[],r=0,o.label=1;case 1:return r<t.length?(u=(s=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(s,[o.sent()]),o.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.deleteDocument=function(t){return s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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 s(this,void 0,void 0,(function(){var t;return o(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 s(this,void 0,void 0,(function(){var e,n;return o(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 s(this,void 0,void 0,(function(){var t,e;return o(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}(),k=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 s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new q(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return s(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new q(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,i=this;return o(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(i.config,t.uid,t.primaryKey)})),[2,r(r({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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.getTasks=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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,u=n.intervalMs,c=void 0===u?50:u;return s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){return o(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={}),s(this,void 0,void 0,(function(){var e;return o(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 r(r({},t),{createdAt:new Date(t.createdAt),updateAt:new Date(t.updateAt)})})),[2,e]}}))}))},t.prototype.getKey=function(t){return s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var n;return o(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 s(this,void 0,void 0,(function(){var e;return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){return o(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 s(this,void 0,void 0,(function(){var t;return o(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}();function m(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var A=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 d("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new d("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new d("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new d("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new d("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 d("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=m({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return m({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}(),x=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new A(e),n}return i(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}(k);export{w as EnqueuedTask,q as Index,e as MatchingStrategies,x as MeiliSearch,c as MeiliSearchApiError,u as MeiliSearchCommunicationError,d as MeiliSearchError,l as MeiliSearchTimeOutError,b as Task,g as TaskClient,x as default,h as httpErrorHandler,a as httpResponseErrorHandler};
//# sourceMappingURL=meilisearch.esm.min.js.map

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

!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))}),{})}var v=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.30.0",")");t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var r=t.clientAgents.concat(n);i[e]=r.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}(t);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=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return r(this,void 0,void 0,(function(){var t,r,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(r=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return r.set(t,o[t])})),t.search=r.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5: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}(),y=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},w=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)},b=function(){function t(t){this.httpRequest=new v(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 w(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 w(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 y(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 y(e)]}}))}))},t}(),g=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new v(t),this.tasks=new b(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 v(n).post("indexes",i(i({},e),{uid:t}))];case 1:return r=s.sent(),[2,new y(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 y(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 y(i)]}}))}))},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 y(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.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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(e)]}}))}))},t}(),q=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 v(t),this.tasks=new b(t)}return t.prototype.index=function(t){return new g(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new g(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 g(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 g(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,g.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 g(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 g(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.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 y(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.Index=g,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=q,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=q,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))}),{})}var v=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.31.0",")");t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var r=t.clientAgents.concat(n);i[e]=r.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}(t);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=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return r(this,void 0,void 0,(function(){var t,r,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(r=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return r.set(t,o[t])})),t.search=r.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5: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}(),y=function(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)},w=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)},b=function(){function t(t){this.httpRequest=new v(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 w(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 w(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 y(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 y(e)]}}))}))},t}(),g=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new v(t),this.tasks=new b(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 v(n).post("indexes",i(i({},e),{uid:t}))];case 1:return r=s.sent(),[2,new y(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 y(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 y(i)]}}))}))},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 y(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.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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(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 y(e)]}}))}))},t}(),q=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 v(t),this.tasks=new b(t)}return t.prototype.index=function(t){return new g(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new g(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 g(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 g(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,g.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 g(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 g(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.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 y(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.Index=g,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=q,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=q,t.httpErrorHandler=a,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=meilisearch.umd.min.js.map

@@ -12,3 +12,4 @@ import { Index } from '../indexes';

* Creates new MeiliSearch instance
* @param {Config} config Configuration object
*
* @param config - Configuration object
*/

@@ -18,26 +19,21 @@ constructor(config: Config);

* Return an Index instance
* @memberof MeiliSearch
* @method index
* @template T
* @param {string} indexUid The index UID
* @returns {Index<T>} Instance of Index
*
* @param indexUid - The index UID
* @returns Instance of Index
*/
index<T = any>(indexUid: string): Index<T>;
/**
* Gather information about an index by calling MeiliSearch and
* return an Index instance with the gathered information
* @memberof MeiliSearch
* @method getIndex
* @template T
* @param {string} indexUid The index UID
* @returns {Promise<Index<T>>} Promise returning Index instance
* Gather information about an index by calling MeiliSearch and return an
* Index instance with the gathered information
*
* @param indexUid - The index UID
* @returns Promise returning Index instance
*/
getIndex<T = any>(indexUid: string): Promise<Index<T>>;
/**
* Gather information about an index by calling MeiliSearch and
* return the raw JSON response
* @memberof MeiliSearch
* @method getRawIndex
* @param {string} indexUid The index UID
* @returns {Promise<IndexObject>} Promise returning index information
* Gather information about an index by calling MeiliSearch and return the raw
* JSON response
*
* @param indexUid - The index UID
* @returns Promise returning index information
*/

@@ -47,7 +43,5 @@ getRawIndex(indexUid: string): Promise<IndexObject>;

* Get all the indexes as Index instances.
* @memberof MeiliSearch
* @method getIndexes
* @param {IndexesQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<IndexesResults<Index[]>>} Promise returning array of raw index information
* @param parameters - Parameters to browse the indexes
* @returns Promise returning array of raw index information
*/

@@ -57,7 +51,5 @@ getIndexes(parameters?: IndexesQuery): Promise<IndexesResults<Index[]>>;

* Get all the indexes in their raw value (no Index instances).
* @memberof MeiliSearch
* @method getRawIndexes
* @param {IndexesQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<IndexesResults<IndexObject[]>>} Promise returning array of raw index information
* @param parameters - Parameters to browse the indexes
* @returns Promise returning array of raw index information
*/

@@ -67,8 +59,6 @@ getRawIndexes(parameters?: IndexesQuery): Promise<IndexesResults<IndexObject[]>>;

* Create a new index
* @memberof MeiliSearch
* @method createIndex
* @template T
* @param {string} uid The index UID
* @param {IndexOptions} options Index options
* @returns {Promise<Index<T>>} Promise returning Index instance
*
* @param uid - The index UID
* @param options - Index options
* @returns Promise returning Index instance
*/

@@ -78,8 +68,6 @@ createIndex(uid: string, options?: IndexOptions): Promise<EnqueuedTask>;

* Update an index
* @memberof MeiliSearch
* @method updateIndex
* @template T
* @param {string} uid The index UID
* @param {IndexOptions} options Index options to update
* @returns {Promise<Index<T>>} Promise returning Index instance after updating
*
* @param uid - The index UID
* @param options - Index options to update
* @returns Promise returning Index instance after updating
*/

@@ -89,6 +77,5 @@ updateIndex(uid: string, options?: IndexOptions): Promise<EnqueuedTask>;

* Delete an index
* @memberof MeiliSearch
* @method deleteIndex
* @param {string} uid The index UID
* @returns {Promise<void>} Promise which resolves when index is deleted successfully
*
* @param uid - The index UID
* @returns Promise which resolves when index is deleted successfully
*/

@@ -98,6 +85,6 @@ deleteIndex(uid: string): Promise<EnqueuedTask>;

* Deletes an index if it already exists.
* @memberof MeiliSearch
* @method deleteIndexIfExists
* @param {string} uid The index UID
* @returns {Promise<boolean>} Promise which resolves to true when index exists and is deleted successfully, otherwise false if it does not exist
*
* @param uid - The index UID
* @returns Promise which resolves to true when index exists and is deleted
* successfully, otherwise false if it does not exist
*/

@@ -108,6 +95,4 @@ deleteIndexIfExists(uid: string): Promise<boolean>;

*
* @memberof MeiliSearch
* @method swapIndexes
* @param {SwapIndexesParams} params - List of indexes tuples to swap.
* @returns {Promise<EnqueuedTask>} - Promise returning object of the enqueued task
* @param params - List of indexes tuples to swap.
* @returns Promise returning object of the enqueued task
*/

@@ -117,7 +102,5 @@ swapIndexes(params: SwapIndexesParams): Promise<EnqueuedTask>;

* Get the list of all client tasks
* @memberof MeiliSearch
* @method getTasks
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise returning all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise returning all tasks
*/

@@ -127,6 +110,5 @@ getTasks(parameters?: TasksQuery): Promise<TasksResults>;

* Get one task on the client scope
* @memberof MeiliSearch
* @method getTask
* @param {number} taskUid - Task identifier
* @returns {Promise<Task>} - Promise returning a task
*
* @param taskUid - Task identifier
* @returns Promise returning a task
*/

@@ -137,8 +119,5 @@ getTask(taskUid: number): Promise<Task>;

*
* @memberof MeiliSearch
* @method waitForTasks
* @param {number[]} taskUids - Tasks identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task[]>} - Promise returning an array of tasks
* @param taskUids - Tasks identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise returning an array of tasks
*/

@@ -149,9 +128,5 @@ waitForTasks(taskUids: number[], { timeOutMs, intervalMs }?: WaitOptions): Promise<Task[]>;

*
* @memberof MeiliSearch
* @method waitForTask
*
* @param {number} taskUid - Task identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task>} - Promise returning an array of tasks
* @param taskUid - Task identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise returning an array of tasks
*/

@@ -161,7 +136,5 @@ waitForTask(taskUid: number, { timeOutMs, intervalMs }?: WaitOptions): Promise<Task>;

* Cancel a list of enqueued or processing tasks.
* @memberof MeiliSearch
* @method cancelTasks
* @param {CancelTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -171,7 +144,5 @@ cancelTasks(parameters: CancelTasksQuery): Promise<EnqueuedTask>;

* Delete a list of tasks.
* @memberof MeiliSearch
* @method deleteTasks
* @param {DeleteTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -181,7 +152,5 @@ deleteTasks(parameters?: DeleteTasksQuery): Promise<EnqueuedTask>;

* Get all API keys
* @memberof MeiliSearch
* @method getKeys
* @param {KeysQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<KeysResults>} Promise returning an object with keys
* @param parameters - Parameters to browse the indexes
* @returns Promise returning an object with keys
*/

@@ -191,7 +160,5 @@ getKeys(parameters?: KeysQuery): Promise<KeysResults>;

* Get one API key
* @memberof MeiliSearch
* @method getKey
*
* @param {string} keyOrUid - Key or uid of the API key
* @returns {Promise<Key>} Promise returning a key
* @param keyOrUid - Key or uid of the API key
* @returns Promise returning a key
*/

@@ -201,7 +168,5 @@ getKey(keyOrUid: string): Promise<Key>;

* Create one API key
* @memberof MeiliSearch
* @method createKey
*
* @param {KeyCreation} options - Key options
* @returns {Promise<Key>} Promise returning a key
* @param options - Key options
* @returns Promise returning a key
*/

@@ -211,8 +176,6 @@ createKey(options: KeyCreation): Promise<Key>;

* Update one API key
* @memberof MeiliSearch
* @method updateKey
*
* @param {string} keyOrUid - Key
* @param {KeyUpdate} options - Key options
* @returns {Promise<Key>} Promise returning a key
* @param keyOrUid - Key
* @param options - Key options
* @returns Promise returning a key
*/

@@ -222,7 +185,5 @@ updateKey(keyOrUid: string, options: KeyUpdate): Promise<Key>;

* Delete one API key
* @memberof MeiliSearch
* @method deleteKey
*
* @param {string} keyOrUid - Key
* @returns {Promise<Void>}
* @param keyOrUid - Key
* @returns
*/

@@ -232,5 +193,4 @@ deleteKey(keyOrUid: string): Promise<void>;

* Checks if the server is healthy, otherwise an error will be thrown.
* @memberof MeiliSearch
* @method health
* @returns {Promise<Health>} Promise returning an object with health details
*
* @returns Promise returning an object with health details
*/

@@ -240,5 +200,4 @@ health(): Promise<Health>;

* Checks if the server is healthy, return true or false.
* @memberof MeiliSearch
* @method isHealthy
* @returns {Promise<boolean>} Promise returning a boolean
*
* @returns Promise returning a boolean
*/

@@ -248,5 +207,4 @@ isHealthy(): Promise<boolean>;

* Get the stats of all the database
* @memberof MeiliSearch
* @method getStats
* @returns {Promise<Stats>} Promise returning object of all the stats
*
* @returns Promise returning object of all the stats
*/

@@ -256,5 +214,4 @@ getStats(): Promise<Stats>;

* Get the version of MeiliSearch
* @memberof MeiliSearch
* @method getVersion
* @returns {Promise<Version>} Promise returning object with version details
*
* @returns Promise returning object with version details
*/

@@ -264,5 +221,4 @@ getVersion(): Promise<Version>;

* Creates a dump
* @memberof MeiliSearch
* @method createDump
* @returns {Promise<EnqueuedTask>} Promise returning object of the enqueued task
*
* @returns Promise returning object of the enqueued task
*/

@@ -273,9 +229,6 @@ createDump(): Promise<EnqueuedTask>;

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -282,0 +235,0 @@ generateTenantToken(_apiKeyUid: string, _searchRules: TokenSearchRules, _options?: TokenOptions): string;

@@ -10,9 +10,6 @@ import { Client } from './client';

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -19,0 +16,0 @@ generateTenantToken(apiKeyUid: string, searchRules: TokenSearchRules, options?: TokenOptions): string;

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

// Type definitions for meilisearch 0.30.0
// Type definitions for meilisearch 0.31.0
// Project: https://github.com/meilisearch/meilisearch-js

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

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

import { Config, SearchResponse, SearchParams, IndexObject, IndexOptions, IndexStats, DocumentsQuery, DocumentQuery, Document, DocumentOptions, Settings, Synonyms, StopWords, RankingRules, DistinctAttribute, FilterableAttributes, SortableAttributes, SearchableAttributes, DisplayedAttributes, TypoTolerance, WaitOptions, DocumentsResults, TasksQuery, TasksResults, PaginationSettings, Faceting } from './types';
import { Config, SearchResponse, SearchParams, IndexObject, IndexOptions, IndexStats, DocumentsQuery, DocumentQuery, DocumentOptions, Settings, Synonyms, StopWords, RankingRules, DistinctAttribute, FilterableAttributes, SortableAttributes, SearchableAttributes, DisplayedAttributes, TypoTolerance, WaitOptions, TasksQuery, TasksResults, PaginationSettings, Faceting, ResourceResults } from './types';
import { HttpRequests } from './http-requests';
import { Task, TaskClient } from './task';
import { EnqueuedTask } from './enqueued-task';
declare class Index<T = Record<string, any>> {
declare class Index<T extends Record<string, any> = Record<string, any>> {
uid: string;

@@ -13,5 +13,5 @@ primaryKey: string | undefined;

/**
* @param {Config} config Request configuration options
* @param {string} uid UID of the index
* @param {string} [primaryKey] Primary Key of the index
* @param config - Request configuration options
* @param uid - UID of the index
* @param primaryKey - Primary Key of the index
*/

@@ -21,28 +21,22 @@ constructor(config: Config, uid: string, primaryKey?: string);

* Search for documents into an index
* @memberof Index
* @method search
* @template T
* @param {string | null} query? Query string
* @param {SearchParams} options? Search options
* @param {Partial<Request>} config? Additional request configuration options
* @returns {Promise<SearchResponse<T>>} Promise containing the search response
*
* @param query - Query string
* @param options - Search options
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
search<T = Record<string, any>>(query?: string | null, options?: SearchParams, config?: Partial<Request>): Promise<SearchResponse<T>>;
search<D = T>(query?: string | null, options?: SearchParams, config?: Partial<Request>): Promise<SearchResponse<D>>;
/**
* Search for documents into an index using the GET method
* @memberof Index
* @method search
* @template T
* @param {string | null} query? Query string
* @param {SearchParams} options? Search options
* @param {Partial<Request>} config? Additional request configuration options
* @returns {Promise<SearchResponse<T>>} Promise containing the search response
*
* @param query - Query string
* @param options - Search options
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
searchGet<T = Record<string, any>>(query?: string | null, options?: SearchParams, config?: Partial<Request>): Promise<SearchResponse<T>>;
searchGet<D = T>(query?: string | null, options?: SearchParams, config?: Partial<Request>): Promise<SearchResponse<D>>;
/**
* Get index information.
* @memberof Index
* @method getRawInfo
*
* @returns {Promise<IndexObject>} Promise containing index information
* @returns Promise containing index information
*/

@@ -52,5 +46,4 @@ getRawInfo(): Promise<IndexObject>;

* Fetch and update Index information.
* @memberof Index
* @method fetchInfo
* @returns {Promise<this>} Promise to the current Index object with updated information
*
* @returns Promise to the current Index object with updated information
*/

@@ -60,5 +53,4 @@ fetchInfo(): Promise<this>;

* Get Primary Key.
* @memberof Index
* @method fetchPrimaryKey
* @returns {Promise<string | undefined>} Promise containing the Primary Key of the index
*
* @returns Promise containing the Primary Key of the index
*/

@@ -68,9 +60,7 @@ fetchPrimaryKey(): Promise<string | undefined>;

* Create an index.
* @memberof Index
* @method create
* @template T
* @param {string} uid Unique identifier of the Index
* @param {IndexOptions} options Index options
* @param {Config} config Request configuration options
* @returns {Promise<EnqueuedTask>} Newly created Index object
*
* @param uid - Unique identifier of the Index
* @param options - Index options
* @param config - Request configuration options
* @returns Newly created Index object
*/

@@ -80,6 +70,5 @@ static create(uid: string, options: IndexOptions | undefined, config: Config): Promise<EnqueuedTask>;

* Update an index.
* @memberof Index
* @method update
* @param {IndexOptions} data Data to update
* @returns {Promise<this>} Promise to the current Index object with updated information
*
* @param data - Data to update
* @returns Promise to the current Index object with updated information
*/

@@ -89,5 +78,4 @@ update(data: IndexOptions): Promise<EnqueuedTask>;

* Delete an index.
* @memberof Index
* @method delete
* @returns {Promise<void>} Promise which resolves when index is deleted successfully
*
* @returns Promise which resolves when index is deleted successfully
*/

@@ -98,7 +86,4 @@ delete(): Promise<EnqueuedTask>;

*
* @memberof Indexes
* @method getTasks
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise containing all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise containing all tasks
*/

@@ -109,7 +94,4 @@ getTasks(parameters?: TasksQuery): Promise<TasksResults>;

*
* @memberof Indexes
* @method getTask
* @param {number} taskUid - Task identifier
*
* @returns {Promise<Task>} - Promise containing a task
* @param taskUid - Task identifier
* @returns Promise containing a task
*/

@@ -120,8 +102,5 @@ getTask(taskUid: number): Promise<Task>;

*
* @memberof Indexes
* @method waitForTasks
* @param {number[]} taskUids - Tasks identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task[]>} - Promise containing an array of tasks
* @param taskUids - Tasks identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise containing an array of tasks
*/

@@ -132,84 +111,67 @@ waitForTasks(taskUids: number[], { timeOutMs, intervalMs }?: WaitOptions): Promise<Task[]>;

*
* @memberof Indexes
* @method waitForTask
* @param {number} taskUid - Task identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task>} - Promise containing an array of tasks
* @param taskUid - Task identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise containing an array of tasks
*/
waitForTask(taskUid: number, { timeOutMs, intervalMs }?: WaitOptions): Promise<Task>;
/**
* get stats of an index
* @memberof Index
* @method getStats
* @returns {Promise<IndexStats>} Promise containing object with stats of the index
* Get stats of an index
*
* @returns Promise containing object with stats of the index
*/
getStats(): Promise<IndexStats>;
/**
* get documents of an index
* @memberof Index
* @method getDocuments
* @template T
* @param {DocumentsQuery<T>} [parameters={}] Parameters to browse the documents
* @returns {Promise<DocumentsResults<T>>>} Promise containing Document responses
* Get documents of an index
*
* @param parameters - Parameters to browse the documents
* @returns Promise containing Document responses
*/
getDocuments<T = Record<string, any>>(parameters?: DocumentsQuery<T>): Promise<DocumentsResults<T>>;
getDocuments<D extends Record<string, any> = T>(parameters?: DocumentsQuery<D>): Promise<ResourceResults<D[]>>;
/**
* Get one document
* @memberof Index
* @method getDocument
* @template T
* @param {string | number} documentId Document ID
* @param {DocumentQuery<T>} [parameters={}] Parameters applied on a document
* @returns {Promise<Document<T>>} Promise containing Document response
*
* @param documentId - Document ID
* @param parameters - Parameters applied on a document
* @returns Promise containing Document response
*/
getDocument<T = Record<string, any>>(documentId: string | number, parameters?: DocumentQuery<T>): Promise<Document<T>>;
getDocument<D extends Record<string, any> = T>(documentId: string | number, parameters?: DocumentQuery<T>): Promise<D>;
/**
* Add or replace multiples documents to an index
* @memberof Index
* @method addDocuments
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/replace
* @param {DocumentOptions} options? Options on document addition
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param documents - Array of Document objects to add/replace
* @param options - Options on document addition
* @returns Promise containing an EnqueuedTask
*/
addDocuments(documents: Array<Document<T>>, options?: DocumentOptions): Promise<EnqueuedTask>;
addDocuments(documents: T[], options?: DocumentOptions): Promise<EnqueuedTask>;
/**
* Add or replace multiples documents to an index in batches
* @memberof Index
* @method addDocumentsInBatches
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/replace
* @param {number} batchSize Size of the batch
* @param {DocumentOptions} options? Options on document addition
* @returns {Promise<EnqueuedTasks>} Promise containing array of enqueued task objects for each batch
*
* @param documents - Array of Document objects to add/replace
* @param batchSize - Size of the batch
* @param options - Options on document addition
* @returns Promise containing array of enqueued task objects for each batch
*/
addDocumentsInBatches(documents: Array<Document<T>>, batchSize?: number, options?: DocumentOptions): Promise<EnqueuedTask[]>;
addDocumentsInBatches(documents: T[], batchSize?: number, options?: DocumentOptions): Promise<EnqueuedTask[]>;
/**
* Add or update multiples documents to an index
* @memberof Index
* @method updateDocuments
* @param {Array<Document<Partial<T>>>} documents Array of Document objects to add/update
* @param {DocumentOptions} options? Options on document update
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documents - Array of Document objects to add/update
* @param options - Options on document update
* @returns Promise containing an EnqueuedTask
*/
updateDocuments(documents: Array<Document<Partial<T>>>, options?: DocumentOptions): Promise<EnqueuedTask>;
updateDocuments(documents: Array<Partial<T>>, options?: DocumentOptions): Promise<EnqueuedTask>;
/**
* Add or update multiples documents to an index in batches
* @memberof Index
* @method updateDocuments
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/update
* @param {number} batchSize Size of the batch
* @param {DocumentOptions} options? Options on document update
* @returns {Promise<EnqueuedTasks>} Promise containing array of enqueued task objects for each batch
*
* @param documents - Array of Document objects to add/update
* @param batchSize - Size of the batch
* @param options - Options on document update
* @returns Promise containing array of enqueued task objects for each batch
*/
updateDocumentsInBatches(documents: Array<Document<Partial<T>>>, batchSize?: number, options?: DocumentOptions): Promise<EnqueuedTask[]>;
updateDocumentsInBatches(documents: Array<Partial<T>>, batchSize?: number, options?: DocumentOptions): Promise<EnqueuedTask[]>;
/**
* Delete one document
* @memberof Index
* @method deleteDocument
* @param {string | number} documentId Id of Document to delete
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documentId - Id of Document to delete
* @returns Promise containing an EnqueuedTask
*/

@@ -219,6 +181,5 @@ deleteDocument(documentId: string | number): Promise<EnqueuedTask>;

* Delete multiples documents of an index
* @memberof Index
* @method deleteDocuments
* @param {string[] | number[]} documentsIds Array of Document Ids to delete
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documentsIds - Array of Document Ids to delete
* @returns Promise containing an EnqueuedTask
*/

@@ -228,5 +189,4 @@ deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedTask>;

* Delete all documents of an index
* @memberof Index
* @method deleteAllDocuments
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -236,14 +196,11 @@ deleteAllDocuments(): Promise<EnqueuedTask>;

* Retrieve all settings
* @memberof Index
* @method getSettings
* @returns {Promise<Settings>} Promise containing Settings object
*
* @returns Promise containing Settings object
*/
getSettings(): Promise<Settings>;
/**
* Update all settings
* Any parameters not provided will be left unchanged.
* @memberof Index
* @method updateSettings
* @param {Settings} settings Object containing parameters with their updated values
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* Update all settings Any parameters not provided will be left unchanged.
*
* @param settings - Object containing parameters with their updated values
* @returns Promise containing an EnqueuedTask
*/

@@ -253,5 +210,4 @@ updateSettings(settings: Settings): Promise<EnqueuedTask>;

* Reset settings.
* @memberof Index
* @method resetSettings
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -261,5 +217,4 @@ resetSettings(): Promise<EnqueuedTask>;

* Get the pagination settings.
* @memberof Index
* @method getPagination
* @returns {Promise<PaginationSetting>} Promise containing object of pagination settings
*
* @returns Promise containing object of pagination settings
*/

@@ -269,6 +224,5 @@ getPagination(): Promise<PaginationSettings>;

* Update the pagination settings.
* @memberof Index
* @method updatePagination
* @param {PaginationSettings} pagination Pagination object
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param pagination - Pagination object
* @returns Promise containing an EnqueuedTask
*/

@@ -278,5 +232,4 @@ updatePagination(pagination: PaginationSettings): Promise<EnqueuedTask>;

* Reset the pagination settings.
* @memberof Index
* @method resetPagination
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -286,5 +239,4 @@ resetPagination(): Promise<EnqueuedTask>;

* Get the list of all synonyms
* @memberof Index
* @method getSynonyms
* @returns {Promise<object>} Promise containing object of synonym mappings
*
* @returns Promise containing object of synonym mappings
*/

@@ -294,6 +246,5 @@ getSynonyms(): Promise<object>;

* Update the list of synonyms. Overwrite the old list.
* @memberof Index
* @method updateSynonyms
* @param {Synonyms} synonyms Mapping of synonyms with their associated words
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param synonyms - Mapping of synonyms with their associated words
* @returns Promise containing an EnqueuedTask
*/

@@ -303,5 +254,4 @@ updateSynonyms(synonyms: Synonyms): Promise<EnqueuedTask>;

* Reset the synonym list to be empty again
* @memberof Index
* @method resetSynonyms
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -311,5 +261,4 @@ resetSynonyms(): Promise<EnqueuedTask>;

* Get the list of all stop-words
* @memberof Index
* @method getStopWords
* @returns {Promise<string[]>} Promise containing array of stop-words
*
* @returns Promise containing array of stop-words
*/

@@ -319,6 +268,5 @@ getStopWords(): Promise<string[]>;

* Update the list of stop-words. Overwrite the old list.
* @memberof Index
* @method updateStopWords
* @param {StopWords} stopWords Array of strings that contains the stop-words.
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param stopWords - Array of strings that contains the stop-words.
* @returns Promise containing an EnqueuedTask
*/

@@ -328,5 +276,4 @@ updateStopWords(stopWords: StopWords): Promise<EnqueuedTask>;

* Reset the stop-words list to be empty again
* @memberof Index
* @method resetStopWords
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -336,5 +283,4 @@ resetStopWords(): Promise<EnqueuedTask>;

* Get the list of all ranking-rules
* @memberof Index
* @method getRankingRules
* @returns {Promise<string[]>} Promise containing array of ranking-rules
*
* @returns Promise containing array of ranking-rules
*/

@@ -344,6 +290,6 @@ getRankingRules(): Promise<string[]>;

* Update the list of ranking-rules. Overwrite the old list.
* @memberof Index
* @method updateRankingRules
* @param {RankingRules} rankingRules Array that contain ranking rules sorted by order of importance.
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param rankingRules - Array that contain ranking rules sorted by order of
* importance.
* @returns Promise containing an EnqueuedTask
*/

@@ -353,5 +299,4 @@ updateRankingRules(rankingRules: RankingRules): Promise<EnqueuedTask>;

* Reset the ranking rules list to its default value
* @memberof Index
* @method resetRankingRules
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -361,5 +306,4 @@ resetRankingRules(): Promise<EnqueuedTask>;

* Get the distinct-attribute
* @memberof Index
* @method getDistinctAttribute
* @returns {Promise<string | null>} Promise containing the distinct-attribute of the index
*
* @returns Promise containing the distinct-attribute of the index
*/

@@ -369,6 +313,5 @@ getDistinctAttribute(): Promise<string | null>;

* Update the distinct-attribute.
* @memberof Index
* @method updateDistinctAttribute
* @param {DistinctAttribute} distinctAttribute Field name of the distinct-attribute
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param distinctAttribute - Field name of the distinct-attribute
* @returns Promise containing an EnqueuedTask
*/

@@ -378,5 +321,4 @@ updateDistinctAttribute(distinctAttribute: DistinctAttribute): Promise<EnqueuedTask>;

* Reset the distinct-attribute.
* @memberof Index
* @method resetDistinctAttribute
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -386,5 +328,4 @@ resetDistinctAttribute(): Promise<EnqueuedTask>;

* Get the filterable-attributes
* @memberof Index
* @method getFilterableAttributes
* @returns {Promise<string[]>} Promise containing an array of filterable-attributes
*
* @returns Promise containing an array of filterable-attributes
*/

@@ -394,6 +335,6 @@ getFilterableAttributes(): Promise<string[]>;

* Update the filterable-attributes.
* @memberof Index
* @method updateFilterableAttributes
* @param {FilterableAttributes} filterableAttributes Array of strings containing the attributes that can be used as filters at query time
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param filterableAttributes - Array of strings containing the attributes
* that can be used as filters at query time
* @returns Promise containing an EnqueuedTask
*/

@@ -403,5 +344,4 @@ updateFilterableAttributes(filterableAttributes: FilterableAttributes): Promise<EnqueuedTask>;

* Reset the filterable-attributes.
* @memberof Index
* @method resetFilterableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -411,5 +351,4 @@ resetFilterableAttributes(): Promise<EnqueuedTask>;

* Get the sortable-attributes
* @memberof Index
* @method getSortableAttributes
* @returns {Promise<string[]>} Promise containing array of sortable-attributes
*
* @returns Promise containing array of sortable-attributes
*/

@@ -419,6 +358,6 @@ getSortableAttributes(): Promise<string[]>;

* Update the sortable-attributes.
* @memberof Index
* @method updateSortableAttributes
* @param {SortableAttributes} sortableAttributes Array of strings containing the attributes that can be used to sort search results at query time
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param sortableAttributes - Array of strings containing the attributes that
* can be used to sort search results at query time
* @returns Promise containing an EnqueuedTask
*/

@@ -428,5 +367,4 @@ updateSortableAttributes(sortableAttributes: SortableAttributes): Promise<EnqueuedTask>;

* Reset the sortable-attributes.
* @memberof Index
* @method resetSortableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -436,5 +374,4 @@ resetSortableAttributes(): Promise<EnqueuedTask>;

* Get the searchable-attributes
* @memberof Index
* @method getSearchableAttributes
* @returns {Promise<string[]>} Promise containing array of searchable-attributes
*
* @returns Promise containing array of searchable-attributes
*/

@@ -444,6 +381,6 @@ getSearchableAttributes(): Promise<string[]>;

* Update the searchable-attributes.
* @memberof Index
* @method updateSearchableAttributes
* @param {SearchableAttributes} searchableAttributes Array of strings that contains searchable attributes sorted by order of importance(most to least important)
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param searchableAttributes - Array of strings that contains searchable
* attributes sorted by order of importance(most to least important)
* @returns Promise containing an EnqueuedTask
*/

@@ -453,5 +390,4 @@ updateSearchableAttributes(searchableAttributes: SearchableAttributes): Promise<EnqueuedTask>;

* Reset the searchable-attributes.
* @memberof Index
* @method resetSearchableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -461,5 +397,4 @@ resetSearchableAttributes(): Promise<EnqueuedTask>;

* Get the displayed-attributes
* @memberof Index
* @method getDisplayedAttributes
* @returns {Promise<string[]>} Promise containing array of displayed-attributes
*
* @returns Promise containing array of displayed-attributes
*/

@@ -469,6 +404,6 @@ getDisplayedAttributes(): Promise<string[]>;

* Update the displayed-attributes.
* @memberof Index
* @method updateDisplayedAttributes
* @param {DisplayedAttributes} displayedAttributes Array of strings that contains attributes of an index to display
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param displayedAttributes - Array of strings that contains attributes of
* an index to display
* @returns Promise containing an EnqueuedTask
*/

@@ -478,5 +413,4 @@ updateDisplayedAttributes(displayedAttributes: DisplayedAttributes): Promise<EnqueuedTask>;

* Reset the displayed-attributes.
* @memberof Index
* @method resetDisplayedAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -486,5 +420,4 @@ resetDisplayedAttributes(): Promise<EnqueuedTask>;

* Get the typo tolerance settings.
* @memberof Index
* @method getTypoTolerance
* @returns {Promise<string[]>} Promise containing the typo tolerance settings.
*
* @returns Promise containing the typo tolerance settings.
*/

@@ -494,6 +427,6 @@ getTypoTolerance(): Promise<string[]>;

* Update the typo tolerance settings.
* @memberof Index
* @method updateTypoTolerance
* @param {TypoTolerance} typoTolerance Object containing the custom typo tolerance settings.
* @returns {Promise<EnqueuedTask>} Promise containing object of the enqueued update
*
* @param typoTolerance - Object containing the custom typo tolerance
* settings.
* @returns Promise containing object of the enqueued update
*/

@@ -503,5 +436,4 @@ updateTypoTolerance(typoTolerance: TypoTolerance): Promise<EnqueuedTask>;

* Reset the typo tolerance settings.
* @memberof Index
* @method resetTypoTolerance
* @returns {Promise<EnqueuedTask>} Promise containing object of the enqueued update
*
* @returns Promise containing object of the enqueued update
*/

@@ -511,5 +443,4 @@ resetTypoTolerance(): Promise<EnqueuedTask>;

* Get the faceting settings.
* @memberof Index
* @method getFaceting
* @returns {Promise<Faceting>} Promise containing object of faceting index settings
*
* @returns Promise containing object of faceting index settings
*/

@@ -519,6 +450,5 @@ getFaceting(): Promise<Faceting>;

* Update the faceting settings.
* @memberof Index
* @method updateFaceting
* @param {Faceting} faceting Faceting index settings object
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param faceting - Faceting index settings object
* @returns Promise containing an EnqueuedTask
*/

@@ -528,5 +458,4 @@ updateFaceting(faceting: Faceting): Promise<EnqueuedTask>;

* Reset the faceting settings.
* @memberof Index
* @method resetFaceting
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -533,0 +462,0 @@ resetFaceting(): Promise<EnqueuedTask>;

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

export declare const PACKAGE_VERSION = "0.30.0";
export declare const PACKAGE_VERSION = "0.31.0";
//# sourceMappingURL=package-version.d.ts.map

@@ -24,5 +24,4 @@ import { Config, WaitOptions, TasksQuery, TasksResults, TaskObject, CancelTasksQuery, DeleteTasksQuery } from './types';

*
* @param {number} uid - unique identifier of the task
*
* @returns { Promise<Task> }
* @param uid - Unique identifier of the task
* @returns
*/

@@ -33,5 +32,4 @@ getTask(uid: number): Promise<Task>;

*
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise containing all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise containing all tasks
*/

@@ -42,6 +40,5 @@ getTasks(parameters?: TasksQuery): Promise<TasksResults>;

*
* @param {number} taskUid Task identifier
* @param {WaitOptions} options Additional configuration options
*
* @returns {Promise<Task>} Promise returning a task after it has been processed
* @param taskUid - Task identifier
* @param options - Additional configuration options
* @returns Promise returning a task after it has been processed
*/

@@ -52,6 +49,5 @@ waitForTask(taskUid: number, { timeOutMs, intervalMs }?: WaitOptions): Promise<Task>;

*
* @param {number[]} taskUids Tasks identifier list
* @param {WaitOptions} options Wait options
*
* @returns {Promise<Task[]>} Promise returning a list of tasks after they have been processed
* @param taskUids - Tasks identifier list
* @param options - Wait options
* @returns Promise returning a list of tasks after they have been processed
*/

@@ -61,7 +57,5 @@ waitForTasks(taskUids: number[], { timeOutMs, intervalMs }?: WaitOptions): Promise<Task[]>;

* Cancel a list of enqueued or processing tasks.
* @memberof Tasks
* @method cancelTasks
* @param {CancelTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -71,7 +65,5 @@ cancelTasks(parameters?: CancelTasksQuery): Promise<EnqueuedTask>;

* Delete a list tasks.
* @memberof Tasks
* @method deleteTasks
* @param {DeleteTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -78,0 +70,0 @@ deleteTasks(parameters?: DeleteTasksQuery): Promise<EnqueuedTask>;

@@ -8,9 +8,6 @@ import { Config, TokenSearchRules, TokenOptions } from './types';

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -17,0 +14,0 @@ generateTenantToken(apiKeyUid: string, searchRules: TokenSearchRules, options?: TokenOptions): string;

@@ -106,5 +106,2 @@ import { Task } from '../task';

};
export declare type Document<T = Record<string, any>> = T;
export declare type Documents<T = Record<string, any>> = Array<Document<T>>;
export declare type DocumentsResults<T = Record<string, any>> = ResourceResults<Documents<T>> & {};
export declare type FilterableAttributes = string[] | null;

@@ -292,2 +289,4 @@ export declare type DistinctAttribute = string | null;

INDEX_CREATION_FAILED = "index_creation_failed",
/** @see https://docs.meilisearch.com/errors/#missing_index_uid */
MISSING_INDEX_UID = "missing_index_uid",
/** @see https://docs.meilisearch.com/errors/#index_already_exists */

@@ -301,2 +300,6 @@ INDEX_ALREADY_EXISTS = "index_already_exists",

INDEX_NOT_ACCESSIBLE = "index_not_accessible",
/** @see https://docs.meilisearch.com/errors/#invalid_index_offset */
INVALID_INDEX_OFFSET = "invalid_index_offset",
/** @see https://docs.meilisearch.com/errors/#invalid_index_limit */
INVALID_INDEX_LIMIT = "invalid_index_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_state */

@@ -308,2 +311,4 @@ INVALID_STATE = "invalid_state",

INDEX_PRIMARY_KEY_ALREADY_EXISTS = "index_primary_key_already_exists",
/** @see https://docs.meilisearch.com/errors/#invalid_index_primary_key */
INVALID_INDEX_PRIMARY_KEY = "invalid_index_primary_key",
/** @see https://docs.meilisearch.com/errors/#max_fields_limit_exceeded */

@@ -319,2 +324,8 @@ DOCUMENTS_FIELDS_LIMIT_REACHED = "document_fields_limit_reached",

MISSING_CONTENT_TYPE = "missing_content_type",
/** @see https://docs.meilisearch.com/errors/#invalid_document_fields */
INVALID_DOCUMENT_FIELDS = "invalid_document_fields",
/** @see https://docs.meilisearch.com/errors/#invalid_document_limit */
INVALID_DOCUMENT_LIMIT = "invalid_document_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_document_offset */
INVALID_DOCUMENT_OFFSET = "invalid_document_offset",
/** @see https://docs.meilisearch.com/errors/#payload_too_large */

@@ -334,8 +345,38 @@ PAYLOAD_TOO_LARGE = "payload_too_large",

INVALID_REQUEST = "invalid_request",
/** @see https://docs.meilisearch.com/errors/#invalid_filter */
INVALID_FILTER = "invalid_filter",
/** @see https://docs.meilisearch.com/errors/#invalid_sort */
INVALID_SORT = "invalid_sort",
/** @see https://docs.meilisearch.com/errors/#invalid_geo_field */
INVALID_GEO_FIELD = "invalid_geo_field",
/** @see https://docs.meilisearch.com/errors/#invalid_document_geo_field */
INVALID_DOCUMENT_GEO_FIELD = "invalid_document_geo_field",
/** @see https://docs.meilisearch.com/errors/#invalid_search_q */
INVALID_SEARCH_Q = "invalid_search_q",
/** @see https://docs.meilisearch.com/errors/#invalid_search_offset */
INVALID_SEARCH_OFFSET = "invalid_search_offset",
/** @see https://docs.meilisearch.com/errors/#invalid_search_limit */
INVALID_SEARCH_LIMIT = "invalid_search_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_search_page */
INVALID_SEARCH_PAGE = "invalid_search_page",
/** @see https://docs.meilisearch.com/errors/#invalid_search_hits_per_page */
INVALID_SEARCH_HITS_PER_PAGE = "invalid_search_hits_per_page",
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_retrieve */
INVALID_SEARCH_ATTRIBUTES_TO_RETRIEVE = "invalid_search_attributes_to_retrieve",
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_crop */
INVALID_SEARCH_ATTRIBUTES_TO_CROP = "invalid_search_attributes_to_crop",
/** @see https://docs.meilisearch.com/errors/#invalid_search_crop_length */
INVALID_SEARCH_CROP_LENGTH = "invalid_search_crop_length",
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_highlight */
INVALID_SEARCH_ATTRIBUTES_TO_HIGHLIGHT = "invalid_search_attributes_to_highlight",
/** @see https://docs.meilisearch.com/errors/#invalid_search_show_matches_position */
INVALID_SEARCH_SHOW_MATCHES_POSITION = "invalid_search_show_matches_position",
/** @see https://docs.meilisearch.com/errors/#invalid_search_filter */
INVALID_SEARCH_FILTER = "invalid_search_filter",
/** @see https://docs.meilisearch.com/errors/#invalid_search_sort */
INVALID_SEARCH_SORT = "invalid_search_sort",
/** @see https://docs.meilisearch.com/errors/#invalid_search_facets */
INVALID_SEARCH_FACETS = "invalid_search_facets",
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_pre_tag */
INVALID_SEARCH_HIGHLIGHT_PRE_TAG = "invalid_search_highlight_pre_tag",
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_post_tag */
INVALID_SEARCH_HIGHLIGHT_POST_TAG = "invalid_search_highlight_post_tag",
/** @see https://docs.meilisearch.com/errors/#invalid_search_crop_marker */
INVALID_SEARCH_CROP_MARKER = "invalid_search_crop_marker",
/** @see https://docs.meilisearch.com/errors/#invalid_search_matching_strategy */
INVALID_SEARCH_MATCHING_STRATEGY = "invalid_search_matching_strategy",
/** @see https://docs.meilisearch.com/errors/#bad_request */

@@ -359,4 +400,14 @@ BAD_REQUEST = "bad_request",

API_KEY_NOT_FOUND = "api_key_not_found",
/** @see https://docs.meilisearch.com/errors/#missing_parameter */
MISSING_PARAMETER = "missing_parameter",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_uid */
IMMUTABLE_API_KEY_UID = "immutable_api_key_uid",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_actions */
IMMUTABLE_API_KEY_ACTIONS = "immutable_api_key_actions",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_indexes */
IMMUTABLE_API_KEY_INDEXES = "immutable_api_key_indexes",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_expires_at */
IMMUTABLE_API_KEY_EXPIRES_AT = "immutable_api_key_expires_at",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_created_at */
IMMUTABLE_API_KEY_CREATED_AT = "immutable_api_key_created_at",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_updated_at */
IMMUTABLE_API_KEY_UPDATED_AT = "immutable_api_key_updated_at",
/** @see https://docs.meilisearch.com/errors/#missing_authorization_header */

@@ -374,18 +425,80 @@ MISSING_AUTHORIZATION_HEADER = "missing_authorization_header",

DUMP_NOT_FOUND = "dump_not_found",
/** @see https://docs.meilisearch.com/errors/#duplicate_index_found */
DUPLICATE_INDEX_FOUND = "duplicate_index_found",
/** @see https://docs.meilisearch.com/errors/#invalid_swap_duplicate_index_found */
INVALID_SWAP_DUPLICATE_INDEX_FOUND = "invalid_swap_duplicate_index_found",
/** @see https://docs.meilisearch.com/errors/#invalid_swap_indexes */
INVALID_SWAP_INDEXES = "invalid_swap_indexes",
/** @see https://docs.meilisearch.com/errors/#missing_swap_indexes */
MISSING_SWAP_INDEXES = "missing_swap_indexes",
/** @see https://docs.meilisearch.com/errors/#missing_master_key */
MISSING_MASTER_KEY = "missing_master_key",
/** @see http://docs.meilisearch.com/errors/#invalid_task_types_filter */
INVALID_TASK_TYPES_FILTER = "invalid_task_types_filter",
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses_filter */
INVALID_TASK_STATUSES_FILTER = "invalid_task_statuses_filter",
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by_filter */
INVALID_TASK_CANCELED_BY_FILTER = "invalid_task_canceled_by_filter",
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids_filter */
INVALID_TASK_UIDS_FILTER = "invalid_task_uids_filter",
/** @see http://docs.meilisearch.com/errors/#invalid_task_date_filter */
INVALID_TASK_DATE_FILTER = "invalid_task_date_filter",
/** @see http://docs.meilisearch.com/errors/#invalid_task_types */
INVALID_TASK_TYPES = "invalid_task_types",
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids */
INVALID_TASK_UIDS = "invalid_task_uids",
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses */
INVALID_TASK_STATUSES = "invalid_task_statuses",
/** @see http://docs.meilisearch.com/errors/#invalid_task_limit */
INVALID_TASK_LIMIT = "invalid_task_limit",
/** @see http://docs.meilisearch.com/errors/#invalid_task_from */
INVALID_TASK_FROM = "invalid_task_from",
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by */
INVALID_TASK_CANCELED_BY = "invalid_task_canceled_by",
/** @see http://docs.meilisearch.com/errors/#missing_task_filters */
MISSING_TASK_FILTERS = "missing_task_filters"
MISSING_TASK_FILTERS = "missing_task_filters",
/** @see http://docs.meilisearch.com/errors/#too_many_open_files */
TOO_MANY_OPEN_FILES = "too_many_open_files",
/** @see http://docs.meilisearch.com/errors/#io_error */
IO_ERROR = "io_error",
/** @see http://docs.meilisearch.com/errors/#invalid_task_index_uids */
INVALID_TASK_INDEX_UIDS = "invalid_task_index_uids",
/** @see http://docs.meilisearch.com/errors/#immutable_index_uid */
IMMUTABLE_INDEX_UID = "immutable_index_uid",
/** @see http://docs.meilisearch.com/errors/#immutable_index_created_at */
IMMUTABLE_INDEX_CREATED_AT = "immutable_index_created_at",
/** @see http://docs.meilisearch.com/errors/#immutable_index_updated_at */
IMMUTABLE_INDEX_UPDATED_AT = "immutable_index_updated_at",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_displayed_attributes */
INVALID_SETTINGS_DISPLAYED_ATTRIBUTES = "invalid_settings_displayed_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_searchable_attributes */
INVALID_SETTINGS_SEARCHABLE_ATTRIBUTES = "invalid_settings_searchable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_filterable_attributes */
INVALID_SETTINGS_FILTERABLE_ATTRIBUTES = "invalid_settings_filterable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_sortable_attributes */
INVALID_SETTINGS_SORTABLE_ATTRIBUTES = "invalid_settings_sortable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_ranking_rules */
INVALID_SETTINGS_RANKING_RULES = "invalid_settings_ranking_rules",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_stop_words */
INVALID_SETTINGS_STOP_WORDS = "invalid_settings_stop_words",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_synonyms */
INVALID_SETTINGS_SYNONYMS = "invalid_settings_synonyms",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_distinct_attribute */
INVALID_SETTINGS_DISTINCT_ATTRIBUTE = "invalid_settings_distinct_attribute",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_typo_tolerance */
INVALID_SETTINGS_TYPO_TOLERANCE = "invalid_settings_typo_tolerance",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_faceting */
INVALID_SETTINGS_FACETING = "invalid_settings_faceting",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_pagination */
INVALID_SETTINGS_PAGINATION = "invalid_settings_pagination",
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_enqueued_at */
INVALID_TASK_BEFORE_ENQUEUED_AT = "invalid_task_before_enqueued_at",
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_enqueued_at */
INVALID_TASK_AFTER_ENQUEUED_AT = "invalid_task_after_enqueued_at",
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_started_at */
INVALID_TASK_BEFORE_STARTED_AT = "invalid_task_before_started_at",
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_started_at */
INVALID_TASK_AFTER_STARTED_AT = "invalid_task_after_started_at",
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_finished_at */
INVALID_TASK_BEFORE_FINISHED_AT = "invalid_task_before_finished_at",
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_finished_at */
INVALID_TASK_AFTER_FINISHED_AT = "invalid_task_after_finished_at",
/** @see http://docs.meilisearch.com/errors/#missing_api_key_actions */
MISSING_API_KEY_ACTIONS = "missing_api_key_actions",
/** @see http://docs.meilisearch.com/errors/#missing_api_key_indexes */
MISSING_API_KEY_INDEXES = "missing_api_key_indexes",
/** @see http://docs.meilisearch.com/errors/#missing_api_key_expires_at */
MISSING_API_KEY_EXPIRES_AT = "missing_api_key_expires_at",
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_limit */
INVALID_API_KEY_LIMIT = "invalid_api_key_limit",
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_offset */
INVALID_API_KEY_OFFSET = "invalid_api_key_offset"
}

@@ -392,0 +505,0 @@ export declare type TokenIndexRules = {

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

/**
* Removes undefined entries from object
*/
/** Removes undefined entries from object */
declare function removeUndefinedFromObject(obj: Record<string, any>): object;

@@ -5,0 +3,0 @@ declare function sleep(ms: number): Promise<void>;

{
"name": "meilisearch",
"version": "0.30.0",
"version": "0.31.0",
"description": "The Meilisearch JS client for Node.js and the browser.",

@@ -75,6 +75,6 @@ "keywords": [

"devDependencies": {
"@babel/preset-env": "^7.19.4",
"@rollup/plugin-babel": "^6.0.2",
"@rollup/plugin-commonjs": "23.0.3",
"@rollup/plugin-json": "^5.0.1",
"@babel/preset-env": "^7.20.2",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.0.1",

@@ -92,3 +92,3 @@ "@types/jest": "^27.5.0",

"eslint-plugin-jest": "^24.1.8",
"eslint-plugin-jsdoc": "^32.2.0",
"eslint-plugin-jsdoc": "^39.6.4",
"eslint-plugin-node": "11",

@@ -98,2 +98,3 @@ "eslint-plugin-prettier": "^3.1.4",

"eslint-plugin-standard": "5",
"eslint-plugin-tsdoc": "^0.2.17",
"gzip-size": "^6.0.0",

@@ -107,2 +108,3 @@ "jest": "^26.6.3",

"prettier": "^2.2.1",
"prettier-plugin-jsdoc": "^0.4.2",
"pretty-bytes": "^5.6.0",

@@ -109,0 +111,0 @@ "rollup": "^2.79.1",

@@ -10,3 +10,3 @@ <p align="center">

<a href="https://docs.meilisearch.com">Documentation</a> |
<a href="https://slack.meilisearch.com">Slack</a> |
<a href="https://discord.meilisearch.com">Discord</a> |
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |

@@ -333,3 +333,3 @@ <a href="https://www.meilisearch.com">Website</a> |

This package only guarantees the compatibility with the [version v0.30.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0).
This package only guarantees the compatibility with the [version v1.0.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v1.0.0).

@@ -336,0 +336,0 @@ ## 💡 Learn more

@@ -47,3 +47,4 @@ /*

* Creates new MeiliSearch instance
* @param {Config} config Configuration object
*
* @param config - Configuration object
*/

@@ -58,7 +59,5 @@ constructor(config: Config) {

* Return an Index instance
* @memberof MeiliSearch
* @method index
* @template T
* @param {string} indexUid The index UID
* @returns {Index<T>} Instance of Index
*
* @param indexUid - The index UID
* @returns Instance of Index
*/

@@ -70,9 +69,7 @@ index<T = any>(indexUid: string): Index<T> {

/**
* Gather information about an index by calling MeiliSearch and
* return an Index instance with the gathered information
* @memberof MeiliSearch
* @method getIndex
* @template T
* @param {string} indexUid The index UID
* @returns {Promise<Index<T>>} Promise returning Index instance
* Gather information about an index by calling MeiliSearch and return an
* Index instance with the gathered information
*
* @param indexUid - The index UID
* @returns Promise returning Index instance
*/

@@ -84,8 +81,7 @@ async getIndex<T = any>(indexUid: string): Promise<Index<T>> {

/**
* Gather information about an index by calling MeiliSearch and
* return the raw JSON response
* @memberof MeiliSearch
* @method getRawIndex
* @param {string} indexUid The index UID
* @returns {Promise<IndexObject>} Promise returning index information
* Gather information about an index by calling MeiliSearch and return the raw
* JSON response
*
* @param indexUid - The index UID
* @returns Promise returning index information
*/

@@ -98,7 +94,5 @@ async getRawIndex(indexUid: string): Promise<IndexObject> {

* Get all the indexes as Index instances.
* @memberof MeiliSearch
* @method getIndexes
* @param {IndexesQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<IndexesResults<Index[]>>} Promise returning array of raw index information
* @param parameters - Parameters to browse the indexes
* @returns Promise returning array of raw index information
*/

@@ -117,7 +111,5 @@ async getIndexes(

* Get all the indexes in their raw value (no Index instances).
* @memberof MeiliSearch
* @method getRawIndexes
* @param {IndexesQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<IndexesResults<IndexObject[]>>} Promise returning array of raw index information
* @param parameters - Parameters to browse the indexes
* @returns Promise returning array of raw index information
*/

@@ -136,8 +128,6 @@ async getRawIndexes(

* Create a new index
* @memberof MeiliSearch
* @method createIndex
* @template T
* @param {string} uid The index UID
* @param {IndexOptions} options Index options
* @returns {Promise<Index<T>>} Promise returning Index instance
*
* @param uid - The index UID
* @param options - Index options
* @returns Promise returning Index instance
*/

@@ -153,8 +143,6 @@ async createIndex(

* Update an index
* @memberof MeiliSearch
* @method updateIndex
* @template T
* @param {string} uid The index UID
* @param {IndexOptions} options Index options to update
* @returns {Promise<Index<T>>} Promise returning Index instance after updating
*
* @param uid - The index UID
* @param options - Index options to update
* @returns Promise returning Index instance after updating
*/

@@ -170,6 +158,5 @@ async updateIndex(

* Delete an index
* @memberof MeiliSearch
* @method deleteIndex
* @param {string} uid The index UID
* @returns {Promise<void>} Promise which resolves when index is deleted successfully
*
* @param uid - The index UID
* @returns Promise which resolves when index is deleted successfully
*/

@@ -182,6 +169,6 @@ async deleteIndex(uid: string): Promise<EnqueuedTask> {

* Deletes an index if it already exists.
* @memberof MeiliSearch
* @method deleteIndexIfExists
* @param {string} uid The index UID
* @returns {Promise<boolean>} Promise which resolves to true when index exists and is deleted successfully, otherwise false if it does not exist
*
* @param uid - The index UID
* @returns Promise which resolves to true when index exists and is deleted
* successfully, otherwise false if it does not exist
*/

@@ -203,6 +190,4 @@ async deleteIndexIfExists(uid: string): Promise<boolean> {

*
* @memberof MeiliSearch
* @method swapIndexes
* @param {SwapIndexesParams} params - List of indexes tuples to swap.
* @returns {Promise<EnqueuedTask>} - Promise returning object of the enqueued task
* @param params - List of indexes tuples to swap.
* @returns Promise returning object of the enqueued task
*/

@@ -220,7 +205,5 @@ async swapIndexes(params: SwapIndexesParams): Promise<EnqueuedTask> {

* Get the list of all client tasks
* @memberof MeiliSearch
* @method getTasks
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise returning all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise returning all tasks
*/

@@ -233,6 +216,5 @@ async getTasks(parameters: TasksQuery = {}): Promise<TasksResults> {

* Get one task on the client scope
* @memberof MeiliSearch
* @method getTask
* @param {number} taskUid - Task identifier
* @returns {Promise<Task>} - Promise returning a task
*
* @param taskUid - Task identifier
* @returns Promise returning a task
*/

@@ -246,8 +228,5 @@ async getTask(taskUid: number): Promise<Task> {

*
* @memberof MeiliSearch
* @method waitForTasks
* @param {number[]} taskUids - Tasks identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task[]>} - Promise returning an array of tasks
* @param taskUids - Tasks identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise returning an array of tasks
*/

@@ -267,9 +246,5 @@ async waitForTasks(

*
* @memberof MeiliSearch
* @method waitForTask
*
* @param {number} taskUid - Task identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task>} - Promise returning an array of tasks
* @param taskUid - Task identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise returning an array of tasks
*/

@@ -288,7 +263,5 @@ async waitForTask(

* Cancel a list of enqueued or processing tasks.
* @memberof MeiliSearch
* @method cancelTasks
* @param {CancelTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -301,7 +274,5 @@ async cancelTasks(parameters: CancelTasksQuery): Promise<EnqueuedTask> {

* Delete a list of tasks.
* @memberof MeiliSearch
* @method deleteTasks
* @param {DeleteTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -318,7 +289,5 @@ async deleteTasks(parameters: DeleteTasksQuery = {}): Promise<EnqueuedTask> {

* Get all API keys
* @memberof MeiliSearch
* @method getKeys
* @param {KeysQuery} [parameters={}] - Parameters to browse the indexes
*
* @returns {Promise<KeysResults>} Promise returning an object with keys
* @param parameters - Parameters to browse the indexes
* @returns Promise returning an object with keys
*/

@@ -340,7 +309,5 @@ async getKeys(parameters: KeysQuery = {}): Promise<KeysResults> {

* Get one API key
* @memberof MeiliSearch
* @method getKey
*
* @param {string} keyOrUid - Key or uid of the API key
* @returns {Promise<Key>} Promise returning a key
* @param keyOrUid - Key or uid of the API key
* @returns Promise returning a key
*/

@@ -354,7 +321,5 @@ async getKey(keyOrUid: string): Promise<Key> {

* Create one API key
* @memberof MeiliSearch
* @method createKey
*
* @param {KeyCreation} options - Key options
* @returns {Promise<Key>} Promise returning a key
* @param options - Key options
* @returns Promise returning a key
*/

@@ -368,8 +333,6 @@ async createKey(options: KeyCreation): Promise<Key> {

* Update one API key
* @memberof MeiliSearch
* @method updateKey
*
* @param {string} keyOrUid - Key
* @param {KeyUpdate} options - Key options
* @returns {Promise<Key>} Promise returning a key
* @param keyOrUid - Key
* @param options - Key options
* @returns Promise returning a key
*/

@@ -383,7 +346,5 @@ async updateKey(keyOrUid: string, options: KeyUpdate): Promise<Key> {

* Delete one API key
* @memberof MeiliSearch
* @method deleteKey
*
* @param {string} keyOrUid - Key
* @returns {Promise<Void>}
* @param keyOrUid - Key
* @returns
*/

@@ -401,5 +362,4 @@ async deleteKey(keyOrUid: string): Promise<void> {

* Checks if the server is healthy, otherwise an error will be thrown.
* @memberof MeiliSearch
* @method health
* @returns {Promise<Health>} Promise returning an object with health details
*
* @returns Promise returning an object with health details
*/

@@ -413,5 +373,4 @@ async health(): Promise<Health> {

* Checks if the server is healthy, return true or false.
* @memberof MeiliSearch
* @method isHealthy
* @returns {Promise<boolean>} Promise returning a boolean
*
* @returns Promise returning a boolean
*/

@@ -434,5 +393,4 @@ async isHealthy(): Promise<boolean> {

* Get the stats of all the database
* @memberof MeiliSearch
* @method getStats
* @returns {Promise<Stats>} Promise returning object of all the stats
*
* @returns Promise returning object of all the stats
*/

@@ -450,5 +408,4 @@ async getStats(): Promise<Stats> {

* Get the version of MeiliSearch
* @memberof MeiliSearch
* @method getVersion
* @returns {Promise<Version>} Promise returning object with version details
*
* @returns Promise returning object with version details
*/

@@ -466,5 +423,4 @@ async getVersion(): Promise<Version> {

* Creates a dump
* @memberof MeiliSearch
* @method createDump
* @returns {Promise<EnqueuedTask>} Promise returning object of the enqueued task
*
* @returns Promise returning object of the enqueued task
*/

@@ -484,9 +440,6 @@ async createDump(): Promise<EnqueuedTask> {

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -493,0 +446,0 @@ generateTenantToken(

@@ -16,9 +16,6 @@ import { Client } from './client'

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -25,0 +22,0 @@ generateTenantToken(

@@ -23,3 +23,2 @@ /*

DocumentQuery,
Document,
DocumentOptions,

@@ -37,3 +36,2 @@ Settings,

WaitOptions,
DocumentsResults,
TasksQuery,

@@ -43,2 +41,3 @@ TasksResults,

Faceting,
ResourceResults,
} from './types'

@@ -50,3 +49,3 @@ import { removeUndefinedFromObject } from './utils'

class Index<T = Record<string, any>> {
class Index<T extends Record<string, any> = Record<string, any>> {
uid: string

@@ -60,5 +59,5 @@ primaryKey: string | undefined

/**
* @param {Config} config Request configuration options
* @param {string} uid UID of the index
* @param {string} [primaryKey] Primary Key of the index
* @param config - Request configuration options
* @param uid - UID of the index
* @param primaryKey - Primary Key of the index
*/

@@ -78,15 +77,13 @@ constructor(config: Config, uid: string, primaryKey?: string) {

* Search for documents into an index
* @memberof Index
* @method search
* @template T
* @param {string | null} query? Query string
* @param {SearchParams} options? Search options
* @param {Partial<Request>} config? Additional request configuration options
* @returns {Promise<SearchResponse<T>>} Promise containing the search response
*
* @param query - Query string
* @param options - Search options
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
async search<T = Record<string, any>>(
async search<D = T>(
query?: string | null,
options?: SearchParams,
config?: Partial<Request>
): Promise<SearchResponse<T>> {
): Promise<SearchResponse<D>> {
const url = `indexes/${this.uid}/search`

@@ -104,15 +101,13 @@

* Search for documents into an index using the GET method
* @memberof Index
* @method search
* @template T
* @param {string | null} query? Query string
* @param {SearchParams} options? Search options
* @param {Partial<Request>} config? Additional request configuration options
* @returns {Promise<SearchResponse<T>>} Promise containing the search response
*
* @param query - Query string
* @param options - Search options
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
async searchGet<T = Record<string, any>>(
async searchGet<D = T>(
query?: string | null,
options?: SearchParams,
config?: Partial<Request>
): Promise<SearchResponse<T>> {
): Promise<SearchResponse<D>> {
const url = `indexes/${this.uid}/search`

@@ -140,3 +135,3 @@

return await this.httpRequest.get<SearchResponse<T>>(
return await this.httpRequest.get<SearchResponse<D>>(
url,

@@ -154,6 +149,4 @@ removeUndefinedFromObject(getParams),

* Get index information.
* @memberof Index
* @method getRawInfo
*
* @returns {Promise<IndexObject>} Promise containing index information
* @returns Promise containing index information
*/

@@ -171,5 +164,4 @@ async getRawInfo(): Promise<IndexObject> {

* Fetch and update Index information.
* @memberof Index
* @method fetchInfo
* @returns {Promise<this>} Promise to the current Index object with updated information
*
* @returns Promise to the current Index object with updated information
*/

@@ -183,5 +175,4 @@ async fetchInfo(): Promise<this> {

* Get Primary Key.
* @memberof Index
* @method fetchPrimaryKey
* @returns {Promise<string | undefined>} Promise containing the Primary Key of the index
*
* @returns Promise containing the Primary Key of the index
*/

@@ -195,9 +186,7 @@ async fetchPrimaryKey(): Promise<string | undefined> {

* Create an index.
* @memberof Index
* @method create
* @template T
* @param {string} uid Unique identifier of the Index
* @param {IndexOptions} options Index options
* @param {Config} config Request configuration options
* @returns {Promise<EnqueuedTask>} Newly created Index object
*
* @param uid - Unique identifier of the Index
* @param options - Index options
* @param config - Request configuration options
* @returns Newly created Index object
*/

@@ -218,6 +207,5 @@ static async create(

* Update an index.
* @memberof Index
* @method update
* @param {IndexOptions} data Data to update
* @returns {Promise<this>} Promise to the current Index object with updated information
*
* @param data - Data to update
* @returns Promise to the current Index object with updated information
*/

@@ -235,5 +223,4 @@ async update(data: IndexOptions): Promise<EnqueuedTask> {

* Delete an index.
* @memberof Index
* @method delete
* @returns {Promise<void>} Promise which resolves when index is deleted successfully
*
* @returns Promise which resolves when index is deleted successfully
*/

@@ -254,7 +241,4 @@ async delete(): Promise<EnqueuedTask> {

*
* @memberof Indexes
* @method getTasks
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise containing all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise containing all tasks
*/

@@ -268,7 +252,4 @@ async getTasks(parameters: TasksQuery = {}): Promise<TasksResults> {

*
* @memberof Indexes
* @method getTask
* @param {number} taskUid - Task identifier
*
* @returns {Promise<Task>} - Promise containing a task
* @param taskUid - Task identifier
* @returns Promise containing a task
*/

@@ -282,8 +263,5 @@ async getTask(taskUid: number): Promise<Task> {

*
* @memberof Indexes
* @method waitForTasks
* @param {number[]} taskUids - Tasks identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task[]>} - Promise containing an array of tasks
* @param taskUids - Tasks identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise containing an array of tasks
*/

@@ -303,8 +281,5 @@ async waitForTasks(

*
* @memberof Indexes
* @method waitForTask
* @param {number} taskUid - Task identifier
* @param {WaitOptions} waitOptions - Options on timeout and interval
*
* @returns {Promise<Task>} - Promise containing an array of tasks
* @param taskUid - Task identifier
* @param waitOptions - Options on timeout and interval
* @returns Promise containing an array of tasks
*/

@@ -326,6 +301,5 @@ async waitForTask(

/**
* get stats of an index
* @memberof Index
* @method getStats
* @returns {Promise<IndexStats>} Promise containing object with stats of the index
* Get stats of an index
*
* @returns Promise containing object with stats of the index
*/

@@ -336,2 +310,3 @@ async getStats(): Promise<IndexStats> {

}
///

@@ -342,12 +317,10 @@ /// DOCUMENTS

/**
* get documents of an index
* @memberof Index
* @method getDocuments
* @template T
* @param {DocumentsQuery<T>} [parameters={}] Parameters to browse the documents
* @returns {Promise<DocumentsResults<T>>>} Promise containing Document responses
* Get documents of an index
*
* @param parameters - Parameters to browse the documents
* @returns Promise containing Document responses
*/
async getDocuments<T = Record<string, any>>(
parameters: DocumentsQuery<T> = {}
): Promise<DocumentsResults<T>> {
async getDocuments<D extends Record<string, any> = T>(
parameters: DocumentsQuery<D> = {}
): Promise<ResourceResults<D[]>> {
const url = `indexes/${this.uid}/documents`

@@ -362,3 +335,3 @@

return await this.httpRequest.get<Promise<DocumentsResults<T>>>(
return await this.httpRequest.get<Promise<ResourceResults<D[]>>>(
url,

@@ -374,13 +347,11 @@ removeUndefinedFromObject({

* Get one document
* @memberof Index
* @method getDocument
* @template T
* @param {string | number} documentId Document ID
* @param {DocumentQuery<T>} [parameters={}] Parameters applied on a document
* @returns {Promise<Document<T>>} Promise containing Document response
*
* @param documentId - Document ID
* @param parameters - Parameters applied on a document
* @returns Promise containing Document response
*/
async getDocument<T = Record<string, any>>(
async getDocument<D extends Record<string, any> = T>(
documentId: string | number,
parameters?: DocumentQuery<T>
): Promise<Document<T>> {
): Promise<D> {
const url = `indexes/${this.uid}/documents/${documentId}`

@@ -395,3 +366,3 @@

return await this.httpRequest.get<Document<T>>(
return await this.httpRequest.get<D>(
url,

@@ -407,12 +378,9 @@ removeUndefinedFromObject({

* Add or replace multiples documents to an index
* @memberof Index
* @method addDocuments
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/replace
* @param {DocumentOptions} options? Options on document addition
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param documents - Array of Document objects to add/replace
* @param options - Options on document addition
* @returns Promise containing an EnqueuedTask
*/
async addDocuments(
documents: Array<Document<T>>,
documents: T[],
options?: DocumentOptions

@@ -428,12 +396,10 @@ ): Promise<EnqueuedTask> {

* Add or replace multiples documents to an index in batches
* @memberof Index
* @method addDocumentsInBatches
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/replace
* @param {number} batchSize Size of the batch
* @param {DocumentOptions} options? Options on document addition
* @returns {Promise<EnqueuedTasks>} Promise containing array of enqueued task objects for each batch
*
* @param documents - Array of Document objects to add/replace
* @param batchSize - Size of the batch
* @param options - Options on document addition
* @returns Promise containing array of enqueued task objects for each batch
*/
async addDocumentsInBatches(
documents: Array<Document<T>>,
documents: T[],
batchSize = 1000,

@@ -453,10 +419,9 @@ options?: DocumentOptions

* Add or update multiples documents to an index
* @memberof Index
* @method updateDocuments
* @param {Array<Document<Partial<T>>>} documents Array of Document objects to add/update
* @param {DocumentOptions} options? Options on document update
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documents - Array of Document objects to add/update
* @param options - Options on document update
* @returns Promise containing an EnqueuedTask
*/
async updateDocuments(
documents: Array<Document<Partial<T>>>,
documents: Array<Partial<T>>,
options?: DocumentOptions

@@ -472,12 +437,10 @@ ): Promise<EnqueuedTask> {

* Add or update multiples documents to an index in batches
* @memberof Index
* @method updateDocuments
* @template T
* @param {Array<Document<T>>} documents Array of Document objects to add/update
* @param {number} batchSize Size of the batch
* @param {DocumentOptions} options? Options on document update
* @returns {Promise<EnqueuedTasks>} Promise containing array of enqueued task objects for each batch
*
* @param documents - Array of Document objects to add/update
* @param batchSize - Size of the batch
* @param options - Options on document update
* @returns Promise containing array of enqueued task objects for each batch
*/
async updateDocumentsInBatches(
documents: Array<Document<Partial<T>>>,
documents: Array<Partial<T>>,
batchSize = 1000,

@@ -497,6 +460,5 @@ options?: DocumentOptions

* Delete one document
* @memberof Index
* @method deleteDocument
* @param {string | number} documentId Id of Document to delete
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documentId - Id of Document to delete
* @returns Promise containing an EnqueuedTask
*/

@@ -514,6 +476,5 @@ async deleteDocument(documentId: string | number): Promise<EnqueuedTask> {

* Delete multiples documents of an index
* @memberof Index
* @method deleteDocuments
* @param {string[] | number[]} documentsIds Array of Document Ids to delete
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param documentsIds - Array of Document Ids to delete
* @returns Promise containing an EnqueuedTask
*/

@@ -532,5 +493,4 @@ async deleteDocuments(

* Delete all documents of an index
* @memberof Index
* @method deleteAllDocuments
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -552,5 +512,4 @@ async deleteAllDocuments(): Promise<EnqueuedTask> {

* Retrieve all settings
* @memberof Index
* @method getSettings
* @returns {Promise<Settings>} Promise containing Settings object
*
* @returns Promise containing Settings object
*/

@@ -563,8 +522,6 @@ async getSettings(): Promise<Settings> {

/**
* Update all settings
* Any parameters not provided will be left unchanged.
* @memberof Index
* @method updateSettings
* @param {Settings} settings Object containing parameters with their updated values
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* Update all settings Any parameters not provided will be left unchanged.
*
* @param settings - Object containing parameters with their updated values
* @returns Promise containing an EnqueuedTask
*/

@@ -582,5 +539,4 @@ async updateSettings(settings: Settings): Promise<EnqueuedTask> {

* Reset settings.
* @memberof Index
* @method resetSettings
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -602,5 +558,4 @@ async resetSettings(): Promise<EnqueuedTask> {

* Get the pagination settings.
* @memberof Index
* @method getPagination
* @returns {Promise<PaginationSetting>} Promise containing object of pagination settings
*
* @returns Promise containing object of pagination settings
*/

@@ -614,6 +569,5 @@ async getPagination(): Promise<PaginationSettings> {

* Update the pagination settings.
* @memberof Index
* @method updatePagination
* @param {PaginationSettings} pagination Pagination object
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param pagination - Pagination object
* @returns Promise containing an EnqueuedTask
*/

@@ -631,5 +585,4 @@ async updatePagination(

* Reset the pagination settings.
* @memberof Index
* @method resetPagination
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -642,2 +595,3 @@ async resetPagination(): Promise<EnqueuedTask> {

}
///

@@ -649,5 +603,4 @@ /// SYNONYMS

* Get the list of all synonyms
* @memberof Index
* @method getSynonyms
* @returns {Promise<object>} Promise containing object of synonym mappings
*
* @returns Promise containing object of synonym mappings
*/

@@ -661,6 +614,5 @@ async getSynonyms(): Promise<object> {

* Update the list of synonyms. Overwrite the old list.
* @memberof Index
* @method updateSynonyms
* @param {Synonyms} synonyms Mapping of synonyms with their associated words
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param synonyms - Mapping of synonyms with their associated words
* @returns Promise containing an EnqueuedTask
*/

@@ -676,5 +628,4 @@ async updateSynonyms(synonyms: Synonyms): Promise<EnqueuedTask> {

* Reset the synonym list to be empty again
* @memberof Index
* @method resetSynonyms
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -696,5 +647,4 @@ async resetSynonyms(): Promise<EnqueuedTask> {

* Get the list of all stop-words
* @memberof Index
* @method getStopWords
* @returns {Promise<string[]>} Promise containing array of stop-words
*
* @returns Promise containing array of stop-words
*/

@@ -708,6 +658,5 @@ async getStopWords(): Promise<string[]> {

* Update the list of stop-words. Overwrite the old list.
* @memberof Index
* @method updateStopWords
* @param {StopWords} stopWords Array of strings that contains the stop-words.
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param stopWords - Array of strings that contains the stop-words.
* @returns Promise containing an EnqueuedTask
*/

@@ -723,5 +672,4 @@ async updateStopWords(stopWords: StopWords): Promise<EnqueuedTask> {

* Reset the stop-words list to be empty again
* @memberof Index
* @method resetStopWords
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -743,5 +691,4 @@ async resetStopWords(): Promise<EnqueuedTask> {

* Get the list of all ranking-rules
* @memberof Index
* @method getRankingRules
* @returns {Promise<string[]>} Promise containing array of ranking-rules
*
* @returns Promise containing array of ranking-rules
*/

@@ -755,6 +702,6 @@ async getRankingRules(): Promise<string[]> {

* Update the list of ranking-rules. Overwrite the old list.
* @memberof Index
* @method updateRankingRules
* @param {RankingRules} rankingRules Array that contain ranking rules sorted by order of importance.
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param rankingRules - Array that contain ranking rules sorted by order of
* importance.
* @returns Promise containing an EnqueuedTask
*/

@@ -770,5 +717,4 @@ async updateRankingRules(rankingRules: RankingRules): Promise<EnqueuedTask> {

* Reset the ranking rules list to its default value
* @memberof Index
* @method resetRankingRules
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -790,5 +736,4 @@ async resetRankingRules(): Promise<EnqueuedTask> {

* Get the distinct-attribute
* @memberof Index
* @method getDistinctAttribute
* @returns {Promise<string | null>} Promise containing the distinct-attribute of the index
*
* @returns Promise containing the distinct-attribute of the index
*/

@@ -802,6 +747,5 @@ async getDistinctAttribute(): Promise<string | null> {

* Update the distinct-attribute.
* @memberof Index
* @method updateDistinctAttribute
* @param {DistinctAttribute} distinctAttribute Field name of the distinct-attribute
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param distinctAttribute - Field name of the distinct-attribute
* @returns Promise containing an EnqueuedTask
*/

@@ -819,5 +763,4 @@ async updateDistinctAttribute(

* Reset the distinct-attribute.
* @memberof Index
* @method resetDistinctAttribute
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -839,5 +782,4 @@ async resetDistinctAttribute(): Promise<EnqueuedTask> {

* Get the filterable-attributes
* @memberof Index
* @method getFilterableAttributes
* @returns {Promise<string[]>} Promise containing an array of filterable-attributes
*
* @returns Promise containing an array of filterable-attributes
*/

@@ -851,6 +793,6 @@ async getFilterableAttributes(): Promise<string[]> {

* Update the filterable-attributes.
* @memberof Index
* @method updateFilterableAttributes
* @param {FilterableAttributes} filterableAttributes Array of strings containing the attributes that can be used as filters at query time
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param filterableAttributes - Array of strings containing the attributes
* that can be used as filters at query time
* @returns Promise containing an EnqueuedTask
*/

@@ -868,5 +810,4 @@ async updateFilterableAttributes(

* Reset the filterable-attributes.
* @memberof Index
* @method resetFilterableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -888,5 +829,4 @@ async resetFilterableAttributes(): Promise<EnqueuedTask> {

* Get the sortable-attributes
* @memberof Index
* @method getSortableAttributes
* @returns {Promise<string[]>} Promise containing array of sortable-attributes
*
* @returns Promise containing array of sortable-attributes
*/

@@ -900,6 +840,6 @@ async getSortableAttributes(): Promise<string[]> {

* Update the sortable-attributes.
* @memberof Index
* @method updateSortableAttributes
* @param {SortableAttributes} sortableAttributes Array of strings containing the attributes that can be used to sort search results at query time
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param sortableAttributes - Array of strings containing the attributes that
* can be used to sort search results at query time
* @returns Promise containing an EnqueuedTask
*/

@@ -917,5 +857,4 @@ async updateSortableAttributes(

* Reset the sortable-attributes.
* @memberof Index
* @method resetSortableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -937,5 +876,4 @@ async resetSortableAttributes(): Promise<EnqueuedTask> {

* Get the searchable-attributes
* @memberof Index
* @method getSearchableAttributes
* @returns {Promise<string[]>} Promise containing array of searchable-attributes
*
* @returns Promise containing array of searchable-attributes
*/

@@ -949,6 +887,6 @@ async getSearchableAttributes(): Promise<string[]> {

* Update the searchable-attributes.
* @memberof Index
* @method updateSearchableAttributes
* @param {SearchableAttributes} searchableAttributes Array of strings that contains searchable attributes sorted by order of importance(most to least important)
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param searchableAttributes - Array of strings that contains searchable
* attributes sorted by order of importance(most to least important)
* @returns Promise containing an EnqueuedTask
*/

@@ -966,5 +904,4 @@ async updateSearchableAttributes(

* Reset the searchable-attributes.
* @memberof Index
* @method resetSearchableAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -986,5 +923,4 @@ async resetSearchableAttributes(): Promise<EnqueuedTask> {

* Get the displayed-attributes
* @memberof Index
* @method getDisplayedAttributes
* @returns {Promise<string[]>} Promise containing array of displayed-attributes
*
* @returns Promise containing array of displayed-attributes
*/

@@ -998,6 +934,6 @@ async getDisplayedAttributes(): Promise<string[]> {

* Update the displayed-attributes.
* @memberof Index
* @method updateDisplayedAttributes
* @param {DisplayedAttributes} displayedAttributes Array of strings that contains attributes of an index to display
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param displayedAttributes - Array of strings that contains attributes of
* an index to display
* @returns Promise containing an EnqueuedTask
*/

@@ -1015,5 +951,4 @@ async updateDisplayedAttributes(

* Reset the displayed-attributes.
* @memberof Index
* @method resetDisplayedAttributes
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -1035,5 +970,4 @@ async resetDisplayedAttributes(): Promise<EnqueuedTask> {

* Get the typo tolerance settings.
* @memberof Index
* @method getTypoTolerance
* @returns {Promise<string[]>} Promise containing the typo tolerance settings.
*
* @returns Promise containing the typo tolerance settings.
*/

@@ -1047,6 +981,6 @@ async getTypoTolerance(): Promise<string[]> {

* Update the typo tolerance settings.
* @memberof Index
* @method updateTypoTolerance
* @param {TypoTolerance} typoTolerance Object containing the custom typo tolerance settings.
* @returns {Promise<EnqueuedTask>} Promise containing object of the enqueued update
*
* @param typoTolerance - Object containing the custom typo tolerance
* settings.
* @returns Promise containing object of the enqueued update
*/

@@ -1066,5 +1000,4 @@ async updateTypoTolerance(

* Reset the typo tolerance settings.
* @memberof Index
* @method resetTypoTolerance
* @returns {Promise<EnqueuedTask>} Promise containing object of the enqueued update
*
* @returns Promise containing object of the enqueued update
*/

@@ -1086,5 +1019,4 @@ async resetTypoTolerance(): Promise<EnqueuedTask> {

* Get the faceting settings.
* @memberof Index
* @method getFaceting
* @returns {Promise<Faceting>} Promise containing object of faceting index settings
*
* @returns Promise containing object of faceting index settings
*/

@@ -1098,6 +1030,5 @@ async getFaceting(): Promise<Faceting> {

* Update the faceting settings.
* @memberof Index
* @method updateFaceting
* @param {Faceting} faceting Faceting index settings object
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @param faceting - Faceting index settings object
* @returns Promise containing an EnqueuedTask
*/

@@ -1113,5 +1044,4 @@ async updateFaceting(faceting: Faceting): Promise<EnqueuedTask> {

* Reset the faceting settings.
* @memberof Index
* @method resetFaceting
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
*
* @returns Promise containing an EnqueuedTask
*/

@@ -1118,0 +1048,0 @@ async resetFaceting(): Promise<EnqueuedTask> {

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

export const PACKAGE_VERSION = '0.30.0'
export const PACKAGE_VERSION = '0.31.0'

@@ -56,5 +56,4 @@ import { MeiliSearchTimeOutError } from './errors'

*
* @param {number} uid - unique identifier of the task
*
* @returns { Promise<Task> }
* @param uid - Unique identifier of the task
* @returns
*/

@@ -70,5 +69,4 @@ async getTask(uid: number): Promise<Task> {

*
* @param {TasksQuery} [parameters={}] - Parameters to browse the tasks
*
* @returns {Promise<TasksResults>} - Promise containing all tasks
* @param parameters - Parameters to browse the tasks
* @returns Promise containing all tasks
*/

@@ -92,6 +90,5 @@ async getTasks(parameters: TasksQuery = {}): Promise<TasksResults> {

*
* @param {number} taskUid Task identifier
* @param {WaitOptions} options Additional configuration options
*
* @returns {Promise<Task>} Promise returning a task after it has been processed
* @param taskUid - Task identifier
* @param options - Additional configuration options
* @returns Promise returning a task after it has been processed
*/

@@ -121,6 +118,5 @@ async waitForTask(

*
* @param {number[]} taskUids Tasks identifier list
* @param {WaitOptions} options Wait options
*
* @returns {Promise<Task[]>} Promise returning a list of tasks after they have been processed
* @param taskUids - Tasks identifier list
* @param options - Wait options
* @returns Promise returning a list of tasks after they have been processed
*/

@@ -144,7 +140,5 @@ async waitForTasks(

* Cancel a list of enqueued or processing tasks.
* @memberof Tasks
* @method cancelTasks
* @param {CancelTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -165,7 +159,5 @@ async cancelTasks(parameters: CancelTasksQuery = {}): Promise<EnqueuedTask> {

* Delete a list tasks.
* @memberof Tasks
* @method deleteTasks
* @param {DeleteTasksQuery} [parameters={}] - Parameters to filter the tasks.
*
* @returns {Promise<EnqueuedTask>} Promise containing an EnqueuedTask
* @param parameters - Parameters to filter the tasks.
* @returns Promise containing an EnqueuedTask
*/

@@ -172,0 +164,0 @@ async deleteTasks(parameters: DeleteTasksQuery = {}): Promise<EnqueuedTask> {

@@ -13,6 +13,6 @@ import { Config, TokenSearchRules, TokenOptions } from './types'

*
* @param {String} apiKey API key used to sign the token.
* @param {String} encodedHeader Header of the token in base64.
* @param {String} encodedPayload Payload of the token in base64.
* @returns {String} The signature of the token in base64.
* @param apiKey - API key used to sign the token.
* @param encodedHeader - Header of the token in base64.
* @param encodedPayload - Payload of the token in base64.
* @returns The signature of the token in base64.
*/

@@ -32,3 +32,3 @@ function sign(apiKey: string, encodedHeader: string, encodedPayload: string) {

*
* @returns {String} The header encoded in base64.
* @returns The header encoded in base64.
*/

@@ -47,6 +47,6 @@ function createHeader() {

*
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {String} apiKey Api key used as issuer of the token.
* @param {String} uid The uid of the api key used as issuer of the token.
* @param {Date | undefined} expiresAt Date at which the token expires.
* @param searchRules - Search rules that are applied to every search.
* @param apiKey - Api key used as issuer of the token.
* @param uid - The uid of the api key used as issuer of the token.
* @param expiresAt - Date at which the token expires.
*/

@@ -103,6 +103,6 @@ function validateTokenParameters(tokenParams: {

*
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {String} uid The uid of the api key used as issuer of the token.
* @param {Date | undefined} expiresAt Date at which the token expires.
* @returns {String} The payload encoded in base64.
* @param searchRules - Search rules that are applied to every search.
* @param uid - The uid of the api key used as issuer of the token.
* @param expiresAt - Date at which the token expires.
* @returns The payload encoded in base64.
*/

@@ -135,9 +135,6 @@ function createPayload(payloadParams: {

*
* @memberof MeiliSearch
* @method generateTenantToken
* @param {apiKeyUid} apiKeyUid The uid of the api key used as issuer of the token.
* @param {SearchRules} searchRules Search rules that are applied to every search.
* @param {TokenOptions} options Token options to customize some aspect of the token.
*
* @returns {String} The token in JWT format.
* @param apiKeyUid - The uid of the api key used as issuer of the token.
* @param searchRules - Search rules that are applied to every search.
* @param options - Token options to customize some aspect of the token.
* @returns The token in JWT format.
*/

@@ -144,0 +141,0 @@ generateTenantToken(

@@ -164,9 +164,2 @@ // Type definitions for meilisearch

export type Document<T = Record<string, any>> = T
export type Documents<T = Record<string, any>> = Array<Document<T>>
export type DocumentsResults<T = Record<string, any>> = ResourceResults<
Documents<T>
> & {}
/*

@@ -440,2 +433,5 @@ ** Settings

/** @see https://docs.meilisearch.com/errors/#missing_index_uid */
MISSING_INDEX_UID = 'missing_index_uid',
/** @see https://docs.meilisearch.com/errors/#index_already_exists */

@@ -453,2 +449,8 @@ INDEX_ALREADY_EXISTS = 'index_already_exists',

/** @see https://docs.meilisearch.com/errors/#invalid_index_offset */
INVALID_INDEX_OFFSET = 'invalid_index_offset',
/** @see https://docs.meilisearch.com/errors/#invalid_index_limit */
INVALID_INDEX_LIMIT = 'invalid_index_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_state */

@@ -463,2 +465,5 @@ INVALID_STATE = 'invalid_state',

/** @see https://docs.meilisearch.com/errors/#invalid_index_primary_key */
INVALID_INDEX_PRIMARY_KEY = 'invalid_index_primary_key',
/** @see https://docs.meilisearch.com/errors/#max_fields_limit_exceeded */

@@ -479,2 +484,11 @@ DOCUMENTS_FIELDS_LIMIT_REACHED = 'document_fields_limit_reached',

/** @see https://docs.meilisearch.com/errors/#invalid_document_fields */
INVALID_DOCUMENT_FIELDS = 'invalid_document_fields',
/** @see https://docs.meilisearch.com/errors/#invalid_document_limit */
INVALID_DOCUMENT_LIMIT = 'invalid_document_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_document_offset */
INVALID_DOCUMENT_OFFSET = 'invalid_document_offset',
/** @see https://docs.meilisearch.com/errors/#payload_too_large */

@@ -501,11 +515,56 @@ PAYLOAD_TOO_LARGE = 'payload_too_large',

/** @see https://docs.meilisearch.com/errors/#invalid_filter */
INVALID_FILTER = 'invalid_filter',
/** @see https://docs.meilisearch.com/errors/#invalid_document_geo_field */
INVALID_DOCUMENT_GEO_FIELD = 'invalid_document_geo_field',
/** @see https://docs.meilisearch.com/errors/#invalid_sort */
INVALID_SORT = 'invalid_sort',
/** @see https://docs.meilisearch.com/errors/#invalid_search_q */
INVALID_SEARCH_Q = 'invalid_search_q',
/** @see https://docs.meilisearch.com/errors/#invalid_geo_field */
INVALID_GEO_FIELD = 'invalid_geo_field',
/** @see https://docs.meilisearch.com/errors/#invalid_search_offset */
INVALID_SEARCH_OFFSET = 'invalid_search_offset',
/** @see https://docs.meilisearch.com/errors/#invalid_search_limit */
INVALID_SEARCH_LIMIT = 'invalid_search_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_search_page */
INVALID_SEARCH_PAGE = 'invalid_search_page',
/** @see https://docs.meilisearch.com/errors/#invalid_search_hits_per_page */
INVALID_SEARCH_HITS_PER_PAGE = 'invalid_search_hits_per_page',
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_retrieve */
INVALID_SEARCH_ATTRIBUTES_TO_RETRIEVE = 'invalid_search_attributes_to_retrieve',
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_crop */
INVALID_SEARCH_ATTRIBUTES_TO_CROP = 'invalid_search_attributes_to_crop',
/** @see https://docs.meilisearch.com/errors/#invalid_search_crop_length */
INVALID_SEARCH_CROP_LENGTH = 'invalid_search_crop_length',
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_highlight */
INVALID_SEARCH_ATTRIBUTES_TO_HIGHLIGHT = 'invalid_search_attributes_to_highlight',
/** @see https://docs.meilisearch.com/errors/#invalid_search_show_matches_position */
INVALID_SEARCH_SHOW_MATCHES_POSITION = 'invalid_search_show_matches_position',
/** @see https://docs.meilisearch.com/errors/#invalid_search_filter */
INVALID_SEARCH_FILTER = 'invalid_search_filter',
/** @see https://docs.meilisearch.com/errors/#invalid_search_sort */
INVALID_SEARCH_SORT = 'invalid_search_sort',
/** @see https://docs.meilisearch.com/errors/#invalid_search_facets */
INVALID_SEARCH_FACETS = 'invalid_search_facets',
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_pre_tag */
INVALID_SEARCH_HIGHLIGHT_PRE_TAG = 'invalid_search_highlight_pre_tag',
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_post_tag */
INVALID_SEARCH_HIGHLIGHT_POST_TAG = 'invalid_search_highlight_post_tag',
/** @see https://docs.meilisearch.com/errors/#invalid_search_crop_marker */
INVALID_SEARCH_CROP_MARKER = 'invalid_search_crop_marker',
/** @see https://docs.meilisearch.com/errors/#invalid_search_matching_strategy */
INVALID_SEARCH_MATCHING_STRATEGY = 'invalid_search_matching_strategy',
/** @see https://docs.meilisearch.com/errors/#bad_request */

@@ -538,5 +597,20 @@ BAD_REQUEST = 'bad_request',

/** @see https://docs.meilisearch.com/errors/#missing_parameter */
MISSING_PARAMETER = 'missing_parameter',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_uid */
IMMUTABLE_API_KEY_UID = 'immutable_api_key_uid',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_actions */
IMMUTABLE_API_KEY_ACTIONS = 'immutable_api_key_actions',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_indexes */
IMMUTABLE_API_KEY_INDEXES = 'immutable_api_key_indexes',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_expires_at */
IMMUTABLE_API_KEY_EXPIRES_AT = 'immutable_api_key_expires_at',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_created_at */
IMMUTABLE_API_KEY_CREATED_AT = 'immutable_api_key_created_at',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_updated_at */
IMMUTABLE_API_KEY_UPDATED_AT = 'immutable_api_key_updated_at',
/** @see https://docs.meilisearch.com/errors/#missing_authorization_header */

@@ -560,25 +634,118 @@ MISSING_AUTHORIZATION_HEADER = 'missing_authorization_header',

/** @see https://docs.meilisearch.com/errors/#duplicate_index_found */
DUPLICATE_INDEX_FOUND = 'duplicate_index_found',
/** @see https://docs.meilisearch.com/errors/#invalid_swap_duplicate_index_found */
INVALID_SWAP_DUPLICATE_INDEX_FOUND = 'invalid_swap_duplicate_index_found',
/** @see https://docs.meilisearch.com/errors/#invalid_swap_indexes */
INVALID_SWAP_INDEXES = 'invalid_swap_indexes',
/** @see https://docs.meilisearch.com/errors/#missing_swap_indexes */
MISSING_SWAP_INDEXES = 'missing_swap_indexes',
/** @see https://docs.meilisearch.com/errors/#missing_master_key */
MISSING_MASTER_KEY = 'missing_master_key',
/** @see http://docs.meilisearch.com/errors/#invalid_task_types_filter */
INVALID_TASK_TYPES_FILTER = 'invalid_task_types_filter',
/** @see http://docs.meilisearch.com/errors/#invalid_task_types */
INVALID_TASK_TYPES = 'invalid_task_types',
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses_filter */
INVALID_TASK_STATUSES_FILTER = 'invalid_task_statuses_filter',
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids */
INVALID_TASK_UIDS = 'invalid_task_uids',
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by_filter */
INVALID_TASK_CANCELED_BY_FILTER = 'invalid_task_canceled_by_filter',
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses */
INVALID_TASK_STATUSES = 'invalid_task_statuses',
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids_filter */
INVALID_TASK_UIDS_FILTER = 'invalid_task_uids_filter',
/** @see http://docs.meilisearch.com/errors/#invalid_task_limit */
INVALID_TASK_LIMIT = 'invalid_task_limit',
/** @see http://docs.meilisearch.com/errors/#invalid_task_date_filter */
INVALID_TASK_DATE_FILTER = 'invalid_task_date_filter',
/** @see http://docs.meilisearch.com/errors/#invalid_task_from */
INVALID_TASK_FROM = 'invalid_task_from',
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by */
INVALID_TASK_CANCELED_BY = 'invalid_task_canceled_by',
/** @see http://docs.meilisearch.com/errors/#missing_task_filters */
MISSING_TASK_FILTERS = 'missing_task_filters',
/** @see http://docs.meilisearch.com/errors/#too_many_open_files */
TOO_MANY_OPEN_FILES = 'too_many_open_files',
/** @see http://docs.meilisearch.com/errors/#io_error */
IO_ERROR = 'io_error',
/** @see http://docs.meilisearch.com/errors/#invalid_task_index_uids */
INVALID_TASK_INDEX_UIDS = 'invalid_task_index_uids',
/** @see http://docs.meilisearch.com/errors/#immutable_index_uid */
IMMUTABLE_INDEX_UID = 'immutable_index_uid',
/** @see http://docs.meilisearch.com/errors/#immutable_index_created_at */
IMMUTABLE_INDEX_CREATED_AT = 'immutable_index_created_at',
/** @see http://docs.meilisearch.com/errors/#immutable_index_updated_at */
IMMUTABLE_INDEX_UPDATED_AT = 'immutable_index_updated_at',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_displayed_attributes */
INVALID_SETTINGS_DISPLAYED_ATTRIBUTES = 'invalid_settings_displayed_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_searchable_attributes */
INVALID_SETTINGS_SEARCHABLE_ATTRIBUTES = 'invalid_settings_searchable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_filterable_attributes */
INVALID_SETTINGS_FILTERABLE_ATTRIBUTES = 'invalid_settings_filterable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_sortable_attributes */
INVALID_SETTINGS_SORTABLE_ATTRIBUTES = 'invalid_settings_sortable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_ranking_rules */
INVALID_SETTINGS_RANKING_RULES = 'invalid_settings_ranking_rules',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_stop_words */
INVALID_SETTINGS_STOP_WORDS = 'invalid_settings_stop_words',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_synonyms */
INVALID_SETTINGS_SYNONYMS = 'invalid_settings_synonyms',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_distinct_attribute */
INVALID_SETTINGS_DISTINCT_ATTRIBUTE = 'invalid_settings_distinct_attribute',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_typo_tolerance */
INVALID_SETTINGS_TYPO_TOLERANCE = 'invalid_settings_typo_tolerance',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_faceting */
INVALID_SETTINGS_FACETING = 'invalid_settings_faceting',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_pagination */
INVALID_SETTINGS_PAGINATION = 'invalid_settings_pagination',
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_enqueued_at */
INVALID_TASK_BEFORE_ENQUEUED_AT = 'invalid_task_before_enqueued_at',
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_enqueued_at */
INVALID_TASK_AFTER_ENQUEUED_AT = 'invalid_task_after_enqueued_at',
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_started_at */
INVALID_TASK_BEFORE_STARTED_AT = 'invalid_task_before_started_at',
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_started_at */
INVALID_TASK_AFTER_STARTED_AT = 'invalid_task_after_started_at',
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_finished_at */
INVALID_TASK_BEFORE_FINISHED_AT = 'invalid_task_before_finished_at',
/** @see http://docs.meilisearch.com/errors/#invalid_task_after_finished_at */
INVALID_TASK_AFTER_FINISHED_AT = 'invalid_task_after_finished_at',
/** @see http://docs.meilisearch.com/errors/#missing_api_key_actions */
MISSING_API_KEY_ACTIONS = 'missing_api_key_actions',
/** @see http://docs.meilisearch.com/errors/#missing_api_key_indexes */
MISSING_API_KEY_INDEXES = 'missing_api_key_indexes',
/** @see http://docs.meilisearch.com/errors/#missing_api_key_expires_at */
MISSING_API_KEY_EXPIRES_AT = 'missing_api_key_expires_at',
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_limit */
INVALID_API_KEY_LIMIT = 'invalid_api_key_limit',
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_offset */
INVALID_API_KEY_OFFSET = 'invalid_api_key_offset',
}

@@ -585,0 +752,0 @@

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

/**
* Removes undefined entries from object
*/
/** Removes undefined entries from object */
function removeUndefinedFromObject(obj: Record<string, any>): object {

@@ -5,0 +3,0 @@ return Object.entries(obj).reduce((acc, curEntry) => {

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc