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

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