@lcap/nasl 3.8.0-beta.3 → 3.8.0-beta.5

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 (320) hide show
  1. package/out/automate/engine/utils.js +1 -2
  2. package/out/automate/engine/utils.js.map +1 -1
  3. package/out/bak/translator.js +1 -1
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.js +7 -2
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/App__.js +6 -1
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +11 -5
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/AuthLogicForCallInterface__.js +3 -0
  12. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  13. package/out/concepts/BinaryExpression__.js +49 -2
  14. package/out/concepts/BinaryExpression__.js.map +1 -1
  15. package/out/concepts/BindAttribute__.d.ts +4 -3
  16. package/out/concepts/BindAttribute__.js +121 -42
  17. package/out/concepts/BindAttribute__.js.map +1 -1
  18. package/out/concepts/BindEvent__.js +5 -42
  19. package/out/concepts/BindEvent__.js.map +1 -1
  20. package/out/concepts/BusinessComponent__.d.ts +1 -0
  21. package/out/concepts/BusinessComponent__.js +16 -0
  22. package/out/concepts/BusinessComponent__.js.map +1 -1
  23. package/out/concepts/BusinessLogic__.js +3 -0
  24. package/out/concepts/BusinessLogic__.js.map +1 -1
  25. package/out/concepts/CallConnector__.js +1 -1
  26. package/out/concepts/CallConnector__.js.map +1 -1
  27. package/out/concepts/CallFunction__.js +1 -1
  28. package/out/concepts/CallFunction__.js.map +1 -1
  29. package/out/concepts/CallLogic__.d.ts +6 -1
  30. package/out/concepts/CallLogic__.js +58 -17
  31. package/out/concepts/CallLogic__.js.map +1 -1
  32. package/out/concepts/Connection__.d.ts +4 -0
  33. package/out/concepts/Connection__.js +15 -0
  34. package/out/concepts/Connection__.js.map +1 -1
  35. package/out/concepts/DatabaseTypeAnnotation__.d.ts +2 -0
  36. package/out/concepts/DatabaseTypeAnnotation__.js +20 -0
  37. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  38. package/out/concepts/End__.js +5 -1
  39. package/out/concepts/End__.js.map +1 -1
  40. package/out/concepts/EntityProperty__.js +2 -0
  41. package/out/concepts/EntityProperty__.js.map +1 -1
  42. package/out/concepts/Entity__.d.ts +1 -0
  43. package/out/concepts/Entity__.js +24 -1
  44. package/out/concepts/Entity__.js.map +1 -1
  45. package/out/concepts/EnumItem__.d.ts +12 -0
  46. package/out/concepts/EnumItem__.js +49 -5
  47. package/out/concepts/EnumItem__.js.map +1 -1
  48. package/out/concepts/Enum__.js +4 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/ForEachStatement__.js +1 -1
  51. package/out/concepts/ForEachStatement__.js.map +1 -1
  52. package/out/concepts/FrontendLibrary__.d.ts +46 -46
  53. package/out/concepts/FrontendLibrary__.js +34 -36
  54. package/out/concepts/FrontendLibrary__.js.map +1 -1
  55. package/out/concepts/I18nInfo__.d.ts +1 -0
  56. package/out/concepts/I18nInfo__.js +7 -0
  57. package/out/concepts/I18nInfo__.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/Interface__.js +4 -1
  61. package/out/concepts/Interface__.js.map +1 -1
  62. package/out/concepts/Logic__.d.ts +2 -3
  63. package/out/concepts/Logic__.js +33 -8
  64. package/out/concepts/Logic__.js.map +1 -1
  65. package/out/concepts/MatchCase__.d.ts +2 -2
  66. package/out/concepts/MatchCase__.js +7 -7
  67. package/out/concepts/MatchCase__.js.map +1 -1
  68. package/out/concepts/NewComposite__.js +2 -1
  69. package/out/concepts/NewComposite__.js.map +1 -1
  70. package/out/concepts/NewList__.js +2 -1
  71. package/out/concepts/NewList__.js.map +1 -1
  72. package/out/concepts/NewMap__.js +2 -1
  73. package/out/concepts/NewMap__.js.map +1 -1
  74. package/out/concepts/OqlQueryComponent__.js +3 -11
  75. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  76. package/out/concepts/OverriddenLogic__.js +7 -0
  77. package/out/concepts/OverriddenLogic__.js.map +1 -1
  78. package/out/concepts/Param__.js +2 -1
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElementV2__.d.ts +4 -5
  81. package/out/concepts/ProcessElementV2__.js +12 -17
  82. package/out/concepts/ProcessElementV2__.js.map +1 -1
  83. package/out/concepts/ProcessElement__.d.ts +3 -4
  84. package/out/concepts/ProcessElement__.js +44 -46
  85. package/out/concepts/ProcessElement__.js.map +1 -1
  86. package/out/concepts/ProcessV2__.d.ts +5 -0
  87. package/out/concepts/ProcessV2__.js +30 -2
  88. package/out/concepts/ProcessV2__.js.map +1 -1
  89. package/out/concepts/Process__.d.ts +5 -0
  90. package/out/concepts/Process__.js +28 -0
  91. package/out/concepts/Process__.js.map +1 -1
  92. package/out/concepts/QueryFromExpression__.js +2 -2
  93. package/out/concepts/QueryFromExpression__.js.map +1 -1
  94. package/out/concepts/QueryJoinExpression__.js +2 -2
  95. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  96. package/out/concepts/Return__.d.ts +1 -1
  97. package/out/concepts/Return__.js +2 -1
  98. package/out/concepts/Return__.js.map +1 -1
  99. package/out/concepts/StaticString__.d.ts +4 -0
  100. package/out/concepts/StaticString__.js +11 -0
  101. package/out/concepts/StaticString__.js.map +1 -1
  102. package/out/concepts/StructureProperty__.js +5 -2
  103. package/out/concepts/StructureProperty__.js.map +1 -1
  104. package/out/concepts/Structure__.js +9 -3
  105. package/out/concepts/Structure__.js.map +1 -1
  106. package/out/concepts/SubLogic__.d.ts +1 -3
  107. package/out/concepts/SubLogic__.js +14 -8
  108. package/out/concepts/SubLogic__.js.map +1 -1
  109. package/out/concepts/Transactional__.d.ts +1 -0
  110. package/out/concepts/Transactional__.js +7 -0
  111. package/out/concepts/Transactional__.js.map +1 -1
  112. package/out/concepts/TypeParam__.d.ts +4 -0
  113. package/out/concepts/TypeParam__.js +3 -0
  114. package/out/concepts/TypeParam__.js.map +1 -1
  115. package/out/concepts/ValidationRule__.d.ts +1 -6
  116. package/out/concepts/ValidationRule__.js +9 -6
  117. package/out/concepts/ValidationRule__.js.map +1 -1
  118. package/out/concepts/Variable__.d.ts +1 -1
  119. package/out/concepts/Variable__.js +7 -2
  120. package/out/concepts/Variable__.js.map +1 -1
  121. package/out/concepts/ViewElement__.d.ts +2 -0
  122. package/out/concepts/ViewElement__.js +130 -47
  123. package/out/concepts/ViewElement__.js.map +1 -1
  124. package/out/concepts/View__.d.ts +8 -0
  125. package/out/concepts/View__.js +123 -7
  126. package/out/concepts/View__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/nasl.processV2.js +2 -2
  128. package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.ui.js +1 -1
  130. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  131. package/out/concepts/basics/stdlib/nasl.validation.js +110 -4
  132. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  133. package/out/generator/genBundleFiles.d.ts +2 -0
  134. package/out/generator/genBundleFiles.js +51 -37
  135. package/out/generator/genBundleFiles.js.map +1 -1
  136. package/out/generator/genMetaData.js +20 -26
  137. package/out/generator/genMetaData.js.map +1 -1
  138. package/out/generator/release-body/body.js +8 -6
  139. package/out/generator/release-body/body.js.map +1 -1
  140. package/out/generator/release-body/index.d.ts +1 -0
  141. package/out/generator/release-body/index.js +1 -0
  142. package/out/generator/release-body/index.js.map +1 -1
  143. package/out/generator/release-body/utils.js +1 -1
  144. package/out/generator/release-body/utils.js.map +1 -1
  145. package/out/natural/genNaturalTS.d.ts +56 -24
  146. package/out/natural/genNaturalTS.js +182 -112
  147. package/out/natural/genNaturalTS.js.map +1 -1
  148. package/out/natural/getContext/getUILib.js +4 -2
  149. package/out/natural/getContext/getUILib.js.map +1 -1
  150. package/out/natural/getContext/index.d.ts +34 -25
  151. package/out/natural/getContext/index.js +304 -157
  152. package/out/natural/getContext/index.js.map +1 -1
  153. package/out/natural/index.d.ts +1 -0
  154. package/out/natural/index.js +1 -0
  155. package/out/natural/index.js.map +1 -1
  156. package/out/natural/tools.d.ts +11 -0
  157. package/out/natural/tools.js +155 -0
  158. package/out/natural/tools.js.map +1 -0
  159. package/out/natural/transformTS2UI.js +84 -22
  160. package/out/natural/transformTS2UI.js.map +1 -1
  161. package/out/natural/transformTSCode.js +83 -22
  162. package/out/natural/transformTSCode.js.map +1 -1
  163. package/out/server/formatTsUtils.js +17 -1
  164. package/out/server/formatTsUtils.js.map +1 -1
  165. package/out/server/getLogics.js +1 -4
  166. package/out/server/getLogics.js.map +1 -1
  167. package/out/server/naslServer.js +285 -32
  168. package/out/server/naslServer.js.map +1 -1
  169. package/out/server/translator.js +5 -1
  170. package/out/server/translator.js.map +1 -1
  171. package/out/templator/genCreateBlock.js +5 -18
  172. package/out/templator/genCreateBlock.js.map +1 -1
  173. package/out/templator/genCurdMultipleKeyBlock.js +11 -32
  174. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  175. package/out/templator/genGetBlock.js +1 -2
  176. package/out/templator/genGetBlock.js.map +1 -1
  177. package/out/templator/genListViewBlock.js +6 -4
  178. package/out/templator/genListViewBlock.js.map +1 -1
  179. package/out/templator/genSelectBlock.js +82 -59
  180. package/out/templator/genSelectBlock.js.map +1 -1
  181. package/out/templator/genTableBlock.js +4 -4
  182. package/out/templator/genTableBlock.js.map +1 -1
  183. package/out/templator/genUpdateBlock.js +2 -15
  184. package/out/templator/genUpdateBlock.js.map +1 -1
  185. package/out/templator/utils.d.ts +1 -1
  186. package/out/templator/utils.js +1 -1
  187. package/out/templator/utils.js.map +1 -1
  188. package/out/translator/types.d.ts +4 -0
  189. package/out/translator/utils.d.ts +1 -0
  190. package/out/translator/utils.js +6 -1
  191. package/out/translator/utils.js.map +1 -1
  192. package/out/utils/env.d.ts +4 -0
  193. package/out/utils/env.js +6 -3
  194. package/out/utils/env.js.map +1 -1
  195. package/out/utils/index.d.ts +19 -0
  196. package/out/utils/index.js +61 -1
  197. package/out/utils/index.js.map +1 -1
  198. package/out/utils/language-cache/constant.d.ts +18 -0
  199. package/out/utils/language-cache/constant.js +35 -0
  200. package/out/utils/language-cache/constant.js.map +1 -0
  201. package/out/utils/language-cache/index.d.ts +2 -0
  202. package/out/utils/language-cache/index.js +19 -0
  203. package/out/utils/language-cache/index.js.map +1 -0
  204. package/out/utils/language-cache/nasl.d.ts +10 -0
  205. package/out/utils/language-cache/nasl.js +98 -0
  206. package/out/utils/language-cache/nasl.js.map +1 -0
  207. package/out/utils/language-cache/types.d.ts +44 -0
  208. package/out/utils/language-cache/types.js +4 -0
  209. package/out/utils/language-cache/types.js.map +1 -0
  210. package/out/utils/time-slicing/controller.js.map +1 -1
  211. package/out/utils/types.d.ts +17 -0
  212. package/package.json +3 -2
  213. package/sandbox/stdlib/nasl.core.ts +15 -11
  214. package/sandbox/stdlib/nasl.oql.ts +5 -1
  215. package/sandbox/stdlib/nasl.processV2.ts +5 -4
  216. package/sandbox/stdlib/nasl.ui.components.pc.ts +225 -225
  217. package/sandbox/stdlib/nasl.ui.ts +10 -0
  218. package/sandbox/stdlib/nasl.util.ts +11 -0
  219. package/sandbox/stdlib/nasl.validation.ts +3 -2
  220. package/sandbox-natural/stdlib/nasl.ui.pre.d.ts +1 -1
  221. package/sandbox-natural/stdlib/nasl.ui.ts +2 -2
  222. package/sandbox-natural/stdlib/nasl.util.ts +2 -2
  223. package/src/automate/engine/utils.js +1 -2
  224. package/src/bak/translator.js +1 -1
  225. package/src/common/BaseNode.ts +7 -3
  226. package/src/concepts/App__.ts +9 -1
  227. package/src/concepts/Argument__.ts +10 -5
  228. package/src/concepts/AuthLogicForCallInterface__.ts +3 -0
  229. package/src/concepts/BinaryExpression__.ts +46 -2
  230. package/src/concepts/BindAttribute__.ts +144 -46
  231. package/src/concepts/BindEvent__.ts +8 -47
  232. package/src/concepts/BusinessComponent__.ts +17 -0
  233. package/src/concepts/BusinessLogic__.ts +3 -0
  234. package/src/concepts/CallConnector__.ts +1 -1
  235. package/src/concepts/CallFunction__.ts +1 -1
  236. package/src/concepts/CallLogic__.ts +63 -17
  237. package/src/concepts/Connection__.ts +16 -0
  238. package/src/concepts/DatabaseTypeAnnotation__.ts +11 -0
  239. package/src/concepts/End__.ts +5 -1
  240. package/src/concepts/EntityProperty__.ts +5 -0
  241. package/src/concepts/Entity__.ts +29 -1
  242. package/src/concepts/EnumItem__.ts +64 -1
  243. package/src/concepts/Enum__.ts +6 -1
  244. package/src/concepts/ForEachStatement__.ts +1 -1
  245. package/src/concepts/FrontendLibrary__.ts +78 -80
  246. package/src/concepts/I18nInfo__.ts +5 -0
  247. package/src/concepts/IfStatement__.ts +2 -2
  248. package/src/concepts/Interface__.ts +6 -1
  249. package/src/concepts/Logic__.ts +39 -10
  250. package/src/concepts/MatchCase__.ts +8 -9
  251. package/src/concepts/NewComposite__.ts +2 -1
  252. package/src/concepts/NewList__.ts +2 -1
  253. package/src/concepts/NewMap__.ts +2 -1
  254. package/src/concepts/OqlQueryComponent__.ts +3 -11
  255. package/src/concepts/OverriddenLogic__.ts +7 -0
  256. package/src/concepts/Param__.ts +1 -0
  257. package/src/concepts/ProcessElementV2__.ts +14 -16
  258. package/src/concepts/ProcessElement__.ts +16 -16
  259. package/src/concepts/ProcessV2__.ts +39 -3
  260. package/src/concepts/Process__.ts +36 -0
  261. package/src/concepts/QueryFromExpression__.ts +2 -2
  262. package/src/concepts/QueryJoinExpression__.ts +2 -2
  263. package/src/concepts/Return__.ts +2 -1
  264. package/src/concepts/StaticString__.ts +12 -0
  265. package/src/concepts/StructureProperty__.ts +7 -2
  266. package/src/concepts/Structure__.ts +11 -3
  267. package/src/concepts/SubLogic__.ts +15 -9
  268. package/src/concepts/Transactional__.ts +5 -0
  269. package/src/concepts/TypeParam__.ts +6 -0
  270. package/src/concepts/ValidationRule__.ts +7 -6
  271. package/src/concepts/Variable__.ts +7 -2
  272. package/src/concepts/ViewElement__.ts +130 -47
  273. package/src/concepts/View__.ts +157 -8
  274. package/src/concepts/basics/stdlib/nasl.processV2.ts +2 -2
  275. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -1
  276. package/src/concepts/basics/stdlib/nasl.validation.ts +111 -4
  277. package/src/generator/genBundleFiles.ts +53 -39
  278. package/src/generator/genMetaData.ts +21 -26
  279. package/src/generator/release-body/body.ts +9 -6
  280. package/src/generator/release-body/index.ts +1 -0
  281. package/src/generator/release-body/utils.ts +4 -2
  282. package/src/natural/genNaturalTS.ts +327 -141
  283. package/src/natural/getContext/getUILib.ts +4 -2
  284. package/src/natural/getContext/index.ts +348 -171
  285. package/src/natural/index.ts +1 -0
  286. package/src/natural/tools.ts +130 -0
  287. package/src/natural/transformTS2UI.ts +84 -22
  288. package/src/natural/transformTSCode.ts +83 -22
  289. package/src/server/formatTsUtils.ts +21 -1
  290. package/src/server/getLogics.ts +1 -4
  291. package/src/server/naslServer.ts +302 -33
  292. package/src/server/translator.ts +5 -1
  293. package/src/templator/genCreateBlock.ts +5 -18
  294. package/src/templator/genCurdMultipleKeyBlock.ts +14 -32
  295. package/src/templator/genGetBlock.ts +2 -4
  296. package/src/templator/genListViewBlock.ts +6 -4
  297. package/src/templator/genSelectBlock.ts +88 -61
  298. package/src/templator/genTableBlock.ts +4 -4
  299. package/src/templator/genUpdateBlock.ts +2 -15
  300. package/src/templator/utils.ts +1 -1
  301. package/src/translator/types.ts +4 -0
  302. package/src/translator/utils.ts +6 -0
  303. package/src/utils/env.ts +5 -4
  304. package/src/utils/index.ts +50 -1
  305. package/src/utils/language-cache/constant.ts +37 -0
  306. package/src/utils/language-cache/index.ts +2 -0
  307. package/src/utils/language-cache/nasl.ts +83 -0
  308. package/src/utils/language-cache/types.ts +48 -0
  309. package/src/utils/time-slicing/controller.ts +0 -1
  310. package/src/utils/types.ts +20 -0
  311. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +13 -13
  312. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +12 -12
  313. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -2
  314. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +221 -217
  315. package/ts-worker/bundle.js +1 -1
  316. package/ts-worker/src/index.js +0 -1
  317. package/out/utils/delay/index.d.ts +0 -0
  318. package/out/utils/delay/index.js +0 -1
  319. package/out/utils/delay/index.js.map +0 -1
  320. package/src/utils/delay/index.ts +0 -0
