@lcap/nasl 3.2.0-beta.4 → 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 (774) hide show
  1. package/out/automate/upgrader/2.20.js +1 -1
  2. package/out/automate/upgrader/2.20.js.map +1 -1
  3. package/out/bak/translator.js +11 -15
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/breakpoint/generator/AfterStartNode.js +3 -1
  6. package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
  7. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
  8. package/out/breakpoint/generator/BreakpointNode.d.ts +1 -0
  9. package/out/breakpoint/generator/BreakpointNode.js +48 -15
  10. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  11. package/out/breakpoint/generator/CallbackNode.d.ts +4 -0
  12. package/out/breakpoint/generator/CallbackNode.js +22 -0
  13. package/out/breakpoint/generator/CallbackNode.js.map +1 -0
  14. package/out/breakpoint/generator/FragmentNode.d.ts +4 -0
  15. package/out/breakpoint/generator/FragmentNode.js +18 -0
  16. package/out/breakpoint/generator/FragmentNode.js.map +1 -0
  17. package/out/breakpoint/generator/index.js +25 -4
  18. package/out/breakpoint/generator/index.js.map +1 -1
  19. package/out/breakpoint/shared/constants.d.ts +3 -0
  20. package/out/breakpoint/shared/constants.js +6 -1
  21. package/out/breakpoint/shared/constants.js.map +1 -1
  22. package/out/breakpoint/shared/operations.js.map +1 -1
  23. package/out/breakpoint/shared/socket.d.ts +1 -1
  24. package/out/breakpoint/shared/socket.js +36 -7
  25. package/out/breakpoint/shared/socket.js.map +1 -1
  26. package/out/breakpoint/shared/utils.d.ts +2 -0
  27. package/out/breakpoint/shared/utils.js +15 -2
  28. package/out/breakpoint/shared/utils.js.map +1 -1
  29. package/out/breakpoint/store/core.d.ts +48 -2
  30. package/out/breakpoint/store/core.js +58 -32
  31. package/out/breakpoint/store/core.js.map +1 -1
  32. package/out/breakpoint/store/dock.js +1 -1
  33. package/out/breakpoint/store/dock.js.map +1 -1
  34. package/out/common/BaseNode.d.ts +1 -1
  35. package/out/common/BaseNode.js +105 -51
  36. package/out/common/BaseNode.js.map +1 -1
  37. package/out/common/Command.d.ts +13 -2
  38. package/out/common/Command.js +37 -9
  39. package/out/common/Command.js.map +1 -1
  40. package/out/common/EventEmitter.js.map +1 -1
  41. package/out/common/Messager.d.ts +3 -3
  42. package/out/common/Messager.js +6 -7
  43. package/out/common/Messager.js.map +1 -1
  44. package/out/common/asyncFuncMap.js.map +1 -1
  45. package/out/concepts/Abort__.js +6 -5
  46. package/out/concepts/Abort__.js.map +1 -1
  47. package/out/concepts/Anchor__.d.ts +4 -3
  48. package/out/concepts/Anchor__.js +24 -7
  49. package/out/concepts/Anchor__.js.map +1 -1
  50. package/out/concepts/AnonymousFunction__.d.ts +22 -21
  51. package/out/concepts/AnonymousFunction__.js +48 -22
  52. package/out/concepts/AnonymousFunction__.js.map +1 -1
  53. package/out/concepts/App__.d.ts +421 -247
  54. package/out/concepts/App__.js +286 -54
  55. package/out/concepts/App__.js.map +1 -1
  56. package/out/concepts/Argument__.d.ts +4 -3
  57. package/out/concepts/Argument__.js +42 -11
  58. package/out/concepts/Argument__.js.map +1 -1
  59. package/out/concepts/Assignee__.d.ts +45 -45
  60. package/out/concepts/Assignee__.js +15 -15
  61. package/out/concepts/Assignee__.js.map +1 -1
  62. package/out/concepts/AssignmentLine__.js +6 -5
  63. package/out/concepts/AssignmentLine__.js.map +1 -1
  64. package/out/concepts/Assignment__.d.ts +7 -6
  65. package/out/concepts/Assignment__.js +40 -22
  66. package/out/concepts/Assignment__.js.map +1 -1
  67. package/out/concepts/Attribute__.d.ts +3 -3
  68. package/out/concepts/Attribute__.js +8 -7
  69. package/out/concepts/Attribute__.js.map +1 -1
  70. package/out/concepts/AuthInterface__.js +4 -3
  71. package/out/concepts/AuthInterface__.js.map +1 -1
  72. package/out/concepts/AuthLogicForCallInterface__.d.ts +15 -15
  73. package/out/concepts/AuthLogicForCallInterface__.js +46 -27
  74. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  75. package/out/concepts/AuthLogic__.js +27 -13
  76. package/out/concepts/AuthLogic__.js.map +1 -1
  77. package/out/concepts/BackendVariable__.d.ts +5 -5
  78. package/out/concepts/BackendVariable__.js +23 -26
  79. package/out/concepts/BackendVariable__.js.map +1 -1
  80. package/out/concepts/Backend__.d.ts +18 -18
  81. package/out/concepts/Backend__.js +13 -13
  82. package/out/concepts/Backend__.js.map +1 -1
  83. package/out/concepts/BatchAssignment__.d.ts +34 -33
  84. package/out/concepts/BatchAssignment__.js +83 -43
  85. package/out/concepts/BatchAssignment__.js.map +1 -1
  86. package/out/concepts/BinaryExpression__.d.ts +7 -6
  87. package/out/concepts/BinaryExpression__.js +60 -24
  88. package/out/concepts/BinaryExpression__.js.map +1 -1
  89. package/out/concepts/BindAttribute__.d.ts +37 -37
  90. package/out/concepts/BindAttribute__.js +101 -48
  91. package/out/concepts/BindAttribute__.js.map +1 -1
  92. package/out/concepts/BindDirective__.d.ts +13 -13
  93. package/out/concepts/BindDirective__.js +23 -21
  94. package/out/concepts/BindDirective__.js.map +1 -1
  95. package/out/concepts/BindEvent__.d.ts +28 -28
  96. package/out/concepts/BindEvent__.js +99 -48
  97. package/out/concepts/BindEvent__.js.map +1 -1
  98. package/out/concepts/BindStyle__.d.ts +14 -15
  99. package/out/concepts/BindStyle__.js +16 -16
  100. package/out/concepts/BindStyle__.js.map +1 -1
  101. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  102. package/out/concepts/BooleanLiteral__.js +12 -5
  103. package/out/concepts/BooleanLiteral__.js.map +1 -1
  104. package/out/concepts/CallAuthInterface__.d.ts +15 -15
  105. package/out/concepts/CallAuthInterface__.js +23 -22
  106. package/out/concepts/CallAuthInterface__.js.map +1 -1
  107. package/out/concepts/CallConnector__.d.ts +11 -9
  108. package/out/concepts/CallConnector__.js +79 -36
  109. package/out/concepts/CallConnector__.js.map +1 -1
  110. package/out/concepts/CallFunction__.d.ts +17 -16
  111. package/out/concepts/CallFunction__.js +95 -63
  112. package/out/concepts/CallFunction__.js.map +1 -1
  113. package/out/concepts/CallInterface__.d.ts +9 -8
  114. package/out/concepts/CallInterface__.js +71 -30
  115. package/out/concepts/CallInterface__.js.map +1 -1
  116. package/out/concepts/CallLogic__.d.ts +20 -19
  117. package/out/concepts/CallLogic__.js +155 -52
  118. package/out/concepts/CallLogic__.js.map +1 -1
  119. package/out/concepts/CallQueryComponent__.d.ts +51 -51
  120. package/out/concepts/CallQueryComponent__.js +66 -63
  121. package/out/concepts/CallQueryComponent__.js.map +1 -1
  122. package/out/concepts/Comment__.d.ts +1 -0
  123. package/out/concepts/Comment__.js +13 -6
  124. package/out/concepts/Comment__.js.map +1 -1
  125. package/out/concepts/CompletionProperty__.d.ts +3 -3
  126. package/out/concepts/CompletionProperty__.js +8 -7
  127. package/out/concepts/CompletionProperty__.js.map +1 -1
  128. package/out/concepts/ConfigGroup__.d.ts +15 -15
  129. package/out/concepts/ConfigGroup__.js +9 -9
  130. package/out/concepts/ConfigGroup__.js.map +1 -1
  131. package/out/concepts/ConfigPropertyValue__.js +4 -3
  132. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  133. package/out/concepts/ConfigProperty__.d.ts +15 -15
  134. package/out/concepts/ConfigProperty__.js +10 -10
  135. package/out/concepts/ConfigProperty__.js.map +1 -1
  136. package/out/concepts/Configuration__.d.ts +15 -15
  137. package/out/concepts/Configuration__.js +9 -9
  138. package/out/concepts/Configuration__.js.map +1 -1
  139. package/out/concepts/Connection__.d.ts +166 -0
  140. package/out/concepts/Connection__.js +332 -0
  141. package/out/concepts/Connection__.js.map +1 -0
  142. package/out/concepts/ConnectorTrigger__.js +4 -3
  143. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  144. package/out/concepts/Connector__.d.ts +66 -66
  145. package/out/concepts/Connector__.js +16 -15
  146. package/out/concepts/Connector__.js.map +1 -1
  147. package/out/concepts/Constant__.d.ts +3 -3
  148. package/out/concepts/Constant__.js +8 -7
  149. package/out/concepts/Constant__.js.map +1 -1
  150. package/out/concepts/DataElement__.d.ts +3 -3
  151. package/out/concepts/DataElement__.js +6 -5
  152. package/out/concepts/DataElement__.js.map +1 -1
  153. package/out/concepts/DataSource__.d.ts +15 -15
  154. package/out/concepts/DataSource__.js +55 -39
  155. package/out/concepts/DataSource__.js.map +1 -1
  156. package/out/concepts/DatabaseTypeAnnotation__.js +4 -3
  157. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  158. package/out/concepts/Destination__.d.ts +12 -11
  159. package/out/concepts/Destination__.js +93 -36
  160. package/out/concepts/Destination__.js.map +1 -1
  161. package/out/concepts/End__.js +15 -13
  162. package/out/concepts/End__.js.map +1 -1
  163. package/out/concepts/EntityIndex__.d.ts +1 -1
  164. package/out/concepts/EntityIndex__.js +6 -5
  165. package/out/concepts/EntityIndex__.js.map +1 -1
  166. package/out/concepts/EntityProperty__.d.ts +8 -7
  167. package/out/concepts/EntityProperty__.js +39 -24
  168. package/out/concepts/EntityProperty__.js.map +1 -1
  169. package/out/concepts/Entity__.d.ts +31 -30
  170. package/out/concepts/Entity__.js +40 -16
  171. package/out/concepts/Entity__.js.map +1 -1
  172. package/out/concepts/EnumItem__.d.ts +1 -0
  173. package/out/concepts/EnumItem__.js +12 -5
  174. package/out/concepts/EnumItem__.js.map +1 -1
  175. package/out/concepts/Enum__.d.ts +9 -8
  176. package/out/concepts/Enum__.js +24 -11
  177. package/out/concepts/Enum__.js.map +1 -1
  178. package/out/concepts/Event__.d.ts +15 -15
  179. package/out/concepts/Event__.js +6 -5
  180. package/out/concepts/Event__.js.map +1 -1
  181. package/out/concepts/ExternalDestination__.d.ts +6 -6
  182. package/out/concepts/ExternalDestination__.js +12 -11
  183. package/out/concepts/ExternalDestination__.js.map +1 -1
  184. package/out/concepts/ForEachStatement__.d.ts +25 -24
  185. package/out/concepts/ForEachStatement__.js +101 -36
  186. package/out/concepts/ForEachStatement__.js.map +1 -1
  187. package/out/concepts/FrontendLibrary__.d.ts +30 -30
  188. package/out/concepts/FrontendLibrary__.js +12 -13
  189. package/out/concepts/FrontendLibrary__.js.map +1 -1
  190. package/out/concepts/FrontendVariable__.js +4 -3
  191. package/out/concepts/FrontendVariable__.js.map +1 -1
  192. package/out/concepts/Frontend__.d.ts +64 -65
  193. package/out/concepts/Frontend__.js +23 -27
  194. package/out/concepts/Frontend__.js.map +1 -1
  195. package/out/concepts/Function__.d.ts +64 -63
  196. package/out/concepts/Function__.js +49 -21
  197. package/out/concepts/Function__.js.map +1 -1
  198. package/out/concepts/Identifier__.js +37 -31
  199. package/out/concepts/Identifier__.js.map +1 -1
  200. package/out/concepts/IfStatement__.d.ts +20 -19
  201. package/out/concepts/IfStatement__.js +64 -34
  202. package/out/concepts/IfStatement__.js.map +1 -1
  203. package/out/concepts/Integration__.d.ts +3 -3
  204. package/out/concepts/Integration__.js +8 -7
  205. package/out/concepts/Integration__.js.map +1 -1
  206. package/out/concepts/InterfaceParam__.d.ts +3 -3
  207. package/out/concepts/InterfaceParam__.js +7 -6
  208. package/out/concepts/InterfaceParam__.js.map +1 -1
  209. package/out/concepts/Interface__.d.ts +33 -33
  210. package/out/concepts/Interface__.js +19 -20
  211. package/out/concepts/Interface__.js.map +1 -1
  212. package/out/concepts/JSBlock__.d.ts +1 -0
  213. package/out/concepts/JSBlock__.js +12 -5
  214. package/out/concepts/JSBlock__.js.map +1 -1
  215. package/out/concepts/JavaLogic__.js +10 -9
  216. package/out/concepts/JavaLogic__.js.map +1 -1
  217. package/out/concepts/LogicItem__.d.ts +6 -0
  218. package/out/concepts/LogicItem__.js +14 -5
  219. package/out/concepts/LogicItem__.js.map +1 -1
  220. package/out/concepts/Logic__.d.ts +80 -79
  221. package/out/concepts/Logic__.js +204 -58
  222. package/out/concepts/Logic__.js.map +1 -1
  223. package/out/concepts/MatchCase__.d.ts +39 -38
  224. package/out/concepts/MatchCase__.js +122 -37
  225. package/out/concepts/MatchCase__.js.map +1 -1
  226. package/out/concepts/Match__.d.ts +13 -11
  227. package/out/concepts/Match__.js +128 -60
  228. package/out/concepts/Match__.js.map +1 -1
  229. package/out/concepts/MemberExpression__.d.ts +7 -6
  230. package/out/concepts/MemberExpression__.js +52 -22
  231. package/out/concepts/MemberExpression__.js.map +1 -1
  232. package/out/concepts/MicroApp__.js +4 -3
  233. package/out/concepts/MicroApp__.js.map +1 -1
  234. package/out/concepts/Module__.d.ts +239 -155
  235. package/out/concepts/Module__.js +139 -33
  236. package/out/concepts/Module__.js.map +1 -1
  237. package/out/concepts/MsgTriggerEvent__.d.ts +15 -15
  238. package/out/concepts/MsgTriggerEvent__.js +6 -5
  239. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  240. package/out/concepts/MsgTriggerLauncher__.d.ts +23 -15
  241. package/out/concepts/MsgTriggerLauncher__.js +24 -5
  242. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  243. package/out/concepts/Namespace__.d.ts +180 -180
  244. package/out/concepts/Namespace__.js +33 -34
  245. package/out/concepts/Namespace__.js.map +1 -1
  246. package/out/concepts/NewComposite__.d.ts +49 -48
  247. package/out/concepts/NewComposite__.js +164 -49
  248. package/out/concepts/NewComposite__.js.map +1 -1
  249. package/out/concepts/NewList__.d.ts +19 -18
  250. package/out/concepts/NewList__.js +29 -12
  251. package/out/concepts/NewList__.js.map +1 -1
  252. package/out/concepts/NewMap__.d.ts +34 -33
  253. package/out/concepts/NewMap__.js +81 -72
  254. package/out/concepts/NewMap__.js.map +1 -1
  255. package/out/concepts/New__.js +6 -5
  256. package/out/concepts/New__.js.map +1 -1
  257. package/out/concepts/NullLiteral__.js +6 -5
  258. package/out/concepts/NullLiteral__.js.map +1 -1
  259. package/out/concepts/NumericLiteral__.d.ts +4 -3
  260. package/out/concepts/NumericLiteral__.js +15 -8
  261. package/out/concepts/NumericLiteral__.js.map +1 -1
  262. package/out/concepts/OqlQueryComponent__.d.ts +4 -3
  263. package/out/concepts/OqlQueryComponent__.js +25 -16
  264. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  265. package/out/concepts/OverriddenLogic__.d.ts +79 -79
  266. package/out/concepts/OverriddenLogic__.js +79 -58
  267. package/out/concepts/OverriddenLogic__.js.map +1 -1
  268. package/out/concepts/Param__.d.ts +6 -5
  269. package/out/concepts/Param__.js +66 -29
  270. package/out/concepts/Param__.js.map +1 -1
  271. package/out/concepts/Point__.js +4 -3
  272. package/out/concepts/Point__.js.map +1 -1
  273. package/out/concepts/ProcessComponent__.d.ts +30 -30
  274. package/out/concepts/ProcessComponent__.js +8 -7
  275. package/out/concepts/ProcessComponent__.js.map +1 -1
  276. package/out/concepts/ProcessElement__.d.ts +96 -96
  277. package/out/concepts/ProcessElement__.js +34 -34
  278. package/out/concepts/ProcessElement__.js.map +1 -1
  279. package/out/concepts/ProcessOutcome__.js +6 -5
  280. package/out/concepts/ProcessOutcome__.js.map +1 -1
  281. package/out/concepts/ProcessOutcomes__.js +6 -5
  282. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  283. package/out/concepts/Process__.d.ts +75 -75
  284. package/out/concepts/Process__.js +33 -30
  285. package/out/concepts/Process__.js.map +1 -1
  286. package/out/concepts/QueryAggregateExpression__.d.ts +3 -3
  287. package/out/concepts/QueryAggregateExpression__.js +8 -7
  288. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  289. package/out/concepts/QueryFieldExpression__.js +7 -6
  290. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  291. package/out/concepts/QueryFromExpression__.d.ts +8 -8
  292. package/out/concepts/QueryFromExpression__.js +8 -7
  293. package/out/concepts/QueryFromExpression__.js.map +1 -1
  294. package/out/concepts/QueryGroupByExpression__.d.ts +3 -3
  295. package/out/concepts/QueryGroupByExpression__.js +9 -10
  296. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  297. package/out/concepts/QueryJoinExpression__.d.ts +23 -23
  298. package/out/concepts/QueryJoinExpression__.js +11 -10
  299. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  300. package/out/concepts/QueryLimitExpression__.d.ts +6 -6
  301. package/out/concepts/QueryLimitExpression__.js +9 -8
  302. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  303. package/out/concepts/QueryOrderByExpression__.d.ts +6 -6
  304. package/out/concepts/QueryOrderByExpression__.js +9 -8
  305. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  306. package/out/concepts/QuerySelectExpression__.d.ts +30 -30
  307. package/out/concepts/QuerySelectExpression__.js +9 -8
  308. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  309. package/out/concepts/Rect__.js +4 -3
  310. package/out/concepts/Rect__.js.map +1 -1
  311. package/out/concepts/Return__.d.ts +4 -3
  312. package/out/concepts/Return__.js +37 -18
  313. package/out/concepts/Return__.js.map +1 -1
  314. package/out/concepts/Role__.js +9 -9
  315. package/out/concepts/Role__.js.map +1 -1
  316. package/out/concepts/SelectMembers__.d.ts +18 -18
  317. package/out/concepts/SelectMembers__.js +10 -9
  318. package/out/concepts/SelectMembers__.js.map +1 -1
  319. package/out/concepts/Slot__.d.ts +3 -3
  320. package/out/concepts/Slot__.js +6 -5
  321. package/out/concepts/Slot__.js.map +1 -1
  322. package/out/concepts/SqlQueryComponent__.d.ts +4 -3
  323. package/out/concepts/SqlQueryComponent__.js +21 -12
  324. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  325. package/out/concepts/Start__.js +6 -5
  326. package/out/concepts/Start__.js.map +1 -1
  327. package/out/concepts/StringInterpolation__.d.ts +16 -15
  328. package/out/concepts/StringInterpolation__.js +37 -14
  329. package/out/concepts/StringInterpolation__.js.map +1 -1
  330. package/out/concepts/StringLiteral__.d.ts +1 -0
  331. package/out/concepts/StringLiteral__.js +13 -8
  332. package/out/concepts/StringLiteral__.js.map +1 -1
  333. package/out/concepts/StructureProperty__.d.ts +4 -3
  334. package/out/concepts/StructureProperty__.js +22 -9
  335. package/out/concepts/StructureProperty__.js.map +1 -1
  336. package/out/concepts/Structure__.d.ts +31 -30
  337. package/out/concepts/Structure__.js +27 -15
  338. package/out/concepts/Structure__.js.map +1 -1
  339. package/out/concepts/SwitchCase__.d.ts +12 -11
  340. package/out/concepts/SwitchCase__.js +69 -31
  341. package/out/concepts/SwitchCase__.js.map +1 -1
  342. package/out/concepts/SwitchStatement__.d.ts +9 -8
  343. package/out/concepts/SwitchStatement__.js +27 -7
  344. package/out/concepts/SwitchStatement__.js.map +1 -1
  345. package/out/concepts/Theme__.js +4 -3
  346. package/out/concepts/Theme__.js.map +1 -1
  347. package/out/concepts/Transactional__.js +4 -3
  348. package/out/concepts/Transactional__.js.map +1 -1
  349. package/out/concepts/TriggerEvent__.d.ts +15 -15
  350. package/out/concepts/TriggerEvent__.js +6 -5
  351. package/out/concepts/TriggerEvent__.js.map +1 -1
  352. package/out/concepts/TriggerLauncher__.d.ts +15 -10
  353. package/out/concepts/TriggerLauncher__.js +54 -32
  354. package/out/concepts/TriggerLauncher__.js.map +1 -1
  355. package/out/concepts/TypeAnnotation__.d.ts +28 -27
  356. package/out/concepts/TypeAnnotation__.js +144 -124
  357. package/out/concepts/TypeAnnotation__.js.map +1 -1
  358. package/out/concepts/TypeParam__.d.ts +1 -0
  359. package/out/concepts/TypeParam__.js +12 -5
  360. package/out/concepts/TypeParam__.js.map +1 -1
  361. package/out/concepts/UnaryExpression__.d.ts +4 -3
  362. package/out/concepts/UnaryExpression__.js +31 -20
  363. package/out/concepts/UnaryExpression__.js.map +1 -1
  364. package/out/concepts/Unparsed__.d.ts +1 -0
  365. package/out/concepts/Unparsed__.js +12 -5
  366. package/out/concepts/Unparsed__.js.map +1 -1
  367. package/out/concepts/UseComponent__.js +4 -3
  368. package/out/concepts/UseComponent__.js.map +1 -1
  369. package/out/concepts/ValidationRule__.d.ts +14 -14
  370. package/out/concepts/ValidationRule__.js +19 -17
  371. package/out/concepts/ValidationRule__.js.map +1 -1
  372. package/out/concepts/Variable__.d.ts +4 -3
  373. package/out/concepts/Variable__.js +39 -23
  374. package/out/concepts/Variable__.js.map +1 -1
  375. package/out/concepts/ViewBlock__.js +4 -3
  376. package/out/concepts/ViewBlock__.js.map +1 -1
  377. package/out/concepts/ViewComponent__.d.ts +90 -90
  378. package/out/concepts/ViewComponent__.js +16 -15
  379. package/out/concepts/ViewComponent__.js.map +1 -1
  380. package/out/concepts/ViewElement__.d.ts +91 -86
  381. package/out/concepts/ViewElement__.js +218 -146
  382. package/out/concepts/ViewElement__.js.map +1 -1
  383. package/out/concepts/View__.d.ts +92 -92
  384. package/out/concepts/View__.js +135 -60
  385. package/out/concepts/View__.js.map +1 -1
  386. package/out/concepts/WhileStatement__.d.ts +12 -11
  387. package/out/concepts/WhileStatement__.js +46 -23
  388. package/out/concepts/WhileStatement__.js.map +1 -1
  389. package/out/concepts/index__.d.ts +2 -1
  390. package/out/concepts/index__.js +2 -1
  391. package/out/concepts/index__.js.map +1 -1
  392. package/out/concepts/types__.d.ts +2 -1
  393. package/out/decorators/index.d.ts +1 -1
  394. package/out/decorators/index.js +20 -7
  395. package/out/decorators/index.js.map +1 -1
  396. package/out/decorators/promise.d.ts +7 -0
  397. package/out/decorators/promise.js +28 -0
  398. package/out/decorators/promise.js.map +1 -0
  399. package/out/enums/KEYWORDS.js.map +1 -1
  400. package/out/enums/LEVEL_NAME_MAP.js.map +1 -1
  401. package/out/generator/compileComponent.js.map +1 -1
  402. package/out/generator/genBundleFiles.d.ts +4 -1
  403. package/out/generator/genBundleFiles.js +15 -11
  404. package/out/generator/genBundleFiles.js.map +1 -1
  405. package/out/generator/genHash.js.map +1 -1
  406. package/out/generator/genMetaData.js +12 -8
  407. package/out/generator/genMetaData.js.map +1 -1
  408. package/out/generator/genReleaseBody.js +33 -35
  409. package/out/generator/genReleaseBody.js.map +1 -1
  410. package/out/generator/microApp.js +2 -1
  411. package/out/generator/microApp.js.map +1 -1
  412. package/out/generator/permission.js +16 -14
  413. package/out/generator/permission.js.map +1 -1
  414. package/out/generator/styleReplacer.js +4 -7
  415. package/out/generator/styleReplacer.js.map +1 -1
  416. package/out/index.d.ts +0 -2
  417. package/out/index.js +0 -3
  418. package/out/index.js.map +1 -1
  419. package/out/manager/diagnostic.d.ts +1 -1
  420. package/out/manager/diagnostic.js.map +1 -1
  421. package/out/manager/stepRecorder.js +13 -9
  422. package/out/manager/stepRecorder.js.map +1 -1
  423. package/out/natural/RequirementAnalyzer.d.ts +22 -0
  424. package/out/natural/RequirementAnalyzer.js +196 -0
  425. package/out/natural/RequirementAnalyzer.js.map +1 -0
  426. package/out/natural/RequirementExecutor.d.ts +51 -0
  427. package/out/natural/RequirementExecutor.js +692 -0
  428. package/out/natural/RequirementExecutor.js.map +1 -0
  429. package/out/natural/componentData.d.ts +31 -0
  430. package/out/natural/componentData.js +85 -0
  431. package/out/natural/componentData.js.map +1 -0
  432. package/out/natural/genNaturalTS.d.ts +3 -0
  433. package/out/natural/genNaturalTS.js +76 -0
  434. package/out/natural/genNaturalTS.js.map +1 -0
  435. package/out/natural/index.d.ts +4 -0
  436. package/out/natural/index.js +21 -0
  437. package/out/natural/index.js.map +1 -0
  438. package/out/natural/knowledgeMap.d.ts +4 -0
  439. package/out/natural/knowledgeMap.js +40 -0
  440. package/out/natural/knowledgeMap.js.map +1 -0
  441. package/out/natural/naslStdlibMap.d.ts +2 -0
  442. package/out/natural/naslStdlibMap.js +26 -0
  443. package/out/natural/naslStdlibMap.js.map +1 -0
  444. package/out/natural/transformTSCode.d.ts +7 -0
  445. package/out/natural/transformTSCode.js +760 -0
  446. package/out/natural/transformTSCode.js.map +1 -0
  447. package/out/sentry/index.d.ts +2 -1
  448. package/out/sentry/index.js.map +1 -1
  449. package/out/server/createUiTs.js +28 -16
  450. package/out/server/createUiTs.js.map +1 -1
  451. package/out/server/entity2LogicNamespace.js +24 -22
  452. package/out/server/entity2LogicNamespace.js.map +1 -1
  453. package/out/server/event.js.map +1 -1
  454. package/out/server/extendBaseNode.js +55 -70
  455. package/out/server/extendBaseNode.js.map +1 -1
  456. package/out/server/formatTsUtils.js +46 -50
  457. package/out/server/formatTsUtils.js.map +1 -1
  458. package/out/server/getConnector.d.ts +3 -3
  459. package/out/server/getConnector.js +7 -8
  460. package/out/server/getConnector.js.map +1 -1
  461. package/out/server/getExtensionModules.js +2 -2
  462. package/out/server/getExtensionModules.js.map +1 -1
  463. package/out/server/getFunctions.js.map +1 -1
  464. package/out/server/getInterfaces.js.map +1 -1
  465. package/out/server/getLogging.js.map +1 -1
  466. package/out/server/getLogics.d.ts +1 -1
  467. package/out/server/getLogics.js +34 -16
  468. package/out/server/getLogics.js.map +1 -1
  469. package/out/server/getMemberIdentifier.js +13 -10
  470. package/out/server/getMemberIdentifier.js.map +1 -1
  471. package/out/server/getProcessComponents.js.map +1 -1
  472. package/out/server/getProcesses.js +21 -29
  473. package/out/server/getProcesses.js.map +1 -1
  474. package/out/server/getScope.js.map +1 -1
  475. package/out/server/getValidates.js.map +1 -1
  476. package/out/server/index.js +0 -1
  477. package/out/server/index.js.map +1 -1
  478. package/out/server/naslServer.d.ts +99 -94
  479. package/out/server/naslServer.js +485 -465
  480. package/out/server/naslServer.js.map +1 -1
  481. package/out/server/naslStdlibMap.js +4 -2
  482. package/out/server/naslStdlibMap.js.map +1 -1
  483. package/out/server/process2LogicNamespace.js.map +1 -1
  484. package/out/server/translator.d.ts +1 -1
  485. package/out/server/translator.js +52 -47
  486. package/out/server/translator.js.map +1 -1
  487. package/out/service/storage/init.d.ts +15 -1
  488. package/out/service/storage/init.js +65 -56
  489. package/out/service/storage/init.js.map +1 -1
  490. package/out/templator/genCallComponentLogic.js +1 -2
  491. package/out/templator/genCallComponentLogic.js.map +1 -1
  492. package/out/templator/genCreateBlock.js +13 -8
  493. package/out/templator/genCreateBlock.js.map +1 -1
  494. package/out/templator/genCurdEditMultipleKeyBlock.js +19 -10
  495. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  496. package/out/templator/genCurdMultipleKeyBlock.js +22 -26
  497. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  498. package/out/templator/genEditTableBlock.js +11 -12
  499. package/out/templator/genEditTableBlock.js.map +1 -1
  500. package/out/templator/genEnumSelectBlock.js +1 -1
  501. package/out/templator/genEnumSelectBlock.js.map +1 -1
  502. package/out/templator/genGetBlock.js +2 -2
  503. package/out/templator/genGetBlock.js.map +1 -1
  504. package/out/templator/genGridViewBlock.js +10 -14
  505. package/out/templator/genGridViewBlock.js.map +1 -1
  506. package/out/templator/genListViewBlock.js +4 -7
  507. package/out/templator/genListViewBlock.js.map +1 -1
  508. package/out/templator/genQueryComponent.js +22 -15
  509. package/out/templator/genQueryComponent.js.map +1 -1
  510. package/out/templator/genSelectBlock.js +12 -33
  511. package/out/templator/genSelectBlock.js.map +1 -1
  512. package/out/templator/genTableBlock.js +8 -10
  513. package/out/templator/genTableBlock.js.map +1 -1
  514. package/out/templator/genUpdateBlock.js +12 -7
  515. package/out/templator/genUpdateBlock.js.map +1 -1
  516. package/out/templator/index.d.ts +4 -2
  517. package/out/templator/index.js +2 -2
  518. package/out/templator/index.js.map +1 -1
  519. package/out/templator/utils.d.ts +2 -2
  520. package/out/templator/utils.js +21 -22
  521. package/out/templator/utils.js.map +1 -1
  522. package/out/translator/index.js +27 -28
  523. package/out/translator/index.js.map +1 -1
  524. package/out/utils/index.d.ts +2 -1
  525. package/out/utils/index.js +8 -14
  526. package/out/utils/index.js.map +1 -1
  527. package/out/utils/logger.js.map +1 -1
  528. package/out/utils/sortTsString.js +3 -1
  529. package/out/utils/sortTsString.js.map +1 -1
  530. package/out/utils/string.js +8 -11
  531. package/out/utils/string.js.map +1 -1
  532. package/out/utils/time-slicing.d.ts +41 -0
  533. package/out/utils/time-slicing.js +81 -0
  534. package/out/utils/time-slicing.js.map +1 -0
  535. package/out/utils/traverse.js +4 -6
  536. package/out/utils/traverse.js.map +1 -1
  537. package/package.json +11 -7
  538. package/sandbox/stdlib/nasl.auth.ts +49 -46
  539. package/sandbox/stdlib/nasl.http.ts +29 -31
  540. package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
  541. package/sandbox-natural/stdlib/nasl.core.ts +36 -0
  542. package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
  543. package/sandbox-natural/stdlib/nasl.ui.ts +56 -0
  544. package/sandbox-natural/stdlib/nasl.util.ts +26 -0
  545. package/sandbox-natural/tsconfig.json +12 -0
  546. package/src/automate/upgrader/2.20.js +1 -1
  547. package/src/bak/translator.js +92 -99
  548. package/src/breakpoint/generator/AfterStartNode.ts +19 -17
  549. package/src/breakpoint/generator/BeforeEndNode.ts +17 -17
  550. package/src/breakpoint/generator/BreakpointNode.ts +243 -195
  551. package/src/breakpoint/generator/CallbackNode.ts +20 -0
  552. package/src/breakpoint/generator/FragmentNode.ts +14 -0
  553. package/src/breakpoint/generator/index.ts +107 -80
  554. package/src/breakpoint/shared/constants.ts +59 -53
  555. package/src/breakpoint/shared/operations.ts +6 -6
  556. package/src/breakpoint/shared/socket.ts +277 -223
  557. package/src/breakpoint/shared/utils.ts +166 -146
  558. package/src/breakpoint/store/core.ts +326 -297
  559. package/src/breakpoint/store/dock.ts +103 -103
  560. package/src/breakpoint/types/index.d.ts +11 -11
  561. package/src/common/BaseNode.ts +1102 -1024
  562. package/src/common/Command.ts +46 -16
  563. package/src/common/ComponentAPI.ts +72 -72
  564. package/src/common/EventEmitter.ts +80 -76
  565. package/src/common/Messager.ts +223 -224
  566. package/src/common/asyncFuncMap.ts +12 -12
  567. package/src/concepts/Abort__.ts +53 -60
  568. package/src/concepts/Anchor__.ts +158 -149
  569. package/src/concepts/AnonymousFunction__.ts +584 -551
  570. package/src/concepts/App__.ts +4278 -3671
  571. package/src/concepts/Argument__.ts +234 -210
  572. package/src/concepts/Assignee__.ts +680 -656
  573. package/src/concepts/AssignmentLine__.ts +80 -84
  574. package/src/concepts/Assignment__.ts +275 -264
  575. package/src/concepts/Attribute__.ts +183 -184
  576. package/src/concepts/AuthInterface__.ts +61 -63
  577. package/src/concepts/AuthLogicForCallInterface__.ts +540 -511
  578. package/src/concepts/AuthLogic__.ts +210 -194
  579. package/src/concepts/BackendVariable__.ts +414 -415
  580. package/src/concepts/Backend__.ts +317 -303
  581. package/src/concepts/BatchAssignment__.ts +987 -939
  582. package/src/concepts/BinaryExpression__.ts +370 -341
  583. package/src/concepts/BindAttribute__.ts +1057 -1007
  584. package/src/concepts/BindDirective__.ts +540 -542
  585. package/src/concepts/BindEvent__.ts +992 -911
  586. package/src/concepts/BindStyle__.ts +442 -451
  587. package/src/concepts/BooleanLiteral__.ts +89 -90
  588. package/src/concepts/CallAuthInterface__.ts +458 -433
  589. package/src/concepts/CallConnector__.ts +209 -164
  590. package/src/concepts/CallFunction__.ts +600 -600
  591. package/src/concepts/CallInterface__.ts +752 -721
  592. package/src/concepts/CallLogic__.ts +1324 -1200
  593. package/src/concepts/CallQueryComponent__.ts +1580 -1501
  594. package/src/concepts/Comment__.ts +69 -68
  595. package/src/concepts/CompletionProperty__.ts +250 -255
  596. package/src/concepts/ConfigGroup__.ts +312 -296
  597. package/src/concepts/ConfigPropertyValue__.ts +92 -93
  598. package/src/concepts/ConfigProperty__.ts +374 -357
  599. package/src/concepts/Configuration__.ts +288 -276
  600. package/src/concepts/Connection__.ts +426 -0
  601. package/src/concepts/ConnectorTrigger__.ts +146 -142
  602. package/src/concepts/Connector__.ts +1090 -1048
  603. package/src/concepts/Constant__.ts +226 -219
  604. package/src/concepts/DataElement__.ts +108 -115
  605. package/src/concepts/DataSource__.ts +508 -472
  606. package/src/concepts/DatabaseTypeAnnotation__.ts +53 -59
  607. package/src/concepts/Destination__.ts +808 -746
  608. package/src/concepts/End__.ts +85 -89
  609. package/src/concepts/EntityIndex__.ts +206 -202
  610. package/src/concepts/EntityProperty__.ts +825 -791
  611. package/src/concepts/Entity__.ts +921 -864
  612. package/src/concepts/EnumItem__.ts +133 -125
  613. package/src/concepts/Enum__.ts +347 -337
  614. package/src/concepts/Event__.ts +305 -292
  615. package/src/concepts/ExternalDestination__.ts +269 -280
  616. package/src/concepts/ForEachStatement__.ts +583 -531
  617. package/src/concepts/FrontendLibrary__.ts +507 -485
  618. package/src/concepts/FrontendVariable__.ts +44 -49
  619. package/src/concepts/Frontend__.ts +1239 -1187
  620. package/src/concepts/Function__.ts +1110 -1045
  621. package/src/concepts/Identifier__.ts +276 -272
  622. package/src/concepts/IfStatement__.ts +467 -436
  623. package/src/concepts/Integration__.ts +136 -137
  624. package/src/concepts/InterfaceParam__.ts +239 -238
  625. package/src/concepts/Interface__.ts +969 -948
  626. package/src/concepts/JSBlock__.ts +83 -83
  627. package/src/concepts/JavaLogic__.ts +101 -106
  628. package/src/concepts/LogicItem__.ts +307 -237
  629. package/src/concepts/Logic__.ts +2301 -2088
  630. package/src/concepts/MatchCase__.ts +886 -779
  631. package/src/concepts/Match__.ts +728 -659
  632. package/src/concepts/MemberExpression__.ts +330 -311
  633. package/src/concepts/MicroApp__.ts +91 -97
  634. package/src/concepts/Module__.ts +2590 -2278
  635. package/src/concepts/MsgTriggerEvent__.ts +297 -281
  636. package/src/concepts/MsgTriggerLauncher__.ts +286 -256
  637. package/src/concepts/Namespace__.ts +2579 -2466
  638. package/src/concepts/NewComposite__.ts +1487 -1350
  639. package/src/concepts/NewList__.ts +464 -450
  640. package/src/concepts/NewMap__.ts +691 -674
  641. package/src/concepts/New__.ts +42 -49
  642. package/src/concepts/NullLiteral__.ts +66 -72
  643. package/src/concepts/NumericLiteral__.ts +169 -169
  644. package/src/concepts/OqlQueryComponent__.ts +282 -279
  645. package/src/concepts/OverriddenLogic__.ts +2142 -2097
  646. package/src/concepts/Param__.ts +500 -442
  647. package/src/concepts/Point__.ts +53 -59
  648. package/src/concepts/ProcessComponent__.ts +497 -475
  649. package/src/concepts/ProcessElement__.ts +1852 -1780
  650. package/src/concepts/ProcessOutcome__.ts +59 -64
  651. package/src/concepts/ProcessOutcomes__.ts +59 -64
  652. package/src/concepts/Process__.ts +1491 -1428
  653. package/src/concepts/QueryAggregateExpression__.ts +135 -142
  654. package/src/concepts/QueryFieldExpression__.ts +138 -142
  655. package/src/concepts/QueryFromExpression__.ts +246 -254
  656. package/src/concepts/QueryGroupByExpression__.ts +130 -136
  657. package/src/concepts/QueryJoinExpression__.ts +441 -438
  658. package/src/concepts/QueryLimitExpression__.ts +159 -166
  659. package/src/concepts/QueryOrderByExpression__.ts +173 -180
  660. package/src/concepts/QuerySelectExpression__.ts +464 -439
  661. package/src/concepts/Rect__.ts +73 -79
  662. package/src/concepts/Return__.ts +366 -345
  663. package/src/concepts/Role__.ts +146 -147
  664. package/src/concepts/SelectMembers__.ts +358 -350
  665. package/src/concepts/Slot__.ts +152 -153
  666. package/src/concepts/SqlQueryComponent__.ts +230 -228
  667. package/src/concepts/Start__.ts +45 -52
  668. package/src/concepts/StringInterpolation__.ts +323 -296
  669. package/src/concepts/StringLiteral__.ts +113 -115
  670. package/src/concepts/StructureProperty__.ts +306 -295
  671. package/src/concepts/Structure__.ts +615 -578
  672. package/src/concepts/SwitchCase__.ts +326 -290
  673. package/src/concepts/SwitchStatement__.ts +236 -229
  674. package/src/concepts/Theme__.ts +64 -68
  675. package/src/concepts/Transactional__.ts +159 -153
  676. package/src/concepts/TriggerEvent__.ts +285 -274
  677. package/src/concepts/TriggerLauncher__.ts +232 -196
  678. package/src/concepts/TypeAnnotation__.ts +1049 -1011
  679. package/src/concepts/TypeParam__.ts +48 -50
  680. package/src/concepts/UnaryExpression__.ts +163 -153
  681. package/src/concepts/Unparsed__.ts +81 -82
  682. package/src/concepts/UseComponent__.ts +53 -59
  683. package/src/concepts/ValidationRule__.ts +524 -544
  684. package/src/concepts/Variable__.ts +419 -397
  685. package/src/concepts/ViewBlock__.ts +58 -64
  686. package/src/concepts/ViewComponent__.ts +1323 -1261
  687. package/src/concepts/ViewElement__.ts +2538 -2350
  688. package/src/concepts/View__.ts +2447 -2268
  689. package/src/concepts/WhileStatement__.ts +293 -272
  690. package/src/concepts/index__.ts +2 -1
  691. package/src/concepts/types__.ts +123 -121
  692. package/src/decorators/index.ts +75 -77
  693. package/src/decorators/promise.ts +28 -0
  694. package/src/enums/KEYWORDS.ts +1228 -1228
  695. package/src/enums/LEVEL_NAME_MAP.ts +24 -24
  696. package/src/generator/compileComponent.ts +10 -10
  697. package/src/generator/genBundleFiles.ts +300 -291
  698. package/src/generator/genHash.ts +2 -2
  699. package/src/generator/genMetaData.ts +280 -261
  700. package/src/generator/genReleaseBody.ts +312 -291
  701. package/src/generator/icestark.ts +1 -1
  702. package/src/generator/microApp.ts +17 -20
  703. package/src/generator/permission.ts +227 -218
  704. package/src/generator/qiankun.ts +1 -1
  705. package/src/generator/styleReplacer.ts +28 -31
  706. package/src/index.ts +0 -3
  707. package/src/manager/diagnostic.ts +84 -82
  708. package/src/manager/stepRecorder.ts +106 -94
  709. package/src/natural/RequirementAnalyzer.ts +208 -0
  710. package/src/natural/RequirementExecutor.ts +685 -0
  711. package/src/natural/componentData.ts +81 -0
  712. package/src/natural/genNaturalTS.ts +77 -0
  713. package/src/natural/index.ts +4 -0
  714. package/src/natural/knowledgeMap.ts +39 -0
  715. package/src/natural/naslStdlibMap.ts +24 -0
  716. package/src/natural/transformTSCode.ts +692 -0
  717. package/src/sentry/index.ts +109 -104
  718. package/src/server/createUiTs.ts +190 -184
  719. package/src/server/entity2LogicNamespace.ts +379 -359
  720. package/src/server/event.js +145 -145
  721. package/src/server/extendBaseNode.ts +461 -456
  722. package/src/server/formatTsUtils.ts +712 -713
  723. package/src/server/getConnector.ts +33 -33
  724. package/src/server/getExtensionModules.ts +23 -22
  725. package/src/server/getFunctions.ts +6 -6
  726. package/src/server/getInterfaces.ts +38 -37
  727. package/src/server/getLogging.ts +1 -1
  728. package/src/server/getLogics.ts +390 -344
  729. package/src/server/getMemberIdentifier.ts +286 -281
  730. package/src/server/getProcessComponents.ts +2 -2
  731. package/src/server/getProcesses.ts +548 -534
  732. package/src/server/getScope.ts +51 -51
  733. package/src/server/getValidates.ts +3 -3
  734. package/src/server/index.ts +29 -30
  735. package/src/server/naslServer.ts +4302 -4225
  736. package/src/server/naslStdlibMap.ts +43 -41
  737. package/src/server/process2LogicNamespace.ts +97 -97
  738. package/src/server/translator.ts +740 -746
  739. package/src/service/storage/init.ts +761 -728
  740. package/src/templator/genCallComponentLogic.ts +14 -15
  741. package/src/templator/genCreateBlock.ts +257 -229
  742. package/src/templator/genCurdEditMultipleKeyBlock.ts +332 -316
  743. package/src/templator/genCurdMultipleKeyBlock.ts +501 -473
  744. package/src/templator/genEditTableBlock.ts +192 -182
  745. package/src/templator/genEnumSelectBlock.ts +13 -7
  746. package/src/templator/genGetBlock.ts +57 -55
  747. package/src/templator/genGridViewBlock.ts +191 -201
  748. package/src/templator/genListViewBlock.ts +59 -64
  749. package/src/templator/genQueryComponent.ts +337 -287
  750. package/src/templator/genSelectBlock.ts +276 -285
  751. package/src/templator/genTableBlock.ts +157 -160
  752. package/src/templator/genUpdateBlock.ts +269 -255
  753. package/src/templator/index.ts +4 -4
  754. package/src/templator/utils.ts +490 -464
  755. package/src/translator/index.ts +84 -84
  756. package/src/translator/lsp.ts +22 -22
  757. package/src/translator/tsp.ts +6 -6
  758. package/src/utils/index.ts +115 -117
  759. package/src/utils/logger.ts +3 -4
  760. package/src/utils/sortTsString.ts +34 -32
  761. package/src/utils/string.ts +47 -48
  762. package/src/utils/time-slicing.ts +109 -0
  763. package/src/utils/traverse.ts +114 -126
  764. package/test/concepts/match/__snapshots__/toEmbeddedTS.spec.ts.snap +66 -0
  765. package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +40 -0
  766. package/test/concepts/match/constant.ts +5 -0
  767. package/test/concepts/match/fixtures/isExpression.json +259 -0
  768. package/test/concepts/match/fixtures/lastBodyIf.json +268 -0
  769. package/test/concepts/match/fixtures/noExpression.json +176 -0
  770. package/test/concepts/match/toEmbeddedTS.spec.ts +14 -0
  771. package/test/concepts/match/toJS.spec.ts +14 -0
  772. package/test/setup.ts +2 -1
  773. package/ts-worker/src/index.js +0 -2
  774. package/tsconfig.json +21 -21
