meilisearch-js
meilisearch-js copied to clipboard
Separate token specific code into its own export
Pull Request
Related issue
Fixes #1690
What does this PR do?
- generalizes the
MeiliSearchclient into a single universal export by stripping Node.js crypto specific token code into its own separate exported module apiKeyoption is now mandatory ingenerateTenantTokenfunction
Migration
Old:
import { MeiliSearch } from "meilisearch";
const client = new MeiliSearch({ host: "http://127.0.0.1:7700", apiKey: "masterKey" });
const token = await client.generateTenantToken("e489fe16-3381-431b-bee3-00430192915d");
// ...
New:
import { generateTenantToken } from "meilisearch/token";
const token = await generateTenantToken("e489fe16-3381-431b-bee3-00430192915d", [], { apiKey: "masterKey" });
// ...
PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?
Thank you so much for contributing to Meilisearch!