@lcap/nasl 1.0.0-alpha.2 → 1.0.0-alpha.5

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 (392) hide show
  1. package/README.md +3 -3
  2. package/docs/assets/search.js +1 -1
  3. package/docs/classes/Entity.html +2832 -204
  4. package/docs/classes/View.html +4567 -365
  5. package/out/common/BaseNode.d.ts +1 -1
  6. package/out/common/BaseNode.js +38 -23
  7. package/out/common/BaseNode.js.map +1 -1
  8. package/out/concepts/App__.d.ts +22 -0
  9. package/out/concepts/App__.js +77 -15
  10. package/out/concepts/App__.js.map +1 -1
  11. package/out/concepts/Argument__.d.ts +2 -1
  12. package/out/concepts/Argument__.js +2 -2
  13. package/out/concepts/Argument__.js.map +1 -1
  14. package/out/concepts/Assignment__.d.ts +2 -1
  15. package/out/concepts/Assignment__.js +3 -8
  16. package/out/concepts/Assignment__.js.map +1 -1
  17. package/out/concepts/Attribute__.js.map +1 -1
  18. package/out/concepts/BinaryExpression__.d.ts +2 -1
  19. package/out/concepts/BinaryExpression__.js +5 -5
  20. package/out/concepts/BinaryExpression__.js.map +1 -1
  21. package/out/concepts/BindAttribute__.d.ts +2 -1
  22. package/out/concepts/BindAttribute__.js +9 -4
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindDirective__.d.ts +2 -1
  25. package/out/concepts/BindDirective__.js +2 -2
  26. package/out/concepts/BindDirective__.js.map +1 -1
  27. package/out/concepts/BindEvent__.d.ts +2 -1
  28. package/out/concepts/BindEvent__.js +4 -3
  29. package/out/concepts/BindEvent__.js.map +1 -1
  30. package/out/concepts/BooleanLiteral__.d.ts +2 -1
  31. package/out/concepts/BooleanLiteral__.js +1 -1
  32. package/out/concepts/BooleanLiteral__.js.map +1 -1
  33. package/out/concepts/CallFunction__.d.ts +57 -1
  34. package/out/concepts/CallFunction__.js +119 -11
  35. package/out/concepts/CallFunction__.js.map +1 -1
  36. package/out/concepts/CallInterface__.d.ts +2 -1
  37. package/out/concepts/CallInterface__.js +2 -2
  38. package/out/concepts/CallInterface__.js.map +1 -1
  39. package/out/concepts/CallLogic__.d.ts +57 -1
  40. package/out/concepts/CallLogic__.js +117 -10
  41. package/out/concepts/CallLogic__.js.map +1 -1
  42. package/out/concepts/CallQueryComponent__.js +1 -1
  43. package/out/concepts/CallQueryComponent__.js.map +1 -1
  44. package/out/concepts/Comment__.js.map +1 -1
  45. package/out/concepts/CompletionProperty__.js.map +1 -1
  46. package/out/concepts/ConfigGroup__.d.ts +120 -0
  47. package/out/concepts/ConfigGroup__.js +214 -0
  48. package/out/concepts/ConfigGroup__.js.map +1 -0
  49. package/out/concepts/ConfigPropertyValue__.d.ts +43 -0
  50. package/out/concepts/ConfigPropertyValue__.js +103 -0
  51. package/out/concepts/ConfigPropertyValue__.js.map +1 -0
  52. package/out/concepts/ConfigProperty__.d.ts +128 -0
  53. package/out/concepts/ConfigProperty__.js +236 -0
  54. package/out/concepts/ConfigProperty__.js.map +1 -0
  55. package/out/concepts/Configuration__.d.ts +120 -0
  56. package/out/concepts/Configuration__.js +210 -0
  57. package/out/concepts/Configuration__.js.map +1 -0
  58. package/out/concepts/Constant__.d.ts +2 -1
  59. package/out/concepts/Constant__.js +1 -1
  60. package/out/concepts/Constant__.js.map +1 -1
  61. package/out/concepts/DataElement__.js.map +1 -1
  62. package/out/concepts/Destination__.d.ts +2 -1
  63. package/out/concepts/Destination__.js +4 -3
  64. package/out/concepts/Destination__.js.map +1 -1
  65. package/out/concepts/End__.js.map +1 -1
  66. package/out/concepts/EntityIndex__.d.ts +8 -0
  67. package/out/concepts/EntityIndex__.js +18 -0
  68. package/out/concepts/EntityIndex__.js.map +1 -1
  69. package/out/concepts/EntityProperty__.d.ts +5 -5
  70. package/out/concepts/EntityProperty__.js +10 -9
  71. package/out/concepts/EntityProperty__.js.map +1 -1
  72. package/out/concepts/Entity__.d.ts +30 -26
  73. package/out/concepts/Entity__.js +44 -36
  74. package/out/concepts/Entity__.js.map +1 -1
  75. package/out/concepts/EnumItem__.js.map +1 -1
  76. package/out/concepts/Enum__.d.ts +8 -8
  77. package/out/concepts/Enum__.js +10 -4
  78. package/out/concepts/Enum__.js.map +1 -1
  79. package/out/concepts/Event__.js +1 -1
  80. package/out/concepts/Event__.js.map +1 -1
  81. package/out/concepts/ForEachStatement__.d.ts +35 -33
  82. package/out/concepts/ForEachStatement__.js +103 -36
  83. package/out/concepts/ForEachStatement__.js.map +1 -1
  84. package/out/concepts/Function__.js +1 -1
  85. package/out/concepts/Function__.js.map +1 -1
  86. package/out/concepts/Identifier__.d.ts +2 -1
  87. package/out/concepts/Identifier__.js +15 -1
  88. package/out/concepts/Identifier__.js.map +1 -1
  89. package/out/concepts/IfStatement__.js.map +1 -1
  90. package/out/concepts/InterfaceParam__.js +1 -1
  91. package/out/concepts/InterfaceParam__.js.map +1 -1
  92. package/out/concepts/Interface__.d.ts +5 -1
  93. package/out/concepts/Interface__.js +19 -5
  94. package/out/concepts/Interface__.js.map +1 -1
  95. package/out/concepts/JSBlock__.js.map +1 -1
  96. package/out/concepts/LogicItem__.d.ts +2 -1
  97. package/out/concepts/LogicItem__.js +2 -2
  98. package/out/concepts/LogicItem__.js.map +1 -1
  99. package/out/concepts/Logic__.js +9 -7
  100. package/out/concepts/Logic__.js.map +1 -1
  101. package/out/concepts/MemberExpression__.d.ts +2 -5
  102. package/out/concepts/MemberExpression__.js +12 -18
  103. package/out/concepts/MemberExpression__.js.map +1 -1
  104. package/out/concepts/Module__.d.ts +121 -126
  105. package/out/concepts/Module__.js +10 -17
  106. package/out/concepts/Module__.js.map +1 -1
  107. package/out/concepts/Namespace__.js +12 -12
  108. package/out/concepts/Namespace__.js.map +1 -1
  109. package/out/concepts/NullLiteral__.d.ts +2 -1
  110. package/out/concepts/NullLiteral__.js +1 -1
  111. package/out/concepts/NullLiteral__.js.map +1 -1
  112. package/out/concepts/NumericLiteral__.d.ts +2 -1
  113. package/out/concepts/NumericLiteral__.js +1 -1
  114. package/out/concepts/NumericLiteral__.js.map +1 -1
  115. package/out/concepts/Param__.d.ts +1 -1
  116. package/out/concepts/Param__.js +2 -2
  117. package/out/concepts/Param__.js.map +1 -1
  118. package/out/concepts/Point__.js.map +1 -1
  119. package/out/concepts/ProcessComponent__.js +2 -2
  120. package/out/concepts/ProcessComponent__.js.map +1 -1
  121. package/out/concepts/ProcessElement__.d.ts +82 -81
  122. package/out/concepts/ProcessElement__.js +19 -6
  123. package/out/concepts/ProcessElement__.js.map +1 -1
  124. package/out/concepts/ProcessOutcome__.js.map +1 -1
  125. package/out/concepts/Process__.d.ts +1 -0
  126. package/out/concepts/Process__.js +10 -4
  127. package/out/concepts/Process__.js.map +1 -1
  128. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  129. package/out/concepts/QueryFieldExpression__.js +1 -1
  130. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  131. package/out/concepts/QueryFromExpression__.js.map +1 -1
  132. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  133. package/out/concepts/QueryJoinExpression__.js +1 -1
  134. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  135. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  136. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  137. package/out/concepts/QuerySelectExpression__.js +1 -1
  138. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  139. package/out/concepts/Rect__.js.map +1 -1
  140. package/out/concepts/Return__.d.ts +1 -1
  141. package/out/concepts/Return__.js +2 -2
  142. package/out/concepts/Return__.js.map +1 -1
  143. package/out/concepts/Role__.d.ts +5 -0
  144. package/out/concepts/Role__.js +19 -2
  145. package/out/concepts/Role__.js.map +1 -1
  146. package/out/concepts/Slot__.js.map +1 -1
  147. package/out/concepts/SqlQueryComponent__.d.ts +2 -0
  148. package/out/concepts/SqlQueryComponent__.js +16 -0
  149. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  150. package/out/concepts/Start__.js.map +1 -1
  151. package/out/concepts/StringLiteral__.d.ts +2 -1
  152. package/out/concepts/StringLiteral__.js +1 -1
  153. package/out/concepts/StringLiteral__.js.map +1 -1
  154. package/out/concepts/StructureProperty__.d.ts +1 -1
  155. package/out/concepts/StructureProperty__.js +1 -1
  156. package/out/concepts/StructureProperty__.js.map +1 -1
  157. package/out/concepts/Structure__.d.ts +1 -1
  158. package/out/concepts/Structure__.js +4 -4
  159. package/out/concepts/Structure__.js.map +1 -1
  160. package/out/concepts/SwitchCase__.js.map +1 -1
  161. package/out/concepts/SwitchStatement__.js.map +1 -1
  162. package/out/concepts/Theme__.js.map +1 -1
  163. package/out/concepts/Transactional__.js.map +1 -1
  164. package/out/concepts/TypeAnnotation__.js +3 -0
  165. package/out/concepts/TypeAnnotation__.js.map +1 -1
  166. package/out/concepts/TypeParam__.js.map +1 -1
  167. package/out/concepts/UnaryExpression__.d.ts +2 -1
  168. package/out/concepts/UnaryExpression__.js +3 -3
  169. package/out/concepts/UnaryExpression__.js.map +1 -1
  170. package/out/concepts/Unparsed__.d.ts +2 -1
  171. package/out/concepts/Unparsed__.js +1 -1
  172. package/out/concepts/Unparsed__.js.map +1 -1
  173. package/out/concepts/UseComponent__.js.map +1 -1
  174. package/out/concepts/ValidationRule__.d.ts +2 -1
  175. package/out/concepts/ValidationRule__.js +2 -2
  176. package/out/concepts/ValidationRule__.js.map +1 -1
  177. package/out/concepts/Variable__.d.ts +6 -5
  178. package/out/concepts/Variable__.js +3 -3
  179. package/out/concepts/Variable__.js.map +1 -1
  180. package/out/concepts/ViewComponent__.js +5 -5
  181. package/out/concepts/ViewComponent__.js.map +1 -1
  182. package/out/concepts/ViewElement__.d.ts +5 -4
  183. package/out/concepts/ViewElement__.js +109 -65
  184. package/out/concepts/ViewElement__.js.map +1 -1
  185. package/out/concepts/View__.d.ts +97 -90
  186. package/out/concepts/View__.js +153 -118
  187. package/out/concepts/View__.js.map +1 -1
  188. package/out/concepts/WhileStatement__.js.map +1 -1
  189. package/out/concepts/basics/stdlib/index.js +2 -2
  190. package/out/concepts/basics/stdlib/index.js.map +1 -1
  191. package/out/concepts/basics/stdlib/nasl.ui.js +3 -137
  192. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  193. package/out/concepts/basics/stdlib/nasl.util.js +21 -5
  194. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  195. package/out/concepts/basics/stdlib/nasl.validation.d.ts +3 -0
  196. package/out/concepts/basics/stdlib/nasl.validation.js +527 -0
  197. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -0
  198. package/out/concepts/index__.d.ts +4 -0
  199. package/out/concepts/index__.js +4 -0
  200. package/out/concepts/index__.js.map +1 -1
  201. package/out/data/Module.d.ts +34 -0
  202. package/out/data/Module.js +53 -0
  203. package/out/data/Module.js.map +1 -0
  204. package/out/generator/compileComponent.d.ts +1 -1
  205. package/out/generator/genBundleFiles.d.ts +0 -1
  206. package/out/generator/genBundleFiles.js +1 -1
  207. package/out/generator/genBundleFiles.js.map +1 -1
  208. package/out/generator/genMetaData.d.ts +35 -0
  209. package/out/generator/genMetaData.js +78 -0
  210. package/out/generator/genMetaData.js.map +1 -0
  211. package/out/generator/index.d.ts +1 -0
  212. package/out/generator/index.js +1 -0
  213. package/out/generator/index.js.map +1 -1
  214. package/out/index.d.ts +2 -2
  215. package/out/index.js +3 -1
  216. package/out/index.js.map +1 -1
  217. package/out/server/createUiTs.d.ts +7 -0
  218. package/out/server/createUiTs.js +157 -0
  219. package/out/server/createUiTs.js.map +1 -0
  220. package/out/server/entity2LogicNamespace.d.ts +9 -1
  221. package/out/server/entity2LogicNamespace.js +11 -1
  222. package/out/server/entity2LogicNamespace.js.map +1 -1
  223. package/out/server/getExtensionModules.d.ts +3 -0
  224. package/out/server/getExtensionModules.js +18 -0
  225. package/out/server/getExtensionModules.js.map +1 -0
  226. package/out/server/getLogics.js +18 -15
  227. package/out/server/getLogics.js.map +1 -1
  228. package/out/server/getMemberIdentifier.d.ts +3 -2
  229. package/out/server/getMemberIdentifier.js +47 -15
  230. package/out/server/getMemberIdentifier.js.map +1 -1
  231. package/out/server/getProcesses.d.ts +4 -1
  232. package/out/server/getProcesses.js +16 -7
  233. package/out/server/getProcesses.js.map +1 -1
  234. package/out/server/getValidates.js +1 -1
  235. package/out/server/getValidates.js.map +1 -1
  236. package/out/server/index.js +1 -0
  237. package/out/server/index.js.map +1 -1
  238. package/out/server/naslServer.d.ts +23 -5
  239. package/out/server/naslServer.js +199 -25
  240. package/out/server/naslServer.js.map +1 -1
  241. package/out/server/process2LogicNamespace.d.ts +15 -1
  242. package/out/server/process2LogicNamespace.js +30 -3
  243. package/out/server/process2LogicNamespace.js.map +1 -1
  244. package/out/server/translator.js +28 -0
  245. package/out/server/translator.js.map +1 -1
  246. package/out/service/storage/init.d.ts +5 -0
  247. package/out/service/storage/init.js +60 -52
  248. package/out/service/storage/init.js.map +1 -1
  249. package/out/templator/genCallComponentLogic.js +2 -2
  250. package/out/templator/genCallComponentLogic.js.map +1 -1
  251. package/out/templator/genCreateBlock.js +6 -8
  252. package/out/templator/genCreateBlock.js.map +1 -1
  253. package/out/templator/genCurdEditMultipleKeyBlock.js +3 -3
  254. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  255. package/out/templator/genCurdMultipleKeyBlock.js +4 -4
  256. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  257. package/out/templator/genEditTableBlock.js +3 -3
  258. package/out/templator/genEditTableBlock.js.map +1 -1
  259. package/out/templator/genGetBlock.js +1 -1
  260. package/out/templator/genGetBlock.js.map +1 -1
  261. package/out/templator/genListViewBlock.js +2 -2
  262. package/out/templator/genListViewBlock.js.map +1 -1
  263. package/out/templator/genSelectBlock.js +1 -1
  264. package/out/templator/genSelectBlock.js.map +1 -1
  265. package/out/templator/genUpdateBlock.js +8 -12
  266. package/out/templator/genUpdateBlock.js.map +1 -1
  267. package/out/templator/utils.d.ts +20 -20
  268. package/out/templator/utils.js +22 -22
  269. package/out/templator/utils.js.map +1 -1
  270. package/package.json +3 -1
  271. package/src/automate/engine/index.js +37 -3
  272. package/src/automate/engine/utils.js +68 -64
  273. package/src/common/BaseNode.ts +43 -28
  274. package/src/concepts/App__.ts +93 -17
  275. package/src/concepts/Argument__.ts +4 -2
  276. package/src/concepts/Assignment__.ts +5 -7
  277. package/src/concepts/Attribute__.ts +1 -0
  278. package/src/concepts/BinaryExpression__.ts +7 -5
  279. package/src/concepts/BindAttribute__.ts +9 -4
  280. package/src/concepts/BindDirective__.ts +4 -2
  281. package/src/concepts/BindEvent__.ts +6 -4
  282. package/src/concepts/BooleanLiteral__.ts +3 -1
  283. package/src/concepts/CallFunction__.ts +195 -11
  284. package/src/concepts/CallInterface__.ts +4 -2
  285. package/src/concepts/CallLogic__.ts +211 -12
  286. package/src/concepts/CallQueryComponent__.ts +2 -1
  287. package/src/concepts/Comment__.ts +1 -0
  288. package/src/concepts/CompletionProperty__.ts +1 -0
  289. package/src/concepts/ConfigGroup__.ts +290 -0
  290. package/src/concepts/ConfigPropertyValue__.ts +112 -0
  291. package/src/concepts/ConfigProperty__.ts +306 -0
  292. package/src/concepts/Configuration__.ts +286 -0
  293. package/src/concepts/Constant__.ts +3 -1
  294. package/src/concepts/DataElement__.ts +1 -0
  295. package/src/concepts/Destination__.ts +7 -5
  296. package/src/concepts/End__.ts +1 -0
  297. package/src/concepts/EntityIndex__.ts +19 -0
  298. package/src/concepts/EntityProperty__.ts +9 -8
  299. package/src/concepts/Entity__.ts +66 -59
  300. package/src/concepts/EnumItem__.ts +1 -0
  301. package/src/concepts/Enum__.ts +32 -12
  302. package/src/concepts/Event__.ts +2 -1
  303. package/src/concepts/ForEachStatement__.ts +115 -69
  304. package/src/concepts/Function__.ts +2 -1
  305. package/src/concepts/Identifier__.ts +18 -1
  306. package/src/concepts/IfStatement__.ts +1 -0
  307. package/src/concepts/InterfaceParam__.ts +2 -1
  308. package/src/concepts/Interface__.ts +21 -5
  309. package/src/concepts/JSBlock__.ts +1 -0
  310. package/src/concepts/LogicItem__.ts +9 -40
  311. package/src/concepts/Logic__.ts +48 -9
  312. package/src/concepts/MemberExpression__.ts +14 -17
  313. package/src/concepts/Module__.ts +158 -139
  314. package/src/concepts/Namespace__.ts +13 -12
  315. package/src/concepts/NullLiteral__.ts +3 -1
  316. package/src/concepts/NumericLiteral__.ts +3 -1
  317. package/src/concepts/Param__.ts +3 -2
  318. package/src/concepts/Point__.ts +1 -0
  319. package/src/concepts/ProcessComponent__.ts +3 -2
  320. package/src/concepts/ProcessElement__.ts +102 -107
  321. package/src/concepts/ProcessOutcome__.ts +1 -0
  322. package/src/concepts/Process__.ts +12 -4
  323. package/src/concepts/QueryAggregateExpression__.ts +1 -0
  324. package/src/concepts/QueryFieldExpression__.ts +2 -1
  325. package/src/concepts/QueryFromExpression__.ts +1 -0
  326. package/src/concepts/QueryGroupByExpression__.ts +1 -0
  327. package/src/concepts/QueryJoinExpression__.ts +2 -1
  328. package/src/concepts/QueryLimitExpression__.ts +1 -0
  329. package/src/concepts/QueryOrderByExpression__.ts +1 -0
  330. package/src/concepts/QuerySelectExpression__.ts +2 -1
  331. package/src/concepts/Rect__.ts +1 -0
  332. package/src/concepts/Return__.ts +3 -2
  333. package/src/concepts/Role__.ts +19 -2
  334. package/src/concepts/Slot__.ts +1 -0
  335. package/src/concepts/SqlQueryComponent__.ts +11 -1
  336. package/src/concepts/Start__.ts +1 -0
  337. package/src/concepts/StringLiteral__.ts +3 -1
  338. package/src/concepts/StructureProperty__.ts +2 -1
  339. package/src/concepts/Structure__.ts +5 -4
  340. package/src/concepts/SwitchCase__.ts +1 -0
  341. package/src/concepts/SwitchStatement__.ts +1 -0
  342. package/src/concepts/Theme__.ts +1 -0
  343. package/src/concepts/Transactional__.ts +1 -0
  344. package/src/concepts/TypeAnnotation__.ts +4 -0
  345. package/src/concepts/TypeParam__.ts +1 -0
  346. package/src/concepts/UnaryExpression__.ts +6 -3
  347. package/src/concepts/Unparsed__.ts +3 -1
  348. package/src/concepts/UseComponent__.ts +1 -0
  349. package/src/concepts/ValidationRule__.ts +5 -2
  350. package/src/concepts/Variable__.ts +12 -6
  351. package/src/concepts/ViewComponent__.ts +6 -5
  352. package/src/concepts/ViewElement__.ts +109 -80
  353. package/src/concepts/View__.ts +245 -206
  354. package/src/concepts/WhileStatement__.ts +1 -0
  355. package/src/concepts/basics/stdlib/index.ts +2 -2
  356. package/src/concepts/basics/stdlib/nasl.ui.ts +3 -137
  357. package/src/concepts/basics/stdlib/nasl.util.ts +21 -5
  358. package/src/concepts/basics/stdlib/{nasl.validate.ts → nasl.validation.ts} +28 -28
  359. package/src/concepts/index__.ts +4 -0
  360. package/src/generator/compileComponent.ts +1 -1
  361. package/src/generator/genBundleFiles.ts +1 -2
  362. package/src/generator/genMetaData.ts +111 -0
  363. package/src/generator/index.ts +1 -0
  364. package/src/index.ts +2 -2
  365. package/src/server/createUiTs.ts +153 -0
  366. package/src/server/entity2LogicNamespace.ts +17 -1
  367. package/src/server/getExtensionModules.ts +13 -0
  368. package/src/server/getLogics.ts +19 -18
  369. package/src/server/getMemberIdentifier.ts +60 -19
  370. package/src/server/getProcesses.ts +15 -8
  371. package/src/server/getValidates.ts +1 -1
  372. package/src/server/index.ts +2 -1
  373. package/src/server/naslServer.ts +204 -24
  374. package/src/server/process2LogicNamespace.ts +44 -3
  375. package/src/server/translator.ts +121 -97
  376. package/src/service/config/api.js +32 -0
  377. package/src/service/config/index.js +6 -0
  378. package/src/service/creator/index.js +2 -2
  379. package/src/service/logic/checktypeSocket.js +49 -0
  380. package/src/service/modules/api.js +20 -0
  381. package/src/service/modules/index.js +6 -0
  382. package/src/service/storage/init.ts +62 -54
  383. package/src/templator/genCallComponentLogic.ts +2 -2
  384. package/src/templator/genCreateBlock.ts +19 -25
  385. package/src/templator/genCurdEditMultipleKeyBlock.ts +3 -3
  386. package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
  387. package/src/templator/genEditTableBlock.ts +3 -3
  388. package/src/templator/genGetBlock.ts +1 -1
  389. package/src/templator/genListViewBlock.ts +2 -2
  390. package/src/templator/genSelectBlock.ts +1 -1
  391. package/src/templator/genUpdateBlock.ts +19 -25
  392. package/src/templator/utils.ts +25 -153
