@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.14

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 (254) hide show
  1. package/out/automate/engine/index.js +1 -1
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/common/BaseNode.d.ts +4 -4
  4. package/out/common/BaseNode.js +45 -41
  5. package/out/common/BaseNode.js.map +1 -1
  6. package/out/concepts/App__.d.ts +17 -0
  7. package/out/concepts/App__.js +54 -12
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +2 -2
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/BinaryExpression__.js +8 -6
  12. package/out/concepts/BinaryExpression__.js.map +1 -1
  13. package/out/concepts/BindAttribute__.d.ts +21 -21
  14. package/out/concepts/BindAttribute__.js +4 -3
  15. package/out/concepts/BindAttribute__.js.map +1 -1
  16. package/out/concepts/BindDirective__.d.ts +3 -3
  17. package/out/concepts/BindDirective__.js +22 -2
  18. package/out/concepts/BindDirective__.js.map +1 -1
  19. package/out/concepts/BindEvent__.d.ts +9 -8
  20. package/out/concepts/BindEvent__.js +17 -7
  21. package/out/concepts/BindEvent__.js.map +1 -1
  22. package/out/concepts/CallFunction__.js +10 -5
  23. package/out/concepts/CallFunction__.js.map +1 -1
  24. package/out/concepts/CallInterface__.js +11 -1
  25. package/out/concepts/CallInterface__.js.map +1 -1
  26. package/out/concepts/CallLogic__.d.ts +1 -0
  27. package/out/concepts/CallLogic__.js +17 -7
  28. package/out/concepts/CallLogic__.js.map +1 -1
  29. package/out/concepts/CallQueryComponent__.d.ts +0 -1
  30. package/out/concepts/CallQueryComponent__.js +5 -8
  31. package/out/concepts/CallQueryComponent__.js.map +1 -1
  32. package/out/concepts/Comment__.js +6 -2
  33. package/out/concepts/Comment__.js.map +1 -1
  34. package/out/concepts/ConfigGroup__.js +1 -1
  35. package/out/concepts/ConfigGroup__.js.map +1 -1
  36. package/out/concepts/ConfigProperty__.js +1 -1
  37. package/out/concepts/ConfigProperty__.js.map +1 -1
  38. package/out/concepts/Configuration__.js +1 -1
  39. package/out/concepts/Configuration__.js.map +1 -1
  40. package/out/concepts/Destination__.js +10 -7
  41. package/out/concepts/Destination__.js.map +1 -1
  42. package/out/concepts/EntityProperty__.d.ts +3 -0
  43. package/out/concepts/EntityProperty__.js +38 -0
  44. package/out/concepts/EntityProperty__.js.map +1 -1
  45. package/out/concepts/Entity__.d.ts +34 -31
  46. package/out/concepts/Entity__.js +29 -12
  47. package/out/concepts/Entity__.js.map +1 -1
  48. package/out/concepts/Enum__.js +1 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/Event__.js +1 -1
  51. package/out/concepts/Event__.js.map +1 -1
  52. package/out/concepts/ForEachStatement__.js +8 -12
  53. package/out/concepts/ForEachStatement__.js.map +1 -1
  54. package/out/concepts/Function__.js +4 -4
  55. package/out/concepts/Function__.js.map +1 -1
  56. package/out/concepts/Identifier__.js +13 -7
  57. package/out/concepts/Identifier__.js.map +1 -1
  58. package/out/concepts/IfStatement__.js +2 -2
  59. package/out/concepts/IfStatement__.js.map +1 -1
  60. package/out/concepts/InterfaceParam__.d.ts +2 -0
  61. package/out/concepts/InterfaceParam__.js +10 -0
  62. package/out/concepts/InterfaceParam__.js.map +1 -1
  63. package/out/concepts/Interface__.js +3 -3
  64. package/out/concepts/Interface__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -0
  66. package/out/concepts/LogicItem__.js +14 -0
  67. package/out/concepts/LogicItem__.js.map +1 -1
  68. package/out/concepts/Logic__.d.ts +1 -0
  69. package/out/concepts/Logic__.js +16 -11
  70. package/out/concepts/Logic__.js.map +1 -1
  71. package/out/concepts/Module__.js +8 -8
  72. package/out/concepts/Module__.js.map +1 -1
  73. package/out/concepts/Namespace__.js +12 -12
  74. package/out/concepts/Namespace__.js.map +1 -1
  75. package/out/concepts/Param__.d.ts +1 -0
  76. package/out/concepts/Param__.js +3 -0
  77. package/out/concepts/Param__.js.map +1 -1
  78. package/out/concepts/ProcessComponent__.js +2 -2
  79. package/out/concepts/ProcessComponent__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +5 -5
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/ProcessOutcome__.js +1 -1
  83. package/out/concepts/ProcessOutcome__.js.map +1 -1
  84. package/out/concepts/Process__.js +4 -4
  85. package/out/concepts/Process__.js.map +1 -1
  86. package/out/concepts/QueryFromExpression__.js +1 -1
  87. package/out/concepts/QueryFromExpression__.js.map +1 -1
  88. package/out/concepts/QueryJoinExpression__.js +2 -2
  89. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  90. package/out/concepts/QuerySelectExpression__.js +1 -1
  91. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  92. package/out/concepts/Return__.d.ts +1 -0
  93. package/out/concepts/Return__.js +6 -3
  94. package/out/concepts/Return__.js.map +1 -1
  95. package/out/concepts/StringLiteral__.d.ts +1 -1
  96. package/out/concepts/StringLiteral__.js +2 -2
  97. package/out/concepts/StringLiteral__.js.map +1 -1
  98. package/out/concepts/StructureProperty__.d.ts +3 -6
  99. package/out/concepts/StructureProperty__.js +38 -32
  100. package/out/concepts/StructureProperty__.js.map +1 -1
  101. package/out/concepts/Structure__.js +3 -3
  102. package/out/concepts/Structure__.js.map +1 -1
  103. package/out/concepts/SwitchCase__.js +3 -3
  104. package/out/concepts/SwitchCase__.js.map +1 -1
  105. package/out/concepts/SwitchStatement__.js +1 -1
  106. package/out/concepts/SwitchStatement__.js.map +1 -1
  107. package/out/concepts/TypeAnnotation__.js +10 -2
  108. package/out/concepts/TypeAnnotation__.js.map +1 -1
  109. package/out/concepts/UnaryExpression__.js +1 -1
  110. package/out/concepts/UnaryExpression__.js.map +1 -1
  111. package/out/concepts/ValidationRule__.d.ts +1 -0
  112. package/out/concepts/ValidationRule__.js +27 -1
  113. package/out/concepts/ValidationRule__.js.map +1 -1
  114. package/out/concepts/Variable__.d.ts +1 -0
  115. package/out/concepts/Variable__.js +6 -3
  116. package/out/concepts/Variable__.js.map +1 -1
  117. package/out/concepts/ViewComponent__.js +5 -5
  118. package/out/concepts/ViewComponent__.js.map +1 -1
  119. package/out/concepts/ViewElement__.d.ts +63 -60
  120. package/out/concepts/ViewElement__.js +123 -88
  121. package/out/concepts/ViewElement__.js.map +1 -1
  122. package/out/concepts/View__.d.ts +4 -0
  123. package/out/concepts/View__.js +26 -10
  124. package/out/concepts/View__.js.map +1 -1
  125. package/out/concepts/WhileStatement__.js +1 -1
  126. package/out/concepts/WhileStatement__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/index.js +3 -1
  128. package/out/concepts/basics/stdlib/index.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
  130. package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
  131. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
  132. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
  133. package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
  134. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
  135. package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
  136. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
  138. package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
  139. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
  140. package/out/concepts/basics/stdlib/nasl.util.js +0 -29
  141. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  142. package/out/enums/KEYWORDS.js +1 -0
  143. package/out/enums/KEYWORDS.js.map +1 -1
  144. package/out/generator/genBundleFiles.js +98 -72
  145. package/out/generator/genBundleFiles.js.map +1 -1
  146. package/out/server/createUiTs.d.ts +1 -0
  147. package/out/server/createUiTs.js +15 -1
  148. package/out/server/createUiTs.js.map +1 -1
  149. package/out/server/getLogics.js +27 -45
  150. package/out/server/getLogics.js.map +1 -1
  151. package/out/server/getMemberIdentifier.js +3 -3
  152. package/out/server/getMemberIdentifier.js.map +1 -1
  153. package/out/server/getProcesses.d.ts +1 -1
  154. package/out/server/getProcesses.js +2 -2
  155. package/out/server/getProcesses.js.map +1 -1
  156. package/out/server/naslServer.d.ts +1 -3
  157. package/out/server/naslServer.js +73 -57
  158. package/out/server/naslServer.js.map +1 -1
  159. package/out/server/translator.d.ts +0 -3
  160. package/out/server/translator.js +16 -7
  161. package/out/server/translator.js.map +1 -1
  162. package/out/service/storage/init.js +21 -12
  163. package/out/service/storage/init.js.map +1 -1
  164. package/out/templator/genCreateBlock.js +3 -3
  165. package/out/templator/genCreateBlock.js.map +1 -1
  166. package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
  167. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  168. package/out/templator/genCurdMultipleKeyBlock.js +2 -2
  169. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  170. package/out/templator/genGetBlock.js +1 -1
  171. package/out/templator/genGetBlock.js.map +1 -1
  172. package/out/templator/genQueryComponent.d.ts +2 -0
  173. package/out/templator/genQueryComponent.js +1 -0
  174. package/out/templator/genQueryComponent.js.map +1 -1
  175. package/out/templator/genUpdateBlock.js +5 -5
  176. package/out/templator/genUpdateBlock.js.map +1 -1
  177. package/out/templator/utils.d.ts +3 -1
  178. package/out/templator/utils.js +2 -1
  179. package/out/templator/utils.js.map +1 -1
  180. package/package.json +1 -1
  181. package/src/automate/engine/index.js +1 -1
  182. package/src/common/BaseNode.ts +46 -42
  183. package/src/concepts/App__.ts +54 -12
  184. package/src/concepts/Argument__.ts +3 -2
  185. package/src/concepts/BinaryExpression__.ts +8 -6
  186. package/src/concepts/BindAttribute__.ts +26 -32
  187. package/src/concepts/BindDirective__.ts +24 -9
  188. package/src/concepts/BindEvent__.ts +25 -29
  189. package/src/concepts/CallFunction__.ts +11 -6
  190. package/src/concepts/CallInterface__.ts +11 -1
  191. package/src/concepts/CallLogic__.ts +21 -40
  192. package/src/concepts/CallQueryComponent__.ts +6 -10
  193. package/src/concepts/Comment__.ts +6 -2
  194. package/src/concepts/ConfigGroup__.ts +1 -1
  195. package/src/concepts/ConfigProperty__.ts +1 -1
  196. package/src/concepts/Configuration__.ts +1 -1
  197. package/src/concepts/Destination__.ts +9 -7
  198. package/src/concepts/EntityProperty__.ts +36 -0
  199. package/src/concepts/Entity__.ts +63 -50
  200. package/src/concepts/Enum__.ts +1 -1
  201. package/src/concepts/Event__.ts +1 -1
  202. package/src/concepts/ForEachStatement__.ts +8 -13
  203. package/src/concepts/Function__.ts +4 -4
  204. package/src/concepts/Identifier__.ts +15 -18
  205. package/src/concepts/IfStatement__.ts +2 -2
  206. package/src/concepts/InterfaceParam__.ts +11 -0
  207. package/src/concepts/Interface__.ts +3 -3
  208. package/src/concepts/LogicItem__.ts +15 -0
  209. package/src/concepts/Logic__.ts +34 -50
  210. package/src/concepts/Module__.ts +8 -8
  211. package/src/concepts/Namespace__.ts +12 -12
  212. package/src/concepts/Param__.ts +3 -0
  213. package/src/concepts/ProcessComponent__.ts +2 -2
  214. package/src/concepts/ProcessElement__.ts +5 -5
  215. package/src/concepts/ProcessOutcome__.ts +1 -1
  216. package/src/concepts/Process__.ts +4 -4
  217. package/src/concepts/QueryFromExpression__.ts +1 -1
  218. package/src/concepts/QueryJoinExpression__.ts +2 -2
  219. package/src/concepts/QuerySelectExpression__.ts +1 -1
  220. package/src/concepts/Return__.ts +6 -3
  221. package/src/concepts/StringLiteral__.ts +2 -2
  222. package/src/concepts/StructureProperty__.ts +36 -29
  223. package/src/concepts/Structure__.ts +3 -3
  224. package/src/concepts/SwitchCase__.ts +3 -3
  225. package/src/concepts/SwitchStatement__.ts +1 -1
  226. package/src/concepts/TypeAnnotation__.ts +8 -2
  227. package/src/concepts/UnaryExpression__.ts +1 -1
  228. package/src/concepts/ValidationRule__.ts +24 -1
  229. package/src/concepts/Variable__.ts +6 -3
  230. package/src/concepts/ViewComponent__.ts +5 -5
  231. package/src/concepts/ViewElement__.ts +183 -147
  232. package/src/concepts/View__.ts +30 -32
  233. package/src/concepts/WhileStatement__.ts +1 -1
  234. package/src/concepts/basics/stdlib/index.ts +3 -1
  235. package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
  236. package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
  237. package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
  238. package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
  239. package/src/enums/KEYWORDS.ts +1 -0
  240. package/src/generator/genBundleFiles.ts +102 -74
  241. package/src/server/createUiTs.ts +18 -3
  242. package/src/server/getLogics.ts +29 -47
  243. package/src/server/getMemberIdentifier.ts +3 -3
  244. package/src/server/getProcesses.ts +2 -2
  245. package/src/server/naslServer.ts +84 -62
  246. package/src/server/translator.ts +18 -6
  247. package/src/service/storage/init.ts +20 -13
  248. package/src/templator/genCreateBlock.ts +3 -3
  249. package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
  250. package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
  251. package/src/templator/genGetBlock.ts +1 -1
  252. package/src/templator/genQueryComponent.ts +1 -0
  253. package/src/templator/genUpdateBlock.ts +5 -6
  254. package/src/templator/utils.ts +2 -1
