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.32.5 to 0.33.0-prototype-search-for-facet-values.0

dist/types/errors/version-hint-message.d.ts

4

CONTRIBUTING.md

@@ -18,4 +18,4 @@ # Contributing

1. **You're familiar with [GitHub](https://github.com) and the [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) (PR) workflow.**
2. **You've read the Meilisearch [documentation](https://docs.meilisearch.com) and the [README](/README.md).**
3. **You know about the [Meilisearch community](https://docs.meilisearch.com/learn/what_is_meilisearch/contact.html). Please use this for help.**
2. **You've read the Meilisearch [documentation](https://www.meilisearch.com/docs) and the [README](/README.md).**
3. **You know about the [Meilisearch community](https://discord.com/invite/meilisearch). Please use this for help.**

@@ -22,0 +22,0 @@ ## How to Contribute

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

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

@@ -6,2 +6,3 @@ export * from './http-error-handler';

export * from './meilisearch-timeout-error';
export * from './version-hint-message';
//# sourceMappingURL=index.d.ts.map

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

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

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

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

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

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

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

// Type definitions for meilisearch 0.32.5
// Type definitions for meilisearch 0.33.0-prototype-search-for-facet-values.0
// Project: https://github.com/meilisearch/meilisearch-js

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

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

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, RawDocumentAdditionOptions, ContentType } 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, RawDocumentAdditionOptions, ContentType, DocumentsIds, DocumentsDeletionQuery, SearchForFacetValuesParams, SearchForFacetValuesResponse } from './types';
import { HttpRequests } from './http-requests';

@@ -37,2 +37,10 @@ import { Task, TaskClient } from './task';

/**
* Search for facet values
*
* @param params - Parameters used to search on the facets
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
searchForFacetValue(params: SearchForFacetValuesParams, config?: Partial<Request>): Promise<SearchForFacetValuesResponse>;
/**
* Get index information.

@@ -114,6 +122,7 @@ *

/**
* Get documents of an index
* Get documents of an index.
*
* @param parameters - Parameters to browse the documents
* @returns Promise containing Document responses
* @param parameters - Parameters to browse the documents. Parameters can
* contain the `filter` field only available in Meilisearch v1.2 and newer
* @returns Promise containing the returned documents
*/

@@ -193,8 +202,13 @@ getDocuments<D extends Record<string, any> = T>(parameters?: DocumentsQuery<D>): Promise<ResourceResults<D[]>>;

