@lcap/nasl 3.7.3-beta.1 → 3.8.0-beta.2

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 (370) hide show
  1. package/.mocharc.js +0 -1
  2. package/out/automate/engine/utils.js +6 -1
  3. package/out/automate/engine/utils.js.map +1 -1
  4. package/out/bak/translator.js +37 -0
  5. package/out/bak/translator.js.map +1 -1
  6. package/out/breakpoint/shared/utils.d.ts +1 -0
  7. package/out/breakpoint/shared/utils.js +1 -1
  8. package/out/breakpoint/shared/utils.js.map +1 -1
  9. package/out/common/BaseNode.d.ts +11 -0
  10. package/out/common/BaseNode.js +101 -5
  11. package/out/common/BaseNode.js.map +1 -1
  12. package/out/concepts/Annotatable__.d.ts +109 -0
  13. package/out/concepts/Annotatable__.js +161 -0
  14. package/out/concepts/Annotatable__.js.map +1 -0
  15. package/out/concepts/AnnotationProperty__.d.ts +48 -0
  16. package/out/concepts/AnnotationProperty__.js +74 -0
  17. package/out/concepts/AnnotationProperty__.js.map +1 -0
  18. package/out/concepts/Annotation__.d.ts +128 -0
  19. package/out/concepts/Annotation__.js +248 -0
  20. package/out/concepts/Annotation__.js.map +1 -0
  21. package/out/concepts/App__.d.ts +14 -26
  22. package/out/concepts/App__.js +50 -20
  23. package/out/concepts/App__.js.map +1 -1
  24. package/out/concepts/ApplyAnnotation__.d.ts +87 -0
  25. package/out/concepts/ApplyAnnotation__.js +140 -0
  26. package/out/concepts/ApplyAnnotation__.js.map +1 -0
  27. package/out/concepts/Argument__.d.ts +19 -0
  28. package/out/concepts/Argument__.js +126 -0
  29. package/out/concepts/Argument__.js.map +1 -1
  30. package/out/concepts/AssigneeV2__.d.ts +169 -0
  31. package/out/concepts/AssigneeV2__.js +176 -1
  32. package/out/concepts/AssigneeV2__.js.map +1 -1
  33. package/out/concepts/AuthLogicForCallInterface__.js +1 -1
  34. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  35. package/out/concepts/AuthLogic__.js +1 -1
  36. package/out/concepts/AuthLogic__.js.map +1 -1
  37. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  38. package/out/concepts/BooleanLiteral__.js +9 -0
  39. package/out/concepts/BooleanLiteral__.js.map +1 -1
  40. package/out/concepts/BusinessLogic__.js +1 -1
  41. package/out/concepts/BusinessLogic__.js.map +1 -1
  42. package/out/concepts/CallFunction__.js +1 -1
  43. package/out/concepts/CallFunction__.js.map +1 -1
  44. package/out/concepts/CallLogic__.d.ts +15 -0
  45. package/out/concepts/CallLogic__.js +149 -17
  46. package/out/concepts/CallLogic__.js.map +1 -1
  47. package/out/concepts/ConnectorLogic__.js +1 -1
  48. package/out/concepts/ConnectorLogic__.js.map +1 -1
  49. package/out/concepts/DatabaseTypeAnnotation__.d.ts +0 -2
  50. package/out/concepts/DatabaseTypeAnnotation__.js +0 -20
  51. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  52. package/out/concepts/DepartmentManagerV2__.d.ts +29 -0
  53. package/out/concepts/DepartmentManagerV2__.js +56 -0
  54. package/out/concepts/DepartmentManagerV2__.js.map +1 -0
  55. package/out/concepts/DepartmentV2__.d.ts +33 -0
  56. package/out/concepts/DepartmentV2__.js +63 -0
  57. package/out/concepts/DepartmentV2__.js.map +1 -0
  58. package/out/concepts/DirectManagerV2__.d.ts +25 -0
  59. package/out/concepts/DirectManagerV2__.js +53 -0
  60. package/out/concepts/DirectManagerV2__.js.map +1 -0
  61. package/out/concepts/End__.js +9 -1
  62. package/out/concepts/End__.js.map +1 -1
  63. package/out/concepts/EntityProperty__.js +0 -2
  64. package/out/concepts/EntityProperty__.js.map +1 -1
  65. package/out/concepts/Entity__.d.ts +2 -2
  66. package/out/concepts/Entity__.js +4 -7
  67. package/out/concepts/Entity__.js.map +1 -1
  68. package/out/concepts/EnumItem__.d.ts +1 -12
  69. package/out/concepts/EnumItem__.js +17 -49
  70. package/out/concepts/EnumItem__.js.map +1 -1
  71. package/out/concepts/EnumSelectSetter__.d.ts +4 -0
  72. package/out/concepts/EnumSelectSetter__.js +7 -0
  73. package/out/concepts/EnumSelectSetter__.js.map +1 -1
  74. package/out/concepts/Enum__.js +1 -4
  75. package/out/concepts/Enum__.js.map +1 -1
  76. package/out/concepts/ForEachStatement__.js +1 -1
  77. package/out/concepts/ForEachStatement__.js.map +1 -1
  78. package/out/concepts/FrontendLibrary__.d.ts +52 -48
  79. package/out/concepts/FrontendLibrary__.js +45 -36
  80. package/out/concepts/FrontendLibrary__.js.map +1 -1
  81. package/out/concepts/FrontendType__.d.ts +4 -0
  82. package/out/concepts/FrontendType__.js +7 -0
  83. package/out/concepts/FrontendType__.js.map +1 -1
  84. package/out/concepts/Frontend__.d.ts +2 -0
  85. package/out/concepts/Frontend__.js +21 -2
  86. package/out/concepts/Frontend__.js.map +1 -1
  87. package/out/concepts/HistoryProcessV2__.js +4 -1
  88. package/out/concepts/HistoryProcessV2__.js.map +1 -1
  89. package/out/concepts/I18nInfo__.d.ts +0 -1
  90. package/out/concepts/I18nInfo__.js +0 -7
  91. package/out/concepts/I18nInfo__.js.map +1 -1
  92. package/out/concepts/Identifier__.d.ts +2 -0
  93. package/out/concepts/Identifier__.js +31 -0
  94. package/out/concepts/Identifier__.js.map +1 -1
  95. package/out/concepts/IfStatement__.js +2 -2
  96. package/out/concepts/IfStatement__.js.map +1 -1
  97. package/out/concepts/Interface__.js +1 -4
  98. package/out/concepts/Interface__.js.map +1 -1
  99. package/out/concepts/LogicItem__.d.ts +1 -1
  100. package/out/concepts/LogicItem__.js.map +1 -1
  101. package/out/concepts/Logic__.d.ts +16 -1
  102. package/out/concepts/Logic__.js +133 -15
  103. package/out/concepts/Logic__.js.map +1 -1
  104. package/out/concepts/ManagerV2__.d.ts +34 -0
  105. package/out/concepts/ManagerV2__.js +61 -0
  106. package/out/concepts/ManagerV2__.js.map +1 -0
  107. package/out/concepts/MatchCase__.d.ts +2 -2
  108. package/out/concepts/MatchCase__.js +7 -7
  109. package/out/concepts/MatchCase__.js.map +1 -1
  110. package/out/concepts/MemberExpression__.js +1 -0
  111. package/out/concepts/MemberExpression__.js.map +1 -1
  112. package/out/concepts/Module__.d.ts +88 -0
  113. package/out/concepts/Module__.js +85 -0
  114. package/out/concepts/Module__.js.map +1 -1
  115. package/out/concepts/OperatePermissionV2__.d.ts +1 -1
  116. package/out/concepts/OperatePermissionV2__.js.map +1 -1
  117. package/out/concepts/Param__.d.ts +4 -0
  118. package/out/concepts/Param__.js +13 -21
  119. package/out/concepts/Param__.js.map +1 -1
  120. package/out/concepts/ProcessElementV2__.d.ts +6 -1
  121. package/out/concepts/ProcessElementV2__.js +20 -0
  122. package/out/concepts/ProcessElementV2__.js.map +1 -1
  123. package/out/concepts/ProcessElement__.d.ts +7 -0
  124. package/out/concepts/ProcessElement__.js +47 -0
  125. package/out/concepts/ProcessElement__.js.map +1 -1
  126. package/out/concepts/ProcessV2__.d.ts +1 -34
  127. package/out/concepts/ProcessV2__.js +3 -70
  128. package/out/concepts/ProcessV2__.js.map +1 -1
  129. package/out/concepts/QueryFromExpression__.js +2 -2
  130. package/out/concepts/QueryFromExpression__.js.map +1 -1
  131. package/out/concepts/QueryJoinExpression__.js +2 -2
  132. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  133. package/out/concepts/StaticString__.d.ts +0 -4
  134. package/out/concepts/StaticString__.js +0 -11
  135. package/out/concepts/StaticString__.js.map +1 -1
  136. package/out/concepts/StructureProperty__.d.ts +1 -0
  137. package/out/concepts/StructureProperty__.js +14 -5
  138. package/out/concepts/StructureProperty__.js.map +1 -1
  139. package/out/concepts/Structure__.d.ts +4 -0
  140. package/out/concepts/Structure__.js +6 -9
  141. package/out/concepts/Structure__.js.map +1 -1
  142. package/out/concepts/SubLogic__.d.ts +418 -0
  143. package/out/concepts/SubLogic__.js +992 -0
  144. package/out/concepts/SubLogic__.js.map +1 -0
  145. package/out/concepts/Theme__.d.ts +9 -0
  146. package/out/concepts/Theme__.js +10 -0
  147. package/out/concepts/Theme__.js.map +1 -1
  148. package/out/concepts/Transactional__.d.ts +0 -1
  149. package/out/concepts/Transactional__.js +0 -7
  150. package/out/concepts/Transactional__.js.map +1 -1
  151. package/out/concepts/TypeAnnotation__.js +18 -0
  152. package/out/concepts/TypeAnnotation__.js.map +1 -1
  153. package/out/concepts/TypeParam__.d.ts +1 -0
  154. package/out/concepts/TypeParam__.js.map +1 -1
  155. package/out/concepts/ValidationRule__.d.ts +6 -1
  156. package/out/concepts/ValidationRule__.js +6 -1
  157. package/out/concepts/ValidationRule__.js.map +1 -1
  158. package/out/concepts/ViewElement__.d.ts +8 -2
  159. package/out/concepts/ViewElement__.js +213 -32
  160. package/out/concepts/ViewElement__.js.map +1 -1
  161. package/out/concepts/View__.d.ts +10 -2
  162. package/out/concepts/View__.js +129 -17
  163. package/out/concepts/View__.js.map +1 -1
  164. package/out/concepts/basics/stdlib/nasl.processV2.d.ts +2 -0
  165. package/out/concepts/basics/stdlib/nasl.processV2.js +50 -4
  166. package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
  167. package/out/concepts/basics/types/index.d.ts +1 -1
  168. package/out/concepts/basics/types/index.js +2 -1
  169. package/out/concepts/basics/types/index.js.map +1 -1
  170. package/out/concepts/index__.d.ts +9 -0
  171. package/out/concepts/index__.js +9 -0
  172. package/out/concepts/index__.js.map +1 -1
  173. package/out/concepts/utils/asserts.d.ts +409 -0
  174. package/out/concepts/utils/asserts.js +564 -14
  175. package/out/concepts/utils/asserts.js.map +1 -1
  176. package/out/concepts/utils/types.d.ts +33 -2
  177. package/out/generator/genBundleFiles.d.ts +13 -9
  178. package/out/generator/genBundleFiles.js +383 -63
  179. package/out/generator/genBundleFiles.js.map +1 -1
  180. package/out/generator/genMetaData.js +2 -0
  181. package/out/generator/genMetaData.js.map +1 -1
  182. package/out/generator/release-body/body.js +1 -0
  183. package/out/generator/release-body/body.js.map +1 -1
  184. package/out/generator/release-body/utils.d.ts +15 -7
  185. package/out/generator/release-body/utils.js +50 -7
  186. package/out/generator/release-body/utils.js.map +1 -1
  187. package/out/natural/genNaturalTS.js +2 -4
  188. package/out/natural/genNaturalTS.js.map +1 -1
  189. package/out/natural/getContext/index.js +0 -2
  190. package/out/natural/getContext/index.js.map +1 -1
  191. package/out/natural/transformTS2UI.js.map +1 -1
  192. package/out/natural/transformTSCode.d.ts +1 -1
  193. package/out/natural/transformTSCode.js.map +1 -1
  194. package/out/server/extendBaseNode.js +9 -0
  195. package/out/server/extendBaseNode.js.map +1 -1
  196. package/out/server/getLogics.js +10 -6
  197. package/out/server/getLogics.js.map +1 -1
  198. package/out/server/getMemberIdentifier.js +6 -0
  199. package/out/server/getMemberIdentifier.js.map +1 -1
  200. package/out/server/getProcessesV2.d.ts +3 -2
  201. package/out/server/getProcessesV2.js +15 -6
  202. package/out/server/getProcessesV2.js.map +1 -1
  203. package/out/server/naslServer.d.ts +5 -1
  204. package/out/server/naslServer.js +120 -30
  205. package/out/server/naslServer.js.map +1 -1
  206. package/out/server/translator.js +4 -0
  207. package/out/server/translator.js.map +1 -1
  208. package/out/service/storage/init.d.ts +2 -1
  209. package/out/service/storage/init.js +28 -71
  210. package/out/service/storage/init.js.map +1 -1
  211. package/out/templator/genCreateBlock.d.ts +6 -2
  212. package/out/templator/genCreateBlock.js +25 -8
  213. package/out/templator/genCreateBlock.js.map +1 -1
  214. package/out/templator/genCurdEditMultipleKeyBlock.d.ts +22 -0
  215. package/out/templator/genCurdEditMultipleKeyBlock.js +60 -1
  216. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  217. package/out/templator/genCurdMultipleKeyBlock.d.ts +13 -3
  218. package/out/templator/genCurdMultipleKeyBlock.js +29 -23
  219. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  220. package/out/templator/genGetBlock.d.ts +1 -1
  221. package/out/templator/genGetBlock.js +3 -2
  222. package/out/templator/genGetBlock.js.map +1 -1
  223. package/out/templator/genListViewBlock.d.ts +1 -1
  224. package/out/templator/genListViewBlock.js +3 -2
  225. package/out/templator/genListViewBlock.js.map +1 -1
  226. package/out/templator/genSelectBlock.d.ts +1 -1
  227. package/out/templator/genSelectBlock.js +3 -2
  228. package/out/templator/genSelectBlock.js.map +1 -1
  229. package/out/templator/genTableBlock.d.ts +9 -4
  230. package/out/templator/genTableBlock.js +31 -17
  231. package/out/templator/genTableBlock.js.map +1 -1
  232. package/out/templator/genUpdateBlock.d.ts +2 -2
  233. package/out/templator/genUpdateBlock.js +11 -11
  234. package/out/templator/genUpdateBlock.js.map +1 -1
  235. package/out/translator/types.d.ts +0 -4
  236. package/out/translator/utils.d.ts +0 -1
  237. package/out/translator/utils.js +1 -6
  238. package/out/translator/utils.js.map +1 -1
  239. package/out/utils/delay/index.d.ts +0 -0
  240. package/out/utils/delay/index.js +1 -0
  241. package/out/utils/delay/index.js.map +1 -0
  242. package/out/utils/env.d.ts +0 -4
  243. package/out/utils/env.js +3 -6
  244. package/out/utils/env.js.map +1 -1
  245. package/out/utils/index.d.ts +3 -2
  246. package/out/utils/index.js +18 -14
  247. package/out/utils/index.js.map +1 -1
  248. package/out/utils/time-slicing/controller.js.map +1 -1
  249. package/out/utils/types.d.ts +0 -17
  250. package/package.json +27 -20
  251. package/sandbox/stdlib/extension.component.ts +29 -0
  252. package/sandbox/stdlib/nasl.process.ts +17 -0
  253. package/sandbox/stdlib/nasl.processV2.ts +10 -5
  254. package/sandbox/stdlib/nasl.util.ts +3 -1
  255. package/src/automate/engine/utils.js +7 -2
  256. package/src/bak/translator.js +42 -1
  257. package/src/breakpoint/shared/utils.ts +2 -1
  258. package/src/common/BaseNode.ts +117 -5
  259. package/src/concepts/Annotatable__.ts +263 -0
  260. package/src/concepts/AnnotationProperty__.ts +102 -0
  261. package/src/concepts/Annotation__.ts +344 -0
  262. package/src/concepts/App__.ts +917 -26
  263. package/src/concepts/ApplyAnnotation__.ts +198 -0
  264. package/src/concepts/Argument__.ts +145 -1
  265. package/src/concepts/AssigneeV2__.ts +387 -1
  266. package/src/concepts/AuthLogicForCallInterface__.ts +1 -1
  267. package/src/concepts/AuthLogic__.ts +1 -1
  268. package/src/concepts/BooleanLiteral__.ts +9 -1
  269. package/src/concepts/BusinessLogic__.ts +1 -1
  270. package/src/concepts/CallFunction__.ts +1 -1
  271. package/src/concepts/CallLogic__.ts +153 -16
  272. package/src/concepts/ConnectorLogic__.ts +1 -1
  273. package/src/concepts/DatabaseTypeAnnotation__.ts +0 -11
  274. package/src/concepts/DepartmentManagerV2__.ts +70 -0
  275. package/src/concepts/DepartmentV2__.ts +75 -0
  276. package/src/concepts/DirectManagerV2__.ts +65 -0
  277. package/src/concepts/End__.ts +10 -1
  278. package/src/concepts/EntityProperty__.ts +0 -5
  279. package/src/concepts/Entity__.ts +5 -9
  280. package/src/concepts/EnumItem__.ts +16 -65
  281. package/src/concepts/EnumSelectSetter__.ts +6 -0
  282. package/src/concepts/Enum__.ts +1 -6
  283. package/src/concepts/ForEachStatement__.ts +1 -1
  284. package/src/concepts/FrontendLibrary__.ts +88 -80
  285. package/src/concepts/FrontendType__.ts +6 -0
  286. package/src/concepts/Frontend__.ts +26 -3
  287. package/src/concepts/HistoryProcessV2__.ts +5 -0
  288. package/src/concepts/I18nInfo__.ts +0 -5
  289. package/src/concepts/Identifier__.ts +32 -0
  290. package/src/concepts/IfStatement__.ts +2 -2
  291. package/src/concepts/Interface__.ts +1 -6
  292. package/src/concepts/LogicItem__.ts +1 -0
  293. package/src/concepts/Logic__.ts +140 -17
  294. package/src/concepts/ManagerV2__.ts +78 -0
  295. package/src/concepts/MatchCase__.ts +9 -8
  296. package/src/concepts/MemberExpression__.ts +1 -0
  297. package/src/concepts/Module__.ts +194 -0
  298. package/src/concepts/OperatePermissionV2__.ts +1 -1
  299. package/src/concepts/Param__.ts +17 -20
  300. package/src/concepts/ProcessElementV2__.ts +23 -0
  301. package/src/concepts/ProcessElement__.ts +18 -0
  302. package/src/concepts/ProcessV2__.ts +4 -70
  303. package/src/concepts/QueryFromExpression__.ts +2 -2
  304. package/src/concepts/QueryJoinExpression__.ts +2 -2
  305. package/src/concepts/StaticString__.ts +0 -13
  306. package/src/concepts/StructureProperty__.ts +16 -7
  307. package/src/concepts/Structure__.ts +10 -11
  308. package/src/concepts/SubLogic__.ts +1516 -0
  309. package/src/concepts/Theme__.ts +9 -0
  310. package/src/concepts/Transactional__.ts +0 -5
  311. package/src/concepts/TriggerLauncher__.ts +1 -1
  312. package/src/concepts/TypeAnnotation__.ts +17 -0
  313. package/src/concepts/TypeParam__.ts +3 -0
  314. package/src/concepts/ValidationRule__.ts +6 -1
  315. package/src/concepts/ViewElement__.ts +224 -34
  316. package/src/concepts/View__.ts +135 -22
  317. package/src/concepts/basics/stdlib/nasl.processV2.ts +56 -3
  318. package/src/concepts/basics/types/index.ts +1 -1
  319. package/src/concepts/index__.ts +9 -0
  320. package/src/concepts/utils/asserts.ts +595 -0
  321. package/src/concepts/utils/types.ts +53 -0
  322. package/src/generator/genBundleFiles.ts +408 -68
  323. package/src/generator/genMetaData.ts +3 -0
  324. package/src/generator/release-body/body.ts +1 -0
  325. package/src/generator/release-body/utils.ts +159 -55
  326. package/src/natural/genNaturalTS.ts +3 -5
  327. package/src/natural/getContext/index.ts +0 -2
  328. package/src/natural/transformTS2UI.ts +5 -2
  329. package/src/natural/transformTSCode.ts +2 -2
  330. package/src/server/extendBaseNode.ts +11 -2
  331. package/src/server/getLogics.ts +9 -7
  332. package/src/server/getMemberIdentifier.ts +7 -0
  333. package/src/server/getProcessesV2.ts +16 -6
  334. package/src/server/naslServer.ts +133 -30
  335. package/src/server/translator.ts +4 -0
  336. package/src/service/storage/init.ts +52 -97
  337. package/src/templator/genCreateBlock.ts +35 -14
  338. package/src/templator/genCurdEditMultipleKeyBlock.ts +65 -1
  339. package/src/templator/genCurdMultipleKeyBlock.ts +42 -23
  340. package/src/templator/genGetBlock.ts +4 -3
  341. package/src/templator/genListViewBlock.ts +3 -3
  342. package/src/templator/genSelectBlock.ts +4 -2
  343. package/src/templator/genTableBlock.ts +32 -17
  344. package/src/templator/genUpdateBlock.ts +21 -18
  345. package/src/translator/types.ts +0 -4
  346. package/src/translator/utils.ts +0 -6
  347. package/src/utils/delay/index.ts +0 -0
  348. package/src/utils/env.ts +4 -5
  349. package/src/utils/index.ts +16 -4
  350. package/src/utils/time-slicing/controller.ts +1 -0
  351. package/src/utils/types.ts +0 -20
  352. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +2 -1
  353. package/ts-worker/bundle.js +1 -1
  354. package/ts-worker/src/index.js +1 -0
  355. package/out/utils/language-cache/constant.d.ts +0 -18
  356. package/out/utils/language-cache/constant.js +0 -35
  357. package/out/utils/language-cache/constant.js.map +0 -1
  358. package/out/utils/language-cache/index.d.ts +0 -2
  359. package/out/utils/language-cache/index.js +0 -19
  360. package/out/utils/language-cache/index.js.map +0 -1
  361. package/out/utils/language-cache/nasl.d.ts +0 -10
  362. package/out/utils/language-cache/nasl.js +0 -98
  363. package/out/utils/language-cache/nasl.js.map +0 -1
  364. package/out/utils/language-cache/types.d.ts +0 -44
  365. package/out/utils/language-cache/types.js +0 -4
  366. package/out/utils/language-cache/types.js.map +0 -1
  367. package/src/utils/language-cache/constant.ts +0 -37
  368. package/src/utils/language-cache/index.ts +0 -2
  369. package/src/utils/language-cache/nasl.ts +0 -83
  370. package/src/utils/language-cache/types.ts +0 -48
