@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.16
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 -1
- package/out/automate/engine/index.js +73 -25
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/utils.js +7 -6
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -4
- package/out/common/BaseNode.js +48 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +18 -1
- package/out/concepts/App__.js +64 -24
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +190 -0
- package/out/concepts/Assignee__.js +264 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/BinaryExpression__.js +6 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +19 -0
- package/out/concepts/BindAttribute__.js +36 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +21 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +1 -0
- package/out/concepts/BindEvent__.js +38 -14
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +20 -7
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +11 -8
- package/out/concepts/CallInterface__.js +160 -23
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +5 -1
- package/out/concepts/CallQueryComponent__.js +15 -11
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +11 -0
- package/out/concepts/Destination__.js +59 -19
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +10 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +7 -0
- package/out/concepts/EntityProperty__.js +60 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -1
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -0
- package/out/concepts/Enum__.js +9 -6
- 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__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +5 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +26 -24
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +41 -21
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +3 -0
- package/out/concepts/Interface__.js +105 -9
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +3 -0
- package/out/concepts/Logic__.js +57 -16
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +13 -6
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +6 -0
- package/out/concepts/Module__.js +18 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +4 -0
- package/out/concepts/Namespace__.js +23 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +35 -22
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +20 -18
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +6 -1
- package/out/concepts/Process__.js +18 -14
- 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/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +38 -25
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -4
- package/out/concepts/StructureProperty__.js +54 -31
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -0
- package/out/concepts/Structure__.js +18 -5
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +3 -5
- package/out/concepts/TypeAnnotation__.js +36 -14
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +4 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +38 -25
- 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 +7 -1
- package/out/concepts/ViewElement__.js +154 -117
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +38 -25
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +49 -41
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +11 -11
- package/out/concepts/basics/types/coreTypeList.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 +1 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +122 -93
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +19 -2
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -0
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getLogics.js +40 -56
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +4 -0
- package/out/server/getMemberIdentifier.js +90 -48
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +2 -2
- package/out/server/getProcesses.js +34 -11
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/index.js +4 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +11 -30
- package/out/server/naslServer.js +410 -199
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +10 -0
- package/out/server/process2LogicNamespace.js +16 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +22 -3
- package/out/server/translator.js +336 -130
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +29 -15
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -5
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +7 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +1 -1
- package/out/templator/genGridViewBlock.js +3 -3
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +3 -3
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +7 -7
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/out/utils/index.d.ts +6 -0
- package/out/utils/index.js +20 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +2 -1
- package/src/automate/engine/index.js +73 -25
- package/src/automate/engine/utils.js +7 -6
- package/src/common/BaseNode.ts +51 -42
- package/src/concepts/App__.ts +104 -26
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/Assignee__.ts +437 -0
- package/src/concepts/BinaryExpression__.ts +7 -6
- package/src/concepts/BindAttribute__.ts +51 -2
- package/src/concepts/BindDirective__.ts +20 -1
- package/src/concepts/BindEvent__.ts +39 -16
- package/src/concepts/CallFunction__.ts +21 -8
- package/src/concepts/CallInterface__.ts +161 -42
- package/src/concepts/CallLogic__.ts +21 -9
- package/src/concepts/CallQueryComponent__.ts +15 -13
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +57 -19
- package/src/concepts/End__.ts +9 -11
- package/src/concepts/EntityProperty__.ts +56 -3
- package/src/concepts/Entity__.ts +33 -20
- package/src/concepts/Enum__.ts +8 -7
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +5 -5
- package/src/concepts/Identifier__.ts +31 -26
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +39 -20
- package/src/concepts/Interface__.ts +103 -9
- package/src/concepts/LogicItem__.ts +16 -1
- package/src/concepts/Logic__.ts +60 -18
- package/src/concepts/MemberExpression__.ts +18 -6
- package/src/concepts/Module__.ts +19 -8
- package/src/concepts/Namespace__.ts +24 -12
- package/src/concepts/Param__.ts +34 -23
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +51 -50
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +32 -28
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +35 -25
- package/src/concepts/SqlQueryComponent__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +49 -29
- package/src/concepts/Structure__.ts +17 -5
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +34 -12
- package/src/concepts/UnaryExpression__.ts +4 -2
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +35 -24
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +168 -113
- package/src/concepts/View__.ts +44 -25
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +49 -41
- package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
- package/src/concepts/basics/types/coreTypeList.ts +11 -11
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +1 -1
- package/src/generator/genBundleFiles.ts +131 -112
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +22 -4
- package/src/server/entity2LogicNamespace.ts +25 -9
- package/src/server/getExtensionModules.ts +2 -0
- package/src/server/getLogics.ts +42 -58
- package/src/server/getMemberIdentifier.ts +88 -46
- package/src/server/getProcesses.ts +32 -9
- package/src/server/index.ts +12 -1
- package/src/server/naslServer.ts +422 -215
- package/src/server/process2LogicNamespace.ts +17 -1
- package/src/server/translator.ts +392 -134
- package/src/service/storage/init.ts +27 -16
- package/src/templator/genCreateBlock.ts +5 -5
- package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +5 -7
- package/src/templator/genGridViewBlock.ts +4 -7
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genTableBlock.ts +4 -7
- package/src/templator/genUpdateBlock.ts +7 -8
- package/src/templator/utils.ts +2 -1
- package/src/utils/index.ts +19 -0
|
@@ -115,7 +115,7 @@ export class Destination extends LogicItem {
|
|
|
115
115
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
116
116
|
let argument: Argument;
|
|
117
117
|
if (options instanceof Argument) {
|
|
118
|
-
options.
|
|
118
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
119
119
|
argument = options;
|
|
120
120
|
Object.assign(argument, relationOptions);
|
|
121
121
|
} else {
|
|
@@ -337,6 +337,38 @@ export class Destination extends LogicItem {
|
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
/**
|
|
341
|
+
* 设置view的argument
|
|
342
|
+
*/
|
|
343
|
+
setViewArgument(view: View) {
|
|
344
|
+
const params = view.params;
|
|
345
|
+
const argument = this.arguments;
|
|
346
|
+
if (params.length > argument.length) {
|
|
347
|
+
params.forEach((item) => {
|
|
348
|
+
const arg = argument.find((arg) => arg.keyword === item.name);
|
|
349
|
+
if (!arg) {
|
|
350
|
+
this.addArgument({
|
|
351
|
+
keyword: item.name,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
} else {
|
|
356
|
+
argument.forEach((item) => {
|
|
357
|
+
const param = params.find((param) => param.name === item.keyword);
|
|
358
|
+
if (!param) {
|
|
359
|
+
item.delete();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* 设置Arguments的KeyWord
|
|
366
|
+
*/
|
|
367
|
+
setArgumentsKeyWord(options: {findArgument: Argument, newKeyword: string}) {
|
|
368
|
+
const { findArgument, newKeyword } = options;
|
|
369
|
+
findArgument.setKeyword(newKeyword);
|
|
370
|
+
}
|
|
371
|
+
|
|
340
372
|
get viewPath() {
|
|
341
373
|
if (!this.viewNamespace) {
|
|
342
374
|
return '';
|
|
@@ -355,20 +387,24 @@ export class Destination extends LogicItem {
|
|
|
355
387
|
@withSourceMap()
|
|
356
388
|
toEmbeddedTSInProcess(state: TranslatorState, prependCode: string): string {
|
|
357
389
|
// const tab = indent(state.tabSize);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
this.arguments
|
|
365
|
-
|
|
366
|
-
|
|
390
|
+
if (this.tsCalleeNamespace && this.tsName) {
|
|
391
|
+
let code = `destination: function() {\n`;
|
|
392
|
+
code += prependCode;
|
|
393
|
+
code += '\n';
|
|
394
|
+
if (this.tsCalleeNamespace && this.viewName) {
|
|
395
|
+
code += `${this.tsCalleeNamespace}.${this.viewName}.$destination({`;
|
|
396
|
+
if (Array.isArray(this.arguments)) {
|
|
397
|
+
this.arguments.forEach((argument: Argument) => {
|
|
398
|
+
code += argument.toEmbeddedTS(shiftState(state, code), false, true) + ', ';
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
code += `});\n`;
|
|
367
402
|
}
|
|
368
|
-
code += `
|
|
403
|
+
code += indent(state.tabSize + 1) + `}\n`;
|
|
404
|
+
return code;
|
|
405
|
+
} else {
|
|
406
|
+
return '__IDENTIFIER__';
|
|
369
407
|
}
|
|
370
|
-
code += indent(state.tabSize + 1) + `}\n`;
|
|
371
|
-
return code;
|
|
372
408
|
}
|
|
373
409
|
|
|
374
410
|
@withSourceMap()
|
|
@@ -379,25 +415,27 @@ export class Destination extends LogicItem {
|
|
|
379
415
|
code = `${utils.firstLowerCase(this.concept)}: () => {\n`;
|
|
380
416
|
code += indent(state.tabSize + 2);
|
|
381
417
|
if (this.tsCalleeNamespace && this.tsName) {
|
|
382
|
-
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination(`;
|
|
418
|
+
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination({`;
|
|
383
419
|
if (Array.isArray(this.arguments)) {
|
|
384
420
|
this.arguments.forEach((argument: Argument) => {
|
|
385
|
-
code += argument.toEmbeddedTS(shiftState(state, code)) + ', ';
|
|
421
|
+
code += argument.toEmbeddedTS(shiftState(state, code), false, true) + ', ';
|
|
386
422
|
});
|
|
387
423
|
}
|
|
388
|
-
code += `);\n`;
|
|
424
|
+
code += `});\n`;
|
|
389
425
|
}
|
|
390
426
|
code += indent(state.tabSize + 1) + `},\n`;
|
|
391
427
|
return code;
|
|
392
428
|
} else {
|
|
393
429
|
if (this.tsCalleeNamespace && this.tsName) {
|
|
394
|
-
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination(`;
|
|
430
|
+
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination({`;
|
|
395
431
|
if (Array.isArray(this.arguments)) {
|
|
396
432
|
this.arguments.forEach((argument: Argument) => {
|
|
397
|
-
code += argument.toEmbeddedTS(shiftState(state, code)) + ', ';
|
|
433
|
+
code += argument.toEmbeddedTS(shiftState(state, code), false, true) + ', ';
|
|
398
434
|
});
|
|
399
435
|
}
|
|
400
|
-
code += `);\n`;
|
|
436
|
+
code += `});\n`;
|
|
437
|
+
} else {
|
|
438
|
+
code += '__IDENTIFIER__';
|
|
401
439
|
}
|
|
402
440
|
return code;
|
|
403
441
|
}
|
package/src/concepts/End__.ts
CHANGED
|
@@ -29,8 +29,6 @@ export class End extends LogicItem {
|
|
|
29
29
|
@property()
|
|
30
30
|
label: string = '结束';
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
32
|
/**
|
|
35
33
|
* @param source 需要合并的部分参数
|
|
36
34
|
*/
|
|
@@ -44,19 +42,19 @@ export class End extends LogicItem {
|
|
|
44
42
|
return super.from(source, parentNode, parentKey) as End;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
45
|
//================================================================================
|
|
55
46
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
56
47
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
57
48
|
//================================================================================
|
|
58
49
|
toJS(state?: TranslatorState): string {
|
|
59
|
-
|
|
50
|
+
let code = '';
|
|
51
|
+
const ret = this.logic.returns[0];
|
|
52
|
+
if (ret) {
|
|
53
|
+
code += 'return ' + ret.name + ';';
|
|
54
|
+
} else {
|
|
55
|
+
code += 'return;';
|
|
56
|
+
}
|
|
57
|
+
return code;
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
@@ -76,7 +74,7 @@ export class End extends LogicItem {
|
|
|
76
74
|
//================================================================================
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
classMap
|
|
77
|
+
classMap.End = End;
|
|
80
78
|
export default End;
|
|
81
79
|
//================================================================================
|
|
82
80
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dataTypesMap } from './basics/types';
|
|
2
2
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
3
|
+
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
4
|
type changeType = 'up' | 'down';
|
|
4
5
|
//================================================================================
|
|
5
6
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -331,6 +332,56 @@ export class EntityProperty extends BaseNode {
|
|
|
331
332
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
332
333
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
333
334
|
//================================================================================
|
|
335
|
+
|
|
336
|
+
get hasChildren() {
|
|
337
|
+
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
338
|
+
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
339
|
+
if (typeNamespace.endsWith('.enums'))
|
|
340
|
+
return null;
|
|
341
|
+
return [{}];
|
|
342
|
+
}
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
get isTreeLeaf() {
|
|
346
|
+
return !this.hasChildren;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 是否展开
|
|
351
|
+
*/
|
|
352
|
+
@property()
|
|
353
|
+
isLeaf: boolean = true;
|
|
354
|
+
|
|
355
|
+
getSelectRef() {
|
|
356
|
+
try {
|
|
357
|
+
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
358
|
+
let completionChildren;
|
|
359
|
+
if (typeKind === 'reference') {
|
|
360
|
+
if (typeNamespace === 'nasl.ui') {
|
|
361
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
362
|
+
const properties = node.properties || [];
|
|
363
|
+
completionChildren = properties;
|
|
364
|
+
} else if (typeNamespace.endsWith('.enums')) {
|
|
365
|
+
completionChildren = undefined;
|
|
366
|
+
} else {
|
|
367
|
+
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
368
|
+
const properties = node.properties || [];
|
|
369
|
+
completionChildren = properties;
|
|
370
|
+
}
|
|
371
|
+
} else if (typeKind === 'generic') {
|
|
372
|
+
if (typeNamespace === 'nasl.collection') {
|
|
373
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
374
|
+
const properties = node.properties || [];
|
|
375
|
+
completionChildren = properties;
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
completionChildren = undefined;
|
|
379
|
+
}
|
|
380
|
+
return completionChildren;
|
|
381
|
+
} catch (err) {
|
|
382
|
+
console.log(err);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
334
385
|
/**
|
|
335
386
|
* 设置是否必填
|
|
336
387
|
*/
|
|
@@ -399,7 +450,7 @@ export class EntityProperty extends BaseNode {
|
|
|
399
450
|
// eslint-disable-next-line prefer-rest-params
|
|
400
451
|
throw new Error('找不到类型:' + arguments[0]);
|
|
401
452
|
} else {
|
|
402
|
-
typeAnnotation._delete();
|
|
453
|
+
typeAnnotation._delete?.();
|
|
403
454
|
const relationOptions = { parentId: this.id, parentConcept: this.concept, parentNode: this };
|
|
404
455
|
Object.assign(typeAnnotation, relationOptions);
|
|
405
456
|
}
|
|
@@ -439,7 +490,8 @@ export class EntityProperty extends BaseNode {
|
|
|
439
490
|
*/
|
|
440
491
|
moveUp() {
|
|
441
492
|
const properties = [...(this.parentNode as Entity).properties];
|
|
442
|
-
const
|
|
493
|
+
const propertiesNameList = properties.map((item) => item.name);
|
|
494
|
+
const oldIndex = propertiesNameList.indexOf(this.name);
|
|
443
495
|
this.changeSort(properties, oldIndex, 'up');
|
|
444
496
|
this.parentNode.update({
|
|
445
497
|
properties,
|
|
@@ -450,7 +502,8 @@ export class EntityProperty extends BaseNode {
|
|
|
450
502
|
*/
|
|
451
503
|
moveDown() {
|
|
452
504
|
const properties = [...(this.parentNode as Entity).properties];
|
|
453
|
-
const
|
|
505
|
+
const propertiesNameList = properties.map((item) => item.name);
|
|
506
|
+
const oldIndex = propertiesNameList.indexOf(this.name);
|
|
454
507
|
this.changeSort(properties, oldIndex, 'down');
|
|
455
508
|
this.parentNode.update({
|
|
456
509
|
properties,
|
package/src/concepts/Entity__.ts
CHANGED
|
@@ -110,15 +110,15 @@ export class Entity extends BaseNode {
|
|
|
110
110
|
/**
|
|
111
111
|
* 设置实体名称
|
|
112
112
|
*/
|
|
113
|
-
setName(name: string) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
113
|
+
// setName(name: string) {
|
|
114
|
+
// const object = {
|
|
115
|
+
// name,
|
|
116
|
+
// };
|
|
117
|
+
// this.update({
|
|
118
|
+
// ...object,
|
|
119
|
+
// field: 'name',
|
|
120
|
+
// });
|
|
121
|
+
// }
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* 设置实体描述
|
|
@@ -132,7 +132,7 @@ export class Entity extends BaseNode {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
getPropertyExistingNames(excludedList: Array<EntityProperty> = []) {
|
|
136
136
|
const excludedSet = new Set(excludedList);
|
|
137
137
|
return (this.properties || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
138
138
|
}
|
|
@@ -176,7 +176,7 @@ export class Entity extends BaseNode {
|
|
|
176
176
|
name: options,
|
|
177
177
|
}, this, 'properties');
|
|
178
178
|
} else if (options instanceof EntityProperty) {
|
|
179
|
-
options.
|
|
179
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
180
180
|
property = options;
|
|
181
181
|
Object.assign(property, relationOptions);
|
|
182
182
|
} else {
|
|
@@ -273,7 +273,6 @@ export class Entity extends BaseNode {
|
|
|
273
273
|
return node;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
|
|
277
276
|
getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
|
|
278
277
|
const excludedSet = new Set(excludedList);
|
|
279
278
|
return (this.indexes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -318,7 +317,7 @@ export class Entity extends BaseNode {
|
|
|
318
317
|
name: options,
|
|
319
318
|
}, this, 'indexes');
|
|
320
319
|
} else if (options instanceof EntityIndex) {
|
|
321
|
-
options.
|
|
320
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
322
321
|
entityIndex = options;
|
|
323
322
|
Object.assign(entityIndex, relationOptions);
|
|
324
323
|
} else {
|
|
@@ -415,9 +414,6 @@ export class Entity extends BaseNode {
|
|
|
415
414
|
return node;
|
|
416
415
|
}
|
|
417
416
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
417
|
/**
|
|
422
418
|
* 删除实体字段
|
|
423
419
|
* @param name 实体字段名称
|
|
@@ -466,8 +462,6 @@ export class Entity extends BaseNode {
|
|
|
466
462
|
return params;
|
|
467
463
|
}
|
|
468
464
|
|
|
469
|
-
|
|
470
|
-
|
|
471
465
|
/**
|
|
472
466
|
* 删除实体索引
|
|
473
467
|
* @param name 实体索引名称
|
|
@@ -520,6 +514,22 @@ export class Entity extends BaseNode {
|
|
|
520
514
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
521
515
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
522
516
|
//================================================================================
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* 设置实体表名并修改表名
|
|
520
|
+
*/
|
|
521
|
+
setName(name: string) {
|
|
522
|
+
const object: { name: string; tableName?: string } = {
|
|
523
|
+
name,
|
|
524
|
+
};
|
|
525
|
+
if (this.name === this.tableName && (this.origin === 'ide' || this.origin === 'sql')) {
|
|
526
|
+
object.tableName = name;
|
|
527
|
+
}
|
|
528
|
+
this.update({
|
|
529
|
+
...object,
|
|
530
|
+
field: 'name',
|
|
531
|
+
});
|
|
532
|
+
}
|
|
523
533
|
/**
|
|
524
534
|
* 设置实体表名
|
|
525
535
|
*/
|
|
@@ -681,10 +691,13 @@ export class Entity extends BaseNode {
|
|
|
681
691
|
}
|
|
682
692
|
|
|
683
693
|
get ns() {
|
|
684
|
-
const ns = entity2LogicNamespace(this);
|
|
694
|
+
const ns: Namespace = entity2LogicNamespace(this);
|
|
685
695
|
ns.path = this.getNamespace() + '.' + ns.name;
|
|
686
696
|
return ns;
|
|
687
697
|
}
|
|
698
|
+
// @excludedInJSON()
|
|
699
|
+
// nslogic: Namespace;
|
|
700
|
+
|
|
688
701
|
get logics() {
|
|
689
702
|
const ns = this.ns;
|
|
690
703
|
return ns.logics;
|
|
@@ -715,7 +728,7 @@ export class Entity extends BaseNode {
|
|
|
715
728
|
//================================================================================
|
|
716
729
|
}
|
|
717
730
|
|
|
718
|
-
classMap
|
|
731
|
+
classMap.Entity = Entity;
|
|
719
732
|
export default Entity;
|
|
720
733
|
//================================================================================
|
|
721
734
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -148,7 +148,7 @@ export class Enum extends BaseNode {
|
|
|
148
148
|
const relationOptions = { parentNode: this, parentKey: 'enumItems' };
|
|
149
149
|
let enumItem: EnumItem;
|
|
150
150
|
if (options instanceof EnumItem) {
|
|
151
|
-
options.
|
|
151
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
152
152
|
enumItem = options;
|
|
153
153
|
Object.assign(enumItem, relationOptions);
|
|
154
154
|
} else {
|
|
@@ -280,24 +280,25 @@ export class Enum extends BaseNode {
|
|
|
280
280
|
@property()
|
|
281
281
|
children: any;
|
|
282
282
|
|
|
283
|
+
/**
|
|
284
|
+
* 是否展开
|
|
285
|
+
*/
|
|
286
|
+
@property()
|
|
287
|
+
isLeaf: boolean = true;
|
|
288
|
+
|
|
283
289
|
@withSourceMap()
|
|
284
290
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
285
291
|
let code = `export class ${this.name} extends nasl.core.Enums {\n`;
|
|
286
292
|
// 增加一个单独的标签
|
|
287
293
|
code += indent(state.tabSize + 1) + `__name: '${this.getNamespace()}.${this.name}';\n`;
|
|
288
|
-
let enumItemStr = '';
|
|
289
294
|
this.enumItems.forEach((property) => {
|
|
290
295
|
code += indent(state.tabSize + 1);
|
|
291
296
|
code += property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
292
297
|
code += ';\n';
|
|
293
|
-
|
|
294
|
-
enumItemStr += `${property.value}: ${this.name},\n`;
|
|
295
298
|
});
|
|
296
299
|
code += `
|
|
297
300
|
static toList() {
|
|
298
|
-
let value: nasl.collection.List<
|
|
299
|
-
${enumItemStr}
|
|
300
|
-
}>
|
|
301
|
+
let value: nasl.collection.List<nasl.ui.EnumItem>
|
|
301
302
|
return value;
|
|
302
303
|
}
|
|
303
304
|
static toString() {
|
package/src/concepts/Event__.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class Event extends BaseNode {
|
|
|
150
150
|
name: options,
|
|
151
151
|
}, this, 'params');
|
|
152
152
|
} else if (options instanceof Param) {
|
|
153
|
-
options.
|
|
153
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
154
154
|
param = options;
|
|
155
155
|
Object.assign(param, relationOptions);
|
|
156
156
|
} else {
|
|
@@ -177,7 +177,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
177
177
|
const relationOptions = { parentNode: this, parentKey: 'body' };
|
|
178
178
|
let logicItem: LogicItem;
|
|
179
179
|
if (options instanceof LogicItem) {
|
|
180
|
-
options.
|
|
180
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
181
181
|
logicItem = options;
|
|
182
182
|
Object.assign(logicItem, relationOptions);
|
|
183
183
|
} else {
|
|
@@ -509,18 +509,13 @@ export class ForEachStatement extends LogicItem {
|
|
|
509
509
|
|
|
510
510
|
toJS(state?: TranslatorState): string {
|
|
511
511
|
let code = '';
|
|
512
|
-
|
|
512
|
+
const list = this.each ? this.each.toJS(shiftState(state, code, {
|
|
513
513
|
tabSize: 0,
|
|
514
514
|
})) : '';
|
|
515
|
-
code +=
|
|
516
|
-
code += this.start && this.start.toJS() ? this.start.toJS() : '';
|
|
517
|
-
code +=
|
|
518
|
-
code +=
|
|
519
|
-
code += ').forEach(async (';
|
|
520
|
-
code += this.item.name ? `${this.item.name}` : '';
|
|
521
|
-
code += ', ';
|
|
522
|
-
code += this.index.name ? `${this.index.name}` : '';
|
|
523
|
-
code += ') => {\n';
|
|
515
|
+
code += `if(Array.isArray(${list})) {\n`;
|
|
516
|
+
code += `for (let ${this.index.name} = ${this.start && this.start.toJS() ? this.start.toJS() : ''}; `;
|
|
517
|
+
code += `${this.index.name} < (${this.end && this.end.toJS() ? this.end.toJS() : ''}); ${this.index.name}++) {\n`;
|
|
518
|
+
code += `const ${this.item.name} = ${list}[${this.index.name}];\n`;
|
|
524
519
|
if (Array.isArray(this.body)) {
|
|
525
520
|
this.body.forEach((logicItem) => {
|
|
526
521
|
code
|
|
@@ -529,8 +524,8 @@ export class ForEachStatement extends LogicItem {
|
|
|
529
524
|
})) + '\n';
|
|
530
525
|
});
|
|
531
526
|
}
|
|
532
|
-
code += '}
|
|
533
|
-
|
|
527
|
+
code += '}\n';
|
|
528
|
+
code += '}\n';
|
|
534
529
|
return code;
|
|
535
530
|
}
|
|
536
531
|
|
|
@@ -170,7 +170,7 @@ export class Function extends BaseNode {
|
|
|
170
170
|
name: options,
|
|
171
171
|
}, this, 'typeParams');
|
|
172
172
|
} else if (options instanceof TypeParam) {
|
|
173
|
-
options.
|
|
173
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
174
174
|
typeParam = options;
|
|
175
175
|
Object.assign(typeParam, relationOptions);
|
|
176
176
|
} else {
|
|
@@ -308,7 +308,7 @@ export class Function extends BaseNode {
|
|
|
308
308
|
name: options,
|
|
309
309
|
}, this, 'params');
|
|
310
310
|
} else if (options instanceof Param) {
|
|
311
|
-
options.
|
|
311
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
312
312
|
param = options;
|
|
313
313
|
Object.assign(param, relationOptions);
|
|
314
314
|
} else {
|
|
@@ -406,7 +406,7 @@ export class Function extends BaseNode {
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
|
|
409
|
-
getReturnUniqueName(name = '
|
|
409
|
+
getReturnUniqueName(name = 'result') {
|
|
410
410
|
return utils.unique(name, this.getVarExistingNames());
|
|
411
411
|
}
|
|
412
412
|
|
|
@@ -446,7 +446,7 @@ export class Function extends BaseNode {
|
|
|
446
446
|
name: options,
|
|
447
447
|
}, this, 'returns');
|
|
448
448
|
} else if (options instanceof Return) {
|
|
449
|
-
options.
|
|
449
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
450
450
|
ret = options;
|
|
451
451
|
Object.assign(ret, relationOptions);
|
|
452
452
|
} else {
|
|
@@ -584,7 +584,7 @@ export class Function extends BaseNode {
|
|
|
584
584
|
name: options,
|
|
585
585
|
}, this, 'variables');
|
|
586
586
|
} else if (options instanceof Variable) {
|
|
587
|
-
options.
|
|
587
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
588
588
|
variable = options;
|
|
589
589
|
Object.assign(variable, relationOptions);
|
|
590
590
|
} else {
|
|
@@ -69,7 +69,7 @@ export class Identifier extends LogicItem {
|
|
|
69
69
|
typeAnnotation: TypeAnnotation = undefined;
|
|
70
70
|
|
|
71
71
|
globalDataMap: {
|
|
72
|
-
[name: string]: boolean
|
|
72
|
+
[name: string]: boolean;
|
|
73
73
|
} = {
|
|
74
74
|
$route: true,
|
|
75
75
|
$global: true,
|
|
@@ -89,7 +89,7 @@ export class Identifier extends LogicItem {
|
|
|
89
89
|
if (last === 'enums') {
|
|
90
90
|
name = `$utils.EnumList("${this.name}")`;
|
|
91
91
|
}
|
|
92
|
-
} else if (this.namespace && this.namespace.endsWith('nasl.browser')) {
|
|
92
|
+
} else if (this.namespace && (this.namespace.endsWith('nasl.browser') || this.namespace.endsWith('nasl.auth') || this.namespace.endsWith('nasl.configuration'))) {
|
|
93
93
|
name = `$global.${this.name}`;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -109,8 +109,8 @@ export class Identifier extends LogicItem {
|
|
|
109
109
|
if (last === 'enums') {
|
|
110
110
|
name = `$utils.EnumList("${this.name}")`;
|
|
111
111
|
}
|
|
112
|
-
} else if (namespace.
|
|
113
|
-
name = `$
|
|
112
|
+
} else if (namespace.startsWith('nasl.')) {
|
|
113
|
+
name = `${namespace}.${this.name}`;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
return name;
|
|
@@ -118,26 +118,19 @@ export class Identifier extends LogicItem {
|
|
|
118
118
|
|
|
119
119
|
toJS(): string {
|
|
120
120
|
const dataMap: {
|
|
121
|
-
[name: string]: boolean
|
|
121
|
+
[name: string]: boolean;
|
|
122
122
|
} = {};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (Array.isArray(variables)) {
|
|
131
|
-
variables.forEach((variable) => {
|
|
132
|
-
dataMap[variable.name] = true;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
123
|
+
|
|
124
|
+
this.view?.params?.forEach((param) => {
|
|
125
|
+
dataMap[param.name] = true;
|
|
126
|
+
});
|
|
127
|
+
this.view?.variables?.forEach((variable) => {
|
|
128
|
+
dataMap[variable.name] = true;
|
|
129
|
+
});
|
|
136
130
|
const parentNode = this.parentNode;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
isMemberExpression = true;
|
|
131
|
+
let isMemberExpressionProperty = false;
|
|
132
|
+
if (parentNode?.concept === 'MemberExpression' && this.parentKey === 'property') {
|
|
133
|
+
isMemberExpressionProperty = true;
|
|
141
134
|
}
|
|
142
135
|
let name = this.name;
|
|
143
136
|
let last = '';
|
|
@@ -152,11 +145,17 @@ export class Identifier extends LogicItem {
|
|
|
152
145
|
if (last === 'enums') {
|
|
153
146
|
name = `$utils.EnumList("${this.name}")`;
|
|
154
147
|
}
|
|
155
|
-
} else if (namespace.endsWith('nasl.browser')) {
|
|
148
|
+
} else if (namespace.endsWith('nasl.browser') || namespace.endsWith('nasl.auth') || namespace.endsWith('nasl.configuration')) {
|
|
156
149
|
name = `$global.${this.name}`;
|
|
157
150
|
}
|
|
158
151
|
}
|
|
159
|
-
return (dataMap[name]
|
|
152
|
+
return (dataMap[name]
|
|
153
|
+
|| this.globalDataMap[name]
|
|
154
|
+
|| namespace?.endsWith('nasl.browser')
|
|
155
|
+
|| namespace?.endsWith('nasl.auth')
|
|
156
|
+
|| namespace?.endsWith('nasl.configuration')
|
|
157
|
+
|| last === 'enums')
|
|
158
|
+
&& !isMemberExpressionProperty ? `this.${name}` : name;
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
@withSourceMap()
|
|
@@ -167,7 +166,7 @@ export class Identifier extends LogicItem {
|
|
|
167
166
|
const viewLogics = view.logics;
|
|
168
167
|
const findLogic = viewLogics.find((item) => item.name === this.name);
|
|
169
168
|
if (findLogic) {
|
|
170
|
-
return
|
|
169
|
+
return this.name;
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
// 因为右侧枚举要赋值就赋值toList方法一下
|
|
@@ -175,7 +174,7 @@ export class Identifier extends LogicItem {
|
|
|
175
174
|
// 绑定类型
|
|
176
175
|
if (this.parentNode instanceof BindAttribute) {
|
|
177
176
|
// this.parentNode.name === 'data-source'
|
|
178
|
-
return (
|
|
177
|
+
return (this.namespace + '.' || '') + this.name + '.toList';
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
|
|
@@ -190,6 +189,12 @@ export class Identifier extends LogicItem {
|
|
|
190
189
|
// return str.includes('.enums.') ? str : str + '.toString()';
|
|
191
190
|
// }
|
|
192
191
|
// }
|
|
192
|
+
|
|
193
|
+
// having 下选择的变量不生成 namespace 前缀
|
|
194
|
+
if (this.namespace === 'inner' && this.getAncestor('CallQueryComponent')) {
|
|
195
|
+
return `__${this.name}` || '__IDENTIFIER__';
|
|
196
|
+
}
|
|
197
|
+
|
|
193
198
|
return this.namespace ? this.namespace + '.' + this.name : this.name || '__IDENTIFIER__';
|
|
194
199
|
}
|
|
195
200
|
|
|
@@ -96,7 +96,7 @@ export class IfStatement extends LogicItem {
|
|
|
96
96
|
const relationOptions = { parentNode: this, parentKey: 'consequent' };
|
|
97
97
|
let logicItem: LogicItem;
|
|
98
98
|
if (options instanceof LogicItem) {
|
|
99
|
-
options.
|
|
99
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
100
100
|
logicItem = options;
|
|
101
101
|
Object.assign(logicItem, relationOptions);
|
|
102
102
|
} else {
|
|
@@ -200,7 +200,7 @@ export class IfStatement extends LogicItem {
|
|
|
200
200
|
const relationOptions = { parentNode: this, parentKey: 'alternate' };
|
|
201
201
|
let logicItem: LogicItem;
|
|
202
202
|
if (options instanceof LogicItem) {
|
|
203
|
-
options.
|
|
203
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
204
204
|
logicItem = options;
|
|
205
205
|
Object.assign(logicItem, relationOptions);
|
|
206
206
|
} else {
|