@lcap/nasl 3.2.0-beta.3 → 3.3.0-alpha

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 (842) hide show
  1. package/out/automate/engine/utils.js +4 -0
  2. package/out/automate/engine/utils.js.map +1 -1
  3. package/out/automate/upgrader/2.20.js +1 -1
  4. package/out/automate/upgrader/2.20.js.map +1 -1
  5. package/out/bak/translator.js +11 -15
  6. package/out/bak/translator.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.js +3 -1
  8. package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
  9. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
  10. package/out/breakpoint/generator/BreakpointNode.d.ts +1 -0
  11. package/out/breakpoint/generator/BreakpointNode.js +48 -15
  12. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  13. package/out/breakpoint/generator/CallbackNode.d.ts +4 -0
  14. package/out/breakpoint/generator/CallbackNode.js +22 -0
  15. package/out/breakpoint/generator/CallbackNode.js.map +1 -0
  16. package/out/breakpoint/generator/FragmentNode.d.ts +4 -0
  17. package/out/breakpoint/generator/FragmentNode.js +18 -0
  18. package/out/breakpoint/generator/FragmentNode.js.map +1 -0
  19. package/out/breakpoint/generator/index.js +25 -4
  20. package/out/breakpoint/generator/index.js.map +1 -1
  21. package/out/breakpoint/shared/constants.d.ts +3 -0
  22. package/out/breakpoint/shared/constants.js +6 -1
  23. package/out/breakpoint/shared/constants.js.map +1 -1
  24. package/out/breakpoint/shared/operations.js.map +1 -1
  25. package/out/breakpoint/shared/socket.d.ts +1 -1
  26. package/out/breakpoint/shared/socket.js +36 -7
  27. package/out/breakpoint/shared/socket.js.map +1 -1
  28. package/out/breakpoint/shared/utils.d.ts +2 -0
  29. package/out/breakpoint/shared/utils.js +15 -2
  30. package/out/breakpoint/shared/utils.js.map +1 -1
  31. package/out/breakpoint/store/core.d.ts +48 -2
  32. package/out/breakpoint/store/core.js +58 -32
  33. package/out/breakpoint/store/core.js.map +1 -1
  34. package/out/breakpoint/store/dock.js +1 -1
  35. package/out/breakpoint/store/dock.js.map +1 -1
  36. package/out/common/BaseNode.d.ts +2 -2
  37. package/out/common/BaseNode.js +110 -53
  38. package/out/common/BaseNode.js.map +1 -1
  39. package/out/common/Command.d.ts +13 -2
  40. package/out/common/Command.js +37 -9
  41. package/out/common/Command.js.map +1 -1
  42. package/out/common/EventEmitter.js.map +1 -1
  43. package/out/common/Messager.d.ts +3 -3
  44. package/out/common/Messager.js +6 -7
  45. package/out/common/Messager.js.map +1 -1
  46. package/out/common/asyncFuncMap.js.map +1 -1
  47. package/out/concepts/Abort__.js +6 -5
  48. package/out/concepts/Abort__.js.map +1 -1
  49. package/out/concepts/Anchor__.d.ts +4 -3
  50. package/out/concepts/Anchor__.js +24 -7
  51. package/out/concepts/Anchor__.js.map +1 -1
  52. package/out/concepts/AnonymousFunction__.d.ts +22 -21
  53. package/out/concepts/AnonymousFunction__.js +48 -22
  54. package/out/concepts/AnonymousFunction__.js.map +1 -1
  55. package/out/concepts/App__.d.ts +421 -247
  56. package/out/concepts/App__.js +288 -54
  57. package/out/concepts/App__.js.map +1 -1
  58. package/out/concepts/Argument__.d.ts +4 -3
  59. package/out/concepts/Argument__.js +42 -11
  60. package/out/concepts/Argument__.js.map +1 -1
  61. package/out/concepts/Assignee__.d.ts +45 -45
  62. package/out/concepts/Assignee__.js +15 -15
  63. package/out/concepts/Assignee__.js.map +1 -1
  64. package/out/concepts/AssignmentLine__.js +6 -5
  65. package/out/concepts/AssignmentLine__.js.map +1 -1
  66. package/out/concepts/Assignment__.d.ts +7 -6
  67. package/out/concepts/Assignment__.js +41 -23
  68. package/out/concepts/Assignment__.js.map +1 -1
  69. package/out/concepts/Attribute__.d.ts +3 -3
  70. package/out/concepts/Attribute__.js +8 -7
  71. package/out/concepts/Attribute__.js.map +1 -1
  72. package/out/concepts/AuthInterface__.js +4 -3
  73. package/out/concepts/AuthInterface__.js.map +1 -1
  74. package/out/concepts/AuthLogicForCallInterface__.d.ts +15 -15
  75. package/out/concepts/AuthLogicForCallInterface__.js +46 -27
  76. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  77. package/out/concepts/AuthLogic__.js +27 -13
  78. package/out/concepts/AuthLogic__.js.map +1 -1
  79. package/out/concepts/BackendVariable__.d.ts +5 -5
  80. package/out/concepts/BackendVariable__.js +23 -26
  81. package/out/concepts/BackendVariable__.js.map +1 -1
  82. package/out/concepts/Backend__.d.ts +18 -18
  83. package/out/concepts/Backend__.js +13 -13
  84. package/out/concepts/Backend__.js.map +1 -1
  85. package/out/concepts/BatchAssignment__.d.ts +34 -33
  86. package/out/concepts/BatchAssignment__.js +83 -43
  87. package/out/concepts/BatchAssignment__.js.map +1 -1
  88. package/out/concepts/BinaryExpression__.d.ts +7 -6
  89. package/out/concepts/BinaryExpression__.js +60 -24
  90. package/out/concepts/BinaryExpression__.js.map +1 -1
  91. package/out/concepts/BindAttribute__.d.ts +37 -37
  92. package/out/concepts/BindAttribute__.js +102 -58
  93. package/out/concepts/BindAttribute__.js.map +1 -1
  94. package/out/concepts/BindDirective__.d.ts +13 -13
  95. package/out/concepts/BindDirective__.js +23 -21
  96. package/out/concepts/BindDirective__.js.map +1 -1
  97. package/out/concepts/BindEvent__.d.ts +28 -28
  98. package/out/concepts/BindEvent__.js +150 -57
  99. package/out/concepts/BindEvent__.js.map +1 -1
  100. package/out/concepts/BindStyle__.d.ts +14 -15
  101. package/out/concepts/BindStyle__.js +16 -16
  102. package/out/concepts/BindStyle__.js.map +1 -1
  103. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  104. package/out/concepts/BooleanLiteral__.js +12 -5
  105. package/out/concepts/BooleanLiteral__.js.map +1 -1
  106. package/out/concepts/CallAuthInterface__.d.ts +15 -15
  107. package/out/concepts/CallAuthInterface__.js +23 -22
  108. package/out/concepts/CallAuthInterface__.js.map +1 -1
  109. package/out/concepts/CallConnector__.d.ts +11 -9
  110. package/out/concepts/CallConnector__.js +79 -36
  111. package/out/concepts/CallConnector__.js.map +1 -1
  112. package/out/concepts/CallFunction__.d.ts +17 -16
  113. package/out/concepts/CallFunction__.js +95 -63
  114. package/out/concepts/CallFunction__.js.map +1 -1
  115. package/out/concepts/CallInterface__.d.ts +9 -8
  116. package/out/concepts/CallInterface__.js +109 -80
  117. package/out/concepts/CallInterface__.js.map +1 -1
  118. package/out/concepts/CallLogic__.d.ts +24 -20
  119. package/out/concepts/CallLogic__.js +209 -162
  120. package/out/concepts/CallLogic__.js.map +1 -1
  121. package/out/concepts/CallQueryComponent__.d.ts +51 -51
  122. package/out/concepts/CallQueryComponent__.js +66 -63
  123. package/out/concepts/CallQueryComponent__.js.map +1 -1
  124. package/out/concepts/Comment__.d.ts +1 -0
  125. package/out/concepts/Comment__.js +13 -6
  126. package/out/concepts/Comment__.js.map +1 -1
  127. package/out/concepts/CompletionProperty__.d.ts +3 -3
  128. package/out/concepts/CompletionProperty__.js +16 -8
  129. package/out/concepts/CompletionProperty__.js.map +1 -1
  130. package/out/concepts/ConfigGroup__.d.ts +15 -15
  131. package/out/concepts/ConfigGroup__.js +9 -9
  132. package/out/concepts/ConfigGroup__.js.map +1 -1
  133. package/out/concepts/ConfigPropertyValue__.js +4 -3
  134. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  135. package/out/concepts/ConfigProperty__.d.ts +15 -15
  136. package/out/concepts/ConfigProperty__.js +10 -10
  137. package/out/concepts/ConfigProperty__.js.map +1 -1
  138. package/out/concepts/Configuration__.d.ts +15 -15
  139. package/out/concepts/Configuration__.js +9 -9
  140. package/out/concepts/Configuration__.js.map +1 -1
  141. package/out/concepts/Connection__.d.ts +166 -0
  142. package/out/concepts/Connection__.js +332 -0
  143. package/out/concepts/Connection__.js.map +1 -0
  144. package/out/concepts/ConnectorTrigger__.js +4 -3
  145. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  146. package/out/concepts/Connector__.d.ts +66 -66
  147. package/out/concepts/Connector__.js +16 -15
  148. package/out/concepts/Connector__.js.map +1 -1
  149. package/out/concepts/Constant__.d.ts +3 -3
  150. package/out/concepts/Constant__.js +8 -7
  151. package/out/concepts/Constant__.js.map +1 -1
  152. package/out/concepts/DataElement__.d.ts +3 -3
  153. package/out/concepts/DataElement__.js +6 -5
  154. package/out/concepts/DataElement__.js.map +1 -1
  155. package/out/concepts/DataSource__.d.ts +15 -15
  156. package/out/concepts/DataSource__.js +55 -39
  157. package/out/concepts/DataSource__.js.map +1 -1
  158. package/out/concepts/DatabaseTypeAnnotation__.js +4 -3
  159. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  160. package/out/concepts/Destination__.d.ts +12 -11
  161. package/out/concepts/Destination__.js +93 -36
  162. package/out/concepts/Destination__.js.map +1 -1
  163. package/out/concepts/End__.js +15 -13
  164. package/out/concepts/End__.js.map +1 -1
  165. package/out/concepts/EntityIndex__.d.ts +1 -1
  166. package/out/concepts/EntityIndex__.js +6 -5
  167. package/out/concepts/EntityIndex__.js.map +1 -1
  168. package/out/concepts/EntityProperty__.d.ts +8 -7
  169. package/out/concepts/EntityProperty__.js +39 -24
  170. package/out/concepts/EntityProperty__.js.map +1 -1
  171. package/out/concepts/Entity__.d.ts +31 -30
  172. package/out/concepts/Entity__.js +40 -16
  173. package/out/concepts/Entity__.js.map +1 -1
  174. package/out/concepts/EnumItem__.d.ts +1 -0
  175. package/out/concepts/EnumItem__.js +12 -5
  176. package/out/concepts/EnumItem__.js.map +1 -1
  177. package/out/concepts/Enum__.d.ts +9 -8
  178. package/out/concepts/Enum__.js +24 -11
  179. package/out/concepts/Enum__.js.map +1 -1
  180. package/out/concepts/Event__.d.ts +15 -15
  181. package/out/concepts/Event__.js +6 -5
  182. package/out/concepts/Event__.js.map +1 -1
  183. package/out/concepts/ExternalDestination__.d.ts +6 -6
  184. package/out/concepts/ExternalDestination__.js +12 -11
  185. package/out/concepts/ExternalDestination__.js.map +1 -1
  186. package/out/concepts/ForEachStatement__.d.ts +25 -24
  187. package/out/concepts/ForEachStatement__.js +101 -36
  188. package/out/concepts/ForEachStatement__.js.map +1 -1
  189. package/out/concepts/FrontendLibrary__.d.ts +30 -30
  190. package/out/concepts/FrontendLibrary__.js +12 -13
  191. package/out/concepts/FrontendLibrary__.js.map +1 -1
  192. package/out/concepts/FrontendVariable__.js +4 -3
  193. package/out/concepts/FrontendVariable__.js.map +1 -1
  194. package/out/concepts/Frontend__.d.ts +64 -65
  195. package/out/concepts/Frontend__.js +23 -27
  196. package/out/concepts/Frontend__.js.map +1 -1
  197. package/out/concepts/Function__.d.ts +64 -63
  198. package/out/concepts/Function__.js +49 -21
  199. package/out/concepts/Function__.js.map +1 -1
  200. package/out/concepts/Identifier__.js +37 -31
  201. package/out/concepts/Identifier__.js.map +1 -1
  202. package/out/concepts/IfStatement__.d.ts +20 -19
  203. package/out/concepts/IfStatement__.js +64 -34
  204. package/out/concepts/IfStatement__.js.map +1 -1
  205. package/out/concepts/Integration__.d.ts +3 -3
  206. package/out/concepts/Integration__.js +8 -7
  207. package/out/concepts/Integration__.js.map +1 -1
  208. package/out/concepts/InterfaceParam__.d.ts +3 -3
  209. package/out/concepts/InterfaceParam__.js +7 -6
  210. package/out/concepts/InterfaceParam__.js.map +1 -1
  211. package/out/concepts/Interface__.d.ts +33 -33
  212. package/out/concepts/Interface__.js +19 -20
  213. package/out/concepts/Interface__.js.map +1 -1
  214. package/out/concepts/JSBlock__.d.ts +1 -0
  215. package/out/concepts/JSBlock__.js +12 -5
  216. package/out/concepts/JSBlock__.js.map +1 -1
  217. package/out/concepts/JavaLogic__.js +10 -9
  218. package/out/concepts/JavaLogic__.js.map +1 -1
  219. package/out/concepts/LogicItem__.d.ts +6 -0
  220. package/out/concepts/LogicItem__.js +14 -5
  221. package/out/concepts/LogicItem__.js.map +1 -1
  222. package/out/concepts/Logic__.d.ts +80 -79
  223. package/out/concepts/Logic__.js +204 -58
  224. package/out/concepts/Logic__.js.map +1 -1
  225. package/out/concepts/MatchCase__.d.ts +39 -38
  226. package/out/concepts/MatchCase__.js +122 -37
  227. package/out/concepts/MatchCase__.js.map +1 -1
  228. package/out/concepts/Match__.d.ts +13 -11
  229. package/out/concepts/Match__.js +128 -60
  230. package/out/concepts/Match__.js.map +1 -1
  231. package/out/concepts/MemberExpression__.d.ts +7 -6
  232. package/out/concepts/MemberExpression__.js +52 -22
  233. package/out/concepts/MemberExpression__.js.map +1 -1
  234. package/out/concepts/MicroApp__.js +4 -3
  235. package/out/concepts/MicroApp__.js.map +1 -1
  236. package/out/concepts/Module__.d.ts +242 -154
  237. package/out/concepts/Module__.js +139 -33
  238. package/out/concepts/Module__.js.map +1 -1
  239. package/out/concepts/MsgTriggerEvent__.d.ts +15 -15
  240. package/out/concepts/MsgTriggerEvent__.js +6 -5
  241. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  242. package/out/concepts/MsgTriggerLauncher__.d.ts +23 -15
  243. package/out/concepts/MsgTriggerLauncher__.js +24 -5
  244. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  245. package/out/concepts/Namespace__.d.ts +180 -180
  246. package/out/concepts/Namespace__.js +33 -34
  247. package/out/concepts/Namespace__.js.map +1 -1
  248. package/out/concepts/NewComposite__.d.ts +49 -48
  249. package/out/concepts/NewComposite__.js +164 -49
  250. package/out/concepts/NewComposite__.js.map +1 -1
  251. package/out/concepts/NewList__.d.ts +19 -18
  252. package/out/concepts/NewList__.js +29 -12
  253. package/out/concepts/NewList__.js.map +1 -1
  254. package/out/concepts/NewMap__.d.ts +34 -33
  255. package/out/concepts/NewMap__.js +81 -72
  256. package/out/concepts/NewMap__.js.map +1 -1
  257. package/out/concepts/New__.js +6 -5
  258. package/out/concepts/New__.js.map +1 -1
  259. package/out/concepts/NullLiteral__.js +6 -5
  260. package/out/concepts/NullLiteral__.js.map +1 -1
  261. package/out/concepts/NumericLiteral__.d.ts +4 -3
  262. package/out/concepts/NumericLiteral__.js +15 -8
  263. package/out/concepts/NumericLiteral__.js.map +1 -1
  264. package/out/concepts/OqlQueryComponent__.d.ts +4 -3
  265. package/out/concepts/OqlQueryComponent__.js +25 -16
  266. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  267. package/out/concepts/OverriddenLogic__.d.ts +79 -79
  268. package/out/concepts/OverriddenLogic__.js +79 -58
  269. package/out/concepts/OverriddenLogic__.js.map +1 -1
  270. package/out/concepts/Param__.d.ts +6 -5
  271. package/out/concepts/Param__.js +66 -29
  272. package/out/concepts/Param__.js.map +1 -1
  273. package/out/concepts/Point__.js +4 -3
  274. package/out/concepts/Point__.js.map +1 -1
  275. package/out/concepts/ProcessComponent__.d.ts +30 -30
  276. package/out/concepts/ProcessComponent__.js +8 -7
  277. package/out/concepts/ProcessComponent__.js.map +1 -1
  278. package/out/concepts/ProcessElement__.d.ts +96 -96
  279. package/out/concepts/ProcessElement__.js +34 -34
  280. package/out/concepts/ProcessElement__.js.map +1 -1
  281. package/out/concepts/ProcessOutcome__.js +6 -5
  282. package/out/concepts/ProcessOutcome__.js.map +1 -1
  283. package/out/concepts/ProcessOutcomes__.js +6 -5
  284. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  285. package/out/concepts/Process__.d.ts +75 -75
  286. package/out/concepts/Process__.js +33 -30
  287. package/out/concepts/Process__.js.map +1 -1
  288. package/out/concepts/QueryAggregateExpression__.d.ts +3 -3
  289. package/out/concepts/QueryAggregateExpression__.js +8 -7
  290. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  291. package/out/concepts/QueryFieldExpression__.js +7 -6
  292. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  293. package/out/concepts/QueryFromExpression__.d.ts +8 -8
  294. package/out/concepts/QueryFromExpression__.js +8 -7
  295. package/out/concepts/QueryFromExpression__.js.map +1 -1
  296. package/out/concepts/QueryGroupByExpression__.d.ts +3 -3
  297. package/out/concepts/QueryGroupByExpression__.js +9 -10
  298. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  299. package/out/concepts/QueryJoinExpression__.d.ts +23 -23
  300. package/out/concepts/QueryJoinExpression__.js +11 -10
  301. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  302. package/out/concepts/QueryLimitExpression__.d.ts +6 -6
  303. package/out/concepts/QueryLimitExpression__.js +9 -8
  304. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  305. package/out/concepts/QueryOrderByExpression__.d.ts +6 -6
  306. package/out/concepts/QueryOrderByExpression__.js +9 -8
  307. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  308. package/out/concepts/QuerySelectExpression__.d.ts +30 -30
  309. package/out/concepts/QuerySelectExpression__.js +9 -8
  310. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  311. package/out/concepts/Rect__.js +4 -3
  312. package/out/concepts/Rect__.js.map +1 -1
  313. package/out/concepts/Return__.d.ts +4 -3
  314. package/out/concepts/Return__.js +37 -18
  315. package/out/concepts/Return__.js.map +1 -1
  316. package/out/concepts/Role__.js +9 -9
  317. package/out/concepts/Role__.js.map +1 -1
  318. package/out/concepts/SelectMembers__.d.ts +18 -18
  319. package/out/concepts/SelectMembers__.js +10 -9
  320. package/out/concepts/SelectMembers__.js.map +1 -1
  321. package/out/concepts/Slot__.d.ts +3 -3
  322. package/out/concepts/Slot__.js +6 -5
  323. package/out/concepts/Slot__.js.map +1 -1
  324. package/out/concepts/SqlQueryComponent__.d.ts +4 -3
  325. package/out/concepts/SqlQueryComponent__.js +21 -12
  326. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  327. package/out/concepts/Start__.js +6 -5
  328. package/out/concepts/Start__.js.map +1 -1
  329. package/out/concepts/StringInterpolation__.d.ts +16 -15
  330. package/out/concepts/StringInterpolation__.js +37 -14
  331. package/out/concepts/StringInterpolation__.js.map +1 -1
  332. package/out/concepts/StringLiteral__.d.ts +1 -0
  333. package/out/concepts/StringLiteral__.js +13 -8
  334. package/out/concepts/StringLiteral__.js.map +1 -1
  335. package/out/concepts/StructureProperty__.d.ts +4 -3
  336. package/out/concepts/StructureProperty__.js +22 -9
  337. package/out/concepts/StructureProperty__.js.map +1 -1
  338. package/out/concepts/Structure__.d.ts +31 -30
  339. package/out/concepts/Structure__.js +27 -15
  340. package/out/concepts/Structure__.js.map +1 -1
  341. package/out/concepts/SwitchCase__.d.ts +12 -11
  342. package/out/concepts/SwitchCase__.js +69 -31
  343. package/out/concepts/SwitchCase__.js.map +1 -1
  344. package/out/concepts/SwitchStatement__.d.ts +9 -8
  345. package/out/concepts/SwitchStatement__.js +27 -7
  346. package/out/concepts/SwitchStatement__.js.map +1 -1
  347. package/out/concepts/Theme__.js +4 -3
  348. package/out/concepts/Theme__.js.map +1 -1
  349. package/out/concepts/Transactional__.js +4 -3
  350. package/out/concepts/Transactional__.js.map +1 -1
  351. package/out/concepts/TriggerEvent__.d.ts +15 -15
  352. package/out/concepts/TriggerEvent__.js +6 -5
  353. package/out/concepts/TriggerEvent__.js.map +1 -1
  354. package/out/concepts/TriggerLauncher__.d.ts +15 -10
  355. package/out/concepts/TriggerLauncher__.js +54 -32
  356. package/out/concepts/TriggerLauncher__.js.map +1 -1
  357. package/out/concepts/TypeAnnotation__.d.ts +28 -27
  358. package/out/concepts/TypeAnnotation__.js +144 -124
  359. package/out/concepts/TypeAnnotation__.js.map +1 -1
  360. package/out/concepts/TypeParam__.d.ts +1 -0
  361. package/out/concepts/TypeParam__.js +12 -5
  362. package/out/concepts/TypeParam__.js.map +1 -1
  363. package/out/concepts/UnaryExpression__.d.ts +4 -3
  364. package/out/concepts/UnaryExpression__.js +31 -20
  365. package/out/concepts/UnaryExpression__.js.map +1 -1
  366. package/out/concepts/Unparsed__.d.ts +1 -0
  367. package/out/concepts/Unparsed__.js +12 -5
  368. package/out/concepts/Unparsed__.js.map +1 -1
  369. package/out/concepts/UseComponent__.js +4 -3
  370. package/out/concepts/UseComponent__.js.map +1 -1
  371. package/out/concepts/ValidationRule__.d.ts +14 -14
  372. package/out/concepts/ValidationRule__.js +19 -17
  373. package/out/concepts/ValidationRule__.js.map +1 -1
  374. package/out/concepts/Variable__.d.ts +4 -3
  375. package/out/concepts/Variable__.js +39 -23
  376. package/out/concepts/Variable__.js.map +1 -1
  377. package/out/concepts/ViewBlock__.js +4 -3
  378. package/out/concepts/ViewBlock__.js.map +1 -1
  379. package/out/concepts/ViewComponent__.d.ts +90 -90
  380. package/out/concepts/ViewComponent__.js +16 -15
  381. package/out/concepts/ViewComponent__.js.map +1 -1
  382. package/out/concepts/ViewElement__.d.ts +92 -86
  383. package/out/concepts/ViewElement__.js +258 -200
  384. package/out/concepts/ViewElement__.js.map +1 -1
  385. package/out/concepts/View__.d.ts +92 -92
  386. package/out/concepts/View__.js +173 -63
  387. package/out/concepts/View__.js.map +1 -1
  388. package/out/concepts/WhileStatement__.d.ts +12 -11
  389. package/out/concepts/WhileStatement__.js +46 -23
  390. package/out/concepts/WhileStatement__.js.map +1 -1
  391. package/out/concepts/basics/stdlib/index.js +17 -1
  392. package/out/concepts/basics/stdlib/index.js.map +1 -1
  393. package/out/concepts/basics/stdlib/nasl.browser.js +36 -0
  394. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  395. package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -0
  396. package/out/concepts/basics/stdlib/nasl.event.js +23 -0
  397. package/out/concepts/basics/stdlib/nasl.event.js.map +1 -0
  398. package/out/concepts/basics/stdlib/nasl.ui.js +45 -0
  399. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  400. package/out/concepts/basics/stdlib/nasl.util.js +6 -22
  401. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  402. package/out/concepts/index__.d.ts +2 -1
  403. package/out/concepts/index__.js +2 -1
  404. package/out/concepts/index__.js.map +1 -1
  405. package/out/concepts/types__.d.ts +2 -1
  406. package/out/decorators/index.d.ts +1 -1
  407. package/out/decorators/index.js +20 -7
  408. package/out/decorators/index.js.map +1 -1
  409. package/out/decorators/promise.d.ts +7 -0
  410. package/out/decorators/promise.js +28 -0
  411. package/out/decorators/promise.js.map +1 -0
  412. package/out/enums/KEYWORDS.js.map +1 -1
  413. package/out/enums/LEVEL_NAME_MAP.js.map +1 -1
  414. package/out/generator/compileComponent.js.map +1 -1
  415. package/out/generator/genBundleFiles.d.ts +4 -1
  416. package/out/generator/genBundleFiles.js +15 -11
  417. package/out/generator/genBundleFiles.js.map +1 -1
  418. package/out/generator/genHash.js.map +1 -1
  419. package/out/generator/genMetaData.js +12 -8
  420. package/out/generator/genMetaData.js.map +1 -1
  421. package/out/generator/genReleaseBody.js +33 -35
  422. package/out/generator/genReleaseBody.js.map +1 -1
  423. package/out/generator/microApp.js +2 -1
  424. package/out/generator/microApp.js.map +1 -1
  425. package/out/generator/permission.js +31 -30
  426. package/out/generator/permission.js.map +1 -1
  427. package/out/generator/styleReplacer.js +4 -7
  428. package/out/generator/styleReplacer.js.map +1 -1
  429. package/out/index.d.ts +0 -2
  430. package/out/index.js +0 -3
  431. package/out/index.js.map +1 -1
  432. package/out/manager/diagnostic.d.ts +1 -1
  433. package/out/manager/diagnostic.js.map +1 -1
  434. package/out/manager/stepRecorder.js +13 -9
  435. package/out/manager/stepRecorder.js.map +1 -1
  436. package/out/natural/RequirementAnalyzer.d.ts +22 -0
  437. package/out/natural/RequirementAnalyzer.js +196 -0
  438. package/out/natural/RequirementAnalyzer.js.map +1 -0
  439. package/out/natural/RequirementExecutor.d.ts +51 -0
  440. package/out/natural/RequirementExecutor.js +692 -0
  441. package/out/natural/RequirementExecutor.js.map +1 -0
  442. package/out/natural/componentData.d.ts +31 -0
  443. package/out/natural/componentData.js +85 -0
  444. package/out/natural/componentData.js.map +1 -0
  445. package/out/natural/genNaturalTS.d.ts +3 -0
  446. package/out/natural/genNaturalTS.js +76 -0
  447. package/out/natural/genNaturalTS.js.map +1 -0
  448. package/out/natural/index.d.ts +4 -0
  449. package/out/natural/index.js +21 -0
  450. package/out/natural/index.js.map +1 -0
  451. package/out/natural/knowledgeMap.d.ts +4 -0
  452. package/out/natural/knowledgeMap.js +40 -0
  453. package/out/natural/knowledgeMap.js.map +1 -0
  454. package/out/natural/naslStdlibMap.d.ts +2 -0
  455. package/out/natural/naslStdlibMap.js +26 -0
  456. package/out/natural/naslStdlibMap.js.map +1 -0
  457. package/out/natural/transformTSCode.d.ts +7 -0
  458. package/out/natural/transformTSCode.js +760 -0
  459. package/out/natural/transformTSCode.js.map +1 -0
  460. package/out/sentry/index.d.ts +2 -1
  461. package/out/sentry/index.js.map +1 -1
  462. package/out/server/createUiTs.js +28 -16
  463. package/out/server/createUiTs.js.map +1 -1
  464. package/out/server/entity2LogicNamespace.js +24 -22
  465. package/out/server/entity2LogicNamespace.js.map +1 -1
  466. package/out/server/event.d.ts +12 -0
  467. package/out/server/event.js +52 -28
  468. package/out/server/event.js.map +1 -1
  469. package/out/server/extendBaseNode.js +55 -70
  470. package/out/server/extendBaseNode.js.map +1 -1
  471. package/out/server/formatTsUtils.js +46 -50
  472. package/out/server/formatTsUtils.js.map +1 -1
  473. package/out/server/getConnector.d.ts +3 -3
  474. package/out/server/getConnector.js +7 -8
  475. package/out/server/getConnector.js.map +1 -1
  476. package/out/server/getExtensionModules.js +2 -2
  477. package/out/server/getExtensionModules.js.map +1 -1
  478. package/out/server/getFunctions.js.map +1 -1
  479. package/out/server/getInterfaces.js.map +1 -1
  480. package/out/server/getLogging.js.map +1 -1
  481. package/out/server/getLogics.d.ts +1 -1
  482. package/out/server/getLogics.js +55 -8
  483. package/out/server/getLogics.js.map +1 -1
  484. package/out/server/getMemberIdentifier.js +13 -10
  485. package/out/server/getMemberIdentifier.js.map +1 -1
  486. package/out/server/getProcessComponents.js.map +1 -1
  487. package/out/server/getProcesses.js +21 -29
  488. package/out/server/getProcesses.js.map +1 -1
  489. package/out/server/getScope.js.map +1 -1
  490. package/out/server/getValidates.js.map +1 -1
  491. package/out/server/index.js +0 -1
  492. package/out/server/index.js.map +1 -1
  493. package/out/server/naslServer.d.ts +99 -94
  494. package/out/server/naslServer.js +490 -469
  495. package/out/server/naslServer.js.map +1 -1
  496. package/out/server/naslStdlibMap.js +6 -2
  497. package/out/server/naslStdlibMap.js.map +1 -1
  498. package/out/server/process2LogicNamespace.js.map +1 -1
  499. package/out/server/translator.d.ts +1 -1
  500. package/out/server/translator.js +52 -47
  501. package/out/server/translator.js.map +1 -1
  502. package/out/service/storage/init.d.ts +15 -1
  503. package/out/service/storage/init.js +65 -56
  504. package/out/service/storage/init.js.map +1 -1
  505. package/out/templator/genCallComponentLogic.js +1 -2
  506. package/out/templator/genCallComponentLogic.js.map +1 -1
  507. package/out/templator/genCreateBlock.js +14 -9
  508. package/out/templator/genCreateBlock.js.map +1 -1
  509. package/out/templator/genCurdEditMultipleKeyBlock.js +23 -14
  510. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  511. package/out/templator/genCurdMultipleKeyBlock.js +26 -30
  512. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  513. package/out/templator/genEditTableBlock.d.ts +1 -1
  514. package/out/templator/genEditTableBlock.js +14 -19
  515. package/out/templator/genEditTableBlock.js.map +1 -1
  516. package/out/templator/genEnumSelectBlock.js +1 -1
  517. package/out/templator/genEnumSelectBlock.js.map +1 -1
  518. package/out/templator/genGetBlock.js +2 -2
  519. package/out/templator/genGetBlock.js.map +1 -1
  520. package/out/templator/genGridViewBlock.d.ts +2 -2
  521. package/out/templator/genGridViewBlock.js +18 -28
  522. package/out/templator/genGridViewBlock.js.map +1 -1
  523. package/out/templator/genListViewBlock.d.ts +2 -2
  524. package/out/templator/genListViewBlock.js +9 -16
  525. package/out/templator/genListViewBlock.js.map +1 -1
  526. package/out/templator/genQueryComponent.js +22 -15
  527. package/out/templator/genQueryComponent.js.map +1 -1
  528. package/out/templator/genSelectBlock.d.ts +2 -2
  529. package/out/templator/genSelectBlock.js +21 -48
  530. package/out/templator/genSelectBlock.js.map +1 -1
  531. package/out/templator/genTableBlock.d.ts +1 -1
  532. package/out/templator/genTableBlock.js +11 -17
  533. package/out/templator/genTableBlock.js.map +1 -1
  534. package/out/templator/genUpdateBlock.js +13 -8
  535. package/out/templator/genUpdateBlock.js.map +1 -1
  536. package/out/templator/index.d.ts +4 -2
  537. package/out/templator/index.js +2 -2
  538. package/out/templator/index.js.map +1 -1
  539. package/out/templator/utils.d.ts +9 -2
  540. package/out/templator/utils.js +22 -22
  541. package/out/templator/utils.js.map +1 -1
  542. package/out/translator/index.js +27 -28
  543. package/out/translator/index.js.map +1 -1
  544. package/out/utils/index.d.ts +2 -1
  545. package/out/utils/index.js +8 -14
  546. package/out/utils/index.js.map +1 -1
  547. package/out/utils/logger.js.map +1 -1
  548. package/out/utils/sortTsString.js +3 -1
  549. package/out/utils/sortTsString.js.map +1 -1
  550. package/out/utils/string.js +8 -11
  551. package/out/utils/string.js.map +1 -1
  552. package/out/utils/time-slicing.d.ts +41 -0
  553. package/out/utils/time-slicing.js +81 -0
  554. package/out/utils/time-slicing.js.map +1 -0
  555. package/out/utils/traverse.js +4 -6
  556. package/out/utils/traverse.js.map +1 -1
  557. package/package.json +22 -20
  558. package/sandbox/stdlib/nasl.auth.ts +49 -46
  559. package/sandbox/stdlib/nasl.browser.ts +1 -0
  560. package/sandbox/stdlib/nasl.event.ts +4 -0
  561. package/sandbox/stdlib/nasl.http.ts +29 -31
  562. package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
  563. package/sandbox/stdlib/nasl.ui.ts +11 -0
  564. package/sandbox-natural/stdlib/nasl.core.ts +36 -0
  565. package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
  566. package/sandbox-natural/stdlib/nasl.ui.ts +56 -0
  567. package/sandbox-natural/stdlib/nasl.util.ts +26 -0
  568. package/sandbox-natural/tsconfig.json +12 -0
  569. package/src/automate/engine/utils.js +3 -0
  570. package/src/automate/upgrader/2.20.js +1 -1
  571. package/src/bak/translator.js +92 -99
  572. package/src/breakpoint/generator/AfterStartNode.ts +19 -17
  573. package/src/breakpoint/generator/BeforeEndNode.ts +17 -17
  574. package/src/breakpoint/generator/BreakpointNode.ts +243 -195
  575. package/src/breakpoint/generator/CallbackNode.ts +20 -0
  576. package/src/breakpoint/generator/FragmentNode.ts +14 -0
  577. package/src/breakpoint/generator/index.ts +107 -80
  578. package/src/breakpoint/shared/constants.ts +59 -53
  579. package/src/breakpoint/shared/operations.ts +6 -6
  580. package/src/breakpoint/shared/socket.ts +277 -223
  581. package/src/breakpoint/shared/utils.ts +166 -146
  582. package/src/breakpoint/store/core.ts +326 -297
  583. package/src/breakpoint/store/dock.ts +103 -103
  584. package/src/breakpoint/types/index.d.ts +11 -11
  585. package/src/common/BaseNode.ts +1103 -1020
  586. package/src/common/Command.ts +46 -16
  587. package/src/common/ComponentAPI.ts +72 -72
  588. package/src/common/EventEmitter.ts +80 -76
  589. package/src/common/Messager.ts +223 -224
  590. package/src/common/asyncFuncMap.ts +12 -12
  591. package/src/concepts/Abort__.ts +53 -60
  592. package/src/concepts/Anchor__.ts +158 -149
  593. package/src/concepts/AnonymousFunction__.ts +584 -551
  594. package/src/concepts/App__.ts +4278 -3669
  595. package/src/concepts/Argument__.ts +234 -210
  596. package/src/concepts/Assignee__.ts +680 -656
  597. package/src/concepts/AssignmentLine__.ts +80 -84
  598. package/src/concepts/Assignment__.ts +276 -264
  599. package/src/concepts/Attribute__.ts +183 -184
  600. package/src/concepts/AuthInterface__.ts +61 -63
  601. package/src/concepts/AuthLogicForCallInterface__.ts +540 -511
  602. package/src/concepts/AuthLogic__.ts +210 -194
  603. package/src/concepts/BackendVariable__.ts +414 -415
  604. package/src/concepts/Backend__.ts +317 -303
  605. package/src/concepts/BatchAssignment__.ts +987 -939
  606. package/src/concepts/BinaryExpression__.ts +370 -341
  607. package/src/concepts/BindAttribute__.ts +1056 -1011
  608. package/src/concepts/BindDirective__.ts +540 -542
  609. package/src/concepts/BindEvent__.ts +992 -866
  610. package/src/concepts/BindStyle__.ts +442 -451
  611. package/src/concepts/BooleanLiteral__.ts +89 -90
  612. package/src/concepts/CallAuthInterface__.ts +458 -433
  613. package/src/concepts/CallConnector__.ts +209 -164
  614. package/src/concepts/CallFunction__.ts +600 -600
  615. package/src/concepts/CallInterface__.ts +752 -725
  616. package/src/concepts/CallLogic__.ts +1328 -1236
  617. package/src/concepts/CallQueryComponent__.ts +1580 -1501
  618. package/src/concepts/Comment__.ts +69 -68
  619. package/src/concepts/CompletionProperty__.ts +250 -250
  620. package/src/concepts/ConfigGroup__.ts +312 -296
  621. package/src/concepts/ConfigPropertyValue__.ts +81 -82
  622. package/src/concepts/ConfigProperty__.ts +374 -357
  623. package/src/concepts/Configuration__.ts +288 -276
  624. package/src/concepts/Connection__.ts +426 -0
  625. package/src/concepts/ConnectorTrigger__.ts +146 -142
  626. package/src/concepts/Connector__.ts +1090 -1048
  627. package/src/concepts/Constant__.ts +226 -219
  628. package/src/concepts/DataElement__.ts +108 -115
  629. package/src/concepts/DataSource__.ts +508 -472
  630. package/src/concepts/DatabaseTypeAnnotation__.ts +53 -59
  631. package/src/concepts/Destination__.ts +808 -746
  632. package/src/concepts/End__.ts +85 -89
  633. package/src/concepts/EntityIndex__.ts +206 -202
  634. package/src/concepts/EntityProperty__.ts +825 -791
  635. package/src/concepts/Entity__.ts +921 -864
  636. package/src/concepts/EnumItem__.ts +133 -125
  637. package/src/concepts/Enum__.ts +347 -337
  638. package/src/concepts/Event__.ts +305 -292
  639. package/src/concepts/ExternalDestination__.ts +269 -280
  640. package/src/concepts/ForEachStatement__.ts +583 -531
  641. package/src/concepts/FrontendLibrary__.ts +507 -485
  642. package/src/concepts/FrontendVariable__.ts +44 -49
  643. package/src/concepts/Frontend__.ts +1239 -1187
  644. package/src/concepts/Function__.ts +1110 -1045
  645. package/src/concepts/Identifier__.ts +276 -272
  646. package/src/concepts/IfStatement__.ts +467 -436
  647. package/src/concepts/Integration__.ts +136 -137
  648. package/src/concepts/InterfaceParam__.ts +239 -238
  649. package/src/concepts/Interface__.ts +969 -948
  650. package/src/concepts/JSBlock__.ts +83 -83
  651. package/src/concepts/JavaLogic__.ts +101 -106
  652. package/src/concepts/LogicItem__.ts +307 -237
  653. package/src/concepts/Logic__.ts +2301 -2088
  654. package/src/concepts/MatchCase__.ts +886 -779
  655. package/src/concepts/Match__.ts +728 -659
  656. package/src/concepts/MemberExpression__.ts +330 -311
  657. package/src/concepts/MicroApp__.ts +91 -97
  658. package/src/concepts/Module__.ts +2590 -2275
  659. package/src/concepts/MsgTriggerEvent__.ts +297 -281
  660. package/src/concepts/MsgTriggerLauncher__.ts +286 -256
  661. package/src/concepts/Namespace__.ts +2579 -2466
  662. package/src/concepts/NewComposite__.ts +1487 -1350
  663. package/src/concepts/NewList__.ts +464 -450
  664. package/src/concepts/NewMap__.ts +691 -674
  665. package/src/concepts/New__.ts +42 -49
  666. package/src/concepts/NullLiteral__.ts +66 -72
  667. package/src/concepts/NumericLiteral__.ts +169 -169
  668. package/src/concepts/OqlQueryComponent__.ts +282 -279
  669. package/src/concepts/OverriddenLogic__.ts +2142 -2097
  670. package/src/concepts/Param__.ts +500 -442
  671. package/src/concepts/Point__.ts +53 -59
  672. package/src/concepts/ProcessComponent__.ts +497 -475
  673. package/src/concepts/ProcessElement__.ts +1852 -1780
  674. package/src/concepts/ProcessOutcome__.ts +59 -64
  675. package/src/concepts/ProcessOutcomes__.ts +59 -64
  676. package/src/concepts/Process__.ts +1491 -1428
  677. package/src/concepts/QueryAggregateExpression__.ts +135 -142
  678. package/src/concepts/QueryFieldExpression__.ts +138 -142
  679. package/src/concepts/QueryFromExpression__.ts +246 -254
  680. package/src/concepts/QueryGroupByExpression__.ts +130 -136
  681. package/src/concepts/QueryJoinExpression__.ts +441 -438
  682. package/src/concepts/QueryLimitExpression__.ts +159 -166
  683. package/src/concepts/QueryOrderByExpression__.ts +173 -180
  684. package/src/concepts/QuerySelectExpression__.ts +464 -439
  685. package/src/concepts/Rect__.ts +73 -79
  686. package/src/concepts/Return__.ts +366 -345
  687. package/src/concepts/Role__.ts +146 -147
  688. package/src/concepts/SelectMembers__.ts +358 -350
  689. package/src/concepts/Slot__.ts +152 -153
  690. package/src/concepts/SqlQueryComponent__.ts +230 -228
  691. package/src/concepts/Start__.ts +45 -52
  692. package/src/concepts/StringInterpolation__.ts +323 -296
  693. package/src/concepts/StringLiteral__.ts +113 -115
  694. package/src/concepts/StructureProperty__.ts +306 -295
  695. package/src/concepts/Structure__.ts +615 -578
  696. package/src/concepts/SwitchCase__.ts +326 -290
  697. package/src/concepts/SwitchStatement__.ts +236 -229
  698. package/src/concepts/Theme__.ts +64 -68
  699. package/src/concepts/Transactional__.ts +159 -153
  700. package/src/concepts/TriggerEvent__.ts +285 -274
  701. package/src/concepts/TriggerLauncher__.ts +232 -196
  702. package/src/concepts/TypeAnnotation__.ts +1049 -1011
  703. package/src/concepts/TypeParam__.ts +48 -50
  704. package/src/concepts/UnaryExpression__.ts +163 -153
  705. package/src/concepts/Unparsed__.ts +81 -82
  706. package/src/concepts/UseComponent__.ts +53 -59
  707. package/src/concepts/ValidationRule__.ts +524 -544
  708. package/src/concepts/Variable__.ts +419 -397
  709. package/src/concepts/ViewBlock__.ts +58 -64
  710. package/src/concepts/ViewComponent__.ts +1323 -1261
  711. package/src/concepts/ViewElement__.ts +2537 -2351
  712. package/src/concepts/View__.ts +2461 -2245
  713. package/src/concepts/WhileStatement__.ts +293 -272
  714. package/src/concepts/basics/stdlib/index.ts +17 -1
  715. package/src/concepts/basics/stdlib/nasl.browser.ts +36 -0
  716. package/src/concepts/basics/stdlib/nasl.event.ts +18 -0
  717. package/src/concepts/basics/stdlib/nasl.ui.ts +45 -0
  718. package/src/concepts/basics/stdlib/nasl.util.ts +6 -22
  719. package/src/concepts/index__.ts +2 -1
  720. package/src/concepts/types__.ts +123 -121
  721. package/src/decorators/index.ts +75 -77
  722. package/src/decorators/promise.ts +28 -0
  723. package/src/enums/KEYWORDS.ts +1228 -1228
  724. package/src/enums/LEVEL_NAME_MAP.ts +24 -24
  725. package/src/generator/compileComponent.ts +10 -10
  726. package/src/generator/genBundleFiles.ts +300 -291
  727. package/src/generator/genHash.ts +2 -2
  728. package/src/generator/genMetaData.ts +280 -261
  729. package/src/generator/genReleaseBody.ts +312 -291
  730. package/src/generator/icestark.ts +1 -1
  731. package/src/generator/microApp.ts +17 -20
  732. package/src/generator/permission.ts +241 -232
  733. package/src/generator/qiankun.ts +1 -1
  734. package/src/generator/styleReplacer.ts +28 -31
  735. package/src/index.ts +0 -3
  736. package/src/manager/diagnostic.ts +84 -82
  737. package/src/manager/stepRecorder.ts +106 -94
  738. package/src/natural/RequirementAnalyzer.ts +208 -0
  739. package/src/natural/RequirementExecutor.ts +685 -0
  740. package/src/natural/componentData.ts +81 -0
  741. package/src/natural/genNaturalTS.ts +77 -0
  742. package/src/natural/index.ts +4 -0
  743. package/src/natural/knowledgeMap.ts +39 -0
  744. package/src/natural/naslStdlibMap.ts +24 -0
  745. package/src/natural/transformTSCode.ts +692 -0
  746. package/src/sentry/index.ts +109 -104
  747. package/src/server/createUiTs.ts +190 -184
  748. package/src/server/entity2LogicNamespace.ts +379 -359
  749. package/src/server/event.js +145 -121
  750. package/src/server/extendBaseNode.ts +461 -456
  751. package/src/server/formatTsUtils.ts +712 -713
  752. package/src/server/getConnector.ts +33 -33
  753. package/src/server/getExtensionModules.ts +23 -22
  754. package/src/server/getFunctions.ts +6 -6
  755. package/src/server/getInterfaces.ts +38 -37
  756. package/src/server/getLogging.ts +1 -1
  757. package/src/server/getLogics.ts +391 -312
  758. package/src/server/getMemberIdentifier.ts +286 -281
  759. package/src/server/getProcessComponents.ts +2 -2
  760. package/src/server/getProcesses.ts +548 -534
  761. package/src/server/getScope.ts +51 -51
  762. package/src/server/getValidates.ts +3 -3
  763. package/src/server/index.ts +29 -30
  764. package/src/server/naslServer.ts +4303 -4222
  765. package/src/server/naslStdlibMap.ts +43 -39
  766. package/src/server/process2LogicNamespace.ts +97 -97
  767. package/src/server/translator.ts +740 -746
  768. package/src/service/storage/init.ts +761 -728
  769. package/src/templator/genCallComponentLogic.ts +14 -15
  770. package/src/templator/genCreateBlock.ts +257 -229
  771. package/src/templator/genCurdEditMultipleKeyBlock.ts +333 -317
  772. package/src/templator/genCurdMultipleKeyBlock.ts +503 -475
  773. package/src/templator/genEditTableBlock.ts +194 -187
  774. package/src/templator/genEnumSelectBlock.ts +13 -7
  775. package/src/templator/genGetBlock.ts +57 -55
  776. package/src/templator/genGridViewBlock.ts +195 -211
  777. package/src/templator/genListViewBlock.ts +62 -72
  778. package/src/templator/genQueryComponent.ts +337 -287
  779. package/src/templator/genSelectBlock.ts +283 -297
  780. package/src/templator/genTableBlock.ts +160 -166
  781. package/src/templator/genUpdateBlock.ts +269 -255
  782. package/src/templator/index.ts +4 -4
  783. package/src/templator/utils.ts +491 -463
  784. package/src/translator/index.ts +84 -84
  785. package/src/translator/lsp.ts +22 -22
  786. package/src/translator/tsp.ts +6 -6
  787. package/src/utils/index.ts +115 -117
  788. package/src/utils/logger.ts +3 -4
  789. package/src/utils/sortTsString.ts +34 -32
  790. package/src/utils/string.ts +47 -48
  791. package/src/utils/time-slicing.ts +109 -0
  792. package/src/utils/traverse.ts +114 -126
  793. package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +71 -0
  794. package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +140 -0
  795. package/test/concepts/call-interface/constant.ts +5 -0
  796. package/test/concepts/call-interface/fixtures/only-interface.json +158 -0
  797. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +455 -0
  798. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +187 -0
  799. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +225 -0
  800. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +213 -0
  801. package/test/concepts/call-interface/fixtures/with-headers.json +192 -0
  802. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +213 -0
  803. package/test/concepts/call-interface/fixtures/with-query.json +192 -0
  804. package/test/concepts/call-interface/toEmbeddedTS.spec.ts +14 -0
  805. package/test/concepts/call-interface/toJS.spec.ts +14 -0
  806. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
  807. package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +141 -0
  808. package/test/concepts/call-logic/constant.ts +5 -0
  809. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +223 -0
  810. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +359 -0
  811. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +209 -0
  812. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +311 -0
  813. package/test/concepts/call-logic/fixtures/only-call-logic.json +10 -0
  814. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +128 -0
  815. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +126 -0
  816. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +244 -0
  817. package/test/concepts/call-logic/toEmbeddedTS.spec.ts +14 -0
  818. package/test/concepts/call-logic/toJS.spec.ts +14 -0
  819. package/test/concepts/match/__snapshots__/toEmbeddedTS.spec.ts.snap +66 -0
  820. package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +40 -0
  821. package/test/concepts/match/constant.ts +5 -0
  822. package/test/concepts/match/fixtures/isExpression.json +259 -0
  823. package/test/concepts/match/fixtures/lastBodyIf.json +268 -0
  824. package/test/concepts/match/fixtures/noExpression.json +176 -0
  825. package/test/concepts/match/toEmbeddedTS.spec.ts +14 -0
  826. package/test/concepts/match/toJS.spec.ts +14 -0
  827. package/test/concepts/utils.ts +76 -3
  828. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
  829. package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +16 -0
  830. package/test/concepts/validation-rule/constant.ts +5 -0
  831. package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +10 -17
  832. package/test/concepts/validation-rule/toJS.spec.ts +14 -0
  833. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +68 -0
  834. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +44 -0
  835. package/test/concepts/view-element/constant.ts +5 -0
  836. package/test/concepts/view-element/fixtures/default-not-found.json +322 -0
  837. package/test/concepts/view-element/toEmbeddedTS.spec.ts +14 -0
  838. package/test/concepts/view-element/toVue.spec.ts +14 -0
  839. package/test/setup.ts +7 -0
  840. package/ts-worker/src/index.js +0 -2
  841. package/tsconfig.json +21 -21
  842. package/bin/naslc +0 -3
