@lcap/asl
Version:
NetEase Application Specific Language
248 lines (247 loc) • 5.88 kB
TypeScript
import { LEVEL_ENUM, Vertex, App, Page, DataNode, GlobalLogicNode, Entity, Structure, Enum, Interface, Process } from '..';
export declare enum SERVICE_TYPE {
web = "web",
micro = "micro"
}
export interface AssetsInfo {
js: Array<string>;
css: Array<string>;
names?: Array<string>;
}
/**
* 服务(模块)类
*/
export declare class Service extends Vertex {
/**
* 概念类型
*/
readonly level: LEVEL_ENUM;
/**
* 服务类型
*/
readonly type: SERVICE_TYPE;
/**
* Service Id
*/
readonly id: string;
/**
* 前端服务标识
*/
readonly name: string;
/**
* 前端服务标题
*/
readonly title: string;
/**
* 服务图标
*/
readonly icon: string;
/**
* App 的 Id
*/
readonly appId: string;
/**
* 数据节点
*/
readonly data: DataNode;
/**
* 接口列表
*/
readonly interfaces: Array<Interface>;
/**
* 逻辑节点 http://doc.hz.netease.com/pages/viewpage.action?pageId=310549021
*/
readonly globalLogic: GlobalLogicNode;
/**
* 所在的 App
* 父级引用,便于在树状结构中查找
*/
readonly app: App;
/**
* 节点是否为展开状态
* 前端 UI 状态
*/
expanded: boolean;
/**
* @param source 需要合并的部分参数
*/
constructor(source?: Partial<Service>);
loadStructures(): Promise<Array<Structure>>;
syncStructures(): Promise<Structure[]>;
/**
* 加载服务所有的接口列表
*/
loadInterfaces(): Promise<Interface[]>;
}
/**
* 前端服务(模块)类
*/
export declare class WebService extends Service {
/**
* 服务类型
*/
readonly type: SERVICE_TYPE;
/**
* 服务状态
*/
readonly status: 'UNPUBLISHED' | 'PUBLISHED' | 'REPOSITORYCREATED' | 'FSSTARTED' | 'APPINIT' | 'CODESYNCED' | 'CICDCREATED';
/**
* 是否为官方服务
*/
readonly officialType: 'official' | 'nonofficial';
readonly dnsAddr: string;
/**
* packageJSON 的缩减版
*/
readonly packageInfo: {
template: {
name: string;
version: string;
};
ui: {
name: string;
version: string;
};
componentDependencies: {
[name: string]: string;
};
themeVariables: {
[name: string]: string;
};
};
/**
* 其他配置
*/
readonly config: string;
readonly api: {
features: {
[name: string]: boolean;
};
builtInFunctions: {
[name: string]: any;
};
};
/**
* 前端页面
*/
readonly pages: Array<Page>;
/**
* @param source 需要合并的部分参数
*/
constructor(source?: Partial<WebService>);
load(): Promise<this>;
loadPackageInfo(): Promise<void>;
savePackageInfo(): Promise<any>;
/**
* 根据 packageInfo 的信息生成用于 load 的 assetsInfo
* 在环境中需要 basic 和 custom 分开 load,否则容易报错
* @param prefix
*/
genAllAssetsInfo(prefix: string): {
basic: AssetsInfo;
custom?: AssetsInfo;
};
genThemeCSS(): string;
loadPages(): Promise<Page[]>;
addPage(page: Page): Promise<Page>;
importPage(page: Page): Promise<Page>;
private _onPageTreeChange;
/**
* 从后端 JSON 生成规范的 WebService 对象
* @param source JSON
* @param app 父级 App
*/
static from(source: any, app: App): WebService;
}
/**
* 后端服务(模块)类
*/
export declare class MicroService extends Service {
/**
* 服务类型
*/
readonly type: SERVICE_TYPE;
/**
* 包名
*/
readonly packageName: string;
/**
* 服务端口
*/
readonly serverPort: number;
/**
* 接口列表
*/
readonly interfaces: Array<Interface>;
/**
* 流程列表
*/
readonly processes: Array<Process>;
/**
* @param source 需要合并的部分参数
*/
constructor(source?: Partial<MicroService>);
private _saveVertexIdToName;
loadEntities(): Promise<Entity[]>;
/**
* 添加实体
* @param name 实体名称
*/
addEntity(name: string): Promise<Entity>;
/**
* 添加实体
* @param entityOptions 实体参数
*/
addEntity(entityOptions: Partial<Entity>): Promise<Entity>;
/**
* 添加实体
* @param entity 已有的实体实例
*/
addEntity(entity: Entity): Promise<Entity>;
/**
* 删除实体
* @param name 实体名称
*/
removeEntity(name: string): Promise<void>;
/**
* 删除实体
* @param id 实体 Id
*/
removeEntity(id: string): Promise<void>;
/**
* 删除实体
* @param entity 已有的实体实例
*/
removeEntity(entity: Entity): Promise<void>;
/**
* 加载所有枚举
*/
loadEnums(): Promise<Enum[]>;
/**
* 加载所有流程
*/
loadProcesses(): Promise<Process[]>;
mountResolverOnProcess(): void;
/**
* 导入sql或其他需要同步entity
*/
syncEntities(): Promise<Entity[]>;
syncEntityPropertyVersion(): Promise<void>;
/**
* 加载服务所有的接口列表
*/
loadInterfaces(): Promise<Interface[]>;
mountResolverOnEntity(): void;
mountResolverOnInterface(): void;
private _onDataTypesChange;
private _onEnumsChange;
private _onInterfacesChange;
private _onVertexIdToNameChange;
/**
* 从后端 JSON 生成规范的 MicroService 对象
* @param source JSON
* @param app 父级 App
*/
static from(source: any, app: App): MicroService;
}
export default Service;