@lcap/nasl 2.22.0-beta.5 → 3.0.0-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.
Files changed (304) hide show
  1. package/README.md +13 -0
  2. package/docs/classes/Module.html +15 -15
  3. package/docs/classes/Namespace.html +15 -15
  4. package/docs/classes/ViewComponent.html +19 -19
  5. package/out/automate/engine/utils.js +4 -0
  6. package/out/automate/engine/utils.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  8. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  9. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  10. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  11. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  12. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  13. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  14. package/out/breakpoint/generator/BreakpointNode.js +166 -0
  15. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  16. package/out/breakpoint/generator/index.d.ts +4 -0
  17. package/out/breakpoint/generator/index.js +98 -0
  18. package/out/breakpoint/generator/index.js.map +1 -0
  19. package/out/breakpoint/index.d.ts +3 -0
  20. package/out/breakpoint/index.js +20 -0
  21. package/out/breakpoint/index.js.map +1 -0
  22. package/out/breakpoint/shared/constants.d.ts +30 -0
  23. package/out/breakpoint/shared/constants.js +87 -0
  24. package/out/breakpoint/shared/constants.js.map +1 -0
  25. package/out/breakpoint/shared/index.d.ts +3 -0
  26. package/out/breakpoint/shared/index.js +33 -0
  27. package/out/breakpoint/shared/index.js.map +1 -0
  28. package/out/breakpoint/shared/operations.d.ts +10 -0
  29. package/out/breakpoint/shared/operations.js +25 -0
  30. package/out/breakpoint/shared/operations.js.map +1 -0
  31. package/out/breakpoint/shared/socket.d.ts +47 -0
  32. package/out/breakpoint/shared/socket.js +210 -0
  33. package/out/breakpoint/shared/socket.js.map +1 -0
  34. package/out/breakpoint/shared/utils.d.ts +20 -0
  35. package/out/breakpoint/shared/utils.js +133 -0
  36. package/out/breakpoint/shared/utils.js.map +1 -0
  37. package/out/breakpoint/store/core.d.ts +30 -0
  38. package/out/breakpoint/store/core.js +341 -0
  39. package/out/breakpoint/store/core.js.map +1 -0
  40. package/out/breakpoint/store/dock.d.ts +1 -0
  41. package/out/breakpoint/store/dock.js +127 -0
  42. package/out/breakpoint/store/dock.js.map +1 -0
  43. package/out/breakpoint/store/index.d.ts +2 -0
  44. package/out/breakpoint/store/index.js +19 -0
  45. package/out/breakpoint/store/index.js.map +1 -0
  46. package/out/common/BaseNode.d.ts +8 -0
  47. package/out/common/BaseNode.js +19 -0
  48. package/out/common/BaseNode.js.map +1 -1
  49. package/out/concepts/App__.d.ts +365 -16
  50. package/out/concepts/App__.js +431 -10
  51. package/out/concepts/App__.js.map +1 -1
  52. package/out/concepts/Assignment__.js +1 -1
  53. package/out/concepts/Assignment__.js.map +1 -1
  54. package/out/concepts/AuthInterface__.d.ts +37 -0
  55. package/out/concepts/AuthInterface__.js +141 -0
  56. package/out/concepts/AuthInterface__.js.map +1 -0
  57. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  58. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  59. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  60. package/out/concepts/AuthLogic__.d.ts +66 -0
  61. package/out/concepts/AuthLogic__.js +206 -0
  62. package/out/concepts/AuthLogic__.js.map +1 -0
  63. package/out/concepts/BackendVariable__.d.ts +137 -0
  64. package/out/concepts/BackendVariable__.js +422 -0
  65. package/out/concepts/BackendVariable__.js.map +1 -0
  66. package/out/concepts/Backend__.d.ts +134 -0
  67. package/out/concepts/Backend__.js +274 -0
  68. package/out/concepts/Backend__.js.map +1 -0
  69. package/out/concepts/BindAttribute__.d.ts +1 -1
  70. package/out/concepts/BindAttribute__.js +3 -1
  71. package/out/concepts/BindAttribute__.js.map +1 -1
  72. package/out/concepts/BindEvent__.d.ts +12 -0
  73. package/out/concepts/BindEvent__.js +68 -0
  74. package/out/concepts/BindEvent__.js.map +1 -1
  75. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  76. package/out/concepts/CallAuthInterface__.js +408 -0
  77. package/out/concepts/CallAuthInterface__.js.map +1 -0
  78. package/out/concepts/CallInterface__.d.ts +6 -1
  79. package/out/concepts/CallInterface__.js +9 -1
  80. package/out/concepts/CallInterface__.js.map +1 -1
  81. package/out/concepts/CallLogic__.js +3 -1
  82. package/out/concepts/CallLogic__.js.map +1 -1
  83. package/out/concepts/CallQueryComponent__.js +9 -7
  84. package/out/concepts/CallQueryComponent__.js.map +1 -1
  85. package/out/concepts/Destination__.js +1 -1
  86. package/out/concepts/Destination__.js.map +1 -1
  87. package/out/concepts/End__.js +29 -2
  88. package/out/concepts/End__.js.map +1 -1
  89. package/out/concepts/EntityProperty__.js.map +1 -1
  90. package/out/concepts/Entity__.d.ts +1 -2
  91. package/out/concepts/Entity__.js +1 -31
  92. package/out/concepts/Entity__.js.map +1 -1
  93. package/out/concepts/ForEachStatement__.js +9 -4
  94. package/out/concepts/ForEachStatement__.js.map +1 -1
  95. package/out/concepts/FrontendLibrary__.d.ts +29 -29
  96. package/out/concepts/FrontendLibrary__.js +2 -2
  97. package/out/concepts/FrontendVariable__.d.ts +21 -0
  98. package/out/concepts/FrontendVariable__.js +64 -0
  99. package/out/concepts/FrontendVariable__.js.map +1 -0
  100. package/out/concepts/Frontend__.d.ts +151 -47
  101. package/out/concepts/Frontend__.js +188 -32
  102. package/out/concepts/Frontend__.js.map +1 -1
  103. package/out/concepts/Function__.js +1 -1
  104. package/out/concepts/Function__.js.map +1 -1
  105. package/out/concepts/Identifier__.js +1 -1
  106. package/out/concepts/Identifier__.js.map +1 -1
  107. package/out/concepts/Interface__.d.ts +1 -1
  108. package/out/concepts/Interface__.js.map +1 -1
  109. package/out/concepts/LogicItem__.d.ts +18 -3
  110. package/out/concepts/LogicItem__.js +22 -4
  111. package/out/concepts/LogicItem__.js.map +1 -1
  112. package/out/concepts/Logic__.d.ts +14 -9
  113. package/out/concepts/Logic__.js +43 -5
  114. package/out/concepts/Logic__.js.map +1 -1
  115. package/out/concepts/Module__.js.map +1 -1
  116. package/out/concepts/Namespace__.d.ts +29 -29
  117. package/out/concepts/Namespace__.js +2 -2
  118. package/out/concepts/NewComposite__.js +2 -2
  119. package/out/concepts/NewComposite__.js.map +1 -1
  120. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  121. package/out/concepts/OverriddenLogic__.js +1602 -0
  122. package/out/concepts/OverriddenLogic__.js.map +1 -0
  123. package/out/concepts/Param__.d.ts +6 -0
  124. package/out/concepts/Param__.js +10 -0
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/QueryFieldExpression__.d.ts +2 -0
  127. package/out/concepts/QueryFieldExpression__.js +9 -0
  128. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  129. package/out/concepts/QuerySelectExpression__.d.ts +2 -2
  130. package/out/concepts/QuerySelectExpression__.js +2 -2
  131. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  132. package/out/concepts/TypeAnnotation__.js +6 -6
  133. package/out/concepts/TypeAnnotation__.js.map +1 -1
  134. package/out/concepts/Variable__.d.ts +10 -0
  135. package/out/concepts/Variable__.js +12 -0
  136. package/out/concepts/Variable__.js.map +1 -1
  137. package/out/concepts/ViewComponent__.d.ts +33 -33
  138. package/out/concepts/ViewComponent__.js +7 -7
  139. package/out/concepts/ViewElement__.d.ts +6 -0
  140. package/out/concepts/ViewElement__.js +104 -1
  141. package/out/concepts/ViewElement__.js.map +1 -1
  142. package/out/concepts/View__.js +2 -2
  143. package/out/concepts/View__.js.map +1 -1
  144. package/out/concepts/basics/stdlib/index.js +2 -1
  145. package/out/concepts/basics/stdlib/index.js.map +1 -1
  146. package/out/concepts/basics/stdlib/nasl.auth.js +24 -0
  147. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  148. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  149. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  150. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  151. package/out/concepts/basics/stdlib/nasl.process.js +68 -0
  152. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.ui.js +4 -19
  154. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.util.js +83 -17
  156. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  157. package/out/concepts/basics/types/index.d.ts +1 -0
  158. package/out/concepts/basics/types/index.js +4 -1
  159. package/out/concepts/basics/types/index.js.map +1 -1
  160. package/out/concepts/index__.d.ts +8 -0
  161. package/out/concepts/index__.js +8 -0
  162. package/out/concepts/index__.js.map +1 -1
  163. package/out/enums/KEYWORDS.js +0 -1
  164. package/out/enums/KEYWORDS.js.map +1 -1
  165. package/out/generator/genBundleFiles.d.ts +1 -0
  166. package/out/generator/genBundleFiles.js +27 -0
  167. package/out/generator/genBundleFiles.js.map +1 -1
  168. package/out/generator/genMetaData.d.ts +4 -1
  169. package/out/generator/genMetaData.js +14 -0
  170. package/out/generator/genMetaData.js.map +1 -1
  171. package/out/generator/genReleaseBody.d.ts +2 -1
  172. package/out/generator/genReleaseBody.js +2 -1
  173. package/out/generator/genReleaseBody.js.map +1 -1
  174. package/out/index.d.ts +2 -1
  175. package/out/index.js +3 -1
  176. package/out/index.js.map +1 -1
  177. package/out/server/extendBaseNode.js +16 -4
  178. package/out/server/extendBaseNode.js.map +1 -1
  179. package/out/server/formatTsUtils.d.ts +2 -1
  180. package/out/server/formatTsUtils.js +39 -4
  181. package/out/server/formatTsUtils.js.map +1 -1
  182. package/out/server/getExtensionModules.d.ts +2 -2
  183. package/out/server/getExtensionModules.js +16 -2
  184. package/out/server/getExtensionModules.js.map +1 -1
  185. package/out/server/getLogics.js +5 -5
  186. package/out/server/getLogics.js.map +1 -1
  187. package/out/server/getMemberIdentifier.d.ts +1 -0
  188. package/out/server/getMemberIdentifier.js +34 -7
  189. package/out/server/getMemberIdentifier.js.map +1 -1
  190. package/out/server/naslServer.d.ts +64 -64
  191. package/out/server/naslServer.js +249 -121
  192. package/out/server/naslServer.js.map +1 -1
  193. package/out/server/naslStdlibMap.js +2 -0
  194. package/out/server/naslStdlibMap.js.map +1 -1
  195. package/out/server/translator.d.ts +1 -0
  196. package/out/server/translator.js +67 -2
  197. package/out/server/translator.js.map +1 -1
  198. package/out/service/defaultErrorMessage.json +1 -0
  199. package/out/service/storage/api.d.ts +10 -1
  200. package/out/service/storage/api.js +6 -0
  201. package/out/service/storage/api.js.map +1 -1
  202. package/out/service/storage/init.d.ts +4 -0
  203. package/out/service/storage/init.js +55 -35
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/service/storage/service.d.ts +3 -0
  206. package/out/service/storage/service.js +14 -0
  207. package/out/service/storage/service.js.map +1 -1
  208. package/out/utils/sortTsString.d.ts +1 -0
  209. package/out/utils/sortTsString.js +36 -0
  210. package/out/utils/sortTsString.js.map +1 -0
  211. package/out/utils/traverse.js +2 -2
  212. package/out/utils/traverse.js.map +1 -1
  213. package/package.json +7 -2
  214. package/sandbox/stdlib/nasl.auth.ts +8 -4
  215. package/sandbox/stdlib/nasl.core.d.ts +206 -0
  216. package/sandbox/stdlib/nasl.core.js +1 -0
  217. package/sandbox/stdlib/nasl.core.js.map +1 -0
  218. package/sandbox/stdlib/nasl.http.ts +35 -0
  219. package/sandbox/stdlib/nasl.process.ts +13 -0
  220. package/sandbox/stdlib/nasl.ui.ts +0 -5
  221. package/src/automate/engine/utils.js +4 -1
  222. package/src/breakpoint/generator/AfterStartNode.ts +27 -0
  223. package/src/breakpoint/generator/BeforeEndNode.ts +27 -0
  224. package/src/breakpoint/generator/BreakpointNode.ts +228 -0
  225. package/src/breakpoint/generator/index.ts +114 -0
  226. package/src/breakpoint/index.ts +3 -0
  227. package/src/breakpoint/shared/constants.ts +95 -0
  228. package/src/breakpoint/shared/index.ts +3 -0
  229. package/src/breakpoint/shared/operations.ts +25 -0
  230. package/src/breakpoint/shared/socket.ts +326 -0
  231. package/src/breakpoint/shared/utils.ts +195 -0
  232. package/src/breakpoint/store/core.ts +411 -0
  233. package/src/breakpoint/store/dock.ts +166 -0
  234. package/src/breakpoint/store/index.ts +2 -0
  235. package/src/breakpoint/types/index.d.ts +19 -0
  236. package/src/common/BaseNode.ts +19 -1
  237. package/src/concepts/App__.ts +828 -26
  238. package/src/concepts/Assignment__.ts +1 -1
  239. package/src/concepts/AuthInterface__.ts +148 -0
  240. package/src/concepts/AuthLogicForCallInterface__.ts +573 -0
  241. package/src/concepts/AuthLogic__.ts +225 -0
  242. package/src/concepts/BackendVariable__.ts +466 -0
  243. package/src/concepts/Backend__.ts +347 -0
  244. package/src/concepts/BindAttribute__.ts +4 -3
  245. package/src/concepts/BindEvent__.ts +71 -2
  246. package/src/concepts/CallAuthInterface__.ts +490 -0
  247. package/src/concepts/CallInterface__.ts +10 -2
  248. package/src/concepts/CallLogic__.ts +3 -1
  249. package/src/concepts/CallQueryComponent__.ts +67 -7
  250. package/src/concepts/Destination__.ts +19 -1
  251. package/src/concepts/End__.ts +31 -3
  252. package/src/concepts/EntityProperty__.ts +6 -0
  253. package/src/concepts/Entity__.ts +8 -31
  254. package/src/concepts/ForEachStatement__.ts +9 -4
  255. package/src/concepts/FrontendLibrary__.ts +30 -30
  256. package/src/concepts/FrontendVariable__.ts +76 -0
  257. package/src/concepts/Frontend__.ts +352 -89
  258. package/src/concepts/Function__.ts +1 -1
  259. package/src/concepts/Identifier__.ts +5 -5
  260. package/src/concepts/Interface__.ts +1 -1
  261. package/src/concepts/LogicItem__.ts +26 -6
  262. package/src/concepts/Logic__.ts +86 -8
  263. package/src/concepts/Module__.ts +32 -2
  264. package/src/concepts/Namespace__.ts +30 -30
  265. package/src/concepts/NewComposite__.ts +2 -3
  266. package/src/concepts/OverriddenLogic__.ts +2165 -0
  267. package/src/concepts/Param__.ts +13 -3
  268. package/src/concepts/QueryFieldExpression__.ts +18 -0
  269. package/src/concepts/QuerySelectExpression__.ts +11 -3
  270. package/src/concepts/TypeAnnotation__.ts +45 -6
  271. package/src/concepts/Variable__.ts +14 -0
  272. package/src/concepts/ViewComponent__.ts +35 -35
  273. package/src/concepts/ViewElement__.ts +104 -1
  274. package/src/concepts/View__.ts +24 -2
  275. package/src/concepts/basics/stdlib/index.ts +2 -1
  276. package/src/concepts/basics/stdlib/nasl.auth.ts +24 -0
  277. package/src/concepts/basics/stdlib/nasl.http.ts +166 -0
  278. package/src/concepts/basics/stdlib/nasl.process.ts +68 -0
  279. package/src/concepts/basics/stdlib/nasl.ui.ts +4 -19
  280. package/src/concepts/basics/stdlib/nasl.util.ts +83 -17
  281. package/src/concepts/basics/types/index.ts +5 -4
  282. package/src/concepts/index__.ts +8 -0
  283. package/src/enums/KEYWORDS.ts +0 -1
  284. package/src/generator/genBundleFiles.ts +36 -2
  285. package/src/generator/genMetaData.ts +16 -1
  286. package/src/generator/genReleaseBody.ts +4 -1
  287. package/src/index.ts +2 -1
  288. package/src/server/extendBaseNode.ts +18 -7
  289. package/src/server/formatTsUtils.ts +37 -5
  290. package/src/server/getExtensionModules.ts +18 -3
  291. package/src/server/getLogics.ts +6 -6
  292. package/src/server/getMemberIdentifier.ts +35 -9
  293. package/src/server/naslServer.ts +250 -124
  294. package/src/server/naslStdlibMap.ts +2 -0
  295. package/src/server/translator.ts +67 -1
  296. package/src/service/defaultErrorMessage.json +1 -0
  297. package/src/service/storage/api.js +7 -1
  298. package/src/service/storage/init.ts +66 -35
  299. package/src/service/storage/service.ts +18 -2
  300. package/src/utils/sortTsString.ts +32 -0
  301. package/src/utils/traverse.ts +2 -2
  302. package/test/examples/app-simple.json +73635 -0
  303. package/ts-worker/lib/tsserver.js +3 -3
  304. package/ts-worker/package.json +1 -1