@@ -37,11 +37,11 @@ exports.NaslServer = exports.getDisplayString2Type = void 0;
37
37
  const fs = __importStar(require("fs-extra"));
38
38
  const path = __importStar(require("path"));
39
39
  const worker_threads_1 = require("worker_threads");
40
- /// #endif
40
+ const decimal_js_1 = require("decimal.js");
41
41
  const config_1 = require("../config");
42
42
  const sentry_1 = require("../sentry");
43
43
  const Messager_1 = __importDefault(require("../common/Messager"));
44
- const getMemberIdentifier_1 = require("../server/getMemberIdentifier");
44
+ const getMemberIdentifier_1 = require("./getMemberIdentifier");
45
45
  const concepts_1 = require("../concepts");
46
46
  const translator_1 = require("../translator");
47
47
  const storage_1 = __importDefault(require("../service/storage"));
@@ -56,7 +56,7 @@ const naslStdlibMap_1 = __importDefault(require("./naslStdlibMap"));
56
56
  const jsoner = __importStar(require("../service/storage/jsoner"));
57
57
  const EventEmitter_1 = require("../common/EventEmitter");
58
58
  const utils_1 = require("../utils");
59
- const decimal_js_1 = require("decimal.js");
59
+ const decorators_1 = require("../decorators");
60
60
  const utils_2 = require("../automate/engine/utils");
