lakutata
Version:
An IoC-based universal application framework.
62 lines (49 loc) • 2.22 kB
TypeScript
import { EntityTarget } from './TypeDef.internal.36.js';
import { ColumnMetadata } from './TypeDef.internal.47.js';
/**
* All types that relation can be.
*/
type RelationType = "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
/**
* DEFERRABLE type to be used to specify if foreign key constraints can be deferred.
*/
type DeferrableType = "INITIALLY IMMEDIATE" | "INITIALLY DEFERRED";
/**
* ON_DELETE type to be used to specify delete strategy when some relation is being deleted from the database.
*/
type OnDeleteType = "RESTRICT" | "CASCADE" | "SET NULL" | "DEFAULT" | "NO ACTION";
/**
* ON_UPDATE type to be used to specify update strategy when some relation is being updated.
*/
type OnUpdateType = "RESTRICT" | "CASCADE" | "SET NULL" | "DEFAULT" | "NO ACTION";
/**
* Contains the name of the property of the object, or the function that returns this name.
*/
type PropertyTypeFactory<T> = string | ((t: T) => string | any);
/**
* Function that returns a type of the field. Returned value must be a class used on the relation.
*/
type RelationTypeInFunction = ((type?: any) => Function) | EntityTarget<any>;
/**
* All types that entity listener can be.
*/
type EventListenerType = "after-load" | "before-insert" | "after-insert" | "before-update" | "after-update" | "before-remove" | "after-remove" | "before-soft-remove" | "after-soft-remove" | "before-recover" | "after-recover";
/**
* Table type. Tables can be closure, junction,, etc.
*/
type TableType = "regular" | "view" | "junction" | "closure" | "closure-junction" | "entity-child";
/**
* Tree type.
* Specifies what table pattern will be used for the tree entity.
*/
type TreeType = "adjacency-list" | "closure-table" | "nested-set" | "materialized-path";
/**
* Tree type.
* Specifies what table pattern will be used for the tree entity.
*/
interface ClosureTreeOptions {
closureTableName?: string;
ancestorColumnName?: (column: ColumnMetadata) => string;
descendantColumnName?: (column: ColumnMetadata) => string;
}
export type { ClosureTreeOptions, DeferrableType, EventListenerType, OnDeleteType, OnUpdateType, PropertyTypeFactory, RelationType, RelationTypeInFunction, TableType, TreeType };