Logic 逻辑
1. 结构声明
- TS Declaration
- JSON Schema
class Logic extends BaseNode {
name: string = '';
title?: string;
description?: string;
triggerType?: string;
cron?: string;
overridable?: boolean;
transactional?: Transactional;
typeParams?: Array<TypeParam>;
params: Array<Param>;
returns: Array<Return>;
variables: Array<Variable>;
body: Array<LogicItem>;
playground: Array<LogicItem>;
}
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"triggerType": {
"type": "string"
},
"cron": {
"type": "string"
},
"overridable": {
"type": "boolean"
},
"transactional": {
"$ref": "#/definitions/Transactional"
},
"typeParams": {
"type": "array",
"items": {
"$ref": "#/definitions/TypeParam"
}
},
"params": {
"type": "array",
"items": {
"$ref": "#/definitions/Param"
}
},
"returns": {
"type": "array",
"items": {
"$ref": "#/definitions/Return"
}
},
"variables": {
"type": "array",
"items": {
"$ref": "#/definitions/Variable"
}
},
"body": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
},
"playground": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
}
},
"required": [
"name",
"params",
"returns",
"variables",
"body",
"playground"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Logic",
"name": "logic1",
"title": "标题",
"description": "",
"triggerType": "",
"cron": "",
"overridable": false,
"transactional": {
"concept": "Transactional",
"enabled": false,
"propagation": "REQUIRED",
"isolation": "DEFAULT"
},
"params": [
{
"concept": "Param",
"name": "param1",
"description": "",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeNamespace": "nasl.core",
"typeKind": "primitive",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"required": false
}
],
"returns": [],
"variables": [],
"body": [
{
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "",
"name": "student"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "name"
}
}
],
"playground": []
}
concept: Logic
name: logic1
title: 标题
description: ""
triggerType: ""
cron: ""
overridable: false
transactional:
concept: Transactional
enabled: false
propagation: REQUIRED
isolation: DEFAULT
params:
- concept: Param
name: param1
description: ""
typeAnnotation:
concept: TypeAnnotation
typeNamespace: nasl.core
typeKind: primitive
typeName: Long
inferred: false
ruleMap: {}
required: false
returns: []
variables: []
body:
- concept: MemberExpression
object:
concept: Identifier
namespace: ""
name: student
property:
concept: Identifier
namespace: ""
name: name
playground: []