Skip to content

Commit 2ab9478

Browse files
authored
Merge branch 'main' into patch-1
2 parents 7994408 + d8ca4ed commit 2ab9478

File tree

14 files changed

+166
-67
lines changed

14 files changed

+166
-67
lines changed

.github/workflows/beta-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: Setup node
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
cache: yarn
2525
node-version: ${{ matrix.node }}
@@ -36,7 +36,7 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838
- name: Setup node
39-
uses: actions/setup-node@v3
39+
uses: actions/setup-node@v4
4040
with:
4141
cache: yarn
4242
node-version: ${{ matrix.node }}
@@ -50,7 +50,7 @@ jobs:
5050
steps:
5151
- uses: actions/checkout@v4
5252
- name: Setup node
53-
uses: actions/setup-node@v3
53+
uses: actions/setup-node@v4
5454
with:
5555
cache: yarn
5656
node-version: ${{ matrix.node }}

.github/workflows/pre-release-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: Setup node
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
cache: yarn
2525
node-version: ${{ matrix.node }}
@@ -36,7 +36,7 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838
- name: Setup node
39-
uses: actions/setup-node@v3
39+
uses: actions/setup-node@v4
4040
with:
4141
cache: yarn
4242
node-version: ${{ matrix.node }}
@@ -50,7 +50,7 @@ jobs:
5050
steps:
5151
- uses: actions/checkout@v4
5252
- name: Setup node
53-
uses: actions/setup-node@v3
53+
uses: actions/setup-node@v4
5454
with:
5555
cache: yarn
5656
node-version: ${{ matrix.node }}

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
11-
- uses: actions/setup-node@v3
11+
- uses: actions/setup-node@v4
1212
with:
1313
node-version: 14
1414
registry-url: https://registry.npmjs.org/

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v4
2525
- name: Setup node
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
node-version: ${{ matrix.node }}
2929
- name: Cache dependencies
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v4
4747
- name: Setup node
48-
uses: actions/setup-node@v3
48+
uses: actions/setup-node@v4
4949
with:
5050
node-version: ${{ matrix.node }}
5151
- name: Cache dependencies
@@ -70,7 +70,7 @@ jobs:
7070
steps:
7171
- uses: actions/checkout@v4
7272
- name: Setup node
73-
uses: actions/setup-node@v3
73+
uses: actions/setup-node@v4
7474
with:
7575
node-version: '18.x'
7676
- name: Cache dependencies

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2022 Meili SAS
3+
Copyright (c) 2021-2024 Meili SAS
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ Meilisearch is an open-source search engine. [Discover what Meilisearch is!](htt
2828

2929
Add your Strapi content-types into a Meilisearch instance. The plugin listens to modifications made on your content-types and updates Meilisearch accordingly.
3030

31-
---
32-
33-
### 🔥 On November 2nd, we are hosting our first-ever live demo and product updates for [Meilisearch Cloud](https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch). Make sure to [register here](https://us06web.zoom.us/meeting/register/tZMlc-mqrjIsH912-HTRe-AaT-pp41bDe81a#/registration) and bring your questions for live Q&A!
34-
35-
---
36-
37-
## Table of Contents <!-- omit in toc -->
31+
## Table of Contents <!-- omit in TOC -->
3832

3933
- [📖 Documentation](#-documentation)
4034
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
@@ -217,6 +211,7 @@ Settings:
217211
- [🤚 Filter entries](#-filter-entries)
218212
- [🏗 Add Meilisearch settings](#-add-meilisearch-settings)
219213
- [🔎 Entries query](#-entries-query)
214+
- [🔐 Selectively index private fields](#-selectively-index-private-fields)
220215

221216
### 🏷 Custom index name
222217

@@ -418,6 +413,27 @@ module.exports = {
418413

419414
[See resources](./resources/entries-query) for more entriesQuery examples.
420415

416+
### 🔐 Selectively index private fields
417+
418+
Private fields are sanitized by default to prevent data leaks. However, you might want to allow some of these private fields to be used for `search`, `filter` or `sort`. This is possible with the `noSanitizePrivateFields`. For example, if you have a private field called `internal_notes` in your content-type schema that you wish to include in searching, you can add it to the `noSanitizePrivateFields` array to allow it to be indexed.
419+
420+
```js
421+
// config/plugins.js
422+
423+
module.exports = {
424+
meilisearch: {
425+
config: {
426+
restaurant: {
427+
noSanitizePrivateFields: ["internal_notes"], // All attributes: ["*"]
428+
settings: {
429+
"searchableAttributes": ["internal_notes"],
430+
}
431+
},
432+
},
433+
},
434+
}
435+
```
436+
421437
### 🕵️‍♀️ Start Searching <!-- omit in toc -->
422438

423439
Once you have a content-type indexed in Meilisearch, you can [start searching](https://www.meilisearch.com/docs/learn/getting_started/quick_start.html#search).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dependencies": {
2828
"@strapi/utils": "^4.14.4",
2929
"@strapi/icons": "^1.12.2",
30-
"@strapi/design-system": "^1.12.2",
30+
"@strapi/design-system": "^1.13.2",
3131
"meilisearch": "^0.35.0"
3232
},
3333
"peerDependencies": {

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@strapi/plugin-users-permissions": "^4.14.4",
1515
"@strapi/strapi": "^4.14.4",
1616
"@strapi/utils": "^4.14.4",
17-
"meilisearch": "^0.35.0",
17+
"meilisearch": "^0.36.0",
1818
"sqlite3": "^5.1.4"
1919
},
2020
"author": {

playground/yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,9 +1847,9 @@
18471847
typescript "5.2.2"
18481848

18491849
"@strapi/ui-primitives@^1.12.0":
1850-
version "1.12.2"
1851-
resolved "https://registry.yarnpkg.com/@strapi/ui-primitives/-/ui-primitives-1.12.2.tgz#50e06514dd8b9e9cb8ef779a6cb63e4885098b32"
1852-
integrity sha512-yQCUp2N+SsXnW/lIldyll3OAdMSLGLLEUmDXmCL+6NnmjkXwPTVoxj+EZCXHal3NTDWKDjuLlS9C7Wc0oayefQ==
1850+
version "1.13.2"
1851+
resolved "https://registry.yarnpkg.com/@strapi/ui-primitives/-/ui-primitives-1.13.2.tgz#8e510bc56944d8bf93581fdc7934f77a76d17e3a"
1852+
integrity sha512-Koaun6riXoTOvvlKNgFy44BVUfLfchgpabRhrNH/KfmBQQlhLCqJDQu023FcFQDQQ4XFO3DpvzDk8pCbmva7oQ==
18531853
dependencies:
18541854
"@radix-ui/number" "^1.0.1"
18551855
"@radix-ui/primitive" "^1.0.1"
@@ -1871,7 +1871,7 @@
18711871
"@radix-ui/react-use-previous" "^1.0.1"
18721872
"@radix-ui/react-visually-hidden" "^1.0.3"
18731873
aria-hidden "^1.2.3"
1874-
react-remove-scroll "^2.5.6"
1874+
react-remove-scroll "^2.5.7"
18751875

18761876
"@strapi/[email protected]", "@strapi/utils@^4.14.4":
18771877
version "4.14.4"
@@ -6395,10 +6395,10 @@ [email protected]:
63956395
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
63966396
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==
63976397

6398-
meilisearch@^0.35.0:
6399-
version "0.35.0"
6400-
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.35.0.tgz#c94d5f266e39ad5ed5a666782e729805a4e8a956"
6401-
integrity sha512-gF1I6K5/Wpe7BWfjBnG+o19y/FIpJ9HbN+byON6CB9U3uE7qc6GvwUbjKOllh7LKXQVVxH/kCu7Jn0ODCUwqbQ==
6398+
meilisearch@^0.36.0:
6399+
version "0.36.0"
6400+
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.36.0.tgz#b2d1f6b342aabc89557832638a6ce2a6a7c6bf64"
6401+
integrity sha512-swcvEYrct0/zsGj3jlbPm1OYxbH14IURnlysKlXywNicIQ5EMkSYLYCLCwOuBKAaGcdISWdgdylH9TXVLegmOQ==
64026402
dependencies:
64036403
cross-fetch "^3.1.6"
64046404

@@ -7709,7 +7709,7 @@ [email protected]:
77097709
use-callback-ref "^1.3.0"
77107710
use-sidecar "^1.1.2"
77117711

7712-
react-remove-scroll@^2.5.6:
7712+
react-remove-scroll@^2.5.6, react-remove-scroll@^2.5.7:
77137713
version "2.5.7"
77147714
resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.5.7.tgz#15a1fd038e8497f65a695bf26a4a57970cac1ccb"
77157715
integrity sha512-FnrTWO4L7/Bhhf3CYBNArEG/yROV0tKmTv7/3h9QCFvH6sndeFf1wPqOcbFVu5VAulS5dV1wGT3GZZ/1GawqiA==

server/__tests__/configuration-validation.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,41 @@ describe('Test plugin configuration', () => {
245245
expect(strapiMock.log.error).toHaveBeenCalledTimes(0)
246246
})
247247

248+
test('Test noSanitizePrivateFields with wrong type', async () => {
249+
validatePluginConfig({
250+
restaurant: {
251+
noSanitizePrivateFields: 0,
252+
},
253+
})
254+
expect(strapiMock.log.warn).toHaveBeenCalledTimes(0)
255+
expect(strapiMock.log.error).toHaveBeenCalledTimes(1)
256+
expect(strapiMock.log.error).toHaveBeenCalledWith(
257+
'The "noSanitizePrivateFields" option of "restaurant" should be an array of strings.'
258+
)
259+
})
260+
261+
test('Test noSanitizePrivateFields with array of strings', async () => {
262+
const configuration = validatePluginConfig({
263+
restaurant: {
264+
noSanitizePrivateFields: ['test'],
265+
},
266+
})
267+
expect(strapiMock.log.warn).toHaveBeenCalledTimes(0)
268+
expect(strapiMock.log.error).toHaveBeenCalledTimes(0)
269+
expect(configuration.restaurant.noSanitizePrivateFields).toEqual(['test'])
270+
})
271+
272+
test('Test noSanitizePrivateFields with undefined', async () => {
273+
validatePluginConfig({
274+
restaurant: {
275+
noSanitizePrivateFields: undefined,
276+
},
277+
})
278+
279+
expect(strapiMock.log.warn).toHaveBeenCalledTimes(0)
280+
expect(strapiMock.log.error).toHaveBeenCalledTimes(0)
281+
})
282+
248283
test('Test configuration with random field ', async () => {
249284
validatePluginConfig({
250285
restaurant: {

0 commit comments

Comments
 (0)