@lcap/nasl 2.18.0 → 2.20.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/out/automate/engine/index.js +3 -3
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/bak/translator.js +85 -37
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.d.ts +6 -10
  6. package/out/common/BaseNode.js +7 -52
  7. package/out/common/BaseNode.js.map +1 -1
  8. package/out/concepts/AnonymousFunction__.js.map +1 -1
  9. package/out/concepts/App__.d.ts +0 -10
  10. package/out/concepts/App__.js +0 -74
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Assignee__.js.map +1 -1
  13. package/out/concepts/AssignmentLine__.d.ts +5 -5
  14. package/out/concepts/AssignmentLine__.js +6 -6
  15. package/out/concepts/AssignmentLine__.js.map +1 -1
  16. package/out/concepts/Assignment__.js +2 -1
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/BatchAssignment__.d.ts +60 -60
  19. package/out/concepts/BatchAssignment__.js +11 -21
  20. package/out/concepts/BatchAssignment__.js.map +1 -1
  21. package/out/concepts/BindAttribute__.d.ts +0 -19
  22. package/out/concepts/BindAttribute__.js +2 -39
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindEvent__.js.map +1 -1
  25. package/out/concepts/BindStyle__.d.ts +2 -2
  26. package/out/concepts/BindStyle__.js +3 -3
  27. package/out/concepts/BindStyle__.js.map +1 -1
  28. package/out/concepts/BooleanLiteral__.js +8 -0
  29. package/out/concepts/BooleanLiteral__.js.map +1 -1
  30. package/out/concepts/CallFunction__.js +25 -58
  31. package/out/concepts/CallFunction__.js.map +1 -1
  32. package/out/concepts/CallInterface__.d.ts +0 -7
  33. package/out/concepts/CallInterface__.js +7 -53
  34. package/out/concepts/CallInterface__.js.map +1 -1
  35. package/out/concepts/CallLogic__.js +14 -63
  36. package/out/concepts/CallLogic__.js.map +1 -1
  37. package/out/concepts/CallQueryComponent__.js +1 -13
  38. package/out/concepts/CallQueryComponent__.js.map +1 -1
  39. package/out/concepts/CompletionProperty__.js +0 -3
  40. package/out/concepts/CompletionProperty__.js.map +1 -1
  41. package/out/concepts/ConfigGroup__.js.map +1 -1
  42. package/out/concepts/ConfigProperty__.js.map +1 -1
  43. package/out/concepts/Configuration__.js.map +1 -1
  44. package/out/concepts/DataSource__.d.ts +0 -6
  45. package/out/concepts/DataSource__.js +0 -41
  46. package/out/concepts/DataSource__.js.map +1 -1
  47. package/out/concepts/Destination__.d.ts +1 -9
  48. package/out/concepts/Destination__.js +29 -61
  49. package/out/concepts/Destination__.js.map +1 -1
  50. package/out/concepts/EntityProperty__.d.ts +8 -21
  51. package/out/concepts/EntityProperty__.js +23 -109
  52. package/out/concepts/EntityProperty__.js.map +1 -1
  53. package/out/concepts/Entity__.d.ts +0 -32
  54. package/out/concepts/Entity__.js +2 -117
  55. package/out/concepts/Entity__.js.map +1 -1
  56. package/out/concepts/Enum__.js +4 -0
  57. package/out/concepts/Enum__.js.map +1 -1
  58. package/out/concepts/Event__.js.map +1 -1
  59. package/out/concepts/ForEachStatement__.d.ts +4 -0
  60. package/out/concepts/ForEachStatement__.js +8 -4
  61. package/out/concepts/ForEachStatement__.js.map +1 -1
  62. package/out/concepts/Function__.js.map +1 -1
  63. package/out/concepts/Identifier__.js +4 -16
  64. package/out/concepts/Identifier__.js.map +1 -1
  65. package/out/concepts/IfStatement__.d.ts +0 -8
  66. package/out/concepts/IfStatement__.js +0 -22
  67. package/out/concepts/IfStatement__.js.map +1 -1
  68. package/out/concepts/InterfaceParam__.js.map +1 -1
  69. package/out/concepts/Interface__.js.map +1 -1
  70. package/out/concepts/LogicItem__.d.ts +1 -1
  71. package/out/concepts/LogicItem__.js.map +1 -1
  72. package/out/concepts/Logic__.d.ts +1 -6
  73. package/out/concepts/Logic__.js +43 -144
  74. package/out/concepts/Logic__.js.map +1 -1
  75. package/out/concepts/MatchCase__.d.ts +1 -1
  76. package/out/concepts/MatchCase__.js +8 -15
  77. package/out/concepts/MatchCase__.js.map +1 -1
  78. package/out/concepts/Match__.d.ts +19 -21
  79. package/out/concepts/Match__.js +25 -112
  80. package/out/concepts/Match__.js.map +1 -1
  81. package/out/concepts/MemberExpression__.d.ts +1 -4
  82. package/out/concepts/MemberExpression__.js +15 -30
  83. package/out/concepts/MemberExpression__.js.map +1 -1
  84. package/out/concepts/Module__.js.map +1 -1
  85. package/out/concepts/Namespace__.js.map +1 -1
  86. package/out/concepts/NumericLiteral__.js +1 -1
  87. package/out/concepts/NumericLiteral__.js.map +1 -1
  88. package/out/concepts/OqlQueryComponent__.d.ts +3 -7
  89. package/out/concepts/OqlQueryComponent__.js +95 -56
  90. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  91. package/out/concepts/Param__.d.ts +1 -1
  92. package/out/concepts/Param__.js +4 -40
  93. package/out/concepts/Param__.js.map +1 -1
  94. package/out/concepts/ProcessComponent__.js.map +1 -1
  95. package/out/concepts/ProcessElement__.js.map +1 -1
  96. package/out/concepts/Process__.js.map +1 -1
  97. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  98. package/out/concepts/QueryOrderByExpression__.d.ts +3 -3
  99. package/out/concepts/QueryOrderByExpression__.js +3 -3
  100. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  101. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  102. package/out/concepts/Return__.js +2 -38
  103. package/out/concepts/Return__.js.map +1 -1
  104. package/out/concepts/SelectMembers__.d.ts +1 -1
  105. package/out/concepts/SelectMembers__.js +2 -2
  106. package/out/concepts/SelectMembers__.js.map +1 -1
  107. package/out/concepts/SqlQueryComponent__.d.ts +4 -2
  108. package/out/concepts/SqlQueryComponent__.js +88 -9
  109. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  110. package/out/concepts/StringLiteral__.js +7 -0
  111. package/out/concepts/StringLiteral__.js.map +1 -1
  112. package/out/concepts/StructureProperty__.js.map +1 -1
  113. package/out/concepts/Structure__.js.map +1 -1
  114. package/out/concepts/TypeAnnotation__.d.ts +0 -1
  115. package/out/concepts/TypeAnnotation__.js +12 -25
  116. package/out/concepts/TypeAnnotation__.js.map +1 -1
  117. package/out/concepts/TypeParam__.d.ts +0 -1
  118. package/out/concepts/TypeParam__.js +0 -2
  119. package/out/concepts/TypeParam__.js.map +1 -1
  120. package/out/concepts/UnaryExpression__.js +9 -6
  121. package/out/concepts/UnaryExpression__.js.map +1 -1
  122. package/out/concepts/ValidationRule__.js +23 -88
  123. package/out/concepts/ValidationRule__.js.map +1 -1
  124. package/out/concepts/Variable__.js +2 -38
  125. package/out/concepts/Variable__.js.map +1 -1
  126. package/out/concepts/ViewComponent__.js.map +1 -1
  127. package/out/concepts/ViewElement__.d.ts +29 -30
  128. package/out/concepts/ViewElement__.js +51 -117
  129. package/out/concepts/ViewElement__.js.map +1 -1
  130. package/out/concepts/View__.d.ts +3 -4
  131. package/out/concepts/View__.js +83 -93
  132. package/out/concepts/View__.js.map +1 -1
  133. package/out/concepts/WhileStatement__.js +1 -1
  134. package/out/concepts/WhileStatement__.js.map +1 -1
  135. package/out/concepts/basics/stdlib/nasl.browser.js +0 -50
  136. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.ui.js +4 -36
  138. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  139. package/out/concepts/basics/stdlib/nasl.util.js +43 -63
  140. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  141. package/out/concepts/index__.d.ts +0 -2
  142. package/out/concepts/index__.js +0 -2
  143. package/out/concepts/index__.js.map +1 -1
  144. package/out/generator/genBundleFiles.d.ts +2 -5
  145. package/out/generator/genBundleFiles.js +45 -148
  146. package/out/generator/genBundleFiles.js.map +1 -1
  147. package/out/generator/index.d.ts +0 -1
  148. package/out/generator/index.js +0 -1
  149. package/out/generator/index.js.map +1 -1
  150. package/out/index.d.ts +2 -3
  151. package/out/index.js +1 -5
  152. package/out/index.js.map +1 -1
  153. package/out/server/entity2LogicNamespace.js +11 -11
  154. package/out/server/entity2LogicNamespace.js.map +1 -1
  155. package/out/server/extendBaseNode.js.map +1 -1
  156. package/out/server/formatTsUtils.js +17 -10
  157. package/out/server/formatTsUtils.js.map +1 -1
  158. package/out/server/getLogics.js +6 -13
  159. package/out/server/getLogics.js.map +1 -1
  160. package/out/server/getMemberIdentifier.js +7 -7
  161. package/out/server/getMemberIdentifier.js.map +1 -1
  162. package/out/server/getProcesses.d.ts +1 -1
  163. package/out/server/index.d.ts +1 -0
  164. package/out/server/index.js +27 -2
  165. package/out/server/index.js.map +1 -1
  166. package/out/server/naslServer.d.ts +7 -47
  167. package/out/server/naslServer.js +393 -591
  168. package/out/server/naslServer.js.map +1 -1
  169. package/out/server/naslStdlibMap.js +28 -30
  170. package/out/server/naslStdlibMap.js.map +1 -1
  171. package/out/server/translator.js +7 -40
  172. package/out/server/translator.js.map +1 -1
  173. package/out/service/storage/init.js +3 -33
  174. package/out/service/storage/init.js.map +1 -1
  175. package/out/templator/genCreateBlock.js +4 -6
  176. package/out/templator/genCreateBlock.js.map +1 -1
  177. package/out/templator/genCurdEditMultipleKeyBlock.js +4 -7
  178. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  179. package/out/templator/genCurdMultipleKeyBlock.js +5 -7
  180. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  181. package/out/templator/genEnumSelectBlock.js +2 -5
  182. package/out/templator/genEnumSelectBlock.js.map +1 -1
  183. package/out/templator/genGridViewBlock.js +2 -2
  184. package/out/templator/genGridViewBlock.js.map +1 -1
  185. package/out/templator/genListViewBlock.js +2 -2
  186. package/out/templator/genListViewBlock.js.map +1 -1
  187. package/out/templator/genQueryComponent.d.ts +2 -2
  188. package/out/templator/genQueryComponent.js +1 -4
  189. package/out/templator/genQueryComponent.js.map +1 -1
  190. package/out/templator/genTableBlock.js +2 -2
  191. package/out/templator/genTableBlock.js.map +1 -1
  192. package/out/templator/genUpdateBlock.js +3 -4
  193. package/out/templator/genUpdateBlock.js.map +1 -1
  194. package/out/templator/utils.js +1 -1
  195. package/out/templator/utils.js.map +1 -1
  196. package/out/test/integration/node-nasl-server.js +38 -10
  197. package/out/test/integration/node-nasl-server.js.map +1 -1
  198. package/out/translator/index.d.ts +0 -1
  199. package/out/translator/index.js +1 -1
  200. package/out/translator/index.js.map +1 -1
  201. package/out/utils/index.d.ts +0 -1
  202. package/out/utils/index.js +1 -38
  203. package/out/utils/index.js.map +1 -1
  204. package/out/utils/string.d.ts +2 -15
  205. package/out/utils/string.js +3 -18
  206. package/out/utils/string.js.map +1 -1
  207. package/package.json +2 -2
  208. package/sandbox/stdlib/nasl.auth.ts +1 -1
  209. package/sandbox/stdlib/nasl.core.ts +1 -0
  210. package/sandbox/stdlib/nasl.logging.ts +4 -4
  211. package/sandbox/stdlib/nasl.util.ts +9 -5
  212. package/src/automate/engine/index.js +4 -4
  213. package/src/automate/engine/uniqueName.js +3 -3
  214. package/src/automate/template/myProcess.js +1 -1
  215. package/src/automate/upgrader/2.20.js +41 -0
  216. package/src/bak/translator.js +4 -1
  217. package/src/common/BaseNode.ts +1 -0
  218. package/src/concepts/AnonymousFunction__.ts +48 -2
  219. package/src/concepts/App__.ts +288 -615
  220. package/src/concepts/BatchAssignment__.ts +111 -51
  221. package/src/concepts/BindAttribute__.ts +18 -25
  222. package/src/concepts/BindDirective__.ts +7 -0
  223. package/src/concepts/BindEvent__.ts +7 -0
  224. package/src/concepts/BindStyle__.ts +7 -0
  225. package/src/concepts/CallFunction__.ts +34 -45
  226. package/src/concepts/CallInterface__.ts +2 -1
  227. package/src/concepts/CallLogic__.ts +87 -55
  228. package/src/concepts/CallQueryComponent__.ts +4 -1
  229. package/src/concepts/Constant__.ts +7 -0
  230. package/src/concepts/DataSource__.ts +57 -5
  231. package/src/concepts/Destination__.ts +100 -43
  232. package/src/concepts/Frontend__.ts +937 -0
  233. package/src/concepts/Identifier__.ts +18 -16
  234. package/src/concepts/LogicItem__.ts +8 -1
  235. package/src/concepts/Logic__.ts +134 -149
  236. package/src/concepts/Match__.ts +13 -29
  237. package/src/concepts/NewComposite__.ts +1357 -0
  238. package/src/concepts/NewList__.ts +440 -0
  239. package/src/concepts/NewMap__.ts +666 -0
  240. package/src/concepts/New__.ts +73 -0
  241. package/src/concepts/Param__.ts +245 -199
  242. package/src/concepts/ProcessElement__.ts +43 -36
  243. package/src/concepts/ProcessOutcomes__.ts +90 -0
  244. package/src/concepts/Process__.ts +1 -23
  245. package/src/concepts/Return__.ts +11 -1
  246. package/src/concepts/SelectMembers__.ts +3 -3
  247. package/src/concepts/Transactional__.ts +7 -0
  248. package/src/concepts/TypeAnnotation__.ts +54 -49
  249. package/src/concepts/ValidationRule__.ts +19 -1
  250. package/src/concepts/Variable__.ts +12 -6
  251. package/src/concepts/ViewElement__.ts +26 -3
  252. package/src/concepts/View__.ts +25 -25
  253. package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
  254. package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
  255. package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
  256. package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
  257. package/src/concepts/index__.ts +7 -0
  258. package/src/enums/KEYWORDS.ts +9 -0
  259. package/src/generator/genBundleFiles.ts +74 -245
  260. package/src/generator/genMetaData.ts +178 -78
  261. package/src/generator/genReleaseBody.ts +87 -44
  262. package/src/generator/index.ts +1 -0
  263. package/src/generator/permission.ts +261 -0
  264. package/src/index.ts +1 -1
  265. package/src/server/entity2LogicNamespace.ts +90 -10
  266. package/src/server/extendBaseNode.ts +33 -22
  267. package/src/server/formatTsUtils.ts +36 -46
  268. package/src/server/getLogics.ts +13 -1
  269. package/src/server/getMemberIdentifier.ts +5 -5
  270. package/src/server/getProcesses.ts +1 -1
  271. package/src/server/naslServer.ts +254 -71
  272. package/src/server/process2LogicNamespace.ts +8 -0
  273. package/src/server/translator.ts +51 -5
  274. package/src/service/creator/add.configs.js +4 -0
  275. package/src/service/datasource/api.js +11 -0
  276. package/src/service/datasource/index.js +6 -0
  277. package/src/service/storage/init.ts +12 -0
  278. package/src/service/video/VideoTranscribe.js +1 -0
  279. package/src/templator/genEditTableBlock.ts +8 -16
  280. package/src/templator/genGetBlock.ts +18 -19
  281. package/src/templator/genGridViewBlock.ts +18 -18
  282. package/src/templator/genListViewBlock.ts +8 -11
  283. package/src/templator/genTableBlock.ts +6 -10
  284. package/ts-worker/lib/tsserver.js +8 -1
  285. package/out/automate/engine/2.14-components.d.ts +0 -1115
  286. package/out/automate/engine/2.14-components.js +0 -1087
  287. package/out/automate/engine/2.14-components.js.map +0 -1
  288. package/out/concepts/ExternalDestination__.d.ts +0 -73
  289. package/out/concepts/ExternalDestination__.js +0 -264
  290. package/out/concepts/ExternalDestination__.js.map +0 -1
  291. package/out/concepts/MatchExpression__.d.ts +0 -97
  292. package/out/concepts/MatchExpression__.js +0 -281
  293. package/out/concepts/MatchExpression__.js.map +0 -1
  294. package/out/concepts/StringInterpolation__.d.ts +0 -113
  295. package/out/concepts/StringInterpolation__.js +0 -227
  296. package/out/concepts/StringInterpolation__.js.map +0 -1
  297. package/out/generator/genReleaseBody.d.ts +0 -41
  298. package/out/generator/genReleaseBody.js +0 -340
  299. package/out/generator/genReleaseBody.js.map +0 -1
  300. package/out/service/defaultErrorMessage.json +0 -97
  301. package/out/service/logic/api.d.ts +0 -9
  302. package/out/service/logic/api.js +0 -11
  303. package/out/service/logic/api.js.map +0 -1
  304. package/out/service/logic/index.d.ts +0 -2
  305. package/out/service/logic/index.js +0 -10
  306. package/out/service/logic/index.js.map +0 -1
  307. package/src/automate/engine/dist/index.dev.js +0 -517
  308. package/src/common/dist/BaseNode.js +0 -1101
  309. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
  310. package/src/concepts/dist/Anchor__.js +0 -179
  311. package/src/concepts/dist/Assignment__.js +0 -301
  312. package/src/concepts/dist/CallFunction__.js +0 -473
  313. package/src/concepts/dist/CallInterface__.js +0 -533
  314. package/src/concepts/dist/CallLogic__.js +0 -864
  315. package/src/concepts/dist/ForEachStatement__.js +0 -426
  316. package/src/concepts/dist/MatchCase__.js +0 -587
  317. package/src/concepts/dist/MemberExpression__.js +0 -348
  318. package/src/concepts/dist/Param__.js +0 -537
  319. package/src/concepts/dist/Return__.js +0 -493
  320. package/src/generator/dist/genBundleFiles.js +0 -414
  321. package/src/server/dist/formatTsUtils.js +0 -683
  322. package/src/server/dist/naslServer.js +0 -3396
  323. package/src/service/storage/dist/init.js +0 -541
  324. package/ts-worker/dist/webpack.config.dev.js +0 -104
  325. package/ts-worker/lib/dist/tsserver.dev.js +0 -22953
  326. package/ts-worker/sources/lib/dist/tsserver.dev.js +0 -22912
