102 lines
2.6 KiB
TypeScript
102 lines
2.6 KiB
TypeScript
import { AuthDeduceRelationMap, EntityDict } from './Entity';
|
||
import { EntityDict as BaseEntityDict } from "../base-app-domain";
|
||
import { AttrUpdateMatrix } from './EntityDesc';
|
||
import { ActionDefDict } from './Action';
|
||
import { StyleDict } from './Style';
|
||
import type { IKoaBodyOptions } from 'koa-body';
|
||
import Koa from 'koa';
|
||
import KoaRouter from 'koa-router';
|
||
/**
|
||
* redis连接信息,如果是Redis集群,可以配置多个
|
||
*/
|
||
export type RedisConfiguration = {
|
||
host: string;
|
||
port: number;
|
||
password?: string;
|
||
};
|
||
/**
|
||
* 后台配置
|
||
*/
|
||
export type ServerConfiguration = {
|
||
database?: {
|
||
type: 'mysql';
|
||
host: string;
|
||
database: string;
|
||
port?: number;
|
||
user: string;
|
||
password?: string;
|
||
connectionLimit: number;
|
||
charset: "utf8mb4_general_ci";
|
||
};
|
||
redis?: RedisConfiguration | RedisConfiguration[];
|
||
workDir: {
|
||
path: string;
|
||
};
|
||
port: number;
|
||
hostname: string;
|
||
nginx?: {
|
||
ssl: boolean;
|
||
apiPath: string;
|
||
port?: number;
|
||
socketPath: string;
|
||
};
|
||
cors?: {
|
||
origin: string | string[];
|
||
headers?: string[];
|
||
methods?: string[];
|
||
};
|
||
ui?: {
|
||
path?: string;
|
||
disable?: boolean;
|
||
username?: string;
|
||
password?: string;
|
||
};
|
||
internalExceptionMask?: string;
|
||
koaBody?: IKoaBodyOptions;
|
||
socket?: (ctx: Koa.ParameterizedContext<any, KoaRouter.IRouterParamContext<any, {}>, any>) => {
|
||
url: string;
|
||
} | undefined;
|
||
middleware?: Koa.Middleware[] | ((app: Koa<Koa.DefaultState, Koa.DefaultContext>) => Koa.Middleware[]);
|
||
};
|
||
/**
|
||
* 前后台访问配置
|
||
*/
|
||
export type AccessConfiguration = {
|
||
routerPrefixes?: {
|
||
aspect?: string;
|
||
endpoint?: string;
|
||
getSubscribePoint?: string;
|
||
bridge?: string;
|
||
};
|
||
socketPath?: string;
|
||
http: {
|
||
hostname: string;
|
||
port?: number;
|
||
ssl?: boolean;
|
||
path?: string;
|
||
};
|
||
timeout?: number;
|
||
clockDriftDuration?: number;
|
||
};
|
||
/**
|
||
* 业务逻辑的通用配置
|
||
*/
|
||
export type CommonConfiguration<ED extends BaseEntityDict & EntityDict> = {
|
||
attrUpdateMatrix: AttrUpdateMatrix<ED>;
|
||
actionDefDict: ActionDefDict<ED>;
|
||
authDeduceRelationMap: AuthDeduceRelationMap<ED>;
|
||
selectFreeEntities?: (keyof ED)[];
|
||
updateFreeDict?: {
|
||
[A in keyof ED]?: string[];
|
||
};
|
||
cacheSavedEntities?: (keyof ED)[];
|
||
cacheKeepFreshPeriod?: number;
|
||
};
|
||
export type DependencyConfiguration = string[];
|
||
/**
|
||
* 渲染相关定义
|
||
*/
|
||
export type RenderConfiguration<ED extends BaseEntityDict & EntityDict> = {
|
||
styleDict: StyleDict<ED>;
|
||
};
|