meilisearch
Advanced tools
Comparing version 0.34.2-tokenizer-customization.0 to 0.34.2
@@ -1,2 +0,2 @@ | ||
import t from"crypto";const e={ALL:"all",LAST:"last"},i={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"};function s(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{d(s.next(t))}catch(t){r(t)}}function u(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,u)}d((s=s.apply(t,e||[])).next())}))}class n extends Error{constructor(t,e,i,s){var r,o,u;super(t),Object.setPrototypeOf(this,n.prototype),this.name="MeiliSearchCommunicationError",e instanceof Response&&(this.message=e.statusText,this.statusCode=e.status),e instanceof Error&&(this.errno=e.errno,this.code=e.code),s?(this.stack=s,this.stack=null===(r=this.stack)||void 0===r?void 0:r.replace(/(TypeError|FetchError)/,this.name),this.stack=null===(o=this.stack)||void 0===o?void 0:o.replace("Failed to fetch",`request to ${i} failed, reason: connect ECONNREFUSED`),this.stack=null===(u=this.stack)||void 0===u?void 0:u.replace("Not Found",`Not Found: ${i}`)):Error.captureStackTrace&&Error.captureStackTrace(this,n)}}const r=class extends Error{constructor(t,e){super(t.message),Object.setPrototypeOf(this,r.prototype),this.name="MeiliSearchApiError",this.code=t.code,this.type=t.type,this.link=t.link,this.message=t.message,this.httpStatus=e,Error.captureStackTrace&&Error.captureStackTrace(this,r)}};function o(t){return s(this,void 0,void 0,(function*(){if(!t.ok){let e;try{e=yield t.json()}catch(e){throw new n(t.statusText,t,t.url)}throw new r(e,t.status)}return t}))}function u(t,e,i){if("MeiliSearchApiError"!==t.name)throw new n(t.message,t,i,e);throw t}class d extends Error{constructor(t){super(t),Object.setPrototypeOf(this,d.prototype),this.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class a extends Error{constructor(t){super(t),Object.setPrototypeOf(this,a.prototype),this.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(this,a)}}function h(t,e){return`${t}\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ${e} call requires.`}function c(t){return Object.entries(t).reduce(((t,e)=>{const[i,s]=e;return void 0!==s&&(t[i]=s),t}),{})}function l(t){return s(this,void 0,void 0,(function*(){return yield new Promise((e=>setTimeout(e,t)))}))}function p(t){return Object.keys(t).reduce(((e,i)=>{const s=t[i];return void 0===s?e:Array.isArray(s)?Object.assign(Object.assign({},e),{[i]:s.join(",")}):s instanceof Date?Object.assign(Object.assign({},e),{[i]:s.toISOString()}):Object.assign(Object.assign({},e),{[i]:s})}),{})}function v(t){var e,i;const s="X-Meilisearch-Client",n="Meilisearch JavaScript (v0.34.2-tokenizer-customization.0)",r=function(t){if(Array.isArray(t))return t.reduce(((t,e)=>(t[e[0]]=e[1],t)),{});if("has"in t){const e={};return t.forEach(((t,i)=>e[i]=t)),e}return Object.assign({},t)}(null!==(i=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==i?i:{});if(t.apiKey&&!r.Authorization&&(r.Authorization=`Bearer ${t.apiKey}`),r["Content-Type"]||(r["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){const e=t.clientAgents.concat(n);r[s]=e.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d(`Meilisearch: The header "${s}" should be an array of string(s).\n`);r[s]=n}return r}class f{constructor(t){this.headers=v(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{const e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:`http://${t}`}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new d("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}request({method:t,url:e,params:i,body:n,config:r={}}){var d;return s(this,void 0,void 0,(function*(){"undefined"==typeof fetch&&require("cross-fetch/polyfill");const s=new URL(e,this.url);if(i){const t=new URLSearchParams;Object.keys(i).filter((t=>null!==i[t])).map((e=>t.set(e,i[e]))),s.search=t.toString()}(null===(d=r.headers)||void 0===d?void 0:d["Content-Type"])||(n=JSON.stringify(n));const a=Object.assign(Object.assign({},this.headers),r.headers);try{const e=(this.httpClient?this.httpClient:fetch)(s.toString(),Object.assign(Object.assign(Object.assign({},r),this.requestConfig),{method:t,body:n,headers:a}));if(this.httpClient)return yield e;const i=yield e.then((t=>o(t)));return yield i.json().catch((()=>{}))}catch(t){u(t,t.stack,s.toString())}}))}get(t,e,i){return s(this,void 0,void 0,(function*(){return yield this.request({method:"GET",url:t,params:e,config:i})}))}post(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"POST",url:t,body:e,params:i,config:n})}))}put(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"PUT",url:t,body:e,params:i,config:n})}))}patch(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"PATCH",url:t,body:e,params:i,config:n})}))}delete(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"DELETE",url:t,body:e,params:i,config:n})}))}}class y{constructor(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}}class g{constructor(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}}class w{constructor(t){this.httpRequest=new f(t)}getTask(t){return s(this,void 0,void 0,(function*(){const e=`tasks/${t}`,i=yield this.httpRequest.get(e);return new g(i)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.get("tasks",p(t));return Object.assign(Object.assign({},e),{results:e.results.map((t=>new g(t)))})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){const s=Date.now();for(;Date.now()-s<e;){const e=yield this.getTask(t);if(!["enqueued","processing"].includes(e.status))return e;yield l(i)}throw new a(`timeout of ${e}ms has exceeded on process ${t} when waiting a task to be resolved.`)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){const s=[];for(const n of t){const t=yield this.waitForTask(n,{timeOutMs:e,intervalMs:i});s.push(t)}return s}))}cancelTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.post("tasks/cancel",{},p(t));return new y(e)}))}deleteTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.delete("tasks",{},p(t));return new y(e)}))}}class q{constructor(t,e,i){this.uid=e,this.primaryKey=i,this.httpRequest=new f(t),this.tasks=new w(t)}search(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/search`;return yield this.httpRequest.post(s,c(Object.assign({q:t},e)),void 0,i)}))}searchGet(t,e,i){var n,r,o,u,a,h,l;return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/search`,p=Object.assign(Object.assign({q:t},e),{filter:(t=>{if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")})(null==e?void 0:e.filter),sort:null===(n=null==e?void 0:e.sort)||void 0===n?void 0:n.join(","),facets:null===(r=null==e?void 0:e.facets)||void 0===r?void 0:r.join(","),attributesToRetrieve:null===(o=null==e?void 0:e.attributesToRetrieve)||void 0===o?void 0:o.join(","),attributesToCrop:null===(u=null==e?void 0:e.attributesToCrop)||void 0===u?void 0:u.join(","),attributesToHighlight:null===(a=null==e?void 0:e.attributesToHighlight)||void 0===a?void 0:a.join(","),vector:null===(h=null==e?void 0:e.vector)||void 0===h?void 0:h.join(","),attributesToSearchOn:null===(l=null==e?void 0:e.attributesToSearchOn)||void 0===l?void 0:l.join(",")});return yield this.httpRequest.get(s,c(p),i)}))}searchForFacetValues(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/facet-search`;return yield this.httpRequest.post(i,c(t),void 0,e)}))}getRawInfo(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}`,e=yield this.httpRequest.get(t);return this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),e}))}fetchInfo(){return s(this,void 0,void 0,(function*(){return yield this.getRawInfo(),this}))}fetchPrimaryKey(){return s(this,void 0,void 0,(function*(){return this.primaryKey=(yield this.getRawInfo()).primaryKey,this.primaryKey}))}static create(t,e={},i){return s(this,void 0,void 0,(function*(){const s=new f(i),n=yield s.post("indexes",Object.assign(Object.assign({},e),{uid:t}));return new y(n)}))}update(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}`,i=yield this.httpRequest.patch(e,t);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}delete(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}`,e=yield this.httpRequest.delete(t);return new y(e)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}))}))}getTask(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTask(t)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTasks(t,{timeOutMs:e,intervalMs:i})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTask(t,{timeOutMs:e,intervalMs:i})}))}getStats(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/stats`;return yield this.httpRequest.get(t)}))}getDocuments(t={}){var e;return s(this,void 0,void 0,(function*(){if(void 0===(t=c(t)).filter){const i=`indexes/${this.uid}/documents`,s=Array.isArray(null==t?void 0:t.fields)?{fields:null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}:{};return yield this.httpRequest.get(i,Object.assign(Object.assign({},t),s))}try{const e=`indexes/${this.uid}/documents/fetch`;return yield this.httpRequest.post(e,t)}catch(t){throw(t instanceof n||t instanceof r)&&(t.message=h(t.message,"getDocuments")),t}}))}getDocument(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents/${t}`,s=(()=>{var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")})();return yield this.httpRequest.get(i,c(Object.assign(Object.assign({},e),{fields:s})))}))}addDocuments(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents`,s=yield this.httpRequest.post(i,t,e);return new y(s)}))}addDocumentsFromString(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/documents`,n=yield this.httpRequest.post(s,t,i,{headers:{"Content-Type":e}});return new y(n)}))}addDocumentsInBatches(t,e=1e3,i){return s(this,void 0,void 0,(function*(){const s=[];for(let n=0;n<t.length;n+=e)s.push(yield this.addDocuments(t.slice(n,n+e),i));return s}))}updateDocuments(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents`,s=yield this.httpRequest.put(i,t,e);return new y(s)}))}updateDocumentsInBatches(t,e=1e3,i){return s(this,void 0,void 0,(function*(){const s=[];for(let n=0;n<t.length;n+=e)s.push(yield this.updateDocuments(t.slice(n,n+e),i));return s}))}updateDocumentsFromString(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/documents`,n=yield this.httpRequest.put(s,t,i,{headers:{"Content-Type":e}});return new y(n)}))}deleteDocument(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/documents/${t}`,i=yield this.httpRequest.delete(e);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}deleteDocuments(t){return s(this,void 0,void 0,(function*(){const e=!Array.isArray(t)&&"object"==typeof t,i=e?"documents/delete":"documents/delete-batch",s=`indexes/${this.uid}/${i}`;try{const e=yield this.httpRequest.post(s,t);return new y(e)}catch(t){throw(t instanceof n&&e||t instanceof r)&&(t.message=h(t.message,"deleteDocuments")),t}}))}deleteAllDocuments(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/documents`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSettings(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings`;return yield this.httpRequest.get(t)}))}updateSettings(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings`,i=yield this.httpRequest.patch(e,t);return i.enqueued=new Date(i.enqueuedAt),i}))}resetSettings(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getPagination(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/pagination`;return yield this.httpRequest.get(t)}))}updatePagination(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/pagination`,i=yield this.httpRequest.patch(e,t);return new y(i)}))}resetPagination(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/pagination`,e=yield this.httpRequest.delete(t);return new y(e)}))}getSynonyms(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/synonyms`;return yield this.httpRequest.get(t)}))}updateSynonyms(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/synonyms`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSynonyms(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/synonyms`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getStopWords(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/stop-words`;return yield this.httpRequest.get(t)}))}updateStopWords(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/stop-words`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetStopWords(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/stop-words`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getRankingRules(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/ranking-rules`;return yield this.httpRequest.get(t)}))}updateRankingRules(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/ranking-rules`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetRankingRules(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/ranking-rules`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getDistinctAttribute(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/distinct-attribute`;return yield this.httpRequest.get(t)}))}updateDistinctAttribute(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/distinct-attribute`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetDistinctAttribute(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/distinct-attribute`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getFilterableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/filterable-attributes`;return yield this.httpRequest.get(t)}))}updateFilterableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/filterable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetFilterableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/filterable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSortableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/sortable-attributes`;return yield this.httpRequest.get(t)}))}updateSortableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/sortable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSortableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/sortable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSearchableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/searchable-attributes`;return yield this.httpRequest.get(t)}))}updateSearchableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/searchable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSearchableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/searchable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getDisplayedAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/displayed-attributes`;return yield this.httpRequest.get(t)}))}updateDisplayedAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/displayed-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetDisplayedAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/displayed-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getTypoTolerance(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/typo-tolerance`;return yield this.httpRequest.get(t)}))}updateTypoTolerance(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/typo-tolerance`,i=yield this.httpRequest.patch(e,t);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}resetTypoTolerance(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/typo-tolerance`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getFaceting(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/faceting`;return yield this.httpRequest.get(t)}))}updateFaceting(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/faceting`,i=yield this.httpRequest.patch(e,t);return new y(i)}))}resetFaceting(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/faceting`,e=yield this.httpRequest.delete(t);return new y(e)}))}getSeparatorTokens(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/separator-tokens`;return yield this.httpRequest.get(t)}))}updateSeparatorTokens(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/separator-tokens`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSeparatorTokens(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/separator-tokens`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getNonSeparatorTokens(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/non-separator-tokens`;return yield this.httpRequest.get(t)}))}updateNonSeparatorTokens(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/non-separator-tokens`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetNonSeparatorTokens(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/non-separator-tokens`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getDictionary(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/dictionary`;return yield this.httpRequest.get(t)}))}updateDictionary(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/dictionary`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetDictionary(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/dictionary`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}}function b(t){return Buffer.from(JSON.stringify(t)).toString("base64")}class m{constructor(t){this.config=t}generateTenantToken(e,i,s){const n=(null==s?void 0:s.apiKey)||this.config.apiKey||"",r=e||"",o=null==s?void 0:s.expiresAt;!function(t){const{searchRules:e,uid:i,apiKey:s,expiresAt:n}=t;if(n){if(!(n instanceof Date))throw new d("Meilisearch: The expiredAt field must be an instance of Date.");if(n.getTime()<Date.now())throw new d("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new d("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!s||"string"!=typeof s)throw new d("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!i||"string"!=typeof i)throw new d("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(i))throw new d("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}({apiKey:n,uid:r,expiresAt:o,searchRules:i});const u=b({alg:"HS256",typ:"JWT"}).replace(/=/g,""),a=function(t){const{searchRules:e,uid:i,expiresAt:s}=t;return b({searchRules:e,apiKeyUid:i,exp:s?Math.floor(s.getTime()/1e3):void 0}).replace(/=/g,"")}({searchRules:i,uid:r,expiresAt:o}),h=function(e,i,s){return t.createHmac("sha256",e).update(`${i}.${s}`).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}(n,u,a);return`${u}.${a}.${h}`}}class k extends class{constructor(t){this.config=t,this.httpRequest=new f(t),this.tasks=new w(t)}index(t){return new q(this.config,t)}getIndex(t){return s(this,void 0,void 0,(function*(){return new q(this.config,t).fetchInfo()}))}getRawIndex(t){return s(this,void 0,void 0,(function*(){return new q(this.config,t).getRawInfo()}))}getIndexes(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.getRawIndexes(t),i=e.results.map((t=>new q(this.config,t.uid,t.primaryKey)));return Object.assign(Object.assign({},e),{results:i})}))}getRawIndexes(t={}){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("indexes",t)}))}createIndex(t,e={}){return s(this,void 0,void 0,(function*(){return yield q.create(t,e,this.config)}))}updateIndex(t,e={}){return s(this,void 0,void 0,(function*(){return yield new q(this.config,t).update(e)}))}deleteIndex(t){return s(this,void 0,void 0,(function*(){return yield new q(this.config,t).delete()}))}deleteIndexIfExists(t){return s(this,void 0,void 0,(function*(){try{return yield this.deleteIndex(t),!0}catch(t){if("index_not_found"===t.code)return!1;throw t}}))}swapIndexes(t){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("/swap-indexes",t)}))}multiSearch(t,e){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("multi-search",t,void 0,e)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTasks(t)}))}getTask(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTask(t)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTasks(t,{timeOutMs:e,intervalMs:i})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTask(t,{timeOutMs:e,intervalMs:i})}))}cancelTasks(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.cancelTasks(t)}))}deleteTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.deleteTasks(t)}))}getKeys(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.get("keys",t);return e.results=e.results.map((t=>Object.assign(Object.assign({},t),{createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)}))),e}))}getKey(t){return s(this,void 0,void 0,(function*(){const e=`keys/${t}`;return yield this.httpRequest.get(e)}))}createKey(t){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("keys",t)}))}updateKey(t,e){return s(this,void 0,void 0,(function*(){const i=`keys/${t}`;return yield this.httpRequest.patch(i,e)}))}deleteKey(t){return s(this,void 0,void 0,(function*(){const e=`keys/${t}`;return yield this.httpRequest.delete(e)}))}health(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("health")}))}isHealthy(){return s(this,void 0,void 0,(function*(){try{const t="health";return yield this.httpRequest.get(t),!0}catch(t){return!1}}))}getStats(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("stats")}))}getVersion(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("version")}))}createDump(){return s(this,void 0,void 0,(function*(){const t=yield this.httpRequest.post("dumps");return new y(t)}))}generateTenantToken(t,e,i){const s=new Error;throw new Error(`Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ${s.stack}.`)}}{constructor(t){super(t),this.tokens=new m(t)}generateTenantToken(t,e,i){return"undefined"==typeof window?this.tokens.generateTenantToken(t,e,i):super.generateTenantToken(t,e,i)}}export{i as ContentTypeEnum,y as EnqueuedTask,q as Index,e as MatchingStrategies,k as MeiliSearch,r as MeiliSearchApiError,n as MeiliSearchCommunicationError,d as MeiliSearchError,a as MeiliSearchTimeOutError,g as Task,w as TaskClient,k as default,u as httpErrorHandler,o as httpResponseErrorHandler,h as versionErrorHintMessage}; | ||
import t from"crypto";const e={ALL:"all",LAST:"last"},i={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"};function s(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{d(s.next(t))}catch(t){r(t)}}function u(t){try{d(s.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,u)}d((s=s.apply(t,e||[])).next())}))}class n extends Error{constructor(t,e,i,s){var r,o,u;super(t),Object.setPrototypeOf(this,n.prototype),this.name="MeiliSearchCommunicationError",e instanceof Response&&(this.message=e.statusText,this.statusCode=e.status),e instanceof Error&&(this.errno=e.errno,this.code=e.code),s?(this.stack=s,this.stack=null===(r=this.stack)||void 0===r?void 0:r.replace(/(TypeError|FetchError)/,this.name),this.stack=null===(o=this.stack)||void 0===o?void 0:o.replace("Failed to fetch",`request to ${i} failed, reason: connect ECONNREFUSED`),this.stack=null===(u=this.stack)||void 0===u?void 0:u.replace("Not Found",`Not Found: ${i}`)):Error.captureStackTrace&&Error.captureStackTrace(this,n)}}const r=class extends Error{constructor(t,e){super(t.message),Object.setPrototypeOf(this,r.prototype),this.name="MeiliSearchApiError",this.code=t.code,this.type=t.type,this.link=t.link,this.message=t.message,this.httpStatus=e,Error.captureStackTrace&&Error.captureStackTrace(this,r)}};function o(t){return s(this,void 0,void 0,(function*(){if(!t.ok){let e;try{e=yield t.json()}catch(e){throw new n(t.statusText,t,t.url)}throw new r(e,t.status)}return t}))}function u(t,e,i){if("MeiliSearchApiError"!==t.name)throw new n(t.message,t,i,e);throw t}class d extends Error{constructor(t){super(t),Object.setPrototypeOf(this,d.prototype),this.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class a extends Error{constructor(t){super(t),Object.setPrototypeOf(this,a.prototype),this.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(this,a)}}function h(t,e){return`${t}\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ${e} call requires.`}function c(t){return Object.entries(t).reduce(((t,e)=>{const[i,s]=e;return void 0!==s&&(t[i]=s),t}),{})}function l(t){return s(this,void 0,void 0,(function*(){return yield new Promise((e=>setTimeout(e,t)))}))}function v(t){return Object.keys(t).reduce(((e,i)=>{const s=t[i];return void 0===s?e:Array.isArray(s)?Object.assign(Object.assign({},e),{[i]:s.join(",")}):s instanceof Date?Object.assign(Object.assign({},e),{[i]:s.toISOString()}):Object.assign(Object.assign({},e),{[i]:s})}),{})}function p(t){var e,i;const s="X-Meilisearch-Client",n="Meilisearch JavaScript (v0.34.2)",r=function(t){if(Array.isArray(t))return t.reduce(((t,e)=>(t[e[0]]=e[1],t)),{});if("has"in t){const e={};return t.forEach(((t,i)=>e[i]=t)),e}return Object.assign({},t)}(null!==(i=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==i?i:{});if(t.apiKey&&!r.Authorization&&(r.Authorization=`Bearer ${t.apiKey}`),r["Content-Type"]||(r["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){const e=t.clientAgents.concat(n);r[s]=e.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new d(`Meilisearch: The header "${s}" should be an array of string(s).\n`);r[s]=n}return r}class f{constructor(t){this.headers=p(t),this.requestConfig=t.requestConfig,this.httpClient=t.httpClient;try{const e=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:`http://${t}`}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new d("The provided host is not valid.")}var e}(t.host);this.url=new URL(e)}catch(t){throw new d("The provided host is not valid.")}}request({method:t,url:e,params:i,body:n,config:r={}}){var d;return s(this,void 0,void 0,(function*(){"undefined"==typeof fetch&&require("cross-fetch/polyfill");const s=new URL(e,this.url);if(i){const t=new URLSearchParams;Object.keys(i).filter((t=>null!==i[t])).map((e=>t.set(e,i[e]))),s.search=t.toString()}(null===(d=r.headers)||void 0===d?void 0:d["Content-Type"])||(n=JSON.stringify(n));const a=Object.assign(Object.assign({},this.headers),r.headers);try{const e=(this.httpClient?this.httpClient:fetch)(s.toString(),Object.assign(Object.assign(Object.assign({},r),this.requestConfig),{method:t,body:n,headers:a}));if(this.httpClient)return yield e;const i=yield e.then((t=>o(t)));return yield i.json().catch((()=>{}))}catch(t){u(t,t.stack,s.toString())}}))}get(t,e,i){return s(this,void 0,void 0,(function*(){return yield this.request({method:"GET",url:t,params:e,config:i})}))}post(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"POST",url:t,body:e,params:i,config:n})}))}put(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"PUT",url:t,body:e,params:i,config:n})}))}patch(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"PATCH",url:t,body:e,params:i,config:n})}))}delete(t,e,i,n){return s(this,void 0,void 0,(function*(){return yield this.request({method:"DELETE",url:t,body:e,params:i,config:n})}))}}class y{constructor(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}}class g{constructor(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}}class w{constructor(t){this.httpRequest=new f(t)}getTask(t){return s(this,void 0,void 0,(function*(){const e=`tasks/${t}`,i=yield this.httpRequest.get(e);return new g(i)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.get("tasks",v(t));return Object.assign(Object.assign({},e),{results:e.results.map((t=>new g(t)))})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){const s=Date.now();for(;Date.now()-s<e;){const e=yield this.getTask(t);if(!["enqueued","processing"].includes(e.status))return e;yield l(i)}throw new a(`timeout of ${e}ms has exceeded on process ${t} when waiting a task to be resolved.`)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){const s=[];for(const n of t){const t=yield this.waitForTask(n,{timeOutMs:e,intervalMs:i});s.push(t)}return s}))}cancelTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.post("tasks/cancel",{},v(t));return new y(e)}))}deleteTasks(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.delete("tasks",{},v(t));return new y(e)}))}}class q{constructor(t,e,i){this.uid=e,this.primaryKey=i,this.httpRequest=new f(t),this.tasks=new w(t)}search(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/search`;return yield this.httpRequest.post(s,c(Object.assign({q:t},e)),void 0,i)}))}searchGet(t,e,i){var n,r,o,u,a,h,l;return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/search`,v=Object.assign(Object.assign({q:t},e),{filter:(t=>{if("string"==typeof t)return t;if(Array.isArray(t))throw new d("The filter query parameter should be in string format when using searchGet")})(null==e?void 0:e.filter),sort:null===(n=null==e?void 0:e.sort)||void 0===n?void 0:n.join(","),facets:null===(r=null==e?void 0:e.facets)||void 0===r?void 0:r.join(","),attributesToRetrieve:null===(o=null==e?void 0:e.attributesToRetrieve)||void 0===o?void 0:o.join(","),attributesToCrop:null===(u=null==e?void 0:e.attributesToCrop)||void 0===u?void 0:u.join(","),attributesToHighlight:null===(a=null==e?void 0:e.attributesToHighlight)||void 0===a?void 0:a.join(","),vector:null===(h=null==e?void 0:e.vector)||void 0===h?void 0:h.join(","),attributesToSearchOn:null===(l=null==e?void 0:e.attributesToSearchOn)||void 0===l?void 0:l.join(",")});return yield this.httpRequest.get(s,c(v),i)}))}searchForFacetValues(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/facet-search`;return yield this.httpRequest.post(i,c(t),void 0,e)}))}getRawInfo(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}`,e=yield this.httpRequest.get(t);return this.primaryKey=e.primaryKey,this.updatedAt=new Date(e.updatedAt),this.createdAt=new Date(e.createdAt),e}))}fetchInfo(){return s(this,void 0,void 0,(function*(){return yield this.getRawInfo(),this}))}fetchPrimaryKey(){return s(this,void 0,void 0,(function*(){return this.primaryKey=(yield this.getRawInfo()).primaryKey,this.primaryKey}))}static create(t,e={},i){return s(this,void 0,void 0,(function*(){const s=new f(i),n=yield s.post("indexes",Object.assign(Object.assign({},e),{uid:t}));return new y(n)}))}update(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}`,i=yield this.httpRequest.patch(e,t);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}delete(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}`,e=yield this.httpRequest.delete(t);return new y(e)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}))}))}getTask(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTask(t)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTasks(t,{timeOutMs:e,intervalMs:i})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTask(t,{timeOutMs:e,intervalMs:i})}))}getStats(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/stats`;return yield this.httpRequest.get(t)}))}getDocuments(t={}){var e;return s(this,void 0,void 0,(function*(){if(void 0===(t=c(t)).filter){const i=`indexes/${this.uid}/documents`,s=Array.isArray(null==t?void 0:t.fields)?{fields:null===(e=null==t?void 0:t.fields)||void 0===e?void 0:e.join(",")}:{};return yield this.httpRequest.get(i,Object.assign(Object.assign({},t),s))}try{const e=`indexes/${this.uid}/documents/fetch`;return yield this.httpRequest.post(e,t)}catch(t){throw(t instanceof n||t instanceof r)&&(t.message=h(t.message,"getDocuments")),t}}))}getDocument(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents/${t}`,s=(()=>{var t;if(Array.isArray(null==e?void 0:e.fields))return null===(t=null==e?void 0:e.fields)||void 0===t?void 0:t.join(",")})();return yield this.httpRequest.get(i,c(Object.assign(Object.assign({},e),{fields:s})))}))}addDocuments(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents`,s=yield this.httpRequest.post(i,t,e);return new y(s)}))}addDocumentsFromString(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/documents`,n=yield this.httpRequest.post(s,t,i,{headers:{"Content-Type":e}});return new y(n)}))}addDocumentsInBatches(t,e=1e3,i){return s(this,void 0,void 0,(function*(){const s=[];for(let n=0;n<t.length;n+=e)s.push(yield this.addDocuments(t.slice(n,n+e),i));return s}))}updateDocuments(t,e){return s(this,void 0,void 0,(function*(){const i=`indexes/${this.uid}/documents`,s=yield this.httpRequest.put(i,t,e);return new y(s)}))}updateDocumentsInBatches(t,e=1e3,i){return s(this,void 0,void 0,(function*(){const s=[];for(let n=0;n<t.length;n+=e)s.push(yield this.updateDocuments(t.slice(n,n+e),i));return s}))}updateDocumentsFromString(t,e,i){return s(this,void 0,void 0,(function*(){const s=`indexes/${this.uid}/documents`,n=yield this.httpRequest.put(s,t,i,{headers:{"Content-Type":e}});return new y(n)}))}deleteDocument(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/documents/${t}`,i=yield this.httpRequest.delete(e);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}deleteDocuments(t){return s(this,void 0,void 0,(function*(){const e=!Array.isArray(t)&&"object"==typeof t,i=e?"documents/delete":"documents/delete-batch",s=`indexes/${this.uid}/${i}`;try{const e=yield this.httpRequest.post(s,t);return new y(e)}catch(t){throw(t instanceof n&&e||t instanceof r)&&(t.message=h(t.message,"deleteDocuments")),t}}))}deleteAllDocuments(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/documents`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSettings(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings`;return yield this.httpRequest.get(t)}))}updateSettings(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings`,i=yield this.httpRequest.patch(e,t);return i.enqueued=new Date(i.enqueuedAt),i}))}resetSettings(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getPagination(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/pagination`;return yield this.httpRequest.get(t)}))}updatePagination(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/pagination`,i=yield this.httpRequest.patch(e,t);return new y(i)}))}resetPagination(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/pagination`,e=yield this.httpRequest.delete(t);return new y(e)}))}getSynonyms(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/synonyms`;return yield this.httpRequest.get(t)}))}updateSynonyms(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/synonyms`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSynonyms(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/synonyms`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getStopWords(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/stop-words`;return yield this.httpRequest.get(t)}))}updateStopWords(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/stop-words`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetStopWords(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/stop-words`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getRankingRules(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/ranking-rules`;return yield this.httpRequest.get(t)}))}updateRankingRules(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/ranking-rules`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetRankingRules(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/ranking-rules`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getDistinctAttribute(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/distinct-attribute`;return yield this.httpRequest.get(t)}))}updateDistinctAttribute(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/distinct-attribute`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetDistinctAttribute(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/distinct-attribute`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getFilterableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/filterable-attributes`;return yield this.httpRequest.get(t)}))}updateFilterableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/filterable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetFilterableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/filterable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSortableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/sortable-attributes`;return yield this.httpRequest.get(t)}))}updateSortableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/sortable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSortableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/sortable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getSearchableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/searchable-attributes`;return yield this.httpRequest.get(t)}))}updateSearchableAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/searchable-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetSearchableAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/searchable-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getDisplayedAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/displayed-attributes`;return yield this.httpRequest.get(t)}))}updateDisplayedAttributes(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/displayed-attributes`,i=yield this.httpRequest.put(e,t);return new y(i)}))}resetDisplayedAttributes(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/displayed-attributes`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getTypoTolerance(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/typo-tolerance`;return yield this.httpRequest.get(t)}))}updateTypoTolerance(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/typo-tolerance`,i=yield this.httpRequest.patch(e,t);return i.enqueuedAt=new Date(i.enqueuedAt),i}))}resetTypoTolerance(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/typo-tolerance`,e=yield this.httpRequest.delete(t);return e.enqueuedAt=new Date(e.enqueuedAt),e}))}getFaceting(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/faceting`;return yield this.httpRequest.get(t)}))}updateFaceting(t){return s(this,void 0,void 0,(function*(){const e=`indexes/${this.uid}/settings/faceting`,i=yield this.httpRequest.patch(e,t);return new y(i)}))}resetFaceting(){return s(this,void 0,void 0,(function*(){const t=`indexes/${this.uid}/settings/faceting`,e=yield this.httpRequest.delete(t);return new y(e)}))}}function b(t){return Buffer.from(JSON.stringify(t)).toString("base64")}class m{constructor(t){this.config=t}generateTenantToken(e,i,s){const n=(null==s?void 0:s.apiKey)||this.config.apiKey||"",r=e||"",o=null==s?void 0:s.expiresAt;!function(t){const{searchRules:e,uid:i,apiKey:s,expiresAt:n}=t;if(n){if(!(n instanceof Date))throw new d("Meilisearch: The expiredAt field must be an instance of Date.");if(n.getTime()<Date.now())throw new d("Meilisearch: The expiresAt field must be a date in the future.")}if(e&&"object"!=typeof e&&!Array.isArray(e))throw new d("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!s||"string"!=typeof s)throw new d("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!i||"string"!=typeof i)throw new d("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(i))throw new d("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}({apiKey:n,uid:r,expiresAt:o,searchRules:i});const u=b({alg:"HS256",typ:"JWT"}).replace(/=/g,""),a=function(t){const{searchRules:e,uid:i,expiresAt:s}=t;return b({searchRules:e,apiKeyUid:i,exp:s?Math.floor(s.getTime()/1e3):void 0}).replace(/=/g,"")}({searchRules:i,uid:r,expiresAt:o}),h=function(e,i,s){return t.createHmac("sha256",e).update(`${i}.${s}`).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}(n,u,a);return`${u}.${a}.${h}`}}class A extends class{constructor(t){this.config=t,this.httpRequest=new f(t),this.tasks=new w(t)}index(t){return new q(this.config,t)}getIndex(t){return s(this,void 0,void 0,(function*(){return new q(this.config,t).fetchInfo()}))}getRawIndex(t){return s(this,void 0,void 0,(function*(){return new q(this.config,t).getRawInfo()}))}getIndexes(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.getRawIndexes(t),i=e.results.map((t=>new q(this.config,t.uid,t.primaryKey)));return Object.assign(Object.assign({},e),{results:i})}))}getRawIndexes(t={}){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("indexes",t)}))}createIndex(t,e={}){return s(this,void 0,void 0,(function*(){return yield q.create(t,e,this.config)}))}updateIndex(t,e={}){return s(this,void 0,void 0,(function*(){return yield new q(this.config,t).update(e)}))}deleteIndex(t){return s(this,void 0,void 0,(function*(){return yield new q(this.config,t).delete()}))}deleteIndexIfExists(t){return s(this,void 0,void 0,(function*(){try{return yield this.deleteIndex(t),!0}catch(t){if("index_not_found"===t.code)return!1;throw t}}))}swapIndexes(t){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("/swap-indexes",t)}))}multiSearch(t,e){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("multi-search",t,void 0,e)}))}getTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTasks(t)}))}getTask(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.getTask(t)}))}waitForTasks(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTasks(t,{timeOutMs:e,intervalMs:i})}))}waitForTask(t,{timeOutMs:e=5e3,intervalMs:i=50}={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.waitForTask(t,{timeOutMs:e,intervalMs:i})}))}cancelTasks(t){return s(this,void 0,void 0,(function*(){return yield this.tasks.cancelTasks(t)}))}deleteTasks(t={}){return s(this,void 0,void 0,(function*(){return yield this.tasks.deleteTasks(t)}))}getKeys(t={}){return s(this,void 0,void 0,(function*(){const e=yield this.httpRequest.get("keys",t);return e.results=e.results.map((t=>Object.assign(Object.assign({},t),{createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)}))),e}))}getKey(t){return s(this,void 0,void 0,(function*(){const e=`keys/${t}`;return yield this.httpRequest.get(e)}))}createKey(t){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.post("keys",t)}))}updateKey(t,e){return s(this,void 0,void 0,(function*(){const i=`keys/${t}`;return yield this.httpRequest.patch(i,e)}))}deleteKey(t){return s(this,void 0,void 0,(function*(){const e=`keys/${t}`;return yield this.httpRequest.delete(e)}))}health(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("health")}))}isHealthy(){return s(this,void 0,void 0,(function*(){try{const t="health";return yield this.httpRequest.get(t),!0}catch(t){return!1}}))}getStats(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("stats")}))}getVersion(){return s(this,void 0,void 0,(function*(){return yield this.httpRequest.get("version")}))}createDump(){return s(this,void 0,void 0,(function*(){const t=yield this.httpRequest.post("dumps");return new y(t)}))}generateTenantToken(t,e,i){const s=new Error;throw new Error(`Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ${s.stack}.`)}}{constructor(t){super(t),this.tokens=new m(t)}generateTenantToken(t,e,i){return"undefined"==typeof window?this.tokens.generateTenantToken(t,e,i):super.generateTenantToken(t,e,i)}}export{i as ContentTypeEnum,y as EnqueuedTask,q as Index,e as MatchingStrategies,A as MeiliSearch,r as MeiliSearchApiError,n as MeiliSearchCommunicationError,d as MeiliSearchError,a as MeiliSearchTimeOutError,g as Task,w as TaskClient,A as default,u as httpErrorHandler,o as httpResponseErrorHandler,h as versionErrorHintMessage}; | ||
//# sourceMappingURL=meilisearch.esm.min.js.map |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,s=Object.create(i.prototype),u=new R(n||[]);return s._invoke=function(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return O()}for(r.method=i,r.arg=s;;){var u=r.delegate;if(u){var a=b(u,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var o=h(t,e,r);if("normal"===o.type){if(n=r.done?"completed":"suspendedYield",o.arg===d)continue;return{value:o.arg,done:r.done}}"throw"===o.type&&(n="completed",r.method="throw",r.arg=o.arg)}}}(t,r,u),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var d={};function p(){}function f(){}function v(){}var l={};o(l,s,(function(){return this}));var w=Object.getPrototypeOf,y=w&&w(w(A([])));y&&y!==r&&n.call(y,s)&&(l=y);var x=v.prototype=p.prototype=Object.create(l);function k(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){function r(i,s,u,a){var o=h(t[i],t,s);if("throw"!==o.type){var c=o.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(d).then((function(t){c.value=t,u(c)}),(function(t){return r("throw",t,u,a)}))}a(o.arg)}var i;this._invoke=function(t,n){function s(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(s,s):s()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=v,o(x,"constructor",v),o(v,"constructor",f),f.displayName=o(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,o(t,a,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},k(g.prototype),o(g.prototype,u,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var u=new g(c(e,r,n,i),s);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(x),o(x,a,"Generator"),o(x,s,(function(){return this})),o(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(q),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),o=n.call(s,"finallyLoc");if(a&&o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var u=s?s.completion:{};return u.type=t,u.arg=e,s?(this.method="next",this.next=s.finallyLoc,d):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;q(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e,r){return d=h()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i},d.apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return p=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return d(t,arguments,o(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)},p(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}function l(t){var e=h();return function(){var r,n=o(t);if(e){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return v(this,r)}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,s=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);u=!0);}catch(t){a=!0,i=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw i}}return s}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,s=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function g(t,e,r,n){return new(r||(r=Promise))((function(i,s){function u(t){try{o(n.next(t))}catch(t){s(t)}}function a(t){try{o(n.throw(t))}catch(t){s(t)}}function o(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}o((n=n.apply(t,e||[])).next())}))}var b=function(t){a(r,t);var e=l(r);function r(t,i,s,u){var a,o,c,h;return n(this,r),a=e.call(this,t),Object.setPrototypeOf(f(a),r.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),u?(a.stack=u,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Failed to fetch","request to ".concat(s," failed, reason: connect ECONNREFUSED")),a.stack=null===(h=a.stack)||void 0===h?void 0:h.replace("Not Found","Not Found: ".concat(s))):Error.captureStackTrace&&Error.captureStackTrace(f(a),r),a}return s(r)}(p(Error)),m=function(t){a(r,t);var e=l(r);function r(t,i){var s;return n(this,r),s=e.call(this,t.message),Object.setPrototypeOf(f(s),r.prototype),s.name="MeiliSearchApiError",s.code=t.code,s.type=t.type,s.link=t.link,s.message=t.message,s.httpStatus=i,Error.captureStackTrace&&Error.captureStackTrace(f(s),r),s}return s(r)}(p(Error));function q(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:n=e.sent,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),new b(t.statusText,t,t.url);case 10:throw new m(n,t.status);case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),r,null,[[1,7]])})))}function R(t,e,r){if("MeiliSearchApiError"!==t.name)throw new b(t.message,t,r,e);throw t}var A=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error)),O=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error));function T(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function S(t){return Object.entries(t).reduce((function(t,e){var r=w(e,2),n=r[0],i=r[1];return void 0!==i&&(t[n]=i),t}),{})}function j(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r)})))}function E(t){return Object.keys(t).reduce((function(e,r){var n=t[r];return void 0===n?e:Array.isArray(n)?Object.assign(Object.assign({},e),u({},r,n.join(","))):n instanceof Date?Object.assign(Object.assign({},e),u({},r,n.toISOString())):Object.assign(Object.assign({},e),u({},r,n))}),{})}function D(t){var e,r,n="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat("0.34.2-tokenizer-customization.0",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,r){return e[r]=t})),e}return Object.assign({},t)}(null!==(r=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==r?r:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var u=t.clientAgents.concat(i);s[n]=u.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new A('Meilisearch: The header "'.concat(n,'" should be an array of string(s).\n'));s[n]=i}return s}var M=function(){function t(e){n(this,t),this.headers=D(e),this.requestConfig=e.requestConfig,this.httpClient=e.httpClient;try{var r=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new A("The provided host is not valid.")}var e}(e.host);this.url=new URL(r)}catch(t){throw new A("The provided host is not valid.")}}return s(t,[{key:"request",value:function(t){var r,n=t.method,i=t.url,s=t.params,u=t.body,a=t.config,o=void 0===a?{}:a;return g(this,void 0,void 0,e().mark((function t(){var a,c,h,d,p,f,v,l;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"==typeof fetch&&require("cross-fetch/polyfill"),a=new URL(i,this.url),s&&(c=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return c.set(t,s[t])})),a.search=c.toString()),(null===(r=o.headers)||void 0===r?void 0:r["Content-Type"])||(u=JSON.stringify(u)),h=Object.assign(Object.assign({},this.headers),o.headers),t.prev=5,d=this.httpClient?this.httpClient:fetch,p=d(a.toString(),Object.assign(Object.assign(Object.assign({},o),this.requestConfig),{method:n,body:u,headers:h})),!this.httpClient){t.next=12;break}return t.next=11,p;case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,p.then((function(t){return q(t)}));case 14:return f=t.sent,t.next=17,f.json().catch((function(){}));case 17:return v=t.sent,t.abrupt("return",v);case 21:t.prev=21,t.t0=t.catch(5),l=t.t0.stack,R(t.t0,l,a.toString());case 25:case"end":return t.stop()}}),t,this,[[5,21]])})))}},{key:"get",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"GET",url:t,params:r,config:n});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),i,this)})))}},{key:"post",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"POST",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"put",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PUT",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"patch",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PATCH",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"delete",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"DELETE",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}}]),t}(),L=s((function t(e){n(this,t),this.taskUid=e.taskUid,this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.enqueuedAt=new Date(e.enqueuedAt)})),F=s((function t(e){n(this,t),this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.uid=e.uid,this.details=e.details,this.canceledBy=e.canceledBy,this.error=e.error,this.duration=e.duration,this.startedAt=new Date(e.startedAt),this.enqueuedAt=new Date(e.enqueuedAt),this.finishedAt=new Date(e.finishedAt)})),I=function(){function t(e){n(this,t),this.httpRequest=new M(e)}return s(t,[{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return i=e.sent,e.abrupt("return",new F(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.get("tasks",E(t));case 3:return n=e.sent,e.abrupt("return",Object.assign(Object.assign({},n),{results:n.results.map((function(t){return new F(t)}))}));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now();case 1:if(!(Date.now()-n<i)){e.next=11;break}return e.next=4,this.getTask(t);case 4:if(s=e.sent,["enqueued","processing"].includes(s.status)){e.next=7;break}return e.abrupt("return",s);case 7:return e.next=9,j(u);case 9:e.next=1;break;case 11:throw new O("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."));case 12:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s,a,o,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],s=k(t),e.prev=2,s.s();case 4:if((a=s.n()).done){e.next=12;break}return o=a.value,e.next=8,this.waitForTask(o,{timeOutMs:i,intervalMs:u});case 8:c=e.sent,n.push(c);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),s.e(e.t0);case 17:return e.prev=17,s.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),r,this,[[2,14,17,20]])})))}},{key:"cancelTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks/cancel",e.next=3,this.httpRequest.post("tasks/cancel",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.delete("tasks",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}}]),t}(),P=function(){function t(e,r,i){n(this,t),this.uid=r,this.primaryKey=i,this.httpRequest=new M(e),this.tasks=new I(e)}return s(t,[{key:"search",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/search"),e.next=3,this.httpRequest.post(s,S(Object.assign({q:t},r)),void 0,n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),i,this)})))}},{key:"searchGet",value:function(t,r,n){var i,s,u,a,o,c,h;return g(this,void 0,void 0,e().mark((function d(){var p,f,v;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p="indexes/".concat(this.uid,"/search"),f=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new A("The filter query parameter should be in string format when using searchGet")},v=Object.assign(Object.assign({q:t},r),{filter:f(null==r?void 0:r.filter),sort:null===(i=null==r?void 0:r.sort)||void 0===i?void 0:i.join(","),facets:null===(s=null==r?void 0:r.facets)||void 0===s?void 0:s.join(","),attributesToRetrieve:null===(u=null==r?void 0:r.attributesToRetrieve)||void 0===u?void 0:u.join(","),attributesToCrop:null===(a=null==r?void 0:r.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(o=null==r?void 0:r.attributesToHighlight)||void 0===o?void 0:o.join(","),vector:null===(c=null==r?void 0:r.vector)||void 0===c?void 0:c.join(","),attributesToSearchOn:null===(h=null==r?void 0:r.attributesToSearchOn)||void 0===h?void 0:h.join(",")}),e.next=5,this.httpRequest.get(p,S(v),n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),d,this)})))}},{key:"searchForFacetValues",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/facet-search"),e.next=3,this.httpRequest.post(i,S(t),void 0,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"getRawInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.get(r);case 3:return n=t.sent,this.primaryKey=n.primaryKey,this.updatedAt=new Date(n.updatedAt),this.createdAt=new Date(n.createdAt),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"fetchInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return t.abrupt("return",this);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"fetchPrimaryKey",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return this.primaryKey=t.sent.primaryKey,t.abrupt("return",this.primaryKey);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"update",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"delete",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getStats",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/stats"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getDocuments",value:function(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function n(){var i,s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===(r=S(r)).filter){e.next=15;break}return e.prev=2,i="indexes/".concat(this.uid,"/documents/fetch"),e.next=6,this.httpRequest.post(i,r);case 6:case 19:return e.abrupt("return",e.sent);case 9:throw e.prev=9,e.t0=e.catch(2),(e.t0 instanceof b||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"getDocuments")),e.t0;case 13:e.next=20;break;case 15:return s="indexes/".concat(this.uid,"/documents"),u=Array.isArray(null==r?void 0:r.fields)?{fields:null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}:{},e.next=19,this.httpRequest.get(s,Object.assign(Object.assign({},r),u));case 20:case"end":return e.stop()}}),n,this,[[2,9]])})))}},{key:"getDocument",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents/").concat(t),s=function(){var t;if(Array.isArray(null==r?void 0:r.fields))return null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}(),e.next=4,this.httpRequest.get(i,S(Object.assign(Object.assign({},r),{fields:s})));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"addDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.addDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"updateDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.updateDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"deleteDocument",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),e.next=3,this.httpRequest.delete(n);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"deleteDocuments",value:function(t){return g(this,void 0,void 0,e().mark((function n(){var i,s,u,a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=!Array.isArray(t)&&"object"===r(t),s=i?"documents/delete":"documents/delete-batch",u="indexes/".concat(this.uid,"/").concat(s),e.prev=3,e.next=6,this.httpRequest.post(u,t);case 6:return a=e.sent,e.abrupt("return",new L(a));case 10:throw e.prev=10,e.t0=e.catch(3),(e.t0 instanceof b&&i||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"deleteDocuments")),e.t0;case 14:case"end":return e.stop()}}),n,this,[[3,10]])})))}},{key:"deleteAllDocuments",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/documents"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSettings",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueued=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updatePagination",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/pagination"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSynonyms",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/synonyms"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateStopWords",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/stop-words"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateRankingRules",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/ranking-rules"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDistinctAttribute",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/distinct-attribute"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFilterableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/filterable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSortableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/sortable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSearchableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/searchable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDisplayedAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/displayed-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateTypoTolerance",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/typo-tolerance"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFaceting",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/faceting"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSeparatorTokens",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/separator-tokens"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getNonSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateNonSeparatorTokens",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/non-separator-tokens"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetNonSeparatorTokens",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/non-separator-tokens"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDictionary",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDictionary",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/dictionary"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDictionary",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/dictionary"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}}],[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"indexes",s=new M(n),e.next=4,s.post("indexes",Object.assign(Object.assign({},r),{uid:t}));case 4:return u=e.sent,e.abrupt("return",new L(u));case 6:case"end":return e.stop()}}),i)})))}}]),t}(),_=function(){function t(e){n(this,t),this.config=e,this.httpRequest=new M(e),this.tasks=new I(e)}return s(t,[{key:"index",value:function(t){return new P(this.config,t)}},{key:"getIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new P(this.config,t).fetchInfo());case 1:case"end":return e.stop()}}),r,this)})))}},{key:"getRawIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new P(this.config,t).getRawInfo());case 1:case"end":return e.stop()}}),r,this)})))}},{key:"getIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n,i,s=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRawIndexes(t);case 2:return n=e.sent,i=n.results.map((function(t){return new P(s.config,t.uid,t.primaryKey)})),e.abrupt("return",Object.assign(Object.assign({},n),{results:i}));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"getRawIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"indexes",e.next=3,this.httpRequest.get("indexes",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"createIndex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P.create(t,r,this.config);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),n,this)})))}},{key:"updateIndex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new P(this.config,t).update(r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),n,this)})))}},{key:"deleteIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new P(this.config,t).delete();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"deleteIndexIfExists",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.deleteIndex(t);case 3:return e.abrupt("return",!0);case 6:if(e.prev=6,e.t0=e.catch(0),"index_not_found"!==e.t0.code){e.next=10;break}return e.abrupt("return",!1);case 10:throw e.t0;case 11:case"end":return e.stop()}}),r,this,[[0,6]])})))}},{key:"swapIndexes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"/swap-indexes",e.next=3,this.httpRequest.post("/swap-indexes",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"multiSearch",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"multi-search",e.next=3,this.httpRequest.post("multi-search",t,void 0,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"cancelTasks",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.cancelTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.deleteTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getKeys",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"keys",e.next=3,this.httpRequest.get("keys",t);case 3:return(n=e.sent).results=n.results.map((function(t){return Object.assign(Object.assign({},t),{createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)})})),e.abrupt("return",n);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"getKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"createKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"keys",e.next=3,this.httpRequest.post("keys",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"updateKey",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="keys/".concat(t),e.next=3,this.httpRequest.patch(i,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"deleteKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.delete(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"health",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"health",t.next=3,this.httpRequest.get("health");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"isHealthy",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,"health",t.next=4,this.httpRequest.get("health");case 4:return t.abrupt("return",!0);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})))}},{key:"getStats",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"stats",t.next=3,this.httpRequest.get("stats");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getVersion",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"version",t.next=3,this.httpRequest.get("version");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"createDump",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"dumps",t.next=3,this.httpRequest.post("dumps");case 3:return r=t.sent,t.abrupt("return",new L(r));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"generateTenantToken",value:function(t,e,r){var n=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(n.stack,"."))}}]),t}(),C=function(t){a(r,t);var e=l(r);function r(t){return n(this,r),e.call(this,t)}return s(r)}(_);t.ContentTypeEnum={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},t.Index=P,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=C,t.MeiliSearchApiError=m,t.MeiliSearchCommunicationError=b,t.MeiliSearchError=A,t.MeiliSearchTimeOutError=O,t.default=C,t.httpErrorHandler=R,t.httpResponseErrorHandler=q,t.versionErrorHintMessage=T,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,s=Object.create(i.prototype),u=new R(n||[]);return s._invoke=function(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return O()}for(r.method=i,r.arg=s;;){var u=r.delegate;if(u){var a=b(u,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var o=h(t,e,r);if("normal"===o.type){if(n=r.done?"completed":"suspendedYield",o.arg===d)continue;return{value:o.arg,done:r.done}}"throw"===o.type&&(n="completed",r.method="throw",r.arg=o.arg)}}}(t,r,u),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var d={};function p(){}function f(){}function v(){}var l={};o(l,s,(function(){return this}));var w=Object.getPrototypeOf,y=w&&w(w(A([])));y&&y!==r&&n.call(y,s)&&(l=y);var x=v.prototype=p.prototype=Object.create(l);function k(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){function r(i,s,u,a){var o=h(t[i],t,s);if("throw"!==o.type){var c=o.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(d).then((function(t){c.value=t,u(c)}),(function(t){return r("throw",t,u,a)}))}a(o.arg)}var i;this._invoke=function(t,n){function s(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(s,s):s()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=v,o(x,"constructor",v),o(v,"constructor",f),f.displayName=o(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,o(t,a,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},k(g.prototype),o(g.prototype,u,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var u=new g(c(e,r,n,i),s);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(x),o(x,a,"Generator"),o(x,s,(function(){return this})),o(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(q),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),o=n.call(s,"finallyLoc");if(a&&o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var u=s?s.completion:{};return u.type=t,u.arg=e,s?(this.method="next",this.next=s.finallyLoc,d):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;q(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e,r){return d=h()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i},d.apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return p=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return d(t,arguments,o(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)},p(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}function l(t){var e=h();return function(){var r,n=o(t);if(e){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return v(this,r)}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,s=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);u=!0);}catch(t){a=!0,i=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw i}}return s}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,s=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function g(t,e,r,n){return new(r||(r=Promise))((function(i,s){function u(t){try{o(n.next(t))}catch(t){s(t)}}function a(t){try{o(n.throw(t))}catch(t){s(t)}}function o(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}o((n=n.apply(t,e||[])).next())}))}var b=function(t){a(r,t);var e=l(r);function r(t,i,s,u){var a,o,c,h;return n(this,r),a=e.call(this,t),Object.setPrototypeOf(f(a),r.prototype),a.name="MeiliSearchCommunicationError",i instanceof Response&&(a.message=i.statusText,a.statusCode=i.status),i instanceof Error&&(a.errno=i.errno,a.code=i.code),u?(a.stack=u,a.stack=null===(o=a.stack)||void 0===o?void 0:o.replace(/(TypeError|FetchError)/,a.name),a.stack=null===(c=a.stack)||void 0===c?void 0:c.replace("Failed to fetch","request to ".concat(s," failed, reason: connect ECONNREFUSED")),a.stack=null===(h=a.stack)||void 0===h?void 0:h.replace("Not Found","Not Found: ".concat(s))):Error.captureStackTrace&&Error.captureStackTrace(f(a),r),a}return s(r)}(p(Error)),m=function(t){a(r,t);var e=l(r);function r(t,i){var s;return n(this,r),s=e.call(this,t.message),Object.setPrototypeOf(f(s),r.prototype),s.name="MeiliSearchApiError",s.code=t.code,s.type=t.type,s.link=t.link,s.message=t.message,s.httpStatus=i,Error.captureStackTrace&&Error.captureStackTrace(f(s),r),s}return s(r)}(p(Error));function q(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:n=e.sent,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),new b(t.statusText,t,t.url);case 10:throw new m(n,t.status);case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),r,null,[[1,7]])})))}function R(t,e,r){if("MeiliSearchApiError"!==t.name)throw new b(t.message,t,r,e);throw t}var A=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error)),O=function(t){a(r,t);var e=l(r);function r(t){var i;return n(this,r),i=e.call(this,t),Object.setPrototypeOf(f(i),r.prototype),i.name="MeiliSearchTimeOutError",Error.captureStackTrace&&Error.captureStackTrace(f(i),r),i}return s(r)}(p(Error));function T(t,e){return"".concat(t,"\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that ").concat(e," call requires.")}function j(t){return Object.entries(t).reduce((function(t,e){var r=w(e,2),n=r[0],i=r[1];return void 0!==i&&(t[n]=i),t}),{})}function S(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r)})))}function E(t){return Object.keys(t).reduce((function(e,r){var n=t[r];return void 0===n?e:Array.isArray(n)?Object.assign(Object.assign({},e),u({},r,n.join(","))):n instanceof Date?Object.assign(Object.assign({},e),u({},r,n.toISOString())):Object.assign(Object.assign({},e),u({},r,n))}),{})}function D(t){var e,r,n="X-Meilisearch-Client",i="Meilisearch JavaScript (v".concat("0.34.2",")"),s=function(t){if(Array.isArray(t))return t.reduce((function(t,e){return t[e[0]]=e[1],t}),{});if("has"in t){var e={};return t.forEach((function(t,r){return e[r]=t})),e}return Object.assign({},t)}(null!==(r=null===(e=t.requestConfig)||void 0===e?void 0:e.headers)&&void 0!==r?r:{});if(t.apiKey&&!s.Authorization&&(s.Authorization="Bearer ".concat(t.apiKey)),s["Content-Type"]||(s["Content-Type"]="application/json"),t.clientAgents&&Array.isArray(t.clientAgents)){var u=t.clientAgents.concat(i);s[n]=u.join(" ; ")}else{if(t.clientAgents&&!Array.isArray(t.clientAgents))throw new A('Meilisearch: The header "'.concat(n,'" should be an array of string(s).\n'));s[n]=i}return s}var M=function(){function t(e){n(this,t),this.headers=D(e),this.requestConfig=e.requestConfig,this.httpClient=e.httpClient;try{var r=function(t){try{return(e=t=function(t){return t.startsWith("https://")||t.startsWith("http://")?t:"http://".concat(t)}(t)).endsWith("/")||(e+="/"),t=e}catch(t){throw new A("The provided host is not valid.")}var e}(e.host);this.url=new URL(r)}catch(t){throw new A("The provided host is not valid.")}}return s(t,[{key:"request",value:function(t){var r,n=t.method,i=t.url,s=t.params,u=t.body,a=t.config,o=void 0===a?{}:a;return g(this,void 0,void 0,e().mark((function t(){var a,c,h,d,p,f,v,l;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"==typeof fetch&&require("cross-fetch/polyfill"),a=new URL(i,this.url),s&&(c=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return c.set(t,s[t])})),a.search=c.toString()),(null===(r=o.headers)||void 0===r?void 0:r["Content-Type"])||(u=JSON.stringify(u)),h=Object.assign(Object.assign({},this.headers),o.headers),t.prev=5,d=this.httpClient?this.httpClient:fetch,p=d(a.toString(),Object.assign(Object.assign(Object.assign({},o),this.requestConfig),{method:n,body:u,headers:h})),!this.httpClient){t.next=12;break}return t.next=11,p;case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,p.then((function(t){return q(t)}));case 14:return f=t.sent,t.next=17,f.json().catch((function(){}));case 17:return v=t.sent,t.abrupt("return",v);case 21:t.prev=21,t.t0=t.catch(5),l=t.t0.stack,R(t.t0,l,a.toString());case 25:case"end":return t.stop()}}),t,this,[[5,21]])})))}},{key:"get",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"GET",url:t,params:r,config:n});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),i,this)})))}},{key:"post",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"POST",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"put",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PUT",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"patch",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"PATCH",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}},{key:"delete",value:function(t,r,n,i){return g(this,void 0,void 0,e().mark((function s(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.request({method:"DELETE",url:t,body:r,params:n,config:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),s,this)})))}}]),t}(),L=s((function t(e){n(this,t),this.taskUid=e.taskUid,this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.enqueuedAt=new Date(e.enqueuedAt)})),F=s((function t(e){n(this,t),this.indexUid=e.indexUid,this.status=e.status,this.type=e.type,this.uid=e.uid,this.details=e.details,this.canceledBy=e.canceledBy,this.error=e.error,this.duration=e.duration,this.startedAt=new Date(e.startedAt),this.enqueuedAt=new Date(e.enqueuedAt),this.finishedAt=new Date(e.finishedAt)})),I=function(){function t(e){n(this,t),this.httpRequest=new M(e)}return s(t,[{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="tasks/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return i=e.sent,e.abrupt("return",new F(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.get("tasks",E(t));case 3:return n=e.sent,e.abrupt("return",Object.assign(Object.assign({},n),{results:n.results.map((function(t){return new F(t)}))}));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now();case 1:if(!(Date.now()-n<i)){e.next=11;break}return e.next=4,this.getTask(t);case 4:if(s=e.sent,["enqueued","processing"].includes(s.status)){e.next=7;break}return e.abrupt("return",s);case 7:return e.next=9,S(u);case 9:e.next=1;break;case 11:throw new O("timeout of ".concat(i,"ms has exceeded on process ").concat(t," when waiting a task to be resolved."));case 12:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){var n,s,a,o,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],s=k(t),e.prev=2,s.s();case 4:if((a=s.n()).done){e.next=12;break}return o=a.value,e.next=8,this.waitForTask(o,{timeOutMs:i,intervalMs:u});case 8:c=e.sent,n.push(c);case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),s.e(e.t0);case 17:return e.prev=17,s.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),r,this,[[2,14,17,20]])})))}},{key:"cancelTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks/cancel",e.next=3,this.httpRequest.post("tasks/cancel",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"tasks",e.next=3,this.httpRequest.delete("tasks",{},E(t));case 3:return n=e.sent,e.abrupt("return",new L(n));case 5:case"end":return e.stop()}}),r,this)})))}}]),t}(),P=function(){function t(e,r,i){n(this,t),this.uid=r,this.primaryKey=i,this.httpRequest=new M(e),this.tasks=new I(e)}return s(t,[{key:"search",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/search"),e.next=3,this.httpRequest.post(s,j(Object.assign({q:t},r)),void 0,n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),i,this)})))}},{key:"searchGet",value:function(t,r,n){var i,s,u,a,o,c,h;return g(this,void 0,void 0,e().mark((function d(){var p,f,v;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p="indexes/".concat(this.uid,"/search"),f=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new A("The filter query parameter should be in string format when using searchGet")},v=Object.assign(Object.assign({q:t},r),{filter:f(null==r?void 0:r.filter),sort:null===(i=null==r?void 0:r.sort)||void 0===i?void 0:i.join(","),facets:null===(s=null==r?void 0:r.facets)||void 0===s?void 0:s.join(","),attributesToRetrieve:null===(u=null==r?void 0:r.attributesToRetrieve)||void 0===u?void 0:u.join(","),attributesToCrop:null===(a=null==r?void 0:r.attributesToCrop)||void 0===a?void 0:a.join(","),attributesToHighlight:null===(o=null==r?void 0:r.attributesToHighlight)||void 0===o?void 0:o.join(","),vector:null===(c=null==r?void 0:r.vector)||void 0===c?void 0:c.join(","),attributesToSearchOn:null===(h=null==r?void 0:r.attributesToSearchOn)||void 0===h?void 0:h.join(",")}),e.next=5,this.httpRequest.get(p,j(v),n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),d,this)})))}},{key:"searchForFacetValues",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/facet-search"),e.next=3,this.httpRequest.post(i,j(t),void 0,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"getRawInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.get(r);case 3:return n=t.sent,this.primaryKey=n.primaryKey,this.updatedAt=new Date(n.updatedAt),this.createdAt=new Date(n.createdAt),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"fetchInfo",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return t.abrupt("return",this);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"fetchPrimaryKey",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getRawInfo();case 2:return this.primaryKey=t.sent.primaryKey,t.abrupt("return",this.primaryKey);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"update",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"delete",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(Object.assign(Object.assign({},t),{indexUids:[this.uid]}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getStats",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/stats"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getDocuments",value:function(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function n(){var i,s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===(r=j(r)).filter){e.next=15;break}return e.prev=2,i="indexes/".concat(this.uid,"/documents/fetch"),e.next=6,this.httpRequest.post(i,r);case 6:case 19:return e.abrupt("return",e.sent);case 9:throw e.prev=9,e.t0=e.catch(2),(e.t0 instanceof b||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"getDocuments")),e.t0;case 13:e.next=20;break;case 15:return s="indexes/".concat(this.uid,"/documents"),u=Array.isArray(null==r?void 0:r.fields)?{fields:null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}:{},e.next=19,this.httpRequest.get(s,Object.assign(Object.assign({},r),u));case 20:case"end":return e.stop()}}),n,this,[[2,9]])})))}},{key:"getDocument",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents/").concat(t),s=function(){var t;if(Array.isArray(null==r?void 0:r.fields))return null===(t=null==r?void 0:r.fields)||void 0===t?void 0:t.join(",")}(),e.next=4,this.httpRequest.get(i,j(Object.assign(Object.assign({},r),{fields:s})));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"addDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.post(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"addDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.addDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocuments",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(i,t,r);case 3:return s=e.sent,e.abrupt("return",new L(s));case 5:case"end":return e.stop()}}),n,this)})))}},{key:"updateDocumentsInBatches",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],u=0;case 2:if(!(u<t.length)){e.next=11;break}return e.t0=s,e.next=6,this.updateDocuments(t.slice(u,u+r),n);case 6:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 8:u+=r,e.next=2;break;case 11:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),i,this)})))}},{key:"updateDocumentsFromString",value:function(t,r,n){return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s="indexes/".concat(this.uid,"/documents"),e.next=3,this.httpRequest.put(s,t,n,{headers:{"Content-Type":r}});case 3:return u=e.sent,e.abrupt("return",new L(u));case 5:case"end":return e.stop()}}),i,this)})))}},{key:"deleteDocument",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/documents/").concat(t),e.next=3,this.httpRequest.delete(n);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"deleteDocuments",value:function(t){return g(this,void 0,void 0,e().mark((function n(){var i,s,u,a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=!Array.isArray(t)&&"object"===r(t),s=i?"documents/delete":"documents/delete-batch",u="indexes/".concat(this.uid,"/").concat(s),e.prev=3,e.next=6,this.httpRequest.post(u,t);case 6:return a=e.sent,e.abrupt("return",new L(a));case 10:throw e.prev=10,e.t0=e.catch(3),(e.t0 instanceof b&&i||e.t0 instanceof m)&&(e.t0.message=T(e.t0.message,"deleteDocuments")),e.t0;case 14:case"end":return e.stop()}}),n,this,[[3,10]])})))}},{key:"deleteAllDocuments",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/documents"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSettings",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueued=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetSettings",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updatePagination",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/pagination"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetPagination",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/pagination"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"getSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSynonyms",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/synonyms"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSynonyms",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/synonyms"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateStopWords",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/stop-words"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetStopWords",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/stop-words"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateRankingRules",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/ranking-rules"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetRankingRules",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/ranking-rules"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDistinctAttribute",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/distinct-attribute"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDistinctAttribute",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/distinct-attribute"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFilterableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/filterable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFilterableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/filterable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSortableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/sortable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSortableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/sortable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateSearchableAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/searchable-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetSearchableAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/searchable-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateDisplayedAttributes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/displayed-attributes"),e.next=3,this.httpRequest.put(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetDisplayedAttributes",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/displayed-attributes"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateTypoTolerance",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/typo-tolerance"),e.next=3,this.httpRequest.patch(n,t);case 3:return(i=e.sent).enqueuedAt=new Date(i.enqueuedAt),e.abrupt("return",i);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"resetTypoTolerance",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/typo-tolerance"),t.next=3,this.httpRequest.delete(r);case 3:return(n=t.sent).enqueuedAt=new Date(n.enqueuedAt),t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"getFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.get(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"updateFaceting",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="indexes/".concat(this.uid,"/settings/faceting"),e.next=3,this.httpRequest.patch(n,t);case 3:return i=e.sent,e.abrupt("return",new L(i));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"resetFaceting",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="indexes/".concat(this.uid,"/settings/faceting"),t.next=3,this.httpRequest.delete(r);case 3:return n=t.sent,t.abrupt("return",new L(n));case 5:case"end":return t.stop()}}),t,this)})))}}],[{key:"create",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return g(this,void 0,void 0,e().mark((function i(){var s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"indexes",s=new M(n),e.next=4,s.post("indexes",Object.assign(Object.assign({},r),{uid:t}));case 4:return u=e.sent,e.abrupt("return",new L(u));case 6:case"end":return e.stop()}}),i)})))}}]),t}(),_=function(){function t(e){n(this,t),this.config=e,this.httpRequest=new M(e),this.tasks=new I(e)}return s(t,[{key:"index",value:function(t){return new P(this.config,t)}},{key:"getIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new P(this.config,t).fetchInfo());case 1:case"end":return e.stop()}}),r,this)})))}},{key:"getRawIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new P(this.config,t).getRawInfo());case 1:case"end":return e.stop()}}),r,this)})))}},{key:"getIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n,i,s=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getRawIndexes(t);case 2:return n=e.sent,i=n.results.map((function(t){return new P(s.config,t.uid,t.primaryKey)})),e.abrupt("return",Object.assign(Object.assign({},n),{results:i}));case 5:case"end":return e.stop()}}),r,this)})))}},{key:"getRawIndexes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"indexes",e.next=3,this.httpRequest.get("indexes",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"createIndex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P.create(t,r,this.config);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),n,this)})))}},{key:"updateIndex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new P(this.config,t).update(r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),n,this)})))}},{key:"deleteIndex",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new P(this.config,t).delete();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"deleteIndexIfExists",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.deleteIndex(t);case 3:return e.abrupt("return",!0);case 6:if(e.prev=6,e.t0=e.catch(0),"index_not_found"!==e.t0.code){e.next=10;break}return e.abrupt("return",!1);case 10:throw e.t0;case 11:case"end":return e.stop()}}),r,this,[[0,6]])})))}},{key:"swapIndexes",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"/swap-indexes",e.next=3,this.httpRequest.post("/swap-indexes",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"multiSearch",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"multi-search",e.next=3,this.httpRequest.post("multi-search",t,void 0,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"getTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getTask",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.getTask(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTasks",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTasks(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"waitForTask",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.timeOutMs,i=void 0===n?5e3:n,s=r.intervalMs,u=void 0===s?50:s;return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.waitForTask(t,{timeOutMs:i,intervalMs:u});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"cancelTasks",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.cancelTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"deleteTasks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.tasks.deleteTasks(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),r,this)})))}},{key:"getKeys",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"keys",e.next=3,this.httpRequest.get("keys",t);case 3:return(n=e.sent).results=n.results.map((function(t){return Object.assign(Object.assign({},t),{createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt)})})),e.abrupt("return",n);case 6:case"end":return e.stop()}}),r,this)})))}},{key:"getKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.get(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"createKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"keys",e.next=3,this.httpRequest.post("keys",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"updateKey",value:function(t,r){return g(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="keys/".concat(t),e.next=3,this.httpRequest.patch(i,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),n,this)})))}},{key:"deleteKey",value:function(t){return g(this,void 0,void 0,e().mark((function r(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="keys/".concat(t),e.next=3,this.httpRequest.delete(n);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),r,this)})))}},{key:"health",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"health",t.next=3,this.httpRequest.get("health");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"isHealthy",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,"health",t.next=4,this.httpRequest.get("health");case 4:return t.abrupt("return",!0);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})))}},{key:"getStats",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"stats",t.next=3,this.httpRequest.get("stats");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getVersion",value:function(){return g(this,void 0,void 0,e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"version",t.next=3,this.httpRequest.get("version");case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"createDump",value:function(){return g(this,void 0,void 0,e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"dumps",t.next=3,this.httpRequest.post("dumps");case 3:return r=t.sent,t.abrupt("return",new L(r));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"generateTenantToken",value:function(t,e,r){var n=new Error;throw new Error("Meilisearch: failed to generate a tenant token. Generation of a token only works in a node environment \n ".concat(n.stack,"."))}}]),t}(),C=function(t){a(r,t);var e=l(r);function r(t){return n(this,r),e.call(this,t)}return s(r)}(_);t.ContentTypeEnum={JSON:"application/json",CSV:"text/csv",NDJSON:"application/x-ndjson"},t.Index=P,t.MatchingStrategies={ALL:"all",LAST:"last"},t.MeiliSearch=C,t.MeiliSearchApiError=m,t.MeiliSearchCommunicationError=b,t.MeiliSearchError=A,t.MeiliSearchTimeOutError=O,t.default=C,t.httpErrorHandler=R,t.httpResponseErrorHandler=q,t.versionErrorHintMessage=T,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=meilisearch.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
// Type definitions for meilisearch 0.34.2-tokenizer-customization.0 | ||
// Type definitions for meilisearch 0.34.2 | ||
// Project: https://github.com/meilisearch/meilisearch-js | ||
@@ -3,0 +3,0 @@ // Definitions by: cvermand <charlotte@meilisearch.com> <https://github.com/meilisearch> |
@@ -1,2 +0,2 @@ | ||
import { Config, SearchResponse, SearchParams, IndexObject, IndexOptions, IndexStats, DocumentsQuery, DocumentQuery, DocumentOptions, Settings, Synonyms, StopWords, RankingRules, DistinctAttribute, FilterableAttributes, SortableAttributes, SearchableAttributes, DisplayedAttributes, TypoTolerance, WaitOptions, TasksQuery, TasksResults, PaginationSettings, Faceting, ResourceResults, RawDocumentAdditionOptions, ContentType, DocumentsIds, DocumentsDeletionQuery, SearchForFacetValuesParams, SearchForFacetValuesResponse, SeparatorTokens, NonSeparatorTokens, Dictionary } from './types'; | ||
import { Config, SearchResponse, SearchParams, IndexObject, IndexOptions, IndexStats, DocumentsQuery, DocumentQuery, DocumentOptions, Settings, Synonyms, StopWords, RankingRules, DistinctAttribute, FilterableAttributes, SortableAttributes, SearchableAttributes, DisplayedAttributes, TypoTolerance, WaitOptions, TasksQuery, TasksResults, PaginationSettings, Faceting, ResourceResults, RawDocumentAdditionOptions, ContentType, DocumentsIds, DocumentsDeletionQuery, SearchForFacetValuesParams, SearchForFacetValuesResponse } from './types'; | ||
import { HttpRequests } from './http-requests'; | ||
@@ -451,61 +451,4 @@ import { Task, TaskClient } from './task'; | ||
resetFaceting(): Promise<EnqueuedTask>; | ||
/** | ||
* Get the list of all separator tokens. | ||
* | ||
* @returns Promise containing array of separator tokens | ||
*/ | ||
getSeparatorTokens(): Promise<string[]>; | ||
/** | ||
* Update the list of separator tokens. Overwrite the old list. | ||
* | ||
* @param separatorTokens - Array that contains separator tokens. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
updateSeparatorTokens(separatorTokens: SeparatorTokens): Promise<EnqueuedTask>; | ||
/** | ||
* Reset the separator tokens list to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
resetSeparatorTokens(): Promise<EnqueuedTask>; | ||
/** | ||
* Get the list of all non-separator tokens. | ||
* | ||
* @returns Promise containing array of non-separator tokens | ||
*/ | ||
getNonSeparatorTokens(): Promise<string[]>; | ||
/** | ||
* Update the list of non-separator tokens. Overwrite the old list. | ||
* | ||
* @param nonSeparatorTokens - Array that contains non-separator tokens. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
updateNonSeparatorTokens(nonSeparatorTokens: NonSeparatorTokens): Promise<EnqueuedTask>; | ||
/** | ||
* Reset the non-separator tokens list to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
resetNonSeparatorTokens(): Promise<EnqueuedTask>; | ||
/** | ||
* Get the dictionary settings of a Meilisearch index. | ||
* | ||
* @returns Promise containing the dictionary settings | ||
*/ | ||
getDictionary(): Promise<string[]>; | ||
/** | ||
* Update the the dictionary settings. Overwrite the old settings. | ||
* | ||
* @param dictionary - Array that contains the new dictionary settings. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
updateDictionary(dictionary: Dictionary): Promise<EnqueuedTask>; | ||
/** | ||
* Reset the dictionary settings to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
resetDictionary(): Promise<EnqueuedTask>; | ||
} | ||
export { Index }; | ||
//# sourceMappingURL=indexes.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const PACKAGE_VERSION = "0.34.2-tokenizer-customization.0"; | ||
export declare const PACKAGE_VERSION = "0.34.2"; | ||
//# sourceMappingURL=package-version.d.ts.map |
@@ -106,5 +106,5 @@ import { Task } from '../task'; | ||
_rankingScore?: number; | ||
_rankingScoreDetails?: RakingScoreDetails; | ||
_rankingScoreDetails?: RankingScoreDetails; | ||
}; | ||
export type RakingScoreDetails = { | ||
export type RankingScoreDetails = { | ||
words?: { | ||
@@ -216,5 +216,2 @@ order: number; | ||
} | null; | ||
export type SeparatorTokens = string[] | null; | ||
export type NonSeparatorTokens = string[] | null; | ||
export type Dictionary = string[] | null; | ||
export type FacetOrder = 'alpha' | 'count'; | ||
@@ -240,5 +237,2 @@ export type Faceting = { | ||
pagination?: PaginationSettings; | ||
separatorTokens?: SeparatorTokens; | ||
nonSeparatorTokens?: NonSeparatorTokens; | ||
dictionary?: Dictionary; | ||
}; | ||
@@ -253,12 +247,13 @@ export declare const enum TaskStatus { | ||
export declare const enum TaskTypes { | ||
DOCUMENTS_ADDITION_OR_UPDATE = "documentAdditionOrUpdate", | ||
DOCUMENT_DELETION = "documentDeletion", | ||
DUMP_CREATION = "dumpCreation", | ||
INDEX_CREATION = "indexCreation", | ||
INDEX_DELETION = "indexDeletion", | ||
INDEXES_SWAP = "indexSwap", | ||
INDEX_UPDATE = "indexUpdate", | ||
INDEX_DELETION = "indexDeletion", | ||
DOCUMENTS_ADDITION_OR_UPDATE = "documentAdditionOrUpdate", | ||
DOCUMENT_DELETION = "documentDeletion", | ||
SETTINGS_UPDATE = "settingsUpdate", | ||
INDEXES_SWAP = "indexSwap", | ||
TASK_DELETION = "taskDeletion", | ||
SNAPSHOT_CREATION = "snapshotCreation", | ||
TASK_CANCELATION = "taskCancelation" | ||
TASK_CANCELATION = "taskCancelation", | ||
TASK_DELETION = "taskDeletion" | ||
} | ||
@@ -265,0 +260,0 @@ export type TasksQuery = { |
{ | ||
"name": "meilisearch", | ||
"version": "0.34.2-tokenizer-customization.0", | ||
"version": "0.34.2", | ||
"description": "The Meilisearch JS client for Node.js and the browser.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -20,2 +20,5 @@ <p align="center"> | ||
<a href="https://github.com/meilisearch/meilisearch-js/actions"><img src="https://github.com/meilisearch/meilisearch-js/workflows/Tests/badge.svg" alt="Tests"></a> | ||
<a href="https://codecov.io/gh/meilisearch/meilisearch-python"> | ||
<img src="https://codecov.io/github/meilisearch/meilisearch-js/coverage.svg?branch=main" alt="Codecov"> | ||
</a> | ||
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="Prettier"></a> | ||
@@ -164,3 +167,3 @@ <a href="https://github.com/meilisearch/meilisearch-js/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a> | ||
Tasks such as document addition always return a unique identifier. You can use this identifier `taskUid` to check the status (`enqueued`, `processing`, `succeeded` or `failed`) of a [task](https://www.meilisearch.com/docs/reference/api/tasks). | ||
Tasks such as document addition always return a unique identifier. You can use this identifier `taskUid` to check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of a [task](https://www.meilisearch.com/docs/reference/api/tasks). | ||
@@ -902,63 +905,2 @@ ### Basic search <!-- omit in toc --> | ||
### Separator tokens <!-- omit in toc --> | ||
#### Get separator tokens | ||
```ts | ||
client.index('myIndex').getSeparatorTokens(): Promise<SeparatorTokens> | ||
``` | ||
#### Update separator tokens | ||
```ts | ||
client.index('myIndex').updateSeparatorTokens(separatorTokens: SeparatorTokens | null): Promise<EnqueuedTask> | ||
``` | ||
#### Reset separator tokens | ||
```ts | ||
client.index('myIndex').resetSeparatorTokens(): Promise<EnqueuedTask> | ||
``` | ||
### Non Separator tokens <!-- omit in toc --> | ||
#### Get non separator tokens | ||
```ts | ||
client.index('myIndex').getNonSeparatorTokens(): Promise<NonSeparatorTokens> | ||
``` | ||
#### Update non separator tokens | ||
```ts | ||
client.index('myIndex').updateNonSeparatorTokens(nonSeparatorTokens: NonSeparatorTokens | null): Promise<EnqueuedTask> | ||
``` | ||
#### Reset non separator tokens | ||
```ts | ||
client.index('myIndex').resetNonSeparatorTokens(): Promise<EnqueuedTask> | ||
``` | ||
### Dictionary <!-- omit in toc --> | ||
#### Get dictionary | ||
```ts | ||
client.index('myIndex').getDictionary(): Promise<Dictionary> | ||
``` | ||
#### Update dictionary | ||
```ts | ||
client.index('myIndex').updateDictionary(dictionary: Dictionary | null): Promise<EnqueuedTask> | ||
``` | ||
#### Reset dictionary | ||
```ts | ||
client.index('myIndex').resetDictionary(): Promise<EnqueuedTask> | ||
``` | ||
### Keys <!-- omit in toc --> | ||
@@ -965,0 +907,0 @@ |
@@ -50,5 +50,2 @@ /* | ||
SearchForFacetValuesResponse, | ||
SeparatorTokens, | ||
NonSeparatorTokens, | ||
Dictionary, | ||
} from './types' | ||
@@ -1124,131 +1121,4 @@ import { removeUndefinedFromObject } from './utils' | ||
} | ||
/// | ||
/// SEPARATOR TOKENS | ||
/// | ||
/** | ||
* Get the list of all separator tokens. | ||
* | ||
* @returns Promise containing array of separator tokens | ||
*/ | ||
async getSeparatorTokens(): Promise<string[]> { | ||
const url = `indexes/${this.uid}/settings/separator-tokens` | ||
return await this.httpRequest.get<string[]>(url) | ||
} | ||
/** | ||
* Update the list of separator tokens. Overwrite the old list. | ||
* | ||
* @param separatorTokens - Array that contains separator tokens. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
async updateSeparatorTokens( | ||
separatorTokens: SeparatorTokens | ||
): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/separator-tokens` | ||
const task = await this.httpRequest.put(url, separatorTokens) | ||
return new EnqueuedTask(task) | ||
} | ||
/** | ||
* Reset the separator tokens list to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
async resetSeparatorTokens(): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/separator-tokens` | ||
const task = await this.httpRequest.delete<EnqueuedTask>(url) | ||
task.enqueuedAt = new Date(task.enqueuedAt) | ||
return task | ||
} | ||
/// | ||
/// NON-SEPARATOR TOKENS | ||
/// | ||
/** | ||
* Get the list of all non-separator tokens. | ||
* | ||
* @returns Promise containing array of non-separator tokens | ||
*/ | ||
async getNonSeparatorTokens(): Promise<string[]> { | ||
const url = `indexes/${this.uid}/settings/non-separator-tokens` | ||
return await this.httpRequest.get<string[]>(url) | ||
} | ||
/** | ||
* Update the list of non-separator tokens. Overwrite the old list. | ||
* | ||
* @param nonSeparatorTokens - Array that contains non-separator tokens. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
async updateNonSeparatorTokens( | ||
nonSeparatorTokens: NonSeparatorTokens | ||
): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/non-separator-tokens` | ||
const task = await this.httpRequest.put(url, nonSeparatorTokens) | ||
return new EnqueuedTask(task) | ||
} | ||
/** | ||
* Reset the non-separator tokens list to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
async resetNonSeparatorTokens(): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/non-separator-tokens` | ||
const task = await this.httpRequest.delete<EnqueuedTask>(url) | ||
task.enqueuedAt = new Date(task.enqueuedAt) | ||
return task | ||
} | ||
/// | ||
/// DICTIONARY | ||
/// | ||
/** | ||
* Get the dictionary settings of a Meilisearch index. | ||
* | ||
* @returns Promise containing the dictionary settings | ||
*/ | ||
async getDictionary(): Promise<string[]> { | ||
const url = `indexes/${this.uid}/settings/dictionary` | ||
return await this.httpRequest.get<string[]>(url) | ||
} | ||
/** | ||
* Update the the dictionary settings. Overwrite the old settings. | ||
* | ||
* @param dictionary - Array that contains the new dictionary settings. | ||
* @returns Promise containing an EnqueuedTask or null | ||
*/ | ||
async updateDictionary(dictionary: Dictionary): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/dictionary` | ||
const task = await this.httpRequest.put(url, dictionary) | ||
return new EnqueuedTask(task) | ||
} | ||
/** | ||
* Reset the dictionary settings to its default value | ||
* | ||
* @returns Promise containing an EnqueuedTask | ||
*/ | ||
async resetDictionary(): Promise<EnqueuedTask> { | ||
const url = `indexes/${this.uid}/settings/dictionary` | ||
const task = await this.httpRequest.delete<EnqueuedTask>(url) | ||
task.enqueuedAt = new Date(task.enqueuedAt) | ||
return task | ||
} | ||
} | ||
export { Index } |
@@ -1,1 +0,1 @@ | ||
export const PACKAGE_VERSION = '0.34.2-tokenizer-customization.0' | ||
export const PACKAGE_VERSION = '0.34.2' |
@@ -154,6 +154,6 @@ // Type definitions for meilisearch | ||
_rankingScore?: number | ||
_rankingScoreDetails?: RakingScoreDetails | ||
_rankingScoreDetails?: RankingScoreDetails | ||
} | ||
export type RakingScoreDetails = { | ||
export type RankingScoreDetails = { | ||
words?: { | ||
@@ -316,5 +316,2 @@ order: number | ||
} | null | ||
export type SeparatorTokens = string[] | null | ||
export type NonSeparatorTokens = string[] | null | ||
export type Dictionary = string[] | null | ||
@@ -344,5 +341,2 @@ export type FacetOrder = 'alpha' | 'count' | ||
pagination?: PaginationSettings | ||
separatorTokens?: SeparatorTokens | ||
nonSeparatorTokens?: NonSeparatorTokens | ||
dictionary?: Dictionary | ||
} | ||
@@ -363,12 +357,13 @@ | ||
export const enum TaskTypes { | ||
DOCUMENTS_ADDITION_OR_UPDATE = 'documentAdditionOrUpdate', | ||
DOCUMENT_DELETION = 'documentDeletion', | ||
DUMP_CREATION = 'dumpCreation', | ||
INDEX_CREATION = 'indexCreation', | ||
INDEX_DELETION = 'indexDeletion', | ||
INDEXES_SWAP = 'indexSwap', | ||
INDEX_UPDATE = 'indexUpdate', | ||
INDEX_DELETION = 'indexDeletion', | ||
DOCUMENTS_ADDITION_OR_UPDATE = 'documentAdditionOrUpdate', | ||
DOCUMENT_DELETION = 'documentDeletion', | ||
SETTINGS_UPDATE = 'settingsUpdate', | ||
INDEXES_SWAP = 'indexSwap', | ||
TASK_DELETION = 'taskDeletion', | ||
SNAPSHOT_CREATION = 'snapshotCreation', | ||
TASK_CANCELATION = 'taskCancelation', | ||
TASK_DELETION = 'taskDeletion', | ||
} | ||
@@ -375,0 +370,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
689166
14477
978