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

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