@lcap/nasl 1.0.2 → 2.12.0

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 (299) hide show
  1. package/out/automate/engine/index.d.ts +1 -0
  2. package/out/automate/engine/index.js +34 -12
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/operators.d.ts +10 -2
  5. package/out/automate/engine/operators.js +105 -7
  6. package/out/automate/engine/operators.js.map +1 -1
  7. package/out/automate/engine/uniqueName.d.ts +8 -2
  8. package/out/automate/engine/uniqueName.js +72 -4
  9. package/out/automate/engine/uniqueName.js.map +1 -1
  10. package/out/automate/engine/utils.d.ts +1 -0
  11. package/out/automate/engine/utils.js +92 -67
  12. package/out/automate/engine/utils.js.map +1 -1
  13. package/out/automate/template/process.d.ts +9 -0
  14. package/out/automate/template/process.js +10976 -0
  15. package/out/automate/template/process.js.map +1 -0
  16. package/out/bak/translator.js +1 -0
  17. package/out/bak/translator.js.map +1 -1
  18. package/out/common/BaseNode.d.ts +5 -0
  19. package/out/common/BaseNode.js +24 -3
  20. package/out/common/BaseNode.js.map +1 -1
  21. package/out/concepts/App__.d.ts +51 -49
  22. package/out/concepts/App__.js +86 -53
  23. package/out/concepts/App__.js.map +1 -1
  24. package/out/concepts/BindAttribute__.js +2 -2
  25. package/out/concepts/BindAttribute__.js.map +1 -1
  26. package/out/concepts/BindDirective__.js +10 -3
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.js +15 -6
  29. package/out/concepts/BindEvent__.js.map +1 -1
  30. package/out/concepts/BooleanLiteral__.d.ts +4 -0
  31. package/out/concepts/BooleanLiteral__.js +11 -0
  32. package/out/concepts/BooleanLiteral__.js.map +1 -1
  33. package/out/concepts/CallFunction__.js +8 -2
  34. package/out/concepts/CallFunction__.js.map +1 -1
  35. package/out/concepts/CallLogic__.js +48 -30
  36. package/out/concepts/CallLogic__.js.map +1 -1
  37. package/out/concepts/CallQueryComponent__.d.ts +8 -7
  38. package/out/concepts/CallQueryComponent__.js +86 -76
  39. package/out/concepts/CallQueryComponent__.js.map +1 -1
  40. package/out/concepts/Comment__.js +1 -1
  41. package/out/concepts/Comment__.js.map +1 -1
  42. package/out/concepts/ConfigGroup__.d.ts +1 -0
  43. package/out/concepts/ConfigGroup__.js +7 -0
  44. package/out/concepts/ConfigGroup__.js.map +1 -1
  45. package/out/concepts/ConfigProperty__.d.ts +1 -0
  46. package/out/concepts/ConfigProperty__.js +3 -0
  47. package/out/concepts/ConfigProperty__.js.map +1 -1
  48. package/out/concepts/Configuration__.d.ts +1 -0
  49. package/out/concepts/Configuration__.js +3 -0
  50. package/out/concepts/Configuration__.js.map +1 -1
  51. package/out/concepts/DataSource__.d.ts +143 -0
  52. package/out/concepts/DataSource__.js +318 -0
  53. package/out/concepts/DataSource__.js.map +1 -0
  54. package/out/concepts/Destination__.js +8 -8
  55. package/out/concepts/Destination__.js.map +1 -1
  56. package/out/concepts/End__.js +2 -2
  57. package/out/concepts/End__.js.map +1 -1
  58. package/out/concepts/EntityIndex__.d.ts +5 -0
  59. package/out/concepts/EntityIndex__.js +6 -0
  60. package/out/concepts/EntityIndex__.js.map +1 -1
  61. package/out/concepts/EntityProperty__.d.ts +9 -0
  62. package/out/concepts/EntityProperty__.js +19 -2
  63. package/out/concepts/EntityProperty__.js.map +1 -1
  64. package/out/concepts/Entity__.d.ts +5 -0
  65. package/out/concepts/Entity__.js +20 -10
  66. package/out/concepts/Entity__.js.map +1 -1
  67. package/out/concepts/Enum__.js +12 -6
  68. package/out/concepts/Enum__.js.map +1 -1
  69. package/out/concepts/ForEachStatement__.js +2 -2
  70. package/out/concepts/ForEachStatement__.js.map +1 -1
  71. package/out/concepts/Function__.d.ts +18 -0
  72. package/out/concepts/Function__.js +96 -1
  73. package/out/concepts/Function__.js.map +1 -1
  74. package/out/concepts/Identifier__.js +6 -15
  75. package/out/concepts/Identifier__.js.map +1 -1
  76. package/out/concepts/IfStatement__.js +8 -8
  77. package/out/concepts/IfStatement__.js.map +1 -1
  78. package/out/concepts/Interface__.js +19 -12
  79. package/out/concepts/Interface__.js.map +1 -1
  80. package/out/concepts/JSBlock__.js +3 -5
  81. package/out/concepts/JSBlock__.js.map +1 -1
  82. package/out/concepts/Logic__.js +44 -44
  83. package/out/concepts/Logic__.js.map +1 -1
  84. package/out/concepts/Module__.d.ts +116 -194
  85. package/out/concepts/Module__.js +31 -114
  86. package/out/concepts/Module__.js.map +1 -1
  87. package/out/concepts/Namespace__.d.ts +0 -86
  88. package/out/concepts/Namespace__.js +1 -108
  89. package/out/concepts/Namespace__.js.map +1 -1
  90. package/out/concepts/Param__.d.ts +2 -1
  91. package/out/concepts/Param__.js +1 -1
  92. package/out/concepts/Param__.js.map +1 -1
  93. package/out/concepts/ProcessElement__.js +30 -10
  94. package/out/concepts/ProcessElement__.js.map +1 -1
  95. package/out/concepts/Process__.d.ts +1 -1
  96. package/out/concepts/Process__.js +17 -10
  97. package/out/concepts/Process__.js.map +1 -1
  98. package/out/concepts/QueryFieldExpression__.js +8 -1
  99. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  100. package/out/concepts/QueryFromExpression__.d.ts +4 -0
  101. package/out/concepts/QueryFromExpression__.js +13 -2
  102. package/out/concepts/QueryFromExpression__.js.map +1 -1
  103. package/out/concepts/QueryJoinExpression__.d.ts +4 -0
  104. package/out/concepts/QueryJoinExpression__.js +14 -3
  105. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  106. package/out/concepts/Return__.js +1 -1
  107. package/out/concepts/Return__.js.map +1 -1
  108. package/out/concepts/Role__.js +10 -3
  109. package/out/concepts/Role__.js.map +1 -1
  110. package/out/concepts/SqlQueryComponent__.d.ts +14 -0
  111. package/out/concepts/SqlQueryComponent__.js +48 -5
  112. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.d.ts +1 -1
  114. package/out/concepts/StringLiteral__.js +1 -1
  115. package/out/concepts/StructureProperty__.js +6 -5
  116. package/out/concepts/StructureProperty__.js.map +1 -1
  117. package/out/concepts/Structure__.js +19 -12
  118. package/out/concepts/Structure__.js.map +1 -1
  119. package/out/concepts/SwitchCase__.d.ts +1 -1
  120. package/out/concepts/SwitchCase__.js +23 -25
  121. package/out/concepts/SwitchCase__.js.map +1 -1
  122. package/out/concepts/SwitchStatement__.js +1 -6
  123. package/out/concepts/SwitchStatement__.js.map +1 -1
  124. package/out/concepts/TypeAnnotation__.d.ts +8 -0
  125. package/out/concepts/TypeAnnotation__.js +44 -2
  126. package/out/concepts/TypeAnnotation__.js.map +1 -1
  127. package/out/concepts/Variable__.js +1 -1
  128. package/out/concepts/Variable__.js.map +1 -1
  129. package/out/concepts/ViewElement__.js +25 -20
  130. package/out/concepts/ViewElement__.js.map +1 -1
  131. package/out/concepts/View__.d.ts +0 -2
  132. package/out/concepts/View__.js +27 -32
  133. package/out/concepts/View__.js.map +1 -1
  134. package/out/concepts/WhileStatement__.js +4 -4
  135. package/out/concepts/WhileStatement__.js.map +1 -1
  136. package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
  137. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  138. package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
  139. package/out/concepts/basics/stdlib/nasl.process.js +410 -0
  140. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  141. package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
  142. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  143. package/out/concepts/basics/stdlib/nasl.util.js +280 -2
  144. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  145. package/out/concepts/basics/types/index.d.ts +1 -0
  146. package/out/concepts/basics/types/index.js +4 -1
  147. package/out/concepts/basics/types/index.js.map +1 -1
  148. package/out/concepts/index__.d.ts +1 -0
  149. package/out/concepts/index__.js +1 -0
  150. package/out/concepts/index__.js.map +1 -1
  151. package/out/generator/genBundleFiles.d.ts +3 -1
  152. package/out/generator/genBundleFiles.js +23 -5
  153. package/out/generator/genBundleFiles.js.map +1 -1
  154. package/out/generator/genMetaData.d.ts +1 -0
  155. package/out/generator/genMetaData.js +20 -12
  156. package/out/generator/genMetaData.js.map +1 -1
  157. package/out/index.d.ts +1 -1
  158. package/out/index.js +2 -1
  159. package/out/index.js.map +1 -1
  160. package/out/server/createUiTs.js +1 -0
  161. package/out/server/createUiTs.js.map +1 -1
  162. package/out/server/getLogics.js +27 -1
  163. package/out/server/getLogics.js.map +1 -1
  164. package/out/server/getMemberIdentifier.js +5 -0
  165. package/out/server/getMemberIdentifier.js.map +1 -1
  166. package/out/server/getProcesses.d.ts +4 -0
  167. package/out/server/getProcesses.js +69 -1
  168. package/out/server/getProcesses.js.map +1 -1
  169. package/out/server/naslServer.d.ts +1 -0
  170. package/out/server/naslServer.js +223 -26
  171. package/out/server/naslServer.js.map +1 -1
  172. package/out/server/process2LogicNamespace.js +10 -1
  173. package/out/server/process2LogicNamespace.js.map +1 -1
  174. package/out/server/translator.js +37 -1
  175. package/out/server/translator.js.map +1 -1
  176. package/out/service/creator/errHandles.js +5 -0
  177. package/out/service/creator/errHandles.js.map +1 -1
  178. package/out/service/storage/init.d.ts +1 -0
  179. package/out/service/storage/init.js +95 -84
  180. package/out/service/storage/init.js.map +1 -1
  181. package/out/templator/genCreateBlock.js +34 -24
  182. package/out/templator/genCreateBlock.js.map +1 -1
  183. package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
  184. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  185. package/out/templator/genCurdMultipleKeyBlock.js +45 -29
  186. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  187. package/out/templator/genEditTableBlock.js +15 -13
  188. package/out/templator/genEditTableBlock.js.map +1 -1
  189. package/out/templator/genEnumSelectBlock.js +1 -1
  190. package/out/templator/genEnumSelectBlock.js.map +1 -1
  191. package/out/templator/genGridViewBlock.js +29 -24
  192. package/out/templator/genGridViewBlock.js.map +1 -1
  193. package/out/templator/genListViewBlock.js +7 -5
  194. package/out/templator/genListViewBlock.js.map +1 -1
  195. package/out/templator/genQueryComponent.js +25 -26
  196. package/out/templator/genQueryComponent.js.map +1 -1
  197. package/out/templator/genSelectBlock.js +8 -7
  198. package/out/templator/genSelectBlock.js.map +1 -1
  199. package/out/templator/genTableBlock.js +31 -21
  200. package/out/templator/genTableBlock.js.map +1 -1
  201. package/out/templator/genUpdateBlock.js +34 -24
  202. package/out/templator/genUpdateBlock.js.map +1 -1
  203. package/out/templator/utils.d.ts +2 -2
  204. package/out/templator/utils.js.map +1 -1
  205. package/out/test/integration/connect-file.js +6 -6
  206. package/out/test/integration/connect-file.js.map +1 -1
  207. package/out/translator/index.js +1 -1
  208. package/out/translator/index.js.map +1 -1
  209. package/out/utils/index.d.ts +5 -0
  210. package/out/utils/index.js +50 -1
  211. package/out/utils/index.js.map +1 -1
  212. package/package.json +1 -1
  213. package/src/automate/engine/index.js +33 -8
  214. package/src/automate/engine/operators.js +114 -17
  215. package/src/automate/engine/uniqueName.js +77 -9
  216. package/src/automate/engine/utils.js +95 -68
  217. package/src/automate/template/process.js +10999 -0
  218. package/src/bak/translator.js +1 -0
  219. package/src/common/BaseNode.ts +21 -4
  220. package/src/concepts/App__.ts +128 -94
  221. package/src/concepts/BindAttribute__.ts +2 -2
  222. package/src/concepts/BindDirective__.ts +9 -7
  223. package/src/concepts/BindEvent__.ts +14 -6
  224. package/src/concepts/BooleanLiteral__.ts +12 -0
  225. package/src/concepts/CallFunction__.ts +6 -2
  226. package/src/concepts/CallLogic__.ts +47 -32
  227. package/src/concepts/CallQueryComponent__.ts +92 -81
  228. package/src/concepts/Comment__.ts +1 -1
  229. package/src/concepts/ConfigGroup__.ts +3 -1
  230. package/src/concepts/ConfigProperty__.ts +4 -0
  231. package/src/concepts/Configuration__.ts +3 -0
  232. package/src/concepts/DataSource__.ts +391 -0
  233. package/src/concepts/Destination__.ts +24 -8
  234. package/src/concepts/End__.ts +2 -2
  235. package/src/concepts/EntityIndex__.ts +7 -0
  236. package/src/concepts/EntityProperty__.ts +20 -2
  237. package/src/concepts/Entity__.ts +23 -11
  238. package/src/concepts/Enum__.ts +25 -6
  239. package/src/concepts/ForEachStatement__.ts +2 -2
  240. package/src/concepts/Function__.ts +95 -1
  241. package/src/concepts/Identifier__.ts +15 -15
  242. package/src/concepts/IfStatement__.ts +9 -9
  243. package/src/concepts/Interface__.ts +20 -12
  244. package/src/concepts/JSBlock__.ts +3 -12
  245. package/src/concepts/Logic__.ts +45 -79
  246. package/src/concepts/Module__.ts +141 -342
  247. package/src/concepts/Namespace__.ts +1 -204
  248. package/src/concepts/Param__.ts +3 -2
  249. package/src/concepts/ProcessElement__.ts +33 -12
  250. package/src/concepts/Process__.ts +18 -12
  251. package/src/concepts/QueryFieldExpression__.ts +9 -1
  252. package/src/concepts/QueryFromExpression__.ts +13 -2
  253. package/src/concepts/QueryJoinExpression__.ts +14 -3
  254. package/src/concepts/Return__.ts +1 -1
  255. package/src/concepts/Role__.ts +10 -4
  256. package/src/concepts/SqlQueryComponent__.ts +47 -11
  257. package/src/concepts/StringLiteral__.ts +1 -1
  258. package/src/concepts/StructureProperty__.ts +6 -9
  259. package/src/concepts/Structure__.ts +19 -11
  260. package/src/concepts/SwitchCase__.ts +23 -27
  261. package/src/concepts/SwitchStatement__.ts +1 -5
  262. package/src/concepts/TypeAnnotation__.ts +43 -2
  263. package/src/concepts/Variable__.ts +1 -1
  264. package/src/concepts/ViewElement__.ts +26 -39
  265. package/src/concepts/View__.ts +29 -34
  266. package/src/concepts/WhileStatement__.ts +4 -4
  267. package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
  268. package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
  269. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
  270. package/src/concepts/basics/stdlib/nasl.util.ts +281 -2
  271. package/src/concepts/basics/types/index.ts +1 -0
  272. package/src/concepts/index__.ts +1 -0
  273. package/src/generator/genBundleFiles.ts +28 -7
  274. package/src/generator/genMetaData.ts +22 -13
  275. package/src/index.ts +1 -1
  276. package/src/server/createUiTs.ts +1 -0
  277. package/src/server/getLogics.ts +29 -4
  278. package/src/server/getMemberIdentifier.ts +4 -0
  279. package/src/server/getProcesses.ts +68 -0
  280. package/src/server/naslServer.ts +227 -30
  281. package/src/server/process2LogicNamespace.ts +29 -19
  282. package/src/server/translator.ts +39 -1
  283. package/src/service/creator/errHandles.js +6 -0
  284. package/src/service/storage/init.ts +97 -86
  285. package/src/templator/genCreateBlock.ts +35 -26
  286. package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
  287. package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
  288. package/src/templator/genEditTableBlock.ts +17 -14
  289. package/src/templator/genEnumSelectBlock.ts +1 -1
  290. package/src/templator/genGridViewBlock.ts +30 -25
  291. package/src/templator/genListViewBlock.ts +10 -7
  292. package/src/templator/genQueryComponent.ts +28 -27
  293. package/src/templator/genSelectBlock.ts +9 -8
  294. package/src/templator/genTableBlock.ts +32 -23
  295. package/src/templator/genUpdateBlock.ts +35 -25
  296. package/src/templator/utils.ts +2 -2
  297. package/src/test/integration/connect-file.ts +6 -6
  298. package/src/translator/index.ts +1 -1
  299. package/src/utils/index.ts +51 -0
