@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
|
@@ -548,9 +548,9 @@ export class BindAttribute extends BaseNode {
|
|
|
548
548
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
549
549
|
let code = '';
|
|
550
550
|
if (this.name === 'destination') {
|
|
551
|
-
code += this.destination.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
551
|
+
code += this.destination.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
552
552
|
} else if (this.expression) {
|
|
553
|
-
code += this.expression.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
553
|
+
code += this.expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
554
554
|
}
|
|
555
555
|
return code;
|
|
556
556
|
}
|
|
@@ -133,10 +133,6 @@ export class BindDirective extends BaseNode {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
136
|
/**
|
|
141
137
|
* 删除逻辑项
|
|
142
138
|
* @param name 逻辑项名称
|
|
@@ -208,8 +204,14 @@ export class BindDirective extends BaseNode {
|
|
|
208
204
|
*/
|
|
209
205
|
toVue(options?: ElementToVueOptions) {
|
|
210
206
|
let modifiersString = '';
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
let modifiers = {};
|
|
208
|
+
try {
|
|
209
|
+
modifiers = JSON.parse(this.modifiers || '{}');
|
|
210
|
+
} catch (err) {
|
|
211
|
+
modifiers = {};
|
|
212
|
+
}
|
|
213
|
+
Object.keys(modifiers).forEach((key) => {
|
|
214
|
+
const value = (modifiers as any)[key];
|
|
213
215
|
if (value)
|
|
214
216
|
modifiersString += '.' + key;
|
|
215
217
|
});
|
|
@@ -253,7 +255,7 @@ export class BindDirective extends BaseNode {
|
|
|
253
255
|
//================================================================================
|
|
254
256
|
}
|
|
255
257
|
|
|
256
|
-
classMap
|
|
258
|
+
classMap.BindDirective = BindDirective;
|
|
257
259
|
export default BindDirective;
|
|
258
260
|
//================================================================================
|
|
259
261
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -291,6 +291,10 @@ export class BindEvent extends BaseNode {
|
|
|
291
291
|
//================================================================================
|
|
292
292
|
// 用于logic回填
|
|
293
293
|
get calleewholeKey(): string {
|
|
294
|
+
if (!this.calleeNamespace && this.calleeName) {
|
|
295
|
+
// 页面逻辑单独处理
|
|
296
|
+
return `${this.view.getNamespace()}.${this.view.name}.logics.${this.calleeName}`;
|
|
297
|
+
}
|
|
294
298
|
return this.calleeNamespace + '.' + this.calleeName;
|
|
295
299
|
}
|
|
296
300
|
get tsCalleeNamespace() {
|
|
@@ -338,11 +342,11 @@ export class BindEvent extends BaseNode {
|
|
|
338
342
|
if (isPageCycle) {
|
|
339
343
|
return `${this.calleeKey}();`;
|
|
340
344
|
}
|
|
341
|
-
let code = `${this.toHump(this.name) || '__IDENTIFIER__'}: (event) => [\n`;
|
|
342
|
-
code += indent(state
|
|
345
|
+
let code = `${this.toHump(this.name) || '__IDENTIFIER__'}: (event: any) => [\n`;
|
|
346
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
343
347
|
code += `() => {${this.calleeKey}()}`;
|
|
344
348
|
code += '\n';
|
|
345
|
-
code += indent(state
|
|
349
|
+
code += indent((state?.tabSize || 0));
|
|
346
350
|
code += '],\n';
|
|
347
351
|
return code;
|
|
348
352
|
}
|
|
@@ -354,10 +358,10 @@ export class BindEvent extends BaseNode {
|
|
|
354
358
|
// let code = '';
|
|
355
359
|
// if (this.name) {
|
|
356
360
|
// code = `function ${this.name || '__IDENTIFIER__'} () {\n`;
|
|
357
|
-
// code += indent(state
|
|
361
|
+
// code += indent((state?.tabSize || 0) + 1);
|
|
358
362
|
// code += `${this.calleeKey}()`;
|
|
359
363
|
// code += '\n';
|
|
360
|
-
// code += indent(state
|
|
364
|
+
// code += indent((state?.tabSize || 0));
|
|
361
365
|
// code += '};\n';
|
|
362
366
|
// }
|
|
363
367
|
// return code;
|
|
@@ -367,8 +371,12 @@ export class BindEvent extends BaseNode {
|
|
|
367
371
|
* 设置callee
|
|
368
372
|
*/
|
|
369
373
|
setCallee(logic: Logic) {
|
|
374
|
+
let calleeNamespace = logic.getNamespace();
|
|
375
|
+
if (logic.parentNode instanceof View) {
|
|
376
|
+
calleeNamespace = '';
|
|
377
|
+
}
|
|
370
378
|
const object = {
|
|
371
|
-
calleeNamespace
|
|
379
|
+
calleeNamespace,
|
|
372
380
|
calleeName: logic.name,
|
|
373
381
|
};
|
|
374
382
|
this.update({
|
|
@@ -72,6 +72,18 @@ export class BooleanLiteral extends LogicItem {
|
|
|
72
72
|
toEmbeddedTS(state?: TranslatorState) {
|
|
73
73
|
return this.value;
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 设置布尔值内容
|
|
78
|
+
*/
|
|
79
|
+
setValue(value: string) {
|
|
80
|
+
const object = {
|
|
81
|
+
value,
|
|
82
|
+
};
|
|
83
|
+
this.update({
|
|
84
|
+
...object,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
75
87
|
getValue() {
|
|
76
88
|
return this.value;
|
|
77
89
|
}
|
|
@@ -421,10 +421,10 @@ export class CallFunction extends LogicItem {
|
|
|
421
421
|
code += ', ';
|
|
422
422
|
});
|
|
423
423
|
if (this.typeArguments && this.typeArguments.length) {
|
|
424
|
-
code += ', ';
|
|
424
|
+
if (this.arguments?.length) code += ', ';
|
|
425
425
|
this.typeArguments?.forEach((arg, index) => {
|
|
426
426
|
code += arg?.toJS(shiftState(state, code));
|
|
427
|
-
if (index !== this.
|
|
427
|
+
if (index !== this.typeArguments?.length - 1)
|
|
428
428
|
code += ', ';
|
|
429
429
|
});
|
|
430
430
|
}
|
|
@@ -456,6 +456,10 @@ export class CallFunction extends LogicItem {
|
|
|
456
456
|
if (param.defaultExpression instanceof Identifier) {
|
|
457
457
|
argument.expression = BaseNode.from(param.defaultExpression, argument, 'expression') as Identifier;
|
|
458
458
|
}
|
|
459
|
+
if (param.defaultExpression instanceof Function) {
|
|
460
|
+
(param.defaultExpression as Function).returnExpression = null;
|
|
461
|
+
argument.expression = BaseNode.from(param.defaultExpression, argument, 'expression') as Identifier;
|
|
462
|
+
}
|
|
459
463
|
Object.assign(argument, relationOptions);
|
|
460
464
|
return argument;
|
|
461
465
|
});
|
|
@@ -496,7 +500,6 @@ export class CallFunction extends LogicItem {
|
|
|
496
500
|
const typeAnnotation = this.typeArguments[0];
|
|
497
501
|
code += `<`;
|
|
498
502
|
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>()`;
|
|
499
|
-
code += '\n';
|
|
500
503
|
} else {
|
|
501
504
|
code = this.calleeKey;
|
|
502
505
|
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
@@ -511,7 +514,7 @@ export class CallFunction extends LogicItem {
|
|
|
511
514
|
if (index !== this.arguments.length - 1)
|
|
512
515
|
code += ', ';
|
|
513
516
|
});
|
|
514
|
-
code += ')
|
|
517
|
+
code += ')';
|
|
515
518
|
}
|
|
516
519
|
return code;
|
|
517
520
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import Logic from './Logic__';
|
|
3
3
|
import Param from './Param__';
|
|
4
|
+
import View from './View__';
|
|
4
5
|
import { ElementToVueOptions } from './ViewElement__';
|
|
5
6
|
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
7
|
+
import { findConceptKeyWordIndexFromNamespace } from '../utils';
|
|
6
8
|
|
|
7
9
|
//================================================================================
|
|
8
10
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -387,6 +389,10 @@ export class CallLogic extends LogicItem {
|
|
|
387
389
|
|
|
388
390
|
// 用于logic回填
|
|
389
391
|
get calleewholeKey(): string {
|
|
392
|
+
if (!this.calleeNamespace && this.calleeName && this.view) {
|
|
393
|
+
// 页面逻辑单独处理
|
|
394
|
+
return `${this.view.getNamespace()}.${this.view.name}.logics.${this.calleeName}`;
|
|
395
|
+
}
|
|
390
396
|
return this.calleeNamespace + '.' + this.calleeName;
|
|
391
397
|
}
|
|
392
398
|
get calleeKey(): string {
|
|
@@ -437,6 +443,9 @@ export class CallLogic extends LogicItem {
|
|
|
437
443
|
|
|
438
444
|
_setCallee(logic: Logic) {
|
|
439
445
|
this.calleeNamespace = logic.getNamespace();
|
|
446
|
+
if (logic.parentNode instanceof View) {
|
|
447
|
+
this.calleeNamespace = '';
|
|
448
|
+
}
|
|
440
449
|
this.calleeName = logic.name;
|
|
441
450
|
this.arguments = [];
|
|
442
451
|
logic.params.forEach((param) => {
|
|
@@ -453,7 +462,10 @@ export class CallLogic extends LogicItem {
|
|
|
453
462
|
}
|
|
454
463
|
|
|
455
464
|
setCallee(logic: Logic) {
|
|
456
|
-
|
|
465
|
+
let calleeNamespace = logic.getNamespace();
|
|
466
|
+
if (logic.parentNode instanceof View) {
|
|
467
|
+
calleeNamespace = '';
|
|
468
|
+
}
|
|
457
469
|
const calleeName = logic.name;
|
|
458
470
|
const params = logic.params.map((param) => {
|
|
459
471
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
@@ -482,7 +494,10 @@ export class CallLogic extends LogicItem {
|
|
|
482
494
|
}
|
|
483
495
|
|
|
484
496
|
setCalleeArgName(logic: Logic) {
|
|
485
|
-
|
|
497
|
+
let calleeNamespace = logic.getNamespace();
|
|
498
|
+
if (logic.parentNode instanceof View) {
|
|
499
|
+
calleeNamespace = '';
|
|
500
|
+
}
|
|
486
501
|
const calleeName = logic.name;
|
|
487
502
|
/**
|
|
488
503
|
* a: logic.params b: this.arguments
|
|
@@ -528,7 +543,7 @@ export class CallLogic extends LogicItem {
|
|
|
528
543
|
|
|
529
544
|
toVue(options?: ElementToVueOptions): string {
|
|
530
545
|
let code = '';
|
|
531
|
-
if (this.calleeNamespace === 'nasl.browser' || this.calleeNamespace === 'nasl.auth' || this.calleeNamespace === 'nasl.configuration') {
|
|
546
|
+
if (this.calleeNamespace === 'nasl.browser' || this.calleeNamespace === 'nasl.auth' || this.calleeNamespace === 'nasl.configuration' || this.calleeNamespace === 'nasl.process') {
|
|
532
547
|
code += '$global.';
|
|
533
548
|
}
|
|
534
549
|
code += this.calleeName;
|
|
@@ -563,21 +578,20 @@ export class CallLogic extends LogicItem {
|
|
|
563
578
|
let isComponentLogic = false;
|
|
564
579
|
let componentName = '';
|
|
565
580
|
const calleeNamespace = this.calleeNamespace;
|
|
566
|
-
const
|
|
567
|
-
|
|
581
|
+
const keywordProcessIndex = findConceptKeyWordIndexFromNamespace(this.calleeNamespace, 'processes');
|
|
582
|
+
const isProcessLogic = keywordProcessIndex !== -1;
|
|
568
583
|
// calleeNamespace不存在,一定是页面逻辑
|
|
569
584
|
if (calleeNamespace) {
|
|
570
585
|
const namespaceArr = calleeNamespace.split('.');
|
|
571
|
-
const start = namespaceArr
|
|
586
|
+
const start = namespaceArr[0];
|
|
572
587
|
if (start === 'app' || start === 'extensions') {
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
if (!keywordViews) {
|
|
588
|
+
const keywordViewsIndex = findConceptKeyWordIndexFromNamespace(this.calleeNamespace, 'views');
|
|
589
|
+
if (keywordViewsIndex === -1) {
|
|
576
590
|
isViewLogic = false;
|
|
577
591
|
}
|
|
578
|
-
} else if (start === 'elements' && namespaceArr.length ===
|
|
592
|
+
} else if (start === 'elements' && namespaceArr.length === 3 && namespaceArr[2] === 'logics') {
|
|
579
593
|
isComponentLogic = true;
|
|
580
|
-
componentName = namespaceArr[
|
|
594
|
+
componentName = namespaceArr[1];
|
|
581
595
|
}
|
|
582
596
|
}
|
|
583
597
|
// 全局逻辑
|
|
@@ -598,17 +612,7 @@ export class CallLogic extends LogicItem {
|
|
|
598
612
|
};
|
|
599
613
|
});
|
|
600
614
|
const args = logic?.params || [];
|
|
601
|
-
|
|
602
|
-
// 去掉app
|
|
603
|
-
namespaceArr.shift();
|
|
604
|
-
const keywordEntities = namespaceArr
|
|
605
|
-
.map((namespaceItem, index) => ({
|
|
606
|
-
key: namespaceItem,
|
|
607
|
-
index,
|
|
608
|
-
}))
|
|
609
|
-
.filter((namespaceItem, index) => index % 2 === 0)
|
|
610
|
-
.find((namespaceItem) => namespaceItem.key === 'entities');
|
|
611
|
-
const entityName = namespaceArr[keywordEntities?.index + 1];
|
|
615
|
+
const keywordEntitiesIndex = findConceptKeyWordIndexFromNamespace(this.calleeNamespace, 'entities');
|
|
612
616
|
code += `this.$logics['${this.calleeNamespace ? `${this.calleeNamespace}.${this.calleeName}` : this.calleeName}']`;
|
|
613
617
|
code += `({
|
|
614
618
|
config: {
|
|
@@ -629,7 +633,7 @@ export class CallLogic extends LogicItem {
|
|
|
629
633
|
headers: {},
|
|
630
634
|
`;
|
|
631
635
|
|
|
632
|
-
if (
|
|
636
|
+
if (keywordEntitiesIndex !== -1) {
|
|
633
637
|
let logicArgs = this.arguments;
|
|
634
638
|
switch (this.calleeName) {
|
|
635
639
|
case 'get':
|
|
@@ -688,19 +692,30 @@ export class CallLogic extends LogicItem {
|
|
|
688
692
|
code += `JSON.parse`;
|
|
689
693
|
break;
|
|
690
694
|
}
|
|
691
|
-
} else if (calleeNamespace === 'nasl.browser' || calleeNamespace === 'nasl.auth' || calleeNamespace === 'nasl.configuration') {
|
|
695
|
+
} else if (calleeNamespace === 'nasl.browser' || calleeNamespace === 'nasl.auth' || calleeNamespace === 'nasl.configuration' || calleeNamespace === 'nasl.process') {
|
|
692
696
|
code += `this.$global.${this.calleeName}`;
|
|
693
697
|
} else {
|
|
694
698
|
code += `this.${this.calleeName}`;
|
|
695
699
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
.
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
700
|
+
if (calleeNamespace === 'nasl.process') {
|
|
701
|
+
code += '({';
|
|
702
|
+
this.arguments?.filter((arg) => arg?.expression)
|
|
703
|
+
.forEach((arg, index) => {
|
|
704
|
+
code += `${arg.keyword}: ${arg?.toJS(shiftState(state, code))}`;
|
|
705
|
+
if (index !== this.arguments?.length - 1)
|
|
706
|
+
code += ', ';
|
|
707
|
+
});
|
|
708
|
+
code += '})';
|
|
709
|
+
} else {
|
|
710
|
+
code += '(';
|
|
711
|
+
this.arguments?.filter((arg) => arg?.expression)
|
|
712
|
+
.forEach((arg, index) => {
|
|
713
|
+
code += arg?.toJS(shiftState(state, code));
|
|
714
|
+
if (index !== this.arguments?.length - 1)
|
|
715
|
+
code += ', ';
|
|
716
|
+
});
|
|
717
|
+
code += ')';
|
|
718
|
+
}
|
|
704
719
|
}
|
|
705
720
|
return code;
|
|
706
721
|
}
|