@lcap/nasl 1.0.1 → 2.12.0-beta.1
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/out/automate/engine/index.d.ts +1 -0
- package/out/automate/engine/index.js +34 -12
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/operators.d.ts +10 -2
- package/out/automate/engine/operators.js +105 -7
- package/out/automate/engine/operators.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +8 -2
- package/out/automate/engine/uniqueName.js +72 -4
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +108 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/process.d.ts +9 -0
- package/out/automate/template/process.js +10976 -0
- package/out/automate/template/process.js.map +1 -0
- package/out/bak/translator.js +1 -0
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +6 -1
- package/out/common/BaseNode.js +37 -6
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +52 -49
- package/out/concepts/App__.js +89 -53
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +11 -0
- package/out/concepts/Assignee__.js +34 -0
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +2 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +10 -3
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +15 -6
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +4 -0
- package/out/concepts/BooleanLiteral__.js +11 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +9 -4
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.js +48 -30
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +34 -4
- package/out/concepts/CallQueryComponent__.js +340 -95
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +7 -0
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +1 -0
- package/out/concepts/ConfigProperty__.js +3 -0
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +3 -0
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js +6 -6
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +143 -0
- package/out/concepts/DataSource__.js +318 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/Destination__.js +22 -8
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +2 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +5 -0
- package/out/concepts/EntityIndex__.js +10 -2
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +22 -7
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +6 -0
- package/out/concepts/Entity__.js +27 -11
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +1 -0
- package/out/concepts/Enum__.js +14 -4
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +2 -2
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +96 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +5 -14
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +8 -8
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +9 -4
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +19 -12
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +3 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.js +44 -44
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.d.ts +116 -194
- package/out/concepts/Module__.js +31 -114
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +1 -108
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +3 -2
- package/out/concepts/Param__.js +15 -8
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +38 -12
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Process__.d.ts +1 -1
- package/out/concepts/Process__.js +17 -10
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +1 -0
- package/out/concepts/QueryFieldExpression__.js +11 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +4 -0
- package/out/concepts/QueryFromExpression__.js +13 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +3 -0
- package/out/concepts/QueryGroupByExpression__.js +20 -0
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +14 -3
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.js +16 -11
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +10 -3
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +14 -0
- package/out/concepts/SqlQueryComponent__.js +48 -5
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -9
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +11 -10
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +19 -12
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +1 -1
- package/out/concepts/SwitchCase__.js +23 -25
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -6
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +8 -0
- package/out/concepts/TypeAnnotation__.js +53 -3
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -1
- package/out/concepts/Variable__.js +16 -11
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +25 -20
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -3
- package/out/concepts/View__.js +42 -36
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +4 -4
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.interface.js +4 -4
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
- package/out/concepts/basics/stdlib/nasl.process.js +410 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +270 -8
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +2 -0
- package/out/concepts/basics/types/index.js +6 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +0 -7
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +3 -1
- package/out/generator/genBundleFiles.js +23 -5
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +1 -0
- package/out/generator/genMetaData.js +20 -12
- package/out/generator/genMetaData.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/{test/integration/connect-file copy.d.ts → server/extendBaseNode.d.ts} +0 -0
- package/out/server/extendBaseNode.js +323 -0
- package/out/server/extendBaseNode.js.map +1 -0
- package/out/server/getLogics.js +49 -2
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +52 -2
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +8 -2
- package/out/server/getProcesses.js +228 -20
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getScope.d.ts +1 -0
- package/out/server/getScope.js +4 -0
- package/out/server/getScope.js.map +1 -1
- package/out/server/index.d.ts +1 -0
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +8 -5
- package/out/server/naslServer.js +314 -383
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +10 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +1 -1
- package/out/server/translator.js +40 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.d.ts +1 -0
- package/out/service/storage/init.js +113 -94
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +34 -24
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +45 -29
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +15 -13
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +1 -1
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +29 -24
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +31 -29
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +13 -22
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +31 -21
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +35 -25
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +5 -3
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/connect-file.js +6 -6
- package/out/test/integration/connect-file.js.map +1 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +5 -0
- package/out/utils/index.js +50 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -2
- package/src/automate/engine/index.js +33 -8
- package/src/automate/engine/operators.js +114 -17
- package/src/automate/engine/uniqueName.js +77 -9
- package/src/automate/engine/utils.js +110 -69
- package/src/automate/template/process.js +10999 -0
- package/src/bak/translator.js +1 -0
- package/src/common/BaseNode.ts +35 -7
- package/src/concepts/App__.ts +132 -131
- package/src/concepts/Assignee__.ts +30 -0
- package/src/concepts/BindAttribute__.ts +2 -2
- package/src/concepts/BindDirective__.ts +9 -7
- package/src/concepts/BindEvent__.ts +14 -6
- package/src/concepts/BooleanLiteral__.ts +12 -0
- package/src/concepts/CallFunction__.ts +7 -4
- package/src/concepts/CallLogic__.ts +47 -32
- package/src/concepts/CallQueryComponent__.ts +352 -101
- package/src/concepts/Comment__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +3 -1
- package/src/concepts/ConfigProperty__.ts +4 -0
- package/src/concepts/Configuration__.ts +3 -0
- package/src/concepts/Constant__.ts +6 -6
- package/src/concepts/DataSource__.ts +391 -0
- package/src/concepts/Destination__.ts +22 -8
- package/src/concepts/End__.ts +2 -2
- package/src/concepts/EntityIndex__.ts +11 -2
- package/src/concepts/EntityProperty__.ts +23 -7
- package/src/concepts/Entity__.ts +38 -14
- package/src/concepts/Enum__.ts +15 -4
- package/src/concepts/ForEachStatement__.ts +2 -2
- package/src/concepts/Function__.ts +95 -1
- package/src/concepts/Identifier__.ts +5 -14
- package/src/concepts/IfStatement__.ts +9 -9
- package/src/concepts/InterfaceParam__.ts +9 -4
- package/src/concepts/Interface__.ts +20 -12
- package/src/concepts/JSBlock__.ts +3 -12
- package/src/concepts/Logic__.ts +45 -79
- package/src/concepts/Module__.ts +141 -342
- package/src/concepts/Namespace__.ts +1 -204
- package/src/concepts/Param__.ts +17 -9
- package/src/concepts/ProcessElement__.ts +42 -15
- package/src/concepts/Process__.ts +18 -12
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +13 -1
- package/src/concepts/QueryFromExpression__.ts +13 -2
- package/src/concepts/QueryGroupByExpression__.ts +23 -0
- package/src/concepts/QueryJoinExpression__.ts +14 -3
- package/src/concepts/Return__.ts +16 -11
- package/src/concepts/Role__.ts +10 -4
- package/src/concepts/SqlQueryComponent__.ts +47 -11
- package/src/concepts/StringLiteral__.ts +2 -9
- package/src/concepts/StructureProperty__.ts +11 -14
- package/src/concepts/Structure__.ts +19 -11
- package/src/concepts/SwitchCase__.ts +23 -27
- package/src/concepts/SwitchStatement__.ts +1 -5
- package/src/concepts/TypeAnnotation__.ts +52 -3
- package/src/concepts/Variable__.ts +16 -11
- package/src/concepts/ViewElement__.ts +26 -39
- package/src/concepts/View__.ts +45 -38
- package/src/concepts/WhileStatement__.ts +4 -4
- package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
- package/src/concepts/basics/stdlib/nasl.configuration.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
- package/src/concepts/basics/stdlib/nasl.util.ts +271 -8
- package/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts +1 -1
- package/src/concepts/basics/types/index.ts +2 -0
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +0 -7
- package/src/generator/genBundleFiles.ts +28 -7
- package/src/generator/genMetaData.ts +22 -13
- package/src/index.ts +1 -1
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +1 -0
- package/src/server/extendBaseNode.ts +318 -0
- package/src/server/getLogics.ts +51 -5
- package/src/server/getMemberIdentifier.ts +53 -2
- package/src/server/getProcesses.ts +238 -21
- package/src/server/getScope.ts +5 -0
- package/src/server/index.ts +1 -0
- package/src/server/naslServer.ts +322 -380
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +42 -2
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +115 -97
- package/src/templator/genCreateBlock.ts +35 -26
- package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
- package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
- package/src/templator/genEditTableBlock.ts +17 -14
- package/src/templator/genEnumSelectBlock.ts +1 -1
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +30 -25
- package/src/templator/genListViewBlock.ts +10 -7
- package/src/templator/genQueryComponent.ts +34 -30
- package/src/templator/genSelectBlock.ts +14 -23
- package/src/templator/genTableBlock.ts +32 -23
- package/src/templator/genUpdateBlock.ts +36 -26
- package/src/templator/utils.ts +5 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +51 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +0 -3
- package/out/concepts/basics/stdlib/nasl.browser copy.js +0 -70
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +0 -1
- package/out/terms/LEVEL_NAME_MAP.d.ts +0 -26
- package/out/terms/LEVEL_NAME_MAP.js +0 -30
- package/out/terms/LEVEL_NAME_MAP.js.map +0 -1
- package/out/test/integration/connect-file copy.js +0 -50
- package/out/test/integration/connect-file copy.js.map +0 -1
- package/out/test/integration/node-nasl-server.d.ts +0 -1
- package/out/test/integration/node-nasl-server.js +0 -41
- package/out/test/integration/node-nasl-server.js.map +0 -1
package/src/bak/translator.js
CHANGED
|
@@ -113,6 +113,7 @@ export default function (definition) {
|
|
|
113
113
|
title: ${JSON.stringify(definition.title)},
|
|
114
114
|
crumb: ${JSON.stringify(definition.crumb)},
|
|
115
115
|
first: ${JSON.stringify(definition.first)},
|
|
116
|
+
auth: ${JSON.stringify(definition.auth)},
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
${events.join('\n\n')}
|
package/src/common/BaseNode.ts
CHANGED
|
@@ -48,6 +48,13 @@ export class BaseNode extends EventEmitter {
|
|
|
48
48
|
*/
|
|
49
49
|
@property()
|
|
50
50
|
branchName: string = undefined;
|
|
51
|
+
/**
|
|
52
|
+
* 合并代码相关
|
|
53
|
+
*/
|
|
54
|
+
@property()
|
|
55
|
+
workingCopy: object = undefined;
|
|
56
|
+
@property()
|
|
57
|
+
branch: object = undefined;
|
|
51
58
|
/**
|
|
52
59
|
* 父节点
|
|
53
60
|
*/
|
|
@@ -159,13 +166,23 @@ export class BaseNode extends EventEmitter {
|
|
|
159
166
|
const property = propertyMap.get(key);
|
|
160
167
|
const sourceItem = (source as any)[key] !== undefined ? (source as any)[key] : (this as any)[key];
|
|
161
168
|
const { objectRef: propertyObjectRef } = property;
|
|
162
|
-
let objectRefCtor;
|
|
169
|
+
let objectRefCtor: any;
|
|
163
170
|
try {
|
|
164
171
|
if (propertyObjectRef) {
|
|
165
172
|
objectRefCtor = getConceptConstructor(propertyObjectRef);
|
|
166
|
-
if (objectRefCtor
|
|
167
|
-
sourceItem
|
|
168
|
-
sourceItem.
|
|
173
|
+
if (objectRefCtor) {
|
|
174
|
+
// if (Array.isArray(sourceItem)) {
|
|
175
|
+
// sourceItem.forEach((item) => {
|
|
176
|
+
// if (item instanceof objectRefCtor) {
|
|
177
|
+
// item.parentNode = this;
|
|
178
|
+
// item.parentKey = key;
|
|
179
|
+
// }
|
|
180
|
+
// });
|
|
181
|
+
// } else
|
|
182
|
+
if (sourceItem instanceof objectRefCtor) {
|
|
183
|
+
sourceItem.parentNode = this;
|
|
184
|
+
sourceItem.parentKey = key;
|
|
185
|
+
}
|
|
169
186
|
}
|
|
170
187
|
}
|
|
171
188
|
|
|
@@ -324,7 +341,8 @@ export class BaseNode extends EventEmitter {
|
|
|
324
341
|
* 删除节点
|
|
325
342
|
*/
|
|
326
343
|
delete() {
|
|
327
|
-
const
|
|
344
|
+
const useIndex = ['BindEvent', 'Identifier'].includes(this.concept);
|
|
345
|
+
const path = this.getNodePath(useIndex);
|
|
328
346
|
const parentParams = this._delete();
|
|
329
347
|
if (parentParams && parentParams.index !== -1) {
|
|
330
348
|
if (Array.isArray((this.parentNode as any)[this.parentKey])) {
|
|
@@ -410,6 +428,16 @@ export class BaseNode extends EventEmitter {
|
|
|
410
428
|
static from(source: any, parentNode?: BaseNode, parentKey?: string): BaseNode {
|
|
411
429
|
// 有一些继承的情况
|
|
412
430
|
const Ctor = classMap[source.concept] || this;
|
|
431
|
+
if (Ctor && source instanceof Ctor) {
|
|
432
|
+
if (parentNode) {
|
|
433
|
+
source.parentNode = parentNode;
|
|
434
|
+
}
|
|
435
|
+
if (parentKey) {
|
|
436
|
+
source.parentKey = parentKey;
|
|
437
|
+
}
|
|
438
|
+
return source;
|
|
439
|
+
}
|
|
440
|
+
|
|
413
441
|
if (Ctor) {
|
|
414
442
|
const instance = new Ctor();
|
|
415
443
|
if (parentNode) {
|
|
@@ -431,7 +459,7 @@ export class BaseNode extends EventEmitter {
|
|
|
431
459
|
return this.getNodePath(false);
|
|
432
460
|
}
|
|
433
461
|
|
|
434
|
-
getNodePath(
|
|
462
|
+
getNodePath(useIndex: boolean) {
|
|
435
463
|
let node: BaseNode = this;
|
|
436
464
|
let isNodeSelf = true;
|
|
437
465
|
const pathArr = [];
|
|
@@ -444,7 +472,7 @@ export class BaseNode extends EventEmitter {
|
|
|
444
472
|
const parentProperty = parentNode[parentKey as keyof BaseNode];
|
|
445
473
|
if (Array.isArray(parentProperty)) {
|
|
446
474
|
const name = node.name;
|
|
447
|
-
if (!name || (
|
|
475
|
+
if (!name || (useIndex && isNodeSelf)) {
|
|
448
476
|
const index = parentProperty.indexOf(node);
|
|
449
477
|
path += `[${index}]`;
|
|
450
478
|
} else {
|
package/src/concepts/App__.ts
CHANGED
|
@@ -14,7 +14,7 @@ import * as utils from '../utils';
|
|
|
14
14
|
import { v4 as uuidv4 } from 'uuid';
|
|
15
15
|
import BaseNode from '../common/BaseNode';
|
|
16
16
|
import classMap from '../common/classMap';
|
|
17
|
-
import
|
|
17
|
+
import DataSource from './DataSource__';
|
|
18
18
|
import Structure from './Structure__';
|
|
19
19
|
import Enum from './Enum__';
|
|
20
20
|
import Logic from './Logic__';
|
|
@@ -110,10 +110,10 @@ export class App extends BaseNode {
|
|
|
110
110
|
hasAuth: boolean = undefined;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* 数据源列表
|
|
114
114
|
*/
|
|
115
|
-
@property('
|
|
116
|
-
|
|
115
|
+
@property('DataSource')
|
|
116
|
+
dataSources: Array<DataSource> = [];
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* 数据结构列表
|
|
@@ -187,8 +187,6 @@ export class App extends BaseNode {
|
|
|
187
187
|
@property('Module')
|
|
188
188
|
componentDependencies: Array<Module> = [];
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
190
|
/**
|
|
193
191
|
* @param source 需要合并的部分参数
|
|
194
192
|
*/
|
|
@@ -237,148 +235,147 @@ export class App extends BaseNode {
|
|
|
237
235
|
});
|
|
238
236
|
}
|
|
239
237
|
|
|
240
|
-
|
|
238
|
+
getDataSourceExistingNames(excludedList: Array<DataSource> = []) {
|
|
241
239
|
const excludedSet = new Set(excludedList);
|
|
242
|
-
return (this.
|
|
240
|
+
return (this.dataSources || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
243
241
|
}
|
|
244
|
-
|
|
245
|
-
return utils.unique(name, this.
|
|
242
|
+
getDataSourceUniqueName(name = 'dataSource1') {
|
|
243
|
+
return utils.unique(name, this.getDataSourceExistingNames(), undefined, true);
|
|
246
244
|
}
|
|
247
245
|
|
|
248
246
|
/**
|
|
249
|
-
*
|
|
247
|
+
* 插入数据源
|
|
250
248
|
* @internal
|
|
251
|
-
* @param name
|
|
249
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
252
250
|
*/
|
|
253
|
-
|
|
251
|
+
_insertDataSourceAt(name: string, index: number): DataSource;
|
|
254
252
|
|
|
255
253
|
/**
|
|
256
|
-
*
|
|
254
|
+
* 插入数据源
|
|
257
255
|
* @internal
|
|
258
|
-
* @param
|
|
256
|
+
* @param dataSourceOptions 数据源参数
|
|
259
257
|
*/
|
|
260
|
-
|
|
258
|
+
_insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
|
|
261
259
|
|
|
262
260
|
/**
|
|
263
|
-
*
|
|
261
|
+
* 插入数据源
|
|
264
262
|
* @internal
|
|
265
|
-
* @param
|
|
263
|
+
* @param dataSource 已有的数据源实例
|
|
266
264
|
*/
|
|
267
|
-
|
|
265
|
+
_insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
|
|
268
266
|
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
const relationOptions = { parentNode: this, parentKey: '
|
|
272
|
-
let
|
|
267
|
+
_insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
|
|
268
|
+
const dataSourceOptions: any = {};
|
|
269
|
+
const relationOptions = { parentNode: this, parentKey: 'dataSources' };
|
|
270
|
+
let dataSource: DataSource;
|
|
273
271
|
if (!options) {
|
|
274
|
-
|
|
275
|
-
...
|
|
276
|
-
name: this.
|
|
277
|
-
}, this, '
|
|
272
|
+
dataSource = DataSource.from({
|
|
273
|
+
...dataSourceOptions,
|
|
274
|
+
name: this.getDataSourceUniqueName(),
|
|
275
|
+
}, this, 'dataSources');
|
|
278
276
|
} else if (typeof options === 'string') {
|
|
279
|
-
|
|
280
|
-
...
|
|
277
|
+
dataSource = DataSource.from({
|
|
278
|
+
...dataSourceOptions,
|
|
281
279
|
name: options,
|
|
282
|
-
}, this, '
|
|
283
|
-
} else if (options instanceof
|
|
280
|
+
}, this, 'dataSources');
|
|
281
|
+
} else if (options instanceof DataSource) {
|
|
284
282
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
285
|
-
|
|
286
|
-
Object.assign(
|
|
283
|
+
dataSource = options;
|
|
284
|
+
Object.assign(dataSource, relationOptions);
|
|
287
285
|
} else {
|
|
288
|
-
|
|
289
|
-
...
|
|
286
|
+
dataSource = DataSource.from({
|
|
287
|
+
...dataSourceOptions,
|
|
290
288
|
...options,
|
|
291
|
-
}, this, '
|
|
289
|
+
}, this, 'dataSources');
|
|
292
290
|
}
|
|
293
|
-
this.
|
|
294
|
-
return
|
|
291
|
+
this.dataSources.splice(index, 0, dataSource);
|
|
292
|
+
return dataSource;
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
/**
|
|
298
|
-
*
|
|
299
|
-
* @param name
|
|
296
|
+
* 插入数据源
|
|
297
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
300
298
|
*/
|
|
301
|
-
|
|
299
|
+
insertDataSourceAt(name: string, index: number): DataSource;
|
|
302
300
|
|
|
303
301
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @param
|
|
302
|
+
* 插入数据源
|
|
303
|
+
* @param dataSourceOptions 数据源参数
|
|
306
304
|
*/
|
|
307
|
-
|
|
305
|
+
insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
|
|
308
306
|
|
|
309
307
|
/**
|
|
310
|
-
*
|
|
311
|
-
* @param
|
|
308
|
+
* 插入数据源
|
|
309
|
+
* @param dataSource 已有的数据源实例
|
|
312
310
|
*/
|
|
313
|
-
|
|
311
|
+
insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
|
|
314
312
|
|
|
315
|
-
|
|
316
|
-
const node = this.
|
|
313
|
+
insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
|
|
314
|
+
const node = this._insertDataSourceAt(options as any, index);
|
|
317
315
|
node.create({
|
|
318
316
|
index,
|
|
319
317
|
parentNode: this,
|
|
320
|
-
parentKey: '
|
|
318
|
+
parentKey: 'dataSources',
|
|
321
319
|
});
|
|
322
320
|
return node;
|
|
323
321
|
}
|
|
324
322
|
|
|
325
323
|
/**
|
|
326
|
-
*
|
|
324
|
+
* 添加数据源
|
|
327
325
|
* @internal
|
|
328
|
-
* @param name
|
|
326
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
329
327
|
*/
|
|
330
|
-
|
|
328
|
+
_addDataSource(name?: string): DataSource;
|
|
331
329
|
|
|
332
330
|
/**
|
|
333
|
-
*
|
|
331
|
+
* 添加数据源
|
|
334
332
|
* @internal
|
|
335
|
-
* @param
|
|
333
|
+
* @param dataSourceOptions 数据源参数
|
|
336
334
|
*/
|
|
337
|
-
|
|
335
|
+
_addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
|
|
338
336
|
|
|
339
337
|
/**
|
|
340
|
-
*
|
|
338
|
+
* 添加数据源
|
|
341
339
|
* @internal
|
|
342
|
-
* @param
|
|
340
|
+
* @param dataSource 已有的数据源实例
|
|
343
341
|
*/
|
|
344
|
-
|
|
342
|
+
_addDataSource(dataSource: DataSource): DataSource;
|
|
345
343
|
|
|
346
|
-
|
|
347
|
-
const index =
|
|
348
|
-
return this.
|
|
344
|
+
_addDataSource(options?: string | Partial<DataSource> | DataSource) {
|
|
345
|
+
const index = this.dataSources.length;
|
|
346
|
+
return this._insertDataSourceAt(options as any, index);
|
|
349
347
|
}
|
|
350
348
|
|
|
351
349
|
/**
|
|
352
|
-
*
|
|
350
|
+
* 添加数据源
|
|
353
351
|
* @internal
|
|
354
|
-
* @param name
|
|
352
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
355
353
|
*/
|
|
356
|
-
|
|
354
|
+
addDataSource(name?: string): DataSource;
|
|
357
355
|
|
|
358
356
|
/**
|
|
359
|
-
*
|
|
360
|
-
* @param
|
|
357
|
+
* 添加数据源
|
|
358
|
+
* @param dataSourceOptions 数据源参数
|
|
361
359
|
*/
|
|
362
|
-
|
|
360
|
+
addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
|
|
363
361
|
|
|
364
362
|
/**
|
|
365
|
-
*
|
|
366
|
-
* @param
|
|
363
|
+
* 添加数据源
|
|
364
|
+
* @param dataSource 已有的数据源实例
|
|
367
365
|
*/
|
|
368
|
-
|
|
366
|
+
addDataSource(dataSource: DataSource): DataSource;
|
|
369
367
|
|
|
370
|
-
|
|
371
|
-
const node = this.
|
|
372
|
-
const index = this.
|
|
368
|
+
addDataSource(options?: string | Partial<DataSource> | DataSource) {
|
|
369
|
+
const node = this._addDataSource(options as any);
|
|
370
|
+
const index = this.dataSources.indexOf(node);
|
|
373
371
|
node.create({
|
|
374
372
|
index,
|
|
375
373
|
parentNode: this,
|
|
376
|
-
parentKey: '
|
|
374
|
+
parentKey: 'dataSources',
|
|
377
375
|
});
|
|
378
376
|
return node;
|
|
379
377
|
}
|
|
380
378
|
|
|
381
|
-
|
|
382
379
|
getStructureExistingNames(excludedList: Array<Structure> = []) {
|
|
383
380
|
const excludedSet = new Set(excludedList);
|
|
384
381
|
return (this.structures || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -520,7 +517,6 @@ export class App extends BaseNode {
|
|
|
520
517
|
return node;
|
|
521
518
|
}
|
|
522
519
|
|
|
523
|
-
|
|
524
520
|
getEnumExistingNames(excludedList: Array<Enum> = []) {
|
|
525
521
|
const excludedSet = new Set(excludedList);
|
|
526
522
|
return (this.enums || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -662,7 +658,6 @@ export class App extends BaseNode {
|
|
|
662
658
|
return node;
|
|
663
659
|
}
|
|
664
660
|
|
|
665
|
-
|
|
666
661
|
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
667
662
|
const excludedSet = new Set(excludedList);
|
|
668
663
|
return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -804,7 +799,6 @@ export class App extends BaseNode {
|
|
|
804
799
|
return node;
|
|
805
800
|
}
|
|
806
801
|
|
|
807
|
-
|
|
808
802
|
getInterfaceExistingNames(excludedList: Array<Interface> = []) {
|
|
809
803
|
const excludedSet = new Set(excludedList);
|
|
810
804
|
return (this.interfaces || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -946,7 +940,6 @@ export class App extends BaseNode {
|
|
|
946
940
|
return node;
|
|
947
941
|
}
|
|
948
942
|
|
|
949
|
-
|
|
950
943
|
getViewExistingNames(excludedList: Array<View> = []) {
|
|
951
944
|
const excludedSet = new Set(excludedList);
|
|
952
945
|
return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1088,7 +1081,6 @@ export class App extends BaseNode {
|
|
|
1088
1081
|
return node;
|
|
1089
1082
|
}
|
|
1090
1083
|
|
|
1091
|
-
|
|
1092
1084
|
getProcessExistingNames(excludedList: Array<Process> = []) {
|
|
1093
1085
|
const excludedSet = new Set(excludedList);
|
|
1094
1086
|
return (this.processes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1230,7 +1222,6 @@ export class App extends BaseNode {
|
|
|
1230
1222
|
return node;
|
|
1231
1223
|
}
|
|
1232
1224
|
|
|
1233
|
-
|
|
1234
1225
|
getRoleExistingNames(excludedList: Array<Role> = []) {
|
|
1235
1226
|
const excludedSet = new Set(excludedList);
|
|
1236
1227
|
return (this.roles || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1372,7 +1363,6 @@ export class App extends BaseNode {
|
|
|
1372
1363
|
return node;
|
|
1373
1364
|
}
|
|
1374
1365
|
|
|
1375
|
-
|
|
1376
1366
|
getModuleExistingNames(excludedList: Array<Module> = []) {
|
|
1377
1367
|
const excludedSet = new Set(excludedList);
|
|
1378
1368
|
return (this.dependencies || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1780,50 +1770,47 @@ export class App extends BaseNode {
|
|
|
1780
1770
|
return node;
|
|
1781
1771
|
}
|
|
1782
1772
|
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
1773
|
/**
|
|
1787
|
-
*
|
|
1788
|
-
* @param name
|
|
1774
|
+
* 删除数据源
|
|
1775
|
+
* @param name 数据源名称
|
|
1789
1776
|
*/
|
|
1790
|
-
|
|
1777
|
+
removeDataSource(name: string): void;
|
|
1791
1778
|
|
|
1792
1779
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
* @param
|
|
1780
|
+
* 删除数据源
|
|
1781
|
+
* @param dataSource 已有的数据源实例
|
|
1795
1782
|
*/
|
|
1796
|
-
|
|
1783
|
+
removeDataSource(dataSource: DataSource): void;
|
|
1797
1784
|
|
|
1798
|
-
|
|
1799
|
-
let
|
|
1785
|
+
removeDataSource(options: string | DataSource) {
|
|
1786
|
+
let dataSource: DataSource;
|
|
1800
1787
|
if (typeof options === 'string') {
|
|
1801
|
-
|
|
1802
|
-
if (!
|
|
1803
|
-
throw new Error('
|
|
1788
|
+
dataSource = this.dataSources.find((item) => item.name === options);
|
|
1789
|
+
if (!dataSource) {
|
|
1790
|
+
throw new Error('找不到数据源 ' + options);
|
|
1804
1791
|
}
|
|
1805
1792
|
} else {
|
|
1806
|
-
|
|
1793
|
+
dataSource = options;
|
|
1807
1794
|
}
|
|
1808
|
-
return
|
|
1795
|
+
return dataSource.delete();
|
|
1809
1796
|
}
|
|
1810
1797
|
|
|
1811
|
-
|
|
1812
|
-
const parentKey =
|
|
1798
|
+
__removeDataSource(dataSource: DataSource) {
|
|
1799
|
+
const parentKey = dataSource.parentKey;
|
|
1813
1800
|
const params: Params = {
|
|
1814
1801
|
parentNode: this,
|
|
1815
1802
|
parentKey,
|
|
1816
1803
|
index: -1,
|
|
1817
1804
|
object: null,
|
|
1818
|
-
oldObject:
|
|
1805
|
+
oldObject: dataSource,
|
|
1819
1806
|
};
|
|
1820
1807
|
if (parentKey) {
|
|
1821
1808
|
params.parentKey = parentKey;
|
|
1822
1809
|
if (Array.isArray((this as any)[parentKey])) {
|
|
1823
|
-
const index = (this as any)[parentKey].indexOf(
|
|
1810
|
+
const index = (this as any)[parentKey].indexOf(dataSource);
|
|
1824
1811
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1825
1812
|
params.index = index;
|
|
1826
|
-
} else if ((this as any)[parentKey] ===
|
|
1813
|
+
} else if ((this as any)[parentKey] === dataSource) {
|
|
1827
1814
|
params.index = 0;
|
|
1828
1815
|
(this as any)[parentKey] = undefined;
|
|
1829
1816
|
}
|
|
@@ -1831,8 +1818,6 @@ export class App extends BaseNode {
|
|
|
1831
1818
|
return params;
|
|
1832
1819
|
}
|
|
1833
1820
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
1821
|
/**
|
|
1837
1822
|
* 删除数据结构
|
|
1838
1823
|
* @param name 数据结构名称
|
|
@@ -1881,8 +1866,6 @@ export class App extends BaseNode {
|
|
|
1881
1866
|
return params;
|
|
1882
1867
|
}
|
|
1883
1868
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
1869
|
/**
|
|
1887
1870
|
* 删除枚举
|
|
1888
1871
|
* @param name 枚举名称
|
|
@@ -1931,8 +1914,6 @@ export class App extends BaseNode {
|
|
|
1931
1914
|
return params;
|
|
1932
1915
|
}
|
|
1933
1916
|
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
1917
|
/**
|
|
1937
1918
|
* 删除逻辑
|
|
1938
1919
|
* @param name 逻辑名称
|
|
@@ -1981,8 +1962,6 @@ export class App extends BaseNode {
|
|
|
1981
1962
|
return params;
|
|
1982
1963
|
}
|
|
1983
1964
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
1965
|
/**
|
|
1987
1966
|
* 删除接口
|
|
1988
1967
|
* @param name 接口名称
|
|
@@ -2031,8 +2010,6 @@ export class App extends BaseNode {
|
|
|
2031
2010
|
return params;
|
|
2032
2011
|
}
|
|
2033
2012
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
2013
|
/**
|
|
2037
2014
|
* 删除页面
|
|
2038
2015
|
* @param name 页面名称
|
|
@@ -2081,8 +2058,6 @@ export class App extends BaseNode {
|
|
|
2081
2058
|
return params;
|
|
2082
2059
|
}
|
|
2083
2060
|
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
2061
|
/**
|
|
2087
2062
|
* 删除流程
|
|
2088
2063
|
* @param name 流程名称
|
|
@@ -2131,8 +2106,6 @@ export class App extends BaseNode {
|
|
|
2131
2106
|
return params;
|
|
2132
2107
|
}
|
|
2133
2108
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
2109
|
/**
|
|
2137
2110
|
* 删除角色
|
|
2138
2111
|
* @param name 角色名称
|
|
@@ -2181,8 +2154,6 @@ export class App extends BaseNode {
|
|
|
2181
2154
|
return params;
|
|
2182
2155
|
}
|
|
2183
2156
|
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
2157
|
/**
|
|
2187
2158
|
* 删除主题
|
|
2188
2159
|
* @param name 主题名称
|
|
@@ -2231,8 +2202,6 @@ export class App extends BaseNode {
|
|
|
2231
2202
|
return params;
|
|
2232
2203
|
}
|
|
2233
2204
|
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
2205
|
/**
|
|
2237
2206
|
* 删除配置管理
|
|
2238
2207
|
* @param name 配置管理名称
|
|
@@ -2281,8 +2250,6 @@ export class App extends BaseNode {
|
|
|
2281
2250
|
return params;
|
|
2282
2251
|
}
|
|
2283
2252
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
2253
|
/**
|
|
2287
2254
|
* 删除模块
|
|
2288
2255
|
* @param name 模块名称
|
|
@@ -2308,8 +2275,6 @@ export class App extends BaseNode {
|
|
|
2308
2275
|
return module.delete();
|
|
2309
2276
|
}
|
|
2310
2277
|
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
2278
|
/**
|
|
2314
2279
|
* 删除模块
|
|
2315
2280
|
* @param name 模块名称
|
|
@@ -2335,8 +2300,6 @@ export class App extends BaseNode {
|
|
|
2335
2300
|
return module.delete();
|
|
2336
2301
|
}
|
|
2337
2302
|
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
2303
|
/**
|
|
2341
2304
|
* 删除模块
|
|
2342
2305
|
* @param name 模块名称
|
|
@@ -2393,8 +2356,12 @@ export class App extends BaseNode {
|
|
|
2393
2356
|
return this.componentDependencies.find((componentDependency) => componentDependency.name === name);
|
|
2394
2357
|
}
|
|
2395
2358
|
|
|
2396
|
-
|
|
2397
|
-
return this.
|
|
2359
|
+
findDataSourceByName(name: string) {
|
|
2360
|
+
return this.dataSources.find((dataSourceItem) => dataSourceItem.name === name);
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
get defaultDS() {
|
|
2364
|
+
return this.dataSources?.find((dataSource) => dataSource.name === 'defaultDS');
|
|
2398
2365
|
}
|
|
2399
2366
|
|
|
2400
2367
|
findEnumByName(name: string) {
|
|
@@ -2467,6 +2434,10 @@ export class App extends BaseNode {
|
|
|
2467
2434
|
* 获取命名空间
|
|
2468
2435
|
*/
|
|
2469
2436
|
getNamespace() {
|
|
2437
|
+
return 'app';
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
getTsNamespace() {
|
|
2470
2441
|
return `app`;
|
|
2471
2442
|
}
|
|
2472
2443
|
|
|
@@ -2494,6 +2465,36 @@ export class App extends BaseNode {
|
|
|
2494
2465
|
return node;
|
|
2495
2466
|
}
|
|
2496
2467
|
|
|
2468
|
+
findNodeByCompleteName(completeName: string) {
|
|
2469
|
+
const nameArr = completeName?.split('.') || [];
|
|
2470
|
+
const start = nameArr.shift();
|
|
2471
|
+
let node: any = this;
|
|
2472
|
+
const mod = 0;
|
|
2473
|
+
const modulesMap: any = {
|
|
2474
|
+
extensions: node.dependencies,
|
|
2475
|
+
apis: node.interfaceDependencies,
|
|
2476
|
+
components: node.componentDependencies,
|
|
2477
|
+
};
|
|
2478
|
+
const modules = modulesMap[start];
|
|
2479
|
+
if (Array.isArray(modules)) {
|
|
2480
|
+
const moduleName = nameArr.shift();
|
|
2481
|
+
node = modules.find((moduleItem) => moduleItem.name === moduleName);
|
|
2482
|
+
}
|
|
2483
|
+
for (let index = 0; index < nameArr.length; index++) {
|
|
2484
|
+
if (!node) {
|
|
2485
|
+
return null;
|
|
2486
|
+
}
|
|
2487
|
+
const nameItem = nameArr[index];
|
|
2488
|
+
const isKeyword = index % 2 === mod;
|
|
2489
|
+
if (!isKeyword && Array.isArray(node)) {
|
|
2490
|
+
node = node.find(({ name }) => name === nameItem);
|
|
2491
|
+
} else {
|
|
2492
|
+
node = node[nameItem];
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
return node;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2497
2498
|
/**
|
|
2498
2499
|
* @param path 路径
|
|
2499
2500
|
* path 为要查找路径:如 /dashboard/student/list、/dashboard/student/list
|
|
@@ -2600,7 +2601,7 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
|
2600
2601
|
//================================================================================
|
|
2601
2602
|
}
|
|
2602
2603
|
|
|
2603
|
-
classMap
|
|
2604
|
+
classMap.App = App;
|
|
2604
2605
|
export default App;
|
|
2605
2606
|
//================================================================================
|
|
2606
2607
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
|
|
2
|
+
import { ProcessElement, Process, } from '..';
|
|
3
|
+
|
|
1
4
|
//================================================================================
|
|
2
5
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
3
6
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -422,7 +425,34 @@ export class Assignee extends LogicItem {
|
|
|
422
425
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
423
426
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
424
427
|
//================================================================================
|
|
428
|
+
/**
|
|
429
|
+
* 祖先 ProcessElement
|
|
430
|
+
*/
|
|
431
|
+
get processElement() {
|
|
432
|
+
return this.getAncestor('ProcessElement') as ProcessElement;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* 祖先 Process
|
|
436
|
+
*/
|
|
437
|
+
get process() {
|
|
438
|
+
return this.getAncestor('Process') as Process;
|
|
439
|
+
}
|
|
425
440
|
|
|
441
|
+
@withSourceMap()
|
|
442
|
+
toEmbeddedTSInProcess(state: TranslatorState, prevCode: string): string {
|
|
443
|
+
// const tab = indent(state.tabSize);
|
|
444
|
+
// let code = `const plainuser = [];\n`
|
|
445
|
+
// code += `const dynamicuser = [];\n`
|
|
446
|
+
let code = prevCode;
|
|
447
|
+
code += `return nasl.util.concatString(`;
|
|
448
|
+
this.dynamicUsers.forEach(u => {
|
|
449
|
+
code += u.toEmbeddedTS(shiftState(state, code));
|
|
450
|
+
code += ',\n';
|
|
451
|
+
})
|
|
452
|
+
code += ')\n';
|
|
453
|
+
// code += `${this.dynamicUsers.map(u => u.toEmbeddedTS(shiftState(state, code))).join(',\n')})\n`;
|
|
454
|
+
return code;
|
|
455
|
+
}
|
|
426
456
|
//================================================================================
|
|
427
457
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
428
458
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|