@@ -21,6 +21,7 @@ import type Namespace from './Namespace__';
21
21
  import type View from './View__';
22
22
  import Process from './Process__';
23
23
  import Module from './Module__';
24
+ import type SubLogic from './SubLogic__';
24
25
  //================================================================================
25
26
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
26
27
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1476,6 +1477,9 @@ export class ProcessElement extends BaseNode {
1476
1477
  @withSourceMapGenerator
1477
1478
  *toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
1478
1479
  const self = this;
1480
+ // 获取所有子节点用于树上填充
1481
+ self.getSubLogics();
1482
+
1479
1483
  // this.syncLogic();
1480
1484
  const tab0 = indent(state?.tabSize || 0);
1481
1485
  const tab1 = indent((state?.tabSize || 0) + 1);
@@ -1723,22 +1727,18 @@ export class ProcessElement extends BaseNode {
1723
1727
  // });
1724
1728
  // this.app.emit('collect:end');
1725
1729
  // }
1726
- get subLogic() {
1727
- // 只有自动任务需要, 其他的UI展示上均在其下面的 Logic 中
1728
- if (this.type === 'ServiceTask') {
1729
- const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
1730
- if (asserts.isSubLogic(node)) {
1731
- return true;
1732
- }
1733
- });
1734
- return subLogics;
1735
- }
1736
- return [];
1737
- }
1738
-
1739
- genActionListener($event: EventPayload): void {
1740
- super.genActionListener($event);
1741
- invokeCommand('logic.update', this);
1730
+ subLogics: Array<SubLogic> = [];
1731
+
1732
+ getSubLogics() {
1733
+ // 只有 AutoTask 才需要在他的节点下找子逻辑
1734
+ // 其他直接在 BindEvent 下找
1735
+ if (this.type !== 'AutoTask') return [] as SubLogic[];
1736
+ const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
1737
+ if (asserts.isSubLogic(node)) {
1738
+ return true;
1739
+ }
1740
+ });
1741
+ this.subLogics = subLogics as Array<SubLogic>;
1742
1742
  }