/**
* Delete multiples documents of an index
* Delete multiples documents of an index.
*
* @param documentsIds - Array of Document Ids to delete
* @param params - Params value can be:
*
* - DocumentsDeletionQuery: An object containing the parameters to customize
* your document deletion. Only available in Meilisearch v1.2 and newer
* - DocumentsIds: An array of document ids to delete
*
* @returns Promise containing an EnqueuedTask
*/
deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedTask>;
deleteDocuments(params: DocumentsDeletionQuery | DocumentsIds): Promise<EnqueuedTask>;
/**

@@ -201,0 +215,0 @@ * Delete all documents of an index

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

export declare const PACKAGE_VERSION = "0.32.5";
export declare const PACKAGE_VERSION = "0.33.0-prototype-search-for-facet-values.0";
//# sourceMappingURL=package-version.d.ts.map

@@ -123,2 +123,18 @@ import { Task } from '../task';

};
export type SearchForFacetValuesParams = SearchParams & {
facetName: string;
facetQuery?: string;
q?: string;
filter?: Filter;
matchingStrategy?: MatchingStrategies;
};
export type FacetHit = {
value: string;
count: number;
};
export type SearchForFacetValuesResponse = {
hits: FacetHit[];
query: string | null;
processingTimeMs: number;
};
type Fields<T = Record<string, any>> = Array<Extract<keyof T, string>> | Extract<keyof T, string>;

@@ -135,2 +151,3 @@ export type DocumentOptions = {

fields?: Fields<T>;
filter?: Filter;
};

@@ -140,2 +157,6 @@ export type DocumentQuery<T = Record<string, any>> = {

};
export type DocumentsDeletionQuery = {
filter: Filter;
};
export type DocumentsIds = string[] | number[];
export type FilterableAttributes = string[] | null;

@@ -321,211 +342,215 @@ export type DistinctAttribute = string | null;

export declare const enum ErrorStatusCode {
/** @see https://docs.meilisearch.com/errors/#index_creation_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_creation_failed */
INDEX_CREATION_FAILED = "index_creation_failed",
/** @see https://docs.meilisearch.com/errors/#missing_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_index_uid */
MISSING_INDEX_UID = "missing_index_uid",
/** @see https://docs.meilisearch.com/errors/#index_already_exists */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_already_exists */
INDEX_ALREADY_EXISTS = "index_already_exists",
/** @see https://docs.meilisearch.com/errors/#index_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_not_found */
INDEX_NOT_FOUND = "index_not_found",
/** @see https://docs.meilisearch.com/errors/#invalid_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_uid */
INVALID_INDEX_UID = "invalid_index_uid",
/** @see https://docs.meilisearch.com/errors/#index_not_accessible */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_not_accessible */
INDEX_NOT_ACCESSIBLE = "index_not_accessible",
/** @see https://docs.meilisearch.com/errors/#invalid_index_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_offset */
INVALID_INDEX_OFFSET = "invalid_index_offset",
/** @see https://docs.meilisearch.com/errors/#invalid_index_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_limit */
INVALID_INDEX_LIMIT = "invalid_index_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_state */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_state */
INVALID_STATE = "invalid_state",
/** @see https://docs.meilisearch.com/errors/#primary_key_inference_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#primary_key_inference_failed */
PRIMARY_KEY_INFERENCE_FAILED = "primary_key_inference_failed",
/** @see https://docs.meilisearch.com/errors/#index_primary_key_already_exists */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_primary_key_already_exists */
INDEX_PRIMARY_KEY_ALREADY_EXISTS = "index_primary_key_already_exists",
/** @see https://docs.meilisearch.com/errors/#invalid_index_primary_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_primary_key */
INVALID_INDEX_PRIMARY_KEY = "invalid_index_primary_key",
/** @see https://docs.meilisearch.com/errors/#max_fields_limit_exceeded */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#max_fields_limit_exceeded */
DOCUMENTS_FIELDS_LIMIT_REACHED = "document_fields_limit_reached",
/** @see https://docs.meilisearch.com/errors/#missing_document_id */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_document_id */
MISSING_DOCUMENT_ID = "missing_document_id",
/** @see https://docs.meilisearch.com/errors/#missing_document_id */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_document_id */
INVALID_DOCUMENT_ID = "invalid_document_id",
/** @see https://docs.meilisearch.com/errors/#invalid_content_type */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_content_type */
INVALID_CONTENT_TYPE = "invalid_content_type",
/** @see https://docs.meilisearch.com/errors/#missing_content_type */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_content_type */
MISSING_CONTENT_TYPE = "missing_content_type",
/** @see https://docs.meilisearch.com/errors/#invalid_document_fields */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_fields */
INVALID_DOCUMENT_FIELDS = "invalid_document_fields",
/** @see https://docs.meilisearch.com/errors/#invalid_document_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_limit */
INVALID_DOCUMENT_LIMIT = "invalid_document_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_document_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
INVALID_DOCUMENT_OFFSET = "invalid_document_offset",
/** @see https://docs.meilisearch.com/errors/#payload_too_large */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
INVALID_DOCUMENT_FILTER = "invalid_document_filter",
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
MISSING_DOCUMENT_FILTER = "missing_document_filter",
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#payload_too_large */
PAYLOAD_TOO_LARGE = "payload_too_large",
/** @see https://docs.meilisearch.com/errors/#missing_payload */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_payload */
MISSING_PAYLOAD = "missing_payload",
/** @see https://docs.meilisearch.com/errors/#malformed_payload */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#malformed_payload */
MALFORMED_PAYLOAD = "malformed_payload",
/** @see https://docs.meilisearch.com/errors/#no_space_left_on_device */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#no_space_left_on_device */
NO_SPACE_LEFT_ON_DEVICE = "no_space_left_on_device",
/** @see https://docs.meilisearch.com/errors/#invalid_store_file */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_store_file */
INVALID_STORE_FILE = "invalid_store_file",
/** @see https://docs.meilisearch.com/errors/#invalid_ranking_rules */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_ranking_rules */
INVALID_RANKING_RULES = "missing_document_id",
/** @see https://docs.meilisearch.com/errors/#invalid_request */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_request */
INVALID_REQUEST = "invalid_request",
/** @see https://docs.meilisearch.com/errors/#invalid_document_geo_field */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_geo_field */
INVALID_DOCUMENT_GEO_FIELD = "invalid_document_geo_field",
/** @see https://docs.meilisearch.com/errors/#invalid_search_q */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_q */
INVALID_SEARCH_Q = "invalid_search_q",
/** @see https://docs.meilisearch.com/errors/#invalid_search_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_offset */
INVALID_SEARCH_OFFSET = "invalid_search_offset",
/** @see https://docs.meilisearch.com/errors/#invalid_search_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_limit */
INVALID_SEARCH_LIMIT = "invalid_search_limit",
/** @see https://docs.meilisearch.com/errors/#invalid_search_page */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_page */
INVALID_SEARCH_PAGE = "invalid_search_page",
/** @see https://docs.meilisearch.com/errors/#invalid_search_hits_per_page */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_crop_length */
INVALID_SEARCH_CROP_LENGTH = "invalid_search_crop_length",
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_highlight */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_show_matches_position */
INVALID_SEARCH_SHOW_MATCHES_POSITION = "invalid_search_show_matches_position",
/** @see https://docs.meilisearch.com/errors/#invalid_search_filter */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_filter */
INVALID_SEARCH_FILTER = "invalid_search_filter",
/** @see https://docs.meilisearch.com/errors/#invalid_search_sort */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_sort */
INVALID_SEARCH_SORT = "invalid_search_sort",
/** @see https://docs.meilisearch.com/errors/#invalid_search_facets */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_facets */
INVALID_SEARCH_FACETS = "invalid_search_facets",
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_pre_tag */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_crop_marker */
INVALID_SEARCH_CROP_MARKER = "invalid_search_crop_marker",
/** @see https://docs.meilisearch.com/errors/#invalid_search_matching_strategy */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_matching_strategy */
INVALID_SEARCH_MATCHING_STRATEGY = "invalid_search_matching_strategy",
/** @see https://docs.meilisearch.com/errors/#bad_request */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#bad_request */
BAD_REQUEST = "bad_request",
/** @see https://docs.meilisearch.com/errors/#document_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#document_not_found */
DOCUMENT_NOT_FOUND = "document_not_found",
/** @see https://docs.meilisearch.com/errors/#internal */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#internal */
INTERNAL = "internal",
/** @see https://docs.meilisearch.com/errors/#invalid_api_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key */
INVALID_API_KEY = "invalid_api_key",
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_description */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_description */
INVALID_API_KEY_DESCRIPTION = "invalid_api_key_description",
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_actions */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_actions */
INVALID_API_KEY_ACTIONS = "invalid_api_key_actions",
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_indexes */
INVALID_API_KEY_INDEXES = "invalid_api_key_indexes",
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_expires_at */
INVALID_API_KEY_EXPIRES_AT = "invalid_api_key_expires_at",
/** @see https://docs.meilisearch.com/errors/#api_key_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#api_key_not_found */
API_KEY_NOT_FOUND = "api_key_not_found",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_uid */
IMMUTABLE_API_KEY_UID = "immutable_api_key_uid",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_actions */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_actions */
IMMUTABLE_API_KEY_ACTIONS = "immutable_api_key_actions",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_indexes */
IMMUTABLE_API_KEY_INDEXES = "immutable_api_key_indexes",
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_updated_at */
IMMUTABLE_API_KEY_UPDATED_AT = "immutable_api_key_updated_at",
/** @see https://docs.meilisearch.com/errors/#missing_authorization_header */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_authorization_header */
MISSING_AUTHORIZATION_HEADER = "missing_authorization_header",
/** @see https://docs.meilisearch.com/errors/#unretrievable_document */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#unretrievable_document */
UNRETRIEVABLE_DOCUMENT = "unretrievable_document",
/** @see https://docs.meilisearch.com/errors/#database_size_limit_reached */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#database_size_limit_reached */
MAX_DATABASE_SIZE_LIMIT_REACHED = "database_size_limit_reached",
/** @see https://docs.meilisearch.com/errors/#task_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#task_not_found */
TASK_NOT_FOUND = "task_not_found",
/** @see https://docs.meilisearch.com/errors/#dump_process_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#dump_process_failed */
DUMP_PROCESS_FAILED = "dump_process_failed",
/** @see https://docs.meilisearch.com/errors/#dump_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#dump_not_found */
DUMP_NOT_FOUND = "dump_not_found",
/** @see https://docs.meilisearch.com/errors/#invalid_swap_duplicate_index_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_swap_duplicate_index_found */
INVALID_SWAP_DUPLICATE_INDEX_FOUND = "invalid_swap_duplicate_index_found",
/** @see https://docs.meilisearch.com/errors/#invalid_swap_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_swap_indexes */
INVALID_SWAP_INDEXES = "invalid_swap_indexes",
/** @see https://docs.meilisearch.com/errors/#missing_swap_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_swap_indexes */
MISSING_SWAP_INDEXES = "missing_swap_indexes",
/** @see https://docs.meilisearch.com/errors/#missing_master_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_master_key */
MISSING_MASTER_KEY = "missing_master_key",
/** @see http://docs.meilisearch.com/errors/#invalid_task_types */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_types */
INVALID_TASK_TYPES = "invalid_task_types",
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_uids */
INVALID_TASK_UIDS = "invalid_task_uids",
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_statuses */
INVALID_TASK_STATUSES = "invalid_task_statuses",
/** @see http://docs.meilisearch.com/errors/#invalid_task_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_limit */
INVALID_TASK_LIMIT = "invalid_task_limit",
/** @see http://docs.meilisearch.com/errors/#invalid_task_from */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_from */
INVALID_TASK_FROM = "invalid_task_from",
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_canceled_by */
INVALID_TASK_CANCELED_BY = "invalid_task_canceled_by",
/** @see http://docs.meilisearch.com/errors/#missing_task_filters */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_task_filters */
MISSING_TASK_FILTERS = "missing_task_filters",
/** @see http://docs.meilisearch.com/errors/#too_many_open_files */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#too_many_open_files */
TOO_MANY_OPEN_FILES = "too_many_open_files",
/** @see http://docs.meilisearch.com/errors/#io_error */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#io_error */
IO_ERROR = "io_error",
/** @see http://docs.meilisearch.com/errors/#invalid_task_index_uids */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_index_uids */
INVALID_TASK_INDEX_UIDS = "invalid_task_index_uids",
/** @see http://docs.meilisearch.com/errors/#immutable_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_uid */
IMMUTABLE_INDEX_UID = "immutable_index_uid",
/** @see http://docs.meilisearch.com/errors/#immutable_index_created_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_created_at */
IMMUTABLE_INDEX_CREATED_AT = "immutable_index_created_at",
/** @see http://docs.meilisearch.com/errors/#immutable_index_updated_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_updated_at */
IMMUTABLE_INDEX_UPDATED_AT = "immutable_index_updated_at",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_displayed_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_displayed_attributes */
INVALID_SETTINGS_DISPLAYED_ATTRIBUTES = "invalid_settings_displayed_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_searchable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_searchable_attributes */
INVALID_SETTINGS_SEARCHABLE_ATTRIBUTES = "invalid_settings_searchable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_filterable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_filterable_attributes */
INVALID_SETTINGS_FILTERABLE_ATTRIBUTES = "invalid_settings_filterable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_sortable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_sortable_attributes */
INVALID_SETTINGS_SORTABLE_ATTRIBUTES = "invalid_settings_sortable_attributes",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_ranking_rules */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_ranking_rules */
INVALID_SETTINGS_RANKING_RULES = "invalid_settings_ranking_rules",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_stop_words */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_stop_words */
INVALID_SETTINGS_STOP_WORDS = "invalid_settings_stop_words",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_synonyms */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_synonyms */
INVALID_SETTINGS_SYNONYMS = "invalid_settings_synonyms",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_distinct_attribute */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_distinct_attribute */
INVALID_SETTINGS_DISTINCT_ATTRIBUTE = "invalid_settings_distinct_attribute",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_typo_tolerance */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_typo_tolerance */
INVALID_SETTINGS_TYPO_TOLERANCE = "invalid_settings_typo_tolerance",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_faceting */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_faceting */
INVALID_SETTINGS_FACETING = "invalid_settings_faceting",
/** @see http://docs.meilisearch.com/errors/#invalid_settings_pagination */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_pagination */
INVALID_SETTINGS_PAGINATION = "invalid_settings_pagination",
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_enqueued_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_api_key_actions */
MISSING_API_KEY_ACTIONS = "missing_api_key_actions",
/** @see http://docs.meilisearch.com/errors/#missing_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_api_key_indexes */
MISSING_API_KEY_INDEXES = "missing_api_key_indexes",
/** @see http://docs.meilisearch.com/errors/#missing_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_limit */
INVALID_API_KEY_LIMIT = "invalid_api_key_limit",
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_offset */
INVALID_API_KEY_OFFSET = "invalid_api_key_offset"