@@ -85,6 +85,18 @@ export class App extends BaseNode {
85
85
  @property()
86
86
  scope: 'pc' | 'h5' = undefined;
87
87
 
88
+ /**
89
+ * 制品应用标题
90
+ */
91
+ @property()
92
+ documentTitle: string = undefined;
93
+
94
+ /**
95
+ * 制品应用图标
96
+ */
97
+ @property()
98
+ documentIcon: string = undefined;
99
+
88
100
  /**
89
101
  * 是否有用户中心
90
102
  */
@@ -199,6 +211,29 @@ export class App extends BaseNode {
199
211
  }
200
212
  return params;
201
213
  }
214
+ /**
215
+ * 设置制品应用标题
216
+ */
217
+ setDocumentTitle(documentTitle: string) {
218
+ const object = {
219
+ documentTitle,
220
+ };
221
+ this.update({
222
+ ...object,
223
+ });
224
+ }
225
+
226
+ /**
227
+ * 设置制品应用图标
228
+ */
229
+ setDocumentIcon(documentIcon: string) {
230
+ const object = {
231
+ documentIcon,
232
+ };
233
+ this.update({
234
+ ...object,
235
+ });
236
+ }
202
237
 
203
238
  getEntityExistingNames(excludedList: Array<Entity> = []) {
204
239
  const excludedSet = new Set(excludedList);
@@ -244,7 +279,7 @@ export class App extends BaseNode {
244
279
  name: options,
245
280
  }, this, 'entities');