61
61
  const EmbeddedTSFileLineMap = {
62
62
  Entity: 3,
@@ -69,13 +69,13 @@ const EmbeddedTSFileOffsetMap = {
69
69
  ConfigProperty: 12,
70
70
  };
71
71
  const SentryMessager = (0, sentry_1.sentryMonitorTSWorkerMessager)(Messager_1.default);
72
- let isChangeInterface = false; //判断是否导入接口
73
- let actionArr = []; //用于导入接口收集更改的节点
74
- let timer = null; //超时器用于收集导入接口相关
72
+ let isChangeInterface = false; // 判断是否导入接口
73
+ let actionArr = []; // 用于导入接口收集更改的节点
74
+ let timer = null; // 超时器用于收集导入接口相关
75
75
  const __naslStdlibFileCacheMap = new Map(); // naslStdlib文件缓存
76
76
  // 联合类型切割取出类型
77
77
  function getDisplayString2Type(displayString) {
78
- const targetString = displayString.match(/value:\s(\S+)\)/)[1];
78
+ const targetString = displayString.match(/value:\s(\S+)\)/)?.[1] ?? '';
79
79
  let targetType = null;
80
80
  if (targetString.startsWith('nasl.core.')) {
81
81
  targetType = targetString.slice(10);
@@ -90,19 +90,17 @@ function getDisplayString2Type(displayString) {
90
90
  if (/<([^()]+)>/g.exec(item)) {
91
91
  return item;
92
92
  }
93
- else if (item.includes(' ')) {
93
+ if (item.includes(' ')) {
94
94
  const strs = item.split(' ');
95
95
  const type = strs[strs.length - 1];
96
96
  return type;
97
97
  }
98
- else if (item.includes('.')) {
98
+ if (item.includes('.')) {
99
99
  const strs = item.split('.');
100
100
  const type = strs[strs.length - 1];
101
101
  return type;
102
102
  }
103
- else {
104
- return item;
105
- }
103
+ return item;
106
104
  });
107
105
  if (targetType) {
108
106
  return typeList.filter((item) => item !== targetType);
@@ -132,12 +130,14 @@ let NaslServer = class NaslServer {
132
130
  logicSetWithComponentLogic = new Set();
133
131
  constructor() {
134
132
  /// #if process.env.BUILD_TARGET === 'node'
135
- if (globalThis.process) // For TS build
133
+ if (globalThis.process)
134
+ // For TS build
136
135
  this.worker = new worker_threads_1.Worker(path.join(__dirname, '../../ts-worker/src/index.js'));
137
136
  // worker = new Worker(path.join(__dirname, '../../../src/static/ts-worker.js'));
138
137
  /// #endif
139
138
  /// #if process.env.BUILD_TARGET !== 'node'
140
- if (globalThis.window) // For TS build
139
+ if (globalThis.window)
140
+ // For TS build
141
141
  /* !!!如果改动这里需要看下关联的对应文件:webpack/ts-worker/loader.js */
142
142
  this.worker = new worker_threads_1.Worker('/ts-worker.js');
143
143
  /// #endif
@@ -187,7 +187,7 @@ let NaslServer = class NaslServer {
187
187
  // 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
188
188
  // @ts-ignore
189
189
  const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
190
- const target = changeStackItem.target;
190
+ const { target } = changeStackItem;
191
191
  const { fileNode: targetFileNode } = this.getCurrentSource(target);
192
192
  return targetFileNode === fileNode;
193
193
  });
@@ -198,10 +198,8 @@ let NaslServer = class NaslServer {
198
198
  // 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
199
199
  return;
200
200
  }
201
- else {
202
- // 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
203
- this.changeStackList.pop();
204
- }
201
+ // 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
202
+ this.changeStackList.pop();
205
203
  }
206
204
  this.changeStackList.push(item.originEvent);
207
205
  }
@@ -231,7 +229,7 @@ let NaslServer = class NaslServer {
231
229
  }, { cache: true });
232
230
  Object.keys(naslStdlibMap_1.default).forEach(async (libFileName) => {
233
231
  await this.addFile({
234
- file: '/' + libFileName,
232
+ file: `/${libFileName}`,
235
233
  fileContent: naslStdlibMap_1.default[libFileName],
236
234
  }, { cache: true });
237
235
  });
@@ -252,8 +250,7 @@ let NaslServer = class NaslServer {
252
250
  structure.sourceMap = result.sourceMap;
253
251
  this.file2NodeMap.set(result.filePath, structure);
254
252
  }
255
- catch (err) {
256
- }
253
+ catch (err) { }
257
254
  });