@@ -416,6 +416,29 @@ export default new Namespace({
416
416
  }),
417
417
  ],
418
418
  }),
419
+ new Function({
420
+ name: 'AddAll',
421
+ description: '为集合添加多项内容,并返回集合长度',
422
+ params: [
423
+ new Param({
424
+ name: 'list',
425
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
426
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
427
+ }),
428
+ }),
429
+ new Param({
430
+ name: 'addlist',
431
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
432
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
433
+ }),
434
+ }),
435
+ ],
436
+ returns: [
437
+ new Return({
438
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
439
+ }),
440
+ ],
441
+ }),
419
442
  new Function({
420
443
  name: 'Insert',
421
444
  description: '为集合指定索引插入项(原索引项依次后推)',
@@ -555,7 +578,7 @@ export default new Namespace({
555
578
  new Param({
556
579
  name: 'digits',
557
580
  typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
558
- description: "保留小数位数",
581
+ description: '保留小数位数',
559
582
  defaultValue: '2',
560
583
  defaultExpression: new NumericLiteral({ value: '2' }),
561
584
  }),
@@ -568,7 +591,7 @@ export default new Namespace({
568
591
  { text: 'true', value: 'true' },
569
592
  { text: 'false', value: 'false' },
570
593
  ],
571
- description: "是否显示千分位:true显示,false不显示",
594
+ description: '是否显示千分位:true显示,false不显示',
572
595
  }),
573
596
  ],
574
597
  returns: [
@@ -748,5 +771,261 @@ export default new Namespace({
748
771
  }),
749
772
  ],
750
773
  }),