246
281
  } else if (options instanceof Entity) {
247
- options.delete(); // 同一实例不支持多处存在
282
+ options.ensureDelete(); // 同一实例不支持多处存在
248
283
  entity = options;
249
284
  Object.assign(entity, relationOptions);
250
285
  } else {
@@ -385,7 +420,7 @@ export class App extends BaseNode {
385
420
  name: options,
386
421
  }, this, 'structures');
387
422
  } else if (options instanceof Structure) {
388
- options.delete(); // 同一实例不支持多处存在
423
+ options.ensureDelete(); // 同一实例不支持多处存在
389
424
  structure = options;
390
425
  Object.assign(structure, relationOptions);
391
426
  } else {
@@ -526,7 +561,7 @@ export class App extends BaseNode {
526
561
  name: options,
527
562
  }, this, 'enums');
528
563
  } else if (options instanceof Enum) {
529
- options.delete(); // 同一实例不支持多处存在
564
+ options.ensureDelete(); // 同一实例不支持多处存在
530
565
  enumeration = options;
531
566
  Object.assign(enumeration, relationOptions);
532
567
  } else {
@@ -667,7 +702,7 @@ export class App extends BaseNode {
667
702
  name: options,
668
703
  }, this, 'logics');
669
704
  } else if (options instanceof Logic) {
670
- options.delete(); // 同一实例不支持多处存在
705
+ options.ensureDelete(); // 同一实例不支持多处存在
671
706
  logic = options;
672
707
  Object.assign(logic, relationOptions);
673
708
  } else {
@@ -808,7 +843,7 @@ export class App extends BaseNode {
808
843
  name: options,
809
844
  }, this, 'interfaces');