@@ -4,7 +4,7 @@ import {
4
4
  runGeneratorSync as runSync,
5
5
  returnOrigin,
6
6
  } from '../utils/time-slicing';
7
- import { waitOqlQueryComponentChildrenFinish } from '../common';
7
+ import { invokeCommand, waitOqlQueryComponentChildrenFinish } from '../common';
8
8
  import type { EmbeddedTSFileGenerator } from '../utils';
9
9
  import { FrontendLibrary } from './FrontendLibrary__';
10
10
  import {
@@ -17,7 +17,6 @@ import {
17
17
  withSourceMapGenerator,
18
18
  withGenerator,
19
19
  TranslatorGenerator,
20
- createDescriptionComment,
21
20
  } from '../translator';
22
21
  import type App from './App__';
23
22
  import type Namespace from './Namespace__';
@@ -47,6 +46,7 @@ import type Process from './Process__';
47
46
  import type CallFunction from './CallFunction__';
48
47
  import ProcessElementV2 from './ProcessElementV2__';
49
48
  import ProcessV2 from './ProcessV2__';
49
+ import type SubLogic from './SubLogic__';
50
50
  //================================================================================
51
51
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
52
52
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -65,12 +65,13 @@ import Param from './Param__';
65
65
  import Return from './Return__';
66
66
  import Variable from './Variable__';
67
67
  import LogicItem from './LogicItem__';
68
+ import Annotatable from './Annotatable__';
68
69
 
69
70
  /**
70
71
  * 逻辑
71
72
  */
72
73
  @concept('逻辑')
73
- export class Logic extends BaseNode {
74
+ export class Logic extends Annotatable {
74
75
  /** 类名 */
75
76
  static readonly ConceptName: string = 'Logic';
76
77
  /**
@@ -79,7 +80,7 @@ export class Logic extends BaseNode {
79
80
  */
80
81
  static isAbstract: boolean = false;
81
82
  /** 继承链 */
82
- static readonly inheritanceChain: string[] = ['BaseNode'];
83
+ static readonly inheritanceChain: string[] = ['Annotatable', 'BaseNode'];
83
84
 
84
85
  /**
85
86
  * 产品概念
@@ -1545,6 +1546,11 @@ export class Logic extends BaseNode {
1545
1546
  prefix?: boolean,
1546
1547
  ): TranslatorGenerator {
1547
1548
  const self = this;
1549
+
1550
+ // 获取所有子节点用于树上填充
1551
+ self.getSubLogics()
1552
+
1553
+ yield waitOqlQueryComponentChildrenFinish(self);
1548
1554
  let code = '';
1549
1555
  if (!prefix) code += `${noName ? '' : `${self.name}:`} function(`;
1550
1556
  else code += `function ${self.name}(`; // 加空格会导致无法查询到引用
@@ -1826,13 +1832,15 @@ export class Logic extends BaseNode {
1826
1832
  @withSourceMapGenerator
1827
1833
  *toEmbeddedTS(state = createCompilerState(), prefix?: string, hideDefaultValue?: boolean): TranslatorGenerator {
1828
1834
  const self = this;
1835
+ // 获取所有子节点用于树上填充
1836
+ self.getSubLogics();
1837
+
1829
1838
  // 等待 oql 查询返回内容
1830
1839
  yield waitOqlQueryComponentChildrenFinish(self);
1831
1840
  // 如果传了不要前缀那就为空, 要不用传进来的,要是都没有就默认导出
1832
1841
  let code = '';
1833
1842
  // 用来储存默认值翻译结构是__IDENTIFIER__或者__IDENTIFIER__()的节点
1834
1843
  const IDENTIFIERMAP = new Set<Variable | Return>();
1835
-
1836
1844
  if (!prefix) {
1837
1845
  code += `export function ${self.tsName}`;
1838
1846
  } else if (prefix === 'noExport') {
@@ -1840,11 +1848,13 @@ export class Logic extends BaseNode {
1840
1848
  } else if (prefix === 'inObject') {
1841
1849
  code += `${self.tsName}`;
1842
1850
  }
1843
- if (self.typeParams?.length) {
1851
+ const completeTypeParams = this.completeTypeParams;
1852
+ const noChooseParamTypes = completeTypeParams.filter((typeParam) => !typeParam.needChoose);
1853
+ if (noChooseParamTypes?.length) {
1844
1854
  code += '<';
1845
- yield* wrapForEach(self.typeParams, function* warpForEachGenerator(typeParam, typeParamIndex) {
1855
+ yield* wrapForEach(noChooseParamTypes, function* warpForEachGenerator(typeParam, typeParamIndex) {
1846
1856
  code += yield* typeParam.toEmbeddedTS(shiftState(state, code, { inline: true }));
1847
- if (typeParamIndex !== self.typeParams.length - 1) code += ', ';
1857
+ if (typeParamIndex !== noChooseParamTypes.length - 1) code += ', ';
1848
1858
  });
1849
1859
  code += '>';
1850
1860
  }
@@ -1916,8 +1926,44 @@ export class Logic extends BaseNode {
1916
1926
  }
1917
1927
  });
1918
1928
 
1929
+ const needChooseParamTypes = completeTypeParams.filter((typeParam) => typeParam.needChoose);
1919
1930
  // 兼容 return 没有类型情况
1920
- if (self.returns.length && self.returns[0].typeAnnotation) {
1931
+ /**
1932
+ *为了翻译成一部分推导一部分手选,翻译和调用同时需要特殊翻译
1933
+ declare function singleTypeParam3<T, S, V>(param: T, param2: S): Map<V, Array<T>>
1934
+ declare function singleTypeParam4<T, S>(param: T, param2: S): <V>() => Map<V, Array<T>>
1935
+
1936
+ 发现还有问题,所以,翻译在调整一下
1937
+ 把所有的泛型拼接在函数后面方便去取回来特殊处理, 因为tsserver没有返回泛型,所以需要手动处理
1938
+ 等后面沟通一下
1939
+ declare function singleTypeParam4<T, S>(param: T, param2: S): <V>() => [Map<V, Array<T>>, T, S]
1940
+ */
1941
+ if (completeTypeParams.length) {
1942
+ code += ': ';
1943
+ if (needChooseParamTypes?.length) {
1944
+ code += '<';
1945
+ yield* wrapForEach(needChooseParamTypes, function* warpForEachGenerator(typeParam, typeParamIndex) {
1946
+ code += yield* typeParam.toEmbeddedTS(shiftState(state, code, { inline: true }));
1947
+ if (typeParamIndex !== needChooseParamTypes.length - 1) code += ', ';
1948
+ });
1949
+ code += '>';
1950
+ }
1951
+ code += '() => [';
1952
+ if (self.returns.length && self.returns[0].typeAnnotation) {
1953
+ code += yield* self.returns[0].typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) ??
1954
+ returnOrigin('');
1955
+ } else {
1956
+ code += 'void';
1957
+ }
1958
+ if (noChooseParamTypes?.length) {
1959
+ code += ',';
1960
+ yield* wrapForEach(noChooseParamTypes, function* warpForEachGenerator(typeParam, typeParamIndex) {
1961
+ code += yield* typeParam.toEmbeddedTS(shiftState(state, code, { inline: true }));
1962
+ if (typeParamIndex !== noChooseParamTypes.length - 1) code += ', ';
1963
+ });
1964
+ }
1965
+ code += ']';
1966
+ } else if (self.returns.length && self.returns[0].typeAnnotation) {
1921
1967
  code += ': ';
1922
1968
  code += yield* self.returns[0].typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) ??
1923
1969
  returnOrigin('');
@@ -2168,8 +2214,6 @@ export class Logic extends BaseNode {
2168
2214
  @withSourceMap()
2169
2215
  toNaturalTS(state = createCompilerState()): string {
2170
2216
  let code = '';
2171
- if (state.descriptionComment)
2172
- code += createDescriptionComment(state, this, ['description']);
2173
2217
 
2174
2218
  let logicName = this.name;
2175
2219
  if (state.autoPrefixName) {
@@ -2457,7 +2501,7 @@ export class Logic extends BaseNode {
2457
2501
 
2458
2502
  getNamespace(): string {
2459
2503
  if (this.parentNode) {
2460
- const parentNamespace = (this.parentNode as any)?.getNamespace();
2504
+ const parentNamespace = (this.parentNode as any)?.getNamespace?.();
2461
2505
  // 针对Connector, 其对应的引入入口只有连接器。且唯一标识由
2462
2506
  // calleeName、calleeNamespace 两个字段组合确认,
2463
2507
  // 故这里只返回 Connector 对应的nameSpace 且 俩字段组合默认会含带logic 字段
@@ -2645,11 +2689,6 @@ export class Logic extends BaseNode {
2645
2689
  actionMsg,
2646
2690
  });
2647
2691
  super.delete();
2648
- this.body.forEach((el) => {
2649
- if (asserts.isCallInterface(el)) {
2650
- el.deleteCallNode()
2651
- }
2652
- })
2653
2692
  this.traverseChildren(async (el) => {
2654
2693
  if (el?.concept === 'CallQueryComponent') (el as CallQueryComponent).removeStructure();
2655
2694
  // 仅仅针对 自定义连接器下的 Loigc,其他需要界定边界
@@ -2779,6 +2818,90 @@ export class Logic extends BaseNode {
2779
2818
  return this.view || (this?.getAncestor('BusinessComponent') as BusinessComponent);
2780
2819
  }
2781
2820
 
2821
+ subLogics: Array<SubLogic> = [];
2822
+
2823
+ getSubLogics() {
2824
+ const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
2825
+ if (asserts.isSubLogic(node)) {
2826
+ return true;
2827
+ }
2828
+ });
2829
+ this.subLogics = subLogics as Array<SubLogic>;
2830
+ }
2831
+
2832
+ existingSubLogic: Set<string> = new Set<string>();
2833
+
2834
+ collectExistSubLogic() {
2835
+ const existSubLogics: SubLogic[] = [];
2836
+ this.findNaslNodeByBFS((node: BaseNode) => {
2837
+ if (asserts.isSubLogic(node)) {
2838
+ existSubLogics.push(node);
2839
+ }
2840
+ return false;
2841
+ });
2842
+ return existSubLogics;
2843
+ }
2844
+
2845
+ // 获取当前逻辑中已经存在的子逻辑名称
2846
+ getSubLogicExistingNames(excludedList: Array<SubLogic> = []) {
2847
+ if (!this.existingSubLogic.size) {
2848
+ const subLogics = this.collectExistSubLogic();
2849
+ subLogics.forEach((subLogic) => {
2850
+ if (!excludedList.includes(subLogic)) {
2851
+ this.existingSubLogic.add(subLogic.name);
2852
+ }
2853
+ });
2854
+ }
2855
+ return Array.from(this.existingSubLogic);
2856
+ }
2857
+
2858
+ getSubLogicUniqueName(name = 'subLogic1') {
2859
+ const existingNames = this.getSubLogicExistingNames();
2860
+ const uniqueName = utils.unique(name, existingNames, undefined, false);
2861
+ this.existingSubLogic.add(uniqueName);
2862
+ return uniqueName;
2863
+ }
2864
+
2865
+ genActionListener($event: EventPayload): void {
2866
+ super.genActionListener($event);
2867
+ invokeCommand('logic.update', this);
2868
+ }
2869
+
2870
+ /**
2871
+ * 完成的泛型参数
2872
+ * 先指支持依赖库的泛型参数
2873
+ * 所以别的都输出 空数组,让别的走旧逻辑
2874
+ */
2875
+ get completeTypeParams() {
2876
+ /**
2877
+ * 遍历泛型和入参类型
2878
+ * 如果泛型在入参中使用,则不需要选择
2879
+ * 所以需要递归看下子集到底是否真的用到了泛型,如果用了,就不需要选择,反之就需要选择
2880
+ */
2881
+ const typeParams = this.typeParams ?? [];
2882
+ if (this.module && typeParams.length) {
2883
+ let needNoChooses = new Set();
2884
+ this.params?.forEach((param) => {
2885
+ param?.typeAnnotation?.traverseStrictChildren((item) => {
2886
+ if (item.concept === 'TypeAnnotation' && item.typeKind === 'typeParam') {
2887
+ const findItem = typeParams.find((typeParam) => typeParam.name === item.typeName);
2888
+ if (findItem) {
2889
+ needNoChooses.add(findItem);
2890
+ }
2891
+ }
2892
+ });
2893
+ });
2894
+ typeParams.forEach((typeParam) => {
2895
+ if (needNoChooses.has(typeParam)) {
2896
+ typeParam.needChoose = false;
2897
+ } else {
2898
+ typeParam.needChoose = true;
2899
+ }
2900
+ });
2901
+ return typeParams;
2902
+ }
2903
+ return [];
2904
+ }
2782
2905
  //================================================================================
2783
2906
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2784
2907
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -0,0 +1,78 @@
1
+ //================================================================================
2
+ // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
3
+ // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
4
+ //================================================================================
5
+ import { EventPayload, Params } from '../common/EventEmitter';
6
+ import { concept, excludedInJSON, property, getConceptConstructor } from '../decorators';
7
+
8
+ import * as utils from '../utils';
9
+ import { createUUID } from '../utils/create';
10
+ import * as types from './utils/types';
11
+ import * as asserts from './utils/asserts';
12
+ import BaseNode from '../common/BaseNode';
13
+ import MemberExpression from './MemberExpression__';
14
+
15
+ /**
16
+ * 主管
17
+ */
18
+ @concept('主管')
19
+ export abstract class ManagerV2 extends BaseNode {
20
+ /** 类名 */
21
+ static readonly ConceptName: string = 'ManagerV2';
22
+ /**
23
+ * 是否为抽象类
24
+ * 抽象类不能产生 concept: string
25
+ */
26
+ static isAbstract: boolean = true;
27
+ /** 继承链 */
28
+ static readonly inheritanceChain: string[] = ['BaseNode'];
29
+
30
+ /**
31
+ * 产品概念
32
+ */
33
+ @property('concept')
34
+ // @ts-ignore
35
+ readonly concept!: 'DirectManagerV2' | 'DepartmentManagerV2';
36
+ /**
37
+ * 下属
38
+ */
39
+ @property({
40
+ objectRef: 'MemberExpression',
41
+ })
42
+ subordinate: MemberExpression;
43
+
44
+ /**
45
+ * 级数
46
+ */
47
+ @property()
48
+ level: number;
49
+
50
+ /**
51
+ * @param source 需要合并的部分参数
52
+ */
53
+ constructor(source?: Partial<ManagerV2>) {
54
+ source = Object.assign({}, ManagerV2.getDefaultOptions(), source);
55
+ super(source);
56
+ super.subConstructor(source);
57
+ }
58
+
59
+ static from(source: any, parentNode?: any, parentKey?: string): ManagerV2 {
60
+ return super.from(source, parentNode, parentKey) as ManagerV2;
61
+ }
62
+
63
+ //================================================================================
64
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
65
+ // 自动生成的代码已结束。下面可以手动编写。
66
+ //================================================================================
67
+
68
+ //================================================================================
69
+ // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
70
+ // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
71
+ //================================================================================
72
+ }
73
+
74
+ export default ManagerV2;
75
+ //================================================================================
76
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
77
+ // 自动生成的代码已结束。下面可以手动编写。
78
+ //================================================================================
@@ -150,6 +150,15 @@ export class MatchCase extends LogicItem {
150
150
  return logicItem;
151
151
  }
152
152
 
153
+ getLogicItemExistingNames(excludedList: Array<LogicItem> = []) {
154
+ const excludedSet = new Set(excludedList);
155
+ return ((this.patterns as LogicItem[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
156
+ }
157
+
158
+ getLogicItemUniqueName(name = 'logicItem1') {
159
+ return utils.unique(name, this.getLogicItemExistingNames(), undefined, false);
160
+ }
161
+
153
162
  /**
154
163
  * 插入逻辑项
155
164
  * @param logicItemOptions 逻辑项参数
@@ -582,14 +591,6 @@ export class MatchCase extends LogicItem {
582
591
  // 自动生成的代码已结束。下面可以手动编写。
583
592
  //================================================================================
584
593
 
585
- getLogicItemExistingNames(excludedList: Array<LogicItem> = []) {
586
- const excludedSet = new Set(excludedList);
587
- return ((this.patterns as LogicItem[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
588
- }
589
- getLogicItemUniqueName(name = 'logicItem1') {
590
- return utils.unique(name, this.getLogicItemExistingNames(), undefined, false);
591
- }
592
-
593
594
  // 是否处于禁用状态
594
595
  get isDisabled() {
595
596
  const matchExpression = this.parentNode as Match;
@@ -494,6 +494,7 @@ export class MemberExpression extends LogicItem {
494
494
  if (
495
495
  leftCode.startsWith('app.enums.') ||
496
496
  leftCode.startsWith('nasl.configuration.enums.') ||
497
+ leftCode.startsWith('nasl.processV2.enums.') ||
497
498
  (leftCode.startsWith('extensions') && leftCode.includes('.enums.'))
498
499
  ) {
499
500
  const lastIndex = leftCode.lastIndexOf('.');
@@ -36,6 +36,7 @@ import Configuration from './Configuration__';
36
36
  import TriggerLauncher from './TriggerLauncher__';
37
37
  import Connection from './Connection__';
38
38
  import MetadataType from './MetadataType__';
39
+ import Annotation from './Annotation__';
39
40
 
40
41
  /**
41
42
  * 模块
@@ -104,6 +105,10 @@ export class Module extends BaseNode {
104
105
  artifactId: string;
105
106
  version: string;
106
107
  }>;
108
+ npm?: Array<{
109
+ name: string;
110
+ version: string;
111
+ }>;
107
112
  };
108
113
 
109
114
  /**
@@ -263,6 +268,16 @@ export class Module extends BaseNode {
263
268
  })
264
269
  metadataTypes: Array<MetadataType> = [];
265
270
 
271
+ /**
272
+ * 注解列表
273
+ */
274
+ @property({
275
+ objectRef: 'Annotation',
276
+ isArray: true,
277
+ defaultValue: [],
278
+ })
279
+ annotations: Array<Annotation> = [];
280
+
266
281
  /**
267
282
  * @param source 需要合并的部分参数
268
283
  */
@@ -2325,6 +2340,160 @@ export class Module extends BaseNode {
2325
2340
  return node;
2326
2341
  }
2327
2342
 
2343
+ getAnnotationExistingNames(excludedList: Array<Annotation> = []) {
2344
+ const excludedSet = new Set(excludedList);
2345
+ return ((this.annotations as Annotation[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
2346
+ }
2347
+ getAnnotationUniqueName(name = 'annotation1') {
2348
+ return utils.unique(name, this.getAnnotationExistingNames(), undefined, false);
2349
+ }
2350
+
2351
+ /**
2352
+ * 插入注解
2353
+ * @internal
2354
+ * @param name 注解名称,如果不填会自动生成一个唯一名称
2355
+ */
2356
+ _insertAnnotationAt(name: string, index: number): Annotation;
2357
+
2358
+ /**
2359
+ * 插入注解
2360
+ * @internal
2361
+ * @param annotationOptions 注解参数
2362
+ */
2363
+ _insertAnnotationAt(annotationOptions: Partial<Annotation>, index: number): Annotation;
2364
+
2365
+ /**
2366
+ * 插入注解
2367
+ * @internal
2368
+ * @param annotation 已有的注解实例
2369
+ */
2370
+ _insertAnnotationAt(annotation: Annotation, index: number): Annotation;
2371
+
2372
+ _insertAnnotationAt(options: string | Partial<Annotation> | Annotation, index: number) {
2373
+ const annotationOptions: any = {};
2374
+ const relationOptions = { parentNode: this, parentKey: 'annotations' };
2375
+ const Annotation = getConceptConstructor('Annotation');
2376
+ let annotation: Annotation;
2377
+ if (!options) {
2378
+ annotation = Annotation.from(
2379
+ {
2380
+ ...annotationOptions,
2381
+ name: this.getAnnotationUniqueName(),
2382
+ },
2383
+ this,
2384
+ 'annotations',
2385
+ );
2386
+ } else if (typeof options === 'string') {
2387
+ annotation = Annotation.from(
2388
+ {
2389
+ ...annotationOptions,
2390
+ name: options,
2391
+ },
2392
+ this,
2393
+ 'annotations',
2394
+ );
2395
+ } else if (asserts.isAnnotation(options)) {
2396
+ options.ensureDelete(); // 同一实例不支持多处存在
2397
+ annotation = options;
2398
+ Object.assign(annotation, relationOptions);
2399
+ } else {
2400
+ annotation = Annotation.from(
2401
+ {
2402
+ ...annotationOptions,
2403
+ ...options,
2404
+ },
2405
+ this,
2406
+ 'annotations',
2407
+ );
2408
+ }
2409
+ this.annotations.splice(index, 0, annotation);
2410
+ return annotation;
2411
+ }
2412
+
2413
+ /**
2414
+ * 插入注解
2415
+ * @param name 注解名称,如果不填会自动生成一个唯一名称
2416
+ */
2417
+ insertAnnotationAt(name: string, index: number): Annotation;
2418
+
2419
+ /**
2420
+ * 插入注解
2421
+ * @param annotationOptions 注解参数
2422
+ */
2423
+ insertAnnotationAt(annotationOptions: Partial<Annotation>, index: number): Annotation;
2424
+
2425
+ /**
2426
+ * 插入注解
2427
+ * @param annotation 已有的注解实例
2428
+ */
2429
+ insertAnnotationAt(annotation: Annotation, index: number): Annotation;
2430
+
2431
+ insertAnnotationAt(options: string | Partial<Annotation> | Annotation, index: number) {
2432
+ const node = this._insertAnnotationAt(options as any, index);
2433
+ node.create({
2434
+ index,
2435
+ parentNode: this,
2436
+ parentKey: 'annotations',
2437
+ });
2438
+ return node;
2439
+ }
2440
+
2441
+ /**
2442
+ * 添加注解
2443
+ * @internal
2444
+ * @param name 注解名称,如果不填会自动生成一个唯一名称
2445
+ */
2446
+ _addAnnotation(name?: string): Annotation;
2447
+
2448
+ /**
2449
+ * 添加注解
2450
+ * @internal
2451
+ * @param annotationOptions 注解参数
2452
+ */
2453
+ _addAnnotation(annotationOptions: Partial<Annotation>): Annotation;
2454
+
2455
+ /**
2456
+ * 添加注解
2457
+ * @internal
2458
+ * @param annotation 已有的注解实例
2459
+ */
2460
+ _addAnnotation(annotation: Annotation): Annotation;
2461
+
2462
+ _addAnnotation(options?: string | Partial<Annotation> | Annotation) {
2463
+ const index = this.annotations.length;
2464
+ return this._insertAnnotationAt(options as any, index);
2465
+ }
2466
+
2467
+ /**
2468
+ * 添加注解
2469
+ * @internal
2470
+ * @param name 注解名称,如果不填会自动生成一个唯一名称
2471
+ */
2472
+ addAnnotation(name?: string): Annotation;
2473
+
2474
+ /**
2475
+ * 添加注解
2476
+ * @param annotationOptions 注解参数
2477
+ */
2478
+ addAnnotation(annotationOptions: Partial<Annotation>): Annotation;
2479
+
2480
+ /**
2481
+ * 添加注解
2482
+ * @param annotation 已有的注解实例
2483
+ */
2484
+ addAnnotation(annotation: Annotation): Annotation;
2485
+
2486
+ addAnnotation(options?: string | Partial<Annotation> | Annotation) {
2487
+ const node = this._addAnnotation(options as any);
2488
+ const index = this.annotations.indexOf(node);
2489
+ node.create({
2490
+ index,
2491
+ parentNode: this,
2492
+ parentKey: 'annotations',
2493
+ });
2494
+ return node;
2495
+ }
2496
+
2328
2497
  /**
2329
2498
  * 删除数据源
2330
2499
  * @param name 数据源名称
@@ -2650,6 +2819,31 @@ export class Module extends BaseNode {
2650
2819
  return metadataType.delete();
2651
2820
  }
2652
2821
 
2822
+ /**
2823
+ * 删除注解
2824
+ * @param name 注解名称
2825
+ */
2826
+ removeAnnotation(name: string): void;
2827
+
2828
+ /**
2829
+ * 删除注解
2830
+ * @param annotation 已有的注解实例
2831
+ */
2832
+ removeAnnotation(annotation: Annotation): void;
2833
+
2834
+ removeAnnotation(options: string | Annotation) {
2835
+ let annotation: Annotation;
2836
+ if (typeof options === 'string') {
2837
+ annotation = (this.annotations as Annotation[]).find((item) => item.name === options);
2838
+ if (!annotation) {
2839
+ throw new Error('找不到注解 ' + options);
2840
+ }
2841
+ } else {
2842
+ annotation = options;
2843
+ }
2844
+ return annotation.delete();
2845
+ }
2846
+
2653
2847
  //================================================================================
2654
2848
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2655
2849
  // 自动生成的代码已结束。下面可以手动编写。
@@ -45,7 +45,7 @@ export class OperatePermissionV2 extends BaseNode {
45
45
  * 字段名
46
46
  */
47
47
  @property()
48
- name: 'approve' | 'reject' | 'reassign' | 'revert' | 'submit' | 'withdraw';
48
+ name: 'approve' | 'reject' | 'reassign' | 'revert' | 'submit' | 'withdraw' | 'addSign';
49
49
 
50
50
  /**
51
51
  * 是否允许操作
@@ -80,6 +80,12 @@ export class Param extends BaseNode {
80
80
  @property()
81
81
  description?: string;
82
82
 
83
+ /**
84
+ * 是否为展开参数
85
+ */
86
+ @property()
87
+ spread?: boolean;
88
+
83
89
  /**
84
90
  * 类型
85
91
  */
@@ -258,27 +264,12 @@ export class Param extends BaseNode {
258
264
  @withSourceMapGenerator
259
265
  *toEmbeddedTS(state = createCompilerState(), dontType?: boolean, hideDefaultValue?: boolean): TranslatorGenerator {
260
266
  const self = this;
261
- let code = self.name;
262
- // 回调函数类的参数
263
- if (self?.typeAnnotation?.typeKind === 'function') {
264
- code += ':{(';
265
- const paramTypes = self.typeAnnotation?.typeArguments || [];
266
- yield* wrapForEach(paramTypes, function* warpForEachGenerator(type, index) {
267
- code += `type${index + 1}:${yield* type.toEmbeddedTS(shiftState(state, code))}`;
268
- if (index !== paramTypes.length - 1) {
269
- code += ',';
270
- } else {
271
- code += ')';
272
- }
273
- });
274
- code += ':';
275
- const returnTypes = self.typeAnnotation?.returnType || [];
276
- yield* wrapForEach(returnTypes, function* warpForEachGenerator(type) {
277
- code += yield* type.toEmbeddedTS(shiftState(state, code));
278
- });
279
- code += '}';
280
- return code;
267
+ let code = '';
268
+ if (self.spread) {
269
+ code += '...';
281
270
  }
271
+ code += self.name;
272
+
282
273
  const { typeNamespace, typeName } = self.typeAnnotation || {};
283
274
  let typeKey = self.typeAnnotation?.typeKey;
284
275
  if (typeNamespace?.endsWith('.metadataTypes')) {
@@ -291,7 +282,13 @@ export class Param extends BaseNode {
291
282
  code += yield* self.defaultExpression.toEmbeddedTSDefinition(shiftState(state, code));
292
283
  } else if (!dontType && self.typeAnnotation) {
293
284
  code += ': ';
285
+ if (self.spread) {
286
+ code += 'Array<';
287
+ }
294
288
  code += yield* self.typeAnnotation.toEmbeddedTS(shiftState(state, code));
289
+ if (self.spread) {
290
+ code += '>';
291
+ }
295
292
  if (!hideDefaultValue && self.defaultValue?.expression) {
296
293
  if (['nasl.core.DateTime', 'nasl.core.Time', 'nasl.core.Date'].includes(typeKey)) {
297
294
  code += yield* self.defaultValue.toEmbeddedTS(shiftState(state, code), true);