774
+ new Function({
775
+ name: 'ListSort',
776
+ description: '为集合按规则排序',
777
+ params: [
778
+ new Param({
779
+ name: 'list',
780
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
781
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
782
+ }),
783
+ }),
784
+ new Param({
785
+ name: 'by',
786
+ defaultExpression: new Function({
787
+ name: '',
788
+ description: '',
789
+ params: [
790
+ new Param({
791
+ name: 'item',
792
+ typeAnnotation: null,
793
+ }),
794
+ ],
795
+ }),
796
+ }),
797
+ new Param({
798
+ name: 'sort',
799
+ description: '下拉选择升序、降序',
800
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
801
+ defaultValue: 'asc',
802
+ defaultExpression: new BooleanLiteral({ value: 'true' }),
803
+ options: [
804
+ { text: 'asc', value: 'true' },
805
+ { text: 'desc', value: 'false' },
806
+ ],
807
+ }),
808
+ ],
809
+ returns: [],
810
+ }),
811
+ new Function({
812
+ name: 'ListFind',
813
+ description: '筛选符合条件的第一个项',
814
+ params: [
815
+ new Param({
816
+ name: 'list',
817
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
818
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
819
+ }),
820
+ }),
821
+ new Param({
822
+ name: 'by',
823
+ defaultExpression: new Function({
824
+ name: '',
825
+ description: '',
826
+ params: [
827
+ new Param({
828
+ name: 'item',
829
+ typeAnnotation: null,
830
+ }),
831
+ ],
832
+ }),
833
+ }),
834
+ ],
835
+ returns: [
836
+ new Return({
837
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
838
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
839
+ }),
840
+ }),
841
+ ],
842
+ }),
843
+ new Function({
844
+ name: 'ListFindIndex',
845
+ description: '筛选符合条件的第一个项的索引值',
846
+ params: [
847
+ new Param({
848
+ name: 'list',
849
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
850
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
851
+ }),
852
+ }),
853
+ new Param({
854
+ name: 'by',
855
+ defaultExpression: new Function({
856
+ name: '',
857
+ description: '',
858
+ params: [
859
+ new Param({
860
+ name: 'item',
861
+ typeAnnotation: null,
862
+ }),
863
+ ],
864
+ }),
865
+ }),
866
+ ],
867
+ returns: [
868
+ new Return({
869
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
870
+ }),
871
+ ],
872
+ }),
873
+ new Function({
874
+ name: 'ListFindAll',
875
+ description: '筛选符合条件的所有项',
876
+ params: [
877
+ new Param({
878
+ name: 'list',
879
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
880
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
881
+ }),
882
+ }),
883
+ new Param({
884
+ name: 'by',
885
+ defaultExpression: new Function({
886
+ name: '',
887
+ description: '',
888
+ params: [
889
+ new Param({
890
+ name: 'item',
891
+ typeAnnotation: null,
892
+ }),
893
+ ],
894
+ }),
895
+ }),
896
+ ],
897
+ returns: [
898
+ new Return({
899
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
900
+ }),
901
+ ],
902
+ }),
903
+ new Function({
904
+ name: 'ListReverse',
905
+ description: '为集合反向排序',
906
+ params: [
907
+ new Param({
908
+ name: 'list',
909
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
910
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
911
+ }),
912
+ }),
913
+ ],
914
+ returns: [],
915
+ }),
916
+ new Function({
917
+ name: 'ListDistinct',
918
+ description: '为集合去除重复项',
919
+ params: [
920
+ new Param({
921
+ name: 'list',
922
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
923
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
924
+ }),
925
+ }),
926
+ ],
927
+ returns: [],
928
+ }),
929
+ new Function({
930
+ name: 'ListSlice',
931
+ description: '将集合按照规则切片,返回切片后的子集合',
932
+ params: [
933
+ new Param({
934
+ name: 'list',
935
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
936
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
937
+ }),
938
+ }),
939
+ new Param({
940
+ name: 'start',
941
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
942
+ }),
943
+ new Param({
944
+ name: 'end',
945
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
946
+ }),
947
+ ],
948
+ returns: [
949
+ new Return({
950
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
951
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
952
+ }),
953
+ }),
954
+ ],
955
+ }),
956
+ new Function({
957
+ name: 'ListSliceToPageOf',
958
+ description: '将集合按照规则切片,返回切片后的PageOf集合',
959
+ params: [
960
+ new Param({
961
+ name: 'list',
962
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
963
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
964
+ }),
965
+ }),
966
+ new Param({
967
+ name: 'page',
968
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
969
+ }),
970
+ new Param({
971
+ name: 'size',
972
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
973
+ }),
974
+ ],
975
+ returns: [
976
+ new Return({
977
+ typeAnnotation: TypeAnnotation.createGeneric('PageOf', {
978
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
979
+ }),
980
+ }),
981
+ ],
982
+ }),
983
+ new Function({
984
+ name: 'New',
985
+ description: '根据参数选择的类型,返回该参数的实例化对象',
986
+ typeParams: [
987
+ new TypeParam({
988
+ name: 'T',
989
+ }),
990
+ ],
991
+ params: [
992
+ ],
993
+ returns: [
994
+ new Return({
995
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
996
+ }),
997
+ ],
998
+ }),
999
+ // new Function({
1000
+ // name: 'CreatePageOf',
1001
+ // description: '将List<T>集合转换为分页集合PageOf<T>',
1002
+ // params: [
1003
+ // new Param({
1004
+ // name: 'list',
1005
+ // typeAnnotation: TypeAnnotation.createGeneric('List', {
1006
+ // typeArguments: [TypeAnnotation.createTypeParam('T')],
1007
+ // }),
1008
+ // }),
1009
+ // new Param({
1010
+ // name: 'page',
1011
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
1012
+ // }),
1013
+ // new Param({
1014
+ // name: 'size',
1015
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
1016
+ // }),
1017
+ // new Param({
1018
+ // name: 'total',
1019
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
1020
+ // }),
1021
+ // ],
1022
+ // returns: [
1023
+ // new Return({
1024
+ // typeAnnotation: TypeAnnotation.createPrimitive('PageOf', {
1025
+ // typeArguments: [TypeAnnotation.createTypeParam('T')],
1026
+ // }),
1027
+ // }),
1028
+ // ],
1029
+ // }),
751
1030
  ],
