@nasl/ast-mini
Version:
Mini collection of NASL AST
410 lines (379 loc) • 9.55 kB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
/**
* 枚举
*/
export interface Enum {
concept: 'Enum';
composedBy: null | Array<string>;
name: string;
label: null | string;
description: null | string;
enumItems: Array<EnumItem>;
valueType: TypeAnnotation;
}
/**
* 枚举值
*/
export interface EnumItem {
concept: 'EnumItem';
composedBy: null | Array<string>;
value: string;
label: StaticString;
}
/**
* 静态字符串
*/
export interface StaticString {
concept: 'StaticString';
composedBy: null | Array<string>;
value: string;
i18nKey: null | string;
}
/**
* 类型标注
*/
export interface TypeAnnotation {
concept: 'TypeAnnotation';
composedBy: null | Array<string>;
typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | 'function' | 'union' | 'anonymousStructure';
typeNamespace: null | string;
typeName: null | string;
typeArguments: null | Array<TypeAnnotation>;
returnType: null | Array<TypeAnnotation>;
inferred: null | boolean;
properties: null | Array<StructureProperty>;
ruleMap: null | Partial<Record<string, number>>;
}
/**
* 数据结构属性
*/
export interface StructureProperty {
concept: 'StructureProperty';
composedBy: null | Array<string>;
name: string;
label: null | string;
description: null | string;
typeAnnotation: null | TypeAnnotation;
defaultValue: null | DefaultValue;
jsonName: null | string;
}
/**
* 默认值
*/
export interface DefaultValue {
concept: 'DefaultValue';
composedBy: null | Array<string>;
expression: null | LogicItem;
playground: Array<LogicItem>;
}
export type LogicItem = Destination | Argument | Anchor | ExternalDestination | ValidationRule;
/**
* 数据源
*/
export interface DataSource {
concept: 'DataSource';
composedBy: null | Array<string>;
name: string;
description: string;
entities: Array<Entity>;
ddlStrategy: 'all' | 'originNotTable' | 'none';
}
export type Annotatable = Entity | View | ViewElement | Logic;
/**
* 实体
*/
export interface Entity {
concept: 'Entity';
composedBy: null | Array<string>;
name: string;
uuid: string;
tableName: string;
description: null | string;
origin: 'ide' | 'sql' | 'table' | 'excel';
properties: Array<EntityProperty>;
indexes: Array<EntityIndex>;
}
/**
* 实体属性
*/
export interface EntityProperty {
concept: 'EntityProperty';
composedBy: null | Array<string>;
name: string;
uuid: string;
columnName: string;
label: null | string;
description: null | string;
typeAnnotation: TypeAnnotation;
required: null | boolean;
defaultValue: null | DefaultValue;
primaryKey: null | boolean;
relationNamespace: null | string;
relationEntity: null | string;
relationProperty: null | string;
deleteRule: null | 'protect' | 'cascade';
display: Partial<Record<string, boolean>>;
rules: Array<string>;
generationRule: 'auto' | 'autoIncrement' | 'manual';
sequence: null | string;
}
/**
* 实体索引
*/
export interface EntityIndex {
concept: 'EntityIndex';
composedBy: null | Array<string>;
name: string;
indexName: null | string;
propertyNames: Array<string>;
unique: boolean;
description: null | string;
}
/**
* 页面
*/
export interface View {
concept: 'View';
composedBy: null | Array<string>;
pageTemplateId: null | string;
name: string;
uuid: null | string;
title: string;
crumb: null | StaticString;
auth: boolean;
authDescription: null | string;
isIndex: null | boolean;
template: null | string;
script: string;
style: null | string;
elements: Array<ViewElement>;
params: null | Array<Param>;
variables: Array<Variable>;
logics: Array<Logic>;
bindEvents: Array<BindEvent>;
bindRoles: Array<string>;
children: Array<View>;
}
/**
* 页面元素
*/
export interface ViewElement {
concept: 'ViewElement';
composedBy: null | Array<string>;
tag: string;
refNamespace: null | string;
name: string;
staticClass: null | string;
staticStyle: null | string;
authDescription: null | string;
slotTarget: null | string;
slotScope: null | string;
bindAttrs: Array<BindAttribute>;
bindEvents: Array<BindEvent>;
bindDirectives: Array<BindDirective>;
bindRoles: Array<string>;
bindStyles: Array<BindStyle>;
children: Array<ViewElement>;
}
/**
* 元素绑定属性
*/
export interface BindAttribute {
concept: 'BindAttribute';
composedBy: null | Array<string>;
name: string;
type: null | 'string' | 'static' | 'dynamic';
value: null | string | boolean | number;
expression: null | LogicItem;
destination: null | Destination;
externalDestination: null | ExternalDestination;
rules: null | Array<ValidationRule>;
model: null | boolean;
sync: null | boolean;
playground: Array<LogicItem>;
i18nKey: null | string;
}
/**
* 跳转页面
*/
export interface Destination {
concept: 'Destination';
composedBy: null | Array<string>;
label: null | string;
description: null | string;
folded: null | boolean;
offsetX: null | number;
offsetY: null | number;
typeAnnotation: null | TypeAnnotation;
viewNamespace: null | string;
viewName: null | string;
arguments: Array<Argument>;
target: '_self' | '_blank' | '_parent' | '_top';
anchor: Anchor;
}
/**
* 实际参数
*/
export interface Argument {
concept: 'Argument';
composedBy: null | Array<string>;
label: null | string;
description: null | string;
folded: null | boolean;
offsetX: null | number;
offsetY: null | number;
typeAnnotation: null | TypeAnnotation;
keyword: string;
spread: null | boolean;
expression: null | LogicItem;
}
/**
* 锚点参数
*/
export interface Anchor {
concept: 'Anchor';
composedBy: null | Array<string>;
label: null | string;
description: null | string;
folded: null | boolean;
offsetX: null | number;
offsetY: null | number;
typeAnnotation: null | TypeAnnotation;
expression: null | LogicItem;
}
/**
* 跳转到外部链接
*/
export interface ExternalDestination {
concept: 'ExternalDestination';
composedBy: null | Array<string>;
label: null | string;
description: null | string;
folded: null | boolean;
offsetX: null | number;
offsetY: null | number;
typeAnnotation: null | TypeAnnotation;
link: LogicItem;
target: '_self' | '_blank' | '_parent' | '_top';
anchor: null | Anchor;
}
/**
* 验证规则
*/
export interface ValidationRule {
concept: 'ValidationRule';
composedBy: null | Array<string>;
label: null | string;
description: null | string;
folded: null | boolean;
offsetX: null | number;
offsetY: null | number;
typeAnnotation: null | TypeAnnotation;
calleeNamespace: string;
calleeName: string;
arguments: Array<Argument>;
errorMessage: null | LogicItem;
target: null | LogicItem;
enableServerValidation: null | boolean;
}
/**
* 元素绑定事件
*/
export interface BindEvent {
concept: 'BindEvent';
composedBy: null | Array<string>;
name: string;
logics: Array<Logic>;
calleeNamespace: null | string;
calleeName: null | string;
arguments: null | Array<Argument>;
}
/**
* 逻辑
*/
export interface Logic {
concept: 'Logic';
composedBy: null | Array<string>;
name: string;
title: null | string;
description: null | string;
triggerType: null | string;
cron: null | string;
overridable: null | boolean;
typeParams: null | Array<TypeParam>;
params: Array<Param>;
returns: Array<Return>;
variables: Array<Variable>;
body: Array<LogicItem>;
playground: Array<LogicItem>;
}
/**
* 类型参数
*/
export interface TypeParam {
concept: 'TypeParam';
composedBy: null | Array<string>;
name: string;
displayName: null | string;
}
/**
* 输入参数
*/
export interface Param {
concept: 'Param';
composedBy: null | Array<string>;
name: string;
description: null | string;
spread: null | boolean;
typeAnnotation: null | TypeAnnotation;
defaultValue: null | DefaultValue;
}
/**
* 输出参数
*/
export interface Return {
concept: 'Return';
composedBy: null | Array<string>;
name: string;
description: null | string;
typeAnnotation: null | TypeAnnotation;
defaultValue: null | DefaultValue;
}
/**
* 变量
*/
export interface Variable {
concept: 'Variable';
composedBy: null | Array<string>;
name: string;
description: null | string;
typeAnnotation: null | TypeAnnotation;
defaultValue: null | DefaultValue;
}
/**
* 元素指令
*/
export interface BindDirective {
concept: 'BindDirective';
composedBy: null | Array<string>;
name: string;
rawName: null | string;
type: 'string' | 'static' | 'dynamic';
value: null | string;
expression: null | LogicItem;
arg: null | string;
modifiers: null | string;
playground: Array<LogicItem>;
i18nKey: null | string;
}
/**
* 元素绑定样式
*/
export interface BindStyle {
concept: 'BindStyle';
composedBy: null | Array<string>;
name: string;
expression: null | LogicItem;
playground: Array<LogicItem>;
}