@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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -2
  3. package/dist/admin/index.d.ts +2 -0
  4. package/dist/admin/index.js +2310 -0
  5. package/dist/admin/index.js.map +7 -0
  6. package/dist/admin/index.mjs +2310 -0
  7. package/dist/admin/index.mjs.map +7 -0
  8. package/dist/admin/translations/ar.json +89 -0
  9. package/dist/admin/translations/en.json +89 -0
  10. package/dist/admin/translations/es.json +89 -0
  11. package/dist/admin/translations/fr.json +89 -0
  12. package/dist/admin/translations/tr.json +89 -0
  13. package/dist/server/bootstrap.d.ts +6 -0
  14. package/dist/server/bootstrap.d.ts.map +1 -0
  15. package/dist/server/config/index.d.ts +15 -0
  16. package/dist/server/config/index.d.ts.map +1 -0
  17. package/dist/server/controllers/index.d.ts +94 -0
  18. package/dist/server/controllers/index.d.ts.map +1 -0
  19. package/dist/server/controllers/schema.d.ts +24 -0
  20. package/dist/server/controllers/schema.d.ts.map +1 -0
  21. package/dist/server/controllers/search.d.ts +21 -0
  22. package/dist/server/controllers/search.d.ts.map +1 -0
  23. package/dist/server/controllers/settings.d.ts +23 -0
  24. package/dist/server/controllers/settings.d.ts.map +1 -0
  25. package/dist/server/index.d.ts +212 -0
  26. package/dist/server/index.d.ts.map +1 -0
  27. package/dist/server/index.js +1186 -0
  28. package/dist/server/index.js.map +7 -0
  29. package/dist/server/index.mjs +1186 -0
  30. package/dist/server/index.mjs.map +7 -0
  31. package/dist/server/register.d.ts +6 -0
  32. package/dist/server/register.d.ts.map +1 -0
  33. package/dist/server/routes/index.d.ts +20 -0
  34. package/dist/server/routes/index.d.ts.map +1 -0
  35. package/dist/server/services/index.d.ts +89 -0
  36. package/dist/server/services/index.d.ts.map +1 -0
  37. package/dist/server/services/permissions.d.ts +13 -0
  38. package/dist/server/services/permissions.d.ts.map +1 -0
  39. package/dist/server/services/query.d.ts +25 -0
  40. package/dist/server/services/query.d.ts.map +1 -0
  41. package/dist/server/services/ranking.d.ts +27 -0
  42. package/dist/server/services/ranking.d.ts.map +1 -0
  43. package/dist/server/services/schema.d.ts +70 -0
  44. package/dist/server/services/schema.d.ts.map +1 -0
  45. package/dist/server/services/search.d.ts +36 -0
  46. package/dist/server/services/search.d.ts.map +1 -0
  47. package/dist/server/services/settings.d.ts +15 -0
  48. package/dist/server/services/settings.d.ts.map +1 -0
  49. package/dist/server/types.d.ts +195 -0
  50. package/dist/server/types.d.ts.map +1 -0
  51. package/dist/server/utils/async.d.ts +8 -0
  52. package/dist/server/utils/async.d.ts.map +1 -0
  53. package/dist/server/utils/constants.d.ts +42 -0
  54. package/dist/server/utils/constants.d.ts.map +1 -0
  55. package/dist/server/utils/text.d.ts +20 -0
  56. package/dist/server/utils/text.d.ts.map +1 -0
  57. 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
- # Temporary Holding Version
1
+ # `@vicacha-devs/strapi-plugin-global-search`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/@vicacha-devs/strapi-plugin-global-search.svg)](https://www.npmjs.com/package/@vicacha-devs/strapi-plugin-global-search)
4
+ [![Strapi 5](https://img.shields.io/badge/strapi-v5-blue)](https://strapi.io)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](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
@@ -0,0 +1,2 @@
1
+ declare const plugin: Record<string, unknown>;
2
+ export default plugin;