@lcap/nasl 2.18.0-beta.3 → 2.18.0-beta.5
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/bak/translator.js +1 -1
- package/out/bak/translator.js.map +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +4 -4
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.js +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +2 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Return__.js +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +16 -16
- package/out/concepts/StringInterpolation__.js +12 -12
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/View__.js +2 -2
- package/out/concepts/View__.js.map +1 -1
- package/out/generator/genReleaseBody.js +1 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/server/naslServer.d.ts +2 -1
- package/out/server/naslServer.js +92 -40
- package/out/server/naslServer.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -2
- package/out/templator/genQueryComponent.js +4 -1
- package/out/templator/genQueryComponent.js.map +1 -1
- package/package.json +2 -3
- package/src/bak/translator.js +1 -1
- package/src/concepts/CallInterface__.ts +9 -9
- package/src/concepts/Destination__.ts +9 -9
- package/src/concepts/ExternalDestination__.ts +5 -5
- package/src/concepts/LogicItem__.ts +4 -0
- package/src/concepts/Logic__.ts +42 -5
- package/src/concepts/Match__.ts +21 -1
- package/src/concepts/MemberExpression__.ts +11 -0
- package/src/concepts/OqlQueryComponent__.ts +7 -0
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Return__.ts +5 -1
- package/src/concepts/StringInterpolation__.ts +26 -26
- package/src/concepts/UnaryExpression__.ts +4 -4
- package/src/concepts/ValidationRule__.ts +1 -1
- package/src/concepts/Variable__.ts +1 -1
- package/src/concepts/ViewElement__.ts +1 -1
- package/src/concepts/View__.ts +2 -2
- package/src/generator/genReleaseBody.ts +1 -1
- package/src/server/naslServer.ts +91 -41
- package/src/templator/genQueryComponent.ts +8 -3
- package/ts-worker/lib/cancellationToken.js +67 -0
- package/ts-worker/lib/harness.js +1 -1
- package/ts-worker/src/start.js +1 -1
- package/ts-worker/webpack.config.js +3 -1
|
@@ -66,7 +66,7 @@ export class Destination extends LogicItem {
|
|
|
66
66
|
@property()
|
|
67
67
|
target: string = '_self';
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @param source 需要合并的部分参数
|
|
@@ -81,7 +81,7 @@ export class Destination extends LogicItem {
|
|
|
81
81
|
return super.from(source, parentNode, parentKey) as Destination;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
/**
|
|
86
86
|
* 设置viewNamespace
|
|
87
87
|
*/
|
|
@@ -133,9 +133,9 @@ export class Destination extends LogicItem {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* 插入实际参数
|
|
@@ -169,7 +169,7 @@ export class Destination extends LogicItem {
|
|
|
169
169
|
return argument;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* 插入实际参数
|
|
@@ -193,7 +193,7 @@ export class Destination extends LogicItem {
|
|
|
193
193
|
return node;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* 添加实际参数
|
|
@@ -214,7 +214,7 @@ export class Destination extends LogicItem {
|
|
|
214
214
|
return this._insertArgumentAt(options as any, index);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* 添加实际参数
|
|
@@ -240,7 +240,7 @@ export class Destination extends LogicItem {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* 删除实际参数
|
|
@@ -253,7 +253,7 @@ export class Destination extends LogicItem {
|
|
|
253
253
|
return argument.delete();
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* 删除锚点参数
|
|
@@ -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
|
+
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
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
|
* 删除锚点参数
|
package/src/concepts/Logic__.ts
CHANGED
|
@@ -238,7 +238,7 @@ export class Logic extends BaseNode {
|
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
|
|
242
242
|
const excludedSet = new Set(excludedList);
|
|
243
243
|
return ((this.typeParams as TypeParam[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
244
244
|
}
|
|
@@ -379,6 +379,7 @@ export class Logic extends BaseNode {
|
|
|
379
379
|
return node;
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
|
|
382
383
|
getParamUniqueName(name = 'param1') {
|
|
383
384
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
384
385
|
}
|
|
@@ -516,6 +517,7 @@ export class Logic extends BaseNode {
|
|
|
516
517
|
return node;
|
|
517
518
|
}
|
|
518
519
|
|
|
520
|
+
|
|
519
521
|
getReturnUniqueName(name = 'result') {
|
|
520
522
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
521
523
|
}
|
|
@@ -653,6 +655,7 @@ export class Logic extends BaseNode {
|
|
|
653
655
|
return node;
|
|
654
656
|
}
|
|
655
657
|
|
|
658
|
+
|
|
656
659
|
getVariableUniqueName(name = 'variable1') {
|
|
657
660
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
658
661
|
}
|
|
@@ -790,6 +793,11 @@ export class Logic extends BaseNode {
|
|
|
790
793
|
return node;
|
|
791
794
|
}
|
|
792
795
|
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
793
801
|
/**
|
|
794
802
|
* 插入逻辑项
|
|
795
803
|
* @internal
|
|
@@ -822,6 +830,8 @@ export class Logic extends BaseNode {
|
|
|
822
830
|
return logicItem;
|
|
823
831
|
}
|
|
824
832
|
|
|
833
|
+
|
|
834
|
+
|
|
825
835
|
/**
|
|
826
836
|
* 插入逻辑项
|
|
827
837
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -844,6 +854,8 @@ export class Logic extends BaseNode {
|
|
|
844
854
|
return node;
|
|
845
855
|
}
|
|
846
856
|
|
|
857
|
+
|
|
858
|
+
|
|
847
859
|
/**
|
|
848
860
|
* 添加逻辑项
|
|
849
861
|
* @internal
|
|
@@ -863,6 +875,8 @@ export class Logic extends BaseNode {
|
|
|
863
875
|
return this._insertItemInBodyAt(options as any, index);
|
|
864
876
|
}
|
|
865
877
|
|
|
878
|
+
|
|
879
|
+
|
|
866
880
|
/**
|
|
867
881
|
* 添加逻辑项
|
|
868
882
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -886,6 +900,8 @@ export class Logic extends BaseNode {
|
|
|
886
900
|
return node;
|
|
887
901
|
}
|
|
888
902
|
|
|
903
|
+
|
|
904
|
+
|
|
889
905
|
/**
|
|
890
906
|
* 插入逻辑项
|
|
891
907
|
* @internal
|
|
@@ -918,6 +934,8 @@ export class Logic extends BaseNode {
|
|
|
918
934
|
return logicItem;
|
|
919
935
|
}
|
|
920
936
|
|
|
937
|
+
|
|
938
|
+
|
|
921
939
|
/**
|
|
922
940
|
* 插入逻辑项
|
|
923
941
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -940,6 +958,8 @@ export class Logic extends BaseNode {
|
|
|
940
958
|
return node;
|
|
941
959
|
}
|
|
942
960
|
|
|
961
|
+
|
|
962
|
+
|
|
943
963
|
/**
|
|
944
964
|
* 添加逻辑项
|
|
945
965
|
* @internal
|
|
@@ -959,6 +979,8 @@ export class Logic extends BaseNode {
|
|
|
959
979
|
return this._insertItemInPlaygroundAt(options as any, index);
|
|
960
980
|
}
|
|
961
981
|
|
|
982
|
+
|
|
983
|
+
|
|
962
984
|
/**
|
|
963
985
|
* 添加逻辑项
|
|
964
986
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -982,6 +1004,9 @@ export class Logic extends BaseNode {
|
|
|
982
1004
|
return node;
|
|
983
1005
|
}
|
|
984
1006
|
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
985
1010
|
/**
|
|
986
1011
|
* 删除事务
|
|
987
1012
|
* @param name 事务名称
|
|
@@ -1030,6 +1055,8 @@ export class Logic extends BaseNode {
|
|
|
1030
1055
|
return params;
|
|
1031
1056
|
}
|
|
1032
1057
|
|
|
1058
|
+
|
|
1059
|
+
|
|
1033
1060
|
/**
|
|
1034
1061
|
* 删除类型参数
|
|
1035
1062
|
* @param name 类型参数名称
|
|
@@ -1078,6 +1105,8 @@ export class Logic extends BaseNode {
|
|
|
1078
1105
|
return params;
|
|
1079
1106
|
}
|
|
1080
1107
|
|
|
1108
|
+
|
|
1109
|
+
|
|
1081
1110
|
/**
|
|
1082
1111
|
* 删除输入参数
|
|
1083
1112
|
* @param name 输入参数名称
|
|
@@ -1126,6 +1155,8 @@ export class Logic extends BaseNode {
|
|
|
1126
1155
|
return params;
|
|
1127
1156
|
}
|
|
1128
1157
|
|
|
1158
|
+
|
|
1159
|
+
|
|
1129
1160
|
/**
|
|
1130
1161
|
* 删除输出参数
|
|
1131
1162
|
* @param name 输出参数名称
|
|
@@ -1174,6 +1205,8 @@ export class Logic extends BaseNode {
|
|
|
1174
1205
|
return params;
|
|
1175
1206
|
}
|
|
1176
1207
|
|
|
1208
|
+
|
|
1209
|
+
|
|
1177
1210
|
/**
|
|
1178
1211
|
* 删除变量
|
|
1179
1212
|
* @param name 变量名称
|
|
@@ -1222,6 +1255,8 @@ export class Logic extends BaseNode {
|
|
|
1222
1255
|
return params;
|
|
1223
1256
|
}
|
|
1224
1257
|
|
|
1258
|
+
|
|
1259
|
+
|
|
1225
1260
|
/**
|
|
1226
1261
|
* 删除逻辑项
|
|
1227
1262
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1229,10 +1264,12 @@ export class Logic extends BaseNode {
|
|
|
1229
1264
|
removeItemInBody(logicItem: LogicItem): void;
|
|
1230
1265
|
|
|
1231
1266
|
removeItemInBody(options: LogicItem) {
|
|
1232
|
-
|
|
1267
|
+
let logicItem: LogicItem = options;
|
|
1233
1268
|
return logicItem.delete();
|
|
1234
1269
|
}
|
|
1235
1270
|
|
|
1271
|
+
|
|
1272
|
+
|
|
1236
1273
|
/**
|
|
1237
1274
|
* 删除逻辑项
|
|
1238
1275
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -1240,7 +1277,7 @@ export class Logic extends BaseNode {
|
|
|
1240
1277
|
removeItemInPlayground(logicItem: LogicItem): void;
|
|
1241
1278
|
|
|
1242
1279
|
removeItemInPlayground(options: LogicItem) {
|
|
1243
|
-
|
|
1280
|
+
let logicItem: LogicItem = options;
|
|
1244
1281
|
return logicItem.delete();
|
|
1245
1282
|
}
|
|
1246
1283
|
|
|
@@ -1747,14 +1784,14 @@ export class Logic extends BaseNode {
|
|
|
1747
1784
|
// 调用接口,参数替换成 null
|
|
1748
1785
|
if (rightNode instanceof CallInterface) {
|
|
1749
1786
|
const { _interface } = rightNode.getModuleInterface();
|
|
1750
|
-
return `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})
|
|
1787
|
+
return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
|
|
1751
1788
|
}
|
|
1752
1789
|
|
|
1753
1790
|
// 调用全局逻辑,参数替换成 null
|
|
1754
1791
|
if (rightNode instanceof CallLogic && rightNode.calleeNamespace === 'app.logics') {
|
|
1755
1792
|
const calleeName = rightNode?.calleeName;
|
|
1756
1793
|
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
1757
|
-
return `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})
|
|
1794
|
+
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
1758
1795
|
}
|
|
1759
1796
|
|
|
1760
1797
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
package/src/concepts/Match__.ts
CHANGED
|
@@ -49,6 +49,8 @@ export class Match extends LogicItem {
|
|
|
49
49
|
@property('MatchCase')
|
|
50
50
|
cases: Array<MatchCase> = [];
|
|
51
51
|
|
|
52
|
+
|
|
53
|
+
|
|
52
54
|
/**
|
|
53
55
|
* @param source 需要合并的部分参数
|
|
54
56
|
*/
|
|
@@ -62,6 +64,13 @@ export class Match extends LogicItem {
|
|
|
62
64
|
return super.from(source, parentNode, parentKey) as Match;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
65
74
|
/**
|
|
66
75
|
* 插入匹配分支
|
|
67
76
|
* @internal
|
|
@@ -94,6 +103,8 @@ export class Match extends LogicItem {
|
|
|
94
103
|
return matchCase;
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
|
|
107
|
+
|
|
97
108
|
/**
|
|
98
109
|
* 插入匹配分支
|
|
99
110
|
* @param matchCaseOptions 匹配分支参数
|
|
@@ -116,6 +127,8 @@ export class Match extends LogicItem {
|
|
|
116
127
|
return node;
|
|
117
128
|
}
|
|
118
129
|
|
|
130
|
+
|
|
131
|
+
|
|
119
132
|
/**
|
|
120
133
|
* 添加匹配分支
|
|
121
134
|
* @internal
|
|
@@ -135,6 +148,8 @@ export class Match extends LogicItem {
|
|
|
135
148
|
return this._insertMatchCaseAt(options as any, index);
|
|
136
149
|
}
|
|
137
150
|
|
|
151
|
+
|
|
152
|
+
|
|
138
153
|
/**
|
|
139
154
|
* 添加匹配分支
|
|
140
155
|
* @param matchCaseOptions 匹配分支参数
|
|
@@ -158,6 +173,9 @@ export class Match extends LogicItem {
|
|
|
158
173
|
return node;
|
|
159
174
|
}
|
|
160
175
|
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
161
179
|
/**
|
|
162
180
|
* 删除逻辑项
|
|
163
181
|
* @param name 逻辑项名称
|
|
@@ -183,6 +201,8 @@ export class Match extends LogicItem {
|
|
|
183
201
|
return expression.delete();
|
|
184
202
|
}
|
|
185
203
|
|
|
204
|
+
|
|
205
|
+
|
|
186
206
|
/**
|
|
187
207
|
* 删除匹配分支
|
|
188
208
|
* @param matchCase 已有的匹配分支实例
|
|
@@ -190,7 +210,7 @@ export class Match extends LogicItem {
|
|
|
190
210
|
removeMatchCaseInCases(matchCase: MatchCase): void;
|
|
191
211
|
|
|
192
212
|
removeMatchCaseInCases(options: MatchCase) {
|
|
193
|
-
|
|
213
|
+
let matchCase: MatchCase = options;
|
|
194
214
|
return matchCase.delete();
|
|
195
215
|
}
|
|
196
216
|
|
|
@@ -44,6 +44,8 @@ export class MemberExpression extends LogicItem {
|
|
|
44
44
|
@property('LogicItem')
|
|
45
45
|
property: LogicItem = undefined;
|
|
46
46
|
|
|
47
|
+
|
|
48
|
+
|
|
47
49
|
/**
|
|
48
50
|
* @param source 需要合并的部分参数
|
|
49
51
|
*/
|
|
@@ -57,6 +59,13 @@ export class MemberExpression extends LogicItem {
|
|
|
57
59
|
return super.from(source, parentNode, parentKey) as MemberExpression;
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
60
69
|
/**
|
|
61
70
|
* 删除逻辑项
|
|
62
71
|
* @param name 逻辑项名称
|
|
@@ -82,6 +91,8 @@ export class MemberExpression extends LogicItem {
|
|
|
82
91
|
return object.delete();
|
|
83
92
|
}
|
|
84
93
|
|
|
94
|
+
|
|
95
|
+
|
|
85
96
|
/**
|
|
86
97
|
* 删除逻辑项
|
|
87
98
|
* @param name 逻辑项名称
|
|
@@ -54,6 +54,8 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
54
54
|
@property()
|
|
55
55
|
dataSource: string = undefined;
|
|
56
56
|
|
|
57
|
+
|
|
58
|
+
|
|
57
59
|
/**
|
|
58
60
|
* @param source 需要合并的部分参数
|
|
59
61
|
*/
|
|
@@ -67,6 +69,7 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
67
69
|
return super.from(source, parentNode, parentKey) as OqlQueryComponent;
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
|
|
70
73
|
/**
|
|
71
74
|
* 设置SQL 查询
|
|
72
75
|
*/
|
|
@@ -79,6 +82,10 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
82
89
|
/**
|
|
83
90
|
* 删除类型标注
|
|
84
91
|
* @param name 类型标注名称
|
package/src/concepts/Param__.ts
CHANGED
|
@@ -292,7 +292,8 @@ export class Param extends BaseNode {
|
|
|
292
292
|
parsedValue = tryJSONParse(defaultValue) ?? defaultValue;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
code += `${this.name} || (this.$route.query.hasOwnProperty('${this.name}') ? this.$route.query.${this.name} : ${JSON.stringify(this.defaultValue)})`;
|
|
295
|
+
code += `${this.name} || (this.$route.query.hasOwnProperty('${this.name}') ? this.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}', this.$route.query.${this.name}) : ${JSON.stringify(this.defaultValue)})`;
|
|
296
|
+
|
|
296
297
|
if (needGenInitFromSchema) {
|
|
297
298
|
code += `)`;
|
|
298
299
|
}
|
|
@@ -303,7 +304,7 @@ export class Param extends BaseNode {
|
|
|
303
304
|
}
|
|
304
305
|
|
|
305
306
|
isEnum() {
|
|
306
|
-
return this.typeAnnotation?.typeNamespace
|
|
307
|
+
return this.typeAnnotation?.typeNamespace?.endsWith('.enums');
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
@withSourceMap()
|
package/src/concepts/Return__.ts
CHANGED
|
@@ -167,6 +167,10 @@ export class Return extends BaseNode {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
170
174
|
/**
|
|
171
175
|
* 删除类型标注
|
|
172
176
|
* @param name 类型标注名称
|
|
@@ -288,7 +292,7 @@ export class Return extends BaseNode {
|
|
|
288
292
|
return code;
|
|
289
293
|
}
|
|
290
294
|
isEnum() {
|
|
291
|
-
return this.typeAnnotation?.typeNamespace
|
|
295
|
+
return this.typeAnnotation?.typeNamespace?.endsWith('.enums');
|
|
292
296
|
}
|
|
293
297
|
@withSourceMap()
|
|
294
298
|
toEmbeddedTSInProcess(state?: TranslatorState): string {
|
|
@@ -58,12 +58,12 @@ export class StringInterpolation extends LogicItem {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
getItemExistingNames(excludedList: Array<LogicItem> = []) {
|
|
62
62
|
const excludedSet = new Set(excludedList);
|
|
63
63
|
return ((this.expressions as LogicItem[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
return utils.unique(name, this.
|
|
65
|
+
getItemUniqueName(name = 'logicItem1') {
|
|
66
|
+
return utils.unique(name, this.getItemExistingNames(), undefined, false);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -71,30 +71,30 @@ export class StringInterpolation extends LogicItem {
|
|
|
71
71
|
* @internal
|
|
72
72
|
* @param name 逻辑项名称,如果不填会自动生成一个唯一名称
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
_insertItemAt(name: string, index: number): LogicItem;
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* 插入逻辑项
|
|
78
78
|
* @internal
|
|
79
79
|
* @param logicItemOptions 逻辑项参数
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
_insertItemAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* 插入逻辑项
|
|
85
85
|
* @internal
|
|
86
86
|
* @param logicItem 已有的逻辑项实例
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
_insertItemAt(logicItem: LogicItem, index: number): LogicItem;
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
_insertItemAt(options: string | Partial<LogicItem> | LogicItem, index: number) {
|
|
91
91
|
const logicItemOptions: any = {};
|
|
92
92
|
const relationOptions = { parentNode: this, parentKey: 'expressions' };
|
|
93
93
|
let logicItem: LogicItem;
|
|
94
94
|
if (!options) {
|
|
95
95
|
logicItem = LogicItem.from({
|
|
96
96
|
...logicItemOptions,
|
|
97
|
-
name: this.
|
|
97
|
+
name: this.getItemUniqueName(),
|
|
98
98
|
}, this, 'expressions');
|
|
99
99
|
} else if (typeof options === 'string') {
|
|
100
100
|
logicItem = LogicItem.from({
|
|
@@ -119,22 +119,22 @@ export class StringInterpolation extends LogicItem {
|
|
|
119
119
|
* 插入逻辑项
|
|
120
120
|
* @param name 逻辑项名称,如果不填会自动生成一个唯一名称
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
insertItemAt(name: string, index: number): LogicItem;
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* 插入逻辑项
|
|
126
126
|
* @param logicItemOptions 逻辑项参数
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
insertItemAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* 插入逻辑项
|
|
132
132
|
* @param logicItem 已有的逻辑项实例
|
|
133
133
|
*/
|
|
134
|
-
|
|
134
|
+
insertItemAt(logicItem: LogicItem, index: number): LogicItem;
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
const node = this.
|
|
136
|
+
insertItemAt(options: string | Partial<LogicItem> | LogicItem, index: number) {
|
|
137
|
+
const node = this._insertItemAt(options as any, index);
|
|
138
138
|
node.create({
|
|
139
139
|
index,
|
|
140
140
|
parentNode: this,
|
|
@@ -148,25 +148,25 @@ export class StringInterpolation extends LogicItem {
|
|
|
148
148
|
* @internal
|
|
149
149
|
* @param name 逻辑项名称,如果不填会自动生成一个唯一名称
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
_addItem(name?: string): LogicItem;
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* 添加逻辑项
|
|
155
155
|
* @internal
|
|
156
156
|
* @param logicItemOptions 逻辑项参数
|
|
157
157
|
*/
|
|
158
|
-
|
|
158
|
+
_addItem(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* 添加逻辑项
|
|
162
162
|
* @internal
|
|
163
163
|
* @param logicItem 已有的逻辑项实例
|
|
164
164
|
*/
|
|
165
|
-
|
|
165
|
+
_addItem(logicItem: LogicItem): LogicItem;
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
_addItem(options?: string | Partial<LogicItem> | LogicItem) {
|
|
168
168
|
const index = this.expressions.length;
|
|
169
|
-
return this.
|
|
169
|
+
return this._insertItemAt(options as any, index);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/**
|
|
@@ -174,22 +174,22 @@ export class StringInterpolation extends LogicItem {
|
|
|
174
174
|
* @internal
|
|
175
175
|
* @param name 逻辑项名称,如果不填会自动生成一个唯一名称
|
|
176
176
|
*/
|
|
177
|
-
|
|
177
|
+
addItem(name?: string): LogicItem;
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* 添加逻辑项
|
|
181
181
|
* @param logicItemOptions 逻辑项参数
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
addItem(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
* 添加逻辑项
|
|
187
187
|
* @param logicItem 已有的逻辑项实例
|
|
188
188
|
*/
|
|
189
|
-
|
|
189
|
+
addItem(logicItem: LogicItem): LogicItem;
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
const node = this.
|
|
191
|
+
addItem(options?: string | Partial<LogicItem> | LogicItem) {
|
|
192
|
+
const node = this._addItem(options as any);
|
|
193
193
|
const index = this.expressions.indexOf(node);
|
|
194
194
|
node.create({
|
|
195
195
|
index,
|
|
@@ -206,15 +206,15 @@ export class StringInterpolation extends LogicItem {
|
|
|
206
206
|
* 删除逻辑项
|
|
207
207
|
* @param name 逻辑项名称
|
|
208
208
|
*/
|
|
209
|
-
|
|
209
|
+
removeItem(name: string): void;
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* 删除逻辑项
|
|
213
213
|
* @param logicItem 已有的逻辑项实例
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
removeItem(logicItem: LogicItem): void;
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
removeItem(options: string | LogicItem) {
|
|
218
218
|
let logicItem: LogicItem;
|
|
219
219
|
if (typeof options === 'string') {
|
|
220
220
|
logicItem = (this.expressions as LogicItem[]).find((item) => item.name === options);
|
|
@@ -37,7 +37,7 @@ export class UnaryExpression extends LogicItem {
|
|
|
37
37
|
@property()
|
|
38
38
|
operator: '!' | 'isNull' = undefined;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @param source 需要合并的部分参数
|
|
@@ -52,7 +52,7 @@ export class UnaryExpression extends LogicItem {
|
|
|
52
52
|
return super.from(source, parentNode, parentKey) as UnaryExpression;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
/**
|
|
57
57
|
* 设置参数
|
|
58
58
|
*/
|
|
@@ -68,9 +68,9 @@ export class UnaryExpression extends LogicItem {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* 删除逻辑项
|
|
@@ -3,6 +3,7 @@ import Function from './Function__';
|
|
|
3
3
|
import { ElementToVueOptions } from './ViewElement__';
|
|
4
4
|
import { getValidationInFunction } from '../server/getFunctions';
|
|
5
5
|
import defaultErrorMessage = require('../service/defaultErrorMessage.json');
|
|
6
|
+
import BindAttribute from './BindAttribute__';
|
|
6
7
|
|
|
7
8
|
//================================================================================
|
|
8
9
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -17,7 +18,6 @@ import BaseNode from '../common/BaseNode';
|
|
|
17
18
|
import classMap from '../common/classMap';
|
|
18
19
|
import Argument from './Argument__';
|
|
19
20
|
import LogicItem from './LogicItem__';
|
|
20
|
-
import BindAttribute from './BindAttribute__';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* 验证规则
|