@@ -532,0 +557,0 @@ }

{
"name": "meilisearch",
"version": "0.32.5",
"version": "0.33.0-prototype-search-for-facet-values.0",
"description": "The Meilisearch JS client for Node.js and the browser.",

@@ -49,2 +49,3 @@ "keywords": [

"test:env:esm": "yarn --cwd tests/env/esm && yarn --cwd tests/env/esm start",
"test:env:nitro-app": "yarn build && yarn --cwd tests/env/nitro-app test",
"size": "node scripts/file-size ./dist/bundles/meilisearch.esm.min.js ./dist/bundles/meilisearch.umd.min.js",

@@ -76,7 +77,7 @@ "style": "yarn lint",

"devDependencies": {
"@babel/preset-env": "^7.21.5",
"@babel/preset-env": "^7.22.4",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "25.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.0.2",
"@rollup/plugin-node-resolve": "15.1.0",
"@types/jest": "^27.5.0",

@@ -93,3 +94,2 @@ "@types/prettier": "^2.2.3",

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

@@ -96,0 +96,0 @@ "eslint-plugin-prettier": "^3.1.4",

@@ -9,7 +9,7 @@ <p align="center">

<a href="https://github.com/meilisearch/meilisearch">Meilisearch</a> |
<a href="https://docs.meilisearch.com">Documentation</a> |
<a href="https://www.meilisearch.com/docs">Documentation</a> |
<a href="https://discord.meilisearch.com">Discord</a> |
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
<a href="https://www.meilisearch.com">Website</a> |
<a href="https://docs.meilisearch.com/faq">FAQ</a>
<a href="https://www.meilisearch.com/docs/faq">FAQ</a>
</h4>

@@ -45,3 +45,3 @@

For general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our [main documentation website](https://docs.meilisearch.com/).
For general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our [main documentation website](https://www.meilisearch.com/docs/).

@@ -62,3 +62,3 @@ ## 🔧 Installation

To use one of our SDKs, you must first have a running Meilisearch instance. Consult our documentation for [instructions on how to download and launch Meilisearch](https://docs.meilisearch.com/reference/features/installation.html#download-and-launch).
To use one of our SDKs, you must first have a running Meilisearch instance. Consult our documentation for [instructions on how to download and launch Meilisearch](https://www.meilisearch.com/docs/learn/getting_started/installation#installation).

@@ -160,3 +160,3 @@ ### Import <!-- omit in toc -->

Tasks such as document addition always return a unique identifier. You can use this identifier `taskUid` to check the status (`enqueued`, `processing`, `succeeded` or `failed`) of a [task](https://docs.meilisearch.com/reference/api/tasks.html#get-task).
Tasks such as document addition always return a unique identifier. You can use this identifier `taskUid` to check the status (`enqueued`, `processing`, `succeeded` or `failed`) of a [task](https://www.meilisearch.com/docs/reference/api/tasks).

@@ -192,3 +192,3 @@ ### Basic search <!-- omit in toc -->

`meilisearch-js` supports all [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) described in our main documentation website.
`meilisearch-js` supports all [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters) described in our main documentation website.

@@ -228,3 +228,3 @@ ```javascript

To enable filtering, you must first add your attributes to the [`filterableAttributes` index setting](https://docs.meilisearch.com/reference/api/filterable_attributes.html).
To enable filtering, you must first add your attributes to the [`filterableAttributes` index setting](https://www.meilisearch.com/docs/reference/api/settings#filterable-attributes).

@@ -240,5 +240,5 @@ ```js

Note that Meilisearch rebuilds your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take considerable time. You can track the process using the [tasks API](https://docs.meilisearch.com/reference/api/tasks.html#get-task)).
Note that Meilisearch rebuilds your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take considerable time. You can track the process using the [tasks API](https://www.meilisearch.com/docs/reference/api/tasks)).
After you configured `filterableAttributes`, you can use the [`filter` search parameter](https://docs.meilisearch.com/reference/api/search.html#filter) to refine your search:
After you configured `filterableAttributes`, you can use the [`filter` search parameter](https://www.meilisearch.com/docs/reference/api/search#filter) to refine your search:

@@ -314,3 +314,3 @@ ```js

Note that to enable faceted search on your dataset you need to add `genres` to the `filterableAttributes` index setting. For more information on filtering and faceting, [consult our documentation settings](https://docs.meilisearch.com/reference/features/faceted_search.html#setting-up-facets).
Note that to enable faceted search on your dataset you need to add `genres` to the `filterableAttributes` index setting. For more information on filtering and faceting, [consult our documentation settings](https://www.meilisearch.com/docs/learn/advanced/faceted_search).

@@ -386,6 +386,6 @@ #### Abortable search <!-- omit in toc -->

- **Manipulate documents**: see the [API references](https://docs.meilisearch.com/reference/api/documents.html) or read more about [documents](https://docs.meilisearch.com/learn/core_concepts/documents.html).
- **Search**: see the [API references](https://docs.meilisearch.com/reference/api/search.html) or follow our guide on [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html).
- **Manage the indexes**: see the [API references](https://docs.meilisearch.com/reference/api/indexes.html) or read more about [indexes](https://docs.meilisearch.com/learn/core_concepts/indexes.html).
- **Configure the index settings**: see the [API references](https://docs.meilisearch.com/reference/api/settings.html) or follow our guide on [settings parameters](https://docs.meilisearch.com/reference/features/settings.html).
- **Manipulate documents**: see the [API references](https://www.meilisearch.com/docs/reference/api/documents) or read more about [documents](https://www.meilisearch.com/docs/learn/core_concepts/documents.html).
- **Search**: see the [API references](https://www.meilisearch.com/docs/reference/api/search) or follow our guide on [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters).
- **Manage the indexes**: see the [API references](https://www.meilisearch.com/docs/reference/api/indexes) or read more about [indexes](https://www.meilisearch.com/docs/learn/core_concepts/indexes.html).
- **Configure the index settings**: see the [API references](https://www.meilisearch.com/docs/reference/api/settings) or follow our guide on [settings parameters](https://www.meilisearch.com/docs/reference/api/settings#settings_parameters).

@@ -402,3 +402,3 @@ This repository also contains [more examples](./examples).

#### [Make a search request](https://docs.meilisearch.com/reference/api/search.html)
#### [Make a search request](https://www.meilisearch.com/docs/reference/api/search)

@@ -409,3 +409,3 @@ ```ts

#### [Make a search request using the GET method (slower than the search method)](https://docs.meilisearch.com/reference/api/search.html#search-in-an-index-with-get-route)
#### [Make a search request using the GET method (slower than the search method)](https://www.meilisearch.com/docs/reference/api/search#search-in-an-index-with-get-route)

@@ -418,3 +418,3 @@ ```ts

#### [Make multiple search requests](https://docs.meilisearch.com/reference/api/multi-search.html)
#### [Make multiple search requests](https://www.meilisearch.com/docs/reference/api/multi_search#multi-search)

@@ -427,5 +427,13 @@ ```ts

### Search For Facet Value
#### [Search for facet value](#)
```ts
client.index<T>('xxx').searchForFacetValue(params: SearchForFacetValuesParams, config?: Partial<Request>): Promise<SearchForFacetValuesResponse>
```
### Documents <!-- omit in toc -->
#### [Add or replace multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-replace-documents)
#### [Add or replace multiple documents](https://www.meilisearch.com/docs/reference/api/documents#add-or-replace-documents)

@@ -436,3 +444,3 @@ ```ts

#### [Add or replace multiple documents in string format](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
#### [Add or replace multiple documents in string format](https://www.meilisearch.com/docs/reference/api/documents#add-or-update-documents)

@@ -443,3 +451,3 @@ ```ts

#### [Add or replace multiple documents in batches](https://docs.meilisearch.com/reference/api/documents.html#add-or-replace-documents)
#### [Add or replace multiple documents in batches](https://www.meilisearch.com/docs/reference/api/documents#add-or-replace-documents)

@@ -450,3 +458,3 @@ ```ts

#### [Add or update multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
#### [Add or update multiple documents](https://www.meilisearch.com/docs/reference/api/documents#add-or-update-documents)

@@ -457,3 +465,3 @@ ```ts

#### [Add or update multiple documents in string format](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
#### [Add or update multiple documents in string format](https://www.meilisearch.com/docs/reference/api/documents#add-or-update-documents)

@@ -464,3 +472,3 @@ ```ts

#### [Add or update multiple documents in batches](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
#### [Add or update multiple documents in batches](https://www.meilisearch.com/docs/reference/api/documents#add-or-update-documents)

@@ -471,3 +479,3 @@ ```ts

#### [Get Documents](https://docs.meilisearch.com/reference/api/documents.html#get-documents)
#### [Get Documents](https://www.meilisearch.com/docs/reference/api/documents#get-documents)

@@ -478,3 +486,3 @@ ```ts

#### [Get one document](https://docs.meilisearch.com/reference/api/documents.html#get-one-document)
#### [Get one document](https://www.meilisearch.com/docs/reference/api/documents#get-one-document)

@@ -485,3 +493,3 @@ ```ts

#### [Delete one document](https://docs.meilisearch.com/reference/api/documents.html#delete-one-document)
#### [Delete one document](https://www.meilisearch.com/docs/reference/api/documents#delete-one-document)

@@ -492,9 +500,9 @@ ```ts

#### [Delete multiple documents](https://docs.meilisearch.com/reference/api/documents.html#delete-documents)
#### [Delete multiple documents](https://www.meilisearch.com/docs/reference/api/documents#delete-documents)
```ts
client.index('myIndex').deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedTask>
client.index('myIndex').deleteDocuments(params: DocumentsDeletionQuery | DocumentsIds): Promise<EnqueuedTask>
```
#### [Delete all documents](https://docs.meilisearch.com/reference/api/documents.html#delete-all-documents)
#### [Delete all documents](https://www.meilisearch.com/docs/reference/api/documents#delete-all-documents)

@@ -507,3 +515,3 @@ ```ts

#### [Get all tasks](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks)
#### [Get all tasks](https://www.meilisearch.com/docs/reference/api/tasks.html#get-all-tasks)

@@ -514,3 +522,3 @@ ```ts

#### [Get one task](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
#### [Get one task](https://www.meilisearch.com/docs/reference/api/tasks)

@@ -521,3 +529,3 @@ ```ts

#### [Delete tasks](https://docs.meilisearch.com/reference/api/tasks.html#delete-task)
#### [Delete tasks](https://www.meilisearch.com/docs/reference/api/tasks.html#delete-task)

@@ -528,3 +536,3 @@ ```ts

#### [Cancel tasks](https://docs.meilisearch.com/reference/api/tasks.html#cancel-task)
#### [Cancel tasks](https://www.meilisearch.com/docs/reference/api/tasks.html#cancel-task)

@@ -535,3 +543,3 @@ ```ts

#### [Get all tasks of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks-by-index)
#### [Get all tasks of an index](https://www.meilisearch.com/docs/reference/api/tasks.html#get-all-tasks-by-index)

@@ -542,3 +550,3 @@ ```ts

#### [Get one task of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
#### [Get one task of an index](https://www.meilisearch.com/docs/reference/api/tasks)

@@ -581,3 +589,3 @@ ```ts

#### [Get all indexes in Index instances](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes)
#### [Get all indexes in Index instances](https://www.meilisearch.com/docs/reference/api/indexes#list-all-indexes)

@@ -588,3 +596,3 @@ ```ts

#### [Get all indexes](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes)
#### [Get all indexes](https://www.meilisearch.com/docs/reference/api/indexes#list-all-indexes)

@@ -596,3 +604,3 @@ ```ts

#### [Create a new index](https://docs.meilisearch.com/reference/api/indexes.html#create-an-index)
#### [Create a new index](https://www.meilisearch.com/docs/reference/api/indexes#create-an-index)

@@ -609,3 +617,3 @@ ```ts

#### [Get an index instance completed with information fetched from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
#### [Get an index instance completed with information fetched from Meilisearch](https://www.meilisearch.com/docs/reference/api/indexes#get-one-index)

@@ -616,3 +624,3 @@ ```ts

#### [Get the raw index JSON response from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
#### [Get the raw index JSON response from Meilisearch](https://www.meilisearch.com/docs/reference/api/indexes#get-one-index)

@@ -623,3 +631,3 @@ ```ts

#### [Get an object with information about the index](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
#### [Get an object with information about the index](https://www.meilisearch.com/docs/reference/api/indexes#get-one-index)

@@ -630,3 +638,3 @@ ```ts

#### [Update Index](https://docs.meilisearch.com/reference/api/indexes.html#update-an-index)
#### [Update Index](https://www.meilisearch.com/docs/reference/api/indexes#update-an-index)

@@ -645,3 +653,3 @@ ##### Using the client

#### [Delete index](https://docs.meilisearch.com/reference/api/indexes.html#delete-an-index)
#### [Delete index](https://www.meilisearch.com/docs/reference/api/indexes#delete-an-index)

@@ -658,3 +666,3 @@ ##### Using the client

#### [Get specific index stats](https://docs.meilisearch.com/reference/api/stats.html#get-stat-of-an-index)
#### [Get specific index stats](https://www.meilisearch.com/docs/reference/api/stats.html#get-stat-of-an-index)

@@ -685,3 +693,3 @@ ```ts

#### [Get settings](https://docs.meilisearch.com/reference/api/settings.html#get-settings)
#### [Get settings](https://www.meilisearch.com/docs/reference/api/settings#get-settings)

@@ -692,3 +700,3 @@ ```ts

#### [Update settings](https://docs.meilisearch.com/reference/api/settings.html#update-settings)
#### [Update settings](https://www.meilisearch.com/docs/reference/api/settings#update-settings)

@@ -699,3 +707,3 @@ ```ts

#### [Reset settings](https://docs.meilisearch.com/reference/api/settings.html#reset-settings)
#### [Reset settings](https://www.meilisearch.com/docs/reference/api/settings#reset-settings)

@@ -708,3 +716,3 @@ ```ts

#### [Get pagination](https://docs.meilisearch.com/reference/api/settings.html#get-pagination-settings)
#### [Get pagination](https://www.meilisearch.com/docs/reference/api/settings#get-pagination-settings)

@@ -715,3 +723,3 @@ ```ts

#### [Update pagination](https://docs.meilisearch.com/reference/api/settings.html#update-pagination-settings)
#### [Update pagination](https://www.meilisearch.com/docs/reference/api/settings#update-pagination-settings)

@@ -722,3 +730,3 @@ ```ts

#### [Reset pagination](https://docs.meilisearch.com/reference/api/settings.html#reset-pagination-settings)
#### [Reset pagination](https://www.meilisearch.com/docs/reference/api/settings#reset-pagination-settings)

@@ -731,3 +739,3 @@ ```ts

#### [Get synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#get-synonyms)
#### [Get synonyms](https://www.meilisearch.com/docs/reference/api/settings#get-synonyms)

@@ -738,3 +746,3 @@ ```ts

#### [Update synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#update-synonyms)
#### [Update synonyms](https://www.meilisearch.com/docs/reference/api/settings#update-synonyms)

@@ -745,3 +753,3 @@ ```ts

#### [Reset synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#reset-synonyms)
#### [Reset synonyms](https://www.meilisearch.com/docs/reference/api/settings#reset-synonyms)

@@ -754,3 +762,3 @@ ```ts

#### [Get stop words](https://docs.meilisearch.com/reference/api/stop_words.html#get-stop-words)
#### [Get stop words](https://www.meilisearch.com/docs/reference/api/settings#get-stop-words)

@@ -761,3 +769,3 @@ ```ts

#### [Update stop words](https://docs.meilisearch.com/reference/api/stop_words.html#update-stop-words)
#### [Update stop words](https://www.meilisearch.com/docs/reference/api/settings#update-stop-words)

@@ -768,3 +776,3 @@ ```ts

#### [Reset stop words](https://docs.meilisearch.com/reference/api/stop_words.html#reset-stop-words)
#### [Reset stop words](https://www.meilisearch.com/docs/reference/api/settings#reset-stop-words)

@@ -777,3 +785,3 @@ ```ts

#### [Get ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#get-ranking-rules)
#### [Get ranking rules](https://www.meilisearch.com/docs/reference/api/settings#get-ranking-rules)

@@ -784,3 +792,3 @@ ```ts

#### [Update ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#update-ranking-rules)
#### [Update ranking rules](https://www.meilisearch.com/docs/reference/api/settings#update-ranking-rules)

@@ -791,3 +799,3 @@ ```ts

#### [Reset ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#reset-ranking-rules)
#### [Reset ranking rules](https://www.meilisearch.com/docs/reference/api/settings#reset-ranking-rules)

@@ -800,3 +808,3 @@ ```ts

#### [Get distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#get-distinct-attribute)
#### [Get distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#get-distinct-attribute)

@@ -807,3 +815,3 @@ ```ts

#### [Update distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#update-distinct-attribute)
#### [Update distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#update-distinct-attribute)

@@ -814,3 +822,3 @@ ```ts

#### [Reset distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#reset-distinct-attribute)
#### [Reset distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#reset-distinct-attribute)

@@ -823,3 +831,3 @@ ```ts

#### [Get searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#get-searchable-attributes)
#### [Get searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#get-searchable-attributes)

@@ -830,3 +838,3 @@ ```ts

#### [Update searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#update-searchable-attributes)
#### [Update searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#update-searchable-attributes)

@@ -837,3 +845,3 @@ ```ts

#### [Reset searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#reset-searchable-attributes)
#### [Reset searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#reset-searchable-attributes)

@@ -846,3 +854,3 @@ ```ts

#### [Get displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#get-displayed-attributes)
#### [Get displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#get-displayed-attributes)

@@ -853,3 +861,3 @@ ```ts

#### [Update displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#update-displayed-attributes)
#### [Update displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#update-displayed-attributes)

@@ -860,3 +868,3 @@ ```ts

#### [Reset displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#reset-displayed-attributes)
#### [Reset displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#reset-displayed-attributes)

@@ -869,3 +877,3 @@ ```ts

#### [Get filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#get-filterable-attributes)
#### [Get filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#get-filterable-attributes)

@@ -876,3 +884,3 @@ ```ts

#### [Update filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes)
#### [Update filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#update-filterable-attributes)

@@ -883,3 +891,3 @@ ```ts

#### [Reset filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#reset-filterable-attributes)
#### [Reset filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#reset-filterable-attributes)

@@ -892,3 +900,3 @@ ```ts

#### [Get sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#get-sortable-attributes)
#### [Get sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#get-sortable-attributes)

@@ -899,3 +907,3 @@ ```ts

#### [Update sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#update-sortable-attributes)
#### [Update sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#update-sortable-attributes)

@@ -906,3 +914,3 @@ ```ts

#### [Reset sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#reset-sortable-attributes)
#### [Reset sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#reset-sortable-attributes)

@@ -915,3 +923,3 @@ ```ts

#### [Get faceting](https://docs.meilisearch.com/reference/api/settings.html#get-faceting-settings)
#### [Get faceting](https://www.meilisearch.com/docs/reference/api/settings#get-faceting-settings)

@@ -922,3 +930,3 @@ ```ts

#### [Update faceting](https://docs.meilisearch.com/reference/api/settings.html#update-faceting-settings)
#### [Update faceting](https://www.meilisearch.com/docs/reference/api/settings#update-faceting-settings)

@@ -929,3 +937,3 @@ ```ts

#### [Reset faceting](https://docs.meilisearch.com/reference/api/settings.html#reset-faceting-settings)
#### [Reset faceting](https://www.meilisearch.com/docs/reference/api/settings#reset-faceting-settings)

@@ -938,3 +946,3 @@ ```ts

#### [Get typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#get-typo-tolerance)
#### [Get typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#get-typo-tolerance-settings)

@@ -945,3 +953,3 @@ ```ts

#### [Update typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#update-typo-tolerance)
#### [Update typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#update-typo-tolerance-settings)

@@ -952,3 +960,3 @@ ```ts

#### [Reset typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#reset-typo-tolerance)
#### [Reset typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#reset-typo-tolerance-settings)

@@ -961,3 +969,3 @@ ```ts

#### [Get keys](https://docs.meilisearch.com/reference/api/keys.html#get-all-keys)
#### [Get keys](https://www.meilisearch.com/docs/reference/api/keys.html#get-all-keys)

@@ -968,3 +976,3 @@ ```ts

#### [Get one key](https://docs.meilisearch.com/reference/api/keys.html#get-one-key)
#### [Get one key](https://www.meilisearch.com/docs/reference/api/keys.html#get-one-key)

@@ -975,3 +983,3 @@ ```ts

#### [Create a key](https://docs.meilisearch.com/reference/api/keys.html#create-a-key)
#### [Create a key](https://www.meilisearch.com/docs/reference/api/keys.html#create-a-key)

@@ -982,3 +990,3 @@ ```ts

#### [Update a key](https://docs.meilisearch.com/reference/api/keys.html#update-a-key)
#### [Update a key](https://www.meilisearch.com/docs/reference/api/keys.html#update-a-key)

@@ -989,3 +997,3 @@ ```ts

#### [Delete a key](https://docs.meilisearch.com/reference/api/keys.html#delete-a-key)
#### [Delete a key](https://www.meilisearch.com/docs/reference/api/keys.html#delete-a-key)

@@ -998,3 +1006,3 @@ ```ts

#### [Return `true` or `false` depending on the health of the server](https://docs.meilisearch.com/reference/api/health.html#get-health)
#### [Return `true` or `false` depending on the health of the server](https://www.meilisearch.com/docs/reference/api/health.html#get-health)

@@ -1007,3 +1015,3 @@ ```ts

#### [Check if the server is healthy](https://docs.meilisearch.com/reference/api/health.html#get-health)
#### [Check if the server is healthy](https://www.meilisearch.com/docs/reference/api/health.html#get-health)

@@ -1016,3 +1024,3 @@ ```ts

#### [Get database stats](https://docs.meilisearch.com/reference/api/stats.html#get-stats-of-all-indexes)
#### [Get database stats](https://www.meilisearch.com/docs/reference/api/stats.html#get-stats-of-all-indexes)

@@ -1025,3 +1033,3 @@ ```ts

#### [Get binary version](https://docs.meilisearch.com/reference/api/version.html#get-version-of-meilisearch)
#### [Get binary version](https://www.meilisearch.com/docs/reference/api/version.html#get-version-of-meilisearch)

@@ -1034,3 +1042,3 @@ ```ts

#### [Trigger a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#create-a-dump)
#### [Trigger a dump creation process](https://www.meilisearch.com/docs/reference/api/dump.html#create-a-dump)

@@ -1037,0 +1045,0 @@ ```ts

@@ -6,1 +6,2 @@ export * from './http-error-handler'

export * from './meilisearch-timeout-error'
export * from './version-hint-message'

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

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

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

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

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

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

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

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

@@ -10,5 +10,9 @@ /*

import { MeiliSearchError } from './errors'
import {
MeiliSearchError,
MeiliSearchCommunicationError,
versionErrorHintMessage,
MeiliSearchApiError,
} from './errors'
import {
Config,

@@ -43,2 +47,6 @@ SearchResponse,

ContentType,
DocumentsIds,
DocumentsDeletionQuery,
SearchForFacetValuesParams,
SearchForFacetValuesResponse,
} from './types'

@@ -145,2 +153,23 @@ import { removeUndefinedFromObject } from './utils'

/**
* Search for facet values
*
* @param params - Parameters used to search on the facets
* @param config - Additional request configuration options
* @returns Promise containing the search response
*/
async searchForFacetValue(
params: SearchForFacetValuesParams,
config?: Partial<Request>
): Promise<SearchForFacetValuesResponse> {
const url = `indexes/${this.uid}/facet-search`
return await this.httpRequest.post(
url,
removeUndefinedFromObject(params),
undefined,
config
)
}
///

@@ -308,6 +337,7 @@ /// INDEX

/**
* Get documents of an index
* Get documents of an index.
*
* @param parameters - Parameters to browse the documents
* @returns Promise containing Document responses
* @param parameters - Parameters to browse the documents. Parameters can
* contain the `filter` field only available in Meilisearch v1.2 and newer
* @returns Promise containing the returned documents
*/

@@ -317,18 +347,36 @@ async getDocuments<D extends Record<string, any> = T>(

): Promise<ResourceResults<D[]>> {
const url = `indexes/${this.uid}/documents`
parameters = removeUndefinedFromObject(parameters)
const fields = (() => {
if (Array.isArray(parameters?.fields)) {
return parameters?.fields?.join(',')
// In case `filter` is provided, use `POST /documents/fetch`
if (parameters.filter !== undefined) {
try {
const url = `indexes/${this.uid}/documents/fetch`
return await this.httpRequest.post<
DocumentsQuery,
Promise<ResourceResults<D[]>>
>(url, parameters)
} catch (e) {
if (e instanceof MeiliSearchCommunicationError) {
e.message = versionErrorHintMessage(e.message, 'getDocuments')
} else if (e instanceof MeiliSearchApiError) {
e.message = versionErrorHintMessage(e.message, 'getDocuments')
}
throw e
}
return undefined
})()
// Else use `GET /documents` method
} else {
const url = `indexes/${this.uid}/documents`
return await this.httpRequest.get<Promise<ResourceResults<D[]>>>(
url,
removeUndefinedFromObject({
// Transform fields to query parameter string format
const fields = Array.isArray(parameters?.fields)
? { fields: parameters?.fields?.join(',') }
: {}
return await this.httpRequest.get<Promise<ResourceResults<D[]>>>(url, {
...parameters,
fields,
...fields,
})
)
}
}

@@ -511,15 +559,39 @@

/**
* Delete multiples documents of an index
* Delete multiples documents of an index.
*
* @param documentsIds - Array of Document Ids to delete
* @param params - Params value can be:
*
* - DocumentsDeletionQuery: An object containing the parameters to customize
* your document deletion. Only available in Meilisearch v1.2 and newer
* - DocumentsIds: An array of document ids to delete
*
* @returns Promise containing an EnqueuedTask
*/
async deleteDocuments(
documentsIds: string[] | number[]
params: DocumentsDeletionQuery | DocumentsIds
): Promise<EnqueuedTask> {
const url = `indexes/${this.uid}/documents/delete-batch`
// If params is of type DocumentsDeletionQuery
const isDocumentsDeletionQuery =
!Array.isArray(params) && typeof params === 'object'
const endpoint = isDocumentsDeletionQuery
? 'documents/delete'
: 'documents/delete-batch'
const url = `indexes/${this.uid}/${endpoint}`
const task = await this.httpRequest.post(url, documentsIds)
try {
const task = await this.httpRequest.post(url, params)
return new EnqueuedTask(task)
return new EnqueuedTask(task)
} catch (e) {
if (
e instanceof MeiliSearchCommunicationError &&
isDocumentsDeletionQuery
) {
e.message = versionErrorHintMessage(e.message, 'deleteDocuments')
} else if (e instanceof MeiliSearchApiError) {
e.message = versionErrorHintMessage(e.message, 'deleteDocuments')
}
throw e
}
}

@@ -526,0 +598,0 @@

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

export const PACKAGE_VERSION = '0.32.5'
export const PACKAGE_VERSION = '0.33.0-prototype-search-for-facet-values.0'

@@ -115,3 +115,3 @@ import { Config, TokenSearchRules, TokenOptions } from './types'

apiKeyUid: uid,
exp: expiresAt?.getTime(),
exp: expiresAt ? Math.floor(expiresAt.getTime() / 1000) : undefined,
}

@@ -118,0 +118,0 @@

@@ -193,2 +193,25 @@ // Type definitions for meilisearch

/*
* Facet search
*/
export type SearchForFacetValuesParams = SearchParams & {
facetName: string
facetQuery?: string
q?: string
filter?: Filter
matchingStrategy?: MatchingStrategies
}
export type FacetHit = {
value: string
count: number
}
export type SearchForFacetValuesResponse = {
hits: FacetHit[]
query: string | null
processingTimeMs: number
}
/*
** Documents

@@ -222,2 +245,3 @@ */

fields?: Fields<T>
filter?: Filter
}

@@ -229,2 +253,8 @@

export type DocumentsDeletionQuery = {
filter: Filter
}
export type DocumentsIds = string[] | number[]
/*

@@ -495,315 +525,321 @@ ** Settings

export const enum ErrorStatusCode {
/** @see https://docs.meilisearch.com/errors/#index_creation_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_creation_failed */
INDEX_CREATION_FAILED = 'index_creation_failed',
/** @see https://docs.meilisearch.com/errors/#missing_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_index_uid */
MISSING_INDEX_UID = 'missing_index_uid',
/** @see https://docs.meilisearch.com/errors/#index_already_exists */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_already_exists */
INDEX_ALREADY_EXISTS = 'index_already_exists',
/** @see https://docs.meilisearch.com/errors/#index_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_not_found */
INDEX_NOT_FOUND = 'index_not_found',
/** @see https://docs.meilisearch.com/errors/#invalid_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_uid */
INVALID_INDEX_UID = 'invalid_index_uid',
/** @see https://docs.meilisearch.com/errors/#index_not_accessible */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_not_accessible */
INDEX_NOT_ACCESSIBLE = 'index_not_accessible',
/** @see https://docs.meilisearch.com/errors/#invalid_index_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_offset */
INVALID_INDEX_OFFSET = 'invalid_index_offset',
/** @see https://docs.meilisearch.com/errors/#invalid_index_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_limit */
INVALID_INDEX_LIMIT = 'invalid_index_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_state */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_state */
INVALID_STATE = 'invalid_state',
/** @see https://docs.meilisearch.com/errors/#primary_key_inference_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#primary_key_inference_failed */
PRIMARY_KEY_INFERENCE_FAILED = 'primary_key_inference_failed',
/** @see https://docs.meilisearch.com/errors/#index_primary_key_already_exists */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#index_primary_key_already_exists */
INDEX_PRIMARY_KEY_ALREADY_EXISTS = 'index_primary_key_already_exists',
/** @see https://docs.meilisearch.com/errors/#invalid_index_primary_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_index_primary_key */
INVALID_INDEX_PRIMARY_KEY = 'invalid_index_primary_key',
/** @see https://docs.meilisearch.com/errors/#max_fields_limit_exceeded */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#max_fields_limit_exceeded */
DOCUMENTS_FIELDS_LIMIT_REACHED = 'document_fields_limit_reached',
/** @see https://docs.meilisearch.com/errors/#missing_document_id */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_document_id */
MISSING_DOCUMENT_ID = 'missing_document_id',
/** @see https://docs.meilisearch.com/errors/#missing_document_id */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_document_id */
INVALID_DOCUMENT_ID = 'invalid_document_id',
/** @see https://docs.meilisearch.com/errors/#invalid_content_type */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_content_type */
INVALID_CONTENT_TYPE = 'invalid_content_type',
/** @see https://docs.meilisearch.com/errors/#missing_content_type */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_content_type */
MISSING_CONTENT_TYPE = 'missing_content_type',
/** @see https://docs.meilisearch.com/errors/#invalid_document_fields */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_fields */
INVALID_DOCUMENT_FIELDS = 'invalid_document_fields',
/** @see https://docs.meilisearch.com/errors/#invalid_document_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_limit */
INVALID_DOCUMENT_LIMIT = 'invalid_document_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_document_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
INVALID_DOCUMENT_OFFSET = 'invalid_document_offset',
/** @see https://docs.meilisearch.com/errors/#payload_too_large */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
INVALID_DOCUMENT_FILTER = 'invalid_document_filter',
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_offset */
MISSING_DOCUMENT_FILTER = 'missing_document_filter',
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#payload_too_large */
PAYLOAD_TOO_LARGE = 'payload_too_large',
/** @see https://docs.meilisearch.com/errors/#missing_payload */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_payload */
MISSING_PAYLOAD = 'missing_payload',
/** @see https://docs.meilisearch.com/errors/#malformed_payload */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#malformed_payload */
MALFORMED_PAYLOAD = 'malformed_payload',
/** @see https://docs.meilisearch.com/errors/#no_space_left_on_device */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#no_space_left_on_device */
NO_SPACE_LEFT_ON_DEVICE = 'no_space_left_on_device',
/** @see https://docs.meilisearch.com/errors/#invalid_store_file */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_store_file */
INVALID_STORE_FILE = 'invalid_store_file',
/** @see https://docs.meilisearch.com/errors/#invalid_ranking_rules */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_ranking_rules */
INVALID_RANKING_RULES = 'missing_document_id',
/** @see https://docs.meilisearch.com/errors/#invalid_request */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_request */
INVALID_REQUEST = 'invalid_request',
/** @see https://docs.meilisearch.com/errors/#invalid_document_geo_field */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_document_geo_field */
INVALID_DOCUMENT_GEO_FIELD = 'invalid_document_geo_field',
/** @see https://docs.meilisearch.com/errors/#invalid_search_q */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_q */
INVALID_SEARCH_Q = 'invalid_search_q',
/** @see https://docs.meilisearch.com/errors/#invalid_search_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_offset */
INVALID_SEARCH_OFFSET = 'invalid_search_offset',
/** @see https://docs.meilisearch.com/errors/#invalid_search_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_limit */
INVALID_SEARCH_LIMIT = 'invalid_search_limit',
/** @see https://docs.meilisearch.com/errors/#invalid_search_page */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_page */
INVALID_SEARCH_PAGE = 'invalid_search_page',
/** @see https://docs.meilisearch.com/errors/#invalid_search_hits_per_page */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_crop_length */
INVALID_SEARCH_CROP_LENGTH = 'invalid_search_crop_length',
/** @see https://docs.meilisearch.com/errors/#invalid_search_attributes_to_highlight */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_show_matches_position */
INVALID_SEARCH_SHOW_MATCHES_POSITION = 'invalid_search_show_matches_position',
/** @see https://docs.meilisearch.com/errors/#invalid_search_filter */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_filter */
INVALID_SEARCH_FILTER = 'invalid_search_filter',
/** @see https://docs.meilisearch.com/errors/#invalid_search_sort */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_sort */
INVALID_SEARCH_SORT = 'invalid_search_sort',
/** @see https://docs.meilisearch.com/errors/#invalid_search_facets */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_facets */
INVALID_SEARCH_FACETS = 'invalid_search_facets',
/** @see https://docs.meilisearch.com/errors/#invalid_search_highlight_pre_tag */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_crop_marker */
INVALID_SEARCH_CROP_MARKER = 'invalid_search_crop_marker',
/** @see https://docs.meilisearch.com/errors/#invalid_search_matching_strategy */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_search_matching_strategy */
INVALID_SEARCH_MATCHING_STRATEGY = 'invalid_search_matching_strategy',
/** @see https://docs.meilisearch.com/errors/#bad_request */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#bad_request */
BAD_REQUEST = 'bad_request',
/** @see https://docs.meilisearch.com/errors/#document_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#document_not_found */
DOCUMENT_NOT_FOUND = 'document_not_found',
/** @see https://docs.meilisearch.com/errors/#internal */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#internal */
INTERNAL = 'internal',
/** @see https://docs.meilisearch.com/errors/#invalid_api_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key */
INVALID_API_KEY = 'invalid_api_key',
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_description */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_description */
INVALID_API_KEY_DESCRIPTION = 'invalid_api_key_description',
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_actions */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_actions */
INVALID_API_KEY_ACTIONS = 'invalid_api_key_actions',
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_indexes */
INVALID_API_KEY_INDEXES = 'invalid_api_key_indexes',
/** @see https://docs.meilisearch.com/errors/#invalid_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_expires_at */
INVALID_API_KEY_EXPIRES_AT = 'invalid_api_key_expires_at',
/** @see https://docs.meilisearch.com/errors/#api_key_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#api_key_not_found */
API_KEY_NOT_FOUND = 'api_key_not_found',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_uid */
IMMUTABLE_API_KEY_UID = 'immutable_api_key_uid',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_actions */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_actions */
IMMUTABLE_API_KEY_ACTIONS = 'immutable_api_key_actions',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_indexes */
IMMUTABLE_API_KEY_INDEXES = 'immutable_api_key_indexes',
/** @see https://docs.meilisearch.com/errors/#immutable_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_api_key_updated_at */
IMMUTABLE_API_KEY_UPDATED_AT = 'immutable_api_key_updated_at',
/** @see https://docs.meilisearch.com/errors/#missing_authorization_header */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_authorization_header */
MISSING_AUTHORIZATION_HEADER = 'missing_authorization_header',
/** @see https://docs.meilisearch.com/errors/#unretrievable_document */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#unretrievable_document */
UNRETRIEVABLE_DOCUMENT = 'unretrievable_document',
/** @see https://docs.meilisearch.com/errors/#database_size_limit_reached */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#database_size_limit_reached */
MAX_DATABASE_SIZE_LIMIT_REACHED = 'database_size_limit_reached',
/** @see https://docs.meilisearch.com/errors/#task_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#task_not_found */
TASK_NOT_FOUND = 'task_not_found',
/** @see https://docs.meilisearch.com/errors/#dump_process_failed */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#dump_process_failed */
DUMP_PROCESS_FAILED = 'dump_process_failed',
/** @see https://docs.meilisearch.com/errors/#dump_not_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#dump_not_found */
DUMP_NOT_FOUND = 'dump_not_found',
/** @see https://docs.meilisearch.com/errors/#invalid_swap_duplicate_index_found */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_swap_duplicate_index_found */
INVALID_SWAP_DUPLICATE_INDEX_FOUND = 'invalid_swap_duplicate_index_found',
/** @see https://docs.meilisearch.com/errors/#invalid_swap_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_swap_indexes */
INVALID_SWAP_INDEXES = 'invalid_swap_indexes',
/** @see https://docs.meilisearch.com/errors/#missing_swap_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_swap_indexes */
MISSING_SWAP_INDEXES = 'missing_swap_indexes',
/** @see https://docs.meilisearch.com/errors/#missing_master_key */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_master_key */
MISSING_MASTER_KEY = 'missing_master_key',
/** @see http://docs.meilisearch.com/errors/#invalid_task_types */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_types */
INVALID_TASK_TYPES = 'invalid_task_types',
/** @see http://docs.meilisearch.com/errors/#invalid_task_uids */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_uids */
INVALID_TASK_UIDS = 'invalid_task_uids',
/** @see http://docs.meilisearch.com/errors/#invalid_task_statuses */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_statuses */
INVALID_TASK_STATUSES = 'invalid_task_statuses',
/** @see http://docs.meilisearch.com/errors/#invalid_task_limit */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_limit */
INVALID_TASK_LIMIT = 'invalid_task_limit',
/** @see http://docs.meilisearch.com/errors/#invalid_task_from */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_from */
INVALID_TASK_FROM = 'invalid_task_from',
/** @see http://docs.meilisearch.com/errors/#invalid_task_canceled_by */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_canceled_by */
INVALID_TASK_CANCELED_BY = 'invalid_task_canceled_by',
/** @see http://docs.meilisearch.com/errors/#missing_task_filters */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_task_filters */
MISSING_TASK_FILTERS = 'missing_task_filters',
/** @see http://docs.meilisearch.com/errors/#too_many_open_files */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#too_many_open_files */
TOO_MANY_OPEN_FILES = 'too_many_open_files',
/** @see http://docs.meilisearch.com/errors/#io_error */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#io_error */
IO_ERROR = 'io_error',
/** @see http://docs.meilisearch.com/errors/#invalid_task_index_uids */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_task_index_uids */
INVALID_TASK_INDEX_UIDS = 'invalid_task_index_uids',
/** @see http://docs.meilisearch.com/errors/#immutable_index_uid */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_uid */
IMMUTABLE_INDEX_UID = 'immutable_index_uid',
/** @see http://docs.meilisearch.com/errors/#immutable_index_created_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_created_at */
IMMUTABLE_INDEX_CREATED_AT = 'immutable_index_created_at',
/** @see http://docs.meilisearch.com/errors/#immutable_index_updated_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#immutable_index_updated_at */
IMMUTABLE_INDEX_UPDATED_AT = 'immutable_index_updated_at',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_displayed_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_displayed_attributes */
INVALID_SETTINGS_DISPLAYED_ATTRIBUTES = 'invalid_settings_displayed_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_searchable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_searchable_attributes */
INVALID_SETTINGS_SEARCHABLE_ATTRIBUTES = 'invalid_settings_searchable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_filterable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_filterable_attributes */
INVALID_SETTINGS_FILTERABLE_ATTRIBUTES = 'invalid_settings_filterable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_sortable_attributes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_sortable_attributes */
INVALID_SETTINGS_SORTABLE_ATTRIBUTES = 'invalid_settings_sortable_attributes',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_ranking_rules */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_ranking_rules */
INVALID_SETTINGS_RANKING_RULES = 'invalid_settings_ranking_rules',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_stop_words */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_stop_words */
INVALID_SETTINGS_STOP_WORDS = 'invalid_settings_stop_words',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_synonyms */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_synonyms */
INVALID_SETTINGS_SYNONYMS = 'invalid_settings_synonyms',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_distinct_attribute */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_distinct_attribute */
INVALID_SETTINGS_DISTINCT_ATTRIBUTE = 'invalid_settings_distinct_attribute',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_typo_tolerance */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_typo_tolerance */
INVALID_SETTINGS_TYPO_TOLERANCE = 'invalid_settings_typo_tolerance',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_faceting */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_faceting */
INVALID_SETTINGS_FACETING = 'invalid_settings_faceting',
/** @see http://docs.meilisearch.com/errors/#invalid_settings_pagination */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_settings_pagination */
INVALID_SETTINGS_PAGINATION = 'invalid_settings_pagination',
/** @see http://docs.meilisearch.com/errors/#invalid_task_before_enqueued_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_api_key_actions */
MISSING_API_KEY_ACTIONS = 'missing_api_key_actions',
/** @see http://docs.meilisearch.com/errors/#missing_api_key_indexes */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#missing_api_key_indexes */
MISSING_API_KEY_INDEXES = 'missing_api_key_indexes',
/** @see http://docs.meilisearch.com/errors/#missing_api_key_expires_at */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#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 */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_limit */
INVALID_API_KEY_LIMIT = 'invalid_api_key_limit',
/** @see http://docs.meilisearch.com/errors/#invalid_api_key_offset */
/** @see https://www.meilisearch.com/docs/reference/errors/error_codes#invalid_api_key_offset */
INVALID_API_KEY_OFFSET = 'invalid_api_key_offset',

@@ -810,0 +846,0 @@ }

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

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