Skip to content

Commit 0af3891

Browse files
meili-bors[bot]meili-botbidoubiwacurquiza
authored
Merge #332
332: Changes related to the next MeiliSearch release (v0.25.0) r=curquiza a=meili-bot This PR gathers the changes related to the next MeiliSearch release (v0.25.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.25.0) is out. - the [`meilisearch-js`](https://github.com/meilisearch/meilisearch-js) dependency has been released to be compatible with MeiliSearch v0.25.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._ --- This PR is breaking because uses meilisearch-js v0.24.0 that only works with MeiliSearch v0.25.0 and later -> it enforces the users to upgrade their MeiliSearch version Co-authored-by: meili-bot <[email protected]> Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: Clémentine Urquizar - curqui <[email protected]> Co-authored-by: Clémentine Urquizar <[email protected]>
2 parents d78e8bb + e739314 commit 0af3891

File tree

11 files changed

+255
-102
lines changed

11 files changed

+255
-102
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Testing the code base against the MeiliSearch pre-releases
2+
name: Pre-Release Tests
3+
4+
# Will only run for PRs and pushes to bump-meilisearch-v*
5+
on:
6+
push:
7+
branches: [bump-meilisearch-v*]
8+
pull_request:
9+
branches: [bump-meilisearch-v*]
10+
11+
jobs:
12+
integration_tests:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
# Strapi is not yet compatible with node 16
17+
node: ["12", "14"]
18+
name: integration-tests (Node.js ${{ matrix.node }})
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Setup node
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node }}
25+
- name: Cache dependencies
26+
uses: actions/cache@v2
27+
with:
28+
path: |
29+
./node_modules
30+
key: ${{ hashFiles('yarn.lock') }}
31+
- name: Install dependencies
32+
run: yarn
33+
- name: Launch tests
34+
run: yarn test
35+
36+
playground_build_tests:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
node: ["12", "14"]
41+
name: playground-build (Node.js ${{ matrix.node }})
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Setup node
45+
uses: actions/setup-node@v2
46+
with:
47+
node-version: ${{ matrix.node }}
48+
- name: Cache dependencies
49+
uses: actions/cache@v2
50+
with:
51+
path: |
52+
./node_modules
53+
key: ${{ hashFiles('yarn.lock') }}
54+
- name: Install dependencies
55+
run: yarn --dev && yarn --cwd ./playground
56+
- name: Build Strapi playground
57+
run: yarn playground:build
58+
59+
linter_check:
60+
runs-on: ubuntu-latest
61+
name: style-check
62+
steps:
63+
- uses: actions/checkout@v2
64+
- name: Setup node
65+
uses: actions/setup-node@v2
66+
with:
67+
node-version: "12.x"
68+
- name: Cache dependencies
69+
uses: actions/cache@v2
70+
with:
71+
path: |
72+
./node_modules
73+
key: ${{ hashFiles('yarn.lock') }}
74+
- name: Install dependencies
75+
run: yarn --dev
76+
- name: Run style check
77+
run: yarn style
78+
- name: Yaml Style
79+
uses: ibiqlik/action-yamllint@v3
80+
with:
81+
config_file: .yamllint.yml
82+
cypress-run:
83+
runs-on: ubuntu-latest
84+
container: cypress/browsers:node12.18.3-chrome87-ff82
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v2
88+
- name: Cache dependencies
89+
uses: actions/cache@v2
90+
with:
91+
path: |
92+
./node_modules
93+
key: ${{ hashFiles('yarn.lock') }}
94+
- name: Setup node
95+
uses: actions/setup-node@v2
96+
with:
97+
node-version: "12.x"
98+
- name: Cache dependencies
99+
uses: actions/cache@v2
100+
with:
101+
path: |
102+
./playground/node_modules
103+
key: ${{ hashFiles('playground/yarn.lock') }}
104+
- name: Grep latest version of MeiliSearch
105+
run: |
106+
echo "MEILISEARCH_LATEST=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)" >> $GITHUB_ENV
107+
- name: Download MeiliSearch
108+
run: |
109+
curl https://github.com/meilisearch/MeiliSearch/releases/download/${{ env.MEILISEARCH_LATEST }}/meilisearch-linux-amd64 --output meilisearch --location
110+
chmod +x meilisearch
111+
- name: Run MeiliSearch
112+
run: |
113+
./meilisearch --master-key=masterKey --no-analytics true &
114+
- name: Install dependencies
115+
run: yarn --dev && yarn --cwd ./playground
116+
- name: Remove plugin symlink
117+
run: rm ./playground/plugins/meilisearch
118+
- name: Move plugin inside playground
119+
# Since the plugin is located at the root of the project but a symlink links
120+
# to it in ./playground/plugins/meilisearch it causes a circular
121+
# chaining problem.
122+
# Now that we removed the symlink (see previous step), we need to move our plugin in the
123+
# plugin directory of the playground.
124+
run: mkdir ./playground/plugins/meilisearch &&
125+
mv admin ./playground/plugins/meilisearch &&
126+
mv controllers ./playground/plugins/meilisearch &&
127+
mv connectors ./playground/plugins/meilisearch &&
128+
mv config ./playground/plugins/meilisearch &&
129+
mv services ./playground/plugins/meilisearch &&
130+
cp package.json ./playground/plugins/meilisearch
131+
- name: Test with reloads activated
132+
uses: cypress-io/github-action@v2
133+
with:
134+
build: yarn playground:build
135+
start: yarn playground:ci
136+
env: env=prereleaseci
137+
- uses: actions/upload-artifact@v2
138+
if: failure()
139+
with:
140+
name: cypress-screenshots
141+
path: cypress/screenshots
142+
- uses: actions/upload-artifact@v2
143+
if: failure()
144+
with:
145+
name: cypress-videos
146+
path: cypress/videos

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ jobs:
8181
with:
8282
config_file: .yamllint.yml
8383
cypress-run:
84+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
85+
# Will still run for each push to bump-meilisearch-v*
86+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
8487
runs-on: ubuntu-latest
8588
container: cypress/browsers:node12.18.3-chrome87-ff82
8689
services:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Complete installation requirements are the same as for Strapi itself and can be
440440

