@lcap/nasl 3.3.0-beta.0 → 3.4.0-alpha.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 (790) hide show
  1. package/out/bak/translator.js +5 -8
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/breakpoint/generator/AfterStartNode.js +1 -2
  4. package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
  5. package/out/breakpoint/generator/BeforeEndNode.js +1 -2
  6. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
  7. package/out/breakpoint/generator/BreakpointNode.js +9 -30
  8. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  9. package/out/breakpoint/shared/constants.d.ts +0 -1
  10. package/out/breakpoint/shared/constants.js +1 -7
  11. package/out/breakpoint/shared/constants.js.map +1 -1
  12. package/out/breakpoint/shared/utils.d.ts +1 -3
  13. package/out/breakpoint/shared/utils.js +4 -25
  14. package/out/breakpoint/shared/utils.js.map +1 -1
  15. package/out/common/BaseNode.d.ts +8 -21
  16. package/out/common/BaseNode.js +69 -115
  17. package/out/common/BaseNode.js.map +1 -1
  18. package/out/common/Command.js +1 -6
  19. package/out/common/Command.js.map +1 -1
  20. package/out/common/EventEmitter.d.ts +1 -1
  21. package/out/common/EventEmitter.js +3 -1
  22. package/out/common/EventEmitter.js.map +1 -1
  23. package/out/common/classMap.d.ts +4 -0
  24. package/out/common/classMap.js +5 -0
  25. package/out/common/classMap.js.map +1 -0
  26. package/out/common/index.d.ts +1 -0
  27. package/out/common/index.js +1 -0
  28. package/out/common/index.js.map +1 -1
  29. package/out/concepts/Abort__.d.ts +2 -3
  30. package/out/concepts/Abort__.js +18 -15
  31. package/out/concepts/Abort__.js.map +1 -1
  32. package/out/concepts/Anchor__.d.ts +3 -3
  33. package/out/concepts/Anchor__.js +35 -18
  34. package/out/concepts/Anchor__.js.map +1 -1
  35. package/out/concepts/AnonymousFunction__.d.ts +3 -3
  36. package/out/concepts/AnonymousFunction__.js +53 -29
  37. package/out/concepts/AnonymousFunction__.js.map +1 -1
  38. package/out/concepts/App__.d.ts +157 -160
  39. package/out/concepts/App__.js +80 -106
  40. package/out/concepts/App__.js.map +1 -1
  41. package/out/concepts/Argument__.d.ts +3 -3
  42. package/out/concepts/Argument__.js +42 -22
  43. package/out/concepts/Argument__.js.map +1 -1
  44. package/out/concepts/Assignee__.d.ts +2 -3
  45. package/out/concepts/Assignee__.js +21 -19
  46. package/out/concepts/Assignee__.js.map +1 -1
  47. package/out/concepts/AssignmentLine__.d.ts +2 -3
  48. package/out/concepts/AssignmentLine__.js +17 -15
  49. package/out/concepts/AssignmentLine__.js.map +1 -1
  50. package/out/concepts/Assignment__.d.ts +3 -3
  51. package/out/concepts/Assignment__.js +42 -34
  52. package/out/concepts/Assignment__.js.map +1 -1
  53. package/out/concepts/Attribute__.d.ts +2 -3
  54. package/out/concepts/Attribute__.js +28 -36
  55. package/out/concepts/Attribute__.js.map +1 -1
  56. package/out/concepts/AuthInterface__.d.ts +3 -4
  57. package/out/concepts/AuthInterface__.js +17 -16
  58. package/out/concepts/AuthInterface__.js.map +1 -1
  59. package/out/concepts/AuthLogicForCallInterface__.d.ts +3 -4
  60. package/out/concepts/AuthLogicForCallInterface__.js +27 -37
  61. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  62. package/out/concepts/AuthLogic__.d.ts +3 -4
  63. package/out/concepts/AuthLogic__.js +19 -18
  64. package/out/concepts/AuthLogic__.js.map +1 -1
  65. package/out/concepts/BackendVariable__.d.ts +7 -8
  66. package/out/concepts/BackendVariable__.js +34 -39
  67. package/out/concepts/BackendVariable__.js.map +1 -1
  68. package/out/concepts/Backend__.d.ts +31 -32
  69. package/out/concepts/Backend__.js +22 -23
  70. package/out/concepts/Backend__.js.map +1 -1
  71. package/out/concepts/BatchAssignment__.d.ts +3 -3
  72. package/out/concepts/BatchAssignment__.js +54 -46
  73. package/out/concepts/BatchAssignment__.js.map +1 -1
  74. package/out/concepts/BinaryExpression__.d.ts +3 -3
  75. package/out/concepts/BinaryExpression__.js +62 -30
  76. package/out/concepts/BinaryExpression__.js.map +1 -1
  77. package/out/concepts/BindAttribute__.d.ts +9 -12
  78. package/out/concepts/BindAttribute__.js +102 -81
  79. package/out/concepts/BindAttribute__.js.map +1 -1
  80. package/out/concepts/BindDirective__.d.ts +3 -5
  81. package/out/concepts/BindDirective__.js +28 -34
  82. package/out/concepts/BindDirective__.js.map +1 -1
  83. package/out/concepts/BindEvent__.d.ts +3 -3
  84. package/out/concepts/BindEvent__.js +74 -51
  85. package/out/concepts/BindEvent__.js.map +1 -1
  86. package/out/concepts/BindStyle__.d.ts +3 -5
  87. package/out/concepts/BindStyle__.js +23 -24
  88. package/out/concepts/BindStyle__.js.map +1 -1
  89. package/out/concepts/BooleanLiteral__.d.ts +3 -3
  90. package/out/concepts/BooleanLiteral__.js +24 -17
  91. package/out/concepts/BooleanLiteral__.js.map +1 -1
  92. package/out/concepts/CallAuthInterface__.d.ts +2 -3
  93. package/out/concepts/CallAuthInterface__.js +19 -17
  94. package/out/concepts/CallAuthInterface__.js.map +1 -1
  95. package/out/concepts/CallConnector__.d.ts +4 -5
  96. package/out/concepts/CallConnector__.js +34 -41
  97. package/out/concepts/CallConnector__.js.map +1 -1
  98. package/out/concepts/CallFunction__.d.ts +3 -3
  99. package/out/concepts/CallFunction__.js +71 -33
  100. package/out/concepts/CallFunction__.js.map +1 -1
  101. package/out/concepts/CallInterface__.d.ts +3 -3
  102. package/out/concepts/CallInterface__.js +57 -26
  103. package/out/concepts/CallInterface__.js.map +1 -1
  104. package/out/concepts/CallLogic__.d.ts +6 -6
  105. package/out/concepts/CallLogic__.js +180 -135
  106. package/out/concepts/CallLogic__.js.map +1 -1
  107. package/out/concepts/CallQueryComponent__.d.ts +2 -3
  108. package/out/concepts/CallQueryComponent__.js +41 -57
  109. package/out/concepts/CallQueryComponent__.js.map +1 -1
  110. package/out/concepts/Comment__.d.ts +3 -3
  111. package/out/concepts/Comment__.js +24 -17
  112. package/out/concepts/Comment__.js.map +1 -1
  113. package/out/concepts/CompletionProperty__.d.ts +2 -3
  114. package/out/concepts/CompletionProperty__.js +25 -30
  115. package/out/concepts/CompletionProperty__.js.map +1 -1
  116. package/out/concepts/ConfigGroup__.d.ts +2 -3
  117. package/out/concepts/ConfigGroup__.js +20 -21
  118. package/out/concepts/ConfigGroup__.js.map +1 -1
  119. package/out/concepts/ConfigPropertyValue__.d.ts +2 -3
  120. package/out/concepts/ConfigPropertyValue__.js +16 -16
  121. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  122. package/out/concepts/ConfigProperty__.d.ts +2 -3
  123. package/out/concepts/ConfigProperty__.js +23 -26
  124. package/out/concepts/ConfigProperty__.js.map +1 -1
  125. package/out/concepts/Configuration__.d.ts +2 -3
  126. package/out/concepts/Configuration__.js +18 -16
  127. package/out/concepts/Configuration__.js.map +1 -1
  128. package/out/concepts/Connection__.d.ts +4 -4
  129. package/out/concepts/Connection__.js +18 -22
  130. package/out/concepts/Connection__.js.map +1 -1
  131. package/out/concepts/ConnectorTrigger__.d.ts +6 -7
  132. package/out/concepts/ConnectorTrigger__.js +21 -22
  133. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  134. package/out/concepts/Connector__.d.ts +33 -139
  135. package/out/concepts/Connector__.js +34 -191
  136. package/out/concepts/Connector__.js.map +1 -1
  137. package/out/concepts/Constant__.d.ts +2 -3
  138. package/out/concepts/Constant__.js +23 -25
  139. package/out/concepts/Constant__.js.map +1 -1
  140. package/out/concepts/DataElement__.d.ts +46 -0
  141. package/out/concepts/DataElement__.js +118 -0
  142. package/out/concepts/DataElement__.js.map +1 -0
  143. package/out/concepts/DataSource__.d.ts +2 -7
  144. package/out/concepts/DataSource__.js +23 -31
  145. package/out/concepts/DataSource__.js.map +1 -1
  146. package/out/concepts/DatabaseTypeAnnotation__.d.ts +4 -5
  147. package/out/concepts/DatabaseTypeAnnotation__.js +18 -18
  148. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  149. package/out/concepts/Destination__.d.ts +11 -11
  150. package/out/concepts/Destination__.js +89 -39
  151. package/out/concepts/Destination__.js.map +1 -1
  152. package/out/concepts/End__.d.ts +2 -3
  153. package/out/concepts/End__.js +17 -15
  154. package/out/concepts/End__.js.map +1 -1
  155. package/out/concepts/EntityIndex__.d.ts +3 -4
  156. package/out/concepts/EntityIndex__.js +21 -23
  157. package/out/concepts/EntityIndex__.js.map +1 -1
  158. package/out/concepts/EntityProperty__.d.ts +4 -4
  159. package/out/concepts/EntityProperty__.js +67 -51
  160. package/out/concepts/EntityProperty__.js.map +1 -1
  161. package/out/concepts/Entity__.d.ts +3 -3
  162. package/out/concepts/Entity__.js +51 -32
  163. package/out/concepts/Entity__.js.map +1 -1
  164. package/out/concepts/EnumItem__.d.ts +3 -3
  165. package/out/concepts/EnumItem__.js +25 -19
  166. package/out/concepts/EnumItem__.js.map +1 -1
  167. package/out/concepts/Enum__.d.ts +3 -3
  168. package/out/concepts/Enum__.js +35 -23
  169. package/out/concepts/Enum__.js.map +1 -1
  170. package/out/concepts/Event__.d.ts +2 -3
  171. package/out/concepts/Event__.js +21 -24
  172. package/out/concepts/Event__.js.map +1 -1
  173. package/out/concepts/ExternalDestination__.d.ts +5 -6
  174. package/out/concepts/ExternalDestination__.js +25 -25
  175. package/out/concepts/ExternalDestination__.js.map +1 -1
  176. package/out/concepts/ForEachStatement__.d.ts +3 -3
  177. package/out/concepts/ForEachStatement__.js +60 -21
  178. package/out/concepts/ForEachStatement__.js.map +1 -1
  179. package/out/concepts/FrontendLibrary__.d.ts +3 -4
  180. package/out/concepts/FrontendLibrary__.js +25 -27
  181. package/out/concepts/FrontendLibrary__.js.map +1 -1
  182. package/out/concepts/FrontendVariable__.d.ts +3 -4
  183. package/out/concepts/FrontendVariable__.js +12 -12
  184. package/out/concepts/FrontendVariable__.js.map +1 -1
  185. package/out/concepts/Frontend__.d.ts +6 -8
  186. package/out/concepts/Frontend__.js +39 -47
  187. package/out/concepts/Frontend__.js.map +1 -1
  188. package/out/concepts/Function__.d.ts +3 -3
  189. package/out/concepts/Function__.js +60 -37
  190. package/out/concepts/Function__.js.map +1 -1
  191. package/out/concepts/Identifier__.d.ts +3 -4
  192. package/out/concepts/Identifier__.js +29 -30
  193. package/out/concepts/Identifier__.js.map +1 -1
  194. package/out/concepts/IfStatement__.d.ts +3 -3
  195. package/out/concepts/IfStatement__.js +51 -21
  196. package/out/concepts/IfStatement__.js.map +1 -1
  197. package/out/concepts/Integration__.d.ts +2 -93
  198. package/out/concepts/Integration__.js +19 -157
  199. package/out/concepts/Integration__.js.map +1 -1
  200. package/out/concepts/InterfaceParam__.d.ts +4 -30
  201. package/out/concepts/InterfaceParam__.js +24 -58
  202. package/out/concepts/InterfaceParam__.js.map +1 -1
  203. package/out/concepts/Interface__.d.ts +5 -31
  204. package/out/concepts/Interface__.js +34 -89
  205. package/out/concepts/Interface__.js.map +1 -1
  206. package/out/concepts/JSBlock__.d.ts +3 -3
  207. package/out/concepts/JSBlock__.js +24 -17
  208. package/out/concepts/JSBlock__.js.map +1 -1
  209. package/out/concepts/JavaLogic__.d.ts +3 -4
  210. package/out/concepts/JavaLogic__.js +21 -22
  211. package/out/concepts/JavaLogic__.js.map +1 -1
  212. package/out/concepts/LogicItem__.d.ts +8 -3
  213. package/out/concepts/LogicItem__.js +30 -23
  214. package/out/concepts/LogicItem__.js.map +1 -1
  215. package/out/concepts/Logic__.d.ts +18 -17
  216. package/out/concepts/Logic__.js +188 -113
  217. package/out/concepts/Logic__.js.map +1 -1
  218. package/out/concepts/MatchCase__.d.ts +3 -3
  219. package/out/concepts/MatchCase__.js +110 -23
  220. package/out/concepts/MatchCase__.js.map +1 -1
  221. package/out/concepts/Match__.d.ts +3 -3
  222. package/out/concepts/Match__.js +64 -20
  223. package/out/concepts/Match__.js.map +1 -1
  224. package/out/concepts/MemberExpression__.d.ts +3 -3
  225. package/out/concepts/MemberExpression__.js +59 -65
  226. package/out/concepts/MemberExpression__.js.map +1 -1
  227. package/out/concepts/MicroApp__.d.ts +2 -3
  228. package/out/concepts/MicroApp__.js +21 -26
  229. package/out/concepts/MicroApp__.js.map +1 -1
  230. package/out/concepts/Module__.d.ts +47 -219
  231. package/out/concepts/Module__.js +32 -232
  232. package/out/concepts/Module__.js.map +1 -1
  233. package/out/concepts/MsgTriggerEvent__.d.ts +3 -4
  234. package/out/concepts/MsgTriggerEvent__.js +18 -16
  235. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  236. package/out/concepts/MsgTriggerLauncher__.d.ts +3 -4
  237. package/out/concepts/MsgTriggerLauncher__.js +19 -18
  238. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  239. package/out/concepts/Namespace__.d.ts +2 -4
  240. package/out/concepts/Namespace__.js +46 -64
  241. package/out/concepts/Namespace__.js.map +1 -1
  242. package/out/concepts/NewComposite__.d.ts +3 -4
  243. package/out/concepts/NewComposite__.js +133 -71
  244. package/out/concepts/NewComposite__.js.map +1 -1
  245. package/out/concepts/NewList__.d.ts +4 -5
  246. package/out/concepts/NewList__.js +41 -35
  247. package/out/concepts/NewList__.js.map +1 -1
  248. package/out/concepts/NewMap__.d.ts +4 -5
  249. package/out/concepts/NewMap__.js +38 -39
  250. package/out/concepts/NewMap__.js.map +1 -1
  251. package/out/concepts/New__.d.ts +2 -3
  252. package/out/concepts/New__.js +17 -15
  253. package/out/concepts/New__.js.map +1 -1
  254. package/out/concepts/NullLiteral__.d.ts +2 -3
  255. package/out/concepts/NullLiteral__.js +17 -15
  256. package/out/concepts/NullLiteral__.js.map +1 -1
  257. package/out/concepts/NumericLiteral__.d.ts +3 -3
  258. package/out/concepts/NumericLiteral__.js +27 -21
  259. package/out/concepts/NumericLiteral__.js.map +1 -1
  260. package/out/concepts/OqlQueryComponent__.d.ts +3 -3
  261. package/out/concepts/OqlQueryComponent__.js +30 -26
  262. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  263. package/out/concepts/OverriddenLogic__.d.ts +22 -14
  264. package/out/concepts/OverriddenLogic__.js +62 -73
  265. package/out/concepts/OverriddenLogic__.js.map +1 -1
  266. package/out/concepts/Param__.d.ts +3 -3
  267. package/out/concepts/Param__.js +69 -34
  268. package/out/concepts/Param__.js.map +1 -1
  269. package/out/concepts/Point__.d.ts +2 -3
  270. package/out/concepts/Point__.js +16 -16
  271. package/out/concepts/Point__.js.map +1 -1
  272. package/out/concepts/ProcessComponent__.d.ts +2 -3
  273. package/out/concepts/ProcessComponent__.js +22 -24
  274. package/out/concepts/ProcessComponent__.js.map +1 -1
  275. package/out/concepts/ProcessElement__.d.ts +2 -3
  276. package/out/concepts/ProcessElement__.js +46 -61
  277. package/out/concepts/ProcessElement__.js.map +1 -1
  278. package/out/concepts/ProcessOutcome__.d.ts +2 -3
  279. package/out/concepts/ProcessOutcome__.js +18 -17
  280. package/out/concepts/ProcessOutcome__.js.map +1 -1
  281. package/out/concepts/ProcessOutcomes__.d.ts +2 -3
  282. package/out/concepts/ProcessOutcomes__.js +17 -15
  283. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  284. package/out/concepts/Process__.d.ts +7 -5
  285. package/out/concepts/Process__.js +35 -46
  286. package/out/concepts/Process__.js.map +1 -1
  287. package/out/concepts/QueryAggregateExpression__.d.ts +2 -3
  288. package/out/concepts/QueryAggregateExpression__.js +22 -23
  289. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  290. package/out/concepts/QueryFieldExpression__.d.ts +3 -4
  291. package/out/concepts/QueryFieldExpression__.js +20 -21
  292. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  293. package/out/concepts/QueryFromExpression__.d.ts +3 -4
  294. package/out/concepts/QueryFromExpression__.js +22 -23
  295. package/out/concepts/QueryFromExpression__.js.map +1 -1
  296. package/out/concepts/QueryGroupByExpression__.d.ts +2 -3
  297. package/out/concepts/QueryGroupByExpression__.js +19 -18
  298. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  299. package/out/concepts/QueryJoinExpression__.d.ts +3 -4
  300. package/out/concepts/QueryJoinExpression__.js +25 -29
  301. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  302. package/out/concepts/QueryLimitExpression__.d.ts +2 -3
  303. package/out/concepts/QueryLimitExpression__.js +22 -22
  304. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  305. package/out/concepts/QueryOrderByExpression__.d.ts +2 -3
  306. package/out/concepts/QueryOrderByExpression__.js +22 -22
  307. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  308. package/out/concepts/QuerySelectExpression__.d.ts +2 -3
  309. package/out/concepts/QuerySelectExpression__.js +21 -23
  310. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  311. package/out/concepts/Rect__.d.ts +2 -3
  312. package/out/concepts/Rect__.js +18 -20
  313. package/out/concepts/Rect__.js.map +1 -1
  314. package/out/concepts/Return__.d.ts +3 -3
  315. package/out/concepts/Return__.js +45 -29
  316. package/out/concepts/Return__.js.map +1 -1
  317. package/out/concepts/Role__.d.ts +2 -3
  318. package/out/concepts/Role__.js +21 -22
  319. package/out/concepts/Role__.js.map +1 -1
  320. package/out/concepts/SelectMembers__.d.ts +2 -3
  321. package/out/concepts/SelectMembers__.js +21 -20
  322. package/out/concepts/SelectMembers__.js.map +1 -1
  323. package/out/concepts/Slot__.d.ts +2 -3
  324. package/out/concepts/Slot__.js +22 -26
  325. package/out/concepts/Slot__.js.map +1 -1
  326. package/out/concepts/SqlQueryComponent__.d.ts +3 -3
  327. package/out/concepts/SqlQueryComponent__.js +31 -28
  328. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  329. package/out/concepts/Start__.d.ts +2 -3
  330. package/out/concepts/Start__.js +17 -15
  331. package/out/concepts/Start__.js.map +1 -1
  332. package/out/concepts/StringInterpolation__.d.ts +3 -3
  333. package/out/concepts/StringInterpolation__.js +37 -17
  334. package/out/concepts/StringInterpolation__.js.map +1 -1
  335. package/out/concepts/StringLiteral__.d.ts +3 -3
  336. package/out/concepts/StringLiteral__.js +22 -14
  337. package/out/concepts/StringLiteral__.js.map +1 -1
  338. package/out/concepts/StructureProperty__.d.ts +5 -5
  339. package/out/concepts/StructureProperty__.js +40 -33
  340. package/out/concepts/StructureProperty__.js.map +1 -1
  341. package/out/concepts/Structure__.d.ts +12 -3
  342. package/out/concepts/Structure__.js +46 -45
  343. package/out/concepts/Structure__.js.map +1 -1
  344. package/out/concepts/SwitchCase__.d.ts +3 -3
  345. package/out/concepts/SwitchCase__.js +54 -19
  346. package/out/concepts/SwitchCase__.js.map +1 -1
  347. package/out/concepts/SwitchStatement__.d.ts +3 -3
  348. package/out/concepts/SwitchStatement__.js +39 -23
  349. package/out/concepts/SwitchStatement__.js.map +1 -1
  350. package/out/concepts/Theme__.d.ts +2 -3
  351. package/out/concepts/Theme__.js +14 -12
  352. package/out/concepts/Theme__.js.map +1 -1
  353. package/out/concepts/Transactional__.d.ts +2 -3
  354. package/out/concepts/Transactional__.js +17 -18
  355. package/out/concepts/Transactional__.js.map +1 -1
  356. package/out/concepts/TriggerEvent__.d.ts +2 -3
  357. package/out/concepts/TriggerEvent__.js +18 -19
  358. package/out/concepts/TriggerEvent__.js.map +1 -1
  359. package/out/concepts/TriggerLauncher__.d.ts +17 -6
  360. package/out/concepts/TriggerLauncher__.js +63 -26
  361. package/out/concepts/TriggerLauncher__.js.map +1 -1
  362. package/out/concepts/TypeAnnotation__.d.ts +6 -8
  363. package/out/concepts/TypeAnnotation__.js +79 -56
  364. package/out/concepts/TypeAnnotation__.js.map +1 -1
  365. package/out/concepts/TypeParam__.d.ts +3 -3
  366. package/out/concepts/TypeParam__.js +23 -16
  367. package/out/concepts/TypeParam__.js.map +1 -1
  368. package/out/concepts/UnaryExpression__.d.ts +3 -3
  369. package/out/concepts/UnaryExpression__.js +39 -21
  370. package/out/concepts/UnaryExpression__.js.map +1 -1
  371. package/out/concepts/Unparsed__.d.ts +3 -3
  372. package/out/concepts/Unparsed__.js +23 -16
  373. package/out/concepts/Unparsed__.js.map +1 -1
  374. package/out/concepts/UseComponent__.d.ts +2 -3
  375. package/out/concepts/UseComponent__.js +16 -16
  376. package/out/concepts/UseComponent__.js.map +1 -1
  377. package/out/concepts/ValidationRule__.d.ts +16 -17
  378. package/out/concepts/ValidationRule__.js +15 -18
  379. package/out/concepts/ValidationRule__.js.map +1 -1
  380. package/out/concepts/Variable__.d.ts +3 -3
  381. package/out/concepts/Variable__.js +45 -29
  382. package/out/concepts/Variable__.js.map +1 -1
  383. package/out/concepts/ViewBlock__.d.ts +3 -4
  384. package/out/concepts/ViewBlock__.js +19 -20
  385. package/out/concepts/ViewBlock__.js.map +1 -1
  386. package/out/concepts/ViewComponent__.d.ts +31 -32
  387. package/out/concepts/ViewComponent__.js +32 -35
  388. package/out/concepts/ViewComponent__.js.map +1 -1
  389. package/out/concepts/ViewElement__.d.ts +81 -82
  390. package/out/concepts/ViewElement__.js +155 -259
  391. package/out/concepts/ViewElement__.js.map +1 -1
  392. package/out/concepts/View__.d.ts +4 -5
  393. package/out/concepts/View__.js +207 -141
  394. package/out/concepts/View__.js.map +1 -1
  395. package/out/concepts/WhileStatement__.d.ts +3 -3
  396. package/out/concepts/WhileStatement__.js +41 -20
  397. package/out/concepts/WhileStatement__.js.map +1 -1
  398. package/out/concepts/index__.d.ts +1 -0
  399. package/out/concepts/index__.js +1 -0
  400. package/out/concepts/index__.js.map +1 -1
  401. package/out/concepts/types__.d.ts +2 -2
  402. package/out/decorators/index.d.ts +0 -2
  403. package/out/decorators/index.js +8 -12
  404. package/out/decorators/index.js.map +1 -1
  405. package/out/generator/genBundleFiles.d.ts +2 -2
  406. package/out/generator/genBundleFiles.js +4 -11
  407. package/out/generator/genBundleFiles.js.map +1 -1
  408. package/out/generator/genReleaseBody.d.ts +2 -4
  409. package/out/generator/genReleaseBody.js +136 -192
  410. package/out/generator/genReleaseBody.js.map +1 -1
  411. package/out/index.d.ts +1 -0
  412. package/out/index.js +1 -0
  413. package/out/index.js.map +1 -1
  414. package/out/natural/RequirementAnalyzer.d.ts +22 -0
  415. package/out/natural/RequirementAnalyzer.js +196 -0
  416. package/out/natural/RequirementAnalyzer.js.map +1 -0
  417. package/out/natural/RequirementExecutor.d.ts +51 -0
  418. package/out/natural/RequirementExecutor.js +692 -0
  419. package/out/natural/RequirementExecutor.js.map +1 -0
  420. package/out/natural/componentData.d.ts +31 -0
  421. package/out/natural/componentData.js +85 -0
  422. package/out/natural/componentData.js.map +1 -0
  423. package/out/natural/genNaturalTS.d.ts +3 -0
  424. package/out/natural/genNaturalTS.js +90 -0
  425. package/out/natural/genNaturalTS.js.map +1 -0
  426. package/out/natural/index.d.ts +4 -0
  427. package/out/natural/index.js +21 -0
  428. package/out/natural/index.js.map +1 -0
  429. package/out/natural/knowledgeMap.d.ts +4 -0
  430. package/out/natural/knowledgeMap.js +40 -0
  431. package/out/natural/knowledgeMap.js.map +1 -0
  432. package/out/natural/naslStdlibMap.d.ts +2 -0
  433. package/out/natural/naslStdlibMap.js +26 -0
  434. package/out/natural/naslStdlibMap.js.map +1 -0
  435. package/out/natural/transformTSCode.d.ts +7 -0
  436. package/out/natural/transformTSCode.js +878 -0
  437. package/out/natural/transformTSCode.js.map +1 -0
  438. package/out/sentry/index.js +2 -2
  439. package/out/sentry/index.js.map +1 -1
  440. package/out/server/createUiTs.js +1 -34
  441. package/out/server/createUiTs.js.map +1 -1
  442. package/out/server/extendBaseNode.js +17 -17
  443. package/out/server/extendBaseNode.js.map +1 -1
  444. package/out/server/formatTsUtils.js +10 -0
  445. package/out/server/formatTsUtils.js.map +1 -1
  446. package/out/server/getConnector.d.ts +0 -3
  447. package/out/server/getConnector.js +1 -38
  448. package/out/server/getConnector.js.map +1 -1
  449. package/out/server/getMemberIdentifier.js +2 -1
  450. package/out/server/getMemberIdentifier.js.map +1 -1
  451. package/out/server/index.js +0 -2
  452. package/out/server/index.js.map +1 -1
  453. package/out/server/naslServer.d.ts +6 -17
  454. package/out/server/naslServer.js +213 -321
  455. package/out/server/naslServer.js.map +1 -1
  456. package/out/server/translator.js +4 -2
  457. package/out/server/translator.js.map +1 -1
  458. package/out/service/creator/add.configs.js +0 -26
  459. package/out/service/creator/add.configs.js.map +1 -1
  460. package/out/service/creator/errHandles.js +3 -5
  461. package/out/service/creator/errHandles.js.map +1 -1
  462. package/out/service/creator/index.js +0 -13
  463. package/out/service/creator/index.js.map +1 -1
  464. package/out/service/storage/init.js +16 -0
  465. package/out/service/storage/init.js.map +1 -1
  466. package/out/service/storage/jsoner.js +1 -1
  467. package/out/service/storage/jsoner.js.map +1 -1
  468. package/out/templator/genCurdEditMultipleKeyBlock.js +3 -3
  469. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  470. package/out/templator/genCurdMultipleKeyBlock.js +3 -3
  471. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  472. package/out/templator/genTableBlock.js +1 -1
  473. package/out/templator/genTableBlock.js.map +1 -1
  474. package/out/translator/index.d.ts +48 -3
  475. package/out/translator/index.js +110 -17
  476. package/out/translator/index.js.map +1 -1
  477. package/out/translator/lsp.d.ts +45 -0
  478. package/out/translator/lsp.js +6 -0
  479. package/out/translator/lsp.js.map +1 -0
  480. package/out/translator/tsp.d.ts +12 -0
  481. package/out/translator/{types.js → tsp.js} +1 -1
  482. package/out/translator/tsp.js.map +1 -0
  483. package/out/utils/index.d.ts +0 -2
  484. package/out/utils/index.js +0 -2
  485. package/out/utils/index.js.map +1 -1
  486. package/out/utils/logger.d.ts +0 -4
  487. package/out/utils/logger.js +1 -13
  488. package/out/utils/logger.js.map +1 -1
  489. package/out/utils/time-slicing.js +1 -1
  490. package/out/utils/time-slicing.js.map +1 -1
  491. package/package.json +11 -5
  492. package/sandbox/stdlib/nasl.oql.ts +0 -2
  493. package/sandbox/stdlib/nasl.ui.definition.ts +1415 -2218
  494. package/sandbox-natural/stdlib/nasl.core.ts +36 -0
  495. package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
  496. package/sandbox-natural/stdlib/nasl.ui.ts +63 -0
  497. package/sandbox-natural/stdlib/nasl.util.ts +119 -0
  498. package/sandbox-natural/tsconfig.json +12 -0
  499. package/src/bak/translator.js +5 -8
  500. package/src/breakpoint/generator/AfterStartNode.ts +1 -2
  501. package/src/breakpoint/generator/BeforeEndNode.ts +1 -2
  502. package/src/breakpoint/generator/BreakpointNode.ts +9 -36
  503. package/src/breakpoint/shared/constants.ts +0 -7
  504. package/src/breakpoint/shared/utils.ts +3 -36
  505. package/src/common/BaseNode.ts +81 -140
  506. package/src/common/Command.ts +1 -6
  507. package/src/common/EventEmitter.ts +4 -2
  508. package/src/common/classMap.ts +3 -0
  509. package/src/common/index.ts +1 -0
  510. package/src/concepts/Abort__.ts +22 -20
  511. package/src/concepts/Anchor__.ts +38 -23
  512. package/src/concepts/AnonymousFunction__.ts +63 -39
  513. package/src/concepts/App__.ts +314 -364
  514. package/src/concepts/Argument__.ts +44 -27
  515. package/src/concepts/Assignee__.ts +39 -41
  516. package/src/concepts/AssignmentLine__.ts +23 -20
  517. package/src/concepts/Assignment__.ts +58 -54
  518. package/src/concepts/Attribute__.ts +34 -40
  519. package/src/concepts/AuthInterface__.ts +24 -22
  520. package/src/concepts/AuthLogicForCallInterface__.ts +41 -71
  521. package/src/concepts/AuthLogic__.ts +30 -21
  522. package/src/concepts/BackendVariable__.ts +54 -55
  523. package/src/concepts/Backend__.ts +59 -58
  524. package/src/concepts/BatchAssignment__.ts +78 -88
  525. package/src/concepts/BinaryExpression__.ts +66 -72
  526. package/src/concepts/BindAttribute__.ts +155 -135
  527. package/src/concepts/BindDirective__.ts +41 -45
  528. package/src/concepts/BindEvent__.ts +89 -80
  529. package/src/concepts/BindStyle__.ts +36 -37
  530. package/src/concepts/BooleanLiteral__.ts +28 -22
  531. package/src/concepts/CallAuthInterface__.ts +32 -29
  532. package/src/concepts/CallConnector__.ts +41 -50
  533. package/src/concepts/CallFunction__.ts +77 -45
  534. package/src/concepts/CallInterface__.ts +68 -36
  535. package/src/concepts/CallLogic__.ts +213 -166
  536. package/src/concepts/CallQueryComponent__.ts +88 -156
  537. package/src/concepts/Comment__.ts +29 -22
  538. package/src/concepts/CompletionProperty__.ts +30 -34
  539. package/src/concepts/ConfigGroup__.ts +29 -28
  540. package/src/concepts/ConfigPropertyValue__.ts +23 -22
  541. package/src/concepts/ConfigProperty__.ts +36 -42
  542. package/src/concepts/Configuration__.ts +26 -23
  543. package/src/concepts/Connection__.ts +21 -26
  544. package/src/concepts/ConnectorTrigger__.ts +34 -30
  545. package/src/concepts/Connector__.ts +87 -342
  546. package/src/concepts/Constant__.ts +36 -30
  547. package/src/concepts/DataElement__.ts +131 -0
  548. package/src/concepts/DataSource__.ts +33 -37
  549. package/src/concepts/DatabaseTypeAnnotation__.ts +24 -24
  550. package/src/concepts/Destination__.ts +104 -51
  551. package/src/concepts/End__.ts +25 -23
  552. package/src/concepts/EntityIndex__.ts +33 -36
  553. package/src/concepts/EntityProperty__.ts +84 -64
  554. package/src/concepts/Entity__.ts +67 -41
  555. package/src/concepts/EnumItem__.ts +32 -24
  556. package/src/concepts/Enum__.ts +42 -28
  557. package/src/concepts/Event__.ts +33 -33
  558. package/src/concepts/ExternalDestination__.ts +29 -29
  559. package/src/concepts/ForEachStatement__.ts +73 -34
  560. package/src/concepts/FrontendLibrary__.ts +38 -37
  561. package/src/concepts/FrontendVariable__.ts +20 -18
  562. package/src/concepts/Frontend__.ts +62 -66
  563. package/src/concepts/Function__.ts +80 -54
  564. package/src/concepts/Identifier__.ts +34 -37
  565. package/src/concepts/IfStatement__.ts +77 -40
  566. package/src/concepts/Integration__.ts +24 -244
  567. package/src/concepts/InterfaceParam__.ts +33 -69
  568. package/src/concepts/Interface__.ts +46 -104
  569. package/src/concepts/JSBlock__.ts +28 -22
  570. package/src/concepts/JavaLogic__.ts +26 -27
  571. package/src/concepts/LogicItem__.ts +47 -29
  572. package/src/concepts/Logic__.ts +226 -168
  573. package/src/concepts/MatchCase__.ts +128 -38
  574. package/src/concepts/Match__.ts +73 -28
  575. package/src/concepts/MemberExpression__.ts +139 -174
  576. package/src/concepts/MicroApp__.ts +27 -32
  577. package/src/concepts/Module__.ts +107 -527
  578. package/src/concepts/MsgTriggerEvent__.ts +33 -25
  579. package/src/concepts/MsgTriggerLauncher__.ts +30 -27
  580. package/src/concepts/Namespace__.ts +99 -109
  581. package/src/concepts/NewComposite__.ts +161 -130
  582. package/src/concepts/NewList__.ts +51 -45
  583. package/src/concepts/NewMap__.ts +48 -51
  584. package/src/concepts/New__.ts +22 -20
  585. package/src/concepts/NullLiteral__.ts +22 -20
  586. package/src/concepts/NumericLiteral__.ts +31 -26
  587. package/src/concepts/OqlQueryComponent__.ts +34 -33
  588. package/src/concepts/OverriddenLogic__.ts +94 -128
  589. package/src/concepts/Param__.ts +90 -51
  590. package/src/concepts/Point__.ts +22 -22
  591. package/src/concepts/ProcessComponent__.ts +37 -36
  592. package/src/concepts/ProcessElement__.ts +86 -114
  593. package/src/concepts/ProcessOutcome__.ts +23 -22
  594. package/src/concepts/ProcessOutcomes__.ts +22 -20
  595. package/src/concepts/Process__.ts +63 -69
  596. package/src/concepts/QueryAggregateExpression__.ts +27 -28
  597. package/src/concepts/QueryFieldExpression__.ts +25 -26
  598. package/src/concepts/QueryFromExpression__.ts +28 -29
  599. package/src/concepts/QueryGroupByExpression__.ts +23 -22
  600. package/src/concepts/QueryJoinExpression__.ts +41 -62
  601. package/src/concepts/QueryLimitExpression__.ts +27 -27
  602. package/src/concepts/QueryOrderByExpression__.ts +27 -27
  603. package/src/concepts/QuerySelectExpression__.ts +54 -105
  604. package/src/concepts/Rect__.ts +24 -26
  605. package/src/concepts/Return__.ts +67 -42
  606. package/src/concepts/Role__.ts +25 -25
  607. package/src/concepts/SelectMembers__.ts +32 -30
  608. package/src/concepts/Slot__.ts +30 -32
  609. package/src/concepts/SqlQueryComponent__.ts +37 -41
  610. package/src/concepts/Start__.ts +22 -20
  611. package/src/concepts/StringInterpolation__.ts +45 -25
  612. package/src/concepts/StringLiteral__.ts +26 -19
  613. package/src/concepts/StructureProperty__.ts +47 -38
  614. package/src/concepts/Structure__.ts +58 -55
  615. package/src/concepts/SwitchCase__.ts +74 -40
  616. package/src/concepts/SwitchStatement__.ts +44 -29
  617. package/src/concepts/Theme__.ts +21 -18
  618. package/src/concepts/Transactional__.ts +31 -24
  619. package/src/concepts/TriggerEvent__.ts +29 -28
  620. package/src/concepts/TriggerLauncher__.ts +82 -32
  621. package/src/concepts/TypeAnnotation__.ts +98 -92
  622. package/src/concepts/TypeParam__.ts +28 -21
  623. package/src/concepts/UnaryExpression__.ts +45 -26
  624. package/src/concepts/Unparsed__.ts +25 -20
  625. package/src/concepts/UseComponent__.ts +22 -22
  626. package/src/concepts/ValidationRule__.ts +555 -539
  627. package/src/concepts/Variable__.ts +67 -43
  628. package/src/concepts/ViewBlock__.ts +25 -26
  629. package/src/concepts/ViewComponent__.ts +91 -87
  630. package/src/concepts/ViewElement__.ts +2437 -2696
  631. package/src/concepts/View__.ts +407 -345
  632. package/src/concepts/WhileStatement__.ts +59 -36
  633. package/src/concepts/index__.ts +1 -0
  634. package/src/concepts/types__.ts +124 -124
  635. package/src/decorators/index.ts +7 -11
  636. package/src/generator/genBundleFiles.ts +4 -14
  637. package/src/generator/genReleaseBody.ts +182 -198
  638. package/src/index.ts +1 -0
  639. package/src/natural/RequirementAnalyzer.ts +208 -0
  640. package/src/natural/RequirementExecutor.ts +685 -0
  641. package/src/natural/componentData.ts +81 -0
  642. package/src/natural/genNaturalTS.ts +90 -0
  643. package/src/natural/index.ts +4 -0
  644. package/src/natural/knowledgeMap.ts +39 -0
  645. package/src/natural/naslStdlibMap.ts +24 -0
  646. package/src/natural/transformTSCode.ts +834 -0
  647. package/src/sentry/index.ts +2 -2
  648. package/src/server/createUiTs.ts +1 -30
  649. package/src/server/extendBaseNode.ts +18 -18
  650. package/src/server/formatTsUtils.ts +11 -0
  651. package/src/server/getConnector.ts +27 -63
  652. package/src/server/getMemberIdentifier.ts +3 -2
  653. package/src/server/index.ts +1 -4
  654. package/src/server/naslServer.ts +212 -302
  655. package/src/server/translator.ts +3 -1
  656. package/src/service/creator/add.configs.js +1 -26
  657. package/src/service/creator/errHandles.js +4 -5
  658. package/src/service/creator/index.js +0 -12
  659. package/src/service/storage/init.ts +17 -0
  660. package/src/service/storage/jsoner.ts +1 -1
  661. package/src/templator/genCurdEditMultipleKeyBlock.ts +3 -3
  662. package/src/templator/genCurdMultipleKeyBlock.ts +3 -3
  663. package/src/templator/genTableBlock.ts +1 -1
  664. package/src/test/examples/app1.json +1406 -0
  665. package/src/test/fixtures/env.ts +19 -0
  666. package/src/test/integration/connect-create-file.ts +14 -0
  667. package/src/test/integration/connect-file.ts +24 -0
  668. package/src/test/integration/node-nasl-server.ts +14 -0
  669. package/src/test/units/baseTypes/Assignment.spec.ts +20 -0
  670. package/src/test/units/baseTypes/CallLogic.spec.ts +22 -0
  671. package/src/test/units/baseTypes/StringLiteral.spec.ts +60 -0
  672. package/src/test/units/baseTypes/new.spec.ts +13 -0
  673. package/src/test/units/common/Vertex.spec.ts +23 -0
  674. package/src/test/units/data/Entity.spec.ts +10 -0
  675. package/src/test/units/login.spec.ts +10 -0
  676. package/src/test/units/page/Block.spec.ts +15 -0
  677. package/src/test/units/page/Element.spec.ts +45 -0
  678. package/src/test/units/page/example.dashboard.html +46 -0
  679. package/src/test/units/page/example.view1.html +63 -0
  680. package/src/test/units/temp/temp.spec.ts +66 -0
  681. package/src/translator/index.ts +137 -3
  682. package/src/translator/lsp.ts +50 -0
  683. package/src/translator/tsp.ts +14 -0
  684. package/src/utils/index.ts +0 -2
  685. package/src/utils/logger.ts +0 -13
  686. package/src/utils/time-slicing.ts +1 -1
  687. package/test/concepts/call-interface/toEmbeddedTS.spec.ts +6 -6
  688. package/test/concepts/call-interface/toJS.spec.ts +6 -6
  689. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -45
  690. package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +0 -102
  691. package/test/concepts/call-logic/toEmbeddedTS.spec.ts +6 -6
  692. package/test/concepts/call-logic/toJS.spec.ts +6 -6
  693. package/test/concepts/match/toEmbeddedTS.spec.ts +6 -6
  694. package/test/concepts/match/toJS.spec.ts +6 -6
  695. package/test/concepts/utils.ts +43 -46
  696. package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +6 -6
  697. package/test/concepts/validation-rule/toJS.spec.ts +6 -6
  698. package/test/concepts/validation-rule/validation-rule.spec.ts +8 -8
  699. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -592
  700. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -308
  701. package/test/concepts/view-element/fixtures/default-not-found.json +313 -313
  702. package/test/concepts/view-element/toEmbeddedTS.spec.ts +6 -6
  703. package/test/concepts/view-element/toVue.spec.ts +6 -6
  704. package/ts-worker/package-lock.json +101 -6663
  705. package/ts-worker/webpack.config.js +1 -1
  706. package/out/translator/constant.d.ts +0 -6
  707. package/out/translator/constant.js +0 -10
  708. package/out/translator/constant.js.map +0 -1
  709. package/out/translator/types.d.ts +0 -32
  710. package/out/translator/types.js.map +0 -1
  711. package/out/translator/utils.d.ts +0 -17
  712. package/out/translator/utils.js +0 -102
  713. package/out/translator/utils.js.map +0 -1
  714. package/out/utils/cookie.d.ts +0 -9
  715. package/out/utils/cookie.js +0 -62
  716. package/out/utils/cookie.js.map +0 -1
  717. package/out/utils/types.d.ts +0 -1
  718. package/out/utils/types.js +0 -3
  719. package/out/utils/types.js.map +0 -1
  720. package/out/utils/window.d.ts +0 -7
  721. package/out/utils/window.js +0 -14
  722. package/out/utils/window.js.map +0 -1
  723. package/src/translator/constant.ts +0 -7
  724. package/src/translator/types.ts +0 -40
  725. package/src/translator/utils.ts +0 -104
  726. package/src/utils/cookie.ts +0 -60
  727. package/src/utils/types.ts +0 -1
  728. package/src/utils/window.ts +0 -9
  729. package/test/concepts/boolean-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -11
  730. package/test/concepts/boolean-literal/__snapshots__/toJS.spec.ts.snap +0 -11
  731. package/test/concepts/boolean-literal/__snapshots__/toVue.spec.ts.snap +0 -11
  732. package/test/concepts/boolean-literal/constant.ts +0 -5
  733. package/test/concepts/boolean-literal/fixtures/false.json +0 -4
  734. package/test/concepts/boolean-literal/fixtures/true.json +0 -4
  735. package/test/concepts/boolean-literal/toEmbeddedTS.spec.ts +0 -14
  736. package/test/concepts/boolean-literal/toJS.spec.ts +0 -14
  737. package/test/concepts/boolean-literal/toVue.spec.ts +0 -14
  738. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +0 -106
  739. package/test/concepts/call-logic/fixtures/nested-call-logic.json +0 -860
  740. package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +0 -23
  741. package/test/concepts/identifier/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -16
  742. package/test/concepts/identifier/__snapshots__/toJS.spec.ts.snap +0 -16
  743. package/test/concepts/identifier/__snapshots__/toVue.spec.ts.snap +0 -16
  744. package/test/concepts/identifier/constant.ts +0 -5
  745. package/test/concepts/identifier/fixtures/data-source.json +0 -5
  746. package/test/concepts/identifier/fixtures/no-namespace.json +0 -4
  747. package/test/concepts/identifier/fixtures/view-variable.json +0 -201
  748. package/test/concepts/identifier/toEmbeddedTS.spec.ts +0 -14
  749. package/test/concepts/identifier/toJS.spec.ts +0 -14
  750. package/test/concepts/identifier/toVue.spec.ts +0 -14
  751. package/test/concepts/member-expression/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -21
  752. package/test/concepts/member-expression/__snapshots__/toJS.spec.ts.snap +0 -21
  753. package/test/concepts/member-expression/__snapshots__/toVue.spec.ts.snap +0 -21
  754. package/test/concepts/member-expression/constant.ts +0 -5
  755. package/test/concepts/member-expression/fixtures/app.enums.UserStatusEnum.json +0 -13
  756. package/test/concepts/member-expression/fixtures/elements.table-view.data.json +0 -13
  757. package/test/concepts/member-expression/fixtures/entry.created-by.json +0 -18
  758. package/test/concepts/member-expression/fixtures/nasl.auth.userInfo.json +0 -19
  759. package/test/concepts/member-expression/toEmbeddedTS.spec.ts +0 -14
  760. package/test/concepts/member-expression/toJS.spec.ts +0 -14
  761. package/test/concepts/member-expression/toVue.spec.ts +0 -14
  762. package/test/concepts/null-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -6
  763. package/test/concepts/null-literal/__snapshots__/toJS.spec.ts.snap +0 -6
  764. package/test/concepts/null-literal/__snapshots__/toVue.spec.ts.snap +0 -6
  765. package/test/concepts/null-literal/constant.ts +0 -5
  766. package/test/concepts/null-literal/fixtures/null.json +0 -3
  767. package/test/concepts/null-literal/toEmbeddedTS.spec.ts +0 -14
  768. package/test/concepts/null-literal/toJS.spec.ts +0 -14
  769. package/test/concepts/null-literal/toVue.spec.ts +0 -14
  770. package/test/concepts/numeric-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -6
  771. package/test/concepts/numeric-literal/__snapshots__/toJS.spec.ts.snap +0 -6
  772. package/test/concepts/numeric-literal/__snapshots__/toVue.spec.ts.snap +0 -6
  773. package/test/concepts/numeric-literal/constant.ts +0 -5
  774. package/test/concepts/numeric-literal/fixtures/number.json +0 -10
  775. package/test/concepts/numeric-literal/toEmbeddedTS.spec.ts +0 -14
  776. package/test/concepts/numeric-literal/toJS.spec.ts +0 -14
  777. package/test/concepts/numeric-literal/toVue.spec.ts +0 -14
  778. package/test/concepts/string-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -16
  779. package/test/concepts/string-literal/__snapshots__/toJS.spec.ts.snap +0 -16
  780. package/test/concepts/string-literal/__snapshots__/toVue.spec.ts.snap +0 -16
  781. package/test/concepts/string-literal/constant.ts +0 -5
  782. package/test/concepts/string-literal/fixtures/escape.json +0 -4
  783. package/test/concepts/string-literal/fixtures/space.json +0 -4
  784. package/test/concepts/string-literal/fixtures/string.json +0 -4
  785. package/test/concepts/string-literal/toEmbeddedTS.spec.ts +0 -14
  786. package/test/concepts/string-literal/toJS.spec.ts +0 -14
  787. package/test/concepts/string-literal/toVue.spec.ts +0 -14
  788. package/test/concepts/view-element/fixtures/default-login.json +0 -333
  789. package/test/concepts/view-element/fixtures/with-role-auth.json +0 -148
  790. package/test/concepts/view-element/fixtures/with-table.json +0 -3473
