@lcap/nasl 3.6.0-alpha.1 → 3.6.0-alpha.2

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 (245) hide show
  1. package/out/bak/translator.js +119 -39
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/breakpoint/generator/BreakpointNode.d.ts +3 -0
  4. package/out/breakpoint/generator/BreakpointNode.js +9 -0
  5. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  6. package/out/breakpoint/shared/constants.js +1 -0
  7. package/out/breakpoint/shared/constants.js.map +1 -1
  8. package/out/breakpoint/shared/utils.js +12 -6
  9. package/out/breakpoint/shared/utils.js.map +1 -1
  10. package/out/breakpoint/store/core.js +1 -1
  11. package/out/breakpoint/store/core.js.map +1 -1
  12. package/out/common/BaseNode.d.ts +1 -4
  13. package/out/common/BaseNode.js +23 -37
  14. package/out/common/BaseNode.js.map +1 -1
  15. package/out/concepts/AnonymousFunction__.d.ts +6 -1
  16. package/out/concepts/AnonymousFunction__.js +34 -16
  17. package/out/concepts/AnonymousFunction__.js.map +1 -1
  18. package/out/concepts/App__.d.ts +55 -51
  19. package/out/concepts/App__.js +76 -80
  20. package/out/concepts/App__.js.map +1 -1
  21. package/out/concepts/BackendVariable__.js +10 -2
  22. package/out/concepts/BackendVariable__.js.map +1 -1
  23. package/out/concepts/BindAttribute__.js +16 -6
  24. package/out/concepts/BindAttribute__.js.map +1 -1
  25. package/out/concepts/BindDirective__.d.ts +1 -0
  26. package/out/concepts/BindDirective__.js +19 -4
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.d.ts +3 -1
  29. package/out/concepts/BindEvent__.js +39 -14
  30. package/out/concepts/BindEvent__.js.map +1 -1
  31. package/out/concepts/BusinessComponent__.d.ts +641 -0
  32. package/out/concepts/BusinessComponent__.js +1921 -0
  33. package/out/concepts/BusinessComponent__.js.map +1 -0
  34. package/out/concepts/BusinessLogic__.d.ts +38 -0
  35. package/out/concepts/BusinessLogic__.js +358 -0
  36. package/out/concepts/BusinessLogic__.js.map +1 -0
  37. package/out/concepts/CallEvent__.d.ts +101 -0
  38. package/out/concepts/CallEvent__.js +280 -0
  39. package/out/concepts/CallEvent__.js.map +1 -0
  40. package/out/concepts/CallFunction__.d.ts +0 -1
  41. package/out/concepts/CallFunction__.js +10 -10
  42. package/out/concepts/CallFunction__.js.map +1 -1
  43. package/out/concepts/CallLogic__.d.ts +2 -0
  44. package/out/concepts/CallLogic__.js +38 -27
  45. package/out/concepts/CallLogic__.js.map +1 -1
  46. package/out/concepts/Constant__.js +7 -6
  47. package/out/concepts/Constant__.js.map +1 -1
  48. package/out/concepts/Destination__.d.ts +1 -1
  49. package/out/concepts/Destination__.js +7 -5
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/End__.js +2 -1
  52. package/out/concepts/End__.js.map +1 -1
  53. package/out/concepts/Event__.d.ts +14 -0
  54. package/out/concepts/Event__.js +61 -0
  55. package/out/concepts/Event__.js.map +1 -1
  56. package/out/concepts/FrontendType__.d.ts +308 -0
  57. package/out/concepts/FrontendType__.js +605 -0
  58. package/out/concepts/FrontendType__.js.map +1 -0
  59. package/out/concepts/Frontend__.d.ts +0 -88
  60. package/out/concepts/Frontend__.js +1 -143
  61. package/out/concepts/Frontend__.js.map +1 -1
  62. package/out/concepts/Identifier__.d.ts +5 -0
  63. package/out/concepts/Identifier__.js +19 -9
  64. package/out/concepts/Identifier__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -1
  66. package/out/concepts/LogicItem__.js.map +1 -1
  67. package/out/concepts/Logic__.d.ts +3 -1
  68. package/out/concepts/Logic__.js +31 -21
  69. package/out/concepts/Logic__.js.map +1 -1
  70. package/out/concepts/Match__.d.ts +1 -1
  71. package/out/concepts/MemberExpression__.d.ts +1 -1
  72. package/out/concepts/MemberExpression__.js +3 -3
  73. package/out/concepts/MemberExpression__.js.map +1 -1
  74. package/out/concepts/NewComposite__.js.map +1 -1
  75. package/out/concepts/ParamWithGroup__.d.ts +39 -0
  76. package/out/concepts/ParamWithGroup__.js +85 -0
  77. package/out/concepts/ParamWithGroup__.js.map +1 -0
  78. package/out/concepts/Param__.js +11 -3
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +9 -1
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/Return__.js +17 -9
  83. package/out/concepts/Return__.js.map +1 -1
  84. package/out/concepts/ValidationRule__.js +2 -1
  85. package/out/concepts/ValidationRule__.js.map +1 -1
  86. package/out/concepts/Variable__.js +17 -8
  87. package/out/concepts/Variable__.js.map +1 -1
  88. package/out/concepts/ViewElement__.d.ts +17 -1
  89. package/out/concepts/ViewElement__.js +145 -16
  90. package/out/concepts/ViewElement__.js.map +1 -1
  91. package/out/concepts/View__.js +21 -20
  92. package/out/concepts/View__.js.map +1 -1
  93. package/out/concepts/index__.d.ts +5 -0
  94. package/out/concepts/index__.js +5 -0
  95. package/out/concepts/index__.js.map +1 -1
  96. package/out/concepts/utils/asserts.d.ts +258 -3
  97. package/out/concepts/utils/asserts.js +351 -13
  98. package/out/concepts/utils/asserts.js.map +1 -1
  99. package/out/concepts/utils/types.d.ts +20 -3
  100. package/out/generator/genBundleFiles.js +25 -11
  101. package/out/generator/genBundleFiles.js.map +1 -1
  102. package/out/generator/genReleaseBody.js +12 -3
  103. package/out/generator/genReleaseBody.js.map +1 -1
  104. package/out/generator/permission.js +3 -3
  105. package/out/generator/permission.js.map +1 -1
  106. package/out/natural/transformTSCode.js +1 -1
  107. package/out/natural/transformTSCode.js.map +1 -1
  108. package/out/server/extendBaseNode.js +6 -4
  109. package/out/server/extendBaseNode.js.map +1 -1
  110. package/out/server/getLogics.js +62 -27
  111. package/out/server/getLogics.js.map +1 -1
  112. package/out/server/getMemberIdentifier.js +6 -1
  113. package/out/server/getMemberIdentifier.js.map +1 -1
  114. package/out/server/getProcesses.js +3 -3
  115. package/out/server/getProcesses.js.map +1 -1
  116. package/out/server/naslServer.js +40 -19
  117. package/out/server/naslServer.js.map +1 -1
  118. package/out/server/translator.js +6 -1
  119. package/out/server/translator.js.map +1 -1
  120. package/out/service/storage/init.js +1 -2
  121. package/out/service/storage/init.js.map +1 -1
  122. package/out/templator/genCreateBlock.js +6 -6
  123. package/out/templator/genCreateBlock.js.map +1 -1
  124. package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
  125. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  126. package/out/templator/genCurdMultipleKeyBlock.js +36 -36
  127. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  128. package/out/templator/genGetBlock.js +6 -5
  129. package/out/templator/genGetBlock.js.map +1 -1
  130. package/out/templator/genGridViewBlock.js +12 -12
  131. package/out/templator/genGridViewBlock.js.map +1 -1
  132. package/out/templator/genListViewBlock.js +4 -4
  133. package/out/templator/genListViewBlock.js.map +1 -1
  134. package/out/templator/genSelectBlock.js +3 -3
  135. package/out/templator/genSelectBlock.js.map +1 -1
  136. package/out/templator/genTableBlock.js +10 -10
  137. package/out/templator/genTableBlock.js.map +1 -1
  138. package/out/templator/genUpdateBlock.js +10 -9
  139. package/out/templator/genUpdateBlock.js.map +1 -1
  140. package/out/templator/utils.d.ts +2 -2
  141. package/out/templator/utils.js.map +1 -1
  142. package/out/translator/utils.js +12 -1
  143. package/out/translator/utils.js.map +1 -1
  144. package/out/utils/i18nInfo.js +7 -2
  145. package/out/utils/i18nInfo.js.map +1 -1
  146. package/out/utils/index.d.ts +17 -0
  147. package/out/utils/index.js +184 -1
  148. package/out/utils/index.js.map +1 -1
  149. package/package.json +2 -2
  150. package/src/bak/translator.js +121 -43
  151. package/src/breakpoint/generator/BreakpointNode.ts +12 -0
  152. package/src/breakpoint/shared/constants.ts +1 -0
  153. package/src/breakpoint/shared/utils.ts +13 -8
  154. package/src/breakpoint/store/core.ts +1 -1
  155. package/src/common/BaseNode.ts +22 -41
  156. package/src/concepts/AnonymousFunction__.ts +36 -18
  157. package/src/concepts/App__.ts +129 -130
  158. package/src/concepts/BackendVariable__.ts +10 -2
  159. package/src/concepts/BindAttribute__.ts +14 -6
  160. package/src/concepts/BindDirective__.ts +19 -4
  161. package/src/concepts/BindEvent__.ts +41 -13
  162. package/src/concepts/BusinessComponent__.ts +2693 -0
  163. package/src/concepts/BusinessLogic__.ts +376 -0
  164. package/src/concepts/CallEvent__.ts +351 -0
  165. package/src/concepts/CallFunction__.ts +10 -13
  166. package/src/concepts/CallLogic__.ts +45 -32
  167. package/src/concepts/Constant__.ts +5 -7
  168. package/src/concepts/Destination__.ts +7 -5
  169. package/src/concepts/End__.ts +1 -0
  170. package/src/concepts/Event__.ts +70 -0
  171. package/src/concepts/FrontendType__.ts +919 -0
  172. package/src/concepts/Frontend__.ts +3 -251
  173. package/src/concepts/Identifier__.ts +29 -13
  174. package/src/concepts/LogicItem__.ts +1 -0
  175. package/src/concepts/Logic__.ts +36 -23
  176. package/src/concepts/MemberExpression__.ts +3 -3
  177. package/src/concepts/NewComposite__.ts +4 -6
  178. package/src/concepts/ParamWithGroup__.ts +101 -0
  179. package/src/concepts/Param__.ts +11 -3
  180. package/src/concepts/ProcessElement__.ts +8 -1
  181. package/src/concepts/Return__.ts +15 -12
  182. package/src/concepts/ValidationRule__.ts +6 -1
  183. package/src/concepts/Variable__.ts +17 -9
  184. package/src/concepts/ViewElement__.ts +168 -33
  185. package/src/concepts/View__.ts +23 -20
  186. package/src/concepts/index__.ts +5 -0
  187. package/src/concepts/utils/asserts.ts +367 -4
  188. package/src/concepts/utils/types.ts +28 -0
  189. package/src/generator/genBundleFiles.ts +33 -15
  190. package/src/generator/genReleaseBody.ts +14 -3
  191. package/src/generator/permission.ts +8 -6
  192. package/src/natural/transformTSCode.ts +1 -1
  193. package/src/server/extendBaseNode.ts +22 -20
  194. package/src/server/getLogics.ts +79 -41
  195. package/src/server/getMemberIdentifier.ts +7 -1
  196. package/src/server/getProcesses.ts +3 -3
  197. package/src/server/naslServer.ts +44 -20
  198. package/src/server/translator.ts +7 -1
  199. package/src/service/storage/init.ts +1 -2
  200. package/src/templator/genCreateBlock.ts +6 -6
  201. package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
  202. package/src/templator/genCurdMultipleKeyBlock.ts +36 -36
  203. package/src/templator/genGetBlock.ts +6 -5
  204. package/src/templator/genGridViewBlock.ts +12 -12
  205. package/src/templator/genListViewBlock.ts +4 -4
  206. package/src/templator/genSelectBlock.ts +3 -3
  207. package/src/templator/genTableBlock.ts +10 -10
  208. package/src/templator/genUpdateBlock.ts +10 -9
  209. package/src/templator/utils.ts +2 -2
  210. package/src/translator/utils.ts +12 -1
  211. package/src/utils/i18nInfo.ts +7 -2
  212. package/src/utils/index.ts +211 -1
  213. package/test/concepts/call-function/fixtures/from-string.json +68 -59
  214. package/test/concepts/call-function/fixtures/to-string-global-tz.json +67 -58
  215. package/test/concepts/call-function/fixtures/to-string-no-tz.json +57 -48
  216. package/test/concepts/call-function/fixtures/to-string-user-tz.json +69 -60
  217. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +69 -60
  218. package/test/concepts/call-interface/fixtures/only-interface.json +81 -72
  219. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +223 -214
  220. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +85 -76
  221. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +100 -91
  222. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +88 -79
  223. package/test/concepts/call-interface/fixtures/with-headers.json +90 -81
  224. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +88 -79
  225. package/test/concepts/call-interface/fixtures/with-query.json +90 -81
  226. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +4 -2
  227. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +104 -95
  228. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +209 -200
  229. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +97 -88
  230. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +124 -115
  231. package/test/concepts/call-logic/fixtures/json-deserialize.json +120 -111
  232. package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +124 -115
  233. package/test/concepts/call-logic/fixtures/json-serialize.json +124 -115
  234. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +91 -82
  235. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +88 -79
  236. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +144 -135
  237. package/test/concepts/identifier/fixtures/view-variable.json +145 -136
  238. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
  239. package/test/concepts/view-element/fixtures/default-login.json +221 -212
  240. package/test/concepts/view-element/fixtures/default-not-found.json +183 -174
  241. package/test/concepts/view-element/fixtures/with-role-auth.json +91 -82
  242. package/test/concepts/view-element/fixtures/with-table.json +1894 -1885
  243. package/test/concepts/view-element/toVue.spec.ts +1 -0
  244. package/ts-worker/package.json +1 -1
  245. package/ts-worker/src/index.js +1 -0
