Skip to content

Commit

Permalink
Merge #437
Browse files Browse the repository at this point in the history
437: Changes related to the next Meilisearch release (v0.28.0) r=bidoubiwa a=meili-bot

This PR gathers the changes related to the next Meilisearch release (v0.28.0) so that this package is ready when the official release is out.

⚠️ This PR should NOT be merged until:
  - the next release of Meilisearch (v0.28.0) is out.
  - the [`meilisearch-js`](https://github.com/meilisearch/meilisearch-js) dependency has been released to be compatible with Meilisearch v0.28.0.
  Once the release is out, the upgrade of the `meilisearch-js` dependency might be committed to this branch.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._

_Related to this issue: https://github.com/meilisearch/integration-guides/issues/205_


Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: Charlotte Vermandel <charlottevermandel@gmail.com>
  • Loading branch information
4 people authored Jul 12, 2022
2 parents ec8d49e + 3b278c4 commit 017811a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ If you are using [Strapi v3](https://github.com/strapi/strapi/tree/v3.6.9), plea

**Supported Meilisearch versions**:

This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).

**Node / NPM versions**:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"dependencies": {
"@strapi/utils": "^4.2.2",
"meilisearch": "^0.25.1"
"meilisearch": "^0.27.0"
},
"peerDependencies": {},
"author": {
Expand Down
2 changes: 1 addition & 1 deletion server/__tests__/meilisearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const deleteDocuments = jest.fn(() => {
return [{ uid: 1 }, { uid: 2 }]
})
const getIndexes = jest.fn(() => {
return [{ uid: 'my_restaurant' }, { uid: 'restaurant' }]
return { results: [{ uid: 'my_restaurant' }, { uid: 'restaurant' }] }
})

const getTasks = jest.fn(() => {
Expand Down
7 changes: 6 additions & 1 deletion server/services/meilisearch/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'
const { MeiliSearch: Meilisearch } = require('meilisearch')
const packageJson = require('../../../package.json')

/**
* Create a Meilisearch client instance.
Expand All @@ -8,4 +9,8 @@ const { MeiliSearch: Meilisearch } = require('meilisearch')
*
* @returns { object } - Meilisearch client instance.
*/
module.exports = config => new Meilisearch(config)
module.exports = config =>
new Meilisearch({
...config,
clientAgents: [`Meilisearch Strapi ${packageJson.version}`],
})
4 changes: 2 additions & 2 deletions server/services/meilisearch/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = ({ strapi, adapter, config }) => {
try {
const { apiKey, host } = await store.getCredentials()
const client = Meilisearch({ apiKey, host })
const indexes = await client.getIndexes()
const { results: indexes } = await client.getIndexes()
return indexes
} catch (e) {
strapi.log.error(`meilisearch: ${e.message}`)
Expand Down Expand Up @@ -280,7 +280,7 @@ module.exports = ({ strapi, adapter, config }) => {
// Add documents in Meilisearch
const task = await client.index(indexUid).addDocuments(documents)

return task.uid
return task.taskUid
}

const tasksUids = await contentTypeService.actionInBatches({
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3140,10 +3140,10 @@ makeerror@1.0.12:
dependencies:
tmpl "1.0.5"

meilisearch@^0.25.1:
version "0.25.1"
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.25.1.tgz#0dc25ffad64e6e50eb3da6c0691b0ff54f8578bf"
integrity sha512-20jO0pK9BhghxHSkOLbdoYn58h/Z0PNL3JQcRq7ipNIeqrxkAetCZZ6ttJC3uxcz0jVglmiFoSXu3Z/lEOLOLQ==
meilisearch@^0.27.0:
version "0.27.0"
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.27.0.tgz#8bd57ddb77b975f93e054cb977b951c488ece297"
integrity sha512-kZOZFIuSO7c6xRf+Y2/9/h6A9pl0sCl/G44X4KuaSwxGbruOZPhmxbeVEgLHBv4pUFvQ56rNVTA/2d/5GCU1YA==
dependencies:
cross-fetch "^3.1.5"

Expand Down

0 comments on commit 017811a

Please sign in to comment.