@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
@@ -46,6 +46,15 @@ export class Theme extends BaseNode {
46
46
  [name: string]: string;
47
47
  } = {};
48
48
 
49
+ /**
50
+ * scope
51
+ * 主题变量 Map
52
+ */
53
+ @property({
54
+ objectRef: '',
55
+ })
56
+ scopeVariableMap: { [scope: string]: { [key: string]: string } } = {};
57
+
49
58
  /**
50
59
  * @param source 需要合并的部分参数
51
60
  */
@@ -111,11 +111,6 @@ export class Transactional extends BaseNode {
111
111
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
112
112
  // 自动生成的代码已结束。下面可以手动编写。
113
113
  //================================================================================
114
- @withSourceMap()
115
- toNaturalTS(state = createCompilerState()): string {
116
- return '';
117
- }
118
-
119
114
  /**
120
115
  * 祖先 Logic
121
116
  */
@@ -13,7 +13,7 @@ import LogicItem from './LogicItem__';
13
13
 
14
14
  import App from './App__';
15
15
  import Module from './Module__';
16
- import ConnectorTriggerLauncher from './ConnectorTriggerLauncher__';
16
+ import type ConnectorTriggerLauncher from './ConnectorTriggerLauncher__';
17
17
  //================================================================================
18
18
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
19
19
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -965,6 +965,23 @@ export class TypeAnnotation extends BaseNode {
965
965
  code += `__name: "AStructure_${self.hash}" `;
966
966
  code += ' }';
967
967
  return code;
968
+ } else if (self?.typeKind === 'function') {
969
+ let code = '';
970
+ code += '(';
971
+ const paramTypes = self?.typeArguments || [];
972
+ yield* wrapForEach(paramTypes, function* warpForEachGenerator(type, index) {
973
+ code += `param${index + 1}:${yield* type.toEmbeddedTS(shiftState(state, code))}`;
974
+ if (index !== paramTypes.length - 1) {
975
+ code += ',';
976
+ }
977
+ });
978
+ code += ')';
979
+ code += '=>';
980
+ const returnTypes = self?.returnType || [];
981
+ yield* wrapForEach(returnTypes, function* warpForEachGenerator(type) {
982
+ code += yield* type.toEmbeddedTS(shiftState(state, code));
983
+ });
984
+ return code;
968
985
  } else {
969
986
  if (self.tsCalleeNamespace && self.typeName) {
970
987
  return `${self.tsCalleeNamespace}.${self.typeName}`;
@@ -69,6 +69,9 @@ export class TypeParam extends BaseNode {
69
69
  // 使用什么组件
70
70
  useComponent: any = undefined;
71
71
 
72
+ // 需要选择泛型,不能推导
73
+ needChoose: boolean;
74
+
72
75
  @withSourceMapGenerator
73
76
  *toEmbeddedTS(state = createCompilerState(), prefix?: string): TranslatorGenerator {
74
77
  const self = this;
@@ -270,7 +270,12 @@ export class ValidationRule extends LogicItem {
270
270
  //================================================================================
271
271
 
272
272
  public static getDefaultOptions() {
273
- return {};
273
+ return {
274
+ target: {
275
+ concept: 'Identifier',
276
+ name: '',
277
+ },
278
+ };
274
279
  }
275
280
 
276
281
  toInViewMethod() {
@@ -16,6 +16,9 @@ import * as babelParser from '@babel/parser';
16
16
  import * as json5 from 'json5';
17
17
  import * as compiler from 'vue-template-compiler';
18
18
 
19
+ import { Namespace } from './Namespace__';
20
+ import { BooleanLiteral } from './BooleanLiteral__';
21
+ import { StringLiteral } from './StringLiteral__';
19
22
  import { LogicItem } from './LogicItem__';
20
23
  import { Logic } from './Logic__';
21
24
  import { config } from '../config';
@@ -76,6 +79,7 @@ function genArgumentMemberExpression(arr: string[]) {
76
79
  return expressionNode;
77
80
  }
78
81
  export interface ElementToVueOptions {
82
+ filterAttr?: Array<string>;
79
83
  isExport?: boolean;
80
84
  isRoot?: boolean;
81
85
  asCompontent?: boolean;
@@ -101,14 +105,7 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
101
105
  let node = null;
102
106
  if (astNode.type === 'CallExpression' && astNode.callee.object.name === '$utils') {
103
107
  const calleeName = astNode.callee.property.name || astNode.callee.property.value;
104
- node = {
105
- concept: 'CallFunction',
106
- name: '',
107
- label: '调用内置函数',
108
- kind: 'Expression',
109
- calleeNamespace: 'nasl.util',
110
- calleeName,
111
- arguments: astNode.arguments
108
+ const _arguments = astNode.arguments
112
109
  .map((argument: any) => ({
113
110
  concept: 'Argument',
114
111
  name: '',
@@ -117,10 +114,24 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
117
114
  expression: transAstNodeToNaslNode(Object.assign({}, argument)),
118
115
  }))
119
116
  .filter((item: any) => item.expression),
120
- typeArguments: astNode.arguments
121
- .map((argument: any) => transAstNodeToNaslTypeNode(Object.assign({}, argument)))
122
- .filter((item: any) => item),
117
+ _typeArguments = astNode.arguments.map((argument: any) => transAstNodeToNaslTypeNode(Object.assign({}, argument))).filter((item: any) => item);
118
+ node = {
119
+ concept: 'CallFunction',
120
+ name: '',
121
+ label: '调用内置函数',
122
+ kind: 'Expression',
123
+ calleeNamespace: 'nasl.util',
124
+ calleeName,
125
+ arguments: _arguments,
126
+ typeArguments: _typeArguments,
123
127
  };
128
+
129
+ if ( calleeName === 'Convert') {
130
+ node.arguments = [_arguments[0]];
131
+ if (_typeArguments.length === 0 && _arguments?.length === 2) {
132
+ node.typeArguments = [_arguments?.[1].expression];
133
+ }
134
+ }
124
135
  } else if (astNode.type === 'MemberExpression') {
125
136
  if (astNode.object?.name === '$global') {
126
137
  if (astNode.property?.name === 'userInfo') {
@@ -154,12 +165,21 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
154
165
  name: astNode.name,
155
166
  kind: 'Expression',
156
167
  };
157
- } else if (astNode.type === 'ArrayExpression' || astNode.type === 'ObjectExpression') {
168
+ } else if (astNode.type === 'ArrayExpression') {
158
169
  node = {
159
170
  concept: 'Unparsed',
160
171
  label: '原子项',
161
172
  code: astNode.value,
162
173
  };
174
+ } else if (astNode.type === 'ObjectExpression') {
175
+ const properties = astNode.properties.map((property: any) => ({
176
+ key: property.key.value,
177
+ value: property.value.value,
178
+ }));
179
+ node = {};
180
+ properties.forEach((property: any) => {
181
+ node[property.key] = property.value;
182
+ })
163
183
  } else if (astNode.type === 'TemplateLiteral') {
164
184
  // 模板字符串翻译成字符串插值
165
185
  const { expressions, quasis } = astNode;
@@ -303,17 +323,18 @@ import * as utils from '../utils';
303
323
  import { createUUID } from '../utils/create';
304
324
  import * as types from './utils/types';
305
325
  import * as asserts from './utils/asserts';
306
- import BaseNode from '../common/BaseNode';
326
+
307
327
  import BindAttribute from './BindAttribute__';
308
328
  import BindEvent from './BindEvent__';
309
329
  import BindDirective from './BindDirective__';
310
330
  import BindStyle from './BindStyle__';
331
+ import Annotatable from './Annotatable__';
311
332
 
312
333
  /**
313
334
  * 页面元素
314
335
  */
315
336
  @concept('页面元素')
316
- export class ViewElement extends BaseNode {
337
+ export class ViewElement extends Annotatable {
317
338
  /** 类名 */
318
339
  static readonly ConceptName: string = 'ViewElement';
319
340
  /**
@@ -322,7 +343,7 @@ export class ViewElement extends BaseNode {
322
343
  */
323
344
  static isAbstract: boolean = false;
324
345
  /** 继承链 */
325
- static readonly inheritanceChain: string[] = ['BaseNode'];
346
+ static readonly inheritanceChain: string[] = ['Annotatable', 'BaseNode'];
326
347
 
327
348
  /**
328
349
  * 产品概念
@@ -336,6 +357,12 @@ export class ViewElement extends BaseNode {
336
357
  @property()
337
358
  tag: string;
338
359
 
360
+ /**
361
+ * 命名空间
362
+ */
363
+ @property()
364
+ refNamespace?: string;
365
+
339
366
  /**
340
367
  * 页面元素名称
341
368
  */
@@ -2279,7 +2306,6 @@ export class ViewElement extends BaseNode {
2279
2306
  }),
2280
2307
  // levelIndex,
2281
2308
  );
2282
- code += ',\n';
2283
2309
  });
2284
2310
 
2285
2311
  code += `${indent(state.tabSize + 1)}] },\n`;
@@ -2289,16 +2315,15 @@ export class ViewElement extends BaseNode {
2289
2315
  });
2290
2316
  // 翻译其余的子集
2291
2317
  if (defaultArr.length) {
2292
- // throw new Error('多个插槽必须都在 template 内');
2293
- defaultArr.forEach((element) => {
2294
- code += element.toTextualNASL(
2295
- shiftState(state, code, {
2296
- tabSize: state.tabSize,
2297
- }),
2298
- // levelIndex,
2299
- );
2300
- code += ',\n';
2301
- });
2318
+ throw new Error('多个插槽必须都在 template 内');
2319
+ // defaultArr.forEach((element) => {
2320
+ // code += element.toTextualNASL(
2321
+ // shiftState(state, code, {
2322
+ // tabSize: state.tabSize,
2323
+ // }),
2324
+ // // levelIndex,
2325
+ // );
2326
+ // });
2302
2327
  }
2303
2328
  } else {
2304
2329
  if (this.children.length) {
@@ -3035,12 +3060,24 @@ export class ViewElement extends BaseNode {
3035
3060
  this.refName && parts.push(`:ref="\`${this.refName}\`"`);
3036
3061
  this.keyName && parts.push(`:key="\`${this.keyName}\`"`);
3037
3062
  this.staticClass && parts.push(`class="${this.staticClass}"`);
3063
+ let dataRefList: any[] = [];
3038
3064
 
3039
3065
  const vIfs: string[] = [];
3040
3066
  []
3041
3067
  .concat(this.bindAttrs, this.bindDirectives, this.bindEvents)
3042
3068
  .forEach((attr: BindAttribute | BindDirective | BindEvent) => {
3043
3069
  let result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
3070
+ // 属性翻译为指令 :仅封闭态流程表单内使用
3071
+ if(options?.filterAttr
3072
+ && options?.filterAttr?.length>0
3073
+ && attr.concept === 'BindAttribute'
3074
+ && attr.name === 'processHidden'){
3075
+ options?.filterAttr.map(filterAttrName=>{
3076
+ if(attr.name===filterAttrName){
3077
+ result = null
3078
+ }
3079
+ })
3080
+ }
3044
3081
  if (
3045
3082
  options?.isExport &&
3046
3083
  attr?.concept === 'BindAttribute' &&
@@ -3059,8 +3096,143 @@ export class ViewElement extends BaseNode {
3059
3096
 
3060
3097
  return;
3061
3098
  }
3099
+
3062
3100
  result && parts.push(result);
3063
3101
  });
3102
+ const genDirectiveByAnno = (viewElement: ViewElement) => {
3103
+ if (viewElement?.applyAnnotations?.length > 0) {
3104
+ // todo: 根据注解生成自定义指令 v-annoName="context"
3105
+ // 血缘算法要生成一个所有的 Entity-ViewElement 的映射map
3106
+ // context 从 血缘算法映射获取 getRelataionByElement()
3107
+ return viewElement.applyAnnotations.map((aa) => {
3108
+ const getExpressionValue = (expression: any) => {
3109
+ if (expression?.concept === 'BooleanLiteral') {
3110
+ return BooleanLiteral.from(expression)?.toBoolean();
3111
+ }
3112
+ if (expression?.concept === 'NewList') {
3113
+ return eval(expression.toUI().replace('新建:', ''));
3114
+ }
3115
+ return expression?.value;
3116
+ };
3117
+ let argsList = aa.arguments.map((arg: any) => getExpressionValue(arg.expression));
3118
+ let annoArgs = {
3119
+ argsList,
3120
+ dataRefList,
3121
+ };
3122
+ // debugger
3123
+ // 所有参数序列化之后当字符串传进指令参数 (目前不支持<div v-demo="{ color: 'white', text: 'hello!' }"></div>
3124
+ let expression = StringLiteral.from({
3125
+ concept: 'StringLiteral',
3126
+ kind: 'Expression',
3127
+ name: '',
3128
+ value: JSON.stringify(annoArgs),
3129
+ });
3130
+ let annoDirective = BindDirective.from({
3131
+ name: aa.annotationName,
3132
+ // arg:'arg',
3133
+ expression,
3134
+ });
3135
+ return annoDirective;
3136
+ });
3137
+ }
3138
+ };
3139
+ let isH5ListViewLayout = this?.tag === 'van-cell' && this.getAncestorByTag('ViewElement', 'van-list-view');
3140
+ let isListViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-list-view');
3141
+ let isGridViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-grid-view');
3142
+
3143
+ const getLogicDataRef = (viewElement: ViewElement) => {
3144
+ // 自上向下查找, 指令需要翻译到绑定值元素的上级父元素
3145
+ // 这个元素需要满足 1 向下能找到 绑定了值的表单子元素
3146
+ // 2 向上能找到 固定的几种表单元素 且带有dataSource 并找到对应的calllogic name
3147
+ let targetTag = ['u-table-view-column']; //'u-form-item' 逻辑无法感知到表单绑定值的变更
3148
+ let logicName;
3149
+ const addDataRefDriective = (ve: ViewElement) => {
3150
+ ve?.bindAttrs?.find((attr: any) => {
3151
+ let type = attr?.expression?.object?.__TypeAnnotation;
3152
+ if (type) {
3153
+ console.log('type: ', type);
3154
+ let { typeKind, typeName, typeNamespace } = type || {};
3155
+ // todo 这里可能不是匿名数据结构吗
3156
+ if (typeKind === 'anonymousStructure') {
3157
+ let parent: any =
3158
+ this.getAncestorByTag('ViewElement', 'u-table-view') ||
3159
+ this.getAncestorByTag('ViewElement', 'u-list-view') ||
3160
+ this.getAncestorByTag('ViewElement', 'u-grid-view') ||
3161
+ this.getAncestorByTag('ViewElement', 'van-grid-view') ||
3162
+ this.getAncestorByTag('ViewElement', 'van-list-view');
3163
+ if (parent?.tag) {
3164
+ let dataSourceAttr = parent?.bindAttrs?.find((it: any) => it?.name === 'dataSource');
3165
+ if (dataSourceAttr?.expression?.concept === 'CallLogic') {
3166
+ if (dataSourceAttr?.expression?.calleeNamespace === 'app.logics') {
3167
+ logicName = dataSourceAttr?.expression?.calleeName;
3168
+ // debugger
3169
+ let ref = {
3170
+ typeNamespace: 'app.logics',
3171
+ typeName: logicName,
3172
+ propName: attr?.expression.toUI()?.replace('current.item.', ''),
3173
+ };
3174
+ console.log('ref: ', ref);
3175
+ dataRefList.push(ref);
3176
+ // 要考虑 多个元素 每个元素有多个注解的情况
3177
+ let result = (genDirectiveByAnno(viewElement) as any)?.map((d: any) => d?.toVue());
3178
+ result && result?.length > 0 && parts.push(...result);
3179
+ }
3180
+ }
3181
+ }
3182
+ }
3183
+ }
3184
+ });
3185
+ };
3186
+ // 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
3187
+ if (viewElement?.tag === 'van-text') {
3188
+ addDataRefDriective(viewElement);
3189
+ }
3190
+ if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
3191
+ this.traverseChildren((ve: ViewElement) => {
3192
+ addDataRefDriective(ve);
3193
+ });
3194
+ }
3195
+ };
3196
+ // 已知问题: 逻辑的表格可以推导 表单无法推导(如果是实体拖过来的 还是指向实体)
3197
+ // 已知问题: 目前采用隐藏父元素的方式; 后续有任何 tag 或者结构更改都不生效
3198
+ getLogicDataRef(this);
3199
+ const getEntityDataRef = (viewElement: ViewElement) => {
3200
+ // 这个类型都是 默认找到子元素的数据引用 然后加到自己的指令上
3201
+ let targetTag = ['u-table-view-column', 'u-form-item'];
3202
+ const addDataRefDriective = (ve: ViewElement) => {
3203
+ ve?.bindAttrs?.find((attr: any) => {
3204
+ let type = attr?.expression?.object?.__TypeAnnotation;
3205
+ if (type) {
3206
+ let { typeKind, typeName, typeNamespace } = type || {};
3207
+ if (typeKind === 'reference' && typeNamespace) {
3208
+ let entityPropName = attr?.expression?.property?.name;
3209
+ // debugger;
3210
+ let ref = {
3211
+ typeNamespace,
3212
+ typeName,
3213
+ propName: entityPropName,
3214
+ };
3215
+ dataRefList.push(ref);
3216
+ let result = (genDirectiveByAnno(viewElement) as any)?.map((d: any) => d?.toVue());
3217
+ result && result?.length > 0 && parts.push(...result);
3218
+ }
3219
+ // typeName "Entity1"
3220
+ // typeNamespace "app.dataSources.defaultDS.entities"
3221
+ }
3222
+ });
3223
+ };
3224
+ // 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
3225
+ if (viewElement?.tag === 'van-text') {
3226
+ addDataRefDriective(viewElement);
3227
+ }
3228
+ if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
3229
+ this.traverseChildren((ve: ViewElement) => addDataRefDriective(ve));
3230
+ }
3231
+ // 数据网格: 指令单元是线性布局 (数据列表结构也一样)
3232
+ // 1 向下能找到 一个绑定了数据源的元素
3233
+ // 2 向上是线性布局 卡片 template gridView
3234
+ };
3235
+ getEntityDataRef(this);
3064
3236
 
3065
3237
  if (vIfs.length === 2) parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
3066
3238
  else if (vIfs.length === 1) parts.push(`v-if="${vIfs[0]}"`);
@@ -3133,6 +3305,21 @@ export class ViewElement extends BaseNode {
3133
3305
  staticStyle = staticStyle.replace(/url\('\/assets\/(.*?)'\)/, `url('${this.app.sysPrefixPath}/assets/$1')`);
3134
3306
  }
3135
3307
  staticStyle && parts.push(`style="${staticStyle}"`);
3308
+ // input hidden属性 要翻译到上级元素的 栅格列的if指令
3309
+ // 从父查子 若有hidden 直接输出null
3310
+ if(this?.name?.includes('grid_layout_column')
3311
+ &&!(options?.filterAttr && options?.filterAttr?.length>0)){
3312
+ let checkHiddenAttr =(it:any) => it?.bindAttrs?.find((attr:any)=> attr?.name === 'processHidden')
3313
+ let getHiddenChild = (el:any)=>{
3314
+ return el.children?.find((it:any)=>{
3315
+ return it.children?.find((item:any)=>checkHiddenAttr(item) )
3316
+ //return checkHiddenAttr(it)
3317
+ })
3318
+ }
3319
+ if(getHiddenChild(this)){
3320
+ parts.push(`v-show="window.Vue.prototype.$env.VUE_APP_DESIGNER"`)
3321
+ }
3322
+ }
3136
3323
  if (!content.length) {
3137
3324
  shouldIndent = false;
3138
3325
  }
@@ -3163,14 +3350,7 @@ export class ViewElement extends BaseNode {
3163
3350
  * 从父级删除该节点
3164
3351
  * @internal
3165
3352
  */
3166
- delete() {
3167
- super.delete();
3168
- if (this.parentNode) {
3169
- this.traverseChildren((ele: ViewElement) => {
3170
- (this.likeComponent as any)?.removeExistingViewElement(ele);
3171
- });
3172
- }
3173
- }
3353
+ delete() {}
3174
3354
 
3175
3355
  findElementByName(name: string): ViewElement {
3176
3356
  return utils.traverse(
@@ -3414,6 +3594,16 @@ export class ViewElement extends BaseNode {
3414
3594
  this.getBindAttribute('processPrefix')
3415
3595
  );
3416
3596
  }
3597
+ getAncestorByTag<Node extends types.SyntaxNode = types.SyntaxNode>(
3598
+ concept: types.SyntaxNode['concept'],
3599
+ tag: string,
3600
+ ): Node {
3601
+ let parentNode = this?.parentNode;
3602
+ while (parentNode && parentNode.concept && !(parentNode.concept === concept && (parentNode as any)?.tag === tag)) {
3603
+ parentNode = parentNode.parentNode;
3604
+ }
3605
+ return parentNode as Node;
3606
+ }
3417
3607
  //================================================================================
3418
3608
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
3419
3609
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