@@ -1,14 +1,13 @@
1
1
  import { queryNodeByPath } from '../service/storage/jsoner';
2
2
  import { getNaslNodeByNodeCallee, getNodeByNodeCallee } from '../automate/engine/utils';
3
- import ConfigProperty from './ConfigProperty__';
4
- import TypeAnnotation from './TypeAnnotation__';
5
- import View from './View__';
6
- import AuthInterface from './AuthInterface__';
7
- import Interface from './Interface__';
3
+ import type ConfigProperty from './ConfigProperty__';
4
+ import type TypeAnnotation from './TypeAnnotation__';
5
+ import type View from './View__';
6
+ import type AuthInterface from './AuthInterface__';
7
+ import type Interface from './Interface__';
8
+ import type Frontend from './Frontend__';
8
9
  import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
9
10
 
10
- // import CallLogic from './CallLogic__';
11
-
12
11
  export interface AssetsInfo {
13
12
  js: Array<string>;
14
13
  css: Array<string>;
@@ -59,7 +58,7 @@ import type Enum from './Enum__';
59
58
  import type Logic from './Logic__';
60
59
  import type OverriddenLogic from './OverriddenLogic__';
61
60
  import type AbstractInterface from './AbstractInterface__';
62
- import type Frontend from './Frontend__';
61
+ import type FrontendType from './FrontendType__';
63
62
  import Backend from './Backend__';
64
63
  import type Process from './Process__';
65
64
  import type Role from './Role__';
@@ -206,14 +205,14 @@ export class App extends BaseNode {
206
205
  interfaces: Array<AbstractInterface> = [];
207
206
 
208
207
  /**
209
- * 前端列表
208
+ * 端类型列表
210
209
  */
211
210
  @property({
212
- objectRef: 'Frontend',
211
+ objectRef: 'FrontendType',
213
212
  isArray: true,
214
213
  defaultValue: [],
215
214
  })
216
- frontends: Array<Frontend> = [];
215
+ frontendTypes: Array<FrontendType> = [];
217
216
 
218
217
  /**
219
218
  * 后端
@@ -1471,156 +1470,158 @@ export class App extends BaseNode {
1471
1470
  return utils.unique(name, this.getAbstractInterfaceExistingNames(), undefined, true);
1472
1471
  }
1473
1472
 
1474
- getFrontendExistingNames(excludedList: Array<Frontend> = []) {
1473
+ getFrontendTypeExistingNames(excludedList: Array<FrontendType> = []) {
1475
1474
  const excludedSet = new Set(excludedList);
1476
- return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
1475
+ return ((this.frontendTypes as FrontendType[]) || [])
1476
+ .filter((item) => !excludedSet.has(item))
1477
+ .map((item) => item?.name);
1477
1478
  }
1478
- getFrontendUniqueName(name = 'frontend1') {
1479
- return utils.unique(name, this.getFrontendExistingNames(), undefined, true);
1479
+ getFrontendTypeUniqueName(name = 'frontendType1') {
1480
+ return utils.unique(name, this.getFrontendTypeExistingNames(), undefined, true);
1480
1481
  }
1481
1482
 
1482
1483
  /**
1483
- * 插入前端
1484
+ * 插入端类型
1484
1485
  * @internal
1485
- * @param name 前端名称,如果不填会自动生成一个唯一名称
1486
+ * @param name 端类型名称,如果不填会自动生成一个唯一名称
1486
1487
  */
1487
- _insertFrontendAt(name: string, index: number): Frontend;
1488
+ _insertFrontendTypeAt(name: string, index: number): FrontendType;
1488
1489
 
1489
1490
  /**
1490
- * 插入前端
1491
+ * 插入端类型
1491
1492
  * @internal
1492
- * @param frontendOptions 前端参数
1493
+ * @param frontendTypeOptions 端类型参数
1493
1494
  */
1494
- _insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
1495
+ _insertFrontendTypeAt(frontendTypeOptions: Partial<FrontendType>, index: number): FrontendType;
1495
1496
 
1496
1497
  /**
1497
- * 插入前端
1498
+ * 插入端类型
1498
1499
  * @internal
1499
- * @param frontend 已有的前端实例
1500
+ * @param frontendType 已有的端类型实例
1500
1501
  */
1501
- _insertFrontendAt(frontend: Frontend, index: number): Frontend;
1502
+ _insertFrontendTypeAt(frontendType: FrontendType, index: number): FrontendType;
1502
1503
 
1503
- _insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
1504
- const frontendOptions: any = {};
1505
- const relationOptions = { parentNode: this, parentKey: 'frontends' };
1506
- const Frontend = getConceptConstructor('Frontend');
1507
- let frontend: Frontend;
1504
+ _insertFrontendTypeAt(options: string | Partial<FrontendType> | FrontendType, index: number) {
1505
+ const frontendTypeOptions: any = {};
1506
+ const relationOptions = { parentNode: this, parentKey: 'frontendTypes' };
1507
+ const FrontendType = getConceptConstructor('FrontendType');
1508
+ let frontendType: FrontendType;
1508
1509
  if (!options) {
1509
- frontend = Frontend.from(
1510
+ frontendType = FrontendType.from(
1510
1511
  {
1511
- ...frontendOptions,
1512
- name: this.getFrontendUniqueName(),
1512
+ ...frontendTypeOptions,
1513
+ name: this.getFrontendTypeUniqueName(),
1513
1514
  },
1514
1515
  this,
1515
- 'frontends',
1516
+ 'frontendTypes',
1516
1517
  );
1517
1518
  } else if (typeof options === 'string') {
1518
- frontend = Frontend.from(
1519
+ frontendType = FrontendType.from(
1519
1520
  {
1520
- ...frontendOptions,
1521
+ ...frontendTypeOptions,
1521
1522
  name: options,
1522
1523
  },
1523
1524
  this,
1524
- 'frontends',
1525
+ 'frontendTypes',
1525
1526
  );
1526
- } else if (asserts.isFrontend(options)) {
1527
+ } else if (asserts.isFrontendType(options)) {
1527
1528
  options.ensureDelete(); // 同一实例不支持多处存在
1528
- frontend = options;
1529
- Object.assign(frontend, relationOptions);
1529
+ frontendType = options;
1530
+ Object.assign(frontendType, relationOptions);
1530
1531
  } else {
1531
- frontend = Frontend.from(
1532
+ frontendType = FrontendType.from(
1532
1533
  {
1533
- ...frontendOptions,
1534
+ ...frontendTypeOptions,
1534
1535
  ...options,
1535
1536
  },
1536
1537
  this,
1537
- 'frontends',
1538
+ 'frontendTypes',
1538
1539
  );
1539
1540
  }
1540
- this.frontends.splice(index, 0, frontend);
1541
- return frontend;
1541
+ this.frontendTypes.splice(index, 0, frontendType);
1542
+ return frontendType;
1542
1543
  }
1543
1544
 
1544
1545
  /**
1545
- * 插入前端
1546
- * @param name 前端名称,如果不填会自动生成一个唯一名称
1546
+ * 插入端类型
1547
+ * @param name 端类型名称,如果不填会自动生成一个唯一名称
1547
1548
  */
1548
- insertFrontendAt(name: string, index: number): Frontend;
1549
+ insertFrontendTypeAt(name: string, index: number): FrontendType;
1549
1550
 
1550
1551
  /**
1551
- * 插入前端
1552
- * @param frontendOptions 前端参数
1552
+ * 插入端类型
1553
+ * @param frontendTypeOptions 端类型参数
1553
1554
  */
1554
- insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
1555
+ insertFrontendTypeAt(frontendTypeOptions: Partial<FrontendType>, index: number): FrontendType;
1555
1556
 
1556
1557
  /**
1557
- * 插入前端
1558
- * @param frontend 已有的前端实例
1558
+ * 插入端类型
1559
+ * @param frontendType 已有的端类型实例
1559
1560
  */
1560
- insertFrontendAt(frontend: Frontend, index: number): Frontend;
1561
+ insertFrontendTypeAt(frontendType: FrontendType, index: number): FrontendType;
1561
1562
 
1562
- insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
1563
- const node = this._insertFrontendAt(options as any, index);
1563
+ insertFrontendTypeAt(options: string | Partial<FrontendType> | FrontendType, index: number) {
1564
+ const node = this._insertFrontendTypeAt(options as any, index);
1564
1565
  node.create({
1565
1566
  index,
1566
1567
  parentNode: this,
1567
- parentKey: 'frontends',
1568
+ parentKey: 'frontendTypes',
1568
1569
  });
1569
1570
  return node;
1570
1571
  }
1571
1572
 
1572
1573
  /**
1573
- * 添加前端
1574
+ * 添加端类型
1574
1575
  * @internal
1575
- * @param name 前端名称,如果不填会自动生成一个唯一名称
1576
+ * @param name 端类型名称,如果不填会自动生成一个唯一名称
1576
1577
  */
1577
- _addFrontend(name?: string): Frontend;
1578
+ _addFrontendType(name?: string): FrontendType;
1578
1579
 
1579
1580
  /**
1580
- * 添加前端
1581
+ * 添加端类型
1581
1582
  * @internal
1582
- * @param frontendOptions 前端参数
1583
+ * @param frontendTypeOptions 端类型参数
1583
1584
  */
1584
- _addFrontend(frontendOptions: Partial<Frontend>): Frontend;
1585
+ _addFrontendType(frontendTypeOptions: Partial<FrontendType>): FrontendType;
1585
1586
 
1586
1587
  /**
1587
- * 添加前端
1588
+ * 添加端类型
1588
1589
  * @internal
1589
- * @param frontend 已有的前端实例
1590
+ * @param frontendType 已有的端类型实例
1590
1591
  */
1591
- _addFrontend(frontend: Frontend): Frontend;
1592
+ _addFrontendType(frontendType: FrontendType): FrontendType;
1592
1593
 
1593
- _addFrontend(options?: string | Partial<Frontend> | Frontend) {
1594
- const index = this.frontends.length;
1595
- return this._insertFrontendAt(options as any, index);
1594
+ _addFrontendType(options?: string | Partial<FrontendType> | FrontendType) {
1595
+ const index = this.frontendTypes.length;
1596
+ return this._insertFrontendTypeAt(options as any, index);
1596
1597
  }
1597
1598
 
1598
1599
  /**
1599
- * 添加前端
1600
+ * 添加端类型
1600
1601
  * @internal
1601
- * @param name 前端名称,如果不填会自动生成一个唯一名称
1602
+ * @param name 端类型名称,如果不填会自动生成一个唯一名称
1602
1603
  */
1603
- addFrontend(name?: string): Frontend;
1604
+ addFrontendType(name?: string): FrontendType;
1604
1605
 
1605
1606
  /**
1606
- * 添加前端
1607
- * @param frontendOptions 前端参数
1607
+ * 添加端类型
1608
+ * @param frontendTypeOptions 端类型参数
1608
1609
  */
1609
- addFrontend(frontendOptions: Partial<Frontend>): Frontend;
1610
+ addFrontendType(frontendTypeOptions: Partial<FrontendType>): FrontendType;
1610
1611
 
1611
1612
  /**
1612
- * 添加前端
1613
- * @param frontend 已有的前端实例
1613
+ * 添加端类型
1614
+ * @param frontendType 已有的端类型实例
1614
1615
  */
1615
- addFrontend(frontend: Frontend): Frontend;
1616
+ addFrontendType(frontendType: FrontendType): FrontendType;
1616
1617
 
1617
- addFrontend(options?: string | Partial<Frontend> | Frontend) {
1618
- const node = this._addFrontend(options as any);
1619
- const index = this.frontends.indexOf(node);
1618
+ addFrontendType(options?: string | Partial<FrontendType> | FrontendType) {
1619
+ const node = this._addFrontendType(options as any);
1620
+ const index = this.frontendTypes.indexOf(node);
1620
1621
  node.create({
1621
1622
  index,
1622
1623
  parentNode: this,
1623
- parentKey: 'frontends',
1624
+ parentKey: 'frontendTypes',
1624
1625
  });
1625
1626
  return node;
1626
1627
  }
@@ -3238,45 +3239,45 @@ export class App extends BaseNode {
3238
3239
  }
3239
3240
 
3240
3241
  /**
3241
- * 删除前端
3242
- * @param name 前端名称
3242
+ * 删除端类型
3243
+ * @param name 端类型名称
3243
3244
  */
3244
- removeFrontend(name: string): void;
3245
+ removeFrontendType(name: string): void;
3245
3246
 
3246
3247
  /**
3247
- * 删除前端
3248
- * @param frontend 已有的前端实例
3248
+ * 删除端类型
3249
+ * @param frontendType 已有的端类型实例
3249
3250
  */
3250
- removeFrontend(frontend: Frontend): void;
3251
+ removeFrontendType(frontendType: FrontendType): void;
3251
3252
 
3252
- removeFrontend(options: string | Frontend) {
3253
- let frontend: Frontend;
3253
+ removeFrontendType(options: string | FrontendType) {
3254
+ let frontendType: FrontendType;
3254
3255
  if (typeof options === 'string') {
3255
- frontend = (this.frontends as Frontend[]).find((item) => item.name === options);
3256
- if (!frontend) {
3257
- throw new Error('找不到前端 ' + options);
3256
+ frontendType = (this.frontendTypes as FrontendType[]).find((item) => item.name === options);
3257
+ if (!frontendType) {
3258
+ throw new Error('找不到端类型 ' + options);
3258
3259
  }
3259
3260
  } else {
3260
- frontend = options;
3261
+ frontendType = options;
3261
3262
  }
3262
- return frontend.delete();
3263
+ return frontendType.delete();
3263
3264
  }
3264
3265
 
3265
- __removeFrontend(frontend: Frontend) {
3266
- const parentKey = frontend.parentKey;
3266
+ __removeFrontendType(frontendType: FrontendType) {
3267
+ const parentKey = frontendType.parentKey;
3267
3268
  const params: Params = {
3268
3269
  parentNode: this,
3269
3270
  parentKey,
3270
3271
  index: -1,
3271
3272
  object: null,
3272
- oldObject: frontend,
3273
+ oldObject: frontendType,
3273
3274
  };
3274
3275
  if (parentKey) {
3275
3276
  params.parentKey = parentKey;
3276
3277
  // @ts-ignore
3277
3278
  const t = this.__v_raw || this;
3278
3279
  // @ts-ignore
3279
- const n = frontend.__v_raw || frontend;
3280
+ const n = frontendType.__v_raw || frontendType;
3280
3281
  if (Array.isArray((t as any)[parentKey])) {
3281
3282
  // @ts-ignore
3282
3283
  const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
@@ -3938,6 +3939,17 @@ export class App extends BaseNode {
3938
3939
  composeCache: composeCacheType = {};
3939
3940
 
3940
3941
 
3942
+ /**
3943
+ * 获取组合节点
3944
+ */
3945
+ getCompose(path: string[]) {
3946
+ let compose = this.composeCache;
3947
+ path.forEach((key) => {
3948
+ compose = compose?.[key];
3949
+ });
3950
+ return compose || null;
3951
+ }
3952
+
3941
3953
  /**
3942
3954
  * 获取组合节点
3943
3955
  */
@@ -4169,10 +4181,10 @@ export class App extends BaseNode {
4169
4181
  names: [],
4170
4182
  },
4171
4183
  };
4172
- const frontends = this.frontends.filter((frontend) => frontend.type === scope);
4184
+ const frontendTypes = this.frontendTypes.filter((frontendType) => frontendType.kind === scope);
4173
4185
  const existingSet = new Set();
4174
- frontends.forEach((frontend) => {
4175
- frontend.componentDependencies.forEach((dep) => {
4186
+ frontendTypes.forEach((frontendType) => {
4187
+ frontendType.componentDependencies.forEach((dep) => {
4176
4188
  const { name, version } = dep;
4177
4189
  const jsName = `${prefix}/packages/${name}@${version}/dist-theme/index.js`;
4178
4190
  if (!existingSet.has(jsName)) {
@@ -4279,7 +4291,11 @@ export class App extends BaseNode {
4279
4291
  structureCount: this.structures.length,
4280
4292
  enumCount: this.enums.length,
4281
4293
  logicCount: this.logics.length,
4282
- viewCount: sum(this.frontends.map((frontend) => countView(frontend.views))),
4294
+ viewCount: sum(
4295
+ this.frontendTypes.map((frontendType) =>
4296
+ sum(frontendType.frontends.map((frontend) => countView(frontend.views))),
4297
+ ),
4298
+ ),
4283
4299
  processCount: this.processes.length,
4284
4300
  };
4285
4301
  }
@@ -4451,35 +4467,19 @@ export class App extends BaseNode {
4451
4467
  return errorList;
4452
4468
  }
4453
4469
 
4454
- addFrontendForType(options?: string | Partial<Frontend> | Frontend) {
4455
- let insertIndex = -1;
4456
- this.frontends.forEach((frontend, index) => {
4457
- if (frontend.type === (options as any).type) {
4458
- insertIndex = index;
4459
- }
4460
- });
4461
- if ((options as any).type === 'h5' && insertIndex === -1) {
4462
- insertIndex = this.frontends.length;
4463
- }
4464
- const node = this._insertFrontendAt(options as any, insertIndex + 1);
4465
- const index = this.frontends.indexOf(node);
4466
- node.create({
4467
- index,
4468
- parentNode: this,
4469
- parentKey: 'frontends',
4470
- });
4471
- return node;
4472
- }
4473
-
4474
4470
  getFrontendExistingTitles(excludedList: Array<Frontend> = []) {
4475
4471
  const excludedSet = new Set(excludedList);
4476
- return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.title);
4472
+ return (this.frontendTypes || [])
4473
+ .map((frontendType) => frontendType.frontends?.filter((item) => !excludedSet.has(item)).map((item) => item.title))
4474
+ .flat(2);
4477
4475
  }
4478
4476
 
4479
4477
  getExtensionsCallbackLogics() {
4480
4478
  let resultLogics: string[] = [];
4481
- this.frontends.forEach((frontend) => {
4482
- resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
4479
+ this.frontendTypes.forEach((frontendType) => {
4480
+ frontendType?.frontends?.forEach((frontend) => {
4481
+ resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
4482
+ });
4483
4483
  });
4484
4484
  return Array.from(new Set(resultLogics));
4485
4485
  }
@@ -4493,7 +4493,6 @@ export class App extends BaseNode {
4493
4493
  }
4494
4494
 
4495
4495
  genAllCustomComponents() {
4496
- const { frontends } = this;
4497
4496
  const compMap: {
4498
4497
  pc: Array<any>;
4499
4498
  h5: Array<any>;
@@ -4502,12 +4501,12 @@ export class App extends BaseNode {
4502
4501
  h5: [],
4503
4502
  };
4504
4503
  const existingSet = new Set();
4505
- frontends.forEach((frontend) => {
4506
- if (frontend.componentDependencies) {
4507
- frontend.componentDependencies.forEach((dep) => {
4504
+ this.frontendTypes.forEach((frontendType) => {
4505
+ if (frontendType.componentDependencies) {
4506
+ frontendType.componentDependencies.forEach((dep) => {
4508
4507
  const { name } = dep;
4509
4508
  if (!existingSet.has(name)) {
4510
- compMap[frontend.type].push(dep);
4509
+ compMap[frontendType.kind].push(dep);
4511
4510
  }
4512
4511
  });
4513
4512
  }
@@ -321,12 +321,20 @@ export class BackendVariable extends BaseNode {
321
321
  toJS(state?: TranslatorState): string {
322
322
  const context = this.view ? 'this' : 'Vue.prototype';
323
323
  const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
324
+ let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
325
+ if (typeNamespace?.endsWith('.metadataTypes')) {
326
+ const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
327
+ const typeAn = referenceNode.typeAnnotation || {};
328
+ sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
329
+ typeKind = typeAn.typeKind;
330
+ typeName = typeAn.typeName;
331
+ }
324
332
  const needGenInitFromSchema =
325
333
  typeAnnotation &&
326
- (!['primitive', 'union'].includes(typeAnnotation.typeKind) || typeAnnotation.typeName === 'DateTime');
334
+ (!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
327
335
  let code = `${this.name} =`;
328
336
  if (needGenInitFromSchema) {
329
- code += `${context}.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}',`;
337
+ code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
330
338
  }
331
339
 
332
340
  if (this.defaultValue?.expression) {
@@ -1085,10 +1085,14 @@ export class BindAttribute extends BaseNode {
1085
1085
  const self = this;
1086
1086
  const { name, type, value, rules, expression, playground } = self;
1087
1087
  let code = '';
1088
- if (self?.name === 'data-source' && self?.expression?.concept === 'CallLogic') {
1089
- code = `() => {`;
1088
+ // 业务组件
1089
+ const isBusinessComponent = self.viewElement?.isCorrespondingBusinessComponent;
1090
+ if (isBusinessComponent) {
1091
+ code += `${name}: `;
1092
+ } else if (self?.name === 'data-source' && self?.expression?.concept === 'CallLogic') {
1093
+ code += `() => {\n`;
1090
1094
  } else {
1091
- code = '() => {';
1095
+ code += '() => {\n';
1092
1096
  }
1093
1097
  if (['destination', 'externalDestination'].includes(name) && type === 'dynamic') {
1094
1098
  code += yield* (self as any)[name].toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
@@ -1100,7 +1104,7 @@ export class BindAttribute extends BaseNode {
1100
1104
  });
1101
1105
  } else if (expression) {
1102
1106
  code += yield* expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1103
- code += ';\n';
1107
+ code += '\n';
1104
1108
  } else if (name === 'url' && value) {
1105
1109
  /**
1106
1110
  * ls定制化处理
@@ -1126,13 +1130,15 @@ export class BindAttribute extends BaseNode {
1126
1130
  code += ';\n';
1127
1131
  }
1128
1132
  }
1129
- if (type === 'dynamic') {
1133
+ if (type === 'dynamic' && !isBusinessComponent) {
1130
1134
  yield* wrapForEach(playground, function* warpForEachGenerator(item, index) {
1131
1135
  code += yield* item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1132
1136
  code += ';\n';
1133
1137
  });
1134
1138
  }
1135
- code += '}';
1139
+ if (!isBusinessComponent) {
1140
+ code += '\n}';
1141
+ }
1136
1142
  return code;
1137
1143
  }
1138
1144
 
@@ -1168,6 +1174,8 @@ export class BindAttribute extends BaseNode {
1168
1174
  type = `${self.value}`.includes('.') ? 'nasl.core.Decimal' : 'nasl.core.Long';
1169
1175
  } else if (typeof self.value === 'boolean') {
1170
1176
  type = 'nasl.core.Boolean';
1177
+ } else if (['page-size', 'page-number'].includes(self.name) && self.value === null) {
1178
+ type = 'nasl.core.Long'
1171
1179
  }
1172
1180
  code += `${type}`;
1173
1181
  } else {
@@ -629,21 +629,36 @@ export class BindDirective extends BaseNode {
629
629
  return str;
630
630
  }
631
631
 
632
+ get viewElement() {
633
+ return this.getAncestor('ViewElement') as ViewElement;
634
+ }
635
+
632
636
  @withSourceMapGenerator
633
637
  *toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
634
638
  const self = this;
635
- let code = '()=>{';
639
+ // 业务组件
640
+ const isBusinessComponent = self.viewElement?.correspondingBusinessComponent;
641
+ let code = '';
642
+ if (!isBusinessComponent) {
643
+ code += '()=>{';
644
+ }
636
645
  if (self.expression) {
637
646
  code += yield* self.expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
638
- code += ';\n';
647
+ code += '\n';
639
648
  }
640
649
  if (self.type === 'dynamic') {
641
650
  yield* wrapForEach(self.playground, function* warpForEachGenerator(item, index) {
642
651
  code += yield* item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
643
- if (index !== self.playground.length - 1) code += ';\n';
652
+ if (index !== self.playground.length - 1) code += '\n';
644
653
  });
645
654
  }
646
- code += '}';
655
+ if (isBusinessComponent) {
656
+ if (code) {
657
+ code = `${self.name === 'if' ? '__NASLIF' : self.name}: ${code}`;
658
+ }
659
+ } else {
660
+ code += '}';
661
+ }
647
662
  return code;
648
663
  }
649
664