@lcap/nasl 3.6.4-beta.1 → 3.6.4-beta.3

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 (52) hide show
  1. package/.nyc_output/3e8e5f5d-80b0-40bc-a120-b24c497d0731.json +1 -0
  2. package/.nyc_output/processinfo/3e8e5f5d-80b0-40bc-a120-b24c497d0731.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -1
  4. package/coverage/cobertura-coverage.xml +74111 -3194
  5. package/out/common/BaseNode.js +3 -3
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/App__.js +1 -1
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/InterfaceParam__.d.ts +1 -1
  10. package/out/concepts/InterfaceParam__.js +2 -2
  11. package/out/concepts/InterfaceParam__.js.map +1 -1
  12. package/out/concepts/Interface__.js +1 -1
  13. package/out/concepts/Interface__.js.map +1 -1
  14. package/out/concepts/NewComposite__.js +2 -2
  15. package/out/concepts/NewComposite__.js.map +1 -1
  16. package/out/generator/release-body/internal.d.ts +153 -0
  17. package/out/generator/release-body/utils.d.ts +1 -0
  18. package/out/generator/release-body/utils.js +14 -4
  19. package/out/generator/release-body/utils.js.map +1 -1
  20. package/out/natural/prompt/analyzeClaims.js +2 -0
  21. package/out/natural/prompt/analyzeClaims.js.map +1 -1
  22. package/out/natural/prompt/analyzeTasks.js +10 -9
  23. package/out/natural/prompt/analyzeTasks.js.map +1 -1
  24. package/out/natural/prompt/executeClaims.js +8 -4
  25. package/out/natural/prompt/executeClaims.js.map +1 -1
  26. package/out/natural/transformTSCode.js +7 -4
  27. package/out/natural/transformTSCode.js.map +1 -1
  28. package/out/server/formatTsUtils.js +2 -2
  29. package/out/server/formatTsUtils.js.map +1 -1
  30. package/out/server/naslServer.js +2 -0
  31. package/out/server/naslServer.js.map +1 -1
  32. package/out/service/storage/init.js +1 -1
  33. package/out/service/storage/init.js.map +1 -1
  34. package/package.json +1 -1
  35. package/sandbox-natural/stdlib/nasl.core.ts +2 -0
  36. package/sandbox-natural/stdlib/nasl.util.ts +2 -0
  37. package/src/common/BaseNode.ts +3 -3
  38. package/src/concepts/App__.ts +1 -1
  39. package/src/concepts/InterfaceParam__.ts +2 -2
  40. package/src/concepts/Interface__.ts +1 -1
  41. package/src/concepts/NewComposite__.ts +2 -2
  42. package/src/generator/release-body/internal.ts +154 -0
  43. package/src/generator/release-body/utils.ts +17 -7
  44. package/src/natural/prompt/analyzeClaims.ts +2 -0
  45. package/src/natural/prompt/analyzeTasks.ts +10 -9
  46. package/src/natural/prompt/executeClaims.ts +8 -4
  47. package/src/natural/transformTSCode.ts +6 -4
  48. package/src/server/formatTsUtils.ts +2 -2
  49. package/src/server/naslServer.ts +2 -0
  50. package/src/service/storage/init.ts +1 -1
  51. package/.nyc_output/50a74696-517e-4e22-8a16-9eeecc5ae7c2.json +0 -1
  52. package/.nyc_output/processinfo/50a74696-517e-4e22-8a16-9eeecc5ae7c2.json +0 -1
@@ -568,7 +568,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
568
568
  return new naslTypes.CallInterface({
569
569
  calleeNamespace: generate((node.callee as any).object).code,
570
570
  calleeName: (callee[callee.length - 1] as babelTypes.Identifier).name,
571
- arguments: node?.arguments?.map((arg: any) => arg?.properties.map((item: any) => new naslTypes.Argument({
571
+ arguments: node?.arguments?.map((arg: any) => arg?.properties?.map((item: any) => new naslTypes.Argument({
572
572
  keyword: item?.key?.name,
573
573
  expression: transformLogicNode(item?.value),
574
574
  }))).flat() as naslTypes.Argument[],
@@ -713,7 +713,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
713
713
  name: (callee?.[2] as babelTypes.Identifier)?.name,
714
714
  }),
715
715
  property: new naslTypes.Identifier({
716
- name: (callee?.[3] as babelTypes.StringLiteral)?.value,
716
+ name: (callee?.[3] as babelTypes.StringLiteral)?.value || (callee?.[3] as babelTypes.Identifier)?.name,
717
717
  }),
718
718
  });
719
719
  }
@@ -923,8 +923,10 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
923
923
  let statements: babelTypes.Statement[] = [];
924
924
 
925
925
  let func: babelTypes.FunctionDeclaration;
926
- if (root.program.body[0].type === 'ExportNamedDeclaration') {
927
- func = root.program.body[0].declaration as babelTypes.FunctionDeclaration;
926
+ if (root.program?.body[0]?.type === 'ExportNamedDeclaration') {
927
+ func = root.program?.body[0]?.declaration as babelTypes.FunctionDeclaration;
928
+ } else {
929
+ func = root.program?.body[0] as babelTypes.FunctionDeclaration;
928
930
  }
929
931
  parameters = func.params as babelTypes.Identifier[];
930
932
  statements = func.body.body;
@@ -734,10 +734,10 @@ function getNodeiconFromLogic(completionProperty: CompletionProperty, node: type
734
734
  }
735
735
  }
736
736
 
737
- const bindAttr = node.getAncestor<BindAttribute>('BindAttribute');
737
+ const bindAttr = node?.getAncestor?.<BindAttribute>('BindAttribute');
738
738
 
739
739
  if (bindAttr) {
740
- const interfaceInstance = bindAttr.getAncestor<Interface>('Interface');
740
+ const interfaceInstance = bindAttr?.getAncestor?.<Interface>('Interface');
741
741
 
742
742
  if (interfaceInstance?.params.find((item) => item.name === propName)) {
743
743
  return 'param';
@@ -1242,6 +1242,7 @@ class NaslServer {
1242
1242
  });
1243
1243
 
1244
1244
  this.logger.timeEnd('处理诊断数据');
1245
+ this.logger.timeEnd('语言服务变更');
1245
1246
 
1246
1247
  return records;
1247
1248
  }
@@ -5056,6 +5057,7 @@ class NaslServer {
5056
5057
  invokeCommand('naslServer:startWork');
5057
5058
  }
5058
5059
 
5060
+ this.logger.time('语言服务变更');
5059
5061
  this.singleFileChangeIng = true;
5060
5062
  // 行为
5061
5063
  const { action, oldObject = {}, object = {} } = $event;
@@ -989,7 +989,7 @@ async function _saveNasl(options: TaskOption) {
989
989
  spaces: 4,
990
990
  });
991
991
  }
992
- app.emit('saved', err);
992
+ app.emit?.('saved', err);
993
993
  return err;
994
994
  }
995
995