@@ -1,20 +1,13 @@
1
- type PropertyType = 'structures' | 'enums' | 'entities' | 'interfaces' | 'processes' | 'views';
2
- const moduleNameSpace = {
3
- dependencies: 'extensions',
4
- interfaceDependencies: 'apis',
5
- componentDependencies: 'components',
6
- };
7
- type ModuleKeyType = 'dependencies' | 'interfaceDependencies' | 'componentDependencies';
1
+ import { v4 as uuidv4 } from 'uuid';
8
2
  import ConfigProperty from './ConfigProperty__';
9
- //================================================================================
3
+ //= ===============================================================================
10
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
11
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
12
- //================================================================================
6
+ //= ===============================================================================
13
7
  import { EventPayload, Params } from '../common/EventEmitter';
14
8
  import { concept, excludedInJSON, property } from '../decorators';
15
9
 
16
10
  import * as utils from '../utils';
17
- import { v4 as uuidv4 } from 'uuid';
18
11
  import BaseNode from '../common/BaseNode';
19
12
  import classMap from '../common/classMap';
20
13
  import DataSource from './DataSource__';
@@ -28,2287 +21,2606 @@ import Process from './Process__';
28
21
  import FrontendLibrary from './FrontendLibrary__';
29
22
  import Configuration from './Configuration__';
30
23
  import TriggerLauncher from './TriggerLauncher__';
24
+ import Connection from './Connection__';
31
25
  import App from './App__';
32
26
 
27
+ type PropertyType = 'structures' | 'enums' | 'entities' | 'interfaces' | 'processes' | 'views';
28
+ const moduleNameSpace = {
29
+ dependencies: 'extensions',
30
+ interfaceDependencies: 'apis',
31
+ componentDependencies: 'components',
32
+ };
33
+ type ModuleKeyType = 'dependencies' | 'interfaceDependencies' | 'componentDependencies';
34
+
33
35
  /**
34
36
  * 模块
35
37
  */
36
38
  @concept('模块')
