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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (842) hide show
  1. package/out/automate/engine/utils.js +4 -0
  2. package/out/automate/engine/utils.js.map +1 -1
  3. package/out/automate/upgrader/2.20.js +1 -1
  4. package/out/automate/upgrader/2.20.js.map +1 -1
  5. package/out/bak/translator.js +11 -15
  6. package/out/bak/translator.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.js +3 -1
  8. package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
  9. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
  10. package/out/breakpoint/generator/BreakpointNode.d.ts +1 -0
  11. package/out/breakpoint/generator/BreakpointNode.js +48 -15
  12. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  13. package/out/breakpoint/generator/CallbackNode.d.ts +4 -0
  14. package/out/breakpoint/generator/CallbackNode.js +22 -0
  15. package/out/breakpoint/generator/CallbackNode.js.map +1 -0
  16. package/out/breakpoint/generator/FragmentNode.d.ts +4 -0
  17. package/out/breakpoint/generator/FragmentNode.js +18 -0
  18. package/out/breakpoint/generator/FragmentNode.js.map +1 -0
  19. package/out/breakpoint/generator/index.js +25 -4
  20. package/out/breakpoint/generator/index.js.map +1 -1
  21. package/out/breakpoint/shared/constants.d.ts +3 -0
  22. package/out/breakpoint/shared/constants.js +6 -1
  23. package/out/breakpoint/shared/constants.js.map +1 -1
  24. package/out/breakpoint/shared/operations.js.map +1 -1
  25. package/out/breakpoint/shared/socket.d.ts +1 -1
  26. package/out/breakpoint/shared/socket.js +36 -7
  27. package/out/breakpoint/shared/socket.js.map +1 -1
  28. package/out/breakpoint/shared/utils.d.ts +2 -0
  29. package/out/breakpoint/shared/utils.js +15 -2
  30. package/out/breakpoint/shared/utils.js.map +1 -1
  31. package/out/breakpoint/store/core.d.ts +48 -2
  32. package/out/breakpoint/store/core.js +58 -32
  33. package/out/breakpoint/store/core.js.map +1 -1
  34. package/out/breakpoint/store/dock.js +1 -1
  35. package/out/breakpoint/store/dock.js.map +1 -1
  36. package/out/common/BaseNode.d.ts +2 -2
  37. package/out/common/BaseNode.js +110 -53
  38. package/out/common/BaseNode.js.map +1 -1
  39. package/out/common/Command.d.ts +13 -2
  40. package/out/common/Command.js +37 -9
  41. package/out/common/Command.js.map +1 -1
  42. package/out/common/EventEmitter.js.map +1 -1
  43. package/out/common/Messager.d.ts +3 -3
  44. package/out/common/Messager.js +6 -7
  45. package/out/common/Messager.js.map +1 -1
  46. package/out/common/asyncFuncMap.js.map +1 -1
  47. package/out/concepts/Abort__.js +6 -5
  48. package/out/concepts/Abort__.js.map +1 -1
  49. package/out/concepts/Anchor__.d.ts +4 -3
  50. package/out/concepts/Anchor__.js +24 -7
  51. package/out/concepts/Anchor__.js.map +1 -1
  52. package/out/concepts/AnonymousFunction__.d.ts +22 -21
  53. package/out/concepts/AnonymousFunction__.js +48 -22
  54. package/out/concepts/AnonymousFunction__.js.map +1 -1
  55. package/out/concepts/App__.d.ts +421 -247
  56. package/out/concepts/App__.js +288 -54
  57. package/out/concepts/App__.js.map +1 -1
  58. package/out/concepts/Argument__.d.ts +4 -3
  59. package/out/concepts/Argument__.js +42 -11
  60. package/out/concepts/Argument__.js.map +1 -1
  61. package/out/concepts/Assignee__.d.ts +45 -45
  62. package/out/concepts/Assignee__.js +15 -15
  63. package/out/concepts/Assignee__.js.map +1 -1
  64. package/out/concepts/AssignmentLine__.js +6 -5
  65. package/out/concepts/AssignmentLine__.js.map +1 -1
  66. package/out/concepts/Assignment__.d.ts +7 -6
  67. package/out/concepts/Assignment__.js +41 -23
  68. package/out/concepts/Assignment__.js.map +1 -1
  69. package/out/concepts/Attribute__.d.ts +3 -3
  70. package/out/concepts/Attribute__.js +8 -7
  71. package/out/concepts/Attribute__.js.map +1 -1
  72. package/out/concepts/AuthInterface__.js +4 -3
  73. package/out/concepts/AuthInterface__.js.map +1 -1
  74. package/out/concepts/AuthLogicForCallInterface__.d.ts +15 -15
  75. package/out/concepts/AuthLogicForCallInterface__.js +46 -27
  76. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  77. package/out/concepts/AuthLogic__.js +27 -13
  78. package/out/concepts/AuthLogic__.js.map +1 -1
  79. package/out/concepts/BackendVariable__.d.ts +5 -5
  80. package/out/concepts/BackendVariable__.js +23 -26
  81. package/out/concepts/BackendVariable__.js.map +1 -1
  82. package/out/concepts/Backend__.d.ts +18 -18
  83. package/out/concepts/Backend__.js +13 -13
  84. package/out/concepts/Backend__.js.map +1 -1
  85. package/out/concepts/BatchAssignment__.d.ts +34 -33
  86. package/out/concepts/BatchAssignment__.js +83 -43
  87. package/out/concepts/BatchAssignment__.js.map +1 -1
  88. package/out/concepts/BinaryExpression__.d.ts +7 -6
  89. package/out/concepts/BinaryExpression__.js +60 -24
  90. package/out/concepts/BinaryExpression__.js.map +1 -1
  91. package/out/concepts/BindAttribute__.d.ts +37 -37
  92. package/out/concepts/BindAttribute__.js +102 -58
  93. package/out/concepts/BindAttribute__.js.map +1 -1
  94. package/out/concepts/BindDirective__.d.ts +13 -13
  95. package/out/concepts/BindDirective__.js +23 -21
  96. package/out/concepts/BindDirective__.js.map +1 -1
  97. package/out/concepts/BindEvent__.d.ts +28 -28
  98. package/out/concepts/BindEvent__.js +150 -57
  99. package/out/concepts/BindEvent__.js.map +1 -1
  100. package/out/concepts/BindStyle__.d.ts +14 -15
  101. package/out/concepts/BindStyle__.js +16 -16
  102. package/out/concepts/BindStyle__.js.map +1 -1
  103. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  104. package/out/concepts/BooleanLiteral__.js +12 -5
  105. package/out/concepts/BooleanLiteral__.js.map +1 -1
  106. package/out/concepts/CallAuthInterface__.d.ts +15 -15
  107. package/out/concepts/CallAuthInterface__.js +23 -22
  108. package/out/concepts/CallAuthInterface__.js.map +1 -1
  109. package/out/concepts/CallConnector__.d.ts +11 -9
  110. package/out/concepts/CallConnector__.js +79 -36
  111. package/out/concepts/CallConnector__.js.map +1 -1
  112. package/out/concepts/CallFunction__.d.ts +17 -16
  113. package/out/concepts/CallFunction__.js +95 -63
  114. package/out/concepts/CallFunction__.js.map +1 -1
  115. package/out/concepts/CallInterface__.d.ts +9 -8
  116. package/out/concepts/CallInterface__.js +109 -80
  117. package/out/concepts/CallInterface__.js.map +1 -1
  118. package/out/concepts/CallLogic__.d.ts +24 -20
  119. package/out/concepts/CallLogic__.js +209 -162
  120. package/out/concepts/CallLogic__.js.map +1 -1
  121. package/out/concepts/CallQueryComponent__.d.ts +51 -51
  122. package/out/concepts/CallQueryComponent__.js +66 -63
  123. package/out/concepts/CallQueryComponent__.js.map +1 -1
  124. package/out/concepts/Comment__.d.ts +1 -0
  125. package/out/concepts/Comment__.js +13 -6
  126. package/out/concepts/Comment__.js.map +1 -1
  127. package/out/concepts/CompletionProperty__.d.ts +3 -3
  128. package/out/concepts/CompletionProperty__.js +16 -8
  129. package/out/concepts/CompletionProperty__.js.map +1 -1
  130. package/out/concepts/ConfigGroup__.d.ts +15 -15
  131. package/out/concepts/ConfigGroup__.js +9 -9
  132. package/out/concepts/ConfigGroup__.js.map +1 -1
  133. package/out/concepts/ConfigPropertyValue__.js +4 -3
  134. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  135. package/out/concepts/ConfigProperty__.d.ts +15 -15
  136. package/out/concepts/ConfigProperty__.js +10 -10
  137. package/out/concepts/ConfigProperty__.js.map +1 -1
  138. package/out/concepts/Configuration__.d.ts +15 -15
  139. package/out/concepts/Configuration__.js +9 -9
  140. package/out/concepts/Configuration__.js.map +1 -1
  141. package/out/concepts/Connection__.d.ts +166 -0
  142. package/out/concepts/Connection__.js +332 -0
  143. package/out/concepts/Connection__.js.map +1 -0
  144. package/out/concepts/ConnectorTrigger__.js +4 -3
  145. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  146. package/out/concepts/Connector__.d.ts +66 -66
  147. package/out/concepts/Connector__.js +16 -15
  148. package/out/concepts/Connector__.js.map +1 -1
  149. package/out/concepts/Constant__.d.ts +3 -3
  150. package/out/concepts/Constant__.js +8 -7
  151. package/out/concepts/Constant__.js.map +1 -1
  152. package/out/concepts/DataElement__.d.ts +3 -3
  153. package/out/concepts/DataElement__.js +6 -5
  154. package/out/concepts/DataElement__.js.map +1 -1
  155. package/out/concepts/DataSource__.d.ts +15 -15
  156. package/out/concepts/DataSource__.js +55 -39
  157. package/out/concepts/DataSource__.js.map +1 -1
  158. package/out/concepts/DatabaseTypeAnnotation__.js +4 -3
  159. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  160. package/out/concepts/Destination__.d.ts +12 -11
  161. package/out/concepts/Destination__.js +93 -36
  162. package/out/concepts/Destination__.js.map +1 -1
  163. package/out/concepts/End__.js +15 -13
  164. package/out/concepts/End__.js.map +1 -1
  165. package/out/concepts/EntityIndex__.d.ts +1 -1
  166. package/out/concepts/EntityIndex__.js +6 -5
  167. package/out/concepts/EntityIndex__.js.map +1 -1
  168. package/out/concepts/EntityProperty__.d.ts +8 -7
  169. package/out/concepts/EntityProperty__.js +39 -24
  170. package/out/concepts/EntityProperty__.js.map +1 -1
  171. package/out/concepts/Entity__.d.ts +31 -30
  172. package/out/concepts/Entity__.js +40 -16
  173. package/out/concepts/Entity__.js.map +1 -1
  174. package/out/concepts/EnumItem__.d.ts +1 -0
  175. package/out/concepts/EnumItem__.js +12 -5
  176. package/out/concepts/EnumItem__.js.map +1 -1
  177. package/out/concepts/Enum__.d.ts +9 -8
  178. package/out/concepts/Enum__.js +24 -11
  179. package/out/concepts/Enum__.js.map +1 -1
  180. package/out/concepts/Event__.d.ts +15 -15
  181. package/out/concepts/Event__.js +6 -5
  182. package/out/concepts/Event__.js.map +1 -1
  183. package/out/concepts/ExternalDestination__.d.ts +6 -6
  184. package/out/concepts/ExternalDestination__.js +12 -11
  185. package/out/concepts/ExternalDestination__.js.map +1 -1
  186. package/out/concepts/ForEachStatement__.d.ts +25 -24
  187. package/out/concepts/ForEachStatement__.js +101 -36
  188. package/out/concepts/ForEachStatement__.js.map +1 -1
  189. package/out/concepts/FrontendLibrary__.d.ts +30 -30
  190. package/out/concepts/FrontendLibrary__.js +12 -13
  191. package/out/concepts/FrontendLibrary__.js.map +1 -1
  192. package/out/concepts/FrontendVariable__.js +4 -3
  193. package/out/concepts/FrontendVariable__.js.map +1 -1
  194. package/out/concepts/Frontend__.d.ts +64 -65
  195. package/out/concepts/Frontend__.js +23 -27
  196. package/out/concepts/Frontend__.js.map +1 -1
  197. package/out/concepts/Function__.d.ts +64 -63
  198. package/out/concepts/Function__.js +49 -21
  199. package/out/concepts/Function__.js.map +1 -1
  200. package/out/concepts/Identifier__.js +37 -31
  201. package/out/concepts/Identifier__.js.map +1 -1
  202. package/out/concepts/IfStatement__.d.ts +20 -19
  203. package/out/concepts/IfStatement__.js +64 -34
  204. package/out/concepts/IfStatement__.js.map +1 -1
  205. package/out/concepts/Integration__.d.ts +3 -3
  206. package/out/concepts/Integration__.js +8 -7
  207. package/out/concepts/Integration__.js.map +1 -1
  208. package/out/concepts/InterfaceParam__.d.ts +3 -3
  209. package/out/concepts/InterfaceParam__.js +7 -6
  210. package/out/concepts/InterfaceParam__.js.map +1 -1
  211. package/out/concepts/Interface__.d.ts +33 -33
  212. package/out/concepts/Interface__.js +19 -20
  213. package/out/concepts/Interface__.js.map +1 -1
  214. package/out/concepts/JSBlock__.d.ts +1 -0
  215. package/out/concepts/JSBlock__.js +12 -5
  216. package/out/concepts/JSBlock__.js.map +1 -1
  217. package/out/concepts/JavaLogic__.js +10 -9
  218. package/out/concepts/JavaLogic__.js.map +1 -1
  219. package/out/concepts/LogicItem__.d.ts +6 -0
  220. package/out/concepts/LogicItem__.js +14 -5
  221. package/out/concepts/LogicItem__.js.map +1 -1
  222. package/out/concepts/Logic__.d.ts +80 -79
  223. package/out/concepts/Logic__.js +204 -58
  224. package/out/concepts/Logic__.js.map +1 -1
  225. package/out/concepts/MatchCase__.d.ts +39 -38
  226. package/out/concepts/MatchCase__.js +122 -37
  227. package/out/concepts/MatchCase__.js.map +1 -1
  228. package/out/concepts/Match__.d.ts +13 -11
  229. package/out/concepts/Match__.js +128 -60
  230. package/out/concepts/Match__.js.map +1 -1
  231. package/out/concepts/MemberExpression__.d.ts +7 -6
  232. package/out/concepts/MemberExpression__.js +52 -22
  233. package/out/concepts/MemberExpression__.js.map +1 -1
  234. package/out/concepts/MicroApp__.js +4 -3
  235. package/out/concepts/MicroApp__.js.map +1 -1
  236. package/out/concepts/Module__.d.ts +242 -154
  237. package/out/concepts/Module__.js +139 -33
  238. package/out/concepts/Module__.js.map +1 -1
  239. package/out/concepts/MsgTriggerEvent__.d.ts +15 -15
  240. package/out/concepts/MsgTriggerEvent__.js +6 -5
  241. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  242. package/out/concepts/MsgTriggerLauncher__.d.ts +23 -15
  243. package/out/concepts/MsgTriggerLauncher__.js +24 -5
  244. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  245. package/out/concepts/Namespace__.d.ts +180 -180
  246. package/out/concepts/Namespace__.js +33 -34
  247. package/out/concepts/Namespace__.js.map +1 -1
  248. package/out/concepts/NewComposite__.d.ts +49 -48
  249. package/out/concepts/NewComposite__.js +164 -49
  250. package/out/concepts/NewComposite__.js.map +1 -1
  251. package/out/concepts/NewList__.d.ts +19 -18
  252. package/out/concepts/NewList__.js +29 -12
  253. package/out/concepts/NewList__.js.map +1 -1
  254. package/out/concepts/NewMap__.d.ts +34 -33
  255. package/out/concepts/NewMap__.js +81 -72
  256. package/out/concepts/NewMap__.js.map +1 -1
  257. package/out/concepts/New__.js +6 -5
  258. package/out/concepts/New__.js.map +1 -1
  259. package/out/concepts/NullLiteral__.js +6 -5
  260. package/out/concepts/NullLiteral__.js.map +1 -1
  261. package/out/concepts/NumericLiteral__.d.ts +4 -3
  262. package/out/concepts/NumericLiteral__.js +15 -8
  263. package/out/concepts/NumericLiteral__.js.map +1 -1
  264. package/out/concepts/OqlQueryComponent__.d.ts +4 -3
  265. package/out/concepts/OqlQueryComponent__.js +25 -16
  266. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  267. package/out/concepts/OverriddenLogic__.d.ts +79 -79
  268. package/out/concepts/OverriddenLogic__.js +79 -58
  269. package/out/concepts/OverriddenLogic__.js.map +1 -1
  270. package/out/concepts/Param__.d.ts +6 -5
  271. package/out/concepts/Param__.js +66 -29
  272. package/out/concepts/Param__.js.map +1 -1
  273. package/out/concepts/Point__.js +4 -3
  274. package/out/concepts/Point__.js.map +1 -1
  275. package/out/concepts/ProcessComponent__.d.ts +30 -30
  276. package/out/concepts/ProcessComponent__.js +8 -7
  277. package/out/concepts/ProcessComponent__.js.map +1 -1
  278. package/out/concepts/ProcessElement__.d.ts +96 -96
  279. package/out/concepts/ProcessElement__.js +34 -34
  280. package/out/concepts/ProcessElement__.js.map +1 -1
  281. package/out/concepts/ProcessOutcome__.js +6 -5
  282. package/out/concepts/ProcessOutcome__.js.map +1 -1
  283. package/out/concepts/ProcessOutcomes__.js +6 -5
  284. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  285. package/out/concepts/Process__.d.ts +75 -75
  286. package/out/concepts/Process__.js +33 -30
  287. package/out/concepts/Process__.js.map +1 -1
  288. package/out/concepts/QueryAggregateExpression__.d.ts +3 -3
  289. package/out/concepts/QueryAggregateExpression__.js +8 -7
  290. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  291. package/out/concepts/QueryFieldExpression__.js +7 -6
  292. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  293. package/out/concepts/QueryFromExpression__.d.ts +8 -8
  294. package/out/concepts/QueryFromExpression__.js +8 -7
  295. package/out/concepts/QueryFromExpression__.js.map +1 -1
  296. package/out/concepts/QueryGroupByExpression__.d.ts +3 -3
  297. package/out/concepts/QueryGroupByExpression__.js +9 -10
  298. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  299. package/out/concepts/QueryJoinExpression__.d.ts +23 -23
  300. package/out/concepts/QueryJoinExpression__.js +11 -10
  301. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  302. package/out/concepts/QueryLimitExpression__.d.ts +6 -6
  303. package/out/concepts/QueryLimitExpression__.js +9 -8
  304. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  305. package/out/concepts/QueryOrderByExpression__.d.ts +6 -6
  306. package/out/concepts/QueryOrderByExpression__.js +9 -8
  307. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  308. package/out/concepts/QuerySelectExpression__.d.ts +30 -30
  309. package/out/concepts/QuerySelectExpression__.js +9 -8
  310. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  311. package/out/concepts/Rect__.js +4 -3
  312. package/out/concepts/Rect__.js.map +1 -1
  313. package/out/concepts/Return__.d.ts +4 -3
  314. package/out/concepts/Return__.js +37 -18
  315. package/out/concepts/Return__.js.map +1 -1
  316. package/out/concepts/Role__.js +9 -9
  317. package/out/concepts/Role__.js.map +1 -1
  318. package/out/concepts/SelectMembers__.d.ts +18 -18
  319. package/out/concepts/SelectMembers__.js +10 -9
  320. package/out/concepts/SelectMembers__.js.map +1 -1
  321. package/out/concepts/Slot__.d.ts +3 -3
  322. package/out/concepts/Slot__.js +6 -5
  323. package/out/concepts/Slot__.js.map +1 -1
  324. package/out/concepts/SqlQueryComponent__.d.ts +4 -3
  325. package/out/concepts/SqlQueryComponent__.js +21 -12
  326. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  327. package/out/concepts/Start__.js +6 -5
  328. package/out/concepts/Start__.js.map +1 -1
  329. package/out/concepts/StringInterpolation__.d.ts +16 -15
  330. package/out/concepts/StringInterpolation__.js +37 -14
  331. package/out/concepts/StringInterpolation__.js.map +1 -1
  332. package/out/concepts/StringLiteral__.d.ts +1 -0
  333. package/out/concepts/StringLiteral__.js +13 -8
  334. package/out/concepts/StringLiteral__.js.map +1 -1
  335. package/out/concepts/StructureProperty__.d.ts +4 -3
  336. package/out/concepts/StructureProperty__.js +22 -9
  337. package/out/concepts/StructureProperty__.js.map +1 -1
  338. package/out/concepts/Structure__.d.ts +31 -30
  339. package/out/concepts/Structure__.js +27 -15
  340. package/out/concepts/Structure__.js.map +1 -1
  341. package/out/concepts/SwitchCase__.d.ts +12 -11
  342. package/out/concepts/SwitchCase__.js +69 -31
  343. package/out/concepts/SwitchCase__.js.map +1 -1
  344. package/out/concepts/SwitchStatement__.d.ts +9 -8
  345. package/out/concepts/SwitchStatement__.js +27 -7
  346. package/out/concepts/SwitchStatement__.js.map +1 -1
  347. package/out/concepts/Theme__.js +4 -3
  348. package/out/concepts/Theme__.js.map +1 -1
  349. package/out/concepts/Transactional__.js +4 -3
  350. package/out/concepts/Transactional__.js.map +1 -1
  351. package/out/concepts/TriggerEvent__.d.ts +15 -15
  352. package/out/concepts/TriggerEvent__.js +6 -5
  353. package/out/concepts/TriggerEvent__.js.map +1 -1
  354. package/out/concepts/TriggerLauncher__.d.ts +15 -10
  355. package/out/concepts/TriggerLauncher__.js +54 -32
  356. package/out/concepts/TriggerLauncher__.js.map +1 -1
  357. package/out/concepts/TypeAnnotation__.d.ts +28 -27
  358. package/out/concepts/TypeAnnotation__.js +144 -124
  359. package/out/concepts/TypeAnnotation__.js.map +1 -1
  360. package/out/concepts/TypeParam__.d.ts +1 -0
  361. package/out/concepts/TypeParam__.js +12 -5
  362. package/out/concepts/TypeParam__.js.map +1 -1
  363. package/out/concepts/UnaryExpression__.d.ts +4 -3
  364. package/out/concepts/UnaryExpression__.js +31 -20
  365. package/out/concepts/UnaryExpression__.js.map +1 -1
  366. package/out/concepts/Unparsed__.d.ts +1 -0
  367. package/out/concepts/Unparsed__.js +12 -5
  368. package/out/concepts/Unparsed__.js.map +1 -1
  369. package/out/concepts/UseComponent__.js +4 -3
  370. package/out/concepts/UseComponent__.js.map +1 -1
  371. package/out/concepts/ValidationRule__.d.ts +14 -14
  372. package/out/concepts/ValidationRule__.js +19 -17
  373. package/out/concepts/ValidationRule__.js.map +1 -1
  374. package/out/concepts/Variable__.d.ts +4 -3
  375. package/out/concepts/Variable__.js +39 -23
  376. package/out/concepts/Variable__.js.map +1 -1
  377. package/out/concepts/ViewBlock__.js +4 -3
  378. package/out/concepts/ViewBlock__.js.map +1 -1
  379. package/out/concepts/ViewComponent__.d.ts +90 -90
  380. package/out/concepts/ViewComponent__.js +16 -15
  381. package/out/concepts/ViewComponent__.js.map +1 -1
  382. package/out/concepts/ViewElement__.d.ts +92 -86
  383. package/out/concepts/ViewElement__.js +258 -200
  384. package/out/concepts/ViewElement__.js.map +1 -1
  385. package/out/concepts/View__.d.ts +92 -92
  386. package/out/concepts/View__.js +173 -63
  387. package/out/concepts/View__.js.map +1 -1
  388. package/out/concepts/WhileStatement__.d.ts +12 -11
  389. package/out/concepts/WhileStatement__.js +46 -23
  390. package/out/concepts/WhileStatement__.js.map +1 -1
  391. package/out/concepts/basics/stdlib/index.js +17 -1
  392. package/out/concepts/basics/stdlib/index.js.map +1 -1
  393. package/out/concepts/basics/stdlib/nasl.browser.js +36 -0
  394. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  395. package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -0
  396. package/out/concepts/basics/stdlib/nasl.event.js +23 -0
  397. package/out/concepts/basics/stdlib/nasl.event.js.map +1 -0
  398. package/out/concepts/basics/stdlib/nasl.ui.js +45 -0
  399. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  400. package/out/concepts/basics/stdlib/nasl.util.js +6 -22
  401. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  402. package/out/concepts/index__.d.ts +2 -1
  403. package/out/concepts/index__.js +2 -1
  404. package/out/concepts/index__.js.map +1 -1
  405. package/out/concepts/types__.d.ts +2 -1
  406. package/out/decorators/index.d.ts +1 -1
  407. package/out/decorators/index.js +20 -7
  408. package/out/decorators/index.js.map +1 -1
  409. package/out/decorators/promise.d.ts +7 -0
  410. package/out/decorators/promise.js +28 -0
  411. package/out/decorators/promise.js.map +1 -0
  412. package/out/enums/KEYWORDS.js.map +1 -1
  413. package/out/enums/LEVEL_NAME_MAP.js.map +1 -1
  414. package/out/generator/compileComponent.js.map +1 -1
  415. package/out/generator/genBundleFiles.d.ts +4 -1
  416. package/out/generator/genBundleFiles.js +15 -11
  417. package/out/generator/genBundleFiles.js.map +1 -1
  418. package/out/generator/genHash.js.map +1 -1
  419. package/out/generator/genMetaData.js +12 -8
  420. package/out/generator/genMetaData.js.map +1 -1
  421. package/out/generator/genReleaseBody.js +33 -35
  422. package/out/generator/genReleaseBody.js.map +1 -1
  423. package/out/generator/microApp.js +2 -1
  424. package/out/generator/microApp.js.map +1 -1
  425. package/out/generator/permission.js +31 -30
  426. package/out/generator/permission.js.map +1 -1
  427. package/out/generator/styleReplacer.js +4 -7
  428. package/out/generator/styleReplacer.js.map +1 -1
  429. package/out/index.d.ts +0 -2
  430. package/out/index.js +0 -3
  431. package/out/index.js.map +1 -1
  432. package/out/manager/diagnostic.d.ts +1 -1
  433. package/out/manager/diagnostic.js.map +1 -1
  434. package/out/manager/stepRecorder.js +13 -9
  435. package/out/manager/stepRecorder.js.map +1 -1
  436. package/out/natural/RequirementAnalyzer.d.ts +22 -0
  437. package/out/natural/RequirementAnalyzer.js +196 -0
  438. package/out/natural/RequirementAnalyzer.js.map +1 -0
  439. package/out/natural/RequirementExecutor.d.ts +51 -0
  440. package/out/natural/RequirementExecutor.js +692 -0
  441. package/out/natural/RequirementExecutor.js.map +1 -0
  442. package/out/natural/componentData.d.ts +31 -0
  443. package/out/natural/componentData.js +85 -0
  444. package/out/natural/componentData.js.map +1 -0
  445. package/out/natural/genNaturalTS.d.ts +3 -0
  446. package/out/natural/genNaturalTS.js +76 -0
  447. package/out/natural/genNaturalTS.js.map +1 -0
  448. package/out/natural/index.d.ts +4 -0
  449. package/out/natural/index.js +21 -0
  450. package/out/natural/index.js.map +1 -0
  451. package/out/natural/knowledgeMap.d.ts +4 -0
  452. package/out/natural/knowledgeMap.js +40 -0
  453. package/out/natural/knowledgeMap.js.map +1 -0
  454. package/out/natural/naslStdlibMap.d.ts +2 -0
  455. package/out/natural/naslStdlibMap.js +26 -0
  456. package/out/natural/naslStdlibMap.js.map +1 -0
  457. package/out/natural/transformTSCode.d.ts +7 -0
  458. package/out/natural/transformTSCode.js +760 -0
  459. package/out/natural/transformTSCode.js.map +1 -0
  460. package/out/sentry/index.d.ts +2 -1
  461. package/out/sentry/index.js.map +1 -1
  462. package/out/server/createUiTs.js +28 -16
  463. package/out/server/createUiTs.js.map +1 -1
  464. package/out/server/entity2LogicNamespace.js +24 -22
  465. package/out/server/entity2LogicNamespace.js.map +1 -1
  466. package/out/server/event.d.ts +12 -0
  467. package/out/server/event.js +52 -28
  468. package/out/server/event.js.map +1 -1
  469. package/out/server/extendBaseNode.js +55 -70
  470. package/out/server/extendBaseNode.js.map +1 -1
  471. package/out/server/formatTsUtils.js +46 -50
  472. package/out/server/formatTsUtils.js.map +1 -1
  473. package/out/server/getConnector.d.ts +3 -3
  474. package/out/server/getConnector.js +7 -8
  475. package/out/server/getConnector.js.map +1 -1
  476. package/out/server/getExtensionModules.js +2 -2
  477. package/out/server/getExtensionModules.js.map +1 -1
  478. package/out/server/getFunctions.js.map +1 -1
  479. package/out/server/getInterfaces.js.map +1 -1
  480. package/out/server/getLogging.js.map +1 -1
  481. package/out/server/getLogics.d.ts +1 -1
  482. package/out/server/getLogics.js +55 -8
  483. package/out/server/getLogics.js.map +1 -1
  484. package/out/server/getMemberIdentifier.js +13 -10
  485. package/out/server/getMemberIdentifier.js.map +1 -1
  486. package/out/server/getProcessComponents.js.map +1 -1
  487. package/out/server/getProcesses.js +21 -29
  488. package/out/server/getProcesses.js.map +1 -1
  489. package/out/server/getScope.js.map +1 -1
  490. package/out/server/getValidates.js.map +1 -1
  491. package/out/server/index.js +0 -1
  492. package/out/server/index.js.map +1 -1
  493. package/out/server/naslServer.d.ts +99 -94
  494. package/out/server/naslServer.js +490 -469
  495. package/out/server/naslServer.js.map +1 -1
  496. package/out/server/naslStdlibMap.js +6 -2
  497. package/out/server/naslStdlibMap.js.map +1 -1
  498. package/out/server/process2LogicNamespace.js.map +1 -1
  499. package/out/server/translator.d.ts +1 -1
  500. package/out/server/translator.js +52 -47
  501. package/out/server/translator.js.map +1 -1
  502. package/out/service/storage/init.d.ts +15 -1
  503. package/out/service/storage/init.js +65 -56
  504. package/out/service/storage/init.js.map +1 -1
  505. package/out/templator/genCallComponentLogic.js +1 -2
  506. package/out/templator/genCallComponentLogic.js.map +1 -1
  507. package/out/templator/genCreateBlock.js +14 -9
  508. package/out/templator/genCreateBlock.js.map +1 -1
  509. package/out/templator/genCurdEditMultipleKeyBlock.js +23 -14
  510. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  511. package/out/templator/genCurdMultipleKeyBlock.js +26 -30
  512. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  513. package/out/templator/genEditTableBlock.d.ts +1 -1
  514. package/out/templator/genEditTableBlock.js +14 -19
  515. package/out/templator/genEditTableBlock.js.map +1 -1
  516. package/out/templator/genEnumSelectBlock.js +1 -1
  517. package/out/templator/genEnumSelectBlock.js.map +1 -1
  518. package/out/templator/genGetBlock.js +2 -2
  519. package/out/templator/genGetBlock.js.map +1 -1
  520. package/out/templator/genGridViewBlock.d.ts +2 -2
  521. package/out/templator/genGridViewBlock.js +18 -28
  522. package/out/templator/genGridViewBlock.js.map +1 -1
  523. package/out/templator/genListViewBlock.d.ts +2 -2
  524. package/out/templator/genListViewBlock.js +9 -16
  525. package/out/templator/genListViewBlock.js.map +1 -1
  526. package/out/templator/genQueryComponent.js +22 -15
  527. package/out/templator/genQueryComponent.js.map +1 -1
  528. package/out/templator/genSelectBlock.d.ts +2 -2
  529. package/out/templator/genSelectBlock.js +21 -48
  530. package/out/templator/genSelectBlock.js.map +1 -1
  531. package/out/templator/genTableBlock.d.ts +1 -1
  532. package/out/templator/genTableBlock.js +11 -17
  533. package/out/templator/genTableBlock.js.map +1 -1
  534. package/out/templator/genUpdateBlock.js +13 -8
  535. package/out/templator/genUpdateBlock.js.map +1 -1
  536. package/out/templator/index.d.ts +4 -2
  537. package/out/templator/index.js +2 -2
  538. package/out/templator/index.js.map +1 -1
  539. package/out/templator/utils.d.ts +9 -2
  540. package/out/templator/utils.js +22 -22
  541. package/out/templator/utils.js.map +1 -1
  542. package/out/translator/index.js +27 -28
  543. package/out/translator/index.js.map +1 -1
  544. package/out/utils/index.d.ts +2 -1
  545. package/out/utils/index.js +8 -14
  546. package/out/utils/index.js.map +1 -1
  547. package/out/utils/logger.js.map +1 -1
  548. package/out/utils/sortTsString.js +3 -1
  549. package/out/utils/sortTsString.js.map +1 -1
  550. package/out/utils/string.js +8 -11
  551. package/out/utils/string.js.map +1 -1
  552. package/out/utils/time-slicing.d.ts +41 -0
  553. package/out/utils/time-slicing.js +81 -0
  554. package/out/utils/time-slicing.js.map +1 -0
  555. package/out/utils/traverse.js +4 -6
  556. package/out/utils/traverse.js.map +1 -1
  557. package/package.json +22 -20
  558. package/sandbox/stdlib/nasl.auth.ts +49 -46
  559. package/sandbox/stdlib/nasl.browser.ts +1 -0
  560. package/sandbox/stdlib/nasl.event.ts +4 -0
  561. package/sandbox/stdlib/nasl.http.ts +29 -31
  562. package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
  563. package/sandbox/stdlib/nasl.ui.ts +11 -0
  564. package/sandbox-natural/stdlib/nasl.core.ts +36 -0
  565. package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
  566. package/sandbox-natural/stdlib/nasl.ui.ts +56 -0
  567. package/sandbox-natural/stdlib/nasl.util.ts +26 -0
  568. package/sandbox-natural/tsconfig.json +12 -0
  569. package/src/automate/engine/utils.js +3 -0
  570. package/src/automate/upgrader/2.20.js +1 -1
  571. package/src/bak/translator.js +92 -99
  572. package/src/breakpoint/generator/AfterStartNode.ts +19 -17
  573. package/src/breakpoint/generator/BeforeEndNode.ts +17 -17
  574. package/src/breakpoint/generator/BreakpointNode.ts +243 -195
  575. package/src/breakpoint/generator/CallbackNode.ts +20 -0
  576. package/src/breakpoint/generator/FragmentNode.ts +14 -0
  577. package/src/breakpoint/generator/index.ts +107 -80
  578. package/src/breakpoint/shared/constants.ts +59 -53
  579. package/src/breakpoint/shared/operations.ts +6 -6
  580. package/src/breakpoint/shared/socket.ts +277 -223
  581. package/src/breakpoint/shared/utils.ts +166 -146
  582. package/src/breakpoint/store/core.ts +326 -297
  583. package/src/breakpoint/store/dock.ts +103 -103
  584. package/src/breakpoint/types/index.d.ts +11 -11
  585. package/src/common/BaseNode.ts +1103 -1020
  586. package/src/common/Command.ts +46 -16
  587. package/src/common/ComponentAPI.ts +72 -72
  588. package/src/common/EventEmitter.ts +80 -76
  589. package/src/common/Messager.ts +223 -224
  590. package/src/common/asyncFuncMap.ts +12 -12
  591. package/src/concepts/Abort__.ts +53 -60
  592. package/src/concepts/Anchor__.ts +158 -149
  593. package/src/concepts/AnonymousFunction__.ts +584 -551
  594. package/src/concepts/App__.ts +4278 -3669
  595. package/src/concepts/Argument__.ts +234 -210
  596. package/src/concepts/Assignee__.ts +680 -656
  597. package/src/concepts/AssignmentLine__.ts +80 -84
  598. package/src/concepts/Assignment__.ts +276 -264
  599. package/src/concepts/Attribute__.ts +183 -184
  600. package/src/concepts/AuthInterface__.ts +61 -63
  601. package/src/concepts/AuthLogicForCallInterface__.ts +540 -511
  602. package/src/concepts/AuthLogic__.ts +210 -194
  603. package/src/concepts/BackendVariable__.ts +414 -415
  604. package/src/concepts/Backend__.ts +317 -303
  605. package/src/concepts/BatchAssignment__.ts +987 -939
  606. package/src/concepts/BinaryExpression__.ts +370 -341
  607. package/src/concepts/BindAttribute__.ts +1056 -1011
  608. package/src/concepts/BindDirective__.ts +540 -542
  609. package/src/concepts/BindEvent__.ts +992 -866
  610. package/src/concepts/BindStyle__.ts +442 -451
  611. package/src/concepts/BooleanLiteral__.ts +89 -90
  612. package/src/concepts/CallAuthInterface__.ts +458 -433
  613. package/src/concepts/CallConnector__.ts +209 -164
  614. package/src/concepts/CallFunction__.ts +600 -600
  615. package/src/concepts/CallInterface__.ts +752 -725
  616. package/src/concepts/CallLogic__.ts +1328 -1236
  617. package/src/concepts/CallQueryComponent__.ts +1580 -1501
  618. package/src/concepts/Comment__.ts +69 -68
  619. package/src/concepts/CompletionProperty__.ts +250 -250
  620. package/src/concepts/ConfigGroup__.ts +312 -296
  621. package/src/concepts/ConfigPropertyValue__.ts +81 -82
  622. package/src/concepts/ConfigProperty__.ts +374 -357
  623. package/src/concepts/Configuration__.ts +288 -276
  624. package/src/concepts/Connection__.ts +426 -0
  625. package/src/concepts/ConnectorTrigger__.ts +146 -142
  626. package/src/concepts/Connector__.ts +1090 -1048
  627. package/src/concepts/Constant__.ts +226 -219
  628. package/src/concepts/DataElement__.ts +108 -115
  629. package/src/concepts/DataSource__.ts +508 -472
  630. package/src/concepts/DatabaseTypeAnnotation__.ts +53 -59
  631. package/src/concepts/Destination__.ts +808 -746
  632. package/src/concepts/End__.ts +85 -89
  633. package/src/concepts/EntityIndex__.ts +206 -202
  634. package/src/concepts/EntityProperty__.ts +825 -791
  635. package/src/concepts/Entity__.ts +921 -864
  636. package/src/concepts/EnumItem__.ts +133 -125
  637. package/src/concepts/Enum__.ts +347 -337
  638. package/src/concepts/Event__.ts +305 -292
  639. package/src/concepts/ExternalDestination__.ts +269 -280
  640. package/src/concepts/ForEachStatement__.ts +583 -531
  641. package/src/concepts/FrontendLibrary__.ts +507 -485
  642. package/src/concepts/FrontendVariable__.ts +44 -49
  643. package/src/concepts/Frontend__.ts +1239 -1187
  644. package/src/concepts/Function__.ts +1110 -1045
  645. package/src/concepts/Identifier__.ts +276 -272
  646. package/src/concepts/IfStatement__.ts +467 -436
  647. package/src/concepts/Integration__.ts +136 -137
  648. package/src/concepts/InterfaceParam__.ts +239 -238
  649. package/src/concepts/Interface__.ts +969 -948
  650. package/src/concepts/JSBlock__.ts +83 -83
  651. package/src/concepts/JavaLogic__.ts +101 -106
  652. package/src/concepts/LogicItem__.ts +307 -237
  653. package/src/concepts/Logic__.ts +2301 -2088
  654. package/src/concepts/MatchCase__.ts +886 -779
  655. package/src/concepts/Match__.ts +728 -659
  656. package/src/concepts/MemberExpression__.ts +330 -311
  657. package/src/concepts/MicroApp__.ts +91 -97
  658. package/src/concepts/Module__.ts +2590 -2275
  659. package/src/concepts/MsgTriggerEvent__.ts +297 -281
  660. package/src/concepts/MsgTriggerLauncher__.ts +286 -256
  661. package/src/concepts/Namespace__.ts +2579 -2466
  662. package/src/concepts/NewComposite__.ts +1487 -1350
  663. package/src/concepts/NewList__.ts +464 -450
  664. package/src/concepts/NewMap__.ts +691 -674
  665. package/src/concepts/New__.ts +42 -49
  666. package/src/concepts/NullLiteral__.ts +66 -72
  667. package/src/concepts/NumericLiteral__.ts +169 -169
  668. package/src/concepts/OqlQueryComponent__.ts +282 -279
  669. package/src/concepts/OverriddenLogic__.ts +2142 -2097
  670. package/src/concepts/Param__.ts +500 -442
  671. package/src/concepts/Point__.ts +53 -59
  672. package/src/concepts/ProcessComponent__.ts +497 -475
  673. package/src/concepts/ProcessElement__.ts +1852 -1780
  674. package/src/concepts/ProcessOutcome__.ts +59 -64
  675. package/src/concepts/ProcessOutcomes__.ts +59 -64
  676. package/src/concepts/Process__.ts +1491 -1428
  677. package/src/concepts/QueryAggregateExpression__.ts +135 -142
  678. package/src/concepts/QueryFieldExpression__.ts +138 -142
  679. package/src/concepts/QueryFromExpression__.ts +246 -254
  680. package/src/concepts/QueryGroupByExpression__.ts +130 -136
  681. package/src/concepts/QueryJoinExpression__.ts +441 -438
  682. package/src/concepts/QueryLimitExpression__.ts +159 -166
  683. package/src/concepts/QueryOrderByExpression__.ts +173 -180
  684. package/src/concepts/QuerySelectExpression__.ts +464 -439
  685. package/src/concepts/Rect__.ts +73 -79
  686. package/src/concepts/Return__.ts +366 -345
  687. package/src/concepts/Role__.ts +146 -147
  688. package/src/concepts/SelectMembers__.ts +358 -350
  689. package/src/concepts/Slot__.ts +152 -153
  690. package/src/concepts/SqlQueryComponent__.ts +230 -228
  691. package/src/concepts/Start__.ts +45 -52
  692. package/src/concepts/StringInterpolation__.ts +323 -296
  693. package/src/concepts/StringLiteral__.ts +113 -115
  694. package/src/concepts/StructureProperty__.ts +306 -295
  695. package/src/concepts/Structure__.ts +615 -578
  696. package/src/concepts/SwitchCase__.ts +326 -290
  697. package/src/concepts/SwitchStatement__.ts +236 -229
  698. package/src/concepts/Theme__.ts +64 -68
  699. package/src/concepts/Transactional__.ts +159 -153
  700. package/src/concepts/TriggerEvent__.ts +285 -274
  701. package/src/concepts/TriggerLauncher__.ts +232 -196
  702. package/src/concepts/TypeAnnotation__.ts +1049 -1011
  703. package/src/concepts/TypeParam__.ts +48 -50
  704. package/src/concepts/UnaryExpression__.ts +163 -153
  705. package/src/concepts/Unparsed__.ts +81 -82
  706. package/src/concepts/UseComponent__.ts +53 -59
  707. package/src/concepts/ValidationRule__.ts +524 -544
  708. package/src/concepts/Variable__.ts +419 -397
  709. package/src/concepts/ViewBlock__.ts +58 -64
  710. package/src/concepts/ViewComponent__.ts +1323 -1261
  711. package/src/concepts/ViewElement__.ts +2537 -2351
  712. package/src/concepts/View__.ts +2461 -2245
  713. package/src/concepts/WhileStatement__.ts +293 -272
  714. package/src/concepts/basics/stdlib/index.ts +17 -1
  715. package/src/concepts/basics/stdlib/nasl.browser.ts +36 -0
  716. package/src/concepts/basics/stdlib/nasl.event.ts +18 -0
  717. package/src/concepts/basics/stdlib/nasl.ui.ts +45 -0
  718. package/src/concepts/basics/stdlib/nasl.util.ts +6 -22
  719. package/src/concepts/index__.ts +2 -1
  720. package/src/concepts/types__.ts +123 -121
  721. package/src/decorators/index.ts +75 -77
  722. package/src/decorators/promise.ts +28 -0
  723. package/src/enums/KEYWORDS.ts +1228 -1228
  724. package/src/enums/LEVEL_NAME_MAP.ts +24 -24
  725. package/src/generator/compileComponent.ts +10 -10
  726. package/src/generator/genBundleFiles.ts +300 -291
  727. package/src/generator/genHash.ts +2 -2
  728. package/src/generator/genMetaData.ts +280 -261
  729. package/src/generator/genReleaseBody.ts +312 -291
  730. package/src/generator/icestark.ts +1 -1
  731. package/src/generator/microApp.ts +17 -20
  732. package/src/generator/permission.ts +241 -232
  733. package/src/generator/qiankun.ts +1 -1
  734. package/src/generator/styleReplacer.ts +28 -31
  735. package/src/index.ts +0 -3
  736. package/src/manager/diagnostic.ts +84 -82
  737. package/src/manager/stepRecorder.ts +106 -94
  738. package/src/natural/RequirementAnalyzer.ts +208 -0
  739. package/src/natural/RequirementExecutor.ts +685 -0
  740. package/src/natural/componentData.ts +81 -0
  741. package/src/natural/genNaturalTS.ts +77 -0
  742. package/src/natural/index.ts +4 -0
  743. package/src/natural/knowledgeMap.ts +39 -0
  744. package/src/natural/naslStdlibMap.ts +24 -0
  745. package/src/natural/transformTSCode.ts +692 -0
  746. package/src/sentry/index.ts +109 -104
  747. package/src/server/createUiTs.ts +190 -184
  748. package/src/server/entity2LogicNamespace.ts +379 -359
  749. package/src/server/event.js +145 -121
  750. package/src/server/extendBaseNode.ts +461 -456
  751. package/src/server/formatTsUtils.ts +712 -713
  752. package/src/server/getConnector.ts +33 -33
  753. package/src/server/getExtensionModules.ts +23 -22
  754. package/src/server/getFunctions.ts +6 -6
  755. package/src/server/getInterfaces.ts +38 -37
  756. package/src/server/getLogging.ts +1 -1
  757. package/src/server/getLogics.ts +391 -312
  758. package/src/server/getMemberIdentifier.ts +286 -281
  759. package/src/server/getProcessComponents.ts +2 -2
  760. package/src/server/getProcesses.ts +548 -534
  761. package/src/server/getScope.ts +51 -51
  762. package/src/server/getValidates.ts +3 -3
  763. package/src/server/index.ts +29 -30
  764. package/src/server/naslServer.ts +4303 -4222
  765. package/src/server/naslStdlibMap.ts +43 -39
  766. package/src/server/process2LogicNamespace.ts +97 -97
  767. package/src/server/translator.ts +740 -746
  768. package/src/service/storage/init.ts +761 -728
  769. package/src/templator/genCallComponentLogic.ts +14 -15
  770. package/src/templator/genCreateBlock.ts +257 -229
  771. package/src/templator/genCurdEditMultipleKeyBlock.ts +333 -317
  772. package/src/templator/genCurdMultipleKeyBlock.ts +503 -475
  773. package/src/templator/genEditTableBlock.ts +194 -187
  774. package/src/templator/genEnumSelectBlock.ts +13 -7
  775. package/src/templator/genGetBlock.ts +57 -55
  776. package/src/templator/genGridViewBlock.ts +195 -211
  777. package/src/templator/genListViewBlock.ts +62 -72
  778. package/src/templator/genQueryComponent.ts +337 -287
  779. package/src/templator/genSelectBlock.ts +283 -297
  780. package/src/templator/genTableBlock.ts +160 -166
  781. package/src/templator/genUpdateBlock.ts +269 -255
  782. package/src/templator/index.ts +4 -4
  783. package/src/templator/utils.ts +491 -463
  784. package/src/translator/index.ts +84 -84
  785. package/src/translator/lsp.ts +22 -22
  786. package/src/translator/tsp.ts +6 -6
  787. package/src/utils/index.ts +115 -117
  788. package/src/utils/logger.ts +3 -4
  789. package/src/utils/sortTsString.ts +34 -32
  790. package/src/utils/string.ts +47 -48
  791. package/src/utils/time-slicing.ts +109 -0
  792. package/src/utils/traverse.ts +114 -126
  793. package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +71 -0
  794. package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +140 -0
  795. package/test/concepts/call-interface/constant.ts +5 -0
  796. package/test/concepts/call-interface/fixtures/only-interface.json +158 -0
  797. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +455 -0
  798. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +187 -0
  799. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +225 -0
  800. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +213 -0
  801. package/test/concepts/call-interface/fixtures/with-headers.json +192 -0
  802. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +213 -0
  803. package/test/concepts/call-interface/fixtures/with-query.json +192 -0
  804. package/test/concepts/call-interface/toEmbeddedTS.spec.ts +14 -0
  805. package/test/concepts/call-interface/toJS.spec.ts +14 -0
  806. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
  807. package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +141 -0
  808. package/test/concepts/call-logic/constant.ts +5 -0
  809. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +223 -0
  810. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +359 -0
  811. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +209 -0
  812. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +311 -0
  813. package/test/concepts/call-logic/fixtures/only-call-logic.json +10 -0
  814. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +128 -0
  815. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +126 -0
  816. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +244 -0
  817. package/test/concepts/call-logic/toEmbeddedTS.spec.ts +14 -0
  818. package/test/concepts/call-logic/toJS.spec.ts +14 -0
  819. package/test/concepts/match/__snapshots__/toEmbeddedTS.spec.ts.snap +66 -0
  820. package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +40 -0
  821. package/test/concepts/match/constant.ts +5 -0
  822. package/test/concepts/match/fixtures/isExpression.json +259 -0
  823. package/test/concepts/match/fixtures/lastBodyIf.json +268 -0
  824. package/test/concepts/match/fixtures/noExpression.json +176 -0
  825. package/test/concepts/match/toEmbeddedTS.spec.ts +14 -0
  826. package/test/concepts/match/toJS.spec.ts +14 -0
  827. package/test/concepts/utils.ts +76 -3
  828. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
  829. package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +16 -0
  830. package/test/concepts/validation-rule/constant.ts +5 -0
  831. package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +10 -17
  832. package/test/concepts/validation-rule/toJS.spec.ts +14 -0
  833. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +68 -0
  834. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +44 -0
  835. package/test/concepts/view-element/constant.ts +5 -0
  836. package/test/concepts/view-element/fixtures/default-not-found.json +322 -0
  837. package/test/concepts/view-element/toEmbeddedTS.spec.ts +14 -0
  838. package/test/concepts/view-element/toVue.spec.ts +14 -0
  839. package/test/setup.ts +7 -0
  840. package/ts-worker/src/index.js +0 -2
  841. package/tsconfig.json +21 -21
  842. package/bin/naslc +0 -3