752
1031
  });
@@ -16,6 +16,7 @@ primitiveTypeList.forEach((typeAnnotation) => {
16
16
  });
17
17
 
18
18
  export { collectionStructures, collectionTypeList } from '../stdlib/nasl.collection';
19
+ export { processStructures, processTypeList } from '../stdlib/nasl.process';
19
20
  export { uiStructures, uiTypeList } from '../stdlib/nasl.ui';
20
21
  export { interfaceTypeList } from '../stdlib/nasl.interface';
21
22
  export { interfaceStructures } from '../stdlib/nasl.interface';
@@ -8,6 +8,7 @@ export * from './StructureProperty__';
8
8
  export * from './Enum__';
9
9
  export * from './EnumItem__';
10
10
  export * from './DataElement__';
11
+ export * from './DataSource__';
11
12
  export * from './Entity__';
12
13
  export * from './EntityProperty__';
13
14
  export * from './EntityIndex__';
@@ -1,4 +1,4 @@
1
- import { App, Module, View, BaseNode, Entity, Structure, Enum, uiStructures, collectionStructures, Logic, Interface, Process } from '../concepts';
1
+ import { App, Module, View, BaseNode, Entity, Structure, Enum, uiStructures, collectionStructures, processStructures, Logic, Interface, Process } from '../concepts';
2
2
  import * as utils from '../utils';
