@lcap/nasl 0.3.13 → 0.3.14

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.
Files changed (61) hide show
  1. package/out/service/logic/logic.d.ts +9 -0
  2. package/out/service/logic/logic.js +7 -0
  3. package/out/service/logic/logic.js.map +1 -1
  4. package/out/types/app/Service.js +9 -1
  5. package/out/types/app/Service.js.map +1 -1
  6. package/out/types/config.d.ts +1 -0
  7. package/out/types/config.js +1 -0
  8. package/out/types/config.js.map +1 -1
  9. package/out/types/data/Entity.d.ts +5 -1
  10. package/out/types/data/Entity.js +10 -3
  11. package/out/types/data/Entity.js.map +1 -1
  12. package/out/types/data/EntityProperty.d.ts +4 -0
  13. package/out/types/data/EntityProperty.js +7 -0
  14. package/out/types/data/EntityProperty.js.map +1 -1
  15. package/out/types/data/Interface.js +2 -1
  16. package/out/types/data/Interface.js.map +1 -1
  17. package/out/types/data/genBlock/genCreateBlock.js +5 -6
  18. package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
  19. package/out/types/data/genBlock/genEnumSelectBlock.js +1 -1
  20. package/out/types/data/genBlock/genEnumSelectBlock.js.map +1 -1
  21. package/out/types/data/genBlock/genGetBlock.js +1 -1
  22. package/out/types/data/genBlock/genGetBlock.js.map +1 -1
  23. package/out/types/data/genBlock/genListViewBlock.js +1 -1
  24. package/out/types/data/genBlock/genListViewBlock.js.map +1 -1
  25. package/out/types/data/genBlock/genQueryComponent.js +1 -1
  26. package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
  27. package/out/types/data/genBlock/genSelectBlock.js +2 -1
  28. package/out/types/data/genBlock/genSelectBlock.js.map +1 -1
  29. package/out/types/data/genBlock/genTableBlock.js +1 -1
  30. package/out/types/data/genBlock/genTableBlock.js.map +1 -1
  31. package/out/types/data/genBlock/genUpdateBlock.js +5 -6
  32. package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
  33. package/out/types/logic/Logic.d.ts +16 -0
  34. package/out/types/logic/Logic.js +39 -0
  35. package/out/types/logic/Logic.js.map +1 -1
  36. package/out/types/logic/LogicItem.d.ts +2 -2
  37. package/out/types/logic/LogicItem.js +92 -36
  38. package/out/types/logic/LogicItem.js.map +1 -1
  39. package/out/types/logic/translator.js +66 -50
  40. package/out/types/logic/translator.js.map +1 -1
  41. package/out/types/typeCheck.js +3 -0
  42. package/out/types/typeCheck.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/service/logic/logic.js +7 -0
  45. package/src/types/app/Service.ts +9 -1
  46. package/src/types/config.ts +1 -0
  47. package/src/types/data/Entity.ts +10 -4
  48. package/src/types/data/EntityProperty.ts +5 -0
  49. package/src/types/data/Interface.ts +3 -1
  50. package/src/types/data/genBlock/genCreateBlock.ts +5 -6
  51. package/src/types/data/genBlock/genEnumSelectBlock.ts +1 -1
  52. package/src/types/data/genBlock/genGetBlock.ts +1 -1
  53. package/src/types/data/genBlock/genListViewBlock.ts +1 -1
  54. package/src/types/data/genBlock/genQueryComponent.ts +1 -1
  55. package/src/types/data/genBlock/genSelectBlock.ts +2 -1
  56. package/src/types/data/genBlock/genTableBlock.ts +1 -1
  57. package/src/types/data/genBlock/genUpdateBlock.ts +5 -7
  58. package/src/types/logic/Logic.ts +35 -0
  59. package/src/types/logic/LogicItem.ts +305 -217
  60. package/src/types/logic/translator.js +64 -50
  61. package/src/types/typeCheck.ts +4 -0
