@lcap/nasl 2.18.0-beta.6 → 2.18.0-beta.7
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/common/BaseNode.js +1 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +63 -46
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -1
- package/out/concepts/CallLogic__.js +26 -11
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +2 -1
- package/out/concepts/Destination__.js +90 -22
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/Logic__.js +6 -7
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchExpression__.d.ts +97 -0
- package/out/concepts/MatchExpression__.js +281 -0
- package/out/concepts/MatchExpression__.js.map +1 -0
- package/out/concepts/ViewElement__.js +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +4 -0
- package/out/concepts/View__.js.map +1 -1
- package/out/generator/genBundleFiles.js +27 -181
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +1 -10
- package/out/generator/genMetaData.js +189 -50
- package/out/generator/genMetaData.js.map +1 -1
- package/out/server/extendBaseNode.js +4 -18
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +2 -1
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/naslServer.js +5 -6
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +19 -4
- package/out/server/translator.js.map +1 -1
- package/out/templator/sql-parser/index.d.ts +1 -0
- package/out/templator/sql-parser/index.js +228 -0
- package/out/templator/sql-parser/index.js.map +1 -0
- package/out/templator/sql-parser/parser.js +26664 -0
- package/out/templator/sql-parser/parser.js.map +1 -0
- package/package.json +2 -2
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/nasl.util.ts +1 -1
- package/src/automate/engine/dist/index.dev.js +517 -0
- package/src/common/BaseNode.ts +1 -0
- package/src/common/dist/BaseNode.js +1101 -0
- package/src/concepts/BatchAssignment__.ts +66 -50
- package/src/concepts/CallLogic__.ts +26 -11
- package/src/concepts/Destination__.ts +92 -22
- package/src/concepts/Logic__.ts +6 -7
- package/src/concepts/ViewElement__.ts +8 -29
- package/src/concepts/View__.ts +4 -0
- package/src/concepts/basics/stdlib/dist/nasl.util.js +1503 -0
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
- package/src/concepts/dist/Anchor__.js +179 -0
- package/src/concepts/dist/Assignment__.js +301 -0
- package/src/concepts/dist/CallFunction__.js +513 -0
- package/src/concepts/dist/CallInterface__.js +533 -0
- package/src/concepts/dist/CallLogic__.js +892 -0
- package/src/concepts/dist/ForEachStatement__.js +426 -0
- package/src/concepts/dist/MatchCase__.js +587 -0
- package/src/concepts/dist/Match__.js +631 -0
- package/src/concepts/dist/MemberExpression__.js +348 -0
- package/src/concepts/dist/Param__.js +538 -0
- package/src/concepts/dist/Return__.js +494 -0
- package/src/concepts/dist/Variable__.js +537 -0
- package/src/concepts/dist/ViewElement__.js +1680 -0
- package/src/generator/dist/genBundleFiles.js +261 -0
- package/src/generator/dist/genMetaData.js +249 -0
- package/src/generator/genBundleFiles.ts +29 -218
- package/src/generator/genMetaData.ts +182 -77
- package/src/server/dist/formatTsUtils.js +683 -0
- package/src/server/dist/naslServer.js +3474 -0
- package/src/server/extendBaseNode.ts +4 -19
- package/src/server/formatTsUtils.ts +2 -1
- package/src/server/naslServer.ts +5 -6
- package/src/server/translator.ts +18 -4
- package/src/service/storage/dist/init.js +572 -0
- package/ts-worker/dist/webpack.config.dev.js +108 -0
- package/dist/bundle.js +0 -3962
- package/dist/bundle.js.LICENSE.txt +0 -16
- package/out/generator/release.d.ts +0 -1
- package/out/generator/release.js +0 -51
- package/out/generator/release.js.map +0 -1
|
@@ -161,19 +161,6 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
161
161
|
refsList = refsList.filter((item) =>
|
|
162
162
|
// 因为ui组件本身会多渲染一次,就先过滤一个
|
|
163
163
|
!(item.lineText.includes(': nasl.ui.')));
|
|
164
|
-
// 删除参数单独处理
|
|
165
|
-
if (node instanceof Param) {
|
|
166
|
-
const methodRefs: tsProtocol.ReferencesResponseItem[] = [];
|
|
167
|
-
refsList.forEach((item) => {
|
|
168
|
-
// 入参查找引用,查到logic 和自己,内容完全一样,就保留一个
|
|
169
|
-
const find = methodRefs.find((findItem) => item.lineText === findItem.lineText);
|
|
170
|
-
if (!find) {
|
|
171
|
-
methodRefs.push(item);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
refsList = methodRefs;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
164
|
// delete的弹框展示
|
|
178
165
|
const confirmParms = {
|
|
179
166
|
actionType: 'delete',
|
|
@@ -182,7 +169,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
182
169
|
icon: 'warning',
|
|
183
170
|
};
|
|
184
171
|
let callback = null;
|
|
185
|
-
if (refsList.length <= 1) {
|
|
172
|
+
if (refsList.length <= 1 || (node instanceof Param && node.parentNode instanceof Logic && refsList.length <= 2)) {
|
|
186
173
|
// 页面组件直接删除然后return
|
|
187
174
|
if (node instanceof ViewElement) {
|
|
188
175
|
this.delete();
|
|
@@ -235,6 +222,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
235
222
|
App.emit('collect:start', {
|
|
236
223
|
actionMsg: '删除参数',
|
|
237
224
|
});
|
|
225
|
+
const Index = node.getIndexOfParent();
|
|
238
226
|
this.delete();
|
|
239
227
|
refsList.forEach((record) => {
|
|
240
228
|
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
@@ -242,11 +230,8 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
242
230
|
return null;
|
|
243
231
|
const minRange: MinRange = naslServer._findMinRange(record, fileNode as FileNode);
|
|
244
232
|
if (minRange) {
|
|
245
|
-
if (minRange.node instanceof CallLogic) {
|
|
246
|
-
minRange.node.
|
|
247
|
-
}
|
|
248
|
-
if (minRange.node instanceof Destination) {
|
|
249
|
-
minRange.node.setViewArgument(parentNode as View);
|
|
233
|
+
if (minRange.node instanceof CallLogic || minRange.node instanceof Destination) {
|
|
234
|
+
minRange.node.deleteCalleeArg(Index);
|
|
250
235
|
}
|
|
251
236
|
}
|
|
252
237
|
});
|
|
@@ -505,8 +505,9 @@ export function formatVariableData(data: unknown | variableItem[], node: BaseNod
|
|
|
505
505
|
item.typeKey = typeKey;
|
|
506
506
|
} else {
|
|
507
507
|
item.value = `${parent.value}.${item.name}`;
|
|
508
|
+
const object: any = BaseNode.from(parent.expression.toJSON());
|
|
508
509
|
const memberExpression = new MemberExpression({
|
|
509
|
-
object
|
|
510
|
+
object,
|
|
510
511
|
property: new Identifier({ name: item.name }),
|
|
511
512
|
});
|
|
512
513
|
item.expression = memberExpression;
|
package/src/server/naslServer.ts
CHANGED
|
@@ -1035,6 +1035,9 @@ export class NaslServer {
|
|
|
1035
1035
|
// 子页面内部逻辑过滤
|
|
1036
1036
|
if (nodeIn.view !== fileNode)
|
|
1037
1037
|
return;
|
|
1038
|
+
// 当局部变量、输出参数属于页面内逻辑时,需过滤同页面下不同逻辑下的同名变量
|
|
1039
|
+
if (node.logic && node.logic !== nodeIn.logic)
|
|
1040
|
+
return;
|
|
1038
1041
|
// 跟变量无关的赋值过滤
|
|
1039
1042
|
const jsCode = nodeIn.toJS();
|
|
1040
1043
|
if (!jsCode.includes(`${node.name} = `))
|
|
@@ -1983,12 +1986,8 @@ export class NaslServer {
|
|
|
1983
1986
|
const minRange: MinRange = this._findMinRange(record, fileNode as FileNode);
|
|
1984
1987
|
if (minRange) {
|
|
1985
1988
|
// 如果找到节点是callLogic就去更新
|
|
1986
|
-
if (minRange.node instanceof CallLogic && node instanceof Param) {
|
|
1987
|
-
minRange.node.
|
|
1988
|
-
}
|
|
1989
|
-
// 如果节点参数增加页面也要更新
|
|
1990
|
-
if (minRange.node instanceof Destination && node instanceof Param) {
|
|
1991
|
-
minRange.node.setViewArgument(parantNode as View);
|
|
1989
|
+
if ((minRange.node instanceof CallLogic || minRange.node instanceof Destination) && node instanceof Param) {
|
|
1990
|
+
minRange.node.addCalleeArg(parantNode as any);
|
|
1992
1991
|
}
|
|
1993
1992
|
}
|
|
1994
1993
|
});
|
package/src/server/translator.ts
CHANGED
|
@@ -86,6 +86,8 @@ function transformType(tsType: string): string {
|
|
|
86
86
|
return '无返回值';
|
|
87
87
|
else if (tsType === '__elements')
|
|
88
88
|
return '页面元素';
|
|
89
|
+
else if (tsType === '__unknown__')
|
|
90
|
+
return '无效';
|
|
89
91
|
else if (tsType === 'extensions')
|
|
90
92
|
return '拓展模块';
|
|
91
93
|
else if (tsType === 'Promise<void>')
|
|
@@ -173,8 +175,13 @@ const TS_RULES: Array<{
|
|
|
173
175
|
}> = [
|
|
174
176
|
{
|
|
175
177
|
re: /Object literal may only specify known properties, and '(.+?)' does not exist in type/,
|
|
176
|
-
result: '当前参数$1
|
|
177
|
-
transforms: [
|
|
178
|
+
result: '当前参数$1,不可用。',
|
|
179
|
+
transforms: [transformType],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
re: /Object literal may only specify known properties, but '(.+?)' does not exist in type/,
|
|
183
|
+
result: '当前参数$1,不可用。',
|
|
184
|
+
transforms: [transformType],
|
|
178
185
|
},
|
|
179
186
|
{
|
|
180
187
|
re: /Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/,
|
|
@@ -494,8 +501,15 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
494
501
|
}
|
|
495
502
|
// 赋值左右侧类型不一致, 把文字换一下
|
|
496
503
|
if (/Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text) && node.parentNode instanceof Assignment) {
|
|
497
|
-
//
|
|
498
|
-
|
|
504
|
+
// OQL 的返回类型报错需要转换翻译,其内部 SQL 语句的参数类型报错不转换翻译
|
|
505
|
+
if (node instanceof OqlQueryComponent) {
|
|
506
|
+
if ((node.getCurrentSource().currentSource.range.start.line + 1) === tsErrorDetail.originalDiagnostic.start.line) {
|
|
507
|
+
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '赋值:类型不一致!右边类型:').replace('接收类型:', '左边类型:');
|
|
508
|
+
}
|
|
509
|
+
} else {
|
|
510
|
+
// node = node.getAncestor('CallLogic');
|
|
511
|
+
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '赋值:类型不一致!右边类型:').replace('接收类型:', '左边类型:');
|
|
512
|
+
}
|
|
499
513
|
}
|
|
500
514
|
if (node instanceof Argument || node instanceof Anchor) {
|
|
501
515
|
// if (/Type '(.+?)' is not assignable to type '(.+?)'./.exec(text)) {
|