37
39
  export class Module extends BaseNode {
38
- /**
39
- * 产品概念
40
- */
41
- @property()
42
- concept: 'Module' | 'Connector' = 'Module';
43
-
44
- /**
45
- * type
46
- */
47
- @property()
48
- type: 'extension' | 'interface' | 'component' | 'connector' = undefined;
49
-
50
- /**
51
- * version
52
- */
53
- @property()
54
- version: string = undefined;
55
-
56
- /**
57
- * 模块名称
58
- */
59
- @property()
60
- name: string = undefined;
61
-
62
- /**
63
- * 模块标题
64
- */
65
- @property()
66
- title: string = undefined;
67
-
68
- /**
69
- * 模块描述
70
- */
71
- @property()
72
- description: string = undefined;
73
-
74
- /**
75
- * provider
76
- */
77
- @property()
78
- provider: string = undefined;
79
-
80
- /**
81
- * 外部语言依赖
82
- */
83
- @property()
84
- externalDependencyMap: { maven?: Array<{ groupId: string, artifactId: string, version: string }> } = undefined;
85
-
86
- /**
87
- * 外部语言依赖
88
- */
89
- @property()
90
- compilerInfoMap: {
91
- java?: Array<{ packageName: string, className: string, naslName: string, type: string, javaTypes: any }>,
92
- js?: { packageName : string,prefix:string },
93
- } = undefined;
94
-
95
- /**
96
- * 数据源列表
97
- */
98
- @property('DataSource')
99
- dataSources: Array<DataSource> = [];
100
-
101
- /**
102
- * 数据结构列表
103
- */
104
- @property('Structure')
105
- structures: Array<Structure> = [];
106
-
107
- /**
108
- * 枚举列表
109
- */
110
- @property('Enum')
111
- enums: Array<Enum> = [];
112
-
113
- /**
114
- * 逻辑列表
115
- */
116
- @property('Logic')
117
- logics: Array<Logic> = [];
118
-
119
- /**
120
- * 接口列表
121
- */
122
- @property('Interface')
123
- interfaces: Array<Interface> = [];
124
-
125
- /**
126
- * 页面列表
127
- */
128
- @property('View')
129
- views: Array<View> = [];
130
-
131
- /**
132
- * 变量列表
133
- */
134
- @property('Variable')
135
- frontendVariables: Array<Variable> = [];
136
-
137
- /**
138
- * 流程列表
139
- */
140
- @property('Process')
141
- processes: Array<Process> = [];
142
-
143
- /**
144
- * 端包列表
145
- */
146
- @property('FrontendLibrary')
147
- frontends: Array<FrontendLibrary> = [];
148
-
149
- /**
150
- * 配置管理
151
- */
152
- @property('Configuration')
153
- configuration: Configuration = undefined;
154
-
155
- /**
156
- * 触发器启动器列表
157
- */
158
- @property('TriggerLauncher')
159
- triggerLaunchers: Array<TriggerLauncher> = [];
160
-
161
- /**
162
- * 祖先 App
163
- */
164
- get app() {
165
- return this.getAncestor('App') as App;
166
- }
167
-
168
- /**
169
- * @param source 需要合并的部分参数
170
- */
171
- constructor(source?: Partial<Module>) {
172
- source = Object.assign({}, Module.getDefaultOptions(), source);
173
- super(source);
174
- super.subConstructor(source);
175
- }
176
- getClassName() {
177
- return 'Module';
178
- }
179
-
180
- static from(source: any, parentNode?: any, parentKey?: string): Module {
181
- return super.from(source, parentNode, parentKey) as Module;
182
- }
183
-
184
- /**
185
- * 从父级删除该节点
186
- * @internal
187
- */
188
- _delete() {
189
- let params: Params = null;
190
- if (this.parentNode) {
191
- params = (this.parentNode as any)?.__removeModule?.(this);
192
- }
193
- return params;
194
- }
195
-
196
-
197
- getDataSourceExistingNames(excludedList: Array<DataSource> = []) {
198
- const excludedSet = new Set(excludedList);
199
- return ((this.dataSources as DataSource[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
200
- }
201
- getDataSourceUniqueName(name = 'dataSource1') {
202
- return utils.unique(name, this.getDataSourceExistingNames(), undefined, false);
203
- }
204
-
205
- /**
206
- * 插入数据源
207
- * @internal
208
- * @param name 数据源名称,如果不填会自动生成一个唯一名称
209
- */
210
- _insertDataSourceAt(name: string, index: number): DataSource;
211
-
212
- /**
213
- * 插入数据源
214
- * @internal
215
- * @param dataSourceOptions 数据源参数
216
- */
217
- _insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
218
-
219
- /**
220
- * 插入数据源
221
- * @internal
222
- * @param dataSource 已有的数据源实例
223
- */
224
- _insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
225
-
226
- _insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
227
- const dataSourceOptions: any = {};
228
- const relationOptions = { parentNode: this, parentKey: 'dataSources' };
229
- let dataSource: DataSource;
230
- if (!options) {
231
- dataSource = DataSource.from({
232
- ...dataSourceOptions,
233
- name: this.getDataSourceUniqueName(),
234
- }, this, 'dataSources');
235
- } else if (typeof options === 'string') {
236
- dataSource = DataSource.from({
237
- ...dataSourceOptions,
238
- name: options,
239
- }, this, 'dataSources');
240
- } else if (options instanceof DataSource) {
241
- options.ensureDelete(); // 同一实例不支持多处存在
242
- dataSource = options;
243
- Object.assign(dataSource, relationOptions);
244
- } else {
245
- dataSource = DataSource.from({
246
- ...dataSourceOptions,
247
- ...options,
248
- }, this, 'dataSources');
249
- }
250
- this.dataSources.splice(index, 0, dataSource);
251
- return dataSource;
252
- }
253
-
254
- /**
255
- * 插入数据源
256
- * @param name 数据源名称,如果不填会自动生成一个唯一名称
257
- */
258
- insertDataSourceAt(name: string, index: number): DataSource;
259
-
260
- /**
261
- * 插入数据源
262
- * @param dataSourceOptions 数据源参数
263
- */
264
- insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
265
-
266
- /**
267
- * 插入数据源
268
- * @param dataSource 已有的数据源实例
269
- */
270
- insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
271
-
272
- insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
273
- const node = this._insertDataSourceAt(options as any, index);
274
- node.create({
275
- index,
276
- parentNode: this,
277
- parentKey: 'dataSources',
278
- });
279
- return node;
280
- }
281
-
282
- /**
283
- * 添加数据源
284
- * @internal
285
- * @param name 数据源名称,如果不填会自动生成一个唯一名称
286
- */
287
- _addDataSource(name?: string): DataSource;
288
-
289
- /**
290
- * 添加数据源
291
- * @internal
292
- * @param dataSourceOptions 数据源参数
293
- */
294
- _addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
295
-
296
- /**
297
- * 添加数据源
298
- * @internal
299
- * @param dataSource 已有的数据源实例
300
- */
301
- _addDataSource(dataSource: DataSource): DataSource;
302
-
303
- _addDataSource(options?: string | Partial<DataSource> | DataSource) {
304
- const index = 0;
305
- return this._insertDataSourceAt(options as any, index);
306
- }
307
-
308
- /**
309
- * 添加数据源
310
- * @internal
311
- * @param name 数据源名称,如果不填会自动生成一个唯一名称
312
- */
313
- addDataSource(name?: string): DataSource;
314
-
315
- /**
316
- * 添加数据源
317
- * @param dataSourceOptions 数据源参数
318
- */
319
- addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
320
-
321
- /**
322
- * 添加数据源
323
- * @param dataSource 已有的数据源实例
324
- */
325
- addDataSource(dataSource: DataSource): DataSource;
326
-
327
- addDataSource(options?: string | Partial<DataSource> | DataSource) {
328
- const node = this._addDataSource(options as any);
329
- const index = this.dataSources.indexOf(node);
330
- node.create({
331
- index,
332
- parentNode: this,
333
- parentKey: 'dataSources',
334
- });
335
- return node;
336
- }
337
-
338
-
339
- getStructureExistingNames(excludedList: Array<Structure> = []) {
340
- const excludedSet = new Set(excludedList);
341
- return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
342
- }
343
- getStructureUniqueName(name = 'Structure1') {
344
- return utils.unique(name, this.getStructureExistingNames(), undefined, false);
345
- }
346
-
347
- /**
348
- * 插入数据结构
349
- * @internal
350
- * @param name 数据结构名称,如果不填会自动生成一个唯一名称
351
- */
352
- _insertStructureAt(name: string, index: number): Structure;
353
-
354
- /**
355
- * 插入数据结构
356
- * @internal
357
- * @param structureOptions 数据结构参数
358
- */
359
- _insertStructureAt(structureOptions: Partial<Structure>, index: number): Structure;
360
-
361
- /**
362
- * 插入数据结构
363
- * @internal
364
- * @param structure 已有的数据结构实例
365
- */
366
- _insertStructureAt(structure: Structure, index: number): Structure;
367
-
368
- _insertStructureAt(options: string | Partial<Structure> | Structure, index: number) {
369
- const structureOptions: any = {};
370
- const relationOptions = { parentNode: this, parentKey: 'structures' };
371
- let structure: Structure;
372
- if (!options) {
373
- structure = Structure.from({
374
- ...structureOptions,
375
- name: this.getStructureUniqueName(),
376
- }, this, 'structures');
377
- } else if (typeof options === 'string') {
378
- structure = Structure.from({
379
- ...structureOptions,
380
- name: options,
381
- }, this, 'structures');
382
- } else if (options instanceof Structure) {
383
- options.ensureDelete(); // 同一实例不支持多处存在
384
- structure = options;
385
- Object.assign(structure, relationOptions);
386
- } else {
387
- structure = Structure.from({
388
- ...structureOptions,
389
- ...options,
390
- }, this, 'structures');
391
- }
392
- this.structures.splice(index, 0, structure);
393
- return structure;
394
- }
395
-
396
- /**
397
- * 插入数据结构
398
- * @param name 数据结构名称,如果不填会自动生成一个唯一名称
399
- */
400
- insertStructureAt(name: string, index: number): Structure;
401
-
402
- /**
403
- * 插入数据结构
404
- * @param structureOptions 数据结构参数
405
- */
406
- insertStructureAt(structureOptions: Partial<Structure>, index: number): Structure;
407
-
408
- /**
409
- * 插入数据结构
410
- * @param structure 已有的数据结构实例
411
- */
412
- insertStructureAt(structure: Structure, index: number): Structure;
413
-
414
- insertStructureAt(options: string | Partial<Structure> | Structure, index: number) {
415
- const node = this._insertStructureAt(options as any, index);
416
- node.create({
417
- index,
418
- parentNode: this,
419
- parentKey: 'structures',
420
- });
421
- return node;
422
- }
423
-
424
- /**
425
- * 添加数据结构
426
- * @internal
427
- * @param name 数据结构名称,如果不填会自动生成一个唯一名称
428
- */
429
- _addStructure(name?: string): Structure;
430
-
431
- /**
432
- * 添加数据结构
433
- * @internal
434
- * @param structureOptions 数据结构参数
435
- */
436
- _addStructure(structureOptions: Partial<Structure>): Structure;
437
-
438
- /**
439
- * 添加数据结构
440
- * @internal
441
- * @param structure 已有的数据结构实例
442
- */
443
- _addStructure(structure: Structure): Structure;
444
-
445
- _addStructure(options?: string | Partial<Structure> | Structure) {
446
- const index = 0;
447
- return this._insertStructureAt(options as any, index);
448
- }
449
-
450
- /**
451
- * 添加数据结构
452
- * @internal
453
- * @param name 数据结构名称,如果不填会自动生成一个唯一名称
454
- */
455
- addStructure(name?: string): Structure;
456
-
457
- /**
458
- * 添加数据结构
459
- * @param structureOptions 数据结构参数
460
- */
461
- addStructure(structureOptions: Partial<Structure>): Structure;
462
-
463
- /**
464
- * 添加数据结构
465
- * @param structure 已有的数据结构实例
466
- */
467
- addStructure(structure: Structure): Structure;
468
-
469
- addStructure(options?: string | Partial<Structure> | Structure) {
470
- const node = this._addStructure(options as any);
471
- const index = this.structures.indexOf(node);
472
- node.create({
473
- index,
474
- parentNode: this,
475
- parentKey: 'structures',
476
- });
477
- return node;
478
- }
479
-
480
-
481
- getEnumExistingNames(excludedList: Array<Enum> = []) {
482
- const excludedSet = new Set(excludedList);
483
- return ((this.enums as Enum[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
484
- }
485
- getEnumUniqueName(name = 'Enum1') {
486
- return utils.unique(name, this.getEnumExistingNames(), undefined, false);
487
- }
488
-
489
- /**
490
- * 插入枚举
491
- * @internal
492
- * @param name 枚举名称,如果不填会自动生成一个唯一名称
493
- */
494
- _insertEnumAt(name: string, index: number): Enum;
495
-
496
- /**
497
- * 插入枚举
498
- * @internal
499
- * @param enumerationOptions 枚举参数
500
- */
501
- _insertEnumAt(enumerationOptions: Partial<Enum>, index: number): Enum;
502
-
503
- /**
504
- * 插入枚举
505
- * @internal
506
- * @param enumeration 已有的枚举实例
507
- */
508
- _insertEnumAt(enumeration: Enum, index: number): Enum;
509
-
510
- _insertEnumAt(options: string | Partial<Enum> | Enum, index: number) {
511
- const enumerationOptions: any = {};
512
- const relationOptions = { parentNode: this, parentKey: 'enums' };
513
- let enumeration: Enum;
514
- if (!options) {
515
- enumeration = Enum.from({
516
- ...enumerationOptions,
517
- name: this.getEnumUniqueName(),
518
- }, this, 'enums');
519
- } else if (typeof options === 'string') {
520
- enumeration = Enum.from({
521
- ...enumerationOptions,
522
- name: options,
523
- }, this, 'enums');
524
- } else if (options instanceof Enum) {
525
- options.ensureDelete(); // 同一实例不支持多处存在
526
- enumeration = options;
527
- Object.assign(enumeration, relationOptions);
528
- } else {
529
- enumeration = Enum.from({
530
- ...enumerationOptions,
531
- ...options,
532
- }, this, 'enums');
533
- }
534
- this.enums.splice(index, 0, enumeration);
535
- return enumeration;
536
- }
537
-
538
- /**
539
- * 插入枚举
540
- * @param name 枚举名称,如果不填会自动生成一个唯一名称
541
- */
542
- insertEnumAt(name: string, index: number): Enum;
543
-
544
- /**
545
- * 插入枚举
546
- * @param enumerationOptions 枚举参数
547
- */
548
- insertEnumAt(enumerationOptions: Partial<Enum>, index: number): Enum;
549
-
550
- /**
551
- * 插入枚举
552
- * @param enumeration 已有的枚举实例
553
- */
554
- insertEnumAt(enumeration: Enum, index: number): Enum;
555
-
556
- insertEnumAt(options: string | Partial<Enum> | Enum, index: number) {
557
- const node = this._insertEnumAt(options as any, index);
558
- node.create({
559
- index,
560
- parentNode: this,
561
- parentKey: 'enums',
562
- });
563
- return node;
564
- }
565
-
566
- /**
567
- * 添加枚举
568
- * @internal
569
- * @param name 枚举名称,如果不填会自动生成一个唯一名称
570
- */
571
- _addEnum(name?: string): Enum;
572
-
573
- /**
574
- * 添加枚举
575
- * @internal
576
- * @param enumerationOptions 枚举参数
577
- */
578
- _addEnum(enumerationOptions: Partial<Enum>): Enum;
579
-
580
- /**
581
- * 添加枚举
582
- * @internal
583
- * @param enumeration 已有的枚举实例
584
- */
585
- _addEnum(enumeration: Enum): Enum;
586
-
587
- _addEnum(options?: string | Partial<Enum> | Enum) {
588
- const index = 0;
589
- return this._insertEnumAt(options as any, index);
590
- }
591
-
592
- /**
593
- * 添加枚举
594
- * @internal
595
- * @param name 枚举名称,如果不填会自动生成一个唯一名称
596
- */
597
- addEnum(name?: string): Enum;
598
-
599
- /**
600
- * 添加枚举
601
- * @param enumerationOptions 枚举参数
602
- */
603
- addEnum(enumerationOptions: Partial<Enum>): Enum;
604
-
605
- /**
606
- * 添加枚举
607
- * @param enumeration 已有的枚举实例
608
- */
609
- addEnum(enumeration: Enum): Enum;
610
-
611
- addEnum(options?: string | Partial<Enum> | Enum) {
612
- const node = this._addEnum(options as any);
613
- const index = this.enums.indexOf(node);
614
- node.create({
615
- index,
616
- parentNode: this,
617
- parentKey: 'enums',
618
- });
619
- return node;
620
- }
621
-
622
-
623
- getLogicExistingNames(excludedList: Array<Logic> = []) {
624
- const excludedSet = new Set(excludedList);
625
- return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
626
- }
627
- getLogicUniqueName(name = 'logic1') {
628
- return utils.unique(name, this.getLogicExistingNames(), undefined, false);
629
- }
630
-
631
- /**
632
- * 插入逻辑
633
- * @internal
634
- * @param name 逻辑名称,如果不填会自动生成一个唯一名称
635
- */
636
- _insertLogicAt(name: string, index: number): Logic;
637
-
638
- /**
639
- * 插入逻辑
640
- * @internal
641
- * @param logicOptions 逻辑参数
642
- */
643
- _insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
644
-
645
- /**
646
- * 插入逻辑
647
- * @internal
648
- * @param logic 已有的逻辑实例
649
- */
650
- _insertLogicAt(logic: Logic, index: number): Logic;
651
-
652
- _insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
653
- const logicOptions: any = {};
654
- const relationOptions = { parentNode: this, parentKey: 'logics' };
655
- let logic: Logic;
656
- if (!options) {
657
- logic = Logic.from({
658
- ...logicOptions,
659
- name: this.getLogicUniqueName(),
660
- }, this, 'logics');
661
- } else if (typeof options === 'string') {
662
- logic = Logic.from({
663
- ...logicOptions,
664
- name: options,
665
- }, this, 'logics');
666
- } else if (options instanceof Logic) {
667
- options.ensureDelete(); // 同一实例不支持多处存在
668
- logic = options;
669
- Object.assign(logic, relationOptions);
670
- } else {
671
- logic = Logic.from({
672
- ...logicOptions,
673
- ...options,
674
- }, this, 'logics');
675
- }
676
- this.logics.splice(index, 0, logic);
677
- return logic;
678
- }
679
-
680
- /**
681
- * 插入逻辑
682
- * @param name 逻辑名称,如果不填会自动生成一个唯一名称
683
- */
684
- insertLogicAt(name: string, index: number): Logic;
685
-
686
- /**
687
- * 插入逻辑
688
- * @param logicOptions 逻辑参数
689
- */
690
- insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
691
-
692
- /**
693
- * 插入逻辑
694
- * @param logic 已有的逻辑实例
695
- */
696
- insertLogicAt(logic: Logic, index: number): Logic;
697
-
698
- insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
699
- const node = this._insertLogicAt(options as any, index);
700
- node.create({
701
- index,
702
- parentNode: this,
703
- parentKey: 'logics',
704
- });
705
- return node;
706
- }
707
-
708
- /**
709
- * 添加逻辑
710
- * @internal
711
- * @param name 逻辑名称,如果不填会自动生成一个唯一名称
712
- */
713
- _addLogic(name?: string): Logic;
714
-
715
- /**
716
- * 添加逻辑
717
- * @internal
718
- * @param logicOptions 逻辑参数
719
- */
720
- _addLogic(logicOptions: Partial<Logic>): Logic;
721
-
722
- /**
723
- * 添加逻辑
724
- * @internal
725
- * @param logic 已有的逻辑实例
726
- */
727
- _addLogic(logic: Logic): Logic;
728
-
729
- _addLogic(options?: string | Partial<Logic> | Logic) {
730
- const index = 0;
731
- return this._insertLogicAt(options as any, index);
732
- }
733
-
734
- /**
735
- * 添加逻辑
736
- * @internal
737
- * @param name 逻辑名称,如果不填会自动生成一个唯一名称
738
- */
739
- addLogic(name?: string): Logic;
740
-
741
- /**
742
- * 添加逻辑
743
- * @param logicOptions 逻辑参数
744
- */
745
- addLogic(logicOptions: Partial<Logic>): Logic;
746
-
747
- /**
748
- * 添加逻辑
749
- * @param logic 已有的逻辑实例
750
- */
751
- addLogic(logic: Logic): Logic;
752
-
753
- addLogic(options?: string | Partial<Logic> | Logic) {
754
- const node = this._addLogic(options as any);
755
- const index = this.logics.indexOf(node);
756
- node.create({
757
- index,
758
- parentNode: this,
759
- parentKey: 'logics',
760
- });
761
- return node;
762
- }
763
-
764
-
765
- getInterfaceExistingNames(excludedList: Array<Interface> = []) {
766
- const excludedSet = new Set(excludedList);
767
- return ((this.interfaces as Interface[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
768
- }
769
- getInterfaceUniqueName(name = 'Interface1') {
770
- return utils.unique(name, this.getInterfaceExistingNames(), undefined, false);
771
- }
772
-
773
- /**
774
- * 插入接口
775
- * @internal
776
- * @param name 接口名称,如果不填会自动生成一个唯一名称
777
- */
778
- _insertInterfaceAt(name: string, index: number): Interface;
779
-
780
- /**
781
- * 插入接口
782
- * @internal
783
- * @param itfaceOptions 接口参数
784
- */
785
- _insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
786
-
787
- /**
788
- * 插入接口
789
- * @internal
790
- * @param itface 已有的接口实例
791
- */
792
- _insertInterfaceAt(itface: Interface, index: number): Interface;
793
-
794
- _insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
795
- const itfaceOptions: any = {};
796
- const relationOptions = { parentNode: this, parentKey: 'interfaces' };
797
- let itface: Interface;
798
- if (!options) {
799
- itface = Interface.from({
800
- ...itfaceOptions,
801
- name: this.getInterfaceUniqueName(),
802
- }, this, 'interfaces');
803
- } else if (typeof options === 'string') {
804
- itface = Interface.from({
805
- ...itfaceOptions,
806
- name: options,
807
- }, this, 'interfaces');
808
- } else if (options instanceof Interface) {
809
- options.ensureDelete(); // 同一实例不支持多处存在
810
- itface = options;
811
- Object.assign(itface, relationOptions);
812
- } else {
813
- itface = Interface.from({
814
- ...itfaceOptions,
815
- ...options,
816
- }, this, 'interfaces');
817
- }
818
- this.interfaces.splice(index, 0, itface);
819
- return itface;
820
- }
821
-
822
- /**
823
- * 插入接口
824
- * @param name 接口名称,如果不填会自动生成一个唯一名称
825
- */
826
- insertInterfaceAt(name: string, index: number): Interface;
827
-
828
- /**
829
- * 插入接口
830
- * @param itfaceOptions 接口参数
831
- */
832
- insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
833
-
834
- /**
835
- * 插入接口
836
- * @param itface 已有的接口实例
837
- */
838
- insertInterfaceAt(itface: Interface, index: number): Interface;
839
-
840
- insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
841
- const node = this._insertInterfaceAt(options as any, index);
842
- node.create({
843
- index,
844
- parentNode: this,
845
- parentKey: 'interfaces',
846
- });
847
- return node;
848
- }
849
-
850
- /**
851
- * 添加接口
852
- * @internal
853
- * @param name 接口名称,如果不填会自动生成一个唯一名称
854
- */
855
- _addInterface(name?: string): Interface;
856
-
857
- /**
858
- * 添加接口
859
- * @internal
860
- * @param itfaceOptions 接口参数
861
- */
862
- _addInterface(itfaceOptions: Partial<Interface>): Interface;
863
-
864
- /**
865
- * 添加接口
866
- * @internal
867
- * @param itface 已有的接口实例
868
- */
869
- _addInterface(itface: Interface): Interface;
870
-
871
- _addInterface(options?: string | Partial<Interface> | Interface) {
872
- const index = 0;
873
- return this._insertInterfaceAt(options as any, index);
874
- }
875
-
876
- /**
877
- * 添加接口
878
- * @internal
879
- * @param name 接口名称,如果不填会自动生成一个唯一名称
880
- */
881
- addInterface(name?: string): Interface;
882
-
883
- /**
884
- * 添加接口
885
- * @param itfaceOptions 接口参数
886
- */
887
- addInterface(itfaceOptions: Partial<Interface>): Interface;
888
-
889
- /**
890
- * 添加接口
891
- * @param itface 已有的接口实例
892
- */
893
- addInterface(itface: Interface): Interface;
894
-
895
- addInterface(options?: string | Partial<Interface> | Interface) {
896
- const node = this._addInterface(options as any);
897
- const index = this.interfaces.indexOf(node);
898
- node.create({
899
- index,
900
- parentNode: this,
901
- parentKey: 'interfaces',
902
- });
903
- return node;
904
- }
905
-
906
-
907
- getViewExistingNames(excludedList: Array<View> = []) {
908
- const excludedSet = new Set(excludedList);
909
- return ((this.views as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
910
- }
911
- getViewUniqueName(name = 'view1') {
912
- return utils.unique(name, this.getViewExistingNames(), undefined, false);
913
- }
914
-
915
- /**
916
- * 插入页面
917
- * @internal
918
- * @param name 页面名称,如果不填会自动生成一个唯一名称
919
- */
920
- _insertViewAt(name: string, index: number): View;
921
-
922
- /**
923
- * 插入页面
924
- * @internal
925
- * @param viewOptions 页面参数
926
- */
927
- _insertViewAt(viewOptions: Partial<View>, index: number): View;
928
-
929
- /**
930
- * 插入页面
931
- * @internal
932
- * @param view 已有的页面实例
933
- */
934
- _insertViewAt(view: View, index: number): View;
935
-
936
- _insertViewAt(options: string | Partial<View> | View, index: number) {
937
- const viewOptions: any = {};
938
- const relationOptions = { parentNode: this, parentKey: 'views' };
939
- let view: View;
940
- if (!options) {
941
- view = View.from({
942
- ...viewOptions,
943
- name: this.getViewUniqueName(),
944
- }, this, 'views');
945
- } else if (typeof options === 'string') {
946
- view = View.from({
947
- ...viewOptions,
948
- name: options,
949
- }, this, 'views');
950
- } else if (options instanceof View) {
951
- options.ensureDelete(); // 同一实例不支持多处存在
952
- view = options;
953
- Object.assign(view, relationOptions);
954
- } else {
955
- view = View.from({
956
- ...viewOptions,
957
- ...options,
958
- }, this, 'views');
959
- }
960
- this.views.splice(index, 0, view);
961
- return view;
962
- }
963
-
964
- /**
965
- * 插入页面
966
- * @param name 页面名称,如果不填会自动生成一个唯一名称
967
- */
968
- insertViewAt(name: string, index: number): View;
969
-
970
- /**
971
- * 插入页面
972
- * @param viewOptions 页面参数
973
- */
974
- insertViewAt(viewOptions: Partial<View>, index: number): View;
975
-
976
- /**
977
- * 插入页面
978
- * @param view 已有的页面实例
979
- */
980
- insertViewAt(view: View, index: number): View;
981
-
982
- insertViewAt(options: string | Partial<View> | View, index: number) {
983
- const node = this._insertViewAt(options as any, index);
984
- node.create({
985
- index,
986
- parentNode: this,
987
- parentKey: 'views',
988
- });
989
- return node;
990
- }
991
-
992
- /**
993
- * 添加页面
994
- * @internal
995
- * @param name 页面名称,如果不填会自动生成一个唯一名称
996
- */
997
- _addView(name?: string): View;
998
-
999
- /**
1000
- * 添加页面
1001
- * @internal
1002
- * @param viewOptions 页面参数
1003
- */
1004
- _addView(viewOptions: Partial<View>): View;
1005
-
1006
- /**
1007
- * 添加页面
1008
- * @internal
1009
- * @param view 已有的页面实例
1010
- */
1011
- _addView(view: View): View;
1012
-
1013
- _addView(options?: string | Partial<View> | View) {
1014
- const index = this.views.length;
1015
- return this._insertViewAt(options as any, index);
1016
- }
1017
-
1018
- /**
1019
- * 添加页面
1020
- * @internal
1021
- * @param name 页面名称,如果不填会自动生成一个唯一名称
1022
- */
1023
- addView(name?: string): View;
1024
-
1025
- /**
1026
- * 添加页面
1027
- * @param viewOptions 页面参数
1028
- */
1029
- addView(viewOptions: Partial<View>): View;
1030
-
1031
- /**
1032
- * 添加页面
1033
- * @param view 已有的页面实例
1034
- */
1035
- addView(view: View): View;
1036
-
1037
- addView(options?: string | Partial<View> | View) {
1038
- const node = this._addView(options as any);
1039
- const index = this.views.indexOf(node);
1040
- node.create({
1041
- index,
1042
- parentNode: this,
1043
- parentKey: 'views',
1044
- });
1045
- return node;
1046
- }
1047
-
1048
-
1049
- getVarExistingNames(excludedList: Array<Variable> = []) {
1050
- const excludedSet = new Set(excludedList);
1051
- return ((this.frontendVariables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1052
- }
1053
- getVariableUniqueName(name = 'variable1') {
1054
- return utils.unique(name, this.getVarExistingNames(), undefined, true);
1055
- }
1056
-
1057
- /**
1058
- * 插入变量
1059
- * @internal
1060
- * @param name 变量名称,如果不填会自动生成一个唯一名称
1061
- */
1062
- _insertVariableAt(name: string, index: number): Variable;
1063
-
1064
- /**
1065
- * 插入变量
1066
- * @internal
1067
- * @param variableOptions 变量参数
1068
- */
1069
- _insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
1070
-
1071
- /**
1072
- * 插入变量
1073
- * @internal
1074
- * @param variable 已有的变量实例
1075
- */
1076
- _insertVariableAt(variable: Variable, index: number): Variable;
1077
-
1078
- _insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1079
- const variableOptions: any = {};
1080
- const relationOptions = { parentNode: this, parentKey: 'frontendVariables' };
1081
- let variable: Variable;
1082
- if (!options) {
1083
- variable = Variable.from({
1084
- ...variableOptions,
1085
- name: this.getVariableUniqueName(),
1086
- }, this, 'frontendVariables');
1087
- } else if (typeof options === 'string') {
1088
- variable = Variable.from({
1089
- ...variableOptions,
1090
- name: options,
1091
- }, this, 'frontendVariables');
1092
- } else if (options instanceof Variable) {
1093
- options.ensureDelete(); // 同一实例不支持多处存在
1094
- variable = options;
1095
- Object.assign(variable, relationOptions);
1096
- } else {
1097
- variable = Variable.from({
1098
- ...variableOptions,
1099
- ...options,
1100
- }, this, 'frontendVariables');
1101
- }
1102
- this.frontendVariables.splice(index, 0, variable);
1103
- return variable;
1104
- }
1105
-
1106
- /**
1107
- * 插入变量
1108
- * @param name 变量名称,如果不填会自动生成一个唯一名称
1109
- */
1110
- insertVariableAt(name: string, index: number): Variable;
1111
-
1112
- /**
1113
- * 插入变量
1114
- * @param variableOptions 变量参数
1115
- */
1116
- insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
1117
-
1118
- /**
1119
- * 插入变量
1120
- * @param variable 已有的变量实例
1121
- */
1122
- insertVariableAt(variable: Variable, index: number): Variable;
1123
-
1124
- insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1125
- const node = this._insertVariableAt(options as any, index);
1126
- node.create({
1127
- index,
1128
- parentNode: this,
1129
- parentKey: 'frontendVariables',
1130
- });
1131
- return node;
1132
- }
1133
-
1134
- /**
1135
- * 添加变量
1136
- * @internal
1137
- * @param name 变量名称,如果不填会自动生成一个唯一名称
1138
- */
1139
- _addVariable(name?: string): Variable;
1140
-
1141
- /**
1142
- * 添加变量
1143
- * @internal
1144
- * @param variableOptions 变量参数
1145
- */
1146
- _addVariable(variableOptions: Partial<Variable>): Variable;
1147
-
1148
- /**
1149
- * 添加变量
1150
- * @internal
1151
- * @param variable 已有的变量实例
1152
- */
1153
- _addVariable(variable: Variable): Variable;
1154
-
1155
- _addVariable(options?: string | Partial<Variable> | Variable) {
1156
- const index = this.frontendVariables.length;
1157
- return this._insertVariableAt(options as any, index);
1158
- }
1159
-
1160
- /**
1161
- * 添加变量
1162
- * @internal
1163
- * @param name 变量名称,如果不填会自动生成一个唯一名称
1164
- */
1165
- addVariable(name?: string): Variable;
1166
-
1167
- /**
1168
- * 添加变量
1169
- * @param variableOptions 变量参数
1170
- */
1171
- addVariable(variableOptions: Partial<Variable>): Variable;
1172
-
1173
- /**
1174
- * 添加变量
1175
- * @param variable 已有的变量实例
1176
- */
1177
- addVariable(variable: Variable): Variable;
1178
-
1179
- addVariable(options?: string | Partial<Variable> | Variable) {
1180
- const node = this._addVariable(options as any);
1181
- const index = this.frontendVariables.indexOf(node);
1182
- node.create({
1183
- index,
1184
- parentNode: this,
1185
- parentKey: 'frontendVariables',
1186
- });
1187
- return node;
1188
- }
1189
-
1190
-
1191
- getProcessExistingNames(excludedList: Array<Process> = []) {
1192
- const excludedSet = new Set(excludedList);
1193
- return ((this.processes as Process[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1194
- }
1195
- getProcessUniqueName(name = 'Process1') {
1196
- return utils.unique(name, this.getProcessExistingNames(), undefined, false);
1197
- }
1198
-
1199
- /**
1200
- * 插入流程
1201
- * @internal
1202
- * @param name 流程名称,如果不填会自动生成一个唯一名称
1203
- */
1204
- _insertProcessAt(name: string, index: number): Process;
1205
-
1206
- /**
1207
- * 插入流程
1208
- * @internal
1209
- * @param processOptions 流程参数
1210
- */
1211
- _insertProcessAt(processOptions: Partial<Process>, index: number): Process;
1212
-
1213
- /**
1214
- * 插入流程
1215
- * @internal
1216
- * @param process 已有的流程实例
1217
- */
1218
- _insertProcessAt(process: Process, index: number): Process;
1219
-
1220
- _insertProcessAt(options: string | Partial<Process> | Process, index: number) {
1221
- const processOptions: any = {};
1222
- const relationOptions = { parentNode: this, parentKey: 'processes' };
1223
- let process: Process;
1224
- if (!options) {
1225
- process = Process.from({
1226
- ...processOptions,
1227
- name: this.getProcessUniqueName(),
1228
- }, this, 'processes');
1229
- } else if (typeof options === 'string') {
1230
- process = Process.from({
1231
- ...processOptions,
1232
- name: options,
1233
- }, this, 'processes');
1234
- } else if (options instanceof Process) {
1235
- options.ensureDelete(); // 同一实例不支持多处存在
1236
- process = options;
1237
- Object.assign(process, relationOptions);
1238
- } else {
1239
- process = Process.from({
1240
- ...processOptions,
1241
- ...options,
1242
- }, this, 'processes');
1243
- }
1244
- this.processes.splice(index, 0, process);
1245
- return process;
1246
- }
1247
-
1248
- /**
1249
- * 插入流程
1250
- * @param name 流程名称,如果不填会自动生成一个唯一名称
1251
- */
1252
- insertProcessAt(name: string, index: number): Process;
1253
-
1254
- /**
1255
- * 插入流程
1256
- * @param processOptions 流程参数
1257
- */
1258
- insertProcessAt(processOptions: Partial<Process>, index: number): Process;
1259
-
1260
- /**
1261
- * 插入流程
1262
- * @param process 已有的流程实例
1263
- */
1264
- insertProcessAt(process: Process, index: number): Process;
1265
-
1266
- insertProcessAt(options: string | Partial<Process> | Process, index: number) {
1267
- const node = this._insertProcessAt(options as any, index);
1268
- node.create({
1269
- index,
1270
- parentNode: this,
1271
- parentKey: 'processes',
1272
- });
1273
- return node;
1274
- }
1275
-
1276
- /**
1277
- * 添加流程
1278
- * @internal
1279
- * @param name 流程名称,如果不填会自动生成一个唯一名称
1280
- */
1281
- _addProcess(name?: string): Process;
1282
-
1283
- /**
1284
- * 添加流程
1285
- * @internal
1286
- * @param processOptions 流程参数
1287
- */
1288
- _addProcess(processOptions: Partial<Process>): Process;
1289
-
1290
- /**
1291
- * 添加流程
1292
- * @internal
1293
- * @param process 已有的流程实例
1294
- */
1295
- _addProcess(process: Process): Process;
1296
-
1297
- _addProcess(options?: string | Partial<Process> | Process) {
1298
- const index = 0;
1299
- return this._insertProcessAt(options as any, index);
1300
- }
1301
-
1302
- /**
1303
- * 添加流程
1304
- * @internal
1305
- * @param name 流程名称,如果不填会自动生成一个唯一名称
1306
- */
1307
- addProcess(name?: string): Process;
1308
-
1309
- /**
1310
- * 添加流程
1311
- * @param processOptions 流程参数
1312
- */
1313
- addProcess(processOptions: Partial<Process>): Process;
1314
-
1315
- /**
1316
- * 添加流程
1317
- * @param process 已有的流程实例
1318
- */
1319
- addProcess(process: Process): Process;
1320
-
1321
- addProcess(options?: string | Partial<Process> | Process) {
1322
- const node = this._addProcess(options as any);
1323
- const index = this.processes.indexOf(node);
1324
- node.create({
1325
- index,
1326
- parentNode: this,
1327
- parentKey: 'processes',
1328
- });
1329
- return node;
1330
- }
1331
-
1332
-
1333
- getFrontendLibraryExistingNames(excludedList: Array<FrontendLibrary> = []) {
1334
- const excludedSet = new Set(excludedList);
1335
- return ((this.frontends as FrontendLibrary[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1336
- }
1337
- getFrontendLibraryUniqueName(name = 'frontendLibrary1') {
1338
- return utils.unique(name, this.getFrontendLibraryExistingNames(), undefined, false);
1339
- }
1340
-
1341
- /**
1342
- * 插入端包
1343
- * @internal
1344
- * @param name 端包名称,如果不填会自动生成一个唯一名称
1345
- */
1346
- _insertFrontendLibraryAt(name: string, index: number): FrontendLibrary;
1347
-
1348
- /**
1349
- * 插入端包
1350
- * @internal
1351
- * @param frontendLibraryOptions 端包参数
1352
- */
1353
- _insertFrontendLibraryAt(frontendLibraryOptions: Partial<FrontendLibrary>, index: number): FrontendLibrary;
1354
-
1355
- /**
1356
- * 插入端包
1357
- * @internal
1358
- * @param frontendLibrary 已有的端包实例
1359
- */
1360
- _insertFrontendLibraryAt(frontendLibrary: FrontendLibrary, index: number): FrontendLibrary;
1361
-
1362
- _insertFrontendLibraryAt(options: string | Partial<FrontendLibrary> | FrontendLibrary, index: number) {
1363
- const frontendLibraryOptions: any = {};
1364
- const relationOptions = { parentNode: this, parentKey: 'frontends' };
1365
- let frontendLibrary: FrontendLibrary;
1366
- if (!options) {
1367
- frontendLibrary = FrontendLibrary.from({
1368
- ...frontendLibraryOptions,
1369
- name: this.getFrontendLibraryUniqueName(),
1370
- }, this, 'frontends');
1371
- } else if (typeof options === 'string') {
1372
- frontendLibrary = FrontendLibrary.from({
1373
- ...frontendLibraryOptions,
1374
- name: options,
1375
- }, this, 'frontends');
1376
- } else if (options instanceof FrontendLibrary) {
1377
- options.ensureDelete(); // 同一实例不支持多处存在
1378
- frontendLibrary = options;
1379
- Object.assign(frontendLibrary, relationOptions);
1380
- } else {
1381
- frontendLibrary = FrontendLibrary.from({
1382
- ...frontendLibraryOptions,
1383
- ...options,
1384
- }, this, 'frontends');
1385
- }
1386
- this.frontends.splice(index, 0, frontendLibrary);
1387
- return frontendLibrary;
1388
- }
1389
-
1390
- /**
1391
- * 插入端包
1392
- * @param name 端包名称,如果不填会自动生成一个唯一名称
1393
- */
1394
- insertFrontendLibraryAt(name: string, index: number): FrontendLibrary;
1395
-
1396
- /**
1397
- * 插入端包
1398
- * @param frontendLibraryOptions 端包参数
1399
- */
1400
- insertFrontendLibraryAt(frontendLibraryOptions: Partial<FrontendLibrary>, index: number): FrontendLibrary;
1401
-
1402
- /**
1403
- * 插入端包
1404
- * @param frontendLibrary 已有的端包实例
1405
- */
1406
- insertFrontendLibraryAt(frontendLibrary: FrontendLibrary, index: number): FrontendLibrary;
1407
-
1408
- insertFrontendLibraryAt(options: string | Partial<FrontendLibrary> | FrontendLibrary, index: number) {
1409
- const node = this._insertFrontendLibraryAt(options as any, index);
1410
- node.create({
1411
- index,
1412
- parentNode: this,
1413
- parentKey: 'frontends',
1414
- });
1415
- return node;
1416
- }
1417
-
1418
- /**
1419
- * 添加端包
1420
- * @internal
1421
- * @param name 端包名称,如果不填会自动生成一个唯一名称
1422
- */
1423
- _addFrontendLibrary(name?: string): FrontendLibrary;
1424
-
1425
- /**
1426
- * 添加端包
1427
- * @internal
1428
- * @param frontendLibraryOptions 端包参数
1429
- */
1430
- _addFrontendLibrary(frontendLibraryOptions: Partial<FrontendLibrary>): FrontendLibrary;
1431
-
1432
- /**
1433
- * 添加端包
1434
- * @internal
1435
- * @param frontendLibrary 已有的端包实例
1436
- */
1437
- _addFrontendLibrary(frontendLibrary: FrontendLibrary): FrontendLibrary;
1438
-
1439
- _addFrontendLibrary(options?: string | Partial<FrontendLibrary> | FrontendLibrary) {
1440
- const index = this.frontends.length;
1441
- return this._insertFrontendLibraryAt(options as any, index);
1442
- }
1443
-
1444
- /**
1445
- * 添加端包
1446
- * @internal
1447
- * @param name 端包名称,如果不填会自动生成一个唯一名称
1448
- */
1449
- addFrontendLibrary(name?: string): FrontendLibrary;
1450
-
1451
- /**
1452
- * 添加端包
1453
- * @param frontendLibraryOptions 端包参数
1454
- */
1455
- addFrontendLibrary(frontendLibraryOptions: Partial<FrontendLibrary>): FrontendLibrary;
1456
-
1457
- /**
1458
- * 添加端包
1459
- * @param frontendLibrary 已有的端包实例
1460
- */
1461
- addFrontendLibrary(frontendLibrary: FrontendLibrary): FrontendLibrary;
1462
-
1463
- addFrontendLibrary(options?: string | Partial<FrontendLibrary> | FrontendLibrary) {
1464
- const node = this._addFrontendLibrary(options as any);
1465
- const index = this.frontends.indexOf(node);
1466
- node.create({
1467
- index,
1468
- parentNode: this,
1469
- parentKey: 'frontends',
1470
- });
1471
- return node;
1472
- }
1473
-
1474
-
1475
-
1476
- getTriggerLauncherExistingNames(excludedList: Array<TriggerLauncher> = []) {
1477
- const excludedSet = new Set(excludedList);
1478
- return ((this.triggerLaunchers as TriggerLauncher[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1479
- }
1480
- getTriggerLauncherUniqueName(name = 'triggerLauncher1') {
1481
- return utils.unique(name, this.getTriggerLauncherExistingNames(), undefined, false);
1482
- }
1483
-
1484
- /**
1485
- * 插入触发器启动器
1486
- * @internal
1487
- * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1488
- */
1489
- _insertTriggerLauncherAt(name: string, index: number): TriggerLauncher;
1490
-
1491
- /**
1492
- * 插入触发器启动器
1493
- * @internal
1494
- * @param triggerLauncherOptions 触发器启动器参数
1495
- */
1496
- _insertTriggerLauncherAt(triggerLauncherOptions: Partial<TriggerLauncher>, index: number): TriggerLauncher;
1497
-
1498
- /**
1499
- * 插入触发器启动器
1500
- * @internal
1501
- * @param triggerLauncher 已有的触发器启动器实例
1502
- */
1503
- _insertTriggerLauncherAt(triggerLauncher: TriggerLauncher, index: number): TriggerLauncher;
1504
-
1505
- _insertTriggerLauncherAt(options: string | Partial<TriggerLauncher> | TriggerLauncher, index: number) {
1506
- const triggerLauncherOptions: any = {};
1507
- const relationOptions = { parentNode: this, parentKey: 'triggerLaunchers' };
1508
- let triggerLauncher: TriggerLauncher;
1509
- if (!options) {
1510
- triggerLauncher = TriggerLauncher.from({
1511
- ...triggerLauncherOptions,
1512
- name: this.getTriggerLauncherUniqueName(),
1513
- }, this, 'triggerLaunchers');
1514
- } else if (typeof options === 'string') {
1515
- triggerLauncher = TriggerLauncher.from({
1516
- ...triggerLauncherOptions,
1517
- name: options,
1518
- }, this, 'triggerLaunchers');
1519
- } else if (options instanceof TriggerLauncher) {
1520
- options.ensureDelete(); // 同一实例不支持多处存在
1521
- triggerLauncher = options;
1522
- Object.assign(triggerLauncher, relationOptions);
1523
- } else {
1524
- triggerLauncher = TriggerLauncher.from({
1525
- ...triggerLauncherOptions,
1526
- ...options,
1527
- }, this, 'triggerLaunchers');
1528
- }
1529
- this.triggerLaunchers.splice(index, 0, triggerLauncher);
1530
- return triggerLauncher;
1531
- }
1532
-
1533
- /**
1534
- * 插入触发器启动器
1535
- * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1536
- */
1537
- insertTriggerLauncherAt(name: string, index: number): TriggerLauncher;
1538
-
1539
- /**
1540
- * 插入触发器启动器
1541
- * @param triggerLauncherOptions 触发器启动器参数
1542
- */
1543
- insertTriggerLauncherAt(triggerLauncherOptions: Partial<TriggerLauncher>, index: number): TriggerLauncher;
1544
-
1545
- /**
1546
- * 插入触发器启动器
1547
- * @param triggerLauncher 已有的触发器启动器实例
1548
- */
1549
- insertTriggerLauncherAt(triggerLauncher: TriggerLauncher, index: number): TriggerLauncher;
1550
-
1551
- insertTriggerLauncherAt(options: string | Partial<TriggerLauncher> | TriggerLauncher, index: number) {
1552
- const node = this._insertTriggerLauncherAt(options as any, index);
1553
- node.create({
1554
- index,
1555
- parentNode: this,
1556
- parentKey: 'triggerLaunchers',
1557
- });
1558
- return node;
1559
- }
1560
-
1561
- /**
1562
- * 添加触发器启动器
1563
- * @internal
1564
- * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1565
- */
1566
- _addTriggerLauncher(name?: string): TriggerLauncher;
1567
-
1568
- /**
1569
- * 添加触发器启动器
1570
- * @internal
1571
- * @param triggerLauncherOptions 触发器启动器参数
1572
- */
1573
- _addTriggerLauncher(triggerLauncherOptions: Partial<TriggerLauncher>): TriggerLauncher;
1574
-
1575
- /**
1576
- * 添加触发器启动器
1577
- * @internal
1578
- * @param triggerLauncher 已有的触发器启动器实例
1579
- */
1580
- _addTriggerLauncher(triggerLauncher: TriggerLauncher): TriggerLauncher;
1581
-
1582
- _addTriggerLauncher(options?: string | Partial<TriggerLauncher> | TriggerLauncher) {
1583
- const index = 0;
1584
- return this._insertTriggerLauncherAt(options as any, index);
1585
- }
1586
-
1587
- /**
1588
- * 添加触发器启动器
1589
- * @internal
1590
- * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1591
- */
1592
- addTriggerLauncher(name?: string): TriggerLauncher;
1593
-
1594
- /**
1595
- * 添加触发器启动器
1596
- * @param triggerLauncherOptions 触发器启动器参数
1597
- */
1598
- addTriggerLauncher(triggerLauncherOptions: Partial<TriggerLauncher>): TriggerLauncher;
1599
-
1600
- /**
1601
- * 添加触发器启动器
1602
- * @param triggerLauncher 已有的触发器启动器实例
1603
- */
1604
- addTriggerLauncher(triggerLauncher: TriggerLauncher): TriggerLauncher;
1605
-
1606
- addTriggerLauncher(options?: string | Partial<TriggerLauncher> | TriggerLauncher) {
1607
- const node = this._addTriggerLauncher(options as any);
1608
- const index = this.triggerLaunchers.indexOf(node);
1609
- node.create({
1610
- index,
1611
- parentNode: this,
1612
- parentKey: 'triggerLaunchers',
1613
- });
1614
- return node;
1615
- }
1616
-
1617
-
1618
-
1619
-
1620
- /**
1621
- * 删除数据源
1622
- * @param name 数据源名称
1623
- */
1624
- removeDataSource(name: string): void;
1625
-
1626
- /**
1627
- * 删除数据源
1628
- * @param dataSource 已有的数据源实例
1629
- */
1630
- removeDataSource(dataSource: DataSource): void;
1631
-
1632
- removeDataSource(options: string | DataSource) {
1633
- let dataSource: DataSource;
1634
- if (typeof options === 'string') {
1635
- dataSource = (this.dataSources as DataSource[]).find((item) => item.name === options);
1636
- if (!dataSource) {
1637
- throw new Error('找不到数据源 ' + options);
1638
- }
1639
- } else {
1640
- dataSource = options;
1641
- }
1642
- return dataSource.delete();
1643
- }
1644
-
1645
- __removeDataSource(dataSource: DataSource) {
1646
- const parentKey = dataSource.parentKey;
1647
- const params: Params = {
1648
- parentNode: this,
1649
- parentKey,
1650
- index: -1,
1651
- object: null,
1652
- oldObject: dataSource,
1653
- };
1654
- if (parentKey) {
1655
- params.parentKey = parentKey;
1656
- if (Array.isArray((this as any)[parentKey])) {
1657
- const index = (this as any)[parentKey].indexOf(dataSource);
1658
- ~index && (this as any)[parentKey].splice(index, 1);
1659
- params.index = index;
1660
- } else if ((this as any)[parentKey] === dataSource) {
1661
- params.index = 0;
1662
- (this as any)[parentKey] = undefined;
1663
- }
1664
- }
1665
- return params;
1666
- }
1667
-
1668
-
1669
-
1670
- /**
1671
- * 删除数据结构
1672
- * @param name 数据结构名称
1673
- */
1674
- removeStructure(name: string): void;
1675
-
1676
- /**
1677
- * 删除数据结构
1678
- * @param structure 已有的数据结构实例
1679
- */
1680
- removeStructure(structure: Structure): void;
1681
-
1682
- removeStructure(options: string | Structure) {
1683
- let structure: Structure;
1684
- if (typeof options === 'string') {
1685
- structure = (this.structures as Structure[]).find((item) => item.name === options);
1686
- if (!structure) {
1687
- throw new Error('找不到数据结构 ' + options);
1688
- }
1689
- } else {
1690
- structure = options;
1691
- }
1692
- return structure.delete();
1693
- }
1694
-
1695
- __removeStructure(structure: Structure) {
1696
- const parentKey = structure.parentKey;
1697
- const params: Params = {
1698
- parentNode: this,
1699
- parentKey,
1700
- index: -1,
1701
- object: null,
1702
- oldObject: structure,
1703
- };
1704
- if (parentKey) {
1705
- params.parentKey = parentKey;
1706
- if (Array.isArray((this as any)[parentKey])) {
1707
- const index = (this as any)[parentKey].indexOf(structure);
1708
- ~index && (this as any)[parentKey].splice(index, 1);
1709
- params.index = index;
1710
- } else if ((this as any)[parentKey] === structure) {
1711
- params.index = 0;
1712
- (this as any)[parentKey] = undefined;
1713
- }
1714
- }
1715
- return params;
1716
- }
1717
-
1718
-
1719
-
1720
- /**
1721
- * 删除枚举
1722
- * @param name 枚举名称
1723
- */
1724
- removeEnum(name: string): void;
1725
-
1726
- /**
1727
- * 删除枚举
1728
- * @param enumeration 已有的枚举实例
1729
- */
1730
- removeEnum(enumeration: Enum): void;
1731
-
1732
- removeEnum(options: string | Enum) {
1733
- let enumeration: Enum;
1734
- if (typeof options === 'string') {
1735
- enumeration = (this.enums as Enum[]).find((item) => item.name === options);
1736
- if (!enumeration) {
1737
- throw new Error('找不到枚举 ' + options);
1738
- }
1739
- } else {
1740
- enumeration = options;
1741
- }
1742
- return enumeration.delete();
1743
- }
1744
-
1745
- __removeEnum(enumeration: Enum) {
1746
- const parentKey = enumeration.parentKey;
1747
- const params: Params = {
1748
- parentNode: this,
1749
- parentKey,
1750
- index: -1,
1751
- object: null,
1752
- oldObject: enumeration,
1753
- };
1754
- if (parentKey) {
1755
- params.parentKey = parentKey;
1756
- if (Array.isArray((this as any)[parentKey])) {
1757
- const index = (this as any)[parentKey].indexOf(enumeration);
1758
- ~index && (this as any)[parentKey].splice(index, 1);
1759
- params.index = index;
1760
- } else if ((this as any)[parentKey] === enumeration) {
1761
- params.index = 0;
1762
- (this as any)[parentKey] = undefined;
1763
- }
1764
- }
1765
- return params;
1766
- }
1767
-
1768
-
1769
-
1770
- /**
1771
- * 删除逻辑
1772
- * @param name 逻辑名称
1773
- */
1774
- removeLogic(name: string): void;
1775
-
1776
- /**
1777
- * 删除逻辑
1778
- * @param logic 已有的逻辑实例
1779
- */
1780
- removeLogic(logic: Logic): void;
1781
-
1782
- removeLogic(options: string | Logic) {
1783
- let logic: Logic;
1784
- if (typeof options === 'string') {
1785
- logic = (this.logics as Logic[]).find((item) => item.name === options);
1786
- if (!logic) {
1787
- throw new Error('找不到逻辑 ' + options);
1788
- }
1789
- } else {
1790
- logic = options;
1791
- }
1792
- return logic.delete();
1793
- }
1794
-
1795
- __removeLogic(logic: Logic) {
1796
- const parentKey = logic.parentKey;
1797
- const params: Params = {
1798
- parentNode: this,
1799
- parentKey,
1800
- index: -1,
1801
- object: null,
1802
- oldObject: logic,
1803
- };
1804
- if (parentKey) {
1805
- params.parentKey = parentKey;
1806
- if (Array.isArray((this as any)[parentKey])) {
1807
- const index = (this as any)[parentKey].indexOf(logic);
1808
- ~index && (this as any)[parentKey].splice(index, 1);
1809
- params.index = index;
1810
- } else if ((this as any)[parentKey] === logic) {
1811
- params.index = 0;
1812
- (this as any)[parentKey] = undefined;
1813
- }
1814
- }
1815
- return params;
1816
- }
1817
-
1818
-
1819
-
1820
- /**
1821
- * 删除接口
1822
- * @param name 接口名称
1823
- */
1824
- removeInterface(name: string): void;
1825
-
1826
- /**
1827
- * 删除接口
1828
- * @param itface 已有的接口实例
1829
- */
1830
- removeInterface(itface: Interface): void;
1831
-
1832
- removeInterface(options: string | Interface) {
1833
- let itface: Interface;
1834
- if (typeof options === 'string') {
1835
- itface = (this.interfaces as Interface[]).find((item) => item.name === options);
1836
- if (!itface) {
1837
- throw new Error('找不到接口 ' + options);
1838
- }
1839
- } else {
1840
- itface = options;
1841
- }
1842
- return itface.delete();
1843
- }
1844
-
1845
- __removeInterface(itface: Interface) {
1846
- const parentKey = itface.parentKey;
1847
- const params: Params = {
1848
- parentNode: this,
1849
- parentKey,
1850
- index: -1,
1851
- object: null,
1852
- oldObject: itface,
1853
- };
1854
- if (parentKey) {
1855
- params.parentKey = parentKey;
1856
- if (Array.isArray((this as any)[parentKey])) {
1857
- const index = (this as any)[parentKey].indexOf(itface);
1858
- ~index && (this as any)[parentKey].splice(index, 1);
1859
- params.index = index;
1860
- } else if ((this as any)[parentKey] === itface) {
1861
- params.index = 0;
1862
- (this as any)[parentKey] = undefined;
1863
- }
1864
- }
1865
- return params;
1866
- }
1867
-
1868
-
1869
-
1870
- /**
1871
- * 删除页面
1872
- * @param name 页面名称
1873
- */
1874
- removeView(name: string): void;
1875
-
1876
- /**
1877
- * 删除页面
1878
- * @param view 已有的页面实例
1879
- */
1880
- removeView(view: View): void;
1881
-
1882
- removeView(options: string | View) {
1883
- let view: View;
1884
- if (typeof options === 'string') {
1885
- view = (this.views as View[]).find((item) => item.name === options);
1886
- if (!view) {
1887
- throw new Error('找不到页面 ' + options);
1888
- }
1889
- } else {
1890
- view = options;
1891
- }
1892
- return view.delete();
1893
- }
1894
-
1895
- __removeView(view: View) {
1896
- const parentKey = view.parentKey;
1897
- const params: Params = {
1898
- parentNode: this,
1899
- parentKey,
1900
- index: -1,
1901
- object: null,
1902
- oldObject: view,
1903
- };
1904
- if (parentKey) {
1905
- params.parentKey = parentKey;
1906
- if (Array.isArray((this as any)[parentKey])) {
1907
- const index = (this as any)[parentKey].indexOf(view);
1908
- ~index && (this as any)[parentKey].splice(index, 1);
1909
- params.index = index;
1910
- } else if ((this as any)[parentKey] === view) {
1911
- params.index = 0;
1912
- (this as any)[parentKey] = undefined;
1913
- }
1914
- }
1915
- return params;
1916
- }
1917
-
1918
-
1919
-
1920
- /**
1921
- * 删除变量
1922
- * @param name 变量名称
1923
- */
1924
- removeVariable(name: string): void;
1925
-
1926
- /**
1927
- * 删除变量
1928
- * @param variable 已有的变量实例
1929
- */
1930
- removeVariable(variable: Variable): void;
1931
-
1932
- removeVariable(options: string | Variable) {
1933
- let variable: Variable;
1934
- if (typeof options === 'string') {
1935
- variable = (this.frontendVariables as Variable[]).find((item) => item.name === options);
1936
- if (!variable) {
1937
- throw new Error('找不到变量 ' + options);
1938
- }
1939
- } else {
1940
- variable = options;
1941
- }
1942
- return variable.delete();
1943
- }
1944
-
1945
- __removeVariable(variable: Variable) {
1946
- const parentKey = variable.parentKey;
1947
- const params: Params = {
1948
- parentNode: this,
1949
- parentKey,
1950
- index: -1,
1951
- object: null,
1952
- oldObject: variable,
1953
- };
1954
- if (parentKey) {
1955
- params.parentKey = parentKey;
1956
- if (Array.isArray((this as any)[parentKey])) {
1957
- const index = (this as any)[parentKey].indexOf(variable);
1958
- ~index && (this as any)[parentKey].splice(index, 1);
1959
- params.index = index;
1960
- } else if ((this as any)[parentKey] === variable) {
1961
- params.index = 0;
1962
- (this as any)[parentKey] = undefined;
1963
- }
1964
- }
1965
- return params;
1966
- }
1967
-
1968
-
1969
-
1970
- /**
1971
- * 删除流程
1972
- * @param name 流程名称
1973
- */
1974
- removeProcess(name: string): void;
1975
-
1976
- /**
1977
- * 删除流程
1978
- * @param process 已有的流程实例
1979
- */
1980
- removeProcess(process: Process): void;
1981
-
1982
- removeProcess(options: string | Process) {
1983
- let process: Process;
1984
- if (typeof options === 'string') {
1985
- process = (this.processes as Process[]).find((item) => item.name === options);
1986
- if (!process) {
1987
- throw new Error('找不到流程 ' + options);
1988
- }
1989
- } else {
1990
- process = options;
1991
- }
1992
- return process.delete();
1993
- }
1994
-
1995
- __removeProcess(process: Process) {
1996
- const parentKey = process.parentKey;
1997
- const params: Params = {
1998
- parentNode: this,
1999
- parentKey,
2000
- index: -1,
2001
- object: null,
2002
- oldObject: process,
2003
- };
2004
- if (parentKey) {
2005
- params.parentKey = parentKey;
2006
- if (Array.isArray((this as any)[parentKey])) {
2007
- const index = (this as any)[parentKey].indexOf(process);
2008
- ~index && (this as any)[parentKey].splice(index, 1);
2009
- params.index = index;
2010
- } else if ((this as any)[parentKey] === process) {
2011
- params.index = 0;
2012
- (this as any)[parentKey] = undefined;
2013
- }
2014
- }
2015
- return params;
2016
- }
2017
-
2018
-
2019
-
2020
- /**
2021
- * 删除端包
2022
- * @param name 端包名称
2023
- */
2024
- removeFrontendLibrary(name: string): void;
2025
-
2026
- /**
2027
- * 删除端包
2028
- * @param frontendLibrary 已有的端包实例
2029
- */
2030
- removeFrontendLibrary(frontendLibrary: FrontendLibrary): void;
2031
-
2032
- removeFrontendLibrary(options: string | FrontendLibrary) {
2033
- let frontendLibrary: FrontendLibrary;
2034
- if (typeof options === 'string') {
2035
- frontendLibrary = (this.frontends as FrontendLibrary[]).find((item) => item.name === options);
2036
- if (!frontendLibrary) {
2037
- throw new Error('找不到端包 ' + options);
2038
- }
2039
- } else {
2040
- frontendLibrary = options;
2041
- }
2042
- return frontendLibrary.delete();
2043
- }
2044
-
2045
- __removeFrontendLibrary(frontendLibrary: FrontendLibrary) {
2046
- const parentKey = frontendLibrary.parentKey;
2047
- const params: Params = {
2048
- parentNode: this,
2049
- parentKey,
2050
- index: -1,
2051
- object: null,
2052
- oldObject: frontendLibrary,
2053
- };
2054
- if (parentKey) {
2055
- params.parentKey = parentKey;
2056
- if (Array.isArray((this as any)[parentKey])) {
2057
- const index = (this as any)[parentKey].indexOf(frontendLibrary);
2058
- ~index && (this as any)[parentKey].splice(index, 1);
2059
- params.index = index;
2060
- } else if ((this as any)[parentKey] === frontendLibrary) {
2061
- params.index = 0;
2062
- (this as any)[parentKey] = undefined;
2063
- }
2064
- }
2065
- return params;
2066
- }
2067
-
2068
-
2069
-
2070
- /**
2071
- * 删除配置管理
2072
- * @param name 配置管理名称
2073
- */
2074
- removeConfiguration(name: string): void;
2075
-
2076
- /**
2077
- * 删除配置管理
2078
- * @param configuration 已有的配置管理实例
2079
- */
2080
- removeConfiguration(configuration: Configuration): void;
2081
-
2082
- removeConfiguration(options: string | Configuration) {
2083
- let configuration: Configuration;
2084
- if (typeof options === 'string') {
2085
- configuration = this.configuration;
2086
- if (!configuration) {
2087
- throw new Error('找不到配置管理 ' + options);
2088
- }
2089
- } else {
2090
- configuration = options;
2091
- }
2092
- return configuration.delete();
2093
- }
2094
-
2095
- __removeConfiguration(configuration: Configuration) {
2096
- const parentKey = configuration.parentKey;
2097
- const params: Params = {
2098
- parentNode: this,
2099
- parentKey,
2100
- index: -1,
2101
- object: null,
2102
- oldObject: configuration,
2103
- };
2104
- if (parentKey) {
2105
- params.parentKey = parentKey;
2106
- if (Array.isArray((this as any)[parentKey])) {
2107
- const index = (this as any)[parentKey].indexOf(configuration);
2108
- ~index && (this as any)[parentKey].splice(index, 1);
2109
- params.index = index;
2110
- } else if ((this as any)[parentKey] === configuration) {
2111
- params.index = 0;
2112
- (this as any)[parentKey] = undefined;
2113
- }
2114
- }
2115
- return params;
2116
- }
2117
-
2118
-
2119
-
2120
- /**
2121
- * 删除触发器启动器
2122
- * @param name 触发器启动器名称
2123
- */
2124
- removeTriggerLauncher(name: string): void;
2125
-
2126
- /**
2127
- * 删除触发器启动器
2128
- * @param triggerLauncher 已有的触发器启动器实例
2129
- */
2130
- removeTriggerLauncher(triggerLauncher: TriggerLauncher): void;
2131
-
2132
- removeTriggerLauncher(options: string | TriggerLauncher) {
2133
- let triggerLauncher: TriggerLauncher;
2134
- if (typeof options === 'string') {
2135
- triggerLauncher = (this.triggerLaunchers as TriggerLauncher[]).find((item) => item.name === options);
2136
- if (!triggerLauncher) {
2137
- throw new Error('找不到触发器启动器 ' + options);
2138
- }
2139
- } else {
2140
- triggerLauncher = options;
2141
- }
2142
- return triggerLauncher.delete();
2143
- }
2144
-
2145
- __removeTriggerLauncher(triggerLauncher: TriggerLauncher) {
2146
- const parentKey = triggerLauncher.parentKey;
2147
- const params: Params = {
2148
- parentNode: this,
2149
- parentKey,
2150
- index: -1,
2151
- object: null,
2152
- oldObject: triggerLauncher,
2153
- };
2154
- if (parentKey) {
2155
- params.parentKey = parentKey;
2156
- if (Array.isArray((this as any)[parentKey])) {
2157
- const index = (this as any)[parentKey].indexOf(triggerLauncher);
2158
- ~index && (this as any)[parentKey].splice(index, 1);
2159
- params.index = index;
2160
- } else if ((this as any)[parentKey] === triggerLauncher) {
2161
- params.index = 0;
2162
- (this as any)[parentKey] = undefined;
2163
- }
2164
- }
2165
- return params;
2166
- }
2167
-
2168
- //================================================================================
2169
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2170
- // 自动生成的代码已结束。下面可以手动编写。
2171
- //================================================================================
2172
- /**
2173
- * 用于区分存量应用新导入模块,存量应用替换数据结构使用
2174
- */
2175
- @property()
2176
- isAdd: boolean;
2177
-
2178
- /**
2179
- * 是否启动
2180
- */
2181
- @property()
2182
- enable: boolean;
2183
-
2184
- /**
2185
- * 依赖列表
2186
- */
2187
- @property()
2188
- dependencies: Array<string> = [];
2189
-
2190
- setIsAdd(isAdd: boolean) {
2191
- const object = {
2192
- isAdd,
2193
- };
2194
- this.update({
2195
- ...object,
40
+ /**
41
+ * 产品概念
42
+ */
43
+ @property()
44
+ concept: 'Module' | 'Connector' = 'Module';
45
+
46
+ /**
47
+ * type
48
+ */
49
+ @property()
50
+ type: 'extension' | 'interface' | 'component' | 'connector' = undefined;
51
+
52
+ /**
53
+ * version
54
+ */
55
+ @property()
56
+ version: string = undefined;
57
+
58
+ /**
59
+ * 模块名称
60
+ */
61
+ @property()
62
+ name: string = undefined;
63
+
64
+ /**
65
+ * 模块标题
66
+ */
67
+ @property()
68
+ title: string = undefined;
69
+
70
+ /**
71
+ * 模块描述
72
+ */
73
+ @property()
74
+ description: string = undefined;
75
+
76
+ /**
77
+ * provider
78
+ */
79
+ @property()
80
+ provider: string = undefined;
81
+
82
+ /**
83
+ * 外部语言依赖
84
+ */
85
+ @property()
86
+ externalDependencyMap: { maven?: Array<{ groupId: string; artifactId: string; version: string }> } = undefined;
87
+
88
+ /**
89
+ * 外部语言依赖
90
+ */
91
+ @property()
92
+ compilerInfoMap: {
93
+ java?: Array<{ packageName: string; className: string; naslName: string; type: string; javaTypes: any }>;
94
+ js?: { prefix: string };
95
+ } = undefined;
96
+
97
+ /**
98
+ * 数据源列表
99
+ */
100
+ @property('DataSource')
101
+ dataSources: Array<DataSource> = [];
102
+
103
+ /**
104
+ * 数据结构列表
105
+ */
106
+ @property('Structure')
107
+ structures: Array<Structure> = [];
108
+
109
+ /**
110
+ * 枚举列表
111
+ */
112
+ @property('Enum')
113
+ enums: Array<Enum> = [];
114
+
115
+ /**
116
+ * 逻辑列表
117
+ */
118
+ @property('Logic')
119
+ logics: Array<Logic> = [];
120
+
121
+ /**
122
+ * 接口列表
123
+ */
124
+ @property('Interface')
125
+ interfaces: Array<Interface> = [];
126
+
127
+ /**
128
+ * 页面列表
129
+ */
130
+ @property('View')
131
+ views: Array<View> = [];
132
+
133
+ /**
134
+ * 变量列表
135
+ */
136
+ @property('Variable')
137
+ frontendVariables: Array<Variable> = [];
138
+
139
+ /**
140
+ * 流程列表
141
+ */
142
+ @property('Process')
143
+ processes: Array<Process> = [];
144
+
145
+ /**
146
+ * 端包列表
147
+ */
148
+ @property('FrontendLibrary')
149
+ frontends: Array<FrontendLibrary> = [];
150
+
151
+ /**
152
+ * 配置管理
153
+ */
154
+ @property('Configuration')
155
+ configuration: Configuration = undefined;
156
+
157
+ /**
158
+ * 触发器启动器列表
159
+ */
160
+ @property('TriggerLauncher')
161
+ triggerLaunchers: Array<TriggerLauncher> = [];
162
+
163
+ /**
164
+ * 连接列表
165
+ */
166
+ @property('Connection')
167
+ connections: Array<Connection> = [];
168
+
169
+ /**
170
+ * 祖先 App
171
+ */
172
+ get app() {
173
+ return this.getAncestor('App') as App;
174
+ }
175
+
176
+ /**
177
+ * @param source 需要合并的部分参数
178
+ */
179
+ constructor(source?: Partial<Module>) {
180
+ // @ts-ignore
181
+ source = { ...Module.getDefaultOptions(), ...source };
182
+ super(source);
183
+ super.subConstructor(source);
184
+ }
185
+
186
+ getClassName() {
187
+ return 'Module';
188
+ }
189
+
190
+ static from(source: any, parentNode?: any, parentKey?: string): Module {
191
+ return super.from(source, parentNode, parentKey) as Module;
192
+ }
193
+
194
+ /**
195
+ * 从父级删除该节点
196
+ * @internal
197
+ */
198
+ _delete() {
199
+ let params: Params = null;
200
+ if (this.parentNode) {
201
+ params = (this.parentNode as any)?.__removeModule?.(this);
202
+ }
203
+ return params;
204
+ }
205
+
206
+ getDataSourceExistingNames(excludedList: Array<DataSource> = []) {
207
+ const excludedSet = new Set(excludedList);
208
+ return ((this.dataSources as DataSource[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
209
+ }
210
+
211
+ getDataSourceUniqueName(name = 'dataSource1') {
212
+ return utils.unique(name, this.getDataSourceExistingNames(), undefined, false);
213
+ }
214
+
215
+ /**
216
+ * 插入数据源
217
+ * @internal
218
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
219
+ */
220
+ _insertDataSourceAt(name: string, index: number): DataSource;
221
+
222
+ /**
223
+ * 插入数据源
224
+ * @internal
225
+ * @param dataSourceOptions 数据源参数
226
+ */
227
+ _insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
228
+
229
+ /**
230
+ * 插入数据源
231
+ * @internal
232
+ * @param dataSource 已有的数据源实例
233
+ */
234
+ _insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
235
+
236
+ _insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
237
+ const dataSourceOptions: any = {};
238
+ const relationOptions = { parentNode: this, parentKey: 'dataSources' };
239
+ let dataSource: DataSource;
240
+ if (!options) {
241
+ dataSource = DataSource.from(
242
+ {
243
+ ...dataSourceOptions,
244
+ name: this.getDataSourceUniqueName(),
245
+ },
246
+ this,
247
+ 'dataSources'
248
+ );
249
+ } else if (typeof options === 'string') {
250
+ dataSource = DataSource.from(
251
+ {
252
+ ...dataSourceOptions,
253
+ name: options,
254
+ },
255
+ this,
256
+ 'dataSources'
257
+ );
258
+ } else if (options instanceof DataSource) {
259
+ options.ensureDelete(); // 同一实例不支持多处存在
260
+ dataSource = options;
261
+ Object.assign(dataSource, relationOptions);
262
+ } else {
263
+ dataSource = DataSource.from(
264
+ {
265
+ ...dataSourceOptions,
266
+ ...options,
267
+ },
268
+ this,
269
+ 'dataSources'
270
+ );
271
+ }
272
+ this.dataSources.splice(index, 0, dataSource);
273
+ return dataSource;
274
+ }
275
+
276
+ /**
277
+ * 插入数据源
278
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
279
+ */
280
+ insertDataSourceAt(name: string, index: number): DataSource;
281
+
282
+ /**
283
+ * 插入数据源
284
+ * @param dataSourceOptions 数据源参数
285
+ */
286
+ insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
287
+
288
+ /**
289
+ * 插入数据源
290
+ * @param dataSource 已有的数据源实例
291
+ */
292
+ insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
293
+
294
+ insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
295
+ const node = this._insertDataSourceAt(options as any, index);
296
+ node.create({
297
+ index,
298
+ parentNode: this,
299
+ parentKey: 'dataSources',
300
+ });
301
+ return node;
302
+ }
303
+
304
+ /**
305
+ * 添加数据源
306
+ * @internal
307
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
308
+ */
309
+ _addDataSource(name?: string): DataSource;
310
+
311
+ /**
312
+ * 添加数据源
313
+ * @internal
314
+ * @param dataSourceOptions 数据源参数
315
+ */
316
+ _addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
317
+
318
+ /**
319
+ * 添加数据源
320
+ * @internal
321
+ * @param dataSource 已有的数据源实例
322
+ */
323
+ _addDataSource(dataSource: DataSource): DataSource;
324
+
325
+ _addDataSource(options?: string | Partial<DataSource> | DataSource) {
326
+ const index = 0;
327
+ return this._insertDataSourceAt(options as any, index);
328
+ }
329
+
330
+ /**
331
+ * 添加数据源
332
+ * @internal
333
+ * @param name 数据源名称,如果不填会自动生成一个唯一名称
334
+ */
335
+ addDataSource(name?: string): DataSource;
336
+
337
+ /**
338
+ * 添加数据源
339
+ * @param dataSourceOptions 数据源参数
340
+ */
341
+ addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
342
+
343
+ /**
344
+ * 添加数据源
345
+ * @param dataSource 已有的数据源实例
346
+ */
347
+ addDataSource(dataSource: DataSource): DataSource;
348
+
349
+ addDataSource(options?: string | Partial<DataSource> | DataSource) {
350
+ const node = this._addDataSource(options as any);
351
+ const index = this.dataSources.indexOf(node);
352
+ node.create({
353
+ index,
354
+ parentNode: this,
355
+ parentKey: 'dataSources',
356
+ });
357
+ return node;
358
+ }
359
+
360
+ getStructureExistingNames(excludedList: Array<Structure> = []) {
361
+ const excludedSet = new Set(excludedList);
362
+ return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
363
+ }
364
+
365
+ getStructureUniqueName(name = 'Structure1') {
366
+ return utils.unique(name, this.getStructureExistingNames(), undefined, false);
367
+ }
368
+
369
+ /**
370
+ * 插入数据结构
371
+ * @internal
372
+ * @param name 数据结构名称,如果不填会自动生成一个唯一名称
373
+ */
374
+ _insertStructureAt(name: string, index: number): Structure;
375
+
376
+ /**
377
+ * 插入数据结构
378
+ * @internal
379
+ * @param structureOptions 数据结构参数
380
+ */
381
+ _insertStructureAt(structureOptions: Partial<Structure>, index: number): Structure;
382
+
383
+ /**
384
+ * 插入数据结构
385
+ * @internal
386
+ * @param structure 已有的数据结构实例
387
+ */
388
+ _insertStructureAt(structure: Structure, index: number): Structure;
389
+
390
+ _insertStructureAt(options: string | Partial<Structure> | Structure, index: number) {
391
+ const structureOptions: any = {};
392
+ const relationOptions = { parentNode: this, parentKey: 'structures' };
393
+ let structure: Structure;
394
+ if (!options) {
395
+ structure = Structure.from(
396
+ {
397
+ ...structureOptions,
398
+ name: this.getStructureUniqueName(),
399
+ },
400
+ this,
401
+ 'structures'
402
+ );
403
+ } else if (typeof options === 'string') {
404
+ structure = Structure.from(
405
+ {
406
+ ...structureOptions,
407
+ name: options,
408
+ },
409
+ this,
410
+ 'structures'
411
+ );
412
+ } else if (options instanceof Structure) {
413
+ options.ensureDelete(); // 同一实例不支持多处存在
414
+ structure = options;
415
+ Object.assign(structure, relationOptions);
416
+ } else {
417
+ structure = Structure.from(
418
+ {
419
+ ...structureOptions,
420
+ ...options,
421
+ },
422
+ this,
423
+ 'structures'
424
+ );
425
+ }
426
+ this.structures.splice(index, 0, structure);
427
+ return structure;
428
+ }
429
+
430
+ /**
431
+ * 插入数据结构
432
+ * @param name 数据结构名称,如果不填会自动生成一个唯一名称
433
+ */
434
+ insertStructureAt(name: string, index: number): Structure;
435
+
436
+ /**
437
+ * 插入数据结构
438
+ * @param structureOptions 数据结构参数
439
+ */
440
+ insertStructureAt(structureOptions: Partial<Structure>, index: number): Structure;
441
+
442
+ /**
443
+ * 插入数据结构
444
+ * @param structure 已有的数据结构实例
445
+ */
446
+ insertStructureAt(structure: Structure, index: number): Structure;
447
+
448
+ insertStructureAt(options: string | Partial<Structure> | Structure, index: number) {
449
+ const node = this._insertStructureAt(options as any, index);
450
+ node.create({
451
+ index,
452
+ parentNode: this,
453
+ parentKey: 'structures',
454
+ });
455
+ return node;
456
+ }
457
+
458
+ /**
459
+ * 添加数据结构
460
+ * @internal
461
+ * @param name 数据结构名称,如果不填会自动生成一个唯一名称
462
+ */
463
+ _addStructure(name?: string): Structure;
464
+
465
+ /**
466
+ * 添加数据结构
467
+ * @internal
468
+ * @param structureOptions 数据结构参数
469
+ */
470
+ _addStructure(structureOptions: Partial<Structure>): Structure;
471
+
472
+ /**
473
+ * 添加数据结构
474
+ * @internal
475
+ * @param structure 已有的数据结构实例
476
+ */
477
+ _addStructure(structure: Structure): Structure;
478
+
479
+ _addStructure(options?: string | Partial<Structure> | Structure) {
480
+ const index = 0;
481
+ return this._insertStructureAt(options as any, index);
482
+ }
483
+
484
+ /**
485
+ * 添加数据结构
486
+ * @internal
487
+ * @param name 数据结构名称,如果不填会自动生成一个唯一名称
488
+ */
489
+ addStructure(name?: string): Structure;
490
+
491
+ /**
492
+ * 添加数据结构
493
+ * @param structureOptions 数据结构参数
494
+ */
495
+ addStructure(structureOptions: Partial<Structure>): Structure;
496
+
497
+ /**
498
+ * 添加数据结构
499
+ * @param structure 已有的数据结构实例
500
+ */
501
+ addStructure(structure: Structure): Structure;
502
+
503
+ addStructure(options?: string | Partial<Structure> | Structure) {
504
+ const node = this._addStructure(options as any);
505
+ const index = this.structures.indexOf(node);
506
+ node.create({
507
+ index,
508
+ parentNode: this,
509
+ parentKey: 'structures',
510
+ });
511
+ return node;
512
+ }
513
+
514
+ getEnumExistingNames(excludedList: Array<Enum> = []) {
515
+ const excludedSet = new Set(excludedList);
516
+ return ((this.enums as Enum[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
517
+ }
518
+
519
+ getEnumUniqueName(name = 'Enum1') {
520
+ return utils.unique(name, this.getEnumExistingNames(), undefined, false);
521
+ }
522
+
523
+ /**
524
+ * 插入枚举
525
+ * @internal
526
+ * @param name 枚举名称,如果不填会自动生成一个唯一名称
527
+ */
528
+ _insertEnumAt(name: string, index: number): Enum;
529
+
530
+ /**
531
+ * 插入枚举
532
+ * @internal
533
+ * @param enumerationOptions 枚举参数
534
+ */
535
+ _insertEnumAt(enumerationOptions: Partial<Enum>, index: number): Enum;
536
+
537
+ /**
538
+ * 插入枚举
539
+ * @internal
540
+ * @param enumeration 已有的枚举实例
541
+ */
542
+ _insertEnumAt(enumeration: Enum, index: number): Enum;
543
+
544
+ _insertEnumAt(options: string | Partial<Enum> | Enum, index: number) {
545
+ const enumerationOptions: any = {};
546
+ const relationOptions = { parentNode: this, parentKey: 'enums' };
547
+ let enumeration: Enum;
548
+ if (!options) {
549
+ enumeration = Enum.from(
550
+ {
551
+ ...enumerationOptions,
552
+ name: this.getEnumUniqueName(),
553
+ },
554
+ this,
555
+ 'enums'
556
+ );
557
+ } else if (typeof options === 'string') {
558
+ enumeration = Enum.from(
559
+ {
560
+ ...enumerationOptions,
561
+ name: options,
562
+ },
563
+ this,
564
+ 'enums'
565
+ );
566
+ } else if (options instanceof Enum) {
567
+ options.ensureDelete(); // 同一实例不支持多处存在
568
+ enumeration = options;
569
+ Object.assign(enumeration, relationOptions);
570
+ } else {
571
+ enumeration = Enum.from(
572
+ {
573
+ ...enumerationOptions,
574
+ ...options,
575
+ },
576
+ this,
577
+ 'enums'
578
+ );
579
+ }
580
+ this.enums.splice(index, 0, enumeration);
581
+ return enumeration;
582
+ }
583
+
584
+ /**
585
+ * 插入枚举
586
+ * @param name 枚举名称,如果不填会自动生成一个唯一名称
587
+ */
588
+ insertEnumAt(name: string, index: number): Enum;
589
+
590
+ /**
591
+ * 插入枚举
592
+ * @param enumerationOptions 枚举参数
593
+ */
594
+ insertEnumAt(enumerationOptions: Partial<Enum>, index: number): Enum;
595
+
596
+ /**
597
+ * 插入枚举
598
+ * @param enumeration 已有的枚举实例
599
+ */
600
+ insertEnumAt(enumeration: Enum, index: number): Enum;
601
+
602
+ insertEnumAt(options: string | Partial<Enum> | Enum, index: number) {
603
+ const node = this._insertEnumAt(options as any, index);
604
+ node.create({
605
+ index,
606
+ parentNode: this,
607
+ parentKey: 'enums',
608
+ });
609
+ return node;
610
+ }
611
+
612
+ /**
613
+ * 添加枚举
614
+ * @internal
615
+ * @param name 枚举名称,如果不填会自动生成一个唯一名称
616
+ */
617
+ _addEnum(name?: string): Enum;
618
+
619
+ /**
620
+ * 添加枚举
621
+ * @internal
622
+ * @param enumerationOptions 枚举参数
623
+ */
624
+ _addEnum(enumerationOptions: Partial<Enum>): Enum;
625
+
626
+ /**
627
+ * 添加枚举
628
+ * @internal
629
+ * @param enumeration 已有的枚举实例
630
+ */
631
+ _addEnum(enumeration: Enum): Enum;
632
+
633
+ _addEnum(options?: string | Partial<Enum> | Enum) {
634
+ const index = 0;
635
+ return this._insertEnumAt(options as any, index);
636
+ }
637
+
638
+ /**
639
+ * 添加枚举
640
+ * @internal
641
+ * @param name 枚举名称,如果不填会自动生成一个唯一名称
642
+ */
643
+ addEnum(name?: string): Enum;
644
+
645
+ /**
646
+ * 添加枚举
647
+ * @param enumerationOptions 枚举参数
648
+ */
649
+ addEnum(enumerationOptions: Partial<Enum>): Enum;
650
+
651
+ /**
652
+ * 添加枚举
653
+ * @param enumeration 已有的枚举实例
654
+ */
655
+ addEnum(enumeration: Enum): Enum;
656
+
657
+ addEnum(options?: string | Partial<Enum> | Enum) {
658
+ const node = this._addEnum(options as any);
659
+ const index = this.enums.indexOf(node);
660
+ node.create({
661
+ index,
662
+ parentNode: this,
663
+ parentKey: 'enums',
664
+ });
665
+ return node;
666
+ }
667
+
668
+ getLogicExistingNames(excludedList: Array<Logic> = []) {
669
+ const excludedSet = new Set(excludedList);
670
+ return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
671
+ }
672
+
673
+ getLogicUniqueName(name = 'logic1') {
674
+ return utils.unique(name, this.getLogicExistingNames(), undefined, false);
675
+ }
676
+
677
+ /**
678
+ * 插入逻辑
679
+ * @internal
680
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
681
+ */
682
+ _insertLogicAt(name: string, index: number): Logic;
683
+
684
+ /**
685
+ * 插入逻辑
686
+ * @internal
687
+ * @param logicOptions 逻辑参数
688
+ */
689
+ _insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
690
+
691
+ /**
692
+ * 插入逻辑
693
+ * @internal
694
+ * @param logic 已有的逻辑实例
695
+ */
696
+ _insertLogicAt(logic: Logic, index: number): Logic;
697
+
698
+ _insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
699
+ const logicOptions: any = {};
700
+ const relationOptions = { parentNode: this, parentKey: 'logics' };
701
+ let logic: Logic;
702
+ if (!options) {
703
+ logic = Logic.from(
704
+ {
705
+ ...logicOptions,
706
+ name: this.getLogicUniqueName(),
707
+ },
708
+ this,
709
+ 'logics'
710
+ );
711
+ } else if (typeof options === 'string') {
712
+ logic = Logic.from(
713
+ {
714
+ ...logicOptions,
715
+ name: options,
716
+ },
717
+ this,
718
+ 'logics'
719
+ );
720
+ } else if (options instanceof Logic) {
721
+ options.ensureDelete(); // 同一实例不支持多处存在
722
+ logic = options;
723
+ Object.assign(logic, relationOptions);
724
+ } else {
725
+ logic = Logic.from(
726
+ {
727
+ ...logicOptions,
728
+ ...options,
729
+ },
730
+ this,
731
+ 'logics'
732
+ );
733
+ }
734
+ this.logics.splice(index, 0, logic);
735
+ return logic;
736
+ }
737
+
738
+ /**
739
+ * 插入逻辑
740
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
741
+ */
742
+ insertLogicAt(name: string, index: number): Logic;
743
+
744
+ /**
745
+ * 插入逻辑
746
+ * @param logicOptions 逻辑参数
747
+ */
748
+ insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
749
+
750
+ /**
751
+ * 插入逻辑
752
+ * @param logic 已有的逻辑实例
753
+ */
754
+ insertLogicAt(logic: Logic, index: number): Logic;
755
+
756
+ insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
757
+ const node = this._insertLogicAt(options as any, index);
758
+ node.create({
759
+ index,
760
+ parentNode: this,
761
+ parentKey: 'logics',
762
+ });
763
+ return node;
764
+ }
765
+
766
+ /**
767
+ * 添加逻辑
768
+ * @internal
769
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
770
+ */
771
+ _addLogic(name?: string): Logic;
772
+
773
+ /**
774
+ * 添加逻辑
775
+ * @internal
776
+ * @param logicOptions 逻辑参数
777
+ */
778
+ _addLogic(logicOptions: Partial<Logic>): Logic;
779
+
780
+ /**
781
+ * 添加逻辑
782
+ * @internal
783
+ * @param logic 已有的逻辑实例
784
+ */
785
+ _addLogic(logic: Logic): Logic;
786
+
787
+ _addLogic(options?: string | Partial<Logic> | Logic) {
788
+ const index = 0;
789
+ return this._insertLogicAt(options as any, index);
790
+ }
791
+
792
+ /**
793
+ * 添加逻辑
794
+ * @internal
795
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
796
+ */
797
+ addLogic(name?: string): Logic;
798
+
799
+ /**
800
+ * 添加逻辑
801
+ * @param logicOptions 逻辑参数
802
+ */
803
+ addLogic(logicOptions: Partial<Logic>): Logic;
804
+
805
+ /**
806
+ * 添加逻辑
807
+ * @param logic 已有的逻辑实例
808
+ */
809
+ addLogic(logic: Logic): Logic;
810
+
811
+ addLogic(options?: string | Partial<Logic> | Logic) {
812
+ const node = this._addLogic(options as any);
813
+ const index = this.logics.indexOf(node);
814
+ node.create({
815
+ index,
816
+ parentNode: this,
817
+ parentKey: 'logics',
818
+ });
819
+ return node;
820
+ }
821
+
822
+ getInterfaceExistingNames(excludedList: Array<Interface> = []) {
823
+ const excludedSet = new Set(excludedList);
824
+ return ((this.interfaces as Interface[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
825
+ }
826
+
827
+ getInterfaceUniqueName(name = 'Interface1') {
828
+ return utils.unique(name, this.getInterfaceExistingNames(), undefined, false);
829
+ }
830
+
831
+ /**
832
+ * 插入接口
833
+ * @internal
834
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
835
+ */
836
+ _insertInterfaceAt(name: string, index: number): Interface;
837
+
838
+ /**
839
+ * 插入接口
840
+ * @internal
841
+ * @param itfaceOptions 接口参数
842
+ */
843
+ _insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
844
+
845
+ /**
846
+ * 插入接口
847
+ * @internal
848
+ * @param itface 已有的接口实例
849
+ */
850
+ _insertInterfaceAt(itface: Interface, index: number): Interface;
851
+
852
+ _insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
853
+ const itfaceOptions: any = {};
854
+ const relationOptions = { parentNode: this, parentKey: 'interfaces' };
855
+ let itface: Interface;
856
+ if (!options) {
857
+ itface = Interface.from(
858
+ {
859
+ ...itfaceOptions,
860
+ name: this.getInterfaceUniqueName(),
861
+ },
862
+ this,
863
+ 'interfaces'
864
+ );
865
+ } else if (typeof options === 'string') {
866
+ itface = Interface.from(
867
+ {
868
+ ...itfaceOptions,
869
+ name: options,
870
+ },
871
+ this,
872
+ 'interfaces'
873
+ );
874
+ } else if (options instanceof Interface) {
875
+ options.ensureDelete(); // 同一实例不支持多处存在
876
+ itface = options;
877
+ Object.assign(itface, relationOptions);
878
+ } else {
879
+ itface = Interface.from(
880
+ {
881
+ ...itfaceOptions,
882
+ ...options,
883
+ },
884
+ this,
885
+ 'interfaces'
886
+ );
887
+ }
888
+ this.interfaces.splice(index, 0, itface);
889
+ return itface;
890
+ }
891
+
892
+ /**
893
+ * 插入接口
894
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
895
+ */
896
+ insertInterfaceAt(name: string, index: number): Interface;
897
+
898
+ /**
899
+ * 插入接口
900
+ * @param itfaceOptions 接口参数
901
+ */
902
+ insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
903
+
904
+ /**
905
+ * 插入接口
906
+ * @param itface 已有的接口实例
907
+ */
908
+ insertInterfaceAt(itface: Interface, index: number): Interface;
909
+
910
+ insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
911
+ const node = this._insertInterfaceAt(options as any, index);
912
+ node.create({
913
+ index,
914
+ parentNode: this,
915
+ parentKey: 'interfaces',
916
+ });
917
+ return node;
918
+ }
919
+
920
+ /**
921
+ * 添加接口
922
+ * @internal
923
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
924
+ */
925
+ _addInterface(name?: string): Interface;
926
+
927
+ /**
928
+ * 添加接口
929
+ * @internal
930
+ * @param itfaceOptions 接口参数
931
+ */
932
+ _addInterface(itfaceOptions: Partial<Interface>): Interface;
933
+
934
+ /**
935
+ * 添加接口
936
+ * @internal
937
+ * @param itface 已有的接口实例
938
+ */
939
+ _addInterface(itface: Interface): Interface;
940
+
941
+ _addInterface(options?: string | Partial<Interface> | Interface) {
942
+ const index = 0;
943
+ return this._insertInterfaceAt(options as any, index);
944
+ }
945
+
946
+ /**
947
+ * 添加接口
948
+ * @internal
949
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
950
+ */
951
+ addInterface(name?: string): Interface;
952
+
953
+ /**
954
+ * 添加接口
955
+ * @param itfaceOptions 接口参数
956
+ */
957
+ addInterface(itfaceOptions: Partial<Interface>): Interface;
958
+
959
+ /**
960
+ * 添加接口
961
+ * @param itface 已有的接口实例
962
+ */
963
+ addInterface(itface: Interface): Interface;
964
+
965
+ addInterface(options?: string | Partial<Interface> | Interface) {
966
+ const node = this._addInterface(options as any);
967
+ const index = this.interfaces.indexOf(node);
968
+ node.create({
969
+ index,
970
+ parentNode: this,
971
+ parentKey: 'interfaces',
972
+ });
973
+ return node;
974
+ }
975
+
976
+ getViewExistingNames(excludedList: Array<View> = []) {
977
+ const excludedSet = new Set(excludedList);
978
+ return ((this.views as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
979
+ }
980
+
981
+ getViewUniqueName(name = 'view1') {
982
+ return utils.unique(name, this.getViewExistingNames(), undefined, false);
983
+ }
984
+
985
+ /**
986
+ * 插入页面
987
+ * @internal
988
+ * @param name 页面名称,如果不填会自动生成一个唯一名称
989
+ */
990
+ _insertViewAt(name: string, index: number): View;
991
+
992
+ /**
993
+ * 插入页面
994
+ * @internal
995
+ * @param viewOptions 页面参数
996
+ */
997
+ _insertViewAt(viewOptions: Partial<View>, index: number): View;
998
+
999
+ /**
1000
+ * 插入页面
1001
+ * @internal
1002
+ * @param view 已有的页面实例
1003
+ */
1004
+ _insertViewAt(view: View, index: number): View;
1005
+
1006
+ _insertViewAt(options: string | Partial<View> | View, index: number) {
1007
+ const viewOptions: any = {};
1008
+ const relationOptions = { parentNode: this, parentKey: 'views' };
1009
+ let view: View;
1010
+ if (!options) {
1011
+ view = View.from(
1012
+ {
1013
+ ...viewOptions,
1014
+ name: this.getViewUniqueName(),
1015
+ },
1016
+ this,
1017
+ 'views'
1018
+ );
1019
+ } else if (typeof options === 'string') {
1020
+ view = View.from(
1021
+ {
1022
+ ...viewOptions,
1023
+ name: options,
1024
+ },
1025
+ this,
1026
+ 'views'
1027
+ );
1028
+ } else if (options instanceof View) {
1029
+ options.ensureDelete(); // 同一实例不支持多处存在
1030
+ view = options;
1031
+ Object.assign(view, relationOptions);
1032
+ } else {
1033
+ view = View.from(
1034
+ {
1035
+ ...viewOptions,
1036
+ ...options,
1037
+ },
1038
+ this,
1039
+ 'views'
1040
+ );
1041
+ }
1042
+ this.views.splice(index, 0, view);
1043
+ return view;
1044
+ }
1045
+
1046
+ /**
1047
+ * 插入页面
1048
+ * @param name 页面名称,如果不填会自动生成一个唯一名称
1049
+ */
1050
+ insertViewAt(name: string, index: number): View;
1051
+
1052
+ /**
1053
+ * 插入页面
1054
+ * @param viewOptions 页面参数
1055
+ */
1056
+ insertViewAt(viewOptions: Partial<View>, index: number): View;
1057
+
1058
+ /**
1059
+ * 插入页面
1060
+ * @param view 已有的页面实例
1061
+ */
1062
+ insertViewAt(view: View, index: number): View;
1063
+
1064
+ insertViewAt(options: string | Partial<View> | View, index: number) {
1065
+ const node = this._insertViewAt(options as any, index);
1066
+ node.create({
1067
+ index,
1068
+ parentNode: this,
1069
+ parentKey: 'views',
1070
+ });
1071
+ return node;
1072
+ }
1073
+
1074
+ /**
1075
+ * 添加页面
1076
+ * @internal
1077
+ * @param name 页面名称,如果不填会自动生成一个唯一名称
1078
+ */
1079
+ _addView(name?: string): View;
1080
+
1081
+ /**
1082
+ * 添加页面
1083
+ * @internal
1084
+ * @param viewOptions 页面参数
1085
+ */
1086
+ _addView(viewOptions: Partial<View>): View;
1087
+
1088
+ /**
1089
+ * 添加页面
1090
+ * @internal
1091
+ * @param view 已有的页面实例
1092
+ */
1093
+ _addView(view: View): View;
1094
+
1095
+ _addView(options?: string | Partial<View> | View) {
1096
+ const index = this.views.length;
1097
+ return this._insertViewAt(options as any, index);
1098
+ }
1099
+
1100
+ /**
1101
+ * 添加页面
1102
+ * @internal
1103
+ * @param name 页面名称,如果不填会自动生成一个唯一名称
1104
+ */
1105
+ addView(name?: string): View;
1106
+
1107
+ /**
1108
+ * 添加页面
1109
+ * @param viewOptions 页面参数
1110
+ */
1111
+ addView(viewOptions: Partial<View>): View;
1112
+
1113
+ /**
1114
+ * 添加页面
1115
+ * @param view 已有的页面实例
1116
+ */
1117
+ addView(view: View): View;
1118
+
1119
+ addView(options?: string | Partial<View> | View) {
1120
+ const node = this._addView(options as any);
1121
+ const index = this.views.indexOf(node);
1122
+ node.create({
1123
+ index,
1124
+ parentNode: this,
1125
+ parentKey: 'views',
1126
+ });
1127
+ return node;
1128
+ }
1129
+
1130
+ getVarExistingNames(excludedList: Array<Variable> = []) {
1131
+ const excludedSet = new Set(excludedList);
1132
+ return ((this.frontendVariables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1133
+ }
1134
+
1135
+ getVariableUniqueName(name = 'variable1') {
1136
+ return utils.unique(name, this.getVarExistingNames(), undefined, true);
1137
+ }
1138
+
1139
+ /**
1140
+ * 插入变量
1141
+ * @internal
1142
+ * @param name 变量名称,如果不填会自动生成一个唯一名称
1143
+ */
1144
+ _insertVariableAt(name: string, index: number): Variable;
1145
+
1146
+ /**
1147
+ * 插入变量
1148
+ * @internal
1149
+ * @param variableOptions 变量参数
1150
+ */
1151
+ _insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
1152
+
1153
+ /**
1154
+ * 插入变量
1155
+ * @internal
1156
+ * @param variable 已有的变量实例
1157
+ */
1158
+ _insertVariableAt(variable: Variable, index: number): Variable;
1159
+
1160
+ _insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1161
+ const variableOptions: any = {};
1162
+ const relationOptions = { parentNode: this, parentKey: 'frontendVariables' };
1163
+ let variable: Variable;
1164
+ if (!options) {
1165
+ variable = Variable.from(
1166
+ {
1167
+ ...variableOptions,
1168
+ name: this.getVariableUniqueName(),
1169
+ },
1170
+ this,
1171
+ 'frontendVariables'
1172
+ );
1173
+ } else if (typeof options === 'string') {
1174
+ variable = Variable.from(
1175
+ {
1176
+ ...variableOptions,
1177
+ name: options,
1178
+ },
1179
+ this,
1180
+ 'frontendVariables'
1181
+ );
1182
+ } else if (options instanceof Variable) {
1183
+ options.ensureDelete(); // 同一实例不支持多处存在
1184
+ variable = options;
1185
+ Object.assign(variable, relationOptions);
1186
+ } else {
1187
+ variable = Variable.from(
1188
+ {
1189
+ ...variableOptions,
1190
+ ...options,
1191
+ },
1192
+ this,
1193
+ 'frontendVariables'
1194
+ );
1195
+ }
1196
+ this.frontendVariables.splice(index, 0, variable);
1197
+ return variable;
1198
+ }
1199
+
1200
+ /**
1201
+ * 插入变量
1202
+ * @param name 变量名称,如果不填会自动生成一个唯一名称
1203
+ */
1204
+ insertVariableAt(name: string, index: number): Variable;
1205
+
1206
+ /**
1207
+ * 插入变量
1208
+ * @param variableOptions 变量参数
1209
+ */
1210
+ insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
1211
+
1212
+ /**
1213
+ * 插入变量
1214
+ * @param variable 已有的变量实例
1215
+ */
1216
+ insertVariableAt(variable: Variable, index: number): Variable;
1217
+
1218
+ insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1219
+ const node = this._insertVariableAt(options as any, index);
1220
+ node.create({
1221
+ index,
1222
+ parentNode: this,
1223
+ parentKey: 'frontendVariables',
1224
+ });
1225
+ return node;
1226
+ }
1227
+
1228
+ /**
1229
+ * 添加变量
1230
+ * @internal
1231
+ * @param name 变量名称,如果不填会自动生成一个唯一名称
1232
+ */
1233
+ _addVariable(name?: string): Variable;
1234
+
1235
+ /**
1236
+ * 添加变量
1237
+ * @internal
1238
+ * @param variableOptions 变量参数
1239
+ */
1240
+ _addVariable(variableOptions: Partial<Variable>): Variable;
1241
+
1242
+ /**
1243
+ * 添加变量
1244
+ * @internal
1245
+ * @param variable 已有的变量实例
1246
+ */
1247
+ _addVariable(variable: Variable): Variable;
1248
+
1249
+ _addVariable(options?: string | Partial<Variable> | Variable) {
1250
+ const index = this.frontendVariables.length;
1251
+ return this._insertVariableAt(options as any, index);
1252
+ }
1253
+
1254
+ /**
1255
+ * 添加变量
1256
+ * @internal
1257
+ * @param name 变量名称,如果不填会自动生成一个唯一名称
1258
+ */
1259
+ addVariable(name?: string): Variable;
1260
+
1261
+ /**
1262
+ * 添加变量
1263
+ * @param variableOptions 变量参数
1264
+ */
1265
+ addVariable(variableOptions: Partial<Variable>): Variable;
1266
+
1267
+ /**
1268
+ * 添加变量
1269
+ * @param variable 已有的变量实例
1270
+ */
1271
+ addVariable(variable: Variable): Variable;
1272
+
1273
+ addVariable(options?: string | Partial<Variable> | Variable) {
1274
+ const node = this._addVariable(options as any);
1275
+ const index = this.frontendVariables.indexOf(node);
1276
+ node.create({
1277
+ index,
1278
+ parentNode: this,
1279
+ parentKey: 'frontendVariables',
1280
+ });
1281
+ return node;
1282
+ }
1283
+
1284
+ getProcessExistingNames(excludedList: Array<Process> = []) {
1285
+ const excludedSet = new Set(excludedList);
1286
+ return ((this.processes as Process[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1287
+ }
1288
+
1289
+ getProcessUniqueName(name = 'Process1') {
1290
+ return utils.unique(name, this.getProcessExistingNames(), undefined, false);
1291
+ }
1292
+
1293
+ /**
1294
+ * 插入流程
1295
+ * @internal
1296
+ * @param name 流程名称,如果不填会自动生成一个唯一名称
1297
+ */
1298
+ _insertProcessAt(name: string, index: number): Process;
1299
+
1300
+ /**
1301
+ * 插入流程
1302
+ * @internal
1303
+ * @param processOptions 流程参数
1304
+ */
1305
+ _insertProcessAt(processOptions: Partial<Process>, index: number): Process;
1306
+
1307
+ /**
1308
+ * 插入流程
1309
+ * @internal
1310
+ * @param process 已有的流程实例
1311
+ */
1312
+ _insertProcessAt(process: Process, index: number): Process;
1313
+
1314
+ _insertProcessAt(options: string | Partial<Process> | Process, index: number) {
1315
+ const processOptions: any = {};
1316
+ const relationOptions = { parentNode: this, parentKey: 'processes' };
1317
+ let process: Process;
1318
+ if (!options) {
1319
+ process = Process.from(
1320
+ {
1321
+ ...processOptions,
1322
+ name: this.getProcessUniqueName(),
1323
+ },
1324
+ this,
1325
+ 'processes'
1326
+ );
1327
+ } else if (typeof options === 'string') {
1328
+ process = Process.from(
1329
+ {
1330
+ ...processOptions,
1331
+ name: options,
1332
+ },
1333
+ this,
1334
+ 'processes'
1335
+ );
1336
+ } else if (options instanceof Process) {
1337
+ options.ensureDelete(); // 同一实例不支持多处存在
1338
+ process = options;
1339
+ Object.assign(process, relationOptions);
1340
+ } else {
1341
+ process = Process.from(
1342
+ {
1343
+ ...processOptions,
1344
+ ...options,
1345
+ },
1346
+ this,
1347
+ 'processes'
1348
+ );
1349
+ }
1350
+ this.processes.splice(index, 0, process);
1351
+ return process;
1352
+ }
1353
+
1354
+ /**
1355
+ * 插入流程
1356
+ * @param name 流程名称,如果不填会自动生成一个唯一名称
1357
+ */
1358
+ insertProcessAt(name: string, index: number): Process;
1359
+
1360
+ /**
1361
+ * 插入流程
1362
+ * @param processOptions 流程参数
1363
+ */
1364
+ insertProcessAt(processOptions: Partial<Process>, index: number): Process;
1365
+
1366
+ /**
1367
+ * 插入流程
1368
+ * @param process 已有的流程实例
1369
+ */
1370
+ insertProcessAt(process: Process, index: number): Process;
1371
+
1372
+ insertProcessAt(options: string | Partial<Process> | Process, index: number) {
1373
+ const node = this._insertProcessAt(options as any, index);
1374
+ node.create({
1375
+ index,
1376
+ parentNode: this,
1377
+ parentKey: 'processes',
1378
+ });
1379
+ return node;
1380
+ }
1381
+
1382
+ /**
1383
+ * 添加流程
1384
+ * @internal
1385
+ * @param name 流程名称,如果不填会自动生成一个唯一名称
1386
+ */
1387
+ _addProcess(name?: string): Process;
1388
+
1389
+ /**
1390
+ * 添加流程
1391
+ * @internal
1392
+ * @param processOptions 流程参数
1393
+ */
1394
+ _addProcess(processOptions: Partial<Process>): Process;
1395
+
1396
+ /**
1397
+ * 添加流程
1398
+ * @internal
1399
+ * @param process 已有的流程实例
1400
+ */
1401
+ _addProcess(process: Process): Process;
1402
+
1403
+ _addProcess(options?: string | Partial<Process> | Process) {
1404
+ const index = 0;
1405
+ return this._insertProcessAt(options as any, index);
1406
+ }
1407
+
1408
+ /**
1409
+ * 添加流程
1410
+ * @internal
1411
+ * @param name 流程名称,如果不填会自动生成一个唯一名称
1412
+ */
1413
+ addProcess(name?: string): Process;
1414
+
1415
+ /**
1416
+ * 添加流程
1417
+ * @param processOptions 流程参数
1418
+ */
1419
+ addProcess(processOptions: Partial<Process>): Process;
1420
+
1421
+ /**
1422
+ * 添加流程
1423
+ * @param process 已有的流程实例
1424
+ */
1425
+ addProcess(process: Process): Process;
1426
+
1427
+ addProcess(options?: string | Partial<Process> | Process) {
1428
+ const node = this._addProcess(options as any);
1429
+ const index = this.processes.indexOf(node);
1430
+ node.create({
1431
+ index,
1432
+ parentNode: this,
1433
+ parentKey: 'processes',
1434
+ });
1435
+ return node;
1436
+ }
1437
+
1438
+ getFrontendLibraryExistingNames(excludedList: Array<FrontendLibrary> = []) {
1439
+ const excludedSet = new Set(excludedList);
1440
+ return ((this.frontends as FrontendLibrary[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1441
+ }
1442
+
1443
+ getFrontendLibraryUniqueName(name = 'frontendLibrary1') {
1444
+ return utils.unique(name, this.getFrontendLibraryExistingNames(), undefined, false);
1445
+ }
1446
+
1447
+ /**
1448
+ * 插入端包
1449
+ * @internal
1450
+ * @param name 端包名称,如果不填会自动生成一个唯一名称
1451
+ */
1452
+ _insertFrontendLibraryAt(name: string, index: number): FrontendLibrary;
1453
+
1454
+ /**
1455
+ * 插入端包
1456
+ * @internal
1457
+ * @param frontendLibraryOptions 端包参数
1458
+ */
1459
+ _insertFrontendLibraryAt(frontendLibraryOptions: Partial<FrontendLibrary>, index: number): FrontendLibrary;
1460
+
1461
+ /**
1462
+ * 插入端包
1463
+ * @internal
1464
+ * @param frontendLibrary 已有的端包实例
1465
+ */
1466
+ _insertFrontendLibraryAt(frontendLibrary: FrontendLibrary, index: number): FrontendLibrary;
1467
+
1468
+ _insertFrontendLibraryAt(options: string | Partial<FrontendLibrary> | FrontendLibrary, index: number) {
1469
+ const frontendLibraryOptions: any = {};
1470
+ const relationOptions = { parentNode: this, parentKey: 'frontends' };
1471
+ let frontendLibrary: FrontendLibrary;
1472
+ if (!options) {
1473
+ frontendLibrary = FrontendLibrary.from(
1474
+ {
1475
+ ...frontendLibraryOptions,
1476
+ name: this.getFrontendLibraryUniqueName(),
1477
+ },
1478
+ this,
1479
+ 'frontends'
1480
+ );
1481
+ } else if (typeof options === 'string') {
1482
+ frontendLibrary = FrontendLibrary.from(
1483
+ {
1484
+ ...frontendLibraryOptions,
1485
+ name: options,
1486
+ },
1487
+ this,
1488
+ 'frontends'
1489
+ );
1490
+ } else if (options instanceof FrontendLibrary) {
1491
+ options.ensureDelete(); // 同一实例不支持多处存在
1492
+ frontendLibrary = options;
1493
+ Object.assign(frontendLibrary, relationOptions);
1494
+ } else {
1495
+ frontendLibrary = FrontendLibrary.from(
1496
+ {
1497
+ ...frontendLibraryOptions,
1498
+ ...options,
1499
+ },
1500
+ this,
1501
+ 'frontends'
1502
+ );
1503
+ }
1504
+ this.frontends.splice(index, 0, frontendLibrary);
1505
+ return frontendLibrary;
1506
+ }
1507
+
1508
+ /**
1509
+ * 插入端包
1510
+ * @param name 端包名称,如果不填会自动生成一个唯一名称
1511
+ */
1512
+ insertFrontendLibraryAt(name: string, index: number): FrontendLibrary;
1513
+
1514
+ /**
1515
+ * 插入端包
1516
+ * @param frontendLibraryOptions 端包参数
1517
+ */
1518
+ insertFrontendLibraryAt(frontendLibraryOptions: Partial<FrontendLibrary>, index: number): FrontendLibrary;
1519
+
1520
+ /**
1521
+ * 插入端包
1522
+ * @param frontendLibrary 已有的端包实例
1523
+ */
1524
+ insertFrontendLibraryAt(frontendLibrary: FrontendLibrary, index: number): FrontendLibrary;
1525
+
1526
+ insertFrontendLibraryAt(options: string | Partial<FrontendLibrary> | FrontendLibrary, index: number) {
1527
+ const node = this._insertFrontendLibraryAt(options as any, index);
1528
+ node.create({
1529
+ index,
1530
+ parentNode: this,
1531
+ parentKey: 'frontends',
1532
+ });
1533
+ return node;
1534
+ }
1535
+
1536
+ /**
1537
+ * 添加端包
1538
+ * @internal
1539
+ * @param name 端包名称,如果不填会自动生成一个唯一名称
1540
+ */
1541
+ _addFrontendLibrary(name?: string): FrontendLibrary;
1542
+
1543
+ /**
1544
+ * 添加端包
1545
+ * @internal
1546
+ * @param frontendLibraryOptions 端包参数
1547
+ */
1548
+ _addFrontendLibrary(frontendLibraryOptions: Partial<FrontendLibrary>): FrontendLibrary;
1549
+
1550
+ /**
1551
+ * 添加端包
1552
+ * @internal
1553
+ * @param frontendLibrary 已有的端包实例
1554
+ */
1555
+ _addFrontendLibrary(frontendLibrary: FrontendLibrary): FrontendLibrary;
1556
+
1557
+ _addFrontendLibrary(options?: string | Partial<FrontendLibrary> | FrontendLibrary) {
1558
+ const index = this.frontends.length;
1559
+ return this._insertFrontendLibraryAt(options as any, index);
1560
+ }
1561
+
1562
+ /**
1563
+ * 添加端包
1564
+ * @internal
1565
+ * @param name 端包名称,如果不填会自动生成一个唯一名称
1566
+ */
1567
+ addFrontendLibrary(name?: string): FrontendLibrary;
1568
+
1569
+ /**
1570
+ * 添加端包
1571
+ * @param frontendLibraryOptions 端包参数
1572
+ */
1573
+ addFrontendLibrary(frontendLibraryOptions: Partial<FrontendLibrary>): FrontendLibrary;
1574
+
1575
+ /**
1576
+ * 添加端包
1577
+ * @param frontendLibrary 已有的端包实例
1578
+ */
1579
+ addFrontendLibrary(frontendLibrary: FrontendLibrary): FrontendLibrary;
1580
+
1581
+ addFrontendLibrary(options?: string | Partial<FrontendLibrary> | FrontendLibrary) {
1582
+ const node = this._addFrontendLibrary(options as any);
1583
+ const index = this.frontends.indexOf(node);
1584
+ node.create({
1585
+ index,
1586
+ parentNode: this,
1587
+ parentKey: 'frontends',
1588
+ });
1589
+ return node;
1590
+ }
1591
+
1592
+ getTriggerLauncherExistingNames(excludedList: Array<TriggerLauncher> = []) {
1593
+ const excludedSet = new Set(excludedList);
1594
+ return ((this.triggerLaunchers as TriggerLauncher[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1595
+ }
1596
+
1597
+ getTriggerLauncherUniqueName(name = 'triggerLauncher1') {
1598
+ return utils.unique(name, this.getTriggerLauncherExistingNames(), undefined, false);
1599
+ }
1600
+
1601
+ /**
1602
+ * 插入触发器启动器
1603
+ * @internal
1604
+ * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1605
+ */
1606
+ _insertTriggerLauncherAt(name: string, index: number): TriggerLauncher;
1607
+
1608
+ /**
1609
+ * 插入触发器启动器
1610
+ * @internal
1611
+ * @param triggerLauncherOptions 触发器启动器参数
1612
+ */
1613
+ _insertTriggerLauncherAt(triggerLauncherOptions: Partial<TriggerLauncher>, index: number): TriggerLauncher;
1614
+
1615
+ /**
1616
+ * 插入触发器启动器
1617
+ * @internal
1618
+ * @param triggerLauncher 已有的触发器启动器实例
1619
+ */
1620
+ _insertTriggerLauncherAt(triggerLauncher: TriggerLauncher, index: number): TriggerLauncher;
1621
+
1622
+ _insertTriggerLauncherAt(options: string | Partial<TriggerLauncher> | TriggerLauncher, index: number) {
1623
+ const triggerLauncherOptions: any = {};
1624
+ const relationOptions = { parentNode: this, parentKey: 'triggerLaunchers' };
1625
+ let triggerLauncher: TriggerLauncher;
1626
+ if (!options) {
1627
+ triggerLauncher = TriggerLauncher.from(
1628
+ {
1629
+ ...triggerLauncherOptions,
1630
+ name: this.getTriggerLauncherUniqueName(),
1631
+ },
1632
+ this,
1633
+ 'triggerLaunchers'
1634
+ );
1635
+ } else if (typeof options === 'string') {
1636
+ triggerLauncher = TriggerLauncher.from(
1637
+ {
1638
+ ...triggerLauncherOptions,
1639
+ name: options,
1640
+ },
1641
+ this,
1642
+ 'triggerLaunchers'
1643
+ );
1644
+ } else if (options instanceof TriggerLauncher) {
1645
+ options.ensureDelete(); // 同一实例不支持多处存在
1646
+ triggerLauncher = options;
1647
+ Object.assign(triggerLauncher, relationOptions);
1648
+ } else {
1649
+ triggerLauncher = TriggerLauncher.from(
1650
+ {
1651
+ ...triggerLauncherOptions,
1652
+ ...options,
1653
+ },
1654
+ this,
1655
+ 'triggerLaunchers'
1656
+ );
1657
+ }
1658
+ this.triggerLaunchers.splice(index, 0, triggerLauncher);
1659
+ return triggerLauncher;
1660
+ }
1661
+
1662
+ /**
1663
+ * 插入触发器启动器
1664
+ * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1665
+ */
1666
+ insertTriggerLauncherAt(name: string, index: number): TriggerLauncher;
1667
+
1668
+ /**
1669
+ * 插入触发器启动器
1670
+ * @param triggerLauncherOptions 触发器启动器参数
1671
+ */
1672
+ insertTriggerLauncherAt(triggerLauncherOptions: Partial<TriggerLauncher>, index: number): TriggerLauncher;
1673
+
1674
+ /**
1675
+ * 插入触发器启动器
1676
+ * @param triggerLauncher 已有的触发器启动器实例
1677
+ */
1678
+ insertTriggerLauncherAt(triggerLauncher: TriggerLauncher, index: number): TriggerLauncher;
1679
+
1680
+ insertTriggerLauncherAt(options: string | Partial<TriggerLauncher> | TriggerLauncher, index: number) {
1681
+ const node = this._insertTriggerLauncherAt(options as any, index);
1682
+ node.create({
1683
+ index,
1684
+ parentNode: this,
1685
+ parentKey: 'triggerLaunchers',
1686
+ });
1687
+ return node;
1688
+ }
1689
+
1690
+ /**
1691
+ * 添加触发器启动器
1692
+ * @internal
1693
+ * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1694
+ */
1695
+ _addTriggerLauncher(name?: string): TriggerLauncher;
1696
+
1697
+ /**
1698
+ * 添加触发器启动器
1699
+ * @internal
1700
+ * @param triggerLauncherOptions 触发器启动器参数
1701
+ */
1702
+ _addTriggerLauncher(triggerLauncherOptions: Partial<TriggerLauncher>): TriggerLauncher;
1703
+
1704
+ /**
1705
+ * 添加触发器启动器
1706
+ * @internal
1707
+ * @param triggerLauncher 已有的触发器启动器实例
1708
+ */
1709
+ _addTriggerLauncher(triggerLauncher: TriggerLauncher): TriggerLauncher;
1710
+
1711
+ _addTriggerLauncher(options?: string | Partial<TriggerLauncher> | TriggerLauncher) {
1712
+ const index = 0;
1713
+ return this._insertTriggerLauncherAt(options as any, index);
1714
+ }
1715
+
1716
+ /**
1717
+ * 添加触发器启动器
1718
+ * @internal
1719
+ * @param name 触发器启动器名称,如果不填会自动生成一个唯一名称
1720
+ */
1721
+ addTriggerLauncher(name?: string): TriggerLauncher;
1722
+
1723
+ /**
1724
+ * 添加触发器启动器
1725
+ * @param triggerLauncherOptions 触发器启动器参数
1726
+ */
1727
+ addTriggerLauncher(triggerLauncherOptions: Partial<TriggerLauncher>): TriggerLauncher;
1728
+
1729
+ /**
1730
+ * 添加触发器启动器
1731
+ * @param triggerLauncher 已有的触发器启动器实例
1732
+ */
1733
+ addTriggerLauncher(triggerLauncher: TriggerLauncher): TriggerLauncher;
1734
+
1735
+ addTriggerLauncher(options?: string | Partial<TriggerLauncher> | TriggerLauncher) {
1736
+ const node = this._addTriggerLauncher(options as any);
1737
+ const index = this.triggerLaunchers.indexOf(node);
1738
+ node.create({
1739
+ index,
1740
+ parentNode: this,
1741
+ parentKey: 'triggerLaunchers',
1742
+ });
1743
+ return node;
1744
+ }
1745
+
1746
+ getConnectionExistingNames(excludedList: Array<Connection> = []) {
1747
+ const excludedSet = new Set(excludedList);
1748
+ return ((this.connections as Connection[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1749
+ }
1750
+
1751
+ getConnectionUniqueName(name = 'connection1') {
1752
+ return utils.unique(name, this.getConnectionExistingNames(), undefined, false);
1753
+ }
1754
+
1755
+ /**
1756
+ * 插入连接
1757
+ * @internal
1758
+ * @param name 连接名称,如果不填会自动生成一个唯一名称
1759
+ */
1760
+ _insertConnectionAt(name: string, index: number): Connection;
1761
+
1762
+ /**
1763
+ * 插入连接
1764
+ * @internal
1765
+ * @param connectionOptions 连接参数
1766
+ */
1767
+ _insertConnectionAt(connectionOptions: Partial<Connection>, index: number): Connection;
1768
+
1769
+ /**
1770
+ * 插入连接
1771
+ * @internal
1772
+ * @param connection 已有的连接实例
1773
+ */
1774
+ _insertConnectionAt(connection: Connection, index: number): Connection;
1775
+
1776
+ _insertConnectionAt(options: string | Partial<Connection> | Connection, index: number) {
1777
+ const connectionOptions: any = {};
1778
+ const relationOptions = { parentNode: this, parentKey: 'connections' };
1779
+ let connection: Connection;
1780
+ if (!options) {
1781
+ connection = Connection.from(
1782
+ {
1783
+ ...connectionOptions,
1784
+ name: this.getConnectionUniqueName(),
1785
+ },
1786
+ this,
1787
+ 'connections'
1788
+ );
1789
+ } else if (typeof options === 'string') {
1790
+ connection = Connection.from(
1791
+ {
1792
+ ...connectionOptions,
1793
+ name: options,
1794
+ },
1795
+ this,
1796
+ 'connections'
1797
+ );
1798
+ } else if (options instanceof Connection) {
1799
+ options.ensureDelete(); // 同一实例不支持多处存在
1800
+ connection = options;
1801
+ Object.assign(connection, relationOptions);
1802
+ } else {
1803
+ connection = Connection.from(
1804
+ {
1805
+ ...connectionOptions,
1806
+ ...options,
1807
+ },
1808
+ this,
1809
+ 'connections'
1810
+ );
1811
+ }
1812
+ this.connections.splice(index, 0, connection);
1813
+ return connection;
1814
+ }
1815
+
1816
+ /**
1817
+ * 插入连接
1818
+ * @param name 连接名称,如果不填会自动生成一个唯一名称
1819
+ */
1820
+ insertConnectionAt(name: string, index: number): Connection;
1821
+
1822
+ /**
1823
+ * 插入连接
1824
+ * @param connectionOptions 连接参数
1825
+ */
1826
+ insertConnectionAt(connectionOptions: Partial<Connection>, index: number): Connection;
1827
+
1828
+ /**
1829
+ * 插入连接
1830
+ * @param connection 已有的连接实例
1831
+ */
1832
+ insertConnectionAt(connection: Connection, index: number): Connection;
1833
+
1834
+ insertConnectionAt(options: string | Partial<Connection> | Connection, index: number) {
1835
+ const node = this._insertConnectionAt(options as any, index);
1836
+ node.create({
1837
+ index,
1838
+ parentNode: this,
1839
+ parentKey: 'connections',
1840
+ });
1841
+ return node;
1842
+ }
1843
+
1844
+ /**
1845
+ * 添加连接
1846
+ * @internal
1847
+ * @param name 连接名称,如果不填会自动生成一个唯一名称
1848
+ */
1849
+ _addConnection(name?: string): Connection;
1850
+
1851
+ /**
1852
+ * 添加连接
1853
+ * @internal
1854
+ * @param connectionOptions 连接参数
1855
+ */
1856
+ _addConnection(connectionOptions: Partial<Connection>): Connection;
1857
+
1858
+ /**
1859
+ * 添加连接
1860
+ * @internal
1861
+ * @param connection 已有的连接实例
1862
+ */
1863
+ _addConnection(connection: Connection): Connection;
1864
+
1865
+ _addConnection(options?: string | Partial<Connection> | Connection) {
1866
+ const index = 0;
1867
+ return this._insertConnectionAt(options as any, index);
1868
+ }
1869
+
1870
+ /**
1871
+ * 添加连接
1872
+ * @internal
1873
+ * @param name 连接名称,如果不填会自动生成一个唯一名称
1874
+ */
1875
+ addConnection(name?: string): Connection;
1876
+
1877
+ /**
1878
+ * 添加连接
1879
+ * @param connectionOptions 连接参数
1880
+ */
1881
+ addConnection(connectionOptions: Partial<Connection>): Connection;
1882
+
1883
+ /**
1884
+ * 添加连接
1885
+ * @param connection 已有的连接实例
1886
+ */
1887
+ addConnection(connection: Connection): Connection;
1888
+
1889
+ addConnection(options?: string | Partial<Connection> | Connection) {
1890
+ const node = this._addConnection(options as any);
1891
+ const index = this.connections.indexOf(node);
1892
+ node.create({
1893
+ index,
1894
+ parentNode: this,
1895
+ parentKey: 'connections',
1896
+ });
1897
+ return node;
1898
+ }
1899
+
1900
+ /**
1901
+ * 删除数据源
1902
+ * @param name 数据源名称
1903
+ */
1904
+ removeDataSource(name: string): void;
1905
+
1906
+ /**
1907
+ * 删除数据源
1908
+ * @param dataSource 已有的数据源实例
1909
+ */
1910
+ removeDataSource(dataSource: DataSource): void;
1911
+
1912
+ removeDataSource(options: string | DataSource) {
1913
+ let dataSource: DataSource;
1914
+ if (typeof options === 'string') {
1915
+ dataSource = (this.dataSources as DataSource[]).find((item) => item.name === options);
1916
+ if (!dataSource) {
1917
+ throw new Error(`找不到数据源 ${options}`);
1918
+ }
1919
+ } else {
1920
+ dataSource = options;
1921
+ }
1922
+ return dataSource.delete();
1923
+ }
1924
+
1925
+ __removeDataSource(dataSource: DataSource) {
1926
+ const { parentKey } = dataSource;
1927
+ const params: Params = {
1928
+ parentNode: this,
1929
+ parentKey,
1930
+ index: -1,
1931
+ object: null,
1932
+ oldObject: dataSource,
1933
+ };
1934
+ if (parentKey) {
1935
+ params.parentKey = parentKey;
1936
+ if (Array.isArray((this as any)[parentKey])) {
1937
+ const index = (this as any)[parentKey].indexOf(dataSource);
1938
+ ~index && (this as any)[parentKey].splice(index, 1);
1939
+ params.index = index;
1940
+ } else if ((this as any)[parentKey] === dataSource) {
1941
+ params.index = 0;
1942
+ (this as any)[parentKey] = undefined;
1943
+ }
1944
+ }
1945
+ return params;
1946
+ }
1947
+
1948
+ /**
1949
+ * 删除数据结构
1950
+ * @param name 数据结构名称
1951
+ */
1952
+ removeStructure(name: string): void;
1953
+
1954
+ /**
1955
+ * 删除数据结构
1956
+ * @param structure 已有的数据结构实例
1957
+ */
1958
+ removeStructure(structure: Structure): void;
1959
+
1960
+ removeStructure(options: string | Structure) {
1961
+ let structure: Structure;
1962
+ if (typeof options === 'string') {
1963
+ structure = (this.structures as Structure[]).find((item) => item.name === options);
1964
+ if (!structure) {
1965
+ throw new Error(`找不到数据结构 ${options}`);
1966
+ }
1967
+ } else {
1968
+ structure = options;
1969
+ }
1970
+ return structure.delete();
1971
+ }
1972
+
1973
+ __removeStructure(structure: Structure) {
1974
+ const { parentKey } = structure;
1975
+ const params: Params = {
1976
+ parentNode: this,
1977
+ parentKey,
1978
+ index: -1,
1979
+ object: null,
1980
+ oldObject: structure,
1981
+ };
1982
+ if (parentKey) {
1983
+ params.parentKey = parentKey;
1984
+ if (Array.isArray((this as any)[parentKey])) {
1985
+ const index = (this as any)[parentKey].indexOf(structure);
1986
+ ~index && (this as any)[parentKey].splice(index, 1);
1987
+ params.index = index;
1988
+ } else if ((this as any)[parentKey] === structure) {
1989
+ params.index = 0;
1990
+ (this as any)[parentKey] = undefined;
1991
+ }
1992
+ }
1993
+ return params;
1994
+ }
1995
+
1996
+ /**
1997
+ * 删除枚举
1998
+ * @param name 枚举名称
1999
+ */
2000
+ removeEnum(name: string): void;
2001
+
2002
+ /**
2003
+ * 删除枚举
2004
+ * @param enumeration 已有的枚举实例
2005
+ */
2006
+ removeEnum(enumeration: Enum): void;
2007
+
2008
+ removeEnum(options: string | Enum) {
2009
+ let enumeration: Enum;
2010
+ if (typeof options === 'string') {
2011
+ enumeration = (this.enums as Enum[]).find((item) => item.name === options);
2012
+ if (!enumeration) {
2013
+ throw new Error(`找不到枚举 ${options}`);
2014
+ }
2015
+ } else {
2016
+ enumeration = options;
2017
+ }
2018
+ return enumeration.delete();
2019
+ }
2020
+
2021
+ __removeEnum(enumeration: Enum) {
2022
+ const { parentKey } = enumeration;
2023
+ const params: Params = {
2024
+ parentNode: this,
2025
+ parentKey,
2026
+ index: -1,
2027
+ object: null,
2028
+ oldObject: enumeration,
2029
+ };
2030
+ if (parentKey) {
2031
+ params.parentKey = parentKey;
2032
+ if (Array.isArray((this as any)[parentKey])) {
2033
+ const index = (this as any)[parentKey].indexOf(enumeration);
2034
+ ~index && (this as any)[parentKey].splice(index, 1);
2035
+ params.index = index;
2036
+ } else if ((this as any)[parentKey] === enumeration) {
2037
+ params.index = 0;
2038
+ (this as any)[parentKey] = undefined;
2039
+ }
2040
+ }
2041
+ return params;
2042
+ }
2043
+
2044
+ /**
2045
+ * 删除逻辑
2046
+ * @param name 逻辑名称
2047
+ */
2048
+ removeLogic(name: string): void;
2049
+
2050
+ /**
2051
+ * 删除逻辑
2052
+ * @param logic 已有的逻辑实例
2053
+ */
2054
+ removeLogic(logic: Logic): void;
2055
+
2056
+ removeLogic(options: string | Logic) {
2057
+ let logic: Logic;
2058
+ if (typeof options === 'string') {
2059
+ logic = (this.logics as Logic[]).find((item) => item.name === options);
2060
+ if (!logic) {
2061
+ throw new Error(`找不到逻辑 ${options}`);
2062
+ }
2063
+ } else {
2064
+ logic = options;
2065
+ }
2066
+ return logic.delete();
2067
+ }
2068
+
2069
+ __removeLogic(logic: Logic) {
2070
+ const { parentKey } = logic;
2071
+ const params: Params = {
2072
+ parentNode: this,
2073
+ parentKey,
2074
+ index: -1,
2075
+ object: null,
2076
+ oldObject: logic,
2077
+ };
2078
+ if (parentKey) {
2079
+ params.parentKey = parentKey;
2080
+ if (Array.isArray((this as any)[parentKey])) {
2081
+ const index = (this as any)[parentKey].indexOf(logic);
2082
+ ~index && (this as any)[parentKey].splice(index, 1);
2083
+ params.index = index;
2084
+ } else if ((this as any)[parentKey] === logic) {
2085
+ params.index = 0;
2086
+ (this as any)[parentKey] = undefined;
2087
+ }
2088
+ }
2089
+ return params;
2090
+ }
2091
+
2092
+ /**
2093
+ * 删除接口
2094
+ * @param name 接口名称
2095
+ */
2096
+ removeInterface(name: string): void;
2097
+
2098
+ /**
2099
+ * 删除接口
2100
+ * @param itface 已有的接口实例
2101
+ */
2102
+ removeInterface(itface: Interface): void;
2103
+
2104
+ removeInterface(options: string | Interface) {
2105
+ let itface: Interface;
2106
+ if (typeof options === 'string') {
2107
+ itface = (this.interfaces as Interface[]).find((item) => item.name === options);
2108
+ if (!itface) {
2109
+ throw new Error(`找不到接口 ${options}`);
2110
+ }
2111
+ } else {
2112
+ itface = options;
2113
+ }
2114
+ return itface.delete();
2115
+ }
2116
+
2117
+ __removeInterface(itface: Interface) {
2118
+ const { parentKey } = itface;
2119
+ const params: Params = {
2120
+ parentNode: this,
2121
+ parentKey,
2122
+ index: -1,
2123
+ object: null,
2124
+ oldObject: itface,
2125
+ };
2126
+ if (parentKey) {
2127
+ params.parentKey = parentKey;
2128
+ if (Array.isArray((this as any)[parentKey])) {
2129
+ const index = (this as any)[parentKey].indexOf(itface);
2130
+ ~index && (this as any)[parentKey].splice(index, 1);
2131
+ params.index = index;
2132
+ } else if ((this as any)[parentKey] === itface) {
2133
+ params.index = 0;
2134
+ (this as any)[parentKey] = undefined;
2135
+ }
2136
+ }
2137
+ return params;
2138
+ }
2139
+
2140
+ /**
2141
+ * 删除页面
2142
+ * @param name 页面名称
2143
+ */
2144
+ removeView(name: string): void;
2145
+
2146
+ /**
2147
+ * 删除页面
2148
+ * @param view 已有的页面实例
2149
+ */
2150
+ removeView(view: View): void;
2151
+
2152
+ removeView(options: string | View) {
2153
+ let view: View;
2154
+ if (typeof options === 'string') {
2155
+ view = (this.views as View[]).find((item) => item.name === options);
2156
+ if (!view) {
2157
+ throw new Error(`找不到页面 ${options}`);
2158
+ }
2159
+ } else {
2160
+ view = options;
2161
+ }
2162
+ return view.delete();
2163
+ }
2164
+
2165
+ __removeView(view: View) {
2166
+ const { parentKey } = view;
2167
+ const params: Params = {
2168
+ parentNode: this,
2169
+ parentKey,
2170
+ index: -1,
2171
+ object: null,
2172
+ oldObject: view,
2173
+ };
2174
+ if (parentKey) {
2175
+ params.parentKey = parentKey;
2176
+ if (Array.isArray((this as any)[parentKey])) {
2177
+ const index = (this as any)[parentKey].indexOf(view);
2178
+ ~index && (this as any)[parentKey].splice(index, 1);
2179
+ params.index = index;
2180
+ } else if ((this as any)[parentKey] === view) {
2181
+ params.index = 0;
2182
+ (this as any)[parentKey] = undefined;
2183
+ }
2184
+ }
2185
+ return params;
2186
+ }
2187
+
2188
+ /**
2189
+ * 删除变量
2190
+ * @param name 变量名称
2191
+ */
2192
+ removeVariable(name: string): void;
2193
+
2194
+ /**
2195
+ * 删除变量
2196
+ * @param variable 已有的变量实例
2197
+ */
2198
+ removeVariable(variable: Variable): void;
2199
+
2200
+ removeVariable(options: string | Variable) {
2201
+ let variable: Variable;
2202
+ if (typeof options === 'string') {
2203
+ variable = (this.frontendVariables as Variable[]).find((item) => item.name === options);
2204
+ if (!variable) {
2205
+ throw new Error(`找不到变量 ${options}`);
2206
+ }
2207
+ } else {
2208
+ variable = options;
2209
+ }
2210
+ return variable.delete();
2211
+ }
2212
+
2213
+ __removeVariable(variable: Variable) {
2214
+ const { parentKey } = variable;
2215
+ const params: Params = {
2216
+ parentNode: this,
2217
+ parentKey,
2218
+ index: -1,
2219
+ object: null,
2220
+ oldObject: variable,
2221
+ };
2222
+ if (parentKey) {
2223
+ params.parentKey = parentKey;
2224
+ if (Array.isArray((this as any)[parentKey])) {
2225
+ const index = (this as any)[parentKey].indexOf(variable);
2226
+ ~index && (this as any)[parentKey].splice(index, 1);
2227
+ params.index = index;
2228
+ } else if ((this as any)[parentKey] === variable) {
2229
+ params.index = 0;
2230
+ (this as any)[parentKey] = undefined;
2231
+ }
2232
+ }
2233
+ return params;
2234
+ }
2235
+
2236
+ /**
2237
+ * 删除流程
2238
+ * @param name 流程名称
2239
+ */
2240
+ removeProcess(name: string): void;
2241
+
2242
+ /**
2243
+ * 删除流程
2244
+ * @param process 已有的流程实例
2245
+ */
2246
+ removeProcess(process: Process): void;
2247
+
2248
+ removeProcess(options: string | Process) {
2249
+ let process: Process;
2250
+ if (typeof options === 'string') {
2251
+ process = (this.processes as Process[]).find((item) => item.name === options);
2252
+ if (!process) {
2253
+ throw new Error(`找不到流程 ${options}`);
2254
+ }
2255
+ } else {
2256
+ process = options;
2257
+ }
2258
+ return process.delete();
2259
+ }
2260
+
2261
+ __removeProcess(process: Process) {
2262
+ const { parentKey } = process;
2263
+ const params: Params = {
2264
+ parentNode: this,
2265
+ parentKey,
2266
+ index: -1,
2267
+ object: null,
2268
+ oldObject: process,
2269
+ };
2270
+ if (parentKey) {
2271
+ params.parentKey = parentKey;
2272
+ if (Array.isArray((this as any)[parentKey])) {
2273
+ const index = (this as any)[parentKey].indexOf(process);
2274
+ ~index && (this as any)[parentKey].splice(index, 1);
2275
+ params.index = index;
2276
+ } else if ((this as any)[parentKey] === process) {
2277
+ params.index = 0;
2278
+ (this as any)[parentKey] = undefined;
2279
+ }
2280
+ }
2281
+ return params;
2282
+ }
2283
+
2284
+ /**
2285
+ * 删除端包
2286
+ * @param name 端包名称
2287
+ */
2288
+ removeFrontendLibrary(name: string): void;
2289
+
2290
+ /**
2291
+ * 删除端包
2292
+ * @param frontendLibrary 已有的端包实例
2293
+ */
2294
+ removeFrontendLibrary(frontendLibrary: FrontendLibrary): void;
2295
+
2296
+ removeFrontendLibrary(options: string | FrontendLibrary) {
2297
+ let frontendLibrary: FrontendLibrary;
2298
+ if (typeof options === 'string') {
2299
+ frontendLibrary = (this.frontends as FrontendLibrary[]).find((item) => item.name === options);
2300
+ if (!frontendLibrary) {
2301
+ throw new Error(`找不到端包 ${options}`);
2302
+ }
2303
+ } else {
2304
+ frontendLibrary = options;
2305
+ }
2306
+ return frontendLibrary.delete();
2307
+ }
2308
+
2309
+ __removeFrontendLibrary(frontendLibrary: FrontendLibrary) {
2310
+ const { parentKey } = frontendLibrary;
2311
+ const params: Params = {
2312
+ parentNode: this,
2313
+ parentKey,
2314
+ index: -1,
2315
+ object: null,
2316
+ oldObject: frontendLibrary,
2317
+ };
2318
+ if (parentKey) {
2319
+ params.parentKey = parentKey;
2320
+ if (Array.isArray((this as any)[parentKey])) {
2321
+ const index = (this as any)[parentKey].indexOf(frontendLibrary);
2322
+ ~index && (this as any)[parentKey].splice(index, 1);
2323
+ params.index = index;
2324
+ } else if ((this as any)[parentKey] === frontendLibrary) {
2325
+ params.index = 0;
2326
+ (this as any)[parentKey] = undefined;
2327
+ }
2328
+ }
2329
+ return params;
2330
+ }
2331
+
2332
+ /**
2333
+ * 删除配置管理
2334
+ * @param name 配置管理名称
2335
+ */
2336
+ removeConfiguration(name: string): void;
2337
+
2338
+ /**
2339
+ * 删除配置管理
2340
+ * @param configuration 已有的配置管理实例
2341
+ */
2342
+ removeConfiguration(configuration: Configuration): void;
2343
+
2344
+ removeConfiguration(options: string | Configuration) {
2345
+ let configuration: Configuration;
2346
+ if (typeof options === 'string') {
2347
+ configuration = this.configuration;
2348
+ if (!configuration) {
2349
+ throw new Error(`找不到配置管理 ${options}`);
2350
+ }
2351
+ } else {
2352
+ configuration = options;
2353
+ }
2354
+ return configuration.delete();
2355
+ }
2356
+
2357
+ __removeConfiguration(configuration: Configuration) {
2358
+ const { parentKey } = configuration;
2359
+ const params: Params = {
2360
+ parentNode: this,
2361
+ parentKey,
2362
+ index: -1,
2363
+ object: null,
2364
+ oldObject: configuration,
2365
+ };
2366
+ if (parentKey) {
2367
+ params.parentKey = parentKey;
2368
+ if (Array.isArray((this as any)[parentKey])) {
2369
+ const index = (this as any)[parentKey].indexOf(configuration);
2370
+ ~index && (this as any)[parentKey].splice(index, 1);
2371
+ params.index = index;
2372
+ } else if ((this as any)[parentKey] === configuration) {
2373
+ params.index = 0;
2374
+ (this as any)[parentKey] = undefined;
2375
+ }
2376
+ }
2377
+ return params;
2378
+ }
2379
+
2380
+ /**
2381
+ * 删除触发器启动器
2382
+ * @param name 触发器启动器名称
2383
+ */
2384
+ removeTriggerLauncher(name: string): void;
2385
+
2386
+ /**
2387
+ * 删除触发器启动器
2388
+ * @param triggerLauncher 已有的触发器启动器实例
2389
+ */
2390
+ removeTriggerLauncher(triggerLauncher: TriggerLauncher): void;
2391
+
2392
+ removeTriggerLauncher(options: string | TriggerLauncher) {
2393
+ let triggerLauncher: TriggerLauncher;
2394
+ if (typeof options === 'string') {
2395
+ triggerLauncher = (this.triggerLaunchers as TriggerLauncher[]).find((item) => item.name === options);
2396
+ if (!triggerLauncher) {
2397
+ throw new Error(`找不到触发器启动器 ${options}`);
2398
+ }
2399
+ } else {
2400
+ triggerLauncher = options;
2401
+ }
2402
+ return triggerLauncher.delete();
2403
+ }
2404
+
2405
+ __removeTriggerLauncher(triggerLauncher: TriggerLauncher) {
2406
+ const { parentKey } = triggerLauncher;
2407
+ const params: Params = {
2408
+ parentNode: this,
2409
+ parentKey,
2410
+ index: -1,
2411
+ object: null,
2412
+ oldObject: triggerLauncher,
2413
+ };
2414
+ if (parentKey) {
2415
+ params.parentKey = parentKey;
2416
+ if (Array.isArray((this as any)[parentKey])) {
2417
+ const index = (this as any)[parentKey].indexOf(triggerLauncher);
2418
+ ~index && (this as any)[parentKey].splice(index, 1);
2419
+ params.index = index;
2420
+ } else if ((this as any)[parentKey] === triggerLauncher) {
2421
+ params.index = 0;
2422
+ (this as any)[parentKey] = undefined;
2423
+ }
2424
+ }
2425
+ return params;
2426
+ }
2427
+
2428
+ /**
2429
+ * 删除连接
2430
+ * @param name 连接名称
2431
+ */
2432
+ removeConnection(name: string): void;
2433
+
2434
+ /**
2435
+ * 删除连接
2436
+ * @param connection 已有的连接实例
2437
+ */
2438
+ removeConnection(connection: Connection): void;
2439
+
2440
+ removeConnection(options: string | Connection) {
2441
+ let connection: Connection;
2442
+ if (typeof options === 'string') {
2443
+ connection = (this.connections as Connection[]).find((item) => item.name === options);
2444
+ if (!connection) {
2445
+ throw new Error(`找不到连接 ${options}`);
2446
+ }
2447
+ } else {
2448
+ connection = options;
2449
+ }
2450
+ return connection.delete();
2451
+ }
2452
+
2453
+ __removeConnection(connection: Connection) {
2454
+ const { parentKey } = connection;
2455
+ const params: Params = {
2456
+ parentNode: this,
2457
+ parentKey,
2458
+ index: -1,
2459
+ object: null,
2460
+ oldObject: connection,
2461
+ };
2462
+ if (parentKey) {
2463
+ params.parentKey = parentKey;
2464
+ if (Array.isArray((this as any)[parentKey])) {
2465
+ const index = (this as any)[parentKey].indexOf(connection);
2466
+ ~index && (this as any)[parentKey].splice(index, 1);
2467
+ params.index = index;
2468
+ } else if ((this as any)[parentKey] === connection) {
2469
+ params.index = 0;
2470
+ (this as any)[parentKey] = undefined;
2471
+ }
2472
+ }
2473
+ return params;
2474
+ }
2475
+
2476
+ //= ===============================================================================
2477
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2478
+ // 自动生成的代码已结束。下面可以手动编写。
2479
+ //= ===============================================================================
2480
+ /**
2481
+ * 用于区分存量应用新导入模块,存量应用替换数据结构使用
2482
+ */
2483
+ @property()
2484
+ isAdd: boolean;
2485
+
2486
+ /**
2487
+ * 是否启动
2488
+ */
2489
+ @property()
2490
+ enable: boolean;
2491
+
2492
+ /**
2493
+ * 依赖列表
2494
+ */
2495
+ @property()
2496
+ dependencies: Array<string> = [];
2497
+
2498
+ setIsAdd(isAdd: boolean) {
2499
+ const object = {
2500
+ isAdd,
2501
+ };
2502
+ this.update({
2503
+ ...object,
2504
+ });
2505
+ }
2506
+
2507
+ /**
2508
+ * 生成宿主语言的文件路径
2509
+ * @param name 一般不用传,用于 rename
2510
+ */
2511
+ getEmbeddedFilePath(name = this.name) {
2512
+ return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
2513
+ }
2514
+
2515
+ /**
2516
+ * 获取命名空间和
2517
+ * 暂时不考虑 Module 嵌套的情况
2518
+ */
2519
+ getNamespace() {
2520
+ // connector namespace 为 connector + connectorName
2521
+ if (this.type === 'connector') {
2522
+ return `connector.${this.name}`;
2523
+ }
2524
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
2525
+ }
2526
+
2527
+ getTsNamespace() {
2528
+ if (this.type === 'connector') {
2529
+ return 'connector';
2530
+ }
2531
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
2532
+ }
2533
+
2534
+ getTsNamespaceAndName() {
2535
+ if (this.type === 'connector') {
2536
+ return 'connector';
2537
+ }
2538
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.name}`;
2539
+ }
2540
+
2541
+ findEnumByName(name: string) {
2542
+ return this.enums.find((enumItem) => enumItem.name === name);
2543
+ }
2544
+
2545
+ /**
2546
+ * 获取属性节点是否存在
2547
+ */
2548
+
2549
+ findProperty(name: string, propertyType: PropertyType): any {
2550
+ return ((this as any)[propertyType] as Array<any>).find((item) => item.name === name);
2551
+ }
2552
+
2553
+ delete() {
2554
+ this.parentNode?.emit('collect:start', {
2555
+ actionMsg: '移除依赖库',
2556
+ });
2557
+ super.delete();
2558
+ this._delete();
2559
+ // if (this.dependencies) {
2560
+ // // 删除依赖链中的依赖
2561
+ // this.dependencies.forEach((tag) => {
2562
+ // const [name, version] = tag.split('-');
2563
+ // const existNode = this.app.dependencies.find((m) => m.name === name && m.version === version);
2564
+ // existNode?.delete();
2565
+ // });
2566
+ // }
2567
+ // 处理同名依赖 重新生成文件
2568
+ // if (this.enable) {
2569
+ // 删[数据源]
2570
+ const dataSourceGroup = (this.parentNode as any)?.configuration?.getGroup('dataSource');
2571
+ if (this.dataSources && dataSourceGroup) {
2572
+ this.dataSources.forEach((datasource) => {
2573
+ this.parentNode?.emit('clear:datasourceError', datasource as any);
2574
+ try {
2575
+ dataSourceGroup.removeConfigProperty(datasource.name);
2576
+ } catch (e) {}
2577
+ });
2578
+ }
2579
+ // // 已启用的依赖库被删除时,将后续被禁用的同名依赖库 切换为启用
2580
+ // const index = this.app.dependencies.findIndex((m) => m.enable === false && m.name === this.name);
2581
+ // if (index >= 0) {
2582
+ // const nextMainModule = this.app.dependencies[index];
2583
+ // // 更新[禁用的依赖]enable:true
2584
+ // nextMainModule.update({ enable: true });
2585
+ // nextMainModule.softDelete({ index });
2586
+ // }
2587
+ // }
2588
+ this.parentNode?.emit('collect:end');
2589
+ }
2590
+
2591
+ // 删除再添加 触发文件生成
2592
+ softDelete(options: { index: number }) {
2593
+ // 删[禁用的依赖]
2594
+ super.delete();
2595
+ // 创建[禁用的依赖]
2596
+ this.app.insertModuleInDependenciesAt(this, options.index);
2597
+ // 创建[禁用的依赖]的数据源
2598
+ const dataSourceGroup = (this.parentNode as any)?.configuration?.getGroup('dataSource');
2599
+ if (this.dataSources && dataSourceGroup) {
2600
+ this.dataSources.forEach((datasource) => {
2601
+ const body: ConfigProperty = ConfigProperty.from({
2602
+ name: datasource.name,
2603
+ description: '',
2604
+ isPrivate: false,
2605
+ values: [
2606
+ { env: 'dev', value: '', concept: 'ConfigPropertyValue' },
2607
+ { env: 'online', value: '', concept: 'ConfigPropertyValue' },
2608
+ ],
2196
2609
  });
2610
+ dataSourceGroup.addConfigProperty(body);
2611
+ });
2197
2612
  }
2198
- /**
2199
- * 生成宿主语言的文件路径
2200
- * @param name 一般不用传,用于 rename
2201
- */
2202
- getEmbeddedFilePath(name = this.name) {
2203
- return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
2204
- }
2205
- /**
2206
- * 获取命名空间和
2207
- * 暂时不考虑 Module 嵌套的情况
2208
- */
2209
- getNamespace() {
2210
- if (this.type === 'connector') {
2211
- return 'connector';
2212
- }
2213
- return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
2214
- }
2215
-
2216
- getTsNamespace() {
2217
- if (this.type === 'connector') {
2218
- return 'connector';
2219
- }
2220
- return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
2221
- }
2222
- getTsNamespaceAndName() {
2223
- if (this.type === 'connector') {
2224
- return 'connector';
2225
- }
2226
- return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.name}`;
2227
- }
2228
-
2229
- findEnumByName(name: string) {
2230
- return this.enums.find((enumItem) => enumItem.name === name);
2231
- }
2232
-
2233
- /**
2234
- * 获取属性节点是否存在
2235
- */
2236
-
2237
- findProperty(name: string, propertyType: PropertyType): any {
2238
- return ((this as any)[propertyType] as Array<any>).find((item) => item.name === name);
2239
- }
2240
-
2241
- delete() {
2242
- this.parentNode?.emit('collect:start', {
2243
- actionMsg: '移除依赖库',
2244
- });
2245
- super.delete();
2246
- this._delete();
2247
- // if (this.dependencies) {
2248
- // // 删除依赖链中的依赖
2249
- // this.dependencies.forEach((tag) => {
2250
- // const [name, version] = tag.split('-');
2251
- // const existNode = this.app.dependencies.find((m) => m.name === name && m.version === version);
2252
- // existNode?.delete();
2253
- // });
2254
- // }
2255
- // 处理同名依赖 重新生成文件
2256
- // if (this.enable) {
2257
- // 删[数据源]
2258
- const dataSourceGroup = (this.parentNode as any)?.configuration?.getGroup('dataSource');
2259
- if (this.dataSources && dataSourceGroup) {
2260
- this.dataSources.forEach((datasource) => {
2261
- this.parentNode?.emit('clear:datasourceError', datasource as any);
2262
- try {
2263
- dataSourceGroup.removeConfigProperty(datasource.name);
2264
- } catch (e) {}
2265
- });
2266
- }
2267
- // // 已启用的依赖库被删除时,将后续被禁用的同名依赖库 切换为启用
2268
- // const index = this.app.dependencies.findIndex((m) => m.enable === false && m.name === this.name);
2269
- // if (index >= 0) {
2270
- // const nextMainModule = this.app.dependencies[index];
2271
- // // 更新[禁用的依赖]enable:true
2272
- // nextMainModule.update({ enable: true });
2273
- // nextMainModule.softDelete({ index });
2274
- // }
2275
- // }
2276
- this.parentNode?.emit('collect:end');
2277
- }
2278
-
2279
- // 删除再添加 触发文件生成
2280
- softDelete(options: { index: number }) {
2281
- // 删[禁用的依赖]
2282
- super.delete();
2283
- // 创建[禁用的依赖]
2284
- this.app.insertModuleInDependenciesAt(this, options.index);
2285
- // 创建[禁用的依赖]的数据源
2286
- const dataSourceGroup = (this.parentNode as any)?.configuration?.getGroup('dataSource');
2287
- if (this.dataSources && dataSourceGroup) {
2288
- this.dataSources.forEach((datasource) => {
2289
- const body: ConfigProperty = ConfigProperty.from({
2290
- name: datasource.name,
2291
- description: '',
2292
- isPrivate: false,
2293
- values: [
2294
- { env: 'dev', value: '', concept: 'ConfigPropertyValue' },
2295
- { env: 'online', value: '', concept: 'ConfigPropertyValue' },
2296
- ],
2297
- });
2298
- dataSourceGroup.addConfigProperty(body);
2299
- });
2300
- }
2301
- }
2613
+ }
2302
2614
 
2303
- //================================================================================
2304
- // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2305
- // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
2306
- //================================================================================
2615
+ //= ===============================================================================
2616
+ // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2617
+ // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
2618
+ //= ===============================================================================
2307
2619
  }
2308
2620
 
2309
2621
  classMap.Module = Module;
2310
2622
  export default Module;
2311
- //================================================================================
2623
+ //= ===============================================================================
2312
2624
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2313
2625
  // 自动生成的代码已结束。下面可以手动编写。
2314
- //================================================================================
2626
+ //= ===============================================================================