1743
1743
  //================================================================================
1744
1744
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -8,6 +8,10 @@ import Logic from './Logic__';
8
8
  import Entity from './Entity__';
9
9
  import { genLaunchProcess, genProcessOperate } from '../server/getProcessesV2';
10
10
  import { createUniqueKey } from '../utils/create';
11
+ import type SubLogic from './SubLogic__';
12
+ import type Param from './Param__';
13
+
14
+
11
15
  //================================================================================
12
16
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
13
17
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -24,7 +28,6 @@ import ProcessElementV2 from './ProcessElementV2__';
24
28
  import HistoryProcessV2 from './HistoryProcessV2__';
25
29
  import ProcessBindV2 from './ProcessBindV2__';
26
30
  import BindEvent from './BindEvent__';
27
-
28
31
  /**
29
32
  * 流程
30
33
  */
@@ -820,6 +823,8 @@ export class ProcessV2 extends BaseNode {
820
823
  // 获取虚拟logic的参数和内容
821
824
  // 用作展示和tots查找引用
822
825
  self.getElementLogicRoot();
826
+ // 获取所有子节点用于树上填充
827
+ self.getSubLogics();
823
828
  const tab1 = indent((state?.tabSize || 0) + 1);
824
829
  let code = `export namespace ${self.uniqueKey} {\n`;
825
830
  const bind = self.bind;
@@ -960,7 +965,7 @@ export class ProcessV2 extends BaseNode {
960
965
  bounds: {
961
966
  concept: 'Rect',
962
967
  x: 0,
963
- y: 0,
968
+ y: 200,
964
969
  },
965
970
  bindAttrs: [
966
971
  {
@@ -1019,7 +1024,7 @@ export class ProcessV2 extends BaseNode {
1019
1024
  bounds: {
1020
1025
  concept: 'Rect',
1021
1026
  x: 0,
1022
- y: 500,
1027
+ y: 400,
1023
1028
  },
1024
1029
  },
1025
1030
  {
@@ -1037,6 +1042,37 @@ export class ProcessV2 extends BaseNode {
1037
1042
  };
1038
1043
  }
1039
1044
 
1045
+ // TODO need reset when process support hoc & spread param & type annotation
1046
+ subLogics: Array<SubLogic> = [];
1047
+
1048
+ getSubLogics() {
1049
+ const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
1050
+ if (asserts.isSubLogic(node)) {
1051
+ return true;
1052
+ }
1053
+ });
1054
+ this.subLogics = subLogics as Array<SubLogic>;
1055
+ }
1056
+
1057
+
1058
+ get includeSpreadCallLogic() {
1059
+ return !!this.findNode((node) => {
1060
+ if (asserts.isCallLogic(node)) {
1061
+ const logic = node.getCallNode();
1062
+ const args = logic?.params || [];
1063
+ return args.some((arg: Param) => arg.spread);
1064
+ }
1065
+ });
1066
+ }
1067
+
1068
+ get includeTypeArgs() {
1069
+ return !!this.findNode((node) => {
1070
+ if (asserts.isCallLogic(node)) {
1071
+ return (node?.needCompleteTypeArguments?.length || 0) > 0;
1072
+ }
1073
+ });
1074
+ }
1075
+
1040
1076
  //================================================================================
1041
1077
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1042
1078
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -17,6 +17,8 @@ import type Logic from './Logic__';
17
17
  import type Variable from './Variable__';
18
18
  import type Identifier from './Identifier__';
19
19
  import Module from './Module__';
20
+ import type SubLogic from './SubLogic__';
21
+
20
22
  //================================================================================
21
23
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
22
24
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1220,6 +1222,9 @@ export class Process extends BaseNode {
1220
1222
  // 获取虚拟logic的参数和内容
1221
1223
  // 用作展示和tots查找引用
1222
1224
  self.getElementLogicRoot();
1225
+ // 获取所有子节点用于树上填充
1226
+ self.getSubLogics();
1227
+
1223
1228
  let code = `export namespace ${self.name} {\n`;
1224
1229
  const tab0 = indent(state?.tabSize || 0);
1225
1230
  const tab1 = indent((state?.tabSize || 0) + 1);
@@ -1487,6 +1492,37 @@ export class Process extends BaseNode {
1487
1492
  ],
1488
1493
  };
1489
1494
  }
1495
+
1496
+ // TODO need reset when process support hoc & spread param & type annotation
1497
+ subLogics: Array<SubLogic> = [];
1498
+
1499
+ getSubLogics() {
1500
+ const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
1501
+ if (asserts.isSubLogic(node)) {
1502
+ return true;
1503
+ }
1504
+ });
1505
+ this.subLogics = subLogics as Array<SubLogic>;
1506
+ }
1507
+
1508
+
1509
+ get includeSpreadCallLogic() {
1510
+ return !!this.findNode((node) => {
1511
+ if (asserts.isCallLogic(node)) {
1512
+ const logic = node.getCallNode();
1513
+ const args = logic?.params || [];
1514
+ return args.some((arg: Param) => arg.spread);
1515
+ }
1516
+ });
1517
+ }
1518
+
1519
+ get includeTypeArgs() {
1520
+ return !!this.findNode((node) => {
1521
+ if (asserts.isCallLogic(node)) {
1522
+ return (node?.needCompleteTypeArguments?.length || 0) > 0;
1523
+ }
1524
+ });
1525
+ }
1490
1526
  //================================================================================
