docs: plugins, cloudflare, sdk, elements, database (#240)

* docs: added plugins docs, updated cloudflare docs

* updated cli help text

* added `systemEntity` and added docs on how to work with system entities

* docs: added defaults to cloudflare image plugin

* docs: updated sdk and elements
This commit is contained in:
dswbx
2025-08-29 12:50:23 +02:00
committed by GitHub
parent 5b879ac6bf
commit 5ed1cf19b6
17 changed files with 655 additions and 100 deletions

View File

@@ -39,6 +39,9 @@ import {
type PolymorphicRelationConfig,
} from "data/relations";
import type { MediaFields } from "media/AppMedia";
import type { UsersFields } from "auth/AppAuth";
type Options<Config = any> = {
entity: { name: string; fields: Record<string, Field<any, any, any>> };
field_name: string;
@@ -199,6 +202,18 @@ export function entity<
return new Entity(name, _fields, config, type);
}
type SystemEntities = {
users: UsersFields;
media: MediaFields;
};
export function systemEntity<
E extends keyof SystemEntities,
Fields extends Record<string, Field<any, any, any>>,
>(name: E, fields: Fields) {
return entity<E, SystemEntities[E] & Fields>(name, fields as any);
}
export function relation<Local extends Entity>(local: Local) {
return {
manyToOne: <Foreign extends Entity>(foreign: Foreign, config?: ManyToOneRelationConfig) => {