mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user