@lcap/nasl 1.0.1 → 2.12.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/out/automate/engine/index.d.ts +1 -0
  2. package/out/automate/engine/index.js +34 -12
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/operators.d.ts +10 -2
  5. package/out/automate/engine/operators.js +105 -7
  6. package/out/automate/engine/operators.js.map +1 -1
  7. package/out/automate/engine/uniqueName.d.ts +8 -2
  8. package/out/automate/engine/uniqueName.js +72 -4
  9. package/out/automate/engine/uniqueName.js.map +1 -1
  10. package/out/automate/engine/utils.d.ts +1 -0
  11. package/out/automate/engine/utils.js +108 -67
  12. package/out/automate/engine/utils.js.map +1 -1
  13. package/out/automate/template/process.d.ts +9 -0
  14. package/out/automate/template/process.js +10976 -0
  15. package/out/automate/template/process.js.map +1 -0
  16. package/out/bak/translator.js +1 -0
  17. package/out/bak/translator.js.map +1 -1
  18. package/out/common/BaseNode.d.ts +6 -1
  19. package/out/common/BaseNode.js +37 -6
  20. package/out/common/BaseNode.js.map +1 -1
  21. package/out/concepts/App__.d.ts +52 -49
  22. package/out/concepts/App__.js +89 -53
  23. package/out/concepts/App__.js.map +1 -1
  24. package/out/concepts/Assignee__.d.ts +11 -0
  25. package/out/concepts/Assignee__.js +34 -0
  26. package/out/concepts/Assignee__.js.map +1 -1
  27. package/out/concepts/BindAttribute__.js +2 -2
  28. package/out/concepts/BindAttribute__.js.map +1 -1
  29. package/out/concepts/BindDirective__.js +10 -3
  30. package/out/concepts/BindDirective__.js.map +1 -1
  31. package/out/concepts/BindEvent__.js +15 -6
  32. package/out/concepts/BindEvent__.js.map +1 -1
  33. package/out/concepts/BooleanLiteral__.d.ts +4 -0
  34. package/out/concepts/BooleanLiteral__.js +11 -0
  35. package/out/concepts/BooleanLiteral__.js.map +1 -1
  36. package/out/concepts/CallFunction__.js +9 -4
  37. package/out/concepts/CallFunction__.js.map +1 -1
  38. package/out/concepts/CallLogic__.js +48 -30
  39. package/out/concepts/CallLogic__.js.map +1 -1
  40. package/out/concepts/CallQueryComponent__.d.ts +34 -4
  41. package/out/concepts/CallQueryComponent__.js +340 -95
  42. package/out/concepts/CallQueryComponent__.js.map +1 -1
  43. package/out/concepts/Comment__.js +1 -1
  44. package/out/concepts/Comment__.js.map +1 -1
  45. package/out/concepts/ConfigGroup__.d.ts +1 -0
  46. package/out/concepts/ConfigGroup__.js +7 -0
  47. package/out/concepts/ConfigGroup__.js.map +1 -1
  48. package/out/concepts/ConfigProperty__.d.ts +1 -0
  49. package/out/concepts/ConfigProperty__.js +3 -0
  50. package/out/concepts/ConfigProperty__.js.map +1 -1
  51. package/out/concepts/Configuration__.d.ts +1 -0
  52. package/out/concepts/Configuration__.js +3 -0
  53. package/out/concepts/Configuration__.js.map +1 -1
  54. package/out/concepts/Constant__.js +6 -6
  55. package/out/concepts/Constant__.js.map +1 -1
  56. package/out/concepts/DataSource__.d.ts +143 -0
  57. package/out/concepts/DataSource__.js +318 -0
  58. package/out/concepts/DataSource__.js.map +1 -0
  59. package/out/concepts/Destination__.js +22 -8
  60. package/out/concepts/Destination__.js.map +1 -1
  61. package/out/concepts/End__.js +2 -2
  62. package/out/concepts/End__.js.map +1 -1
  63. package/out/concepts/EntityIndex__.d.ts +5 -0
  64. package/out/concepts/EntityIndex__.js +10 -2
  65. package/out/concepts/EntityIndex__.js.map +1 -1
  66. package/out/concepts/EntityProperty__.d.ts +9 -0
  67. package/out/concepts/EntityProperty__.js +22 -7
  68. package/out/concepts/EntityProperty__.js.map +1 -1
  69. package/out/concepts/Entity__.d.ts +6 -0
  70. package/out/concepts/Entity__.js +27 -11
  71. package/out/concepts/Entity__.js.map +1 -1
  72. package/out/concepts/Enum__.d.ts +1 -0
  73. package/out/concepts/Enum__.js +14 -4
  74. package/out/concepts/Enum__.js.map +1 -1
  75. package/out/concepts/ForEachStatement__.js +2 -2
  76. package/out/concepts/ForEachStatement__.js.map +1 -1
  77. package/out/concepts/Function__.d.ts +18 -0
  78. package/out/concepts/Function__.js +96 -1
  79. package/out/concepts/Function__.js.map +1 -1
  80. package/out/concepts/Identifier__.js +5 -14
  81. package/out/concepts/Identifier__.js.map +1 -1
  82. package/out/concepts/IfStatement__.js +8 -8
  83. package/out/concepts/IfStatement__.js.map +1 -1
  84. package/out/concepts/InterfaceParam__.js +9 -4
  85. package/out/concepts/InterfaceParam__.js.map +1 -1
  86. package/out/concepts/Interface__.js +19 -12
  87. package/out/concepts/Interface__.js.map +1 -1
  88. package/out/concepts/JSBlock__.js +3 -5
  89. package/out/concepts/JSBlock__.js.map +1 -1
  90. package/out/concepts/Logic__.js +44 -44
  91. package/out/concepts/Logic__.js.map +1 -1
  92. package/out/concepts/Module__.d.ts +116 -194
  93. package/out/concepts/Module__.js +31 -114
  94. package/out/concepts/Module__.js.map +1 -1
  95. package/out/concepts/Namespace__.d.ts +0 -86
  96. package/out/concepts/Namespace__.js +1 -108
  97. package/out/concepts/Namespace__.js.map +1 -1
  98. package/out/concepts/Param__.d.ts +3 -2
  99. package/out/concepts/Param__.js +15 -8
  100. package/out/concepts/Param__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js +38 -12
  102. package/out/concepts/ProcessElement__.js.map +1 -1
  103. package/out/concepts/Process__.d.ts +1 -1
  104. package/out/concepts/Process__.js +17 -10
  105. package/out/concepts/Process__.js.map +1 -1
  106. package/out/concepts/QueryAggregateExpression__.js +1 -1
  107. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  108. package/out/concepts/QueryFieldExpression__.d.ts +1 -0
  109. package/out/concepts/QueryFieldExpression__.js +11 -1
  110. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  111. package/out/concepts/QueryFromExpression__.d.ts +4 -0
  112. package/out/concepts/QueryFromExpression__.js +13 -2
  113. package/out/concepts/QueryFromExpression__.js.map +1 -1
  114. package/out/concepts/QueryGroupByExpression__.d.ts +3 -0
  115. package/out/concepts/QueryGroupByExpression__.js +20 -0
  116. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  117. package/out/concepts/QueryJoinExpression__.d.ts +4 -0
  118. package/out/concepts/QueryJoinExpression__.js +14 -3
  119. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  120. package/out/concepts/Return__.d.ts +1 -1
  121. package/out/concepts/Return__.js +16 -11
  122. package/out/concepts/Return__.js.map +1 -1
  123. package/out/concepts/Role__.js +10 -3
  124. package/out/concepts/Role__.js.map +1 -1
  125. package/out/concepts/SqlQueryComponent__.d.ts +14 -0
  126. package/out/concepts/SqlQueryComponent__.js +48 -5
  127. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  128. package/out/concepts/StringLiteral__.d.ts +1 -1
  129. package/out/concepts/StringLiteral__.js +2 -9
  130. package/out/concepts/StringLiteral__.js.map +1 -1
  131. package/out/concepts/StructureProperty__.js +11 -10
  132. package/out/concepts/StructureProperty__.js.map +1 -1
  133. package/out/concepts/Structure__.js +19 -12
  134. package/out/concepts/Structure__.js.map +1 -1
  135. package/out/concepts/SwitchCase__.d.ts +1 -1
  136. package/out/concepts/SwitchCase__.js +23 -25
  137. package/out/concepts/SwitchCase__.js.map +1 -1
  138. package/out/concepts/SwitchStatement__.js +1 -6
  139. package/out/concepts/SwitchStatement__.js.map +1 -1
  140. package/out/concepts/TypeAnnotation__.d.ts +8 -0
  141. package/out/concepts/TypeAnnotation__.js +53 -3
  142. package/out/concepts/TypeAnnotation__.js.map +1 -1
  143. package/out/concepts/Variable__.d.ts +1 -1
  144. package/out/concepts/Variable__.js +16 -11
  145. package/out/concepts/Variable__.js.map +1 -1
  146. package/out/concepts/ViewElement__.js +25 -20
  147. package/out/concepts/ViewElement__.js.map +1 -1
  148. package/out/concepts/View__.d.ts +1 -3
  149. package/out/concepts/View__.js +42 -36
  150. package/out/concepts/View__.js.map +1 -1
  151. package/out/concepts/WhileStatement__.js +4 -4
  152. package/out/concepts/WhileStatement__.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
  154. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.configuration.js +1 -1
  156. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  157. package/out/concepts/basics/stdlib/nasl.interface.d.ts +2 -0
  158. package/out/concepts/basics/stdlib/nasl.interface.js +4 -4
  159. package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
  160. package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
  161. package/out/concepts/basics/stdlib/nasl.process.js +410 -0
  162. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  163. package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
  164. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  165. package/out/concepts/basics/stdlib/nasl.util.js +270 -8
  166. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  167. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +1 -1
  168. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -1
  169. package/out/concepts/basics/types/index.d.ts +2 -0
  170. package/out/concepts/basics/types/index.js +6 -1
  171. package/out/concepts/basics/types/index.js.map +1 -1
  172. package/out/concepts/index__.d.ts +1 -0
  173. package/out/concepts/index__.js +1 -0
  174. package/out/concepts/index__.js.map +1 -1
  175. package/out/enums/KEYWORDS.js +0 -7
  176. package/out/enums/KEYWORDS.js.map +1 -1
  177. package/out/generator/genBundleFiles.d.ts +3 -1
  178. package/out/generator/genBundleFiles.js +23 -5
  179. package/out/generator/genBundleFiles.js.map +1 -1
  180. package/out/generator/genMetaData.d.ts +1 -0
  181. package/out/generator/genMetaData.js +20 -12
  182. package/out/generator/genMetaData.js.map +1 -1
  183. package/out/index.d.ts +1 -1
  184. package/out/index.js +2 -1
  185. package/out/index.js.map +1 -1
  186. package/out/manager/diagnostic.d.ts +1 -1
  187. package/out/server/createUiTs.js +1 -0
  188. package/out/server/createUiTs.js.map +1 -1
  189. package/out/{test/integration/connect-file copy.d.ts → server/extendBaseNode.d.ts} +0 -0
  190. package/out/server/extendBaseNode.js +323 -0
  191. package/out/server/extendBaseNode.js.map +1 -0
  192. package/out/server/getLogics.js +49 -2
  193. package/out/server/getLogics.js.map +1 -1
  194. package/out/server/getMemberIdentifier.js +52 -2
  195. package/out/server/getMemberIdentifier.js.map +1 -1
  196. package/out/server/getProcesses.d.ts +8 -2
  197. package/out/server/getProcesses.js +228 -20
  198. package/out/server/getProcesses.js.map +1 -1
  199. package/out/server/getScope.d.ts +1 -0
  200. package/out/server/getScope.js +4 -0
  201. package/out/server/getScope.js.map +1 -1
  202. package/out/server/index.d.ts +1 -0
  203. package/out/server/index.js +1 -0
  204. package/out/server/index.js.map +1 -1
  205. package/out/server/naslServer.d.ts +8 -5
  206. package/out/server/naslServer.js +314 -383
  207. package/out/server/naslServer.js.map +1 -1
  208. package/out/server/process2LogicNamespace.js +10 -1
  209. package/out/server/process2LogicNamespace.js.map +1 -1
  210. package/out/server/translator.d.ts +1 -1
  211. package/out/server/translator.js +40 -2
  212. package/out/server/translator.js.map +1 -1
  213. package/out/service/creator/errHandles.js +5 -0
  214. package/out/service/creator/errHandles.js.map +1 -1
  215. package/out/service/storage/init.d.ts +1 -0
  216. package/out/service/storage/init.js +113 -94
  217. package/out/service/storage/init.js.map +1 -1
  218. package/out/templator/genCreateBlock.js +34 -24
  219. package/out/templator/genCreateBlock.js.map +1 -1
  220. package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
  221. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  222. package/out/templator/genCurdMultipleKeyBlock.js +45 -29
  223. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  224. package/out/templator/genEditTableBlock.js +15 -13
  225. package/out/templator/genEditTableBlock.js.map +1 -1
  226. package/out/templator/genEnumSelectBlock.js +1 -1
  227. package/out/templator/genEnumSelectBlock.js.map +1 -1
  228. package/out/templator/genGetBlock.js +1 -1
  229. package/out/templator/genGetBlock.js.map +1 -1
  230. package/out/templator/genGridViewBlock.js +29 -24
  231. package/out/templator/genGridViewBlock.js.map +1 -1
  232. package/out/templator/genListViewBlock.js +7 -5
  233. package/out/templator/genListViewBlock.js.map +1 -1
  234. package/out/templator/genQueryComponent.js +31 -29
  235. package/out/templator/genQueryComponent.js.map +1 -1
  236. package/out/templator/genSelectBlock.js +13 -22
  237. package/out/templator/genSelectBlock.js.map +1 -1
  238. package/out/templator/genTableBlock.js +31 -21
  239. package/out/templator/genTableBlock.js.map +1 -1
  240. package/out/templator/genUpdateBlock.js +35 -25
  241. package/out/templator/genUpdateBlock.js.map +1 -1
  242. package/out/templator/utils.d.ts +5 -3
  243. package/out/templator/utils.js +2 -1
  244. package/out/templator/utils.js.map +1 -1
  245. package/out/test/integration/connect-file.js +6 -6
  246. package/out/test/integration/connect-file.js.map +1 -1
  247. package/out/translator/index.js +1 -1
  248. package/out/translator/index.js.map +1 -1
  249. package/out/utils/index.d.ts +5 -0
  250. package/out/utils/index.js +50 -1
  251. package/out/utils/index.js.map +1 -1
  252. package/package.json +1 -2
  253. package/src/automate/engine/index.js +33 -8
  254. package/src/automate/engine/operators.js +114 -17
  255. package/src/automate/engine/uniqueName.js +77 -9
  256. package/src/automate/engine/utils.js +110 -69
  257. package/src/automate/template/process.js +10999 -0
  258. package/src/bak/translator.js +1 -0
  259. package/src/common/BaseNode.ts +35 -7
  260. package/src/concepts/App__.ts +132 -131
  261. package/src/concepts/Assignee__.ts +30 -0
  262. package/src/concepts/BindAttribute__.ts +2 -2
  263. package/src/concepts/BindDirective__.ts +9 -7
  264. package/src/concepts/BindEvent__.ts +14 -6
  265. package/src/concepts/BooleanLiteral__.ts +12 -0
  266. package/src/concepts/CallFunction__.ts +7 -4
  267. package/src/concepts/CallLogic__.ts +47 -32
  268. package/src/concepts/CallQueryComponent__.ts +352 -101
  269. package/src/concepts/Comment__.ts +1 -1
  270. package/src/concepts/ConfigGroup__.ts +3 -1
  271. package/src/concepts/ConfigProperty__.ts +4 -0
  272. package/src/concepts/Configuration__.ts +3 -0
  273. package/src/concepts/Constant__.ts +6 -6
  274. package/src/concepts/DataSource__.ts +391 -0
  275. package/src/concepts/Destination__.ts +22 -8
  276. package/src/concepts/End__.ts +2 -2
  277. package/src/concepts/EntityIndex__.ts +11 -2
  278. package/src/concepts/EntityProperty__.ts +23 -7
  279. package/src/concepts/Entity__.ts +38 -14
  280. package/src/concepts/Enum__.ts +15 -4
  281. package/src/concepts/ForEachStatement__.ts +2 -2
  282. package/src/concepts/Function__.ts +95 -1
  283. package/src/concepts/Identifier__.ts +5 -14
  284. package/src/concepts/IfStatement__.ts +9 -9
  285. package/src/concepts/InterfaceParam__.ts +9 -4
  286. package/src/concepts/Interface__.ts +20 -12
  287. package/src/concepts/JSBlock__.ts +3 -12
  288. package/src/concepts/Logic__.ts +45 -79
  289. package/src/concepts/Module__.ts +141 -342
  290. package/src/concepts/Namespace__.ts +1 -204
  291. package/src/concepts/Param__.ts +17 -9
  292. package/src/concepts/ProcessElement__.ts +42 -15
  293. package/src/concepts/Process__.ts +18 -12
  294. package/src/concepts/QueryAggregateExpression__.ts +1 -1
  295. package/src/concepts/QueryFieldExpression__.ts +13 -1
  296. package/src/concepts/QueryFromExpression__.ts +13 -2
  297. package/src/concepts/QueryGroupByExpression__.ts +23 -0
  298. package/src/concepts/QueryJoinExpression__.ts +14 -3
  299. package/src/concepts/Return__.ts +16 -11
  300. package/src/concepts/Role__.ts +10 -4
  301. package/src/concepts/SqlQueryComponent__.ts +47 -11
  302. package/src/concepts/StringLiteral__.ts +2 -9
  303. package/src/concepts/StructureProperty__.ts +11 -14
  304. package/src/concepts/Structure__.ts +19 -11
  305. package/src/concepts/SwitchCase__.ts +23 -27
  306. package/src/concepts/SwitchStatement__.ts +1 -5
  307. package/src/concepts/TypeAnnotation__.ts +52 -3
  308. package/src/concepts/Variable__.ts +16 -11
  309. package/src/concepts/ViewElement__.ts +26 -39
  310. package/src/concepts/View__.ts +45 -38
  311. package/src/concepts/WhileStatement__.ts +4 -4
  312. package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
  313. package/src/concepts/basics/stdlib/nasl.configuration.ts +1 -1
  314. package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
  315. package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
  316. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
  317. package/src/concepts/basics/stdlib/nasl.util.ts +271 -8
  318. package/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts +1 -1
  319. package/src/concepts/basics/types/index.ts +2 -0
  320. package/src/concepts/index__.ts +1 -0
  321. package/src/enums/KEYWORDS.ts +0 -7
  322. package/src/generator/genBundleFiles.ts +28 -7
  323. package/src/generator/genMetaData.ts +22 -13
  324. package/src/index.ts +1 -1
  325. package/src/manager/diagnostic.ts +1 -1
  326. package/src/server/createUiTs.ts +1 -0
  327. package/src/server/extendBaseNode.ts +318 -0
  328. package/src/server/getLogics.ts +51 -5
  329. package/src/server/getMemberIdentifier.ts +53 -2
  330. package/src/server/getProcesses.ts +238 -21
  331. package/src/server/getScope.ts +5 -0
  332. package/src/server/index.ts +1 -0
  333. package/src/server/naslServer.ts +322 -380
  334. package/src/server/process2LogicNamespace.ts +29 -19
  335. package/src/server/translator.ts +42 -2
  336. package/src/service/creator/errHandles.js +6 -0
  337. package/src/service/storage/init.ts +115 -97
  338. package/src/templator/genCreateBlock.ts +35 -26
  339. package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
  340. package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
  341. package/src/templator/genEditTableBlock.ts +17 -14
  342. package/src/templator/genEnumSelectBlock.ts +1 -1
  343. package/src/templator/genGetBlock.ts +1 -1
  344. package/src/templator/genGridViewBlock.ts +30 -25
  345. package/src/templator/genListViewBlock.ts +10 -7
  346. package/src/templator/genQueryComponent.ts +34 -30
  347. package/src/templator/genSelectBlock.ts +14 -23
  348. package/src/templator/genTableBlock.ts +32 -23
  349. package/src/templator/genUpdateBlock.ts +36 -26
  350. package/src/templator/utils.ts +5 -2
  351. package/src/test/integration/connect-file.ts +6 -6
  352. package/src/translator/index.ts +1 -1
  353. package/src/utils/index.ts +51 -0
  354. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +0 -3
  355. package/out/concepts/basics/stdlib/nasl.browser copy.js +0 -70
  356. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +0 -1
  357. package/out/terms/LEVEL_NAME_MAP.d.ts +0 -26
  358. package/out/terms/LEVEL_NAME_MAP.js +0 -30
  359. package/out/terms/LEVEL_NAME_MAP.js.map +0 -1
  360. package/out/test/integration/connect-file copy.js +0 -50
  361. package/out/test/integration/connect-file copy.js.map +0 -1
  362. package/out/test/integration/node-nasl-server.d.ts +0 -1
  363. package/out/test/integration/node-nasl-server.js +0 -41
  364. package/out/test/integration/node-nasl-server.js.map +0 -1
