@digicms/cms
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
67 lines (58 loc) • 1.73 kB
TypeScript
import type { Strapi as StrapiInterface } from './types/core';
import type {
CollectionTypeSchema,
SingleTypeSchema,
ComponentSchema,
ContentTypeSchema,
} from './types/core/schemas';
import type { KeysBy } from './types/utils';
declare global {
namespace Strapi {
/**
* Map of UID / schemas used as a schemas database for other types.
* It must be extended by the user application or plugins.
*
* @example
* ```ts
* declare global {
* namespace Strapi {
* interface Schemas {
* 'xxx::xxx.uid: ContentTypeSchema | ComponentSchema;
* }
* }
* }
* ```
*/
interface Schemas {}
/**
* Literal union type of every content type registered in Strapi.Schemas
*/
type ContentTypeUIDs = KeysBy<Schemas, ContentTypeSchema>;
/**
* Literal union type of every collection type registered in Strapi.Schemas
*/
type CollectionTypeUIDs = KeysBy<Schemas, CollectionTypeSchema>;
/**
* Literal union type of every single type registered in Strapi.Schemas
*/
type SingleTypeUIDs = KeysBy<Schemas, SingleTypeSchema>;
/**
* Literal union type of every component registered in Strapi.Schemas
*/
type ComponentUIDs = KeysBy<Schemas, ComponentSchema>;
/**
* Global shorthand to access the `StrapiInterface` type
*/
type Strapi = StrapiInterface;
}
/**
* Strapi global variable definition
**/
export const strapi: StrapiInterface;
/**
* Adds the strapi global variable to the NodeJS Global interface
*/
export interface Global {
strapi: StrapiInterface;
}
}