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.27.0 to 0.28.0-beta.0

30

CONTRIBUTING.md

@@ -37,3 +37,3 @@ # Contributing

- Node.js >= v12 and node <= 16
- Node.js >= v14 and node <= 18
- Yarn

@@ -139,13 +139,20 @@

- Create a new branch originating the branch containing the "beta" changes. For example, if during the Meilisearch pre-release, create a branch originating `bump-meilisearch-v*.*.*`.<br>
`vX.X.X` is the next version of the package, NOT the version of Meilisearch!
- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.
```bash
git checkout bump-meilisearch-v*.*.*
git pull origin bump-meilisearch-v*.*.*
git checkout -b vX.X.X-beta.0
```
For example:
- When implementing a beta feature, create a branch `my-feature-beta` where you implement the feature.
```bash
git checkout -b my-feature-beta
```
- During the Meilisearch pre-release, create a branch originating from `bump-meilisearch-v*.*.*` named `meilisearch-v*.*.*-beta`. <br>
`v*.*.*` is the next version of the package, NOT the version of Meilisearch!
- Change the version in `package.json` with `X.X.X-beta.0` and commit it to the `vX.X.X-beta.0` branch
```bash
git checkout bump-meilisearch-v*.*.*
git pull origin bump-meilisearch-v*.*.*
git checkout -b bump-meilisearch-v*.*.*-beta
```
- Change the version in [`package.json`](/package.json) and in [`src/package-version`](/src/package-version.ts) with `*.*.*-xxx-beta.0` and commit it to the `beta` branch.
- Go to the [GitHub interface for releasing](https://github.com/meilisearch/meilisearch-js/releases): on this page, click on `Draft a new release`.

@@ -164,5 +171,4 @@

💡 If you need to release a new beta for the same version (i.e. `vX.X.X-beta.1`):
- merge the change into `bump-meilisearch-v*.*.*`
- rebase the `vX.X.X-beta.0` branch
- change the version name in `package.json`
- merge the change into your beta branch
- change the version name in [`package.json`](/package.json) and in [`src/package-version`](/src/package-version.ts)
- creata a pre-release via the GitHub interface

@@ -169,0 +175,0 @@

2

dist/bundles/meilisearch.esm.min.js

@@ -15,3 +15,3 @@ import"cross-fetch/polyfill";import t from"crypto";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */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])})(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}).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 f(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()]}}))}))}var p=function(){function t(t){this.headers=function(t){var e="Meilisearch JavaScript (v".concat("0.27.0",")");t.headers=t.headers||{};var n=Object.assign({},t.headers);if(t.apiKey&&(n.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(n["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var i=t.clientAgents.concat(e);n["X-Meilisearch-Client"]=i.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat("X-Meilisearch-Client",'" should be an array of string(s).\n'));n["X-Meilisearch-Client"]=e}return n}(t);try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return r(this,void 0,void 0,(function(){var t,r,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(r=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return r.set(t,o[t])})),t.search=r.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return r(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),v=function(){function t(t){this.httpRequest=new p(t)}return t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){var e,n,i;return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return"tasks",r={indexUid:null===(e=null==t?void 0:t.indexUid)||void 0===e?void 0:e.join(","),type:null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.join(","),status:null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.join(","),from:t.from,limit:t.limit},[4,this.httpRequest.get("tasks",l(r))];case 1:return[2,s.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(){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,f(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}(),y=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new p(t),this.tasks=new v(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,f,p;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),f=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:f(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(p),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(){return s(this,(function(r){return"indexes",[2,new p(n).post("indexes",i(i({},e),{uid:t}))]}))}))},t.prototype.update=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=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),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUid:[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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return[2,i.sent()]}}))}))},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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=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,"/documents"),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetFilterableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSortableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetTypoTolerance=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.delete(t)];case 1:return[2,e.sent()]}}))}))},t}(),b=function(){function t(t){this.config=t,this.httpRequest=new p(t),this.tasks=new v(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(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 y(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 y(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,y.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 y(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 y(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.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.getKeys=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"keys",[4,this.httpRequest.get("keys",t)];case 1:return[2,e.sent()]}}))}))},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(){return s(this,(function(t){switch(t.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return[2,t.sent()]}}))}))},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 w(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var g=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 h("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new h("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new h("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new h("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new h("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 h("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=w({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return w({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}(),m=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new g(e),n}return n(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}(b);export{y as Index,m as MeiliSearch,u as MeiliSearchApiError,o as MeiliSearchCommunicationError,h as MeiliSearchError,d as MeiliSearchTimeOutError,m as default,a as httpErrorHandler,c as httpResponseErrorHandler};
***************************************************************************** */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 f(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()]}}))}))}var p=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.28.0-beta.0",")");t.headers=t.headers||{};var i=Object.assign({},t.headers);if(t.apiKey&&(i.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(i["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var r=t.clientAgents.concat(n);i[e]=r.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));i[e]=n}return i}(t);try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return r(this,void 0,void 0,(function(){var t,r,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(r=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return r.set(t,o[t])})),t.search=r.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return r(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),v=function(){function t(t){this.httpRequest=new p(t)}return t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){var e,n,i;return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return"tasks",r={indexUid:null===(e=null==t?void 0:t.indexUid)||void 0===e?void 0:e.join(","),type:null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.join(","),status:null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.join(","),from:t.from,limit:t.limit},[4,this.httpRequest.get("tasks",l(r))];case 1:return[2,s.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(){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,f(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}(),y=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new p(t),this.tasks=new v(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,f,p;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),f=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:f(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(p),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(){return s(this,(function(r){return"indexes",[2,new p(n).post("indexes",i(i({},e),{uid:t}))]}))}))},t.prototype.update=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=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),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUid:[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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return[2,i.sent()]}}))}))},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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=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,"/documents"),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetFilterableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSortableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetTypoTolerance=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.delete(t)];case 1:return[2,e.sent()]}}))}))},t}(),b=function(){function t(t){this.config=t,this.httpRequest=new p(t),this.tasks=new v(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(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 y(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 y(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,y.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 y(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 y(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.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.getKeys=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"keys",[4,this.httpRequest.get("keys",t)];case 1:return[2,e.sent()]}}))}))},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(){return s(this,(function(t){switch(t.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return[2,t.sent()]}}))}))},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 w(t){return Buffer.from(JSON.stringify(t)).toString("base64")}var g=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 h("Meilisearch: The expiredAt field must be an instance of Date.");if(r.getTime()<Date.now())throw new h("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new h("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!i||"string"!=typeof i)throw new h("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||"string"!=typeof n)throw new h("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 h("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=w({alg:"HS256",typ:"JWT"}).replace(/=/g,""),c=function(t){var e=t.searchRules,n=t.uid,i=t.expiresAt;return w({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}(),m=function(t){function e(e){var n=t.call(this,e)||this;return n.tokens=new g(e),n}return n(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}(b);export{y as Index,m as MeiliSearch,u as MeiliSearchApiError,o as MeiliSearchCommunicationError,h as MeiliSearchError,d as MeiliSearchTimeOutError,m as default,a as httpErrorHandler,c as httpResponseErrorHandler};
//# sourceMappingURL=meilisearch.esm.min.js.map

@@ -15,3 +15,3 @@ !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";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */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])})(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}).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 f(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()]}}))}))}var p=function(){function t(t){this.headers=function(t){var e="Meilisearch JavaScript (v".concat("0.27.0",")");t.headers=t.headers||{};var n=Object.assign({},t.headers);if(t.apiKey&&(n.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(n["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var i=t.clientAgents.concat(e);n["X-Meilisearch-Client"]=i.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat("X-Meilisearch-Client",'" should be an array of string(s).\n'));n["X-Meilisearch-Client"]=e}return n}(t);try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return r(this,void 0,void 0,(function(){var t,r,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(r=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return r.set(t,o[t])})),t.search=r.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),i(i({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return r(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.post=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.put=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.patch=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t.prototype.delete=function(t,e,n,i){return r(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:i})];case 1:return[2,r.sent()]}}))}))},t}(),v=function(){function t(t){this.httpRequest=new p(t)}return t.prototype.getTask=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){var e,n,i;return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var r;return s(this,(function(s){switch(s.label){case 0:return"tasks",r={indexUid:null===(e=null==t?void 0:t.indexUid)||void 0===e?void 0:e.join(","),type:null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.join(","),status:null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.join(","),from:t.from,limit:t.limit},[4,this.httpRequest.get("tasks",l(r))];case 1:return[2,s.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(){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,f(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}(),y=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new p(t),this.tasks=new v(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,f,p;return s(this,(function(s){switch(s.label){case 0:return r="indexes/".concat(this.uid,"/search"),f=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:f(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(p),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(){return s(this,(function(r){return"indexes",[2,new p(n).post("indexes",i(i({},e),{uid:t}))]}))}))},t.prototype.update=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=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),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(i(i({},t),{indexUid:[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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.post(n,t,e)];case 1:return[2,i.sent()]}}))}))},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;return s(this,(function(i){switch(i.label){case 0:return n="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.put(n,t,e)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),r(this,void 0,void 0,(function(){var i,r,o,u;return s(this,(function(s){switch(s.label){case 0:i=[],r=0,s.label=1;case 1:return r<t.length?(u=(o=i).push,[4,this.updateDocuments(t.slice(r,r+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return r+=e,[3,1];case 4:return[2,i]}}))}))},t.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=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,"/documents"),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetFilterableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSortableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=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.delete(t)];case 1:return[2,e.sent()]}}))}))},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;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetTypoTolerance=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.delete(t)];case 1:return[2,e.sent()]}}))}))},t}(),b=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 p(t),this.tasks=new v(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(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 y(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 y(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,y.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 y(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 y(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.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.getKeys=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"keys",[4,this.httpRequest.get("keys",t)];case 1:return[2,e.sent()]}}))}))},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(){return s(this,(function(t){switch(t.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return[2,t.sent()]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var i=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(i.stack,"."))},t}());t.Index=y,t.MeiliSearch=b,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=b,t.httpErrorHandler=a,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}));
***************************************************************************** */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 r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function u(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}c((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[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,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=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,r,i,s){var o,u,c,a=this;return a=t.call(this,n)||this,Object.setPrototypeOf(a,e.prototype),a.name="MeiliSearchCommunicationError",r instanceof Response&&(a.message=r.statusText,a.statusCode=r.status),r instanceof Error&&(a.errno=r.errno,a.code=r.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(i," failed, reason: connect ECONNREFUSED")),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Not Found","Not Found: ".concat(i))):Error.captureStackTrace&&Error.captureStackTrace(a,e),a}return n(e,t),e}(Error),u=function(t){function e(e,n){var r=t.call(this,e.message)||this;return Object.setPrototypeOf(r,u.prototype),r.name="MeiliSearchApiError",r.code=e.code,r.type=e.type,r.link=e.link,r.message=e.message,r.httpStatus=n,Error.captureStackTrace&&Error.captureStackTrace(r,u),r}return n(e,t),e}(Error);function c(t){return i(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 r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return n(e,t),e}(Error),d=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return n(e,t),e}(Error);function l(t){return Object.entries(t).reduce((function(t,e){var n=e[0],r=e[1];return void 0!==r&&(t[n]=r),t}),{})}function f(t){return i(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()]}}))}))}var p=function(){function t(t){this.headers=function(t){var e="X-Meilisearch-Client",n="Meilisearch JavaScript (v".concat("0.28.0-beta.0",")");t.headers=t.headers||{};var r=Object.assign({},t.headers);if(t.apiKey&&(r.Authorization="Bearer ".concat(t.apiKey)),t.headers["Content-Type"]||(r["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var i=t.clientAgents.concat(n);r[e]=i.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new h('Meilisearch: The header "'.concat(e,'" should be an array of string(s).\n'));r[e]=n}return r}(t);try{var e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new h("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new h("The provided host is not valid.")}}return t.prototype.request=function(t){var e=t.method,n=t.url,o=t.params,u=t.body,h=t.config;return i(this,void 0,void 0,(function(){var t,i,d,l;return s(this,(function(s){switch(s.label){case 0:t=new URL(n,this.url),o&&(i=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return i.set(t,o[t])})),t.search=i.toString()),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(t.toString(),r(r({},h),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return c(t)}))];case 2:return[4,s.sent().json().catch((function(){}))];case 3:return[2,s.sent()];case 4:return d=s.sent(),l=d.stack,a(d,l,t.toString()),[3,5];case 5:return[2]}}))}))},t.prototype.get=function(t,e,n){return i(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:n})];case 1:return[2,r.sent()]}}))}))},t.prototype.post=function(t,e,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.patch=function(t,e,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PATCH",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:n,config:r})];case 1:return[2,i.sent()]}}))}))},t}(),v=function(){function t(t){this.httpRequest=new p(t)}return t.prototype.getTask=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="tasks/".concat(t),[4,this.httpRequest.get(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.getTasks=function(t){var e,n,r;return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var i;return s(this,(function(s){switch(s.label){case 0:return"tasks",i={indexUid:null===(e=null==t?void 0:t.indexUid)||void 0===e?void 0:e.join(","),type:null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.join(","),status:null===(r=null==t?void 0:t.status)||void 0===r?void 0:r.join(","),from:t.from,limit:t.limit},[4,this.httpRequest.get("tasks",l(i))];case 1:return[2,s.sent()]}}))}))},t.prototype.waitForTask=function(t,e){var n=void 0===e?{}:e,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return Date.now()-e<o?[4,this.getTask(t)]:[3,4];case 2:return n=r.sent(),["enqueued","processing"].includes(n.status)?[4,f(c)]:[2,n];case 3:return r.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,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(this,void 0,void 0,(function(){var e,n,r,i,u;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,r=t,s.label=1;case 1:return n<r.length?(i=r[n],[4,this.waitForTask(i,{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}(),y=function(){function t(t,e,n){this.uid=e,this.primaryKey=n,this.httpRequest=new p(t),this.tasks=new v(t)}return t.prototype.search=function(t,e,n){return i(this,void 0,void 0,(function(){var i;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/search"),[4,this.httpRequest.post(i,l(r({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 i(this,void 0,void 0,(function(){var i,f,p;return s(this,(function(s){switch(s.label){case 0:return i="indexes/".concat(this.uid,"/search"),f=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=r(r({q:t},e),{filter:f(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(i,l(p),n)];case 1:return[2,s.sent()]}}))}))},t.prototype.getRawInfo=function(){return i(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 i(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 i(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={}),i(this,void 0,void 0,(function(){return s(this,(function(i){return"indexes",[2,new p(n).post("indexes",r(r({},e),{uid:t}))]}))}))},t.prototype.update=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTasks=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.tasks.getTasks(r(r({},t),{indexUid:[this.uid]}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getTask=function(t){return i(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,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(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,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(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 i(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={}),i(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"),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(r(r({},t),{fields:n})))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t,e){return i(this,void 0,void 0,(function(){var n,i;return s(this,(function(s){switch(s.label){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),i=function(){var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")}(),[4,this.httpRequest.get(n,l(r(r({},e),{fields:i})))];case 1:return[2,s.sent()]}}))}))},t.prototype.addDocuments=function(t,e){return i(this,void 0,void 0,(function(){var n;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[2,r.sent()]}}))}))},t.prototype.addDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),i(this,void 0,void 0,(function(){var r,i,o,u;return s(this,(function(s){switch(s.label){case 0:r=[],i=0,s.label=1;case 1:return i<t.length?(u=(o=r).push,[4,this.addDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.updateDocuments=function(t,e){return i(this,void 0,void 0,(function(){var n;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[2,r.sent()]}}))}))},t.prototype.updateDocumentsInBatches=function(t,e,n){return void 0===e&&(e=1e3),i(this,void 0,void 0,(function(){var r,i,o,u;return s(this,(function(s){switch(s.label){case 0:r=[],i=0,s.label=1;case 1:return i<t.length?(u=(o=r).push,[4,this.updateDocuments(t.slice(i,i+e),n)]):[3,4];case 2:u.apply(o,[s.sent()]),s.label=3;case 3:return i+=e,[3,1];case 4:return[2,r]}}))}))},t.prototype.deleteDocument=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/").concat(t),[4,this.httpRequest.delete(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/documents/delete-batch"),[4,this.httpRequest.post(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/".concat(this.uid,"/documents"),[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSettings=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSynonyms=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/synonyms"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getStopWords=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/stop-words"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getRankingRules=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/ranking-rules"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/distinct-attribute"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getFilterableAttributes=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/filterable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetFilterableAttributes=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSortableAttributes=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/sortable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSortableAttributes=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/searchable-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/displayed-attributes"),[4,this.httpRequest.put(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getTypoTolerance=function(){return i(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 i(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e="indexes/".concat(this.uid,"/settings/typo-tolerance"),[4,this.httpRequest.patch(e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetTypoTolerance=function(){return i(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.delete(t)];case 1:return[2,e.sent()]}}))}))},t}(),b=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 p(t),this.tasks=new v(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(this.config,t).fetchInfo()]}))}))},t.prototype.getRawIndex=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(this.config,t).getRawInfo()]}))}))},t.prototype.getIndexes=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var e,n,i=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 y(i.config,t.uid,t.primaryKey)})),[2,r(r({},e),{results:n})]}}))}))},t.prototype.getRawIndexes=function(t){return void 0===t&&(t={}),i(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={}),i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,y.create(t,e,this.config)];case 1:return[2,n.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,new y(this.config,t).update(e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new y(this.config,t).delete()];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIndexIfExists=function(t){return i(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.getTasks=function(t){return void 0===t&&(t={}),i(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 i(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,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(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,r=n.timeOutMs,o=void 0===r?5e3:r,u=n.intervalMs,c=void 0===u?50:u;return i(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.getKeys=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return"keys",[4,this.httpRequest.get("keys",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getKey=function(t){return i(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 i(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 i(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return n="keys/".concat(t),[4,this.httpRequest.patch(n,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.deleteKey=function(t){return i(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 i(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 i(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 i(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 i(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 i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return"dumps",[4,this.httpRequest.post("dumps")];case 1:return[2,t.sent()]}}))}))},t.prototype.generateTenantToken=function(t,e,n){var r=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(r.stack,"."))},t}());t.Index=y,t.MeiliSearch=b,t.MeiliSearchApiError=u,t.MeiliSearchCommunicationError=o,t.MeiliSearchError=h,t.MeiliSearchTimeOutError=d,t.default=b,t.httpErrorHandler=a,t.httpResponseErrorHandler=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=meilisearch.umd.min.js.map

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

// Type definitions for meilisearch 0.27.0
// Type definitions for meilisearch 0.28.0-beta.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 @@

export declare const PACKAGE_VERSION = "0.27.0";
export declare const PACKAGE_VERSION = "0.28.0-beta.0";
//# sourceMappingURL=package-version.d.ts.map

@@ -27,2 +27,6 @@ export declare type Config = {

export declare type IndexesResults<T> = ResourceResults<T> & {};
export declare const enum MatchingStrategies {
ALL = "all",
LAST = "last"
}
export declare type Filter = string | Array<string | string[]>;

@@ -48,2 +52,3 @@ export declare type Query = {

showMatchesPosition?: boolean;
matchingStrategy?: MatchingStrategies;
};

@@ -50,0 +55,0 @@ export declare type SearchRequestGET = Pagination & Query & Omit<Highlight, 'attributesToHighlight'> & Omit<Crop, 'attributesToCrop'> & {

{
"name": "meilisearch",
"version": "0.27.0",
"version": "0.28.0-beta.0",
"description": "The Meilisearch JS client for Node.js and the browser.",

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

"devDependencies": {
"@babel/preset-env": "^7.18.6",
"@babel/preset-env": "^7.18.9",
"@rollup/plugin-babel": "^5.3.1",

@@ -106,3 +106,3 @@ "@rollup/plugin-commonjs": "22.0.1",

"pretty-bytes": "^5.6.0",
"rollup": "^2.76.0",
"rollup": "^2.77.2",
"rollup-plugin-terser": "^7.0.0",

@@ -109,0 +109,0 @@ "rollup-plugin-typescript2": "^0.31.2",

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

**Meilisearch** is an open-source search engine. [Discover what Meilisearch is!](https://github.com/meilisearch/meilisearch)
**Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/meilisearch)

@@ -35,18 +35,18 @@ ## Table of Contents <!-- omit in toc -->

- [🔧 Installation](#-installation)
- [🎬 Getting Started](#-getting-started)
- [🎬 Getting started](#-getting-started)
- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)
- [💡 Learn More](#-learn-more)
- [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing)
- [📜 API Resources](#-api-resources)
- [💡 Learn more](#-learn-more)
- [⚙️ Contributing](#️-contributing)
- [📜 API resources](#-api-resources)
## 📖 Documentation
See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/).
This readme contains all the documentation you need to start using this Meilisearch SDK.
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/).
## 🔧 Installation
We only guarantee that the package works with `node` >= 12 and `node` <= 16.
We recommend installing `meilisearch-js` in your project with your package manager of choice.
With `npm`:
```sh

@@ -56,29 +56,15 @@ npm install meilisearch

With `yarn`:
`meilisearch-js` officially supports `node` versions >= 14 and <= 18.
```sh
yarn add meilisearch
```
Instead of using a package manager, you may also import the library directly into your [HTML via a CDN](#include-script-tag).
### 🏃‍♀️ Run Meilisearch <!-- omit in toc -->
### Run Meilisearch <!-- omit in toc -->
There are many easy ways to [download and run a Meilisearch instance](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://docs.meilisearch.com/reference/features/installation.html#download-and-launch).
For example, using the `curl` command in [your Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/web-publishing/what-is-a-terminal/):
```bash
# Install Meilisearch
curl -L https://install.meilisearch.com | sh
# Launch Meilisearch
./meilisearch --master-key=masterKey
```
NB: you can also download Meilisearch from **Homebrew** or **APT** or even run it using **Docker**.
### Import <!-- omit in toc -->
Depending on the environment in which you are using Meilisearch, imports may differ.
After installing `meilisearch-js`, you must import it into your application. There are many ways of doing that depending on your development environment.
#### Import Syntax <!-- omit in toc -->
#### `import` syntax <!-- omit in toc -->

@@ -96,3 +82,3 @@ Usage in an ES module environment:

#### Include Script Tag <!-- omit in toc -->
#### `<script>` tag <!-- omit in toc -->

@@ -111,5 +97,5 @@ Usage in an HTML (or alike) file:

#### Require Syntax <!-- omit in toc -->
#### `require` syntax <!-- omit in toc -->
Usage in a back-end node environment
Usage in a back-end node.js or another environment supporting CommonJS modules:

@@ -127,9 +113,9 @@ ```javascript

To make this package work with React Native, please add the [react-native-url-polyfill](https://www.npmjs.com/package/react-native-url-polyfill).
To use `meilisearch-js` with React Native, you must also install [react-native-url-polyfill](https://www.npmjs.com/package/react-native-url-polyfill).
#### Deno<!-- omit in toc -->
Usage in a back-end deno environment
Usage in a Deno environment:
```ts
```js
import { MeiliSearch } from "https://esm.sh/meilisearch"

@@ -143,7 +129,6 @@

## 🎬 Getting started
## 🎬 Getting Started
### Add documents <!-- omit in toc -->
#### Add Documents <!-- omit in toc -->
```js

@@ -179,5 +164,5 @@ const { MeiliSearch } = require('meilisearch')

With the `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [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://docs.meilisearch.com/reference/api/tasks.html#get-task).
#### Basic Search <!-- omit in toc -->
### Basic search <!-- omit in toc -->

@@ -209,5 +194,5 @@ ```javascript

#### Custom Search <!-- omit in toc -->
### Using search parameters <!-- omit in toc -->
All the supported options are described in the [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) section of the documentation.
`meilisearch-js` supports all [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) described in our main documentation website.

@@ -231,3 +216,3 @@ ```javascript

"_formatted": {
"id": 2,
"id": "2",
"title": "<em>Wonder</em> Woman",

@@ -246,5 +231,5 @@ "genres": ["Action", "Adventure"]

#### Custom Search With Filters <!-- omit in toc -->
### Custom search with filters <!-- omit in toc -->
If you want to enable filtering, you must add your attributes to the `filterableAttributes` index setting.
To enable filtering, you must first add your attributes to the [`filterableAttributes` index setting](https://docs.meilisearch.com/reference/api/filterable_attributes.html).

@@ -258,7 +243,7 @@ ```js

You only need to perform this operation once.
You only need to perform this operation once per index.
Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](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://docs.meilisearch.com/reference/api/tasks.html#get-task)).
Then, you can perform the search:
After you configured `filterableAttributes`, you can use the [`filter` search parameter](https://docs.meilisearch.com/reference/api/search.html#filter) to refine your search:

@@ -291,5 +276,5 @@ ```js

#### Placeholder Search <!-- omit in toc -->
### Placeholder search <!-- omit in toc -->
Placeholder search makes it possible to receive hits based on your parameters without having any query (`q`). To enable faceted search on your dataset you need to add `genres` in the [settings](https://docs.meilisearch.com/reference/features/faceted_search.html#setting-up-facets).
Placeholder search makes it possible to receive hits based on your parameters without having any query (`q`). For example, in a movies database you can run an empty query to receive all results filtered by `genre`.

@@ -335,4 +320,6 @@ ```javascript

#### Abortable Search <!-- omit in toc -->
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).
#### Abortable search <!-- omit in toc -->
You can abort a pending search request by providing an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to the request.

@@ -359,7 +346,7 @@

This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).
This package only guarantees the compatibility with the [version v0.29.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.29.0).
## 💡 Learn More
## 💡 Learn more
The following sections may interest you:
The following sections in our main documentation website may interest you:

@@ -373,314 +360,496 @@ - **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).

## ⚙️ Development Workflow and Contributing
## ⚙️ Contributing
Any new contribution is more than welcome to this project!
We welcome all contributions, big and small! If you want to know more about this SDK's development workflow or want to contribute to the repo, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions.
If you want to know more about the development workflow or want to contribute, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions!
## 📜 API resources
## 📜 API Resources
### Search <!-- omit in toc -->
- [Make a search request](https://docs.meilisearch.com/reference/api/search.html):
#### [Make a search request](https://docs.meilisearch.com/reference/api/search.html)
`client.index<T>('xxx').search(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>`
```ts
client.index<T>('xxx').search(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>
```
- [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://docs.meilisearch.com/reference/api/search.html#search-in-an-index-with-get-route)
`client.index<T>('xxx').searchGet(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>`
```ts
client.index<T>('xxx').searchGet(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>
```
### 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://docs.meilisearch.com/reference/api/documents.html#add-or-replace-documents)
`index.addDocuments(documents: Document<T>[]): Promise<EnqueuedTask>`
```ts
client.index('myIndex').addDocuments(documents: Document<T>[]): Promise<EnqueuedTask>
```
- [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://docs.meilisearch.com/reference/api/documents.html#add-or-replace-documents)
`index.addDocumentsInBatches(documents: Document<T>[], batchSize = 1000): Promise<EnqueuedTask[]>`
```ts
client.index('myIndex').addDocumentsInBatches(documents: Document<T>[], batchSize = 1000): Promise<EnqueuedTask[]>
```
- [Add or update multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents):
#### [Add or update multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
`index.updateDocuments(documents: Array<Document<Partial<T>>>): Promise<EnqueuedTask>`
```ts
client.index('myIndex').updateDocuments(documents: Array<Document<Partial<T>>>): Promise<EnqueuedTask>
```
- [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://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents)
`index.updateDocumentsInBatches(documents: Array<Document<Partial<T>>>, batchSize = 1000): Promise<EnqueuedTask[]>`
```ts
client.index('myIndex').updateDocumentsInBatches(documents: Array<Document<Partial<T>>>, batchSize = 1000): Promise<EnqueuedTask[]>
```
- [Get Documents](https://docs.meilisearch.com/reference/api/documents.html#get-documents):
#### [Get Documents](https://docs.meilisearch.com/reference/api/documents.html#get-documents)
`index.getDocuments(parameters: DocumentsQuery = {}): Promise<DocumentsResults<T>>>`
```ts
client.index.getDocuments(parameters: DocumentsQuery = {}): Promise<DocumentsResults<T>>>
```
- [Get one document](https://docs.meilisearch.com/reference/api/documents.html#get-one-document):
#### [Get one document](https://docs.meilisearch.com/reference/api/documents.html#get-one-document)
`index.getDocument(documentId: string): Promise<Document<T>>`
```ts
client.index('myIndex').getDocument(documentId: string): Promise<Document<T>>
```
- [Delete one document](https://docs.meilisearch.com/reference/api/documents.html#delete-one-document):
#### [Delete one document](https://docs.meilisearch.com/reference/api/documents.html#delete-one-document)
`index.deleteDocument(documentId: string | number): Promise<EnqueuedTask>`
```ts
client.index('myIndex').deleteDocument(documentId: string | number): Promise<EnqueuedTask>
```
- [Delete multiple documents](https://docs.meilisearch.com/reference/api/documents.html#delete-documents):
#### [Delete multiple documents](https://docs.meilisearch.com/reference/api/documents.html#delete-documents)
`index.deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedTask>`
```ts
client.index('myIndex').deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedTask>
```
- [Delete all documents](https://docs.meilisearch.com/reference/api/documents.html#delete-all-documents):
#### [Delete all documents](https://docs.meilisearch.com/reference/api/documents.html#delete-all-documents)
`index.deleteAllDocuments(): Promise<Types.EnqueuedTask>`
```ts
client.index('myIndex').deleteAllDocuments(): Promise<Types.EnqueuedTask>
```
### Tasks <!-- omit in toc -->
- [Get all tasks](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks)
#### [Get all tasks](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks)
`client.getTasks(parameters: TasksQuery): Promise<TasksResults>`
```ts
client.getTasks(parameters: TasksQuery): Promise<TasksResults>
```
- [Get one task](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
#### [Get one task](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
`client.getTask(uid: number): Promise<Task>`
```ts
client.getTask(uid: number): Promise<Task>
```
- [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://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks-by-index)
`index.getTasks(parameters: TasksQuery): Promise<TasksResults>`
```ts
client.index('myIndex').getTasks(parameters: TasksQuery): Promise<TasksResults>
```
- [Get one task of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
#### [Get one task of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-task)
`index.getTask(uid: number): Promise<Task>`
```ts
client.index('myIndex').getTask(uid: number): Promise<Task>
```
- Wait for one task:
#### Wait for one task
`client.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`
With an index instance:
`index.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`
##### Using the client
- Wait for multiple tasks:
`client.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>`
```ts
client.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>
```
With an index instance:
`index.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>`
##### Using the index
```ts
client.index('myIndex').waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>
```
#### Wait for multiple tasks
##### Using the client
```ts
client.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>
```
##### Using the index
```ts
client.index('myIndex').waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>
```
### Indexes <!-- omit in toc -->
- [Get all indexes as Index instances](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):
#### [Get all indexes in Index instances](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes)
`client.getIndexes(parameters: IndexesQuery): Promise<IndexesResults<Index[]>>`
```ts
client.getIndexes(parameters: IndexesQuery): Promise<IndexesResults<Index[]>>
```
- [Get all indexes](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):
#### [Get all indexes](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes)
`client.getRawIndexes(parameters: IndexesQuery): Promise<IndexesResults<IndexObject[]>>`
```ts
client.getRawIndexes(parameters: IndexesQuery): Promise<IndexesResults<IndexObject[]>>
```
- [Create a new index](https://docs.meilisearch.com/reference/api/indexes.html#create-an-index):
`client.createIndex<T>(uid: string, options?: IndexOptions): Promise<EnqueuedTask>`
#### [Create a new index](https://docs.meilisearch.com/reference/api/indexes.html#create-an-index)
- Create a local reference to an index:
```ts
client.createIndex<T>(uid: string, options?: IndexOptions): Promise<EnqueuedTask>
```
`client.index<T>(uid: string): Index<T>`
#### Create a local reference to an index
- [Get an index instance completed with information fetched from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
`client.getIndex<T>(uid: string): Promise<Index<T>>`
```ts
client.index<T>(uid: string): Index<T>
```
- [Get the raw index JSON response from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
`client.getRawIndex(uid: string): Promise<IndexObject>`
#### [Get an index instance completed with information fetched from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
- [Get an object with information about the index](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
`index.getRawInfo(): Promise<IndexObject>`
```ts
client.getIndex<T>(uid: string): Promise<Index<T>>
```
- [Update Index](https://docs.meilisearch.com/reference/api/indexes.html#update-an-index):
#### [Get the raw index JSON response from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
Using the client
`client.updateIndex(uid: string, options: IndexOptions): Promise<EnqueuedTask>`
```ts
client.getRawIndex(uid: string): Promise<IndexObject>
```
Using the index object:
`index.update(data: IndexOptions): Promise<EnqueuedTask>`
#### [Get an object with information about the index](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index)
- [Delete Index](https://docs.meilisearch.com/reference/api/indexes.html#delete-an-index):
```ts
client.index('myIndex').getRawInfo(): Promise<IndexObject>
```
Using the client
`client.deleteIndex(uid): Promise<void>`
#### [Update Index](https://docs.meilisearch.com/reference/api/indexes.html#update-an-index)
Using the index object:
`index.delete(): Promise<void>`
##### Using the client
- [Get specific index stats](https://docs.meilisearch.com/reference/api/stats.html#get-stat-of-an-index):
```ts
client.updateIndex(uid: string, options: IndexOptions): Promise<EnqueuedTask>
```
`index.getStats(): Promise<IndexStats>`
##### Using the index object
- Return Index instance with updated information:
```ts
client.index('myIndex').update(data: IndexOptions): Promise<EnqueuedTask>
```
`index.fetchInfo(): Promise<Index>`
#### [Delete index](https://docs.meilisearch.com/reference/api/indexes.html#delete-an-index)
- Get Primary Key of an Index:
##### Using the client
```ts
client.deleteIndex(uid): Promise<void>
```
`index.fetchPrimaryKey(): Promise<string | undefined>`
##### Using the index object
```ts
client.index('myIndex').delete(): Promise<void>
```
#### [Get specific index stats](https://docs.meilisearch.com/reference/api/stats.html#get-stat-of-an-index)
```ts
client.index('myIndex').getStats(): Promise<IndexStats>
```
##### Return Index instance with updated information
```ts
client.index('myIndex').fetchInfo(): Promise<Index>
```
##### Get Primary Key of an Index
```ts
client.index('myIndex').fetchPrimaryKey(): Promise<string | undefined>
```
### Settings <!-- omit in toc -->
- [Get settings](https://docs.meilisearch.com/reference/api/settings.html#get-settings):
#### [Get settings](https://docs.meilisearch.com/reference/api/settings.html#get-settings)
`index.getSettings(): Promise<Settings>`
```ts
client.index('myIndex').getSettings(): Promise<Settings>
```
- [Update settings](https://docs.meilisearch.com/reference/api/settings.html#update-settings):
#### [Update settings](https://docs.meilisearch.com/reference/api/settings.html#update-settings)
`index.updateSettings(settings: Settings): Promise<EnqueuedTask>`
```ts
client.index('myIndex').updateSettings(settings: Settings): Promise<EnqueuedTask>
```
- [Reset settings](https://docs.meilisearch.com/reference/api/settings.html#reset-settings):
#### [Reset settings](https://docs.meilisearch.com/reference/api/settings.html#reset-settings)
`index.resetSettings(): Promise<EnqueuedTask>`
```ts
client.index('myIndex').resetSettings(): Promise<EnqueuedTask>
```
### Synonyms <!-- omit in toc -->
- [Get synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#get-synonyms):
#### [Get synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#get-synonyms)
`index.getSynonyms(): Promise<object>`
```ts
client.index('myIndex').getSynonyms(): Promise<Synonyms>
```
- [Update synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#update-synonyms):
#### [Update synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#update-synonyms)
`index.updateSynonyms(synonyms: Synonyms): Promise<EnqueuedTask>`
```ts
client.index('myIndex').updateSynonyms(synonyms: Synonyms): Promise<EnqueuedTask>
```
- [Reset synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#reset-synonyms):
#### [Reset synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#reset-synonyms)
`index.resetSynonyms(): Promise<EnqueuedTask>`
```ts
client.index('myIndex').resetSynonyms(): Promise<EnqueuedTask>
```
### Stop-words <!-- omit in toc -->
### Stop words <!-- omit in toc -->
- [Get Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#get-stop-words):
`index.getStopWords(): Promise<string[]>`
#### [Get stop words](https://docs.meilisearch.com/reference/api/stop_words.html#get-stop-words)
- [Update Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#update-stop-words):
`index.updateStopWords(stopWords: string[] | null ): Promise<EnqueuedTask>`
```ts
client.index('myIndex').getStopWords(): Promise<string[]>
```
- [Reset Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#reset-stop-words):
`index.resetStopWords(): Promise<EnqueuedTask>`
#### [Update stop words](https://docs.meilisearch.com/reference/api/stop_words.html#update-stop-words)
```ts
client.index('myIndex').updateStopWords(stopWords: string[] | null ): Promise<EnqueuedTask>
```
#### [Reset stop words](https://docs.meilisearch.com/reference/api/stop_words.html#reset-stop-words)
```ts
client.index('myIndex').resetStopWords(): Promise<EnqueuedTask>
```
### Ranking rules <!-- omit in toc -->
- [Get Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#get-ranking-rules):
`index.getRankingRules(): Promise<string[]>`
#### [Get ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#get-ranking-rules)
- [Update Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#update-ranking-rules):
`index.updateRankingRules(rankingRules: string[] | null): Promise<EnqueuedTask>`
```ts
client.index('myIndex').getRankingRules(): Promise<string[]>
```
- [Reset Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#reset-ranking-rules):
`index.resetRankingRules(): Promise<EnqueuedTask>`
#### [Update ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#update-ranking-rules)
```ts
client.index('myIndex').updateRankingRules(rankingRules: string[] | null): Promise<EnqueuedTask>
```
#### [Reset ranking rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#reset-ranking-rules)
```ts
client.index('myIndex').resetRankingRules(): Promise<EnqueuedTask>
```
### Distinct Attribute <!-- omit in toc -->
- [Get Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#get-distinct-attribute):
`index.getDistinctAttribute(): Promise<string | void>`
#### [Get distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#get-distinct-attribute)
- [Update Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#update-distinct-attribute):
`index.updateDistinctAttribute(distinctAttribute: string | null): Promise<EnqueuedTask>`
```ts
client.index('myIndex').getDistinctAttribute(): Promise<string | void>
```
- [Reset Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#reset-distinct-attribute):
`index.resetDistinctAttribute(): Promise<EnqueuedTask>`
#### [Update distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#update-distinct-attribute)
### Searchable Attributes <!-- omit in toc -->
```ts
client.index('myIndex').updateDistinctAttribute(distinctAttribute: string | null): Promise<EnqueuedTask>
```
- [Get Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#get-searchable-attributes):
`index.getSearchableAttributes(): Promise<string[]>`
#### [Reset distinct attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#reset-distinct-attribute)
- [Update Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#update-searchable-attributes):
`index.updateSearchableAttributes(searchableAttributes: string[] | null): Promise<EnqueuedTask>`
```ts
client.index('myIndex').resetDistinctAttribute(): Promise<EnqueuedTask>
```
- [Reset Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#reset-searchable-attributes):
`index.resetSearchableAttributes(): Promise<EnqueuedTask>`
### Searchable attributes <!-- omit in toc -->
### Displayed Attributes <!-- omit in toc -->
#### [Get searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#get-searchable-attributes)
- [Get Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#get-displayed-attributes):
`index.getDisplayedAttributes(): Promise<string[]>`
```ts
client.index('myIndex').getSearchableAttributes(): Promise<string[]>
```
- [Update Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#update-displayed-attributes):
`index.updateDisplayedAttributes(displayedAttributes: string[] | null): Promise<EnqueuedTask>`
#### [Update searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#update-searchable-attributes)
- [Reset Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#reset-displayed-attributes):
`index.resetDisplayedAttributes(): Promise<EnqueuedTask>`
```ts
client.index('myIndex').updateSearchableAttributes(searchableAttributes: string[] | null): Promise<EnqueuedTask>
```
### Filterable Attributes <!-- omit in toc -->
#### [Reset searchable attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#reset-searchable-attributes)
- [Get Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#get-filterable-attributes):
`index.getFilterableAttributes(): Promise<string[]>`
```ts
client.index('myIndex').resetSearchableAttributes(): Promise<EnqueuedTask>
```
- [Update Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes):
`index.updateFilterableAttributes(filterableAttributes: string[] | null): Promise<EnqueuedTask>`
### Displayed attributes <!-- omit in toc -->
- [Reset Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#reset-filterable-attributes):
`index.resetFilterableAttributes(): Promise<EnqueuedTask>`
#### [Get displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#get-displayed-attributes)
### Sortable Attributes <!-- omit in toc -->
```ts
client.index('myIndex').getDisplayedAttributes(): Promise<string[]>
```
- [Get Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#get-sortable-attributes):
`index.getSortableAttributes(): Promise<string[]>`
#### [Update displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#update-displayed-attributes)
- [Update Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#update-sortable-attributes):
`index.updateSortableAttributes(sortableAttributes: string[] | null): Promise<EnqueuedTask>`
```ts
client.index('myIndex').updateDisplayedAttributes(displayedAttributes: string[] | null): Promise<EnqueuedTask>
```
- [Reset Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#reset-sortable-attributes):
`index.resetSortableAttributes(): Promise<EnqueuedTask>`
#### [Reset displayed attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#reset-displayed-attributes)
### Typo Tolerance <!-- omit in toc -->
```ts
client.index('myIndex').resetDisplayedAttributes(): Promise<EnqueuedTask>
```
- [Get Typo Tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#get-typo-tolerance):
`index.getTypoTolerance(): Promise<TypoTolerance>`
### Filterable attributes <!-- omit in toc -->
- [Update Typo Tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#update-typo-tolerance):
`index.updateTypoTolerance(typoTolerance: TypoTolerance | null): Promise<EnqueuedTask>`
#### [Get filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#get-filterable-attributes)
- [Reset Typo Tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#reset-typo-tolerance):
`index.resetTypoTolerance(): Promise<EnqueuedTask>`
```ts
client.index('myIndex').getFilterableAttributes(): Promise<string[]>
```
#### [Update filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes)
```ts
client.index('myIndex').updateFilterableAttributes(filterableAttributes: string[] | null): Promise<EnqueuedTask>
```
#### [Reset filterable attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#reset-filterable-attributes)
```ts
client.index('myIndex').resetFilterableAttributes(): Promise<EnqueuedTask>
```
### Sortable attributes <!-- omit in toc -->
#### [Get sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#get-sortable-attributes)
```ts
client.index('myIndex').getSortableAttributes(): Promise<string[]>
```
#### [Update sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#update-sortable-attributes)
```ts
client.index('myIndex').updateSortableAttributes(sortableAttributes: string[] | null): Promise<EnqueuedTask>
```
#### [Reset sortable attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#reset-sortable-attributes)
```ts
client.index('myIndex').resetSortableAttributes(): Promise<EnqueuedTask>
```
### Typo tolerance <!-- omit in toc -->
#### [Get typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#get-typo-tolerance)
```ts
client.index('myIndex').getTypoTolerance(): Promise<TypoTolerance>
```
#### [Update typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#update-typo-tolerance)
```ts
client.index('myIndex').updateTypoTolerance(typoTolerance: TypoTolerance | null): Promise<EnqueuedTask>
```
#### [Reset typo tolerance](https://docs.meilisearch.com/reference/api/typo_tolerance.html#reset-typo-tolerance)
```ts
client.index('myIndex').resetTypoTolerance(): Promise<EnqueuedTask>
```
### Keys <!-- omit in toc -->
- [Get keys](https://docs.meilisearch.com/reference/api/keys.html#get-all-keys):
#### [Get keys](https://docs.meilisearch.com/reference/api/keys.html#get-all-keys)
`client.getKeys(parameters: KeysQuery): Promise<KeysResults>`
```ts
client.getKeys(parameters: KeysQuery): Promise<KeysResults>
```
- [Get one key](https://docs.meilisearch.com/reference/api/keys.html#get-one-key):
#### [Get one key](https://docs.meilisearch.com/reference/api/keys.html#get-one-key)
`client.getKey(keyOrUid: string): Promise<Key>`
```ts
client.getKey(keyOrUid: string): Promise<Key>
```
- [Create a key](https://docs.meilisearch.com/reference/api/keys.html#create-a-key):
#### [Create a key](https://docs.meilisearch.com/reference/api/keys.html#create-a-key)
`client.createKey(options: KeyCreation): Promise<Key>`
```ts
client.createKey(options: KeyCreation): Promise<Key>
```
- [Update a key](https://docs.meilisearch.com/reference/api/keys.html#update-a-key):
#### [Update a key](https://docs.meilisearch.com/reference/api/keys.html#update-a-key)
`client.updateKey(keyOrUid: string, options: KeyUpdate): Promise<Key>`
```ts
client.updateKey(keyOrUid: string, options: KeyUpdate): Promise<Key>
```
- [Delete a key](https://docs.meilisearch.com/reference/api/keys.html#delete-a-key):
#### [Delete a key](https://docs.meilisearch.com/reference/api/keys.html#delete-a-key)
`client.deleteKey(keyOrUid: string): Promise<void>`
```ts
client.deleteKey(keyOrUid: string): Promise<void>
```
### isHealthy <!-- omit in toc -->
### `isHealthy` <!-- omit in toc -->
- [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://docs.meilisearch.com/reference/api/health.html#get-health)
`client.isHealthy(): Promise<boolean>`
```ts
client.isHealthy(): Promise<boolean>
```
### Health <!-- omit in toc -->
- [Check if the server is healthy](https://docs.meilisearch.com/reference/api/health.html#get-health):
#### [Check if the server is healthy](https://docs.meilisearch.com/reference/api/health.html#get-health)
`client.health(): Promise<Health>`
```ts
client.health(): Promise<Health>
```
### Stats <!-- omit in toc -->
- [Get database stats](https://docs.meilisearch.com/reference/api/stats.html#get-stats-of-all-indexes):
#### [Get database stats](https://docs.meilisearch.com/reference/api/stats.html#get-stats-of-all-indexes)
`client.getStats(): Promise<Stats>`
```ts
client.getStats(): Promise<Stats>
```
### Version <!-- omit in toc -->
- [Get binary version](https://docs.meilisearch.com/reference/api/version.html#get-version-of-meilisearch):
#### [Get binary version](https://docs.meilisearch.com/reference/api/version.html#get-version-of-meilisearch)
`client.getVersion(): Promise<Version>`
```ts
client.getVersion(): Promise<Version>
```
### Dumps <!-- omit in toc -->
- [Trigger a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#create-a-dump):
#### [Trigger a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#create-a-dump)
`client.createDump(): Promise<EnqueuedTask>`
```ts
client.createDump(): Promise<EnqueuedTask>
```
<hr>
---
**Meilisearch** provides and maintains many **SDKs and Integration tools** like this one. We want to provide everyone with an **amazing search experience for any kind of project**. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the [integration-guides](https://github.com/meilisearch/integration-guides) repository.
Meilisearch provides and maintains many SDKs and integration tools like this one. We want to provide everyone with an **amazing search experience for any kind of project**. For a full overview of everything we create and maintain, take a look at the [integration-guides](https://github.com/meilisearch/integration-guides) repository.

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

export const PACKAGE_VERSION = '0.27.0'
export const PACKAGE_VERSION = '0.28.0-beta.0'

@@ -53,2 +53,7 @@ // Type definitions for meilisearch

export const enum MatchingStrategies {
ALL = 'all',
LAST = 'last',
}
export type Filter = string | Array<string | string[]>

@@ -81,2 +86,3 @@

showMatchesPosition?: boolean
matchingStrategy?: MatchingStrategies
}

@@ -83,0 +89,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

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