@@ -4,11 +4,12 @@ import * as path from 'path';
4
4
  import { Worker } from 'worker_threads';
5
5
  /// #endif
6
6
 
7
+ import * as tsProtocol from 'typescript/lib/protocol';
8
+ import { Decimal } from 'decimal.js';
7
9
  import { config } from '../config';
8
10
  import { sentryMonitorNaslServer, sentryMonitorTSWorkerMessager } from '../sentry';
9
11
  import Messager from '../common/Messager';
10
- import * as tsProtocol from 'typescript/lib/protocol';
11
- import { formatEnums } from '../server/getMemberIdentifier';
12
+ import { formatEnums } from "./getMemberIdentifier";
12
13
 
13
14
  import {
14
15
  Module,
@@ -84,8 +85,7 @@ import {
84
85
  TriggerLauncher,
85
86
  CallConnector,
86
87
  } from '../concepts';
87
-
88
- import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange } from '../translator';
88
+ import { lsp2tspNumber, SourceMap, SourceMapItem } from '../translator';
89
89
  import axios from '../service/storage';
90
90
  import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange, checkAStructure_ } from './translator';
91
91
  import { EventPayload, invokeCommand, registerCommand } from '../common';
@@ -101,7 +101,6 @@ import { EventEmitter } from '../common/EventEmitter';
101
101
  import { traverse } from '../utils';
