@lcap/nasl 2.20.0-beta.2 → 2.20.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 (323) hide show
  1. package/out/automate/engine/index.d.ts +1 -1
  2. package/out/automate/engine/index.js +2 -3
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/uniqueName.d.ts +1 -1
  5. package/out/automate/engine/uniqueName.js +2 -2
  6. package/out/automate/engine/uniqueName.js.map +1 -1
  7. package/out/automate/engine/utils.js +4 -1
  8. package/out/automate/engine/utils.js.map +1 -1
  9. package/out/automate/template/myProcess.d.ts +1 -1
  10. package/out/automate/template/myProcess.js +2 -2
  11. package/out/automate/template/myProcess.js.map +1 -1
  12. package/out/bak/translator.js +14 -22
  13. package/out/bak/translator.js.map +1 -1
  14. package/out/common/BaseNode.js +4 -1
  15. package/out/common/BaseNode.js.map +1 -1
  16. package/out/common/Command.d.ts +1 -0
  17. package/out/common/Command.js +5 -1
  18. package/out/common/Command.js.map +1 -1
  19. package/out/concepts/App__.d.ts +4 -0
  20. package/out/concepts/App__.js +30 -6
  21. package/out/concepts/App__.js.map +1 -1
  22. package/out/concepts/Assignee__.js +4 -3
  23. package/out/concepts/Assignee__.js.map +1 -1
  24. package/out/concepts/BatchAssignment__.js +3 -3
  25. package/out/concepts/BatchAssignment__.js.map +1 -1
  26. package/out/concepts/BindAttribute__.d.ts +7 -0
  27. package/out/concepts/BindAttribute__.js +270 -39
  28. package/out/concepts/BindAttribute__.js.map +1 -1
  29. package/out/concepts/BindDirective__.d.ts +7 -0
  30. package/out/concepts/BindDirective__.js +215 -17
  31. package/out/concepts/BindDirective__.js.map +1 -1
  32. package/out/concepts/BindStyle__.d.ts +7 -0
  33. package/out/concepts/BindStyle__.js +194 -4
  34. package/out/concepts/BindStyle__.js.map +1 -1
  35. package/out/concepts/CallFunction__.js +22 -8
  36. package/out/concepts/CallFunction__.js.map +1 -1
  37. package/out/concepts/CallInterface__.js +3 -2
  38. package/out/concepts/CallInterface__.js.map +1 -1
  39. package/out/concepts/CallLogic__.d.ts +3 -0
  40. package/out/concepts/CallLogic__.js +78 -89
  41. package/out/concepts/CallLogic__.js.map +1 -1
  42. package/out/concepts/CallQueryComponent__.js +20 -3
  43. package/out/concepts/CallQueryComponent__.js.map +1 -1
  44. package/out/concepts/ConfigGroup__.d.ts +1 -0
  45. package/out/concepts/ConfigGroup__.js +13 -0
  46. package/out/concepts/ConfigGroup__.js.map +1 -1
  47. package/out/concepts/ConfigProperty__.d.ts +19 -0
  48. package/out/concepts/ConfigProperty__.js +61 -0
  49. package/out/concepts/ConfigProperty__.js.map +1 -1
  50. package/out/concepts/Configuration__.d.ts +1 -0
  51. package/out/concepts/Configuration__.js +13 -0
  52. package/out/concepts/Configuration__.js.map +1 -1
  53. package/out/concepts/DataSource__.js.map +1 -1
  54. package/out/concepts/Destination__.d.ts +1 -0
  55. package/out/concepts/Destination__.js +61 -7
  56. package/out/concepts/Destination__.js.map +1 -1
  57. package/out/concepts/EntityProperty__.js +9 -1
  58. package/out/concepts/EntityProperty__.js.map +1 -1
  59. package/out/concepts/EnumItem__.d.ts +5 -5
  60. package/out/concepts/EnumItem__.js +6 -6
  61. package/out/concepts/Enum__.d.ts +20 -19
  62. package/out/concepts/Enum__.js +28 -1
  63. package/out/concepts/Enum__.js.map +1 -1
  64. package/out/concepts/ExternalDestination__.d.ts +1 -0
  65. package/out/concepts/ExternalDestination__.js +21 -3
  66. package/out/concepts/ExternalDestination__.js.map +1 -1
  67. package/out/concepts/ForEachStatement__.js +2 -0
  68. package/out/concepts/ForEachStatement__.js.map +1 -1
  69. package/out/concepts/Frontend__.d.ts +2 -1
  70. package/out/concepts/Frontend__.js.map +1 -1
  71. package/out/concepts/Identifier__.js +16 -5
  72. package/out/concepts/Identifier__.js.map +1 -1
  73. package/out/concepts/InterfaceParam__.js +9 -1
  74. package/out/concepts/InterfaceParam__.js.map +1 -1
  75. package/out/concepts/JSBlock__.js +5 -1
  76. package/out/concepts/JSBlock__.js.map +1 -1
  77. package/out/concepts/Logic__.d.ts +79 -79
  78. package/out/concepts/Logic__.js +16 -3
  79. package/out/concepts/Logic__.js.map +1 -1
  80. package/out/concepts/Match__.d.ts +0 -3
  81. package/out/concepts/Match__.js +11 -66
  82. package/out/concepts/Match__.js.map +1 -1
  83. package/out/concepts/MemberExpression__.js +9 -0
  84. package/out/concepts/MemberExpression__.js.map +1 -1
  85. package/out/concepts/Module__.d.ts +16 -0
  86. package/out/concepts/Module__.js +43 -0
  87. package/out/concepts/Module__.js.map +1 -1
  88. package/out/concepts/NewComposite__.d.ts +2 -4
  89. package/out/concepts/NewComposite__.js +91 -126
  90. package/out/concepts/NewComposite__.js.map +1 -1
  91. package/out/concepts/NewList__.d.ts +1 -0
  92. package/out/concepts/NewList__.js +22 -2
  93. package/out/concepts/NewList__.js.map +1 -1
  94. package/out/concepts/NewMap__.d.ts +1 -0
  95. package/out/concepts/NewMap__.js +43 -11
  96. package/out/concepts/NewMap__.js.map +1 -1
  97. package/out/concepts/OqlQueryComponent__.js +40 -12
  98. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  99. package/out/concepts/Param__.js +10 -2
  100. package/out/concepts/Param__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js +2 -1
  102. package/out/concepts/ProcessElement__.js.map +1 -1
  103. package/out/concepts/ProcessOutcome__.js +1 -1
  104. package/out/concepts/ProcessOutcome__.js.map +1 -1
  105. package/out/concepts/ProcessOutcomes__.js +1 -1
  106. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  107. package/out/concepts/Process__.js +1 -0
  108. package/out/concepts/Process__.js.map +1 -1
  109. package/out/concepts/Return__.js +10 -2
  110. package/out/concepts/Return__.js.map +1 -1
  111. package/out/concepts/StringInterpolation__.js +14 -2
  112. package/out/concepts/StringInterpolation__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.js +6 -6
  114. package/out/concepts/StringLiteral__.js.map +1 -1
  115. package/out/concepts/StructureProperty__.js +9 -1
  116. package/out/concepts/StructureProperty__.js.map +1 -1
  117. package/out/concepts/TypeAnnotation__.d.ts +6 -3
  118. package/out/concepts/TypeAnnotation__.js +67 -13
  119. package/out/concepts/TypeAnnotation__.js.map +1 -1
  120. package/out/concepts/ValidationRule__.d.ts +1 -0
  121. package/out/concepts/ValidationRule__.js +53 -0
  122. package/out/concepts/ValidationRule__.js.map +1 -1
  123. package/out/concepts/Variable__.js +9 -1
  124. package/out/concepts/Variable__.js.map +1 -1
  125. package/out/concepts/ViewElement__.js +17 -1
  126. package/out/concepts/ViewElement__.js.map +1 -1
  127. package/out/concepts/View__.d.ts +1 -3
  128. package/out/concepts/View__.js +22 -11
  129. package/out/concepts/View__.js.map +1 -1
  130. package/out/concepts/basics/stdlib/nasl.collection.js +6 -1
  131. package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
  132. package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
  133. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  134. package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
  135. package/out/concepts/basics/stdlib/nasl.core.js +34 -0
  136. package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.util.js +4 -2
  138. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  139. package/out/concepts/basics/types/index.d.ts +1 -0
  140. package/out/concepts/basics/types/index.js +3 -1
  141. package/out/concepts/basics/types/index.js.map +1 -1
  142. package/out/concepts/index__.d.ts +0 -1
  143. package/out/concepts/index__.js +0 -1
  144. package/out/concepts/index__.js.map +1 -1
  145. package/out/enums/KEYWORDS.js +8 -0
  146. package/out/enums/KEYWORDS.js.map +1 -1
  147. package/out/generator/genBundleFiles.js +24 -5
  148. package/out/generator/genBundleFiles.js.map +1 -1
  149. package/out/generator/genReleaseBody.d.ts +2 -3
  150. package/out/generator/genReleaseBody.js +97 -23
  151. package/out/generator/genReleaseBody.js.map +1 -1
  152. package/out/generator/permission.d.ts +2 -10
  153. package/out/generator/permission.js +27 -14
  154. package/out/generator/permission.js.map +1 -1
  155. package/out/server/entity2LogicNamespace.js +2 -20
  156. package/out/server/entity2LogicNamespace.js.map +1 -1
  157. package/out/server/extendBaseNode.js +16 -5
  158. package/out/server/extendBaseNode.js.map +1 -1
  159. package/out/server/formatTsUtils.d.ts +2 -1
  160. package/out/server/formatTsUtils.js +40 -10
  161. package/out/server/formatTsUtils.js.map +1 -1
  162. package/out/server/getLogics.d.ts +2 -2
  163. package/out/server/getLogics.js +3 -3
  164. package/out/server/getLogics.js.map +1 -1
  165. package/out/server/getMemberIdentifier.d.ts +1 -0
  166. package/out/server/getMemberIdentifier.js +27 -1
  167. package/out/server/getMemberIdentifier.js.map +1 -1
  168. package/out/server/index.js +1 -0
  169. package/out/server/index.js.map +1 -1
  170. package/out/server/naslServer.d.ts +7 -1
  171. package/out/server/naslServer.js +519 -46
  172. package/out/server/naslServer.js.map +1 -1
  173. package/out/server/translator.js +109 -33
  174. package/out/server/translator.js.map +1 -1
  175. package/out/service/storage/init.js +21 -1
  176. package/out/service/storage/init.js.map +1 -1
  177. package/out/templator/genCreateBlock.js +1 -3
  178. package/out/templator/genCreateBlock.js.map +1 -1
  179. package/out/templator/genCurdEditMultipleKeyBlock.js +1 -3
  180. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  181. package/out/templator/genCurdMultipleKeyBlock.js +2 -4
  182. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  183. package/out/templator/genGetBlock.js +1 -1
  184. package/out/templator/genGetBlock.js.map +1 -1
  185. package/out/templator/genGridViewBlock.js +2 -2
  186. package/out/templator/genGridViewBlock.js.map +1 -1
  187. package/out/templator/genListViewBlock.js +7 -1
  188. package/out/templator/genListViewBlock.js.map +1 -1
  189. package/out/templator/genSelectBlock.js +1 -1
  190. package/out/templator/genSelectBlock.js.map +1 -1
  191. package/out/templator/genTableBlock.js +2 -2
  192. package/out/templator/genTableBlock.js.map +1 -1
  193. package/out/templator/genUpdateBlock.js +2 -3
  194. package/out/templator/genUpdateBlock.js.map +1 -1
  195. package/out/utils/traverse.js +8 -2
  196. package/out/utils/traverse.js.map +1 -1
  197. package/package.json +2 -2
  198. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  199. package/sandbox/stdlib/dist/nasl.util.js +0 -0
  200. package/sandbox/stdlib/nasl.collection.ts +1 -0
  201. package/sandbox/stdlib/nasl.core.ts +34 -0
  202. package/sandbox/stdlib/nasl.oql.ts +71 -15
  203. package/sandbox/stdlib/nasl.util.ts +9 -3
  204. package/src/automate/engine/dist/index.dev.js +517 -0
  205. package/src/automate/engine/index.js +2 -3
  206. package/src/automate/engine/uniqueName.js +2 -2
  207. package/src/automate/engine/utils.js +4 -2
  208. package/src/automate/template/myProcess.js +2 -2
  209. package/src/bak/translator.js +16 -25
  210. package/src/common/BaseNode.ts +3 -1
  211. package/src/common/Command.ts +4 -0
  212. package/src/common/dist/BaseNode.js +1101 -0
  213. package/src/concepts/App__.ts +36 -7
  214. package/src/concepts/Assignee__.ts +4 -3
  215. package/src/concepts/BatchAssignment__.ts +3 -3
  216. package/src/concepts/BindAttribute__.ts +299 -38
  217. package/src/concepts/BindDirective__.ts +204 -31
  218. package/src/concepts/BindStyle__.ts +187 -24
  219. package/src/concepts/CallFunction__.ts +55 -10
  220. package/src/concepts/CallInterface__.ts +3 -2
  221. package/src/concepts/CallLogic__.ts +110 -90
  222. package/src/concepts/CallQueryComponent__.ts +18 -3
  223. package/src/concepts/ConfigGroup__.ts +17 -4
  224. package/src/concepts/ConfigProperty__.ts +70 -4
  225. package/src/concepts/Configuration__.ts +14 -5
  226. package/src/concepts/DataSource__.ts +4 -1
  227. package/src/concepts/Destination__.ts +61 -7
  228. package/src/concepts/EntityProperty__.ts +7 -1
  229. package/src/concepts/EnumItem__.ts +6 -6
  230. package/src/concepts/Enum__.ts +22 -19
  231. package/src/concepts/ExternalDestination__.ts +28 -8
  232. package/src/concepts/ForEachStatement__.ts +2 -0
  233. package/src/concepts/Frontend__.ts +2 -1
  234. package/src/concepts/Identifier__.ts +16 -5
  235. package/src/concepts/InterfaceParam__.ts +7 -1
  236. package/src/concepts/JSBlock__.ts +3 -2
  237. package/src/concepts/Logic__.ts +95 -83
  238. package/src/concepts/Match__.ts +31 -67
  239. package/src/concepts/MemberExpression__.ts +6 -0
  240. package/src/concepts/Module__.ts +57 -0
  241. package/src/concepts/NewComposite__.ts +95 -140
  242. package/src/concepts/NewList__.ts +23 -2
  243. package/src/concepts/NewMap__.ts +48 -24
  244. package/src/concepts/OqlQueryComponent__.ts +40 -20
  245. package/src/concepts/Param__.ts +178 -176
  246. package/src/concepts/ProcessElement__.ts +2 -1
  247. package/src/concepts/ProcessOutcome__.ts +1 -1
  248. package/src/concepts/ProcessOutcomes__.ts +1 -1
  249. package/src/concepts/Process__.ts +1 -0
  250. package/src/concepts/Return__.ts +8 -2
  251. package/src/concepts/StringInterpolation__.ts +19 -7
  252. package/src/concepts/StringLiteral__.ts +7 -6
  253. package/src/concepts/StructureProperty__.ts +7 -1
  254. package/src/concepts/TypeAnnotation__.ts +101 -14
  255. package/src/concepts/ValidationRule__.ts +58 -9
  256. package/src/concepts/Variable__.ts +11 -1
  257. package/src/concepts/ViewElement__.ts +39 -2
  258. package/src/concepts/View__.ts +26 -14
  259. package/src/concepts/basics/stdlib/dist/nasl.util.js +1602 -0
  260. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
  261. package/src/concepts/basics/stdlib/nasl.collection.ts +6 -1
  262. package/src/concepts/basics/stdlib/nasl.configuration.ts +3 -0
  263. package/src/concepts/basics/stdlib/nasl.core.ts +33 -2
  264. package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
  265. package/src/concepts/basics/types/index.ts +1 -0
  266. package/src/concepts/dist/BindAttribute__.js +795 -0
  267. package/src/concepts/dist/BindEvent__.js +732 -0
  268. package/src/concepts/dist/CallFunction__.js +527 -0
  269. package/src/concepts/dist/CallLogic__.js +932 -0
  270. package/src/concepts/dist/Destination__.js +708 -0
  271. package/src/concepts/dist/ExternalDestination__.js +298 -0
  272. package/src/concepts/dist/Identifier__.js +311 -0
  273. package/src/concepts/dist/StringInterpolation__.js +231 -0
  274. package/src/concepts/dist/TypeAnnotation__.js +834 -0
  275. package/src/concepts/dist/ViewElement__.js +1692 -0
  276. package/src/concepts/dist/View__.js +1601 -0
  277. package/src/concepts/index__.ts +0 -1
  278. package/src/enums/KEYWORDS.ts +8 -0
  279. package/src/generator/dist/genBundleFiles.js +261 -0
  280. package/src/generator/dist/genMetaData.js +245 -0
  281. package/src/generator/dist/permission.js +405 -0
  282. package/src/generator/genBundleFiles.ts +24 -5
  283. package/src/generator/genReleaseBody.ts +75 -30
  284. package/src/generator/permission.ts +31 -15
  285. package/src/server/entity2LogicNamespace.ts +2 -20
  286. package/src/server/extendBaseNode.ts +15 -5
  287. package/src/server/formatTsUtils.ts +41 -10
  288. package/src/server/getLogics.ts +4 -4
  289. package/src/server/getMemberIdentifier.ts +27 -1
  290. package/src/server/index.ts +2 -0
  291. package/src/server/naslServer.ts +520 -48
  292. package/src/server/translator.ts +96 -34
  293. package/src/service/storage/dist/init.js +579 -0
  294. package/src/service/storage/init.ts +22 -2
  295. package/src/templator/dist/genEditTableBlock.js +204 -0
  296. package/src/templator/dist/genGridViewBlock.js +265 -0
  297. package/src/templator/dist/genListViewBlock.js +84 -0
  298. package/src/templator/dist/genTableBlock.js +209 -0
  299. package/src/templator/dist/utils.js +527 -0
  300. package/src/templator/genCreateBlock.ts +1 -3
  301. package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -3
  302. package/src/templator/genCurdMultipleKeyBlock.ts +2 -4
  303. package/src/templator/genGetBlock.ts +1 -1
  304. package/src/templator/genGridViewBlock.ts +3 -4
  305. package/src/templator/genListViewBlock.ts +9 -3
  306. package/src/templator/genSelectBlock.ts +1 -1
  307. package/src/templator/genTableBlock.ts +3 -3
  308. package/src/templator/genUpdateBlock.ts +2 -3
  309. package/src/utils/traverse.ts +10 -2
  310. package/ts-worker/lib/tsserver.js +10 -2
  311. package/ts-worker/package.json +1 -0
  312. package/ts-worker/webpack.config.js +11 -2
  313. package/out/concepts/ConstructArgument__.d.ts +0 -40
  314. package/out/concepts/ConstructArgument__.js +0 -108
  315. package/out/concepts/ConstructArgument__.js.map +0 -1
  316. package/out/concepts/Construct__.d.ts +0 -189
  317. package/out/concepts/Construct__.js +0 -340
  318. package/out/concepts/Construct__.js.map +0 -1
  319. package/out/templator/sql-parser/index.d.ts +0 -1
  320. package/out/templator/sql-parser/index.js +0 -228
  321. package/out/templator/sql-parser/index.js.map +0 -1
  322. package/out/templator/sql-parser/parser.js +0 -26664
  323. package/out/templator/sql-parser/parser.js.map +0 -1