@@ -113,6 +113,7 @@ export default function (definition) {
113
113
  title: ${JSON.stringify(definition.title)},
114
114
  crumb: ${JSON.stringify(definition.crumb)},
115
115
  first: ${JSON.stringify(definition.first)},
116
+ auth: ${JSON.stringify(definition.auth)},
116
117
  });
117
118
 
118
119
  ${events.join('\n\n')}
@@ -48,6 +48,13 @@ export class BaseNode extends EventEmitter {
48
48
  */
49
49
  @property()
50
50
  branchName: string = undefined;
51
+ /**
52
+ * 合并代码相关
53
+ */
54
+ @property()
55
+ workingCopy: object = undefined;
56
+ @property()
57
+ branch: object = undefined;
51
58
  /**
52
59
  * 父节点
53
60
  */
@@ -159,13 +166,23 @@ export class BaseNode extends EventEmitter {
159
166
  const property = propertyMap.get(key);
160
167
  const sourceItem = (source as any)[key] !== undefined ? (source as any)[key] : (this as any)[key];
161
168
  const { objectRef: propertyObjectRef } = property;
162
- let objectRefCtor;
169
+ let objectRefCtor: any;
163
170
  try {
164
171
  if (propertyObjectRef) {
165
172
  objectRefCtor = getConceptConstructor(propertyObjectRef);
166
- if (objectRefCtor && sourceItem instanceof objectRefCtor) {
167
- sourceItem.parentNode = this;
168
- sourceItem.parentKey = key;
173
+ if (objectRefCtor) {
174
+ // if (Array.isArray(sourceItem)) {
175
+ // sourceItem.forEach((item) => {
176
+ // if (item instanceof objectRefCtor) {
177
+ // item.parentNode = this;
178
+ // item.parentKey = key;
179
+ // }
180
+ // });
181
+ // } else
182
+ if (sourceItem instanceof objectRefCtor) {
183
+ sourceItem.parentNode = this;
184
+ sourceItem.parentKey = key;
185
+ }
169
186
  }
170
187
  }
171
188
 
@@ -324,7 +341,8 @@ export class BaseNode extends EventEmitter {
324
341
  * 删除节点
325
342
  */
326
343
  delete() {
327
- const path = this.getNodePath(false);
344
+ const useIndex = ['BindEvent', 'Identifier'].includes(this.concept);
345
+ const path = this.getNodePath(useIndex);
328
346
  const parentParams = this._delete();
329
347
  if (parentParams && parentParams.index !== -1) {
330
348
  if (Array.isArray((this.parentNode as any)[this.parentKey])) {
@@ -410,6 +428,16 @@ export class BaseNode extends EventEmitter {
410
428
  static from(source: any, parentNode?: BaseNode, parentKey?: string): BaseNode {
411
429
  // 有一些继承的情况
412
430
  const Ctor = classMap[source.concept] || this;
431
+ if (Ctor && source instanceof Ctor) {
432
+ if (parentNode) {
433
+ source.parentNode = parentNode;
434
+ }
435
+ if (parentKey) {
436
+ source.parentKey = parentKey;
437
+ }
438
+ return source;
439
+ }
440
+
413
441
  if (Ctor) {
414
442
  const instance = new Ctor();
415
443
  if (parentNode) {
@@ -431,7 +459,7 @@ export class BaseNode extends EventEmitter {
431
459
  return this.getNodePath(false);
432
460
  }
433
461
 
434
- getNodePath(isCreate: boolean) {
462
+ getNodePath(useIndex: boolean) {
435
463
  let node: BaseNode = this;
436
464
  let isNodeSelf = true;
437
465
  const pathArr = [];
@@ -444,7 +472,7 @@ export class BaseNode extends EventEmitter {
444
472
  const parentProperty = parentNode[parentKey as keyof BaseNode];
445
473
  if (Array.isArray(parentProperty)) {
446
474
  const name = node.name;
447
- if (!name || (isCreate && isNodeSelf)) {
475
+ if (!name || (useIndex && isNodeSelf)) {
448
476
  const index = parentProperty.indexOf(node);
449
477
  path += `[${index}]`;
450
478
  } else {
@@ -14,7 +14,7 @@ import * as utils from '../utils';
14
14
  import { v4 as uuidv4 } from 'uuid';
15
15
  import BaseNode from '../common/BaseNode';
16
16
  import classMap from '../common/classMap';
17
- import Entity from './Entity__';
17
+ import DataSource from './DataSource__';
18
18
  import Structure from './Structure__';
19
19
  import Enum from './Enum__';
20
20
  import Logic from './Logic__';
@@ -110,10 +110,10 @@ export class App extends BaseNode {
110
110
  hasAuth: boolean = undefined;
111
111
 
112
112
  /**
113
- * 实体列表
113
+ * 数据源列表
114
114
  */
115
- @property('Entity')
116
- entities: Array<Entity> = [];
115
+ @property('DataSource')
116
+ dataSources: Array<DataSource> = [];
117
117
 
118
118
  /**
119
119
  * 数据结构列表
@@ -187,8 +187,6 @@ export class App extends BaseNode {
187
187
  @property('Module')
188
188
  componentDependencies: Array<Module> = [];
189
189
 
190
-
191
-
192
190
  /**
193
191
  * @param source 需要合并的部分参数
194
192
  */
@@ -237,148 +235,147 @@ export class App extends BaseNode {
237
235
  });
238
236
  }
239
237
 
240
- getEntityExistingNames(excludedList: Array<Entity> = []) {
238
+ getDataSourceExistingNames(excludedList: Array<DataSource> = []) {
241
239
  const excludedSet = new Set(excludedList);
242
- return (this.entities || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
240
+ return (this.dataSources || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
243
241
  }
244
- getEntityUniqueName(name = 'Entity1') {
245
- return utils.unique(name, this.getEntityExistingNames(), undefined, true);
242
+ getDataSourceUniqueName(name = 'dataSource1') {
243
+ return utils.unique(name, this.getDataSourceExistingNames(), undefined, true);
246
244
  }
247
245
 
248
246
  /**
249
- * 插入实体
247
+ * 插入数据源
250
248
  * @internal
251
- * @param name 实体名称,如果不填会自动生成一个唯一名称
249
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
252
250
  */
253
- _insertEntityAt(name: string, index: number): Entity;
251
+ _insertDataSourceAt(name: string, index: number): DataSource;
254
252
 
255
253
  /**
256
- * 插入实体
254
+ * 插入数据源
257
255
  * @internal
258
- * @param entityOptions 实体参数
256
+ * @param dataSourceOptions 数据源参数
259
257
  */
260
- _insertEntityAt(entityOptions: Partial<Entity>, index: number): Entity;
258
+ _insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
261
259
 
262
260
  /**
263
- * 插入实体
261
+ * 插入数据源
264
262
  * @internal
265
- * @param entity 已有的实体实例
263
+ * @param dataSource 已有的数据源实例
266
264
  */
267
- _insertEntityAt(entity: Entity, index: number): Entity;
265
+ _insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
268
266
 
269
- _insertEntityAt(options: string | Partial<Entity> | Entity, index: number) {
270
- const entityOptions: any = {};
271
- const relationOptions = { parentNode: this, parentKey: 'entities' };
272
- let entity: Entity;
267
+ _insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
268
+ const dataSourceOptions: any = {};
269
+ const relationOptions = { parentNode: this, parentKey: 'dataSources' };
270
+ let dataSource: DataSource;
273
271
  if (!options) {
274
- entity = Entity.from({
275
- ...entityOptions,
276
- name: this.getEntityUniqueName(),
277
- }, this, 'entities');
272
+ dataSource = DataSource.from({
273
+ ...dataSourceOptions,
274
+ name: this.getDataSourceUniqueName(),
275
+ }, this, 'dataSources');
278
276
  } else if (typeof options === 'string') {
279
- entity = Entity.from({
280
- ...entityOptions,
277
+ dataSource = DataSource.from({
278
+ ...dataSourceOptions,
281
279
  name: options,
282
- }, this, 'entities');
283
- } else if (options instanceof Entity) {
280
+ }, this, 'dataSources');
281
+ } else if (options instanceof DataSource) {
284
282
  options.ensureDelete(); // 同一实例不支持多处存在
285
- entity = options;
286
- Object.assign(entity, relationOptions);
283
+ dataSource = options;
284
+ Object.assign(dataSource, relationOptions);
287
285
  } else {
288
- entity = Entity.from({
289
- ...entityOptions,
286
+ dataSource = DataSource.from({
287
+ ...dataSourceOptions,
290
288
  ...options,
291
- }, this, 'entities');
289
+ }, this, 'dataSources');
292
290
  }
293
- this.entities.splice(index, 0, entity);
294
- return entity;
291
+ this.dataSources.splice(index, 0, dataSource);
292
+ return dataSource;
295
293
  }
296
294
 
297
295
  /**
298
- * 插入实体
299
- * @param name 实体名称,如果不填会自动生成一个唯一名称
296
+ * 插入数据源
297
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
300
298
  */
301
- insertEntityAt(name: string, index: number): Entity;
299
+ insertDataSourceAt(name: string, index: number): DataSource;
302
300
 
303
301
  /**
304
- * 插入实体
305
- * @param entityOptions 实体参数
302
+ * 插入数据源
303
+ * @param dataSourceOptions 数据源参数
306
304
  */
307
- insertEntityAt(entityOptions: Partial<Entity>, index: number): Entity;
305
+ insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
308
306
 
309
307
  /**
310
- * 插入实体
311
- * @param entity 已有的实体实例
308
+ * 插入数据源
309
+ * @param dataSource 已有的数据源实例
312
310
  */
313
- insertEntityAt(entity: Entity, index: number): Entity;
311
+ insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
314
312
 
315
- insertEntityAt(options: string | Partial<Entity> | Entity, index: number) {
316
- const node = this._insertEntityAt(options as any, index);
313
+ insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
314
+ const node = this._insertDataSourceAt(options as any, index);
317
315
  node.create({
318
316
  index,
319
317
  parentNode: this,
320
- parentKey: 'entities',
318
+ parentKey: 'dataSources',
321
319
  });
322
320
  return node;
323
321
  }
324
322
 
325
323
  /**
326
- * 添加实体
324
+ * 添加数据源
327
325
  * @internal
328
- * @param name 实体名称,如果不填会自动生成一个唯一名称
326
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
329
327
  */
330
- _addEntity(name?: string): Entity;
328
+ _addDataSource(name?: string): DataSource;
331
329
 
332
330
  /**
333
- * 添加实体
331
+ * 添加数据源
334
332
  * @internal
335
- * @param entityOptions 实体参数
333
+ * @param dataSourceOptions 数据源参数
336
334
  */
337
- _addEntity(entityOptions: Partial<Entity>): Entity;
335
+ _addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
338
336
 
339
337
  /**
340
- * 添加实体
338
+ * 添加数据源
341
339
  * @internal
342
- * @param entity 已有的实体实例
340
+ * @param dataSource 已有的数据源实例
343
341
  */
344
- _addEntity(entity: Entity): Entity;
342
+ _addDataSource(dataSource: DataSource): DataSource;
345
343
 
346
- _addEntity(options?: string | Partial<Entity> | Entity) {
347
- const index = 0;
348
- return this._insertEntityAt(options as any, index);
344
+ _addDataSource(options?: string | Partial<DataSource> | DataSource) {
345
+ const index = this.dataSources.length;
346
+ return this._insertDataSourceAt(options as any, index);
349
347
  }
350
348
 
351
349
  /**
352
- * 添加实体
350
+ * 添加数据源
353
351
  * @internal
354
- * @param name 实体名称,如果不填会自动生成一个唯一名称
352
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
355
353
  */
356
- addEntity(name?: string): Entity;
354
+ addDataSource(name?: string): DataSource;
357
355
 
358
356
  /**
359
- * 添加实体
360
- * @param entityOptions 实体参数
357
+ * 添加数据源
358
+ * @param dataSourceOptions 数据源参数
361
359
  */
362
- addEntity(entityOptions: Partial<Entity>): Entity;
360
+ addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
363
361
 
364
362
  /**
365
- * 添加实体
366
- * @param entity 已有的实体实例
363
+ * 添加数据源
364
+ * @param dataSource 已有的数据源实例
367
365
  */
368
- addEntity(entity: Entity): Entity;
366
+ addDataSource(dataSource: DataSource): DataSource;
369
367
 
370
- addEntity(options?: string | Partial<Entity> | Entity) {
371
- const node = this._addEntity(options as any);
372
- const index = this.entities.indexOf(node);
368
+ addDataSource(options?: string | Partial<DataSource> | DataSource) {
369
+ const node = this._addDataSource(options as any);
370
+ const index = this.dataSources.indexOf(node);
373
371
  node.create({
374
372
  index,
375
373
  parentNode: this,
376
- parentKey: 'entities',
374
+ parentKey: 'dataSources',
377
375
  });
378
376
  return node;
379
377
  }
380
378
 
381
-
382
379
  getStructureExistingNames(excludedList: Array<Structure> = []) {
383
380
  const excludedSet = new Set(excludedList);
384
381
  return (this.structures || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -520,7 +517,6 @@ export class App extends BaseNode {
520
517
  return node;
521
518
  }
522
519
 
523
-
524
520
  getEnumExistingNames(excludedList: Array<Enum> = []) {
525
521
  const excludedSet = new Set(excludedList);
526
522
  return (this.enums || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -662,7 +658,6 @@ export class App extends BaseNode {
662
658
  return node;
663
659
  }
664
660
 
665
-
666
661
  getLogicExistingNames(excludedList: Array<Logic> = []) {
667
662
  const excludedSet = new Set(excludedList);
668
663
  return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -804,7 +799,6 @@ export class App extends BaseNode {
804
799
  return node;
805
800
  }
806
801
 
807
-
808
802
  getInterfaceExistingNames(excludedList: Array<Interface> = []) {
809
803
  const excludedSet = new Set(excludedList);
810
804
  return (this.interfaces || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -946,7 +940,6 @@ export class App extends BaseNode {
946
940
  return node;
947
941
  }
948
942
 
949
-
950
943
  getViewExistingNames(excludedList: Array<View> = []) {
951
944
  const excludedSet = new Set(excludedList);
952
945
  return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1088,7 +1081,6 @@ export class App extends BaseNode {
1088
1081
  return node;
1089
1082
  }
1090
1083
 
1091
-
1092
1084
  getProcessExistingNames(excludedList: Array<Process> = []) {
1093
1085
  const excludedSet = new Set(excludedList);
1094
1086
  return (this.processes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1230,7 +1222,6 @@ export class App extends BaseNode {
1230
1222
  return node;
1231
1223
  }
1232
1224
 
1233
-
1234
1225
  getRoleExistingNames(excludedList: Array<Role> = []) {
1235
1226
  const excludedSet = new Set(excludedList);
1236
1227
  return (this.roles || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1372,7 +1363,6 @@ export class App extends BaseNode {
1372
1363
  return node;
1373
1364
  }
1374
1365
 
1375
-
1376
1366
  getModuleExistingNames(excludedList: Array<Module> = []) {
1377
1367
  const excludedSet = new Set(excludedList);
1378
1368
  return (this.dependencies || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1780,50 +1770,47 @@ export class App extends BaseNode {
1780
1770
  return node;
1781
1771
  }
1782
1772
 
1783
-
1784
-
1785
-
1786
1773
  /**
1787
- * 删除实体
1788
- * @param name 实体名称
1774
+ * 删除数据源
1775
+ * @param name 数据源名称
1789
1776
  */
1790
- removeEntity(name: string): void;
1777
+ removeDataSource(name: string): void;
1791
1778
 
1792
1779
  /**
1793
- * 删除实体
1794
- * @param entity 已有的实体实例
1780
+ * 删除数据源
1781
+ * @param dataSource 已有的数据源实例
1795
1782
  */
1796
- removeEntity(entity: Entity): void;
1783
+ removeDataSource(dataSource: DataSource): void;
1797
1784
 
1798
- removeEntity(options: string | Entity) {
1799
- let entity: Entity;
1785
+ removeDataSource(options: string | DataSource) {
1786
+ let dataSource: DataSource;
1800
1787
  if (typeof options === 'string') {
1801
- entity = this.entities.find((item) => item.name === options);
1802
- if (!entity) {
1803
- throw new Error('找不到实体 ' + options);
1788
+ dataSource = this.dataSources.find((item) => item.name === options);
1789
+ if (!dataSource) {
1790
+ throw new Error('找不到数据源 ' + options);
1804
1791
  }
1805
1792
  } else {
1806
- entity = options;
1793
+ dataSource = options;
1807
1794
  }
1808
- return entity.delete();
1795
+ return dataSource.delete();
1809
1796
  }
1810
1797
 
1811
- __removeEntity(entity: Entity) {
1812
- const parentKey = entity.parentKey;
1798
+ __removeDataSource(dataSource: DataSource) {
1799
+ const parentKey = dataSource.parentKey;
1813
1800
  const params: Params = {
1814
1801
  parentNode: this,
1815
1802
  parentKey,
1816
1803
  index: -1,
1817
1804
  object: null,
1818
- oldObject: entity,
1805
+ oldObject: dataSource,
1819
1806
  };
1820
1807
  if (parentKey) {
1821
1808
  params.parentKey = parentKey;
1822
1809
  if (Array.isArray((this as any)[parentKey])) {
1823
- const index = (this as any)[parentKey].indexOf(entity);
1810
+ const index = (this as any)[parentKey].indexOf(dataSource);
1824
1811
  ~index && (this as any)[parentKey].splice(index, 1);
1825
1812
  params.index = index;
1826
- } else if ((this as any)[parentKey] === entity) {
1813
+ } else if ((this as any)[parentKey] === dataSource) {
1827
1814
  params.index = 0;
1828
1815
  (this as any)[parentKey] = undefined;
1829
1816
  }
@@ -1831,8 +1818,6 @@ export class App extends BaseNode {
1831
1818
  return params;
1832
1819
  }
1833
1820
 
1834
-
1835
-
1836
1821
  /**
1837
1822
  * 删除数据结构
1838
1823
  * @param name 数据结构名称
@@ -1881,8 +1866,6 @@ export class App extends BaseNode {
1881
1866
  return params;
1882
1867
  }
1883
1868
 
1884
-
1885
-
1886
1869
  /**
1887
1870
  * 删除枚举
1888
1871
  * @param name 枚举名称
@@ -1931,8 +1914,6 @@ export class App extends BaseNode {
1931
1914
  return params;
1932
1915
  }
1933
1916
 
1934
-
1935
-
1936
1917
  /**
1937
1918
  * 删除逻辑
1938
1919
  * @param name 逻辑名称
@@ -1981,8 +1962,6 @@ export class App extends BaseNode {
1981
1962
  return params;
1982
1963
  }
1983
1964
 
1984
-
1985
-
1986
1965
  /**
1987
1966
  * 删除接口
1988
1967
  * @param name 接口名称
@@ -2031,8 +2010,6 @@ export class App extends BaseNode {
2031
2010
  return params;
2032
2011
  }
2033
2012
 
2034
-
2035
-
2036
2013
  /**
2037
2014
  * 删除页面
2038
2015
  * @param name 页面名称
@@ -2081,8 +2058,6 @@ export class App extends BaseNode {
2081
2058
  return params;
2082
2059
  }
2083
2060
 
2084
-
2085
-
2086
2061
  /**
2087
2062
  * 删除流程
2088
2063
  * @param name 流程名称
@@ -2131,8 +2106,6 @@ export class App extends BaseNode {
2131
2106
  return params;
2132
2107
  }
2133
2108
 
2134
-
2135
-
2136
2109
  /**
2137
2110
  * 删除角色
2138
2111
  * @param name 角色名称
@@ -2181,8 +2154,6 @@ export class App extends BaseNode {
2181
2154
  return params;
2182
2155
  }
2183
2156
 
2184
-
2185
-
2186
2157
  /**
2187
2158
  * 删除主题
2188
2159
  * @param name 主题名称
@@ -2231,8 +2202,6 @@ export class App extends BaseNode {
2231
2202
  return params;
2232
2203
  }
2233
2204
 
2234
-
2235
-
2236
2205
  /**
2237
2206
  * 删除配置管理
2238
2207
  * @param name 配置管理名称
@@ -2281,8 +2250,6 @@ export class App extends BaseNode {
2281
2250
  return params;
2282
2251
  }
2283
2252
 
2284
-
2285
-
2286
2253
  /**
2287
2254
  * 删除模块
2288
2255
  * @param name 模块名称
@@ -2308,8 +2275,6 @@ export class App extends BaseNode {
2308
2275
  return module.delete();
2309
2276
  }
2310
2277
 
2311
-
2312
-
2313
2278
  /**
2314
2279
  * 删除模块
2315
2280
  * @param name 模块名称
@@ -2335,8 +2300,6 @@ export class App extends BaseNode {
2335
2300
  return module.delete();
2336
2301
  }
2337
2302
 
2338
-
2339
-
2340
2303
  /**
2341
2304
  * 删除模块
2342
2305
  * @param name 模块名称
@@ -2393,8 +2356,12 @@ export class App extends BaseNode {
2393
2356
  return this.componentDependencies.find((componentDependency) => componentDependency.name === name);
2394
2357
  }
2395
2358
 
2396
- findEntityByName(name: string) {
2397
- return this.entities.find((entity) => entity.name === name);
2359
+ findDataSourceByName(name: string) {
2360
+ return this.dataSources.find((dataSourceItem) => dataSourceItem.name === name);
2361
+ }
2362
+
2363
+ get defaultDS() {
2364
+ return this.dataSources?.find((dataSource) => dataSource.name === 'defaultDS');
2398
2365
  }
2399
2366
 
2400
2367
  findEnumByName(name: string) {
@@ -2467,6 +2434,10 @@ export class App extends BaseNode {
2467
2434
  * 获取命名空间
2468
2435
  */
2469
2436
  getNamespace() {
2437
+ return 'app';
2438
+ }
2439
+
2440
+ getTsNamespace() {
2470
2441
  return `app`;
2471
2442
  }
2472
2443
 
@@ -2494,6 +2465,36 @@ export class App extends BaseNode {
2494
2465
  return node;
2495
2466
  }
2496
2467
 
2468
+ findNodeByCompleteName(completeName: string) {
2469
+ const nameArr = completeName?.split('.') || [];
2470
+ const start = nameArr.shift();
2471
+ let node: any = this;
2472
+ const mod = 0;
2473
+ const modulesMap: any = {
2474
+ extensions: node.dependencies,
2475
+ apis: node.interfaceDependencies,
2476
+ components: node.componentDependencies,
2477
+ };
2478
+ const modules = modulesMap[start];
2479
+ if (Array.isArray(modules)) {
2480
+ const moduleName = nameArr.shift();
2481
+ node = modules.find((moduleItem) => moduleItem.name === moduleName);
2482
+ }
2483
+ for (let index = 0; index < nameArr.length; index++) {
2484
+ if (!node) {
2485
+ return null;
2486
+ }
2487
+ const nameItem = nameArr[index];
2488
+ const isKeyword = index % 2 === mod;
2489
+ if (!isKeyword && Array.isArray(node)) {
2490
+ node = node.find(({ name }) => name === nameItem);
2491
+ } else {
2492
+ node = node[nameItem];
2493
+ }
2494
+ }
2495
+ return node;
2496
+ }
2497
+
2497
2498
  /**
2498
2499
  * @param path 路径
2499
2500
  * path 为要查找路径:如 /dashboard/student/list、/dashboard/student/list
@@ -2600,7 +2601,7 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
2600
2601
  //================================================================================
2601
2602
  }
2602
2603
 
2603
- classMap['App'] = App;
2604
+ classMap.App = App;
2604
2605
  export default App;
2605
2606
  //================================================================================
2606
2607
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -1,3 +1,6 @@
1
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
2
+ import { ProcessElement, Process, } from '..';
3
+
1
4
  //================================================================================
2
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
3
6
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -422,7 +425,34 @@ export class Assignee extends LogicItem {
422
425
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
423
426
  // 自动生成的代码已结束。下面可以手动编写。
424
427
  //================================================================================
428
+ /**
429
+ * 祖先 ProcessElement
430
+ */
431
+ get processElement() {
432
+ return this.getAncestor('ProcessElement') as ProcessElement;
433
+ }
434
+ /**
435
+ * 祖先 Process
436
+ */
437
+ get process() {
438
+ return this.getAncestor('Process') as Process;
439
+ }
425
440
 
441
+ @withSourceMap()
442
+ toEmbeddedTSInProcess(state: TranslatorState, prevCode: string): string {
443
+ // const tab = indent(state.tabSize);
444
+ // let code = `const plainuser = [];\n`
445
+ // code += `const dynamicuser = [];\n`
446
+ let code = prevCode;
447
+ code += `return nasl.util.concatString(`;
448
+ this.dynamicUsers.forEach(u => {
449
+ code += u.toEmbeddedTS(shiftState(state, code));
450
+ code += ',\n';
451
+ })
452
+ code += ')\n';
453
+ // code += `${this.dynamicUsers.map(u => u.toEmbeddedTS(shiftState(state, code))).join(',\n')})\n`;
454
+ return code;
455
+ }
426
456
  //================================================================================
427
457
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
428
458
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