@lcap/nasl 2.20.0-beta.4 → 2.20.1-beta.1
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/2.14-components.d.ts +1115 -0
- package/out/automate/engine/2.14-components.js +1087 -0
- package/out/automate/engine/2.14-components.js.map +1 -0
- package/out/automate/engine/operators.d.ts +0 -9
- package/out/automate/engine/viewCache.d.ts +0 -1
- package/out/automate/template/myProcess.d.ts +0 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +13 -0
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +9 -14
- package/out/concepts/Attribute__.js +12 -39
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +13 -6
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +8 -6
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +1 -1
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +1 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js +1 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +212 -0
- package/out/concepts/FrontendLibrary__.js +349 -0
- package/out/concepts/FrontendLibrary__.js.map +1 -0
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +26 -13
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +49 -49
- package/out/concepts/Module__.js +50 -50
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js +3 -0
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +16 -0
- package/out/concepts/Slot__.js +43 -0
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +1 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +1 -1
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +3 -0
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.d.ts +34 -0
- package/out/concepts/ViewBlock__.js +82 -0
- package/out/concepts/ViewBlock__.js.map +1 -0
- package/out/concepts/ViewComponent__.d.ts +85 -0
- package/out/concepts/ViewComponent__.js +104 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -0
- package/out/concepts/View__.js +13 -8
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/index__.d.ts +2 -0
- package/out/concepts/index__.js +2 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/config.d.ts +1 -1
- package/out/decorators/index.d.ts +2 -2
- package/out/generator/permission.d.ts +1 -1
- package/out/server/getLogics.js +12 -0
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -3
- package/out/server/getScope.d.ts +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +70 -36
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -1
- package/out/service/storage/init.js +1 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/translator/index.d.ts +1 -1
- package/out/translator/lsp.d.ts +3 -3
- package/out/utils/index.d.ts +4 -4
- package/package.json +1 -1
- package/src/concepts/App__.ts +13 -0
- package/src/concepts/Attribute__.ts +10 -59
- package/src/concepts/BindAttribute__.ts +11 -12
- package/src/concepts/BindDirective__.ts +16 -1
- package/src/concepts/BindStyle__.ts +16 -1
- package/src/concepts/CallLogic__.ts +12 -37
- package/src/concepts/ConfigProperty__.ts +8 -6
- package/src/concepts/Destination__.ts +19 -1
- package/src/concepts/ExternalDestination__.ts +6 -6
- package/src/concepts/FrontendLibrary__.ts +518 -0
- package/src/concepts/Frontend__.ts +12 -1
- package/src/concepts/Identifier__.ts +9 -0
- package/src/concepts/Logic__.ts +27 -14
- package/src/concepts/Module__.ts +92 -121
- package/src/concepts/Param__.ts +4 -0
- package/src/concepts/ProcessElement__.ts +23 -1
- package/src/concepts/Process__.ts +16 -1
- package/src/concepts/Return__.ts +2 -0
- package/src/concepts/Slot__.ts +55 -0
- package/src/concepts/StringInterpolation__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +9 -9
- package/src/concepts/Variable__.ts +2 -0
- package/src/concepts/ViewBlock__.ts +91 -0
- package/src/concepts/ViewComponent__.ts +199 -0
- package/src/concepts/View__.ts +39 -10
- package/src/concepts/index__.ts +2 -0
- package/src/server/getLogics.ts +13 -0
- package/src/server/naslServer.ts +66 -34
- package/src/server/translator.ts +1 -1
- package/src/service/storage/init.ts +1 -1
- package/yarn-error.log +2087 -0
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/BindAttribute__.js +0 -795
- package/src/concepts/dist/BindEvent__.js +0 -732
- package/src/concepts/dist/CallFunction__.js +0 -527
- package/src/concepts/dist/CallLogic__.js +0 -932
- package/src/concepts/dist/Destination__.js +0 -708
- package/src/concepts/dist/ExternalDestination__.js +0 -298
- package/src/concepts/dist/Identifier__.js +0 -311
- package/src/concepts/dist/StringInterpolation__.js +0 -231
- package/src/concepts/dist/TypeAnnotation__.js +0 -834
- package/src/concepts/dist/ViewElement__.js +0 -1692
- package/src/concepts/dist/View__.js +0 -1601
- package/src/generator/dist/genBundleFiles.js +0 -261
- package/src/generator/dist/genMetaData.js +0 -245
- package/src/generator/dist/permission.js +0 -405
- package/src/service/storage/dist/init.js +0 -579
- package/src/templator/dist/genEditTableBlock.js +0 -204
- package/src/templator/dist/genGridViewBlock.js +0 -265
- package/src/templator/dist/genListViewBlock.js +0 -84
- package/src/templator/dist/genTableBlock.js +0 -209
- package/src/templator/dist/utils.js +0 -527
package/src/concepts/View__.ts
CHANGED
|
@@ -266,6 +266,8 @@ export class View extends BaseNode {
|
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
|
|
270
|
+
|
|
269
271
|
/**
|
|
270
272
|
* 插入页面元素
|
|
271
273
|
* @internal
|
|
@@ -399,6 +401,7 @@ export class View extends BaseNode {
|
|
|
399
401
|
return node;
|
|
400
402
|
}
|
|
401
403
|
|
|
404
|
+
|
|
402
405
|
getParamUniqueName(name = 'param1') {
|
|
403
406
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
404
407
|
}
|
|
@@ -536,6 +539,7 @@ export class View extends BaseNode {
|
|
|
536
539
|
return node;
|
|
537
540
|
}
|
|
538
541
|
|
|
542
|
+
|
|
539
543
|
getVariableUniqueName(name = 'variable1') {
|
|
540
544
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
541
545
|
}
|
|
@@ -673,6 +677,7 @@ export class View extends BaseNode {
|
|
|
673
677
|
return node;
|
|
674
678
|
}
|
|
675
679
|
|
|
680
|
+
|
|
676
681
|
getLogicUniqueName(name = 'logic1') {
|
|
677
682
|
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
678
683
|
}
|
|
@@ -810,6 +815,7 @@ export class View extends BaseNode {
|
|
|
810
815
|
return node;
|
|
811
816
|
}
|
|
812
817
|
|
|
818
|
+
|
|
813
819
|
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
814
820
|
const excludedSet = new Set(excludedList);
|
|
815
821
|
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -951,6 +957,9 @@ export class View extends BaseNode {
|
|
|
951
957
|
return node;
|
|
952
958
|
}
|
|
953
959
|
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
954
963
|
getViewExistingNames(excludedList: Array<View> = []) {
|
|
955
964
|
const excludedSet = new Set(excludedList);
|
|
956
965
|
return ((this.children as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1092,8 +1101,12 @@ export class View extends BaseNode {
|
|
|
1092
1101
|
return node;
|
|
1093
1102
|
}
|
|
1094
1103
|
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1095
1107
|
/**
|
|
1096
1108
|
* 删除页面元素
|
|
1109
|
+
* @param name 页面元素名称
|
|
1097
1110
|
*/
|
|
1098
1111
|
removeViewElement(name: string): void;
|
|
1099
1112
|
|
|
@@ -1139,6 +1152,8 @@ export class View extends BaseNode {
|
|
|
1139
1152
|
return params;
|
|
1140
1153
|
}
|
|
1141
1154
|
|
|
1155
|
+
|
|
1156
|
+
|
|
1142
1157
|
/**
|
|
1143
1158
|
* 删除输入参数
|
|
1144
1159
|
* @param name 输入参数名称
|
|
@@ -1187,6 +1202,8 @@ export class View extends BaseNode {
|
|
|
1187
1202
|
return params;
|
|
1188
1203
|
}
|
|
1189
1204
|
|
|
1205
|
+
|
|
1206
|
+
|
|
1190
1207
|
/**
|
|
1191
1208
|
* 删除变量
|
|
1192
1209
|
* @param name 变量名称
|
|
@@ -1235,6 +1252,8 @@ export class View extends BaseNode {
|
|
|
1235
1252
|
return params;
|
|
1236
1253
|
}
|
|
1237
1254
|
|
|
1255
|
+
|
|
1256
|
+
|
|
1238
1257
|
/**
|
|
1239
1258
|
* 删除逻辑
|
|
1240
1259
|
* @param name 逻辑名称
|
|
@@ -1283,6 +1302,8 @@ export class View extends BaseNode {
|
|
|
1283
1302
|
return params;
|
|
1284
1303
|
}
|
|
1285
1304
|
|
|
1305
|
+
|
|
1306
|
+
|
|
1286
1307
|
/**
|
|
1287
1308
|
* 删除元素绑定事件
|
|
1288
1309
|
* @param name 元素绑定事件名称
|
|
@@ -1331,6 +1352,8 @@ export class View extends BaseNode {
|
|
|
1331
1352
|
return params;
|
|
1332
1353
|
}
|
|
1333
1354
|
|
|
1355
|
+
|
|
1356
|
+
|
|
1334
1357
|
/**
|
|
1335
1358
|
* 删除页面
|
|
1336
1359
|
* @param name 页面名称
|
|
@@ -1765,16 +1788,22 @@ export class View extends BaseNode {
|
|
|
1765
1788
|
// 子页面内部逻辑过滤
|
|
1766
1789
|
if (el.view !== this)
|
|
1767
1790
|
return;
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1791
|
+
if (el instanceof Assignment) {
|
|
1792
|
+
const advanceVar = this.variables?.find((variable) =>
|
|
1793
|
+
!variable.typeAnnotation && el.left?.name === variable.name);
|
|
1794
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1795
|
+
advanceMap.set(advanceVar, el);
|
|
1796
|
+
}
|
|
1797
|
+
} else if (el instanceof BatchAssignment) {
|
|
1798
|
+
el.assignmentLines.forEach(({ leftIndex }) => {
|
|
1799
|
+
const leftCode
|
|
1800
|
+
= leftIndex.length === 1 ? el.left?.expression?.toEmbeddedTS(shiftState(state, code, { inline: true })) : el.left?.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1801
|
+
const advanceVar = this.variables?.find((variable) =>
|
|
1802
|
+
!variable.typeAnnotation && leftCode === variable.name);
|
|
1803
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1804
|
+
advanceMap.set(advanceVar, el);
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1778
1807
|
}
|
|
1779
1808
|
}
|
|
1780
1809
|
});
|
package/src/concepts/index__.ts
CHANGED
package/src/server/getLogics.ts
CHANGED
|
@@ -226,6 +226,19 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
226
226
|
}));
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
app.dependencies.forEach((item) => {
|
|
230
|
+
const fed = item.frontends.find((item) => item.type === node?.frontend?.type);
|
|
231
|
+
if (fed?.logics.length > 0) {
|
|
232
|
+
systemTree.children.push(new Namespace({
|
|
233
|
+
name: 'category',
|
|
234
|
+
path: 'dependencies',
|
|
235
|
+
title: item.name,
|
|
236
|
+
logics: fed.logics,
|
|
237
|
+
expanded: false,
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
229
242
|
if (!app.processes.length)
|
|
230
243
|
systemTree.children.shift();
|
|
231
244
|
|
package/src/server/naslServer.ts
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
Frontend,
|
|
65
65
|
NewList,
|
|
66
66
|
NewMap,
|
|
67
|
+
FrontendLibrary,
|
|
67
68
|
ConfigProperty,
|
|
68
69
|
BindStyle,
|
|
69
70
|
BindDirective,
|
|
@@ -298,33 +299,49 @@ export class NaslServer {
|
|
|
298
299
|
} catch (err) {
|
|
299
300
|
}
|
|
300
301
|
});
|
|
301
|
-
(module
|
|
302
|
-
|
|
303
|
-
const result = frontend.toEmbeddedTSFile();
|
|
304
|
-
results.push(result);
|
|
305
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
306
|
-
frontend.sourceMap = result.sourceMap;
|
|
307
|
-
this.file2NodeMap.set(result.filePath, frontend);
|
|
308
|
-
} catch (err) {
|
|
309
|
-
console.log(err);
|
|
310
|
-
}
|
|
311
|
-
frontend.variables?.forEach((frontendVariable) => {
|
|
302
|
+
if (module instanceof App) {
|
|
303
|
+
module.frontends?.forEach((frontend) => {
|
|
312
304
|
try {
|
|
313
|
-
const result =
|
|
305
|
+
const result = frontend.toEmbeddedTSFile();
|
|
314
306
|
results.push(result);
|
|
315
307
|
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
316
|
-
|
|
317
|
-
this.file2NodeMap.set(result.filePath,
|
|
308
|
+
frontend.sourceMap = result.sourceMap;
|
|
309
|
+
this.file2NodeMap.set(result.filePath, frontend);
|
|
318
310
|
} catch (err) {
|
|
319
311
|
console.log(err);
|
|
320
312
|
}
|
|
313
|
+
frontend.variables?.forEach((frontendVariable) => {
|
|
314
|
+
try {
|
|
315
|
+
const result = frontendVariable.toEmbeddedTSFile();
|
|
316
|
+
results.push(result);
|
|
317
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
318
|
+
frontendVariable.sourceMap = result.sourceMap;
|
|
319
|
+
this.file2NodeMap.set(result.filePath, frontendVariable);
|
|
320
|
+
} catch (err) {
|
|
321
|
+
console.log(err);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
// view的生成
|
|
325
|
+
if (!config.closeViews) {
|
|
326
|
+
this.view2TSFile(frontend.views, results);
|
|
327
|
+
}
|
|
328
|
+
frontend.componentDependencies?.forEach((item) => this.contentToFile(item, results));
|
|
321
329
|
});
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
330
|
+
} else {
|
|
331
|
+
module.frontends?.forEach((frontend) => {
|
|
332
|
+
try {
|
|
333
|
+
frontend.logics.forEach((logic) => {
|
|
334
|
+
const result = logic.toEmbeddedTSFile();
|
|
335
|
+
results.push(result);
|
|
336
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
337
|
+
logic.sourceMap = result.sourceMap;
|
|
338
|
+
this.file2NodeMap.set(result.filePath, logic);
|
|
339
|
+
});
|
|
340
|
+
} catch (err) {
|
|
341
|
+
console.log(err);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
328
345
|
|
|
329
346
|
(module as App).dataSources?.forEach((dataSource) => {
|
|
330
347
|
// 本身dataSource也要生成一个文件用于改名
|
|
@@ -1104,7 +1121,7 @@ export class NaslServer {
|
|
|
1104
1121
|
if (Array.isArray(body) && body.length) {
|
|
1105
1122
|
const lastExpression = body[body.length - 1];
|
|
1106
1123
|
diagnostic.node = lastExpression;
|
|
1107
|
-
diagnostic.message =
|
|
1124
|
+
diagnostic.message = `匹配:该分支类型与多数类型不一致,将产生Union类型。当前类型:${typeAnnotation?.headTitle},多数类型:${maxTypeAnnotation?.headTitle}`;
|
|
1108
1125
|
this.baseNodeAssignmentTsError(lastExpression, diagnostic);
|
|
1109
1126
|
diagnostics.push(diagnostic);
|
|
1110
1127
|
}
|
|
@@ -1378,7 +1395,12 @@ export class NaslServer {
|
|
|
1378
1395
|
if (node.logic && node.logic !== nodeIn.logic)
|
|
1379
1396
|
return;
|
|
1380
1397
|
// 跟变量无关的赋值过滤
|
|
1381
|
-
|
|
1398
|
+
let jsCode = '';
|
|
1399
|
+
try {
|
|
1400
|
+
jsCode = nodeIn.toJS();
|
|
1401
|
+
} catch (err) {
|
|
1402
|
+
console.log(err);
|
|
1403
|
+
}
|
|
1382
1404
|
if (!jsCode.includes(`${node.name} = `))
|
|
1383
1405
|
return;
|
|
1384
1406
|
// 页面局部变量
|
|
@@ -1551,16 +1573,24 @@ export class NaslServer {
|
|
|
1551
1573
|
fileNode?.sourceMap.forEach((valueIn, nodeIn) => {
|
|
1552
1574
|
if (!used && nodeIn
|
|
1553
1575
|
&& (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1576
|
+
) {
|
|
1577
|
+
let jsCode = '';
|
|
1578
|
+
try {
|
|
1579
|
+
jsCode = nodeIn.toJS();
|
|
1580
|
+
} catch (err) {
|
|
1581
|
+
console.log(err);
|
|
1582
|
+
}
|
|
1583
|
+
if (jsCode.includes(`${node.name} = `)) {
|
|
1584
|
+
used = true;
|
|
1585
|
+
if (!nodeIn.tsErrorDetail) {
|
|
1586
|
+
const diagnostic = {
|
|
1587
|
+
node: nodeIn,
|
|
1588
|
+
severity: 'error',
|
|
1589
|
+
message: `${nodeIn.label}左边 ${node.name} 未设置类型,右边必须为有返回值的内容。`,
|
|
1590
|
+
};
|
|
1591
|
+
nodeIn.tsErrorDetail = diagnostic;
|
|
1592
|
+
diagnostics.push(diagnostic);
|
|
1593
|
+
}
|
|
1564
1594
|
}
|
|
1565
1595
|
}
|
|
1566
1596
|
});
|
|
@@ -1762,6 +1792,7 @@ export class NaslServer {
|
|
|
1762
1792
|
'nasl.collection.Map<nasl.core.String, nasl.core.String>',
|
|
1763
1793
|
'nasl.collection.Map<nasl.core.String, nasl.core.Text>',
|
|
1764
1794
|
'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
|
|
1795
|
+
'nasl.collection.List<>',
|
|
1765
1796
|
];
|
|
1766
1797
|
// 先特殊处理等 类型合并后就可以去掉了
|
|
1767
1798
|
if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
|
|
@@ -2775,6 +2806,7 @@ export class NaslServer {
|
|
|
2775
2806
|
&& !(fileNode.parentNode instanceof App)
|
|
2776
2807
|
&& !(fileNode.parentNode instanceof Module)
|
|
2777
2808
|
&& !(fileNode.parentNode instanceof DataSource)
|
|
2809
|
+
&& !(fileNode.parentNode instanceof Frontend)
|
|
2778
2810
|
&& !(fileNode instanceof View)
|
|
2779
2811
|
&& !(fileNode instanceof ConfigProperty)
|
|
2780
2812
|
) {
|
|
@@ -3040,9 +3072,9 @@ export class NaslServer {
|
|
|
3040
3072
|
}
|
|
3041
3073
|
args.push(fileDetail);
|
|
3042
3074
|
});
|
|
3043
|
-
console.time('请求');
|
|
3075
|
+
// console.time('请求');
|
|
3044
3076
|
const resultMap: any = (await this.getNaslNodeTypeFull(args)).response;
|
|
3045
|
-
console.timeEnd('请求');
|
|
3077
|
+
// console.timeEnd('请求');
|
|
3046
3078
|
|
|
3047
3079
|
// console.log(resultMap);
|
|
3048
3080
|
|
package/src/server/translator.ts
CHANGED
|
@@ -537,7 +537,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
537
537
|
// 赋值左右侧类型不一致, 把文字换一下
|
|
538
538
|
if (/Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text)) {
|
|
539
539
|
if (node instanceof OqlQueryComponent) {
|
|
540
|
-
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '类型不一致!传入类型:').replace('接收类型:', '
|
|
540
|
+
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '类型不一致!传入类型:').replace('接收类型:', '期望类型:');
|
|
541
541
|
} else if (node.parentNode instanceof Assignment) {
|
|
542
542
|
// OQL 的返回类型报错需要转换翻译,其内部 SQL 语句的参数类型报错不转换翻译
|
|
543
543
|
if (node instanceof OqlQueryComponent) {
|
|
@@ -318,7 +318,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
318
318
|
undo: '已撤销操作:',
|
|
319
319
|
redo: '已重做操作:',
|
|
320
320
|
};
|
|
321
|
-
let msg = actionMap[action as 'undo' | 'redo'];
|
|
321
|
+
let msg = actionMap[action as 'undo' | 'redo'] || '';
|
|
322
322
|
msg += actionMsg;
|
|
323
323
|
Vue.prototype.$toast.info(msg);
|
|
324
324
|
app._historying = false;
|