@@ -98,4 +98,3 @@ export * from './Point__';
98
98
  export * from './Rect__';
99
99
  export * from './SelectMembers__';
100
100
  export * from './AssignmentLine__';
101
- export * from './NewList__';
@@ -1234,4 +1234,12 @@ export const FRONTEND_PATH_KEYWORDS = [
1234
1234
  'system',
1235
1235
  'getCustomConfig',
1236
1236
  'proxy',
1237
+ 'upload',
1238
+ 'gateway',
1239
+ 'config',
1240
+ 'getCurrentIp',
1241
+ 'gw',
1242
+ 'report',
1243
+ 'download',
1244
+ 'tenantExpiration',
1237
1245
  ];
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.genBundleFiles = void 0;
4
+ var utils = require("../utils");
5
+ var _1 = require(".");
6
+ var compileComponent_1 = require("./compileComponent");
7
+ var JSON5 = require("json5");
8
+ var prettier = require("prettier");
9
+ // @ts-ignore:next-line
10
+ var parserBabel = require("prettier/parser-babel");
11
+ var UglifyJS = require("uglify-js-export");
12
+ var genMetaData_1 = require("./genMetaData");
13
+ function genBundleFiles(app, config) {
14
+ var _a;
15
+ var _b, _c, _d;
16
+ var fnNuimsDomain = ((_b = config === null || config === void 0 ? void 0 : config.envNuimsDomain) === null || _b === void 0 ? void 0 : _b[config === null || config === void 0 ? void 0 : config.env]) || (config === null || config === void 0 ? void 0 : config.nuimsDomain);
17
+ var fnLowcodeDomain = ((_d = (_c = config === null || config === void 0 ? void 0 : config.envLcpDomain) === null || _c === void 0 ? void 0 : _c[config === null || config === void 0 ? void 0 : config.env]) === null || _d === void 0 ? void 0 : _d.lcpDomain) || (config === null || config === void 0 ? void 0 : config.lowcodeDomain);
18
+ var modules = [];
19
+ var views = [];
20
+ app.dependencies && modules.push.apply(modules, app.dependencies);
21
+ app.interfaceDependencies && modules.push.apply(modules, app.interfaceDependencies);
22
+ app.views && views.push.apply(views, app.views);
23
+ modules.forEach(function (module) {
24
+ module.views && views.push.apply(views, module.views);
25
+ });
26
+ var componentMap = {};
27
+ utils.traverse(function (current) {
28
+ if (current.node.toVueOptions)
29
+ componentMap[current.node.id] = current.node.toVueOptions();
30
+ }, {
31
+ node: {
32
+ children: views
33
+ }
34
+ });
35
+ /**
36
+ * vue.config.js page options
37
+ */
38
+ var routes = [];
39
+ // 开启了权限的页面
40
+ var authResourceViews = [];
41
+ var baseResourcePaths = [];
42
+ var rootViewData = [];
43
+ var defaultRoute = '';
44
+ // 遍历页面
45
+ var traverseViews = function (view, isParentViewAuth) {
46
+ var parentNode = view.parentNode || {};
47
+ var isRootView = parentNode.concept !== 'View';
48
+ var viewName = view.name;
49
+ // 页面是否需要权限,如果父页面需要权限,子页面也一定需要
50
+ var isViewAuth = isParentViewAuth || view.auth;
51
+ // 路由地址
52
+ var routePath = viewName;
53
+ if (isRootView) {
54
+ rootViewData.push({ name: viewName, title: view.title || viewName, isIndex: view.isIndex });
55
+ routePath = "/" + viewName;
56
+ if (!isViewAuth) {
57
+ if (viewName === 'notFound') {
58
+ defaultRoute = routePath;
59
+ }
60
+ if (view.isIndex) {
61
+ if (!defaultRoute) {
62
+ defaultRoute = routePath;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ var route = {
68
+ path: routePath,
69
+ component: compileComponent_1.compileComponent(componentMap[view.id]),
70
+ children: []
71
+ };
72
+ var viewChildren = view.children;
73
+ if (Array.isArray(viewChildren) && viewChildren.length) {
74
+ for (var i = 0; i < viewChildren.length; i++) {
75
+ var subView = viewChildren[i];
76
+ var subViewRoute = traverseViews(subView, isViewAuth).route;
77
+ route.children.push(subViewRoute);
78
+ if (subView.isIndex) {
79
+ route.children.push({
80
+ path: '',
81
+ redirect: "'" + subView.name + "'"
82
+ });
83
+ }
84
+ }
85
+ }
86
+ var viewPath = view.path;
87
+ if (isViewAuth) {
88
+ authResourceViews.push(view);
89
+ }
90
+ if (!isViewAuth) {
91
+ baseResourcePaths.push(viewPath);
92
+ }
93
+ return {
94
+ route: route,
95
+ isViewAuth: isViewAuth
96
+ };
97
+ };
98
+ // 页面
99
+ views.forEach(function (view) {
100
+ var route = traverseViews(view).route;
101
+ routes.push(route);
102
+ if (view.isIndex) {
103
+ routes.push({
104
+ path: '/',
105
+ redirect: "'/" + view.name + "'"
106
+ });
107
+ }
108
+ });
109
+ var authResourcePathMap = {};
110
+ // 默认跳转子页面开启权限的情况,需要把父页面也都加入权限校验列表
111
+ if (Array.isArray(authResourceViews)) {
112
+ authResourceViews.forEach(function (authResourceView) {
113
+ if (authResourceView) {
114
+ authResourcePathMap[authResourceView.path] = true;
115
+ var viewNode = authResourceView;
116
+ while (viewNode.concept === 'View' && viewNode.isIndex) {
117
+ var parentViewNode = viewNode.parentNode;
118
+ if (parentViewNode.concept === 'View') {
119
+ authResourcePathMap[parentViewNode.path] = true;
120
+ }
121
+ else { // viewNode是根页面
122
+ authResourcePathMap['/'] = true;
123
+ }
124
+ viewNode = parentViewNode;
125
+ }
126
+ }
127
+ });
128
+ }
129
+ var authResourcePaths = Object.keys(authResourcePathMap);
130
+ function routeToString(route) {
131
+ var _a, _b;
132
+ var content = "{\n path: '" + route.path + "',\n";
133
+ if ((_a = route === null || route === void 0 ? void 0 : route.component) === null || _a === void 0 ? void 0 : _a.script) {
134
+ var template = route.component.template;
135
+ if (config.env !== 'dev') {
136
+ template = template.replace(/[\t\r\n]/g, '');
137
+ }
138
+ content += "component: (function(){\n var componentOptions = " + (route.component.script ? '(function(){\n' + route.component.script.trim().replace(/export default |module\.exports +=/, 'return ') + '\n})()' : '{}') + ";\n Object.assign(componentOptions, {\n template: `" + template.replace(/[`$]/g, function (m) { return '\\' + m; }) + "`,\n });\n return componentOptions;\n })(),\n";
139
+ }
140
+ if ((_b = route === null || route === void 0 ? void 0 : route.children) === null || _b === void 0 ? void 0 : _b.length) {
141
+ content += "children: [\n " + route.children.map(routeToString).join(',\n') + "\n ],\n";
142
+ }
143
+ if (route === null || route === void 0 ? void 0 : route.redirect) {
144
+ content += "redirect: " + (route === null || route === void 0 ? void 0 : route.redirect) + ",\n";
145
+ }
146
+ content += '}';
147
+ return content;
148
+ }
149
+ var routesStr = '[';
150
+ routes.forEach(function (route) {
151
+ routesStr += routeToString(route) + ",\n";
152
+ });
153
+ if (defaultRoute) {
154
+ routesStr += "{\n path: '*',\n redirect: '" + defaultRoute + "',\n }\n";
155
+ }
156
+ routesStr += ']';
157
+ var platformConfig = JSON5.stringify({
158
+ appConfig: {
159
+ project: app.name,
160
+ domainName: app.name,
161
+ nuimsDomain: fnNuimsDomain,
162
+ envNuimsDomain: config.envNuimsDomain,
163
+ tenantType: config.tenantType,
164
+ tenantLevel: config.tenantLevel,
165
+ extendedConfig: config.extendedConfig,
166
+ envConfig: {
167
+ lowcodeDomain: fnLowcodeDomain
168
+ },
169
+ tenant: config.tenant,
170
+ documentTitle: app.documentTitle,
171
+ rootViewData: rootViewData
172
+ },
173
+ dnsAddr: app.dnsAddr,
174
+ devDnsAddr: config.devDnsAddr,
175
+ tenant: config.tenant,
176
+ env: config.env,
177
+ hasUserCenter: app.hasUserCenter,
178
+ hasAuth: app.hasAuth,
179
+ authResourcePaths: authResourcePaths,
180
+ baseResourcePaths: baseResourcePaths,
181
+ miniEnable: config.miniEnable
182
+ }, null, 4);
183
+ var metaData = genMetaData_1.genMetaData(app);
184
+ var metaDataStr = JSON5.stringify(metaData);
185
+ var assetsInfo = app.genAllAssetsInfo(config.STATIC_URL);
186
+ var customNames = JSON5.stringify(assetsInfo.custom.names);
187
+ var content = "(function(){\n ";
188
+ var themeCSS = app.genThemeCSS();
189
+ if (themeCSS) {
190
+ content += "{\n const el = document.createElement('style');\n el.id = 'theme';\n el.innerHTML = `" + themeCSS + "`;\n document.head.appendChild(el);\n }\n ";
191
+ }
192
+ if (app.documentIcon) {
193
+ content += "{\n const link = document.createElement('link');\n link.rel = 'shortcut icon';\n link.href = `" + app.documentIcon + "`;\n document.head.appendChild(link);\n }";
194
+ }
195
+ content += "\n var customNames = " + customNames + ";\n for(var i=0;i<customNames.length;i++){\n var name = window.kebab2Camel(customNames[i]);\n if(window[name]){\n window.CloudUI.install(window.Vue, window[name]);\n }\n }";
196
+ content += "\n var platformConfig = " + platformConfig + ";\n var metaData = " + metaDataStr + ";\n var routes = " + routesStr + ";\n\n window.createLcapApp = () => window.appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);\n window.createLcapApp();\n })();";
197
+ if (config.env === 'dev') {
198
+ // 加载资源js
199
+ // const domain = fnLowcodeDomain.slice(fnLowcodeDomain.indexOf('.') + 1);
200
+ // const targetUrl = `${typeof location !== 'undefined' ? location.origin : `http://${config.tenant}.${fnLowcodeDomain}`}/empty?url=${domain}&appid=${config.appid}`;
201
+ // if(!document.querySelector("iframe[name='iframeEmpty']")){
202
+ // var el = document.createElement('iframe');
203
+ // el.setAttribute('src', "${targetUrl}");
204
+ // el.setAttribute('name', 'iframeEmpty');
205
+ // el.setAttribute('width', 0);
206
+ // el.setAttribute('height', 0);
207
+ // el.style.borderWidth = 0
208
+ // el.style.display= "block"
209
+ // document.getElementsByTagName('body')[0].appendChild(el);
210
+ // document.domain = '${domain}'
211
+ var str = "\n var _div = document.createElement('div');\n _div.classList = \"div-load\"\n _div.innerHTML = \"<div class='loading-container'></div><div>\u6B63\u5728\u66F4\u65B0\u6700\u65B0\u53D1\u5E03\u5185\u5BB9...</div>\"\n document.getElementsByTagName('body')[0].appendChild(_div);\n window.showLoading = function(){\n document.querySelector(\".div-load\").style.display =\"flex\"\n }\n window.hideLoading = function(){\n document.querySelector(\".div-load\").style.display =\"none\"\n }\n var style = document.createElement('style');\n style.innerHTML=`.div-load{\n width: 208px;\n height: 40px;\n background: rgba(48, 48, 48, 0.8);\n box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n position: fixed;\n top: 120px;\n left: 50%;\n margin-left: -104px;\n color: #FFFFFF;\n font-size: 14px;\n display: none;\n justify-content: center;\n align-items: center;\n }\n\n .loading-container{\n width: 12px;\n height: 12px;\n margin-right: 10px;\n animation: loading-animation 0.8s infinite linear;\n border: 2px solid #f3f3f3;\n border-top: 2px solid rgb(109, 108, 108);\n border-right: 2px solid rgb(109, 108, 108);\n border-bottom: 2px solid rgb(109, 108, 108);\n border-radius: 50%;\n }\n\n @keyframes loading-animation{\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }`\n document.getElementsByTagName('body')[0].appendChild(style);\n window.addEventListener('message', function (e) {\n console.log('message:',e)\n if(e.data ===\"release-start\"){\n showLoading()\n }\n if(e.data===\"release-end\"){\n hideLoading()\n window.location.reload();\n }\n })\n ";
212
+ content += str;
213
+ }
214
+ var bundlePath = config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/bundle." + _1.genHash(content) + ".js";
215
+ var bundleSourceMapPath = bundlePath + ".map";
216
+ var bundleMinPath = config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/bundle." + _1.genHash(content) + ".min.js";
217
+ var otherJsList = config.miniEnable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
218
+ var assetsContent = "(function() {\n LazyLoad.js(" + JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath])) + ");\n LazyLoad.css(" + JSON5.stringify(assetsInfo.basic.css.concat(assetsInfo.custom.css)) + ");\n})()\n";
219
+ var minifyObj;
220
+ // 开发环境加上sourceMap
221
+ if (config.env === 'dev') {
222
+ content = prettier.format(content, {
223
+ parser: 'babel',
224
+ plugins: [parserBabel],
225
+ tabWidth: 4
226
+ });
227
+ minifyObj = UglifyJS.minify((_a = {},
228
+ _a[bundlePath] = content,
229
+ _a), {
230
+ sourceMap: {
231
+ url: bundleSourceMapPath
232
+ }
233
+ });
234
+ }
235
+ else {
236
+ minifyObj = UglifyJS.minify(content);
237
+ }
238
+ var outputs = [
239
+ {
240
+ name: bundleMinPath,
241
+ content: minifyObj.code
242
+ },
243
+ {
244
+ name: config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/client.js",
245
+ content: assetsContent
246
+ },
247
+ ];
248
+ // 开发环境加上sourceMap
249
+ if (config.env === 'dev') {
250
+ // map和源文件
251
+ outputs.push({
252
+ name: bundlePath,
253
+ content: content
254
+ }, {
255
+ name: bundleSourceMapPath,
256
+ content: minifyObj.map
257
+ });
258
+ }
259
+ return outputs;
260
+ }
261
+ exports.genBundleFiles = genBundleFiles;
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.genMetaData = void 0;
4
+ var concepts_1 = require("../concepts");
5
+ var utils = require("../utils");
6
+ // 生成typeKey
7
+ function genSortedTypeKey(typeAnnotation) {
8
+ var _a = typeAnnotation || {}, typeKind = _a.typeKind, typeNamespace = _a.typeNamespace, typeName = _a.typeName, typeArguments = _a.typeArguments, properties = _a.properties;
9
+ var typeKeyArr = [];
10
+ if (typeKind === 'union') { // 联合类型
11
+ if (Array.isArray(typeArguments)) {
12
+ // 按返回的每个具体项排序
13
+ var childTypeArgs = typeArguments.map(function (typeArg) { return genSortedTypeKey(typeArg); }).sort(function (name1, name2) { return name1 > name2 ? 1 : -1; });
14
+ typeKeyArr.push(childTypeArgs.join(' | '));
15
+ }
16
+ }
17
+ else if (typeKind === 'anonymousStructure') { // 匿名数据结构
18
+ typeKeyArr.push('{');
19
+ if (Array.isArray(properties)) {
20
+ // 按匿名数据结构的key排序
21
+ var childTypeArgs = properties.sort(function (_a, _b) {
22
+ var name1 = _a.name;
23
+ var name2 = _b.name;
24
+ return name1 > name2 ? 1 : -1;
25
+ }).map(function (typeArg) {
26
+ var _a = typeArg || {}, typeArgName = _a.name, typeArgTypeAnnotation = _a.typeAnnotation;
27
+ return typeArgName + ": " + genSortedTypeKey(typeArgTypeAnnotation);
28
+ });
29
+ typeKeyArr.push(childTypeArgs.join(', '));
30
+ }
31
+ typeKeyArr.push('}');
32
+ }
33
+ else {
34
+ var typeArr = [];
35
+ typeNamespace && typeArr.push(typeNamespace);
36
+ typeName && typeArr.push(typeName);
37
+ var typeKey = typeArr.join('.');
38
+ typeKey && typeKeyArr.push(typeKey);
39
+ if (typeKind === 'generic') {
40
+ typeKeyArr.push('<');
41
+ if (Array.isArray(typeArguments)) {
42
+ // 必须按typeArguments定义的顺序,否则实参位置不对
43
+ var childTypeArgs = typeArguments.map(function (typeArg) { return genSortedTypeKey(typeArg); });
44
+ typeKeyArr.push(childTypeArgs.join(', '));
45
+ }
46
+ typeKeyArr.push('>');
47
+ }
48
+ }
49
+ return typeKeyArr.join('');
50
+ }
51
+ function genMetaData(app) {
52
+ var modules = [];
53
+ var views = [];
54
+ var entities = [];
55
+ var structures = [];
56
+ var enums = [];
57
+ var logics = [];
58
+ var interfaces = [];
59
+ var processes = [];
60
+ app.views && views.push.apply(views, app.views);
61
+ if (Array.isArray(app.dataSources)) {
62
+ app.dataSources.forEach(function (dataSource) {
63
+ if (Array.isArray(dataSource.entities)) {
64
+ entities.push.apply(entities, dataSource.entities);
65
+ }
66
+ });
67
+ }
68
+ app.structures && structures.push.apply(structures, app.structures);
69
+ app.enums && enums.push.apply(enums, app.enums);
70
+ app.logics && logics.push.apply(logics, app.logics);
71
+ app.processes && processes.push.apply(processes, app.processes);
72
+ app.dependencies && modules.push.apply(modules, app.dependencies);
73
+ app.interfaceDependencies && modules.push.apply(modules, app.interfaceDependencies);
74
+ modules.forEach(function (module) {
75
+ module.views && views.push.apply(views, module.views);
76
+ module.structures && structures.push.apply(structures, module.structures);
77
+ module.enums && enums.push.apply(enums, module.enums);
78
+ module.logics && logics.push.apply(logics, module.logics);
79
+ module.interfaces && interfaces.push.apply(interfaces, module.interfaces);
80
+ if (Array.isArray(module.dataSources)) {
81
+ module.dataSources.forEach(function (dataSource) {
82
+ if (Array.isArray(dataSource.entities)) {
83
+ entities.push.apply(entities, dataSource.entities);
84
+ }
85
+ });
86
+ }
87
+ });
88
+ var dataTypes = [];
89
+ var dataTypesMap = {};
90
+ var frontendVariables = app.frontendVariables;
91
+ var enumsMap = {};
92
+ var logicsMap = {};
93
+ var _custom = {};
94
+ var allLogics = [];
95
+ if (Array.isArray(enums)) {
96
+ dataTypes.push.apply(dataTypes, enums);
97
+ enums.forEach(function (node) {
98
+ var _a = node || {}, name = _a.name, enumItems = _a.enumItems;
99
+ if (node.module) {
100
+ name = "extensions." + node.module.name + ".enums." + name;
101
+ }
102
+ var enumObj = {};
103
+ enumItems.forEach(function (_a) {
104
+ var label = _a.label, value = _a.value;
105
+ enumObj[value] = label;
106
+ });
107
+ enumsMap[name] = enumObj;
108
+ });
109
+ }
110
+ if (Array.isArray(entities)) {
111
+ dataTypes.push.apply(dataTypes, entities);
112
+ entities.forEach(function (entity) {
113
+ var ns = entity.ns;
114
+ if (Array.isArray(ns === null || ns === void 0 ? void 0 : ns.logics)) {
115
+ allLogics.push.apply(allLogics, ns.logics);
116
+ }
117
+ });
118
+ }
119
+ if (Array.isArray(structures)) {
120
+ dataTypes.push.apply(dataTypes, structures);
121
+ }
122
+ dataTypes.forEach(function (node) {
123
+ var _a;
124
+ var namespace = node.getNamespace();
125
+ var id = namespace + "." + node.name;
126
+ dataTypesMap[id] = (_a = node.toJSON) === null || _a === void 0 ? void 0 : _a.call(node);
127
+ var properties = (node).properties;
128
+ if (Array.isArray(properties)) {
129
+ properties.forEach(function (property) {
130
+ collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
131
+ });
132
+ }
133
+ });
134
+ [
135
+ {
136
+ namespace: 'nasl.ui',
137
+ list: concepts_1.uiStructures
138
+ },
139
+ {
140
+ namespace: 'nasl.collection',
141
+ list: concepts_1.collectionStructures
142
+ },
143
+ {
144
+ namespace: 'nasl.interface',
145
+ list: concepts_1.interfaceStructures
146
+ },
147
+ {
148
+ namespace: 'nasl.process',
149
+ list: concepts_1.processStructures
150
+ },
151
+ ].forEach(function (item) {
152
+ var _a = item || {}, namespace = _a.namespace, list = _a.list;
153
+ if (Array.isArray(list)) {
154
+ list.forEach(function (node) {
155
+ var _a;
156
+ var id = namespace + "." + node.name;
157
+ dataTypesMap[id] = (_a = node.toJSON) === null || _a === void 0 ? void 0 : _a.call(node);
158
+ var properties = (node).properties;
159
+ if (Array.isArray(properties)) {
160
+ properties.forEach(function (property) {
161
+ collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
162
+ });
163
+ }
164
+ });
165
+ }
166
+ });
167
+ if (Array.isArray(logics)) {
168
+ allLogics.push.apply(allLogics, logics);
169
+ }
170
+ allLogics.forEach(function (node) {
171
+ var namespace = node.getNamespace();
172
+ var id = namespace ? namespace + "." + node.name : node.name;
173
+ logicsMap[id] = node.toService();
174
+ });
175
+ processes.forEach(function (process) {
176
+ if (Array.isArray(process.logics)) {
177
+ process.logics.forEach(function (node) {
178
+ var namespace = node.getNamespace();
179
+ var id = namespace ? namespace + "." + node.name : node.name;
180
+ logicsMap[id] = node.toProcessService();
181
+ });
182
+ }
183
+ });
184
+ interfaces.forEach(function (interfaceItem) {
185
+ _custom[interfaceItem.getNamespace() + "." + interfaceItem.name] = interfaceItem.toService();
186
+ });
187
+ utils.traverse(function (current) {
188
+ var node = (current || {}).node;
189
+ var typeAnnotation = (node === null || node === void 0 ? void 0 : node.typeAnnotation) || (node === null || node === void 0 ? void 0 : node.__TypeAnnotation);
190
+ collectTypeAnnotation(typeAnnotation);
191
+ }, {
192
+ node: {
193
+ children: views
194
+ }
195
+ }, {
196
+ mode: 'anyObject',
197
+ excludedKeySet: new Set([
198
+ 'parentNode',
199
+ 'sourceMap',
200
+ 'storageJSON',
201
+ 'tsErrorDetail',
202
+ 'NaslAnnotatedJSON',
203
+ 'calledFrom',
204
+ '_events',
205
+ '_collectingList',
206
+ '_historyList',
207
+ ])
208
+ });
209
+ if (Array.isArray(frontendVariables)) {
210
+ frontendVariables.forEach(function (frontendVariable) {
211
+ var typeAnnotation = frontendVariable.typeAnnotation || frontendVariable.__TypeAnnotation;
212
+ collectTypeAnnotation(typeAnnotation);
213
+ });
214
+ }
215
+ function collectTypeAnnotation(typeAnnotation) {
216
+ var _a, _b;
217
+ if (typeAnnotation) {
218
+ var sortedTypeKey = genSortedTypeKey(typeAnnotation);
219
+ if (!dataTypesMap[sortedTypeKey]) {
220
+ dataTypesMap[sortedTypeKey] = (_b = (_a = typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.toJSON) === null || _a === void 0 ? void 0 : _a.call(typeAnnotation)) !== null && _b !== void 0 ? _b : typeAnnotation;
221
+ var _c = (dataTypesMap[sortedTypeKey] || {}), properties = _c.properties, typeArguments = _c.typeArguments;
222
+ if (Array.isArray(properties)) {
223
+ properties.forEach(function (property) {
224
+ collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
225
+ });
226
+ }
227
+ if (Array.isArray(typeArguments)) {
228
+ typeArguments.forEach(function (typeArg) {
229
+ collectTypeAnnotation(typeArg);
230
+ });
231
+ }
232
+ }
233
+ }
234
+ }
235
+ return {
236
+ frontendVariables: frontendVariables,
237
+ dataTypesMap: dataTypesMap,
238
+ enumsMap: enumsMap,
239
+ logicsMap: logicsMap,
240
+ servicesMap: {
241
+ _custom: _custom
242
+ }
243
+ };
244
+ }
245
+ exports.genMetaData = genMetaData;