Socket
Socket
Sign inDemoInstall

meilisearch

Package Overview
Dependencies
Maintainers
3
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meilisearch - npm Package Compare versions

Comparing version 0.17.0 to 0.17.1

64

CONTRIBUTING.md

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

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

@@ -27,3 +28,3 @@ <!-- /MarkdownTOC -->

4. Review the [Development Workflow](#workflow) section that describes the steps to maintain the repository.
5. Make your changes.
5. Make the changes on your branch.
6. [Submit the branch as a PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `master` branch of the main meilisearch-js repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.<br>

@@ -57,32 +58,2 @@ We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://github.com/meilisearch/meilisearch-js/releases/).

### Release Process
MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/).
#### Automated Changelogs
For each PR merged on `master`, a GitHub Action is running and updates the next release description as a draft release in the [GitHub interface](https://github.com/meilisearch/meilisearch-js/releases). If you don't have the right access to this repository, you will not be able to see the draft release until the release is published.
The draft release description is therefore generated and corresponds to all the PRs titles since the previous release. This means each PR should only do one change and the title should be descriptive of this change.
About this automation:
- As the draft release description is generated on every push on `master`, don't change it manually until the final release publishment.
- If you don't want a PR to appear in the release changelogs: add the label `skip-changelog`. We suggest removing PRs updating the README or the CI (except for big changes).
- If the changes you are doing in the PR are breaking: add the label `breaking-change`. In the release tag, the minor will be increased instead of the patch. The major will never be changed until [MeiliSearch](https://github.com/meilisearch/MeiliSearch) is stable.
- If you did any mistake, for example the PR is already closed but you forgot to add a label or you misnamed your PR, don't panic: change what you want in the closed PR and run the job again.
*More information about the [Release Drafter](https://github.com/release-drafter/release-drafter), used to automate these steps.*
#### How to Publish the Release
Make a PR modifying the file [`package.json`](/package.json) with the right version.
```javascript
"version": "X.X.X",
```
Once the changes are merged on `master`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-js/releases).
A GitHub Action will be triggered and push the package to [npm](https://www.npmjs.com/package/meilisearch).
## Git Guidelines

@@ -108,8 +79,37 @@

Some notes on GitHub PRs:
- [Convert your PR as a draft](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request) if your changes are a work in progress: no one will review it until you pass your PR as ready for review.<br>
The draft PR can be very useful if you want to show that you are working on something and make your work visible.
- The branch related to the PR must be **up-to-date with `master`** before merging. [Bors](https://github.com/bors-ng/bors-ng) will rebase your branch if it is not. Ask a maintainer to run it.
- The branch related to the PR must be **up-to-date with `master`** before merging. Fortunately, this project [integrates a bot](https://github.com/meilisearch/integration-guides/blob/master/guides/bors.md) to automatically enforce this requirement without the PR author having to do it manually..
- All PRs must be reviewed and approved by at least one maintainer.
- The PR title should be accurate and descriptive of the changes. The title of the PR will be indeed automatically added to the next [release changelogs](https://github.com/meilisearch/meilisearch-js/releases/).
## Release Process (for Admin only)
MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/).
### Automation to Rebase and Merge the PRs
This project integrates a bot that helps us manage pull requests merging.<br>
_[Read more about this](https://github.com/meilisearch/integration-guides/blob/master/guides/bors.md)._
### Automated Changelogs
This project integrates a tool to create automated changelogs.<br>
_[Read more about this](https://github.com/meilisearch/integration-guides/blob/master/guides/release-drafter.md)._
### How to Publish the Release
Make a PR modifying the file [`package.json`](/package.json) with the right version.
```javascript
"version": "X.X.X",
```
Once the changes are merged on `master`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-js/releases).
GitHub Actions will be triggered and push the package to [npm](https://www.npmjs.com/package/meilisearch).
<hr>
Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide ❤️

@@ -174,3 +174,3 @@ import 'cross-fetch/polyfill';

return __awaiter(this, void 0, void 0, function () {
var err, e_1;
var err;
return __generator(this, function (_a) {

@@ -189,3 +189,3 @@ switch (_a.label) {

case 3:
e_1 = _a.sent();
_a.sent();
throw new MeiliSearchCommunicationError(response.statusText, response);

@@ -208,4 +208,10 @@ case 4: throw new MeiliSearchApiError(err, response.status);

this.headers = __assign(__assign(__assign({}, (config.headers || {})), { 'Content-Type': 'application/json' }), (config.apiKey ? { 'X-Meili-API-Key': config.apiKey } : {}));
this.url = config.host;
this.url = new URL(config.host);
}
HttpRequests.addTrailingSlash = function (url) {
if (!url.endsWith('/')) {
url += '/';
}
return url;
};
HttpRequests.prototype.request = function (_a) {

@@ -219,4 +225,3 @@ var method = _a.method, url = _a.url, params = _a.params, body = _a.body, config = _a.config;

_b.trys.push([0, 3, , 4]);
constructURL = new URL(this.url);
constructURL.pathname = constructURL.pathname + url;
constructURL = new URL(url, this.url);
if (params) {

@@ -331,2 +336,11 @@ queryParams_1 = new URLSearchParams();

///
/// STATIC
///
Index.getApiRoutes = function () {
return Index.apiRoutes;
};
Index.getRouteConstructors = function () {
return Index.routeConstructors;
};
///
/// UPDATES

@@ -345,3 +359,3 @@ ///

case 0:
url = "/indexes/" + this.uid + "/updates/" + updateId;
url = Index.routeConstructors.getUpdateStatus(this.uid, updateId);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -389,3 +403,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/updates";
url = Index.routeConstructors.getAllUpdateStatus(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -412,3 +426,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/search";
url = Index.routeConstructors.search(this.uid);
params = {

@@ -460,3 +474,3 @@ q: query,

case 0:
url = "/indexes/" + this.uid;
url = Index.routeConstructors.indexRoute(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -520,3 +534,3 @@ case 1:

case 0:
url = '/indexes';
url = Index.apiRoutes.indexes;
req = new HttpRequests(config);

@@ -542,3 +556,3 @@ return [4 /*yield*/, req.post(url, __assign(__assign({}, options), { uid: uid }))];

case 0:
url = "/indexes/" + this.uid;
url = Index.routeConstructors.update(this.uid);
return [4 /*yield*/, this.httpRequest.put(url, data)];

@@ -564,3 +578,3 @@ case 1:

case 0:
url = "/indexes/" + this.uid;
url = Index.routeConstructors["delete"](this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -607,3 +621,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents";
url = Index.routeConstructors.getDocuments(this.uid);
if (options !== undefined && Array.isArray(options.attributesToRetrieve)) {

@@ -629,3 +643,3 @@ attr = options.attributesToRetrieve.join(',');

case 0:
url = "/indexes/" + this.uid + "/documents/" + documentId;
url = Index.routeConstructors.getDocument(this.uid, documentId);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -648,3 +662,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents";
url = Index.routeConstructors.addDocuments(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, documents, options)];

@@ -667,3 +681,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents";
url = Index.routeConstructors.updateDocuments(this.uid);
return [4 /*yield*/, this.httpRequest.put(url, documents, options)];

@@ -686,3 +700,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents/" + documentId;
url = Index.routeConstructors.deleteDocument(this.uid, documentId);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -705,3 +719,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents/delete-batch";
url = Index.routeConstructors.deleteDocuments(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, documentsIds)];

@@ -724,3 +738,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/documents";
url = Index.routeConstructors.deleteAllDocuments(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -746,3 +760,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings";
url = Index.routeConstructors.getSettings(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -766,3 +780,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings";
url = Index.routeConstructors.updateSettings(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, settings)];

@@ -785,3 +799,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings";
url = Index.routeConstructors.resetSettings(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -807,3 +821,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/synonyms";
url = Index.routeConstructors.getSynonyms(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -826,3 +840,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/synonyms";
url = Index.routeConstructors.updateSynonyms(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, synonyms)];

@@ -845,3 +859,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/synonyms";
url = Index.routeConstructors.resetSynonyms(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -867,3 +881,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/stop-words";
url = Index.routeConstructors.getStopWords(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -886,3 +900,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/stop-words";
url = Index.routeConstructors.updateStopWords(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, stopWords)];

@@ -905,3 +919,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/stop-words";
url = Index.routeConstructors.resetStopWords(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -927,3 +941,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/ranking-rules";
url = Index.routeConstructors.getRankingRules(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -946,3 +960,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/ranking-rules";
url = Index.routeConstructors.updateRankingRules(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, rankingRules)];

@@ -965,3 +979,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/ranking-rules";
url = Index.routeConstructors.resetRankingRules(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -987,3 +1001,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/distinct-attribute";
url = Index.routeConstructors.getDistinctAttribute(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1006,3 +1020,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/distinct-attribute";
url = Index.routeConstructors.updateDistinctAttribute(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, distinctAttribute)];

@@ -1025,3 +1039,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/distinct-attribute";
url = Index.routeConstructors.resetDistinctAttribute(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -1047,3 +1061,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/attributes-for-faceting";
url = Index.routeConstructors.getAttributesForFaceting(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1066,3 +1080,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/attributes-for-faceting";
url = Index.routeConstructors.updateAttributesForFaceting(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, attributesForFaceting)];

@@ -1085,3 +1099,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/attributes-for-faceting";
url = Index.routeConstructors.resetAttributesForFaceting(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -1107,3 +1121,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/searchable-attributes";
url = Index.routeConstructors.getSearchableAttributes(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1126,3 +1140,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/searchable-attributes";
url = Index.routeConstructors.updateSearchableAttributes(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, searchableAttributes)];

@@ -1145,3 +1159,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/searchable-attributes";
url = Index.routeConstructors.resetSearchableAttributes(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -1167,3 +1181,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/displayed-attributes";
url = Index.routeConstructors.getDisplayedAttributes(this.uid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1186,3 +1200,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/displayed-attributes";
url = Index.routeConstructors.updateDisplayedAttributes(this.uid);
return [4 /*yield*/, this.httpRequest.post(url, displayedAttributes)];

@@ -1205,3 +1219,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/indexes/" + this.uid + "/settings/displayed-attributes";
url = Index.routeConstructors.resetDisplayedAttributes(this.uid);
return [4 /*yield*/, this.httpRequest["delete"](url)];

@@ -1213,2 +1227,144 @@ case 1: return [2 /*return*/, _a.sent()];

};
Index.apiRoutes = {
indexes: 'indexes',
};
Index.routeConstructors = {
indexRoute: function (indexUid) {
return Index.apiRoutes.indexes + "/" + indexUid;
},
getUpdateStatus: function (indexUid, updateId) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
("updates/" + updateId));
},
getAllUpdateStatus: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid) + '/' + "updates";
},
search: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid) + '/' + "search";
},
getRawInfo: function (indexUid) {
return "indexes/" + indexUid;
},
update: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid);
},
"delete": function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid);
},
getStats: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid) + '/' + "stats";
},
getDocument: function (indexUid, documentId) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
("documents/" + documentId));
},
getDocuments: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid) + '/' + "documents";
},
addDocuments: function (indexUid) {
return Index.routeConstructors.getDocuments(indexUid);
},
updateDocuments: function (indexUid) {
return Index.routeConstructors.getDocuments(indexUid);
},
deleteAllDocuments: function (indexUid) {
return Index.routeConstructors.getDocuments(indexUid);
},
deleteDocument: function (indexUid, documentId) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
("documents/" + documentId));
},
deleteDocuments: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"documents/delete-batch");
},
getSettings: function (indexUid) {
return Index.routeConstructors.indexRoute(indexUid) + '/' + "settings";
},
updateSettings: function (indexUid) {
return Index.routeConstructors.getSettings(indexUid);
},
resetSettings: function (indexUid) {
return Index.routeConstructors.getSettings(indexUid);
},
getSynonyms: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) + '/' + "settings/synonyms");
},
updateSynonyms: function (indexUid) {
return Index.routeConstructors.getSynonyms(indexUid);
},
resetSynonyms: function (indexUid) {
return Index.routeConstructors.getSynonyms(indexUid);
},
getStopWords: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/stop-words");
},
updateStopWords: function (indexUid) {
return Index.routeConstructors.getStopWords(indexUid);
},
resetStopWords: function (indexUid) {
return Index.routeConstructors.getStopWords(indexUid);
},
getRankingRules: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/ranking-rules");
},
updateRankingRules: function (indexUid) {
return Index.routeConstructors.getRankingRules(indexUid);
},
resetRankingRules: function (indexUid) {
return Index.routeConstructors.getRankingRules(indexUid);
},
getDistinctAttribute: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/distinct-attribute");
},
updateDistinctAttribute: function (indexUid) {
return Index.routeConstructors.getDistinctAttribute(indexUid);
},
resetDistinctAttribute: function (indexUid) {
return Index.routeConstructors.getDistinctAttribute(indexUid);
},
getAttributesForFaceting: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/attributes-for-faceting");
},
updateAttributesForFaceting: function (indexUid) {
return Index.routeConstructors.getAttributesForFaceting(indexUid);
},
resetAttributesForFaceting: function (indexUid) {
return Index.routeConstructors.getAttributesForFaceting(indexUid);
},
getSearchableAttributes: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/searchable-attributes");
},
updateSearchableAttributes: function (indexUid) {
return Index.routeConstructors.getSearchableAttributes(indexUid);
},
resetSearchableAttributes: function (indexUid) {
return Index.routeConstructors.getSearchableAttributes(indexUid);
},
getDisplayedAttributes: function (indexUid) {
return (Index.routeConstructors.indexRoute(indexUid) +
'/' +
"settings/displayed-attributes");
},
updateDisplayedAttributes: function (indexUid) {
return Index.routeConstructors.getDisplayedAttributes(indexUid);
},
resetDisplayedAttributes: function (indexUid) {
return Index.routeConstructors.getDisplayedAttributes(indexUid);
},
};
return Index;