810
845
  } else if (options instanceof Interface) {
811
- options.delete(); // 同一实例不支持多处存在
846
+ options.ensureDelete(); // 同一实例不支持多处存在
812
847
  itface = options;
813
848
  Object.assign(itface, relationOptions);
814
849
  } else {
@@ -949,7 +984,7 @@ export class App extends BaseNode {
949
984
  name: options,
950
985
  }, this, 'views');
951
986
  } else if (options instanceof View) {
952
- options.delete(); // 同一实例不支持多处存在
987
+ options.ensureDelete(); // 同一实例不支持多处存在
953
988
  view = options;
954
989
  Object.assign(view, relationOptions);
955
990
  } else {
@@ -1090,7 +1125,7 @@ export class App extends BaseNode {
1090
1125
  name: options,
1091
1126
  }, this, 'processes');
1092
1127
  } else if (options instanceof Process) {
1093
- options.delete(); // 同一实例不支持多处存在
1128
+ options.ensureDelete(); // 同一实例不支持多处存在
1094
1129
  process = options;
1095
1130
  Object.assign(process, relationOptions);
1096
1131
  } else {
@@ -1231,7 +1266,7 @@ export class App extends BaseNode {
1231
1266
  name: options,
1232
1267
  }, this, 'roles');
1233
1268
  } else if (options instanceof Role) {
1234
- options.delete(); // 同一实例不支持多处存在
1269
+ options.ensureDelete(); // 同一实例不支持多处存在
1235
1270
  role = options;
1236
1271
  Object.assign(role, relationOptions);
1237
1272
  } else {
@@ -1372,7 +1407,7 @@ export class App extends BaseNode {
1372
1407
  name: options,
1373
1408
  }, this, 'dependencies');
1374
1409
  } else if (options instanceof Module) {
1375
- options.delete(); // 同一实例不支持多处存在
1410
+ options.ensureDelete(); // 同一实例不支持多处存在
1376
1411
  module = options;
1377
1412
  Object.assign(module, relationOptions);
1378
1413
  } else {
@@ -1505,7 +1540,7 @@ export class App extends BaseNode {
1505
1540
  name: options,
1506
1541
  }, this, 'interfaceDependencies');
1507
1542
  } else if (options instanceof Module) {
1508
- options.delete(); // 同一实例不支持多处存在
1543
+ options.ensureDelete(); // 同一实例不支持多处存在
1509
1544
  module = options;
1510
1545
  Object.assign(module, relationOptions);
1511
1546
  } else {
@@ -1638,7 +1673,7 @@ export class App extends BaseNode {
1638
1673
  name: options,
1639
1674
  }, this, 'componentDependencies');
