@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
|
@@ -32,7 +32,7 @@ export class CallFunction extends LogicItem {
|
|
|
32
32
|
* 调用函数标题
|
|
33
33
|
*/
|
|
34
34
|
@property()
|
|
35
|
-
label: string = '
|
|
35
|
+
label: string = '内置函数';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* calleeNamespace
|
|
@@ -105,7 +105,7 @@ export class CallFunction extends LogicItem {
|
|
|
105
105
|
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
106
106
|
let typeAnnotation: TypeAnnotation;
|
|
107
107
|
if (options instanceof TypeAnnotation) {
|
|
108
|
-
options.
|
|
108
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
109
109
|
typeAnnotation = options;
|
|
110
110
|
Object.assign(typeAnnotation, relationOptions);
|
|
111
111
|
} else {
|
|
@@ -212,7 +212,7 @@ export class CallFunction extends LogicItem {
|
|
|
212
212
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
213
213
|
let argument: Argument;
|
|
214
214
|
if (options instanceof Argument) {
|
|
215
|
-
options.
|
|
215
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
216
216
|
argument = options;
|
|
217
217
|
Object.assign(argument, relationOptions);
|
|
218
218
|
} else {
|
|
@@ -404,6 +404,14 @@ export class CallFunction extends LogicItem {
|
|
|
404
404
|
if (index !== this.arguments.length - 1)
|
|
405
405
|
code += ', ';
|
|
406
406
|
});
|
|
407
|
+
if (this.typeArguments && this.typeArguments.length) {
|
|
408
|
+
code += ', ';
|
|
409
|
+
this.typeArguments.forEach((arg, index) => {
|
|
410
|
+
code += arg.toJS(shiftState(state, code));
|
|
411
|
+
if (index !== this.arguments.length - 1)
|
|
412
|
+
code += ', ';
|
|
413
|
+
});
|
|
414
|
+
}
|
|
407
415
|
code += ')';
|
|
408
416
|
return code;
|
|
409
417
|
}
|
|
@@ -429,7 +437,7 @@ export class CallFunction extends LogicItem {
|
|
|
429
437
|
const argument = Argument.from({
|
|
430
438
|
keyword: param.name,
|
|
431
439
|
}, this);
|
|
432
|
-
if(param.defaultExpression instanceof Identifier) {
|
|
440
|
+
if (param.defaultExpression instanceof Identifier) {
|
|
433
441
|
argument.expression = BaseNode.from(param.defaultExpression, argument, 'expression') as Identifier;
|
|
434
442
|
}
|
|
435
443
|
Object.assign(argument, relationOptions);
|
|
@@ -470,14 +478,19 @@ export class CallFunction extends LogicItem {
|
|
|
470
478
|
code += ')';
|
|
471
479
|
// 如果有内容
|
|
472
480
|
const typeAnnotation = this.typeArguments[0];
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
481
|
+
code += `<`;
|
|
482
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>()`;
|
|
476
483
|
code += '\n';
|
|
477
484
|
} else {
|
|
478
485
|
code = this.calleeKey;
|
|
486
|
+
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
487
|
+
// 如果有内容
|
|
488
|
+
const typeAnnotation = this.typeArguments[0];
|
|
489
|
+
code += `<`;
|
|
490
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>`;
|
|
491
|
+
}
|
|
479
492
|
code += '(';
|
|
480
|
-
this.arguments.forEach((arg, index) => {
|
|
493
|
+
Array.isArray(this.arguments) && this.arguments.forEach((arg, index) => {
|
|
481
494
|
code += arg.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
482
495
|
if (index !== this.arguments.length - 1)
|
|
483
496
|
code += ', ';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import Interface from './Interface__';
|
|
3
3
|
import { ElementToVueOptions } from './ViewElement__';
|
|
4
|
+
import { getConceptConstructor } from '../decorators';
|
|
4
5
|
//================================================================================
|
|
5
6
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
6
7
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -14,6 +15,7 @@ import BaseNode from '../common/BaseNode';
|
|
|
14
15
|
import classMap from '../common/classMap';
|
|
15
16
|
import Argument from './Argument__';
|
|
16
17
|
import LogicItem from './LogicItem__';
|
|
18
|
+
import NullLiteral from './NullLiteral__';
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* 调用接口
|
|
@@ -56,8 +58,6 @@ export class CallInterface extends LogicItem {
|
|
|
56
58
|
@property('Argument')
|
|
57
59
|
arguments: Array<Argument> = [];
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
61
|
/**
|
|
62
62
|
* @param source 需要合并的部分参数
|
|
63
63
|
*/
|
|
@@ -71,25 +71,18 @@ export class CallInterface extends LogicItem {
|
|
|
71
71
|
return super.from(source, parentNode, parentKey) as CallInterface;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
74
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
* 插入实际参数
|
|
76
|
+
* @internal
|
|
77
|
+
* @param argumentOptions 实际参数参数
|
|
78
|
+
*/
|
|
86
79
|
_insertArgumentAt(argumentOptions: Partial<Argument>, index: number): Argument;
|
|
87
80
|
|
|
88
81
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
* 插入实际参数
|
|
83
|
+
* @internal
|
|
84
|
+
* @param argument 已有的实际参数实例
|
|
85
|
+
*/
|
|
93
86
|
_insertArgumentAt(argument: Argument, index: number): Argument;
|
|
94
87
|
|
|
95
88
|
_insertArgumentAt(options: Partial<Argument> | Argument, index: number) {
|
|
@@ -97,7 +90,7 @@ export class CallInterface extends LogicItem {
|
|
|
97
90
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
98
91
|
let argument: Argument;
|
|
99
92
|
if (options instanceof Argument) {
|
|
100
|
-
options.
|
|
93
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
101
94
|
argument = options;
|
|
102
95
|
Object.assign(argument, relationOptions);
|
|
103
96
|
} else {
|
|
@@ -110,8 +103,6 @@ export class CallInterface extends LogicItem {
|
|
|
110
103
|
return argument;
|
|
111
104
|
}
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
|
|
115
106
|
/**
|
|
116
107
|
* 插入实际参数
|
|
117
108
|
* @param argumentOptions 实际参数参数
|
|
@@ -134,8 +125,6 @@ export class CallInterface extends LogicItem {
|
|
|
134
125
|
return node;
|
|
135
126
|
}
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
|
|
139
128
|
/**
|
|
140
129
|
* 添加实际参数
|
|
141
130
|
* @internal
|
|
@@ -155,8 +144,6 @@ export class CallInterface extends LogicItem {
|
|
|
155
144
|
return this._insertArgumentAt(options as any, index);
|
|
156
145
|
}
|
|
157
146
|
|
|
158
|
-
|
|
159
|
-
|
|
160
147
|
/**
|
|
161
148
|
* 添加实际参数
|
|
162
149
|
* @param argumentOptions 实际参数参数
|
|
@@ -180,9 +167,6 @@ export class CallInterface extends LogicItem {
|
|
|
180
167
|
return node;
|
|
181
168
|
}
|
|
182
169
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
170
|
/**
|
|
187
171
|
* 删除实际参数
|
|
188
172
|
* @param argument 已有的实际参数实例
|
|
@@ -190,7 +174,7 @@ export class CallInterface extends LogicItem {
|
|
|
190
174
|
removeArgument(argument: Argument): void;
|
|
191
175
|
|
|
192
176
|
removeArgument(options: Argument) {
|
|
193
|
-
|
|
177
|
+
const argument: Argument = options;
|
|
194
178
|
return argument.delete();
|
|
195
179
|
}
|
|
196
180
|
|
|
@@ -269,6 +253,7 @@ export class CallInterface extends LogicItem {
|
|
|
269
253
|
const _queries = _params.filter((item) => item.in === 'query').map((item) => item.name);
|
|
270
254
|
const _headers = _params.filter((item) => item.in === 'header').map((item) => item.name);
|
|
271
255
|
const _body = _params.filter((item) => item.in === 'body').map((item) => item.name);
|
|
256
|
+
const _paths = _params.filter((item) => item.in === 'path').map((item) => item.name);
|
|
272
257
|
|
|
273
258
|
let code = `await this.$services['_custom']['${this.calleeNamespace}.${this.calleeName}']`;
|
|
274
259
|
code += `({
|
|
@@ -283,6 +268,15 @@ export class CallInterface extends LogicItem {
|
|
|
283
268
|
if (index !== this.arguments.length - 1)
|
|
284
269
|
code += ', ';
|
|
285
270
|
});
|
|
271
|
+
code += `},
|
|
272
|
+
path: {`;
|
|
273
|
+
this.arguments
|
|
274
|
+
.filter((arg) => _paths.includes(arg.keyword))
|
|
275
|
+
.forEach((arg, index) => {
|
|
276
|
+
code += `\n'${arg.keyword}': ${arg.toJS(shiftState(state, code))}`;
|
|
277
|
+
if (index !== this.arguments.length - 1)
|
|
278
|
+
code += ', ';
|
|
279
|
+
});
|
|
286
280
|
code += `},
|
|
287
281
|
headers: {`;
|
|
288
282
|
this.arguments
|
|
@@ -294,38 +288,52 @@ export class CallInterface extends LogicItem {
|
|
|
294
288
|
});
|
|
295
289
|
code += `},
|
|
296
290
|
`;
|
|
297
|
-
code += `
|
|
291
|
+
code += `
|
|
298
292
|
body: {`;
|
|
299
293
|
this.arguments
|
|
300
294
|
.filter((arg) => _body.includes(arg.keyword))
|
|
301
295
|
.forEach((arg, index) => {
|
|
302
|
-
code +=
|
|
296
|
+
code += ` ...${arg.toJS(shiftState(state, code))}`;
|
|
303
297
|
if (index !== this.arguments.length - 1)
|
|
304
298
|
code += ', ';
|
|
305
299
|
});
|
|
306
|
-
code += '
|
|
300
|
+
code += '}';
|
|
307
301
|
code += '\n})';
|
|
308
302
|
return code;
|
|
309
303
|
}
|
|
310
304
|
|
|
311
305
|
@withSourceMap()
|
|
312
306
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
313
|
-
let code = this.
|
|
307
|
+
let code = this.tsCalleeKey;
|
|
314
308
|
const _keys = this.calleeDefaultKey.split('.');
|
|
315
309
|
const _module = this.app.interfaceDependencies.find((item) => item.name === _keys[1]);
|
|
316
310
|
let params: string[] = [];
|
|
317
311
|
const _interface = _module?.interfaces?.find((item) => item.name === _keys[3]);
|
|
318
312
|
if (_interface) {
|
|
319
313
|
params = _interface.params.filter((item) => item.required).map((item) => item.name) || [];
|
|
314
|
+
// const _bodyParams = _interface.params.find((item) => item.name === 'Body');
|
|
315
|
+
// if (_bodyParams) {
|
|
316
|
+
// const _typeKey = _bodyParams.typeAnnotation.typeKey;
|
|
317
|
+
// const _list = _typeKey.split('.');
|
|
318
|
+
// const _structure = _module.structures.find((item) => item.name === _list[3]);
|
|
319
|
+
// const isBodyRequired = _structure.properties.some((item) => item.required === true);
|
|
320
|
+
// if (isBodyRequired) {
|
|
321
|
+
// params.push('Body');
|
|
322
|
+
// }
|
|
323
|
+
// }
|
|
324
|
+
}
|
|
325
|
+
code += '(';
|
|
326
|
+
if (this.arguments.length) {
|
|
327
|
+
code += '{';
|
|
328
|
+
this.arguments.forEach((arg, index) => {
|
|
329
|
+
code += arg.toEmbeddedTS(shiftState(state, code), params.includes(arg.keyword), true);
|
|
330
|
+
if (index !== this.arguments.length - 1)
|
|
331
|
+
code += ', ';
|
|
332
|
+
});
|
|
333
|
+
code += '}';
|
|
320
334
|
}
|
|
321
|
-
code += '({';
|
|
322
|
-
this.arguments.forEach((arg, index) => {
|
|
323
|
-
code += arg.toEmbeddedTS(shiftState(state, code), params.includes(arg.keyword), true);
|
|
324
|
-
if (index !== this.arguments.length - 1)
|
|
325
|
-
code += ', ';
|
|
326
|
-
});
|
|
327
|
-
code += '});\n';
|
|
328
335
|
|
|
336
|
+
code += ');\n';
|
|
329
337
|
return code;
|
|
330
338
|
}
|
|
331
339
|
|
|
@@ -334,6 +342,96 @@ export class CallInterface extends LogicItem {
|
|
|
334
342
|
const calleeName = this.calleeName;
|
|
335
343
|
return calleeName ? `${tsCalleeNamespace}.${calleeName}` : '__IDENTIFIER__';
|
|
336
344
|
}
|
|
345
|
+
// 用于logic回填
|
|
346
|
+
get calleewholeKey(): string {
|
|
347
|
+
return this.calleeNamespace + '.' + this.calleeName;
|
|
348
|
+
}
|
|
349
|
+
get tsCalleeName(): string {
|
|
350
|
+
const excludeds = [
|
|
351
|
+
'abstract',
|
|
352
|
+
'arguments',
|
|
353
|
+
'await',
|
|
354
|
+
'boolean',
|
|
355
|
+
'break',
|
|
356
|
+
'byte',
|
|
357
|
+
'case',
|
|
358
|
+
'catch',
|
|
359
|
+
'char',
|
|
360
|
+
'class',
|
|
361
|
+
'const',
|
|
362
|
+
'continue',
|
|
363
|
+
'debugger',
|
|
364
|
+
'default',
|
|
365
|
+
'delete',
|
|
366
|
+
'do',
|
|
367
|
+
'double',
|
|
368
|
+
'else',
|
|
369
|
+
'enum',
|
|
370
|
+
'eval',
|
|
371
|
+
'export',
|
|
372
|
+
'extends',
|
|
373
|
+
'false',
|
|
374
|
+
'final',
|
|
375
|
+
'finally',
|
|
376
|
+
'float',
|
|
377
|
+
'for',
|
|
378
|
+
'function',
|
|
379
|
+
'goto',
|
|
380
|
+
'if',
|
|
381
|
+
'implements',
|
|
382
|
+
'import',
|
|
383
|
+
'in',
|
|
384
|
+
'instanceof',
|
|
385
|
+
'int',
|
|
386
|
+
'interface',
|
|
387
|
+
'let',
|
|
388
|
+
'long',
|
|
389
|
+
'native',
|
|
390
|
+
'new',
|
|
391
|
+
'null',
|
|
392
|
+
'package',
|
|
393
|
+
'private',
|
|
394
|
+
'protected',
|
|
395
|
+
'public',
|
|
396
|
+
'return',
|
|
397
|
+
'short',
|
|
398
|
+
'static',
|
|
399
|
+
'super',
|
|
400
|
+
'switch',
|
|
401
|
+
'synchronized',
|
|
402
|
+
'this',
|
|
403
|
+
'throw',
|
|
404
|
+
'throws',
|
|
405
|
+
'transient',
|
|
406
|
+
'true',
|
|
407
|
+
'try',
|
|
408
|
+
'typeof',
|
|
409
|
+
'var',
|
|
410
|
+
'void',
|
|
411
|
+
'volatile',
|
|
412
|
+
'while',
|
|
413
|
+
'with',
|
|
414
|
+
'yield,as',
|
|
415
|
+
'any',
|
|
416
|
+
'number',
|
|
417
|
+
'string',
|
|
418
|
+
'get',
|
|
419
|
+
'type',
|
|
420
|
+
'typeof',
|
|
421
|
+
'instanceof',
|
|
422
|
+
'require',
|
|
423
|
+
];
|
|
424
|
+
if (excludeds.includes(this.calleeName)) {
|
|
425
|
+
return '_' + this.calleeName;
|
|
426
|
+
}
|
|
427
|
+
return this.calleeName;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
get tsCalleeKey(): string {
|
|
431
|
+
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
432
|
+
const calleeName = this.tsCalleeName;
|
|
433
|
+
return calleeName ? `${tsCalleeNamespace}.${calleeName}` : '__IDENTIFIER__';
|
|
434
|
+
}
|
|
337
435
|
get calleeDefaultKey(): string {
|
|
338
436
|
return `${this.calleeNamespace}.${this.calleeName}`;
|
|
339
437
|
}
|
|
@@ -351,9 +449,30 @@ export class CallInterface extends LogicItem {
|
|
|
351
449
|
const calleeName = _interface.name;
|
|
352
450
|
const params = _interface.params.map((param) => {
|
|
353
451
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
354
|
-
|
|
452
|
+
let expression;
|
|
453
|
+
if (param.defaultValue && param.typeAnnotation.typeKind === 'primitive') {
|
|
454
|
+
const conceptMap: { [name: string]: string } = {
|
|
455
|
+
String: 'StringLiteral',
|
|
456
|
+
Boolean: 'BooleanLiteral',
|
|
457
|
+
Integer: 'NumericLiteral',
|
|
458
|
+
Double: 'NumericLiteral',
|
|
459
|
+
Long: 'NumericLiteral',
|
|
460
|
+
};
|
|
461
|
+
const typeName = param.typeAnnotation.typeName;
|
|
462
|
+
const concept: string = conceptMap[typeName] || 'StringLiteral';
|
|
463
|
+
const Ctor = getConceptConstructor(concept);
|
|
464
|
+
expression = new Ctor({
|
|
465
|
+
concept,
|
|
466
|
+
value: param.defaultValue,
|
|
467
|
+
typeAnnotation: param.typeAnnotation,
|
|
468
|
+
});
|
|
469
|
+
} else if (!param.required) {
|
|
470
|
+
expression = new NullLiteral();
|
|
471
|
+
}
|
|
472
|
+
const argument = new Argument({
|
|
355
473
|
keyword: param.name,
|
|
356
|
-
|
|
474
|
+
expression,
|
|
475
|
+
});
|
|
357
476
|
Object.assign(argument, relationOptions);
|
|
358
477
|
return argument;
|
|
359
478
|
});
|
|
@@ -369,7 +488,7 @@ export class CallInterface extends LogicItem {
|
|
|
369
488
|
//================================================================================
|
|
370
489
|
}
|
|
371
490
|
|
|
372
|
-
classMap
|
|
491
|
+
classMap.CallInterface = CallInterface;
|
|
373
492
|
export default CallInterface;
|
|
374
493
|
//================================================================================
|
|
375
494
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -2,6 +2,8 @@ import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
|
2
2
|
import Logic from './Logic__';
|
|
3
3
|
import Param from './Param__';
|
|
4
4
|
import { ElementToVueOptions } from './ViewElement__';
|
|
5
|
+
import { getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
6
|
+
|
|
5
7
|
//================================================================================
|
|
6
8
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
7
9
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -105,7 +107,7 @@ export class CallLogic extends LogicItem {
|
|
|
105
107
|
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
106
108
|
let typeAnnotation: TypeAnnotation;
|
|
107
109
|
if (options instanceof TypeAnnotation) {
|
|
108
|
-
options.
|
|
110
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
109
111
|
typeAnnotation = options;
|
|
110
112
|
Object.assign(typeAnnotation, relationOptions);
|
|
111
113
|
} else {
|
|
@@ -212,7 +214,7 @@ export class CallLogic extends LogicItem {
|
|
|
212
214
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
213
215
|
let argument: Argument;
|
|
214
216
|
if (options instanceof Argument) {
|
|
215
|
-
options.
|
|
217
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
216
218
|
argument = options;
|
|
217
219
|
Object.assign(argument, relationOptions);
|
|
218
220
|
} else {
|
|
@@ -382,11 +384,16 @@ export class CallLogic extends LogicItem {
|
|
|
382
384
|
}
|
|
383
385
|
return '';
|
|
384
386
|
}
|
|
387
|
+
|
|
388
|
+
// 用于logic回填
|
|
389
|
+
get calleewholeKey(): string {
|
|
390
|
+
return this.calleeNamespace + '.' + this.calleeName;
|
|
391
|
+
}
|
|
385
392
|
get calleeKey(): string {
|
|
386
393
|
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
387
394
|
const calleeName = this.calleeName;
|
|
388
395
|
if (!tsCalleeNamespace) {
|
|
389
|
-
return calleeName ?
|
|
396
|
+
return calleeName ? `${calleeName}` : '__IDENTIFIER__';
|
|
390
397
|
}
|
|
391
398
|
// elements单独处理相对路径,和后缀的问题
|
|
392
399
|
if (tsCalleeNamespace.startsWith('elements') && tsCalleeNamespace.endsWith('logics')) {
|
|
@@ -399,7 +406,7 @@ export class CallLogic extends LogicItem {
|
|
|
399
406
|
/**
|
|
400
407
|
* 设置argment 触发别的地方的更新
|
|
401
408
|
*/
|
|
402
|
-
setArgumentName({ argument }: { argument: Argument[]}) {
|
|
409
|
+
setArgumentName({ argument }: { argument: Argument[] }) {
|
|
403
410
|
// argument.setKeyword(newKeyword);
|
|
404
411
|
// this.arguments = argument;
|
|
405
412
|
}
|
|
@@ -521,7 +528,7 @@ export class CallLogic extends LogicItem {
|
|
|
521
528
|
|
|
522
529
|
toVue(options?: ElementToVueOptions): string {
|
|
523
530
|
let code = '';
|
|
524
|
-
if (this.calleeNamespace === 'nasl.browser') {
|
|
531
|
+
if (this.calleeNamespace === 'nasl.browser' || this.calleeNamespace === 'nasl.auth' || this.calleeNamespace === 'nasl.configuration') {
|
|
525
532
|
code += '$global.';
|
|
526
533
|
}
|
|
527
534
|
code += this.calleeName;
|
|
@@ -660,7 +667,7 @@ export class CallLogic extends LogicItem {
|
|
|
660
667
|
code += `JSON.parse`;
|
|
661
668
|
break;
|
|
662
669
|
}
|
|
663
|
-
} else if (calleeNamespace === 'nasl.browser') {
|
|
670
|
+
} else if (calleeNamespace === 'nasl.browser' || calleeNamespace === 'nasl.auth' || calleeNamespace === 'nasl.configuration') {
|
|
664
671
|
code += `this.$global.${this.calleeName}`;
|
|
665
672
|
} else {
|
|
666
673
|
code += `this.${this.calleeName}`;
|
|
@@ -681,20 +688,25 @@ export class CallLogic extends LogicItem {
|
|
|
681
688
|
@withSourceMap()
|
|
682
689
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
683
690
|
let code = this.calleeKey;
|
|
691
|
+
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
692
|
+
// 如果有内容
|
|
693
|
+
const typeAnnotation = this.typeArguments[0];
|
|
694
|
+
code += `<`;
|
|
695
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>`;
|
|
696
|
+
}
|
|
684
697
|
code += '(';
|
|
685
698
|
this.arguments.forEach((arg, index) => {
|
|
686
699
|
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
687
700
|
// 页面逻辑先都非必填
|
|
688
701
|
if (tsCalleeNamespace.startsWith('elements') && tsCalleeNamespace.endsWith('logics')) {
|
|
689
|
-
code += arg.toEmbeddedTS(shiftState(state, code));
|
|
702
|
+
code += arg.toEmbeddedTS(shiftState(state, code), false);
|
|
690
703
|
} else {
|
|
691
|
-
code += arg.toEmbeddedTS(shiftState(state, code)
|
|
704
|
+
code += arg.toEmbeddedTS(shiftState(state, code));
|
|
692
705
|
}
|
|
693
706
|
if (index !== this.arguments.length - 1)
|
|
694
707
|
code += ', ';
|
|
695
708
|
});
|
|
696
709
|
code += ');\n';
|
|
697
|
-
|
|
698
710
|
return code;
|
|
699
711
|
}
|
|
700
712
|
|
|
@@ -82,6 +82,12 @@ export class CallQueryComponent extends LogicItem {
|
|
|
82
82
|
@property('QueryLimitExpression')
|
|
83
83
|
limit: QueryLimitExpression = undefined;
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* 查询组件的局部版本
|
|
87
|
+
*/
|
|
88
|
+
@property()
|
|
89
|
+
ideVersion: string = undefined;
|
|
90
|
+
|
|
85
91
|
|
|
86
92
|
|
|
87
93
|
/**
|
|
@@ -241,7 +247,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
241
247
|
name: options,
|
|
242
248
|
}, this, 'groupBy');
|
|
243
249
|
} else if (options instanceof QueryGroupByExpression) {
|
|
244
|
-
options.
|
|
250
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
245
251
|
queryGroupByExpression = options;
|
|
246
252
|
Object.assign(queryGroupByExpression, relationOptions);
|
|
247
253
|
} else {
|
|
@@ -359,7 +365,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
359
365
|
const relationOptions = { parentNode: this, parentKey: 'orderBy' };
|
|
360
366
|
let queryOrderByExpression: QueryOrderByExpression;
|
|
361
367
|
if (options instanceof QueryOrderByExpression) {
|
|
362
|
-
options.
|
|
368
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
363
369
|
queryOrderByExpression = options;
|
|
364
370
|
Object.assign(queryOrderByExpression, relationOptions);
|
|
365
371
|
} else {
|
|
@@ -784,7 +790,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
784
790
|
code += indent(state.tabSize + 1);
|
|
785
791
|
const { asName, aggregateName, aggregateParam } = item;
|
|
786
792
|
if (asName)
|
|
787
|
-
code += `const ${asName} = `;
|
|
793
|
+
code += `const __${asName} = `;
|
|
788
794
|
if (aggregateName) {
|
|
789
795
|
code += `nasl.langUtil.${aggregateName}(`;
|
|
790
796
|
code += aggregateParam.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
@@ -901,13 +907,14 @@ export class CallQueryComponent extends LogicItem {
|
|
|
901
907
|
return Structure.from({
|
|
902
908
|
concept: 'Structure',
|
|
903
909
|
name: structureName,
|
|
910
|
+
origin: 'CallQueryComponent',
|
|
904
911
|
properties: [...genPropertyListOfFrom(this.from), ...genPropertyListOfAggregate(this)],
|
|
905
912
|
});
|
|
906
913
|
}
|
|
907
914
|
|
|
908
915
|
saveStructure() {
|
|
909
916
|
const source = this.genStructure();
|
|
910
|
-
console.log(source);
|
|
917
|
+
// console.log(source);
|
|
911
918
|
if (this.typeAnnotation) {
|
|
912
919
|
const structure = this.app.structures.find((item) => item.name === this.typeAnnotation.typeName);
|
|
913
920
|
if (structure) {
|
|
@@ -938,11 +945,6 @@ export class CallQueryComponent extends LogicItem {
|
|
|
938
945
|
} catch {}
|
|
939
946
|
}
|
|
940
947
|
|
|
941
|
-
delete() {
|
|
942
|
-
this.removeStructure();
|
|
943
|
-
super.delete();
|
|
944
|
-
}
|
|
945
|
-
|
|
946
948
|
getEntityNames(node: QueryFromExpression | QueryJoinExpression, set = new Set()) {
|
|
947
949
|
if (node?.entityName)
|
|
948
950
|
set.add(node.entityName);
|
|
@@ -999,20 +1001,20 @@ export class CallQueryComponent extends LogicItem {
|
|
|
999
1001
|
new CompletionProperty({
|
|
1000
1002
|
concept: 'CompletionProperty',
|
|
1001
1003
|
name: item.asName,
|
|
1002
|
-
value: item.asName
|
|
1004
|
+
value: `inner.${item.asName}`,
|
|
1003
1005
|
expression: LogicItem.from({
|
|
1004
1006
|
concept: 'Identifier',
|
|
1005
1007
|
name: item.asName,
|
|
1006
|
-
|
|
1008
|
+
namespace: 'inner',
|
|
1007
1009
|
}),
|
|
1008
1010
|
}));
|
|
1009
1011
|
if (!children || children.length === 0)
|
|
1010
1012
|
return;
|
|
1011
|
-
|
|
1013
|
+
|
|
1012
1014
|
children.forEach((item) => {
|
|
1013
1015
|
item.icon = 'variable';
|
|
1014
1016
|
});
|
|
1015
|
-
return { name: '聚合属性别名', icon:
|
|
1017
|
+
return { name: '聚合属性别名', icon: 'category', children, expanded: true };
|
|
1016
1018
|
}
|
|
1017
1019
|
|
|
1018
1020
|
//================================================================================
|
|
@@ -67,7 +67,7 @@ export class Comment extends LogicItem {
|
|
|
67
67
|
//================================================================================
|
|
68
68
|
|
|
69
69
|
toJS(state?: TranslatorState): string {
|
|
70
|
-
return
|
|
70
|
+
return `/* ${this.value} */`;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
public static getDefaultOptions() {
|
|
@@ -79,7 +79,11 @@ export class Comment extends LogicItem {
|
|
|
79
79
|
@withSourceMap()
|
|
80
80
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
81
81
|
let code = '';
|
|
82
|
-
code += `\n${indent(state.tabSize)}
|
|
82
|
+
code += `\n${indent(state.tabSize)}
|
|
83
|
+
/**
|
|
84
|
+
* 注释不用翻译
|
|
85
|
+
*/
|
|
86
|
+
\n`;
|
|
83
87
|
return code;
|
|
84
88
|
}
|
|
85
89
|
//================================================================================
|
|
@@ -123,7 +123,7 @@ export class ConfigGroup extends BaseNode {
|
|
|
123
123
|
name: options,
|
|
124
124
|
}, this, 'properties');
|
|
125
125
|
} else if (options instanceof ConfigProperty) {
|
|
126
|
-
options.
|
|
126
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
127
127
|
configProperty = options;
|
|
128
128
|
Object.assign(configProperty, relationOptions);
|
|
129
129
|
} else {
|
|
@@ -129,7 +129,7 @@ export class ConfigProperty extends BaseNode {
|
|
|
129
129
|
name: options,
|
|
130
130
|
}, this, 'values');
|
|
131
131
|
} else if (options instanceof ConfigPropertyValue) {
|
|
132
|
-
options.
|
|
132
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
133
133
|
configPropertyValue = options;
|
|
134
134
|
Object.assign(configPropertyValue, relationOptions);
|
|
135
135
|
} else {
|
|
@@ -107,7 +107,7 @@ export class Configuration extends BaseNode {
|
|
|
107
107
|
name: options,
|
|
108
108
|
}, this, 'groups');
|
|
109
109
|
} else if (options instanceof ConfigGroup) {
|
|
110
|
-
options.
|
|
110
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
111
111
|
configGroup = options;
|
|
112
112
|
Object.assign(configGroup, relationOptions);
|
|
113
113
|
} else {
|