@lcap/nasl 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/assets/search.js +1 -1
- package/docs/classes/Entity.html +2832 -204
- package/docs/classes/View.html +4567 -365
- package/out/common/BaseNode.js +23 -16
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +22 -0
- package/out/concepts/App__.js +77 -15
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +2 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +2 -1
- package/out/concepts/Assignment__.js +3 -8
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -1
- package/out/concepts/BinaryExpression__.js +5 -5
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +2 -1
- package/out/concepts/BindAttribute__.js +9 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +2 -1
- package/out/concepts/BindDirective__.js +2 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -1
- package/out/concepts/BindEvent__.js +4 -3
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +57 -1
- package/out/concepts/CallFunction__.js +119 -11
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -1
- package/out/concepts/CallInterface__.js +2 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +57 -1
- package/out/concepts/CallLogic__.js +117 -10
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +120 -0
- package/out/concepts/ConfigGroup__.js +214 -0
- package/out/concepts/ConfigGroup__.js.map +1 -0
- package/out/concepts/ConfigPropertyValue__.d.ts +43 -0
- package/out/concepts/ConfigPropertyValue__.js +103 -0
- package/out/concepts/ConfigPropertyValue__.js.map +1 -0
- package/out/concepts/ConfigProperty__.d.ts +128 -0
- package/out/concepts/ConfigProperty__.js +236 -0
- package/out/concepts/ConfigProperty__.js.map +1 -0
- package/out/concepts/Configuration__.d.ts +120 -0
- package/out/concepts/Configuration__.js +210 -0
- package/out/concepts/Configuration__.js.map +1 -0
- package/out/concepts/Constant__.d.ts +2 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +2 -1
- package/out/concepts/Destination__.js +4 -3
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +8 -0
- package/out/concepts/EntityIndex__.js +18 -0
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +5 -5
- package/out/concepts/EntityProperty__.js +10 -9
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +30 -26
- package/out/concepts/Entity__.js +44 -36
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +8 -8
- package/out/concepts/Enum__.js +10 -4
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +35 -33
- package/out/concepts/ForEachStatement__.js +103 -36
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -1
- package/out/concepts/Identifier__.js +15 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +5 -1
- package/out/concepts/Interface__.js +19 -5
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +2 -2
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +9 -7
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -5
- package/out/concepts/MemberExpression__.js +12 -18
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +121 -126
- package/out/concepts/Module__.js +10 -17
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +12 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +2 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +2 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -1
- package/out/concepts/Param__.js +2 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +82 -81
- package/out/concepts/ProcessElement__.js +19 -6
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +1 -0
- package/out/concepts/Process__.js +10 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.js +2 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +5 -0
- package/out/concepts/Role__.js +19 -2
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -0
- package/out/concepts/SqlQueryComponent__.js +16 -0
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +2 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +1 -1
- package/out/concepts/StructureProperty__.js +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -1
- package/out/concepts/Structure__.js +4 -4
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +3 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +2 -1
- package/out/concepts/UnaryExpression__.js +3 -3
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +2 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -1
- package/out/concepts/ValidationRule__.js +2 -2
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +6 -5
- package/out/concepts/Variable__.js +3 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +5 -4
- package/out/concepts/ViewElement__.js +109 -65
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +97 -90
- package/out/concepts/View__.js +153 -118
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +2 -2
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +3 -137
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +21 -5
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.validation.js +527 -0
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -0
- package/out/concepts/index__.d.ts +4 -0
- package/out/concepts/index__.js +4 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/data/Module.d.ts +34 -0
- package/out/data/Module.js +53 -0
- package/out/data/Module.js.map +1 -0
- package/out/generator/compileComponent.d.ts +1 -1
- package/out/generator/genBundleFiles.d.ts +0 -1
- package/out/generator/genBundleFiles.js +1 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +35 -0
- package/out/generator/genMetaData.js +78 -0
- package/out/generator/genMetaData.js.map +1 -0
- package/out/generator/index.d.ts +1 -0
- package/out/generator/index.js +1 -0
- package/out/generator/index.js.map +1 -1
- package/out/index.d.ts +2 -2
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/server/createUiTs.d.ts +7 -0
- package/out/server/createUiTs.js +157 -0
- package/out/server/createUiTs.js.map +1 -0
- package/out/server/entity2LogicNamespace.d.ts +9 -1
- package/out/server/entity2LogicNamespace.js +11 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.d.ts +3 -0
- package/out/server/getExtensionModules.js +18 -0
- package/out/server/getExtensionModules.js.map +1 -0
- package/out/server/getLogics.js +18 -15
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +3 -2
- package/out/server/getMemberIdentifier.js +47 -15
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +4 -1
- package/out/server/getProcesses.js +16 -7
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getValidates.js +1 -1
- package/out/server/getValidates.js.map +1 -1
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +23 -5
- package/out/server/naslServer.js +199 -25
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +15 -1
- package/out/server/process2LogicNamespace.js +30 -3
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +28 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +5 -0
- package/out/service/storage/init.js +60 -52
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCallComponentLogic.js +2 -2
- package/out/templator/genCallComponentLogic.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +3 -3
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +3 -3
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +2 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +8 -12
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +20 -20
- package/out/templator/utils.js +22 -22
- package/out/templator/utils.js.map +1 -1
- package/package.json +2 -1
- package/src/automate/engine/index.js +37 -3
- package/src/automate/engine/utils.js +68 -64
- package/src/common/BaseNode.ts +24 -17
- package/src/concepts/App__.ts +93 -17
- package/src/concepts/Argument__.ts +4 -2
- package/src/concepts/Assignment__.ts +5 -7
- package/src/concepts/Attribute__.ts +1 -0
- package/src/concepts/BinaryExpression__.ts +7 -5
- package/src/concepts/BindAttribute__.ts +9 -4
- package/src/concepts/BindDirective__.ts +4 -2
- package/src/concepts/BindEvent__.ts +6 -4
- package/src/concepts/BooleanLiteral__.ts +3 -1
- package/src/concepts/CallFunction__.ts +195 -11
- package/src/concepts/CallInterface__.ts +4 -2
- package/src/concepts/CallLogic__.ts +211 -12
- package/src/concepts/CallQueryComponent__.ts +2 -1
- package/src/concepts/Comment__.ts +1 -0
- package/src/concepts/CompletionProperty__.ts +1 -0
- package/src/concepts/ConfigGroup__.ts +290 -0
- package/src/concepts/ConfigPropertyValue__.ts +112 -0
- package/src/concepts/ConfigProperty__.ts +306 -0
- package/src/concepts/Configuration__.ts +286 -0
- package/src/concepts/Constant__.ts +3 -1
- package/src/concepts/DataElement__.ts +1 -0
- package/src/concepts/Destination__.ts +7 -5
- package/src/concepts/End__.ts +1 -0
- package/src/concepts/EntityIndex__.ts +19 -0
- package/src/concepts/EntityProperty__.ts +9 -8
- package/src/concepts/Entity__.ts +66 -59
- package/src/concepts/EnumItem__.ts +1 -0
- package/src/concepts/Enum__.ts +32 -12
- package/src/concepts/Event__.ts +2 -1
- package/src/concepts/ForEachStatement__.ts +115 -69
- package/src/concepts/Function__.ts +2 -1
- package/src/concepts/Identifier__.ts +18 -1
- package/src/concepts/IfStatement__.ts +1 -0
- package/src/concepts/InterfaceParam__.ts +2 -1
- package/src/concepts/Interface__.ts +21 -5
- package/src/concepts/JSBlock__.ts +1 -0
- package/src/concepts/LogicItem__.ts +9 -40
- package/src/concepts/Logic__.ts +48 -9
- package/src/concepts/MemberExpression__.ts +14 -17
- package/src/concepts/Module__.ts +158 -139
- package/src/concepts/Namespace__.ts +13 -12
- package/src/concepts/NullLiteral__.ts +3 -1
- package/src/concepts/NumericLiteral__.ts +3 -1
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Point__.ts +1 -0
- package/src/concepts/ProcessComponent__.ts +3 -2
- package/src/concepts/ProcessElement__.ts +102 -107
- package/src/concepts/ProcessOutcome__.ts +1 -0
- package/src/concepts/Process__.ts +12 -4
- package/src/concepts/QueryAggregateExpression__.ts +1 -0
- package/src/concepts/QueryFieldExpression__.ts +2 -1
- package/src/concepts/QueryFromExpression__.ts +1 -0
- package/src/concepts/QueryGroupByExpression__.ts +1 -0
- package/src/concepts/QueryJoinExpression__.ts +2 -1
- package/src/concepts/QueryLimitExpression__.ts +1 -0
- package/src/concepts/QueryOrderByExpression__.ts +1 -0
- package/src/concepts/QuerySelectExpression__.ts +2 -1
- package/src/concepts/Rect__.ts +1 -0
- package/src/concepts/Return__.ts +3 -2
- package/src/concepts/Role__.ts +19 -2
- package/src/concepts/Slot__.ts +1 -0
- package/src/concepts/SqlQueryComponent__.ts +11 -1
- package/src/concepts/Start__.ts +1 -0
- package/src/concepts/StringLiteral__.ts +3 -1
- package/src/concepts/StructureProperty__.ts +2 -1
- package/src/concepts/Structure__.ts +5 -4
- package/src/concepts/SwitchCase__.ts +1 -0
- package/src/concepts/SwitchStatement__.ts +1 -0
- package/src/concepts/Theme__.ts +1 -0
- package/src/concepts/Transactional__.ts +1 -0
- package/src/concepts/TypeAnnotation__.ts +4 -0
- package/src/concepts/TypeParam__.ts +1 -0
- package/src/concepts/UnaryExpression__.ts +6 -3
- package/src/concepts/Unparsed__.ts +3 -1
- package/src/concepts/UseComponent__.ts +1 -0
- package/src/concepts/ValidationRule__.ts +5 -2
- package/src/concepts/Variable__.ts +12 -6
- package/src/concepts/ViewComponent__.ts +6 -5
- package/src/concepts/ViewElement__.ts +109 -80
- package/src/concepts/View__.ts +245 -206
- package/src/concepts/WhileStatement__.ts +1 -0
- package/src/concepts/basics/stdlib/index.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.ui.ts +3 -137
- package/src/concepts/basics/stdlib/nasl.util.ts +21 -5
- package/src/concepts/basics/stdlib/{nasl.validate.ts → nasl.validation.ts} +28 -28
- package/src/concepts/index__.ts +4 -0
- package/src/generator/compileComponent.ts +1 -1
- package/src/generator/genBundleFiles.ts +1 -2
- package/src/generator/genMetaData.ts +111 -0
- package/src/generator/index.ts +1 -0
- package/src/index.ts +2 -2
- package/src/server/createUiTs.ts +153 -0
- package/src/server/entity2LogicNamespace.ts +17 -1
- package/src/server/getExtensionModules.ts +13 -0
- package/src/server/getLogics.ts +19 -18
- package/src/server/getMemberIdentifier.ts +60 -19
- package/src/server/getProcesses.ts +15 -8
- package/src/server/getValidates.ts +1 -1
- package/src/server/index.ts +2 -1
- package/src/server/naslServer.ts +204 -24
- package/src/server/process2LogicNamespace.ts +44 -3
- package/src/server/translator.ts +121 -97
- package/src/service/config/api.js +32 -0
- package/src/service/config/index.js +6 -0
- package/src/service/creator/index.js +2 -2
- package/src/service/logic/checktypeSocket.js +49 -0
- package/src/service/modules/api.js +20 -0
- package/src/service/modules/index.js +6 -0
- package/src/service/storage/init.ts +62 -54
- package/src/templator/genCallComponentLogic.ts +2 -2
- package/src/templator/genCreateBlock.ts +19 -25
- package/src/templator/genCurdEditMultipleKeyBlock.ts +3 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +3 -3
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genListViewBlock.ts +2 -2
- package/src/templator/genSelectBlock.ts +1 -1
- package/src/templator/genUpdateBlock.ts +19 -25
- package/src/templator/utils.ts +25 -153
|
@@ -2,6 +2,7 @@ import { dataTypesMap } from './basics/types';
|
|
|
2
2
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
3
3
|
import Entity from './Entity__';
|
|
4
4
|
import Structure from './Structure__';
|
|
5
|
+
import { ElementToVueOptions } from './ViewElement__';
|
|
5
6
|
//================================================================================
|
|
6
7
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
7
8
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -10,6 +11,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
10
11
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
11
12
|
|
|
12
13
|
import * as utils from '../utils';
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
13
15
|
import BaseNode from '../common/BaseNode';
|
|
14
16
|
import classMap from '../common/classMap';
|
|
15
17
|
import TypeAnnotation from './TypeAnnotation__';
|
|
@@ -209,7 +211,7 @@ export class Constant extends BaseNode {
|
|
|
209
211
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
210
212
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
211
213
|
//================================================================================
|
|
212
|
-
toVue(): string {
|
|
214
|
+
toVue(options?: ElementToVueOptions): string {
|
|
213
215
|
return this.name;
|
|
214
216
|
}
|
|
215
217
|
|
|
@@ -6,6 +6,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
6
6
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
7
7
|
|
|
8
8
|
import * as utils from '../utils';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
10
|
import BaseNode from '../common/BaseNode';
|
|
10
11
|
import classMap from '../common/classMap';
|
|
11
12
|
import TypeAnnotation from './TypeAnnotation__';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import View from './View__';
|
|
2
2
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
|
|
3
|
+
import { ElementToVueOptions } from './ViewElement__';
|
|
3
4
|
//================================================================================
|
|
4
5
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
5
6
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -8,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
8
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
9
10
|
|
|
10
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
13
|
import BaseNode from '../common/BaseNode';
|
|
12
14
|
import classMap from '../common/classMap';
|
|
13
15
|
import Argument from './Argument__';
|
|
@@ -236,7 +238,6 @@ export class Destination extends LogicItem {
|
|
|
236
238
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
237
239
|
//================================================================================
|
|
238
240
|
|
|
239
|
-
|
|
240
241
|
get tsCalleeNamespace() {
|
|
241
242
|
if (this.viewNamespace) {
|
|
242
243
|
let tsCalleeNamespace = this.viewNamespace;
|
|
@@ -252,7 +253,8 @@ export class Destination extends LogicItem {
|
|
|
252
253
|
if (/^\d/.test(tsName)) {
|
|
253
254
|
tsName = '$' + tsName;
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
+
// 匹配所有特殊字符都转为_
|
|
257
|
+
tsName = tsName.replace(/\W/g, '_');
|
|
256
258
|
return tsName;
|
|
257
259
|
}
|
|
258
260
|
return '';
|
|
@@ -266,7 +268,7 @@ export class Destination extends LogicItem {
|
|
|
266
268
|
return viewArr;
|
|
267
269
|
}
|
|
268
270
|
|
|
269
|
-
toVue() {
|
|
271
|
+
toVue(options?: ElementToVueOptions) {
|
|
270
272
|
let url = '';
|
|
271
273
|
const viewArr = this.genViewArr();
|
|
272
274
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
@@ -342,7 +344,7 @@ export class Destination extends LogicItem {
|
|
|
342
344
|
if (Array.isArray(namespaceAttr)) {
|
|
343
345
|
namespaceAttr.forEach((item, index) => {
|
|
344
346
|
if (item === 'views') {
|
|
345
|
-
viewNameAttr.push(namespaceAttr[index + 1]
|
|
347
|
+
viewNameAttr.push(namespaceAttr[index + 1]);
|
|
346
348
|
}
|
|
347
349
|
});
|
|
348
350
|
}
|
|
@@ -379,7 +381,7 @@ export class Destination extends LogicItem {
|
|
|
379
381
|
}
|
|
380
382
|
code += `${tab});\n`;
|
|
381
383
|
}
|
|
382
|
-
code += `${indent(state.tabSize + 1)}}\n
|
|
384
|
+
code += `${indent(state.tabSize + 1)}}\n`;
|
|
383
385
|
return code;
|
|
384
386
|
}
|
|
385
387
|
//================================================================================
|
package/src/concepts/End__.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
7
7
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
8
8
|
|
|
9
9
|
import * as utils from '../utils';
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
11
|
import BaseNode from '../common/BaseNode';
|
|
11
12
|
import classMap from '../common/classMap';
|
|
12
13
|
import LogicItem from './LogicItem__';
|
|
@@ -9,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
9
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
10
10
|
|
|
11
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
import BaseNode from '../common/BaseNode';
|
|
13
14
|
import classMap from '../common/classMap';
|
|
14
15
|
import Entity from './Entity__';
|
|
@@ -32,6 +33,12 @@ export class EntityIndex extends BaseNode {
|
|
|
32
33
|
@property()
|
|
33
34
|
name: string = undefined;
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 数据库索引名
|
|
38
|
+
*/
|
|
39
|
+
@property()
|
|
40
|
+
indexName: string = undefined;
|
|
41
|
+
|
|
35
42
|
/**
|
|
36
43
|
* propertyNames
|
|
37
44
|
*/
|
|
@@ -106,6 +113,18 @@ export class EntityIndex extends BaseNode {
|
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
|
|
116
|
+
/**
|
|
117
|
+
* 设置数据库索引名
|
|
118
|
+
*/
|
|
119
|
+
setIndexName(indexName: string) {
|
|
120
|
+
const object = {
|
|
121
|
+
indexName,
|
|
122
|
+
};
|
|
123
|
+
this.update({
|
|
124
|
+
...object,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
109
128
|
/**
|
|
110
129
|
* 设置propertyNames
|
|
111
130
|
*/
|
|
@@ -9,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
9
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
10
10
|
|
|
11
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
import BaseNode from '../common/BaseNode';
|
|
13
14
|
import classMap from '../common/classMap';
|
|
14
15
|
import TypeAnnotation from './TypeAnnotation__';
|
|
@@ -33,6 +34,12 @@ export class EntityProperty extends BaseNode {
|
|
|
33
34
|
@property()
|
|
34
35
|
name: string = undefined;
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* 唯一标识
|
|
39
|
+
*/
|
|
40
|
+
@property()
|
|
41
|
+
uuid: string = uuidv4().replace(/-/g, '');
|
|
42
|
+
|
|
36
43
|
/**
|
|
37
44
|
* 数据库列名
|
|
38
45
|
*/
|
|
@@ -99,12 +106,6 @@ export class EntityProperty extends BaseNode {
|
|
|
99
106
|
@property()
|
|
100
107
|
deleteRule: 'protect' | 'cascade' = undefined;
|
|
101
108
|
|
|
102
|
-
/**
|
|
103
|
-
* 是否可删除
|
|
104
|
-
*/
|
|
105
|
-
@property()
|
|
106
|
-
deletable: boolean = undefined;
|
|
107
|
-
|
|
108
109
|
/**
|
|
109
110
|
* 显示方式
|
|
110
111
|
*/
|
|
@@ -490,8 +491,8 @@ export class EntityProperty extends BaseNode {
|
|
|
490
491
|
/**
|
|
491
492
|
* 是否可编辑
|
|
492
493
|
* */
|
|
493
|
-
get
|
|
494
|
-
return !!this.module;
|
|
494
|
+
get readonly() {
|
|
495
|
+
return !!this.module || this.generationRule !== 'manual';
|
|
495
496
|
}
|
|
496
497
|
|
|
497
498
|
//================================================================================
|
package/src/concepts/Entity__.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
9
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
10
10
|
|
|
11
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
import BaseNode from '../common/BaseNode';
|
|
13
14
|
import classMap from '../common/classMap';
|
|
14
15
|
import EntityProperty from './EntityProperty__';
|
|
@@ -33,6 +34,12 @@ export class Entity extends BaseNode {
|
|
|
33
34
|
@property()
|
|
34
35
|
name: string = undefined;
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* 唯一标识
|
|
39
|
+
*/
|
|
40
|
+
@property()
|
|
41
|
+
uuid: string = uuidv4().replace(/-/g, '');
|
|
42
|
+
|
|
36
43
|
/**
|
|
37
44
|
* 数据库表名
|
|
38
45
|
*/
|
|
@@ -125,12 +132,12 @@ export class Entity extends BaseNode {
|
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
134
|
|
|
128
|
-
|
|
135
|
+
getPropertyExistingNames(excludedList: Array<EntityProperty> = []) {
|
|
129
136
|
const excludedSet = new Set(excludedList);
|
|
130
|
-
return this.properties.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
137
|
+
return (this.properties || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
131
138
|
}
|
|
132
|
-
|
|
133
|
-
return utils.unique(name, this.
|
|
139
|
+
getPropertyUniqueName(name = 'property1') {
|
|
140
|
+
return utils.unique(name, this.getPropertyExistingNames());
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
/**
|
|
@@ -138,70 +145,70 @@ export class Entity extends BaseNode {
|
|
|
138
145
|
* @internal
|
|
139
146
|
* @param name 实体字段名称,如果不填会自动生成一个唯一名称
|
|
140
147
|
*/
|
|
141
|
-
|
|
148
|
+
_insertPropertyAt(name: string, index: number): EntityProperty;
|
|
142
149
|
|
|
143
150
|
/**
|
|
144
151
|
* 插入实体字段
|
|
145
152
|
* @internal
|
|
146
|
-
* @param
|
|
153
|
+
* @param propertyOptions 实体字段参数
|
|
147
154
|
*/
|
|
148
|
-
|
|
155
|
+
_insertPropertyAt(propertyOptions: Partial<EntityProperty>, index: number): EntityProperty;
|
|
149
156
|
|
|
150
157
|
/**
|
|
151
158
|
* 插入实体字段
|
|
152
159
|
* @internal
|
|
153
|
-
* @param
|
|
160
|
+
* @param property 已有的实体字段实例
|
|
154
161
|
*/
|
|
155
|
-
|
|
162
|
+
_insertPropertyAt(property: EntityProperty, index: number): EntityProperty;
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
const
|
|
164
|
+
_insertPropertyAt(options: string | Partial<EntityProperty> | EntityProperty, index: number) {
|
|
165
|
+
const propertyOptions: any = {};
|
|
159
166
|
const relationOptions = { parentNode: this, parentKey: 'properties' };
|
|
160
|
-
let
|
|
167
|
+
let property: EntityProperty;
|
|
161
168
|
if (!options) {
|
|
162
|
-
|
|
163
|
-
...
|
|
164
|
-
name: this.
|
|
169
|
+
property = EntityProperty.from({
|
|
170
|
+
...propertyOptions,
|
|
171
|
+
name: this.getPropertyUniqueName(),
|
|
165
172
|
}, this, 'properties');
|
|
166
173
|
} else if (typeof options === 'string') {
|
|
167
|
-
|
|
168
|
-
...
|
|
174
|
+
property = EntityProperty.from({
|
|
175
|
+
...propertyOptions,
|
|
169
176
|
name: options,
|
|
170
177
|
}, this, 'properties');
|
|
171
178
|
} else if (options instanceof EntityProperty) {
|
|
172
179
|
options.delete(); // 同一实例不支持多处存在
|
|
173
|
-
|
|
174
|
-
Object.assign(
|
|
180
|
+
property = options;
|
|
181
|
+
Object.assign(property, relationOptions);
|
|
175
182
|
} else {
|
|
176
|
-
|
|
177
|
-
...
|
|
183
|
+
property = EntityProperty.from({
|
|
184
|
+
...propertyOptions,
|
|
178
185
|
...options,
|
|
179
186
|
}, this, 'properties');
|
|
180
187
|
}
|
|
181
|
-
this.properties.splice(index, 0,
|
|
182
|
-
return
|
|
188
|
+
this.properties.splice(index, 0, property);
|
|
189
|
+
return property;
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
/**
|
|
186
193
|
* 插入实体字段
|
|
187
194
|
* @param name 实体字段名称,如果不填会自动生成一个唯一名称
|
|
188
195
|
*/
|
|
189
|
-
|
|
196
|
+
insertPropertyAt(name: string, index: number): EntityProperty;
|
|
190
197
|
|
|
191
198
|
/**
|
|
192
199
|
* 插入实体字段
|
|
193
|
-
* @param
|
|
200
|
+
* @param propertyOptions 实体字段参数
|
|
194
201
|
*/
|
|
195
|
-
|
|
202
|
+
insertPropertyAt(propertyOptions: Partial<EntityProperty>, index: number): EntityProperty;
|
|
196
203
|
|
|
197
204
|
/**
|
|
198
205
|
* 插入实体字段
|
|
199
|
-
* @param
|
|
206
|
+
* @param property 已有的实体字段实例
|
|
200
207
|
*/
|
|
201
|
-
|
|
208
|
+
insertPropertyAt(property: EntityProperty, index: number): EntityProperty;
|
|
202
209
|
|
|
203
|
-
|
|
204
|
-
const node = this.
|
|
210
|
+
insertPropertyAt(options: string | Partial<EntityProperty> | EntityProperty, index: number) {
|
|
211
|
+
const node = this._insertPropertyAt(options as any, index);
|
|
205
212
|
node.create({
|
|
206
213
|
index,
|
|
207
214
|
parentNode: this,
|
|
@@ -215,25 +222,25 @@ export class Entity extends BaseNode {
|
|
|
215
222
|
* @internal
|
|
216
223
|
* @param name 实体字段名称,如果不填会自动生成一个唯一名称
|
|
217
224
|
*/
|
|
218
|
-
|
|
225
|
+
_addProperty(name?: string): EntityProperty;
|
|
219
226
|
|
|
220
227
|
/**
|
|
221
228
|
* 添加实体字段
|
|
222
229
|
* @internal
|
|
223
|
-
* @param
|
|
230
|
+
* @param propertyOptions 实体字段参数
|
|
224
231
|
*/
|
|
225
|
-
|
|
232
|
+
_addProperty(propertyOptions: Partial<EntityProperty>): EntityProperty;
|
|
226
233
|
|
|
227
234
|
/**
|
|
228
235
|
* 添加实体字段
|
|
229
236
|
* @internal
|
|
230
|
-
* @param
|
|
237
|
+
* @param property 已有的实体字段实例
|
|
231
238
|
*/
|
|
232
|
-
|
|
239
|
+
_addProperty(property: EntityProperty): EntityProperty;
|
|
233
240
|
|
|
234
|
-
|
|
241
|
+
_addProperty(options?: string | Partial<EntityProperty> | EntityProperty) {
|
|
235
242
|
const index = this.properties.length;
|
|
236
|
-
return this.
|
|
243
|
+
return this._insertPropertyAt(options as any, index);
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
/**
|
|
@@ -241,22 +248,22 @@ export class Entity extends BaseNode {
|
|
|
241
248
|
* @internal
|
|
242
249
|
* @param name 实体字段名称,如果不填会自动生成一个唯一名称
|
|
243
250
|
*/
|
|
244
|
-
|
|
251
|
+
addProperty(name?: string): EntityProperty;
|
|
245
252
|
|
|
246
253
|
/**
|
|
247
254
|
* 添加实体字段
|
|
248
|
-
* @param
|
|
255
|
+
* @param propertyOptions 实体字段参数
|
|
249
256
|
*/
|
|
250
|
-
|
|
257
|
+
addProperty(propertyOptions: Partial<EntityProperty>): EntityProperty;
|
|
251
258
|
|
|
252
259
|
/**
|
|
253
260
|
* 添加实体字段
|
|
254
|
-
* @param
|
|
261
|
+
* @param property 已有的实体字段实例
|
|
255
262
|
*/
|
|
256
|
-
|
|
263
|
+
addProperty(property: EntityProperty): EntityProperty;
|
|
257
264
|
|
|
258
|
-
|
|
259
|
-
const node = this.
|
|
265
|
+
addProperty(options?: string | Partial<EntityProperty> | EntityProperty) {
|
|
266
|
+
const node = this._addProperty(options as any);
|
|
260
267
|
const index = this.properties.length;
|
|
261
268
|
node.create({
|
|
262
269
|
index,
|
|
@@ -269,7 +276,7 @@ export class Entity extends BaseNode {
|
|
|
269
276
|
|
|
270
277
|
getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
|
|
271
278
|
const excludedSet = new Set(excludedList);
|
|
272
|
-
return this.indexes.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
279
|
+
return (this.indexes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
273
280
|
}
|
|
274
281
|
getEntityIndexUniqueName(name = 'entityIndex1') {
|
|
275
282
|
return utils.unique(name, this.getEntityIndexExistingNames());
|
|
@@ -415,43 +422,43 @@ export class Entity extends BaseNode {
|
|
|
415
422
|
* 删除实体字段
|
|
416
423
|
* @param name 实体字段名称
|
|
417
424
|
*/
|
|
418
|
-
|
|
425
|
+
removeProperty(name: string): void;
|
|
419
426
|
|
|
420
427
|
/**
|
|
421
428
|
* 删除实体字段
|
|
422
|
-
* @param
|
|
429
|
+
* @param property 已有的实体字段实例
|
|
423
430
|
*/
|
|
424
|
-
|
|
431
|
+
removeProperty(property: EntityProperty): void;
|
|
425
432
|
|
|
426
|
-
|
|
427
|
-
let
|
|
433
|
+
removeProperty(options: string | EntityProperty) {
|
|
434
|
+
let property: EntityProperty;
|
|
428
435
|
if (typeof options === 'string') {
|
|
429
|
-
|
|
430
|
-
if (!
|
|
436
|
+
property = this.properties.find((item) => item.name === options);
|
|
437
|
+
if (!property) {
|
|
431
438
|
throw new Error('找不到实体字段 ' + options);
|
|
432
439
|
}
|
|
433
440
|
} else {
|
|
434
|
-
|
|
441
|
+
property = options;
|
|
435
442
|
}
|
|
436
|
-
return
|
|
443
|
+
return property.delete();
|
|
437
444
|
}
|
|
438
445
|
|
|
439
|
-
__removeEntityProperty(
|
|
440
|
-
const parentKey =
|
|
446
|
+
__removeEntityProperty(property: EntityProperty) {
|
|
447
|
+
const parentKey = property.parentKey;
|
|
441
448
|
const params: Params = {
|
|
442
449
|
parentNode: this,
|
|
443
450
|
parentKey,
|
|
444
451
|
index: -1,
|
|
445
452
|
object: null,
|
|
446
|
-
oldObject:
|
|
453
|
+
oldObject: property,
|
|
447
454
|
};
|
|
448
455
|
if (parentKey) {
|
|
449
456
|
params.parentKey = parentKey;
|
|
450
457
|
if (Array.isArray((this as any)[parentKey])) {
|
|
451
|
-
const index = (this as any)[parentKey].indexOf(
|
|
458
|
+
const index = (this as any)[parentKey].indexOf(property);
|
|
452
459
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
453
460
|
params.index = index;
|
|
454
|
-
} else if ((this as any)[parentKey] ===
|
|
461
|
+
} else if ((this as any)[parentKey] === property) {
|
|
455
462
|
params.index = 0;
|
|
456
463
|
(this as any)[parentKey] = undefined;
|
|
457
464
|
}
|
|
@@ -8,6 +8,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
8
8
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
9
9
|
|
|
10
10
|
import * as utils from '../utils';
|
|
11
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
12
|
import BaseNode from '../common/BaseNode';
|
|
12
13
|
import classMap from '../common/classMap';
|
|
13
14
|
import Enum from './Enum__';
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
9
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
10
10
|
|
|
11
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
import BaseNode from '../common/BaseNode';
|
|
13
14
|
import classMap from '../common/classMap';
|
|
14
15
|
import EnumItem from './EnumItem__';
|
|
@@ -124,18 +125,22 @@ export class Enum extends BaseNode {
|
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
127
132
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
* 插入枚举项
|
|
134
|
+
* @internal
|
|
135
|
+
* @param enumItemOptions 枚举项参数
|
|
136
|
+
*/
|
|
132
137
|
_insertEnumItemAt(enumItemOptions: Partial<EnumItem>, index: number): EnumItem;
|
|
133
138
|
|
|
134
139
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
* 插入枚举项
|
|
141
|
+
* @internal
|
|
142
|
+
* @param enumItem 已有的枚举项实例
|
|
143
|
+
*/
|
|
139
144
|
_insertEnumItemAt(enumItem: EnumItem, index: number): EnumItem;
|
|
140
145
|
|
|
141
146
|
_insertEnumItemAt(options: Partial<EnumItem> | EnumItem, index: number) {
|
|
@@ -156,6 +161,8 @@ export class Enum extends BaseNode {
|
|
|
156
161
|
return enumItem;
|
|
157
162
|
}
|
|
158
163
|
|
|
164
|
+
|
|
165
|
+
|
|
159
166
|
/**
|
|
160
167
|
* 插入枚举项
|
|
161
168
|
* @param enumItemOptions 枚举项参数
|
|
@@ -178,6 +185,8 @@ export class Enum extends BaseNode {
|
|
|
178
185
|
return node;
|
|
179
186
|
}
|
|
180
187
|
|
|
188
|
+
|
|
189
|
+
|
|
181
190
|
/**
|
|
182
191
|
* 添加枚举项
|
|
183
192
|
* @internal
|
|
@@ -197,6 +206,8 @@ export class Enum extends BaseNode {
|
|
|
197
206
|
return this._insertEnumItemAt(options as any, index);
|
|
198
207
|
}
|
|
199
208
|
|
|
209
|
+
|
|
210
|
+
|
|
200
211
|
/**
|
|
201
212
|
* 添加枚举项
|
|
202
213
|
* @param enumItemOptions 枚举项参数
|
|
@@ -220,6 +231,9 @@ export class Enum extends BaseNode {
|
|
|
220
231
|
return node;
|
|
221
232
|
}
|
|
222
233
|
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
223
237
|
/**
|
|
224
238
|
* 删除枚举项
|
|
225
239
|
* @param enumItem 已有的枚举项实例
|
|
@@ -227,7 +241,7 @@ export class Enum extends BaseNode {
|
|
|
227
241
|
removeEnumItem(enumItem: EnumItem): void;
|
|
228
242
|
|
|
229
243
|
removeEnumItem(options: EnumItem) {
|
|
230
|
-
|
|
244
|
+
let enumItem: EnumItem = options;
|
|
231
245
|
return enumItem.delete();
|
|
232
246
|
}
|
|
233
247
|
|
|
@@ -270,12 +284,18 @@ export class Enum extends BaseNode {
|
|
|
270
284
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
271
285
|
let code = `export class ${this.name} {\n`;
|
|
272
286
|
// 增加一个单独的标签
|
|
273
|
-
code += indent(state.tabSize + 1) + `__name: '${this.getNamespace()}.${this.name}';\n`;
|
|
287
|
+
code += indent(state.tabSize + 1) + `static __name: '${this.getNamespace()}.${this.name}';\n`;
|
|
274
288
|
this.enumItems.forEach((property) => {
|
|
275
289
|
code += indent(state.tabSize + 1);
|
|
276
290
|
code += property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
277
291
|
code += ';\n';
|
|
278
292
|
});
|
|
293
|
+
code += `
|
|
294
|
+
static toList(): nasl.collection.List<{ text: string, value: string }> {
|
|
295
|
+
let value: nasl.collection.List<{ text: string, value: string }>
|
|
296
|
+
return value;
|
|
297
|
+
}
|
|
298
|
+
`;
|
|
279
299
|
code += indent(state.tabSize) + '}\n';
|
|
280
300
|
|
|
281
301
|
return code;
|
|
@@ -283,7 +303,7 @@ export class Enum extends BaseNode {
|
|
|
283
303
|
|
|
284
304
|
getNamespace() {
|
|
285
305
|
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
286
|
-
return
|
|
306
|
+
return `${(this.parentNode as Namespace).getNamespace()}.enums`;
|
|
287
307
|
} else
|
|
288
308
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
289
309
|
}
|
|
@@ -317,7 +337,7 @@ export class Enum extends BaseNode {
|
|
|
317
337
|
//================================================================================
|
|
318
338
|
}
|
|
319
339
|
|
|
320
|
-
classMap
|
|
340
|
+
classMap['Enum'] = Enum;
|
|
321
341
|
export default Enum;
|
|
322
342
|
//================================================================================
|
|
323
343
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Event__.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
6
6
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
7
7
|
|
|
8
8
|
import * as utils from '../utils';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
10
|
import BaseNode from '../common/BaseNode';
|
|
10
11
|
import classMap from '../common/classMap';
|
|
11
12
|
import Param from './Param__';
|
|
@@ -107,7 +108,7 @@ export class Event extends BaseNode {
|
|
|
107
108
|
|
|
108
109
|
getParamExistingNames(excludedList: Array<Param> = []) {
|
|
109
110
|
const excludedSet = new Set(excludedList);
|
|
110
|
-
return this.params.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
111
|
+
return (this.params || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
111
112
|
}
|
|
112
113
|
getParamUniqueName(name = 'param1') {
|
|
113
114
|
return utils.unique(name, this.getParamExistingNames());
|