Event 组件事件
1. 结构声明
- TS Declaration
- JSON Schema
class Event extends BaseNode {
name: string = '';
group?: string;
title?: string;
description: string;
advanced?: boolean;
params: Array<Param>;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"group": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"advanced": {
"type": "boolean"
},
"params": {
"type": "array",
"items": {
"$ref": "#/definitions/Param"
}
}
},
"required": [
"name",
"description",
"params"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Event",
"name": "confirm",
"description": "确定事件",
"params": [
{
"concept": "Param",
"name": "payload",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String",
"inferred": false,
"ruleMap": {}
},
"description": "数据量"
}
]
}
concept: Event
name: confirm
description: 确定事件
params:
- concept: Param
name: payload
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
inferred: false
ruleMap: {}
description: 数据量
对应的代码如下:
- 文本化 NASL
@(
description = "确定事件",
)
onConfirm: (payload: String) => null