102
102
  import { withQueueExecute } from '../decorators';
103
103
 
104
- import { Decimal } from 'decimal.js';
105
104
  import { getNodeByNodeCallee } from '../automate/engine/utils';
106
105
 
107
106
  const EmbeddedTSFileLineMap: { [name: string]: number } = {
@@ -142,16 +141,17 @@ interface QuoteNode {
142
141
  // 批量查找节点位置的节点信息类型
143
142
  type QuickInfoNodes = Array<{ filePath: string; node: BaseNode; item: SourceMapItem }>;
144
143
 
145
- let isChangeInterface = false; //判断是否导入接口
144
+ let isChangeInterface = false; // 判断是否导入接口
146
145
  type ActionNode = { target: Variable; typeannotation: TypeAnnotation };
147
- let actionArr: Array<ActionNode> = []; //用于导入接口收集更改的节点
148
- let timer: number | null = null; //超时器用于收集导入接口相关
146
+ let actionArr: Array<ActionNode> = []; // 用于导入接口收集更改的节点
147
+ let timer: number = null; // 超时器用于收集导入接口相关
148
+ const __naslStdlibFileCacheMap: Map<tsProtocol.OpenRequestArgs['file'], tsProtocol.OpenRequestArgs> = new Map(); // naslStdlib文件缓存
149
149
 
150
150
  // 联合类型切割取出类型
151
151
  export function getDisplayString2Type(displayString: string) {
152
- const targetString = displayString.match(/value:\s(\S+)\)/)?.[1];
153
- let targetType:string | null = null;
154
- if (targetString?.startsWith('nasl.core.')) {
152
+ const targetString = displayString.match(/value:\s(\S+)\)/)?.[1] ?? '';
153
+ let targetType: string = null;
154
+ if (targetString.startsWith('nasl.core.')) {
155
155
  targetType = targetString.slice(10);
156
156
  }
157
157
 
@@ -161,20 +161,20 @@ export function getDisplayString2Type(displayString: string) {
161
161
  displayString = displayString?.replace('T extends ', '') || '';
162
162
  const types = reg.exec(displayString);
163
163
  // 取出提示的类型,组成是数组
164
- const typeList: string[] = (types?.[1].split(' | ') ?? []).map((item: string) => {
164
+ const typeList: string[] = types[1].split(' | ').map((item: string) => {
165
165
  if (/<([^()]+)>/g.exec(item)) {
166
166
  return item;
167
- } else if (item.includes(' ')) {
167
+ } if (item.includes(' ')) {
168
168
  const strs = item.split(' ');
169
169
  const type = strs[strs.length - 1];
170
170
  return type;
171
- } else if (item.includes('.')) {
171
+ } if (item.includes('.')) {
172
172
  const strs = item.split('.');
173
173
  const type = strs[strs.length - 1];
174
174
  return type;
175
- } else {
175
+ }
176
176
  return item;
177
- }
177
+
178
178
  });
179
179
 
180
180
  if (targetType) {
@@ -185,12 +185,11 @@ export function getDisplayString2Type(displayString: string) {
185
185
 
186
186
  @sentryMonitorNaslServer
187
187
  class NaslServer {
188
- /** naslStdlib文件缓存 */
189
- naslStdlibFileCacheMap: Map<tsProtocol.OpenRequestArgs['file'], tsProtocol.OpenRequestArgs> = new Map();
188
+ naslStdlibFileCacheMap = __naslStdlibFileCacheMap;
190
189
 
191
- messager: Messager;
190
+ messager: Messager = undefined;
192
191
 
193
- worker: Worker;
192
+ worker: Worker = undefined;
194
193
 
195
194
  /**
196
195
  * 按道理 fileSourceMap: new Map<string, SourceMap>() 比较合理,
@@ -199,22 +198,12 @@ class NaslServer {
199
198
  */
200
199
  file2NodeMap: Map<string, BaseNode> = new Map<string, BaseNode>();
201
200
 
202
- /** TS 翻译的源码 */
203
- tsFiles = new Map<string, string>();
204
-
205
- /// #if process.env.NODE_ENV === 'development'
206
- /**
207
- * 调试时是否储存 ts 文件
208
- */
209
- openDebugEmbedded = true;
210
- /// #endif
211
-
212
201
  elementsLogic: { [elementLogicName: string]: Array<Logic> } = {};
213
202
 
214
203
  // 错误日志收集
215
- diagnosticManager: DiagnosticManager;
204
+ diagnosticManager: DiagnosticManager = undefined;
216
205
 
217
- embeddedTSEmitter: EventEmitter;
206
+ embeddedTSEmitter: EventEmitter = undefined;
218
207
 
219
208
  // 需要执行修改的文件
220
209
  changeStackList: Array<EventPayload> = [];
@@ -261,6 +250,8 @@ class NaslServer {
261
250
  // 结束诊断和标注
262
251
  invokeCommand('naslServer:endWork');
263
252
  invokeCommand('naslServer:nodeChange');
253
+ this.embeddedTSEmitter.emit('naslServer:endWork');
254
+ this.embeddedTSEmitter.emit('naslServer:nodeChange');
264
255
  } catch (e) {
265
256
  console.log('no "naslServer:nodeChange" event received');
266
257
  }
@@ -289,7 +280,7 @@ class NaslServer {
289
280
  // 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
290
281
  // @ts-ignore
291
282
  const findLastIndex = this.changeStackList.findLastIndex((changeStackItem: EventPayload) => {
292
- const target = changeStackItem.target;
283
+ const {target} = changeStackItem;
293
284
  const { fileNode: targetFileNode } = this.getCurrentSource(target);
294
285
  return targetFileNode === fileNode;
295
286
  });
@@ -299,10 +290,10 @@ class NaslServer {
299
290
  if (this.changeStackList[findLastIndex]?.field) {
300
291
  // 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
301
292
  return;
302
- } else {
293
+ }
303
294
  // 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
304
295
  this.changeStackList.pop();
305
- }
296
+
306
297
  }
307
298
  this.changeStackList.push(item.originEvent);
308
299
  } catch (err) {
@@ -339,7 +330,7 @@ class NaslServer {
339
330
  Object.keys(naslStdlibMap).forEach(async (libFileName: string) => {
340
331
  await this.addFile(
341
332
  {
342
- file: '/' + libFileName,
333
+ file: `/${ libFileName}`,
343
334
  fileContent: naslStdlibMap[libFileName],
344
335
  },
345
336
  { cache: true }
@@ -530,24 +521,6 @@ class NaslServer {
530
521
  launcher.sourceMap = result.sourceMap;
531
522
  this.file2NodeMap.set(result.filePath, launcher);
532
523
  });
533
- module.namespaces?.forEach?.((namespace) => {
534
- namespace.logics.forEach((logic) => {
535
- const result = logic.toEmbeddedTSFile();
536
- results.push(result);
537
- // sourceMap都存在目录级别内容下,在页面层级下去找
538
- logic.sourceMap = result.sourceMap;
539
- this.file2NodeMap.set(result.filePath, logic);
540
- });
541
- })
542
- module?.authLogicsForCallInterface?.forEach?.((logic) => {
543
- try {
544
- if (!(logic instanceof Logic)) return;
545
- const result = logic.toEmbeddedTSFile();
546
- results.push(result);
547
- logic.sourceMap = result.sourceMap;
548
- this.file2NodeMap.set(result.filePath, logic);
549
- } catch (err) {}
550
- });
551
524
  } catch (error) {
552
525
  console.error(error);
553
526
  }
@@ -627,7 +600,6 @@ class NaslServer {
627
600
  // 其他模块的创建内容
628
601
  app.dependencies.forEach((item) => this.contentToFile(item, results));
629
602
  app.interfaceDependencies.forEach((item) => this.contentToFile(item, results));
630
- app.integration?.connectors?.forEach((item) => this.contentToFile(item, results));
631
603
  } catch (err) {
632
604
  console.log(err);
633
605
  }
@@ -671,17 +643,17 @@ class NaslServer {
671
643
  cache && this.cacheFile(file);
672
644
  return this.messager.requestCommand('addFile', file);
673
645
  }
646
+
674
647
  // 缓存添加过的文件
675
648
  cacheFile(options: tsProtocol.OpenRequestArgs) {
676
- this.naslStdlibFileCacheMap.set(options.file, options);
649
+ __naslStdlibFileCacheMap.set(options.file, options);
677
650
  }
678
651
 
679
- /**u
652
+ /** u
680
653
  * 只新增文件
681
654
  * @param {*} files
682
655
  */
683
656
  writeFiles(files: Array<tsProtocol.OpenRequestArgs>) {
684
- files.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
685
657
  return this.messager.requestCommand('writeFiles', files);
686
658
  }
687
659
 
@@ -691,7 +663,6 @@ class NaslServer {
691
663
  * @param {*} args
692
664
  */
693
665
  updateFiles(args: { outputFiles: Array<tsProtocol.OpenRequestArgs> }) {
694
- args.outputFiles.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
695
666
  return this.messager.requestCommand('updateFiles', args);
696
667
  }
697
668
 
@@ -699,37 +670,36 @@ class NaslServer {
699
670
  * 清除一个目录下的所有文件
700
671
  */
701
672
  deleteDirectoryFiles(args: { directoryName: string }) {
702
- Array.from(this.tsFiles.keys())
703
- .filter((key) => key.startsWith(args.directoryName))
704
- .forEach((key) => this.tsFiles.delete(key));
705
-
706
673
  return this.messager.requestCommand('deleteDirectoryFiles', args);
707
674
  }
708
675
 
709
676
  async _debugInFileStorage(node: BaseNode, openFiles: Array<tsProtocol.OpenRequestArgs>) {
710
677
  let app = node;
678
+ let openDebugEmbedded = true;
711
679
  if (node.concept !== 'App') {
712
680
  app = (node as any).rootNode || (node as any).app;
713
681
  }
714
682
  /// #if process.env.NODE_ENV === 'development'
715
683
  // 首次尝试请求
716
- await axios.post('/api/App/debugEmbedded?id=' + app.id, openFiles[0]).catch(() => (this.openDebugEmbedded = false));
717
- if (this.openDebugEmbedded && globalThis.window) {
684
+ await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, openFiles[0]).catch(() => (openDebugEmbedded = false));
685
+
686
+ if (openDebugEmbedded && globalThis.window) {
718
687
  // For TS build
719
688
  try {
720
689
  let canDebug = true;
721
- await axios.post('/api/App/debugEmbedded?id=' + app.id, openFiles[0]).catch(() => (canDebug = false));
690
+ await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, openFiles[0]).catch(() => (canDebug = false));
722
691
 
723
692
  if (canDebug) {
724
693
  await Promise.all(
725
694
  openFiles.map(async (file) => {
726
- const res = await axios.post('/api/App/debugEmbedded?id=' + app.id, file);
695
+ const res = await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, file);
727
696
  return res.data;
728
697
  })
729
698
  );
730
699
  }
731
700
  } catch (e) {
732
- // ..
701
+ // 出现错误之后不再调用
702
+ openDebugEmbedded = false;
733
703
  }
734
704
  }
735
705
  /// #endif
@@ -768,15 +738,15 @@ class NaslServer {
768
738
  return this._getValueSelectCompletion({
769
739
  file: (fileNode as FileNode).getEmbeddedFilePath(),
770
740
  range: {
771
- line: lsp2tspNumber(currentSource.start.line),
772
- offset: lsp2tspNumber(currentSource.start.character),
741
+ line: lsp2tspNumber(currentSource.range.start.line),
742
+ offset: lsp2tspNumber(currentSource.range.start.character),
773
743
  },
774
744
  value,
775
745
  noFilterList,
776
746
  });
777
- } else {
747
+ }
778
748
  console.log('没找到节点', node, currentSource, fileNode);
779
- }
749
+
780
750
  }
781
751
 
782
752
  _getValueSelectCompletion(args: any) {
@@ -803,8 +773,8 @@ class NaslServer {
803
773
  try {
804
774
  const quickInfo = await this._getTypeQuickinfo({
805
775
  file: (fileNode as FileNode).getEmbeddedFilePath(),
806
- line: lsp2tspNumber(currentSource.start.line),
807
- offset: lsp2tspNumber(currentSource.start.character) + `nasl.util.C`.length,
776
+ line: lsp2tspNumber(currentSource.range.start.line),
777
+ offset: lsp2tspNumber(currentSource.range.start.character) + `nasl.util.C`.length,
808
778
  });
809
779
  if (quickInfo.responseRequired) {
810
780
  const displayString = quickInfo?.response?.displayString || '';
@@ -820,9 +790,9 @@ class NaslServer {
820
790
  });
821
791
  if (!res.length) {
822
792
  return [];
823
- } else {
793
+ }
824
794
  return [{ title: '基础类型', children: res }];
825
- }
795
+
826
796
  }
827
797
  } catch (err) {
828
798
  console.log(err);
@@ -849,8 +819,8 @@ class NaslServer {
849
819
  }
850
820
  const quickInfo = await this._getTypeQuickinfo({
851
821
  file: (fileNode as FileNode).getEmbeddedFilePath(),
852
- line: lsp2tspNumber(currentSource.start.line),
853
- offset: lsp2tspNumber(currentSource.start.character) + `new nasl.ui.`.length,
822
+ line: lsp2tspNumber(currentSource.range.start.line),
823
+ offset: lsp2tspNumber(currentSource.range.start.character) + `new nasl.ui.`.length,
854
824
  });
855
825
  if (quickInfo.responseRequired) {
856
826
  const displayString = quickInfo?.response?.displayString || '';
@@ -866,7 +836,7 @@ class NaslServer {
866
836
  .replaceAll('\n', '')
867
837
  .replace(/__name:"AStructure_\w{8}";/g, '')
868
838
  .replace(/dataSources.([^.]+).entities.([^;]+)/g, ($1, $2, $3) => `${$3}(${$2})`);
869
- } else if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
839
+ } if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
870
840
  /**
871
841
  * {
872
842
  text: nasl.core.String;
@@ -898,6 +868,7 @@ class NaslServer {
898
868
  }
899
869
  return '';
900
870
  }
871
+
901
872
  async getDataSchemaStructureOrTypeAnnotation(node: ViewElement) {
902
873
  if (!(node instanceof ViewElement)) return;
903
874
 
@@ -907,8 +878,8 @@ class NaslServer {
907
878
  }
908
879
  const quickInfo = await this._getTypeQuickinfo({
909
880
  file: (fileNode as FileNode).getEmbeddedFilePath(),
910
- line: lsp2tspNumber(currentSource.start.line),
911
- offset: lsp2tspNumber(currentSource.start.character) + `new nasl.ui.`.length,
881
+ line: lsp2tspNumber(currentSource.range.start.line),
882
+ offset: lsp2tspNumber(currentSource.range.start.character) + `new nasl.ui.`.length,
912
883
  });
913
884
  if (quickInfo.responseRequired) {
914
885
  const displayString = quickInfo?.response?.displayString || '';
@@ -917,7 +888,7 @@ class NaslServer {
917
888
 
918
889
  const types = /<([^()]+)>/g.exec(displayString);
919
890
  const typeStr = types && types[1];
920
- const app = node.app;
891
+ const {app} = node;
921
892
  if (typeStr.includes('__name: "AStructure_')) {
922
893
  const properties: StructureProperty[] = [];
923
894
  typeStr.replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
@@ -940,7 +911,7 @@ class NaslServer {
940
911
  return '';
941
912
  });
942
913
  return TypeAnnotation.createTypeAnonymousStructure(properties);
943
- } else if (typeStr.startsWith('structures')) return app.findNodeByCompleteName(`app.${typeStr}`);
914
+ } if (typeStr.startsWith('structures')) return app.findNodeByCompleteName(`app.${typeStr}`);
944
915
  }
945
916
  }
946
917
 
@@ -1002,14 +973,14 @@ class NaslServer {
1002
973
  return this._getSelectNextCompletion({
1003
974
  file: (fileNode as FileNode).getEmbeddedFilePath(),
1004
975
  range: {
1005
- line: lsp2tspNumber(currentSource.start.line),
1006
- offset: lsp2tspNumber(currentSource.start.character),
976
+ line: lsp2tspNumber(currentSource.range.start.line),
977
+ offset: lsp2tspNumber(currentSource.range.start.character),
1007
978
  },
1008
979
  noFilterList,
1009
980
  });
1010
- } else {
981
+ }
1011
982
  console.log('没找到节点', currentSource, fileNode);
1012
- }
983
+
1013
984
  }
1014
985
 
1015
986
  _getSelectNextCompletion(args: any) {
@@ -1028,6 +999,7 @@ class NaslServer {
1028
999
  if (node.tsErrorDetail) return;
1029
1000
  node.tsErrorDetail = tsErrorDetail;
1030
1001
  }
1002
+
1031
1003
  /**
1032
1004
  * 处理诊断结果
1033
1005
  * @param records 结果
@@ -1041,7 +1013,7 @@ class NaslServer {
1041
1013
  }
1042
1014
  await Promise.all(
1043
1015
  records.map(async (record) => {
1044
- const node = record.node;
1016
+ const {node} = record;
1045
1017
  if (!node) return;
1046
1018
 
1047
1019
  // 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
@@ -1049,7 +1021,7 @@ class NaslServer {
1049
1021
 
1050
1022
  oldRecord?.semanticDiagnostics.forEach((item) => {
1051
1023
  if (item.node) {
1052
- delete item.node.tsErrorDetail;
1024
+ item.node.tsErrorDetail = undefined;
1053
1025
  // 如果logic中有报错就把标识置为true
1054
1026
  if ((item.node as any)?.logic?.haveError) {
1055
1027
  (item.node as any).logic.haveError = false;
@@ -1060,7 +1032,7 @@ class NaslServer {
1060
1032
  // 清空一些状态
1061
1033
  oldRecord?.suggestionDiagnostics.forEach((item) => {
1062
1034
  if (item.node) {
1063
- delete item.node.tsErrorDetail;
1035
+ item.node.tsErrorDetail = undefined;
1064
1036
  if (item.node && item.node instanceof Logic) {
1065
1037
  item.node.isSmpty = false;
1066
1038
  }
@@ -1076,7 +1048,7 @@ class NaslServer {
1076
1048
  if (record.node instanceof Logic) {
1077
1049
  record?.syntaxDiagnostics.forEach((item) => {
1078
1050
  const minRange = this._findMinRange(item as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
1079
- if (minRange?.node instanceof OqlQueryComponent) {
1051
+ if (minRange.node instanceof OqlQueryComponent) {
1080
1052
  if (item.text === 'Invalid character.') {
1081
1053
  record.semanticDiagnostics.push(item);
1082
1054
  }
@@ -1101,7 +1073,7 @@ class NaslServer {
1101
1073
  if (diagnostic.severity === 'warning') {
1102
1074
  record.suggestionDiagnostics.push(diagnostic);
1103
1075
  return null;
1104
- } else if (currentNode.concept === 'OqlQueryComponent') {
1076
+ } if (currentNode.concept === 'OqlQueryComponent') {
1105
1077
  // OQL别名错误降级为警告
1106
1078
  if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
1107
1079
  // 重置 图标和错误等级
@@ -1146,7 +1118,7 @@ class NaslServer {
1146
1118
  if (diag?.node) {
1147
1119
  return diag;
1148
1120
  // 一些已知警告的单独处理
1149
- } else if (
1121
+ } if (
1150
1122
  [
1151
1123
  `'__LogicEmpty' is declared but its value is never read.`,
1152
1124
  `'__destinationEmpty__' is declared but its value is never read.`,
@@ -1156,7 +1128,7 @@ class NaslServer {
1156
1128
  ].includes(diag.text)
1157
1129
  ) {
1158
1130
  return this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode, record);
1159
- } else if (diag.text.includes(` is declared but its value is never read.`)) {
1131
+ } if (diag.text.includes(` is declared but its value is never read.`)) {
1160
1132
  // 局部变量和输入变量未使用的警告
1161
1133
  const fromModule = record.node.parentNode.concept === 'Module';
1162
1134
  const fromConnector = record.node.parentNode.concept === 'Connector';
@@ -1185,7 +1157,7 @@ class NaslServer {
1185
1157
  message: `未使用的输入参数${minRange.node.name}`,
1186
1158
  };
1187
1159
  return diagnostic;
1188
- } else if (minRange.node instanceof Variable) {
1160
+ } if (minRange.node instanceof Variable) {
1189
1161
  const diagnostic = {
1190
1162
  node: minRange.node,
1191
1163
  severity: 'warning',
@@ -1369,7 +1341,7 @@ class NaslServer {
1369
1341
  const typeAnnotation = item.__TypeAnnotation;
1370
1342
  // 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
1371
1343
  if (typeAnnotation) {
1372
- const sortedTypeKey = typeAnnotation.sortedTypeKey;
1344
+ const {sortedTypeKey} = typeAnnotation;
1373
1345
  if (!typeAnnotationMap[sortedTypeKey]) {
1374
1346
  typeAnnotationMap[sortedTypeKey] = {
1375
1347
  typeAnnotation,
@@ -1421,7 +1393,7 @@ class NaslServer {
1421
1393
  const typeAnnotation = value.__TypeAnnotation;
1422
1394
  // 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
1423
1395
  if (typeAnnotation) {
1424
- const sortedTypeKey = typeAnnotation.sortedTypeKey;
1396
+ const {sortedTypeKey} = typeAnnotation;
1425
1397
  if (!typeAnnotationMap[sortedTypeKey]) {
1426
1398
  typeAnnotationMap[sortedTypeKey] = {
1427
1399
  typeAnnotation,
@@ -1519,14 +1491,6 @@ class NaslServer {
1519
1491
  };
1520
1492
  this.baseNodeAssignmentTsError(variable, diagnostic);
1521
1493
  diagnostics.push(diagnostic);
1522
- } else if (variable.__TypeAnnotation?.hasSystemType(node.app)) {
1523
- const diagnostic = {
1524
- node,
1525
- severity: 'warning',
1526
- message: `数据查询中不可以使用或包含系统类型!当前类型:${variable.__TypeAnnotation?.typeChineseTitle}。`,
1527
- };
1528
- this.baseNodeAssignmentTsError(variable, diagnostic);
1529
- diagnostics.push(diagnostic);
1530
1494
  }
1531
1495
  });
1532
1496
  }
@@ -1752,17 +1716,17 @@ class NaslServer {
1752
1716
  if (Array.isArray(node.bindExpressions)) {
1753
1717
  const exp = node.bindExpressions.find((bindExpression) => this.hasComponentLogics(bindExpression));
1754
1718
  if (exp) {
1755
- //const element: any = node.getAncestor('ViewElement');
1756
- //const api = config.allNodesAPI[element?.tag];
1757
- //const attr = api?.attrs?.find?.((attr) => {
1719
+ // const element: any = node.getAncestor('ViewElement');
1720
+ // const api = config.allNodesAPI[element?.tag];
1721
+ // const attr = api?.attrs?.find?.((attr) => {
1758
1722
  // return attr.name === node.name;
1759
- //});
1723
+ // });
1760
1724
  const map = {
1761
1725
  BindAttribute: '属性',
1762
1726
  BindDirective: '指令',
1763
1727
  BindStyle: '样式属性',
1764
1728
  };
1765
- //“${attr?.title || node.title || node.name}”
1729
+ // “${attr?.title || node.title || node.name}”
1766
1730
  const diagnostic = {
1767
1731
  node,
1768
1732
  severity: 'error',
@@ -1785,19 +1749,6 @@ class NaslServer {
1785
1749
  diagnostics.push(diagnostic);
1786
1750
  node.tsErrorDetail = diagnostic;
1787
1751
  }
1788
- } else if (node instanceof Identifier) {
1789
- // 变量如果选到了页面,因为ts会找到兄弟的同名变量,所以需要新增报错,通过类型来判断加不加
1790
- // https://projectmanage.netease-official.lcap.163yun.com/dashboard/BugDetail?id=2696136968961024
1791
- if (node.name && node.__TypeAnnotation?.typeKind === 'reference' && node.__TypeAnnotation?.typeNamespace?.endsWith('views')) {
1792
- const errorMsg = `找不到 ${node.name}。`;
1793
- const diagnostic = {
1794
- node,
1795
- severity: 'error',
1796
- message: errorMsg,
1797
- };
1798
- diagnostics.push(diagnostic);
1799
- node.tsErrorDetail = diagnostic;
1800
- }
1801
1752
  } else {
1802
1753
  this.checkNodeError(node, diagnostics);
1803
1754
  }
@@ -1937,7 +1888,7 @@ class NaslServer {
1937
1888
  const { default: defaultVal } = precisionOption || {};
1938
1889
  const precision = databaseTypeAnnotation ? (databaseTypeAnnotation.arguments as any)?.precision : defaultVal;
1939
1890
  const ruleScale = (typeAnnotation?.ruleMap as any)?.scale;
1940
- const scale = ruleScale !== undefined ? ruleScale + '' : '';
1891
+ const scale = ruleScale !== undefined ? `${ruleScale }` : '';
1941
1892
  let ensureScale = true;
1942
1893
  switch (typeName) {
1943
1894
  case 'String': {
@@ -1966,16 +1917,6 @@ class NaslServer {
1966
1917
  typeAnnotationErrorDetail.errorPos[key] = errorMsg;
1967
1918
  }
1968
1919
  });
1969
- } else if (rulesMap?.maxLength && +dataBaseTyp?.max && +rulesMap.maxLength > +dataBaseTyp.max) {
1970
- // 判断当前 最大长度 是不是比 数据库类型的最大长度 长,超过就报错
1971
- const errorMsg = `最大长度超出存储长度`;
1972
- const diag: any = {
1973
- node: property,
1974
- severity: 'warning',
1975
- message: errorMsg,
1976
- };
1977
- diagnostics.push(diag);
1978
- typeAnnotationErrorDetail.errorPos.maxLength = errorMsg;
1979
1920
  }
1980
1921
  }
1981
1922
  case 'Long': {
@@ -2046,7 +1987,7 @@ class NaslServer {
2046
1987
  // 储存小数部分
2047
1988
  const memoryScaleStr = memoryStr.slice(0, +(scale || '0'));
2048
1989
  // 储存绝对值
2049
- const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? '.' + memoryScaleStr : '');
1990
+ const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? `.${ memoryScaleStr}` : '');
2050
1991
  const decimalMemoryAbsVal = new Decimal(memoryAbsVal);
2051
1992
  [
2052
1993
  {
@@ -2114,7 +2055,7 @@ class NaslServer {
2114
2055
  diagnostics.push(diagnostic);
2115
2056
  }
2116
2057
  fileNode?.sourceMap.forEach((value, node) => {
2117
- //OQL支持返回复合类型数据了
2058
+ // OQL支持返回复合类型数据了
2118
2059
  // SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
2119
2060
  // if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
2120
2061
  // const diagnostic = {
@@ -2130,7 +2071,7 @@ class NaslServer {
2130
2071
  const typeAnnotation = type2TypeAnnotation((node as any).__nodeType);
2131
2072
  if (!node.typeAnnotation && typeAnnotation) {
2132
2073
  if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
2133
- const typeArguments = typeAnnotation.typeArguments;
2074
+ const {typeArguments} = typeAnnotation;
2134
2075
  if (typeArguments.length && typeArguments[0].isComplexType()) {
2135
2076
  const diagnostic = {
2136
2077
  node,
@@ -2178,7 +2119,7 @@ class NaslServer {
2178
2119
  node.tsErrorDetail = diagnostic;
2179
2120
  diagnostics.push(diagnostic);
2180
2121
  } else {
2181
- delete node.tsErrorDetail;
2122
+ node.tsErrorDetail = undefined;
2182
2123
  }
2183
2124
  }
2184
2125
  this.checkNodeError(node, diagnostics);
@@ -2418,7 +2359,7 @@ class NaslServer {
2418
2359
  // 先特殊处理等 类型合并后就可以去掉了
2419
2360
  if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
2420
2361
  return null;
2421
- } else if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
2362
+ } if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
2422
2363
  return null;
2423
2364
  }
2424
2365
  const diagnostic = {
@@ -2458,7 +2399,7 @@ class NaslServer {
2458
2399
  if (typeKeyArr[0] === 'apis') {
2459
2400
  const structureName = typeKeyArr[3];
2460
2401
  const moduleName = typeKeyArr[1];
2461
- const app = (typeAnnotation.upperNode as Variable).app;
2402
+ const {app} = (typeAnnotation.upperNode as Variable);
2462
2403
  if (!app) {
2463
2404
  return null;
2464
2405
  }
@@ -2474,14 +2415,14 @@ class NaslServer {
2474
2415
  }
2475
2416
  }
2476
2417
  return null;
2477
- } else {
2418
+ }
2478
2419
  return diag;
2479
- }
2420
+
2480
2421
  });
2481
2422
  if (actionArr.length) {
2482
2423
  if (timer) return;
2483
2424
  timer = window.setTimeout(() => {
2484
- const app = actionArr[0].target.app;
2425
+ const {app} = actionArr[0].target;
2485
2426
  app.emit('collect:start', {
2486
2427
  actionMsg: '设置导入接口数据类型错误',
2487
2428
  });
@@ -2545,7 +2486,7 @@ class NaslServer {
2545
2486
  */
2546
2487
  _findMinRange(diagnostic: tsProtocol.DiagnosticWithFileName | tsProtocol.ReferencesResponseItem, fileNode: FileNode) {
2547
2488
  let minRange: MinRange;
2548
- const sourceMap: SourceMap = fileNode.sourceMap;
2489
+ const {sourceMap} = fileNode;
2549
2490
  // 是否找到了行内准确的,是的话,就不走多行的
2550
2491
  let haveLineNode = false;
2551
2492
  for (const [node, item] of sourceMap.entries()) {
@@ -2553,19 +2494,19 @@ class NaslServer {
2553
2494
  * 当前内容的开始行 <= 诊断开始的行 &&
2554
2495
  * 当前内容的结束行 >= 诊断结束的行
2555
2496
  */
2556
- if (lsp2tspNumber(item.start.line) <= diagnostic.start.line && lsp2tspNumber(item.end.line) >= diagnostic.end.line) {
2497
+ if (lsp2tspNumber(item.range.start.line) <= diagnostic.start.line && lsp2tspNumber(item.range.end.line) >= diagnostic.end.line) {
2557
2498
  // 如果找到某一行
2558
- if (lsp2tspNumber(item.start.line) === diagnostic.start.line && lsp2tspNumber(item.end.line) === diagnostic.end.line) {
2499
+ if (lsp2tspNumber(item.range.start.line) === diagnostic.start.line && lsp2tspNumber(item.range.end.line) === diagnostic.end.line) {
2559
2500
  // 在行的范围但是又不在列的范围,不用给默认值,给了反而不对,
2560
2501
  // 需要在列的范围内
2561
2502
  if (
2562
- lsp2tspNumber(item.start.character) <= diagnostic.start.offset &&
2563
- lsp2tspNumber(item.end.character) >= diagnostic.end.offset
2503
+ lsp2tspNumber(item.range.start.character) <= diagnostic.start.offset &&
2504
+ lsp2tspNumber(item.range.end.character) >= diagnostic.end.offset
2564
2505
  ) {
2565
2506
  // 比列更靠近 ,满足条件且长度更短
2566
2507
  // 如果先走到下面有一个默认值了就像在if for里面有个表达式
2567
2508
  // if for的内容也是包括当前的所以会重新赋值
2568
- if (!minRange || (item.end.offset - item.start.offset) < (minRange.item.end.offset - minRange.item.start.offset)) {
2509
+ if (!minRange || item.code.length < minRange.item.code.length) {
2569
2510
  minRange = { item, node };
2570
2511
  haveLineNode = true;
2571
2512
  }
@@ -2577,24 +2518,22 @@ class NaslServer {
2577
2518
  minRange = { node, item };
2578
2519
  } else if (!haveLineNode) {
2579
2520
  if (
2580
- lsp2tspNumber(item.start.line) === diagnostic.start.line &&
2581
- diagnostic.start.offset >= lsp2tspNumber(item.start.character)
2521
+ lsp2tspNumber(item.range.start.line) === diagnostic.start.line &&
2522
+ diagnostic.start.offset >= lsp2tspNumber(item.range.start.character)
2582
2523
  ) {
2583
2524
  // 如果当前遍历的内容的行和列都 小于之前的, 而且是有效的
2584
2525
  // 如果两个内容位置行数是一样的,就比较下找到内容的位置信息
2585
2526
  // 找到的内容的开始位置, 要大于申明内容开始的位置,要不就不包含在内了
2586
- if (diagnostic.start.offset - item.start.character <= diagnostic.start.offset - minRange.item.start.character) {
2527
+ if (diagnostic.start.offset - item.range.start.character <= diagnostic.start.offset - minRange.item.range.start.character) {
2587
2528
  minRange = { node, item };
2588
- } else {
2589
- if (diagnostic.start.offset < lsp2tspNumber(minRange.item.start.character)) {
2529
+ } else if (diagnostic.start.offset < lsp2tspNumber(minRange.item.range.start.character)) {
2590
2530
  minRange = { node, item };
2591
2531
  }
2592
- }
2593
- } else if (item.end.line - item.start.line <= minRange.item.end.line - minRange.item.start.line) {
2532
+ } else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
2594
2533
  // 行都一致 ,比较列
2595
- if (minRange.item.start.line === item.start.line && minRange.item.end.line === item.end.line) {
2534
+ if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
2596
2535
  // 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
2597
- if (item.start.character > minRange.item.start.character) {
2536
+ if (item.range.start.character > minRange.item.range.start.character) {
2598
2537
  minRange = { node, item };
2599
2538
  }
2600
2539
  } else {
@@ -2628,12 +2567,11 @@ class NaslServer {
2628
2567
  if (currentSource) {
2629
2568
  const newRefs = await this.references({
2630
2569
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2631
- line: lsp2tspNumber(currentSource.start.line),
2632
- offset: lsp2tspNumber(currentSource.start.character),
2570
+ line: lsp2tspNumber(currentSource.range.start.line),
2571
+ offset: lsp2tspNumber(currentSource.range.start.character),
2633
2572
  });
2634
2573
  refsList = [...newRefs.refs];
2635
- } else {
2636
- if (node instanceof Module) {
2574
+ } else if (node instanceof Module) {
2637
2575
  const lists = node.logics || node.structures || node.enums;
2638
2576
  const moduleName = (fileNode as FileNode).getEmbeddedFilePath();
2639
2577
  if (lists.length) {
@@ -2643,7 +2581,7 @@ class NaslServer {
2643
2581
  const newRefs = await this.references({
2644
2582
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2645
2583
  line: 1,
2646
- offset: 22, //固定的位置,module的位置信息
2584
+ offset: 22, // 固定的位置,module的位置信息
2647
2585
  });
2648
2586
  refsList = newRefs.refs.filter((item) => !item.file.startsWith(moduleName));
2649
2587
  // 多塞一个 ,删除的时候就有值了, 上面过滤了之后可能是空的
@@ -2651,7 +2589,6 @@ class NaslServer {
2651
2589
  }
2652
2590
  }
2653
2591
  }
2654
- }
2655
2592
 
2656
2593
  // 如果是DataSource就需要在单独,查一边来修改名字
2657
2594
  if (node instanceof DataSource) {
@@ -2672,7 +2609,7 @@ class NaslServer {
2672
2609
  const entity = this.file2NodeMap.get(item.file);
2673
2610
  const { currentSource } = this.getCurrentSource(entity);
2674
2611
  // 42 11个函数的总行数
2675
- if (item.end.line < currentSource.end.line - 42 && item.start.line > 1) {
2612
+ if (item.end.line < currentSource.range.end.line - 42 && item.start.line > 1) {
2676
2613
  flag = true;
2677
2614
  }
2678
2615
  }
@@ -2701,8 +2638,8 @@ class NaslServer {
2701
2638
  callQueryComponentTypeAnnotation = key;
2702
2639
  }
2703
2640
  });
2704
- const { currentSource: qcTypeAnnotationCurrentSource, fileNode: qcTypeCurrentFileNode } = callQueryComponentTypeAnnotation.getCurrentSource();
2705
- const { currentSource: logicCurrentSource, fileNode: logicCurrentFileNode } = fileNode.getCurrentSource();
2641
+ const { currentSource: qcTypeAnnotationCurrentSource, fileNode } = callQueryComponentTypeAnnotation.getCurrentSource();
2642
+ const { currentSource: logicCurrentSource } = fileNode.getCurrentSource();
2706
2643
  const aggregateLength = callQueryComponent.select.selectAggregateElements.filter(
2707
2644
  (item: any) => item.aggregateName && item.asName
2708
2645
  ).length;
@@ -2711,25 +2648,22 @@ class NaslServer {
2711
2648
  ).length;
2712
2649
  if (!groupByLength && !aggregateLength && callQueryComponentTypeAnnotation.typeKind === 'anonymousStructure') {
2713
2650
  // 拿到 List 的泛型(匿名数据结构)的所有属性
2714
- const properties = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0].properties;
2651
+ const {properties} = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0];
2715
2652
  const targetProperty = properties.find((p) => p.name === utils.firstLowerCase(node.name));
2716
2653
  if (!targetProperty) {
2717
2654
  continue;
2718
2655
  }
2719
2656
  const { currentSource: propertyTypeCurrentSource } = targetProperty.typeAnnotation.getCurrentSource();
2720
2657
  // 减去 ": " 2个字符、减去属性名长度
2721
- const propertyCharacter = propertyTypeCurrentSource.start.character - 2 - targetProperty.name.length;
2722
- const propertyOffset = propertyCharacter - qcTypeAnnotationCurrentSource.start.character;
2723
- const qcTypeCurrentFilePath = (qcTypeCurrentFileNode as any).getEmbeddedFilePath() as string;
2724
- const qcTypeAnnotationCurrentCode = this.getNodeCode(qcTypeCurrentFileNode, qcTypeAnnotationCurrentSource);
2725
- const logicCurrentCode = this.getNodeCode(qcTypeCurrentFileNode, logicCurrentSource);
2726
- const qcTypeAnnotationOffset = logicCurrentCode.indexOf(qcTypeAnnotationCurrentCode);
2727
- const declarationCodeArr = logicCurrentCode.slice(0, qcTypeAnnotationOffset).split('\n');
2658
+ const propertyCharacter = propertyTypeCurrentSource.range.start.character - 2 - targetProperty.name.length;
2659
+ const propertyOffset = propertyCharacter - qcTypeAnnotationCurrentSource.range.start.character;
2660
+ const qcTypeAnnotationOffset = logicCurrentSource.code.indexOf(qcTypeAnnotationCurrentSource.code);
2661
+ const declarationCodeArr = logicCurrentSource.code.slice(0, qcTypeAnnotationOffset).split('\n');
2728
2662
  const line = declarationCodeArr.length - 1;
2729
2663
  const character = declarationCodeArr[declarationCodeArr.length - 1].length;
2730
2664
  // eslint-disable-next-line no-await-in-loop
2731
2665
  const newRefs = await this.references({
2732
- file: qcTypeCurrentFilePath,
2666
+ file: (fileNode as any).getEmbeddedFilePath(),
2733
2667
  line: line + 2,
2734
2668
  offset: character + 1 + propertyOffset,
2735
2669
  });
@@ -2756,8 +2690,8 @@ class NaslServer {
2756
2690
  const { currentSource } = this.getCurrentSource(logicNode);
2757
2691
  const parentRefs = await this.references({
2758
2692
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2759
- line: lsp2tspNumber(currentSource.start.line),
2760
- offset: lsp2tspNumber(currentSource.start.character),
2693
+ line: lsp2tspNumber(currentSource.range.start.line),
2694
+ offset: lsp2tspNumber(currentSource.range.start.character),
2761
2695
  });
2762
2696
  refsList = [...refsList, ...parentRefs.refs];
2763
2697
  }
@@ -2765,13 +2699,13 @@ class NaslServer {
2765
2699
  // 如果是参数修改, 就需要把logic的引用 都查找出来就需要把他的父级的引用全部查找出来
2766
2700
  if (node instanceof Param && (node.parentNode instanceof View || node.parentNode instanceof Process)) {
2767
2701
  const viewNode = node.parentNode;
2768
- const { currentSource, fileNode } = this.getCurrentSource(viewNode);
2769
- const code = this.getNodeCode(fileNode, currentSource);
2702
+ const { currentSource } = this.getCurrentSource(viewNode);
2703
+ const {code} = currentSource;
2770
2704
  const viewIndex = code.indexOf(' {');
2771
2705
  const viewRefs = await this.references({
2772
2706
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2773
- line: lsp2tspNumber(currentSource.start.line),
2774
- offset: lsp2tspNumber(currentSource.start.character + viewIndex),
2707
+ line: lsp2tspNumber(currentSource.range.start.line),
2708
+ offset: lsp2tspNumber(currentSource.range.start.character + viewIndex),
2775
2709
  });
2776
2710
  let filterViewRefs = [];
2777
2711
  if (node.parentNode instanceof View) {
@@ -2794,8 +2728,8 @@ class NaslServer {
2794
2728
  // const viewIndex = code.indexOf(' {');
2795
2729
  // const viewRefs = await naslServer.references({
2796
2730
  // file: (fileNode as FileNode).getEmbeddedFilePath(),
2797
- // line: lsp2tspNumber(currentSource.start.line),
2798
- // offset: lsp2tspNumber(currentSource.start.character + viewIndex),
2731
+ // line: lsp2tspNumber(currentSource.range.start.line),
2732
+ // offset: lsp2tspNumber(currentSource.range.start.character + viewIndex),
2799
2733
  // });
2800
2734
  // refsList = [...viewRefs.refs];
2801
2735
  // }
@@ -2804,14 +2738,14 @@ class NaslServer {
2804
2738
  */
2805
2739
  if (node instanceof ViewElement) {
2806
2740
  if (currentSource) {
2807
- const code = this.getNodeCode(fileNode, currentSource);
2741
+ const {code} = currentSource;
2808
2742
  const prefix = '__elements.';
2809
2743
  const prefixIndex = code.indexOf(prefix) !== -1 ? code.indexOf(prefix) : 0;
2810
2744
  const methodsNameIndex = prefixIndex + prefix.length;
2811
2745
  const methods = await this.references({
2812
2746
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2813
- line: lsp2tspNumber(currentSource.start.line),
2814
- offset: lsp2tspNumber(currentSource.start.character + methodsNameIndex),
2747
+ line: lsp2tspNumber(currentSource.range.start.line),
2748
+ offset: lsp2tspNumber(currentSource.range.start.character + methodsNameIndex),
2815
2749
  });
2816
2750
  const methodRefs: tsProtocol.ReferencesResponseItem[] = [];
2817
2751
  methods.refs.forEach((item) => {
@@ -2830,7 +2764,7 @@ class NaslServer {
2830
2764
  }
2831
2765
  if (node instanceof Process) {
2832
2766
  if (currentSource) {
2833
- const code = this.getNodeCode(fileNode, currentSource);
2767
+ const {code} = currentSource;
2834
2768
  const prefix = '__ProcessIdentification__';
2835
2769
  let positions = [];
2836
2770
  let pos = code.indexOf(prefix);
@@ -2844,8 +2778,8 @@ class NaslServer {
2844
2778
  const promises = positions.map((item) =>
2845
2779
  this.references({
2846
2780
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2847
- line: lsp2tspNumber(currentSource.start.line),
2848
- offset: lsp2tspNumber(currentSource.start.character + item),
2781
+ line: lsp2tspNumber(currentSource.range.start.line),
2782
+ offset: lsp2tspNumber(currentSource.range.start.character + item),
2849
2783
  })
2850
2784
  );
2851
2785
  const results = await Promise.all(promises);
@@ -2855,9 +2789,9 @@ class NaslServer {
2855
2789
  }
2856
2790
  }
2857
2791
  if ((node instanceof Param || node instanceof Return) && node.parentNode instanceof Process) {
2858
- const { currentSource, fileNode } = this.getCurrentSource(node.parentNode);
2792
+ const { currentSource } = this.getCurrentSource(node.parentNode);
2859
2793
  if (currentSource) {
2860
- const code = this.getNodeCode(fileNode, currentSource);
2794
+ const {code} = currentSource;
2861
2795
  const prefix = '__ProcessIdentification__';
2862
2796
  const positions = [];
2863
2797
  let pos = code.indexOf(prefix);
@@ -2875,8 +2809,8 @@ class NaslServer {
2875
2809
  const promises = positions.map((item) =>
2876
2810
  this.references({
2877
2811
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2878
- line: lsp2tspNumber(currentSource.start.line),
2879
- offset: lsp2tspNumber(currentSource.start.character + item),
2812
+ line: lsp2tspNumber(currentSource.range.start.line),
2813
+ offset: lsp2tspNumber(currentSource.range.start.character + item),
2880
2814
  })
2881
2815
  );
2882
2816
  const results = await Promise.all(promises);
@@ -2887,7 +2821,7 @@ class NaslServer {
2887
2821
  }
2888
2822
  if (node instanceof ProcessElement) {
2889
2823
  if (currentSource) {
2890
- const code = this.getNodeCode(fileNode, currentSource);
2824
+ const {code} = currentSource;
2891
2825
  const prefix = '__ProcessIdentification__';
2892
2826
  let positions = [];
2893
2827
  let pos = code.indexOf(prefix);
@@ -2900,8 +2834,8 @@ class NaslServer {
2900
2834
  const promises = positions.map((item) =>
2901
2835
  this.references({
2902
2836
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2903
- line: lsp2tspNumber(currentSource.start.line),
2904
- offset: lsp2tspNumber(currentSource.start.character + item),
2837
+ line: lsp2tspNumber(currentSource.range.start.line),
2838
+ offset: lsp2tspNumber(currentSource.range.start.character + item),
2905
2839
  })
2906
2840
  );
2907
2841
  const results = await Promise.all(promises);
@@ -2911,9 +2845,9 @@ class NaslServer {
2911
2845
  }
2912
2846
  }
2913
2847
  if (node instanceof Return && node.parentNode instanceof ProcessElement) {
2914
- const { currentSource, fileNode } = this.getCurrentSource(node.parentNode);
2848
+ const { currentSource } = this.getCurrentSource(node.parentNode);
2915
2849
  if (currentSource) {
2916
- const code = this.getNodeCode(fileNode, currentSource);
2850
+ const {code} = currentSource;
2917
2851
  const prefix = '__ProcessIdentification__';
2918
2852
  const positions = [];
2919
2853
  let pos = code.indexOf(prefix);
@@ -2934,8 +2868,8 @@ class NaslServer {
2934
2868
  const promises = positions.map((item) =>
2935
2869
  this.references({
2936
2870
  file: (fileNode as FileNode).getEmbeddedFilePath(),
2937
- line: lsp2tspNumber(currentSource.start.line),
2938
- offset: lsp2tspNumber(currentSource.start.character + item),
2871
+ line: lsp2tspNumber(currentSource.range.start.line),
2872
+ offset: lsp2tspNumber(currentSource.range.start.character + item),
2939
2873
  })
2940
2874
  );
2941
2875
  const results = await Promise.all(promises);
@@ -2988,7 +2922,7 @@ class NaslServer {
2988
2922
  }
2989
2923
  if (minRange.node instanceof CallLogic && node instanceof ViewElement) {
2990
2924
  minRange.setTypeMethods = 'setCalleeNamespace';
2991
- minRange.newValue = 'elements.' + newValue + '.logics';
2925
+ minRange.newValue = `elements.${ newValue }.logics`;
2992
2926
  }
2993
2927
  // 如果节点是实体修改引发calllogic修改
2994
2928
  if (
@@ -3007,9 +2941,9 @@ class NaslServer {
3007
2941
  * 3.然后把namespace中的 $替换成 ''
3008
2942
  *
3009
2943
  */
3010
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
2944
+ const {tsCalleeNamespace} = minRange.node;
3011
2945
  // 先看下标位置
3012
- const lineText = record.lineText;
2946
+ const {lineText} = record;
3013
2947
  const index = lineText.indexOf(tsCalleeNamespace);
3014
2948
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3015
2949
  const start = record.start.offset - index - 1;
@@ -3044,12 +2978,12 @@ class NaslServer {
3044
2978
  if (minRange.node instanceof Identifier) {
3045
2979
  // 匹配到的内容,当前这一行的内容;
3046
2980
  // 因为要用下面的点位信息
3047
- const name = minRange.node.name;
2981
+ const {name} = minRange.node;
3048
2982
  // 如果name不改,那就是要改命名空间
3049
2983
  if (node instanceof Frontend || newValue === name) {
3050
- const namespace = minRange.node.namespace;
2984
+ const {namespace} = minRange.node;
3051
2985
  // 先看下标位置
3052
- const lineText = record.lineText;
2986
+ const {lineText} = record;
3053
2987
  const index = lineText.indexOf(namespace);
3054
2988
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3055
2989
  const start = record.start.offset - index - 1;
@@ -3080,7 +3014,7 @@ class NaslServer {
3080
3014
  // 枚举key的特殊性,因为它不是原来的key+value形式的
3081
3015
  // 是加了中括号啥的,所以直接赋值新值
3082
3016
  if (node instanceof EnumItem) {
3083
- const newTextValue = node.parentNode.name + '.' + newValue;
3017
+ const newTextValue = `${node.parentNode.name }.${ newValue}`;
3084
3018
  minRange.newValue = newTextValue;
3085
3019
  } else {
3086
3020
  // 匹配到的内容,当前这一行的内容;
@@ -3115,7 +3049,7 @@ class NaslServer {
3115
3049
  minRange.setTypeMethods = 'setEntityNameAndEffect';
3116
3050
  } else if (minRange.node instanceof BindAttribute && minRange.node.name === 'url') {
3117
3051
  // 如果是查找到 上传地址的链接引用
3118
- let newName = newValue.replace(/[A-Z]/g, (item) => '-' + item.toLowerCase());
3052
+ let newName = newValue.replace(/[A-Z]/g, (item) => `-${ item.toLowerCase()}`);
3119
3053
  newName = newName[0] === '-' ? newName.slice(1) : newName;
3120
3054
  const newTextValue = node.parentNode.name === 'defaultDS' ? `/api/${newName}/import` : `/api/${node.parentNode.name}/${newName}/import`;
3121
3055
  minRange.setTypeMethods = 'setUrlValue';
@@ -3157,11 +3091,11 @@ class NaslServer {
3157
3091
  * 3.然后把namespace中的 $替换成 ''
3158
3092
  *
3159
3093
  */
3160
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
3161
- const tsName = minRange.node.tsName;
3162
- const oldValue = tsCalleeNamespace + '.' + tsName;
3094
+ const {tsCalleeNamespace} = minRange.node;
3095
+ const {tsName} = minRange.node;
3096
+ const oldValue = `${tsCalleeNamespace }.${ tsName}`;
3163
3097
  // 先看下标位置
3164
- const lineText = record.lineText;
3098
+ const {lineText} = record;
3165
3099
  const index = lineText.indexOf(oldValue);
3166
3100
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3167
3101
  const start = record.start.offset - index - 1;
@@ -3178,11 +3112,11 @@ class NaslServer {
3178
3112
  }
3179
3113
  }
3180
3114
  if (node instanceof Frontend && minRange.node instanceof Destination) {
3181
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
3182
- const tsName = minRange.node.tsName;
3183
- const oldValue = tsCalleeNamespace + '.' + tsName;
3115
+ const {tsCalleeNamespace} = minRange.node;
3116
+ const {tsName} = minRange.node;
3117
+ const oldValue = `${tsCalleeNamespace }.${ tsName}`;
3184
3118
  // 先看下标位置
3185
- const lineText = record.lineText;
3119
+ const {lineText} = record;
3186
3120
  const index = lineText.indexOf(oldValue);
3187
3121
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3188
3122
  const start = record.start.offset - index - 1;
@@ -3202,7 +3136,7 @@ class NaslServer {
3202
3136
  // 页面逻辑直接赋值就可以, 因为是相对路径
3203
3137
  if (node instanceof ViewElement) {
3204
3138
  minRange.setTypeMethods = 'setCalleeNamespace';
3205
- minRange.newValue = 'elements.' + newValue + '.logics';
3139
+ minRange.newValue = `elements.${ newValue }.logics`;
3206
3140
  } else {
3207
3141
  /**
3208
3142
  * 如果namespce是 'app.views.Student.views.404.views.505.views.update'
@@ -3213,11 +3147,11 @@ class NaslServer {
3213
3147
  * 2.在匹配到的内容中取转后的namespace的位置
3214
3148
  * 3.然后把namespace中的 $替换成 ''
3215
3149
  */
3216
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
3150
+ const {tsCalleeNamespace} = minRange.node;
3217
3151
  const oldValue = tsCalleeNamespace;
3218
3152
 
3219
3153
  // 先看下标位置
3220
- const lineText = record.lineText;
3154
+ const {lineText} = record;
3221
3155
  const index = lineText.indexOf(oldValue);
3222
3156
 
3223
3157
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
@@ -3280,7 +3214,7 @@ class NaslServer {
3280
3214
  if (node instanceof DataSource) {
3281
3215
  const setTypeNamespace = (typeNamespace: string, record: any) => {
3282
3216
  // 先看下标位置
3283
- const lineText = record.lineText;
3217
+ const {lineText} = record;
3284
3218
  const index = lineText.indexOf(typeNamespace);
3285
3219
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3286
3220
  const start = record.start.offset - index - 1;
@@ -3405,7 +3339,7 @@ class NaslServer {
3405
3339
  .sort((a, b) => {
3406
3340
  if (a.node.concept === 'QueryFieldExpression') {
3407
3341
  return 1;
3408
- } else if (b.node.concept === 'QueryFieldExpression') {
3342
+ } if (b.node.concept === 'QueryFieldExpression') {
3409
3343
  return -1;
3410
3344
  }
3411
3345
  return 0;
@@ -3647,7 +3581,7 @@ class NaslServer {
3647
3581
  */
3648
3582
  getCurrentSource(node: BaseNode) {
3649
3583
  if (node instanceof App || node instanceof Theme) return { fileNode: null };
3650
- let sourceMap = node.sourceMap;
3584
+ let {sourceMap} = node;
3651
3585
  let fileNode = node;
3652
3586
  // 如果没有sourceMap,就继续向上找 ,或者到module结束
3653
3587
  // 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
@@ -3679,8 +3613,8 @@ class NaslServer {
3679
3613
  handlingCurrentSourceException(currentSource: SourceMapItem, node: BaseNode) {
3680
3614
  // 如果有前面的一些注解,元素在最后一行输出的值就给最后一行
3681
3615
  if (node instanceof EntityProperty) {
3682
- if (currentSource.start.line !== currentSource.end.line) {
3683
- currentSource.start = { ...currentSource.start, line: currentSource.end.line };
3616
+ if (currentSource.range.start.line !== currentSource.range.end.line) {
3617
+ currentSource.range.start = { ...currentSource.range.start, line: currentSource.range.end.line };
3684
3618
  }
3685
3619
  }
3686
3620
  }
@@ -3690,26 +3624,26 @@ class NaslServer {
3690
3624
  const { currentSource, fileNode } = this.getCurrentSource(node);
3691
3625
  if (currentSource && fileNode) {
3692
3626
  const range = {
3693
- line: lsp2tspNumber(currentSource.start.line),
3694
- offset: lsp2tspNumber(currentSource.start.character),
3627
+ line: lsp2tspNumber(currentSource.range.start.line),
3628
+ offset: lsp2tspNumber(currentSource.range.start.character),
3695
3629
  };
3696
3630
  // foreach 在最后一行自动补全
3697
3631
  if (node.concept === 'ForEachStatement') {
3698
- range.line = currentSource.end.line;
3632
+ range.line = currentSource.range.end.line;
3699
3633
  range.offset = 0;
3700
3634
  } else if (node.concept === 'BindAttribute') {
3701
- range.offset = range.offset + 7;
3635
+ range.offset += 7;
3702
3636
  } else if (node.concept === 'BindDirective') {
3703
- range.offset = range.offset + 5;
3637
+ range.offset += 5;
3704
3638
  }
3705
3639
  return this._getFieldKeySelectCompletion({
3706
3640
  file: (fileNode as FileNode).getEmbeddedFilePath(),
3707
3641
  range,
3708
3642
  getFieldKey: fieldKey,
3709
3643
  });
3710
- } else {
3644
+ }
3711
3645
  console.log('没找到节点', currentSource, fileNode);
3712
- }
3646
+
3713
3647
  }
3714
3648
 
3715
3649
  _getFieldKeySelectCompletion(args: any) {
@@ -3759,7 +3693,7 @@ class NaslServer {
3759
3693
  return [...fileNodes];
3760
3694
  }
3761
3695
 
3762
- /**获取当前节点的已知类型
3696
+ /** 获取当前节点的已知类型
3763
3697
  * @param node 当前要获取类型的节点
3764
3698
  * @returns 不需要去查就可以返回类型的节点
3765
3699
  */
@@ -3862,7 +3796,7 @@ class NaslServer {
3862
3796
  }
3863
3797
  // 如果 入参不是虚拟节点的,就不去请求类型
3864
3798
  // 只有虚拟节点的入参,才没有类型
3865
- if (node.concept === 'Param' && (node.parentKey !== 'virtualParams' && node.parentKey !== 'item' && node.parentNode.concept !== 'AnonymousFunction')) {
3799
+ if (node.concept === 'Param' && node.parentKey !== 'virtualParams' && node.parentKey !== 'item') {
3866
3800
  return;
3867
3801
  }
3868
3802
  if (
@@ -3897,76 +3831,69 @@ class NaslServer {
3897
3831
  newQuickInfoNodes.push(itemDetail);
3898
3832
  const fileDetail = {
3899
3833
  file: filePath,
3900
- line: lsp2tspNumber(item.start.line),
3901
- offset: lsp2tspNumber(item.start.character),
3902
- };
3903
-
3904
- const getCode = (range: SourceMapItem) => {
3905
- return this.tsFiles.get(filePath)?.slice(range.start.offset, range.end.offset) ?? '';
3834
+ line: lsp2tspNumber(item.range.start.line),
3835
+ offset: lsp2tspNumber(item.range.start.character),
3906
3836
  };
3907
3837
 
3908
3838
  // 位置计算偏移
3909
3839
  if ('getQuickInfoOffset' in node) {
3910
- Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, getCode(item)));
3840
+ Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, item.code));
3911
3841
  }
3912
3842
 
3913
3843
  // 位置计算偏移2
3914
3844
  // TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
3915
3845
  if (
3916
3846
  node.concept === 'BinaryExpression' ||
3847
+ node.concept === 'CallLogic' ||
3917
3848
  node.concept === 'CallFunction' ||
3918
3849
  node.concept === 'CallInterface'
3919
3850
  ) {
3920
- const code = getCode(item);
3921
3851
  // 如果没有括号 ,括号就在外面,就 -1
3922
3852
  // 有括号就找到括号的位置 然后 -1
3923
3853
  let indexOf = 0;
3924
- if (!code.includes('(')) {
3854
+ if (!item.code.includes('(')) {
3925
3855
  indexOf = -1;
3926
3856
  } else {
3927
3857
  // 如果有泛型先往前找一找
3928
- if (code.includes('<')) {
3929
- indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
3858
+ if (item.code.includes('<')) {
3859
+ indexOf = Math.min(item.code.indexOf('<'), item.code.indexOf('('));
3930
3860
  } else {
3931
- indexOf = code.indexOf('(');
3861
+ indexOf = item.code.indexOf('(');
3932
3862
  }
3933
- const subStr = code.substring(0, indexOf);
3863
+ const subStr = item.code.substring(0, indexOf);
3934
3864
  const codeArr = subStr?.split('.');
3935
3865
  const lastLen = codeArr?.[codeArr.length - 1]?.length;
3936
3866
  indexOf = subStr.length - lastLen;
3937
3867
  }
3938
- fileDetail.offset = fileDetail.offset + indexOf;
3868
+ fileDetail.offset += indexOf;
3939
3869
  } else if (
3940
3870
  node.concept === 'MemberExpression' ||
3941
3871
  node.concept === 'Identifier' ||
3942
3872
  node.concept === 'QueryFieldExpression' ||
3943
3873
  node.concept === 'QueryGroupByExpression'
3944
3874
  ) {
3945
- const code = getCode(item);
3946
- if (code.includes('.')) {
3947
- const codeArr = code?.split('.');
3875
+ if (item.code.includes('.')) {
3876
+ const codeArr = item.code?.split('.');
3948
3877
  const lastLen = codeArr?.[codeArr.length - 1]?.length;
3949
3878
  // MemberExpression取最后一位当做类型
3950
- const indexOf = code.length - lastLen;
3951
- fileDetail.offset = fileDetail.offset + indexOf;
3879
+ const indexOf = item.code.length - lastLen;
3880
+ fileDetail.offset += indexOf;
3952
3881
  }
3953
3882
  } else if (node.concept === 'Match') {
3954
- const code = getCode(item);
3955
3883
  // 去查return 后面的返回值,变成函数调用
3956
- if (code?.endsWith(';\n')) {
3957
- fileDetail.line = item.end.line - 1;
3884
+ if (item.code?.endsWith(';\n')) {
3885
+ fileDetail.line = item.range.end.line - 1;
3958
3886
  } else {
3959
- fileDetail.line = item.end.line;
3887
+ fileDetail.line = item.range.end.line;
3960
3888
  }
3961
- const indexOf = code.indexOf('return __MatchExpressionFuntion');
3962
- let newCode = code.substring(0, indexOf);
3889
+ const indexOf = item.code.indexOf('return __MatchExpressionFuntion');
3890
+ let newCode = item.code.substring(0, indexOf);
3963
3891
  newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
3964
3892
  fileDetail.offset = newCode.length + 'return '.length;
3965
3893
  } else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
3966
- const code = getCode(item);
3967
- fileDetail.line = item.end.line;
3968
- const indexOf = code.indexOf('return __newComposite');
3969
- let newCode = code.substring(0, indexOf);
3894
+ fileDetail.line = item.range.end.line;
3895
+ const indexOf = item.code.indexOf('return __newComposite');
3896
+ let newCode = item.code.substring(0, indexOf);
3970
3897
  newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
3971
3898
  fileDetail.offset = newCode.length + 'return '.length;
3972
3899
  } else if (['OqlQueryComponent'].includes(node.concept)) {
@@ -3982,17 +3909,11 @@ class NaslServer {
3982
3909
  const item = (resultMap as any)?.[file]?.[line]?.[offset];
3983
3910
  const itemType = item?.[0]?.nodeType;
3984
3911
  const nodeTypeAnnotation = type2TypeAnnotation(itemType);
3985
- const node = newQuickInfoNodes[index].node;
3912
+ const {node} = newQuickInfoNodes[index];
3986
3913
 
3987
3914
  types.set(node, Object.freeze(nodeTypeAnnotation) as TypeAnnotation);
3988
3915
 
3989
- const type = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
3990
-
3991
- if (type) {
3992
- (node as any).__nodeType = type;
3993
- } else {
3994
- delete (node as any).__nodeType;
3995
- }
3916
+ (node as any).__nodeType = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
3996
3917
  });
3997
3918
 
3998
3919
  await utils.timeSlicing(Array.from(getFromOthers.entries()), ([node]) => {
@@ -4025,9 +3946,9 @@ class NaslServer {
4025
3946
  const typeAnnotation = value as TypeAnnotation;
4026
3947
  if (!node.typeAnnotation && typeAnnotation) {
4027
3948
  if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
4028
- const typeArguments = typeAnnotation.typeArguments;
3949
+ const {typeArguments} = typeAnnotation;
4029
3950
  if (typeArguments.length && typeArguments[0].isComplexType()) {
4030
- delete node.__TypeAnnotation;
3951
+ node.__TypeAnnotation = null;
4031
3952
  return;
4032
3953
  }
4033
3954
  }
@@ -4040,12 +3961,12 @@ class NaslServer {
4040
3961
  }
4041
3962
  } else {
4042
3963
  // 清空原来已经赋值上去的类型,可能原来有现在没有了
4043
- delete node.__TypeAnnotation;
3964
+ node.__TypeAnnotation = null;
4044
3965
  }
4045
3966
  } catch (err) {
4046
- // if (globalThis.window) {
4047
- // console.log(err);
4048
- // }
3967
+ if (globalThis.window) {
3968
+ // console.log(err);
3969
+ }
4049
3970
  }
4050
3971
  });
4051
3972
  return types;
@@ -4199,7 +4120,7 @@ class NaslServer {
4199
4120
  ) {
4200
4121
  const { currentSource, fileNode } = matchExpression?.getCurrentSource();
4201
4122
  fileNode.sourceMap.forEach((item, itemNode) => {
4202
- if (itemNode.concept === matchExpression.concept && isSameRange(item, currentSource)) {
4123
+ if (itemNode.concept === matchExpression.concept && item.code === currentSource.code) {
4203
4124
  const jsonNode = jsoner.queryNodeByPath(json, itemNode.getNodePath(false));
4204
4125
  jsonNode.typeAnnotation = matchExpression.__TypeAnnotation;
4205
4126
  }
@@ -4260,7 +4181,7 @@ class NaslServer {
4260
4181
  }
4261
4182
  }
4262
4183
  // 用户自己声明的用用户的
4263
- const callObj = App.findNodeByCompleteName(parent.calleeNamespace + '.' + parent.calleeName);
4184
+ const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace }.${ parent.calleeName}`);
4264
4185
  const index = parent.arguments.indexOf(node);
4265
4186
  const param = callObj?.params?.[index] || {};
4266
4187
  // 取出参数的类型
@@ -4508,8 +4429,8 @@ class NaslServer {
4508
4429
  */
4509
4430
  const oldRefs = await this.references({
4510
4431
  file: (fileNode as FileNode).getEmbeddedFilePath(),
4511
- line: lsp2tspNumber(currentSource.start.line),
4512
- offset: lsp2tspNumber(currentSource.start.character),
4432
+ line: lsp2tspNumber(currentSource.range.start.line),
4433
+ offset: lsp2tspNumber(currentSource.range.start.character),
4513
4434
  });
4514
4435
  oldRefs.refs.forEach((ref) => this.filesToCheck.add(ref.file));
4515
4436
  // 更新文件之后
@@ -4517,8 +4438,8 @@ class NaslServer {
4517
4438
 
4518
4439
  const newRefs2 = await this.references({
4519
4440
  file: (fileNode as FileNode).getEmbeddedFilePath(),
4520
- line: lsp2tspNumber(currentSource.start.line),
4521
- offset: lsp2tspNumber(currentSource.start.character),
4441
+ line: lsp2tspNumber(currentSource.range.start.line),
4442
+ offset: lsp2tspNumber(currentSource.range.start.character),
4522
4443
  });
4523
4444
  newRefs2.refs.forEach((ref) => this.filesToCheck.add(ref.file));
4524
4445
  }
@@ -4536,7 +4457,7 @@ class NaslServer {
4536
4457
  */
4537
4458
  async incidentalAction(action: string, fileNode: BaseNode, targetNode: BaseNode, oldpath?: string) {
4538
4459
  if ((action === 'create' || action === 'delete' || (action === 'update' && oldpath)) && fileNode === targetNode) {
4539
- //删除、更改、新增端
4460
+ // 删除、更改、新增端
4540
4461
  if (fileNode instanceof Frontend && (fileNode.views?.length || fileNode.variables?.length)) {
4541
4462
  const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
4542
4463
  for (let i = 0; i < fileNodeChildren.length; i++) {
@@ -4552,7 +4473,7 @@ class NaslServer {
4552
4473
  } else if (action === 'update' && oldpath) {
4553
4474
  const parentPath = oldpath.replace('.ts', '/');
4554
4475
  const foldName = fileNodeItem.concept === 'View' ? 'views' : 'variables';
4555
- const currentOldPath = parentPath + foldName + '/' + fileNodeItem.name + '.ts';
4476
+ const currentOldPath = `${parentPath + foldName }/${ fileNodeItem.name }.ts`;
4556
4477
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4557
4478
  await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
4558
4479
  await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
@@ -4574,7 +4495,7 @@ class NaslServer {
4574
4495
  await this.incidentalAction(action, fileNodeItem, fileNodeItem);
4575
4496
  } else if (action === 'update' && oldpath) {
4576
4497
  const parentPath = oldpath.replace('.ts', '/');
4577
- const currentOldPath = parentPath + fileNodeItem.name + '.ts';
4498
+ const currentOldPath = `${parentPath + fileNodeItem.name }.ts`;
4578
4499
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4579
4500
  await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
4580
4501
  await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
@@ -4618,7 +4539,7 @@ class NaslServer {
4618
4539
  try {
4619
4540
  const result = entity.toEmbeddedTSFile();
4620
4541
  const parentPath = oldpath.replace('.ts', '/');
4621
- const currentOldPath = parentPath + '/entities/' + entity.name + '.ts';
4542
+ const currentOldPath = `${parentPath }/entities/${ entity.name }.ts`;
4622
4543
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4623
4544
  await this.handleRename(entity, entity, result, currentOldPath);
4624
4545
  } catch (err) {
@@ -4632,7 +4553,7 @@ class NaslServer {
4632
4553
  async receiveHandleChange($event: EventPayload) {
4633
4554
  this.singleFileChangeIng = true;
4634
4555
  // 行为
4635
- const action = $event.action;
4556
+ const {action} = $event;
4636
4557
  const targetNode = $event.target;
4637
4558
  // Connection 相关配置的更新不需要写入文件
4638
4559
  if (targetNode?.parentNode instanceof Connection) {
@@ -4653,14 +4574,9 @@ class NaslServer {
4653
4574
  return;
4654
4575
  }
4655
4576
 
4656
- if (process.env.NODE_ENV === 'development') {
4657
- console.time('重新生成 TS 文件');
4658
- }
4577
+ console.time('重新生成 TS 文件');
4659
4578
  const result = (fileNode as FileNode).toEmbeddedTSFile();
4660
- if (process.env.NODE_ENV === 'development') {
4661
- console.timeEnd('重新生成 TS 文件');
4662
- console.log('重新生成 TS 文件', (fileNode as FileNode).getEmbeddedFilePath());
4663
- }
4579
+ console.timeEnd('重新生成 TS 文件');
4664
4580
 
4665
4581
  // 当前操作的节点
4666
4582
  // 如果当前没有生成tsFile
@@ -4707,19 +4623,13 @@ class NaslServer {
4707
4623
  if (this.changeStackList.length) {
4708
4624
  this.changeFileNext();
4709
4625
  } else {
4710
- if (process.env.NODE_ENV === 'development') {
4711
- console.info('校验以下文件', Array.from(this.filesToCheck));
4712
- }
4626
+ console.info(Array.from(this.filesToCheck));
4713
4627
  await this.getDiagnosticRecordsAndPushAll(Array.from(this.filesToCheck));
4714
4628
  this.filesToCheck.clear();
4715
4629
  }
4716
4630
  });
4717
4631
  }
4718
4632
  }
4719
-
4720
- private getNodeCode(fileNode: BaseNode, range: SourceMapItem) {
4721
- return (this.tsFiles.get((fileNode as any).getEmbeddedFilePath()) ?? '').slice(range.start.offset, range.end.offset)
4722
- }
4723
4633
  }
4724
4634
 
4725
4635
  export { NaslServer };