1640
1675
  } else if (options instanceof Module) {
1641
- options.delete(); // 同一实例不支持多处存在
1676
+ options.ensureDelete(); // 同一实例不支持多处存在
1642
1677
  module = options;
1643
1678
  Object.assign(module, relationOptions);
1644
1679
  } else {
@@ -2438,6 +2473,13 @@ export class App extends BaseNode {
2438
2473
  return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
2439
2474
  }
2440
2475
 
2476
+ findViewByName(name: string): View {
2477
+ return utils.traverse((current) => {
2478
+ if (current.node.name === name)
2479
+ return current.node;
2480
+ }, { node: { name: '', children: this.views } });
2481
+ }
2482
+
2441
2483
  loadEnvList() {
2442
2484
  this.envList = ['dev', 'online'];
2443
2485
  }
@@ -2483,7 +2525,7 @@ export class App extends BaseNode {
2483
2525
 
2484
2526
  scope === 'h5' ? `${prefix}/packages/@lcap/mobile-ui@${packageInfo.ui.version}/dist-theme/index.js` : `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.js`,
2485
2527
 
2486
- scope === 'h5' ? `${prefix}/packages/@lcap/mobile-template@0.7.10-beta/cloudAdminDesigner.umd.min.js` : `${prefix}/packages/lcap-pc-template@0.4.13-beta/cloudAdminDesigner.umd.min.js`,
2528
+ scope === 'h5' ? `${prefix}/packages/@lcap/mobile-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js` : `${prefix}/packages/lcap-pc-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js`,
2487
2529
  ],
2488
2530
  css: [
2489
2531
  scope === 'h5' ? `${prefix}/packages/@lcap/mobile-ui@${packageInfo.ui.version}/dist-theme/index.css` : `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.css`,
@@ -12,6 +12,7 @@ import { v4 as uuidv4 } from 'uuid';
12
12
  import BaseNode from '../common/BaseNode';
13
13
  import classMap from '../common/classMap';
14
14
  import LogicItem from './LogicItem__';
15
+ import StringLiteral from './StringLiteral__';
15
16
 
16
17
  /**
17
18
  * 实际参数
@@ -189,13 +190,13 @@ export class Argument extends LogicItem {
189
190
  }
190
191
 
191
192
  @withSourceMap()
192
- toEmbeddedTS(state?: TranslatorState, isRequired?: boolean, isHaveKeyWord?: boolean): string {
193
+ toEmbeddedTS(state?: TranslatorState, isRequired: boolean = true, isHaveKeyWord?: boolean): string {
193
194
  let code = this.spread ? '...' : '';
194
195
  if (isHaveKeyWord) {
195
196
  code += `${this.tsKeyword}:`;
196
197
  }
197
198
  if (this.expression) {
198
- code += this.expression.toEmbeddedTS(shiftState(state, code));
199
+ code += (this.expression as StringLiteral).toEmbeddedTS(shiftState(state, code), isRequired);
199
200
  } else {
200
201
  code += isRequired ? '__IDENTIFIER__' : 'undefined';
201
202
  }
@@ -188,9 +188,9 @@ export class BinaryExpression extends LogicItem {
188
188
  return code;
189
189
  }
190
190
  let code = '';
191
- code += this.left?.toVue ? this.left.toVue() : '';
191
+ code += '(' + (this.left?.toVue() || '') + ')';
192
192
  code += ` ${this.operator} `;
193
- code += this.right?.toVue ? this.right.toVue() : '';
193
+ code += '(' + (this.right?.toVue() || '') + ')';
194
194
  return code;
195
195
  }
196
196
 
@@ -206,12 +206,14 @@ export class BinaryExpression extends LogicItem {
206
206
  code += '.' + fnName + '(';
207
207
  code += this.right?.toUI ? this.right.toUI(shiftState(state, code, { inline: true })) : '';
208
208
  code += ')';
209
+ console.log(code);
209
210
  return code;
210
211
  }
211
212
  let code = '';
212
- code += this.left?.toUI ? this.left.toUI(shiftState(state, code, { inline: true })) : '';
213
+ code += '(' + (this.left?.toUI(shiftState(state, code, { inline: true })) || '') + ')';
213
214
  code += ` ${this.operator} `;
214
- code += this.right?.toUI ? this.right.toUI(shiftState(state, code, { inline: true })) : '';
215
+ code += '(' + (this.right?.toUI(shiftState(state, code, { inline: true })) || '') + ')';
216
+ console.log(code);
215
217
  return code;
216
218
  }
217
219
 
@@ -230,9 +232,9 @@ export class BinaryExpression extends LogicItem {
230
232
  return code;
231
233
  }
232
234
  let code = '';
233
- code += '(' + this.left?.toJS ? this.left.toJS(shiftState(state, code, { inline: true })) : '' + ')';
235
+ code += '(' + (this.left?.toJS(shiftState(state, code, { inline: true })) || '') + ')';
234
236
  code += ` ${this.operator} `;
235
- code += '(' + this.right?.toJS ? this.right.toJS(shiftState(state, code, { inline: true })) : '' + ')';
237
+ code += '(' + (this.right?.toJS(shiftState(state, code, { inline: true })) || '') + ')';
236
238
  return code;
237
239
  }
238
240
 
@@ -196,7 +196,7 @@ export class BindAttribute extends BaseNode {
196
196
  });
197
197
  }
198
198
 
199
- getValidationRuleExistingNames(excludedList: Array<ValidationRule> = []) {
199
+ getValidationRuleExistingNames(excludedList: Array<ValidationRule> = []) {
200
200
  const excludedSet = new Set(excludedList);
201
201
  return (this.rules || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
202
202
  }
@@ -205,24 +205,24 @@ export class BindAttribute extends BaseNode {
205
205
  }
206
206
 
207
207
  /**
208
- * 插入验证规则
209
- * @internal
210
- * @param name 验证规则名称,如果不填会自动生成一个唯一名称
211
- */
208
+ * 插入验证规则
209
+ * @internal
210
+ * @param name 验证规则名称,如果不填会自动生成一个唯一名称
211
+ */
212
212
  _insertValidationRuleAt(name: string, index: number): ValidationRule;
213
213
 
214
214
  /**
215
- * 插入验证规则
216
- * @internal
217
- * @param validationRuleOptions 验证规则参数
218
- */
215
+ * 插入验证规则
216
+ * @internal
217
+ * @param validationRuleOptions 验证规则参数
218
+ */
219
219
  _insertValidationRuleAt(validationRuleOptions: Partial<ValidationRule>, index: number): ValidationRule;
220
220
 
221
221
  /**
222
- * 插入验证规则
223
- * @internal
224
- * @param validationRule 已有的验证规则实例
225
- */
222
+ * 插入验证规则
223
+ * @internal
224
+ * @param validationRule 已有的验证规则实例
225
+ */
226
226
  _insertValidationRuleAt(validationRule: ValidationRule, index: number): ValidationRule;
227
227
 
228
228
  _insertValidationRuleAt(options: string | Partial<ValidationRule> | ValidationRule, index: number) {
@@ -240,7 +240,7 @@ export class BindAttribute extends BaseNode {
240
240
  name: options,
241
241
  }, this, 'rules');
242
242
  } else if (options instanceof ValidationRule) {
243
- options.delete(); // 同一实例不支持多处存在
243
+ options.ensureDelete(); // 同一实例不支持多处存在
244
244
  validationRule = options;
245
245
  Object.assign(validationRule, relationOptions);
246
246
  } else {
@@ -337,13 +337,10 @@ export class BindAttribute extends BaseNode {
337
337
  return node;
338
338
  }
339
339
 
340
-
341
-
342
-
343
340
  /**
344
- * 删除逻辑项
345
- * @param name 逻辑项名称
346
- */
341
+ * 删除逻辑项
342
+ * @param name 逻辑项名称
343
+ */
347
344
  removeExpression(name: string): void;
348
345
 
349
346
  /**
@@ -365,12 +362,10 @@ export class BindAttribute extends BaseNode {
365
362
  return expression.delete();
366
363
  }
367
364
 
368
-
369
-
370
365
  /**
371
- * 删除跳转页面
372
- * @param name 跳转页面名称
373
- */
366
+ * 删除跳转页面
367
+ * @param name 跳转页面名称
368
+ */
374
369
  removeDestination(name: string): void;
375
370
 
376
371
  /**
@@ -392,12 +387,10 @@ export class BindAttribute extends BaseNode {
392
387
  return destination.delete();
393
388
  }
394
389
 
395
-
396
-
397
390
  /**
398
- * 删除验证规则
399
- * @param name 验证规则名称
400
- */
391
+ * 删除验证规则
392
+ * @param name 验证规则名称
393
+ */
401
394
  removeValidationRuleInRules(name: string): void;
402
395
 
403
396
  /**
@@ -472,8 +465,9 @@ export class BindAttribute extends BaseNode {
472
465
  value = value.replace(/"/g, "'");
473
466
  }
474
467
  if (this.name === 'destination' && this.type === 'dynamic') {
475
- return this.destination.toVue(options);
468
+ return this.destination ? this.destination.toVue(options) : '';
476
469
  } else if (this.name === 'rules' && this.rules) {
470
+ console.log('this.rules: ', this.rules);
477
471
  const ruleStrs = this.rules.map((rule) => rule.toVue());
478
472
  value = ruleStrs.join(' | ');
479
473
  return value !== undefined && value !== null ? `${this.name}="${value}"` : '';
@@ -500,7 +494,7 @@ export class BindAttribute extends BaseNode {
500
494
  //================================================================================
501
495
  }
502
496
 
503
- classMap['BindAttribute'] = BindAttribute;
497
+ classMap.BindAttribute = BindAttribute;
504
498
  export default BindAttribute;
505
499
  //================================================================================
506
500
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -133,14 +133,10 @@ export class BindDirective extends BaseNode {
133
133
  });
134
134
  }
135
135
 
136
-
137
-
138
-
139
-
140
136
  /**
141
- * 删除逻辑项
142
- * @param name 逻辑项名称
143
- */
137
+ * 删除逻辑项
138
+ * @param name 逻辑项名称
139
+ */
144
140
  removeExpression(name: string): void;
145
141
 
146
142
  /**
@@ -223,7 +219,26 @@ export class BindDirective extends BaseNode {
223
219
  value = value?.replace(/"/g, "'");
224
220
  }
225
221
  if (this.name === 'auth' && !!this.value) {
226
- value = `'/${this.view.name}/${this.element.name}'`;
222
+ const regex = /(.\w+\[name=\w+\])/g;
223
+ const paths = this.element.nodePath.match(regex);
224
+ const regex1 = /\s*=(\w+)\]/;
225
+ let pathArr: string[] = [];
226
+ const isElement = paths.find((item) => {
227
+ if (item.startsWith('.elements')) {
228
+ return true;
229
+ } else {
230
+ pathArr.push(item);
231
+ return false;
232
+ }
233
+ });
234
+ if (isElement) {
235
+ pathArr = [...pathArr, ...paths.slice(-1)];
236
+ }
237
+ const _path = pathArr.reduce((str, item) => {
238
+ const c = item.match(regex1);
239
+ return str + '/' + c[1];
240
+ }, '');
241
+ value = `'${_path}'`;
227
242
  }
228
243
  return value !== '' && value !== undefined && value !== null ? `v-${this.name}${modifiersString}${this.arg ? ':' + this.arg : ''}="${value}"` : '';
229
244
  }
@@ -234,7 +249,7 @@ export class BindDirective extends BaseNode {
234
249
  //================================================================================
235
250
  }
236
251
 
237
- classMap['BindDirective'] = BindDirective;
252
+ classMap.BindDirective = BindDirective;
238
253
  export default BindDirective;
239
254
  //================================================================================
240
255
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -142,22 +142,18 @@ export class BindEvent extends BaseNode {
142
142
  });
143
143
  }
144
144
 
145
-
146
-
147
-
148
-
149
145
  /**
150
- * 插入实际参数
151
- * @internal
152
- * @param argumentOptions 实际参数参数
153
- */
146
+ * 插入实际参数
147
+ * @internal
148
+ * @param argumentOptions 实际参数参数
149
+ */
154
150
  _insertArgumentAt(argumentOptions: Partial<Argument>, index: number): Argument;
155
151
 
156
152
  /**
157
- * 插入实际参数
158
- * @internal
159
- * @param argument 已有的实际参数实例
160
- */
153
+ * 插入实际参数
154
+ * @internal
155
+ * @param argument 已有的实际参数实例
156
+ */
161
157
  _insertArgumentAt(argument: Argument, index: number): Argument;
162
158
 
163
159
  _insertArgumentAt(options: Partial<Argument> | Argument, index: number) {
@@ -165,7 +161,7 @@ export class BindEvent extends BaseNode {
165
161
  const relationOptions = { parentNode: this, parentKey: 'arguments' };
166
162
  let argument: Argument;
167
163
  if (options instanceof Argument) {
168
- options.delete(); // 同一实例不支持多处存在
164
+ options.ensureDelete(); // 同一实例不支持多处存在
169
165
  argument = options;
170
166
  Object.assign(argument, relationOptions);
171
167
  } else {
@@ -178,8 +174,6 @@ export class BindEvent extends BaseNode {
178
174
  return argument;
179
175
  }
180
176
 
181
-
182
-
183
177
  /**
184
178
  * 插入实际参数
185
179
  * @param argumentOptions 实际参数参数
@@ -202,8 +196,6 @@ export class BindEvent extends BaseNode {
202
196
  return node;
203
197
  }
204
198
 
205
-
206
-
207
199
  /**
208
200
  * 添加实际参数
209
201
  * @internal
@@ -223,8 +215,6 @@ export class BindEvent extends BaseNode {
223
215
  return this._insertArgumentAt(options as any, index);
224
216
  }
225
217
 
226
-
227
-
228
218
  /**
229
219
  * 添加实际参数
230
220
  * @param argumentOptions 实际参数参数
@@ -248,9 +238,6 @@ export class BindEvent extends BaseNode {
248
238
  return node;
249
239
  }
250
240
 
251
-
252
-
253
-
254
241
  /**
255
242
  * 删除实际参数
256
243
  * @param argument 已有的实际参数实例
@@ -258,7 +245,7 @@ export class BindEvent extends BaseNode {
258
245
  removeArgument(argument: Argument): void;
259
246
 
260
247
  removeArgument(options: Argument) {
261
- let argument: Argument = options;
248
+ const argument: Argument = options;
262
249
  return argument.delete();
263
250
  }
264
251
 
@@ -289,7 +276,10 @@ export class BindEvent extends BaseNode {
289
276
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
290
277
  // 自动生成的代码已结束。下面可以手动编写。
291
278
  //================================================================================
292
-
279
+ // 用于logic回填
280
+ get calleewholeKey(): string {
281
+ return this.calleeNamespace + '.' + this.calleeName;
282
+ }
293
283
  get tsCalleeNamespace() {
294
284
  if (this.calleeNamespace) {
295
285
  let tsCalleeNamespace = this.calleeNamespace;
@@ -326,7 +316,7 @@ export class BindEvent extends BaseNode {
326
316
  return `${randerNameSpace}.${this.calleeName}`;
327
317
  }
328
318
  // 绑定事件转驼峰
329
- toHump = (name: string) => name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '';
319
+ toHump = (name: string) => (name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '');
330
320
 
331
321
  @withSourceMap()
332
322
  toEmbeddedTS(state?: TranslatorState, isPageCycle?: Boolean): string {
@@ -388,10 +378,16 @@ export class BindEvent extends BaseNode {
388
378
  componentName = namespaceArr[0];
389
379
  }
390
380
  }
391
- const calleeName = isComponentLogic ? `$refs.${componentName}.${this.calleeName}` : this.calleeName;
381
+ let callee = '';
382
+ if (isComponentLogic)
383
+ callee = `$refs.${componentName}.${this.calleeName}`;
384
+ else if (calleeNamespace?.startsWith('nasl.'))
385
+ callee = `$global.${this.calleeName}`;
386
+ else
387
+ callee = this.calleeName;
392
388
  let code = '';
393
- if (calleeName) {
394
- code += `@${this.name}="${calleeName}`;
389
+ if (callee) {
390
+ code += `@${this.name}="${callee}`;
395
391
  if (Array.isArray(this.arguments) && this.arguments.length) {
396
392
  code += '(';
397
393
  this.arguments.forEach((arg, index) => {
@@ -413,7 +409,7 @@ export class BindEvent extends BaseNode {
413
409
  //================================================================================
414
410
  }
415
411
 
416
- classMap['BindEvent'] = BindEvent;
412
+ classMap.BindEvent = BindEvent;
417
413
  export default BindEvent;
418
414
  //================================================================================
419
415
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -105,7 +105,7 @@ export class CallFunction extends LogicItem {
105
105
  const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
106
106
  let typeAnnotation: TypeAnnotation;
107
107
  if (options instanceof TypeAnnotation) {
108
- options.delete(); // 同一实例不支持多处存在
108
+ options.ensureDelete(); // 同一实例不支持多处存在
109
109
  typeAnnotation = options;
110
110
  Object.assign(typeAnnotation, relationOptions);
111
111
  } else {
@@ -212,7 +212,7 @@ export class CallFunction extends LogicItem {
212
212
  const relationOptions = { parentNode: this, parentKey: 'arguments' };
213
213
  let argument: Argument;
214
214
  if (options instanceof Argument) {
215
- options.delete(); // 同一实例不支持多处存在
215
+ options.ensureDelete(); // 同一实例不支持多处存在
216
216
  argument = options;
217
217
  Object.assign(argument, relationOptions);
218
218
  } else {
@@ -429,7 +429,7 @@ export class CallFunction extends LogicItem {
429
429
  const argument = Argument.from({
430
430
  keyword: param.name,
431
431
  }, this);
432
- if(param.defaultExpression instanceof Identifier) {
432
+ if (param.defaultExpression instanceof Identifier) {
433
433
  argument.expression = BaseNode.from(param.defaultExpression, argument, 'expression') as Identifier;
434
434
  }
435
435
  Object.assign(argument, relationOptions);
@@ -470,12 +470,17 @@ export class CallFunction extends LogicItem {
470
470
  code += ')';
471
471
  // 如果有内容
472
472
  const typeAnnotation = this.typeArguments[0];
473
- if (typeAnnotation.typeNamespace && typeAnnotation.typeName) {
474
- code += `<${typeAnnotation.typeNamespace}.${typeAnnotation.typeName}>()`;
475
- }
473
+ code += `<`;
474
+ code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>()`;
476
475
  code += '\n';
477
476
  } else {
478
477
  code = this.calleeKey;
478
+ if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
479
+ // 如果有内容
480
+ const typeAnnotation = this.typeArguments[0];
481
+ code += `<`;
482
+ code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>`;
483
+ }
479
484
  code += '(';
480
485
  this.arguments.forEach((arg, index) => {
481
486
  code += arg.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
@@ -97,7 +97,7 @@ export class CallInterface extends LogicItem {
97
97
  const relationOptions = { parentNode: this, parentKey: 'arguments' };
98
98
  let argument: Argument;
99
99
  if (options instanceof Argument) {
100
- options.delete(); // 同一实例不支持多处存在
100
+ options.ensureDelete(); // 同一实例不支持多处存在
101
101
  argument = options;
102
102
  Object.assign(argument, relationOptions);
103
103
  } else {
@@ -317,6 +317,16 @@ export class CallInterface extends LogicItem {
317
317
  const _interface = _module?.interfaces?.find((item) => item.name === _keys[3]);
318
318
  if (_interface) {
319
319
  params = _interface.params.filter((item) => item.required).map((item) => item.name) || [];
320
+ const _bodyParams = _interface.params.find((item) => item.name === 'Body');
321
+ if (_bodyParams) {
322
+ const _typeKey = _bodyParams.typeAnnotation.typeKey;
323
+ const _list = _typeKey.split('.');
324
+ const _structure = _module.structures.find((item) => item.name === _list[3]);
325
+ const isBodyRequired = _structure.properties.some((item) => item.required === true);
326
+ if (isBodyRequired) {
327
+ params.push('Body');
328
+ }
329
+ }
320
330
  }
321
331
  code += '({';
322
332
  this.arguments.forEach((arg, index) => {