@lcap/nasl 1.0.2 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/index.d.ts +1 -0
- package/out/automate/engine/index.js +34 -12
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/operators.d.ts +10 -2
- package/out/automate/engine/operators.js +105 -7
- package/out/automate/engine/operators.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +8 -2
- package/out/automate/engine/uniqueName.js +72 -4
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +92 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/process.d.ts +9 -0
- package/out/automate/template/process.js +10976 -0
- package/out/automate/template/process.js.map +1 -0
- package/out/bak/translator.js +1 -0
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -0
- package/out/common/BaseNode.js +24 -3
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +51 -49
- package/out/concepts/App__.js +86 -53
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +2 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +10 -3
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +15 -6
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +4 -0
- package/out/concepts/BooleanLiteral__.js +11 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +8 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.js +48 -30
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +8 -7
- package/out/concepts/CallQueryComponent__.js +86 -76
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +7 -0
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +1 -0
- package/out/concepts/ConfigProperty__.js +3 -0
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +3 -0
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +143 -0
- package/out/concepts/DataSource__.js +318 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/Destination__.js +8 -8
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +2 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +5 -0
- package/out/concepts/EntityIndex__.js +6 -0
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +19 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -0
- package/out/concepts/Entity__.js +20 -10
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +12 -6
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +2 -2
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +96 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +6 -15
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +8 -8
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +19 -12
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +3 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.js +44 -44
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.d.ts +116 -194
- package/out/concepts/Module__.js +31 -114
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +1 -108
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +30 -10
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Process__.d.ts +1 -1
- package/out/concepts/Process__.js +17 -10
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +8 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +4 -0
- package/out/concepts/QueryFromExpression__.js +13 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +14 -3
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/Return__.js +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +10 -3
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +14 -0
- package/out/concepts/SqlQueryComponent__.js +48 -5
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StructureProperty__.js +6 -5
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +19 -12
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +1 -1
- package/out/concepts/SwitchCase__.js +23 -25
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -6
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +8 -0
- package/out/concepts/TypeAnnotation__.js +44 -2
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.js +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +25 -20
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +0 -2
- package/out/concepts/View__.js +27 -32
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +4 -4
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
- package/out/concepts/basics/stdlib/nasl.process.js +410 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +280 -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 +4 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +3 -1
- package/out/generator/genBundleFiles.js +23 -5
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +1 -0
- package/out/generator/genMetaData.js +20 -12
- package/out/generator/genMetaData.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +27 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +5 -0
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +4 -0
- package/out/server/getProcesses.js +69 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -0
- package/out/server/naslServer.js +223 -26
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +10 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +37 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.d.ts +1 -0
- package/out/service/storage/init.js +95 -84
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +34 -24
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +45 -29
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +15 -13
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +1 -1
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +29 -24
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +25 -26
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +8 -7
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +31 -21
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +34 -24
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/connect-file.js +6 -6
- package/out/test/integration/connect-file.js.map +1 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +5 -0
- package/out/utils/index.js +50 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +33 -8
- package/src/automate/engine/operators.js +114 -17
- package/src/automate/engine/uniqueName.js +77 -9
- package/src/automate/engine/utils.js +95 -68
- package/src/automate/template/process.js +10999 -0
- package/src/bak/translator.js +1 -0
- package/src/common/BaseNode.ts +21 -4
- package/src/concepts/App__.ts +128 -94
- package/src/concepts/BindAttribute__.ts +2 -2
- package/src/concepts/BindDirective__.ts +9 -7
- package/src/concepts/BindEvent__.ts +14 -6
- package/src/concepts/BooleanLiteral__.ts +12 -0
- package/src/concepts/CallFunction__.ts +6 -2
- package/src/concepts/CallLogic__.ts +47 -32
- package/src/concepts/CallQueryComponent__.ts +92 -81
- package/src/concepts/Comment__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +3 -1
- package/src/concepts/ConfigProperty__.ts +4 -0
- package/src/concepts/Configuration__.ts +3 -0
- package/src/concepts/DataSource__.ts +391 -0
- package/src/concepts/Destination__.ts +24 -8
- package/src/concepts/End__.ts +2 -2
- package/src/concepts/EntityIndex__.ts +7 -0
- package/src/concepts/EntityProperty__.ts +20 -2
- package/src/concepts/Entity__.ts +23 -11
- package/src/concepts/Enum__.ts +25 -6
- package/src/concepts/ForEachStatement__.ts +2 -2
- package/src/concepts/Function__.ts +95 -1
- package/src/concepts/Identifier__.ts +15 -15
- package/src/concepts/IfStatement__.ts +9 -9
- package/src/concepts/Interface__.ts +20 -12
- package/src/concepts/JSBlock__.ts +3 -12
- package/src/concepts/Logic__.ts +45 -79
- package/src/concepts/Module__.ts +141 -342
- package/src/concepts/Namespace__.ts +1 -204
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/ProcessElement__.ts +33 -12
- package/src/concepts/Process__.ts +18 -12
- package/src/concepts/QueryFieldExpression__.ts +9 -1
- package/src/concepts/QueryFromExpression__.ts +13 -2
- package/src/concepts/QueryJoinExpression__.ts +14 -3
- package/src/concepts/Return__.ts +1 -1
- package/src/concepts/Role__.ts +10 -4
- package/src/concepts/SqlQueryComponent__.ts +47 -11
- package/src/concepts/StringLiteral__.ts +1 -1
- package/src/concepts/StructureProperty__.ts +6 -9
- package/src/concepts/Structure__.ts +19 -11
- package/src/concepts/SwitchCase__.ts +23 -27
- package/src/concepts/SwitchStatement__.ts +1 -5
- package/src/concepts/TypeAnnotation__.ts +43 -2
- package/src/concepts/Variable__.ts +1 -1
- package/src/concepts/ViewElement__.ts +26 -39
- package/src/concepts/View__.ts +29 -34
- package/src/concepts/WhileStatement__.ts +4 -4
- package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
- package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
- package/src/concepts/basics/stdlib/nasl.util.ts +281 -2
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/concepts/index__.ts +1 -0
- package/src/generator/genBundleFiles.ts +28 -7
- package/src/generator/genMetaData.ts +22 -13
- package/src/index.ts +1 -1
- package/src/server/createUiTs.ts +1 -0
- package/src/server/getLogics.ts +29 -4
- package/src/server/getMemberIdentifier.ts +4 -0
- package/src/server/getProcesses.ts +68 -0
- package/src/server/naslServer.ts +227 -30
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +39 -1
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +97 -86
- package/src/templator/genCreateBlock.ts +35 -26
- package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
- package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
- package/src/templator/genEditTableBlock.ts +17 -14
- package/src/templator/genEnumSelectBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +30 -25
- package/src/templator/genListViewBlock.ts +10 -7
- package/src/templator/genQueryComponent.ts +28 -27
- package/src/templator/genSelectBlock.ts +9 -8
- package/src/templator/genTableBlock.ts +32 -23
- package/src/templator/genUpdateBlock.ts +35 -25
- package/src/templator/utils.ts +2 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +51 -0
package/src/concepts/Logic__.ts
CHANGED
|
@@ -227,7 +227,7 @@ export class Logic extends BaseNode {
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
|
|
231
231
|
const excludedSet = new Set(excludedList);
|
|
232
232
|
return (this.typeParams || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
233
233
|
}
|
|
@@ -368,7 +368,6 @@ export class Logic extends BaseNode {
|
|
|
368
368
|
return node;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
|
|
372
371
|
getParamUniqueName(name = 'param1') {
|
|
373
372
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
374
373
|
}
|
|
@@ -506,7 +505,6 @@ export class Logic extends BaseNode {
|
|
|
506
505
|
return node;
|
|
507
506
|
}
|
|
508
507
|
|
|
509
|
-
|
|
510
508
|
getReturnUniqueName(name = 'result') {
|
|
511
509
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
512
510
|
}
|
|
@@ -644,7 +642,6 @@ export class Logic extends BaseNode {
|
|
|
644
642
|
return node;
|
|
645
643
|
}
|
|
646
644
|
|
|
647
|
-
|
|
648
645
|
getVariableUniqueName(name = 'variable1') {
|
|
649
646
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
650
647
|
}
|
|
@@ -782,11 +779,6 @@ export class Logic extends BaseNode {
|
|
|
782
779
|
return node;
|
|
783
780
|
}
|
|
784
781
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
782
|
/**
|
|
791
783
|
* 插入逻辑项
|
|
792
784
|
* @internal
|
|
@@ -819,8 +811,6 @@ export class Logic extends BaseNode {
|
|
|
819
811
|
return logicItem;
|
|
820
812
|
}
|
|
821
813
|
|
|
822
|
-
|
|
823
|
-
|
|
824
814
|
/**
|
|
825
815
|
* 插入逻辑项
|
|
826
816
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -843,8 +833,6 @@ export class Logic extends BaseNode {
|
|
|
843
833
|
return node;
|
|
844
834
|
}
|
|
845
835
|
|
|
846
|
-
|
|
847
|
-
|
|
848
836
|
/**
|
|
849
837
|
* 添加逻辑项
|
|
850
838
|
* @internal
|
|
@@ -864,8 +852,6 @@ export class Logic extends BaseNode {
|
|
|
864
852
|
return this._insertItemInBodyAt(options as any, index);
|
|
865
853
|
}
|
|
866
854
|
|
|
867
|
-
|
|
868
|
-
|
|
869
855
|
/**
|
|
870
856
|
* 添加逻辑项
|
|
871
857
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -889,8 +875,6 @@ export class Logic extends BaseNode {
|
|
|
889
875
|
return node;
|
|
890
876
|
}
|
|
891
877
|
|
|
892
|
-
|
|
893
|
-
|
|
894
878
|
/**
|
|
895
879
|
* 插入逻辑项
|
|
896
880
|
* @internal
|
|
@@ -923,8 +907,6 @@ export class Logic extends BaseNode {
|
|
|
923
907
|
return logicItem;
|
|
924
908
|
}
|
|
925
909
|
|
|
926
|
-
|
|
927
|
-
|
|
928
910
|
/**
|
|
929
911
|
* 插入逻辑项
|
|
930
912
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -947,8 +929,6 @@ export class Logic extends BaseNode {
|
|
|
947
929
|
return node;
|
|
948
930
|
}
|
|
949
931
|
|
|
950
|
-
|
|
951
|
-
|
|
952
932
|
/**
|
|
953
933
|
* 添加逻辑项
|
|
954
934
|
* @internal
|
|
@@ -968,8 +948,6 @@ export class Logic extends BaseNode {
|
|
|
968
948
|
return this._insertItemInPlaygroundAt(options as any, index);
|
|
969
949
|
}
|
|
970
950
|
|
|
971
|
-
|
|
972
|
-
|
|
973
951
|
/**
|
|
974
952
|
* 添加逻辑项
|
|
975
953
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -993,9 +971,6 @@ export class Logic extends BaseNode {
|
|
|
993
971
|
return node;
|
|
994
972
|
}
|
|
995
973
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
974
|
/**
|
|
1000
975
|
* 删除事务
|
|
1001
976
|
* @param name 事务名称
|
|
@@ -1044,8 +1019,6 @@ export class Logic extends BaseNode {
|
|
|
1044
1019
|
return params;
|
|
1045
1020
|
}
|
|
1046
1021
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
1022
|
/**
|
|
1050
1023
|
* 删除类型参数
|
|
1051
1024
|
* @param name 类型参数名称
|
|
@@ -1094,8 +1067,6 @@ export class Logic extends BaseNode {
|
|
|
1094
1067
|
return params;
|
|
1095
1068
|
}
|
|
1096
1069
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
1070
|
/**
|
|
1100
1071
|
* 删除输入参数
|
|
1101
1072
|
* @param name 输入参数名称
|
|
@@ -1144,8 +1115,6 @@ export class Logic extends BaseNode {
|
|
|
1144
1115
|
return params;
|
|
1145
1116
|
}
|
|
1146
1117
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
1118
|
/**
|
|
1150
1119
|
* 删除输出参数
|
|
1151
1120
|
* @param name 输出参数名称
|
|
@@ -1194,8 +1163,6 @@ export class Logic extends BaseNode {
|
|
|
1194
1163
|
return params;
|
|
1195
1164
|
}
|
|
1196
1165
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
1166
|
/**
|
|
1200
1167
|
* 删除局部变量
|
|
1201
1168
|
* @param name 局部变量名称
|
|
@@ -1244,8 +1211,6 @@ export class Logic extends BaseNode {
|
|
|
1244
1211
|
return params;
|
|
1245
1212
|
}
|
|
1246
1213
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
1214
|
/**
|
|
1250
1215
|
* 删除逻辑项
|
|
1251
1216
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1253,12 +1218,10 @@ export class Logic extends BaseNode {
|
|
|
1253
1218
|
removeItemInBody(logicItem: LogicItem): void;
|
|
1254
1219
|
|
|
1255
1220
|
removeItemInBody(options: LogicItem) {
|
|
1256
|
-
|
|
1221
|
+
const logicItem: LogicItem = options;
|
|
1257
1222
|
return logicItem.delete();
|
|
1258
1223
|
}
|
|
1259
1224
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
1225
|
/**
|
|
1263
1226
|
* 删除逻辑项
|
|
1264
1227
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1266,7 +1229,7 @@ export class Logic extends BaseNode {
|
|
|
1266
1229
|
removeItemInPlayground(logicItem: LogicItem): void;
|
|
1267
1230
|
|
|
1268
1231
|
removeItemInPlayground(options: LogicItem) {
|
|
1269
|
-
|
|
1232
|
+
const logicItem: LogicItem = options;
|
|
1270
1233
|
return logicItem.delete();
|
|
1271
1234
|
}
|
|
1272
1235
|
|
|
@@ -1391,7 +1354,7 @@ export class Logic extends BaseNode {
|
|
|
1391
1354
|
// params
|
|
1392
1355
|
if (Array.isArray(this.params)) {
|
|
1393
1356
|
this.params.forEach((param) => {
|
|
1394
|
-
code += indent(state
|
|
1357
|
+
code += indent((state?.tabSize || 0) + 1) + '';
|
|
1395
1358
|
code += param.toJS(shiftState(state, code, { inline: true }));
|
|
1396
1359
|
code += ';\n';
|
|
1397
1360
|
});
|
|
@@ -1399,7 +1362,7 @@ export class Logic extends BaseNode {
|
|
|
1399
1362
|
// variables
|
|
1400
1363
|
if (Array.isArray(this.variables)) {
|
|
1401
1364
|
this.variables.forEach((variable) => {
|
|
1402
|
-
code += indent(state
|
|
1365
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1403
1366
|
code += variable.toJS(shiftState(state, code, { inline: true }));
|
|
1404
1367
|
code += ';\n';
|
|
1405
1368
|
});
|
|
@@ -1408,19 +1371,19 @@ export class Logic extends BaseNode {
|
|
|
1408
1371
|
// returns
|
|
1409
1372
|
if (Array.isArray(this.returns)) {
|
|
1410
1373
|
this.returns.forEach((ret) => {
|
|
1411
|
-
code += indent(state
|
|
1374
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1412
1375
|
code += ret.toJS(shiftState(state, code, { inline: true }));
|
|
1413
1376
|
code += ';\n';
|
|
1414
1377
|
});
|
|
1415
1378
|
}
|
|
1416
1379
|
if (Array.isArray(this.body)) {
|
|
1417
1380
|
this.body.forEach((item) => {
|
|
1418
|
-
code += item.toJS && item.toJS(shiftState(state, code, { tabSize: state
|
|
1381
|
+
code += item.toJS && item.toJS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1419
1382
|
code += '\n';
|
|
1420
1383
|
});
|
|
1421
1384
|
}
|
|
1422
1385
|
|
|
1423
|
-
code += indent(state
|
|
1386
|
+
code += indent((state?.tabSize || 0)) + '}\n';
|
|
1424
1387
|
|
|
1425
1388
|
return code;
|
|
1426
1389
|
}
|
|
@@ -1448,10 +1411,15 @@ export class Logic extends BaseNode {
|
|
|
1448
1411
|
path = `/api/${entityName.replace('-', '_')}/${logicName}`;
|
|
1449
1412
|
} else if (concept === 'Namespace') {
|
|
1450
1413
|
serviceType = 'entity';
|
|
1451
|
-
|
|
1414
|
+
let entityPath = entityName.replace(/[A-Z]/g, (char, index) => {
|
|
1452
1415
|
const lowerChar = char.toLowerCase();
|
|
1453
1416
|
return index === 0 ? lowerChar : `-${lowerChar}`;
|
|
1454
1417
|
});
|
|
1418
|
+
const dataSource = parentNode.getAncestor('DataSource');
|
|
1419
|
+
// 默认数据源不动,其他数据源需要拼接数据源信息
|
|
1420
|
+
if (dataSource && dataSource.name !== 'defaultDS') {
|
|
1421
|
+
entityPath = dataSource.name + '/' + entityPath;
|
|
1422
|
+
}
|
|
1455
1423
|
path = `/api/${entityPath}`;
|
|
1456
1424
|
switch (this.name) {
|
|
1457
1425
|
case 'get':
|
|
@@ -1513,33 +1481,33 @@ export class Logic extends BaseNode {
|
|
|
1513
1481
|
code += prependCode || '';
|
|
1514
1482
|
code += '\n';
|
|
1515
1483
|
this.variables.forEach((variable) => {
|
|
1516
|
-
code += indent(state
|
|
1484
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1517
1485
|
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1518
1486
|
code += ';\n';
|
|
1519
1487
|
});
|
|
1520
1488
|
|
|
1521
1489
|
this.returns.forEach((ret) => {
|
|
1522
|
-
code += indent(state
|
|
1490
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1523
1491
|
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1524
1492
|
code += ';\n';
|
|
1525
1493
|
});
|
|
1526
1494
|
|
|
1527
1495
|
if (!this.body.length && this.returns.length) {
|
|
1528
|
-
code += indent(state
|
|
1496
|
+
code += indent((state?.tabSize || 0) + 1) + `return ${this.returns[0].name};\n`;
|
|
1529
1497
|
} else {
|
|
1530
1498
|
this.body.forEach((item) => {
|
|
1531
|
-
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
1499
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1532
1500
|
code += '\n';
|
|
1533
1501
|
});
|
|
1534
1502
|
}
|
|
1535
1503
|
|
|
1536
1504
|
// 在body渲染完成之后把其余的节点放到下面
|
|
1537
1505
|
this.playground.forEach((item) => {
|
|
1538
|
-
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
1506
|
+
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1539
1507
|
code += '\n';
|
|
1540
1508
|
});
|
|
1541
1509
|
|
|
1542
|
-
code += indent(state
|
|
1510
|
+
code += indent((state?.tabSize || 0)) + '}';
|
|
1543
1511
|
code += '\n';
|
|
1544
1512
|
return code;
|
|
1545
1513
|
}
|
|
@@ -1572,33 +1540,33 @@ export class Logic extends BaseNode {
|
|
|
1572
1540
|
code += '{\n';
|
|
1573
1541
|
|
|
1574
1542
|
this.variables.forEach((variable) => {
|
|
1575
|
-
code += indent(state
|
|
1543
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1576
1544
|
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1577
1545
|
code += ';\n';
|
|
1578
1546
|
});
|
|
1579
1547
|
|
|
1580
1548
|
this.returns.forEach((ret) => {
|
|
1581
|
-
code += indent(state
|
|
1549
|
+
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1582
1550
|
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1583
1551
|
code += ';\n';
|
|
1584
1552
|
});
|
|
1585
1553
|
|
|
1586
1554
|
if (!this.body.length && this.returns.length) {
|
|
1587
|
-
code += indent(state
|
|
1555
|
+
code += indent((state?.tabSize || 0) + 1) + `return ${this.returns[0].name};\n`;
|
|
1588
1556
|
} else {
|
|
1589
1557
|
this.body.forEach((item) => {
|
|
1590
|
-
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
1558
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1591
1559
|
code += '\n';
|
|
1592
1560
|
});
|
|
1593
1561
|
}
|
|
1594
1562
|
|
|
1595
1563
|
// 在body渲染完成之后把其余的节点放到下面
|
|
1596
1564
|
this.playground.forEach((item) => {
|
|
1597
|
-
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
1565
|
+
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1598
1566
|
code += '\n';
|
|
1599
1567
|
});
|
|
1600
1568
|
|
|
1601
|
-
code += indent(state
|
|
1569
|
+
code += indent((state?.tabSize || 0)) + '}';
|
|
1602
1570
|
if (prefix === 'inObject') {
|
|
1603
1571
|
code += `,`;
|
|
1604
1572
|
}
|
|
@@ -1608,36 +1576,34 @@ export class Logic extends BaseNode {
|
|
|
1608
1576
|
|
|
1609
1577
|
getNamespace(): string {
|
|
1610
1578
|
if (this.parentNode) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1579
|
+
const parentNamespace = (this.parentNode as any)?.getNamespace();
|
|
1580
|
+
const parentName = this.parentNode.name;
|
|
1581
|
+
const arr = [parentNamespace];
|
|
1582
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1583
|
+
arr.push(parentName);
|
|
1614
1584
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
=
|
|
1618
|
-
if (this.parentNode instanceof View) {
|
|
1619
|
-
return (parentNodeNamespace = '');
|
|
1585
|
+
let namespace = arr.join('.');
|
|
1586
|
+
if (!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process'].includes(namespace) && !namespace.includes('.logics')) {
|
|
1587
|
+
namespace = `${namespace}.logics`;
|
|
1620
1588
|
}
|
|
1621
|
-
return
|
|
1589
|
+
return namespace;
|
|
1622
1590
|
} else
|
|
1623
1591
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1624
1592
|
}
|
|
1625
1593
|
|
|
1626
1594
|
getTsNamespace(): string {
|
|
1627
1595
|
if (this.parentNode) {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1596
|
+
const parentNamespace = (this.parentNode as any)?.getTsNamespace();
|
|
1597
|
+
const parentName = this.parentNode.tsName || this.parentNode.name;
|
|
1598
|
+
const arr = [parentNamespace];
|
|
1599
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1600
|
+
arr.push(parentName);
|
|
1633
1601
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
=
|
|
1637
|
-
if (this.parentNode instanceof View) {
|
|
1638
|
-
return (parentNodeNamespace = '');
|
|
1602
|
+
let namespace = arr.join('.');
|
|
1603
|
+
if (!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process'].includes(namespace) && !namespace.includes('.logics')) {
|
|
1604
|
+
namespace = `${namespace}.logics`;
|
|
1639
1605
|
}
|
|
1640
|
-
return
|
|
1606
|
+
return namespace;
|
|
1641
1607
|
} else
|
|
1642
1608
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1643
1609
|
}
|
|
@@ -1736,7 +1702,7 @@ export class Logic extends BaseNode {
|
|
|
1736
1702
|
//================================================================================
|
|
1737
1703
|
}
|
|
1738
1704
|
|
|
1739
|
-
classMap
|
|
1705
|
+
classMap.Logic = Logic;
|
|
1740
1706
|
export default Logic;
|
|
1741
1707
|
//================================================================================
|
|
1742
1708
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|