3
3
  import { genHash, RawOptions } from '.';
4
4
  import { compileComponent } from './compileComponent';
@@ -20,8 +20,8 @@ export interface PageOptions {
20
20
  hasUserCenter: boolean;
21
21
  hasAuth: boolean;
22
22
  domainName: string;
23
- nuimsDomain: string;
24
23
  auth: boolean;
24
+ subPage: object;
25
25
  documentTitle?: string;
26
26
  router: {
27
27
  notFound: string;
@@ -44,8 +44,12 @@ export async function genBundleFiles(app: App,
44
44
  USER_STATIC_URL: string;
45
45
  extendedConfig: string;
46
46
  lowcodeDomain: string;
47
+ envLcpDomain: any,
48
+ envNuimsDomain: any,
47
49
  appid: string;
48
50
  }) {
51
+ const fnNuimsDomain = config?.envNuimsDomain?.[config?.env] || config?.nuimsDomain;
52
+ const fnLowcodeDomain = config?.envLcpDomain?.[config?.env]?.lcpDomain || config?.lowcodeDomain;
49
53
  const modules: Module[] = [];
50
54
  const views: View[] = [];
51
55
  const entities: Entity[] = [];
@@ -56,7 +60,13 @@ export async function genBundleFiles(app: App,
56
60
  const processes: Process[] = [];
57
61
 
58
62
  app.views && views.push(...app.views);
59
- app.entities && entities.push(...app.entities);
63
+ if (Array.isArray(app.dataSources)) {
64
+ app.dataSources.forEach((dataSource) => {
65
+ if (Array.isArray(dataSource.entities)) {
66
+ entities.push(...dataSource.entities);
67
+ }
68
+ });
69
+ }
60
70
  app.structures && structures.push(...app.structures);
61
71
  app.enums && enums.push(...app.enums);
62
72
  app.logics && logics.push(...app.logics);
@@ -67,7 +77,6 @@ export async function genBundleFiles(app: App,
67
77
 
68
78
  modules.forEach((module: Module) => {
69
79
  module.views && views.push(...module.views);
70
- module.entities && entities.push(...module.entities);
71
80
  module.structures && structures.push(...module.structures);
72
81
  module.enums && enums.push(...module.enums);
73
82
  module.logics && logics.push(...module.logics);
@@ -130,8 +139,8 @@ export async function genBundleFiles(app: App,
130
139
  hasUserCenter: app.hasUserCenter,
131
140
  hasAuth: app.hasAuth,
132
141
  domainName: app.name,
133
- nuimsDomain: config.nuimsDomain,
134
142
  auth: view.auth,
143
+ subPage: view.children,
135
144
  documentTitle: app.documentTitle,
136
145
  router: {
137
146
  notFound: '/',
@@ -212,6 +221,14 @@ export async function genBundleFiles(app: App,
212
221
  });
213
222
  }
214
223
 
224
+ if (Array.isArray(processStructures)) {
225
+ const namespace = 'nasl.process';
226
+ processStructures.forEach((node) => {
227
+ const id = `${namespace}.${node.name}`;
228
+ dataTypesMap[id] = node;
229
+ });
230
+ }
231
+
215
232
  if (Array.isArray(logics)) {
216
233
  allLogics.push(...logics);
217
234
  }
@@ -247,9 +264,11 @@ export async function genBundleFiles(app: App,
247
264
  },
248
265
  },
249
266
  extendedConfig: config.extendedConfig,
250
- lowcodeDomain: config.lowcodeDomain,
267
+ lowcodeDomain: fnLowcodeDomain,
251
268
  tenant: config.tenant,
252
269
  env: config.env,
270
+ nuimsDomain: fnNuimsDomain,
271
+ envNuimsDomain: config.envNuimsDomain,
253
272
  indexName,
254
273
  }, null, 4);
255
274
 
@@ -336,6 +355,8 @@ export async function genBundleFiles(app: App,
336
355
  tenant: data.tenant,
337
356
  env: data.env,
338
357
  extendedConfig: data.extendedConfig,
358
+ nuimsDomain: data.nuimsDomain,
359
+ envNuimsDomain: data.envNuimsDomain,
339
360
  envConfig: {
340
361
  lowcodeDomain: data.lowcodeDomain,
341
362
  },
@@ -345,7 +366,7 @@ export async function genBundleFiles(app: App,
345
366
 
346
367
  if (config.env === 'dev') {
347
368
  // 加载资源js
348
- const domain = config.lowcodeDomain.slice(5);
369
+ const domain = fnLowcodeDomain.slice(fnLowcodeDomain.indexOf('.') + 1);
349
370
  const targetUrl = `${location.origin}/empty?url=${domain}&appid=${config.appid}`;
350
371
  const str = `
351
372
  if(!document.querySelector("iframe[name='iframeEmpty']")){
@@ -1,10 +1,11 @@
1
- import { App, View, BaseNode, Module, Interface, Entity, Structure, Enum, uiStructures, collectionStructures, Logic, Process } from '../concepts';
1
+ import { App, View, BaseNode, Module, Interface, Entity, Structure, Enum, uiStructures, collectionStructures, processStructures, Logic, Process, DataSource } from '../concepts';
2
2
 
3
3
  export function genMetaData(app: App,
4
4
  config: {
5
5
  tenant: string;
6
6
  env: string;
7
7
  nuimsDomain: string;
8
+ envNuimsDomain: Object;
8
9
  STATIC_URL: string;
9
10
  USER_STATIC_URL: string;
10
11
  extendedConfig: string;
@@ -12,7 +13,7 @@ export function genMetaData(app: App,
12
13
  }) {
13
14
  const modules: Module[] = [];
14
15
  const views: View[] = [];
15
- const entities: Entity[] = [];
16
+ const dataSources: DataSource[] = [];
16
17
  const structures: Structure[] = [];
17
18
  const enums: Enum[] = [];
18
19
  const logics: Logic[] = [];
@@ -20,7 +21,7 @@ export function genMetaData(app: App,
20
21
  const processes: Process[] = [];
21
22
 
22
23
  const {
23
- entities: appEntities = [],
24
+ dataSources: appDataSources = [],
24
25
  structures: appStructures = [],
25
26
  enums: appEnums = [],
26
27
  logics: appLogics = [],
@@ -28,7 +29,7 @@ export function genMetaData(app: App,
28
29
  dependencies: appDependencies = [],
29
30
  processes: appProcesses = [],
30
31
  } = app || {};
31
- entities.push(...appEntities);
32
+ dataSources.push(...appDataSources);
32
33
  structures.push(...appStructures);
33
34
  enums.push(...appEnums);
34
35
  logics.push(...appLogics);
@@ -42,14 +43,12 @@ export function genMetaData(app: App,
42
43
  modules.forEach((module: Module) => {
43
44
  const {
44
45
  views: moduleViews = [],
45
- entities: moduleEntities = [],
46
46
  structures: moduleStructures = [],
47
47
  enums: moduleEnums = [],
48
48
  logics: moduleLogics = [],
49
49
  interfaces: moduleInterfaces = [],
50
50
  } = module;
51
51
  views.push(...moduleViews);
52
- entities.push(...moduleEntities);
53
52
  structures.push(...moduleStructures);
54
53
  enums.push(...moduleEnums);
55
54
  logics.push(...moduleLogics);
@@ -93,13 +92,15 @@ export function genMetaData(app: App,
93
92
  enumsMap[name] = enumObj;
94
93
  });
95
94
  }
96
- if (Array.isArray(entities)) {
97
- dataTypes.push(...entities);
98
- entities.forEach((entity) => {
99
- const ns = entity.ns;
100
- if (Array.isArray(ns?.logics)) {
101
- allLogics.push(...ns.logics);
102
- }
95
+ if (Array.isArray(dataSources)) {
96
+ dataSources.forEach((dataSource)=> {
97
+ dataSource.entities.forEach((entity) => {
98
+ dataTypes.push(entity);
99
+ const ns = entity.ns;
100
+ if (Array.isArray(ns?.logics)) {
101
+ allLogics.push(...ns.logics);
102
+ }
103
+ });
103
104
  });
104
105
  }
105
106
  if (Array.isArray(structures)) {
@@ -127,6 +128,14 @@ export function genMetaData(app: App,
127
128
  });
128
129
  }
129
130
 
131
+ if (Array.isArray(processStructures)) {
132
+ const namespace = 'nasl.process';
133
+ processStructures.forEach((node) => {
134
+ const id = `${namespace}.${node.name}`;
135
+ dataTypesMap[id] = node;
136
+ });
137
+ }
138
+
130
139
  if (Array.isArray(logics)) {
131
140
  allLogics.push(...logics);
132
141
  }
package/src/index.ts CHANGED
@@ -8,5 +8,5 @@ export * as genBlock from './templator';
8
8
  export * as utils from './utils';
9
9
  export * from './config';
10
10
  export * from './eventBus';
11
- export { loadApp, loadAppSync } from './service/storage/init';
11
+ export { loadApp, loadAppSync, handleApp } from './service/storage/init';
12
12
  import './automate/engine';
@@ -12,6 +12,7 @@ const naslStdlibMap: any = {
12
12
  'nasl.langUtil.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.langUtil.ts').default,
13
13
  'nasl.annotation.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.annotation.ts').default,
14
14
  'nasl.validation.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.validation.ts').default,
15
+ 'nasl.process.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.process.ts').default,
15
16
  };
16
17
 
17
18
  export default function formatUiTs(allComponent: any) {
@@ -24,8 +24,8 @@ function iterator(tree: FakeNode | FakeProcessNode, searchContent: string, fakeN
24
24
  if (tree.children) {
25
25
  tree.children.forEach((c) => {
26
26
  const childFakeNode = {};
27
- if(c.title?.toLowerCase().includes(searchContent) || c.name?.toLowerCase().includes(searchContent))
28
- fakeNode.children.push({...c});
27
+ if (c.title?.toLowerCase().includes(searchContent) || c.name?.toLowerCase().includes(searchContent))
28
+ fakeNode.children.push({ ...c });
29
29
  else if (iterator(c, searchContent, childFakeNode)) {
30
30
  fakeNode.children.push(childFakeNode);
31
31
  }
@@ -63,7 +63,15 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
63
63
  const result = [];
64
64
 
65
65
  if (needAllLogic) {
66
- const nc = app.entities.map((entity) => entity.ns);
66
+ const nc: Namespace[] = [];
67
+ if (Array.isArray(app.dataSources)) {
68
+ app.dataSources.forEach((dataSource) => {
69
+ if (Array.isArray(dataSource.entities)) {
70
+ const list = dataSource.entities.map((entity) => entity.ns);
71
+ nc.push(...list);
72
+ }
73
+ });
74
+ }
67
75
  nc.map((item) => {
68
76
  item.logics = item.logics.filter((logic) => !logic.name.startsWith('import'));
69
77
  item.expanded = true;
@@ -120,12 +128,18 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
120
128
  });
121
129
  tree.expanded = true;
122
130
  result.push(tree);
123
-
124
131
  const systemTree = new Namespace({
125
132
  name: 'category',
126
133
  path: `nasl`,
127
134
  title: '系统逻辑',
128
135
  children: [
136
+ new Namespace({
137
+ name: 'category',
138
+ path: `process`,
139
+ title: '流程逻辑',
140
+ logics: stdlibNamespace.findChild('process').logics,
141
+ expanded: true,
142
+ }),
129
143
  new Namespace({
130
144
  name: 'category',
131
145
  path: `browser`,
@@ -150,6 +164,8 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
150
164
  ],
151
165
  expanded: true,
152
166
  });
167
+ if (!app.processes.length)
168
+ systemTree.children.shift();
153
169
 
154
170
  systemTree.expanded = true;
155
171
  systemTree.children.forEach((child) => (child.expanded = true));
@@ -161,6 +177,13 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
161
177
  path: `nasl`,
162
178
  title: '系统逻辑',
163
179
  children: [
180
+ new Namespace({
181
+ name: 'category',
182
+ path: `process`,
183
+ title: '流程逻辑',
184
+ logics: stdlibNamespace.findChild('process').logics,
185
+ expanded: true,
186
+ }),
164
187
  new Namespace({
165
188
  name: 'category',
166
189
  path: `configuration`,
@@ -171,6 +194,8 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
171
194
  ],
172
195
  expanded: true,
173
196
  });
197
+ if (!app.processes.length)
198
+ systemTree.children.shift();
174
199
 
175
200
  systemTree.expanded = true;
176
201
  systemTree.children.forEach((child) => (child.expanded = true));
@@ -76,6 +76,10 @@ function createType2Annotation(type: string): TypeAnnotation {
76
76
  typeAnnotation = TypeAnnotation.createReference(types[types.length - 1], {
77
77
  typeNamespace: 'nasl.ui',
78
78
  });
79
+ } else if (type.startsWith('nasl.process')) {
80
+ typeAnnotation = TypeAnnotation.createReference(types[types.length - 1], {
81
+ typeNamespace: 'nasl.process',
82
+ });
79
83
  } else if (type.startsWith('nasl.collection')) {
80
84
  typeAnnotation = TypeAnnotation.createGeneric(types[types.length - 1], {
81
85
  typeNamespace: 'nasl.collection',