@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
@@ -56,6 +56,8 @@ const EmbeddedTSFileLineMap = {
56
56
  };
57
57
  const EmbeddedTSFileOffsetMap = {
58
58
  Variable: 12,
59
+ // Backend:12,
60
+ BackendVariable: 12,
59
61
  ConfigProperty: 12,
60
62
  };
61
63
  const SentryMessager = (0, sentry_1.sentryMonitorTSWorkerMessager)(Messager_1.default);
@@ -162,8 +164,8 @@ class NaslServer {
162
164
  /**
163
165
  * 多个行为进行合并
164
166
  * 合并规则是
165
- * 1.[a,b,c,c] 在cc的时候,在已有一个c,又来一个c的时候,如果他们不都是file级别的节点
166
- * 就可以前面的内容去掉,只保留最后一个
167
+ * 1.[a,b,c,c] 在cc的时候,在已有一个c,又来一个c的时候,file级别的节点
168
+ * 就可以前面的内容去掉,只保留最后一个, 但是如果前面那个有携带file
167
169
  * 2.[a,b,c,b,c] 在bc已存在,又来了bc 这就都要保留,因为可能顺序有相关性,不能去掉
168
170
  * 理论上只处理同时几个操作 合并,
169
171
  * 3.有field的也直接保留
@@ -172,13 +174,22 @@ class NaslServer {
172
174
  const changeEvent = item.originEvent;
173
175
  const changeNode = changeEvent.target;
174
176
  const { fileNode } = this.getCurrentSource(changeNode);
175
- if (changeNode !== fileNode || !changeEvent.field) {
176
- const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
177
- const target = changeStackItem.target;
178
- const { fileNode: targetFileNode } = this.getCurrentSource(target);
179
- return targetFileNode === fileNode;
180
- });
181
- if (findLastIndex === this.changeStackList.length - 1) {
177
+ // 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
178
+ // @ts-ignore
179
+ const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
180
+ const target = changeStackItem.target;
181
+ const { fileNode: targetFileNode } = this.getCurrentSource(target);
182
+ return targetFileNode === fileNode;
183
+ });
184
+ // 如果当前找到了节点,而且节点在数组的最后一项,说明此次可以合并
185
+ if (findLastIndex !== -1 && findLastIndex === this.changeStackList.length - 1) {
186
+ // 最后一项有field就直接保留,新的也不塞,直接return
187
+ if (this.changeStackList[findLastIndex]?.field) {
188
+ // 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
189
+ return;
190
+ }
191
+ else {
192
+ // 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
182
193
  this.changeStackList.pop();
183
194
  }
184
195
  }
@@ -235,6 +246,31 @@ class NaslServer {
235
246
  }
236
247
  });
237
248
  if (module instanceof concepts_1.App) {
249
+ module.overriddenLogics?.forEach?.((logic) => {
250
+ try {
251
+ if (!(logic instanceof concepts_1.OverriddenLogic))
252
+ return;
253
+ const result = logic.toEmbeddedTSFile();
254
+ results.push(result);
255
+ logic.sourceMap = result.sourceMap;
256
+ this.file2NodeMap.set(result.filePath, logic);
257
+ }
258
+ catch (err) {
259
+ console.error('err: ', err);
260
+ }
261
+ });
262
+ module?.backend?.variables?.forEach((backdndVariable) => {
263
+ try {
264
+ const result = backdndVariable.toEmbeddedTSFile();
265
+ results.push(result);
266
+ // sourceMap都存在目录级别内容下,在页面层级下去找
267
+ backdndVariable.sourceMap = result.sourceMap;
268
+ this.file2NodeMap.set(result.filePath, backdndVariable);
269
+ }
270
+ catch (err) {
271
+ console.error(err);
272
+ }
273
+ });
238
274
  module.frontends?.forEach((frontend) => {
239
275
  try {
240
276
  const result = frontend.toEmbeddedTSFile();
@@ -258,6 +294,21 @@ class NaslServer {
258
294
  console.log(err);
259
295
  }
260
296
  });
297
+ frontend.bindEvents.forEach((bindEvent) => {
298
+ if (bindEvent?.logics && bindEvent?.logics?.length > 0) {
299
+ bindEvent.logics.forEach((logic) => {
300
+ try {
301
+ const result = logic.toEmbeddedTSFile();
302
+ results.push(result);
303
+ logic.sourceMap = result.sourceMap;
304
+ this.file2NodeMap.set(result.filePath, logic);
305
+ }
306
+ catch (err) {
307
+ console.error('err: ', err);
308
+ }
309
+ });
310
+ }
311
+ });
261
312
  // view的生成
262
313
  if (!config_1.config.closeViews) {
263
314
  this.view2TSFile(frontend.views, results);
@@ -338,6 +389,30 @@ class NaslServer {
338
389
  catch (err) {
339
390
  }
340
391
  });
392
+ module?.authLogics?.forEach?.((logic) => {
393
+ try {
394
+ if (!(logic instanceof concepts_1.Logic))
395
+ return;
396
+ const result = logic.toEmbeddedTSFile();
397
+ results.push(result);
398
+ logic.sourceMap = result.sourceMap;
399
+ this.file2NodeMap.set(result.filePath, logic);
400
+ }
401
+ catch (err) {
402
+ }
403
+ });
404
+ module?.authLogicsForCallInterface?.forEach?.((logic) => {
405
+ try {
406
+ if (!(logic instanceof concepts_1.Logic))
407
+ return;
408
+ const result = logic.toEmbeddedTSFile();
409
+ results.push(result);
410
+ logic.sourceMap = result.sourceMap;
411
+ this.file2NodeMap.set(result.filePath, logic);
412
+ }
413
+ catch (err) {
414
+ }
415
+ });
341
416
  module.processes.forEach((process) => {
342
417
  try {
343
418
  const result = process.toEmbeddedTSFile();
@@ -425,6 +500,8 @@ class NaslServer {
425
500
  async refreshApp(app) {
426
501
  // 清除所有问题
427
502
  this.diagnosticManager.clear();
503
+ // 刷新要清除文件列表
504
+ this.file2NodeMap.clear();
428
505
  await this.deleteDirectoryFiles({ directoryName: '/embedded' });
429
506
  // 清楚check count的数量
430
507
  await this.messager.requestCommand('_clearTimeout');
@@ -435,29 +512,29 @@ class NaslServer {
435
512
  // check内容后,会自动走增量类型标注完善全部类型
436
513
  }
437
514
  /**
438
- * 初始化之前添加文件
439
- */
515
+ * 初始化之前添加文件
516
+ */
440
517
  addFile(file) {
441
518
  return this.messager.requestCommand('addFile', file);
442
519
  }
443
- /**
444
- * 只新增文件
445
- * @param {*} files
446
- */
520
+ /**u
521
+ * 只新增文件
522
+ * @param {*} files
523
+ */
447
524
  writeFiles(files) {
448
525
  return this.messager.requestCommand('writeFiles', files);
449
526
  }
450
527
  /**
451
- * 新增、修改
452
- * 删除文件 文件用修改内容为空模拟,防止报错
453
- * @param {*} args
454
- */
528
+ * 新增、修改
529
+ * 删除文件 文件用修改内容为空模拟,防止报错
530
+ * @param {*} args
531
+ */
455
532
  updateFiles(args) {
456
533
  return this.messager.requestCommand('updateFiles', args);
457
534
  }
458
535
  /**
459
- * 清除一个目录下的所有文件
460
- */
536
+ * 清除一个目录下的所有文件
537
+ */
461
538
  deleteDirectoryFiles(args) {
462
539
  return this.messager.requestCommand('deleteDirectoryFiles', args);
463
540
  }
@@ -500,6 +577,7 @@ class NaslServer {
500
577
  return this.messager.requestCommand('fileReferences', filePath);
501
578
  }
502
579
  async references(args) {
580
+ // debugger
503
581
  return (await this.messager.requestCommand('references', args))?.response;
504
582
  }
505
583
  getValueSelectCompletion(node, value, noFilterList) {
@@ -532,10 +610,10 @@ class NaslServer {
532
610
  if (node && node instanceof concepts_1.BaseNode) {
533
611
  const callFunction = node.parentNode.parentNode;
534
612
  /**
535
- * currentSource callFunction 的节点,要去到当前节点的位置
536
- * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
537
- * fileNode
538
- */
613
+ * currentSource callFunction 的节点,要去到当前节点的位置
614
+ * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
615
+ * fileNode
616
+ */
539
617
  const { currentSource, fileNode } = this.getCurrentSource(callFunction);
540
618
  if (!currentSource) {
541
619
  return [];
@@ -692,10 +770,10 @@ class NaslServer {
692
770
  }
693
771
  }
694
772
  /**
695
- * ts的 quickInfo方法,查询指定位置的详情
696
- * @param args 文件信息数组
697
- * @returns 查询到的
698
- */
773
+ * ts的 quickInfo方法,查询指定位置的详情
774
+ * @param args 文件信息数组
775
+ * @returns 查询到的
776
+ */
699
777
  _getTypeQuickinfo(args) {
700
778
  return this.messager.requestCommand('quickInfo', args);
701
779
  }
@@ -727,11 +805,11 @@ class NaslServer {
727
805
  return result;
728
806
  }
729
807
  /**
730
- * 获取已经选中的内容的 下一级的内容
731
- * @param node 已经选中的内容
732
- * @param noFilterList 不过滤的key 的数据
733
- * @returns 可以选择的数据数组
734
- */
808
+ * 获取已经选中的内容的 下一级的内容
809
+ * @param node 已经选中的内容
810
+ * @param noFilterList 不过滤的key 的数据
811
+ * @returns 可以选择的数据数组
812
+ */
735
813
  getSelectNextCompletion(node, noFilterList) {
736
814
  const { currentSource, fileNode } = this.getCurrentSource(node);
737
815
  // console.log(currentSource, fileNode);
@@ -767,8 +845,8 @@ class NaslServer {
767
845
  // diagnosticManager.pushAll(records);
768
846
  }
769
847
  /**
770
- * 节点异常是只能挂载单个,如果已经了就不赋值了
771
- */
848
+ * 节点异常是只能挂载单个,如果已经了就不赋值了
849
+ */
772
850
  baseNodeAssignmentTsError(node, tsErrorDetail) {
773
851
  if (node.tsErrorDetail)
774
852
  return;
@@ -823,6 +901,7 @@ class NaslServer {
823
901
  }
824
902
  });
825
903
  }
904
+ record.semanticDiagnostics.forEach((diag) => (0, translator_2.checkAStructure_)(diag.text));
826
905
  record.semanticDiagnostics = record.semanticDiagnostics
827
906
  .map((diag) => this._resolveDiagnostic(diag, node, record))
828
907
  .filter((diag) => !!diag);
@@ -1201,6 +1280,9 @@ class NaslServer {
1201
1280
  if (node.code === `location.href = '/';`) {
1202
1281
  return null;
1203
1282
  }
1283
+ if (node?.code?.includes('use JSBlock')) {
1284
+ return null;
1285
+ }
1204
1286
  const diagnostic = {
1205
1287
  node,
1206
1288
  severity: 'warning',
@@ -1303,10 +1385,10 @@ class NaslServer {
1303
1385
  return flag;
1304
1386
  }
1305
1387
  /**
1306
- * 额外的诊断
1307
- * @param fileNode 文件级别的节点
1308
- * @returns 诊断结果
1309
- */
1388
+ * 额外的诊断
1389
+ * @param fileNode 文件级别的节点
1390
+ * @returns 诊断结果
1391
+ */
1310
1392
  _attachDiagnostics(fileNode) {
1311
1393
  // 每次诊断前先清空这个Set
1312
1394
  this.logicSetWithComponentLogic = new Set();
@@ -1975,18 +2057,18 @@ class NaslServer {
1975
2057
  diagnostics.push(diagnostic);
1976
2058
  }
1977
2059
  /**
1978
- * 如果节点是内置函数
1979
- * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
1980
- * && 他在父级中,不在body
1981
- * && 也不再 if的线上
1982
- * && 也不再 switch的线上consequent
1983
- * && 也不再草稿区域
1984
- * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
1985
- * && 而且也没有类型,就说明在槽位里,就需要报错
1986
- *
1987
- * 如果是内置函数而且也不在线上
1988
- * 只有下面自己实现的函数才会报错
1989
- */
2060
+ * 如果节点是内置函数
2061
+ * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
2062
+ * && 他在父级中,不在body
2063
+ * && 也不再 if的线上
2064
+ * && 也不再 switch的线上consequent
2065
+ * && 也不再草稿区域
2066
+ * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
2067
+ * && 而且也没有类型,就说明在槽位里,就需要报错
2068
+ *
2069
+ * 如果是内置函数而且也不在线上
2070
+ * 只有下面自己实现的函数才会报错
2071
+ */
1990
2072
  if (node instanceof concepts_1.CallFunction && node.parentKey !== 'body' && node.parentKey !== 'alternate' && node.parentKey !== 'playground' && node.parentKey !== 'consequent' && node.parentNode?.parentNode?.concept !== 'CallInterface' && !node.__TypeAnnotation) {
1991
2073
  let showErr = false;
1992
2074
  if (node.parentNode?.parentNode?.concept === 'CallLogic') {
@@ -2117,11 +2199,11 @@ class NaslServer {
2117
2199
  }
2118
2200
  }
2119
2201
  /**
2120
- * 单个问题的诊断处理
2121
- * @param diagnostic 诊断问题
2122
- * @param fileNode 页面节点
2123
- * @returns 处理后的结果
2124
- */
2202
+ * 单个问题的诊断处理
2203
+ * @param diagnostic 诊断问题
2204
+ * @param fileNode 页面节点
2205
+ * @returns 处理后的结果
2206
+ */
2125
2207
  _resolveDiagnostic(diagnostic, fileNode, record) {
2126
2208
  // 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
2127
2209
  if (fileNode.module && !(fileNode instanceof concepts_1.ConfigProperty)) {
@@ -2131,6 +2213,9 @@ class NaslServer {
2131
2213
  // if ('compilerInfoMap' in fileNode && (fileNode as any).compilerInfoMap?.java) {
2132
2214
  // return;
2133
2215
  // }
2216
+ if (fileNode.concept === 'OverriddenLogic' && diagnostic.text === `'__LogicEmpty' is declared but its value is never read.`) {
2217
+ return;
2218
+ }
2134
2219
  const minRange = this._findMinRange(diagnostic, fileNode);
2135
2220
  const tsErrorDetail = {
2136
2221
  severity: diagnostic.category === 'error' ? 'error' : 'warning',
@@ -2152,11 +2237,11 @@ class NaslServer {
2152
2237
  return result;
2153
2238
  }
2154
2239
  /**
2155
- * 通过节点诊断反过来查找节点
2156
- * @param diagnostic 诊断信息
2157
- * @param fileNode 文件级别节点
2158
- * @returns 找到的节点
2159
- */
2240
+ * 通过节点诊断反过来查找节点
2241
+ * @param diagnostic 诊断信息
2242
+ * @param fileNode 文件级别节点
2243
+ * @returns 找到的节点
2244
+ */
2160
2245
  _findMinRange(diagnostic, fileNode) {
2161
2246
  let minRange;
2162
2247
  const sourceMap = fileNode.sourceMap;
@@ -2199,7 +2284,14 @@ class NaslServer {
2199
2284
  }
2200
2285
  }
2201
2286
  else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
2202
- if (minRange.item.range.start.line !== diagnostic.start.line) {
2287
+ // 行都一致 ,比较列
2288
+ if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
2289
+ // 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
2290
+ if (item.range.start.character > minRange.item.range.start.character) {
2291
+ minRange = { node, item };
2292
+ }
2293
+ }
2294
+ else {
2203
2295
  minRange = { node, item };
2204
2296
  }
2205
2297
  }
@@ -2223,8 +2315,8 @@ class NaslServer {
2223
2315
  const { currentSource, fileNode } = this.getCurrentSource(node);
2224
2316
  let refsList = [];
2225
2317
  /**
2226
- * 未完成创建的节点 ,或者异常情况 可能找不到节点
2227
- */
2318
+ * 未完成创建的节点 ,或者异常情况 可能找不到节点
2319
+ */
2228
2320
  if (currentSource) {
2229
2321
  const newRefs = await this.references({
2230
2322
  file: fileNode.getEmbeddedFilePath(),
@@ -2260,12 +2352,12 @@ class NaslServer {
2260
2352
  const dataSourceFile = fileNode.getEmbeddedFilePath();
2261
2353
  const entityFilePrefix = dataSourceFile.replace('.ts', '');
2262
2354
  /**
2263
- * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2264
- * 所以全部过滤掉了,
2265
- * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2266
- * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2267
- * 进行过滤
2268
- */
2355
+ * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2356
+ * 所以全部过滤掉了,
2357
+ * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2358
+ * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2359
+ * 进行过滤
2360
+ */
2269
2361
  // 不要数据源下面的实体里的引用 ,保留原始的节点内容
2270
2362
  let flag = false;
2271
2363
  if (item.file.includes(entityFilePrefix)) {
@@ -2324,12 +2416,12 @@ class NaslServer {
2324
2416
  refsList = [...refsList, ...filterViewRefs];
2325
2417
  }
2326
2418
  /**
2327
- * 暂时不要了, 因为生成的结构发生了变化
2328
- * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2329
- * 找到第一个 { 之前的变量 进行修改
2330
- * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2331
- * 最后一个,因为生成的规则不一样
2332
- */
2419
+ * 暂时不要了, 因为生成的结构发生了变化
2420
+ * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2421
+ * 找到第一个 { 之前的变量 进行修改
2422
+ * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2423
+ * 最后一个,因为生成的规则不一样
2424
+ */
2333
2425
  // if (node instanceof View) {
2334
2426
  // const code = currentSource.code;
2335
2427
  // const viewIndex = code.indexOf(' {');
@@ -2341,8 +2433,8 @@ class NaslServer {
2341
2433
  // refsList = [...viewRefs.refs];
2342
2434
  // }
2343
2435
  /**
2344
- * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2345
- */
2436
+ * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2437
+ */
2346
2438
  if (node instanceof concepts_1.ViewElement) {
2347
2439
  if (currentSource) {
2348
2440
  const code = currentSource.code;
@@ -2480,13 +2572,13 @@ class NaslServer {
2480
2572
  return refsList;
2481
2573
  }
2482
2574
  /**
2483
- * 查找引用,并且做一些 修改前的准备工作,
2484
- * 有引用有的话,就返回集合
2485
- * @param node 当前重命名的节点
2486
- * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2487
- * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2488
- * @returns 找到的引用
2489
- */
2575
+ * 查找引用,并且做一些 修改前的准备工作,
2576
+ * 有引用有的话,就返回集合
2577
+ * @param node 当前重命名的节点
2578
+ * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2579
+ * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2580
+ * @returns 找到的引用
2581
+ */
2490
2582
  _renamePrepare(node, refsList, newValue) {
2491
2583
  const oldName = node?.name;
2492
2584
  const result = refsList
@@ -2631,7 +2723,10 @@ class NaslServer {
2631
2723
  if (minRange.node instanceof concepts_1.EntityProperty) {
2632
2724
  minRange.setTypeMethods = 'setRelationEntity';
2633
2725
  }
2634
- else if (minRange.node instanceof concepts_1.QueryFieldExpression || minRange.node instanceof concepts_1.QueryGroupByExpression) {
2726
+ else if (minRange.node instanceof concepts_1.QueryFieldExpression) {
2727
+ minRange.setTypeMethods = 'setEntityAsNameAndEffect';
2728
+ }
2729
+ else if (minRange.node instanceof concepts_1.QueryGroupByExpression) {
2635
2730
  minRange.setTypeMethods = 'setEntityAsName';
2636
2731
  }
2637
2732
  else if (minRange.node instanceof concepts_1.QueryFromExpression || minRange.node instanceof concepts_1.QueryJoinExpression) {
@@ -2861,12 +2956,15 @@ class NaslServer {
2861
2956
  if (minRange.node instanceof concepts_1.BindEvent && node instanceof concepts_1.Param) {
2862
2957
  return null;
2863
2958
  }
2959
+ if (minRange.node instanceof concepts_1.Argument && node instanceof concepts_1.Param) {
2960
+ minRange.setTypeMethods = 'setKeyword';
2961
+ }
2864
2962
  /**
2865
- * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
2866
- * 流程改名不触发Logic改名
2867
- * 如果是修改param查找到logic就不操作
2868
- * 除非想在内部修改别的内容所以暂时屏蔽掉
2869
- */
2963
+ * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
2964
+ * 流程改名不触发Logic改名
2965
+ * 如果是修改param查找到logic就不操作
2966
+ * 除非想在内部修改别的内容所以暂时屏蔽掉
2967
+ */
2870
2968
  if (minRange.node instanceof concepts_1.Logic && node !== minRange.node) {
2871
2969
  return null;
2872
2970
  }
@@ -2914,7 +3012,18 @@ class NaslServer {
2914
3012
  return minRange;
2915
3013
  })
2916
3014
  // 过滤掉不需要操作的
2917
- .filter((item) => !!item);
3015
+ .filter((item) => !!item)
3016
+ // 排序:
3017
+ // QueryFieldExpression依赖Entity,把Entity放在QueryFieldExpression前,
3018
+ .sort((a, b) => {
3019
+ if (a.node.concept === 'QueryFieldExpression') {
3020
+ return 1;
3021
+ }
3022
+ else if (b.node.concept === 'QueryFieldExpression') {
3023
+ return -1;
3024
+ }
3025
+ return 0;
3026
+ });
2918
3027
  return result;
2919
3028
  }
2920
3029
  // 增加参数的副作用,用于更新logic和view
@@ -2927,8 +3036,21 @@ class NaslServer {
2927
3036
  const minRange = this._findMinRange(record, fileNode);
2928
3037
  if (minRange) {
2929
3038
  // 如果找到节点是callLogic就去更新
2930
- if ((minRange.node instanceof concepts_1.CallLogic || minRange.node instanceof concepts_1.Destination) && node instanceof concepts_1.Param) {
2931
- minRange.node.addCalleeArg(parantNode);
3039
+ if (node instanceof concepts_1.Param) {
3040
+ if (minRange.node instanceof concepts_1.CallLogic) {
3041
+ minRange.node.addCalleeArg(parantNode);
3042
+ }
3043
+ else if (minRange.node instanceof concepts_1.Destination) {
3044
+ // 跳转页面,可能在父级下增加参数,子的跳转页面也可以查找到引用
3045
+ // 精准匹配子页面的内容
3046
+ const viewNode = node.parentNode;
3047
+ if (viewNode instanceof concepts_1.View) {
3048
+ const viewNamespace = viewNode.getNamespace();
3049
+ if (viewNamespace === minRange.node.viewNamespace && viewNode.name === minRange.node.viewName) {
3050
+ minRange.node.addCalleeArg(parantNode);
3051
+ }
3052
+ }
3053
+ }
2932
3054
  }
2933
3055
  }
2934
3056
  });
@@ -3094,11 +3216,11 @@ class NaslServer {
3094
3216
  return treeNodeMap;
3095
3217
  }
3096
3218
  /**
3097
- * 处理tree的队列,把相同节点进行合并
3098
- * 这里把当前二维数组进行一个整合
3099
- * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3100
- * @returns 最后要使用到的节点和对应的子集
3101
- */
3219
+ * 处理tree的队列,把相同节点进行合并
3220
+ * 这里把当前二维数组进行一个整合
3221
+ * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3222
+ * @returns 最后要使用到的节点和对应的子集
3223
+ */
3102
3224
  handleTreeQueue(queueLists) {
3103
3225
  const map = new Map();
3104
3226
  let root = null;
@@ -3126,11 +3248,11 @@ class NaslServer {
3126
3248
  return children;
3127
3249
  }
3128
3250
  /**
3129
- * 递归调用输出结果
3130
- * @param root 一个根节点
3131
- * @param map 当前所有节点的map对象
3132
- * @returns 当前节点,最后输出所有节点
3133
- */
3251
+ * 递归调用输出结果
3252
+ * @param root 一个根节点
3253
+ * @param map 当前所有节点的map对象
3254
+ * @returns 当前节点,最后输出所有节点
3255
+ */
3134
3256
  _recursionCreateResult(root, map) {
3135
3257
  const children = (map.get(root) || []).map((item) => this._recursionCreateResult(item, map));
3136
3258
  if (children && children.length) {
@@ -3139,9 +3261,9 @@ class NaslServer {
3139
3261
  return root;
3140
3262
  }
3141
3263
  /**
3142
- * 获取
3143
- * 当前this上下文 的Source 和 父级文件级别的节点
3144
- */
3264
+ * 获取
3265
+ * 当前this上下文 的Source 和 父级文件级别的节点
3266
+ */
3145
3267
  getCurrentSource(node) {
3146
3268
  if (node instanceof concepts_1.App || node instanceof concepts_1.Theme)
3147
3269
  return { fileNode: null };
@@ -3157,6 +3279,7 @@ class NaslServer {
3157
3279
  && !(fileNode.parentNode instanceof concepts_1.Module)
3158
3280
  && !(fileNode.parentNode instanceof concepts_1.DataSource)
3159
3281
  && !(fileNode.parentNode instanceof concepts_1.Frontend)
3282
+ && !(fileNode.parentNode instanceof concepts_1.Backend)
3160
3283
  && !(fileNode instanceof concepts_1.View)
3161
3284
  && !(fileNode instanceof concepts_1.ConfigProperty)) {
3162
3285
  fileNode = fileNode.parentNode;
@@ -3242,9 +3365,9 @@ class NaslServer {
3242
3365
  return [...fileNodes];
3243
3366
  }
3244
3367
  /**获取当前节点的已知类型
3245
- * @param node 当前要获取类型的节点
3246
- * @returns 不需要去查就可以返回类型的节点
3247
- */
3368
+ * @param node 当前要获取类型的节点
3369
+ * @returns 不需要去查就可以返回类型的节点
3370
+ */
3248
3371
  getCurrentNodeKnownTypeAnnotation(node) {
3249
3372
  if (node.concept === 'StringLiteral' || node.concept === 'StringInterpolation' || node.concept === 'BooleanLiteral' || node.concept === 'NullLiteral') {
3250
3373
  let type = 'String';
@@ -3355,6 +3478,11 @@ class NaslServer {
3355
3478
  'QueryFieldExpression',
3356
3479
  'QueryGroupByExpression',
3357
3480
  'Param',
3481
+ 'AuthLogic',
3482
+ 'AuthLogic',
3483
+ 'BackendVariable',
3484
+ 'AuthLogicForCallInterface',
3485
+ 'CallAuthInterface',
3358
3486
  ].includes(node.concept))
3359
3487
  return;
3360
3488
  // 要去ls那边获取的
@@ -3693,17 +3821,17 @@ class NaslServer {
3693
3821
  jsonNode.typeAnnotation = value.toJSON();
3694
3822
  }
3695
3823
  }
3696
- if (node instanceof concepts_1.NewComposite && node.typeAnnotation?.typeKind === 'anonymousStructure') {
3824
+ if (node instanceof concepts_1.NewComposite && (node.typeAnnotation?.typeKind === 'anonymousStructure' || node.typeAnnotation?.typeKind === 'generic')) {
3697
3825
  const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
3698
3826
  jsonNode.typeAnnotation = value.toJSON();
3699
3827
  }
3700
3828
  });
3701
3829
  }
3702
3830
  /**
3703
- * 获取getArgument的参数位的类型
3704
- * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3705
- * 获取logic的默认值和原来Arg的类型和默认值对应
3706
- */
3831
+ * 获取getArgument的参数位的类型
3832
+ * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3833
+ * 获取logic的默认值和原来Arg的类型和默认值对应
3834
+ */
3707
3835
  getArgumentTypeAnnotation(node, QuickInfoNodes, types) {
3708
3836
  // 直接复用内部expression的type类型
3709
3837
  if (node.parentNode instanceof concepts_1.CallLogic && node.parentNode.calleeNamespace?.includes('entities') && node.parentNode.calleeNamespace?.includes('logics') && node.parentNode.calleeName === 'delete') {
@@ -3825,8 +3953,8 @@ class NaslServer {
3825
3953
  const filePath = fileNode.getEmbeddedFilePath();
3826
3954
  // 如果要删除,而且当前要删Logic就直接删除并且清除错误
3827
3955
  /**
3828
- * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
3829
- */
3956
+ * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
3957
+ */
3830
3958
  let outputFiles = [];
3831
3959
  // 删除之前先查一下内容的依赖
3832
3960
  const newRefs = await this.references({
@@ -3943,7 +4071,7 @@ class NaslServer {
3943
4071
  }
3944
4072
  else if (targetNode instanceof concepts_1.ViewElement) {
3945
4073
  /**
3946
- * 因为页面组件比较特殊
4074
+ * 因为平台类型比较特殊
3947
4075
  * 修改之后只用查页面本身就好了
3948
4076
  */
3949
4077
  // 更新文件之后
@@ -4071,8 +4199,8 @@ class NaslServer {
4071
4199
  }
4072
4200
  }
4073
4201
  /**
4074
- * DataSource只会重命名时候,需要把子集全部重新生成一下
4075
- */
4202
+ * DataSource只会重命名时候,需要把子集全部重新生成一下
4203
+ */
4076
4204
  if (fileNode instanceof concepts_1.DataSource) {
4077
4205
  fileNode.entities.forEach(async (entity) => {
4078
4206
  try {