Skip to content

Commit 91c0042

Browse files
committed
🤖 Update LLMs files [skip ci]
1 parent 501106c commit 91c0042

3 files changed

Lines changed: 56 additions & 37 deletions

File tree

docusaurus/static/llms-code.txt

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30314,7 +30314,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
3031430314

3031530315

3031630316
## Sanitization
30317-
Description: Plugin controllers are plain factory functions and do not extend createCoreController.
30317+
Description: Plugin controllers are plain factory functions and do not extend createCoreController like in the Strapi core (see backend customization for details).
3031830318
(Source: https://docs.strapi.io/cms/plugins-development/server-controllers-services#sanitization)
3031930319

3032030320
Language: JavaScript
@@ -30541,7 +30541,7 @@ strapi.controller('plugin::plugin-name.controller-name')
3054130541

3054230542

3054330543
## Calling a plugin service from a controller
30544-
Description: The most common pattern: a controller delegates to its own plugin's service.
30544+
Description: The most common pattern: a controller delegates to its own plugin's service:
3054530545
(Source: https://docs.strapi.io/cms/plugins-development/server-getters-usage#calling-a-plugin-service-from-a-controller)
3054630546

3054730547
Language: JavaScript
@@ -30600,7 +30600,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => ({
3060030600

3060130601

3060230602
## Calling a plugin service from bootstrap
30603-
Description: Services called in bootstrap() have access to the full strapi instance, including other plugins' services.
30603+
Description: Services called in bootstrap() have access to the full strapi instance, including other plugins' services:
3060430604
(Source: https://docs.strapi.io/cms/plugins-development/server-getters-usage#calling-a-plugin-service-from-bootstrap)
3060530605

3060630606
Language: JavaScript
@@ -30713,21 +30713,26 @@ Language: JavaScript
3071330713
File path: N/A
3071430714

3071530715
```js
30716-
// highlight-start
30717-
const maxItems = strapi.plugin('todo').config('maxItems'); // read a single key
30718-
const todoConfig = strapi.config.get('plugin::todo'); // read the full config object
30719-
const endpoint = strapi.config.get('plugin::todo.endpoint'); // read a nested key
30720-
// highlight-end
30716+
// Read a single key
30717+
const maxItems = strapi.plugin('todo').config('maxItems');
3072130718
```
3072230719

3072330720
---
30724-
Language: TypeScript
30721+
Language: JavaScript
3072530722
File path: N/A
3072630723

30727-
```ts
30728-
const maxItems = strapi.plugin('todo').config('maxItems') as number;
30729-
const todoConfig = strapi.config.get('plugin::todo') as Record<string, unknown>;
30730-
const endpoint = strapi.config.get('plugin::todo.endpoint') as string;
30724+
```js
30725+
// Read the full config object
30726+
const todoConfig = strapi.config.get('plugin::todo');
30727+
```
30728+
30729+
---
30730+
Language: JavaScript
30731+
File path: N/A
30732+
30733+
```js
30734+
// Read a nested key
30735+
const endpoint = strapi.config.get('plugin::todo.endpoint');
3073130736
```
3073230737

3073330738

@@ -30739,8 +30744,8 @@ Language: JavaScript
3073930744
File path: N/A
3074030745

3074130746
```js
30742-
// highlight-next-line
30743-
const schema = strapi.contentType('plugin::todo.task'); // access the content-type schema
30747+
// Access the content-type schema
30748+
const schema = strapi.contentType('plugin::todo.task');
3074430749

3074530750
const sanitizedOutput = await strapi.contentAPI.sanitize.output(
3074630751
data,
@@ -31141,6 +31146,7 @@ module.exports = [
3114131146
path: '/articles',
3114231147
handler: 'article.create',
3114331148
config: {
31149+
// highlight-next-line
3114431150
middlewares: ['plugin::my-plugin.logRequest'],
3114531151
},
3114631152
},
@@ -31240,7 +31246,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => {
3124031246
Source: https://docs.strapi.io/cms/plugins-development/server-routes
3124131247

3124231248
## Array format
31243-
Description: The simplest format: export an array of route objects directly.
31249+
Description: The array format is the most basic format: it exports an array of route objects directly.
3124431250
(Source: https://docs.strapi.io/cms/plugins-development/server-routes#array-format)
3124531251

3124631252
Language: JavaScript
@@ -31296,7 +31302,7 @@ export default [
3129631302

3129731303

3129831304
## Named router format
31299-
Description: Use an object with named keys (admin, content-api, or any custom name) to declare separate router groups.
31305+
Description: With the named router format, use an object with named keys (admin, content-api, or any custom name) to declare separate router groups.
3130031306
(Source: https://docs.strapi.io/cms/plugins-development/server-routes#named-router-format)
3130131307

3130231308
Language: JavaScript

docusaurus/static/llms-full.txt

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11307,7 +11307,7 @@ All server code can technically live in the single entry file, but splitting eac
1130711307

1130811308
:::note Notes
1130911309
* The entry file accepts either an object literal or a function that receives `{ strapi }` and returns the same object shape. The function form is useful when you need a reference to the Strapi instance at declaration time.
11310-
* `config` is a configuration object, not an executable lifecycle hook. Unlike `register()`, `bootstrap()`, or `destroy()`, it is not called as a function during the plugin lifecycle. It is loaded at startup and used to set defaults and validate user configuration.
11310+
* `config` is a configuration object, not an executable lifecycle hook. Unlike `register()`, `bootstrap()`, or `destroy()`, it is not called as a function during the plugin lifecycle. It is loaded at startup and used to set defaults and validate user configuration. See [server lifecycle](/cms/plugins-development/server-lifecycle) for more information.
1131111311
:::
1131211312

1131311313
## Available actions
@@ -11335,7 +11335,7 @@ Use the following table to find which capability matches your goal:
1133511335
The following cards link directly to each dedicated page:
1133611336

1133711337
:::strapi Backend customization
11338-
Plugin routes, controllers, services, policies, and middlewares follow the same conventions as [backend customization](/cms/backend-customization) in a standard Strapi application. The Server API wraps these into the plugin namespace automatically see [Content-types](/cms/plugins-development/server-content-types#uids-and-naming-conventions) for details on UIDs and naming conventions.
11338+
Plugin routes, controllers, services, policies, and middlewares follow the same conventions as [backend customization](/cms/backend-customization) in a standard Strapi application. The Server API wraps these into the plugin namespace automatically (see [server content types](/cms/plugins-development/server-content-types#uids-and-naming-conventions) for details on UIDs and naming conventions).
1133911339
:::
1134011340

1134111341

@@ -11421,7 +11421,7 @@ This UID is used consistently across all APIs:
1142111421
Controllers, services, policies, and middlewares use the same `plugin::<plugin-name>.<resource-name>` UID format for global getters, but are referenced by their short registry key (e.g., `'article'`) within plugin-level APIs such as route `handler` and `policies`. See [Getters & usage](/cms/plugins-development/server-getters-usage) for details.
1142211422
:::
1142311423

11424-
## Accessing content-types at runtime
11424+
## Access at runtime
1142511425

1142611426
### Querying with the Document Service API
1142711427

@@ -11471,7 +11471,7 @@ Controllers and services are the 2 building blocks that handle request processin
1147111471

1147211472
When your plugin exposes Content API routes, sanitize query parameters and output data before returning them. This prevents leaking private fields or bypassing access rules.
1147311473

11474-
Plugin controllers are plain factory functions and do not extend `createCoreController`. This means the `this.sanitizeQuery` and `this.sanitizeOutput` shorthands are not available. Use `strapi.contentAPI.sanitize` directly instead, passing the content-type schema explicitly:
11474+
Plugin controllers are plain factory functions and do not extend `createCoreController` like in the Strapi core (see [backend customization](/cms/backend-customization/controllers) for details). This means the `this.sanitizeQuery` and `this.sanitizeOutput` shorthands are not available. Use `strapi.contentAPI.sanitize` directly instead, passing the content-type schema explicitly:
1147511475

1147611476
</Tabs>
1147711477

@@ -11528,7 +11528,7 @@ Plugin server resources, such as controllers, services, policies, middlewares, a
1152811528

1152911529
### Calling a plugin service from bootstrap
1153011530

11531-
Services called in `bootstrap()` have access to the full `strapi` instance, including other plugins' services.
11531+
Services called in `bootstrap()` have access to the full `strapi` instance, including other plugins' services:
1153211532

1153311533
</Tabs>
1153411534

@@ -11540,7 +11540,20 @@ From application-level controllers or services (outside the plugin), or when cal
1154011540

1154111541
### Reading plugin configuration at runtime
1154211542

11543-
</Tabs>
11543+
```js
11544+
// Read a single key
11545+
const maxItems = strapi.plugin('todo').config('maxItems');
11546+
```
11547+
11548+
```js
11549+
// Read the full config object
11550+
const todoConfig = strapi.config.get('plugin::todo');
11551+
```
11552+
11553+
```js
11554+
// Read a nested key
11555+
const endpoint = strapi.config.get('plugin::todo.endpoint');
11556+
```
1154411557

1154511558
:::note
1154611559
`strapi.plugin('my-plugin').config('key')` reads the merged configuration (user overrides applied on top of plugin defaults). It is the recommended way to read config inside plugin code. See [Server configuration](/cms/plugins-development/server-configuration) for how plugin configuration is declared and merged.
@@ -11562,10 +11575,10 @@ Use the content-type getter when you need the schema object, for example to pass
1156211575

1156311576
- **Using an incomplete UID in global getters.** `strapi.service('todo.task')` is not a valid plugin UID. Use the full `plugin::todo.task` form. Without the proper namespace, the service call fails or returns `undefined` at runtime.
1156411577

11565-
| Scope | Example UID |
11566-
| --- | --- |
11567-
| Plugin service | `plugin::todo.task` |
11568-
| API service | `api::project.project` |
11578+
| Scope | Example UID |
11579+
| --- | --- |
11580+
| Plugin service | `plugin::todo.task` |
11581+
| API service | `api::project.project` |
1156911582

1157011583
## Best practices
1157111584

@@ -11656,7 +11669,7 @@ For the full policy reference including GraphQL support and the `policyContext`
1165611669

1165711670
## Middlewares
1165811671

11659-
A middleware is a Koa-style function that wraps the request/response cycle. Unlike policies (which are pass/fail guards), middlewares can read and modify the request before it reaches the controller, and modify the response after the controller has executed.
11672+
A middleware is a Koa-style function that wraps the request/response cycle. Unlike [policies](#policies) (which are pass/fail guards), middlewares can read and modify the request before it reaches the controller, and modify the response after the controller has executed.
1166011673

1166111674
Plugins can export middlewares in 2 ways:
1166211675

@@ -11720,7 +11733,7 @@ Routes expose your plugin's HTTP endpoints and map incoming requests to controll
1172011733

1172111734
### Named router format
1172211735

11723-
Use an object with named keys (`admin`, `content-api`, or any custom name) to declare separate router groups. Each group is a router object with a `type`, optional `prefix`, and a `routes` array. Use this format when your plugin exposes both admin and Content API routes.
11736+
With the named router format, use an object with named keys (`admin`, `content-api`, or any custom name) to declare separate router groups. Each group is a router object with a `type`, optional `prefix`, and a `routes` array. Use this format when your plugin exposes both admin and Content API routes.
1172411737

1172511738
</Tabs>
1172611739

@@ -11790,7 +11803,7 @@ For configuration examples including policies, public routes, dynamic URL parame
1179011803

1179111804
- **Use the named router format when exposing both admin and Content API endpoints.** It makes the intent of each route explicit and avoids relying on the `type` default, which can be surprising.
1179211805

11793-
- **Keep `handler` as a string.** String handlers get automatic auth scope generation. Function handlers do not: authentication still runs for both string and function handlers unless you set `config.auth: false`, but only string handlers get automatic `config.auth.scope`. If you use a function handler and need route-level permission scoping, define `config.auth.scope` explicitly.
11806+
- **Keep `handler` as a string.** String handlers get automatic auth scope generation, function handlers do not. Authentication still runs for both string and function handlers unless you set `config.auth: false`, but only string handlers get automatic `config.auth.scope`. If you use a function handler and need route-level permission scoping, define `config.auth.scope` explicitly.
1179411807

1179511808
- **Scope policies to their namespace.** When referencing a plugin policy in a route, use the full `plugin::my-plugin.policy-name` form. This avoids ambiguity if a policy with the same short name exists elsewhere in the application.
1179611809

docusaurus/static/llms.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@
119119
- [Plugin structure](https://docs.strapi.io/cms/plugins-development/plugin-structure): Learn more about the structure of a Strapi plugin
120120
- [Plugins extension](https://docs.strapi.io/cms/plugins-development/plugins-extension): Existing plugins can be overriden by placing code in /src/extensions or using global register/bootstrap hooks. Instructions in this documentation cover reshaping plugin content-type schemas or server logic — altough upstream updates may break extensions.
121121
- [Server API for plugins](https://docs.strapi.io/cms/plugins-development/server-api): The Server API defines what a plugin registers, exposes, and executes on the Strapi server. It covers lifecycle hooks, routes, controllers, services, policies, middlewares, and configuration. Use the entry file to declare what the plugin contributes, then navigate to the dedicated pages below for each capability.
122-
- [Server configuration](https://docs.strapi.io/cms/plugins-development/server-configuration): Expose a config object with a default property and a validator function. Strapi deep-merges the defaults with the user's config/plugins file, then runs validation before the plugin loads. Read configuration at runtime with strapi.plugin('my-plugin').config('key').
123-
- [Server content-types](https://docs.strapi.io/cms/plugins-development/server-content-types): Export a contentTypes object from the server entry file to declare plugin content-types. Each key must match the content-type's info.singularName. The UID follows the plugin:: . convention and is used to query, sanitize, and reference the content-type at runtime.
124-
- [Server controllers & services](https://docs.strapi.io/cms/plugins-development/server-controllers-services): Controllers handle the HTTP layer: they receive ctx, call services, and return responses. Services hold reusable business logic and interact with content-types through the Document Service API. Keep controllers thin and put domain logic in services.
125-
- [Server getters & usage](https://docs.strapi.io/cms/plugins-development/server-getters-usage): Access plugin resources through top-level getters (strapi.plugin('my-plugin').service('name')) or global getters (strapi.service('plugin::my-plugin.name')). Both return the same object. Use top-level getters inside your own plugin, and global getters from application code or other plugins. Routes have no global getter equivalent. Configuration uses dedicated config APIs.
126-
- [Server lifecycle](https://docs.strapi.io/cms/plugins-development/server-lifecycle): Use register() to declare capabilities before the app is fully initialized, bootstrap() to run logic once Strapi is initialized, and destroy() to clean up resources on shutdown. Each function receives { strapi } as its argument.
127-
- [Server policies & middlewares](https://docs.strapi.io/cms/plugins-development/server-policies-middlewares): Policies run before a controller action and return true or false to allow or block the request. Middlewares run in sequence around the full request/response cycle and call next() to continue. Declare policies and middlewares as objects of factory functions and reference them by their plugin-namespaced name in routes.
128-
- [Server routes](https://docs.strapi.io/cms/plugins-development/server-routes): Export a routes value from the server entry file to expose plugin endpoints. Use the array format for simple cases, the named router format to separate admin and Content API routes, or the factory callback format for dynamic route configuration.
122+
- [Server configuration](https://docs.strapi.io/cms/plugins-development/server-configuration): The Server API exposes a config object with a default property and a validator function. Strapi deep-merges the defaults with the user's config/plugins file, then runs validation before the plugin loads. Read configuration at runtime with strapi.plugin('my-plugin').config('key').
123+
- [Server content-types](https://docs.strapi.io/cms/plugins-development/server-content-types): The Server API exports a contentTypes object from the server entry file to declare plugin content-types. The UID follows the plugin:: . convention and is used to query, sanitize, and reference the content-type at runtime.
124+
- [Server controllers & services](https://docs.strapi.io/cms/plugins-development/server-controllers-services): Just like the Strapi core, plugins can have controllers and services. Plugin controllers handle the HTTP layer: they receive ctx, call services, and return responses. Plugin services hold reusable business logic and interact with content-types through the Document Service API. Keep controllers thin and put domain logic in services.
125+
- [Server getters & usage](https://docs.strapi.io/cms/plugins-development/server-getters-usage): Access plugin resources through top-level getters (strapi.plugin('my-plugin').service('name')) or global getters (strapi.service('plugin::my-plugin.name')). Both return the same object. Use top-level getters inside your own plugin, and global getters from application code or other plugins. Routes have no global getter equivalent. Configuration uses dedicated configuration APIs.
126+
- [Server lifecycle](https://docs.strapi.io/cms/plugins-development/server-lifecycle): The Server API has 3 lifecycle functions. Use register() to declare capabilities before the app is fully initialized, bootstrap() to run logic once Strapi is initialized, and destroy() to clean up resources on shutdown. Each function receives { strapi } as its argument.
127+
- [Server policies & middlewares](https://docs.strapi.io/cms/plugins-development/server-policies-middlewares): Just like the Strapi core, plugins can have policies and middlewares. Plugin policies run before a controller action and return true or false to allow or block the request. Plugin middlewares run in sequence around the full request/response cycle and call next() to continue. Declare policies and middlewares as objects of factory functions and reference them by their plugin-namespaced name in routes.
128+
- [Server routes](https://docs.strapi.io/cms/plugins-development/server-routes): The Server API exports a routes value from the server entry file to expose plugin endpoints. Use the array format for simple cases, the named router format to separate admin and Content API routes, or the factory callback format for dynamic route configuration.
129129
- [Documentation plugin](https://docs.strapi.io/cms/plugins/documentation): The Documentation plugin auto-generates OpenAPI/Swagger docs for your API by scanning content types and routes. This documentation walks you through installation, customizing settings, and restricting access to the docs.
130130
- [GraphQL plugin](https://docs.strapi.io/cms/plugins/graphql): The GraphQL plugin adds a GraphQL endpoint and Apollo-based sandbox for crafting queries and mutations. Options in config/plugins let you tune depth, item limits, and other Apollo Server settings which are explained in this documentation.
131131
- [Installing Plugins via the Marketplace](https://docs.strapi.io/cms/plugins/installing-plugins-via-marketplace): The in-app Marketplace lists plugins and providers with badges, search, and “More” links to detailed Strapi Market pages. This documentation outlines browsing cards and following provider-specific instructions to install new integrations.

0 commit comments

Comments
 (0)