@@ -1,3 +1,4 @@
1
+ import { v4 as uuidv4 } from 'uuid';
1
2
  import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
2
3
  import { genLaunchProcess, syncMemberExpression } from '../server/getProcesses';
3
4
  import { process2LogicNamespace } from '../server/process2LogicNamespace';
@@ -5,15 +6,14 @@ import Namespace from './Namespace__';
5
6
  import Logic from './Logic__';
6
7
  import Variable from './Variable__';
7
8
  import Identifier from './Identifier__';
8
- //================================================================================
9
+ //= ===============================================================================
9
10
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
10
11
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
11
- //================================================================================
12
+ //= ===============================================================================
12
13
  import { EventPayload, Params } from '../common/EventEmitter';
13
14
  import { concept, excludedInJSON, property } from '../decorators';
14
15
 
15
16
  import * as utils from '../utils';
16
- import { v4 as uuidv4 } from 'uuid';
17
17
  import BaseNode from '../common/BaseNode';
18
18
  import classMap from '../common/classMap';
19
19
  import BindEvent from './BindEvent__';
@@ -29,1464 +29,1527 @@ import App from './App__';
29
29
  */
30
30
  @concept('流程')
31
31
  export class Process extends BaseNode {
32
- /**
33
- * 产品概念
34
- */
35
- @property()
36
- concept: 'Process' = 'Process';
37
-
38
- /**
39
- * 流程名称
40
- */
41
- @property()
42
- name: string = undefined;
43
-
44
- /**
45
- * 流程标题
46
- */
47
- @property()
48
- title: string = undefined;
49
-
50
- /**
51
- * 流程描述
52
- */
53
- @property()
54
- description: string = undefined;
55
-
56
- /**
57
- * 元素绑定事件列表
58
- */
59
- @property('BindEvent')
60
- bindEvents: Array<BindEvent> = [];
61
-
62
- /**
63
- * 输入参数列表
64
- */
65
- @property('Param')
66
- params: Array<Param> = [];
67
-
68
- /**
69
- * 输出参数列表
70
- */
71
- @property('Return')
72
- returns: Array<Return> = [];
73
-
74
- /**
75
- * 常量列表
76
- */
77
- @property('Constant')
78
- constants: Array<Constant> = [];
79
-
80
- /**
81
- * 流程元素列表
82
- */
83
- @property('ProcessElement')
84
- elements: Array<ProcessElement> = [];
85
-
86
- /**
87
- * 祖先 Module
88
- */
89
- get module() {
90
- return this.getAncestor('Module') as Module;
91
- }
92
- /**
93
- * 祖先 App
94
- */
95
- get app() {
96
- return this.getAncestor('App') as App;
97
- }
98
-
99
- /**
100
- * @param source 需要合并的部分参数
101
- */
102
- constructor(source?: Partial<Process>) {
103
- source = Object.assign({}, Process.getDefaultOptions(), source);
104
- super(source);
105
- super.subConstructor(source);
106
- }
107
- getClassName() {
108
- return 'Process';
109
- }
110
-
111
- static from(source: any, parentNode?: any, parentKey?: string): Process {
112
- return super.from(source, parentNode, parentKey) as Process;
113
- }
114
-
115
- /**
116
- * 从父级删除该节点
117
- * @internal
118
- */
119
- _delete() {
120
- let params: Params = null;
121
- if (this.parentNode) {
122
- params = (this.parentNode as any)?.__removeProcess?.(this);
123
- }
124
- return params;
125
- }
126
- /**
127
- * 设置流程名称
128
- */
129
- setName(name: string) {
130
- const object = {
131
- name,
132
- };
133
- this.update({
134
- ...object,
135
- field: 'name',
136
- });
137
- }
138
-
139
- /**
140
- * 设置流程标题
141
- */
142
- setTitle(title: string) {
143
- const object = {
144
- title,
145
- };
146
- this.update({
147
- ...object,
148
- });
149
- }
150
-
151
- /**
152
- * 设置流程描述
153
- */
154
- setDescription(description: string) {
155
- const object = {
156
- description,
157
- };
158
- this.update({
159
- ...object,
160
- });
161
- }
162
-
163
- getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
164
- const excludedSet = new Set(excludedList);
165
- return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
166
- }
167
- getBindEventUniqueName(name = 'bindEvent1') {
168
- return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
169
- }
170
-
171
- /**
172
- * 插入元素绑定事件
173
- * @internal
174
- * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
175
- */
176
- _insertBindEventAt(name: string, index: number): BindEvent;
177
-
178
- /**
179
- * 插入元素绑定事件
180
- * @internal
181
- * @param bindEventOptions 元素绑定事件参数
182
- */
183
- _insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
184
-
185
- /**
186
- * 插入元素绑定事件
187
- * @internal
188
- * @param bindEvent 已有的元素绑定事件实例
189
- */
190
- _insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
191
-
192
- _insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
193
- const bindEventOptions: any = {};
194
- const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
195
- let bindEvent: BindEvent;
196
- if (!options) {
197
- bindEvent = BindEvent.from({
198
- ...bindEventOptions,
199
- name: this.getBindEventUniqueName(),
200
- }, this, 'bindEvents');
201
- } else if (typeof options === 'string') {
202
- bindEvent = BindEvent.from({
203
- ...bindEventOptions,
204
- name: options,
205
- }, this, 'bindEvents');
206
- } else if (options instanceof BindEvent) {
207
- options.ensureDelete(); // 同一实例不支持多处存在
208
- bindEvent = options;
209
- Object.assign(bindEvent, relationOptions);
210
- } else {
211
- bindEvent = BindEvent.from({
212
- ...bindEventOptions,
213
- ...options,
214
- }, this, 'bindEvents');
215
- }
216
- this.bindEvents.splice(index, 0, bindEvent);
217
- return bindEvent;
218
- }
219
-
220
- /**
221
- * 插入元素绑定事件
222
- * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
223
- */
224
- insertBindEventAt(name: string, index: number): BindEvent;
225
-
226
- /**
227
- * 插入元素绑定事件
228
- * @param bindEventOptions 元素绑定事件参数
229
- */
230
- insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
231
-
232
- /**
233
- * 插入元素绑定事件
234
- * @param bindEvent 已有的元素绑定事件实例
235
- */
236
- insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
237
-
238
- insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
239
- const node = this._insertBindEventAt(options as any, index);
240
- node.create({
241
- index,
242
- parentNode: this,
243
- parentKey: 'bindEvents',
244
- });
245
- return node;
246
- }
247
-
248
- /**
249
- * 添加元素绑定事件
250
- * @internal
251
- * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
252
- */
253
- _addBindEvent(name?: string): BindEvent;
254
-
255
- /**
256
- * 添加元素绑定事件
257
- * @internal
258
- * @param bindEventOptions 元素绑定事件参数
259
- */
260
- _addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
261
-
262
- /**
263
- * 添加元素绑定事件
264
- * @internal
265
- * @param bindEvent 已有的元素绑定事件实例
266
- */
267
- _addBindEvent(bindEvent: BindEvent): BindEvent;
268
-
269
- _addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
270
- const index = this.bindEvents.length;
271
- return this._insertBindEventAt(options as any, index);
272
- }
273
-
274
- /**
275
- * 添加元素绑定事件
276
- * @internal
277
- * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
278
- */
279
- addBindEvent(name?: string): BindEvent;
280
-
281
- /**
282
- * 添加元素绑定事件
283
- * @param bindEventOptions 元素绑定事件参数
284
- */
285
- addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
286
-
287
- /**
288
- * 添加元素绑定事件
289
- * @param bindEvent 已有的元素绑定事件实例
290
- */
291
- addBindEvent(bindEvent: BindEvent): BindEvent;
292
-
293
- addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
294
- const node = this._addBindEvent(options as any);
295
- const index = this.bindEvents.indexOf(node);
296
- node.create({
297
- index,
298
- parentNode: this,
299
- parentKey: 'bindEvents',
300
- });
301
- return node;
302
- }
303
-
304
-
305
- getParamExistingNames(excludedList: Array<Param> = []) {
306
- const excludedSet = new Set(excludedList);
307
- return ((this.params as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
308
- }
309
- getParamUniqueName(name = 'param1') {
310
- return utils.unique(name, this.getParamExistingNames(), undefined, false);
311
- }
312
-
313
- /**
314
- * 插入输入参数
315
- * @internal
316
- * @param name 输入参数名称,如果不填会自动生成一个唯一名称
317
- */
318
- _insertParamAt(name: string, index: number): Param;
319
-
320
- /**
321
- * 插入输入参数
322
- * @internal
323
- * @param paramOptions 输入参数参数
324
- */
325
- _insertParamAt(paramOptions: Partial<Param>, index: number): Param;
326
-
327
- /**
328
- * 插入输入参数
329
- * @internal
330
- * @param param 已有的输入参数实例
331
- */
332
- _insertParamAt(param: Param, index: number): Param;
333
-
334
- _insertParamAt(options: string | Partial<Param> | Param, index: number) {
335
- const paramOptions: any = {};
336
- const relationOptions = { parentNode: this, parentKey: 'params' };
337
- let param: Param;
338
- if (!options) {
339
- param = Param.from({
340
- ...paramOptions,
341
- name: this.getParamUniqueName(),
342
- }, this, 'params');
343
- } else if (typeof options === 'string') {
344
- param = Param.from({
345
- ...paramOptions,
346
- name: options,
347
- }, this, 'params');
348
- } else if (options instanceof Param) {
349
- options.ensureDelete(); // 同一实例不支持多处存在
350
- param = options;
351
- Object.assign(param, relationOptions);
352
- } else {
353
- param = Param.from({
354
- ...paramOptions,
355
- ...options,
356
- }, this, 'params');
357
- }
358
- this.params.splice(index, 0, param);
359
- return param;
360
- }
361
-
362
- /**
363
- * 插入输入参数
364
- * @param name 输入参数名称,如果不填会自动生成一个唯一名称
365
- */
366
- insertParamAt(name: string, index: number): Param;
367
-
368
- /**
369
- * 插入输入参数
370
- * @param paramOptions 输入参数参数
371
- */
372
- insertParamAt(paramOptions: Partial<Param>, index: number): Param;
373
-
374
- /**
375
- * 插入输入参数
376
- * @param param 已有的输入参数实例
377
- */
378
- insertParamAt(param: Param, index: number): Param;
379
-
380
- insertParamAt(options: string | Partial<Param> | Param, index: number) {
381
- const node = this._insertParamAt(options as any, index);
382
- node.create({
383
- index,
384
- parentNode: this,
385
- parentKey: 'params',
386
- });
387
- return node;
388
- }
389
-
390
- /**
391
- * 添加输入参数
392
- * @internal
393
- * @param name 输入参数名称,如果不填会自动生成一个唯一名称
394
- */
395
- _addParam(name?: string): Param;
396
-
397
- /**
398
- * 添加输入参数
399
- * @internal
400
- * @param paramOptions 输入参数参数
401
- */
402
- _addParam(paramOptions: Partial<Param>): Param;
403
-
404
- /**
405
- * 添加输入参数
406
- * @internal
407
- * @param param 已有的输入参数实例
408
- */
409
- _addParam(param: Param): Param;
410
-
411
- _addParam(options?: string | Partial<Param> | Param) {
412
- const index = this.params.length;
413
- return this._insertParamAt(options as any, index);
414
- }
415
-
416
- /**
417
- * 添加输入参数
418
- * @internal
419
- * @param name 输入参数名称,如果不填会自动生成一个唯一名称
420
- */
421
- addParam(name?: string): Param;
422
-
423
- /**
424
- * 添加输入参数
425
- * @param paramOptions 输入参数参数
426
- */
427
- addParam(paramOptions: Partial<Param>): Param;
428
-
429
- /**
430
- * 添加输入参数
431
- * @param param 已有的输入参数实例
432
- */
433
- addParam(param: Param): Param;
434
-
435
- addParam(options?: string | Partial<Param> | Param) {
436
- const node = this._addParam(options as any);
437
- const index = this.params.indexOf(node);
438
- node.create({
439
- index,
440
- parentNode: this,
441
- parentKey: 'params',
442
- });
443
- return node;
32
+ /**
33
+ * 产品概念
34
+ */
35
+ @property()
36
+ concept: 'Process' = 'Process';
37
+
38
+ /**
39
+ * 流程名称
40
+ */
41
+ @property()
42
+ name: string = undefined;
43
+
44
+ /**
45
+ * 流程标题
46
+ */
47
+ @property()
48
+ title: string = undefined;
49
+
50
+ /**
51
+ * 流程描述
52
+ */
53
+ @property()
54
+ description: string = undefined;
55
+
56
+ /**
57
+ * 元素绑定事件列表
58
+ */
59
+ @property('BindEvent')
60
+ bindEvents: Array<BindEvent> = [];
61
+
62
+ /**
63
+ * 输入参数列表
64
+ */
65
+ @property('Param')
66
+ params: Array<Param> = [];
67
+
68
+ /**
69
+ * 输出参数列表
70
+ */
71
+ @property('Return')
72
+ returns: Array<Return> = [];
73
+
74
+ /**
75
+ * 常量列表
76
+ */
77
+ @property('Constant')
78
+ constants: Array<Constant> = [];
79
+
80
+ /**
81
+ * 流程元素列表
82
+ */
83
+ @property('ProcessElement')
84
+ elements: Array<ProcessElement> = [];
85
+
86
+ /**
87
+ * 祖先 Module
88
+ */
89
+ get module() {
90
+ return this.getAncestor('Module') as Module;
91
+ }
92
+
93
+ /**
94
+ * 祖先 App
95
+ */
96
+ get app() {
97
+ return this.getAncestor('App') as App;
98
+ }
99
+
100
+ /**
101
+ * @param source 需要合并的部分参数
102
+ */
103
+ constructor(source?: Partial<Process>) {
104
+ // @ts-ignore
105
+ source = { ...Process.getDefaultOptions(), ...source };
106
+ super(source);
107
+ super.subConstructor(source);
108
+ }
109
+
110
+ getClassName() {
111
+ return 'Process';
112
+ }
113
+
114
+ static from(source: any, parentNode?: any, parentKey?: string): Process {
115
+ return super.from(source, parentNode, parentKey) as Process;
116
+ }
117
+
118
+ /**
119
+ * 从父级删除该节点
120
+ * @internal
121
+ */
122
+ _delete() {
123
+ let params: Params = null;
124
+ if (this.parentNode) {
125
+ params = (this.parentNode as any)?.__removeProcess?.(this);
444
126
  }
445
-
446
-
447
- getReturnExistingNames(excludedList: Array<Return> = []) {
448
- const excludedSet = new Set(excludedList);
449
- return ((this.returns as Return[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
450
- }
451
- getReturnUniqueName(name = 'ret1') {
452
- return utils.unique(name, this.getReturnExistingNames(), undefined, false);
453
- }
454
-
455
- /**
456
- * 插入输出参数
457
- * @internal
458
- * @param name 输出参数名称,如果不填会自动生成一个唯一名称
459
- */
460
- _insertReturnAt(name: string, index: number): Return;
461
-
462
- /**
463
- * 插入输出参数
464
- * @internal
465
- * @param retOptions 输出参数参数
466
- */
467
- _insertReturnAt(retOptions: Partial<Return>, index: number): Return;
468
-
469
- /**
470
- * 插入输出参数
471
- * @internal
472
- * @param ret 已有的输出参数实例
473
- */
474
- _insertReturnAt(ret: Return, index: number): Return;
475
-
476
- _insertReturnAt(options: string | Partial<Return> | Return, index: number) {
477
- const retOptions: any = {};
478
- const relationOptions = { parentNode: this, parentKey: 'returns' };
479
- let ret: Return;
480
- if (!options) {
481
- ret = Return.from({
482
- ...retOptions,
483
- name: this.getReturnUniqueName(),
484
- }, this, 'returns');
485
- } else if (typeof options === 'string') {
486
- ret = Return.from({
487
- ...retOptions,
488
- name: options,
489
- }, this, 'returns');
490
- } else if (options instanceof Return) {
491
- options.ensureDelete(); // 同一实例不支持多处存在
492
- ret = options;
493
- Object.assign(ret, relationOptions);
494
- } else {
495
- ret = Return.from({
496
- ...retOptions,
497
- ...options,
498
- }, this, 'returns');
499
- }
500
- this.returns.splice(index, 0, ret);
501
- return ret;
502
- }
503
-
504
- /**
505
- * 插入输出参数
506
- * @param name 输出参数名称,如果不填会自动生成一个唯一名称
507
- */
508
- insertReturnAt(name: string, index: number): Return;
509
-
510
- /**
511
- * 插入输出参数
512
- * @param retOptions 输出参数参数
513
- */
514
- insertReturnAt(retOptions: Partial<Return>, index: number): Return;
515
-
516
- /**
517
- * 插入输出参数
518
- * @param ret 已有的输出参数实例
519
- */
520
- insertReturnAt(ret: Return, index: number): Return;
521
-
522
- insertReturnAt(options: string | Partial<Return> | Return, index: number) {
523
- const node = this._insertReturnAt(options as any, index);
524
- node.create({
525
- index,
526
- parentNode: this,
527
- parentKey: 'returns',
528
- });
529
- return node;
530
- }
531
-
532
- /**
533
- * 添加输出参数
534
- * @internal
535
- * @param name 输出参数名称,如果不填会自动生成一个唯一名称
536
- */
537
- _addReturn(name?: string): Return;
538
-
539
- /**
540
- * 添加输出参数
541
- * @internal
542
- * @param retOptions 输出参数参数
543
- */
544
- _addReturn(retOptions: Partial<Return>): Return;
545
-
546
- /**
547
- * 添加输出参数
548
- * @internal
549
- * @param ret 已有的输出参数实例
550
- */
551
- _addReturn(ret: Return): Return;
552
-
553
- _addReturn(options?: string | Partial<Return> | Return) {
554
- const index = this.returns.length;
555
- return this._insertReturnAt(options as any, index);
556
- }
557
-
558
- /**
559
- * 添加输出参数
560
- * @internal
561
- * @param name 输出参数名称,如果不填会自动生成一个唯一名称
562
- */
563
- addReturn(name?: string): Return;
564
-
565
- /**
566
- * 添加输出参数
567
- * @param retOptions 输出参数参数
568
- */
569
- addReturn(retOptions: Partial<Return>): Return;
570
-
571
- /**
572
- * 添加输出参数
573
- * @param ret 已有的输出参数实例
574
- */
575
- addReturn(ret: Return): Return;
576
-
577
- addReturn(options?: string | Partial<Return> | Return) {
578
- const node = this._addReturn(options as any);
579
- const index = this.returns.indexOf(node);
580
- node.create({
581
- index,
582
- parentNode: this,
583
- parentKey: 'returns',
584
- });
585
- return node;
586
- }
587
-
588
-
589
- getConstantExistingNames(excludedList: Array<Constant> = []) {
590
- const excludedSet = new Set(excludedList);
591
- return ((this.constants as Constant[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
592
- }
593
- getConstantUniqueName(name = 'constant1') {
594
- return utils.unique(name, this.getConstantExistingNames(), undefined, false);
595
- }
596
-
597
- /**
598
- * 插入常量
599
- * @internal
600
- * @param name 常量名称,如果不填会自动生成一个唯一名称
601
- */
602
- _insertConstantAt(name: string, index: number): Constant;
603
-
604
- /**
605
- * 插入常量
606
- * @internal
607
- * @param constantOptions 常量参数
608
- */
609
- _insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
610
-
611
- /**
612
- * 插入常量
613
- * @internal
614
- * @param constant 已有的常量实例
615
- */
616
- _insertConstantAt(constant: Constant, index: number): Constant;
617
-
618
- _insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
619
- const constantOptions: any = {};
620
- const relationOptions = { parentNode: this, parentKey: 'constants' };
621
- let constant: Constant;
622
- if (!options) {
623
- constant = Constant.from({
624
- ...constantOptions,
625
- name: this.getConstantUniqueName(),
626
- }, this, 'constants');
627
- } else if (typeof options === 'string') {
628
- constant = Constant.from({
629
- ...constantOptions,
630
- name: options,
631
- }, this, 'constants');
632
- } else if (options instanceof Constant) {
633
- options.ensureDelete(); // 同一实例不支持多处存在
634
- constant = options;
635
- Object.assign(constant, relationOptions);
636
- } else {
637
- constant = Constant.from({
638
- ...constantOptions,
639
- ...options,
640
- }, this, 'constants');
641
- }
642
- this.constants.splice(index, 0, constant);
643
- return constant;
644
- }
645
-
646
- /**
647
- * 插入常量
648
- * @param name 常量名称,如果不填会自动生成一个唯一名称
649
- */
650
- insertConstantAt(name: string, index: number): Constant;
651
-
652
- /**
653
- * 插入常量
654
- * @param constantOptions 常量参数
655
- */
656
- insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
657
-
658
- /**
659
- * 插入常量
660
- * @param constant 已有的常量实例
661
- */
662
- insertConstantAt(constant: Constant, index: number): Constant;
663
-
664
- insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
665
- const node = this._insertConstantAt(options as any, index);
666
- node.create({
667
- index,
668
- parentNode: this,
669
- parentKey: 'constants',
670
- });
671
- return node;
672
- }
673
-
674
- /**
675
- * 添加常量
676
- * @internal
677
- * @param name 常量名称,如果不填会自动生成一个唯一名称
678
- */
679
- _addConstant(name?: string): Constant;
680
-
681
- /**
682
- * 添加常量
683
- * @internal
684
- * @param constantOptions 常量参数
685
- */
686
- _addConstant(constantOptions: Partial<Constant>): Constant;
687
-
688
- /**
689
- * 添加常量
690
- * @internal
691
- * @param constant 已有的常量实例
692
- */
693
- _addConstant(constant: Constant): Constant;
694
-
695
- _addConstant(options?: string | Partial<Constant> | Constant) {
696
- const index = this.constants.length;
697
- return this._insertConstantAt(options as any, index);
698
- }
699
-
700
- /**
701
- * 添加常量
702
- * @internal
703
- * @param name 常量名称,如果不填会自动生成一个唯一名称
704
- */
705
- addConstant(name?: string): Constant;
706
-
707
- /**
708
- * 添加常量
709
- * @param constantOptions 常量参数
710
- */
711
- addConstant(constantOptions: Partial<Constant>): Constant;
712
-
713
- /**
714
- * 添加常量
715
- * @param constant 已有的常量实例
716
- */
717
- addConstant(constant: Constant): Constant;
718
-
719
- addConstant(options?: string | Partial<Constant> | Constant) {
720
- const node = this._addConstant(options as any);
721
- const index = this.constants.indexOf(node);
722
- node.create({
723
- index,
724
- parentNode: this,
725
- parentKey: 'constants',
726
- });
727
- return node;
728
- }
729
-
730
-
731
- getElementExistingNames(excludedList: Array<ProcessElement> = []) {
732
- const excludedSet = new Set(excludedList);
733
- return ((this.elements as ProcessElement[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
734
- }
735
- getElementUniqueName(name = 'element1') {
736
- return utils.unique(name, this.getElementExistingNames(), undefined, false);
737
- }
738
-
739
- /**
740
- * 插入流程元素
741
- * @internal
742
- * @param name 流程元素名称,如果不填会自动生成一个唯一名称
743
- */
744
- _insertElementAt(name: string, index: number): ProcessElement;
745
-
746
- /**
747
- * 插入流程元素
748
- * @internal
749
- * @param elementOptions 流程元素参数
750
- */
751
- _insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
752
-
753
- /**
754
- * 插入流程元素
755
- * @internal
756
- * @param element 已有的流程元素实例
757
- */
758
- _insertElementAt(element: ProcessElement, index: number): ProcessElement;
759
-
760
- _insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
761
- const elementOptions: any = {};
762
- const relationOptions = { parentNode: this, parentKey: 'elements' };
763
- let element: ProcessElement;
764
- if (!options) {
765
- element = ProcessElement.from({
766
- ...elementOptions,
767
- name: this.getElementUniqueName(),
768
- }, this, 'elements');
769
- } else if (typeof options === 'string') {
770
- element = ProcessElement.from({
771
- ...elementOptions,
772
- name: options,
773
- }, this, 'elements');
774
- } else if (options instanceof ProcessElement) {
775
- options.ensureDelete(); // 同一实例不支持多处存在
776
- element = options;
777
- Object.assign(element, relationOptions);
778
- } else {
779
- element = ProcessElement.from({
780
- ...elementOptions,
781
- ...options,
782
- }, this, 'elements');
783
- }
784
- this.elements.splice(index, 0, element);
785
- return element;
786
- }
787
-
788
- /**
789
- * 插入流程元素
790
- * @param name 流程元素名称,如果不填会自动生成一个唯一名称
791
- */
792
- insertElementAt(name: string, index: number): ProcessElement;
793
-
794
- /**
795
- * 插入流程元素
796
- * @param elementOptions 流程元素参数
797
- */
798
- insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
799
-
800
- /**
801
- * 插入流程元素
802
- * @param element 已有的流程元素实例
803
- */
804
- insertElementAt(element: ProcessElement, index: number): ProcessElement;
805
-
806
- insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
807
- const node = this._insertElementAt(options as any, index);
808
- node.create({
809
- index,
810
- parentNode: this,
811
- parentKey: 'elements',
812
- });
813
- return node;
814
- }
815
-
816
- /**
817
- * 添加流程元素
818
- * @internal
819
- * @param name 流程元素名称,如果不填会自动生成一个唯一名称
820
- */
821
- _addElement(name?: string): ProcessElement;
822
-
823
- /**
824
- * 添加流程元素
825
- * @internal
826
- * @param elementOptions 流程元素参数
827
- */
828
- _addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
829
-
830
- /**
831
- * 添加流程元素
832
- * @internal
833
- * @param element 已有的流程元素实例
834
- */
835
- _addElement(element: ProcessElement): ProcessElement;
836
-
837
- _addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
838
- const index = this.elements.length;
839
- return this._insertElementAt(options as any, index);
840
- }
841
-
842
- /**
843
- * 添加流程元素
844
- * @internal
845
- * @param name 流程元素名称,如果不填会自动生成一个唯一名称
846
- */
847
- addElement(name?: string): ProcessElement;
848
-
849
- /**
850
- * 添加流程元素
851
- * @param elementOptions 流程元素参数
852
- */
853
- addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
854
-
855
- /**
856
- * 添加流程元素
857
- * @param element 已有的流程元素实例
858
- */
859
- addElement(element: ProcessElement): ProcessElement;
860
-
861
- addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
862
- const node = this._addElement(options as any);
863
- const index = this.elements.indexOf(node);
864
- node.create({
865
- index,
866
- parentNode: this,
867
- parentKey: 'elements',
868
- });
869
- return node;
127
+ return params;
128
+ }
129
+
130
+ /**
131
+ * 设置流程名称
132
+ */
133
+ setName(name: string) {
134
+ const object = {
135
+ name,
136
+ };
137
+ this.update({
138
+ ...object,
139
+ field: 'name',
140
+ });
141
+ }
142
+
143
+ /**
144
+ * 设置流程标题
145
+ */
146
+ setTitle(title: string) {
147
+ const object = {
148
+ title,
149
+ };
150
+ this.update({
151
+ ...object,
152
+ });
153
+ }
154
+
155
+ /**
156
+ * 设置流程描述
157
+ */
158
+ setDescription(description: string) {
159
+ const object = {
160
+ description,
161
+ };
162
+ this.update({
163
+ ...object,
164
+ });
165
+ }
166
+
167
+ getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
168
+ const excludedSet = new Set(excludedList);
169
+ return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
170
+ }
171
+
172
+ getBindEventUniqueName(name = 'bindEvent1') {
173
+ return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
174
+ }
175
+
176
+ /**
177
+ * 插入元素绑定事件
178
+ * @internal
179
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
180
+ */
181
+ _insertBindEventAt(name: string, index: number): BindEvent;
182
+
183
+ /**
184
+ * 插入元素绑定事件
185
+ * @internal
186
+ * @param bindEventOptions 元素绑定事件参数
187
+ */
188
+ _insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
189
+
190
+ /**
191
+ * 插入元素绑定事件
192
+ * @internal
193
+ * @param bindEvent 已有的元素绑定事件实例
194
+ */
195
+ _insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
196
+
197
+ _insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
198
+ const bindEventOptions: any = {};
199
+ const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
200
+ let bindEvent: BindEvent;
201
+ if (!options) {
202
+ bindEvent = BindEvent.from(
203
+ {
204
+ ...bindEventOptions,
205
+ name: this.getBindEventUniqueName(),
206
+ },
207
+ this,
208
+ 'bindEvents'
209
+ );
210
+ } else if (typeof options === 'string') {
211
+ bindEvent = BindEvent.from(
212
+ {
213
+ ...bindEventOptions,
214
+ name: options,
215
+ },
216
+ this,
217
+ 'bindEvents'
218
+ );
219
+ } else if (options instanceof BindEvent) {
220
+ options.ensureDelete(); // 同一实例不支持多处存在
221
+ bindEvent = options;
222
+ Object.assign(bindEvent, relationOptions);
223
+ } else {
224
+ bindEvent = BindEvent.from(
225
+ {
226
+ ...bindEventOptions,
227
+ ...options,
228
+ },
229
+ this,
230
+ 'bindEvents'
231
+ );
870
232
  }
871
-
872
-
873
-
874
-
875
- /**
876
- * 删除元素绑定事件
877
- * @param name 元素绑定事件名称
878
- */
879
- removeBindEvent(name: string): void;
880
-
881
- /**
882
- * 删除元素绑定事件
883
- * @param bindEvent 已有的元素绑定事件实例
884
- */
885
- removeBindEvent(bindEvent: BindEvent): void;
886
-
887
- removeBindEvent(options: string | BindEvent) {
888
- let bindEvent: BindEvent;
889
- if (typeof options === 'string') {
890
- bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
891
- if (!bindEvent) {
892
- throw new Error('找不到元素绑定事件 ' + options);
893
- }
894
- } else {
895
- bindEvent = options;
896
- }
897
- return bindEvent.delete();
233
+ this.bindEvents.splice(index, 0, bindEvent);
234
+ return bindEvent;
235
+ }
236
+
237
+ /**
238
+ * 插入元素绑定事件
239
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
240
+ */
241
+ insertBindEventAt(name: string, index: number): BindEvent;
242
+
243
+ /**
244
+ * 插入元素绑定事件
245
+ * @param bindEventOptions 元素绑定事件参数
246
+ */
247
+ insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
248
+
249
+ /**
250
+ * 插入元素绑定事件
251
+ * @param bindEvent 已有的元素绑定事件实例
252
+ */
253
+ insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
254
+
255
+ insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
256
+ const node = this._insertBindEventAt(options as any, index);
257
+ node.create({
258
+ index,
259
+ parentNode: this,
260
+ parentKey: 'bindEvents',
261
+ });
262
+ return node;
263
+ }
264
+
265
+ /**
266
+ * 添加元素绑定事件
267
+ * @internal
268
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
269
+ */
270
+ _addBindEvent(name?: string): BindEvent;
271
+
272
+ /**
273
+ * 添加元素绑定事件
274
+ * @internal
275
+ * @param bindEventOptions 元素绑定事件参数
276
+ */
277
+ _addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
278
+
279
+ /**
280
+ * 添加元素绑定事件
281
+ * @internal
282
+ * @param bindEvent 已有的元素绑定事件实例
283
+ */
284
+ _addBindEvent(bindEvent: BindEvent): BindEvent;
285
+
286
+ _addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
287
+ const index = this.bindEvents.length;
288
+ return this._insertBindEventAt(options as any, index);
289
+ }
290
+
291
+ /**
292
+ * 添加元素绑定事件
293
+ * @internal
294
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
295
+ */
296
+ addBindEvent(name?: string): BindEvent;
297
+
298
+ /**
299
+ * 添加元素绑定事件
300
+ * @param bindEventOptions 元素绑定事件参数
301
+ */
302
+ addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
303
+
304
+ /**
305
+ * 添加元素绑定事件
306
+ * @param bindEvent 已有的元素绑定事件实例
307
+ */
308
+ addBindEvent(bindEvent: BindEvent): BindEvent;
309
+
310
+ addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
311
+ const node = this._addBindEvent(options as any);
312
+ const index = this.bindEvents.indexOf(node);
313
+ node.create({
314
+ index,
315
+ parentNode: this,
316
+ parentKey: 'bindEvents',
317
+ });
318
+ return node;
319
+ }
320
+
321
+ getParamExistingNames(excludedList: Array<Param> = []) {
322
+ const excludedSet = new Set(excludedList);
323
+ return ((this.params as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
324
+ }
325
+
326
+ getParamUniqueName(name = 'param1') {
327
+ return utils.unique(name, this.getParamExistingNames(), undefined, false);
328
+ }
329
+
330
+ /**
331
+ * 插入输入参数
332
+ * @internal
333
+ * @param name 输入参数名称,如果不填会自动生成一个唯一名称
334
+ */
335
+ _insertParamAt(name: string, index: number): Param;
336
+
337
+ /**
338
+ * 插入输入参数
339
+ * @internal
340
+ * @param paramOptions 输入参数参数
341
+ */
342
+ _insertParamAt(paramOptions: Partial<Param>, index: number): Param;
343
+
344
+ /**
345
+ * 插入输入参数
346
+ * @internal
347
+ * @param param 已有的输入参数实例
348
+ */
349
+ _insertParamAt(param: Param, index: number): Param;
350
+
351
+ _insertParamAt(options: string | Partial<Param> | Param, index: number) {
352
+ const paramOptions: any = {};
353
+ const relationOptions = { parentNode: this, parentKey: 'params' };
354
+ let param: Param;
355
+ if (!options) {
356
+ param = Param.from(
357
+ {
358
+ ...paramOptions,
359
+ name: this.getParamUniqueName(),
360
+ },
361
+ this,
362
+ 'params'
363
+ );
364
+ } else if (typeof options === 'string') {
365
+ param = Param.from(
366
+ {
367
+ ...paramOptions,
368
+ name: options,
369
+ },
370
+ this,
371
+ 'params'
372
+ );
373
+ } else if (options instanceof Param) {
374
+ options.ensureDelete(); // 同一实例不支持多处存在
375
+ param = options;
376
+ Object.assign(param, relationOptions);
377
+ } else {
378
+ param = Param.from(
379
+ {
380
+ ...paramOptions,
381
+ ...options,
382
+ },
383
+ this,
384
+ 'params'
385
+ );
898
386
  }
899
-
900
- __removeBindEvent(bindEvent: BindEvent) {
901
- const parentKey = bindEvent.parentKey;
902
- const params: Params = {
903
- parentNode: this,
904
- parentKey,
905
- index: -1,
906
- object: null,
907
- oldObject: bindEvent,
908
- };
909
- if (parentKey) {
910
- params.parentKey = parentKey;
911
- if (Array.isArray((this as any)[parentKey])) {
912
- const index = (this as any)[parentKey].indexOf(bindEvent);
913
- ~index && (this as any)[parentKey].splice(index, 1);
914
- params.index = index;
915
- } else if ((this as any)[parentKey] === bindEvent) {
916
- params.index = 0;
917
- (this as any)[parentKey] = undefined;
918
- }
919
- }
920
- return params;
387
+ this.params.splice(index, 0, param);
388
+ return param;
389
+ }
390
+
391
+ /**
392
+ * 插入输入参数
393
+ * @param name 输入参数名称,如果不填会自动生成一个唯一名称
394
+ */
395
+ insertParamAt(name: string, index: number): Param;
396
+
397
+ /**
398
+ * 插入输入参数
399
+ * @param paramOptions 输入参数参数
400
+ */
401
+ insertParamAt(paramOptions: Partial<Param>, index: number): Param;
402
+
403
+ /**
404
+ * 插入输入参数
405
+ * @param param 已有的输入参数实例
406
+ */
407
+ insertParamAt(param: Param, index: number): Param;
408
+
409
+ insertParamAt(options: string | Partial<Param> | Param, index: number) {
410
+ const node = this._insertParamAt(options as any, index);
411
+ node.create({
412
+ index,
413
+ parentNode: this,
414
+ parentKey: 'params',
415
+ });
416
+ return node;
417
+ }
418
+
419
+ /**
420
+ * 添加输入参数
421
+ * @internal
422
+ * @param name 输入参数名称,如果不填会自动生成一个唯一名称
423
+ */
424
+ _addParam(name?: string): Param;
425
+
426
+ /**
427
+ * 添加输入参数
428
+ * @internal
429
+ * @param paramOptions 输入参数参数
430
+ */
431
+ _addParam(paramOptions: Partial<Param>): Param;
432
+
433
+ /**
434
+ * 添加输入参数
435
+ * @internal
436
+ * @param param 已有的输入参数实例
437
+ */
438
+ _addParam(param: Param): Param;
439
+
440
+ _addParam(options?: string | Partial<Param> | Param) {
441
+ const index = this.params.length;
442
+ return this._insertParamAt(options as any, index);
443
+ }
444
+
445
+ /**
446
+ * 添加输入参数
447
+ * @internal
448
+ * @param name 输入参数名称,如果不填会自动生成一个唯一名称
449
+ */
450
+ addParam(name?: string): Param;
451
+
452
+ /**
453
+ * 添加输入参数
454
+ * @param paramOptions 输入参数参数
455
+ */
456
+ addParam(paramOptions: Partial<Param>): Param;
457
+
458
+ /**
459
+ * 添加输入参数
460
+ * @param param 已有的输入参数实例
461
+ */
462
+ addParam(param: Param): Param;
463
+
464
+ addParam(options?: string | Partial<Param> | Param) {
465
+ const node = this._addParam(options as any);
466
+ const index = this.params.indexOf(node);
467
+ node.create({
468
+ index,
469
+ parentNode: this,
470
+ parentKey: 'params',
471
+ });
472
+ return node;
473
+ }
474
+
475
+ getReturnExistingNames(excludedList: Array<Return> = []) {
476
+ const excludedSet = new Set(excludedList);
477
+ return ((this.returns as Return[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
478
+ }
479
+
480
+ getReturnUniqueName(name = 'ret1') {
481
+ return utils.unique(name, this.getReturnExistingNames(), undefined, false);
482
+ }
483
+
484
+ /**
485
+ * 插入输出参数
486
+ * @internal
487
+ * @param name 输出参数名称,如果不填会自动生成一个唯一名称
488
+ */
489
+ _insertReturnAt(name: string, index: number): Return;
490
+
491
+ /**
492
+ * 插入输出参数
493
+ * @internal
494
+ * @param retOptions 输出参数参数
495
+ */
496
+ _insertReturnAt(retOptions: Partial<Return>, index: number): Return;
497
+
498
+ /**
499
+ * 插入输出参数
500
+ * @internal
501
+ * @param ret 已有的输出参数实例
502
+ */
503
+ _insertReturnAt(ret: Return, index: number): Return;
504
+
505
+ _insertReturnAt(options: string | Partial<Return> | Return, index: number) {
506
+ const retOptions: any = {};
507
+ const relationOptions = { parentNode: this, parentKey: 'returns' };
508
+ let ret: Return;
509
+ if (!options) {
510
+ ret = Return.from(
511
+ {
512
+ ...retOptions,
513
+ name: this.getReturnUniqueName(),
514
+ },
515
+ this,
516
+ 'returns'
517
+ );
518
+ } else if (typeof options === 'string') {
519
+ ret = Return.from(
520
+ {
521
+ ...retOptions,
522
+ name: options,
523
+ },
524
+ this,
525
+ 'returns'
526
+ );
527
+ } else if (options instanceof Return) {
528
+ options.ensureDelete(); // 同一实例不支持多处存在
529
+ ret = options;
530
+ Object.assign(ret, relationOptions);
531
+ } else {
532
+ ret = Return.from(
533
+ {
534
+ ...retOptions,
535
+ ...options,
536
+ },
537
+ this,
538
+ 'returns'
539
+ );
921
540
  }
922
-
923
-
924
-
925
- /**
926
- * 删除输入参数
927
- * @param name 输入参数名称
928
- */
929
- removeParam(name: string): void;
930
-
931
- /**
932
- * 删除输入参数
933
- * @param param 已有的输入参数实例
934
- */
935
- removeParam(param: Param): void;
936
-
937
- removeParam(options: string | Param) {
938
- let param: Param;
939
- if (typeof options === 'string') {
940
- param = (this.params as Param[]).find((item) => item.name === options);
941
- if (!param) {
942
- throw new Error('找不到输入参数 ' + options);
943
- }
944
- } else {
945
- param = options;
946
- }
947
- return param.delete();
541
+ this.returns.splice(index, 0, ret);
542
+ return ret;
543
+ }
544
+
545
+ /**
546
+ * 插入输出参数
547
+ * @param name 输出参数名称,如果不填会自动生成一个唯一名称
548
+ */
549
+ insertReturnAt(name: string, index: number): Return;
550
+
551
+ /**
552
+ * 插入输出参数
553
+ * @param retOptions 输出参数参数
554
+ */
555
+ insertReturnAt(retOptions: Partial<Return>, index: number): Return;
556
+
557
+ /**
558
+ * 插入输出参数
559
+ * @param ret 已有的输出参数实例
560
+ */
561
+ insertReturnAt(ret: Return, index: number): Return;
562
+
563
+ insertReturnAt(options: string | Partial<Return> | Return, index: number) {
564
+ const node = this._insertReturnAt(options as any, index);
565
+ node.create({
566
+ index,
567
+ parentNode: this,
568
+ parentKey: 'returns',
569
+ });
570
+ return node;
571
+ }
572
+
573
+ /**
574
+ * 添加输出参数
575
+ * @internal
576
+ * @param name 输出参数名称,如果不填会自动生成一个唯一名称
577
+ */
578
+ _addReturn(name?: string): Return;
579
+
580
+ /**
581
+ * 添加输出参数
582
+ * @internal
583
+ * @param retOptions 输出参数参数
584
+ */
585
+ _addReturn(retOptions: Partial<Return>): Return;
586
+
587
+ /**
588
+ * 添加输出参数
589
+ * @internal
590
+ * @param ret 已有的输出参数实例
591
+ */
592
+ _addReturn(ret: Return): Return;
593
+
594
+ _addReturn(options?: string | Partial<Return> | Return) {
595
+ const index = this.returns.length;
596
+ return this._insertReturnAt(options as any, index);
597
+ }
598
+
599
+ /**
600
+ * 添加输出参数
601
+ * @internal
602
+ * @param name 输出参数名称,如果不填会自动生成一个唯一名称
603
+ */
604
+ addReturn(name?: string): Return;
605
+
606
+ /**
607
+ * 添加输出参数
608
+ * @param retOptions 输出参数参数
609
+ */
610
+ addReturn(retOptions: Partial<Return>): Return;
611
+
612
+ /**
613
+ * 添加输出参数
614
+ * @param ret 已有的输出参数实例
615
+ */
616
+ addReturn(ret: Return): Return;
617
+
618
+ addReturn(options?: string | Partial<Return> | Return) {
619
+ const node = this._addReturn(options as any);
620
+ const index = this.returns.indexOf(node);
621
+ node.create({
622
+ index,
623
+ parentNode: this,
624
+ parentKey: 'returns',
625
+ });
626
+ return node;
627
+ }
628
+
629
+ getConstantExistingNames(excludedList: Array<Constant> = []) {
630
+ const excludedSet = new Set(excludedList);
631
+ return ((this.constants as Constant[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
632
+ }
633
+
634
+ getConstantUniqueName(name = 'constant1') {
635
+ return utils.unique(name, this.getConstantExistingNames(), undefined, false);
636
+ }
637
+
638
+ /**
639
+ * 插入常量
640
+ * @internal
641
+ * @param name 常量名称,如果不填会自动生成一个唯一名称
642
+ */
643
+ _insertConstantAt(name: string, index: number): Constant;
644
+
645
+ /**
646
+ * 插入常量
647
+ * @internal
648
+ * @param constantOptions 常量参数
649
+ */
650
+ _insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
651
+
652
+ /**
653
+ * 插入常量
654
+ * @internal
655
+ * @param constant 已有的常量实例
656
+ */
657
+ _insertConstantAt(constant: Constant, index: number): Constant;
658
+
659
+ _insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
660
+ const constantOptions: any = {};
661
+ const relationOptions = { parentNode: this, parentKey: 'constants' };
662
+ let constant: Constant;
663
+ if (!options) {
664
+ constant = Constant.from(
665
+ {
666
+ ...constantOptions,
667
+ name: this.getConstantUniqueName(),
668
+ },
669
+ this,
670
+ 'constants'
671
+ );
672
+ } else if (typeof options === 'string') {
673
+ constant = Constant.from(
674
+ {
675
+ ...constantOptions,
676
+ name: options,
677
+ },
678
+ this,
679
+ 'constants'
680
+ );
681
+ } else if (options instanceof Constant) {
682
+ options.ensureDelete(); // 同一实例不支持多处存在
683
+ constant = options;
684
+ Object.assign(constant, relationOptions);
685
+ } else {
686
+ constant = Constant.from(
687
+ {
688
+ ...constantOptions,
689
+ ...options,
690
+ },
691
+ this,
692
+ 'constants'
693
+ );
948
694
  }
949
-
950
- __removeParam(param: Param) {
951
- const parentKey = param.parentKey;
952
- const params: Params = {
953
- parentNode: this,
954
- parentKey,
955
- index: -1,
956
- object: null,
957
- oldObject: param,
958
- };
959
- if (parentKey) {
960
- params.parentKey = parentKey;
961
- if (Array.isArray((this as any)[parentKey])) {
962
- const index = (this as any)[parentKey].indexOf(param);
963
- ~index && (this as any)[parentKey].splice(index, 1);
964
- params.index = index;
965
- } else if ((this as any)[parentKey] === param) {
966
- params.index = 0;
967
- (this as any)[parentKey] = undefined;
968
- }
969
- }
970
- return params;
695
+ this.constants.splice(index, 0, constant);
696
+ return constant;
697
+ }
698
+
699
+ /**
700
+ * 插入常量
701
+ * @param name 常量名称,如果不填会自动生成一个唯一名称
702
+ */
703
+ insertConstantAt(name: string, index: number): Constant;
704
+
705
+ /**
706
+ * 插入常量
707
+ * @param constantOptions 常量参数
708
+ */
709
+ insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
710
+
711
+ /**
712
+ * 插入常量
713
+ * @param constant 已有的常量实例
714
+ */
715
+ insertConstantAt(constant: Constant, index: number): Constant;
716
+
717
+ insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
718
+ const node = this._insertConstantAt(options as any, index);
719
+ node.create({
720
+ index,
721
+ parentNode: this,
722
+ parentKey: 'constants',
723
+ });
724
+ return node;
725
+ }
726
+
727
+ /**
728
+ * 添加常量
729
+ * @internal
730
+ * @param name 常量名称,如果不填会自动生成一个唯一名称
731
+ */
732
+ _addConstant(name?: string): Constant;
733
+
734
+ /**
735
+ * 添加常量
736
+ * @internal
737
+ * @param constantOptions 常量参数
738
+ */
739
+ _addConstant(constantOptions: Partial<Constant>): Constant;
740
+
741
+ /**
742
+ * 添加常量
743
+ * @internal
744
+ * @param constant 已有的常量实例
745
+ */
746
+ _addConstant(constant: Constant): Constant;
747
+
748
+ _addConstant(options?: string | Partial<Constant> | Constant) {
749
+ const index = this.constants.length;
750
+ return this._insertConstantAt(options as any, index);
751
+ }
752
+
753
+ /**
754
+ * 添加常量
755
+ * @internal
756
+ * @param name 常量名称,如果不填会自动生成一个唯一名称
757
+ */
758
+ addConstant(name?: string): Constant;
759
+
760
+ /**
761
+ * 添加常量
762
+ * @param constantOptions 常量参数
763
+ */
764
+ addConstant(constantOptions: Partial<Constant>): Constant;
765
+
766
+ /**
767
+ * 添加常量
768
+ * @param constant 已有的常量实例
769
+ */
770
+ addConstant(constant: Constant): Constant;
771
+
772
+ addConstant(options?: string | Partial<Constant> | Constant) {
773
+ const node = this._addConstant(options as any);
774
+ const index = this.constants.indexOf(node);
775
+ node.create({
776
+ index,
777
+ parentNode: this,
778
+ parentKey: 'constants',
779
+ });
780
+ return node;
781
+ }
782
+
783
+ getElementExistingNames(excludedList: Array<ProcessElement> = []) {
784
+ const excludedSet = new Set(excludedList);
785
+ return ((this.elements as ProcessElement[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
786
+ }
787
+
788
+ getElementUniqueName(name = 'element1') {
789
+ return utils.unique(name, this.getElementExistingNames(), undefined, false);
790
+ }
791
+
792
+ /**
793
+ * 插入流程元素
794
+ * @internal
795
+ * @param name 流程元素名称,如果不填会自动生成一个唯一名称
796
+ */
797
+ _insertElementAt(name: string, index: number): ProcessElement;
798
+
799
+ /**
800
+ * 插入流程元素
801
+ * @internal
802
+ * @param elementOptions 流程元素参数
803
+ */
804
+ _insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
805
+
806
+ /**
807
+ * 插入流程元素
808
+ * @internal
809
+ * @param element 已有的流程元素实例
810
+ */
811
+ _insertElementAt(element: ProcessElement, index: number): ProcessElement;
812
+
813
+ _insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
814
+ const elementOptions: any = {};
815
+ const relationOptions = { parentNode: this, parentKey: 'elements' };
816
+ let element: ProcessElement;
817
+ if (!options) {
818
+ element = ProcessElement.from(
819
+ {
820
+ ...elementOptions,
821
+ name: this.getElementUniqueName(),
822
+ },
823
+ this,
824
+ 'elements'
825
+ );
826
+ } else if (typeof options === 'string') {
827
+ element = ProcessElement.from(
828
+ {
829
+ ...elementOptions,
830
+ name: options,
831
+ },
832
+ this,
833
+ 'elements'
834
+ );
835
+ } else if (options instanceof ProcessElement) {
836
+ options.ensureDelete(); // 同一实例不支持多处存在
837
+ element = options;
838
+ Object.assign(element, relationOptions);
839
+ } else {
840
+ element = ProcessElement.from(
841
+ {
842
+ ...elementOptions,
843
+ ...options,
844
+ },
845
+ this,
846
+ 'elements'
847
+ );
971
848
  }
972
-
973
-
974
-
975
- /**
976
- * 删除输出参数
977
- * @param name 输出参数名称
978
- */
979
- removeReturn(name: string): void;
980
-
981
- /**
982
- * 删除输出参数
983
- * @param ret 已有的输出参数实例
984
- */
985
- removeReturn(ret: Return): void;
986
-
987
- removeReturn(options: string | Return) {
988
- let ret: Return;
989
- if (typeof options === 'string') {
990
- ret = (this.returns as Return[]).find((item) => item.name === options);
991
- if (!ret) {
992
- throw new Error('找不到输出参数 ' + options);
993
- }
994
- } else {
995
- ret = options;
996
- }
997
- return ret.delete();
849
+ this.elements.splice(index, 0, element);
850
+ return element;
851
+ }
852
+
853
+ /**
854
+ * 插入流程元素
855
+ * @param name 流程元素名称,如果不填会自动生成一个唯一名称
856
+ */
857
+ insertElementAt(name: string, index: number): ProcessElement;
858
+
859
+ /**
860
+ * 插入流程元素
861
+ * @param elementOptions 流程元素参数
862
+ */
863
+ insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
864
+
865
+ /**
866
+ * 插入流程元素
867
+ * @param element 已有的流程元素实例
868
+ */
869
+ insertElementAt(element: ProcessElement, index: number): ProcessElement;
870
+
871
+ insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
872
+ const node = this._insertElementAt(options as any, index);
873
+ node.create({
874
+ index,
875
+ parentNode: this,
876
+ parentKey: 'elements',
877
+ });
878
+ return node;
879
+ }
880
+
881
+ /**
882
+ * 添加流程元素
883
+ * @internal
884
+ * @param name 流程元素名称,如果不填会自动生成一个唯一名称
885
+ */
886
+ _addElement(name?: string): ProcessElement;
887
+
888
+ /**
889
+ * 添加流程元素
890
+ * @internal
891
+ * @param elementOptions 流程元素参数
892
+ */
893
+ _addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
894
+
895
+ /**
896
+ * 添加流程元素
897
+ * @internal
898
+ * @param element 已有的流程元素实例
899
+ */
900
+ _addElement(element: ProcessElement): ProcessElement;
901
+
902
+ _addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
903
+ const index = this.elements.length;
904
+ return this._insertElementAt(options as any, index);
905
+ }
906
+
907
+ /**
908
+ * 添加流程元素
909
+ * @internal
910
+ * @param name 流程元素名称,如果不填会自动生成一个唯一名称
911
+ */
912
+ addElement(name?: string): ProcessElement;
913
+
914
+ /**
915
+ * 添加流程元素
916
+ * @param elementOptions 流程元素参数
917
+ */
918
+ addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
919
+
920
+ /**
921
+ * 添加流程元素
922
+ * @param element 已有的流程元素实例
923
+ */
924
+ addElement(element: ProcessElement): ProcessElement;
925
+
926
+ addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
927
+ const node = this._addElement(options as any);
928
+ const index = this.elements.indexOf(node);
929
+ node.create({
930
+ index,
931
+ parentNode: this,
932
+ parentKey: 'elements',
933
+ });
934
+ return node;
935
+ }
936
+
937
+ /**
938
+ * 删除元素绑定事件
939
+ * @param name 元素绑定事件名称
940
+ */
941
+ removeBindEvent(name: string): void;
942
+
943
+ /**
944
+ * 删除元素绑定事件
945
+ * @param bindEvent 已有的元素绑定事件实例
946
+ */
947
+ removeBindEvent(bindEvent: BindEvent): void;
948
+
949
+ removeBindEvent(options: string | BindEvent) {
950
+ let bindEvent: BindEvent;
951
+ if (typeof options === 'string') {
952
+ bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
953
+ if (!bindEvent) {
954
+ throw new Error(`找不到元素绑定事件 ${options}`);
955
+ }
956
+ } else {
957
+ bindEvent = options;
998
958
  }
999
-
1000
- __removeReturn(ret: Return) {
1001
- const parentKey = ret.parentKey;
1002
- const params: Params = {
1003
- parentNode: this,
1004
- parentKey,
1005
- index: -1,
1006
- object: null,
1007
- oldObject: ret,
1008
- };
1009
- if (parentKey) {
1010
- params.parentKey = parentKey;
1011
- if (Array.isArray((this as any)[parentKey])) {
1012
- const index = (this as any)[parentKey].indexOf(ret);
1013
- ~index && (this as any)[parentKey].splice(index, 1);
1014
- params.index = index;
1015
- } else if ((this as any)[parentKey] === ret) {
1016
- params.index = 0;
1017
- (this as any)[parentKey] = undefined;
1018
- }
1019
- }
1020
- return params;
959
+ return bindEvent.delete();
960
+ }
961
+
962
+ __removeBindEvent(bindEvent: BindEvent) {
963
+ const { parentKey } = bindEvent;
964
+ const params: Params = {
965
+ parentNode: this,
966
+ parentKey,
967
+ index: -1,
968
+ object: null,
969
+ oldObject: bindEvent,
970
+ };
971
+ if (parentKey) {
972
+ params.parentKey = parentKey;
973
+ if (Array.isArray((this as any)[parentKey])) {
974
+ const index = (this as any)[parentKey].indexOf(bindEvent);
975
+ ~index && (this as any)[parentKey].splice(index, 1);
976
+ params.index = index;
977
+ } else if ((this as any)[parentKey] === bindEvent) {
978
+ params.index = 0;
979
+ (this as any)[parentKey] = undefined;
980
+ }
1021
981
  }
1022
-
1023
-
1024
-
1025
- /**
1026
- * 删除常量
1027
- * @param name 常量名称
1028
- */
1029
- removeConstant(name: string): void;
1030
-
1031
- /**
1032
- * 删除常量
1033
- * @param constant 已有的常量实例
1034
- */
1035
- removeConstant(constant: Constant): void;
1036
-
1037
- removeConstant(options: string | Constant) {
1038
- let constant: Constant;
1039
- if (typeof options === 'string') {
1040
- constant = (this.constants as Constant[]).find((item) => item.name === options);
1041
- if (!constant) {
1042
- throw new Error('找不到常量 ' + options);
1043
- }
1044
- } else {
1045
- constant = options;
1046
- }
1047
- return constant.delete();
982
+ return params;
983
+ }
984
+
985
+ /**
986
+ * 删除输入参数
987
+ * @param name 输入参数名称
988
+ */
989
+ removeParam(name: string): void;
990
+
991
+ /**
992
+ * 删除输入参数
993
+ * @param param 已有的输入参数实例
994
+ */
995
+ removeParam(param: Param): void;
996
+
997
+ removeParam(options: string | Param) {
998
+ let param: Param;
999
+ if (typeof options === 'string') {
1000
+ param = (this.params as Param[]).find((item) => item.name === options);
1001
+ if (!param) {
1002
+ throw new Error(`找不到输入参数 ${options}`);
1003
+ }
1004
+ } else {
1005
+ param = options;
1048
1006
  }
1049
-
1050
- __removeConstant(constant: Constant) {
1051
- const parentKey = constant.parentKey;
1052
- const params: Params = {
1053
- parentNode: this,
1054
- parentKey,
1055
- index: -1,
1056
- object: null,
1057
- oldObject: constant,
1058
- };
1059
- if (parentKey) {
1060
- params.parentKey = parentKey;
1061
- if (Array.isArray((this as any)[parentKey])) {
1062
- const index = (this as any)[parentKey].indexOf(constant);
1063
- ~index && (this as any)[parentKey].splice(index, 1);
1064
- params.index = index;
1065
- } else if ((this as any)[parentKey] === constant) {
1066
- params.index = 0;
1067
- (this as any)[parentKey] = undefined;
1068
- }
1069
- }
1070
- return params;
1007
+ return param.delete();
1008
+ }
1009
+
1010
+ __removeParam(param: Param) {
1011
+ const { parentKey } = param;
1012
+ const params: Params = {
1013
+ parentNode: this,
1014
+ parentKey,
1015
+ index: -1,
1016
+ object: null,
1017
+ oldObject: param,
1018
+ };
1019
+ if (parentKey) {
1020
+ params.parentKey = parentKey;
1021
+ if (Array.isArray((this as any)[parentKey])) {
1022
+ const index = (this as any)[parentKey].indexOf(param);
1023
+ ~index && (this as any)[parentKey].splice(index, 1);
1024
+ params.index = index;
1025
+ } else if ((this as any)[parentKey] === param) {
1026
+ params.index = 0;
1027
+ (this as any)[parentKey] = undefined;
1028
+ }
1071
1029
  }
1072
-
1073
-
1074
-
1075
- /**
1076
- * 删除流程元素
1077
- * @param name 流程元素名称
1078
- */
1079
- removeElement(name: string): void;
1080
-
1081
- /**
1082
- * 删除流程元素
1083
- * @param element 已有的流程元素实例
1084
- */
1085
- removeElement(element: ProcessElement): void;
1086
-
1087
- removeElement(options: string | ProcessElement) {
1088
- let element: ProcessElement;
1089
- if (typeof options === 'string') {
1090
- element = (this.elements as ProcessElement[]).find((item) => item.name === options);
1091
- if (!element) {
1092
- throw new Error('找不到流程元素 ' + options);
1093
- }
1094
- } else {
1095
- element = options;
1096
- }
1097
- return element.delete();
1030
+ return params;
1031
+ }
1032
+
1033
+ /**
1034
+ * 删除输出参数
1035
+ * @param name 输出参数名称
1036
+ */
1037
+ removeReturn(name: string): void;
1038
+
1039
+ /**
1040
+ * 删除输出参数
1041
+ * @param ret 已有的输出参数实例
1042
+ */
1043
+ removeReturn(ret: Return): void;
1044
+
1045
+ removeReturn(options: string | Return) {
1046
+ let ret: Return;
1047
+ if (typeof options === 'string') {
1048
+ ret = (this.returns as Return[]).find((item) => item.name === options);
1049
+ if (!ret) {
1050
+ throw new Error(`找不到输出参数 ${options}`);
1051
+ }
1052
+ } else {
1053
+ ret = options;
1098
1054
  }
1099
-
1100
- __removeProcessElement(element: ProcessElement) {
1101
- const parentKey = element.parentKey;
1102
- const params: Params = {
1103
- parentNode: this,
1104
- parentKey,
1105
- index: -1,
1106
- object: null,
1107
- oldObject: element,
1108
- };
1109
- if (parentKey) {
1110
- params.parentKey = parentKey;
1111
- if (Array.isArray((this as any)[parentKey])) {
1112
- const index = (this as any)[parentKey].indexOf(element);
1113
- ~index && (this as any)[parentKey].splice(index, 1);
1114
- params.index = index;
1115
- } else if ((this as any)[parentKey] === element) {
1116
- params.index = 0;
1117
- (this as any)[parentKey] = undefined;
1118
- }
1119
- }
1120
- return params;
1055
+ return ret.delete();
1056
+ }
1057
+
1058
+ __removeReturn(ret: Return) {
1059
+ const { parentKey } = ret;
1060
+ const params: Params = {
1061
+ parentNode: this,
1062
+ parentKey,
1063
+ index: -1,
1064
+ object: null,
1065
+ oldObject: ret,
1066
+ };
1067
+ if (parentKey) {
1068
+ params.parentKey = parentKey;
1069
+ if (Array.isArray((this as any)[parentKey])) {
1070
+ const index = (this as any)[parentKey].indexOf(ret);
1071
+ ~index && (this as any)[parentKey].splice(index, 1);
1072
+ params.index = index;
1073
+ } else if ((this as any)[parentKey] === ret) {
1074
+ params.index = 0;
1075
+ (this as any)[parentKey] = undefined;
1076
+ }
1121
1077
  }
1122
-
1123
- //================================================================================
1124
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1125
- // 自动生成的代码已结束。下面可以手动编写。
1126
- //================================================================================
1127
- onChange($event?: EventPayload): void {
1128
- this.emit('change', $event);
1078
+ return params;
1079
+ }
1080
+
1081
+ /**
1082
+ * 删除常量
1083
+ * @param name 常量名称
1084
+ */
1085
+ removeConstant(name: string): void;
1086
+
1087
+ /**
1088
+ * 删除常量
1089
+ * @param constant 已有的常量实例
1090
+ */
1091
+ removeConstant(constant: Constant): void;
1092
+
1093
+ removeConstant(options: string | Constant) {
1094
+ let constant: Constant;
1095
+ if (typeof options === 'string') {
1096
+ constant = (this.constants as Constant[]).find((item) => item.name === options);
1097
+ if (!constant) {
1098
+ throw new Error(`找不到常量 ${options}`);
1099
+ }
1100
+ } else {
1101
+ constant = options;
1129
1102
  }
1130
-
1131
- _removeElement(element: ProcessElement) {
1132
- const params = {
1133
- propertyName: 'elements',
1134
- index: -1,
1135
- };
1136
- const id = element.id;
1137
- const index = this.elements.indexOf(element);
1138
- ~index && this.elements.splice(index, 1);
1139
- if (element.type !== 'SequenceFlow') {
1140
- const links: Array<ProcessElement> = [];
1141
- this.elements.forEach((c) => {
1142
- if (c.type === 'SequenceFlow' && (c.sourceRef === id || c.targetRef === id)) {
1143
- links.push(c);
1144
- }
1145
- });
1146
- links.forEach((l) => {
1147
- l.delete();
1148
- });
1149
- }
1103
+ return constant.delete();
1104
+ }
1105
+
1106
+ __removeConstant(constant: Constant) {
1107
+ const { parentKey } = constant;
1108
+ const params: Params = {
1109
+ parentNode: this,
1110
+ parentKey,
1111
+ index: -1,
1112
+ object: null,
1113
+ oldObject: constant,
1114
+ };
1115
+ if (parentKey) {
1116
+ params.parentKey = parentKey;
1117
+ if (Array.isArray((this as any)[parentKey])) {
1118
+ const index = (this as any)[parentKey].indexOf(constant);
1119
+ ~index && (this as any)[parentKey].splice(index, 1);
1150
1120
  params.index = index;
1151
- return params;
1121
+ } else if ((this as any)[parentKey] === constant) {
1122
+ params.index = 0;
1123
+ (this as any)[parentKey] = undefined;
1124
+ }
1152
1125
  }
1153
-
1154
- getVarExistingNames(excludedList: Array<Param | Return | Constant | ProcessElement> = []) {
1155
- const excludedSet = new Set(excludedList);
1156
- return [...this.params, ...this.returns, ...this.constants, ...this.elements].filter((item) => !excludedSet.has(item)).map((item) => item.name);
1126
+ return params;
1127
+ }
1128
+
1129
+ /**
1130
+ * 删除流程元素
1131
+ * @param name 流程元素名称
1132
+ */
1133
+ removeElement(name: string): void;
1134
+
1135
+ /**
1136
+ * 删除流程元素
1137
+ * @param element 已有的流程元素实例
1138
+ */
1139
+ removeElement(element: ProcessElement): void;
1140
+
1141
+ removeElement(options: string | ProcessElement) {
1142
+ let element: ProcessElement;
1143
+ if (typeof options === 'string') {
1144
+ element = (this.elements as ProcessElement[]).find((item) => item.name === options);
1145
+ if (!element) {
1146
+ throw new Error(`找不到流程元素 ${options}`);
1147
+ }
1148
+ } else {
1149
+ element = options;
1157
1150
  }
1158
-
1159
- getNamespace(ns: string) {
1160
- if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
1161
- const parentNamespace = (this.parentNode as Namespace).getNamespace();
1162
- const parentName = this.parentNode.name;
1163
- const arr = [parentNamespace];
1164
- if (this.parentNode.concept !== 'App' && parentName) {
1165
- arr.push(parentName);
1166
- }
1167
- return `${arr.join('.')}.${ns || 'processes'}`;
1168
- } else
1169
- throw new Error('无法获取命名空间,请设置 parentNode!');
1151
+ return element.delete();
1152
+ }
1153
+
1154
+ __removeProcessElement(element: ProcessElement) {
1155
+ const { parentKey } = element;
1156
+ const params: Params = {
1157
+ parentNode: this,
1158
+ parentKey,
1159
+ index: -1,
1160
+ object: null,
1161
+ oldObject: element,
1162
+ };
1163
+ if (parentKey) {
1164
+ params.parentKey = parentKey;
1165
+ if (Array.isArray((this as any)[parentKey])) {
1166
+ const index = (this as any)[parentKey].indexOf(element);
1167
+ ~index && (this as any)[parentKey].splice(index, 1);
1168
+ params.index = index;
1169
+ } else if ((this as any)[parentKey] === element) {
1170
+ params.index = 0;
1171
+ (this as any)[parentKey] = undefined;
1172
+ }
1170
1173
  }
1171
-
1172
- getEmbeddedFilePath(name = this.name) {
1173
- return `/embedded/${this.app.name}/processes/${name}.ts`;
1174
+ return params;
1175
+ }
1176
+
1177
+ //= ===============================================================================
1178
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1179
+ // 自动生成的代码已结束。下面可以手动编写。
1180
+ //= ===============================================================================
1181
+ onChange($event?: EventPayload): void {
1182
+ this.emit('change', $event);
1183
+ }
1184
+
1185
+ _removeElement(element: ProcessElement) {
1186
+ const params = {
1187
+ propertyName: 'elements',
1188
+ index: -1,
1189
+ };
1190
+ const { id } = element;
1191
+ const index = this.elements.indexOf(element);
1192
+ ~index && this.elements.splice(index, 1);
1193
+ if (element.type !== 'SequenceFlow') {
1194
+ const links: Array<ProcessElement> = [];
1195
+ this.elements.forEach((c) => {
1196
+ if (c.type === 'SequenceFlow' && (c.sourceRef === id || c.targetRef === id)) {
1197
+ links.push(c);
1198
+ }
1199
+ });
1200
+ links.forEach((l) => {
1201
+ l.delete();
1202
+ });
1174
1203
  }
1175
-
1176
- genExclusiveGatewayLogic(elem: ProcessElement) {
1177
- const l = BaseNode.from(elem.logic) as Logic;
1178
- elem.variables.forEach((v) => {
1179
- const pv = BaseNode.from(v) as Variable;
1180
- l._addVariable(pv);
1181
- });
1182
- return l;
1204
+ params.index = index;
1205
+ return params;
1206
+ }
1207
+
1208
+ getVarExistingNames(excludedList: Array<Param | Return | Constant | ProcessElement> = []) {
1209
+ const excludedSet = new Set(excludedList);
1210
+ return [...this.params, ...this.returns, ...this.constants, ...this.elements].filter((item) => !excludedSet.has(item)).map((item) => item.name);
1211
+ }
1212
+
1213
+ getNamespace(ns: string) {
1214
+ if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
1215
+ const parentNamespace = (this.parentNode as Namespace).getNamespace();
1216
+ const parentName = this.parentNode.name;
1217
+ const arr = [parentNamespace];
1218
+ if (this.parentNode.concept !== 'App' && parentName) {
1219
+ arr.push(parentName);
1220
+ }
1221
+ return `${arr.join('.')}.${ns || 'processes'}`;
1183
1222
  }
1223
+ throw new Error('无法获取命名空间,请设置 parentNode!');
1224
+ }
1225
+
1226
+ getEmbeddedFilePath(name = this.name) {
1227
+ return `/embedded/${this.app.name}/processes/${name}.ts`;
1228
+ }
1229
+
1230
+ genExclusiveGatewayLogic(elem: ProcessElement) {
1231
+ const l = BaseNode.from(elem.logic) as Logic;
1232
+ elem.variables.forEach((v) => {
1233
+ const pv = BaseNode.from(v) as Variable;
1234
+ l._addVariable(pv);
1235
+ });
1236
+ return l;
1237
+ }
1238
+
1239
+ get logics() {
1240
+ // return [
1241
+ // genLaunchProcess(this),
1242
+ // ...this.elements.filter(el => el.type === 'UserTask').map(el => {
1243
+ // return {
1244
+ // name: el.name,
1245
+ // complete: genUserTaskLogic(el),
1246
+ // }
1247
+ // })
1248
+ // ];
1249
+ const ns = process2LogicNamespace(this);
1250
+ let logics: Logic[] = [];
1251
+ ns.children.map((subns) => {
1252
+ logics = logics.concat(subns.logics);
1253
+ });
1184
1254
 
1185
- get logics() {
1186
- // return [
1187
- // genLaunchProcess(this),
1188
- // ...this.elements.filter(el => el.type === 'UserTask').map(el => {
1189
- // return {
1190
- // name: el.name,
1191
- // complete: genUserTaskLogic(el),
1192
- // }
1193
- // })
1194
- // ];
1195
- const ns = process2LogicNamespace(this);
1196
- let logics: Logic[] = [];
1197
- ns.children.map((subns) => {
1198
- logics = logics.concat(subns.logics);
1199
- });
1200
-
1201
- return [
1202
- ...ns.logics,
1203
- ...logics,
1204
- ];
1205
- }
1206
- /**
1207
- * 获取当前逻辑下所有elements上bindEvents下的logic
1208
- */
1209
- get elementLogicRoot() {
1210
- const logics: Array<Logic> = [];
1211
- // 页面上的绑定的事件
1212
- this.bindEvents.forEach((bindEvent) => {
1213
- bindEvent.logics.forEach((logic) => {
1255
+ return [...ns.logics, ...logics];
1256
+ }
1257
+
1258
+ /**
1259
+ * 获取当前逻辑下所有elements上bindEvents下的logic
1260
+ */
1261
+ get elementLogicRoot() {
1262
+ const logics: Array<Logic> = [];
1263
+ // 页面上的绑定的事件
1264
+ this.bindEvents.forEach((bindEvent) => {
1265
+ bindEvent.logics.forEach((logic) => {
1266
+ logics.push(logic);
1267
+ });
1268
+ });
1269
+ this.elements.forEach((item) => {
1270
+ if (item.concept === 'ProcessElement' && item.isUserTask) {
1271
+ utils.traverse(
1272
+ (current) => {
1273
+ current.node.bindEvents.forEach((bindEvent) => {
1274
+ bindEvent.logics.forEach((logic) => {
1214
1275
  logics.push(logic);
1276
+ });
1215
1277
  });
1216
- });
1217
- this.elements.forEach((item) => {
1218
- if (item.concept === 'ProcessElement' && item.isUserTask) {
1219
- utils.traverse((current) => {
1220
- current.node.bindEvents.forEach((bindEvent) => {
1221
- bindEvent.logics.forEach((logic) => {
1222
- logics.push(logic);
1223
- });
1224
- });
1225
- }, { node: item });
1226
- }
1227
- });
1228
- return [{
1229
- concept: 'elementLogicRoot',
1230
- expanded: false,
1231
- children: logics,
1232
- }];
1233
- }
1234
-
1235
- toUserTaskPropertyGetterTS(userTask: ProcessElement) {
1236
- return `let ${userTask.name} = elements.${userTask.name};`;
1237
- }
1238
-
1239
- @withSourceMap()
1240
- toEmbeddedTS(state?: TranslatorState): string {
1241
- let code = `export namespace ${this.name} {\n`;
1242
- const tab0 = indent((state?.tabSize || 0));
1243
- const tab1 = indent((state?.tabSize || 0) + 1);
1244
- const tab2 = indent((state?.tabSize || 0) + 2);
1245
- const tab3 = indent((state?.tabSize || 0) + 3);
1246
- // code += `${tab1}namespace variables{\n`;
1247
-
1248
- code += `${tab1}let __ProcessIdentification__: string;\n`;
1249
- code += `${tab1}export namespace logics {\n`;
1250
- const logic = genLaunchProcess(this);
1251
- // sourceMap 映射
1252
- logic.parentNode = this;
1253
- code += logic.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1254
- code += `${tab1}}\n`;
1255
-
1256
- this.params.forEach((property) => {
1257
- code += `${tab1}export let `;
1258
- code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1259
- code += ';\n';
1260
- });
1261
-
1262
- this.returns.forEach((property) => {
1263
- code += `${tab1}export let `;
1264
- code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1265
- code += ';\n';
1266
- });
1267
- this.constants.forEach((property) => {
1268
- code += `${tab1}export let `;
1269
- code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1270
- code += ';\n';
1271
- });
1272
-
1273
- code += `${tab1}export const elements = {\n`;
1274
-
1275
- this.elements.forEach((ele) => {
1276
- code += '\n';
1277
- if (ele.type !== 'EndNoneEvent' && ele.type !== 'SequenceFlow') {
1278
- code += ele.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1279
- }
1280
- });
1281
- code += `${tab1}}\n`;
1282
- // 流程逻辑提示错误信息
1283
- if (Array.isArray(this.bindEvents)) {
1284
- this.bindEvents.forEach((event) => {
1285
- code += event.toEmbeddedTS(shiftState(state, code, {
1286
- tabSize: (state?.tabSize || 0),
1287
- }));
1288
- code += '\n';
1289
- });
1290
- }
1291
- code += `}\n`;
1292
- return code;
1293
- }
1278
+ },
1279
+ { node: item }
1280
+ );
1281
+ }
1282
+ });
1283
+ return [
1284
+ {
1285
+ concept: 'elementLogicRoot',
1286
+ expanded: false,
1287
+ children: logics,
1288
+ },
1289
+ ];
1290
+ }
1291
+
1292
+ toUserTaskPropertyGetterTS(userTask: ProcessElement) {
1293
+ return `let ${userTask.name} = elements.${userTask.name};`;
1294
+ }
1295
+
1296
+ @withSourceMap()
1297
+ toEmbeddedTS(state?: TranslatorState): string {
1298
+ let code = `export namespace ${this.name} {\n`;
1299
+ const tab0 = indent(state?.tabSize || 0);
1300
+ const tab1 = indent((state?.tabSize || 0) + 1);
1301
+ const tab2 = indent((state?.tabSize || 0) + 2);
1302
+ const tab3 = indent((state?.tabSize || 0) + 3);
1303
+ // code += `${tab1}namespace variables{\n`;
1304
+
1305
+ code += `${tab1}let __ProcessIdentification__: string;\n`;
1306
+ code += `${tab1}export namespace logics {\n`;
1307
+ const logic = genLaunchProcess(this);
1308
+ // sourceMap 映射
1309
+ logic.parentNode = this;
1310
+ code += logic.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1311
+ code += `${tab1}}\n`;
1312
+
1313
+ this.params.forEach((property) => {
1314
+ code += `${tab1}export let `;
1315
+ code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1316
+ code += ';\n';
1317
+ });
1294
1318
 
1295
- toEmbeddedTSFile() {
1296
- let code = `namespace ${this.getNamespace('processes')} {\n`;
1319
+ this.returns.forEach((property) => {
1320
+ code += `${tab1}export let `;
1321
+ code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1322
+ code += ';\n';
1323
+ });
1324
+ this.constants.forEach((property) => {
1325
+ code += `${tab1}export let `;
1326
+ code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
1327
+ code += ';\n';
1328
+ });
1297
1329
 
1298
- const state = createCompilerState(code, { tabSize: 1 });
1299
- try {
1300
- code += this.toEmbeddedTS(state);
1301
- } catch (err) {
1302
- code += '';
1303
- console.log(err);
1304
- }
1305
- code += '}\n';
1330
+ code += `${tab1}export const elements = {\n`;
1306
1331
 
1307
- return {
1308
- code,
1309
- filePath: this.getEmbeddedFilePath(),
1310
- sourceMap: state.sourceMap,
1311
- };
1332
+ this.elements.forEach((ele) => {
1333
+ code += '\n';
1334
+ if (ele.type !== 'EndNoneEvent' && ele.type !== 'SequenceFlow') {
1335
+ code += ele.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1336
+ }
1337
+ });
1338
+ code += `${tab1}}\n`;
1339
+ // 流程逻辑提示错误信息
1340
+ if (Array.isArray(this.bindEvents)) {
1341
+ this.bindEvents.forEach((event) => {
1342
+ code += event.toEmbeddedTS(
1343
+ shiftState(state, code, {
1344
+ tabSize: state?.tabSize || 0,
1345
+ })
1346
+ );
1347
+ code += '\n';
1348
+ });
1312
1349
  }
1313
-
1314
- public static getDefaultOptions() {
1315
- const userTaskAttr = {
1316
- bindAttrs: [
1317
- {
1318
- concept: 'BindAttribute',
1319
- name: 'assignee',
1320
- assignee: {
1321
- concept: 'Assignee',
1322
- },
1323
- },
1324
- ],
1325
- constants: [
1326
- {
1327
- concept: 'Constant',
1328
- name: 'taskId',
1329
- typeAnnotation: {
1330
- concept: 'TypeAnnotation',
1331
- typeKind: 'primitive',
1332
- typeNamespace: 'nasl.core',
1333
- typeName: 'String',
1334
- },
1335
- },
1336
- ],
1337
- };
1338
- return {
1339
- constants: [
1340
- {
1341
- concept: 'Constant',
1342
- name: 'processId',
1343
- typeAnnotation: {
1344
- concept: 'TypeAnnotation',
1345
- typeKind: 'primitive',
1346
- typeNamespace: 'nasl.core',
1347
- typeName: 'String',
1348
- },
1349
- },
1350
- {
1351
- concept: 'Constant',
1352
- name: 'startBy',
1353
- typeAnnotation: {
1354
- concept: 'TypeAnnotation',
1355
- typeKind: 'primitive',
1356
- typeNamespace: 'nasl.core',
1357
- typeName: 'String',
1358
- },
1359
- },
1360
- ],
1361
- elements: [
1362
- {
1363
- concept: 'ProcessElement',
1364
- name: 'Start',
1365
- type: 'StartNoneEvent',
1366
- bounds: {
1367
- concept: 'Rect',
1368
- x: 0, y: 0,
1369
- },
1370
- },
1371
- {
1372
- concept: 'ProcessElement',
1373
- name: 'InitiateTask',
1374
- type: 'InitiateTask',
1375
- title: '发起任务',
1376
- ...userTaskAttr,
1377
- bounds: {
1378
- concept: 'Rect',
1379
- x: 0, y: 90,
1380
- },
1381
- },
1382
- {
1383
- concept: 'ProcessElement',
1384
- name: 'ApprovalTask',
1385
- type: 'ApprovalTask',
1386
- title: '审批任务',
1387
- returns: [
1388
- {
1389
- concept: 'Return',
1390
- description: '审批意见',
1391
- name: 'approvalComment',
1392
- typeAnnotation: {
1393
- concept: 'TypeAnnotation',
1394
- typeKind: 'primitive',
1395
- typeNamespace: 'nasl.core',
1396
- typeName: 'String',
1397
- },
1398
- },
1399
- {
1400
- concept: 'Return',
1401
- description: '审批结果',
1402
- name: 'approvalResult',
1403
- typeAnnotation: {
1404
- concept: 'TypeAnnotation',
1405
- typeKind: 'primitive',
1406
- typeNamespace: 'nasl.core',
1407
- typeName: 'String',
1408
- },
1409
- },
1410
- ],
1411
- ...userTaskAttr,
1412
- bounds: {
1413
- concept: 'Rect',
1414
- x: 0, y: 250,
1415
- },
1416
- },
1417
- {
1418
- concept: 'ProcessElement',
1419
- name: 'End',
1420
- type: 'EndNoneEvent',
1421
- bounds: {
1422
- concept: 'Rect',
1423
- x: 0, y: 500,
1424
- },
1425
- },
1426
- {
1427
- concept: 'ProcessElement',
1428
- name: 'SequenceFlow',
1429
- type: 'SequenceFlow',
1430
- sourceRef: 'Start',
1431
- targetRef: 'InitiateTask',
1432
- waypoints: [
1433
- { x: 0, y: 1 },
1434
- { x: 0, y: -1 },
1435
- ],
1436
- },
1437
- {
1438
- concept: 'ProcessElement',
1439
- name: 'SequenceFlow1',
1440
- type: 'SequenceFlow',
1441
- sourceRef: 'InitiateTask',
1442
- targetRef: 'ApprovalTask',
1443
- waypoints: [
1444
- { x: 0, y: 1 },
1445
- { x: 0, y: -1 },
1446
- ],
1447
- },
1448
- {
1449
- concept: 'ProcessElement',
1450
- name: 'SequenceFlow2',
1451
- type: 'SequenceFlow',
1452
- sourceRef: 'ApprovalTask',
1453
- targetRef: 'End',
1454
- waypoints: [
1455
- { x: 0, y: 1 },
1456
- { x: 0, y: -1 },
1457
- ],
1458
- },
1459
- ],
1460
- };
1350
+ code += `}\n`;
1351
+ return code;
1352
+ }
1353
+
1354
+ toEmbeddedTSFile() {
1355
+ let code = `namespace ${this.getNamespace('processes')} {\n`;
1356
+
1357
+ const state = createCompilerState(code, { tabSize: 1 });
1358
+ try {
1359
+ code += this.toEmbeddedTS(state);
1360
+ } catch (err) {
1361
+ code += '';
1362
+ console.log(err);
1461
1363
  }
1462
- //================================================================================
1463
- // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1464
- // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
1465
- //================================================================================
1364
+ code += '}\n';
1365
+
1366
+ return {
1367
+ code,
1368
+ filePath: this.getEmbeddedFilePath(),
1369
+ sourceMap: state.sourceMap,
1370
+ };
1371
+ }
1372
+
1373
+ public static getDefaultOptions() {
1374
+ const userTaskAttr = {
1375
+ bindAttrs: [
1376
+ {
1377
+ concept: 'BindAttribute',
1378
+ name: 'assignee',
1379
+ assignee: {
1380
+ concept: 'Assignee',
1381
+ },
1382
+ },
1383
+ ],
1384
+ constants: [
1385
+ {
1386
+ concept: 'Constant',
1387
+ name: 'taskId',
1388
+ typeAnnotation: {
1389
+ concept: 'TypeAnnotation',
1390
+ typeKind: 'primitive',
1391
+ typeNamespace: 'nasl.core',
1392
+ typeName: 'String',
1393
+ },
1394
+ },
1395
+ ],
1396
+ };
1397
+ return {
1398
+ constants: [
1399
+ {
1400
+ concept: 'Constant',
1401
+ name: 'processId',
1402
+ typeAnnotation: {
1403
+ concept: 'TypeAnnotation',
1404
+ typeKind: 'primitive',
1405
+ typeNamespace: 'nasl.core',
1406
+ typeName: 'String',
1407
+ },
1408
+ },
1409
+ {
1410
+ concept: 'Constant',
1411
+ name: 'startBy',
1412
+ typeAnnotation: {
1413
+ concept: 'TypeAnnotation',
1414
+ typeKind: 'primitive',
1415
+ typeNamespace: 'nasl.core',
1416
+ typeName: 'String',
1417
+ },
1418
+ },
1419
+ ],
1420
+ elements: [
1421
+ {
1422
+ concept: 'ProcessElement',
1423
+ name: 'Start',
1424
+ type: 'StartNoneEvent',
1425
+ bounds: {
1426
+ concept: 'Rect',
1427
+ x: 0,
1428
+ y: 0,
1429
+ },
1430
+ },
1431
+ {
1432
+ concept: 'ProcessElement',
1433
+ name: 'InitiateTask',
1434
+ type: 'InitiateTask',
1435
+ title: '发起任务',
1436
+ ...userTaskAttr,
1437
+ bounds: {
1438
+ concept: 'Rect',
1439
+ x: 0,
1440
+ y: 90,
1441
+ },
1442
+ },
1443
+ {
1444
+ concept: 'ProcessElement',
1445
+ name: 'ApprovalTask',
1446
+ type: 'ApprovalTask',
1447
+ title: '审批任务',
1448
+ returns: [
1449
+ {
1450
+ concept: 'Return',
1451
+ description: '审批意见',
1452
+ name: 'approvalComment',
1453
+ typeAnnotation: {
1454
+ concept: 'TypeAnnotation',
1455
+ typeKind: 'primitive',
1456
+ typeNamespace: 'nasl.core',
1457
+ typeName: 'String',
1458
+ },
1459
+ },
1460
+ {
1461
+ concept: 'Return',
1462
+ description: '审批结果',
1463
+ name: 'approvalResult',
1464
+ typeAnnotation: {
1465
+ concept: 'TypeAnnotation',
1466
+ typeKind: 'primitive',
1467
+ typeNamespace: 'nasl.core',
1468
+ typeName: 'String',
1469
+ },
1470
+ },
1471
+ ],
1472
+ ...userTaskAttr,
1473
+ bounds: {
1474
+ concept: 'Rect',
1475
+ x: 0,
1476
+ y: 250,
1477
+ },
1478
+ },
1479
+ {
1480
+ concept: 'ProcessElement',
1481
+ name: 'End',
1482
+ type: 'EndNoneEvent',
1483
+ bounds: {
1484
+ concept: 'Rect',
1485
+ x: 0,
1486
+ y: 500,
1487
+ },
1488
+ },
1489
+ {
1490
+ concept: 'ProcessElement',
1491
+ name: 'SequenceFlow',
1492
+ type: 'SequenceFlow',
1493
+ sourceRef: 'Start',
1494
+ targetRef: 'InitiateTask',
1495
+ waypoints: [
1496
+ { x: 0, y: 1 },
1497
+ { x: 0, y: -1 },
1498
+ ],
1499
+ },
1500
+ {
1501
+ concept: 'ProcessElement',
1502
+ name: 'SequenceFlow1',
1503
+ type: 'SequenceFlow',
1504
+ sourceRef: 'InitiateTask',
1505
+ targetRef: 'ApprovalTask',
1506
+ waypoints: [
1507
+ { x: 0, y: 1 },
1508
+ { x: 0, y: -1 },
1509
+ ],
1510
+ },
1511
+ {
1512
+ concept: 'ProcessElement',
1513
+ name: 'SequenceFlow2',
1514
+ type: 'SequenceFlow',
1515
+ sourceRef: 'ApprovalTask',
1516
+ targetRef: 'End',
1517
+ waypoints: [
1518
+ { x: 0, y: 1 },
1519
+ { x: 0, y: -1 },
1520
+ ],
1521
+ },
1522
+ ],
1523
+ };
1524
+ }
1525
+ //= ===============================================================================
1526
+ // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1527
+ // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
1528
+ //= ===============================================================================
1466
1529
  }
1467
1530
 
1468
1531
  classMap.Process = Process;
1469
1532
  export default Process;
1470
- //================================================================================
1533
+ //= ===============================================================================
1471
1534
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1472
1535
  // 自动生成的代码已结束。下面可以手动编写。
1473
- //================================================================================
1536
+ //= ===============================================================================
1474
1537
  Process.prototype.setName = function (name: string) {
1475
- const App = this.rootNode;
1476
- const oldName = this.name;
1477
- App.emit('collect:start', {
1478
- actionMsg: '设置名称',
1479
- });
1480
- syncMemberExpression(this, (node) => {
1481
- if (node.object instanceof Identifier && node.object.name === oldName) {
1482
- node.object.update({
1483
- name,
1484
- });
1485
- }
1486
- });
1487
- this.update({
1538
+ const App = this.rootNode;
1539
+ const oldName = this.name;
1540
+ App.emit('collect:start', {
1541
+ actionMsg: '设置名称',
1542
+ });
1543
+ syncMemberExpression(this, (node) => {
1544
+ if (node.object instanceof Identifier && node.object.name === oldName) {
1545
+ node.object.update({
1488
1546
  name,
1489
- field: 'name',
1490
- });
1491
- App.emit('collect:end');
1547
+ });
1548
+ }
1549
+ });
1550
+ this.update({
1551
+ name,
1552
+ field: 'name',
1553
+ });
1554
+ App.emit('collect:end');
1492
1555
  };