441441
**Supported MeiliSearch versions**:
442442

443-
This package only guarantees the compatibility with the [version v0.24.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.24.0).
443+
This package only guarantees the compatibility with the [version v0.25.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.25.0).
444444

445445
**Node / NPM versions**:
446446

admin/src/components/Collections.js

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,82 +24,83 @@ const Collections = ({ updateCredentials }) => {
2424
const [upToDateCollections, setUpToDateCollection] = useState(false) // Boolean that informs if collections have been updated.
2525
const [needReload, setNeedReload] = useState(false) // Boolean to inform that reload is requested.
2626
const [collectionInWaitMode, setCollectionInWaitMode] = useState([]) // Collections that are waiting for their indexation to complete.
27-
const [collectionUpdateIds, setCollectionUpdateIds] = useState({}) // List of collection's enqueued update ids.
27+
const [collectionTaskUids, setCollectionTaskUids] = useState({}) // List of collection's enqueued task uids.
2828

29-
// Trigger a updateId fetcher to find enqueued update ids of the indexed collections.
29+
// Trigger a task uids fetcher to find enqueued task of the indexed collections.
3030
useEffect(() => {
31-
findUpdateIds()
31+
findTaskUids()
3232
}, [])
3333

3434
// Adds a listener that informs if collections have been updated.
3535
useEffect(() => {
3636
setUpToDateCollection(false)
3737
}, [updateCredentials])
3838

39-
// Adds a listener that updates collections informations when an update occured.
39+
// Adds a listener that updates collections informations on updates
4040
useEffect(() => {
4141
if (!upToDateCollections) fetchCollections()
4242
}, [upToDateCollections, updateCredentials])
4343

44-
// Trigger an update watch if a collection has enqueued update id's.
44+
// Trigger a watch if a collection has enqueued task uid's.
4545
useEffect(() => {
46-
for (const collection in collectionUpdateIds) {
47-
if (collectionUpdateIds[collection].length > 0) {
48-
watchUpdates({ collection })
46+
for (const collection in collectionTaskUids) {
47+
if (collectionTaskUids[collection].length > 0) {
48+
watchTasks({ collection })
4949
}
5050
}
51-
}, [collectionUpdateIds])
51+
}, [collectionTaskUids])
5252

5353
/**
54-
* Find all enqueued update id's of the indexed collections.
54+
* Find all enqueued task uid's of the indexed collections.
5555
* It is triggered on load.
5656
*/
57-
const findUpdateIds = async () => {
58-
const response = await request(`/${pluginId}/collection/update`, {
57+
const findTaskUids = async () => {
58+
const response = await request(`/${pluginId}/collection/tasks`, {
5959
method: 'GET',
6060
})
6161

6262
if (response.error) errorNotifications(response)
63-
setCollectionUpdateIds(response.updateIds)
63+
setCollectionTaskUids(response.taskUids)
6464
}
6565

6666
/**
6767
* Watches a collection (if not already)
68-
* For a maximum of 5 enqueued updates in MeiliSearch.
68+
* For a maximum of 5 enqueued tasks in MeiliSearch.
6969
*
7070
* @param {string} collection - Collection name.
7171
*/
72-
const watchUpdates = async ({ collection }) => {
73-
// If collection has pending updates
74-
const updateIds = collectionUpdateIds[collection]
72+
const watchTasks = async ({ collection }) => {
73+
// If collection has pending tasks
74+
const taskUids = collectionTaskUids[collection]
7575

76-
if (!collectionInWaitMode.includes(collection) && updateIds?.length > 0) {
76+
if (!collectionInWaitMode.includes(collection) && taskUids?.length > 0) {
7777
addIndexedStatus
7878
setCollectionInWaitMode(prev => [...prev, collection])
7979

80-
const updateIdsChunk = updateIds.splice(0, 1)
80+
const taskUidsIdsChunk = taskUids.splice(0, 1)
8181
const response = await request(
82-
`/${pluginId}/collection/${collection}/update/batch`,
82+
`/${pluginId}/collection/${collection}/tasks/batch`,
8383
{
8484
method: 'POST',
85-
body: { updateIds: updateIdsChunk },
85+
body: { taskUids: taskUidsIdsChunk },
8686
}
8787
)
88+
8889
if (response.error) errorNotifications(response)
8990

90-
const { updateStatus } = response
91+
const { tasksStatus } = response
9192

92-
updateStatus.map(update => {
93-
if (update.status === 'failed') {
94-
update.error.message = `Some documents could not be added: \n${update.error.message}`
95-
errorNotifications(update.error)
93+
tasksStatus.map(task => {
94+
if (task.status === 'failed') {
95+
task.error.message = `Some documents could not be added: \n${task.error.message}`
96+
errorNotifications(task.error)
9697
}
9798
})
9899

99100
setCollectionInWaitMode(prev => prev.filter(col => col !== collection))
100-
setCollectionUpdateIds(prev => ({
101+
setCollectionTaskUids(prev => ({
101102
...prev,
102-
[collection]: updateIds,
103+
[collection]: taskUids,
103104
}))
104105

105106
setUpToDateCollection(false) // Ask for collections to be updated.
@@ -122,9 +123,9 @@ const Collections = ({ updateCredentials }) => {
122123
createResponseNotification(response, `${collection} is created!`)
123124

124125
if (!response.error) {
125-
setCollectionUpdateIds(prev => ({
126+
setCollectionTaskUids(prev => ({
126127
...prev,
127-
[collection]: response.updateIds,
128+
[collection]: response.taskUids,
128129
}))
129130
}
130131

@@ -147,9 +148,9 @@ const Collections = ({ updateCredentials }) => {
147148
createResponseNotification(response, `${collection} update started!`)
148149

149150
if (!response.error) {
150-
setCollectionUpdateIds(prev => ({
151+
setCollectionTaskUids(prev => ({
151152
...prev,
152-
[collection]: response.updateIds,
153+
[collection]: response.taskUids,
153154
}))
154155
}
155156

@@ -199,10 +200,10 @@ const Collections = ({ updateCredentials }) => {
199200

200201
if (error) errorNotifications(res)
201202
else {
202-
// Start watching collections that have pending updates
203+
// Start watching collections that have pending tasks
203204
collections.map(col => {
204205
if (col.isIndexing) {
205-
watchUpdates({ collection: col.collection })
206+
watchTasks({ collection: col.collection })
206207
}
207208
})
208209

config/routes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
},
3535
{
3636
"method": "POST",
37-
"path": "/collection/:collection/update/batch",
38-
"handler": "meilisearch.waitForBatchUpdates",
37+
"path": "/collection/:collection/tasks/batch",
38+
"handler": "meilisearch.waitForTasks",
3939
"config": {
4040
"policies": ["isAdmin"]
4141
}
4242
},
4343
{
4444
"method": "GET",
45-
"path": "/collection/update",
46-
"handler": "meilisearch.getUpdateIds",
45+
"path": "/collection/tasks",
46+
"handler": "meilisearch.getTaskUids",
4747
"config": {
4848
"policies": ["isAdmin"]
4949
}

0 commit comments

Comments
 (0)