@lcap/nasl 2.18.0 → 2.20.0-beta.2
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 +4 -4
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +1 -1
- package/out/automate/engine/uniqueName.js +3 -3
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/template/myProcess.js +1 -1
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +2 -1
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.js +1 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +1 -0
- package/out/concepts/AnonymousFunction__.js +40 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +79 -261
- package/out/concepts/App__.js +241 -367
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +2 -0
- package/out/concepts/BatchAssignment__.js +108 -47
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +5 -0
- package/out/concepts/BindAttribute__.js +15 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +5 -0
- package/out/concepts/BindDirective__.js +6 -0
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +5 -0
- package/out/concepts/BindEvent__.js +6 -0
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +5 -0
- package/out/concepts/BindStyle__.js +6 -0
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallFunction__.js +33 -14
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +2 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -1
- package/out/concepts/CallLogic__.js +112 -27
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +4 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +5 -0
- package/out/concepts/Constant__.js +6 -0
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +2 -0
- package/out/concepts/DataSource__.js +55 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +2 -1
- package/out/concepts/Destination__.js +98 -25
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +370 -0
- package/out/concepts/Frontend__.js +669 -0
- package/out/concepts/Frontend__.js.map +1 -0
- package/out/concepts/Identifier__.d.ts +1 -0
- package/out/concepts/Identifier__.js +18 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +6 -1
- package/out/concepts/LogicItem__.js +6 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +85 -79
- package/out/concepts/Logic__.js +41 -23
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.js +14 -9
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +345 -0
- package/out/concepts/NewComposite__.js +1068 -0
- package/out/concepts/NewComposite__.js.map +1 -0
- package/out/concepts/NewList__.d.ts +130 -0
- package/out/concepts/NewList__.js +349 -0
- package/out/concepts/NewList__.js.map +1 -0
- package/out/concepts/NewMap__.d.ts +221 -0
- package/out/concepts/NewMap__.js +480 -0
- package/out/concepts/NewMap__.js.map +1 -0
- package/out/concepts/New__.d.ts +19 -0
- package/out/concepts/New__.js +66 -0
- package/out/concepts/New__.js.map +1 -0
- package/out/concepts/Param__.d.ts +7 -0
- package/out/concepts/Param__.js +46 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +42 -13
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +30 -0
- package/out/concepts/ProcessOutcomes__.js +87 -0
- package/out/concepts/ProcessOutcomes__.js.map +1 -0
- package/out/concepts/Process__.d.ts +4 -20
- package/out/concepts/Process__.js +0 -7
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/Return__.d.ts +5 -0
- package/out/concepts/Return__.js +8 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +3 -3
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +5 -0
- package/out/concepts/Transactional__.js +6 -0
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +3 -0
- package/out/concepts/TypeAnnotation__.js +50 -11
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +5 -0
- package/out/concepts/Variable__.js +9 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +5 -0
- package/out/concepts/ViewElement__.js +21 -3
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +6 -0
- package/out/concepts/View__.js +23 -3
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.logging.js +5 -0
- package/out/concepts/basics/stdlib/nasl.logging.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +2 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +151 -19
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +7 -0
- package/out/concepts/index__.js +7 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.d.ts +1 -0
- package/out/enums/KEYWORDS.js +9 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +6 -3
- package/out/generator/genBundleFiles.js +54 -192
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +2 -11
- package/out/generator/genMetaData.js +185 -51
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +18 -2
- package/out/generator/genReleaseBody.js +80 -40
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/index.d.ts +1 -0
- package/out/generator/index.js +1 -0
- package/out/generator/index.js.map +1 -1
- package/out/generator/permission.d.ts +17 -0
- package/out/generator/permission.js +221 -0
- package/out/generator/permission.js.map +1 -0
- package/out/index.d.ts +1 -1
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +89 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +33 -20
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +1 -2
- package/out/server/formatTsUtils.js +36 -47
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -1
- package/out/server/getLogics.js +13 -2
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +4 -4
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.js +1 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +3 -1
- package/out/server/naslServer.js +254 -65
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +8 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +50 -5
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +4 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/datasource/api.d.ts +12 -0
- package/out/service/datasource/api.js +14 -0
- package/out/service/datasource/api.js.map +1 -0
- package/out/service/datasource/index.d.ts +2 -0
- package/out/service/datasource/index.js +10 -0
- package/out/service/datasource/index.js.map +1 -0
- package/out/service/storage/init.js +15 -4
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genEditTableBlock.js +4 -5
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -3
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +16 -14
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +5 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +6 -10
- package/out/templator/genTableBlock.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.auth.ts +1 -1
- package/sandbox/stdlib/nasl.core.ts +1 -0
- package/sandbox/stdlib/nasl.logging.ts +4 -4
- package/sandbox/stdlib/nasl.util.ts +9 -5
- package/src/automate/engine/index.js +4 -4
- package/src/automate/engine/uniqueName.js +3 -3
- package/src/automate/template/myProcess.js +1 -1
- package/src/automate/upgrader/2.20.js +41 -0
- package/src/bak/translator.js +4 -1
- package/src/common/BaseNode.ts +1 -0
- package/src/concepts/AnonymousFunction__.ts +48 -2
- package/src/concepts/App__.ts +298 -650
- package/src/concepts/BatchAssignment__.ts +111 -51
- package/src/concepts/BindAttribute__.ts +18 -25
- package/src/concepts/BindDirective__.ts +7 -0
- package/src/concepts/BindEvent__.ts +7 -0
- package/src/concepts/BindStyle__.ts +7 -0
- package/src/concepts/CallFunction__.ts +34 -45
- package/src/concepts/CallInterface__.ts +2 -1
- package/src/concepts/CallLogic__.ts +87 -55
- package/src/concepts/CallQueryComponent__.ts +4 -1
- package/src/concepts/Constant__.ts +7 -0
- package/src/concepts/DataSource__.ts +57 -5
- package/src/concepts/Destination__.ts +100 -43
- package/src/concepts/Frontend__.ts +945 -0
- package/src/concepts/Identifier__.ts +18 -16
- package/src/concepts/LogicItem__.ts +8 -1
- package/src/concepts/Logic__.ts +134 -149
- package/src/concepts/Match__.ts +13 -29
- package/src/concepts/NewComposite__.ts +1357 -0
- package/src/concepts/NewList__.ts +440 -0
- package/src/concepts/NewMap__.ts +666 -0
- package/src/concepts/New__.ts +73 -0
- package/src/concepts/Param__.ts +245 -199
- package/src/concepts/ProcessElement__.ts +43 -36
- package/src/concepts/ProcessOutcomes__.ts +90 -0
- package/src/concepts/Process__.ts +1 -23
- package/src/concepts/Return__.ts +11 -1
- package/src/concepts/SelectMembers__.ts +3 -3
- package/src/concepts/Transactional__.ts +7 -0
- package/src/concepts/TypeAnnotation__.ts +54 -49
- package/src/concepts/ValidationRule__.ts +19 -1
- package/src/concepts/Variable__.ts +12 -6
- package/src/concepts/ViewElement__.ts +28 -26
- package/src/concepts/View__.ts +26 -26
- package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
- package/src/concepts/index__.ts +7 -0
- package/src/enums/KEYWORDS.ts +9 -0
- package/src/generator/genBundleFiles.ts +74 -245
- package/src/generator/genMetaData.ts +178 -78
- package/src/generator/genReleaseBody.ts +87 -44
- package/src/generator/index.ts +1 -0
- package/src/generator/permission.ts +261 -0
- package/src/index.ts +1 -1
- package/src/server/entity2LogicNamespace.ts +90 -10
- package/src/server/extendBaseNode.ts +33 -22
- package/src/server/formatTsUtils.ts +36 -46
- package/src/server/getLogics.ts +15 -3
- package/src/server/getMemberIdentifier.ts +5 -5
- package/src/server/getProcesses.ts +1 -1
- package/src/server/naslServer.ts +260 -77
- package/src/server/process2LogicNamespace.ts +8 -0
- package/src/server/translator.ts +51 -5
- package/src/service/creator/add.configs.js +4 -0
- package/src/service/datasource/api.js +11 -0
- package/src/service/datasource/index.js +6 -0
- package/src/service/storage/init.ts +15 -4
- package/src/service/video/VideoTranscribe.js +1 -0
- package/src/templator/genEditTableBlock.ts +8 -16
- package/src/templator/genGetBlock.ts +18 -19
- package/src/templator/genGridViewBlock.ts +18 -18
- package/src/templator/genListViewBlock.ts +8 -11
- package/src/templator/genTableBlock.ts +6 -10
- package/ts-worker/lib/tsserver.js +8 -1
- package/out/automate/engine/2.14-components.d.ts +0 -1115
- package/out/automate/engine/2.14-components.js +0 -1087
- package/out/automate/engine/2.14-components.js.map +0 -1
- package/out/concepts/MatchExpression__.d.ts +0 -97
- package/out/concepts/MatchExpression__.js +0 -281
- package/out/concepts/MatchExpression__.js.map +0 -1
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/Anchor__.js +0 -179
- package/src/concepts/dist/Assignment__.js +0 -301
- package/src/concepts/dist/CallFunction__.js +0 -473
- package/src/concepts/dist/CallInterface__.js +0 -533
- package/src/concepts/dist/CallLogic__.js +0 -864
- package/src/concepts/dist/ForEachStatement__.js +0 -426
- package/src/concepts/dist/MatchCase__.js +0 -587
- package/src/concepts/dist/MemberExpression__.js +0 -348
- package/src/concepts/dist/Param__.js +0 -537
- package/src/concepts/dist/Return__.js +0 -493
- package/src/generator/dist/genBundleFiles.js +0 -414
- package/src/server/dist/formatTsUtils.js +0 -683
- package/src/server/dist/naslServer.js +0 -3396
- package/src/service/storage/dist/init.js +0 -541
- package/ts-worker/dist/webpack.config.dev.js +0 -104
- package/ts-worker/lib/dist/tsserver.dev.js +0 -22953
- package/ts-worker/sources/lib/dist/tsserver.dev.js +0 -22912
package/src/concepts/Logic__.ts
CHANGED
|
@@ -34,6 +34,7 @@ import Module from './Module__';
|
|
|
34
34
|
import View from './View__';
|
|
35
35
|
import ProcessElement from './ProcessElement__';
|
|
36
36
|
import App from './App__';
|
|
37
|
+
import Frontend from './Frontend__';
|
|
37
38
|
import Process from './Process__';
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -81,7 +82,7 @@ export class Logic extends BaseNode {
|
|
|
81
82
|
* 编译器信息
|
|
82
83
|
*/
|
|
83
84
|
@property()
|
|
84
|
-
compilerInfoMap: { java?: { packageName: string
|
|
85
|
+
compilerInfoMap: { java?: { packageName: string; className: string } } = undefined;
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
88
|
* 类型参数列表
|
|
@@ -137,6 +138,12 @@ export class Logic extends BaseNode {
|
|
|
137
138
|
get view() {
|
|
138
139
|
return this.getAncestor('View') as View;
|
|
139
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* 祖先 Frontend
|
|
143
|
+
*/
|
|
144
|
+
get frontend() {
|
|
145
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
146
|
+
}
|
|
140
147
|
/**
|
|
141
148
|
* 祖先 ProcessElement
|
|
142
149
|
*/
|
|
@@ -238,7 +245,7 @@ export class Logic extends BaseNode {
|
|
|
238
245
|
});
|
|
239
246
|
}
|
|
240
247
|
|
|
241
|
-
|
|
248
|
+
getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
|
|
242
249
|
const excludedSet = new Set(excludedList);
|
|
243
250
|
return ((this.typeParams as TypeParam[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
244
251
|
}
|
|
@@ -247,24 +254,24 @@ export class Logic extends BaseNode {
|
|
|
247
254
|
}
|
|
248
255
|
|
|
249
256
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
257
|
+
* 插入类型参数
|
|
258
|
+
* @internal
|
|
259
|
+
* @param name 类型参数名称,如果不填会自动生成一个唯一名称
|
|
260
|
+
*/
|
|
254
261
|
_insertTypeParamAt(name: string, index: number): TypeParam;
|
|
255
262
|
|
|
256
263
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
* 插入类型参数
|
|
265
|
+
* @internal
|
|
266
|
+
* @param typeParamOptions 类型参数参数
|
|
267
|
+
*/
|
|
261
268
|
_insertTypeParamAt(typeParamOptions: Partial<TypeParam>, index: number): TypeParam;
|
|
262
269
|
|
|
263
270
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
* 插入类型参数
|
|
272
|
+
* @internal
|
|
273
|
+
* @param typeParam 已有的类型参数实例
|
|
274
|
+
*/
|
|
268
275
|
_insertTypeParamAt(typeParam: TypeParam, index: number): TypeParam;
|
|
269
276
|
|
|
270
277
|
_insertTypeParamAt(options: string | Partial<TypeParam> | TypeParam, index: number) {
|
|
@@ -379,30 +386,29 @@ export class Logic extends BaseNode {
|
|
|
379
386
|
return node;
|
|
380
387
|
}
|
|
381
388
|
|
|
382
|
-
|
|
383
389
|
getParamUniqueName(name = 'param1') {
|
|
384
390
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
385
391
|
}
|
|
386
392
|
|
|
387
393
|
/**
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
394
|
+
* 插入输入参数
|
|
395
|
+
* @internal
|
|
396
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
397
|
+
*/
|
|
392
398
|
_insertParamAt(name: string, index: number): Param;
|
|
393
399
|
|
|
394
400
|
/**
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
* 插入输入参数
|
|
402
|
+
* @internal
|
|
403
|
+
* @param paramOptions 输入参数参数
|
|
404
|
+
*/
|
|
399
405
|
_insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
400
406
|
|
|
401
407
|
/**
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
408
|
+
* 插入输入参数
|
|
409
|
+
* @internal
|
|
410
|
+
* @param param 已有的输入参数实例
|
|
411
|
+
*/
|
|
406
412
|
_insertParamAt(param: Param, index: number): Param;
|
|
407
413
|
|
|
408
414
|
_insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
@@ -517,30 +523,29 @@ export class Logic extends BaseNode {
|
|
|
517
523
|
return node;
|
|
518
524
|
}
|
|
519
525
|
|
|
520
|
-
|
|
521
526
|
getReturnUniqueName(name = 'result') {
|
|
522
527
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
523
528
|
}
|
|
524
529
|
|
|
525
530
|
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
531
|
+
* 插入输出参数
|
|
532
|
+
* @internal
|
|
533
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
534
|
+
*/
|
|
530
535
|
_insertReturnAt(name: string, index: number): Return;
|
|
531
536
|
|
|
532
537
|
/**
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
538
|
+
* 插入输出参数
|
|
539
|
+
* @internal
|
|
540
|
+
* @param retOptions 输出参数参数
|
|
541
|
+
*/
|
|
537
542
|
_insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
538
543
|
|
|
539
544
|
/**
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
545
|
+
* 插入输出参数
|
|
546
|
+
* @internal
|
|
547
|
+
* @param ret 已有的输出参数实例
|
|
548
|
+
*/
|
|
544
549
|
_insertReturnAt(ret: Return, index: number): Return;
|
|
545
550
|
|
|
546
551
|
_insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
@@ -655,30 +660,29 @@ export class Logic extends BaseNode {
|
|
|
655
660
|
return node;
|
|
656
661
|
}
|
|
657
662
|
|
|
658
|
-
|
|
659
663
|
getVariableUniqueName(name = 'variable1') {
|
|
660
664
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
661
665
|
}
|
|
662
666
|
|
|
663
667
|
/**
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
+
* 插入变量
|
|
669
|
+
* @internal
|
|
670
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
671
|
+
*/
|
|
668
672
|
_insertVariableAt(name: string, index: number): Variable;
|
|
669
673
|
|
|
670
674
|
/**
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
+
* 插入变量
|
|
676
|
+
* @internal
|
|
677
|
+
* @param variableOptions 变量参数
|
|
678
|
+
*/
|
|
675
679
|
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
676
680
|
|
|
677
681
|
/**
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
+
* 插入变量
|
|
683
|
+
* @internal
|
|
684
|
+
* @param variable 已有的变量实例
|
|
685
|
+
*/
|
|
682
686
|
_insertVariableAt(variable: Variable, index: number): Variable;
|
|
683
687
|
|
|
684
688
|
_insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
@@ -793,23 +797,18 @@ export class Logic extends BaseNode {
|
|
|
793
797
|
return node;
|
|
794
798
|
}
|
|
795
799
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
800
|
/**
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
801
|
+
* 插入逻辑项
|
|
802
|
+
* @internal
|
|
803
|
+
* @param logicItemOptions 逻辑项参数
|
|
804
|
+
*/
|
|
806
805
|
_insertItemInBodyAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
807
806
|
|
|
808
807
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
808
|
+
* 插入逻辑项
|
|
809
|
+
* @internal
|
|
810
|
+
* @param logicItem 已有的逻辑项实例
|
|
811
|
+
*/
|
|
813
812
|
_insertItemInBodyAt(logicItem: LogicItem, index: number): LogicItem;
|
|
814
813
|
|
|
815
814
|
_insertItemInBodyAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
@@ -830,8 +829,6 @@ export class Logic extends BaseNode {
|
|
|
830
829
|
return logicItem;
|
|
831
830
|
}
|
|
832
831
|
|
|
833
|
-
|
|
834
|
-
|
|
835
832
|
/**
|
|
836
833
|
* 插入逻辑项
|
|
837
834
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -854,8 +851,6 @@ export class Logic extends BaseNode {
|
|
|
854
851
|
return node;
|
|
855
852
|
}
|
|
856
853
|
|
|
857
|
-
|
|
858
|
-
|
|
859
854
|
/**
|
|
860
855
|
* 添加逻辑项
|
|
861
856
|
* @internal
|
|
@@ -875,8 +870,6 @@ export class Logic extends BaseNode {
|
|
|
875
870
|
return this._insertItemInBodyAt(options as any, index);
|
|
876
871
|
}
|
|
877
872
|
|
|
878
|
-
|
|
879
|
-
|
|
880
873
|
/**
|
|
881
874
|
* 添加逻辑项
|
|
882
875
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -900,20 +893,18 @@ export class Logic extends BaseNode {
|
|
|
900
893
|
return node;
|
|
901
894
|
}
|
|
902
895
|
|
|
903
|
-
|
|
904
|
-
|
|
905
896
|
/**
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
897
|
+
* 插入逻辑项
|
|
898
|
+
* @internal
|
|
899
|
+
* @param logicItemOptions 逻辑项参数
|
|
900
|
+
*/
|
|
910
901
|
_insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
911
902
|
|
|
912
903
|
/**
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
904
|
+
* 插入逻辑项
|
|
905
|
+
* @internal
|
|
906
|
+
* @param logicItem 已有的逻辑项实例
|
|
907
|
+
*/
|
|
917
908
|
_insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
|
|
918
909
|
|
|
919
910
|
_insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
@@ -934,8 +925,6 @@ export class Logic extends BaseNode {
|
|
|
934
925
|
return logicItem;
|
|
935
926
|
}
|
|
936
927
|
|
|
937
|
-
|
|
938
|
-
|
|
939
928
|
/**
|
|
940
929
|
* 插入逻辑项
|
|
941
930
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -958,8 +947,6 @@ export class Logic extends BaseNode {
|
|
|
958
947
|
return node;
|
|
959
948
|
}
|
|
960
949
|
|
|
961
|
-
|
|
962
|
-
|
|
963
950
|
/**
|
|
964
951
|
* 添加逻辑项
|
|
965
952
|
* @internal
|
|
@@ -979,8 +966,6 @@ export class Logic extends BaseNode {
|
|
|
979
966
|
return this._insertItemInPlaygroundAt(options as any, index);
|
|
980
967
|
}
|
|
981
968
|
|
|
982
|
-
|
|
983
|
-
|
|
984
969
|
/**
|
|
985
970
|
* 添加逻辑项
|
|
986
971
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -1004,13 +989,10 @@ export class Logic extends BaseNode {
|
|
|
1004
989
|
return node;
|
|
1005
990
|
}
|
|
1006
991
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
992
|
/**
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
993
|
+
* 删除事务
|
|
994
|
+
* @param name 事务名称
|
|
995
|
+
*/
|
|
1014
996
|
removeTransactional(name: string): void;
|
|
1015
997
|
|
|
1016
998
|
/**
|
|
@@ -1055,12 +1037,10 @@ export class Logic extends BaseNode {
|
|
|
1055
1037
|
return params;
|
|
1056
1038
|
}
|
|
1057
1039
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
1040
|
/**
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1041
|
+
* 删除类型参数
|
|
1042
|
+
* @param name 类型参数名称
|
|
1043
|
+
*/
|
|
1064
1044
|
removeTypeParam(name: string): void;
|
|
1065
1045
|
|
|
1066
1046
|
/**
|
|
@@ -1105,12 +1085,10 @@ export class Logic extends BaseNode {
|
|
|
1105
1085
|
return params;
|
|
1106
1086
|
}
|
|
1107
1087
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
1088
|
/**
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1089
|
+
* 删除输入参数
|
|
1090
|
+
* @param name 输入参数名称
|
|
1091
|
+
*/
|
|
1114
1092
|
removeParam(name: string): void;
|
|
1115
1093
|
|
|
1116
1094
|
/**
|
|
@@ -1155,12 +1133,10 @@ export class Logic extends BaseNode {
|
|
|
1155
1133
|
return params;
|
|
1156
1134
|
}
|
|
1157
1135
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
1136
|
/**
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1137
|
+
* 删除输出参数
|
|
1138
|
+
* @param name 输出参数名称
|
|
1139
|
+
*/
|
|
1164
1140
|
removeReturn(name: string): void;
|
|
1165
1141
|
|
|
1166
1142
|
/**
|
|
@@ -1205,12 +1181,10 @@ export class Logic extends BaseNode {
|
|
|
1205
1181
|
return params;
|
|
1206
1182
|
}
|
|
1207
1183
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
1184
|
/**
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1185
|
+
* 删除变量
|
|
1186
|
+
* @param name 变量名称
|
|
1187
|
+
*/
|
|
1214
1188
|
removeVariable(name: string): void;
|
|
1215
1189
|
|
|
1216
1190
|
/**
|
|
@@ -1255,8 +1229,6 @@ export class Logic extends BaseNode {
|
|
|
1255
1229
|
return params;
|
|
1256
1230
|
}
|
|
1257
1231
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
1232
|
/**
|
|
1261
1233
|
* 删除逻辑项
|
|
1262
1234
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1264,12 +1236,10 @@ export class Logic extends BaseNode {
|
|
|
1264
1236
|
removeItemInBody(logicItem: LogicItem): void;
|
|
1265
1237
|
|
|
1266
1238
|
removeItemInBody(options: LogicItem) {
|
|
1267
|
-
|
|
1239
|
+
const logicItem: LogicItem = options;
|
|
1268
1240
|
return logicItem.delete();
|
|
1269
1241
|
}
|
|
1270
1242
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
1243
|
/**
|
|
1274
1244
|
* 删除逻辑项
|
|
1275
1245
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1277,7 +1247,7 @@ export class Logic extends BaseNode {
|
|
|
1277
1247
|
removeItemInPlayground(logicItem: LogicItem): void;
|
|
1278
1248
|
|
|
1279
1249
|
removeItemInPlayground(options: LogicItem) {
|
|
1280
|
-
|
|
1250
|
+
const logicItem: LogicItem = options;
|
|
1281
1251
|
return logicItem.delete();
|
|
1282
1252
|
}
|
|
1283
1253
|
|
|
@@ -1625,15 +1595,10 @@ export class Logic extends BaseNode {
|
|
|
1625
1595
|
code += '(';
|
|
1626
1596
|
this.params.forEach((param, index) => {
|
|
1627
1597
|
code += param.toEmbeddedTS(shiftState(state, code));
|
|
1628
|
-
code += ',';
|
|
1629
|
-
});
|
|
1630
|
-
code += '\n, __defaultValues?: { \n';
|
|
1631
|
-
this.params.forEach((param, index) => {
|
|
1632
|
-
code += `${param.name}: "${param.defaultValue || ''}"`;
|
|
1633
1598
|
if (index !== this.params.length - 1)
|
|
1634
|
-
code += '
|
|
1599
|
+
code += ', ';
|
|
1635
1600
|
});
|
|
1636
|
-
code += '
|
|
1601
|
+
code += ')';
|
|
1637
1602
|
} else {
|
|
1638
1603
|
// 没有参数的
|
|
1639
1604
|
code += '()';
|
|
@@ -1645,13 +1610,11 @@ export class Logic extends BaseNode {
|
|
|
1645
1610
|
this.traverseChildren((el) => {
|
|
1646
1611
|
if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
|
|
1647
1612
|
const jsCode = el.toJS();
|
|
1648
|
-
const advanceVar = this.variables?.find((variable) =>
|
|
1649
|
-
!variable.typeAnnotation && jsCode.includes(`${variable.name} = `));
|
|
1613
|
+
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && jsCode.includes(`${variable.name} = `));
|
|
1650
1614
|
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1651
1615
|
advanceMap.set(advanceVar, el);
|
|
1652
1616
|
}
|
|
1653
|
-
const advanceRn = this.returns?.find((ret) =>
|
|
1654
|
-
!ret.typeAnnotation && jsCode.includes(`${ret.name} = `));
|
|
1617
|
+
const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && jsCode.includes(`${ret.name} = `));
|
|
1655
1618
|
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1656
1619
|
advanceMap.set(advanceRn, el);
|
|
1657
1620
|
}
|
|
@@ -1668,12 +1631,14 @@ export class Logic extends BaseNode {
|
|
|
1668
1631
|
Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1669
1632
|
// 触发一下更新重新生成代码
|
|
1670
1633
|
(this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1671
|
-
value: [
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1634
|
+
value: [
|
|
1635
|
+
{
|
|
1636
|
+
originEvent: {
|
|
1637
|
+
action: 'update',
|
|
1638
|
+
target: this,
|
|
1639
|
+
},
|
|
1675
1640
|
},
|
|
1676
|
-
|
|
1641
|
+
],
|
|
1677
1642
|
});
|
|
1678
1643
|
});
|
|
1679
1644
|
}
|
|
@@ -1685,11 +1650,13 @@ export class Logic extends BaseNode {
|
|
|
1685
1650
|
code += '{\n';
|
|
1686
1651
|
|
|
1687
1652
|
// 用于虚拟节点的查找引用
|
|
1688
|
-
this.virtualParams
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1653
|
+
this.virtualParams
|
|
1654
|
+
&& Array.isArray(this.virtualParams)
|
|
1655
|
+
&& this.virtualParams.forEach((param) => {
|
|
1656
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1657
|
+
code += param.toEmbeddedNameTS(shiftState(state, code, { inline: true }));
|
|
1658
|
+
code += '\n';
|
|
1659
|
+
});
|
|
1693
1660
|
|
|
1694
1661
|
this.variables.forEach((variable) => {
|
|
1695
1662
|
if (!advanceMap.get(variable)) {
|
|
@@ -1713,12 +1680,12 @@ export class Logic extends BaseNode {
|
|
|
1713
1680
|
code += node.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1714
1681
|
if (assignment instanceof BatchAssignment) {
|
|
1715
1682
|
assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
|
|
1716
|
-
const leftCode
|
|
1683
|
+
const leftCode
|
|
1684
|
+
= leftIndex.length === 1 ? assignment.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true })) : assignment.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1717
1685
|
if (leftCode === node.name) {
|
|
1718
1686
|
const rightNode: any = rightIndex.length === 1 ? assignment.rights[rightIndex[0]]?.expression : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1719
1687
|
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1720
|
-
if (rightNode?.typeAnnotation
|
|
1721
|
-
&& !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1688
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1722
1689
|
code += ': ';
|
|
1723
1690
|
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1724
1691
|
} else {
|
|
@@ -1728,11 +1695,14 @@ export class Logic extends BaseNode {
|
|
|
1728
1695
|
}
|
|
1729
1696
|
}
|
|
1730
1697
|
});
|
|
1698
|
+
} else if (['NewList', 'NewMap'].includes(assignment.right.concept) && !(assignment.right as any).typeAnnotation) {
|
|
1699
|
+
const rightNode: any = assignment.right;
|
|
1700
|
+
code += ' = ';
|
|
1701
|
+
code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
|
|
1731
1702
|
} else {
|
|
1732
1703
|
const rightNode: any = assignment.right;
|
|
1733
1704
|
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1734
|
-
if (rightNode?.typeAnnotation
|
|
1735
|
-
&& !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1705
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1736
1706
|
code += ': ';
|
|
1737
1707
|
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1738
1708
|
} else {
|
|
@@ -1742,7 +1712,7 @@ export class Logic extends BaseNode {
|
|
|
1742
1712
|
if (rightNode && rightNode instanceof Identifier && rightNode.namespace && rightNode.namespace.endsWith('enums')) {
|
|
1743
1713
|
rightCode += 'new ';
|
|
1744
1714
|
}
|
|
1745
|
-
rightCode +=
|
|
1715
|
+
rightCode += rightNode && rightNode.toEmbeddedTS ? rightNode.toEmbeddedTS(shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1746
1716
|
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1747
1717
|
}
|
|
1748
1718
|
}
|
|
@@ -1815,6 +1785,10 @@ export class Logic extends BaseNode {
|
|
|
1815
1785
|
return replaceCode;
|
|
1816
1786
|
|
|
1817
1787
|
let fnCode = $1;
|
|
1788
|
+
if ($1.startsWith(`${variable}.`))
|
|
1789
|
+
fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
1790
|
+
if ($1.startsWith(`${variable},`))
|
|
1791
|
+
fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
1818
1792
|
if ($1.includes(`(${variable},`))
|
|
1819
1793
|
fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
1820
1794
|
if ($1.includes(`(${variable}.`))
|
|
@@ -1882,7 +1856,10 @@ export class Logic extends BaseNode {
|
|
|
1882
1856
|
arr.push(parentName);
|
|
1883
1857
|
}
|
|
1884
1858
|
let namespace = arr.join('.');
|
|
1885
|
-
if (
|
|
1859
|
+
if (
|
|
1860
|
+
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1861
|
+
&& !namespace.includes('.logics')
|
|
1862
|
+
) {
|
|
1886
1863
|
namespace = `${namespace}.logics`;
|
|
1887
1864
|
}
|
|
1888
1865
|
return namespace;
|
|
@@ -1899,7 +1876,10 @@ export class Logic extends BaseNode {
|
|
|
1899
1876
|
arr.push(parentName);
|
|
1900
1877
|
}
|
|
1901
1878
|
let namespace = arr.join('.');
|
|
1902
|
-
if (
|
|
1879
|
+
if (
|
|
1880
|
+
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1881
|
+
&& !namespace.includes('.logics')
|
|
1882
|
+
) {
|
|
1903
1883
|
namespace = `${namespace}.logics`;
|
|
1904
1884
|
}
|
|
1905
1885
|
return namespace;
|
|
@@ -2039,6 +2019,11 @@ export class Logic extends BaseNode {
|
|
|
2039
2019
|
// 虚拟输入参数列表
|
|
2040
2020
|
virtualParams: Array<Param> = [];
|
|
2041
2021
|
|
|
2022
|
+
get getLogicBelongTo() {
|
|
2023
|
+
const [, belongTo] = this.calleewholeKey.split('.');
|
|
2024
|
+
return belongTo;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2042
2027
|
//================================================================================
|
|
2043
2028
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2044
2029
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|