@@ -205,35 +205,42 @@ export default function (source) {
205
205
  if (node.type === 'CallLogic') {
206
206
  if (node.calleeCode.startsWith('callInterface_')) {
207
207
  const getParams = (key) => {
208
- // 过滤掉 null 的 param
209
- const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
210
- if (key === 'body') {
211
- let inBody = '';
212
- const bodyStr = [];
213
- nodeParams.filter((t) => t.callInterParamValue)
214
- .forEach((b) => {
215
- const refTarget = Vertex.getVertexByRef(b.callInterParam);
216
- if (refTarget.in === 'body') {
217
- inBody = generateNode(b.callInterParamValue);
218
- } else if (refTarget.in === '') {
219
- bodyStr.push(`["${refTarget.name}"]: ${generateNode(b.callInterParamValue)}`);
220
- }
221
- });
222
-
223
- return inBody || `{${bodyStr.join(',')}}`;
224
- } else {
225
- return nodeParams
226
- .filter((param) => {
227
- const refTarget = Vertex.getVertexByRef(param.callInterParam);
228
- return refTarget && refTarget.in === key;
229
- })
230
- .map((param) => {
231
- const refTarget = Vertex.getVertexByRef(param.callInterParam);
232
- const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
233
- const value = generateNode(callInterParamValue);
234
-
235
- return `${safeCodeAsKey(refTarget)}: ${value}`;
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('params type: ', key);
243
+ throw error;
237
244
  }
238
245
  };
239
246
  const key = node.interfaceKey || node.callee || '';
@@ -264,30 +271,37 @@ export default function (source) {
264
271
  const key = node.interfaceKey || '';
265
272
  const arr = key.split('/');
266
273
  const getParams = (key) => {
267
- // 过滤掉 null 的 param
268
- const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
269
- if (key === 'body') {
270
- const body = (nodeParams || []).find((param) => {
271
- const refTarget = Vertex.getVertexByRef(param.callInterParam);
272
- return refTarget && refTarget.in === key;
273
- });
274
- if (body) {
275
- return generateNode(body.callInterParamValue);
276
- }
277
- return '{}';
278
- } else {
279
- return nodeParams
280
- .filter((param) => {
274
+ // 增加参数拼接日志信息
275
+ try {
276
+ // 过滤掉 null param
277
+ const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
278
+ if (key === 'body') {
279
+ const body = (nodeParams || []).find((param) => {
281
280
  const refTarget = Vertex.getVertexByRef(param.callInterParam);
282
281
  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
282
  });
283
+ if (body) {
284
+ return generateNode(body.callInterParamValue);
285
+ }
286
+ return '{}';
287
+ } else {
288
+ return nodeParams
289
+ .filter((param) => {
290
+ const refTarget = Vertex.getVertexByRef(param.callInterParam);
291
+ return refTarget && refTarget.in === key;
292
+ })
293
+ .map((param) => {
294
+ const refTarget = Vertex.getVertexByRef(param.callInterParam);
295
+ const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
296
+ const value = generateNode(callInterParamValue);
297
+
298
+ return `${safeCodeAsKey(refTarget)}: ${value}`;
299
+ });
300
+ }
301
+ } catch (error) {
302
+ console.log('CallInterface interfaceKey: ', node.interfaceKey);
303
+ console.log('params type: ', key);
304
+ throw error;
291
305
  }
292
306
  };
293
307
 
@@ -107,6 +107,10 @@ export default {
107
107
  }
108
108
  }
109
109
 
110
+ // if ((record as any)['test']) {
111
+ // this.pushAll([(record as any)['test']], { processComponentId, logicId });
112
+ // }
113
+
110
114
  if ((record as any)['right'] &&
111
115
  (record as any)['right'].level === 'logicNode') {
112
116
  this.pushAll([(record as any)['right']], { processComponentId, logicId });