@@ -1225,5 +1381,12 @@ }());

function MeiliSearch(config) {
config.host = HttpRequests.addTrailingSlash(config.host);
this.config = config;
this.httpRequest = new HttpRequests(config);
}
MeiliSearch.getApiRoutes = function () {
return MeiliSearch.apiRoutes;
};
MeiliSearch.getRouteConstructors = function () {
return MeiliSearch.routeConstructors;
};
/**

@@ -1289,3 +1452,3 @@ * Return an Index instance

case 0:
url = '/indexes';
url = MeiliSearch.apiRoutes.listIndexes;
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1352,3 +1515,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = '/keys';
url = MeiliSearch.apiRoutes.getKeys;
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1371,8 +1534,7 @@ case 1: return [2 /*return*/, _a.sent()];

return __awaiter(this, void 0, void 0, function () {
var url;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
url = '/health';
return [4 /*yield*/, this.httpRequest.get(url).then(function () { return true; })];
case 0: return [4 /*yield*/, this.httpRequest
.get(MeiliSearch.apiRoutes.isHealthy)
.then(function () { return true; })];
case 1: return [2 /*return*/, _a.sent()];

@@ -1397,3 +1559,3 @@ }

case 0:
url = '/stats';
url = MeiliSearch.apiRoutes.stats;
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1416,3 +1578,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = '/version';
url = MeiliSearch.apiRoutes.version;
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1438,3 +1600,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = '/dumps';
url = MeiliSearch.apiRoutes.createDump;
return [4 /*yield*/, this.httpRequest.post(url)];

@@ -1457,3 +1619,3 @@ case 1: return [2 /*return*/, _a.sent()];

case 0:
url = "/dumps/" + dumpUid + "/status";
url = MeiliSearch.routeConstructors.getDumpStatus(dumpUid);
return [4 /*yield*/, this.httpRequest.get(url)];

@@ -1465,2 +1627,15 @@ case 1: return [2 /*return*/, _a.sent()];

};
MeiliSearch.apiRoutes = {
listIndexes: 'indexes',
getkeys: 'keys',
isHealthy: 'health',
stats: 'stats',
version: 'version',
createDump: 'dumps',
};
MeiliSearch.routeConstructors = {
getDumpStatus: function (dumpUid) {
return "dumps/" + dumpUid + "/status";
},
};
return MeiliSearch;