@@ -3,10 +3,12 @@ export interface AssetsInfo {
3
3
  css: Array<string>;
4
4
  names?: Array<string>;
5
5
  }
6
+
6
7
  import { queryNodeByPath } from '../service/storage/jsoner';
7
8
  import { getNaslNodeByNodeCallee, getNodeByNodeCallee } from '../automate/engine/utils';
8
9
  import ConfigProperty from './ConfigProperty__';
9
10
  import TypeAnnotation from './TypeAnnotation__';
11
+ // import CallLogic from './CallLogic__';
10
12
  //================================================================================
11
13
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
12
14
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -23,11 +25,9 @@ import Structure from './Structure__';
23
25
  import Enum from './Enum__';
24
26
  import Logic from './Logic__';
25
27
  import Interface from './Interface__';
26
- import View from './View__';
27
- import Variable from './Variable__';
28
+ import Frontend from './Frontend__';
28
29
  import Process from './Process__';
29
30
  import Role from './Role__';
30
- import Theme from './Theme__';
31
31
  import Configuration from './Configuration__';
32
32
  import Module from './Module__';
33
33
 
@@ -84,24 +84,6 @@ export class App extends BaseNode {
84
84
  @property()
85
85
  dnsAddr: string = undefined;
86
86
 
87
- /**
88
- * PC/H5 端
89
- */
90
- @property()
91
- scope: 'pc' | 'h5' = undefined;
92
-
93
- /**
94
- * 制品应用标题
95
- */
96
- @property()
97
- documentTitle: string = undefined;
98
-
99
- /**
100
- * 制品应用图标
101
- */
102
- @property()
103
- documentIcon: string = undefined;
104
-
105
87
  /**
106
88
  * 是否有用户中心
107
89
  */
@@ -145,16 +127,10 @@ export class App extends BaseNode {
145
127
  interfaces: Array<Interface> = [];
146
128
 
147
129
  /**
148
- * 页面列表
149
- */
150
- @property('View')
151
- views: Array<View> = [];
152
-
153
- /**
154
- * 变量列表
130
+ * 端列表
155
131
  */
156
- @property('Variable')
157
- frontendVariables: Array<Variable> = [];
132
+ @property('Frontend')
133
+ frontends: Array<Frontend> = [];
158
134
 
159
135
  /**
160
136
  * 流程列表
@@ -168,12 +144,6 @@ export class App extends BaseNode {
168
144
  @property('Role')
169
145
  roles: Array<Role> = [];
170
146
 
171
- /**
172
- * 主题配置
173
- */
174
- @property('Theme')
175
- theme: Theme = new Theme();
176
-
177
147
  /**
178
148
  * 配置管理
179
149
  */
@@ -192,12 +162,6 @@ export class App extends BaseNode {
192
162
  @property('Module')
193
163
  interfaceDependencies: Array<Module> = [];
194
164
 
195
- /**
196
- * 扩展组件列表(兼容老版)
197
- */
198
- @property('Module')
199
- componentDependencies: Array<Module> = [];
200
-
201
165
 
202
166
 
203
167
  /**
@@ -224,29 +188,7 @@ export class App extends BaseNode {
224
188
  }
225
189
  return params;
226
190
  }
227
- /**
228
- * 设置制品应用标题
229
- */
230
- setDocumentTitle(documentTitle: string) {
231
- const object = {
232
- documentTitle,
233
- };
234
- this.update({
235
- ...object,
236
- });
237
- }
238
-
239
- /**
240
- * 设置制品应用图标
241
- */
242
- setDocumentIcon(documentIcon: string) {
243
- const object = {
244
- documentIcon,
245
- };
246
- this.update({
247
- ...object,
248
- });
249
- }
191
+
250
192
 
251
193
  getDataSourceUniqueName(name = 'dataSource1') {
252
194
  return utils.unique(name, this.getDataSourceExistingNames(), undefined, true);
@@ -954,285 +896,143 @@ export class App extends BaseNode {
954
896
  }
955
897
 
956
898
 
957
- getViewExistingNames(excludedList: Array<View> = []) {
958
- const excludedSet = new Set(excludedList);
959
- return ((this.views as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
960
- }
961
- getViewUniqueName(name = 'view1') {
962
- return utils.unique(name, this.getViewExistingNames(), undefined, true);
963
- }
964
-
965
- /**
966
- * 插入页面
967
- * @internal
968
- * @param name 页面名称,如果不填会自动生成一个唯一名称
969
- */
970
- _insertViewAt(name: string, index: number): View;
971
-
972
- /**
973
- * 插入页面
974
- * @internal
975
- * @param viewOptions 页面参数
976
- */
977
- _insertViewAt(viewOptions: Partial<View>, index: number): View;
978
-
979
- /**
980
- * 插入页面
981
- * @internal
982
- * @param view 已有的页面实例
983
- */
984
- _insertViewAt(view: View, index: number): View;
985
-
986
- _insertViewAt(options: string | Partial<View> | View, index: number) {
987
- const viewOptions: any = {};
988
- const relationOptions = { parentNode: this, parentKey: 'views' };
989
- let view: View;
990
- if (!options) {
991
- view = View.from({
992
- ...viewOptions,
993
- name: this.getViewUniqueName(),
994
- }, this, 'views');
995
- } else if (typeof options === 'string') {
996
- view = View.from({
997
- ...viewOptions,
998
- name: options,
999
- }, this, 'views');
1000
- } else if (options instanceof View) {
1001
- options.ensureDelete(); // 同一实例不支持多处存在
1002
- view = options;
1003
- Object.assign(view, relationOptions);
1004
- } else {
1005
- view = View.from({
1006
- ...viewOptions,
1007
- ...options,
1008
- }, this, 'views');
1009
- }
1010
- this.views.splice(index, 0, view);
1011
- return view;
1012
- }
1013
-
1014
- /**
1015
- * 插入页面
1016
- * @param name 页面名称,如果不填会自动生成一个唯一名称
1017
- */
1018
- insertViewAt(name: string, index: number): View;
1019
-
1020
- /**
1021
- * 插入页面
1022
- * @param viewOptions 页面参数
1023
- */
1024
- insertViewAt(viewOptions: Partial<View>, index: number): View;
1025
-
1026
- /**
1027
- * 插入页面
1028
- * @param view 已有的页面实例
1029
- */
1030
- insertViewAt(view: View, index: number): View;
1031
-
1032
- insertViewAt(options: string | Partial<View> | View, index: number) {
1033
- const node = this._insertViewAt(options as any, index);
1034
- node.create({
1035
- index,
1036
- parentNode: this,
1037
- parentKey: 'views',
1038
- });
1039
- return node;
1040
- }
1041
-
1042
- /**
1043
- * 添加页面
1044
- * @internal
1045
- * @param name 页面名称,如果不填会自动生成一个唯一名称
1046
- */
1047
- _addView(name?: string): View;
1048
-
1049
- /**
1050
- * 添加页面
1051
- * @internal
1052
- * @param viewOptions 页面参数
1053
- */
1054
- _addView(viewOptions: Partial<View>): View;
1055
-
1056
- /**
1057
- * 添加页面
1058
- * @internal
1059
- * @param view 已有的页面实例
1060
- */
1061
- _addView(view: View): View;
1062
-
1063
- _addView(options?: string | Partial<View> | View) {
1064
- const index = this.views.length;
1065
- return this._insertViewAt(options as any, index);
1066
- }
1067
-
1068
- /**
1069
- * 添加页面
1070
- * @internal
1071
- * @param name 页面名称,如果不填会自动生成一个唯一名称
1072
- */
1073
- addView(name?: string): View;
1074
-
1075
- /**
1076
- * 添加页面
1077
- * @param viewOptions 页面参数
1078
- */
1079
- addView(viewOptions: Partial<View>): View;
1080
-
1081
- /**
1082
- * 添加页面
1083
- * @param view 已有的页面实例
1084
- */
1085
- addView(view: View): View;
1086
-
1087
- addView(options?: string | Partial<View> | View) {
1088
- const node = this._addView(options as any);
1089
- const index = this.views.indexOf(node);
1090
- node.create({
1091
- index,
1092
- parentNode: this,
1093
- parentKey: 'views',
1094
- });
1095
- return node;
1096
- }
1097
-
1098
-
1099
- getVarExistingNames(excludedList: Array<Variable> = []) {
899
+ getFrontendExistingNames(excludedList: Array<Frontend> = []) {
1100
900
  const excludedSet = new Set(excludedList);
1101
- return ((this.frontendVariables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
901
+ return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
1102
902
  }
1103
- getVariableUniqueName(name = 'variable1') {
1104
- return utils.unique(name, this.getVarExistingNames(), undefined, true);
903
+ getFrontendUniqueName(name = 'frontend1') {
904
+ return utils.unique(name, this.getFrontendExistingNames(), undefined, true);
1105
905
  }
1106
906
 
1107
907
  /**
1108
- * 插入变量
908
+ * 插入端
1109
909
  * @internal
1110
- * @param name 变量名称,如果不填会自动生成一个唯一名称
910
+ * @param name 端名称,如果不填会自动生成一个唯一名称
1111
911
  */
1112
- _insertVariableAt(name: string, index: number): Variable;
912
+ _insertFrontendAt(name: string, index: number): Frontend;
1113
913
 
1114
914
  /**
1115
- * 插入变量
915
+ * 插入端
1116
916
  * @internal
1117
- * @param variableOptions 变量参数
917
+ * @param frontendOptions 端参数
1118
918
  */
1119
- _insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
919
+ _insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
1120
920
 
1121
921
  /**
1122
- * 插入变量
922
+ * 插入端
1123
923
  * @internal
1124
- * @param variable 已有的变量实例
924
+ * @param frontend 已有的端实例
1125
925
  */
1126
- _insertVariableAt(variable: Variable, index: number): Variable;
926
+ _insertFrontendAt(frontend: Frontend, index: number): Frontend;
1127
927
 
1128
- _insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1129
- const variableOptions: any = {};
1130
- const relationOptions = { parentNode: this, parentKey: 'frontendVariables' };
1131
- let variable: Variable;
928
+ _insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
929
+ const frontendOptions: any = {};
930
+ const relationOptions = { parentNode: this, parentKey: 'frontends' };
931
+ let frontend: Frontend;
1132
932
  if (!options) {
1133
- variable = Variable.from({
1134
- ...variableOptions,
1135
- name: this.getVariableUniqueName(),
1136
- }, this, 'frontendVariables');
933
+ frontend = Frontend.from({
934
+ ...frontendOptions,
935
+ name: this.getFrontendUniqueName(),
936
+ }, this, 'frontends');
1137
937
  } else if (typeof options === 'string') {
1138
- variable = Variable.from({
1139
- ...variableOptions,
938
+ frontend = Frontend.from({
939
+ ...frontendOptions,
1140
940
  name: options,
1141
- }, this, 'frontendVariables');
1142
- } else if (options instanceof Variable) {
941
+ }, this, 'frontends');
942
+ } else if (options instanceof Frontend) {
1143
943
  options.ensureDelete(); // 同一实例不支持多处存在
1144
- variable = options;
1145
- Object.assign(variable, relationOptions);
944
+ frontend = options;
945
+ Object.assign(frontend, relationOptions);
1146
946
  } else {
1147
- variable = Variable.from({
1148
- ...variableOptions,
947
+ frontend = Frontend.from({
948
+ ...frontendOptions,
1149
949
  ...options,
1150
- }, this, 'frontendVariables');
950
+ }, this, 'frontends');
1151
951
  }
1152
- this.frontendVariables.splice(index, 0, variable);
1153
- return variable;
952
+ this.frontends.splice(index, 0, frontend);
953
+ return frontend;
1154
954
  }
1155
955
 
1156
956
  /**
1157
- * 插入变量
1158
- * @param name 变量名称,如果不填会自动生成一个唯一名称
957
+ * 插入端
958
+ * @param name 端名称,如果不填会自动生成一个唯一名称
1159
959
  */
1160
- insertVariableAt(name: string, index: number): Variable;
960
+ insertFrontendAt(name: string, index: number): Frontend;
1161
961
 
1162
962
  /**
1163
- * 插入变量
1164
- * @param variableOptions 变量参数
963
+ * 插入端
964
+ * @param frontendOptions 端参数
1165
965
  */
1166
- insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
966
+ insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
1167
967
 
1168
968
  /**
1169
- * 插入变量
1170
- * @param variable 已有的变量实例
969
+ * 插入端
970
+ * @param frontend 已有的端实例
1171
971
  */
1172
- insertVariableAt(variable: Variable, index: number): Variable;
972
+ insertFrontendAt(frontend: Frontend, index: number): Frontend;
1173
973
 
1174
- insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
1175
- const node = this._insertVariableAt(options as any, index);
974
+ insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
975
+ const node = this._insertFrontendAt(options as any, index);
1176
976
  node.create({
1177
977
  index,
1178
978
  parentNode: this,
1179
- parentKey: 'frontendVariables',
979
+ parentKey: 'frontends',
1180
980
  });
1181
981
  return node;
1182
982
  }
1183
983
 
1184
984
  /**
1185
- * 添加变量
985
+ * 添加端
1186
986
  * @internal
1187
- * @param name 变量名称,如果不填会自动生成一个唯一名称
987
+ * @param name 端名称,如果不填会自动生成一个唯一名称
1188
988
  */
1189
- _addVariable(name?: string): Variable;
989
+ _addFrontend(name?: string): Frontend;
1190
990
 
1191
991
  /**
1192
- * 添加变量
992
+ * 添加端
1193
993
  * @internal
1194
- * @param variableOptions 变量参数
994
+ * @param frontendOptions 端参数
1195
995
  */
1196
- _addVariable(variableOptions: Partial<Variable>): Variable;
996
+ _addFrontend(frontendOptions: Partial<Frontend>): Frontend;
1197
997
 
1198
998
  /**
1199
- * 添加变量
999
+ * 添加端
1200
1000
  * @internal
1201
- * @param variable 已有的变量实例
1001
+ * @param frontend 已有的端实例
1202
1002
  */
1203
- _addVariable(variable: Variable): Variable;
1003
+ _addFrontend(frontend: Frontend): Frontend;
1204
1004
 
1205
- _addVariable(options?: string | Partial<Variable> | Variable) {
1206
- const index = this.frontendVariables.length;
1207
- return this._insertVariableAt(options as any, index);
1005
+ _addFrontend(options?: string | Partial<Frontend> | Frontend) {
1006
+ const index = this.frontends.length;
1007
+ return this._insertFrontendAt(options as any, index);
1208
1008
  }
1209
1009
 
1210
1010
  /**
1211
- * 添加变量
1011
+ * 添加端
1212
1012
  * @internal
1213
- * @param name 变量名称,如果不填会自动生成一个唯一名称
1013
+ * @param name 端名称,如果不填会自动生成一个唯一名称
1214
1014
  */
1215
- addVariable(name?: string): Variable;
1015
+ addFrontend(name?: string): Frontend;
1216
1016
 
1217
1017
  /**
1218
- * 添加变量
1219
- * @param variableOptions 变量参数
1018
+ * 添加端
1019
+ * @param frontendOptions 端参数
1220
1020
  */
1221
- addVariable(variableOptions: Partial<Variable>): Variable;
1021
+ addFrontend(frontendOptions: Partial<Frontend>): Frontend;
1222
1022
 
1223
1023
  /**
1224
- * 添加变量
1225
- * @param variable 已有的变量实例
1024
+ * 添加端
1025
+ * @param frontend 已有的端实例
1226
1026
  */
1227
- addVariable(variable: Variable): Variable;
1027
+ addFrontend(frontend: Frontend): Frontend;
1228
1028
 
1229
- addVariable(options?: string | Partial<Variable> | Variable) {
1230
- const node = this._addVariable(options as any);
1231
- const index = this.frontendVariables.indexOf(node);
1029
+ addFrontend(options?: string | Partial<Frontend> | Frontend) {
1030
+ const node = this._addFrontend(options as any);
1031
+ const index = this.frontends.indexOf(node);
1232
1032
  node.create({
1233
1033
  index,
1234
1034
  parentNode: this,
1235
- parentKey: 'frontendVariables',
1035
+ parentKey: 'frontends',
1236
1036
  });
1237
1037
  return node;
1238
1038
  }
@@ -1796,139 +1596,6 @@ export class App extends BaseNode {
1796
1596
  return node;
1797
1597
  }
1798
1598
 
1799
- /**
1800
- * 插入模块
1801
- * @internal
1802
- * @param name 模块名称,如果不填会自动生成一个唯一名称
1803
- */
1804
- _insertModuleInComponentDependenciesAt(name: string, index: number): Module;
1805
-
1806
- /**
1807
- * 插入模块
1808
- * @internal
1809
- * @param moduleOptions 模块参数
1810
- */
1811
- _insertModuleInComponentDependenciesAt(moduleOptions: Partial<Module>, index: number): Module;
1812
-
1813
- /**
1814
- * 插入模块
1815
- * @internal
1816
- * @param module 已有的模块实例
1817
- */
1818
- _insertModuleInComponentDependenciesAt(module: Module, index: number): Module;
1819
-
1820
- _insertModuleInComponentDependenciesAt(options: string | Partial<Module> | Module, index: number) {
1821
- const moduleOptions: any = {};
1822
- const relationOptions = { parentNode: this, parentKey: 'componentDependencies' };
1823
- let module: Module;
1824
- if (!options) {
1825
- module = Module.from({
1826
- ...moduleOptions,
1827
- name: this.getModuleUniqueName(),
1828
- }, this, 'componentDependencies');
1829
- } else if (typeof options === 'string') {
1830
- module = Module.from({
1831
- ...moduleOptions,
1832
- name: options,
1833
- }, this, 'componentDependencies');
1834
- } else if (options instanceof Module) {
1835
- options.ensureDelete(); // 同一实例不支持多处存在
1836
- module = options;
1837
- Object.assign(module, relationOptions);
1838
- } else {
1839
- module = Module.from({
1840
- ...moduleOptions,
1841
- ...options,
1842
- }, this, 'componentDependencies');
1843
- }
1844
- this.componentDependencies.splice(index, 0, module);
1845
- return module;
1846
- }
1847
-
1848
- /**
1849
- * 插入模块
1850
- * @param name 模块名称,如果不填会自动生成一个唯一名称
1851
- */
1852
- insertModuleInComponentDependenciesAt(name: string, index: number): Module;
1853
-
1854
- /**
1855
- * 插入模块
1856
- * @param moduleOptions 模块参数
1857
- */
1858
- insertModuleInComponentDependenciesAt(moduleOptions: Partial<Module>, index: number): Module;
1859
-
1860
- /**
1861
- * 插入模块
1862
- * @param module 已有的模块实例
1863
- */
1864
- insertModuleInComponentDependenciesAt(module: Module, index: number): Module;
1865
-
1866
- insertModuleInComponentDependenciesAt(options: string | Partial<Module> | Module, index: number) {
1867
- const node = this._insertModuleInComponentDependenciesAt(options as any, index);
1868
- node.create({
1869
- index,
1870
- parentNode: this,
1871
- parentKey: 'componentDependencies',
1872
- });
1873
- return node;
1874
- }
1875
-
1876
- /**
1877
- * 添加模块
1878
- * @internal
1879
- * @param name 模块名称,如果不填会自动生成一个唯一名称
1880
- */
1881
- _addModuleInComponentDependencies(name?: string): Module;
1882
-
1883
- /**
1884
- * 添加模块
1885
- * @internal
1886
- * @param moduleOptions 模块参数
1887
- */
1888
- _addModuleInComponentDependencies(moduleOptions: Partial<Module>): Module;
1889
-
1890
- /**
1891
- * 添加模块
1892
- * @internal
1893
- * @param module 已有的模块实例
1894
- */
1895
- _addModuleInComponentDependencies(module: Module): Module;
1896
-
1897
- _addModuleInComponentDependencies(options?: string | Partial<Module> | Module) {
1898
- const index = this.componentDependencies.length;
1899
- return this._insertModuleInComponentDependenciesAt(options as any, index);
1900
- }
1901
-
1902
- /**
1903
- * 添加模块
1904
- * @internal
1905
- * @param name 模块名称,如果不填会自动生成一个唯一名称
1906
- */
1907
- addModuleInComponentDependencies(name?: string): Module;
1908
-
1909
- /**
1910
- * 添加模块
1911
- * @param moduleOptions 模块参数
1912
- */
1913
- addModuleInComponentDependencies(moduleOptions: Partial<Module>): Module;
1914
-
1915
- /**
1916
- * 添加模块
1917
- * @param module 已有的模块实例
1918
- */
1919
- addModuleInComponentDependencies(module: Module): Module;
1920
-
1921
- addModuleInComponentDependencies(options?: string | Partial<Module> | Module) {
1922
- const node = this._addModuleInComponentDependencies(options as any);
1923
- const index = this.componentDependencies.indexOf(node);
1924
- node.create({
1925
- index,
1926
- parentNode: this,
1927
- parentKey: 'componentDependencies',
1928
- });
1929
- return node;
1930
- }
1931
-
1932
1599
 
1933
1600
 
1934
1601
 
@@ -2183,96 +1850,46 @@ export class App extends BaseNode {
2183
1850
 
2184
1851
 
2185
1852
  /**
2186
- * 删除页面
2187
- * @param name 页面名称
2188
- */
2189
- removeView(name: string): void;
2190
-
2191
- /**
2192
- * 删除页面
2193
- * @param view 已有的页面实例
2194
- */
2195
- removeView(view: View): void;
2196
-
2197
- removeView(options: string | View) {
2198
- let view: View;
2199
- if (typeof options === 'string') {
2200
- view = (this.views as View[]).find((item) => item.name === options);
2201
- if (!view) {
2202
- throw new Error('找不到页面 ' + options);
2203
- }
2204
- } else {
2205
- view = options;
2206
- }
2207
- return view.delete();
2208
- }
2209
-
2210
- __removeView(view: View) {
2211
- const parentKey = view.parentKey;
2212
- const params: Params = {
2213
- parentNode: this,
2214
- parentKey,
2215
- index: -1,
2216
- object: null,
2217
- oldObject: view,
2218
- };
2219
- if (parentKey) {
2220
- params.parentKey = parentKey;
2221
- if (Array.isArray((this as any)[parentKey])) {
2222
- const index = (this as any)[parentKey].indexOf(view);
2223
- ~index && (this as any)[parentKey].splice(index, 1);
2224
- params.index = index;
2225
- } else if ((this as any)[parentKey] === view) {
2226
- params.index = 0;
2227
- (this as any)[parentKey] = undefined;
2228
- }
2229
- }
2230
- return params;
2231
- }
2232
-
2233
-
2234
-
2235
- /**
2236
- * 删除变量
2237
- * @param name 变量名称
1853
+ * 删除端
1854
+ * @param name 端名称
2238
1855
  */
2239
- removeVariable(name: string): void;
1856
+ removeFrontend(name: string): void;
2240
1857
 
2241
1858
  /**
2242
- * 删除变量
2243
- * @param variable 已有的变量实例
1859
+ * 删除端
1860
+ * @param frontend 已有的端实例
2244
1861
  */
2245
- removeVariable(variable: Variable): void;
1862
+ removeFrontend(frontend: Frontend): void;
2246
1863
 
2247
- removeVariable(options: string | Variable) {
2248
- let variable: Variable;
1864
+ removeFrontend(options: string | Frontend) {
1865
+ let frontend: Frontend;
2249
1866
  if (typeof options === 'string') {
2250
- variable = (this.frontendVariables as Variable[]).find((item) => item.name === options);
2251
- if (!variable) {
2252
- throw new Error('找不到变量 ' + options);
1867
+ frontend = (this.frontends as Frontend[]).find((item) => item.name === options);
1868
+ if (!frontend) {
1869
+ throw new Error('找不到端 ' + options);
2253
1870
  }
2254
1871
  } else {
2255
- variable = options;
1872
+ frontend = options;
2256
1873
  }
2257
- return variable.delete();
1874
+ return frontend.delete();
2258
1875
  }
2259
1876
 
2260
- __removeVariable(variable: Variable) {
2261
- const parentKey = variable.parentKey;
1877
+ __removeFrontend(frontend: Frontend) {
1878
+ const parentKey = frontend.parentKey;
2262
1879
  const params: Params = {
2263
1880
  parentNode: this,
2264
1881
  parentKey,
2265
1882
  index: -1,
2266
1883
  object: null,
2267
- oldObject: variable,
1884
+ oldObject: frontend,
2268
1885
  };
2269
1886
  if (parentKey) {
2270
1887
  params.parentKey = parentKey;
2271
1888
  if (Array.isArray((this as any)[parentKey])) {
2272
- const index = (this as any)[parentKey].indexOf(variable);
1889
+ const index = (this as any)[parentKey].indexOf(frontend);
2273
1890
  ~index && (this as any)[parentKey].splice(index, 1);
2274
1891
  params.index = index;
2275
- } else if ((this as any)[parentKey] === variable) {
1892
+ } else if ((this as any)[parentKey] === frontend) {
2276
1893
  params.index = 0;
2277
1894
  (this as any)[parentKey] = undefined;
2278
1895
  }
@@ -2382,56 +1999,6 @@ export class App extends BaseNode {
2382
1999
 
2383
2000
 
2384
2001
 
2385
- /**
2386
- * 删除主题
2387
- * @param name 主题名称
2388
- */
2389
- removeTheme(name: string): void;
2390
-
2391
- /**
2392
- * 删除主题
2393
- * @param theme 已有的主题实例
2394
- */
2395
- removeTheme(theme: Theme): void;
2396
-
2397
- removeTheme(options: string | Theme) {
2398
- let theme: Theme;
2399
- if (typeof options === 'string') {
2400
- theme = this.theme;
2401
- if (!theme) {
2402
- throw new Error('找不到主题 ' + options);
2403
- }
2404
- } else {
2405
- theme = options;
2406
- }
2407
- return theme.delete();
2408
- }
2409
-
2410
- __removeTheme(theme: Theme) {
2411
- const parentKey = theme.parentKey;
2412
- const params: Params = {
2413
- parentNode: this,
2414
- parentKey,
2415
- index: -1,
2416
- object: null,
2417
- oldObject: theme,
2418
- };
2419
- if (parentKey) {
2420
- params.parentKey = parentKey;
2421
- if (Array.isArray((this as any)[parentKey])) {
2422
- const index = (this as any)[parentKey].indexOf(theme);
2423
- ~index && (this as any)[parentKey].splice(index, 1);
2424
- params.index = index;
2425
- } else if ((this as any)[parentKey] === theme) {
2426
- params.index = 0;
2427
- (this as any)[parentKey] = undefined;
2428
- }
2429
- }
2430
- return params;
2431
- }
2432
-
2433
-
2434
-
2435
2002
  /**
2436
2003
  * 删除配置管理
2437
2004
  * @param name 配置管理名称
@@ -2534,33 +2101,6 @@ export class App extends BaseNode {
2534
2101
  return module.delete();
2535
2102
  }
2536
2103
 
2537
-
2538
-
2539
- /**
2540
- * 删除模块
2541
- * @param name 模块名称
2542
- */
2543
- removeModuleInComponentDependencies(name: string): void;
2544
-
2545
- /**
2546
- * 删除模块
2547
- * @param module 已有的模块实例
2548
- */
2549
- removeModuleInComponentDependencies(module: Module): void;
2550
-
2551
- removeModuleInComponentDependencies(options: string | Module) {
2552
- let module: Module;
2553
- if (typeof options === 'string') {
2554
- module = (this.componentDependencies as Module[]).find((item) => item.name === options);
2555
- if (!module) {
2556
- throw new Error('找不到模块 ' + options);
2557
- }
2558
- } else {
2559
- module = options;
2560
- }
2561
- return module.delete();
2562
- }
2563
-
2564
2104
  __removeModule(module: Module) {
2565
2105
  const parentKey = module.parentKey;
2566
2106
  const params: Params = {
@@ -2588,9 +2128,6 @@ export class App extends BaseNode {
2588
2128
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2589
2129
  // 自动生成的代码已结束。下面可以手动编写。
2590
2130
  //================================================================================
2591
- findComponentDependencyByName(name: string) {
2592
- return this.componentDependencies.find((componentDependency) => componentDependency.name === name);
2593
- }
2594
2131
 
2595
2132
  findDataSourceByName(name: string) {
2596
2133
  return this.dataSources.find((dataSourceItem) => dataSourceItem.name === name);
@@ -2722,50 +2259,35 @@ export class App extends BaseNode {
2722
2259
  return node;
2723
2260
  }
2724
2261
 
2725
- /**
2726
- * @param path 路径
2727
- * path 为要查找路径:如 /dashboard/student/list、/dashboard/student/list
2728
- */
2729
- findViewByPath(path: string) {
2730
- const arr = path.split('/');
2731
- if (arr[0] === '')
2732
- arr.shift();
2733
-
2734
- if (!arr.length)
2735
- throw Error('Cannot find View ' + path);
2736
- const childName = arr.shift();
2737
- const subView = this.views.find((child) => child.name === childName);
2738
- return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
2739
- }
2740
-
2741
- findViewByName(name: string): View {
2742
- return utils.traverse((current) => {
2743
- if (current.node.name === name)
2744
- return current.node;
2745
- }, { node: { name: '', children: this.views } });
2746
- }
2747
-
2748
2262
  loadEnvList() {
2749
2263
  this.envList = ['dev', 'online'];
2750
2264
  }
2751
2265
 
2752
- // 必须先 loadPackageInfo 之后再生成代码
2753
- public packageInfo: {
2754
- template: { name: string; version: string };
2755
- ui: { name: string; version: string };
2756
- } = null;
2757
-
2758
- loadPackageInfo() {
2266
+ loadPackageInfo(scope: string) {
2759
2267
  const dependencyMap = (window as any).globalData.ideVersionDetail.dependencies;
2760
- this.packageInfo = {
2761
- template: { name: '', version: '' },
2762
- ui: { name: '', version: '' },
2268
+ const packageInfo = {
2269
+ template: { name: '', version: '', scope },
2270
+ ui: { name: '', version: '', scope },
2271
+ scope,
2763
2272
  };
2764
2273
 
2765
- this.packageInfo.template.name = this.scope === 'h5' ? '@lcap/mobile-template' : 'lcap-pc-template';
2766
- this.packageInfo.template.version = this.scope === 'h5' ? dependencyMap.FrontendArchH5.version : dependencyMap.FrontendArchPC.version;
2767
- this.packageInfo.ui.name = this.scope === 'h5' ? '@lcap/mobile-ui' : 'cloud-ui.vusion';
2768
- this.packageInfo.ui.version = this.scope === 'h5' ? dependencyMap.FrontendComponentLibraryH5.version : dependencyMap.FrontendComponentLibraryPC.version;
2274
+ packageInfo.template.name = scope === 'h5' ? '@lcap/mobile-template' : 'lcap-pc-template';
2275
+ packageInfo.template.version = scope === 'h5' ? dependencyMap.FrontendArchH5.version : dependencyMap.FrontendArchPC.version;
2276
+ packageInfo.ui.name = scope === 'h5' ? '@lcap/mobile-ui' : 'cloud-ui.vusion';
2277
+ packageInfo.ui.version = scope === 'h5' ? dependencyMap.FrontendComponentLibraryH5.version : dependencyMap.FrontendComponentLibraryPC.version;
2278
+ return packageInfo;
2279
+ }
2280
+
2281
+ public packageInfos: Array<{
2282
+ template: { name: string; version: string, scope: string };
2283
+ ui: { name: string; version: string, scope: string };
2284
+ scope: string;
2285
+ }>= [];
2286
+ loadPackageInfos() {
2287
+ const scopes = ['pc', 'h5'];
2288
+ scopes.forEach((scope) => {
2289
+ this.packageInfos.push(this.loadPackageInfo(scope));
2290
+ });
2769
2291
  }
2770
2292
 
2771
2293
  /**
@@ -2773,9 +2295,9 @@ export class App extends BaseNode {
2773
2295
  * 在环境中需要 basic 和 custom 分开 load,否则容易报错
2774
2296
  * @param prefix
2775
2297
  */
2776
- genAllAssetsInfo(prefix: string) {
2777
- const packageInfo = this.packageInfo;
2778
- const scope = this.scope;
2298
+ genAllAssetsInfo(prefix: string, scope: string) {
2299
+ // const packageInfo = this.packageInfo;
2300
+ const packageInfo = this.packageInfos.find((info) => info.scope === scope);
2779
2301
  const result: {
2780
2302
  basic: AssetsInfo;
2781
2303
  custom?: AssetsInfo;
@@ -2800,28 +2322,25 @@ export class App extends BaseNode {
2800
2322
  names: [],
2801
2323
  },
2802
2324
  };
2803
- this.componentDependencies.forEach((dep) => {
2804
- const { name, version } = dep;
2805
- result.custom.js.push(`${prefix}/packages/${name}@${version}/dist-theme/index.js`);
2806
- if (utils.shouldLoadCss(name, version)) {
2807
- result.custom.css.push(`${prefix}/packages/${name}@${version}/dist-theme/index.css`);
2808
- }
2809
- result.custom.names.push(name);
2325
+ const frontends = this.frontends.filter((frontend) => frontend.type === scope);
2326
+ const existingSet = new Set();
2327
+ frontends.forEach((frontend) => {
2328
+ frontend.componentDependencies.forEach((dep) => {
2329
+ const { name, version } = dep;
2330
+ const jsName = `${prefix}/packages/${name}@${version}/dist-theme/index.js`;
2331
+ if (!existingSet.has(jsName)) {
2332
+ existingSet.add(jsName);
2333
+ result.custom.js.push(jsName);
2334
+ if (utils.shouldLoadCss(name, version)) {
2335
+ result.custom.css.push(`${prefix}/packages/${name}@${version}/dist-theme/index.css`);
2336
+ }
2337
+ result.custom.names.push(name);
2338
+ }
2339
+ });
2810
2340
  });
2811
2341
  return result;
2812
2342
  }
2813
2343
 
2814
- genThemeCSS() {
2815
- const keys = Object.keys(this.theme?.variableMap || {});
2816
- if (!keys.length)
2817
- return;
2818
-
2819
- return `:root {
2820
- ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
2821
- }
2822
- `;
2823
- }
2824
-
2825
2344
  onChange($event?: EventPayload): void {
2826
2345
  this.emit('change', $event);
2827
2346
  }
@@ -2947,6 +2466,160 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
2947
2466
  console.log(err);
2948
2467
  }
2949
2468
  }
2469
+ /* 判断接口是否有误,需要重新导出 */
2470
+
2471
+ getQualifiedInterface(interfaces: Interface[] = this.interfaces):MessageData[] {
2472
+ const errorList: MessageData[] = [];
2473
+ interfaces.forEach((item:Interface) => {
2474
+ const logic = this.logics.find((logic: Logic) => logic.name === item.originLogicName);
2475
+ const logicParamMap: any = {};
2476
+ logic.params.forEach((param) => {
2477
+ logicParamMap[param.name] = param.typeAnnotation;
2478
+ });
2479
+ item.params.forEach((param) => {
2480
+ const logicTypeAnnotation = logicParamMap[param.name]?.toJSON();
2481
+ delete logicParamMap[param.name];
2482
+ if (!logicTypeAnnotation) {
2483
+ return errorList.push({
2484
+ logicName: logic.name,
2485
+ interfaceName: item.name,
2486
+ param: param.name,
2487
+ type: 1,
2488
+ message: `参数“${param.name}”已被删除,请确定请求类型无误后点击“重新导出”为接口`,
2489
+ });
2490
+ }
2491
+ const interfaceTypeAnnotation = param.typeAnnotation.toJSON() as TypeAnnotation;
2492
+ let isSame = false;
2493
+ if (logicTypeAnnotation?.typeNamespace === 'app.enums') {
2494
+ if (interfaceTypeAnnotation.typeNamespace === 'nasl.core' && interfaceTypeAnnotation.typeName === 'String') {
2495
+ isSame = true;
2496
+ }
2497
+ }
2498
+ if (JSON.stringify(logicTypeAnnotation) === JSON.stringify(interfaceTypeAnnotation)) {
2499
+ isSame = true;
2500
+ }
2501
+ if (!isSame) {
2502
+ errorList.push({
2503
+ logicName: logic.name,
2504
+ interfaceName: item.name,
2505
+ param: param.name,
2506
+ type: 2,
2507
+ message: `参数“${param.name}”数据类型变更,请确定请求类型无误后点击“重新导出”为接口`,
2508
+ });
2509
+ }
2510
+ });
2511
+ const logicReturns = logic.returns;
2512
+ const interfaceReturns = item.returns;
2513
+ if (logicReturns?.length > interfaceReturns?.length) {
2514
+ if (!logicReturns[0].typeAnnotation) {
2515
+ errorList.push({
2516
+ logicName: logic.name,
2517
+ interfaceName: item.name,
2518
+ resultName: logicReturns[0].name,
2519
+ type: 4,
2520
+ message: `输出参数发生变更,请点击“重新导出”`,
2521
+ });
2522
+ } else {
2523
+ errorList.push({
2524
+ logicName: logic.name,
2525
+ interfaceName: item.name,
2526
+ resultName: logicReturns[0].name,
2527
+ type: 4,
2528
+ message: `输出参数发生变更,请点击“重新导出”`,
2529
+ });
2530
+ }
2531
+ } else if (logicReturns?.length < interfaceReturns?.length) {
2532
+ errorList.push({
2533
+ logicName: logic.name,
2534
+ interfaceName: item.name,
2535
+ resultName: interfaceReturns[0].name,
2536
+ type: 4,
2537
+ message: `输出参数发生变更,请点击“重新导出”`,
2538
+ });
2539
+ } else if (logicReturns?.length === interfaceReturns?.length) {
2540
+ if (logicReturns.length !== 0) {
2541
+ if (logicReturns[0].name !== interfaceReturns[0].name) {
2542
+ errorList.push({
2543
+ logicName: logic.name,
2544
+ interfaceName: item.name,
2545
+ resultName: logicReturns[0].name,
2546
+ type: 4,
2547
+ message: `输出参数发生变更,请点击“重新导出”`,
2548
+ });
2549
+ } else if (!logicReturns[0].typeAnnotation) {
2550
+ if (!logicReturns[0]?.__TypeAnnotation) {
2551
+ errorList.push({
2552
+ logicName: logic.name,
2553
+ interfaceName: item.name,
2554
+ resultName: logicReturns[0].name,
2555
+ type: 7,
2556
+ message: `输出参数“${logicReturns[0].name}”没有数据类型,无法导出`,
2557
+ });
2558
+ } else if (JSON.stringify(logicReturns[0]?.__TypeAnnotation?.toJSON()) !== JSON.stringify(interfaceReturns[0]?.typeAnnotation?.toJSON())) {
2559
+ errorList.push({
2560
+ logicName: logic.name,
2561
+ interfaceName: item.name,
2562
+ resultName: logicReturns[0].name,
2563
+ type: 4,
2564
+ message: `输出参数发生变更,请点击“重新导出”`,
2565
+ });
2566
+ }
2567
+ } else if (JSON.stringify(logicReturns[0]?.typeAnnotation?.toJSON()) !== JSON.stringify(interfaceReturns[0]?.typeAnnotation?.toJSON())) {
2568
+ errorList.push({
2569
+ logicName: logic.name,
2570
+ interfaceName: item.name,
2571
+ resultName: logicReturns[0].name,
2572
+ type: 4,
2573
+ message: `输出参数发生变更,请点击“重新导出”`,
2574
+ });
2575
+ }
2576
+ }
2577
+ }
2578
+ for (const i in logicParamMap) {
2579
+ errorList.push({
2580
+ logicName: logic.name,
2581
+ param: i,
2582
+ message: `新增参数“${i}”,请确定请求类型无误后点击“重新导出”为接口`,
2583
+ type: 3,
2584
+ });
2585
+ }
2586
+ });
2587
+ return errorList;
2588
+ }
2589
+
2590
+ addFrontendForType(options?: string | Partial<Frontend> | Frontend) {
2591
+ let insertIndex = -1;
2592
+ this.frontends.forEach((frontend, index) => {
2593
+ if (frontend.type === (options as any).type) {
2594
+ insertIndex = index;
2595
+ }
2596
+ });
2597
+ if ((options as any).type === 'h5' && insertIndex === -1) {
2598
+ insertIndex = this.frontends.length;
2599
+ }
2600
+ const node = this._insertFrontendAt(options as any, insertIndex + 1);
2601
+ const index = this.frontends.indexOf(node);
2602
+ node.create({
2603
+ index,
2604
+ parentNode: this,
2605
+ parentKey: 'frontends',
2606
+ });
2607
+ return node;
2608
+ }
2609
+
2610
+ getFrontendExistingTitles(excludedList: Array<Frontend> = []) {
2611
+ const excludedSet = new Set(excludedList);
2612
+ return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.title);
2613
+ }
2614
+
2615
+ getExtensionsCallbackLogics() {
2616
+ let resultLogics:string[] = [];
2617
+ this.frontends.forEach((frontend) => {
2618
+ resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
2619
+ });
2620
+ return Array.from(new Set(resultLogics));
2621
+ }
2622
+
2950
2623
  //================================================================================
2951
2624
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2952
2625
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