@@ -72,11 +72,15 @@ import {
72
72
  LogicItem,
73
73
  JSBlock,
74
74
  NewComposite,
75
+ OverriddenLogic,
75
76
  Integration,
77
+ Backend,
78
+ CallAuthInterface,
79
+ AuthLogicForCallInterface,
76
80
  } from '../concepts';
77
81
  import { lsp2tspNumber, SourceMap, SourceMapItem } from '../translator';
78
82
  import axios from '../service/storage';
79
- import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange } from './translator';
83
+ import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange, checkAStructure_ } from './translator';
80
84
  import { EventPayload, invokeCommand, registerCommand } from '../common';
81
85
  import { DiagnosticRecord, Diagnostic, DiagnosticManager } from '../manager/diagnostic';
82
86
  import formatUiTs from './createUiTs';
@@ -97,6 +101,8 @@ const EmbeddedTSFileLineMap: { [name: string]: number } = {
97
101
 
98
102
  const EmbeddedTSFileOffsetMap: { [name: string]: number } = {
99
103
  Variable: 12,
104
+ // Backend:12,
105
+ BackendVariable: 12,
100
106
  ConfigProperty: 12,
101
107
  };
102
108
 
@@ -139,7 +145,7 @@ let timer: number = null; //超时器用于收集导入接口相关
139
145
  // 联合类型切割取出类型
140
146
  export function getDisplayString2Type(displayString: string) {
141
147
  const targetString = displayString.match(/value:\s(\S+)\)/)[1];
142
- let targetType:string = null;
148
+ let targetType: string = null;
143
149
  if (targetString.startsWith('nasl.core.')) {
144
150
  targetType = targetString.slice(10);
145
151
  }
@@ -247,8 +253,8 @@ export class NaslServer {
247
253
  /**
248
254
  * 多个行为进行合并
249
255
  * 合并规则是
250
- * 1.[a,b,c,c] 在cc的时候,在已有一个c,又来一个c的时候,如果他们不都是file级别的节点
251
- * 就可以前面的内容去掉,只保留最后一个
256
+ * 1.[a,b,c,c] 在cc的时候,在已有一个c,又来一个c的时候,file级别的节点
257
+ * 就可以前面的内容去掉,只保留最后一个, 但是如果前面那个有携带file
252
258
  * 2.[a,b,c,b,c] 在bc已存在,又来了bc 这就都要保留,因为可能顺序有相关性,不能去掉
253
259
  * 理论上只处理同时几个操作 合并,
254
260
  * 3.有field的也直接保留
@@ -257,13 +263,21 @@ export class NaslServer {
257
263
  const changeEvent = item.originEvent;
258
264
  const changeNode = changeEvent.target;
259
265
  const { fileNode } = this.getCurrentSource(changeNode);
260
- if (changeNode !== fileNode || !changeEvent.field) {
261
- const findLastIndex = (this.changeStackList as any).findLastIndex((changeStackItem: EventPayload) => {
262
- const target = changeStackItem.target;
263
- const { fileNode: targetFileNode } = this.getCurrentSource(target);
264
- return targetFileNode === fileNode;
265
- });
266
- if (findLastIndex === this.changeStackList.length - 1) {
266
+ // 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
267
+ // @ts-ignore
268
+ const findLastIndex = this.changeStackList.findLastIndex((changeStackItem: EventPayload) => {
269
+ const target = changeStackItem.target;
270
+ const { fileNode: targetFileNode } = this.getCurrentSource(target);
271
+ return targetFileNode === fileNode;
272
+ });
273
+ // 如果当前找到了节点,而且节点在数组的最后一项,说明此次可以合并
274
+ if (findLastIndex !== -1 && findLastIndex === this.changeStackList.length - 1) {
275
+ // 最后一项有field就直接保留,新的也不塞,直接return
276
+ if (this.changeStackList[findLastIndex]?.field) {
277
+ // 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
278
+ return;
279
+ } else {
280
+ // 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
267
281
  this.changeStackList.pop();
268
282
  }
269
283
  }
@@ -323,6 +337,29 @@ export class NaslServer {
323
337
  }
324
338
  });
325
339
  if (module instanceof App) {
340
+ module.overriddenLogics?.forEach?.((logic) => {
341
+ try {
342
+ if (!(logic instanceof OverriddenLogic))
343
+ return;
344
+ const result = logic.toEmbeddedTSFile();
345
+ results.push(result);
346
+ logic.sourceMap = result.sourceMap;
347
+ this.file2NodeMap.set(result.filePath, logic);
348
+ } catch (err) {
349
+ console.error('err: ', err);
350
+ }
351
+ });
352
+ module?.backend?.variables?.forEach((backdndVariable) => {
353
+ try {
354
+ const result = backdndVariable.toEmbeddedTSFile();
355
+ results.push(result);
356
+ // sourceMap都存在目录级别内容下,在页面层级下去找
357
+ backdndVariable.sourceMap = result.sourceMap;
358
+ this.file2NodeMap.set(result.filePath, backdndVariable);
359
+ } catch (err) {
360
+ console.error(err);
361
+ }
362
+ });
326
363
  module.frontends?.forEach((frontend) => {
327
364
  try {
328
365
  const result = frontend.toEmbeddedTSFile();
@@ -344,6 +381,20 @@ export class NaslServer {
344
381
  console.log(err);
345
382
  }
346
383
  });
384
+ frontend.bindEvents.forEach((bindEvent) => {
385
+ if (bindEvent?.logics && bindEvent?.logics?.length > 0) {
386
+ bindEvent.logics.forEach((logic: Logic) => {
387
+ try {
388
+ const result = logic.toEmbeddedTSFile();
389
+ results.push(result);
390
+ logic.sourceMap = result.sourceMap;
391
+ this.file2NodeMap.set(result.filePath, logic);
392
+ } catch (err) {
393
+ console.error('err: ', err);
394
+ }
395
+ });
396
+ }
397
+ });
347
398
  // view的生成
348
399
  if (!config.closeViews) {
349
400
  this.view2TSFile(frontend.views, results);
@@ -420,6 +471,30 @@ export class NaslServer {
420
471
  }
421
472
  });
422
473
 
474
+ (module as App)?.authLogics?.forEach?.((logic) => {
475
+ try {
476
+ if (!(logic instanceof Logic))
477
+ return;
478
+ const result = logic.toEmbeddedTSFile();
479
+ results.push(result);
480
+ logic.sourceMap = result.sourceMap;
481
+ this.file2NodeMap.set(result.filePath, logic);
482
+ } catch (err) {
483
+ }
484
+ });
485
+
486
+ (module as App)?.authLogicsForCallInterface?.forEach?.((logic) => {
487
+ try {
488
+ if (!(logic instanceof Logic))
489
+ return;
490
+ const result = logic.toEmbeddedTSFile();
491
+ results.push(result);
492
+ logic.sourceMap = result.sourceMap;
493
+ this.file2NodeMap.set(result.filePath, logic);
494
+ } catch (err) {
495
+ }
496
+ });
497
+
423
498
  module.processes.forEach((process) => {
424
499
  try {
425
500
  const result = process.toEmbeddedTSFile();
@@ -508,6 +583,8 @@ export class NaslServer {
508
583
  async refreshApp(app: App) {
509
584
  // 清除所有问题
510
585
  this.diagnosticManager.clear();
586
+ // 刷新要清除文件列表
587
+ this.file2NodeMap.clear();
511
588
  await this.deleteDirectoryFiles({ directoryName: '/embedded' });
512
589
  // 清楚check count的数量
513
590
  await this.messager.requestCommand('_clearTimeout');
@@ -519,32 +596,32 @@ export class NaslServer {
519
596
  }
520
597
 
521
598
  /**
522
- * 初始化之前添加文件
523
- */
599
+ * 初始化之前添加文件
600
+ */
524
601
  addFile(file: tsProtocol.OpenRequestArgs) {
525
602
  return this.messager.requestCommand('addFile', file);
526
603
  }
527
604
 
528
- /**
529
- * 只新增文件
530
- * @param {*} files
531
- */
605
+ /**u
606
+ * 只新增文件
607
+ * @param {*} files
608
+ */
532
609
  writeFiles(files: Array<tsProtocol.OpenRequestArgs>) {
533
610
  return this.messager.requestCommand('writeFiles', files);
534
611
  }
535
612
 
536
613
  /**
537
- * 新增、修改
538
- * 删除文件 文件用修改内容为空模拟,防止报错
539
- * @param {*} args
540
- */
614
+ * 新增、修改
615
+ * 删除文件 文件用修改内容为空模拟,防止报错
616
+ * @param {*} args
617
+ */
541
618
  updateFiles(args: { outputFiles: Array<tsProtocol.OpenRequestArgs> }) {
542
619
  return this.messager.requestCommand('updateFiles', args);
543
620
  }
544
621
 
545
622
  /**
546
- * 清除一个目录下的所有文件
547
- */
623
+ * 清除一个目录下的所有文件
624
+ */
548
625
  deleteDirectoryFiles(args: { directoryName: string }) {
549
626
  return this.messager.requestCommand('deleteDirectoryFiles', args);
550
627
  }
@@ -590,6 +667,7 @@ export class NaslServer {
590
667
  }
591
668
 
592
669
  async references(args: tsProtocol.FileLocationRequestArgs) {
670
+ // debugger
593
671
  return ((await this.messager.requestCommand('references', args)) as any)?.response as tsProtocol.ReferencesResponseBody;
594
672
  }
595
673
 
@@ -624,10 +702,10 @@ export class NaslServer {
624
702
  if (node && node instanceof BaseNode) {
625
703
  const callFunction = node.parentNode.parentNode;
626
704
  /**
627
- * currentSource callFunction 的节点,要去到当前节点的位置
628
- * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
629
- * fileNode
630
- */
705
+ * currentSource callFunction 的节点,要去到当前节点的位置
706
+ * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
707
+ * fileNode
708
+ */
631
709
  const { currentSource, fileNode } = this.getCurrentSource(callFunction);
632
710
  if (!currentSource) {
633
711
  return [];
@@ -782,10 +860,10 @@ export class NaslServer {
782
860
  }
783
861
 
784
862
  /**
785
- * ts的 quickInfo方法,查询指定位置的详情
786
- * @param args 文件信息数组
787
- * @returns 查询到的
788
- */
863
+ * ts的 quickInfo方法,查询指定位置的详情
864
+ * @param args 文件信息数组
865
+ * @returns 查询到的
866
+ */
789
867
  _getTypeQuickinfo(args: any) {
790
868
  return this.messager.requestCommand('quickInfo', args) as unknown as { responseRequired: boolean; response: tsProtocol.QuickInfoResponseBody };
791
869
  }
@@ -824,11 +902,11 @@ export class NaslServer {
824
902
  }
825
903
 
826
904
  /**
827
- * 获取已经选中的内容的 下一级的内容
828
- * @param node 已经选中的内容
829
- * @param noFilterList 不过滤的key 的数据
830
- * @returns 可以选择的数据数组
831
- */
905
+ * 获取已经选中的内容的 下一级的内容
906
+ * @param node 已经选中的内容
907
+ * @param noFilterList 不过滤的key 的数据
908
+ * @returns 可以选择的数据数组
909
+ */
832
910
  getSelectNextCompletion(node: BaseNode, noFilterList?: Array<string>) {
833
911
  const { currentSource, fileNode } = this.getCurrentSource(node);
834
912
  // console.log(currentSource, fileNode);
@@ -867,8 +945,8 @@ export class NaslServer {
867
945
  }
868
946
 
869
947
  /**
870
- * 节点异常是只能挂载单个,如果已经了就不赋值了
871
- */
948
+ * 节点异常是只能挂载单个,如果已经了就不赋值了
949
+ */
872
950
  baseNodeAssignmentTsError(node: BaseNode, tsErrorDetail: Diagnostic) {
873
951
  if (node.tsErrorDetail)
874
952
  return;
@@ -927,6 +1005,7 @@ export class NaslServer {
927
1005
  }
928
1006
  });
929
1007
  }
1008
+ record.semanticDiagnostics.forEach((diag) => checkAStructure_(diag.text));
930
1009
  record.semanticDiagnostics = record.semanticDiagnostics
931
1010
  .map((diag) => this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode, record))
932
1011
  .filter((diag) => !!diag);
@@ -1062,6 +1141,7 @@ export class NaslServer {
1062
1141
  * @param fileNode 文件级别的节点
1063
1142
  * @returns 诊断结果
1064
1143
  */
1144
+
1065
1145
  _attachSuggestionDiagnostics(fileNode: BaseNode): Diagnostic[] {
1066
1146
  const diagnostics: Diagnostic[] = [];
1067
1147
  if (fileNode instanceof Logic || fileNode instanceof View) {
@@ -1308,6 +1388,9 @@ export class NaslServer {
1308
1388
  if ((node as JSBlock).code === `location.href = '/';`) {
1309
1389
  return null;
1310
1390
  }
1391
+ if ((node as JSBlock)?.code?.includes('use JSBlock')) {
1392
+ return null;
1393
+ }
1311
1394
  const diagnostic = {
1312
1395
  node,
1313
1396
  severity: 'warning',
@@ -1406,10 +1489,10 @@ export class NaslServer {
1406
1489
  }
1407
1490
 
1408
1491
  /**
1409
- * 额外的诊断
1410
- * @param fileNode 文件级别的节点
1411
- * @returns 诊断结果
1412
- */
1492
+ * 额外的诊断
1493
+ * @param fileNode 文件级别的节点
1494
+ * @returns 诊断结果
1495
+ */
1413
1496
  _attachDiagnostics(fileNode: BaseNode): Diagnostic[] {
1414
1497
  // 每次诊断前先清空这个Set
1415
1498
  this.logicSetWithComponentLogic = new Set<string>();
@@ -2056,18 +2139,18 @@ export class NaslServer {
2056
2139
  diagnostics.push(diagnostic);
2057
2140
  }
2058
2141
  /**
2059
- * 如果节点是内置函数
2060
- * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
2061
- * && 他在父级中,不在body
2062
- * && 也不再 if的线上
2063
- * && 也不再 switch的线上consequent
2064
- * && 也不再草稿区域
2065
- * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
2066
- * && 而且也没有类型,就说明在槽位里,就需要报错
2067
- *
2068
- * 如果是内置函数而且也不在线上
2069
- * 只有下面自己实现的函数才会报错
2070
- */
2142
+ * 如果节点是内置函数
2143
+ * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
2144
+ * && 他在父级中,不在body
2145
+ * && 也不再 if的线上
2146
+ * && 也不再 switch的线上consequent
2147
+ * && 也不再草稿区域
2148
+ * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
2149
+ * && 而且也没有类型,就说明在槽位里,就需要报错
2150
+ *
2151
+ * 如果是内置函数而且也不在线上
2152
+ * 只有下面自己实现的函数才会报错
2153
+ */
2071
2154
  if (node instanceof CallFunction && node.parentKey !== 'body' && node.parentKey !== 'alternate' && node.parentKey !== 'playground' && node.parentKey !== 'consequent' && node.parentNode?.parentNode?.concept !== 'CallInterface' && !node.__TypeAnnotation) {
2072
2155
  let showErr = false;
2073
2156
  if (node.parentNode?.parentNode?.concept === 'CallLogic') {
@@ -2198,11 +2281,11 @@ export class NaslServer {
2198
2281
  }
2199
2282
 
2200
2283
  /**
2201
- * 单个问题的诊断处理
2202
- * @param diagnostic 诊断问题
2203
- * @param fileNode 页面节点
2204
- * @returns 处理后的结果
2205
- */
2284
+ * 单个问题的诊断处理
2285
+ * @param diagnostic 诊断问题
2286
+ * @param fileNode 页面节点
2287
+ * @returns 处理后的结果
2288
+ */
2206
2289
  _resolveDiagnostic(diagnostic: tsProtocol.DiagnosticWithFileName, fileNode: FileNode, record: DiagnosticRecord): Diagnostic {
2207
2290
  // 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
2208
2291
  if ((fileNode as any).module && !(fileNode instanceof ConfigProperty)) {
@@ -2212,7 +2295,9 @@ export class NaslServer {
2212
2295
  // if ('compilerInfoMap' in fileNode && (fileNode as any).compilerInfoMap?.java) {
2213
2296
  // return;
2214
2297
  // }
2215
-
2298
+ if (fileNode.concept === 'OverriddenLogic' && diagnostic.text === `'__LogicEmpty' is declared but its value is never read.`) {
2299
+ return;
2300
+ }
2216
2301
  const minRange = this._findMinRange(diagnostic, fileNode);
2217
2302
  const tsErrorDetail = {
2218
2303
  severity: diagnostic.category === 'error' ? 'error' : 'warning',
@@ -2235,11 +2320,11 @@ export class NaslServer {
2235
2320
  }
2236
2321
 
2237
2322
  /**
2238
- * 通过节点诊断反过来查找节点
2239
- * @param diagnostic 诊断信息
2240
- * @param fileNode 文件级别节点
2241
- * @returns 找到的节点
2242
- */
2323
+ * 通过节点诊断反过来查找节点
2324
+ * @param diagnostic 诊断信息
2325
+ * @param fileNode 文件级别节点
2326
+ * @returns 找到的节点
2327
+ */
2243
2328
  _findMinRange(diagnostic: tsProtocol.DiagnosticWithFileName | tsProtocol.ReferencesResponseItem, fileNode: FileNode) {
2244
2329
  let minRange: MinRange;
2245
2330
  const sourceMap: SourceMap = fileNode.sourceMap;
@@ -2279,7 +2364,13 @@ export class NaslServer {
2279
2364
  }
2280
2365
  }
2281
2366
  } else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
2282
- if (minRange.item.range.start.line !== diagnostic.start.line) {
2367
+ // 行都一致 ,比较列
2368
+ if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
2369
+ // 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
2370
+ if (item.range.start.character > minRange.item.range.start.character) {
2371
+ minRange = { node, item };
2372
+ }
2373
+ } else {
2283
2374
  minRange = { node, item };
2284
2375
  }
2285
2376
  }
@@ -2304,8 +2395,8 @@ export class NaslServer {
2304
2395
  const { currentSource, fileNode } = this.getCurrentSource(node);
2305
2396
  let refsList: tsProtocol.ReferencesResponseItem[] = [];
2306
2397
  /**
2307
- * 未完成创建的节点 ,或者异常情况 可能找不到节点
2308
- */
2398
+ * 未完成创建的节点 ,或者异常情况 可能找不到节点
2399
+ */
2309
2400
  if (currentSource) {
2310
2401
  const newRefs = await this.references({
2311
2402
  file: (fileNode as FileNode).getEmbeddedFilePath(),
@@ -2341,12 +2432,12 @@ export class NaslServer {
2341
2432
  const dataSourceFile = (fileNode as FileNode).getEmbeddedFilePath();
2342
2433
  const entityFilePrefix = dataSourceFile.replace('.ts', '');
2343
2434
  /**
2344
- * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2345
- * 所以全部过滤掉了,
2346
- * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2347
- * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2348
- * 进行过滤
2349
- */
2435
+ * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2436
+ * 所以全部过滤掉了,
2437
+ * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2438
+ * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2439
+ * 进行过滤
2440
+ */
2350
2441
  // 不要数据源下面的实体里的引用 ,保留原始的节点内容
2351
2442
  let flag = false;
2352
2443
  if (item.file.includes(entityFilePrefix)) {
@@ -2407,12 +2498,12 @@ export class NaslServer {
2407
2498
  refsList = [...refsList, ...filterViewRefs];
2408
2499
  }
2409
2500
  /**
2410
- * 暂时不要了, 因为生成的结构发生了变化
2411
- * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2412
- * 找到第一个 { 之前的变量 进行修改
2413
- * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2414
- * 最后一个,因为生成的规则不一样
2415
- */
2501
+ * 暂时不要了, 因为生成的结构发生了变化
2502
+ * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2503
+ * 找到第一个 { 之前的变量 进行修改
2504
+ * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2505
+ * 最后一个,因为生成的规则不一样
2506
+ */
2416
2507
  // if (node instanceof View) {
2417
2508
  // const code = currentSource.code;
2418
2509
  // const viewIndex = code.indexOf(' {');
@@ -2424,8 +2515,8 @@ export class NaslServer {
2424
2515
  // refsList = [...viewRefs.refs];
2425
2516
  // }
2426
2517
  /**
2427
- * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2428
- */
2518
+ * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2519
+ */
2429
2520
  if (node instanceof ViewElement) {
2430
2521
  if (currentSource) {
2431
2522
  const code = currentSource.code;
@@ -2565,13 +2656,13 @@ export class NaslServer {
2565
2656
  }
2566
2657
 
2567
2658
  /**
2568
- * 查找引用,并且做一些 修改前的准备工作,
2569
- * 有引用有的话,就返回集合
2570
- * @param node 当前重命名的节点
2571
- * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2572
- * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2573
- * @returns 找到的引用
2574
- */
2659
+ * 查找引用,并且做一些 修改前的准备工作,
2660
+ * 有引用有的话,就返回集合
2661
+ * @param node 当前重命名的节点
2662
+ * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2663
+ * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2664
+ * @returns 找到的引用
2665
+ */
2575
2666
  _renamePrepare(node: BaseNode, refsList: any[], newValue: string) {
2576
2667
  const oldName = node?.name;
2577
2668
  const result = refsList
@@ -2714,7 +2805,9 @@ export class NaslServer {
2714
2805
  // 如果是修改实体,引发节点依赖实体发生改变的
2715
2806
  if (minRange.node instanceof EntityProperty) {
2716
2807
  minRange.setTypeMethods = 'setRelationEntity';
2717
- } else if (minRange.node instanceof QueryFieldExpression || minRange.node instanceof QueryGroupByExpression) {
2808
+ } else if (minRange.node instanceof QueryFieldExpression) {
2809
+ minRange.setTypeMethods = 'setEntityAsNameAndEffect';
2810
+ } else if (minRange.node instanceof QueryGroupByExpression) {
2718
2811
  minRange.setTypeMethods = 'setEntityAsName';
2719
2812
  } else if (minRange.node instanceof QueryFromExpression || minRange.node instanceof QueryJoinExpression) {
2720
2813
  minRange.setTypeMethods = 'setEntityName';
@@ -2941,12 +3034,17 @@ export class NaslServer {
2941
3034
  if (minRange.node instanceof BindEvent && node instanceof Param) {
2942
3035
  return null;
2943
3036
  }
3037
+
3038
+ if (minRange.node instanceof Argument && node instanceof Param) {
3039
+ minRange.setTypeMethods = 'setKeyword';
3040
+ }
3041
+
2944
3042
  /**
2945
- * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
2946
- * 流程改名不触发Logic改名
2947
- * 如果是修改param查找到logic就不操作
2948
- * 除非想在内部修改别的内容所以暂时屏蔽掉
2949
- */
3043
+ * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
3044
+ * 流程改名不触发Logic改名
3045
+ * 如果是修改param查找到logic就不操作
3046
+ * 除非想在内部修改别的内容所以暂时屏蔽掉
3047
+ */
2950
3048
  if (minRange.node instanceof Logic && node !== minRange.node) {
2951
3049
  return null;
2952
3050
  }
@@ -2993,7 +3091,17 @@ export class NaslServer {
2993
3091
  return minRange;
2994
3092
  })
2995
3093
  // 过滤掉不需要操作的
2996
- .filter((item) => !!item);
3094
+ .filter((item) => !!item)
3095
+ // 排序:
3096
+ // QueryFieldExpression依赖Entity,把Entity放在QueryFieldExpression前,
3097
+ .sort((a, b) => {
3098
+ if (a.node.concept === 'QueryFieldExpression') {
3099
+ return 1;
3100
+ } else if (b.node.concept === 'QueryFieldExpression') {
3101
+ return -1;
3102
+ }
3103
+ return 0;
3104
+ });
2997
3105
  return result;
2998
3106
  }
2999
3107
 
@@ -3007,8 +3115,20 @@ export class NaslServer {
3007
3115
  const minRange: MinRange = this._findMinRange(record, fileNode as FileNode);
3008
3116
  if (minRange) {
3009
3117
  // 如果找到节点是callLogic就去更新
3010
- if ((minRange.node instanceof CallLogic || minRange.node instanceof Destination) && node instanceof Param) {
3011
- minRange.node.addCalleeArg(parantNode as any);
3118
+ if (node instanceof Param) {
3119
+ if (minRange.node instanceof CallLogic) {
3120
+ minRange.node.addCalleeArg(parantNode as any);
3121
+ } else if (minRange.node instanceof Destination) {
3122
+ // 跳转页面,可能在父级下增加参数,子的跳转页面也可以查找到引用
3123
+ // 精准匹配子页面的内容
3124
+ const viewNode = node.parentNode;
3125
+ if (viewNode instanceof View) {
3126
+ const viewNamespace = viewNode.getNamespace();
3127
+ if (viewNamespace === minRange.node.viewNamespace && viewNode.name === minRange.node.viewName) {
3128
+ minRange.node.addCalleeArg(parantNode as any);
3129
+ }
3130
+ }
3131
+ }
3012
3132
  }
3013
3133
  }
3014
3134
  });
@@ -3178,11 +3298,11 @@ export class NaslServer {
3178
3298
  }
3179
3299
 
3180
3300
  /**
3181
- * 处理tree的队列,把相同节点进行合并
3182
- * 这里把当前二维数组进行一个整合
3183
- * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3184
- * @returns 最后要使用到的节点和对应的子集
3185
- */
3301
+ * 处理tree的队列,把相同节点进行合并
3302
+ * 这里把当前二维数组进行一个整合
3303
+ * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3304
+ * @returns 最后要使用到的节点和对应的子集
3305
+ */
3186
3306
  handleTreeQueue(queueLists: Array<Array<QuoteNode>>) {
3187
3307
  const map = new Map<QuoteNode, Array<QuoteNode>>();
3188
3308
  let root: QuoteNode = null;
@@ -3210,11 +3330,11 @@ export class NaslServer {
3210
3330
  }
3211
3331
 
3212
3332
  /**
3213
- * 递归调用输出结果
3214
- * @param root 一个根节点
3215
- * @param map 当前所有节点的map对象
3216
- * @returns 当前节点,最后输出所有节点
3217
- */
3333
+ * 递归调用输出结果
3334
+ * @param root 一个根节点
3335
+ * @param map 当前所有节点的map对象
3336
+ * @returns 当前节点,最后输出所有节点
3337
+ */
3218
3338
  _recursionCreateResult(root: QuoteNode, map: Map<QuoteNode, Array<QuoteNode>>) {
3219
3339
  const children = (map.get(root) || []).map((item: QuoteNode) => this._recursionCreateResult(item, map));
3220
3340
  if (children && children.length) {
@@ -3224,9 +3344,9 @@ export class NaslServer {
3224
3344
  }
3225
3345
 
3226
3346
  /**
3227
- * 获取
3228
- * 当前this上下文 的Source 和 父级文件级别的节点
3229
- */
3347
+ * 获取
3348
+ * 当前this上下文 的Source 和 父级文件级别的节点
3349
+ */
3230
3350
  getCurrentSource(node: BaseNode) {
3231
3351
  if (node instanceof App || node instanceof Theme)
3232
3352
  return { fileNode: null };
@@ -3243,6 +3363,7 @@ export class NaslServer {
3243
3363
  && !(fileNode.parentNode instanceof Module)
3244
3364
  && !(fileNode.parentNode instanceof DataSource)
3245
3365
  && !(fileNode.parentNode instanceof Frontend)
3366
+ && !(fileNode.parentNode instanceof Backend)
3246
3367
  && !(fileNode instanceof View)
3247
3368
  && !(fileNode instanceof ConfigProperty)
3248
3369
  ) {
@@ -3334,9 +3455,9 @@ export class NaslServer {
3334
3455
  }
3335
3456
 
3336
3457
  /**获取当前节点的已知类型
3337
- * @param node 当前要获取类型的节点
3338
- * @returns 不需要去查就可以返回类型的节点
3339
- */
3458
+ * @param node 当前要获取类型的节点
3459
+ * @returns 不需要去查就可以返回类型的节点
3460
+ */
3340
3461
  getCurrentNodeKnownTypeAnnotation(node: BaseNode) {
3341
3462
  if (node.concept === 'StringLiteral' || node.concept === 'StringInterpolation' || node.concept === 'BooleanLiteral' || node.concept === 'NullLiteral') {
3342
3463
  let type = 'String';
@@ -3457,6 +3578,11 @@ export class NaslServer {
3457
3578
  'QueryFieldExpression',
3458
3579
  'QueryGroupByExpression',
3459
3580
  'Param',
3581
+ 'AuthLogic',
3582
+ 'AuthLogic',
3583
+ 'BackendVariable',
3584
+ 'AuthLogicForCallInterface',
3585
+ 'CallAuthInterface',
3460
3586
  ].includes(node.concept))
3461
3587
  return;
3462
3588
 
@@ -3798,7 +3924,7 @@ export class NaslServer {
3798
3924
  jsonNode.typeAnnotation = (value as TypeAnnotation).toJSON();
3799
3925
  }
3800
3926
  }
3801
- if (node instanceof NewComposite && node.typeAnnotation?.typeKind === 'anonymousStructure') {
3927
+ if (node instanceof NewComposite && (node.typeAnnotation?.typeKind === 'anonymousStructure' || node.typeAnnotation?.typeKind === 'generic')) {
3802
3928
  const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
3803
3929
  jsonNode.typeAnnotation = (value as TypeAnnotation).toJSON();
3804
3930
  }
@@ -3806,10 +3932,10 @@ export class NaslServer {
3806
3932
  }
3807
3933
 
3808
3934
  /**
3809
- * 获取getArgument的参数位的类型
3810
- * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3811
- * 获取logic的默认值和原来Arg的类型和默认值对应
3812
- */
3935
+ * 获取getArgument的参数位的类型
3936
+ * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3937
+ * 获取logic的默认值和原来Arg的类型和默认值对应
3938
+ */
3813
3939
  getArgumentTypeAnnotation(node: Argument, QuickInfoNodes: QuickInfoNodes, types: Map<BaseNode, TypeAnnotation>) {
3814
3940
  // 直接复用内部expression的type类型
3815
3941
  if (node.parentNode instanceof CallLogic && node.parentNode.calleeNamespace?.includes('entities') && node.parentNode.calleeNamespace?.includes('logics') && node.parentNode.calleeName === 'delete') {
@@ -3935,8 +4061,8 @@ export class NaslServer {
3935
4061
  const filePath = (fileNode as FileNode).getEmbeddedFilePath();
3936
4062
  // 如果要删除,而且当前要删Logic就直接删除并且清除错误
3937
4063
  /**
3938
- * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
3939
- */
4064
+ * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
4065
+ */
3940
4066
  let outputFiles: any = [];
3941
4067
  // 删除之前先查一下内容的依赖
3942
4068
  const newRefs = await this.references({
@@ -4063,7 +4189,7 @@ export class NaslServer {
4063
4189
  // }
4064
4190
  } else if (targetNode instanceof ViewElement) {
4065
4191
  /**
4066
- * 因为页面组件比较特殊
4192
+ * 因为平台类型比较特殊
4067
4193
  * 修改之后只用查页面本身就好了
4068
4194
  */
4069
4195
  // 更新文件之后
@@ -4188,8 +4314,8 @@ export class NaslServer {
4188
4314
  }
4189
4315
  }
4190
4316
  /**
4191
- * DataSource只会重命名时候,需要把子集全部重新生成一下
4192
- */
4317
+ * DataSource只会重命名时候,需要把子集全部重新生成一下
4318
+ */
4193
4319
  if (fileNode instanceof DataSource) {
4194
4320
  (fileNode as DataSource).entities.forEach(async (entity) => {
4195
4321
  try {