@@ -1467,0 +1642,0 @@ }());

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

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

@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("cross-fetch/polyfill")):"function"==typeof define&&define.amd?define(["cross-fetch/polyfill"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).MeiliSearch=e()}(this,(function(){"use strict";

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

@@ -5,4 +5,5 @@ import 'cross-fetch/polyfill';

headers: {};
url: string;
url: URL;
constructor(config: Types.Config);
static addTrailingSlash(url: string): string;
request({ method, url, params, body, config, }: {

@@ -9,0 +10,0 @@ method: string;

import * as Types from './types';
import HttpRequests from './http-requests';
declare type objectId = string | number | undefined;
declare type createIndexPath = (indexUid: string, objectId?: objectId) => string;
declare class Index<T> implements Types.IndexInterface<T> {

@@ -7,3 +9,15 @@ uid: string;

httpRequest: HttpRequests;
static apiRoutes: {
[key: string]: string;
};
static routeConstructors: {
[key: string]: createIndexPath;
};
constructor(config: Types.Config, uid: string, primaryKey?: string);
static getApiRoutes(): {
[key: string]: string;
};
static getRouteConstructors(): {
[key: string]: createIndexPath;
};
/**

@@ -10,0 +24,0 @@ * Get the informations about an update status

import { Index } from './index';
import * as Types from './types';
import HttpRequests from './http-requests';
declare type createPath = (x: string | number) => string;
declare class MeiliSearch implements Types.MeiliSearchInterface {
config: Types.Config;
httpRequest: HttpRequests;
static apiRoutes: {
[key: string]: string;
};
static routeConstructors: {
[key: string]: createPath;
};
constructor(config: Types.Config);
static getApiRoutes(): {
[key: string]: string;
};
static getRouteConstructors(): {
[key: string]: createPath;
};
/**

@@ -9,0 +22,0 @@ * Return an Index instance

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

// Type definitions for meilisearch 0.17.0
// Type definitions for meilisearch 0.17.1
// Project: https://github.com/meilisearch/meilisearch-js

@@ -80,2 +80,6 @@ // Definitions by: cvermand <charlotte@meilisearch.com> <https://github.com/meilisearch>

};
export declare type CategoriesDistribution = {
[category: string]: number;
};
export declare type Facet = string;
export interface SearchResponse<T, P extends SearchParams<T>> {

@@ -86,3 +90,3 @@ hits: P['attributesToRetrieve'] extends Array<infer K> ? Array<Hit<Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>>> : Array<Hit<T>>;

processingTimeMs: number;
facetsDistribution?: object;
facetsDistribution?: Record<Facet, CategoriesDistribution>;
exhaustiveFacetsCount?: boolean;

@@ -89,0 +93,0 @@ query: string;

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

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

"@rollup/plugin-node-resolve": "11.0.0",
"@types/jest": "26.0.14",
"@types/jest": "^26.0.14",
"@types/prettier": "^2.0.0",

@@ -81,3 +81,3 @@ "@typescript-eslint/eslint-plugin": "2.34.0",

"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-jsdoc": "^30.0.0",
"eslint-plugin-jsdoc": "^31.0.6",
"eslint-plugin-node": "11",

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

"gzip-size": "^6.0.0",
"jest": "^25.2.4",
"jest": "^26.6.3",
"jest-watch-typeahead": "^0.5.0",

@@ -99,5 +99,5 @@ "kleur": "^4.0.0",

"shx": "^0.3.2",
"ts-jest": "^25.3.0",
"ts-jest": "^26.4.4",
"typescript": "3.9.7"
}
}

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

<a href="https://docs.meilisearch.com">Documentation</a> |
<a href="https://slack.meilisearch.com">Slack</a> |
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
<a href="https://www.meilisearch.com">Website</a> |
<a href="https://blog.meilisearch.com">Blog</a> |
<a href="https://twitter.com/meilisearch">Twitter</a> |
<a href="https://docs.meilisearch.com/faq">FAQ</a>

@@ -23,3 +22,2 @@ </h4>

<a href="https://github.com/meilisearch/meilisearch-js/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
<a href="https://slack.meilisearch.com"><img src="https://img.shields.io/badge/slack-MeiliSearch-blue.svg?logo=slack" alt="Slack"></a>
<a href="https://app.bors.tech/repositories/28762"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>

@@ -30,4 +28,6 @@ </p>

**MeiliSearch JavaScript** is the MeiliSearch API client for JavaScript developers. **MeiliSearch** is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box.
**MeiliSearch JavaScript** is the MeiliSearch API client for JavaScript developers.
**MeiliSearch** is an open-source search engine. [Discover what MeiliSearch is!](https://github.com/meilisearch/MeiliSearch)
## Table of Contents <!-- omit in toc -->

@@ -277,3 +277,3 @@

This package only guarantees the compatibility with the [version v0.17.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.17.0).
This package only guarantees the compatibility with the [version v0.18.1 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.18.1).

@@ -280,0 +280,0 @@ ## 💡 Learn More

@@ -10,3 +10,3 @@ import 'cross-fetch/polyfill'

headers: {}
url: string
url: URL

@@ -19,5 +19,12 @@ constructor(config: Types.Config) {

}
this.url = config.host
this.url = new URL(config.host)
}
static addTrailingSlash(url: string): string {
if (!url.endsWith('/')) {
url += '/'
}
return url
}
async request({

@@ -37,5 +44,3 @@ method,

try {
const constructURL = new URL(this.url)
constructURL.pathname = constructURL.pathname + url
const constructURL = new URL(url, this.url)
if (params) {

@@ -48,3 +53,2 @@ const queryParams = new URLSearchParams()

}
const response: Response = await fetch(constructURL.toString(), {

@@ -51,0 +55,0 @@ ...config,

@@ -16,2 +16,5 @@ /*

type objectId = string | number | undefined
type createIndexPath = (indexUid: string, objectId?: objectId) => string
class Index<T> implements Types.IndexInterface<T> {

@@ -21,2 +24,170 @@ uid: string

httpRequest: HttpRequests
static apiRoutes: {
[key: string]: string
} = {
indexes: 'indexes',
}
static routeConstructors: {
[key: string]: createIndexPath
} = {
indexRoute: (indexUid: string) => {
return `${Index.apiRoutes.indexes}/${indexUid}`
},
getUpdateStatus: (indexUid: string, updateId: objectId) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`updates/${updateId}`
)
},
getAllUpdateStatus: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid) + '/' + `updates`
},
search: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid) + '/' + `search`
},
getRawInfo: (indexUid: string) => {
return `indexes/${indexUid}`
},
update: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid)
},
delete: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid)
},
getStats: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid) + '/' + `stats`
},
getDocument: (indexUid: string, documentId: objectId) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`documents/${documentId}`
)
},
getDocuments: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid) + '/' + `documents`
},
addDocuments: (indexUid: string) => {
return Index.routeConstructors.getDocuments(indexUid)
},
updateDocuments: (indexUid: string) => {
return Index.routeConstructors.getDocuments(indexUid)
},
deleteAllDocuments: (indexUid: string) => {
return Index.routeConstructors.getDocuments(indexUid)
},
deleteDocument: (indexUid: string, documentId: objectId) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`documents/${documentId}`
)
},
deleteDocuments: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`documents/delete-batch`
)
},
getSettings: (indexUid: string) => {
return Index.routeConstructors.indexRoute(indexUid) + '/' + `settings`
},
updateSettings: (indexUid: string) => {
return Index.routeConstructors.getSettings(indexUid)
},
resetSettings: (indexUid: string) => {
return Index.routeConstructors.getSettings(indexUid)
},
getSynonyms: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) + '/' + `settings/synonyms`
)
},
updateSynonyms: (indexUid: string) => {
return Index.routeConstructors.getSynonyms(indexUid)
},
resetSynonyms: (indexUid: string) => {
return Index.routeConstructors.getSynonyms(indexUid)
},
getStopWords: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/stop-words`
)
},
updateStopWords: (indexUid: string) => {
return Index.routeConstructors.getStopWords(indexUid)
},
resetStopWords: (indexUid: string) => {
return Index.routeConstructors.getStopWords(indexUid)
},
getRankingRules: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/ranking-rules`
)
},
updateRankingRules: (indexUid: string) => {
return Index.routeConstructors.getRankingRules(indexUid)
},
resetRankingRules: (indexUid: string) => {
return Index.routeConstructors.getRankingRules(indexUid)
},
getDistinctAttribute: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/distinct-attribute`
)
},
updateDistinctAttribute: (indexUid: string) => {
return Index.routeConstructors.getDistinctAttribute(indexUid)
},
resetDistinctAttribute: (indexUid: string) => {
return Index.routeConstructors.getDistinctAttribute(indexUid)
},
getAttributesForFaceting: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/attributes-for-faceting`
)
},
updateAttributesForFaceting: (indexUid: string) => {
return Index.routeConstructors.getAttributesForFaceting(indexUid)
},
resetAttributesForFaceting: (indexUid: string) => {
return Index.routeConstructors.getAttributesForFaceting(indexUid)
},
getSearchableAttributes: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/searchable-attributes`
)
},
updateSearchableAttributes: (indexUid: string) => {
return Index.routeConstructors.getSearchableAttributes(indexUid)
},
resetSearchableAttributes: (indexUid: string) => {
return Index.routeConstructors.getSearchableAttributes(indexUid)
},
getDisplayedAttributes: (indexUid: string) => {
return (
Index.routeConstructors.indexRoute(indexUid) +
'/' +
`settings/displayed-attributes`
)
},
updateDisplayedAttributes: (indexUid: string) => {
return Index.routeConstructors.getDisplayedAttributes(indexUid)
},
resetDisplayedAttributes: (indexUid: string) => {
return Index.routeConstructors.getDisplayedAttributes(indexUid)
},
}

@@ -28,3 +199,13 @@ constructor(config: Types.Config, uid: string, primaryKey?: string) {

}
///
/// STATIC
///
static getApiRoutes(): { [key: string]: string } {
return Index.apiRoutes
}
static getRouteConstructors(): { [key: string]: createIndexPath } {
return Index.routeConstructors
}
///

@@ -40,4 +221,3 @@ /// UPDATES

async getUpdateStatus(updateId: number): Promise<Types.Update> {
const url = `/indexes/${this.uid}/updates/${updateId}`
const url = Index.routeConstructors.getUpdateStatus(this.uid, updateId)
return await this.httpRequest.get<Types.Update>(url)

@@ -70,4 +250,3 @@ }

async getAllUpdateStatus(): Promise<Types.Update[]> {
const url = `/indexes/${this.uid}/updates`
const url = Index.routeConstructors.getAllUpdateStatus(this.uid)
return await this.httpRequest.get<Types.Update[]>(url)

@@ -91,3 +270,3 @@ }

): Promise<Types.SearchResponse<T, P>> {
const url = `/indexes/${this.uid}/search`
const url = Index.routeConstructors.search(this.uid)
const params: Types.SearchRequest = {

@@ -155,4 +334,3 @@ q: query,

async getRawInfo(): Promise<Types.IndexResponse> {
const url = `/indexes/${this.uid}`
const url = Index.routeConstructors.indexRoute(this.uid)
const res = await this.httpRequest.get<Types.IndexResponse>(url)

@@ -193,4 +371,3 @@ this.primaryKey = res.primaryKey

): Promise<Index<T>> {
const url = '/indexes'
const url = Index.apiRoutes.indexes
const req = new HttpRequests(config)

@@ -207,4 +384,3 @@ const index = await req.post(url, { ...options, uid })

async update(data: Types.IndexOptions): Promise<this> {
const url = `/indexes/${this.uid}`
const url = Index.routeConstructors.update(this.uid)
const index = await this.httpRequest.put(url, data)

@@ -221,4 +397,3 @@ this.primaryKey = index.primaryKey

async delete(): Promise<void> {
const url = `/indexes/${this.uid}`
const url = Index.routeConstructors.delete(this.uid)
return await this.httpRequest.delete(url)

@@ -238,3 +413,2 @@ }

const url = `/indexes/${this.uid}/stats`
return await this.httpRequest.get<Types.IndexStats>(url)

@@ -254,3 +428,3 @@ }

): Promise<Types.GetDocumentsResponse<T, P>> {
const url = `/indexes/${this.uid}/documents`
const url = Index.routeConstructors.getDocuments(this.uid)
let attr

@@ -273,4 +447,3 @@ if (options !== undefined && Array.isArray(options.attributesToRetrieve)) {

async getDocument(documentId: string | number): Promise<Types.Document<T>> {
const url = `/indexes/${this.uid}/documents/${documentId}`
const url = Index.routeConstructors.getDocument(this.uid, documentId)
return await this.httpRequest.get<Types.Document<T>>(url)

@@ -288,4 +461,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/documents`
const url = Index.routeConstructors.addDocuments(this.uid)
return await this.httpRequest.post(url, documents, options)

@@ -303,4 +475,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/documents`
const url = Index.routeConstructors.updateDocuments(this.uid)
return await this.httpRequest.put(url, documents, options)

@@ -317,4 +488,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/documents/${documentId}`
const url = Index.routeConstructors.deleteDocument(this.uid, documentId)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -331,3 +501,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/documents/delete-batch`
const url = Index.routeConstructors.deleteDocuments(this.uid)

@@ -343,4 +513,3 @@ return await this.httpRequest.post(url, documentsIds)

async deleteAllDocuments(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/documents`
const url = Index.routeConstructors.deleteAllDocuments(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -359,4 +528,3 @@ }

async getSettings(): Promise<Types.Settings> {
const url = `/indexes/${this.uid}/settings`
const url = Index.routeConstructors.getSettings(this.uid)
return await this.httpRequest.get<Types.Settings>(url)

@@ -374,4 +542,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings`
const url = Index.routeConstructors.updateSettings(this.uid)
return await this.httpRequest.post(url, settings)

@@ -386,4 +553,3 @@ }

async resetSettings(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings`
const url = Index.routeConstructors.resetSettings(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -402,4 +568,3 @@ }

async getSynonyms(): Promise<object> {
const url = `/indexes/${this.uid}/settings/synonyms`
const url = Index.routeConstructors.getSynonyms(this.uid)
return await this.httpRequest.get<object>(url)

@@ -414,4 +579,3 @@ }

async updateSynonyms(synonyms: object): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/synonyms`
const url = Index.routeConstructors.updateSynonyms(this.uid)
return await this.httpRequest.post(url, synonyms)

@@ -426,4 +590,3 @@ }

async resetSynonyms(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/synonyms`
const url = Index.routeConstructors.resetSynonyms(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -442,4 +605,3 @@ }

async getStopWords(): Promise<string[]> {
const url = `/indexes/${this.uid}/settings/stop-words`
const url = Index.routeConstructors.getStopWords(this.uid)
return await this.httpRequest.get<string[]>(url)

@@ -454,4 +616,3 @@ }

async updateStopWords(stopWords: string[]): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/stop-words`
const url = Index.routeConstructors.updateStopWords(this.uid)
return await this.httpRequest.post(url, stopWords)

@@ -466,4 +627,3 @@ }

async resetStopWords(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/stop-words`
const url = Index.routeConstructors.resetStopWords(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -482,4 +642,3 @@ }

async getRankingRules(): Promise<string[]> {
const url = `/indexes/${this.uid}/settings/ranking-rules`
const url = Index.routeConstructors.getRankingRules(this.uid)
return await this.httpRequest.get<string[]>(url)

@@ -496,4 +655,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/ranking-rules`
const url = Index.routeConstructors.updateRankingRules(this.uid)
return await this.httpRequest.post(url, rankingRules)

@@ -508,4 +666,3 @@ }

async resetRankingRules(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/ranking-rules`
const url = Index.routeConstructors.resetRankingRules(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -524,4 +681,3 @@ }

async getDistinctAttribute(): Promise<string | null> {
const url = `/indexes/${this.uid}/settings/distinct-attribute`
const url = Index.routeConstructors.getDistinctAttribute(this.uid)
return await this.httpRequest.get<string | null>(url)

@@ -538,4 +694,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/distinct-attribute`
const url = Index.routeConstructors.updateDistinctAttribute(this.uid)
return await this.httpRequest.post(url, distinctAttribute)

@@ -550,4 +705,3 @@ }

async resetDistinctAttribute(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/distinct-attribute`
const url = Index.routeConstructors.resetDistinctAttribute(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -566,4 +720,3 @@ }

async getAttributesForFaceting(): Promise<string[]> {
const url = `/indexes/${this.uid}/settings/attributes-for-faceting`
const url = Index.routeConstructors.getAttributesForFaceting(this.uid)
return await this.httpRequest.get<string[]>(url)

@@ -580,4 +733,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/attributes-for-faceting`
const url = Index.routeConstructors.updateAttributesForFaceting(this.uid)
return await this.httpRequest.post(url, attributesForFaceting)

@@ -592,4 +744,3 @@ }

async resetAttributesForFaceting(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/attributes-for-faceting`
const url = Index.routeConstructors.resetAttributesForFaceting(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -608,4 +759,3 @@ }

async getSearchableAttributes(): Promise<string[]> {
const url = `/indexes/${this.uid}/settings/searchable-attributes`
const url = Index.routeConstructors.getSearchableAttributes(this.uid)
return await this.httpRequest.get<string[]>(url)

@@ -622,4 +772,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/searchable-attributes`
const url = Index.routeConstructors.updateSearchableAttributes(this.uid)
return await this.httpRequest.post(url, searchableAttributes)

@@ -634,4 +783,3 @@ }

async resetSearchableAttributes(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/searchable-attributes`
const url = Index.routeConstructors.resetSearchableAttributes(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -650,4 +798,3 @@ }

async getDisplayedAttributes(): Promise<string[]> {
const url = `/indexes/${this.uid}/settings/displayed-attributes`
const url = Index.routeConstructors.getDisplayedAttributes(this.uid)
return await this.httpRequest.get<string[]>(url)

@@ -664,4 +811,3 @@ }

): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/displayed-attributes`
const url = Index.routeConstructors.updateDisplayedAttributes(this.uid)
return await this.httpRequest.post(url, displayedAttributes)

@@ -676,4 +822,3 @@ }

async resetDisplayedAttributes(): Promise<Types.EnqueuedUpdate> {
const url = `/indexes/${this.uid}/settings/displayed-attributes`
const url = Index.routeConstructors.resetDisplayedAttributes(this.uid)
return await this.httpRequest.delete<Types.EnqueuedUpdate>(url)

@@ -680,0 +825,0 @@ }

@@ -15,7 +15,27 @@ /*

type createPath = (x: string | number) => string
class MeiliSearch implements Types.MeiliSearchInterface {
config: Types.Config
httpRequest: HttpRequests
static apiRoutes: {
[key: string]: string
} = {
listIndexes: 'indexes',
getkeys: 'keys',
isHealthy: 'health',
stats: 'stats',
version: 'version',
createDump: 'dumps',
}
static routeConstructors: {
[key: string]: createPath
} = {
getDumpStatus: (dumpUid: string | number) => {
return `dumps/${dumpUid}/status`
},
}
constructor(config: Types.Config) {
config.host = HttpRequests.addTrailingSlash(config.host)
this.config = config

@@ -25,2 +45,9 @@ this.httpRequest = new HttpRequests(config)

static getApiRoutes(): { [key: string]: string } {
return MeiliSearch.apiRoutes
}
static getRouteConstructors(): { [key: string]: createPath } {
return MeiliSearch.routeConstructors
}
/**

@@ -71,4 +98,3 @@ * Return an Index instance

async listIndexes(): Promise<Types.IndexResponse[]> {
const url = '/indexes'
const url = MeiliSearch.apiRoutes.listIndexes
return await this.httpRequest.get<Types.IndexResponse[]>(url)

@@ -120,4 +146,3 @@ }

async getKeys(): Promise<Types.Keys> {
const url = '/keys'
const url = MeiliSearch.apiRoutes.getKeys
return await this.httpRequest.get<Types.Keys>(url)

@@ -137,5 +162,5 @@ }

async isHealthy(): Promise<true> {
const url = '/health'
return await this.httpRequest.get(url).then(() => true)
return await this.httpRequest
.get(MeiliSearch.apiRoutes.isHealthy)
.then(() => true)
}

@@ -153,4 +178,3 @@

async stats(): Promise<Types.Stats> {
const url = '/stats'
const url = MeiliSearch.apiRoutes.stats
return await this.httpRequest.get<Types.Stats>(url)

@@ -165,4 +189,3 @@ }

async version(): Promise<Types.Version> {
const url = '/version'
const url = MeiliSearch.apiRoutes.version
return await this.httpRequest.get<Types.Version>(url)

@@ -181,4 +204,3 @@ }

async createDump(): Promise<Types.EnqueuedDump> {
const url = '/dumps'
const url = MeiliSearch.apiRoutes.createDump
return await this.httpRequest.post<undefined, Types.EnqueuedDump>(url)

@@ -193,4 +215,3 @@ }

async getDumpStatus(dumpUid: string): Promise<Types.EnqueuedDump> {
const url = `/dumps/${dumpUid}/status`
const url = MeiliSearch.routeConstructors.getDumpStatus(dumpUid)
return await this.httpRequest.get<Types.EnqueuedDump>(url)

@@ -197,0 +218,0 @@ }

@@ -93,2 +93,8 @@ // Type definitions for meilisearch

export type CategoriesDistribution = {
[category: string]: number
}
export type Facet = string
// The second generic P is used to capture the SearchParams type

@@ -105,3 +111,3 @@ export interface SearchResponse<T, P extends SearchParams<T>> {

processingTimeMs: number
facetsDistribution?: object
facetsDistribution?: Record<Facet, CategoriesDistribution>
exhaustiveFacetsCount?: boolean

@@ -108,0 +114,0 @@ query: string

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc