@lcap/nasl 2.20.0-beta.2 → 2.20.0-beta.4
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 +2 -3
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +1 -1
- package/out/automate/engine/uniqueName.js +2 -2
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.js +4 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/myProcess.d.ts +1 -1
- package/out/automate/template/myProcess.js +2 -2
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +14 -22
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.js +4 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +5 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/App__.d.ts +4 -0
- package/out/concepts/App__.js +30 -6
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js +4 -3
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +3 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +7 -0
- package/out/concepts/BindAttribute__.js +270 -39
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +7 -0
- package/out/concepts/BindDirective__.js +215 -17
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +7 -0
- package/out/concepts/BindStyle__.js +194 -4
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallFunction__.js +22 -8
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +3 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +3 -0
- package/out/concepts/CallLogic__.js +78 -89
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +20 -3
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +13 -0
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +19 -0
- package/out/concepts/ConfigProperty__.js +61 -0
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +13 -0
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +1 -0
- package/out/concepts/Destination__.js +61 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +9 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +5 -5
- package/out/concepts/EnumItem__.js +6 -6
- package/out/concepts/Enum__.d.ts +20 -19
- package/out/concepts/Enum__.js +28 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +1 -0
- package/out/concepts/ExternalDestination__.js +21 -3
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +2 -0
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Identifier__.js +16 -5
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +9 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/JSBlock__.js +5 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +79 -79
- package/out/concepts/Logic__.js +16 -3
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.d.ts +0 -3
- package/out/concepts/Match__.js +11 -66
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +9 -0
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +16 -0
- package/out/concepts/Module__.js +43 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +2 -4
- package/out/concepts/NewComposite__.js +91 -126
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +1 -0
- package/out/concepts/NewList__.js +22 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +1 -0
- package/out/concepts/NewMap__.js +43 -11
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +40 -12
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +10 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +2 -1
- 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/ProcessOutcomes__.js +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +1 -0
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/Return__.js +10 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +14 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +6 -6
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +9 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +6 -3
- package/out/concepts/TypeAnnotation__.js +67 -13
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +53 -0
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +9 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +17 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -3
- package/out/concepts/View__.js +22 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +6 -1
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.core.js +34 -0
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +4 -2
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +3 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -1
- package/out/concepts/index__.js +0 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +8 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +24 -5
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +2 -3
- package/out/generator/genReleaseBody.js +97 -23
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.d.ts +2 -10
- package/out/generator/permission.js +27 -14
- package/out/generator/permission.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +2 -20
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +16 -5
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +2 -1
- package/out/server/formatTsUtils.js +40 -10
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -2
- package/out/server/getLogics.js +3 -3
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +27 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +7 -1
- package/out/server/naslServer.js +519 -46
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +109 -33
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +1 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +1 -3
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +2 -2
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -1
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +2 -2
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/utils/traverse.js +8 -2
- package/out/utils/traverse.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/sandbox/stdlib/nasl.collection.ts +1 -0
- package/sandbox/stdlib/nasl.core.ts +34 -0
- package/sandbox/stdlib/nasl.oql.ts +71 -15
- package/sandbox/stdlib/nasl.util.ts +9 -3
- package/src/automate/engine/dist/index.dev.js +517 -0
- package/src/automate/engine/index.js +2 -3
- package/src/automate/engine/uniqueName.js +2 -2
- package/src/automate/engine/utils.js +4 -2
- package/src/automate/template/myProcess.js +2 -2
- package/src/bak/translator.js +16 -25
- package/src/common/BaseNode.ts +3 -1
- package/src/common/Command.ts +4 -0
- package/src/common/dist/BaseNode.js +1101 -0
- package/src/concepts/App__.ts +36 -7
- package/src/concepts/Assignee__.ts +4 -3
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/BindAttribute__.ts +299 -38
- package/src/concepts/BindDirective__.ts +204 -31
- package/src/concepts/BindStyle__.ts +187 -24
- package/src/concepts/CallFunction__.ts +55 -10
- package/src/concepts/CallInterface__.ts +3 -2
- package/src/concepts/CallLogic__.ts +110 -90
- package/src/concepts/CallQueryComponent__.ts +18 -3
- package/src/concepts/ConfigGroup__.ts +17 -4
- package/src/concepts/ConfigProperty__.ts +70 -4
- package/src/concepts/Configuration__.ts +14 -5
- package/src/concepts/DataSource__.ts +4 -1
- package/src/concepts/Destination__.ts +61 -7
- package/src/concepts/EntityProperty__.ts +7 -1
- package/src/concepts/EnumItem__.ts +6 -6
- package/src/concepts/Enum__.ts +22 -19
- package/src/concepts/ExternalDestination__.ts +28 -8
- package/src/concepts/ForEachStatement__.ts +2 -0
- package/src/concepts/Frontend__.ts +2 -1
- package/src/concepts/Identifier__.ts +16 -5
- package/src/concepts/InterfaceParam__.ts +7 -1
- package/src/concepts/JSBlock__.ts +3 -2
- package/src/concepts/Logic__.ts +95 -83
- package/src/concepts/Match__.ts +31 -67
- package/src/concepts/MemberExpression__.ts +6 -0
- package/src/concepts/Module__.ts +57 -0
- package/src/concepts/NewComposite__.ts +95 -140
- package/src/concepts/NewList__.ts +23 -2
- package/src/concepts/NewMap__.ts +48 -24
- package/src/concepts/OqlQueryComponent__.ts +40 -20
- package/src/concepts/Param__.ts +178 -176
- package/src/concepts/ProcessElement__.ts +2 -1
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/ProcessOutcomes__.ts +1 -1
- package/src/concepts/Process__.ts +1 -0
- package/src/concepts/Return__.ts +8 -2
- package/src/concepts/StringInterpolation__.ts +19 -7
- package/src/concepts/StringLiteral__.ts +7 -6
- package/src/concepts/StructureProperty__.ts +7 -1
- package/src/concepts/TypeAnnotation__.ts +101 -14
- package/src/concepts/ValidationRule__.ts +58 -9
- package/src/concepts/Variable__.ts +11 -1
- package/src/concepts/ViewElement__.ts +39 -2
- package/src/concepts/View__.ts +26 -14
- package/src/concepts/basics/stdlib/dist/nasl.util.js +1602 -0
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
- package/src/concepts/basics/stdlib/nasl.collection.ts +6 -1
- package/src/concepts/basics/stdlib/nasl.configuration.ts +3 -0
- package/src/concepts/basics/stdlib/nasl.core.ts +33 -2
- package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/concepts/dist/BindAttribute__.js +795 -0
- package/src/concepts/dist/BindEvent__.js +732 -0
- package/src/concepts/dist/CallFunction__.js +527 -0
- package/src/concepts/dist/CallLogic__.js +932 -0
- package/src/concepts/dist/Destination__.js +708 -0
- package/src/concepts/dist/ExternalDestination__.js +298 -0
- package/src/concepts/dist/Identifier__.js +311 -0
- package/src/concepts/dist/StringInterpolation__.js +231 -0
- package/src/concepts/dist/TypeAnnotation__.js +834 -0
- package/src/concepts/dist/ViewElement__.js +1692 -0
- package/src/concepts/dist/View__.js +1601 -0
- package/src/concepts/index__.ts +0 -1
- package/src/enums/KEYWORDS.ts +8 -0
- package/src/generator/dist/genBundleFiles.js +261 -0
- package/src/generator/dist/genMetaData.js +245 -0
- package/src/generator/dist/permission.js +405 -0
- package/src/generator/genBundleFiles.ts +24 -5
- package/src/generator/genReleaseBody.ts +75 -30
- package/src/generator/permission.ts +31 -15
- package/src/server/entity2LogicNamespace.ts +2 -20
- package/src/server/extendBaseNode.ts +15 -5
- package/src/server/formatTsUtils.ts +41 -10
- package/src/server/getLogics.ts +4 -4
- package/src/server/getMemberIdentifier.ts +27 -1
- package/src/server/index.ts +2 -0
- package/src/server/naslServer.ts +520 -48
- package/src/server/translator.ts +96 -34
- package/src/service/storage/dist/init.js +579 -0
- package/src/service/storage/init.ts +22 -2
- package/src/templator/dist/genEditTableBlock.js +204 -0
- package/src/templator/dist/genGridViewBlock.js +265 -0
- package/src/templator/dist/genListViewBlock.js +84 -0
- package/src/templator/dist/genTableBlock.js +209 -0
- package/src/templator/dist/utils.js +527 -0
- package/src/templator/genCreateBlock.ts +1 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -4
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +3 -4
- package/src/templator/genListViewBlock.ts +9 -3
- package/src/templator/genSelectBlock.ts +1 -1
- package/src/templator/genTableBlock.ts +3 -3
- package/src/templator/genUpdateBlock.ts +2 -3
- package/src/utils/traverse.ts +10 -2
- package/ts-worker/lib/tsserver.js +10 -2
- package/ts-worker/package.json +1 -0
- package/ts-worker/webpack.config.js +11 -2
- package/out/concepts/ConstructArgument__.d.ts +0 -40
- package/out/concepts/ConstructArgument__.js +0 -108
- package/out/concepts/ConstructArgument__.js.map +0 -1
- package/out/concepts/Construct__.d.ts +0 -189
- package/out/concepts/Construct__.js +0 -340
- package/out/concepts/Construct__.js.map +0 -1
- package/out/templator/sql-parser/index.d.ts +0 -1
- package/out/templator/sql-parser/index.js +0 -228
- package/out/templator/sql-parser/index.js.map +0 -1
- package/out/templator/sql-parser/parser.js +0 -26664
- package/out/templator/sql-parser/parser.js.map +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { TranslatorState, withSourceMap, createCompilerState, indent } from '../translator';
|
|
2
|
+
import ConfigGroup from './ConfigGroup__';
|
|
3
|
+
import Namespace from './Namespace__';
|
|
4
|
+
|
|
1
5
|
//================================================================================
|
|
2
6
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
3
7
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -11,6 +15,7 @@ import BaseNode from '../common/BaseNode';
|
|
|
11
15
|
import classMap from '../common/classMap';
|
|
12
16
|
import ConfigPropertyValue from './ConfigPropertyValue__';
|
|
13
17
|
import App from './App__';
|
|
18
|
+
import Module from './Module__';
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* 配置属性
|
|
@@ -47,6 +52,12 @@ export class ConfigProperty extends BaseNode {
|
|
|
47
52
|
get app() {
|
|
48
53
|
return this.getAncestor('App') as App;
|
|
49
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* 祖先 Module
|
|
57
|
+
*/
|
|
58
|
+
get module() {
|
|
59
|
+
return this.getAncestor('Module') as Module;
|
|
60
|
+
}
|
|
50
61
|
|
|
51
62
|
/**
|
|
52
63
|
* @param source 需要合并的部分参数
|
|
@@ -85,7 +96,7 @@ export class ConfigProperty extends BaseNode {
|
|
|
85
96
|
});
|
|
86
97
|
}
|
|
87
98
|
|
|
88
|
-
|
|
99
|
+
getConfigPropertyValueExistingNames(excludedList: Array<ConfigPropertyValue> = []) {
|
|
89
100
|
const excludedSet = new Set(excludedList);
|
|
90
101
|
return ((this.values as ConfigPropertyValue[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
91
102
|
}
|
|
@@ -226,9 +237,6 @@ export class ConfigProperty extends BaseNode {
|
|
|
226
237
|
return node;
|
|
227
238
|
}
|
|
228
239
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
240
|
/**
|
|
233
241
|
* 删除配置属性值
|
|
234
242
|
* @param name 配置属性值名称
|
|
@@ -296,6 +304,64 @@ export class ConfigProperty extends BaseNode {
|
|
|
296
304
|
getPropertyEnv(env = '') {
|
|
297
305
|
return this.values.find((item) => item.env === env);
|
|
298
306
|
}
|
|
307
|
+
|
|
308
|
+
getNamespace() {
|
|
309
|
+
if (this.parentNode && (this.parentNode as ConfigGroup).getNamespace) {
|
|
310
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
311
|
+
const parentName = this.parentNode.name;
|
|
312
|
+
const arr = [parentNamespace];
|
|
313
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
314
|
+
arr.push(parentName);
|
|
315
|
+
}
|
|
316
|
+
return `${arr.join('.')}.properties`;
|
|
317
|
+
} else
|
|
318
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* 生成宿主语言的文件路径
|
|
323
|
+
* @param name 一般不用传,用于 rename
|
|
324
|
+
*/
|
|
325
|
+
getEmbeddedFilePath(name = this.name) {
|
|
326
|
+
const _path = this.module ? `/${this.module.parentKey}/${this.module.name}` : '';
|
|
327
|
+
return `/embedded/${this.app.name}${_path}/configuration/custom/${name}.ts`;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
@withSourceMap()
|
|
331
|
+
toEmbeddedTS(state?: TranslatorState): string {
|
|
332
|
+
let code = `let ${this.name}: nasl.core.String; \n`;
|
|
333
|
+
this.values.forEach((value) => {
|
|
334
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
335
|
+
if (!value.value) {
|
|
336
|
+
code += `const __${value.env}ConfigValueEmpty: any = null;\n`;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
return code;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
toEmbeddedTSFile() {
|
|
343
|
+
let code = `namespace ${this.getNamespace()} {\n export `;
|
|
344
|
+
|
|
345
|
+
const state = createCompilerState(code, { tabSize: 0 });
|
|
346
|
+
try {
|
|
347
|
+
code += this.toEmbeddedTS(state);
|
|
348
|
+
} catch (err) {
|
|
349
|
+
code += '';
|
|
350
|
+
console.log(err);
|
|
351
|
+
}
|
|
352
|
+
code += '}\n';
|
|
353
|
+
|
|
354
|
+
return {
|
|
355
|
+
code,
|
|
356
|
+
filePath: this.getEmbeddedFilePath(),
|
|
357
|
+
sourceMap: state.sourceMap,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
get calleewholeKey() {
|
|
362
|
+
return this.getNamespace() + '.' + this.name;
|
|
363
|
+
}
|
|
364
|
+
|
|
299
365
|
//================================================================================
|
|
300
366
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
301
367
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -61,9 +61,8 @@ export class Configuration extends BaseNode {
|
|
|
61
61
|
}
|
|
62
62
|
return params;
|
|
63
63
|
}
|
|
64
|
-
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
getConfigGroupExistingNames(excludedList: Array<ConfigGroup> = []) {
|
|
67
66
|
const excludedSet = new Set(excludedList);
|
|
68
67
|
return ((this.groups as ConfigGroup[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
69
68
|
}
|
|
@@ -204,9 +203,6 @@ export class Configuration extends BaseNode {
|
|
|
204
203
|
return node;
|
|
205
204
|
}
|
|
206
205
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
206
|
/**
|
|
211
207
|
* 删除配置组
|
|
212
208
|
* @param name 配置组名称
|
|
@@ -275,6 +271,19 @@ export class Configuration extends BaseNode {
|
|
|
275
271
|
return this.groups.find((item) => item.name === name);
|
|
276
272
|
}
|
|
277
273
|
|
|
274
|
+
getNamespace() {
|
|
275
|
+
if (this.parentNode && (this.parentNode as App).getNamespace) {
|
|
276
|
+
const parentNamespace = (this.parentNode as App).getNamespace();
|
|
277
|
+
const parentName = this.parentNode.name;
|
|
278
|
+
const arr = [parentNamespace];
|
|
279
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
280
|
+
arr.push(parentName);
|
|
281
|
+
}
|
|
282
|
+
return `${arr.join('.')}.configuration`;
|
|
283
|
+
} else
|
|
284
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
285
|
+
}
|
|
286
|
+
|
|
278
287
|
//================================================================================
|
|
279
288
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
280
289
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -94,7 +94,7 @@ export class DataSource extends BaseNode {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
getEntityExistingNames(excludedList: Array<Entity> = []) {
|
|
98
98
|
const excludedSet = new Set(excludedList);
|
|
99
99
|
return ((this.entities as Entity[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
100
100
|
}
|
|
@@ -235,6 +235,9 @@ export class DataSource extends BaseNode {
|
|
|
235
235
|
return node;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
238
241
|
/**
|
|
239
242
|
* 删除实体
|
|
240
243
|
* @param name 实体名称
|
|
@@ -326,12 +326,65 @@ export class Destination extends LogicItem {
|
|
|
326
326
|
return viewArr;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
toInViewMethod() {
|
|
330
|
+
let code = '';
|
|
331
|
+
const viewArr = this.genViewArr();
|
|
332
|
+
if (Array.isArray(viewArr) && viewArr.length) {
|
|
333
|
+
code += `let url = '${this.viewNode.frontend.basePath ? this.viewNode.frontend.basePath : ''}/${viewArr.join('/')}';\n`;
|
|
334
|
+
const completeArguments = this.completeArguments;
|
|
335
|
+
if (Array.isArray(completeArguments) && completeArguments.length) {
|
|
336
|
+
const node = this.viewNode;
|
|
337
|
+
let logicParam: Param[] = [];
|
|
338
|
+
if (node) {
|
|
339
|
+
logicParam = node.params;
|
|
340
|
+
}
|
|
341
|
+
const logicParamLen = logicParam.length;
|
|
342
|
+
const paramAssigns: string[] = [];
|
|
343
|
+
const args: string[] = [];
|
|
344
|
+
completeArguments.forEach((arg, index) => {
|
|
345
|
+
const value = arg?.toJS();
|
|
346
|
+
if (value && index < logicParamLen) {
|
|
347
|
+
let paramAssign = `const ${arg.keyword} = `;
|
|
348
|
+
if (value === 'undefined') {
|
|
349
|
+
paramAssign += `null`;
|
|
350
|
+
} else {
|
|
351
|
+
paramAssign += value;
|
|
352
|
+
}
|
|
353
|
+
paramAssign += '\n;';
|
|
354
|
+
paramAssigns.push(paramAssign);
|
|
355
|
+
const constStr = '${' + arg.keyword + '}';
|
|
356
|
+
args.push(`${arg.keyword}=${constStr}`);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
code += `${paramAssigns.join(';\n')}\n`;
|
|
360
|
+
code += 'const params = `';
|
|
361
|
+
code += args.join('&');
|
|
362
|
+
code += '`;\n';
|
|
363
|
+
code += 'if (params) {\nurl += `?${params}`;\n}\n';
|
|
364
|
+
}
|
|
365
|
+
if (this.anchor) {
|
|
366
|
+
const anchorCode = this.anchor.toJS();
|
|
367
|
+
if (anchorCode) {
|
|
368
|
+
code += `const anchor = ${anchorCode};\n`;
|
|
369
|
+
code += 'if (anchor) {\nurl += `#${anchor}`;\n}\n';
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
code += 'return url;';
|
|
373
|
+
}
|
|
374
|
+
return `await (async () => {
|
|
375
|
+
try {
|
|
376
|
+
${code};
|
|
377
|
+
} catch(err) {
|
|
378
|
+
console.log(err);
|
|
379
|
+
}
|
|
380
|
+
})();`;
|
|
381
|
+
}
|
|
382
|
+
|
|
329
383
|
toVue(options?: ElementToVueOptions) {
|
|
330
|
-
let url = '';
|
|
384
|
+
let url = '`';
|
|
331
385
|
const viewArr = this.genViewArr();
|
|
332
386
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
333
|
-
url +=
|
|
334
|
-
url += `/${viewArr.join('/')}`;
|
|
387
|
+
url += `${this.viewNode?.frontend?.basePath ? this.viewNode.frontend.basePath : ''}/${viewArr.join('/')}`;
|
|
335
388
|
const completeArguments = this.completeArguments;
|
|
336
389
|
if (completeArguments.length) {
|
|
337
390
|
const node = this.viewNode;
|
|
@@ -361,8 +414,8 @@ export class Destination extends LogicItem {
|
|
|
361
414
|
if (anchor)
|
|
362
415
|
url += `#\${${anchor}}`;
|
|
363
416
|
}
|
|
364
|
-
url += '`"';
|
|
365
417
|
}
|
|
418
|
+
url += '`';
|
|
366
419
|
return url;
|
|
367
420
|
}
|
|
368
421
|
|
|
@@ -371,7 +424,7 @@ export class Destination extends LogicItem {
|
|
|
371
424
|
const viewArr = this.genViewArr();
|
|
372
425
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
373
426
|
url += '`';
|
|
374
|
-
url +=
|
|
427
|
+
url += `${this.viewNode?.frontend?.basePath ? this.viewNode.frontend.basePath : ''}/${viewArr.join('/')}`;
|
|
375
428
|
const completeArguments = this.completeArguments;
|
|
376
429
|
if (completeArguments.length) {
|
|
377
430
|
const node = this.viewNode;
|
|
@@ -411,7 +464,7 @@ export class Destination extends LogicItem {
|
|
|
411
464
|
const viewArr = this.genViewArr();
|
|
412
465
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
413
466
|
url += 'this.$destination(`';
|
|
414
|
-
url +=
|
|
467
|
+
url += `${this.viewNode?.frontend?.basePath ? this.viewNode.frontend.basePath : ''}/${viewArr.join('/')}`;
|
|
415
468
|
const completeArguments = this.completeArguments;
|
|
416
469
|
|
|
417
470
|
if (completeArguments.length) {
|
|
@@ -570,7 +623,8 @@ export class Destination extends LogicItem {
|
|
|
570
623
|
toEmbeddedTSInProcess(state: TranslatorState, prependCode: string): string {
|
|
571
624
|
// const tab = indent((state?.tabSize || 0));
|
|
572
625
|
if (this.tsCalleeNamespace && this.tsName) {
|
|
573
|
-
|
|
626
|
+
const destinationName = this.parentNode.name.replace('-', '_');
|
|
627
|
+
let code = `${destinationName}: function() {\n`;
|
|
574
628
|
code += prependCode;
|
|
575
629
|
code += '\n';
|
|
576
630
|
if (this.tsCalleeNamespace && this.viewName) {
|
|
@@ -370,11 +370,13 @@ export class EntityProperty extends BaseNode {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
get hasChildren() {
|
|
373
|
-
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
373
|
+
const { typeKind, typeName, typeNamespace } = this.typeAnnotation;
|
|
374
374
|
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
375
375
|
if (typeNamespace.endsWith('.enums'))
|
|
376
376
|
return null;
|
|
377
377
|
return [{}];
|
|
378
|
+
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
379
|
+
return [{}];
|
|
378
380
|
}
|
|
379
381
|
return null;
|
|
380
382
|
}
|
|
@@ -417,6 +419,10 @@ export class EntityProperty extends BaseNode {
|
|
|
417
419
|
}
|
|
418
420
|
}
|
|
419
421
|
completionChildren = properties;
|
|
422
|
+
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
423
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
424
|
+
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
425
|
+
completionChildren = properties;
|
|
420
426
|
} else {
|
|
421
427
|
completionChildren = [];
|
|
422
428
|
}
|
|
@@ -15,9 +15,9 @@ import Module from './Module__';
|
|
|
15
15
|
import App from './App__';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* 枚举值
|
|
19
19
|
*/
|
|
20
|
-
@concept('
|
|
20
|
+
@concept('枚举值')
|
|
21
21
|
export class EnumItem extends BaseNode {
|
|
22
22
|
/**
|
|
23
23
|
* 产品概念
|
|
@@ -26,13 +26,13 @@ export class EnumItem extends BaseNode {
|
|
|
26
26
|
concept: 'EnumItem' = 'EnumItem';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 枚举值的值
|
|
30
30
|
*/
|
|
31
31
|
@property()
|
|
32
32
|
value: string = undefined;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* 枚举值标题
|
|
36
36
|
*/
|
|
37
37
|
@property()
|
|
38
38
|
label: string = undefined;
|
|
@@ -81,7 +81,7 @@ export class EnumItem extends BaseNode {
|
|
|
81
81
|
return params;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* 设置枚举值的值
|
|
85
85
|
*/
|
|
86
86
|
setValue(value: string) {
|
|
87
87
|
const object = {
|
|
@@ -93,7 +93,7 @@ export class EnumItem extends BaseNode {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* 设置枚举值标题
|
|
97
97
|
*/
|
|
98
98
|
setLabel(label: string) {
|
|
99
99
|
const object = {
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -46,7 +46,7 @@ export class Enum extends BaseNode {
|
|
|
46
46
|
description: string = undefined;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* 枚举值列表
|
|
50
50
|
*/
|
|
51
51
|
@property('EnumItem')
|
|
52
52
|
enumItems: Array<EnumItem> = [];
|
|
@@ -130,16 +130,16 @@ export class Enum extends BaseNode {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
133
|
+
* 插入枚举值
|
|
134
134
|
* @internal
|
|
135
|
-
* @param enumItemOptions
|
|
135
|
+
* @param enumItemOptions 枚举值参数
|
|
136
136
|
*/
|
|
137
137
|
_insertEnumItemAt(enumItemOptions: Partial<EnumItem>, index: number): EnumItem;
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* 插入枚举值
|
|
141
141
|
* @internal
|
|
142
|
-
* @param enumItem
|
|
142
|
+
* @param enumItem 已有的枚举值实例
|
|
143
143
|
*/
|
|
144
144
|
_insertEnumItemAt(enumItem: EnumItem, index: number): EnumItem;
|
|
145
145
|
|
|
@@ -164,14 +164,14 @@ export class Enum extends BaseNode {
|
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param enumItemOptions
|
|
167
|
+
* 插入枚举值
|
|
168
|
+
* @param enumItemOptions 枚举值参数
|
|
169
169
|
*/
|
|
170
170
|
insertEnumItemAt(enumItemOptions: Partial<EnumItem>, index: number): EnumItem;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @param enumItem
|
|
173
|
+
* 插入枚举值
|
|
174
|
+
* @param enumItem 已有的枚举值实例
|
|
175
175
|
*/
|
|
176
176
|
insertEnumItemAt(enumItem: EnumItem, index: number): EnumItem;
|
|
177
177
|
|
|
@@ -188,16 +188,16 @@ export class Enum extends BaseNode {
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
191
|
+
* 添加枚举值
|
|
192
192
|
* @internal
|
|
193
|
-
* @param enumItemOptions
|
|
193
|
+
* @param enumItemOptions 枚举值参数
|
|
194
194
|
*/
|
|
195
195
|
_addEnumItem(enumItemOptions: Partial<EnumItem>): EnumItem;
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
*
|
|
198
|
+
* 添加枚举值
|
|
199
199
|
* @internal
|
|
200
|
-
* @param enumItem
|
|
200
|
+
* @param enumItem 已有的枚举值实例
|
|
201
201
|
*/
|
|
202
202
|
_addEnumItem(enumItem: EnumItem): EnumItem;
|
|
203
203
|
|
|
@@ -209,14 +209,14 @@ export class Enum extends BaseNode {
|
|
|
209
209
|
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @param enumItemOptions
|
|
212
|
+
* 添加枚举值
|
|
213
|
+
* @param enumItemOptions 枚举值参数
|
|
214
214
|
*/
|
|
215
215
|
addEnumItem(enumItemOptions: Partial<EnumItem>): EnumItem;
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
*
|
|
219
|
-
* @param enumItem
|
|
218
|
+
* 添加枚举值
|
|
219
|
+
* @param enumItem 已有的枚举值实例
|
|
220
220
|
*/
|
|
221
221
|
addEnumItem(enumItem: EnumItem): EnumItem;
|
|
222
222
|
|
|
@@ -235,8 +235,8 @@ export class Enum extends BaseNode {
|
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
|
-
*
|
|
239
|
-
* @param enumItem
|
|
238
|
+
* 删除枚举值
|
|
239
|
+
* @param enumItem 已有的枚举值实例
|
|
240
240
|
*/
|
|
241
241
|
removeEnumItem(enumItem: EnumItem): void;
|
|
242
242
|
|
|
@@ -290,6 +290,9 @@ export class Enum extends BaseNode {
|
|
|
290
290
|
const excludedSet = new Set(excludedList);
|
|
291
291
|
return (this.enumItems || []).filter((item) => !excludedSet.has(item)).map((item) => item.value);
|
|
292
292
|
}
|
|
293
|
+
getEnumItemUniqueName(name = 'VALUE1') {
|
|
294
|
+
return utils.unique(name, this.getEnumItemExistingNames(), undefined, false);
|
|
295
|
+
}
|
|
293
296
|
|
|
294
297
|
@withSourceMap()
|
|
295
298
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
@@ -47,7 +47,7 @@ export class ExternalDestination extends LogicItem {
|
|
|
47
47
|
@property('Anchor')
|
|
48
48
|
anchor: Anchor = undefined;
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @param source 需要合并的部分参数
|
|
@@ -62,7 +62,7 @@ export class ExternalDestination extends LogicItem {
|
|
|
62
62
|
return super.from(source, parentNode, parentKey) as ExternalDestination;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
/**
|
|
67
67
|
* 设置外部链接
|
|
68
68
|
*/
|
|
@@ -105,9 +105,9 @@ export class ExternalDestination extends LogicItem {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
108
|
|
|
110
|
-
|
|
109
|
+
|
|
110
|
+
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* 删除逻辑项
|
|
@@ -134,7 +134,7 @@ export class ExternalDestination extends LogicItem {
|
|
|
134
134
|
return link.delete();
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* 删除锚点参数
|
|
@@ -201,10 +201,30 @@ export class ExternalDestination extends LogicItem {
|
|
|
201
201
|
|
|
202
202
|
return code;
|
|
203
203
|
}
|
|
204
|
+
|
|
205
|
+
toInViewMethod() {
|
|
206
|
+
let code = `let url = ${this.link?.toJS() || '\'\''};\n`;
|
|
207
|
+
if (this.anchor) {
|
|
208
|
+
const anchorCode = this.anchor.toJS();
|
|
209
|
+
if (anchorCode) {
|
|
210
|
+
code += `const anchor = ${anchorCode};`;
|
|
211
|
+
code += 'if (anchor) {\nurl += `#${anchor}`;\n}\n';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
code += 'return url;';
|
|
215
|
+
return `await (async () => {
|
|
216
|
+
try {
|
|
217
|
+
${code}
|
|
218
|
+
} catch(err) {
|
|
219
|
+
console.log(err);
|
|
220
|
+
}
|
|
221
|
+
})();`;
|
|
222
|
+
}
|
|
223
|
+
|
|
204
224
|
toVue(options?: ElementToVueOptions) {
|
|
205
|
-
let url = '';
|
|
225
|
+
let url = '`';
|
|
206
226
|
const tempLink = this.link ? this.link.toVue(options) : '';
|
|
207
|
-
url += '
|
|
227
|
+
url += '${';
|
|
208
228
|
url += `${tempLink}`;
|
|
209
229
|
url += '}';
|
|
210
230
|
if (this.anchor) {
|
|
@@ -212,7 +232,7 @@ export class ExternalDestination extends LogicItem {
|
|
|
212
232
|
if (anchor)
|
|
213
233
|
url += `#\${${anchor}}`;
|
|
214
234
|
}
|
|
215
|
-
url += '`
|
|
235
|
+
url += '`';
|
|
216
236
|
return url;
|
|
217
237
|
}
|
|
218
238
|
|
|
@@ -531,6 +531,8 @@ export class ForEachStatement extends LogicItem {
|
|
|
531
531
|
code += this.each ? this.each.toEmbeddedTS(shiftState(state, code, {
|
|
532
532
|
tabSize: 0,
|
|
533
533
|
})) : '__IDENTIFIER__';
|
|
534
|
+
if (['NewList', 'NewMap'].includes(this.each?.concept))
|
|
535
|
+
code += '\n';
|
|
534
536
|
code += '.__slice(';
|
|
535
537
|
code += this.start ? this.start.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__';
|
|
536
538
|
code += ', ';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
2
|
+
import { AssetsInfo } from './App__';
|
|
2
3
|
import Namespace from './Namespace__';
|
|
3
4
|
|
|
4
5
|
//================================================================================
|
|
@@ -16,7 +17,7 @@ import View from './View__';
|
|
|
16
17
|
import Variable from './Variable__';
|
|
17
18
|
import Theme from './Theme__';
|
|
18
19
|
import Module from './Module__';
|
|
19
|
-
import App
|
|
20
|
+
import App from './App__';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* 端
|
|
@@ -78,7 +78,7 @@ export class Identifier extends LogicItem {
|
|
|
78
78
|
if (namespace) {
|
|
79
79
|
if ((this.namespace.endsWith('nasl.browser') || this.namespace.endsWith('nasl.auth') || this.namespace.endsWith('nasl.configuration') || this.namespace.endsWith('nasl.process'))) {
|
|
80
80
|
name = `$global.${this.name}`;
|
|
81
|
-
} else if (this.namespace.endsWith('
|
|
81
|
+
} else if (this.namespace.startsWith('app.frontends') && this.namespace.endsWith('variables')) {
|
|
82
82
|
name = `$global.frontendVariables.${this.name}`;
|
|
83
83
|
} else if (this.isEnum()) {
|
|
84
84
|
let enumName = this.name;
|
|
@@ -99,7 +99,7 @@ export class Identifier extends LogicItem {
|
|
|
99
99
|
if (namespace) {
|
|
100
100
|
if (namespace.startsWith('nasl.')) {
|
|
101
101
|
name = `${namespace}.${this.name}`;
|
|
102
|
-
} else if (namespace.endsWith('
|
|
102
|
+
} else if (namespace.startsWith('app.frontends') && namespace.endsWith('variables')) {
|
|
103
103
|
name = `nasl.frontendVariables.${this.name}`;
|
|
104
104
|
} else if (this.isEnum()) {
|
|
105
105
|
let enumName = this.name;
|
|
@@ -119,7 +119,7 @@ export class Identifier extends LogicItem {
|
|
|
119
119
|
if (namespace) {
|
|
120
120
|
if (namespace.endsWith('nasl.browser') || namespace.endsWith('nasl.auth') || namespace.endsWith('nasl.configuration') || this.namespace.endsWith('nasl.process')) {
|
|
121
121
|
name = `$global.${this.name}`;
|
|
122
|
-
} else if (namespace.endsWith('
|
|
122
|
+
} else if (namespace.startsWith('app.frontends') && namespace.endsWith('variables')) {
|
|
123
123
|
name = `$global.frontendVariables.${this.name}`;
|
|
124
124
|
} else if (this.isEnum()) {
|
|
125
125
|
let enumName = this.name;
|
|
@@ -127,6 +127,9 @@ export class Identifier extends LogicItem {
|
|
|
127
127
|
enumName = `${this.namespace}.${this.name}`;
|
|
128
128
|
}
|
|
129
129
|
name = enumName;
|
|
130
|
+
} else if (namespace.endsWith('configuration.groups.custom.properties')) {
|
|
131
|
+
// 配置参数
|
|
132
|
+
name = `"${this.namespace}.${this.name}"`;
|
|
130
133
|
} else if (this.namespace.endsWith('logics')) {
|
|
131
134
|
name = `'${this.namespace}.${name}'`;
|
|
132
135
|
}
|
|
@@ -150,6 +153,10 @@ export class Identifier extends LogicItem {
|
|
|
150
153
|
this.view?.variables?.forEach((variable) => {
|
|
151
154
|
dataMap[variable.name] = true;
|
|
152
155
|
});
|
|
156
|
+
// 目前前端逻辑也会被当成可选变量(以datasource为典型)
|
|
157
|
+
this.view?.logics?.forEach((logics) => {
|
|
158
|
+
dataMap[logics.name] = true;
|
|
159
|
+
});
|
|
153
160
|
const parentNode = this.parentNode;
|
|
154
161
|
let isMemberExpressionProperty = false;
|
|
155
162
|
if (parentNode?.concept === 'MemberExpression' && this.parentKey === 'property') {
|
|
@@ -157,6 +164,10 @@ export class Identifier extends LogicItem {
|
|
|
157
164
|
}
|
|
158
165
|
const name = this.jsName;
|
|
159
166
|
const namespace = this.namespace;
|
|
167
|
+
|
|
168
|
+
if (name === 'UserStatusEnum') {
|
|
169
|
+
console.log(this);
|
|
170
|
+
}
|
|
160
171
|
return (
|
|
161
172
|
dataMap[name]
|
|
162
173
|
|| this.globalDataMap[name]
|
|
@@ -164,7 +175,7 @@ export class Identifier extends LogicItem {
|
|
|
164
175
|
|| namespace?.endsWith('nasl.auth')
|
|
165
176
|
|| namespace?.endsWith('nasl.configuration')
|
|
166
177
|
|| namespace?.endsWith('nasl.process')
|
|
167
|
-
|| namespace?.endsWith('
|
|
178
|
+
|| (namespace?.startsWith('app.frontends') && namespace?.endsWith('variables'))
|
|
168
179
|
|| this.isEnum()
|
|
169
180
|
) && !isMemberExpressionProperty;
|
|
170
181
|
}
|
|
@@ -186,7 +197,7 @@ export class Identifier extends LogicItem {
|
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
// 全局变量在不是页面的地方放置,就会报错
|
|
189
|
-
if (this.namespace?.startsWith('app.
|
|
200
|
+
if (this.namespace?.startsWith('app.frontends') && this.namespace?.endsWith('variables') && !this.view) {
|
|
190
201
|
return '__FRONTENDVARIABLES__';
|
|
191
202
|
}
|
|
192
203
|
|
|
@@ -281,11 +281,13 @@ export class InterfaceParam extends BaseNode {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
get hasChildren() {
|
|
284
|
-
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
284
|
+
const { typeKind, typeName, typeNamespace } = this.typeAnnotation;
|
|
285
285
|
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
286
286
|
if (typeNamespace.endsWith('.enums'))
|
|
287
287
|
return null;
|
|
288
288
|
return [{}];
|
|
289
|
+
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
290
|
+
return [{}];
|
|
289
291
|
}
|
|
290
292
|
return null;
|
|
291
293
|
}
|
|
@@ -321,6 +323,10 @@ export class InterfaceParam extends BaseNode {
|
|
|
321
323
|
}
|
|
322
324
|
}
|
|
323
325
|
completionChildren = properties;
|
|
326
|
+
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
327
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
328
|
+
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
329
|
+
completionChildren = properties;
|
|
324
330
|
} else {
|
|
325
331
|
completionChildren = [];
|
|
326
332
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranslatorState } from '../translator';
|
|
1
|
+
import { withSourceMap, TranslatorState } from '../translator';
|
|
2
2
|
//================================================================================
|
|
3
3
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
4
4
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -81,8 +81,9 @@ export class JSBlock extends LogicItem {
|
|
|
81
81
|
})();`;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
@withSourceMap()
|
|
84
85
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
85
|
-
return '';
|
|
86
|
+
return 'nasl.core.universalVariable';
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
toBrief(): string {
|