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

meilisearch

Package Overview
Dependencies
Maintainers
3
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meilisearch - npm Package Compare versions

Comparing version 0.17.1 to 0.18.0

LICENSE

4

CONTRIBUTING.md

@@ -11,3 +11,3 @@ # Contributing

- [Git Guidelines](#git-guidelines)
- [Release Process (for Admin only)](#release-process-for-admin-only)
- [Release Process (for internal team only)](#release-process-for-internal-team-only)

@@ -84,3 +84,3 @@ <!-- /MarkdownTOC -->

## Release Process (for Admin only)
## Release Process (for internal team only)

@@ -87,0 +87,0 @@ MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/).

@@ -1591,2 +1591,2 @@ import 'cross-fetch/polyfill';

export default MeiliSearch;
export { MeiliSearch };

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

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,r,n){return new(r||(r=Promise))((function(i,u){function o(t){try{c(n.next(t))}catch(t){u(t)}}function s(t){try{c(n.throw(t))}catch(t){u(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,u,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(u){return function(s){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}var u=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error),o=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error);function s(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return n(this,void 0,void 0,(function(){return i(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 a=function(t){function r(e,n){var i=t.call(this,e)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,r),i}return e(r,t),r}(Error),h=function(t){function r(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,h),n}return e(r,t),r}(Error);var d=function(){function t(t){this.headers=r(r(r({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,u=t.url,o=t.params,s=t.body,c=t.config;return n(this,void 0,void 0,(function(){var t,d,p;return i(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),t=new URL(u,this.url),o&&(d=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return d.set(t,o[t])})),t.search=d.toString()),[4,fetch(t.toString(),r(r({},c),{method:e,body:s?JSON.stringify(s):void 0,headers:this.headers})).then((function(t){return function(t){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new a(t.statusText,t);case 4:throw new h(e,t.status);case 5:return[2,t]}}))}))}(t)}))];case 1:return[4,f.sent().text()];case 2:p=f.sent();try{return[2,JSON.parse(p)]}catch(t){return[2]}return[3,4];case 3:return function(t){if("MeiliSearchApiError"!==t.type)throw new a(t.message,t);throw t}(f.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.put=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t}(),p=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,u=r.timeOutMs,s=void 0===u?5e3:u,a=r.intervalMs,h=void 0===a?50:a;return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,c(h)];case 3:return n.sent(),[3,1];case 4:throw new o("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,o,c,a){return void 0===c&&(c="POST"),n(this,void 0,void 0,(function(){var n,h,d;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.search(this.uid),h={q:e,offset:null==o?void 0:o.offset,limit:null==o?void 0:o.limit,cropLength:null==o?void 0:o.cropLength,filters:null==o?void 0:o.filters,matches:null==o?void 0:o.matches,facetFilters:null==o?void 0:o.facetFilters,facetsDistribution:null==o?void 0:o.facetsDistribution,attributesToRetrieve:null==o?void 0:o.attributesToRetrieve,attributesToCrop:null==o?void 0:o.attributesToCrop,attributesToHighlight:null==o?void 0:o.attributesToHighlight},"POST"!==c.toUpperCase()?[3,2]:[4,this.httpRequest.post(n,s(h),void 0,a)];case 1:return[2,i.sent()];case 2:return"GET"!==c.toUpperCase()?[3,4]:(d=r(r({},h),{facetFilters:Array.isArray(null==o?void 0:o.facetFilters)&&(null==o?void 0:o.facetFilters)?JSON.stringify(o.facetFilters):void 0,facetsDistribution:(null==o?void 0:o.facetsDistribution)?JSON.stringify(o.facetsDistribution):void 0,attributesToRetrieve:(null==o?void 0:o.attributesToRetrieve)?o.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==o?void 0:o.attributesToCrop)?o.attributesToCrop.join(","):void 0,attributesToHighlight:(null==o?void 0:o.attributesToHighlight)?o.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(n,s(d),a)]);case 3:return[2,i.sent()];case 4:throw new u("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return n(this,void 0,void 0,(function(){var t;return i(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(e,u,o){return void 0===o&&(o={}),n(this,void 0,void 0,(function(){var n,s;return i(this,(function(i){switch(i.label){case 0:return n=t.apiRoutes.indexes,[4,new d(e).post(n,r(r({},o),{uid:u}))];case 1:return s=i.sent(),[2,new t(e,u,s.primaryKey)]}}))}))},t.prototype.update=function(e){return n(this,void 0,void 0,(function(){var r,n;return i(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return n(this,void 0,void 0,(function(){var n,u;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(u=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(n,r(r({},e),void 0!==u?{attributesToRetrieve:u}:{}))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}(),f=function(){function t(t){t.host=d.addTrailingSlash(t.host),this.config=t,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new p(this.config,t)},t.prototype.getIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new h(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,p.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){return[2,new p(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getkeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}();export default f;
***************************************************************************** */var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,r,n){return new(r||(r=Promise))((function(i,u){function o(t){try{c(n.next(t))}catch(t){u(t)}}function s(t){try{c(n.throw(t))}catch(t){u(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,u,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(u){return function(s){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}var u=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error),o=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error);function s(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return n(this,void 0,void 0,(function(){return i(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 a=function(t){function r(e,n){var i=t.call(this,e)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,r),i}return e(r,t),r}(Error),h=function(t){function r(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,h),n}return e(r,t),r}(Error);var d=function(){function t(t){this.headers=r(r(r({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,u=t.url,o=t.params,s=t.body,c=t.config;return n(this,void 0,void 0,(function(){var t,d,p;return i(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),t=new URL(u,this.url),o&&(d=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return d.set(t,o[t])})),t.search=d.toString()),[4,fetch(t.toString(),r(r({},c),{method:e,body:s?JSON.stringify(s):void 0,headers:this.headers})).then((function(t){return function(t){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new a(t.statusText,t);case 4:throw new h(e,t.status);case 5:return[2,t]}}))}))}(t)}))];case 1:return[4,f.sent().text()];case 2:p=f.sent();try{return[2,JSON.parse(p)]}catch(t){return[2]}return[3,4];case 3:return function(t){if("MeiliSearchApiError"!==t.type)throw new a(t.message,t);throw t}(f.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.put=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t}(),p=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,u=r.timeOutMs,s=void 0===u?5e3:u,a=r.intervalMs,h=void 0===a?50:a;return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,c(h)];case 3:return n.sent(),[3,1];case 4:throw new o("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,o,c,a){return void 0===c&&(c="POST"),n(this,void 0,void 0,(function(){var n,h,d;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.search(this.uid),h={q:e,offset:null==o?void 0:o.offset,limit:null==o?void 0:o.limit,cropLength:null==o?void 0:o.cropLength,filters:null==o?void 0:o.filters,matches:null==o?void 0:o.matches,facetFilters:null==o?void 0:o.facetFilters,facetsDistribution:null==o?void 0:o.facetsDistribution,attributesToRetrieve:null==o?void 0:o.attributesToRetrieve,attributesToCrop:null==o?void 0:o.attributesToCrop,attributesToHighlight:null==o?void 0:o.attributesToHighlight},"POST"!==c.toUpperCase()?[3,2]:[4,this.httpRequest.post(n,s(h),void 0,a)];case 1:return[2,i.sent()];case 2:return"GET"!==c.toUpperCase()?[3,4]:(d=r(r({},h),{facetFilters:Array.isArray(null==o?void 0:o.facetFilters)&&(null==o?void 0:o.facetFilters)?JSON.stringify(o.facetFilters):void 0,facetsDistribution:(null==o?void 0:o.facetsDistribution)?JSON.stringify(o.facetsDistribution):void 0,attributesToRetrieve:(null==o?void 0:o.attributesToRetrieve)?o.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==o?void 0:o.attributesToCrop)?o.attributesToCrop.join(","):void 0,attributesToHighlight:(null==o?void 0:o.attributesToHighlight)?o.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(n,s(d),a)]);case 3:return[2,i.sent()];case 4:throw new u("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return n(this,void 0,void 0,(function(){var t;return i(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(e,u,o){return void 0===o&&(o={}),n(this,void 0,void 0,(function(){var n,s;return i(this,(function(i){switch(i.label){case 0:return n=t.apiRoutes.indexes,[4,new d(e).post(n,r(r({},o),{uid:u}))];case 1:return s=i.sent(),[2,new t(e,u,s.primaryKey)]}}))}))},t.prototype.update=function(e){return n(this,void 0,void 0,(function(){var r,n;return i(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return n(this,void 0,void 0,(function(){var n,u;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(u=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(n,r(r({},e),void 0!==u?{attributesToRetrieve:u}:{}))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}(),f=function(){function t(t){t.host=d.addTrailingSlash(t.host),this.config=t,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new p(this.config,t)},t.prototype.getIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new h(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,p.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){return[2,new p(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getkeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}();export{f as MeiliSearch};
//# sourceMappingURL=meilisearch.esm.min.js.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("cross-fetch/polyfill")):"function"==typeof define&&define.amd?define(["cross-fetch/polyfill"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).MeiliSearch=e()}(this,(function(){"use strict";
!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";
/*! *****************************************************************************

@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,r,n){return new(r||(r=Promise))((function(i,u){function o(t){try{c(n.next(t))}catch(t){u(t)}}function s(t){try{c(n.throw(t))}catch(t){u(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,u,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(u){return function(s){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}var u=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error),o=function(t){function r(e){var n=t.call(this,e)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,r),n}return e(r,t),r}(Error);function s(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return n(this,void 0,void 0,(function(){return i(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 a=function(t){function r(e,n){var i=t.call(this,e)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,r),i}return e(r,t),r}(Error),h=function(t){function r(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,h),n}return e(r,t),r}(Error);var d=function(){function t(t){this.headers=r(r(r({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,u=t.url,o=t.params,s=t.body,c=t.config;return n(this,void 0,void 0,(function(){var t,d,p;return i(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),t=new URL(u,this.url),o&&(d=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return d.set(t,o[t])})),t.search=d.toString()),[4,fetch(t.toString(),r(r({},c),{method:e,body:s?JSON.stringify(s):void 0,headers:this.headers})).then((function(t){return function(t){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new a(t.statusText,t);case 4:throw new h(e,t.status);case 5:return[2,t]}}))}))}(t)}))];case 1:return[4,f.sent().text()];case 2:p=f.sent();try{return[2,JSON.parse(p)]}catch(t){return[2]}return[3,4];case 3:return function(t){if("MeiliSearchApiError"!==t.type)throw new a(t.message,t);throw t}(f.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.put=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t.prototype.delete=function(t,e,r,u){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:u})];case 1:return[2,n.sent()]}}))}))},t}(),p=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,u=r.timeOutMs,s=void 0===u?5e3:u,a=r.intervalMs,h=void 0===a?50:a;return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,c(h)];case 3:return n.sent(),[3,1];case 4:throw new o("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,o,c,a){return void 0===c&&(c="POST"),n(this,void 0,void 0,(function(){var n,h,d;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.search(this.uid),h={q:e,offset:null==o?void 0:o.offset,limit:null==o?void 0:o.limit,cropLength:null==o?void 0:o.cropLength,filters:null==o?void 0:o.filters,matches:null==o?void 0:o.matches,facetFilters:null==o?void 0:o.facetFilters,facetsDistribution:null==o?void 0:o.facetsDistribution,attributesToRetrieve:null==o?void 0:o.attributesToRetrieve,attributesToCrop:null==o?void 0:o.attributesToCrop,attributesToHighlight:null==o?void 0:o.attributesToHighlight},"POST"!==c.toUpperCase()?[3,2]:[4,this.httpRequest.post(n,s(h),void 0,a)];case 1:return[2,i.sent()];case 2:return"GET"!==c.toUpperCase()?[3,4]:(d=r(r({},h),{facetFilters:Array.isArray(null==o?void 0:o.facetFilters)&&(null==o?void 0:o.facetFilters)?JSON.stringify(o.facetFilters):void 0,facetsDistribution:(null==o?void 0:o.facetsDistribution)?JSON.stringify(o.facetsDistribution):void 0,attributesToRetrieve:(null==o?void 0:o.attributesToRetrieve)?o.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==o?void 0:o.attributesToCrop)?o.attributesToCrop.join(","):void 0,attributesToHighlight:(null==o?void 0:o.attributesToHighlight)?o.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(n,s(d),a)]);case 3:return[2,i.sent()];case 4:throw new u("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return n(this,void 0,void 0,(function(){var t;return i(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(e,u,o){return void 0===o&&(o={}),n(this,void 0,void 0,(function(){var n,s;return i(this,(function(i){switch(i.label){case 0:return n=t.apiRoutes.indexes,[4,new d(e).post(n,r(r({},o),{uid:u}))];case 1:return s=i.sent(),[2,new t(e,u,s.primaryKey)]}}))}))},t.prototype.update=function(e){return n(this,void 0,void 0,(function(){var r,n;return i(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return n(this,void 0,void 0,(function(){var n,u;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(u=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(n,r(r({},e),void 0!==u?{attributesToRetrieve:u}:{}))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}();return function(){function t(t){t.host=d.addTrailingSlash(t.host),this.config=t,this.httpRequest=new d(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new p(this.config,t)},t.prototype.getIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new h(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,p.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){return i(this,(function(r){return[2,new p(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new p(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getkeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}()}));
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){return new(r||(r=Promise))((function(i,o){function u(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,n=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){u=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(6===o[0]&&u.label<i[1]){u.label=i[1],i=o;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(o);break}i[2]&&u.ops.pop(),u.trys.pop();continue}o=e.call(t,u)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var u=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error),s=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error);function c(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function a(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}var h=function(t){function e(r,n){var i=t.call(this,r)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),d=function(t){function e(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,d),n}return r(e,t),e}(Error);var p=function(){function t(t){this.headers=n(n(n({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,r=t.url,u=t.params,s=t.body,c=t.config;return i(this,void 0,void 0,(function(){var t,a,p;return o(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),t=new URL(r,this.url),u&&(a=new URLSearchParams,Object.keys(u).filter((function(t){return null!==u[t]})).map((function(t){return a.set(t,u[t])})),t.search=a.toString()),[4,fetch(t.toString(),n(n({},c),{method:e,body:s?JSON.stringify(s):void 0,headers:this.headers})).then((function(t){return function(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new h(t.statusText,t);case 4:throw new d(e,t.status);case 5:return[2,t]}}))}))}(t)}))];case 1:return[4,f.sent().text()];case 2:p=f.sent();try{return[2,JSON.parse(p)]}catch(t){return[2]}return[3,4];case 3:return function(t){if("MeiliSearchApiError"!==t.type)throw new h(t.message,t);throw t}(f.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return i(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t}(),f=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new p(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,n=r.timeOutMs,u=void 0===n?5e3:n,c=r.intervalMs,h=void 0===c?50:c;return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<u?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,a(h)];case 3:return n.sent(),[3,1];case 4:throw new s("timeout of "+u+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,r,s,a){return void 0===s&&(s="POST"),i(this,void 0,void 0,(function(){var i,h,d;return o(this,(function(o){switch(o.label){case 0:return i=t.routeConstructors.search(this.uid),h={q:e,offset:null==r?void 0:r.offset,limit:null==r?void 0:r.limit,cropLength:null==r?void 0:r.cropLength,filters:null==r?void 0:r.filters,matches:null==r?void 0:r.matches,facetFilters:null==r?void 0:r.facetFilters,facetsDistribution:null==r?void 0:r.facetsDistribution,attributesToRetrieve:null==r?void 0:r.attributesToRetrieve,attributesToCrop:null==r?void 0:r.attributesToCrop,attributesToHighlight:null==r?void 0:r.attributesToHighlight},"POST"!==s.toUpperCase()?[3,2]:[4,this.httpRequest.post(i,c(h),void 0,a)];case 1:return[2,o.sent()];case 2:return"GET"!==s.toUpperCase()?[3,4]:(d=n(n({},h),{facetFilters:Array.isArray(null==r?void 0:r.facetFilters)&&(null==r?void 0:r.facetFilters)?JSON.stringify(r.facetFilters):void 0,facetsDistribution:(null==r?void 0:r.facetsDistribution)?JSON.stringify(r.facetsDistribution):void 0,attributesToRetrieve:(null==r?void 0:r.attributesToRetrieve)?r.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==r?void 0:r.attributesToCrop)?r.attributesToCrop.join(","):void 0,attributesToHighlight:(null==r?void 0:r.attributesToHighlight)?r.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(i,c(d),a)]);case 3:return[2,o.sent()];case 4:throw new u("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(e,r,u){return void 0===u&&(u={}),i(this,void 0,void 0,(function(){var i,s;return o(this,(function(o){switch(o.label){case 0:return i=t.apiRoutes.indexes,[4,new p(e).post(i,n(n({},u),{uid:r}))];case 1:return s=o.sent(),[2,new t(e,r,s.primaryKey)]}}))}))},t.prototype.update=function(e){return i(this,void 0,void 0,(function(){var r,n;return o(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return i(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(i=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(r,n(n({},e),void 0!==i?{attributesToRetrieve:i}:{}))];case 1:return[2,o.sent()]}}))}))},t.prototype.getDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}(),l=function(){function t(t){t.host=p.addTrailingSlash(t.host),this.config=t,this.httpRequest=new p(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new f(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new f(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new d(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,f.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){return[2,new f(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new f(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getkeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}();t.MeiliSearch=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=meilisearch.umd.min.js.map

@@ -5,3 +5,3 @@ import { Index } from './index';

declare type createPath = (x: string | number) => string;
declare class MeiliSearch implements Types.MeiliSearchInterface {
export declare class MeiliSearch implements Types.MeiliSearchInterface {
config: Types.Config;

@@ -103,3 +103,3 @@ httpRequest: HttpRequests;

}
export default MeiliSearch;
export {};
//# sourceMappingURL=meilisearch.d.ts.map

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

// Type definitions for meilisearch 0.17.1
// Type definitions for meilisearch 0.18.0
// Project: https://github.com/meilisearch/meilisearch-js
// Definitions by: cvermand <charlotte@meilisearch.com> <https://github.com/meilisearch>
// Definitions: https://github.com/meilisearch/meilisearch-js
// TypeScript Version: 3.9.7
// TypeScript Version: 4.1.3
import { Index } from './index';
import MeiliSearch from './meilisearch';
import { MeiliSearch } from './meilisearch';
import MeiliSearchApiError from './errors/meilisearch-api-error';

@@ -13,2 +13,3 @@ import MeiliSearchTimeOutError from './errors/meilisearch-timeout-error';

export { Index };
export { MeiliSearch };
export { MeiliSearchApiError };

@@ -15,0 +16,0 @@ export { MeiliSearchError };

{
"name": "meilisearch",
"version": "0.17.1",
"version": "0.18.0",
"description": "The MeiliSearch JS client for Node.js and the browser.",

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

"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "11.0.0",
"@rollup/plugin-node-resolve": "11.1.0",
"@types/jest": "^26.0.14",

@@ -77,7 +77,7 @@ "@types/prettier": "^2.0.0",

"eslint": "^7.5.0",
"eslint-config-prettier": "^7.0.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-standard-with-typescript": "^17.0.0",
"eslint-plugin-import": "2",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-jsdoc": "^31.0.6",
"eslint-plugin-jsdoc": "^31.3.3",
"eslint-plugin-node": "11",

@@ -89,8 +89,9 @@ "eslint-plugin-prettier": "^3.1.4",

"jest": "^26.6.3",
"jest-watch-typeahead": "^0.5.0",
"kleur": "^4.0.0",
"jest-environment-jsdom": "25.5",
"jest-watch-typeahead": "^0.6.1",
"kleur": "^4.1.4",
"lint-staged": "10.5.1",
"prettier": "^2.0.2",
"pretty-bytes": "^5.3.0",
"rollup": "^2.2.0",
"rollup": "^2.38.0",
"rollup-plugin-terser": "^7.0.0",

@@ -100,4 +101,4 @@ "rollup-plugin-typescript2": "^0.29.0",

"ts-jest": "^26.4.4",
"typescript": "3.9.7"
"typescript": "4.1.3"
}
}

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

#### Front End or ESmodule <!-- omit in toc -->
Depending on the environment on which you are using MeiliSearch, imports may differ.
#### Import Syntax <!-- omit in toc -->
Usage in a ES module environment:
```javascript
import MeiliSearch from 'meilisearch'
import { MeiliSearch } from 'meilisearch'

@@ -85,5 +89,7 @@ const client = new MeiliSearch({

#### HTML Import <!-- omit in toc -->
#### Include Script Tag <!-- omit in toc -->
```javascript
Usage in an HTML (or alike) file:
```html
<script src="https://cdn.jsdelivr.net/npm/meilisearch@latest/dist/bundles/meilisearch.umd.js"></script>

@@ -95,12 +101,11 @@ <script>

})
client.listIndexes().then(res => {
console.log({ res });
})
</script>
```
#### Back-End CommonJs <!-- omit in toc -->
#### Require Syntax <!-- omit in toc -->
Usage in a back-end node environment
```javascript
const MeiliSearch = require('meilisearch')
const { MeiliSearch } = require('meilisearch')

@@ -122,5 +127,5 @@ const client = new MeiliSearch({

```js
const MeiliSearch = require('meilisearch')
// Or if you are on a front-end environment:
import MeiliSearch from 'meilisearch'
const { MeiliSearch } = require('meilisearch')
// Or if you are in a ES environment
import { MeiliSearch } from 'meilisearch'

@@ -127,0 +132,0 @@ ;(async () => {

@@ -17,3 +17,3 @@ /*

class MeiliSearch implements Types.MeiliSearchInterface {
export class MeiliSearch implements Types.MeiliSearchInterface {
config: Types.Config

@@ -212,3 +212,1 @@ httpRequest: HttpRequests

}
export default MeiliSearch

@@ -8,3 +8,3 @@ // Type definitions for meilisearch

import { Index } from './index'
import MeiliSearch from './meilisearch'
import { MeiliSearch } from './meilisearch'
import MeiliSearchApiError from './errors/meilisearch-api-error'

@@ -14,2 +14,3 @@ import MeiliSearchTimeOutError from './errors/meilisearch-timeout-error'

export { Index }
export { MeiliSearch }
export { MeiliSearchApiError }

@@ -16,0 +17,0 @@ export { MeiliSearchError }

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