@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
package/src/server/naslServer.ts
CHANGED
|
@@ -34,12 +34,16 @@ import {
|
|
|
34
34
|
BindAttribute,
|
|
35
35
|
Assignment,
|
|
36
36
|
CallQueryComponent,
|
|
37
|
+
Role,
|
|
38
|
+
Configuration,
|
|
37
39
|
} from '../concepts';
|
|
38
40
|
import { lsp2tspNumber, SourceMap, SourceMapItem, embeddedTSEmitter } from '../translator';
|
|
39
41
|
import axios from '../service/storage';
|
|
40
42
|
import { transformType, translateDiagnosticMessage } from './translator';
|
|
41
43
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
42
44
|
import { DiagnosticRecord, Diagnostic, default as diagnosticManager } from '../manager/diagnostic';
|
|
45
|
+
import formatUiTs from './createUiTs';
|
|
46
|
+
import { primitiveTypeList } from '../concepts/basics/types/coreTypeList';
|
|
43
47
|
|
|
44
48
|
const EmbeddedTSFileLineMap: { [name: string]: number } = {
|
|
45
49
|
Entity: 3,
|
|
@@ -108,9 +112,21 @@ const naslServer = {
|
|
|
108
112
|
* 先用挂在点上面,简单的方法实现,后期再考虑解耦
|
|
109
113
|
*/
|
|
110
114
|
file2NodeMap: new Map<string, BaseNode>(),
|
|
115
|
+
elementsLogic: <{ [elementLogicName: string]: Array<Logic> }>{},
|
|
111
116
|
start() {
|
|
112
117
|
return this.messager.requestCommand('start');
|
|
113
118
|
},
|
|
119
|
+
async createUiTs(allComponent: any) {
|
|
120
|
+
const { code, elementsLogic } = await formatUiTs(allComponent);
|
|
121
|
+
// 放入生產的uits文件
|
|
122
|
+
await naslServer.addFile({
|
|
123
|
+
file: 'nasl.ui.definition.ts',
|
|
124
|
+
fileContent: code,
|
|
125
|
+
});
|
|
126
|
+
naslServer.elementsLogic = elementsLogic;
|
|
127
|
+
// 全部文件加载完毕开始初始化
|
|
128
|
+
await naslServer.getDiagnosticRecordsAndPushAll();
|
|
129
|
+
},
|
|
114
130
|
contentToFile(module: Module | App, results: Array<ReturnType<Structure['toEmbeddedTSFile']>>) {
|
|
115
131
|
module.structures.forEach((structure) => {
|
|
116
132
|
const result = structure.toEmbeddedTSFile();
|
|
@@ -141,18 +157,17 @@ const naslServer = {
|
|
|
141
157
|
this.file2NodeMap.set(result.filePath, _enum);
|
|
142
158
|
});
|
|
143
159
|
module.logics.forEach((logic) => {
|
|
160
|
+
if (!(logic instanceof Logic))
|
|
161
|
+
return;
|
|
144
162
|
const result = logic.toEmbeddedTSFile();
|
|
145
163
|
results.push(result);
|
|
146
164
|
logic.sourceMap = result.sourceMap;
|
|
147
165
|
this.file2NodeMap.set(result.filePath, logic);
|
|
148
166
|
});
|
|
149
167
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
view.sourceMap = result.sourceMap;
|
|
154
|
-
this.file2NodeMap.set(result.filePath, view);
|
|
155
|
-
});
|
|
168
|
+
// view的生成
|
|
169
|
+
naslServer.view2TSFile(module.views, results);
|
|
170
|
+
|
|
156
171
|
module.processes.forEach((process) => {
|
|
157
172
|
const result = process.toEmbeddedTSFile();
|
|
158
173
|
results.push(result);
|
|
@@ -170,6 +185,18 @@ const naslServer = {
|
|
|
170
185
|
});
|
|
171
186
|
}
|
|
172
187
|
},
|
|
188
|
+
view2TSFile(viewsChildren: View[], results: Array<ReturnType<Structure['toEmbeddedTSFile']>>) {
|
|
189
|
+
// 子页面
|
|
190
|
+
viewsChildren.forEach((view) => {
|
|
191
|
+
const result = view.toEmbeddedTSFile();
|
|
192
|
+
results.push(result);
|
|
193
|
+
view.sourceMap = result.sourceMap;
|
|
194
|
+
this.file2NodeMap.set(result.filePath, view);
|
|
195
|
+
if (view.children.length) {
|
|
196
|
+
naslServer.view2TSFile(view.children, results);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
},
|
|
173
200
|
async openApp(app: App) {
|
|
174
201
|
const results: Array<ReturnType<Structure['toEmbeddedTSFile']>> = [];
|
|
175
202
|
try {
|
|
@@ -210,7 +237,13 @@ const naslServer = {
|
|
|
210
237
|
fileContent: result.code,
|
|
211
238
|
}));
|
|
212
239
|
await this.writeFiles(files);
|
|
213
|
-
this._debugInFileStorage(
|
|
240
|
+
this._debugInFileStorage(module.parentNode as App, files);
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* 初始化之前添加文件
|
|
244
|
+
*/
|
|
245
|
+
addFile(file: tsProtocol.OpenRequestArgs) {
|
|
246
|
+
return this.messager.requestCommand('addFile', file);
|
|
214
247
|
},
|
|
215
248
|
/**
|
|
216
249
|
* 只新增文件
|
|
@@ -235,11 +268,15 @@ const naslServer = {
|
|
|
235
268
|
updateFiles(args: { outputFiles: Array<tsProtocol.OpenRequestArgs> }) {
|
|
236
269
|
return this.messager.requestCommand('updateFiles', args);
|
|
237
270
|
},
|
|
238
|
-
_debugInFileStorage(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
271
|
+
_debugInFileStorage(node: BaseNode, openFiles: Array<tsProtocol.OpenRequestArgs>) {
|
|
272
|
+
// let app = node;
|
|
273
|
+
// if (node.concept !== 'App') {
|
|
274
|
+
// app = (node as any).rootNode || (node as any).app;
|
|
275
|
+
// }
|
|
276
|
+
// return Promise.all(openFiles.map(async (file) => {
|
|
277
|
+
// const res = await axios.post('/api/App/debugEmbedded?id=' + app.id, file);
|
|
278
|
+
// return res.data;
|
|
279
|
+
// }));
|
|
243
280
|
},
|
|
244
281
|
open() {
|
|
245
282
|
return this.messager.requestCommand('open');
|
|
@@ -253,23 +290,87 @@ const naslServer = {
|
|
|
253
290
|
async references(args: tsProtocol.FileLocationRequestArgs) {
|
|
254
291
|
return ((await this.messager.requestCommand('references', args)) as any)?.response as tsProtocol.ReferencesResponseBody;
|
|
255
292
|
},
|
|
256
|
-
|
|
293
|
+
getValueSelectCompletion(node: BaseNode, value: string) {
|
|
257
294
|
const { currentSource, fileNode } = naslServer.getCurrentSource(node);
|
|
258
295
|
// console.log(currentSource, fileNode);
|
|
259
296
|
if (currentSource && fileNode) {
|
|
260
|
-
return naslServer.
|
|
297
|
+
return naslServer._getValueSelectCompletion({
|
|
261
298
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
262
299
|
range: {
|
|
263
300
|
line: lsp2tspNumber(currentSource.range.start.line),
|
|
264
301
|
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
265
302
|
},
|
|
303
|
+
value,
|
|
266
304
|
});
|
|
267
305
|
} else {
|
|
268
306
|
console.log('没找到节点', node, currentSource, fileNode);
|
|
269
307
|
}
|
|
270
308
|
},
|
|
271
|
-
|
|
272
|
-
return this.messager.requestCommand('
|
|
309
|
+
_getValueSelectCompletion(args: any) {
|
|
310
|
+
return this.messager.requestCommand('getValueSelectCompletion', args);
|
|
311
|
+
},
|
|
312
|
+
// 联合类型切割取出类型
|
|
313
|
+
getDisplayString2Type(displayString: string) {
|
|
314
|
+
// 取出匹配的内容
|
|
315
|
+
const reg = /\<([^()]+)\>/g;
|
|
316
|
+
const types = reg.exec(displayString);
|
|
317
|
+
// 取出提示的类型,组成是数组
|
|
318
|
+
const typeList: string[] = types[1].split(' | ').map((item: string) => {
|
|
319
|
+
if (item.includes(' ')) {
|
|
320
|
+
const strs = item.split(' ');
|
|
321
|
+
const type = strs[strs.length - 1];
|
|
322
|
+
return type;
|
|
323
|
+
} else if (item.includes('.')) {
|
|
324
|
+
const strs = item.split('.');
|
|
325
|
+
const type = strs[strs.length - 1];
|
|
326
|
+
return type;
|
|
327
|
+
} else {
|
|
328
|
+
return item;
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
return typeList;
|
|
332
|
+
},
|
|
333
|
+
async getTypeQuickinfo(node: BaseNode) {
|
|
334
|
+
console.log(node);
|
|
335
|
+
if (node instanceof Identifier) {
|
|
336
|
+
const callFunction = node.parentNode.parentNode;
|
|
337
|
+
/**
|
|
338
|
+
* currentSource callFunction 的节点,要去到当前节点的位置
|
|
339
|
+
* nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
|
|
340
|
+
* fileNode
|
|
341
|
+
*/
|
|
342
|
+
const { currentSource, fileNode } = naslServer.getCurrentSource(callFunction);
|
|
343
|
+
const quickInfo = await naslServer._getTypeQuickinfo({
|
|
344
|
+
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
345
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
346
|
+
offset: lsp2tspNumber(currentSource.range.start.character) + `nasl.util.C`.length,
|
|
347
|
+
});
|
|
348
|
+
if (quickInfo.responseRequired) {
|
|
349
|
+
const displayString = quickInfo?.response?.displayString || '';
|
|
350
|
+
const typeList = naslServer.getDisplayString2Type(displayString);
|
|
351
|
+
let res: Array<TypeAnnotation> = [];
|
|
352
|
+
typeList.forEach((type) => {
|
|
353
|
+
const typeAnnotation = primitiveTypeList.find((typeAnnotation) => typeAnnotation.typeName === type);
|
|
354
|
+
if (typeAnnotation) {
|
|
355
|
+
res.push(typeAnnotation);
|
|
356
|
+
} else if (type === 'unknown') {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
if (!res.length) {
|
|
361
|
+
res = primitiveTypeList;
|
|
362
|
+
}
|
|
363
|
+
// 调整结构
|
|
364
|
+
const dataTypeList: Array<{
|
|
365
|
+
title: string;
|
|
366
|
+
children: Array<TypeAnnotation>;
|
|
367
|
+
}> = [{ title: '基础类型', children: res }];
|
|
368
|
+
return dataTypeList;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
_getTypeQuickinfo(args: any) {
|
|
373
|
+
return this.messager.requestCommand('quickInfo', args) as unknown as { responseRequired: boolean; response: tsProtocol.QuickInfoResponseBody };
|
|
273
374
|
},
|
|
274
375
|
getSelectNextCompletion(node: BaseNode) {
|
|
275
376
|
const { currentSource, fileNode } = naslServer.getCurrentSource(node);
|
|
@@ -320,10 +421,15 @@ const naslServer = {
|
|
|
320
421
|
// 实体下的建议不用展示,因为都是平台自己写的逻辑
|
|
321
422
|
if (node instanceof Entity) {
|
|
322
423
|
record.suggestionDiagnostics = [];
|
|
323
|
-
}
|
|
424
|
+
}
|
|
425
|
+
if (node instanceof View) {
|
|
324
426
|
// event在view中不展示建议使用,提示关闭掉
|
|
325
427
|
record.suggestionDiagnostics = record.suggestionDiagnostics.filter((item) => !item.text.includes(`'event'`));
|
|
326
428
|
}
|
|
429
|
+
if (node instanceof Logic) {
|
|
430
|
+
// logic在for循环中,不展示any提示
|
|
431
|
+
record.suggestionDiagnostics = record.suggestionDiagnostics.filter((item) => !item.text.includes(`implicitly has an 'any' type, but a better type may be inferred from usage.`));
|
|
432
|
+
}
|
|
327
433
|
record.suggestionDiagnostics = record.suggestionDiagnostics
|
|
328
434
|
.map((diag) => this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, node.sourceMap))
|
|
329
435
|
.filter((diag) => !!diag);
|
|
@@ -361,7 +467,7 @@ const naslServer = {
|
|
|
361
467
|
_diagnosticSpecialTreatment(minRange: MinRange, tsErrorDetail: Diagnostic) {
|
|
362
468
|
// 因为缺少参数时候有可能有特殊情况,因为原本少的多了就会找到 callLogic上,
|
|
363
469
|
// 但是只少一个的时候就会找到准确的Argument上 需要特殊处理, ui层就可以统一处理
|
|
364
|
-
if (minRange.node instanceof Argument && /Expected (.+?) arguments, but got (.+?)./.exec(tsErrorDetail.text)) {
|
|
470
|
+
if (minRange.node instanceof Argument && /Expected (.+?) arguments, but got (.+?)./.exec(tsErrorDetail.originalDiagnostic.text)) {
|
|
365
471
|
minRange.node = minRange.node.parentNode;
|
|
366
472
|
}
|
|
367
473
|
minRange.node.tsErrorDetail = tsErrorDetail;
|
|
@@ -515,6 +621,31 @@ const naslServer = {
|
|
|
515
621
|
});
|
|
516
622
|
refsList = [...viewRefs.refs];
|
|
517
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
|
|
626
|
+
*/
|
|
627
|
+
if (node instanceof ViewElement) {
|
|
628
|
+
const code = currentSource.code;
|
|
629
|
+
const prefix = '__elements.';
|
|
630
|
+
const prefixIndex = code.indexOf(prefix) !== -1 ? code.indexOf(prefix) : 0;
|
|
631
|
+
const methodsNameIndex = prefixIndex + prefix.length;
|
|
632
|
+
const methods = await naslServer.references({
|
|
633
|
+
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
634
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
635
|
+
offset: lsp2tspNumber(currentSource.range.start.character + methodsNameIndex),
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
const methodRefs = methods.refs.filter((item) => {
|
|
639
|
+
if (item.lineText.includes('__elements.') && item.lineText.includes('new nasl.ui.')) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
if (item.lineText.includes(': <nasl.ui.')) {
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
return true;
|
|
646
|
+
});
|
|
647
|
+
refsList = [...methodRefs];
|
|
648
|
+
}
|
|
518
649
|
return refsList;
|
|
519
650
|
},
|
|
520
651
|
/**
|
|
@@ -545,6 +676,10 @@ const naslServer = {
|
|
|
545
676
|
if (minRange.node instanceof CallLogic && node instanceof Logic) {
|
|
546
677
|
minRange.setTypeMethods = 'setCalleeName';
|
|
547
678
|
}
|
|
679
|
+
if (minRange.node instanceof CallLogic && node instanceof ViewElement) {
|
|
680
|
+
minRange.setTypeMethods = 'setCalleeName';
|
|
681
|
+
minRange.newValue = 'elements.' + newValue + '.logics';
|
|
682
|
+
}
|
|
548
683
|
// 如果节点是实体修改引发calllogic修改
|
|
549
684
|
if (minRange.node instanceof CallLogic && (node instanceof Entity || node instanceof View)) {
|
|
550
685
|
// 匹配到的内容,当前这一行的内容;
|
|
@@ -609,6 +744,11 @@ const naslServer = {
|
|
|
609
744
|
minRange.newValue = newTextValue;
|
|
610
745
|
}
|
|
611
746
|
}
|
|
747
|
+
// 如果修改逻辑,改到了Identifier表达式,只能说明是在属性里有使用了
|
|
748
|
+
if (minRange.node instanceof Identifier && node instanceof Logic) {
|
|
749
|
+
minRange.newValue = newValue;
|
|
750
|
+
minRange.setTypeMethods = 'setName';
|
|
751
|
+
}
|
|
612
752
|
// 如果节点是MemberExpression表达式
|
|
613
753
|
if (minRange.node instanceof MemberExpression) {
|
|
614
754
|
// 匹配到的内容,当前这一行的内容;
|
|
@@ -711,6 +851,19 @@ const naslServer = {
|
|
|
711
851
|
minRange.newValue = newTsNameSpace;
|
|
712
852
|
}
|
|
713
853
|
}
|
|
854
|
+
if (minRange.node instanceof Interface && node instanceof Logic) {
|
|
855
|
+
minRange.setTypeMethods = 'setOriginLogicName';
|
|
856
|
+
}
|
|
857
|
+
// 如果是role改名,就需要查到变更后的数组
|
|
858
|
+
if ((minRange.node instanceof View || minRange.node instanceof ViewElement) && node instanceof Role) {
|
|
859
|
+
// oldName旧的节点存的值
|
|
860
|
+
// newValue用户输入值
|
|
861
|
+
// node.bindRoles 存的
|
|
862
|
+
minRange.setTypeMethods = 'setBindRoles';
|
|
863
|
+
const str = minRange.node.bindRoles.toString().replace(oldName, newValue);
|
|
864
|
+
const newBindRoles = str.split(',');
|
|
865
|
+
minRange.newValue = newBindRoles;
|
|
866
|
+
}
|
|
714
867
|
// 枚举修改枚举名,比较特殊
|
|
715
868
|
if (minRange.node instanceof EnumItem && node instanceof Enum) {
|
|
716
869
|
// 什么都不做,用来跳过修改
|
|
@@ -725,6 +878,10 @@ const naslServer = {
|
|
|
725
878
|
if (minRange.node instanceof View && node instanceof View && minRange.node !== node) {
|
|
726
879
|
return null;
|
|
727
880
|
}
|
|
881
|
+
// 逻辑改名,触发了在定义里面的,element定义,的值,直接掠过
|
|
882
|
+
if (minRange.node instanceof View && node instanceof Logic) {
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
728
885
|
} else {
|
|
729
886
|
console.log('没找到节点需要排查');
|
|
730
887
|
console.log(record, fileNode.sourceMap);
|
|
@@ -920,7 +1077,7 @@ const naslServer = {
|
|
|
920
1077
|
}
|
|
921
1078
|
},
|
|
922
1079
|
// 获取element方法的可选值
|
|
923
|
-
|
|
1080
|
+
getFieldKeySelectCompletion(node: BaseNode, fieldKey?: string) {
|
|
924
1081
|
const { currentSource, fileNode } = naslServer.getCurrentSource(node);
|
|
925
1082
|
console.log(currentSource);
|
|
926
1083
|
if (currentSource && fileNode) {
|
|
@@ -930,7 +1087,7 @@ const naslServer = {
|
|
|
930
1087
|
line: lsp2tspNumber(currentSource.range.start.line),
|
|
931
1088
|
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
932
1089
|
},
|
|
933
|
-
getFieldKey,
|
|
1090
|
+
getFieldKey: fieldKey,
|
|
934
1091
|
});
|
|
935
1092
|
} else {
|
|
936
1093
|
console.log('没找到节点', currentSource, fileNode);
|
|
@@ -984,6 +1141,8 @@ BaseNode.prototype.findUsage = function findUsage() {
|
|
|
984
1141
|
}
|
|
985
1142
|
};
|
|
986
1143
|
BaseNode.prototype.changeName = async function changeName(newValue: string, updateAll: boolean = false) {
|
|
1144
|
+
console.log(newValue);
|
|
1145
|
+
console.log(this);
|
|
987
1146
|
try {
|
|
988
1147
|
/**
|
|
989
1148
|
* 查找这个节点是不是有依赖
|
|
@@ -1068,10 +1227,11 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1068
1227
|
} else {
|
|
1069
1228
|
// 如果有依赖就有一个查找引用提示
|
|
1070
1229
|
confirmParms.tipFlag = true;
|
|
1230
|
+
const node = this;
|
|
1071
1231
|
callback = () => {
|
|
1072
1232
|
// removeParam
|
|
1073
1233
|
// 跟rename 还不太一样,部分修改依赖修改好的值,然后在下面的修改需要把自己传递进去
|
|
1074
|
-
if (
|
|
1234
|
+
if (node instanceof Param) {
|
|
1075
1235
|
const App = this.rootNode;
|
|
1076
1236
|
const logicNode = this.parentNode;
|
|
1077
1237
|
// 收集修改
|
|
@@ -1092,6 +1252,26 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1092
1252
|
App.emit('collect:end');
|
|
1093
1253
|
return;
|
|
1094
1254
|
}
|
|
1255
|
+
// 删除logic节点,如果有对应的interface要一起删除
|
|
1256
|
+
if (node instanceof Logic) {
|
|
1257
|
+
const App = this.rootNode;
|
|
1258
|
+
// 收集修改
|
|
1259
|
+
App.emit('collect:start');
|
|
1260
|
+
this.delete();
|
|
1261
|
+
refsList.forEach((record) => {
|
|
1262
|
+
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
1263
|
+
if (!fileNode)
|
|
1264
|
+
return null;
|
|
1265
|
+
const minRange: MinRange = naslServer._findMinRange(record, fileNode.sourceMap);
|
|
1266
|
+
if (minRange) {
|
|
1267
|
+
if (minRange.node instanceof Interface) {
|
|
1268
|
+
minRange.node.delete();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
// 结束修改 ,批量操作
|
|
1273
|
+
App.emit('collect:end');
|
|
1274
|
+
}
|
|
1095
1275
|
// 其余的都直接调用删除
|
|
1096
1276
|
this.delete();
|
|
1097
1277
|
};
|
|
@@ -1235,8 +1415,8 @@ async function receiveHandleChange($event: EventPayload) {
|
|
|
1235
1415
|
const targetNode = $event.target;
|
|
1236
1416
|
// 当前操作的文件节点
|
|
1237
1417
|
const { fileNode } = naslServer.getCurrentSource(targetNode);
|
|
1238
|
-
// 如果是导入模块就,就引入对应模块,先不处理module,下面的内容会自动创建
|
|
1239
|
-
if (fileNode instanceof Module) {
|
|
1418
|
+
// 如果是导入模块就,就引入对应模块,先不处理module和Configuration,下面的内容会自动创建
|
|
1419
|
+
if (fileNode instanceof Module || fileNode instanceof Configuration) {
|
|
1240
1420
|
return;
|
|
1241
1421
|
}
|
|
1242
1422
|
|
|
@@ -1273,7 +1453,7 @@ embeddedTSEmitter.on('change', ($event: EventPayload) => {
|
|
|
1273
1453
|
// 收集到一个行为集合
|
|
1274
1454
|
const eventValue = $event.value;
|
|
1275
1455
|
eventValue.forEach((item: EventPayload) => {
|
|
1276
|
-
receiveHandleChange(item);
|
|
1456
|
+
receiveHandleChange(item.originEvent);
|
|
1277
1457
|
});
|
|
1278
1458
|
});
|
|
1279
1459
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallLogic, BindEvent, App, Namespace, Entity, BaseNode, Logic, Param, TypeAnnotation, Return, Process } from '..';
|
|
1
|
+
import { CallLogic, BindEvent, App, Namespace, Entity, BaseNode, Logic, Param, TypeAnnotation, Return, Process, ProcessElement } from '..';
|
|
2
2
|
import { genLaunchProcess, genUserTaskLogic } from './getProcesses';
|
|
3
3
|
|
|
4
4
|
export function process2LogicNamespace(process: Process) {
|
|
@@ -10,11 +10,12 @@ export function process2LogicNamespace(process: Process) {
|
|
|
10
10
|
name: e.name,
|
|
11
11
|
logics: [l],
|
|
12
12
|
});
|
|
13
|
+
const path = `app.processes.${process.name}.elements.${e.name}.logic`;
|
|
13
14
|
l.getNamespace = function() {
|
|
14
|
-
return
|
|
15
|
+
return path;
|
|
15
16
|
}
|
|
16
17
|
children.push(ns);
|
|
17
|
-
ns.path = `app.processes.${process.name}.elements.${e.name}
|
|
18
|
+
ns.path = `app.processes.${process.name}.elements.${e.name}`
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
const launchLogic = genLaunchProcess(process);
|
|
@@ -26,3 +27,43 @@ export function process2LogicNamespace(process: Process) {
|
|
|
26
27
|
ns.path = `app.processes.${process.name}.logics`;
|
|
27
28
|
return ns;
|
|
28
29
|
}
|
|
30
|
+
|
|
31
|
+
interface processTreeFragment {
|
|
32
|
+
level: 'processTreeFragment';
|
|
33
|
+
name: string,
|
|
34
|
+
id: string,
|
|
35
|
+
logics: Array<Logic>,
|
|
36
|
+
elements: Array<{
|
|
37
|
+
level: 'processTreeElementFragment',
|
|
38
|
+
name: string,
|
|
39
|
+
id: string,
|
|
40
|
+
logics: Array<Logic>,
|
|
41
|
+
}>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function processToTreeFragment(process: Process) {
|
|
45
|
+
const fragment: processTreeFragment = {
|
|
46
|
+
level: 'processTreeFragment',
|
|
47
|
+
name: process.name,
|
|
48
|
+
id: process.id,
|
|
49
|
+
logics: [],
|
|
50
|
+
elements: [],
|
|
51
|
+
}
|
|
52
|
+
process.elements.forEach((e) => {
|
|
53
|
+
if (e.type === 'UserTask') {
|
|
54
|
+
const l = genUserTaskLogic(e);
|
|
55
|
+
l.parentKey = 'readonly'
|
|
56
|
+
fragment.elements.push({
|
|
57
|
+
level: 'processTreeElementFragment',
|
|
58
|
+
id: e.id,
|
|
59
|
+
name: e.name,
|
|
60
|
+
logics: [l],
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const launchLogic = genLaunchProcess(process);
|
|
66
|
+
fragment.logics.push(launchLogic);
|
|
67
|
+
launchLogic.parentKey = 'readonly'
|
|
68
|
+
return fragment;
|
|
69
|
+
}
|