258
255
  if (module instanceof concepts_1.App) {
259
256
  module.overriddenLogics?.forEach?.((logic) => {
@@ -304,7 +301,7 @@ let NaslServer = class NaslServer {
304
301
  console.log(err);
305
302
  }
306
303
  });
307
- frontend.bindEvents.forEach((bindEvent) => {
304
+ frontend.bindEvents?.forEach((bindEvent) => {
308
305
  if (bindEvent?.logics && bindEvent?.logics?.length > 0) {
309
306
  bindEvent.logics.forEach((logic) => {
310
307
  try {
@@ -351,8 +348,7 @@ let NaslServer = class NaslServer {
351
348
  dataSource.sourceMap = result.sourceMap;
352
349
  this.file2NodeMap.set(result.filePath, dataSource);
353
350
  }
354
- catch (err) {
355
- }
351
+ catch (err) { }
356
352
  dataSource.entities.forEach((entity) => {
357
353
  try {
358
354
  const result = entity.toEmbeddedTSFile();
@@ -361,8 +357,7 @@ let NaslServer = class NaslServer {
361
357
  entity.sourceMap = result.sourceMap;
362
358
  this.file2NodeMap.set(result.filePath, entity);
363
359
  }
364
- catch (err) {
365
- }
360
+ catch (err) { }
366
361
  });
367
362
  });
368
363
  module?.interfaces?.forEach((_interface) => {
@@ -373,8 +368,7 @@ let NaslServer = class NaslServer {
373
368
  _interface.sourceMap = result.sourceMap;
374
369
  this.file2NodeMap.set(result.filePath, _interface);
375
370
  }
376
- catch (err) {
377
- }
371
+ catch (err) { }
378
372
  });
379
373
  module?.enums?.forEach((_enum) => {
380
374
  try {
@@ -384,8 +378,7 @@ let NaslServer = class NaslServer {
384
378
  _enum.sourceMap = result.sourceMap;
385
379
  this.file2NodeMap.set(result.filePath, _enum);
386
380
  }
387
- catch (err) {
388
- }
381
+ catch (err) { }
389
382
  });
390
383
  module?.logics?.forEach((logic) => {
391
384
  try {
@@ -396,8 +389,7 @@ let NaslServer = class NaslServer {
396
389
  logic.sourceMap = result.sourceMap;
397
390
  this.file2NodeMap.set(result.filePath, logic);
398
391
  }
399
- catch (err) {
400
- }
392
+ catch (err) { }
401
393
  });
402
394
  module?.authLogics?.forEach?.((logic) => {
403
395
  try {
@@ -408,8 +400,7 @@ let NaslServer = class NaslServer {
408
400
  logic.sourceMap = result.sourceMap;
409
401
  this.file2NodeMap.set(result.filePath, logic);
410
402
  }
411
- catch (err) {
412
- }
403
+ catch (err) { }
413
404
  });
414
405
  module?.authLogicsForCallInterface?.forEach?.((logic) => {
415
406
  try {
@@ -420,8 +411,7 @@ let NaslServer = class NaslServer {
420
411
  logic.sourceMap = result.sourceMap;
421
412
  this.file2NodeMap.set(result.filePath, logic);
422
413
  }
423
- catch (err) {
424
- }
414
+ catch (err) { }
425
415
  });
426
416
  module.processes?.forEach((process) => {
427
417
  try {
@@ -430,8 +420,7 @@ let NaslServer = class NaslServer {
430
420
  process.sourceMap = result.sourceMap;
431
421
  this.file2NodeMap.set(result.filePath, process);
432
422
  }
433
- catch (err) {
434
- }
423
+ catch (err) { }
435
424
  });
436
425
  if (module instanceof concepts_1.Connector) {
437
426
  try {
@@ -456,8 +445,29 @@ let NaslServer = class NaslServer {
456
445
  role.sourceMap = result.sourceMap;
457
446
  this.file2NodeMap.set(result.filePath, role);
458
447
  }
459
- catch (err) {
448
+ catch (err) { }
449
+ });
450
+ }
451
+ if (module instanceof concepts_1.App) {
452
+ module.connections.forEach((connection) => {
453
+ try {
454
+ const result = connection.toEmbeddedTSFile();
455
+ results.push(result);
456
+ // sourceMap都存在目录级别内容下,在页面层级下去找
457
+ connection.sourceMap = result.sourceMap;
458
+ this.file2NodeMap.set(result.filePath, connection);
460
459
  }
460
+ catch (err) { }
461
+ });
462
+ module.triggerLaunchers.forEach((triggerLauncher) => {
463
+ try {
464
+ const result = triggerLauncher.toEmbeddedTSFile();
465
+ results.push(result);
466
+ // sourceMap都存在目录级别内容下,在页面层级下去找
467
+ triggerLauncher.sourceMap = result.sourceMap;
468
+ this.file2NodeMap.set(result.filePath, triggerLauncher);
469
+ }
470
+ catch (err) { }
461
471
  });
462
472
  }
463
473
  module.configuration?.groups?.forEach((_group) => {
@@ -470,8 +480,7 @@ let NaslServer = class NaslServer {
470
480
  _property.sourceMap = result.sourceMap;
471
481
  this.file2NodeMap.set(result.filePath, _property);
472
482
  }
473
- catch (err) {
474
- }
483
+ catch (err) { }
475
484
  });
476
485
  }
477
486
  });
@@ -489,12 +498,12 @@ let NaslServer = class NaslServer {
489
498
  this.view2TSFile(view.children, results);
490
499
  }
491
500
  }
492
- catch (err) {
493
- }
501
+ catch (err) { }
494
502
  });
495
503
  }
496
504
  }
497
505
  async openApp(app) {
506
+ console.time('生成 TS 文件');
498
507
  const results = [];
499
508
  try {
500
509
  // app的创建内容
@@ -520,6 +529,7 @@ let NaslServer = class NaslServer {
520
529
  (0, common_1.registerCommand)('tsDelete.change', (callback) => {
521
530
  callback();
522
531
  });
532
+ console.timeEnd('生成 TS 文件');
523
533
  }
524
534
  async refreshApp(app) {
525
535
  // 清除所有问题
@@ -536,8 +546,8 @@ let NaslServer = class NaslServer {
536
546
  // check内容后,会自动走增量类型标注完善全部类型
537
547
  }
538
548
  /**
539
- * 初始化之前添加文件
540
- */
549
+ * 初始化之前添加文件
550
+ */
541
551
  addFile(file, { cache = false } = {}) {
542
552
  cache && this.cacheFile(file);
543
553
  return this.messager.requestCommand('addFile', file);
@@ -546,52 +556,57 @@ let NaslServer = class NaslServer {
546
556
  cacheFile(options) {
547
557
  __naslStdlibFileCacheMap.set(options.file, options);
548
558
  }
549
- /**u
550
- * 只新增文件
551
- * @param {*} files
552
- */
559
+ /** u
560
+ * 只新增文件
561
+ * @param {*} files
562
+ */
553
563
  writeFiles(files) {
554
564
  return this.messager.requestCommand('writeFiles', files);
555
565
  }
556
566
  /**
557
- * 新增、修改
558
- * 删除文件 文件用修改内容为空模拟,防止报错
559
- * @param {*} args
560
- */
567
+ * 新增、修改
568
+ * 删除文件 文件用修改内容为空模拟,防止报错
569
+ * @param {*} args
570
+ */
561
571
  updateFiles(args) {
562
572
  return this.messager.requestCommand('updateFiles', args);
563
573
  }
564
574
  /**
565
- * 清除一个目录下的所有文件
566
- */
575
+ * 清除一个目录下的所有文件
576
+ */
567
577
  deleteDirectoryFiles(args) {
568
578
  return this.messager.requestCommand('deleteDirectoryFiles', args);
569
579
  }
570
580
  async _debugInFileStorage(node, openFiles) {
571
581
  let app = node;
582
+ let openDebugEmbedded = true;
572
583
  if (node.concept !== 'App') {
573
584
  app = node.rootNode || node.app;
574
585
  }
575
586
  /// #if process.env.NODE_ENV === 'development'
576
- if (globalThis.window) { // For TS build
587
+ // 首次尝试请求
588
+ await storage_1.default.post(`/api/App/debugEmbedded?id=${app.id}`, openFiles[0]).catch(() => (openDebugEmbedded = false));
589
+ if (openDebugEmbedded && globalThis.window) {
590
+ // For TS build
577
591
  try {
578
592
  let canDebug = true;
579
- await storage_1.default.post('/api/App/debugEmbedded?id=' + app.id, openFiles[0])
580
- .catch(() => canDebug = false);
593
+ await storage_1.default.post(`/api/App/debugEmbedded?id=${app.id}`, openFiles[0]).catch(() => (canDebug = false));
581
594
  if (canDebug) {
582
595
  await Promise.all(openFiles.map(async (file) => {
583
- const res = await storage_1.default.post('/api/App/debugEmbedded?id=' + app.id, file);
596
+ const res = await storage_1.default.post(`/api/App/debugEmbedded?id=${app.id}`, file);
584
597
  return res.data;
585
598
  }));
586
599
  }
587
600
  }
588
601
  catch (e) {
589
- console.error(e);
602
+ // 出现错误之后不再调用
603
+ openDebugEmbedded = false;
590
604
  }
591
605
  }
592
606
  /// #endif
593
607
  /// #if process.env.BUILD_TARGET === 'node'
594
- if (globalThis.process) { // For TS build
608
+ if (globalThis.process) {
609
+ // For TS build
595
610
  try {
596
611
  await Promise.all(openFiles.map(async (file) => fs.outputFile(path.join(__dirname, '../debug/apps', app.id, file.file), file.fileContent)));
597
612
  }
@@ -627,9 +642,7 @@ let NaslServer = class NaslServer {
627
642
  noFilterList,
628
643
  });
629
644
  }
630
- else {
631
- console.log('没找到节点', node, currentSource, fileNode);
632
- }
645
+ console.log('没找到节点', node, currentSource, fileNode);
633
646
  }
634
647
  _getValueSelectCompletion(args) {
635
648
  return this.messager.requestCommand('getValueSelectCompletion', args);
@@ -643,10 +656,10 @@ let NaslServer = class NaslServer {
643
656
  if (node && node instanceof concepts_1.BaseNode) {
644
657
  const callFunction = node.parentNode.parentNode;
645
658
  /**
646
- * currentSource callFunction 的节点,要去到当前节点的位置
647
- * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
648
- * fileNode
649
- */
659
+ * currentSource callFunction 的节点,要去到当前节点的位置
660
+ * nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
661
+ * fileNode
662
+ */
650
663
  const { currentSource, fileNode } = this.getCurrentSource(callFunction);
651
664
  if (!currentSource) {
652
665
  return [];
@@ -673,9 +686,7 @@ let NaslServer = class NaslServer {
673
686
  if (!res.length) {
674
687
  return [];
675
688
  }
676
- else {
677
- return [{ title: '基础类型', children: res }];
678
- }
689
+ return [{ title: '基础类型', children: res }];
679
690
  }
680
691
  }
681
692
  catch (err) {
@@ -710,26 +721,25 @@ let NaslServer = class NaslServer {
710
721
  if (quickInfo.responseRequired) {
711
722
  const displayString = quickInfo?.response?.displayString || '';
712
723
  const flag = displayString.includes('<') && displayString.includes('>');
713
- const types = /\<([^()]+)\>/g.exec(displayString);
724
+ const types = /<([^()]+)>/g.exec(displayString);
714
725
  let typeStr = types && types[1];
715
726
  if (flag) {
716
727
  // 自定义结构的展示
717
728
  if (typeStr.includes('__name: "AStructure_')) {
718
- return typeStr.replaceAll(' ', '')
729
+ return typeStr
730
+ .replaceAll(' ', '')
719
731
  .replaceAll('\n', '')
720
732
  .replace(/__name:"AStructure_\w{8}";/g, '')
721
- .replace(/dataSources.([^.]+).entities.([^;]+)/g, ($1, $2, $3) => (`${$3}(${$2})`));
733
+ .replace(/dataSources.([^.]+).entities.([^;]+)/g, ($1, $2, $3) => `${$3}(${$2})`);
722
734
  }
723
- else if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
735
+ if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
724
736
  /**
725
- * {
726
- text: nasl.core.String;
727
- value: nasl.core.String;
728
- }
729
- */
730
- return typeStr.replaceAll(' ', '')
731
- .replaceAll('\n', '')
732
- .replaceAll('nasl.core.', '');
737
+ * {
738
+ text: nasl.core.String;
739
+ value: nasl.core.String;
740
+ }
741
+ */
742
+ return typeStr.replaceAll(' ', '').replaceAll('\n', '').replaceAll('nasl.core.', '');
733
743
  }
734
744
  let str = '';
735
745
  // 取出T的值
@@ -739,7 +749,7 @@ let NaslServer = class NaslServer {
739
749
  return typeStr;
740
750
  }
741
751
  // 取出剩下的剩下的类型的最后一项
742
- if (/\<([^()]+)\>/g.exec(typeStr)) {
752
+ if (/<([^()]+)>/g.exec(typeStr)) {
743
753
  str = typeStr;
744
754
  }
745
755
  else if (typeStr.includes('.')) {
@@ -773,13 +783,12 @@ let NaslServer = class NaslServer {
773
783
  const flag = displayString.includes('<') && displayString.includes('>');
774
784
  if (!flag)
775
785
  return;
776
- const types = /\<([^()]+)\>/g.exec(displayString);
786
+ const types = /<([^()]+)>/g.exec(displayString);
777
787
  const typeStr = types && types[1];
778
- const app = node.app;
788
+ const { app } = node;
779
789
  if (typeStr.includes('__name: "AStructure_')) {
780
790
  const properties = [];
781
- typeStr
782
- .replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
791
+ typeStr.replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
783
792
  if (name === '__name')
784
793
  return;
785
794
  typeKey = `app.${typeKey}`;
@@ -798,15 +807,15 @@ let NaslServer = class NaslServer {
798
807
  });
799
808
  return concepts_1.TypeAnnotation.createTypeAnonymousStructure(properties);
800
809
  }
801
- else if (typeStr.startsWith('structures'))
810
+ if (typeStr.startsWith('structures'))
802
811
  return app.findNodeByCompleteName(`app.${typeStr}`);
803
812
  }
804
813
  }
805
814
  /**
806
- * ts的 quickInfo方法,查询指定位置的详情
807
- * @param args 文件信息数组
808
- * @returns 查询到的
809
- */
815
+ * ts的 quickInfo方法,查询指定位置的详情
816
+ * @param args 文件信息数组
817
+ * @returns 查询到的
818
+ */
810
819
  _getTypeQuickinfo(args) {
811
820
  return this.messager.requestCommand('quickInfo', args);
812
821
  }
@@ -838,11 +847,11 @@ let NaslServer = class NaslServer {
838
847
  return result;
839
848
  }
840
849
  /**
841
- * 获取已经选中的内容的 下一级的内容
842
- * @param node 已经选中的内容
843
- * @param noFilterList 不过滤的key 的数据
844
- * @returns 可以选择的数据数组
845
- */
850
+ * 获取已经选中的内容的 下一级的内容
851
+ * @param node 已经选中的内容
852
+ * @param noFilterList 不过滤的key 的数据
853
+ * @returns 可以选择的数据数组
854
+ */
846
855
  getSelectNextCompletion(node, noFilterList) {
847
856
  const { currentSource, fileNode } = this.getCurrentSource(node);
848
857
  // console.log(currentSource, fileNode);
@@ -856,32 +865,18 @@ let NaslServer = class NaslServer {
856
865
  noFilterList,
857
866
  });
858
867
  }
859
- else {
860
- console.log('没找到节点', currentSource, fileNode);
861
- }
868
+ console.log('没找到节点', currentSource, fileNode);
862
869
  }
863
870
  _getSelectNextCompletion(args) {
864
871
  return this.messager.requestCommand('getSelectNextCompletion', args);
865
872
  }
866
- /**
867
- * 获取诊断信息
868
- * @param fileNames 多个文件名
869
- * @returns 诊断结果
870
- */
871
- async getDiagnosticRecords(fileNames) {
872
- const records = (await this.messager.requestCommand('getDiagnosticRecords', fileNames));
873
- const diagnosticRecords = await this._resolveDiagnosticRecords(records);
874
- return diagnosticRecords;
875
- }
876
- async getDiagnosticRecordsAndPushAll(fileNames) {
877
- // 开始诊断和标注
873
+ getDiagnosticRecordsAndPushAll(fileNames) {
878
874
  (0, common_1.invokeCommand)('naslServer:startWork');
879
- const records = await this.getDiagnosticRecords(fileNames);
880
- // diagnosticManager.pushAll(records);
875
+ return this.messager.requestCommand('getDiagnosticRecords', fileNames);
881
876
  }
882
877
  /**
883
- * 节点异常是只能挂载单个,如果已经了就不赋值了
884
- */
878
+ * 节点异常是只能挂载单个,如果已经了就不赋值了
879
+ */
885
880
  baseNodeAssignmentTsError(node, tsErrorDetail) {
886
881
  if (node.tsErrorDetail)
887
882
  return;
@@ -897,8 +892,8 @@ let NaslServer = class NaslServer {
897
892
  if (records.length) {
898
893
  await this.IncrementalAnnotationJSON(records);
899
894
  }
900
- records.forEach((record) => {
901
- const node = record.node;
895
+ await Promise.all(records.map(async (record) => {
896
+ const { node } = record;
902
897
  if (!node)
903
898
  return;
904
899
  // 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
@@ -923,7 +918,7 @@ let NaslServer = class NaslServer {
923
918
  });
924
919
  // 语义诊断
925
920
  if (isChangeInterface) {
926
- this.existStructureFix(record.semanticDiagnostics, node, this);
921
+ this.existStructureFix(record.semanticDiagnostics, record.node, this);
927
922
  }
928
923
  // 单独处理 oql 语义错误提示
929
924
  if (record.node instanceof concepts_1.Logic) {
@@ -936,11 +931,12 @@ let NaslServer = class NaslServer {
936
931
  }
937
932
  });
938
933
  }
934
+ // 记录结构体数据
939
935
  record.semanticDiagnostics.forEach((diag) => (0, translator_2.checkAStructure_)(diag.text));
940
936
  record.semanticDiagnostics = record.semanticDiagnostics
941
- .map((diag) => this._resolveDiagnostic(diag, node, record))
937
+ .map((diag) => this._resolveDiagnostic(diag, record.node, record))
942
938
  .filter((diag) => !!diag);
943
- record.semanticDiagnostics.push(...this._attachDiagnostics(node));
939
+ record.semanticDiagnostics.push(...(await this._attachDiagnostics(node)));
944
940
  // 报错降级逻辑
945
941
  record.semanticDiagnostics = record.semanticDiagnostics
946
942
  .map((diagnostic) => {
@@ -951,7 +947,7 @@ let NaslServer = class NaslServer {
951
947
  record.suggestionDiagnostics.push(diagnostic);
952
948
  return null;
953
949
  }
954
- else if (currentNode.concept === 'OqlQueryComponent') {
950
+ if (currentNode.concept === 'OqlQueryComponent') {
955
951
  // OQL别名错误降级为警告
956
952
  if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
957
953
  // 重置 图标和错误等级
@@ -964,7 +960,7 @@ let NaslServer = class NaslServer {
964
960
  return null;
965
961
  }
966
962
  }
967
- while (currentNode?.parentNode?.concept !== 'App') {
963
+ while (currentNode && currentNode?.parentNode?.concept !== 'App') {
968
964
  if (currentNode.parentKey?.toLowerCase()?.includes('playground')) {
969
965
  // 草稿区降级
970
966
  // 重置 图标和错误等级
@@ -985,53 +981,46 @@ let NaslServer = class NaslServer {
985
981
  }
986
982
  }
987
983
  return diagnostic;
988
- }).filter((diag) => !!diag);
989
- // 建议诊断
990
- // 实体下的建议不用展示,因为都是平台自己写的逻辑
991
- // if (node instanceof Entity) {
992
- // record.suggestionDiagnostics = [];
993
- // }
994
- // if (node instanceof View) {
995
- // // event在view中不展示建议使用,提示关闭掉
996
- // record.suggestionDiagnostics = record.suggestionDiagnostics.filter((item) => !item.text.includes(`'event'`));
997
- // }
998
- // if (node instanceof Logic) {
999
- // // logic在for循环中,不展示any提示
1000
- // record.suggestionDiagnostics = record.suggestionDiagnostics.filter((item) => !item.text.includes(`implicitly has an 'any' type, but a better type may be inferred from usage.`));
1001
- // }
984
+ })
985
+ .filter((diag) => !!diag);
1002
986
  // 处理后的警告异常提示信息
1003
- record.suggestionDiagnostics = record.suggestionDiagnostics.map((diag) => {
987
+ record.suggestionDiagnostics = record.suggestionDiagnostics
988
+ .map((diag) => {
1004
989
  // 上面错误降级下来的
1005
990
  if (diag?.node) {
1006
991
  return diag;
1007
992
  // 一些已知警告的单独处理
1008
993
  }
1009
- else if ([`'__LogicEmpty' is declared but its value is never read.`,
994
+ if ([
995
+ `'__LogicEmpty' is declared but its value is never read.`,
1010
996
  `'__destinationEmpty__' is declared but its value is never read.`,
1011
997
  `'__devConfigValueEmpty' is declared but its value is never read.`,
1012
998
  `'__onlineConfigValueEmpty' is declared but its value is never read.`,
1013
- `'__UpdateNoProperty__' is declared but its value is never read.`].includes(diag.text)) {
1014
- return this._resolveDiagnostic(diag, node, record);
999
+ `'__UpdateNoProperty__' is declared but its value is never read.`,
1000
+ ].includes(diag.text)) {
1001
+ return this._resolveDiagnostic(diag, record.node, record);
1015
1002
  }
1016
- else if ((diag.text).includes(` is declared but its value is never read.`)) {
1003
+ if (diag.text.includes(` is declared but its value is never read.`)) {
1017
1004
  // 局部变量和输入变量未使用的警告
1018
- const fromModule = node.parentNode.concept === 'Module';
1019
- const fromConnector = node.parentNode.concept === 'Connector';
1020
- if ((node.concept === 'View' || node.concept === 'Logic') && !(fromModule || fromConnector)) {
1005
+ const fromModule = record.node.parentNode.concept === 'Module';
1006
+ const fromConnector = record.node.parentNode.concept === 'Connector';
1007
+ if ((record.node.concept === 'View' || record.node.concept === 'Logic') && !(fromModule || fromConnector)) {
1021
1008
  /**
1022
1009
  * javalogic不用提示
1023
1010
  */
1024
- if (node.concept === 'Logic' && this._isJavalogic(node)) {
1025
- return;
1011
+ if (record.node.concept === 'Logic' && this._isJavalogic(record.node)) {
1012
+ return null;
1026
1013
  }
1027
- const minRange = this._findMinRange(diag, node);
1014
+ const minRange = this._findMinRange(diag, record.node);
1028
1015
  if (minRange) {
1029
1016
  /**
1030
1017
  * 如果节点是入参类型
1031
1018
  * 而且不是foreach中
1032
1019
  * 而且不是事件逻辑的入参
1033
1020
  */
1034
- if (minRange.node instanceof concepts_1.Param && minRange.node.parentNode.concept !== 'ForEachStatement' && !minRange.node.getAncestor('BindEvent')) {
1021
+ if (minRange.node instanceof concepts_1.Param &&
1022
+ minRange.node.parentNode.concept !== 'ForEachStatement' &&
1023
+ !minRange.node.getAncestor('BindEvent')) {
1035
1024
  const diagnostic = {
1036
1025
  node: minRange.node,
1037
1026
  severity: 'warning',
@@ -1039,7 +1028,7 @@ let NaslServer = class NaslServer {
1039
1028
  };
1040
1029
  return diagnostic;
1041
1030
  }
1042
- else if (minRange.node instanceof concepts_1.Variable) {
1031
+ if (minRange.node instanceof concepts_1.Variable) {
1043
1032
  const diagnostic = {
1044
1033
  node: minRange.node,
1045
1034
  severity: 'warning',
@@ -1051,9 +1040,10 @@ let NaslServer = class NaslServer {
1051
1040
  }
1052
1041
  }
1053
1042
  return null;
1054
- }).filter((diag) => !!diag);
1043
+ })
1044
+ .filter((diag) => !!diag);
1055
1045
  record.suggestionDiagnostics.push(...this._attachSuggestionDiagnostics(node));
1056
- });
1046
+ }));
1057
1047
  return records;
1058
1048
  }
1059
1049
  /**
@@ -1175,7 +1165,7 @@ let NaslServer = class NaslServer {
1175
1165
  }
1176
1166
  });
1177
1167
  }
1178
- const { typeAnnotation: maxTypeAnnotation, } = maxTypeAnnotationInfo;
1168
+ const { typeAnnotation: maxTypeAnnotation } = maxTypeAnnotationInfo;
1179
1169
  for (const sortedTypeKey in typeAnnotationMap) {
1180
1170
  const { typeAnnotation, cases } = typeAnnotationMap[sortedTypeKey];
1181
1171
  if (maxTypeAnnotation?.sortedTypeKey !== typeAnnotation?.sortedTypeKey) {
@@ -1202,9 +1192,9 @@ let NaslServer = class NaslServer {
1202
1192
  else if (node instanceof concepts_1.NewList && !node.typeAnnotation) {
1203
1193
  // 匿名函数返回值有可能是newList,需要过滤。代码来源:AnonymousFunction.__ts
1204
1194
  const grandParent = node.parentNode?.parentNode?.parentNode;
1205
- if (grandParent instanceof concepts_1.CallLogic
1206
- && /dataSources\.[^.]+\.entities\.[^.]+\.logics/.test(grandParent.calleeNamespace)
1207
- && ['update', 'updateBy', 'createOrUpdate', 'batchUpdate'].includes(grandParent.calleeName)) {
1195
+ if (grandParent instanceof concepts_1.CallLogic &&
1196
+ /dataSources\.[^.]+\.entities\.[^.]+\.logics/.test(grandParent.calleeNamespace) &&
1197
+ ['update', 'updateBy', 'createOrUpdate', 'batchUpdate'].includes(grandParent.calleeName)) {
1208
1198
  return;
1209
1199
  }
1210
1200
  const { items } = node || {};
@@ -1219,7 +1209,7 @@ let NaslServer = class NaslServer {
1219
1209
  const typeAnnotation = item.__TypeAnnotation;
1220
1210
  // 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
1221
1211
  if (typeAnnotation) {
1222
- const sortedTypeKey = typeAnnotation.sortedTypeKey;
1212
+ const { sortedTypeKey } = typeAnnotation;
1223
1213
  if (!typeAnnotationMap[sortedTypeKey]) {
1224
1214
  typeAnnotationMap[sortedTypeKey] = {
1225
1215
  typeAnnotation,
@@ -1240,7 +1230,7 @@ let NaslServer = class NaslServer {
1240
1230
  }
1241
1231
  });
1242
1232
  }
1243
- const { typeAnnotation: maxTypeAnnotation, } = maxTypeAnnotationInfo;
1233
+ const { typeAnnotation: maxTypeAnnotation } = maxTypeAnnotationInfo;
1244
1234
  for (const sortedTypeKey in typeAnnotationMap) {
1245
1235
  const { typeAnnotation, items } = typeAnnotationMap[sortedTypeKey];
1246
1236
  if (maxTypeAnnotation?.sortedTypeKey !== typeAnnotation?.sortedTypeKey) {
@@ -1273,7 +1263,7 @@ let NaslServer = class NaslServer {
1273
1263
  const typeAnnotation = value.__TypeAnnotation;
1274
1264
  // 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
1275
1265
  if (typeAnnotation) {
1276
- const sortedTypeKey = typeAnnotation.sortedTypeKey;
1266
+ const { sortedTypeKey } = typeAnnotation;
1277
1267
  if (!typeAnnotationMap[sortedTypeKey]) {
1278
1268
  typeAnnotationMap[sortedTypeKey] = {
1279
1269
  typeAnnotation,
@@ -1294,7 +1284,7 @@ let NaslServer = class NaslServer {
1294
1284
  }
1295
1285
  });
1296
1286
  }
1297
- const { typeAnnotation: maxTypeAnnotation, } = maxTypeAnnotationInfo;
1287
+ const { typeAnnotation: maxTypeAnnotation } = maxTypeAnnotationInfo;
1298
1288
  for (const sortedTypeKey in typeAnnotationMap) {
1299
1289
  const { typeAnnotation, values } = typeAnnotationMap[sortedTypeKey];
1300
1290
  if (maxTypeAnnotation?.sortedTypeKey !== typeAnnotation?.sortedTypeKey) {
@@ -1348,7 +1338,8 @@ let NaslServer = class NaslServer {
1348
1338
  contentVariables.push(node);
1349
1339
  // QueryFromExpression QueryJoinExpression
1350
1340
  }
1351
- else if ((node?.concept === 'QueryFieldExpression' && !node.isDotStar) || node?.concept === 'QueryGroupByExpression') {
1341
+ else if ((node?.concept === 'QueryFieldExpression' && !node.isDotStar) ||
1342
+ node?.concept === 'QueryGroupByExpression') {
1352
1343
  contentVariables.push(node);
1353
1344
  }
1354
1345
  }
@@ -1387,7 +1378,8 @@ let NaslServer = class NaslServer {
1387
1378
  if (node.isComponentLogic) {
1388
1379
  flag = true;
1389
1380
  }
1390
- else if (node.isViewLogic) { // 调用页面逻辑
1381
+ else if (node.isViewLogic) {
1382
+ // 调用页面逻辑
1391
1383
  const logicNode = node.view?.logics?.find?.((viewLogic) => viewLogic.name === node.calleeName);
1392
1384
  if (logicNode) {
1393
1385
  if (this.logicSetWithComponentLogic.has(logicNode.nodePath)) {
@@ -1421,12 +1413,59 @@ let NaslServer = class NaslServer {
1421
1413
  });
1422
1414
  return flag;
1423
1415
  }
1416
+ /** 是否被 触发器依赖, 如果存在,返回第一个触发器对应的名称 */
1417
+ async isRefedByTriggerAndReturnFirstRef(fileNode) {
1418
+ const refs = await this._isHaveRef(fileNode);
1419
+ const basePath = concepts_1.TriggerLauncher.getEmbeddedFileBasePath(fileNode.rootNode);
1420
+ let flag = false;
1421
+ let fRefName = '';
1422
+ try {
1423
+ for (const ref of refs) {
1424
+ const { file } = ref;
1425
+ if (file.startsWith(basePath)) {
1426
+ flag = true;
1427
+ // file: /embedded/tttta/triggerLaunchers/订阅配置_asd.ts
1428
+ fRefName = file.split(basePath)[1].split('.')[0];
1429
+ break;
1430
+ }
1431
+ }
1432
+ }
1433
+ catch (error) {
1434
+ console.error(error, refs);
1435
+ }
1436
+ return {
1437
+ isRefedByTrigger: flag,
1438
+ fRefName,
1439
+ };
1440
+ }
1441
+ /**
1442
+ * 是否符合 触发器规则
1443
+ * 规则:
1444
+ * 1. 入参仅有一个,且必须为string类型
1445
+ */
1446
+ isTriggerRule(fileNode) {
1447
+ const { sourceMap } = fileNode;
1448
+ let paramsLength = 0;
1449
+ let flag = true;
1450
+ sourceMap.forEach((_, k) => {
1451
+ if (k instanceof concepts_1.Param) {
1452
+ paramsLength++;
1453
+ const typeAnnotation = k.typeAnnotation || k.__TypeAnnotation;
1454
+ const { typeKind, typeName, typeNamespace } = typeAnnotation || {};
1455
+ const isString = typeKind === 'primitive' && typeName === 'String' && typeNamespace === 'nasl.core';
1456
+ if (!isString) {
1457
+ flag = false;
1458
+ }
1459
+ }
1460
+ });
1461
+ return paramsLength === 1 && flag;
1462
+ }
1424
1463
  /**
1425
- * 额外的诊断
1426
- * @param fileNode 文件级别的节点
1427
- * @returns 诊断结果
1428
- */
1429
- _attachDiagnostics(fileNode) {
1464
+ * 额外的诊断
1465
+ * @param fileNode 文件级别的节点
1466
+ * @returns 诊断结果
1467
+ */
1468
+ async _attachDiagnostics(fileNode) {
1430
1469
  // 每次诊断前先清空这个Set
1431
1470
  this.logicSetWithComponentLogic = new Set();
1432
1471
  const diagnostics = [];
@@ -1504,9 +1543,9 @@ let NaslServer = class NaslServer {
1504
1543
  if (!jsCode.includes(`this.${node.name} = `))
1505
1544
  return;
1506
1545
  // 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
1507
- if (nodeIn.logic?.params.find((param) => jsCode.includes(param.name))
1508
- || nodeIn.logic?.virtualParams.find((vParam) => jsCode.includes(vParam.name))
1509
- || nodeIn.logic?.variables.find((variable) => jsCode.includes(variable.name))) {
1546
+ if (nodeIn.logic?.params.find((param) => jsCode.includes(param.name)) ||
1547
+ nodeIn.logic?.virtualParams.find((vParam) => jsCode.includes(vParam.name)) ||
1548
+ nodeIn.logic?.variables.find((variable) => jsCode.includes(variable.name))) {
1510
1549
  if (!nodeIn.tsErrorDetail) {
1511
1550
  const diagnostic = {
1512
1551
  node: nodeIn,
@@ -1546,17 +1585,17 @@ let NaslServer = class NaslServer {
1546
1585
  if (Array.isArray(node.bindExpressions)) {
1547
1586
  const exp = node.bindExpressions.find((bindExpression) => this.hasComponentLogics(bindExpression));
1548
1587
  if (exp) {
1549
- //const element: any = node.getAncestor('ViewElement');
1550
- //const api = config.allNodesAPI[element?.tag];
1551
- //const attr = api?.attrs?.find?.((attr) => {
1588
+ // const element: any = node.getAncestor('ViewElement');
1589
+ // const api = config.allNodesAPI[element?.tag];
1590
+ // const attr = api?.attrs?.find?.((attr) => {
1552
1591
  // return attr.name === node.name;
1553
- //});
1592
+ // });
1554
1593
  const map = {
1555
1594
  BindAttribute: '属性',
1556
1595
  BindDirective: '指令',
1557
1596
  BindStyle: '样式属性',
1558
1597
  };
1559
- //“${attr?.title || node.title || node.name}”
1598
+ // “${attr?.title || node.title || node.name}”
1560
1599
  const diagnostic = {
1561
1600
  node,
1562
1601
  severity: 'error',
@@ -1586,7 +1625,7 @@ let NaslServer = class NaslServer {
1586
1625
  }
1587
1626
  });
1588
1627
  }
1589
- if (fileNode instanceof concepts_1.DataSource) {
1628
+ else if (fileNode instanceof concepts_1.DataSource) {
1590
1629
  const dataSourceGroup = fileNode.rootNode.configuration?.getGroup('dataSource');
1591
1630
  if (dataSourceGroup) {
1592
1631
  const property = dataSourceGroup.getProperty(fileNode.name);
@@ -1651,7 +1690,7 @@ let NaslServer = class NaslServer {
1651
1690
  }
1652
1691
  }
1653
1692
  // 加上对实体属性存储类型的校验规则
1654
- if (fileNode instanceof concepts_1.Entity) {
1693
+ else if (fileNode instanceof concepts_1.Entity) {
1655
1694
  const entity = fileNode;
1656
1695
  const dbType = entity.dataSource.dataSourceSqlType;
1657
1696
  const { origin, properties } = entity || {};
@@ -1728,7 +1767,7 @@ let NaslServer = class NaslServer {
1728
1767
  const { default: defaultVal } = precisionOption || {};
1729
1768
  const precision = databaseTypeAnnotation ? databaseTypeAnnotation.arguments?.precision : defaultVal;
1730
1769
  const ruleScale = typeAnnotation?.ruleMap?.scale;
1731
- const scale = ruleScale !== undefined ? ruleScale + '' : '';
1770
+ const scale = ruleScale !== undefined ? `${ruleScale}` : '';
1732
1771
  let ensureScale = true;
1733
1772
  switch (typeName) {
1734
1773
  case 'String': {
@@ -1776,7 +1815,8 @@ let NaslServer = class NaslServer {
1776
1815
  value: maxVal,
1777
1816
  },
1778
1817
  ].forEach(({ key, name, value }) => {
1779
- if (ruleMin && value && new decimal_js_1.Decimal(ruleMin).greaterThan(new decimal_js_1.Decimal(value))) { // 超出存储下限
1818
+ if (ruleMin && value && new decimal_js_1.Decimal(ruleMin).greaterThan(new decimal_js_1.Decimal(value))) {
1819
+ // 超出存储下限
1780
1820
  const diag = {
1781
1821
  node: property,
1782
1822
  severity: 'warning',
@@ -1785,7 +1825,8 @@ let NaslServer = class NaslServer {
1785
1825
  diagnostics.push(diag);
1786
1826
  typeAnnotationErrorDetail.errorPos[key] = `${name}超出存储下限`;
1787
1827
  }
1788
- if (ruleMax && value && new decimal_js_1.Decimal(ruleMax).lessThan(new decimal_js_1.Decimal(value))) { // 超出存储上限
1828
+ if (ruleMax && value && new decimal_js_1.Decimal(ruleMax).lessThan(new decimal_js_1.Decimal(value))) {
1829
+ // 超出存储上限
1789
1830
  const diag = {
1790
1831
  node: property,
1791
1832
  severity: 'warning',
@@ -1825,7 +1866,7 @@ let NaslServer = class NaslServer {
1825
1866
  // 储存小数部分
1826
1867
  const memoryScaleStr = memoryStr.slice(0, +(scale || '0'));
1827
1868
  // 储存绝对值
1828
- const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? '.' + memoryScaleStr : '');
1869
+ const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? `.${memoryScaleStr}` : '');
1829
1870
  const decimalMemoryAbsVal = new decimal_js_1.Decimal(memoryAbsVal);
1830
1871
  [
1831
1872
  {
@@ -1883,8 +1924,17 @@ let NaslServer = class NaslServer {
1883
1924
  }
1884
1925
  }
1885
1926
  if (fileNode instanceof concepts_1.Logic || fileNode instanceof concepts_1.OverriddenLogic) {
1927
+ const { isRefedByTrigger, fRefName } = await this.isRefedByTriggerAndReturnFirstRef(fileNode);
1928
+ if (isRefedByTrigger && !this.isTriggerRule(fileNode)) {
1929
+ const diagnostic = {
1930
+ node: fileNode,
1931
+ severity: 'error',
1932
+ message: `${fileNode.name} 已被Kafka消息订阅配置 ${fRefName} 引用,该逻辑入参只有一个入参,且入参类型为string,否则会导致无法接收Kafka消息`,
1933
+ };
1934
+ diagnostics.push(diagnostic);
1935
+ }
1886
1936
  fileNode?.sourceMap.forEach((value, node) => {
1887
- //OQL支持返回复合类型数据了
1937
+ // OQL支持返回复合类型数据了
1888
1938
  // SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
1889
1939
  // if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
1890
1940
  // const diagnostic = {
@@ -1900,7 +1950,7 @@ let NaslServer = class NaslServer {
1900
1950
  const typeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(node.__nodeType);
1901
1951
  if (!node.typeAnnotation && typeAnnotation) {
1902
1952
  if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
1903
- const typeArguments = typeAnnotation.typeArguments;
1953
+ const { typeArguments } = typeAnnotation;
1904
1954
  if (typeArguments.length && typeArguments[0].isComplexType()) {
1905
1955
  const diagnostic = {
1906
1956
  node,
@@ -1918,8 +1968,7 @@ let NaslServer = class NaslServer {
1918
1968
  const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
1919
1969
  let used = false;
1920
1970
  fileNode?.sourceMap.forEach((valueIn, nodeIn) => {
1921
- if (!used && nodeIn
1922
- && (nodeIn instanceof concepts_1.BatchAssignment || (nodeIn instanceof concepts_1.Assignment && nodeIn.left?.name))) {
1971
+ if (!used && nodeIn && (nodeIn instanceof concepts_1.BatchAssignment || (nodeIn instanceof concepts_1.Assignment && nodeIn.left?.name))) {
1923
1972
  let jsCode = '';
1924
1973
  try {
1925
1974
  jsCode = nodeIn.toJS();
@@ -1957,11 +2006,12 @@ let NaslServer = class NaslServer {
1957
2006
  this.checkNodeError(node, diagnostics);
1958
2007
  });
1959
2008
  }
1960
- if (fileNode instanceof concepts_1.Process) {
2009
+ else if (fileNode instanceof concepts_1.Process) {
1961
2010
  fileNode?.sourceMap.forEach((value, node) => {
1962
2011
  this.checkNodeError(node, diagnostics);
1963
2012
  });
1964
2013
  }
2014
+ console.timeEnd('_attachDiagnostics');
1965
2015
  return diagnostics;
1966
2016
  }
1967
2017
  checkNodeError(node, diagnostics) {
@@ -2035,7 +2085,7 @@ let NaslServer = class NaslServer {
2035
2085
  }
2036
2086
  if (node instanceof concepts_1.MatchCase && node.getAncestor('Match')?.isExpression && node.body.length === 0) {
2037
2087
  // 如果不是其他就标红
2038
- if ((node?.getIndexOfParent() !== (node.getAncestor('Match')?.cases?.length || 0) - 1)) {
2088
+ if (node?.getIndexOfParent() !== (node.getAncestor('Match')?.cases?.length || 0) - 1) {
2039
2089
  const diagnostic = {
2040
2090
  node,
2041
2091
  severity: 'error',
@@ -2089,7 +2139,7 @@ let NaslServer = class NaslServer {
2089
2139
  }
2090
2140
  if (node.tsErrorDetail) {
2091
2141
  // 如果父级是枚举,而且子集选的是变量,就提示枚举值已被删除
2092
- if (matchExpressionType?.typeNamespace?.includes('enums') && (node instanceof concepts_1.MemberExpression)) {
2142
+ if (matchExpressionType?.typeNamespace?.includes('enums') && node instanceof concepts_1.MemberExpression) {
2093
2143
  node.tsErrorDetail.titleTip = '该枚举值已被删除';
2094
2144
  }
2095
2145
  else if (!node.tsErrorDetail.titleTip) {
@@ -2108,24 +2158,31 @@ let NaslServer = class NaslServer {
2108
2158
  diagnostics.push(diagnostic);
2109
2159
  }
2110
2160
  /**
2111
- * 如果节点是内置函数
2112
- * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
2113
- * && 他在父级中,不在body
2114
- * && 也不再 if的线上
2115
- * && 也不再 switch的线上consequent
2116
- * && 也不再草稿区域
2117
- * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
2118
- * && 而且也没有类型,就说明在槽位里,就需要报错
2119
- *
2120
- * 如果是内置函数而且也不在线上
2121
- * 只有下面自己实现的函数才会报错
2122
- */
2123
- if (node instanceof concepts_1.CallFunction && node.parentKey !== 'body' && node.parentKey !== 'alternate' && node.parentKey !== 'playground' && node.parentKey !== 'consequent' && node.parentNode?.parentNode?.concept !== 'CallInterface' && !node.__TypeAnnotation) {
2161
+ * 如果节点是内置函数
2162
+ * 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
2163
+ * && 他在父级中,不在body
2164
+ * && 也不再 if的线上
2165
+ * && 也不再 switch的线上consequent
2166
+ * && 也不再草稿区域
2167
+ * && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
2168
+ * && 而且也没有类型,就说明在槽位里,就需要报错
2169
+ *
2170
+ * 如果是内置函数而且也不在线上
2171
+ * 只有下面自己实现的函数才会报错
2172
+ */
2173
+ if (node instanceof concepts_1.CallFunction &&
2174
+ node.parentKey !== 'body' &&
2175
+ node.parentKey !== 'alternate' &&
2176
+ node.parentKey !== 'playground' &&
2177
+ node.parentKey !== 'consequent' &&
2178
+ node.parentNode?.parentNode?.concept !== 'CallInterface' &&
2179
+ !node.__TypeAnnotation) {
2124
2180
  let showErr = false;
2125
2181
  if (node.parentNode?.parentNode?.concept === 'CallLogic') {
2126
2182
  // calllogic 中别的类型会强校验,但是内置函数,不会强制校验,下面这几个其实是走的内置函数的实现,所以需要手动增加一下校验
2127
2183
  const { calleeNamespace, calleeName } = node.parentNode.parentNode;
2128
- if ((calleeNamespace === 'nasl.ui' || calleeNamespace === 'nasl.util') && (calleeName === 'showMessage' || calleeName === 'consoleLog' || calleeName === 'jsonSerialize' || calleeName === 'jsonDeserialize')) {
2184
+ if ((calleeNamespace === 'nasl.ui' || calleeNamespace === 'nasl.util') &&
2185
+ (calleeName === 'showMessage' || calleeName === 'consoleLog' || calleeName === 'jsonSerialize' || calleeName === 'jsonDeserialize')) {
2129
2186
  showErr = true;
2130
2187
  }
2131
2188
  }
@@ -2162,23 +2219,23 @@ let NaslServer = class NaslServer {
2162
2219
  const rightType = node.right?.__TypeAnnotation || {};
2163
2220
  // 如果左边节点是 泛型,而且 左边泛型的名字 和 右边一样, 而且是list 或者map 就强制报错
2164
2221
  // 而且右边原来没有报错
2165
- if (leftType.typeKind === 'generic' && leftType.typeKind === rightType.typeKind && leftType.typeName === rightType.typeName && ['Map', 'List'].includes(leftType.typeName)) {
2166
- if (!(node.right.tsErrorDetail) && leftType.sortedTypeKey !== rightType.sortedTypeKey) {
2222
+ if (leftType.typeKind === 'generic' &&
2223
+ leftType.typeKind === rightType.typeKind &&
2224
+ leftType.typeName === rightType.typeName &&
2225
+ ['Map', 'List'].includes(leftType.typeName)) {
2226
+ if (!node.right.tsErrorDetail && leftType.sortedTypeKey !== rightType.sortedTypeKey) {
2167
2227
  const excludeList = [
2168
2228
  'nasl.collection.List<nasl.core.String>',
2169
2229
  'nasl.collection.List<nasl.core.Email>',
2170
2230
  'nasl.collection.Map<nasl.core.String, nasl.core.String>',
2171
2231
  'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
2172
2232
  ];
2173
- const excludeList2 = [
2174
- 'nasl.collection.List<>',
2175
- 'nasl.collection.List<T>',
2176
- ];
2233
+ const excludeList2 = ['nasl.collection.List<>', 'nasl.collection.List<T>'];
2177
2234
  // 先特殊处理等 类型合并后就可以去掉了
2178
2235
  if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
2179
2236
  return null;
2180
2237
  }
2181
- else if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
2238
+ if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
2182
2239
  return null;
2183
2240
  }
2184
2241
  const diagnostic = {
@@ -2215,7 +2272,7 @@ let NaslServer = class NaslServer {
2215
2272
  if (typeKeyArr[0] === 'apis') {
2216
2273
  const structureName = typeKeyArr[3];
2217
2274
  const moduleName = typeKeyArr[1];
2218
- const app = typeAnnotation.upperNode.app;
2275
+ const { app } = typeAnnotation.upperNode;
2219
2276
  if (!app) {
2220
2277
  return null;
2221
2278
  }
@@ -2232,15 +2289,13 @@ let NaslServer = class NaslServer {
2232
2289
  }
2233
2290
  return null;
2234
2291
  }
2235
- else {
2236
- return diag;
2237
- }
2292
+ return diag;
2238
2293
  });
2239
2294
  if (actionArr.length) {
2240
2295
  if (timer)
2241
2296
  return;
2242
2297
  timer = window.setTimeout(() => {
2243
- const app = actionArr[0].target.app;
2298
+ const { app } = actionArr[0].target;
2244
2299
  app.emit('collect:start', {
2245
2300
  actionMsg: '设置导入接口数据类型错误',
2246
2301
  });
@@ -2257,11 +2312,11 @@ let NaslServer = class NaslServer {
2257
2312
  }
2258
2313
  }
2259
2314
  /**
2260
- * 单个问题的诊断处理
2261
- * @param diagnostic 诊断问题
2262
- * @param fileNode 页面节点
2263
- * @returns 处理后的结果
2264
- */
2315
+ * 单个问题的诊断处理
2316
+ * @param diagnostic 诊断问题
2317
+ * @param fileNode 页面节点
2318
+ * @returns 处理后的结果
2319
+ */
2265
2320
  _resolveDiagnostic(diagnostic, fileNode, record) {
2266
2321
  // 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
2267
2322
  if ((fileNode.module || fileNode.connector) && !(fileNode instanceof concepts_1.ConfigProperty)) {
@@ -2295,14 +2350,14 @@ let NaslServer = class NaslServer {
2295
2350
  return result;
2296
2351
  }
2297
2352
  /**
2298
- * 通过节点诊断反过来查找节点
2299
- * @param diagnostic 诊断信息
2300
- * @param fileNode 文件级别节点
2301
- * @returns 找到的节点
2302
- */
2353
+ * 通过节点诊断反过来查找节点
2354
+ * @param diagnostic 诊断信息
2355
+ * @param fileNode 文件级别节点
2356
+ * @returns 找到的节点
2357
+ */
2303
2358
  _findMinRange(diagnostic, fileNode) {
2304
2359
  let minRange;
2305
- const sourceMap = fileNode.sourceMap;
2360
+ const { sourceMap } = fileNode;
2306
2361
  for (const [node, item] of sourceMap.entries()) {
2307
2362
  /**
2308
2363
  * 当前内容的开始行 <= 诊断开始的行 &&
@@ -2313,7 +2368,8 @@ let NaslServer = class NaslServer {
2313
2368
  if ((0, translator_1.lsp2tspNumber)(item.range.start.line) === diagnostic.start.line && (0, translator_1.lsp2tspNumber)(item.range.end.line) === diagnostic.end.line) {
2314
2369
  // 在行的范围但是又不在列的范围,不用给默认值,给了反而不对,
2315
2370
  // 需要在列的范围内
2316
- if ((0, translator_1.lsp2tspNumber)(item.range.start.character) <= diagnostic.start.offset && (0, translator_1.lsp2tspNumber)(item.range.end.character) >= diagnostic.end.offset) {
2371
+ if ((0, translator_1.lsp2tspNumber)(item.range.start.character) <= diagnostic.start.offset &&
2372
+ (0, translator_1.lsp2tspNumber)(item.range.end.character) >= diagnostic.end.offset) {
2317
2373
  // 比列更靠近 ,满足条件且长度更短
2318
2374
  // 如果先走到下面有一个默认值了就像在if for里面有个表达式
2319
2375
  // if for的内容也是包括当前的所以会重新赋值
@@ -2328,17 +2384,16 @@ let NaslServer = class NaslServer {
2328
2384
  if (!minRange) {
2329
2385
  minRange = { node, item };
2330
2386
  }
2331
- else if ((0, translator_1.lsp2tspNumber)(item.range.start.line) === diagnostic.start.line && diagnostic.start.offset >= (0, translator_1.lsp2tspNumber)(item.range.start.character)) {
2387
+ else if ((0, translator_1.lsp2tspNumber)(item.range.start.line) === diagnostic.start.line &&
2388
+ diagnostic.start.offset >= (0, translator_1.lsp2tspNumber)(item.range.start.character)) {
2332
2389
  // 如果当前遍历的内容的行和列都 小于之前的, 而且是有效的
2333
2390
  // 如果两个内容位置行数是一样的,就比较下找到内容的位置信息
2334
2391
  // 找到的内容的开始位置, 要大于申明内容开始的位置,要不就不包含在内了
2335
2392
  if (diagnostic.start.offset - item.range.start.character <= diagnostic.start.offset - minRange.item.range.start.character) {
2336
2393
  minRange = { node, item };
2337
2394
  }
2338
- else {
2339
- if (diagnostic.start.offset < (0, translator_1.lsp2tspNumber)(minRange.item.range.start.character)) {
2340
- minRange = { node, item };
2341
- }
2395
+ else if (diagnostic.start.offset < (0, translator_1.lsp2tspNumber)(minRange.item.range.start.character)) {
2396
+ minRange = { node, item };
2342
2397
  }
2343
2398
  }
2344
2399
  else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
@@ -2373,8 +2428,8 @@ let NaslServer = class NaslServer {
2373
2428
  const { currentSource, fileNode } = this.getCurrentSource(node);
2374
2429
  let refsList = [];
2375
2430
  /**
2376
- * 未完成创建的节点 ,或者异常情况 可能找不到节点
2377
- */
2431
+ * 未完成创建的节点 ,或者异常情况 可能找不到节点
2432
+ */
2378
2433
  if (currentSource) {
2379
2434
  const newRefs = await this.references({
2380
2435
  file: fileNode.getEmbeddedFilePath(),
@@ -2383,23 +2438,21 @@ let NaslServer = class NaslServer {
2383
2438
  });
2384
2439
  refsList = [...newRefs.refs];
2385
2440
  }
2386
- else {
2387
- if (node instanceof concepts_1.Module) {
2388
- const lists = node.logics || node.structures || node.enums;
2389
- const moduleName = fileNode.getEmbeddedFilePath();
2390
- if (lists.length) {
2391
- const item = lists[0];
2392
- const { fileNode } = this.getCurrentSource(item);
2393
- if (fileNode) {
2394
- const newRefs = await this.references({
2395
- file: fileNode.getEmbeddedFilePath(),
2396
- line: 1,
2397
- offset: 22, //固定的位置,module的位置信息
2398
- });
2399
- refsList = newRefs.refs.filter((item) => !item.file.startsWith(moduleName));
2400
- // 多塞一个 ,删除的时候就有值了, 上面过滤了之后可能是空的
2401
- refsList.unshift(newRefs.refs[0]);
2402
- }
2441
+ else if (node instanceof concepts_1.Module) {
2442
+ const lists = node.logics || node.structures || node.enums;
2443
+ const moduleName = fileNode.getEmbeddedFilePath();
2444
+ if (lists.length) {
2445
+ const item = lists[0];
2446
+ const { fileNode } = this.getCurrentSource(item);
2447
+ if (fileNode) {
2448
+ const newRefs = await this.references({
2449
+ file: fileNode.getEmbeddedFilePath(),
2450
+ line: 1,
2451
+ offset: 22, // 固定的位置,module的位置信息
2452
+ });
2453
+ refsList = newRefs.refs.filter((item) => !item.file.startsWith(moduleName));
2454
+ // 多塞一个 ,删除的时候就有值了, 上面过滤了之后可能是空的
2455
+ refsList.unshift(newRefs.refs[0]);
2403
2456
  }
2404
2457
  }
2405
2458
  }
@@ -2410,12 +2463,12 @@ let NaslServer = class NaslServer {
2410
2463
  const dataSourceFile = fileNode.getEmbeddedFilePath();
2411
2464
  const entityFilePrefix = dataSourceFile.replace('.ts', '');
2412
2465
  /**
2413
- * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2414
- * 所以全部过滤掉了,
2415
- * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2416
- * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2417
- * 进行过滤
2418
- */
2466
+ * 特殊处理,因为关联属性或者关联实体等等都是在实体里,在实体中因为自己不可以是自己的类型
2467
+ * 所以全部过滤掉了,
2468
+ * 但是在datasource里面在实体里会有大量的引用,不需要全部修改.只需要处理除了11个函数之外的引用
2469
+ * 所以底部内容是11个函数,所以这里就 用entity的行数 减去11个函数的行数,然后其余的在进行处理
2470
+ * 进行过滤
2471
+ */
2419
2472
  // 不要数据源下面的实体里的引用 ,保留原始的节点内容
2420
2473
  let flag = false;
2421
2474
  if (item.file.includes(entityFilePrefix)) {
@@ -2458,7 +2511,7 @@ let NaslServer = class NaslServer {
2458
2511
  const groupByLength = callQueryComponent.groupBy.filter((item) => item.groupElement?.propertyName && item.groupElement.asName).length;
2459
2512
  if (!groupByLength && !aggregateLength && callQueryComponentTypeAnnotation.typeKind === 'anonymousStructure') {
2460
2513
  // 拿到 List 的泛型(匿名数据结构)的所有属性
2461
- const properties = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0].properties;
2514
+ const { properties } = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0];
2462
2515
  const targetProperty = properties.find((p) => p.name === utils.firstLowerCase(node.name));
2463
2516
  if (!targetProperty) {
2464
2517
  continue;
@@ -2508,7 +2561,7 @@ let NaslServer = class NaslServer {
2508
2561
  if (node instanceof concepts_1.Param && (node.parentNode instanceof concepts_1.View || node.parentNode instanceof concepts_1.Process)) {
2509
2562
  const viewNode = node.parentNode;
2510
2563
  const { currentSource } = this.getCurrentSource(viewNode);
2511
- const code = currentSource.code;
2564
+ const { code } = currentSource;
2512
2565
  const viewIndex = code.indexOf(' {');
2513
2566
  const viewRefs = await this.references({
2514
2567
  file: fileNode.getEmbeddedFilePath(),
@@ -2526,12 +2579,12 @@ let NaslServer = class NaslServer {
2526
2579
  refsList = [...refsList, ...filterViewRefs];
2527
2580
  }
2528
2581
  /**
2529
- * 暂时不要了, 因为生成的结构发生了变化
2530
- * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2531
- * 找到第一个 { 之前的变量 进行修改
2532
- * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2533
- * 最后一个,因为生成的规则不一样
2534
- */
2582
+ * 暂时不要了, 因为生成的结构发生了变化
2583
+ * view 因为不是嵌套的,所以不能用最前面的变量查找,所以要单独处理一下
2584
+ * 找到第一个 { 之前的变量 进行修改
2585
+ * 如果是VIew的查找,比较特殊,他查的是当前抛出的 {} 大括号前的
2586
+ * 最后一个,因为生成的规则不一样
2587
+ */
2535
2588
  // if (node instanceof View) {
2536
2589
  // const code = currentSource.code;
2537
2590
  // const viewIndex = code.indexOf(' {');
@@ -2543,11 +2596,11 @@ let NaslServer = class NaslServer {
2543
2596
  // refsList = [...viewRefs.refs];
2544
2597
  // }
2545
2598
  /**
2546
- * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2547
- */
2599
+ * elements 需要查的是__elements.后面的那个内容,过滤两个为了生成内容的节点
2600
+ */
2548
2601
  if (node instanceof concepts_1.ViewElement) {
2549
2602
  if (currentSource) {
2550
- const code = currentSource.code;
2603
+ const { code } = currentSource;
2551
2604
  const prefix = '__elements.';
2552
2605
  const prefixIndex = code.indexOf(prefix) !== -1 ? code.indexOf(prefix) : 0;
2553
2606
  const methodsNameIndex = prefixIndex + prefix.length;
@@ -2572,7 +2625,7 @@ let NaslServer = class NaslServer {
2572
2625
  }
2573
2626
  if (node instanceof concepts_1.Process) {
2574
2627
  if (currentSource) {
2575
- const code = currentSource.code;
2628
+ const { code } = currentSource;
2576
2629
  const prefix = '__ProcessIdentification__';
2577
2630
  let positions = [];
2578
2631
  let pos = code.indexOf(prefix);
@@ -2597,7 +2650,7 @@ let NaslServer = class NaslServer {
2597
2650
  if ((node instanceof concepts_1.Param || node instanceof concepts_1.Return) && node.parentNode instanceof concepts_1.Process) {
2598
2651
  const { currentSource } = this.getCurrentSource(node.parentNode);
2599
2652
  if (currentSource) {
2600
- const code = currentSource.code;
2653
+ const { code } = currentSource;
2601
2654
  const prefix = '__ProcessIdentification__';
2602
2655
  const positions = [];
2603
2656
  let pos = code.indexOf(prefix);
@@ -2625,7 +2678,7 @@ let NaslServer = class NaslServer {
2625
2678
  }
2626
2679
  if (node instanceof concepts_1.ProcessElement) {
2627
2680
  if (currentSource) {
2628
- const code = currentSource.code;
2681
+ const { code } = currentSource;
2629
2682
  const prefix = '__ProcessIdentification__';
2630
2683
  let positions = [];
2631
2684
  let pos = code.indexOf(prefix);
@@ -2649,7 +2702,7 @@ let NaslServer = class NaslServer {
2649
2702
  if (node instanceof concepts_1.Return && node.parentNode instanceof concepts_1.ProcessElement) {
2650
2703
  const { currentSource } = this.getCurrentSource(node.parentNode);
2651
2704
  if (currentSource) {
2652
- const code = currentSource.code;
2705
+ const { code } = currentSource;
2653
2706
  const prefix = '__ProcessIdentification__';
2654
2707
  const positions = [];
2655
2708
  let pos = code.indexOf(prefix);
@@ -2682,13 +2735,13 @@ let NaslServer = class NaslServer {
2682
2735
  return refsList;
2683
2736
  }
2684
2737
  /**
2685
- * 查找引用,并且做一些 修改前的准备工作,
2686
- * 有引用有的话,就返回集合
2687
- * @param node 当前重命名的节点
2688
- * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2689
- * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2690
- * @returns 找到的引用
2691
- */
2738
+ * 查找引用,并且做一些 修改前的准备工作,
2739
+ * 有引用有的话,就返回集合
2740
+ * @param node 当前重命名的节点
2741
+ * @param newValue 传递过来的新值,给MemberExpression用的比较特殊
2742
+ * 而且,这个新值不一定会用到,MemberExpression在批量更新的时候,可以取到新的value, 这里需要位置信息防止 a.a.a.a 中的一个a发生修改
2743
+ * @returns 找到的引用
2744
+ */
2692
2745
  _renamePrepare(node, refsList, newValue) {
2693
2746
  const oldName = node?.name;
2694
2747
  const result = refsList
@@ -2719,10 +2772,11 @@ let NaslServer = class NaslServer {
2719
2772
  }
2720
2773
  if (minRange.node instanceof concepts_1.CallLogic && node instanceof concepts_1.ViewElement) {
2721
2774
  minRange.setTypeMethods = 'setCalleeNamespace';
2722
- minRange.newValue = 'elements.' + newValue + '.logics';
2775
+ minRange.newValue = `elements.${newValue}.logics`;
2723
2776
  }
2724
2777
  // 如果节点是实体修改引发calllogic修改
2725
- if (minRange.node instanceof concepts_1.CallLogic && (node instanceof concepts_1.Entity || node instanceof concepts_1.View || node instanceof concepts_1.Process || node instanceof concepts_1.ProcessElement)) {
2778
+ if (minRange.node instanceof concepts_1.CallLogic &&
2779
+ (node instanceof concepts_1.Entity || node instanceof concepts_1.View || node instanceof concepts_1.Process || node instanceof concepts_1.ProcessElement)) {
2726
2780
  // 匹配到的内容,当前这一行的内容;
2727
2781
  // 因为要用下面的点位信息
2728
2782
  /**
@@ -2735,9 +2789,9 @@ let NaslServer = class NaslServer {
2735
2789
  * 3.然后把namespace中的 $替换成 ''
2736
2790
  *
2737
2791
  */
2738
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
2792
+ const { tsCalleeNamespace } = minRange.node;
2739
2793
  // 先看下标位置
2740
- const lineText = record.lineText;
2794
+ const { lineText } = record;
2741
2795
  const index = lineText.indexOf(tsCalleeNamespace);
2742
2796
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
2743
2797
  const start = record.start.offset - index - 1;
@@ -2772,12 +2826,12 @@ let NaslServer = class NaslServer {
2772
2826
  if (minRange.node instanceof concepts_1.Identifier) {
2773
2827
  // 匹配到的内容,当前这一行的内容;
2774
2828
  // 因为要用下面的点位信息
2775
- const name = minRange.node.name;
2829
+ const { name } = minRange.node;
2776
2830
  // 如果name不改,那就是要改命名空间
2777
2831
  if (node instanceof concepts_1.Frontend || newValue === name) {
2778
- const namespace = minRange.node.namespace;
2832
+ const { namespace } = minRange.node;
2779
2833
  // 先看下标位置
2780
- const lineText = record.lineText;
2834
+ const { lineText } = record;
2781
2835
  const index = lineText.indexOf(namespace);
2782
2836
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
2783
2837
  const start = record.start.offset - index - 1;
@@ -2809,7 +2863,7 @@ let NaslServer = class NaslServer {
2809
2863
  // 枚举key的特殊性,因为它不是原来的key+value形式的
2810
2864
  // 是加了中括号啥的,所以直接赋值新值
2811
2865
  if (node instanceof concepts_1.EnumItem) {
2812
- const newTextValue = node.parentNode.name + '.' + newValue;
2866
+ const newTextValue = `${node.parentNode.name}.${newValue}`;
2813
2867
  minRange.newValue = newTextValue;
2814
2868
  }
2815
2869
  else {
@@ -2834,7 +2888,7 @@ let NaslServer = class NaslServer {
2834
2888
  minRange.setTypeMethods = 'setRelationEntity';
2835
2889
  }
2836
2890
  else if (minRange.node instanceof concepts_1.QueryFieldExpression) {
2837
- if (minRange.node.parentKey === "selectElements") {
2891
+ if (minRange.node.parentKey === 'selectElements') {
2838
2892
  minRange.setTypeMethods = 'setEntityAsNameAndEffect';
2839
2893
  }
2840
2894
  else {
@@ -2849,7 +2903,7 @@ let NaslServer = class NaslServer {
2849
2903
  }
2850
2904
  else if (minRange.node instanceof concepts_1.BindAttribute && minRange.node.name === 'url') {
2851
2905
  // 如果是查找到 上传地址的链接引用
2852
- let newName = newValue.replace(/[A-Z]/g, (item) => '-' + item.toLowerCase());
2906
+ let newName = newValue.replace(/[A-Z]/g, (item) => `-${item.toLowerCase()}`);
2853
2907
  newName = newName[0] === '-' ? newName.slice(1) : newName;
2854
2908
  const newTextValue = node.parentNode.name === 'defaultDS' ? `/api/${newName}/import` : `/api/${node.parentNode.name}/${newName}/import`;
2855
2909
  minRange.setTypeMethods = 'setUrlValue';
@@ -2860,7 +2914,9 @@ let NaslServer = class NaslServer {
2860
2914
  }
2861
2915
  }
2862
2916
  // 如果是修改实体属性,要同步实体属性
2863
- if (minRange.node instanceof concepts_1.EntityProperty && node instanceof concepts_1.EntityProperty && record.lineText.includes('@nasl.annotation.EntityRelation')) {
2917
+ if (minRange.node instanceof concepts_1.EntityProperty &&
2918
+ node instanceof concepts_1.EntityProperty &&
2919
+ record.lineText.includes('@nasl.annotation.EntityRelation')) {
2864
2920
  minRange.setTypeMethods = 'setRelationProperty';
2865
2921
  }
2866
2922
  // 如果要修改索引的
@@ -2887,11 +2943,11 @@ let NaslServer = class NaslServer {
2887
2943
  * 3.然后把namespace中的 $替换成 ''
2888
2944
  *
2889
2945
  */
2890
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
2891
- const tsName = minRange.node.tsName;
2892
- const oldValue = tsCalleeNamespace + '.' + tsName;
2946
+ const { tsCalleeNamespace } = minRange.node;
2947
+ const { tsName } = minRange.node;
2948
+ const oldValue = `${tsCalleeNamespace}.${tsName}`;
2893
2949
  // 先看下标位置
2894
- const lineText = record.lineText;
2950
+ const { lineText } = record;
2895
2951
  const index = lineText.indexOf(oldValue);
2896
2952
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
2897
2953
  const start = record.start.offset - index - 1;
@@ -2909,11 +2965,11 @@ let NaslServer = class NaslServer {
2909
2965
  }
2910
2966
  }
2911
2967
  if (node instanceof concepts_1.Frontend && minRange.node instanceof concepts_1.Destination) {
2912
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
2913
- const tsName = minRange.node.tsName;
2914
- const oldValue = tsCalleeNamespace + '.' + tsName;
2968
+ const { tsCalleeNamespace } = minRange.node;
2969
+ const { tsName } = minRange.node;
2970
+ const oldValue = `${tsCalleeNamespace}.${tsName}`;
2915
2971
  // 先看下标位置
2916
- const lineText = record.lineText;
2972
+ const { lineText } = record;
2917
2973
  const index = lineText.indexOf(oldValue);
2918
2974
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
2919
2975
  const start = record.start.offset - index - 1;
@@ -2933,7 +2989,7 @@ let NaslServer = class NaslServer {
2933
2989
  // 页面逻辑直接赋值就可以, 因为是相对路径
2934
2990
  if (node instanceof concepts_1.ViewElement) {
2935
2991
  minRange.setTypeMethods = 'setCalleeNamespace';
2936
- minRange.newValue = 'elements.' + newValue + '.logics';
2992
+ minRange.newValue = `elements.${newValue}.logics`;
2937
2993
  }
2938
2994
  else {
2939
2995
  /**
@@ -2945,10 +3001,10 @@ let NaslServer = class NaslServer {
2945
3001
  * 2.在匹配到的内容中取转后的namespace的位置
2946
3002
  * 3.然后把namespace中的 $替换成 ''
2947
3003
  */
2948
- const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
3004
+ const { tsCalleeNamespace } = minRange.node;
2949
3005
  const oldValue = tsCalleeNamespace;
2950
3006
  // 先看下标位置
2951
- const lineText = record.lineText;
3007
+ const { lineText } = record;
2952
3008
  const index = lineText.indexOf(oldValue);
2953
3009
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
2954
3010
  const start = record.start.offset - index - 1;
@@ -3011,7 +3067,7 @@ let NaslServer = class NaslServer {
3011
3067
  if (node instanceof concepts_1.DataSource) {
3012
3068
  const setTypeNamespace = (typeNamespace, record) => {
3013
3069
  // 先看下标位置
3014
- const lineText = record.lineText;
3070
+ const { lineText } = record;
3015
3071
  const index = lineText.indexOf(typeNamespace);
3016
3072
  // 在把开始结束位置的-开始位置,来知道是哪里要替换
3017
3073
  const start = record.start.offset - index - 1;
@@ -3055,8 +3111,8 @@ let NaslServer = class NaslServer {
3055
3111
  minRange.setTypeMethods = 'setPropertyName';
3056
3112
  }
3057
3113
  // 如果跳转链接或者页面变量同一个param和TypeAnnotation 有两个过滤掉一个
3058
- if ((minRange.node instanceof concepts_1.Param || minRange.node instanceof concepts_1.Variable || minRange.node instanceof concepts_1.Return)
3059
- && (node instanceof concepts_1.Entity || node instanceof concepts_1.Enum || node instanceof concepts_1.Structure)) {
3114
+ if ((minRange.node instanceof concepts_1.Param || minRange.node instanceof concepts_1.Variable || minRange.node instanceof concepts_1.Return) &&
3115
+ (node instanceof concepts_1.Entity || node instanceof concepts_1.Enum || node instanceof concepts_1.Structure)) {
3060
3116
  return null;
3061
3117
  }
3062
3118
  if (minRange.node instanceof concepts_1.Destination && (node instanceof concepts_1.Process || node instanceof concepts_1.ProcessElement)) {
@@ -3078,11 +3134,11 @@ let NaslServer = class NaslServer {
3078
3134
  minRange.setTypeMethods = 'setKeyword';
3079
3135
  }
3080
3136
  /**
3081
- * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
3082
- * 流程改名不触发Logic改名
3083
- * 如果是修改param查找到logic就不操作
3084
- * 除非想在内部修改别的内容所以暂时屏蔽掉
3085
- */
3137
+ * 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
3138
+ * 流程改名不触发Logic改名
3139
+ * 如果是修改param查找到logic就不操作
3140
+ * 除非想在内部修改别的内容所以暂时屏蔽掉
3141
+ */
3086
3142
  if (minRange.node instanceof concepts_1.Logic && node !== minRange.node) {
3087
3143
  return null;
3088
3144
  }
@@ -3137,7 +3193,7 @@ let NaslServer = class NaslServer {
3137
3193
  if (a.node.concept === 'QueryFieldExpression') {
3138
3194
  return 1;
3139
3195
  }
3140
- else if (b.node.concept === 'QueryFieldExpression') {
3196
+ if (b.node.concept === 'QueryFieldExpression') {
3141
3197
  return -1;
3142
3198
  }
3143
3199
  return 0;
@@ -3334,11 +3390,11 @@ let NaslServer = class NaslServer {
3334
3390
  return treeNodeMap;
3335
3391
  }
3336
3392
  /**
3337
- * 处理tree的队列,把相同节点进行合并
3338
- * 这里把当前二维数组进行一个整合
3339
- * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3340
- * @returns 最后要使用到的节点和对应的子集
3341
- */
3393
+ * 处理tree的队列,把相同节点进行合并
3394
+ * 这里把当前二维数组进行一个整合
3395
+ * @param arr 当前页面下的queue的二维数组,一个数组下有多条链路
3396
+ * @returns 最后要使用到的节点和对应的子集
3397
+ */
3342
3398
  handleTreeQueue(queueLists) {
3343
3399
  const map = new Map();
3344
3400
  let root = null;
@@ -3366,11 +3422,11 @@ let NaslServer = class NaslServer {
3366
3422
  return children;
3367
3423
  }
3368
3424
  /**
3369
- * 递归调用输出结果
3370
- * @param root 一个根节点
3371
- * @param map 当前所有节点的map对象
3372
- * @returns 当前节点,最后输出所有节点
3373
- */
3425
+ * 递归调用输出结果
3426
+ * @param root 一个根节点
3427
+ * @param map 当前所有节点的map对象
3428
+ * @returns 当前节点,最后输出所有节点
3429
+ */
3374
3430
  _recursionCreateResult(root, map) {
3375
3431
  const children = (map.get(root) || []).map((item) => this._recursionCreateResult(item, map));
3376
3432
  if (children && children.length) {
@@ -3379,27 +3435,27 @@ let NaslServer = class NaslServer {
3379
3435
  return root;
3380
3436
  }
3381
3437
  /**
3382
- * 获取
3383
- * 当前this上下文 的Source 和 父级文件级别的节点
3384
- */
3438
+ * 获取
3439
+ * 当前this上下文 的Source 和 父级文件级别的节点
3440
+ */
3385
3441
  getCurrentSource(node) {
3386
3442
  if (node instanceof concepts_1.App || node instanceof concepts_1.Theme)
3387
3443
  return { fileNode: null };
3388
- let sourceMap = node.sourceMap;
3444
+ let { sourceMap } = node;
3389
3445
  let fileNode = node;
3390
3446
  // 如果没有sourceMap,就继续向上找 ,或者到module结束
3391
3447
  // 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
3392
3448
  // 如果当前节点是view就不要向上查找了
3393
3449
  // 配置参数的ConfigProperty也不需要向上找
3394
- while (!sourceMap
3395
- && fileNode
3396
- && !(fileNode.parentNode instanceof concepts_1.App)
3397
- && !(fileNode.parentNode instanceof concepts_1.Module)
3398
- && !(fileNode.parentNode instanceof concepts_1.DataSource)
3399
- && !(fileNode.parentNode instanceof concepts_1.Frontend)
3400
- && !(fileNode.parentNode instanceof concepts_1.Backend)
3401
- && !(fileNode instanceof concepts_1.View)
3402
- && !(fileNode instanceof concepts_1.ConfigProperty)) {
3450
+ while (!sourceMap &&
3451
+ fileNode &&
3452
+ !(fileNode.parentNode instanceof concepts_1.App) &&
3453
+ !(fileNode.parentNode instanceof concepts_1.Module) &&
3454
+ !(fileNode.parentNode instanceof concepts_1.DataSource) &&
3455
+ !(fileNode.parentNode instanceof concepts_1.Frontend) &&
3456
+ !(fileNode.parentNode instanceof concepts_1.Backend) &&
3457
+ !(fileNode instanceof concepts_1.View) &&
3458
+ !(fileNode instanceof concepts_1.ConfigProperty)) {
3403
3459
  fileNode = fileNode.parentNode;
3404
3460
  sourceMap = fileNode?.sourceMap;
3405
3461
  }
@@ -3432,9 +3488,7 @@ let NaslServer = class NaslServer {
3432
3488
  getFieldKey: fieldKey,
3433
3489
  });
3434
3490
  }
3435
- else {
3436
- console.log('没找到节点', currentSource, fileNode);
3437
- }
3491
+ console.log('没找到节点', currentSource, fileNode);
3438
3492
  }
3439
3493
  _getFieldKeySelectCompletion(args) {
3440
3494
  return this.messager.requestCommand('getFieldKeySelectCompletion', args);
@@ -3482,12 +3536,15 @@ let NaslServer = class NaslServer {
3482
3536
  });
3483
3537
  return [...fileNodes];
3484
3538
  }
3485
- /**获取当前节点的已知类型
3486
- * @param node 当前要获取类型的节点
3487
- * @returns 不需要去查就可以返回类型的节点
3488
- */
3539
+ /** 获取当前节点的已知类型
3540
+ * @param node 当前要获取类型的节点
3541
+ * @returns 不需要去查就可以返回类型的节点
3542
+ */
3489
3543
  getCurrentNodeKnownTypeAnnotation(node) {
3490
- if (node.concept === 'StringLiteral' || node.concept === 'StringInterpolation' || node.concept === 'BooleanLiteral' || node.concept === 'NullLiteral') {
3544
+ if (node.concept === 'StringLiteral' ||
3545
+ node.concept === 'StringInterpolation' ||
3546
+ node.concept === 'BooleanLiteral' ||
3547
+ node.concept === 'NullLiteral') {
3491
3548
  let type = 'String';
3492
3549
  switch (node.concept) {
3493
3550
  case 'NullLiteral':
@@ -3500,17 +3557,17 @@ let NaslServer = class NaslServer {
3500
3557
  return concepts_1.TypeAnnotation.createPrimitive(type);
3501
3558
  }
3502
3559
  // 这些原有类型的 比较的 返回值肯定就是布尔值,就不去调用ls
3503
- if (node instanceof concepts_1.BinaryExpression && (['==', '!=', '>', '<', '>=', '<='].includes(node.operator))) {
3560
+ if (node instanceof concepts_1.BinaryExpression && ['==', '!=', '>', '<', '>=', '<='].includes(node.operator)) {
3504
3561
  return concepts_1.TypeAnnotation.createPrimitive('Boolean');
3505
3562
  }
3506
3563
  // Convert和new都是自身携带类型的,就不进行修改
3507
- if (node instanceof concepts_1.CallFunction && node.calleeNamespace === 'nasl.util' && (['Convert', 'New', 'FromString'].includes(node.calleeName))) {
3564
+ if (node instanceof concepts_1.CallFunction && node.calleeNamespace === 'nasl.util' && ['Convert', 'New', 'FromString'].includes(node.calleeName)) {
3508
3565
  if (node.typeArguments.length) {
3509
3566
  return node.typeArguments[0];
3510
3567
  }
3511
3568
  }
3512
3569
  // Convert和new都是自身携带类型的,就不进行修改
3513
- if (node instanceof concepts_1.CallLogic && node.calleeNamespace === 'nasl.util' && (node.calleeName === 'jsonDeserialize')) {
3570
+ if (node instanceof concepts_1.CallLogic && node.calleeNamespace === 'nasl.util' && node.calleeName === 'jsonDeserialize') {
3514
3571
  if (node.typeArguments.length) {
3515
3572
  return node.typeArguments[0];
3516
3573
  }
@@ -3548,7 +3605,7 @@ let NaslServer = class NaslServer {
3548
3605
  // 总共要返回出去的
3549
3606
  const types = new Map();
3550
3607
  const newQuickInfoNodes = [];
3551
- nodes.forEach((itemDetail) => {
3608
+ await utils.timeSlicing(nodes, (itemDetail) => {
3552
3609
  const { node, filePath, item } = itemDetail;
3553
3610
  // 先按照顺序占位
3554
3611
  types.set(node, null);
@@ -3559,23 +3616,16 @@ let NaslServer = class NaslServer {
3559
3616
  return;
3560
3617
  }
3561
3618
  // 要通过自己或者依赖关系拿的,二次遍历
3562
- if ([
3563
- 'Argument',
3564
- 'Assignment',
3565
- 'MatchCase',
3566
- ].includes(node.concept)) {
3619
+ if (['Argument', 'Assignment', 'MatchCase'].includes(node.concept)) {
3567
3620
  getFromOthers.set(node, null);
3568
3621
  }
3569
- if ([
3570
- 'Return',
3571
- 'Variable',
3572
- ].includes(node.concept) && node.typeAnnotation) {
3622
+ if (['Return', 'Variable'].includes(node.concept) && node.typeAnnotation) {
3573
3623
  types.set(node, node.typeAnnotation);
3574
3624
  return;
3575
3625
  }
3576
3626
  // 如果 入参不是虚拟节点的,就不去请求类型
3577
3627
  // 只有虚拟节点的入参,才没有类型
3578
- if (node.concept === 'Param' && node.parentKey !== 'virtualParams') {
3628
+ if (node.concept === 'Param' && node.parentKey !== 'virtualParams' && node.parentKey !== 'item') {
3579
3629
  return;
3580
3630
  }
3581
3631
  if (![
@@ -3611,11 +3661,12 @@ let NaslServer = class NaslServer {
3611
3661
  offset: (0, translator_1.lsp2tspNumber)(item.range.start.character),
3612
3662
  };
3613
3663
  // 位置计算偏移
3614
- if (node.concept === 'CallLogic' && node.useIife) {
3615
- fileDetail.line += 2;
3616
- fileDetail.offset = 8;
3664
+ if ('getQuickInfoOffset' in node) {
3665
+ Object.assign(fileDetail, node.getQuickInfoOffset(fileDetail, item.code));
3617
3666
  }
3618
- else if (node.concept === 'BinaryExpression' ||
3667
+ // 位置计算偏移2
3668
+ // TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
3669
+ if (node.concept === 'BinaryExpression' ||
3619
3670
  node.concept === 'CallLogic' ||
3620
3671
  node.concept === 'CallFunction' ||
3621
3672
  node.concept === 'CallInterface') {
@@ -3638,15 +3689,18 @@ let NaslServer = class NaslServer {
3638
3689
  const lastLen = codeArr?.[codeArr.length - 1]?.length;
3639
3690
  indexOf = subStr.length - lastLen;
3640
3691
  }
3641
- fileDetail.offset = fileDetail.offset + indexOf;
3692
+ fileDetail.offset += indexOf;
3642
3693
  }
3643
- else if (node.concept === 'MemberExpression' || node.concept === 'Identifier' || node.concept === 'QueryFieldExpression' || node.concept === 'QueryGroupByExpression') {
3694
+ else if (node.concept === 'MemberExpression' ||
3695
+ node.concept === 'Identifier' ||
3696
+ node.concept === 'QueryFieldExpression' ||
3697
+ node.concept === 'QueryGroupByExpression') {
3644
3698
  if (item.code.includes('.')) {
3645
3699
  const codeArr = item.code?.split('.');
3646
3700
  const lastLen = codeArr?.[codeArr.length - 1]?.length;
3647
3701
  // MemberExpression取最后一位当做类型
3648
3702
  const indexOf = item.code.length - lastLen;
3649
- fileDetail.offset = fileDetail.offset + indexOf;
3703
+ fileDetail.offset += indexOf;
3650
3704
  }
3651
3705
  }
3652
3706
  else if (node.concept === 'Match') {
@@ -3673,27 +3727,17 @@ let NaslServer = class NaslServer {
3673
3727
  fileDetail.offset += 10;
3674
3728
  }
3675
3729
  args.push(fileDetail);
3676
- });
3677
- // console.time('请求');
3730
+ }, { minimum: 1000 });
3678
3731
  const resultMap = (await this.getNaslNodeTypeFull(args))?.response;
3679
- // console.timeEnd('请求');
3680
- // console.log(resultMap);
3681
- // const result = (await this.getNaslNodeQuickInfoFull(args)).response;
3682
- // console.log(result);
3683
- args.forEach((arg, index) => {
3684
- const { file, line, offset } = arg;
3732
+ await utils.timeSlicing(args, ({ file, line, offset }, index) => {
3685
3733
  const item = resultMap?.[file]?.[line]?.[offset];
3686
- //const displayString1 = resule1[index]?.displayString;
3687
- // console.log('位置:', file, line, offset);
3688
- // console.log('原始:', displayString);
3689
- // console.log('方案2:', item?.[0]?.nodeType);
3690
- const nodeTypeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(item?.[0]?.nodeType);
3691
- // console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
3692
- types.set(newQuickInfoNodes[index].node, Object.freeze(nodeTypeAnnotation));
3693
- newQuickInfoNodes[index].node.__nodeType = Object.freeze(item?.[0]?.nodeType);
3694
- // console.log('方案1:', displayString1);
3734
+ const itemType = item?.[0]?.nodeType;
3735
+ const nodeTypeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(itemType);
3736
+ const { node } = newQuickInfoNodes[index];
3737
+ types.set(node, Object.freeze(nodeTypeAnnotation));
3738
+ node.__nodeType = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
3695
3739
  });
3696
- getFromOthers.forEach((type, node) => {
3740
+ await utils.timeSlicing(Array.from(getFromOthers.entries()), ([node]) => {
3697
3741
  if (node instanceof concepts_1.Assignment) {
3698
3742
  if (!types.get(node.left)) {
3699
3743
  types.set(node.left, types.get(node.right));
@@ -3715,8 +3759,7 @@ let NaslServer = class NaslServer {
3715
3759
  }
3716
3760
  }
3717
3761
  });
3718
- // 重置类型状态, 并且赋值
3719
- types.forEach((value, node) => {
3762
+ await utils.timeSlicing(Array.from(types.entries()), ([node, value]) => {
3720
3763
  try {
3721
3764
  // 因为node可能是经过处理的TypeAnnotation
3722
3765
  node.__isCorrectTypeAnnotation = true;
@@ -3726,7 +3769,7 @@ let NaslServer = class NaslServer {
3726
3769
  const typeAnnotation = value;
3727
3770
  if (!node.typeAnnotation && typeAnnotation) {
3728
3771
  if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
3729
- const typeArguments = typeAnnotation.typeArguments;
3772
+ const { typeArguments } = typeAnnotation;
3730
3773
  if (typeArguments.length && typeArguments[0].isComplexType()) {
3731
3774
  node.__TypeAnnotation = null;
3732
3775
  return;
@@ -3752,53 +3795,6 @@ let NaslServer = class NaslServer {
3752
3795
  }
3753
3796
  }
3754
3797
  });
3755
- // newQuickInfoNodes.forEach((itemDetail, index) => {
3756
- // const { node, filePath } = itemDetail;
3757
- // if (!result[index] || node.concept === 'Argument')
3758
- // return;
3759
- // // console.log(result[index].displayString, node);
3760
- // /**
3761
- // * 这个前缀是给会自动省略命名空间的内容设置的,下个版本干掉,应急的方法
3762
- // */
3763
- // let parentPrefix;
3764
- // if (filePath && (filePath.split('/').length > 3)) {
3765
- // const arr = filePath.split('/');
3766
- // if (arr[3] === 'dependencies' || arr[3] === 'interfaceDependencies' || arr[3] === 'componentDependencies') {
3767
- // const map = {
3768
- // dependencies: 'extensions',
3769
- // interfaceDependencies: 'apis',
3770
- // componentDependencies: 'components',
3771
- // };
3772
- // parentPrefix = `${map[arr[3]]}.${arr[4]}.`;
3773
- // }
3774
- // }
3775
- // const nodeTypeAnnotation = displayString2TypeAnnotation(result[index].displayString, parentPrefix);
3776
- // // console.log(result[index].displayString, items[index], '************', typeAnnotation);
3777
- // // console.log(node, index, items[index].code, result[index].displayString, '+++++++++++++++++++++++++++', typeAnnotation && typeAnnotation.typeKey)
3778
- // try {
3779
- // types.set(node, nodeTypeAnnotation);
3780
- // /**
3781
- // * 没有类型标注的情况
3782
- // * 1.void 没有返回值
3783
- // * 2.Argment
3784
- // */
3785
- // // if (!typeAnnotation) {
3786
- // // console.log(items[index].code, jsonNode, result[index]);
3787
- // // console.log(result[index].displayString)
3788
- // // }
3789
- // } catch (e) {
3790
- // console.log(node, node.getNodePath(false));
3791
- // }
3792
- // });
3793
- // // Argument的标注,因为这个位置上可能放任何东西所以直接在其内部去取
3794
- // newQuickInfoNodes.forEach((itemDetail, index) => {
3795
- // const { node } = itemDetail;
3796
- // if (node instanceof Argument) {
3797
- // // 如果Argument,但是没可以用的类型,就用原来logic的参数类型
3798
- // const argType = this.getArgumentTypeAnnotation(node, newQuickInfoNodes, result, (types as any));
3799
- // types.set(node, argType);
3800
- // }
3801
- // });
3802
3798
  return types;
3803
3799
  }
3804
3800
  // 全量标注并且返回json
@@ -3821,9 +3817,7 @@ let NaslServer = class NaslServer {
3821
3817
  });
3822
3818
  console.time('全量标注');
3823
3819
  const typesMap = await this.getQuickInfoNodesTypeMap(nodes, true);
3824
- // console.log(typesMap, 'typesMap')
3825
3820
  console.timeEnd('全量标注');
3826
- //console.log('一共处理节点数:', types.size);
3827
3821
  const json = app.toJSON();
3828
3822
  if (releaseFlag) {
3829
3823
  // 全量标注后对json进行一些修改,为了服务端翻译处理
@@ -3842,13 +3836,14 @@ let NaslServer = class NaslServer {
3842
3836
  record.id = fileNode.id;
3843
3837
  record.node = fileNode;
3844
3838
  if (!['Structure', 'DataSource', 'Entity', 'Enum', 'Role'].includes(fileNode.concept)) {
3845
- fileNode.sourceMap && fileNode.sourceMap.forEach((item, nodeItem) => {
3846
- nodes.push({
3847
- filePath: record.filePath,
3848
- node: nodeItem,
3849
- item,
3839
+ fileNode.sourceMap &&
3840
+ fileNode.sourceMap.forEach((item, nodeItem) => {
3841
+ nodes.push({
3842
+ filePath: record.filePath,
3843
+ node: nodeItem,
3844
+ item,
3845
+ });
3850
3846
  });
3851
- });
3852
3847
  }
3853
3848
  });
3854
3849
  await this.getQuickInfoNodesTypeMap(nodes);
@@ -3882,7 +3877,8 @@ let NaslServer = class NaslServer {
3882
3877
  typeArguments: [],
3883
3878
  inferred: false,
3884
3879
  ruleMap: null,
3885
- properties: [{
3880
+ properties: [
3881
+ {
3886
3882
  concept: 'StructureProperty',
3887
3883
  name: 'list',
3888
3884
  label: null,
@@ -3897,7 +3893,8 @@ let NaslServer = class NaslServer {
3897
3893
  },
3898
3894
  required: null,
3899
3895
  defaultValue: null,
3900
- }, {
3896
+ },
3897
+ {
3901
3898
  concept: 'StructureProperty',
3902
3899
  name: 'total',
3903
3900
  label: null,
@@ -3912,7 +3909,8 @@ let NaslServer = class NaslServer {
3912
3909
  },
3913
3910
  required: null,
3914
3911
  defaultValue: null,
3915
- }],
3912
+ },
3913
+ ],
3916
3914
  };
3917
3915
  }
3918
3916
  // 特殊处理param有类型错误的
@@ -3925,7 +3923,8 @@ let NaslServer = class NaslServer {
3925
3923
  }
3926
3924
  if (node instanceof concepts_1.Match) {
3927
3925
  const matchExpression = node.expression;
3928
- if (matchExpression?.__TypeAnnotation?.typeKind === 'union' && (matchExpression instanceof concepts_1.Identifier || matchExpression instanceof concepts_1.MemberExpression)) {
3926
+ if (matchExpression?.__TypeAnnotation?.typeKind === 'union' &&
3927
+ (matchExpression instanceof concepts_1.Identifier || matchExpression instanceof concepts_1.MemberExpression)) {
3929
3928
  const { currentSource, fileNode } = matchExpression?.getCurrentSource();
3930
3929
  fileNode.sourceMap.forEach((item, itemNode) => {
3931
3930
  if (itemNode.concept === matchExpression.concept && item.code === currentSource.code) {
@@ -3950,13 +3949,16 @@ let NaslServer = class NaslServer {
3950
3949
  });
3951
3950
  }
3952
3951
  /**
3953
- * 获取getArgument的参数位的类型
3954
- * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3955
- * 获取logic的默认值和原来Arg的类型和默认值对应
3956
- */
3952
+ * 获取getArgument的参数位的类型
3953
+ * 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
3954
+ * 获取logic的默认值和原来Arg的类型和默认值对应
3955
+ */
3957
3956
  getArgumentTypeAnnotation(node, QuickInfoNodes, types) {
3958
3957
  // 直接复用内部expression的type类型
3959
- if (node.parentNode instanceof concepts_1.CallLogic && node.parentNode.calleeNamespace?.includes('entities') && node.parentNode.calleeNamespace?.includes('logics') && node.parentNode.calleeName === 'delete') {
3958
+ if (node.parentNode instanceof concepts_1.CallLogic &&
3959
+ node.parentNode.calleeNamespace?.includes('entities') &&
3960
+ node.parentNode.calleeNamespace?.includes('logics') &&
3961
+ node.parentNode.calleeName === 'delete') {
3960
3962
  const nodeType = node.parentNode?.__nodeType;
3961
3963
  if (nodeType && Array.isArray(nodeType.fnParams)) {
3962
3964
  const index = node.parentNode.arguments.indexOf(node);
@@ -3972,7 +3974,7 @@ let NaslServer = class NaslServer {
3972
3974
  }
3973
3975
  // 获取返回值结果里找到父级的callLogic || CallInterface的类型填充进去Argument
3974
3976
  const App = node.app;
3975
- const parent = (node.parentNode);
3977
+ const parent = node.parentNode;
3976
3978
  // 如果nasl包下的 ,很多声明都含有T啥的先用自己内部的
3977
3979
  if (!parent.calleeNamespace || parent.calleeNamespace?.startsWith('nasl')) {
3978
3980
  if (types.get(node.expression)) {
@@ -3983,7 +3985,7 @@ let NaslServer = class NaslServer {
3983
3985
  }
3984
3986
  }
3985
3987
  // 用户自己声明的用用户的
3986
- const callObj = App.findNodeByCompleteName(parent.calleeNamespace + '.' + parent.calleeName);
3988
+ const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace}.${parent.calleeName}`);
3987
3989
  const index = parent.arguments.indexOf(node);
3988
3990
  const param = callObj?.params?.[index] || {};
3989
3991
  // 取出参数的类型
@@ -4075,8 +4077,8 @@ let NaslServer = class NaslServer {
4075
4077
  const filePath = fileNode.getEmbeddedFilePath();
4076
4078
  // 如果要删除,而且当前要删Logic就直接删除并且清除错误
4077
4079
  /**
4078
- * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
4079
- */
4080
+ * 删除节点中的一个内容,删除了以后,就查一下引用的地方一起查一下异常
4081
+ */
4080
4082
  let outputFiles = [];
4081
4083
  // 删除之前先查一下内容的依赖
4082
4084
  const newRefs = await this.references({
@@ -4136,18 +4138,20 @@ let NaslServer = class NaslServer {
4136
4138
  node: fileNode,
4137
4139
  icon: 'success',
4138
4140
  };
4139
- (0, common_1.invokeCommand)('tsConfirm.open', confirmParms, () => { });
4141
+ (0, common_1.invokeCommand)('tsConfirm.open', confirmParms, () => {
4142
+ // ..
4143
+ });
4140
4144
  }
4141
4145
  }
4142
4146
  }
4143
4147
  /**
4144
- * 重命名的更新
4145
- * @param fileNode 文件级别的节点
4146
- * @param targetNode 触发修改的节点
4147
- * @param result 生成代码的code 和位置信息
4148
- * @param isRename 是不是修改名字
4149
- * @param oldFilePath 如果是改名,文件级别的才会有这个参数,用于文件新增替换
4150
- */
4148
+ * 重命名的更新
4149
+ * @param fileNode 文件级别的节点
4150
+ * @param targetNode 触发修改的节点
4151
+ * @param result 生成代码的code 和位置信息
4152
+ * @param isRename 是不是修改名字
4153
+ * @param oldFilePath 如果是改名,文件级别的才会有这个参数,用于文件新增替换
4154
+ */
4151
4155
  async handleRename(fileNode, targetNode, result, oldFilePath) {
4152
4156
  // rename 场景
4153
4157
  const outputFiles = [{ file: result.filePath, fileContent: result.code }];
@@ -4241,7 +4245,7 @@ let NaslServer = class NaslServer {
4241
4245
  */
4242
4246
  async incidentalAction(action, fileNode, targetNode, oldpath) {
4243
4247
  if ((action === 'create' || action === 'delete' || (action === 'update' && oldpath)) && fileNode === targetNode) {
4244
- //删除、更改、新增端
4248
+ // 删除、更改、新增端
4245
4249
  if (fileNode instanceof concepts_1.Frontend && (fileNode.views?.length || fileNode.variables?.length)) {
4246
4250
  const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
4247
4251
  for (let i = 0; i < fileNodeChildren.length; i++) {
@@ -4259,7 +4263,7 @@ let NaslServer = class NaslServer {
4259
4263
  else if (action === 'update' && oldpath) {
4260
4264
  const parentPath = oldpath.replace('.ts', '/');
4261
4265
  const foldName = fileNodeItem.concept === 'View' ? 'views' : 'variables';
4262
- const currentOldPath = parentPath + foldName + '/' + fileNodeItem.name + '.ts';
4266
+ const currentOldPath = `${parentPath + foldName}/${fileNodeItem.name}.ts`;
4263
4267
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4264
4268
  await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
4265
4269
  await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
@@ -4283,7 +4287,7 @@ let NaslServer = class NaslServer {
4283
4287
  }
4284
4288
  else if (action === 'update' && oldpath) {
4285
4289
  const parentPath = oldpath.replace('.ts', '/');
4286
- const currentOldPath = parentPath + fileNodeItem.name + '.ts';
4290
+ const currentOldPath = `${parentPath + fileNodeItem.name}.ts`;
4287
4291
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4288
4292
  await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
4289
4293
  await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
@@ -4321,14 +4325,14 @@ let NaslServer = class NaslServer {
4321
4325
  }
4322
4326
  }
4323
4327
  /**
4324
- * DataSource只会重命名时候,需要把子集全部重新生成一下
4325
- */
4328
+ * DataSource只会重命名时候,需要把子集全部重新生成一下
4329
+ */
4326
4330
  if (fileNode instanceof concepts_1.DataSource) {
4327
4331
  fileNode.entities.forEach(async (entity) => {
4328
4332
  try {
4329
4333
  const result = entity.toEmbeddedTSFile();
4330
4334
  const parentPath = oldpath.replace('.ts', '/');
4331
- const currentOldPath = parentPath + '/entities/' + entity.name + '.ts';
4335
+ const currentOldPath = `${parentPath}/entities/${entity.name}.ts`;
4332
4336
  // 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
4333
4337
  await this.handleRename(entity, entity, result, currentOldPath);
4334
4338
  }
@@ -4342,8 +4346,12 @@ let NaslServer = class NaslServer {
4342
4346
  async receiveHandleChange($event) {
4343
4347
  this.singleFileChangeIng = true;
4344
4348
  // 行为
4345
- const action = $event.action;
4349
+ const { action } = $event;
4346
4350
  const targetNode = $event.target;
4351
+ // Connection 相关配置的更新不需要写入文件
4352
+ if (targetNode?.parentNode instanceof concepts_1.Connection) {
4353
+ return;
4354
+ }
4347
4355
  // 当前操作的文件节点
4348
4356
  const { fileNode } = this.getCurrentSource(targetNode);
4349
4357
  // 不处理系统配置参数
@@ -4358,7 +4366,9 @@ let NaslServer = class NaslServer {
4358
4366
  }
4359
4367
  return;
4360
4368
  }
4369
+ console.time('重新生成 TS 文件');
4361
4370
  const result = fileNode.toEmbeddedTSFile();
4371
+ console.timeEnd('重新生成 TS 文件');
4362
4372
  // 当前操作的节点
4363
4373
  // 如果当前没有生成tsFile
4364
4374
  if (!result) {
@@ -4393,9 +4403,11 @@ let NaslServer = class NaslServer {
4393
4403
  changeFileNext() {
4394
4404
  if (!this.singleFileChangeIng) {
4395
4405
  const item = this.changeStackList.shift();
4396
- this.receiveHandleChange(item).catch((err) => {
4406
+ this.receiveHandleChange(item)
4407
+ .catch((err) => {
4397
4408
  console.log(err, 'receiveHandleChangeErr');
4398
- }).finally(async () => {
4409
+ })
4410
+ .finally(async () => {
4399
4411
  // 每一个文件与change接触就把状态置为false,让下一个进入
4400
4412
  this.singleFileChangeIng = false;
4401
4413
  if (this.changeStackList.length) {
@@ -4410,6 +4422,15 @@ let NaslServer = class NaslServer {
4410
4422
  }
4411
4423
  }
4412
4424
  };
4425
+ __decorate([
4426
+ (0, decorators_1.withQueueExecute)('diagnostic')
4427
+ ], NaslServer.prototype, "_resolveDiagnosticRecords", null);
4428
+ __decorate([
4429
+ (0, decorators_1.withQueueExecute)('annotation')
4430
+ ], NaslServer.prototype, "getNaslAnnotatedJSON", null);
4431
+ __decorate([
4432
+ (0, decorators_1.withQueueExecute)('annotation')
4433
+ ], NaslServer.prototype, "IncrementalAnnotationJSON", null);
4413
4434
  NaslServer = __decorate([
4414
4435
  sentry_1.sentryMonitorNaslServer
4415
4436
  ], NaslServer);