1491
1527
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1492
1528
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -262,12 +262,12 @@ export class QueryFromExpression extends LogicItem {
262
262
 
263
263
  @withSourceMap()
264
264
  toNaturalTS(state = createCompilerState()): string {
265
- const simpleEntityKey = this.entityName + 'Entity';
265
+ const simpleEntityKey = this.entityKey + 'Entity';
266
266
  let code = `FROM(${simpleEntityKey}, ${this.asName || this.entityName} => $`;
267
267
 
268
268
  if (this.joinParts.length) {
269
269
  this.joinParts.forEach((joinPart) => {
270
- code += '\n';
270
+ code += `\n${indent(state.tabSize)}`;
271
271
  code += joinPart.toNaturalTS(state);
272
272
  });
273
273
  }
@@ -466,7 +466,7 @@ export class QueryJoinExpression extends LogicItem {
466
466
 
467
467
  @withSourceMap()
468
468
  toNaturalTS(state = createCompilerState()): string {
469
- const simpleEntityKey = this.entityName + 'Entity';
469
+ const simpleEntityKey = this.entityKey + 'Entity';
470
470
  let code = `.${this.joinType}_JOIN(${simpleEntityKey}, ${this.asName || this.entityName} => ON(() => `;
471
471
  this.onExpressions.forEach((on) => {
472
472
  code += on.toNaturalTS(shiftState(state, code, { inline: true }));
@@ -475,7 +475,7 @@ export class QueryJoinExpression extends LogicItem {
475
475
 
476
476
  if (this.joinParts.length) {
477
477
  this.joinParts.forEach((joinPart) => {
478
- code += '\n';
478
+ code += `\n${indent(state.tabSize)}`;
479
479
  code += joinPart.toNaturalTS(state);
480
480
  });
481
481
  }
@@ -372,7 +372,8 @@ export class Return extends BaseNode {
372
372
  get __isVirtual() {
373
373
  const processV2 = this.getAncestor('ProcessV2') as ProcessV2;
374
374
  const process = this.getAncestor('Process') as Process;
375
- return processV2?.__isVirtual || process?.__isVirtual || false;
375
+ const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(processV2?.status)
376
+ return isDisabled || process?.__isVirtual || false;
376
377
  }
377
378
  //================================================================================
378
379
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -65,6 +65,18 @@ export class StaticString extends BaseNode {
65
65
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
66
66
  // 自动生成的代码已结束。下面可以手动编写。
67
67
  //================================================================================
68
+
69
+ /**
70
+ * 设置字符串的值
71
+ */
72
+ setValue(value: string) {
73
+ const object = {
74
+ value,
75
+ };
76
+ this.update({
77
+ ...object,
78
+ });
79
+ }
68
80
  /**
69
81
  * 祖先 View
70
82
  */
@@ -9,6 +9,7 @@ import {
9
9
  TranslatorGenerator,
10
10
  indent,
11
11
  createDecoratorCode,
12
+ createDescriptionComment,
12
13
  } from '../translator';
13
14
  import type Namespace from './Namespace__';
14
15
 
@@ -203,7 +204,11 @@ export class StructureProperty extends BaseNode {
203
204
 
204
205
  @withSourceMap()
205
206
  toNaturalTS(state = createCompilerState()): string {
206
- let code = this.name;
207
+ let code = '';
208
+ if (state.descriptionComment)
209
+ code += createDescriptionComment(state, this, ['label', 'description']);
210
+
211
+ code += this.name;
207
212
  if (this.typeAnnotation) {
208
213
  code += ': ';
209
214
  code += this.typeAnnotation.toNaturalTS(shiftState(state, code, { inline: true }));
@@ -300,7 +305,7 @@ export class StructureProperty extends BaseNode {
300
305
  * 是否可编辑
301
306
  * */
302
307
  get readonly() {
303
- return !!this.module || (this.parentNode as Structure).origin === 'CallQueryComponent' || this.isConnector;
308
+ return !!this.module || this.isConnector;
304
309
  }
305
310
 
306
311
  //================================================================================
@@ -10,6 +10,7 @@ import {
10
10
  withGenerator,
11
11
  TranslatorGenerator,
12
12
  createDecoratorCode,
13
+ createDescriptionComment,
13
14
  } from '../translator';
14
15
  import type Namespace from './Namespace__';
15
16
  import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
@@ -523,7 +524,7 @@ export class Structure extends BaseNode {
523
524
  * 是否可编辑
524
525
  * */
525
526
  get readonly() {
526
- return !!this.module || this.origin === 'CallQueryComponent' || this.isConnector;
527
+ return !!this.module || this.isConnector;
527
528
  }
528
529
 
529
530
  /* 删除空数据模块 */
@@ -561,7 +562,10 @@ export class Structure extends BaseNode {
561
562
 
562
563
  @withSourceMap()
563
564
  toNaturalTS(state = createCompilerState()): string {
564
- let code = `class ${this.name}`;
565
+ let code = '';
566
+ if (state.descriptionComment)
567
+ code += createDescriptionComment(state, this, ['description']);
568
+ code = `class ${this.name}`;
565
569
 
566
570
  if (this.typeParams?.length) {
567
571
  code += `<${this.typeParams
@@ -569,7 +573,11 @@ export class Structure extends BaseNode {
569
573
  .join(', ')}>`;
570
574
  }
571
575
 
572
- code += ` {\n`;
576
+ code += ` {`;
577
+ if (state.descriptionComment && this.description)
578
+ code += `/* ${this.description} */`;
579
+ code += '\n';
580
+
573
581
  // code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
574
582
  this.properties.forEach((property) => {
575
583
  code += indent(state.tabSize + 1);
@@ -923,9 +923,9 @@ export class SubLogic extends LogicItem {
923
923
 
924
924
  completionChildren: Array<SubLogic> = [];
925
925
 
926
- getVarExistingNames(excludedList: Array<Param> = []) {
926
+ getVarExistingNames(excludedList: Array<Param | Variable | Return> = []) {
927
927
  const excludedSet = new Set(excludedList);
928
- return [...this.params].filter((item) => !excludedSet.has(item)).map((item) => item.name);
928
+ return [...this.params, ...this.variables, ...this.returns].filter((item) => !excludedSet.has(item)).map((item) => item.name);
929
929
  }
930
930
 
931
931
  toJSContent(code: string, state?: TranslatorState): string {
@@ -1030,6 +1030,10 @@ export class SubLogic extends LogicItem {
1030
1030
  const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
1031
1031
  return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
1032
1032
  }
1033
+ // 调用依赖库逻辑可能会有子逻辑,子逻辑拼接可能有ts忽略先去掉
1034
+ if (asserts.isCallLogic(rightNode) && rightNode.calleeNamespace?.startsWith('extensions.')) {
1035
+ code = code.replaceAll('// @ts-ignore', '');
1036
+ }
1033
1037
 
1034
1038
  // ForEachStatement 内部变量需要替换处理,如 item、index
1035
1039
  const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
@@ -1040,7 +1044,9 @@ export class SubLogic extends LogicItem {
1040
1044
  const callFunction = assignment.getAncestor('CallFunction') as CallFunction;
1041
1045
  if (callFunction && callFunction.isLoopCollection) {
1042
1046
  const anonymousFunction = assignment.getAncestor('AnonymousFunction') as AnonymousFunction;
1043
- code = yield* this.handleCollectionCode(code, anonymousFunction, callFunction);
1047
+ if (anonymousFunction) {
1048
+ code = yield* this.handleCollectionCode(code, anonymousFunction, callFunction);
1049
+ }
1044
1050
  }
1045
1051
  // Match 需要针对分支缩小类型范围
1046
1052
  const matchCase = assignment.getAncestor('MatchCase') as MatchCase;
@@ -1099,7 +1105,9 @@ export class SubLogic extends LogicItem {
1099
1105
  const parentCallFunction = callFunction.getAncestor('CallFunction') as CallFunction;
1100
1106
  if (parentCallFunction?.isLoopCollection) {
1101
1107
  const parentAnonymousFunction = callFunction.getAncestor('AnonymousFunction') as AnonymousFunction;
1102
- code = yield* this.handleCollectionCode(code, parentAnonymousFunction, parentCallFunction);
1108
+ if (parentAnonymousFunction) {
1109
+ code = yield* this.handleCollectionCode(code, parentAnonymousFunction, parentCallFunction);
1110
+ }
1103
1111
  }
1104
1112
  return code;
1105
1113
  }
@@ -1183,6 +1191,9 @@ export class SubLogic extends LogicItem {
1183
1191
  // 内置函数对集合类型的推导
1184
1192
  (asserts.isCallFunction(el) && el.derivablecollection?.name))
1185
1193
  ) {
1194
+ if (el?.getAncestor('SubLogic') !== self) {
1195
+ return;
1196
+ }
1186
1197
  if (asserts.isAssignment(el)) {
1187
1198
  const advanceVar = self.variables?.find(
1188
1199
  (variable) => !variable.typeAnnotation && el.left?.name === variable.name,
@@ -1493,11 +1504,6 @@ export class SubLogic extends LogicItem {
1493
1504
  this.subLogics = subLogics as SubLogic[];
1494
1505
  }
1495
1506
 
1496
- genActionListener($event: EventPayload): void {
1497
- super.genActionListener($event);
1498
- invokeCommand('logic.update', this);
1499
- }
1500
-
1501
1507
  // 用于展示的名称
1502
1508
  get __name__() {
1503
1509
  const callLogic = this.getAncestor('CallLogic') as CallLogic;
@@ -111,6 +111,11 @@ export class Transactional extends BaseNode {
111
111
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
112
112
  // 自动生成的代码已结束。下面可以手动编写。
113
113
  //================================================================================
114
+ @withSourceMap()
115
+ toNaturalTS(state = createCompilerState()): string {
116
+ return '';
117
+ }
118
+
114
119
  /**
115
120
  * 祖先 Logic
116
121
  */
@@ -48,6 +48,12 @@ export class TypeParam extends BaseNode {
48
48
  @property()
49
49
  name: string = '';
50
50
 
51
+ /**
52
+ * 展示名称
53
+ */
54
+ @property()
55
+ displayName?: string;
56
+
51
57
  /**
52
58
  * @param source 需要合并的部分参数
53
59
  */
@@ -270,12 +270,7 @@ export class ValidationRule extends LogicItem {
270
270
  //================================================================================
271
271
 
272
272
  public static getDefaultOptions() {
273
- return {
274
- target: {
275
- concept: 'Identifier',
276
- name: '',
277
- },
278
- };
273
+ return {};
279
274
  }
280
275
 
281
276
  toInViewMethod() {
@@ -287,6 +282,8 @@ export class ValidationRule extends LogicItem {
287
282
  code += `validate: 'excluded',`;
288
283
  } else if (this.calleeName === 'confirmed') {
289
284
  code += `validate: 'is',`;
285
+ } else if (this.calleeName === 'object') {
286
+ code += `validate: 'plainObject',`;
290
287
  } else {
291
288
  code += `validate: '${this.calleeName}',`;
292
289
  }
@@ -337,6 +334,8 @@ export class ValidationRule extends LogicItem {
337
334
  code += `validate: 'excluded',`;
338
335
  } else if (this.calleeName === 'confirmed') {
339
336
  code += `validate: 'is',`;
337
+ } else if (this.calleeName === 'object') {
338
+ code += `validate: 'plainObject',`;
340
339
  } else {
341
340
  code += `validate: '${this.calleeName}',`;
342
341
  }
@@ -547,6 +546,8 @@ export class ValidationRule extends LogicItem {
547
546
  const argument = Argument.from(
548
547
  {
549
548
  keyword: param.name,
549
+ expression: param.defaultValue?.expression,
550
+ required: param.required,
550
551
  },
551
552
  this,
552
553
  );
@@ -208,7 +208,8 @@ export class Variable extends BaseNode {
208
208
  get __isVirtual() {
209
209
  const processV2 = this.getAncestor('ProcessV2') as ProcessV2;
210
210
  const process = this.getAncestor('Process') as Process;
211
- return processV2?.__isVirtual || process?.__isVirtual || false;
211
+ const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(processV2?.status)
212
+ return isDisabled || process?.__isVirtual || false;
212
213
  }
213
214
 
214
215
  toVue(options?: ElementToVueOptions): string {
@@ -465,7 +466,11 @@ export class Variable extends BaseNode {
465
466
  * 是否可编辑
466
467
  * */
467
468
  get readonly() {
468
- return !!this.module;
469
+ // 不在可编辑态的连接器下
470
+ const isInConnector = this.connector;
471
+ const isInIntegration = this.getAncestor('Integration');
472
+ const isInEditableConnector = isInIntegration && isInConnector;
473
+ return !!(this.module && !isInEditableConnector);
469
474
  }
470
475
 
471
476
  //================================================================================