@vicacha-devs/strapi-plugin-global-search 0.0.0-stage → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -2
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +2310 -0
- package/dist/admin/index.js.map +7 -0
- package/dist/admin/index.mjs +2310 -0
- package/dist/admin/index.mjs.map +7 -0
- package/dist/admin/translations/ar.json +89 -0
- package/dist/admin/translations/en.json +89 -0
- package/dist/admin/translations/es.json +89 -0
- package/dist/admin/translations/fr.json +89 -0
- package/dist/admin/translations/tr.json +89 -0
- package/dist/server/bootstrap.d.ts +6 -0
- package/dist/server/bootstrap.d.ts.map +1 -0
- package/dist/server/config/index.d.ts +15 -0
- package/dist/server/config/index.d.ts.map +1 -0
- package/dist/server/controllers/index.d.ts +94 -0
- package/dist/server/controllers/index.d.ts.map +1 -0
- package/dist/server/controllers/schema.d.ts +24 -0
- package/dist/server/controllers/schema.d.ts.map +1 -0
- package/dist/server/controllers/search.d.ts +21 -0
- package/dist/server/controllers/search.d.ts.map +1 -0
- package/dist/server/controllers/settings.d.ts +23 -0
- package/dist/server/controllers/settings.d.ts.map +1 -0
- package/dist/server/index.d.ts +212 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +1186 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/index.mjs +1186 -0
- package/dist/server/index.mjs.map +7 -0
- package/dist/server/register.d.ts +6 -0
- package/dist/server/register.d.ts.map +1 -0
- package/dist/server/routes/index.d.ts +20 -0
- package/dist/server/routes/index.d.ts.map +1 -0
- package/dist/server/services/index.d.ts +89 -0
- package/dist/server/services/index.d.ts.map +1 -0
- package/dist/server/services/permissions.d.ts +13 -0
- package/dist/server/services/permissions.d.ts.map +1 -0
- package/dist/server/services/query.d.ts +25 -0
- package/dist/server/services/query.d.ts.map +1 -0
- package/dist/server/services/ranking.d.ts +27 -0
- package/dist/server/services/ranking.d.ts.map +1 -0
- package/dist/server/services/schema.d.ts +70 -0
- package/dist/server/services/schema.d.ts.map +1 -0
- package/dist/server/services/search.d.ts +36 -0
- package/dist/server/services/search.d.ts.map +1 -0
- package/dist/server/services/settings.d.ts +15 -0
- package/dist/server/services/settings.d.ts.map +1 -0
- package/dist/server/types.d.ts +195 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils/async.d.ts +8 -0
- package/dist/server/utils/async.d.ts.map +1 -0
- package/dist/server/utils/constants.d.ts +42 -0
- package/dist/server/utils/constants.d.ts.map +1 -0
- package/dist/server/utils/text.d.ts +20 -0
- package/dist/server/utils/text.d.ts.map +1 -0
- package/package.json +79 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sagar Maurya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@vicacha-devs/strapi-plugin-global-search`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@vicacha-devs/strapi-plugin-global-search)
|
|
4
|
+
[](https://strapi.io)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Spotlight-style **global search** for the Strapi v5 admin: every collection type and single type, from a dedicated page or a <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd> palette.
|
|
8
|
+
|
|
9
|
+
Install it, enable it, and start Strapi. It introspects your content types at boot and never needs to know your schema ahead of time.
|
|
10
|
+
|
|
11
|
+
**Strapi 4:** use [`strapi-global-search@1.x`](https://www.npmjs.com/package/strapi-global-search/v/1.0.0). This major (`2.x`) is Strapi 5 only.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Searches everything** — every `api::` and Content-Manager-visible `plugin::` collection type _and_ single type, including custom fields, structured rich text (ProseMirror / Tiptap JSON), and text fields nested inside components.
|
|
16
|
+
- **Two surfaces** — a full search page under the plugins menu, and an instant SPA-navigating command palette (<kbd>Ctrl</kbd>/<kbd>Cmd</kbd> + <kbd>K</kbd>) available from anywhere in the admin.
|
|
17
|
+
- **Predictable ordering** — results are ranked id → name → other fields → nested fields (see below), never by an opaque relevance score.
|
|
18
|
+
- **Respects your permissions** — an editor only ever sees content types they can read in the Content Manager.
|
|
19
|
+
- **i18n and draft/publish aware** — searches every locale by default and finds drafts. Includes UI translations for `en`, `fr`, `es`, `ar`, and `tr`.
|
|
20
|
+
- **No index, no extra services** — plain database queries, nothing to keep in sync.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @vicacha-devs/strapi-plugin-global-search
|
|
26
|
+
# or
|
|
27
|
+
npm install @vicacha-devs/strapi-plugin-global-search
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Enable it in `config/plugins.js` or `config/plugins.ts`:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
module.exports = {
|
|
34
|
+
"global-search": {
|
|
35
|
+
enabled: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then start your Strapi app (`npm run develop`). There is no extra build step.
|
|
41
|
+
|
|
42
|
+
This package has **no** `preinstall` / `install` / `postinstall` scripts and does not use git or remote URL dependencies. On [npm v12](https://github.blog/changelog/2026-07-08-npm-install-time-security-and-gat-bypass2fa-deprecation/) you do not need an `allowScripts` entry for `strapi-global-search`.
|
|
43
|
+
|
|
44
|
+
## Result ordering
|
|
45
|
+
|
|
46
|
+
| Priority | Match |
|
|
47
|
+
| -------- | ------------------------------------------- |
|
|
48
|
+
| 1 | `id` / `documentId` exact |
|
|
49
|
+
| 2 | `id` / `documentId` partial |
|
|
50
|
+
| 3 | Name (the Content Manager main field) exact |
|
|
51
|
+
| 4 | Name starts with the query |
|
|
52
|
+
| 5 | Name contains the query |
|
|
53
|
+
| 6 | Any other top-level text field |
|
|
54
|
+
| 7 | Any text field inside a component |
|
|
55
|
+
|
|
56
|
+
Ties break on an exact-case match, then the shortest matching value, then the most recently updated entry.
|
|
57
|
+
|
|
58
|
+
## Spotlight Command Palette (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>K</kbd>)
|
|
59
|
+
|
|
60
|
+
At bootstrap, the plugin mounts a lightweight React portal (`#global-search-portal-root`) on `document.body` so the command palette can be opened on **any** Strapi v5 Admin route — including inside Content Manager edit views and Settings pages:
|
|
61
|
+
|
|
62
|
+
| Shortcut | Action |
|
|
63
|
+
| :--- | :--- |
|
|
64
|
+
| <kbd>⌘</kbd> + <kbd>K</kbd> / <kbd>Ctrl</kbd> + <kbd>K</kbd> | Toggle the Spotlight Command Palette from anywhere in the Strapi v5 Admin panel |
|
|
65
|
+
| <kbd>↑</kbd> / <kbd>↓</kbd> | Navigate up and down through ranked search results |
|
|
66
|
+
| <kbd>↵</kbd> (`Enter`) | Open the highlighted entry in the current tab via SPA router navigation |
|
|
67
|
+
| <kbd>⌘</kbd>/<kbd>Ctrl</kbd> + <kbd>↵</kbd> | Open the highlighted entry in a new browser tab |
|
|
68
|
+
| <kbd>Esc</kbd> | Close the command palette and restore focus |
|
|
69
|
+
|
|
70
|
+
Each result row displays:
|
|
71
|
+
- **Entry Title & Highlighted Match** — matched query substrings are highlighted inline across both the main field and matched secondary/component fields (e.g., `Slug: historia-del-islam`).
|
|
72
|
+
- **Document ID Badge** — quick reference to the Strapi v5 `documentId` (`#ikm8b47sijmgzv99g119h3a5`).
|
|
73
|
+
- **Locale & Publication State Badges** — shows the active i18n locale (`en`, `es`, `ar`, `tr`) and `DRAFT` / `PUBLISHED` status alongside the human-readable Content-Type label (`Article & Course`, `Community Service`, `Resource Publication`).
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
Everything is optional and can be changed at **Settings → Global Search → Configuration**, or pinned in `config/plugins.js` / `config/plugins.ts`:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
module.exports = {
|
|
81
|
+
"global-search": {
|
|
82
|
+
enabled: true,
|
|
83
|
+
config: {
|
|
84
|
+
minChars: 2, // minimum query length
|
|
85
|
+
debounce: 250, // ms to wait after the last keystroke
|
|
86
|
+
perTypeLimit: 20, // rows fetched per content type
|
|
87
|
+
maxResults: 100, // cap on the merged, ranked result set
|
|
88
|
+
deep: true, // search inside components
|
|
89
|
+
maxDepth: 3, // how many component levels to walk
|
|
90
|
+
includeDrafts: true, // include unpublished entries
|
|
91
|
+
includePluginContentTypes: true, // include visible plugin::* content types
|
|
92
|
+
queryTimeout: 4000, // per-content-type timeout in ms
|
|
93
|
+
concurrency: 8, // content types queried in parallel
|
|
94
|
+
excludedContentTypes: [], // e.g. ['api::log.log']
|
|
95
|
+
excludedFields: [], // e.g. ['api::article.article:body']
|
|
96
|
+
displayFields: {}, // extra fields in the result row, keyed by UID
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Permissions
|
|
103
|
+
|
|
104
|
+
Two RBAC actions are registered and can be assigned per role:
|
|
105
|
+
|
|
106
|
+
- `plugin::global-search.read` — use the search page and the palette.
|
|
107
|
+
- `plugin::global-search.settings` — change the configuration.
|
|
108
|
+
|
|
109
|
+
Search results are additionally filtered by each user's Content Manager read permissions.
|
|
110
|
+
|
|
111
|
+
## Performance notes
|
|
112
|
+
|
|
113
|
+
Searching runs live database `LIKE` queries — there is no index to maintain, but a query on a very large table is only as fast as your database makes it. The plugin keeps this bounded with a per-content-type row limit, a bounded column projection, a per-type timeout, a concurrency cap and a client-side debounce. For very large tables, consider a database index on the fields people actually search, or disable those content types in Settings.
|
|
114
|
+
|
|
115
|
+
Reported result counts reflect the capped set (`perTypeLimit` rows per type, `maxResults` overall) — a `+` in the UI means there were more matches than were fetched.
|
|
116
|
+
|
|
117
|
+
## Limitations
|
|
118
|
+
|
|
119
|
+
- **Dynamic zones** and **blocks** fields are not searched: the query engine cannot filter polymorphic JSON columns.
|
|
120
|
+
- Relations, media and raw JSON fields are not searched.
|
|
121
|
+
- Internal Strapi system plugin content types (such as `plugin::upload.file`, `plugin::i18n.locale`, and `plugin::users-permissions.*`) are skipped automatically.
|
|
122
|
+
|
|
123
|
+
## Compatibility
|
|
124
|
+
|
|
125
|
+
| | |
|
|
126
|
+
| ------ | ----------------------------------- |
|
|
127
|
+
| Strapi | `^5.0.0` (developed against 5.52.0) |
|
|
128
|
+
| Node | 20 – 26 |
|
|
129
|
+
| React | 18 |
|
|
130
|
+
|
|
131
|
+
## Publishing and supply chain
|
|
132
|
+
|
|
133
|
+
Public releases are published from GitHub Actions with [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) (OIDC). There is no long-lived 2FA-bypass granular access token. See [npm install-time security and GAT bypass2fa deprecation](https://github.blog/changelog/2026-07-08-npm-install-time-security-and-gat-bypass2fa-deprecation/).
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT
|