@@ -1,7 +1,7 @@
1
1
  import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
2
2
  import Namespace from './Namespace__';
3
3
  import CallQueryComponent from './CallQueryComponent__';
4
- import pluralize = require('pluralize')
4
+ import pluralize = require('pluralize');
5
5
  import { kebabCase } from 'lodash';
6
6
  //================================================================================
7
7
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -11,6 +11,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
11
11
  import { concept, excludedInJSON, property } from '../decorators';
12
12
 
13
13
  import * as utils from '../utils';
14
+ import { v4 as uuidv4 } from 'uuid';
14
15
  import BaseNode from '../common/BaseNode';
15
16
  import classMap from '../common/classMap';
16
17
  import Transactional from './Transactional__';
@@ -188,9 +189,9 @@ export class Logic extends BaseNode {
188
189
  });
189
190
  }
190
191
 
191
- getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
192
+ getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
192
193
  const excludedSet = new Set(excludedList);
193
- return this.typeParams.filter((item) => !excludedSet.has(item)).map((item) => item.name);
194
+ return (this.typeParams || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
194
195
  }
195
196
  getTypeParamUniqueName(name = 'typeParam1') {
196
197
  return utils.unique(name, this.getTypeParamExistingNames());
@@ -329,6 +330,7 @@ export class Logic extends BaseNode {
329
330
  return node;
330
331
  }
331
332
 
333
+
332
334
  getParamUniqueName(name = 'param1') {
333
335
  return utils.unique(name, this.getVarExistingNames());
334
336
  }
@@ -466,6 +468,7 @@ export class Logic extends BaseNode {
466
468
  return node;
467
469
  }
468
470
 
471
+
469
472
  getReturnUniqueName(name = 'result1') {
470
473
  return utils.unique(name, this.getVarExistingNames());
471
474
  }
@@ -603,6 +606,7 @@ export class Logic extends BaseNode {
603
606
  return node;
604
607
  }
605
608
 
609
+
606
610
  getVariableUniqueName(name = 'variable1') {
607
611
  return utils.unique(name, this.getVarExistingNames());
608
612
  }
@@ -740,6 +744,11 @@ export class Logic extends BaseNode {
740
744
  return node;
741
745
  }
742
746
 
747
+
748
+
749
+
750
+
751
+
743
752
  /**
744
753
  * 插入逻辑项
745
754
  * @internal
@@ -772,6 +781,8 @@ export class Logic extends BaseNode {
772
781
  return logicItem;
773
782
  }
774
783
 
784
+
785
+
775
786
  /**
776
787
  * 插入逻辑项
777
788
  * @param logicItemOptions 逻辑项参数
@@ -794,6 +805,8 @@ export class Logic extends BaseNode {
794
805
  return node;
795
806
  }
796
807
 
808
+
809
+
797
810
  /**
798
811
  * 添加逻辑项
799
812
  * @internal
@@ -813,6 +826,8 @@ export class Logic extends BaseNode {
813
826
  return this._insertItemInBodyAt(options as any, index);
814
827
  }
815
828
 
829
+
830
+
816
831
  /**
817
832
  * 添加逻辑项
818
833
  * @param logicItemOptions 逻辑项参数
@@ -836,6 +851,8 @@ export class Logic extends BaseNode {
836
851
  return node;
837
852
  }
838
853
 
854
+
855
+
839
856
  /**
840
857
  * 插入逻辑项
841
858
  * @internal
@@ -868,6 +885,8 @@ export class Logic extends BaseNode {
868
885
  return logicItem;
869
886
  }
870
887
 
888
+
889
+
871
890
  /**
872
891
  * 插入逻辑项
873
892
  * @param logicItemOptions 逻辑项参数
@@ -890,6 +909,8 @@ export class Logic extends BaseNode {
890
909
  return node;
891
910
  }
892
911
 
912
+
913
+
893
914
  /**
894
915
  * 添加逻辑项
895
916
  * @internal
@@ -909,6 +930,8 @@ export class Logic extends BaseNode {
909
930
  return this._insertItemInPlaygroundAt(options as any, index);
910
931
  }
911
932
 
933
+
934
+
912
935
  /**
913
936
  * 添加逻辑项
914
937
  * @param logicItemOptions 逻辑项参数
@@ -932,6 +955,9 @@ export class Logic extends BaseNode {
932
955
  return node;
933
956
  }
934
957
 
958
+
959
+
960
+
935
961
  /**
936
962
  * 删除事务
937
963
  * @param name 事务名称
@@ -980,6 +1006,8 @@ export class Logic extends BaseNode {
980
1006
  return params;
981
1007
  }
982
1008
 
1009
+
1010
+
983
1011
  /**
984
1012
  * 删除类型参数
985
1013
  * @param name 类型参数名称
@@ -1028,6 +1056,8 @@ export class Logic extends BaseNode {
1028
1056
  return params;
1029
1057
  }
1030
1058
 
1059
+
1060
+
1031
1061
  /**
1032
1062
  * 删除输入参数
1033
1063
  * @param name 输入参数名称
@@ -1076,6 +1106,8 @@ export class Logic extends BaseNode {
1076
1106
  return params;
1077
1107
  }
1078
1108
 
1109
+
1110
+
1079
1111
  /**
1080
1112
  * 删除输出参数
1081
1113
  * @param name 输出参数名称
@@ -1124,6 +1156,8 @@ export class Logic extends BaseNode {
1124
1156
  return params;
1125
1157
  }
1126
1158
 
1159
+
1160
+
1127
1161
  /**
1128
1162
  * 删除局部变量
1129
1163
  * @param name 局部变量名称
@@ -1172,6 +1206,8 @@ export class Logic extends BaseNode {
1172
1206
  return params;
1173
1207
  }
1174
1208
 
1209
+
1210
+
1175
1211
  /**
1176
1212
  * 删除逻辑项
1177
1213
  * @param logicItem 已有的逻辑项实例
@@ -1179,10 +1215,12 @@ export class Logic extends BaseNode {
1179
1215
  removeItemInBody(logicItem: LogicItem): void;
1180
1216
 
1181
1217
  removeItemInBody(options: LogicItem) {
1182
- const logicItem: LogicItem = options;
1218
+ let logicItem: LogicItem = options;
1183
1219
  return logicItem.delete();
1184
1220
  }
1185
1221
 
1222
+
1223
+
1186
1224
  /**
1187
1225
  * 删除逻辑项
1188
1226
  * @param logicItem 已有的逻辑项实例
@@ -1190,7 +1228,7 @@ export class Logic extends BaseNode {
1190
1228
  removeItemInPlayground(logicItem: LogicItem): void;
1191
1229
 
1192
1230
  removeItemInPlayground(options: LogicItem) {
1193
- const logicItem: LogicItem = options;
1231
+ let logicItem: LogicItem = options;
1194
1232
  return logicItem.delete();
1195
1233
  }
1196
1234
 
@@ -1414,12 +1452,12 @@ export class Logic extends BaseNode {
1414
1452
  getNamespace(): string {
1415
1453
  if (this.parentNode) {
1416
1454
  let parentNodeNamespace = '';
1417
- if (this.parentNode instanceof Namespace || this.parentNode instanceof App) {
1455
+ if (this.parentNode instanceof Namespace || this.parentNode instanceof App || this.parentNode instanceof Module) {
1418
1456
  parentNodeNamespace = this.parentNode.getNamespace();
1419
1457
  }
1420
1458
  parentNodeNamespace = parentNodeNamespace.includes('.logics') ? parentNodeNamespace : `${parentNodeNamespace}.logics`;
1421
1459
  if (this.parentNode instanceof View) {
1422
- return parentNodeNamespace = '';
1460
+ return (parentNodeNamespace = '');
1423
1461
  }
1424
1462
  return parentNodeNamespace;
1425
1463
  } else
@@ -1431,7 +1469,8 @@ export class Logic extends BaseNode {
1431
1469
  * @param name 一般不用传,用于 rename
1432
1470
  */
1433
1471
  getEmbeddedFilePath(name = this.name) {
1434
- return `/embedded/${this.app.name}/logics/${name}.ts`;
1472
+ const _path = this.module ? `/${this.module.parentKey}/${this.module.name}` : '';
1473
+ return `/embedded/${this.app.name}${_path}/logics/${name}.ts`;
1435
1474
  }
1436
1475
 
1437
1476
  toEmbeddedTSFile() {
@@ -1490,7 +1529,7 @@ export class Logic extends BaseNode {
1490
1529
  //================================================================================
1491
1530
  }
1492
1531
 
1493
- classMap.Logic = Logic;
1532
+ classMap['Logic'] = Logic;
1494
1533
  export default Logic;
1495
1534
  //================================================================================
1496
1535
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -1,4 +1,5 @@
1
1
  import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { ElementToVueOptions } from './ViewElement__';
2
3
 
3
4
  //================================================================================
4
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -8,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
8
9
  import { concept, excludedInJSON, property } from '../decorators';
9
10
 
10
11
  import * as utils from '../utils';
12
+ import { v4 as uuidv4 } from 'uuid';
11
13
  import BaseNode from '../common/BaseNode';
12
14
  import classMap from '../common/classMap';
13
15
  import LogicItem from './LogicItem__';
@@ -137,26 +139,21 @@ export class MemberExpression extends LogicItem {
137
139
  // 自动生成的代码已结束。下面可以手动编写。
138
140
  //================================================================================
139
141
 
140
- /**
141
- * object的替代品(用object值会丢失)
142
- */
143
- @property('LogicItem')
144
- objectqwer: LogicItem = undefined;
145
-
146
- toVue() {
147
- const object: string = this.objectqwer.toVue();
148
- const property = this.property.toVue();
149
- return `${object}.${property}`;
142
+ toVue(options?: ElementToVueOptions) {
143
+ const object: string = this.object.toVue(options);
144
+ const property = this.property.toVue(options);
145
+ const lastPart = object.split(' && ').pop();
146
+ return options?.finalCode === false ? `${object}.${property}` : `${object} && ${lastPart}.${property}`;
150
147
  }
151
148
 
152
149
  toUI(): string {
153
- const object: string = this.objectqwer.toUI();
150
+ const object: string = this.object.toUI();
154
151
  const property = this.property.toUI();
155
152
  return `${object}.${property}`;
156
153
  }
157
154
 
158
155
  toJS(): string {
159
- const object: string = this.objectqwer.toJS();
156
+ const object: string = this.object.toJS();
160
157
  const property = this.property.toJS();
161
158
  const lastPart = object.split(' && ').pop();
162
159
  return `${object} && ${lastPart}.${property}`;
@@ -168,12 +165,12 @@ export class MemberExpression extends LogicItem {
168
165
  let arrIndex = 0;
169
166
 
170
167
  let current: any = this;
171
- while (current.objectqwer) {
168
+ while (current.object) {
172
169
  if (current.property.name !== newValueList[arrIndex]) {
173
170
  current.property.setName(newValueList[arrIndex]);
174
171
  return;
175
172
  }
176
- current = current.objectqwer;
173
+ current = current.object;
177
174
  arrIndex++;
178
175
  }
179
176
  // 前面没有找到,到这里就是最后一项的值要修改
@@ -201,10 +198,10 @@ export class MemberExpression extends LogicItem {
201
198
  let value: string = '';
202
199
  // MemberExpression 有两个属性object代表父级,property代表自己
203
200
  // 先向上找父级的值在获取自己的值进行拼接
204
- while (current.objectqwer) {
201
+ while (current.object) {
205
202
  const currentValue = current.property.name;
206
203
  value = value ? currentValue + '.' + value : currentValue;
207
- current = current.objectqwer;
204
+ current = current.object;
208
205
  }
209
206
 
210
207
  // 最后一个是Identifier,他的值是自己的name
@@ -221,7 +218,7 @@ export class MemberExpression extends LogicItem {
221
218
  @withSourceMap()
222
219
  toEmbeddedTS(state?: TranslatorState): string {
223
220
  let code = '';
224
- code += this.objectqwer ? this.objectqwer.toEmbeddedTS(shiftState(state, code, { inline: true })) + '.' : '';
221
+ code += this.object ? this.object.toEmbeddedTS(shiftState(state, code, { inline: true })) + '.' : '';
225
222
  code += this.property ? this.property.toEmbeddedTS(shiftState(state, code, { inline: true })) : '';
226
223
  return code;
227
224
  }