@lcap/nasl 0.3.12-beta.1 → 0.3.12-beta.4
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/service/logic/checktypeSocket.d.ts +5 -0
- package/out/service/logic/checktypeSocket.js +55 -0
- package/out/service/logic/checktypeSocket.js.map +1 -0
- package/out/service/logic/index.d.ts +3 -0
- package/out/service/logic/index.js +4 -1
- package/out/service/logic/index.js.map +1 -1
- package/out/types/app/App.d.ts +3 -1
- package/out/types/app/App.js +17 -0
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/Service.d.ts +1 -0
- package/out/types/app/Service.js +36 -3
- package/out/types/app/Service.js.map +1 -1
- package/out/types/data/Entity.d.ts +5 -0
- package/out/types/data/Entity.js +13 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/Enum.d.ts +4 -0
- package/out/types/data/Enum.js +7 -0
- package/out/types/data/Enum.js.map +1 -1
- package/out/types/data/Module.d.ts +34 -0
- package/out/types/data/Module.js +53 -0
- package/out/types/data/Module.js.map +1 -0
- package/out/types/data/Structure.d.ts +4 -0
- package/out/types/data/Structure.js +7 -0
- package/out/types/data/Structure.js.map +1 -1
- package/out/types/data/dataTypes.js +21 -4
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +0 -2
- package/out/types/data/genBlock/index.js +0 -2
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/systemTypes.js +73 -0
- package/out/types/data/systemTypes.js.map +1 -1
- package/out/types/index.d.ts +2 -0
- package/out/types/index.js +5 -2
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +7 -0
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +18 -10
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +1 -1
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/translator.js +75 -51
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/process/ProcessParam.js +1 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/typeCheck.js +2 -1
- package/out/types/typeCheck.js.map +1 -1
- package/package.json +2 -1
- package/src/service/logic/checktypeSocket.js +49 -0
- package/src/service/logic/index.js +3 -0
- package/src/service/modules/api.js +20 -0
- package/src/service/modules/index.js +6 -0
- package/src/types/app/App.ts +17 -2
- package/src/types/app/Service.ts +39 -4
- package/src/types/data/Entity.ts +17 -6
- package/src/types/data/Enum.ts +5 -0
- package/src/types/data/Module.ts +51 -0
- package/src/types/data/Structure.ts +5 -0
- package/src/types/data/dataTypes.ts +24 -4
- package/src/types/data/genBlock/index.ts +0 -2
- package/src/types/data/systemTypes.ts +73 -0
- package/src/types/index.ts +2 -0
- package/src/types/logic/Logic.ts +5 -0
- package/src/types/logic/LogicItem.ts +21 -13
- package/src/types/logic/Param.ts +1 -1
- package/src/types/logic/translator.js +73 -51
- package/src/types/process/ProcessParam.ts +1 -1
- package/src/types/typeCheck.ts +5 -4
- package/src/types/data/genBlock/genCurdBlock.ts +0 -654
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +0 -581
|
@@ -205,35 +205,43 @@ export default function (source) {
|
|
|
205
205
|
if (node.type === 'CallLogic') {
|
|
206
206
|
if (node.calleeCode.startsWith('callInterface_')) {
|
|
207
207
|
const getParams = (key) => {
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
208
|
+
// 增加参数拼接日志信息
|
|
209
|
+
try {
|
|
210
|
+
// 过滤掉 null 的 param
|
|
211
|
+
const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
|
|
212
|
+
if (key === 'body') {
|
|
213
|
+
let inBody = '';
|
|
214
|
+
const bodyStr = [];
|
|
215
|
+
nodeParams.filter((t) => t.callInterParamValue)
|
|
216
|
+
.forEach((b) => {
|
|
217
|
+
const refTarget = Vertex.getVertexByRef(b.callInterParam);
|
|
218
|
+
if (refTarget.in === 'body') {
|
|
219
|
+
inBody = generateNode(b.callInterParamValue);
|
|
220
|
+
} else if (refTarget.in === '') {
|
|
221
|
+
bodyStr.push(`["${refTarget.name}"]: ${generateNode(b.callInterParamValue)}`);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return inBody || `{${bodyStr.join(',')}}`;
|
|
226
|
+
} else {
|
|
227
|
+
return nodeParams
|
|
228
|
+
.filter((param) => {
|
|
229
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
230
|
+
return refTarget && refTarget.in === key;
|
|
231
|
+
})
|
|
232
|
+
.map((param) => {
|
|
233
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
234
|
+
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
235
|
+
const value = generateNode(callInterParamValue);
|
|
236
|
+
|
|
237
|
+
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
} catch (error) {
|
|
241
|
+
console.log('CallLogic calleeCode: ', node.calleeCode);
|
|
242
|
+
console.log('CallLogic key: ', node.interfaceKey || node.callee || '');
|
|
243
|
+
console.log('params type: ', key);
|
|
244
|
+
throw error;
|
|
237
245
|
}
|
|
238
246
|
};
|
|
239
247
|
const key = node.interfaceKey || node.callee || '';
|
|
@@ -264,30 +272,37 @@ export default function (source) {
|
|
|
264
272
|
const key = node.interfaceKey || '';
|
|
265
273
|
const arr = key.split('/');
|
|
266
274
|
const getParams = (key) => {
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
if (body) {
|
|
275
|
-
return generateNode(body.callInterParamValue);
|
|
276
|
-
}
|
|
277
|
-
return '{}';
|
|
278
|
-
} else {
|
|
279
|
-
return nodeParams
|
|
280
|
-
.filter((param) => {
|
|
275
|
+
// 增加参数拼接日志信息
|
|
276
|
+
try {
|
|
277
|
+
// 过滤掉 null 的 param
|
|
278
|
+
const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
|
|
279
|
+
if (key === 'body') {
|
|
280
|
+
const body = (nodeParams || []).find((param) => {
|
|
281
281
|
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
282
282
|
return refTarget && refTarget.in === key;
|
|
283
|
-
})
|
|
284
|
-
.map((param) => {
|
|
285
|
-
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
286
|
-
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
287
|
-
const value = generateNode(callInterParamValue);
|
|
288
|
-
|
|
289
|
-
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
290
283
|
});
|
|
284
|
+
if (body) {
|
|
285
|
+
return generateNode(body.callInterParamValue);
|
|
286
|
+
}
|
|
287
|
+
return '{}';
|
|
288
|
+
} else {
|
|
289
|
+
return nodeParams
|
|
290
|
+
.filter((param) => {
|
|
291
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
292
|
+
return refTarget && refTarget.in === key;
|
|
293
|
+
})
|
|
294
|
+
.map((param) => {
|
|
295
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
296
|
+
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
297
|
+
const value = generateNode(callInterParamValue);
|
|
298
|
+
|
|
299
|
+
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
console.log('CallInterface key: ', node.interfaceKey || '');
|
|
304
|
+
console.log('params type: ', key);
|
|
305
|
+
throw error;
|
|
291
306
|
}
|
|
292
307
|
};
|
|
293
308
|
|
|
@@ -604,7 +619,14 @@ export default function (source) {
|
|
|
604
619
|
}
|
|
605
620
|
|
|
606
621
|
if (node.type === 'BuiltInFunction') {
|
|
607
|
-
|
|
622
|
+
let params = (node.builtInFuncParams || []).map((param) => generateNode(param.builtInFuncParamValue));
|
|
623
|
+
if (node.calleeCode === 'Split') {
|
|
624
|
+
// Bug-34789: 参考 url 转义规则对 ' 转义
|
|
625
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
|
626
|
+
params = params.map((param) => (param.replace(/'(.*)'/, (match, p1) => `'${p1.replace(/'/g, '%27')}'`)));
|
|
627
|
+
if (params.find((param) => param.includes('%27')))
|
|
628
|
+
return `this.$utils['${node.calleeCode}'](${params.join(',')}).map((item) => item.replace(/%27/g, "'"))`;
|
|
629
|
+
}
|
|
608
630
|
return `this.$utils['${node.calleeCode}'](${params.join(',')})`;
|
|
609
631
|
}
|
|
610
632
|
|
|
@@ -68,7 +68,7 @@ export class ProcessParam extends Param {
|
|
|
68
68
|
config.defaultApp?.emit('saved');
|
|
69
69
|
|
|
70
70
|
// 更新所有调用此Logic的LogicItem
|
|
71
|
-
|
|
71
|
+
await this.process.launchProcessInterface.logic.callLogicUpdate();
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
74
|
/**
|
package/src/types/typeCheck.ts
CHANGED
|
@@ -25,14 +25,15 @@ export default {
|
|
|
25
25
|
push(record: TypeCheckRecord) {
|
|
26
26
|
const pos = this.deleteOwn(record.id);
|
|
27
27
|
|
|
28
|
-
if(record.typeCheckNote?.message?.filter)
|
|
28
|
+
if (record.typeCheckNote?.message?.filter)
|
|
29
29
|
record.typeCheckNote.message = record.typeCheckNote.message.filter((item) => !!item);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// typeCheckNote.message 不存在时,视为误报
|
|
32
|
+
if (!record.typeCheckNote || record.typeCheckNote.status === 'success'
|
|
33
|
+
|| !record.typeCheckNote.message || record.typeCheckNote.message.length === 0)
|
|
33
34
|
return;
|
|
34
35
|
|
|
35
|
-
if(pos === -1)
|
|
36
|
+
if (pos === -1)
|
|
36
37
|
this.records.unshift(record);
|
|
37
38
|
else
|
|
38
39
|
this.records.splice(pos, 0, record);
|