diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..9f11b755a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/docusaurus/docs/dev-docs/typescript/development.md b/docusaurus/docs/dev-docs/typescript/development.md index 5e815d4afd..a2181acfc1 100644 --- a/docusaurus/docs/dev-docs/typescript/development.md +++ b/docusaurus/docs/dev-docs/typescript/development.md @@ -2,25 +2,27 @@ title: TypeScript development description: Learn more about TypeScript usage with Strapi 5 tags: -- strapi() factory -- strapi.compile() function -- typescript -- plugins development - + - strapi() factory + - strapi.compile() function + - typescript + - plugins development + - api + - guides --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' +# TypeScript Development with Strapi + +This page provides a comprehensive guide to developing with TypeScript in Strapi v5, covering key patterns and configurations for integrating TypeScript effectively. You'll find sections on using Strapi’s provided types, generating and managing typings for content types, configuring Strapi programmatically, and building plugins with TypeScript. Each section includes practical steps and example code to help you set up and troubleshoot TypeScript-based workflows in your Strapi project. -# TypeScript Development with Strapi +:::strapi API reference +We are preparing an API reference page, which will include an exhaustive list of the types exported by Strapi. Please come back soon! 👀 +::: - +## :books: Guides -While developing a [TypeScript](/dev-docs/typescript)-based application with Strapi, you can: +The guides are a curated list of common examples in which you might need to use Strapi types in your application. -- access [typings for the `Strapi`](#use-strapi-typescript-typings) class with autocompletion, -- [generate typings](#generate-typings-for-content-types-schemas) for your project's content-types, -- [start Strapi programmatically](#start-strapi-programmatically), -- and follow some TypeScript-specific instructions for [plugins development](#develop-a-plugin-using-typescript). +You can find the list of available guides [here](/dev-docs/typescript/development/guides). ## Use `Strapi` TypeScript typings @@ -31,15 +33,15 @@ To experience TypeScript-based autocomplete while developing Strapi applications 1. Open the `./src/index.ts` file from your code editor. 2. Declare the `strapi` argument as type `Strapi` within the global `register` method: - ```typescript title="./src/index.ts" - import { Strapi } from '@strapi/strapi'; + ```typescript title="./src/index.ts" + import type { Core } from '@strapi/strapi'; - export default { - register({ strapi }: { strapi: Strapi }) { - // ... - }, - }; - ``` + export default { + register({ strapi }: { strapi: Core.Strapi }) { + // ... + }, + }; + ``` 3. Within the body of the `register` method, start typing `strapi.` and use keyboard arrows to browse the available properties. @@ -116,10 +118,9 @@ To start Strapi programmatically in a TypeScript project the Strapi instance req Strapi can be run programmatically by using the `strapi.createStrapi()` factory. Since the code of TypeScript projects is compiled in a specific directory, the parameter `distDir` should be passed to the factory to indicate where the compiled code should be read: ```js title="./server.js" - const strapi = require('@strapi/strapi'); const app = strapi.createStrapi({ distDir: './dist' }); -app.start(); +app.start(); ``` ### Use the `strapi.compile()` function @@ -129,7 +130,7 @@ The `strapi.compile()` function should be mostly used for developing tools that ```js const strapi = require('@strapi/strapi'); -strapi.compile().then(appContext => strapi(appContext).start()); +strapi.compile().then((appContext) => strapi(appContext).start()); ``` ## Develop a plugin using TypeScript diff --git a/docusaurus/docs/dev-docs/typescript/development/api-reference.md b/docusaurus/docs/dev-docs/typescript/development/api-reference.md new file mode 100644 index 0000000000..58486e18b7 --- /dev/null +++ b/docusaurus/docs/dev-docs/typescript/development/api-reference.md @@ -0,0 +1,12 @@ +--- +title: TypeScript - API Reference +sidebar_label: API Reference +description: API Reference for Strapi Type System +tags: + - typescript + - api +--- + +# API Reference + +:building_construction: **Still under construction, come back later** :construction: diff --git a/docusaurus/docs/dev-docs/typescript/development/guides.md b/docusaurus/docs/dev-docs/typescript/development/guides.md new file mode 100644 index 0000000000..db67c57c2d --- /dev/null +++ b/docusaurus/docs/dev-docs/typescript/development/guides.md @@ -0,0 +1,18 @@ +--- +title: TypeScript - Guides +sidebar_label: Guides +description: List of TypeScript guides to get started with Strapi and TypeScript +tags: + - typescript + - guides +--- + +# TypeScript Guides + +This page includes a curated list of common examples useful to use types while [developing a Strapi TypeScript application](/dev-docs/typescript/development). + + + + + + diff --git a/docusaurus/docs/dev-docs/typescript/development/guides/documents-and-entries.md b/docusaurus/docs/dev-docs/typescript/development/guides/documents-and-entries.md new file mode 100644 index 0000000000..ec288d7b2f --- /dev/null +++ b/docusaurus/docs/dev-docs/typescript/development/guides/documents-and-entries.md @@ -0,0 +1,214 @@ +--- +title: TypeScript - Manipulating Documents and Entries +sidebar_label: Manipulating Documents and Entries +description: TypeScript guide to get started with manipulating documents and entries +tags: + - typescript + - guides + - data + - document + - component + - uid + - entries +--- + +# Manipulating documents and entries + +This guide will explore TypeScript patterns for manipulating documents and entries in a Strapi v5 application, including how to leverage Strapi's `UID` and `Data` namespaces to interact with both generic and known entity types safely. If you're working on a TypeScript-based Strapi project, mastering these approaches will help you take full advantage of type safety and code completion, ensuring robust, error-free interactions with your application’s content and components. + +:::prerequisites + +- **Strapi Application:** A Strapi v5 application. If you don't have one, follow the [documentation](/dev-docs/quick-start) to get started. +- **TypeScript:** Ensure TypeScript is set up in your Strapi project. You can follow Strapi's [official guide](/dev-docs/typescript#getting-started-with-typescript-in-strapi) on configuring TypeScript. +- **Generated Types:** Application types [have been generated](/dev-docs/typescript/development#generate-typings-for-content-types-schemas) and are accessible. + ::: + +## Type Imports + +The `UID` namespace contains literal unions representing the available resources in the application. + +```typescript +import type { UID } from '@strapi/strapi'; +``` + +- `UID.ContentType` represents a union of every content-type identifier in the application +- `UID.Component` represents a union of every component identifier in the application +- `UID.Schema` represents a union of every schema (content-type or component) identifier in the application +- And others... + +--- + +Strapi provides a `Data` namespace containing several built-in types for entity representation. + +```typescript +import type { Data } from '@strapi/strapi'; +``` + +- `Data.ContentType` represents a Strapi document object +- `Data.Component` represents a Strapi component object +- `Data.Entity` represents either a document or a component + +:::tip +Both the entities' type definitions and UIDs are based on the generated schema types for your application. + +In case of a mismatch or error, you can always [regenerate the types](/dev-docs/typescript/development#generate-typings-for-content-types-schemas). +::: + +## Usage + +### Generic entities + +When dealing with generic data, it is recommended to use non-parametrized forms of the `Data` types. + +#### Generic documents + +```typescript +async function save(name: string, document: Data.ContentType) { + await writeCSV(name, document); + // ^ { + // id: Data.ID; + // documentId: string; + // createdAt?: DateTimeValue; + // updatedAt?: DateTimeValue; + // publishedAt?: DateTimeValue; + // ... + // } +} +``` + +:::warning +In the preceding example, the resolved properties for `document` are those common to every content-type. + +Other properties have to be checked manually using type guards. + +```typescript +if ('my_prop' in document) { + return document.my_prop; +} +``` + +::: + +#### Generic components + +```typescript +function renderComponent(parent: Node, component: Data.Component) { + const elements: Element[] = []; + const properties = Object.entries(component); + + for (const [name, value] of properties) { + // ^ ^ + // string any + const paragraph = document.createElement('p'); + + paragraph.textContent = `Key: ${name}, Value: ${value}`; + + elements.push(paragraph); + } + + parent.append(...elements); +} +``` + +### Known entities + +When manipulating known entities, it is possible to parametrize `Data` types for better type safety and code completion. + +#### Known documents + +```typescript +const ALL_CATEGORIES = ['food', 'tech', 'travel']; + +function validateArticle(article: Data.ContentType<'api::article.article'>) { + const { title, category } = article; + // ^? ^? + // string Data.ContentType<'api::category.category'> + + if (title.length < 5) { + throw new Error('Title too short'); + } + + if (!ALL_CATEGORIES.includes(category.name)) { + throw new Error(`Unknown category ${category.name}`); + } +} +``` + +#### Known components + +```typescript +function processUsageMetrics( + id: string, + metrics: Data.Component<'app.metrics'> +) { + telemetry.send(id, { clicks: metrics.clicks, views: metrics.views }); +} +``` + +### Advanced use cases + +#### Entities subsets + +Using the types' second parameter (`TKeys`), it is possible to obtain a subset of an entity. + +```typescript +type Credentials = Data.ContentType<'api::acount.acount', 'email' | 'password'>; +// ^? { email: string; password: string } +``` + +```typescript +type UsageMetrics = Data.Component<'app.metrics', 'clicks' | 'views'>; +// ^? { clicks: number; views: number } +``` + +#### Type argument inference + +It is possible to bind and restrict an entity type based on other function parameters. + +In the following example, the `uid` type is inferred upon usage as `T` and used as a type parameter for the `document`. + +```typescript +import type { UID } from '@strapi/strapi'; + +function display( + uid: T, + document: Data.ContentType +) { + switch (uid) { + case 'api::article.article': { + return document.title; + // ^? string + // ^? Data.ContentType<'api::article.article'> + } + case 'api::category.category': { + return document.name; + // ^? string + // ^? Data.ContentType<'api::category.category'> + } + case 'api::account.account': { + return document.email; + // ^? string + // ^? Data.ContentType<'api::account.account'> + } + default: { + throw new Error(`unknown content-type uid: "${uid}"`); + } + } +} +``` + +When calling the function, the `document` type needs to match the given `uid`. + +```typescript +declare const article: Data.Document<'api::article.article'>; +declare const category: Data.Document<'api::category.category'>; +declare const account: Data.Document<'api::account.account'>; + +display('api::article.article', article); +display('api::category.category', category); +display('api::account.account', account); +// ^ ✅ + +display('api::article.article', category); +// ^ Error: "category" is not assignable to parameter of type ContentType<'api::article.article'> +``` diff --git a/docusaurus/sidebars.js b/docusaurus/sidebars.js index 816585536d..0183115f85 100644 --- a/docusaurus/sidebars.js +++ b/docusaurus/sidebars.js @@ -15,11 +15,12 @@ /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { devDocsSidebar: [ - { // Getting Started + { + // Getting Started type: 'category', collapsed: false, label: '🚀 Getting Started', - link: {type: 'doc', id: 'dev-docs/intro'}, + link: { type: 'doc', id: 'dev-docs/intro' }, items: [ { type: 'doc', @@ -40,15 +41,16 @@ const sidebars = { id: 'dev-docs/whats-new', label: "What's new?", customProps: { - udpated: true - } + updated: true, + }, }, 'dev-docs/faq', 'dev-docs/community', 'dev-docs/usage-information', - ] + ], }, - { // Setup & Deployment + { + // Setup & Deployment type: 'category', collapsed: false, label: '⚙️ Setup & Deployment', @@ -65,7 +67,7 @@ const sidebars = { { type: 'category', label: 'Installation', - link: {type: 'doc', id: 'dev-docs/installation'}, + link: { type: 'doc', id: 'dev-docs/installation' }, customProps: { updated: true, }, @@ -83,7 +85,7 @@ const sidebars = { }, }, 'dev-docs/installation/docker', - ] + ], }, 'dev-docs/project-structure', { @@ -123,7 +125,7 @@ const sidebars = { id: 'dev-docs/deployment', }, items: [ - { + { type: 'doc', label: 'Introduction to deployment', id: 'dev-docs/deployment', @@ -133,15 +135,16 @@ const sidebars = { label: '☁️ Strapi Cloud', id: 'cloud/getting-started/deployment', }, - ] - } - ] + ], + }, + ], }, - { // Content APIs + { + // Content APIs type: 'category', collapsed: false, label: '📦 Content API', - link: {type: 'doc', id: 'dev-docs/api/content-api'}, + link: { type: 'doc', id: 'dev-docs/api/content-api' }, items: [ { type: 'doc', @@ -159,7 +162,7 @@ const sidebars = { }, link: { type: 'doc', - id: 'dev-docs/api/rest' + id: 'dev-docs/api/rest', }, items: [ { @@ -174,7 +177,7 @@ const sidebars = { 'dev-docs/api/rest/relations', 'dev-docs/api/rest/interactive-query-builder', 'dev-docs/api/rest/guides/intro', - ] + ], }, { type: 'doc', @@ -222,68 +225,69 @@ const sidebars = { label: 'Document Service API', link: { type: 'doc', - id: 'dev-docs/api/document-service' + id: 'dev-docs/api/document-service', }, customProps: { - new: true + new: true, }, items: [ { type: 'doc', label: 'Introduction & Concepts', - id: 'dev-docs/api/document' + id: 'dev-docs/api/document', }, { type: 'doc', label: 'Available methods', - id: 'dev-docs/api/document-service' + id: 'dev-docs/api/document-service', }, { type: 'doc', label: 'Filters', - id: 'dev-docs/api/document-service/filters' + id: 'dev-docs/api/document-service/filters', }, { type: 'doc', label: 'Populate', - id: 'dev-docs/api/document-service/populate' + id: 'dev-docs/api/document-service/populate', }, { type: 'doc', label: 'Fields', - id: 'dev-docs/api/document-service/fields' + id: 'dev-docs/api/document-service/fields', }, { type: 'doc', label: 'Sort & Pagination', - id: 'dev-docs/api/document-service/sort-pagination' + id: 'dev-docs/api/document-service/sort-pagination', }, { type: 'doc', label: 'Locale', - id: 'dev-docs/api/document-service/locale' + id: 'dev-docs/api/document-service/locale', }, { type: 'doc', label: 'Status', - id: 'dev-docs/api/document-service/status' + id: 'dev-docs/api/document-service/status', }, { type: 'doc', label: 'Middlewares', - id: 'dev-docs/api/document-service/middlewares' + id: 'dev-docs/api/document-service/middlewares', }, - ] + ], }, - ] + ], }, - { // Advanced features + { + // Advanced features type: 'category', label: '🔧 Advanced features', collapsed: false, link: { type: 'doc', - id: 'dev-docs/advanced-features' + id: 'dev-docs/advanced-features', }, items: [ { @@ -314,13 +318,33 @@ const sidebars = { label: 'TypeScript', link: { type: 'doc', - id: 'dev-docs/typescript' + id: 'dev-docs/typescript', }, items: [ 'dev-docs/typescript', - 'dev-docs/typescript/development', + { + type: 'category', + label: 'TypeScript development', + link: { + type: 'doc', + id: 'dev-docs/typescript/development', + }, + items: [ + { + type: 'category', + label: 'Guides', + link: { + type: 'doc', + id: 'dev-docs/typescript/development/guides', + }, + items: [ + 'dev-docs/typescript/development/guides/documents-and-entries', + ], + }, + ], + }, 'dev-docs/typescript/adding-support-to-existing-project', - ] + ], }, { type: 'doc', @@ -333,7 +357,7 @@ const sidebars = { id: 'dev-docs/templates', customProps: { updated: true, - } + }, }, { type: 'category', @@ -354,16 +378,17 @@ const sidebars = { type: 'doc', label: 'Data transfer', id: 'dev-docs/data-management/transfer', - } + }, ], }, 'dev-docs/database-migrations', 'dev-docs/database-transactions', 'dev-docs/testing', 'dev-docs/error-handling', - ] + ], }, - { // Customization + { + // Customization type: 'category', collapsed: false, label: '🛠 Customization', @@ -388,7 +413,7 @@ const sidebars = { }, link: { type: 'doc', - id: 'dev-docs/backend-customization' + id: 'dev-docs/backend-customization', }, items: [ { @@ -407,7 +432,7 @@ const sidebars = { 'dev-docs/backend-customization/services', 'dev-docs/backend-customization/models', 'dev-docs/backend-customization/webhooks', - ] + ], }, { type: 'category', @@ -431,11 +456,12 @@ const sidebars = { 'dev-docs/admin-panel-customization/wysiwyg-editor', 'dev-docs/admin-panel-customization/extension', 'dev-docs/admin-panel-customization/deployment', - ] + ], }, - ] + ], }, - { // Plugins + { + // Plugins type: 'category', collapsed: false, label: '🔌 Plugins', @@ -447,20 +473,20 @@ const sidebars = { { type: 'doc', label: 'Plugins Introduction & Concepts', - id: 'dev-docs/plugins' + id: 'dev-docs/plugins', }, { type: 'category', label: 'Using plugins', link: { type: 'doc', - id: 'dev-docs/plugins/using-plugins' + id: 'dev-docs/plugins/using-plugins', }, items: [ { type: 'doc', label: 'Introduction to using plugins', - id: 'dev-docs/plugins/using-plugins' + id: 'dev-docs/plugins/using-plugins', }, { type: 'doc', @@ -493,7 +519,7 @@ const sidebars = { label: 'Users & Permissions', id: 'dev-docs/plugins/users-permissions', }, - ] + ], }, { type: 'category', @@ -509,7 +535,7 @@ const sidebars = { { type: 'doc', label: 'Introduction to developing plugins', - id: 'dev-docs/plugins/developing-plugins' + id: 'dev-docs/plugins/developing-plugins', }, 'dev-docs/plugins/development/create-a-plugin', { @@ -550,8 +576,8 @@ const sidebars = { customProps: { new: true, }, - } - ] + }, + ], }, { type: 'doc', @@ -571,13 +597,14 @@ const sidebars = { 'dev-docs/plugins/guides/store-and-access-data', 'dev-docs/plugins/guides/pass-data-from-server-to-admin', 'dev-docs/plugins/development/create-a-plugin', - ] - } - ] - } - ] + ], + }, + ], + }, + ], }, - { // Update & Migration + { + // Update & Migration type: 'category', collapsed: false, label: '♻️ Upgrades', @@ -603,19 +630,19 @@ const sidebars = { collapsed: false, link: { type: 'doc', - id: 'dev-docs/migration/v4-to-v5/introduction-and-faq' + id: 'dev-docs/migration/v4-to-v5/introduction-and-faq', }, label: 'Upgrade to Strapi 5', items: [ { type: 'doc', label: 'Introduction and FAQ', - id: 'dev-docs/migration/v4-to-v5/introduction-and-faq' + id: 'dev-docs/migration/v4-to-v5/introduction-and-faq', }, { type: 'doc', label: 'Step-by-step guide', - id: 'dev-docs/migration/v4-to-v5/step-by-step' + id: 'dev-docs/migration/v4-to-v5/step-by-step', }, { type: 'doc', @@ -627,8 +654,8 @@ const sidebars = { label: 'Specific resources', id: 'dev-docs/migration/v4-to-v5/additional-resources/introduction', }, - ] - } + ], + }, ], }, ], @@ -638,8 +665,8 @@ const sidebars = { collapsed: false, label: 'Getting Started', link: { - type: "doc", - id: "user-docs/intro", + type: 'doc', + id: 'user-docs/intro', }, items: [ 'user-docs/intro', @@ -652,7 +679,7 @@ const sidebars = { collapsed: false, link: { type: 'doc', - id: 'user-docs/content-manager/introduction-to-content-manager' + id: 'user-docs/content-manager/introduction-to-content-manager', }, label: 'Content Manager', items: [ @@ -664,7 +691,7 @@ const sidebars = { id: 'user-docs/content-manager/working-with-content-history', customProps: { new: true, - } + }, }, 'user-docs/content-manager/managing-relational-fields', 'user-docs/content-manager/translating-content', @@ -674,7 +701,7 @@ const sidebars = { id: 'user-docs/content-manager/saving-and-publishing-content', customProps: { updated: true, - } + }, }, 'user-docs/content-manager/adding-content-to-releases', ], @@ -684,38 +711,38 @@ const sidebars = { collapsed: false, label: 'Content-type Builder', link: { - type: "doc", - id: "user-docs/content-type-builder/introduction-to-content-types-builder", + type: 'doc', + id: 'user-docs/content-type-builder/introduction-to-content-types-builder', }, items: [ { type: 'autogenerated', - dirName: 'user-docs/content-type-builder' - } - ] + dirName: 'user-docs/content-type-builder', + }, + ], }, { type: 'category', collapsed: false, label: 'Media Library', link: { - type: "doc", - id: "user-docs/media-library/introduction-to-the-media-library", + type: 'doc', + id: 'user-docs/media-library/introduction-to-the-media-library', }, items: [ { type: 'autogenerated', - dirName: 'user-docs/media-library' - } - ] + dirName: 'user-docs/media-library', + }, + ], }, { - type: "category", + type: 'category', collapsed: false, - label: "Releases", + label: 'Releases', link: { - type: "doc", - id: "user-docs/releases/introduction", + type: 'doc', + id: 'user-docs/releases/introduction', }, items: [ 'user-docs/releases/introduction', @@ -728,50 +755,50 @@ const sidebars = { collapsed: false, label: 'Users, Roles & Permissions', link: { - type: "doc", - id: "user-docs/users-roles-permissions/introduction-to-users-roles-permissions", + type: 'doc', + id: 'user-docs/users-roles-permissions/introduction-to-users-roles-permissions', }, items: [ { type: 'autogenerated', - dirName: 'user-docs/users-roles-permissions' - } - ] + dirName: 'user-docs/users-roles-permissions', + }, + ], }, { type: 'category', collapsed: false, label: 'Plugins', link: { - type: "doc", - id: "user-docs/plugins/introduction-to-plugins", + type: 'doc', + id: 'user-docs/plugins/introduction-to-plugins', }, items: [ { type: 'autogenerated', - dirName: 'user-docs/plugins' - } - ] + dirName: 'user-docs/plugins', + }, + ], }, { type: 'category', collapsed: false, label: 'Settings', link: { - type: "doc", - id: "user-docs/settings/introduction", + type: 'doc', + id: 'user-docs/settings/introduction', }, items: [ - 'user-docs/settings/introduction', - 'user-docs/settings/configuring-users-permissions-plugin-settings', - 'user-docs/settings/audit-logs', + 'user-docs/settings/introduction', + 'user-docs/settings/configuring-users-permissions-plugin-settings', + 'user-docs/settings/audit-logs', { type: 'category', collapsed: false, label: 'Configuring global settings', link: { type: 'doc', - id: 'user-docs/settings/introduction' + id: 'user-docs/settings/introduction', }, items: [ 'user-docs/settings/admin-panel', @@ -786,115 +813,115 @@ const sidebars = { }, 'user-docs/settings/single-sign-on', 'user-docs/settings/transfer-tokens', - ] + ], }, ], }, ], cloudSidebar: [ { - type: "category", + type: 'category', collapsed: false, - label: "Getting Started", + label: 'Getting Started', link: { - type: "doc", - id: "cloud/getting-started/intro", + type: 'doc', + id: 'cloud/getting-started/intro', }, items: [ - "cloud/getting-started/intro", + 'cloud/getting-started/intro', { - type: "doc", - label: "Cloud fundamentals", - id: "cloud/getting-started/cloud-fundamentals", + type: 'doc', + label: 'Cloud fundamentals', + id: 'cloud/getting-started/cloud-fundamentals', customProps: { new: false, }, }, { - type: "category", - label: "Project deployment", - link: { type: "doc", id: "cloud/getting-started/deployment-options" }, + type: 'category', + label: 'Project deployment', + link: { type: 'doc', id: 'cloud/getting-started/deployment-options' }, customProps: { updated: false, }, items: [ { - type: "doc", - id: "cloud/getting-started/deployment", + type: 'doc', + id: 'cloud/getting-started/deployment', customProps: { updated: true, }, }, { - type: "doc", - id: "cloud/getting-started/deployment-cli", + type: 'doc', + id: 'cloud/getting-started/deployment-cli', customProps: { new: true, }, - }, + }, ], }, { - type: "doc", - id: "cloud/getting-started/usage-billing", + type: 'doc', + id: 'cloud/getting-started/usage-billing', customProps: { updated: false, }, }, - "cloud/getting-started/caching", + 'cloud/getting-started/caching', { - type: "doc", - label: "Notifications", - id: "cloud/projects/notifications", + type: 'doc', + label: 'Notifications', + id: 'cloud/projects/notifications', }, ], }, { - type: "category", + type: 'category', collapsed: false, - label: "Projects management", + label: 'Projects management', link: { - type: "doc", - id: "cloud/projects/overview", + type: 'doc', + id: 'cloud/projects/overview', }, items: [ - "cloud/projects/overview", + 'cloud/projects/overview', { - type: "doc", - label: "Project settings", - id: "cloud/projects/settings", + type: 'doc', + label: 'Project settings', + id: 'cloud/projects/settings', customProps: { updated: true, }, }, - "cloud/projects/collaboration", - "cloud/projects/runtime-logs", + 'cloud/projects/collaboration', + 'cloud/projects/runtime-logs', ], }, { - type: "category", + type: 'category', collapsed: false, - label: "Deployments", + label: 'Deployments', link: { - type: "doc", - id: "cloud/projects/deploys", + type: 'doc', + id: 'cloud/projects/deploys', }, - items: ["cloud/projects/deploys", "cloud/projects/deploys-history"], + items: ['cloud/projects/deploys', 'cloud/projects/deploys-history'], }, { - type: "category", + type: 'category', collapsed: false, - label: "Account management", + label: 'Account management', link: { - type: "doc", - id: "cloud/account/account-settings", + type: 'doc', + id: 'cloud/account/account-settings', }, items: [ - "cloud/account/account-settings", + 'cloud/account/account-settings', { - type: "doc", - id: "cloud/account/account-billing", - label: "Account billing & invoices", + type: 'doc', + id: 'cloud/account/account-billing', + label: 'Account billing & invoices', customProps: { updated: false, }, @@ -902,18 +929,18 @@ const sidebars = { ], }, { - type: "category", + type: 'category', collapsed: false, - label: "Command Line Interface", + label: 'Command Line Interface', link: { - type: "doc", - id: "cloud/cli/cloud-cli", + type: 'doc', + id: 'cloud/cli/cloud-cli', }, items: [ { - type: "doc", - id: "cloud/cli/cloud-cli", - label: "Strapi Cloud CLI", + type: 'doc', + id: 'cloud/cli/cloud-cli', + label: 'Strapi Cloud CLI', customProps: { updated: true, }, @@ -921,27 +948,27 @@ const sidebars = { ], }, { - type: "category", + type: 'category', collapsed: false, - label: "Advanced configuration", + label: 'Advanced configuration', link: { - type: "doc", - id: "cloud/advanced/database", + type: 'doc', + id: 'cloud/advanced/database', }, items: [ - "cloud/advanced/database", + 'cloud/advanced/database', { - type: "doc", - id: "cloud/advanced/email", - label: "Email provider", + type: 'doc', + id: 'cloud/advanced/email', + label: 'Email provider', customProps: { new: false, }, }, { - type: "doc", - id: "cloud/advanced/upload", - label: "Upload provider", + type: 'doc', + id: 'cloud/advanced/upload', + label: 'Upload provider', customProps: { new: false, }, @@ -953,7 +980,7 @@ const sidebars = { { type: 'link', label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' + href: '/dev-docs/intro', }, { type: 'category', @@ -961,13 +988,13 @@ const sidebars = { label: 'REST API reference', link: { type: 'doc', - id: 'dev-docs/api/rest' + id: 'dev-docs/api/rest', }, items: [ { type: 'category', label: 'Endpoints and basic requests', - link: {type: 'doc', id: 'dev-docs/api/rest'}, + link: { type: 'doc', id: 'dev-docs/api/rest' }, collapsed: false, items: [ { @@ -978,43 +1005,43 @@ const sidebars = { { type: 'link', label: 'Get documents', - href: '/dev-docs/api/rest#get-all' + href: '/dev-docs/api/rest#get-all', }, { type: 'link', label: 'Get a document', - href: '/dev-docs/api/rest#get' + href: '/dev-docs/api/rest#get', }, { type: 'link', label: 'Create a document', - href: '/dev-docs/api/rest#create' + href: '/dev-docs/api/rest#create', }, { type: 'link', label: 'Update a document', - href: '/dev-docs/api/rest#update' + href: '/dev-docs/api/rest#update', }, { type: 'link', label: 'Delete a document', - href: '/dev-docs/api/rest#delete' + href: '/dev-docs/api/rest#delete', }, - ] + ], }, { type: 'doc', id: 'dev-docs/api/rest/interactive-query-builder', - label: '✨ Interactive Query Builder' + label: '✨ Interactive Query Builder', }, { type: 'doc', - id: 'dev-docs/api/rest/parameters' + id: 'dev-docs/api/rest/parameters', }, { type: 'category', label: 'Populate and Select', - link: {type: 'doc', id: 'dev-docs/api/rest/populate-select'}, + link: { type: 'doc', id: 'dev-docs/api/rest/populate-select' }, collapsed: false, items: [ { @@ -1027,18 +1054,21 @@ const sidebars = { label: 'Population', href: '/dev-docs/api/rest/populate-select#population', }, - ] + ], }, { type: 'category', collapsed: false, label: 'Filters, Locale, Publication State', - link: {type: 'doc', id: 'dev-docs/api/rest/filters-locale-publication' }, + link: { + type: 'doc', + id: 'dev-docs/api/rest/filters-locale-publication', + }, items: [ { type: 'link', label: 'Filtering', - href: '/dev-docs/api/rest/filters-locale-publication#filtering' + href: '/dev-docs/api/rest/filters-locale-publication#filtering', }, { type: 'link', @@ -1066,58 +1096,58 @@ const sidebars = { type: 'category', collapsed: false, label: 'Sort and Pagination', - link: { type: 'doc', id: 'dev-docs/api/rest/sort-pagination'}, + link: { type: 'doc', id: 'dev-docs/api/rest/sort-pagination' }, items: [ { type: 'link', label: 'Sorting', - href: '/dev-docs/api/rest/sort-pagination#sorting' + href: '/dev-docs/api/rest/sort-pagination#sorting', }, { type: 'link', label: 'Pagination', - href: '/dev-docs/api/rest/sort-pagination#pagination' + href: '/dev-docs/api/rest/sort-pagination#pagination', }, { type: 'link', label: 'Pagination by page', - href: '/dev-docs/api/rest/sort-pagination#pagination-by-page' + href: '/dev-docs/api/rest/sort-pagination#pagination-by-page', }, { type: 'link', label: 'Pagination by offset', - href: '/dev-docs/api/rest/sort-pagination#pagination-by-offset' + href: '/dev-docs/api/rest/sort-pagination#pagination-by-offset', }, - ] + ], }, { type: 'category', collapsed: false, label: 'Relations', - link: {type: 'doc', id: 'dev-docs/api/rest/relations'}, + link: { type: 'doc', id: 'dev-docs/api/rest/relations' }, items: [ { type: 'link', label: 'connect', - href: '/dev-docs/api/rest/relations#connect' + href: '/dev-docs/api/rest/relations#connect', }, { type: 'link', label: 'disconnect', - href: '/dev-docs/api/rest/relations#disconnect' + href: '/dev-docs/api/rest/relations#disconnect', }, { type: 'link', label: 'set', - href: '/dev-docs/api/rest/relations#set' + href: '/dev-docs/api/rest/relations#set', }, - ] + ], }, - ] + ], }, { - type: "category", - label: "Rest API guides", + type: 'category', + label: 'Rest API guides', collapsed: false, link: { type: 'doc', @@ -1125,28 +1155,28 @@ const sidebars = { }, items: [ { - type: "doc", - label: "Understanding populate", + type: 'doc', + label: 'Understanding populate', id: 'dev-docs/api/rest/guides/understanding-populate', }, { - type: "doc", - label: "How to populate creator fields", + type: 'doc', + label: 'How to populate creator fields', id: 'dev-docs/api/rest/guides/populate-creator-fields', }, { type: 'link', label: 'Additional resources', - href: '/dev-docs/api/rest/guides/intro#additional-resources' + href: '/dev-docs/api/rest/guides/intro#additional-resources', }, ], - } + }, ], devDocsConfigSidebar: [ { type: 'link', label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' + href: '/dev-docs/intro', }, { type: 'category', @@ -1168,7 +1198,7 @@ const sidebars = { label: 'Base configurations', link: { type: 'doc', - id: 'dev-docs/configurations' + id: 'dev-docs/configurations', }, items: [ 'dev-docs/configurations/database', @@ -1176,7 +1206,7 @@ const sidebars = { 'dev-docs/configurations/admin-panel', 'dev-docs/configurations/middlewares', 'dev-docs/configurations/api', - ] + ], }, { type: 'category', @@ -1184,7 +1214,7 @@ const sidebars = { collapsed: false, link: { type: 'doc', - id: 'dev-docs/configurations' + id: 'dev-docs/configurations', }, items: [ 'dev-docs/configurations/plugins', @@ -1195,7 +1225,7 @@ const sidebars = { 'dev-docs/configurations/environment', 'dev-docs/configurations/sso', 'dev-docs/configurations/features', - ] + ], }, { type: 'category', @@ -1203,7 +1233,7 @@ const sidebars = { collapsed: false, link: { type: 'doc', - id: 'dev-docs/configurations' + id: 'dev-docs/configurations', }, items: [ 'dev-docs/configurations/guides/rbac', @@ -1211,23 +1241,23 @@ const sidebars = { 'dev-docs/configurations/guides/access-cast-environment-variables', 'dev-docs/configurations/guides/access-configuration-values', 'dev-docs/configurations/guides/use-cron-jobs', - ] - } - ] + ], + }, + ], }, ], devDocsMigrationV5Sidebar: [ { type: 'link', label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' + href: '/dev-docs/intro', }, { type: 'category', collapsed: false, link: { type: 'doc', - id: 'dev-docs/migration/v4-to-v5/introduction-and-faq' + id: 'dev-docs/migration/v4-to-v5/introduction-and-faq', }, label: 'Upgrade to Strapi 5', customProps: { @@ -1235,52 +1265,54 @@ const sidebars = { }, items: [ { - type: "doc", - label: "Introduction and FAQ", - id: "dev-docs/migration/v4-to-v5/introduction-and-faq" + type: 'doc', + label: 'Introduction and FAQ', + id: 'dev-docs/migration/v4-to-v5/introduction-and-faq', }, { - type: "doc", - label: "Step-by-step guide", - id: "dev-docs/migration/v4-to-v5/step-by-step" + type: 'doc', + label: 'Step-by-step guide', + id: 'dev-docs/migration/v4-to-v5/step-by-step', }, { - type: "doc", - label: "Upgrade tool reference", + type: 'doc', + label: 'Upgrade tool reference', id: 'dev-docs/upgrade-tool', }, { - type: "category", + type: 'category', collapsible: true, collapsed: true, - label: "Breaking changes", + label: 'Breaking changes', link: { type: 'doc', - id: 'dev-docs/migration/v4-to-v5/breaking-changes' + id: 'dev-docs/migration/v4-to-v5/breaking-changes', }, items: [ { - type: "autogenerated", - dirName: 'dev-docs/migration/v4-to-v5/breaking-changes' + type: 'autogenerated', + dirName: 'dev-docs/migration/v4-to-v5/breaking-changes', }, - ] + ], }, { type: 'category', label: 'Specific resources', collapsed: false, - link: { type: 'doc', id: 'dev-docs/migration/v4-to-v5/additional-resources/introduction' }, + link: { + type: 'doc', + id: 'dev-docs/migration/v4-to-v5/additional-resources/introduction', + }, items: [ 'dev-docs/migration/v4-to-v5/additional-resources/introduction', 'dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service', 'dev-docs/migration/v4-to-v5/additional-resources/plugins-migration', 'dev-docs/migration/v4-to-v5/additional-resources/helper-plugin', - ] - } - ] + ], + }, + ], }, - - ] + ], }; module.exports = sidebars;