@lcap/nasl 2.18.0-beta.7 → 2.20.0-beta.1

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 (336) hide show
  1. package/out/automate/engine/index.js +3 -3
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/bak/translator.js +85 -37
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.d.ts +6 -10
  6. package/out/common/BaseNode.js +7 -53
  7. package/out/common/BaseNode.js.map +1 -1
  8. package/out/concepts/AnonymousFunction__.js.map +1 -1
  9. package/out/concepts/App__.d.ts +0 -10
  10. package/out/concepts/App__.js +0 -74
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Assignee__.js.map +1 -1
  13. package/out/concepts/AssignmentLine__.d.ts +5 -5
  14. package/out/concepts/AssignmentLine__.js +6 -6
  15. package/out/concepts/AssignmentLine__.js.map +1 -1
  16. package/out/concepts/Assignment__.js +2 -1
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/BatchAssignment__.d.ts +60 -60
  19. package/out/concepts/BatchAssignment__.js +41 -68
  20. package/out/concepts/BatchAssignment__.js.map +1 -1
  21. package/out/concepts/BindAttribute__.d.ts +0 -19
  22. package/out/concepts/BindAttribute__.js +2 -39
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindEvent__.js.map +1 -1
  25. package/out/concepts/BindStyle__.d.ts +2 -2
  26. package/out/concepts/BindStyle__.js +3 -3
  27. package/out/concepts/BindStyle__.js.map +1 -1
  28. package/out/concepts/BooleanLiteral__.js +8 -0
  29. package/out/concepts/BooleanLiteral__.js.map +1 -1
  30. package/out/concepts/CallFunction__.js +25 -58
  31. package/out/concepts/CallFunction__.js.map +1 -1
  32. package/out/concepts/CallInterface__.d.ts +0 -7
  33. package/out/concepts/CallInterface__.js +7 -53
  34. package/out/concepts/CallInterface__.js.map +1 -1
  35. package/out/concepts/CallLogic__.d.ts +1 -2
  36. package/out/concepts/CallLogic__.js +25 -89
  37. package/out/concepts/CallLogic__.js.map +1 -1
  38. package/out/concepts/CallQueryComponent__.js +1 -13
  39. package/out/concepts/CallQueryComponent__.js.map +1 -1
  40. package/out/concepts/CompletionProperty__.js +0 -3
  41. package/out/concepts/CompletionProperty__.js.map +1 -1
  42. package/out/concepts/ConfigGroup__.js.map +1 -1
  43. package/out/concepts/ConfigProperty__.js.map +1 -1
  44. package/out/concepts/Configuration__.js.map +1 -1
  45. package/out/concepts/DataSource__.d.ts +0 -6
  46. package/out/concepts/DataSource__.js +0 -41
  47. package/out/concepts/DataSource__.js.map +1 -1
  48. package/out/concepts/Destination__.d.ts +2 -11
  49. package/out/concepts/Destination__.js +48 -148
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/EntityProperty__.d.ts +8 -21
  52. package/out/concepts/EntityProperty__.js +23 -109
  53. package/out/concepts/EntityProperty__.js.map +1 -1
  54. package/out/concepts/Entity__.d.ts +0 -32
  55. package/out/concepts/Entity__.js +2 -117
  56. package/out/concepts/Entity__.js.map +1 -1
  57. package/out/concepts/Enum__.js +4 -0
  58. package/out/concepts/Enum__.js.map +1 -1
  59. package/out/concepts/Event__.js.map +1 -1
  60. package/out/concepts/ForEachStatement__.d.ts +4 -0
  61. package/out/concepts/ForEachStatement__.js +8 -4
  62. package/out/concepts/ForEachStatement__.js.map +1 -1
  63. package/out/concepts/Function__.js.map +1 -1
  64. package/out/concepts/Identifier__.js +4 -16
  65. package/out/concepts/Identifier__.js.map +1 -1
  66. package/out/concepts/IfStatement__.d.ts +0 -8
  67. package/out/concepts/IfStatement__.js +0 -22
  68. package/out/concepts/IfStatement__.js.map +1 -1
  69. package/out/concepts/InterfaceParam__.js.map +1 -1
  70. package/out/concepts/Interface__.js.map +1 -1
  71. package/out/concepts/LogicItem__.d.ts +1 -1
  72. package/out/concepts/LogicItem__.js.map +1 -1
  73. package/out/concepts/Logic__.d.ts +1 -6
  74. package/out/concepts/Logic__.js +50 -150
  75. package/out/concepts/Logic__.js.map +1 -1
  76. package/out/concepts/MatchCase__.d.ts +1 -1
  77. package/out/concepts/MatchCase__.js +8 -15
  78. package/out/concepts/MatchCase__.js.map +1 -1
  79. package/out/concepts/Match__.d.ts +19 -21
  80. package/out/concepts/Match__.js +25 -112
  81. package/out/concepts/Match__.js.map +1 -1
  82. package/out/concepts/MemberExpression__.d.ts +1 -4
  83. package/out/concepts/MemberExpression__.js +15 -30
  84. package/out/concepts/MemberExpression__.js.map +1 -1
  85. package/out/concepts/Module__.js.map +1 -1
  86. package/out/concepts/Namespace__.js.map +1 -1
  87. package/out/concepts/NumericLiteral__.js +1 -1
  88. package/out/concepts/NumericLiteral__.js.map +1 -1
  89. package/out/concepts/OqlQueryComponent__.d.ts +3 -7
  90. package/out/concepts/OqlQueryComponent__.js +95 -56
  91. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  92. package/out/concepts/Param__.d.ts +1 -1
  93. package/out/concepts/Param__.js +4 -40
  94. package/out/concepts/Param__.js.map +1 -1
  95. package/out/concepts/ProcessComponent__.js.map +1 -1
  96. package/out/concepts/ProcessElement__.js.map +1 -1
  97. package/out/concepts/Process__.js.map +1 -1
  98. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  99. package/out/concepts/QueryOrderByExpression__.d.ts +3 -3
  100. package/out/concepts/QueryOrderByExpression__.js +3 -3
  101. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  102. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  103. package/out/concepts/Return__.js +2 -38
  104. package/out/concepts/Return__.js.map +1 -1
  105. package/out/concepts/SelectMembers__.d.ts +1 -1
  106. package/out/concepts/SelectMembers__.js +2 -2
  107. package/out/concepts/SelectMembers__.js.map +1 -1
  108. package/out/concepts/SqlQueryComponent__.d.ts +4 -2
  109. package/out/concepts/SqlQueryComponent__.js +88 -9
  110. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  111. package/out/concepts/StringLiteral__.js +7 -0
  112. package/out/concepts/StringLiteral__.js.map +1 -1
  113. package/out/concepts/StructureProperty__.js.map +1 -1
  114. package/out/concepts/Structure__.js.map +1 -1
  115. package/out/concepts/TypeAnnotation__.d.ts +0 -1
  116. package/out/concepts/TypeAnnotation__.js +12 -25
  117. package/out/concepts/TypeAnnotation__.js.map +1 -1
  118. package/out/concepts/TypeParam__.d.ts +0 -1
  119. package/out/concepts/TypeParam__.js +0 -2
  120. package/out/concepts/TypeParam__.js.map +1 -1
  121. package/out/concepts/UnaryExpression__.js +9 -6
  122. package/out/concepts/UnaryExpression__.js.map +1 -1
  123. package/out/concepts/ValidationRule__.js +23 -88
  124. package/out/concepts/ValidationRule__.js.map +1 -1
  125. package/out/concepts/Variable__.js +2 -38
  126. package/out/concepts/Variable__.js.map +1 -1
  127. package/out/concepts/ViewComponent__.js.map +1 -1
  128. package/out/concepts/ViewElement__.d.ts +29 -30
  129. package/out/concepts/ViewElement__.js +52 -118
  130. package/out/concepts/ViewElement__.js.map +1 -1
  131. package/out/concepts/View__.d.ts +3 -4
  132. package/out/concepts/View__.js +83 -97
  133. package/out/concepts/View__.js.map +1 -1
  134. package/out/concepts/WhileStatement__.js +1 -1
  135. package/out/concepts/WhileStatement__.js.map +1 -1
  136. package/out/concepts/basics/stdlib/nasl.browser.js +0 -50
  137. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  138. package/out/concepts/basics/stdlib/nasl.ui.js +4 -36
  139. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  140. package/out/concepts/basics/stdlib/nasl.util.js +43 -63
  141. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  142. package/out/concepts/index__.d.ts +0 -2
  143. package/out/concepts/index__.js +0 -2
  144. package/out/concepts/index__.js.map +1 -1
  145. package/out/generator/genBundleFiles.d.ts +2 -5
  146. package/out/generator/genBundleFiles.js +155 -108
  147. package/out/generator/genBundleFiles.js.map +1 -1
  148. package/out/generator/genMetaData.d.ts +10 -1
  149. package/out/generator/genMetaData.js +50 -189
  150. package/out/generator/genMetaData.js.map +1 -1
  151. package/out/generator/index.d.ts +0 -1
  152. package/out/generator/index.js +0 -1
  153. package/out/generator/index.js.map +1 -1
  154. package/out/index.d.ts +2 -3
  155. package/out/index.js +1 -5
  156. package/out/index.js.map +1 -1
  157. package/out/server/entity2LogicNamespace.js +11 -11
  158. package/out/server/entity2LogicNamespace.js.map +1 -1
  159. package/out/server/extendBaseNode.js +18 -4
  160. package/out/server/extendBaseNode.js.map +1 -1
  161. package/out/server/formatTsUtils.d.ts +2 -1
  162. package/out/server/formatTsUtils.js +64 -40
  163. package/out/server/formatTsUtils.js.map +1 -1
  164. package/out/server/getLogics.js +6 -13
  165. package/out/server/getLogics.js.map +1 -1
  166. package/out/server/getMemberIdentifier.js +7 -7
  167. package/out/server/getMemberIdentifier.js.map +1 -1
  168. package/out/server/getProcesses.d.ts +1 -1
  169. package/out/server/getProcesses.js +1 -1
  170. package/out/server/getProcesses.js.map +1 -1
  171. package/out/server/index.d.ts +1 -0
  172. package/out/server/index.js +27 -2
  173. package/out/server/index.js.map +1 -1
  174. package/out/server/naslServer.d.ts +7 -47
  175. package/out/server/naslServer.js +399 -604
  176. package/out/server/naslServer.js.map +1 -1
  177. package/out/server/naslStdlibMap.js +28 -30
  178. package/out/server/naslStdlibMap.js.map +1 -1
  179. package/out/server/translator.js +11 -59
  180. package/out/server/translator.js.map +1 -1
  181. package/out/service/storage/init.js +3 -33
  182. package/out/service/storage/init.js.map +1 -1
  183. package/out/templator/genCreateBlock.js +4 -6
  184. package/out/templator/genCreateBlock.js.map +1 -1
  185. package/out/templator/genCurdEditMultipleKeyBlock.js +4 -7
  186. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  187. package/out/templator/genCurdMultipleKeyBlock.js +5 -7
  188. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  189. package/out/templator/genEnumSelectBlock.js +2 -5
  190. package/out/templator/genEnumSelectBlock.js.map +1 -1
  191. package/out/templator/genGridViewBlock.js +2 -2
  192. package/out/templator/genGridViewBlock.js.map +1 -1
  193. package/out/templator/genListViewBlock.js +2 -2
  194. package/out/templator/genListViewBlock.js.map +1 -1
  195. package/out/templator/genQueryComponent.d.ts +2 -2
  196. package/out/templator/genQueryComponent.js +1 -4
  197. package/out/templator/genQueryComponent.js.map +1 -1
  198. package/out/templator/genTableBlock.js +2 -2
  199. package/out/templator/genTableBlock.js.map +1 -1
  200. package/out/templator/genUpdateBlock.js +3 -4
  201. package/out/templator/genUpdateBlock.js.map +1 -1
  202. package/out/templator/utils.js +1 -1
  203. package/out/templator/utils.js.map +1 -1
  204. package/out/test/integration/node-nasl-server.js +38 -10
  205. package/out/test/integration/node-nasl-server.js.map +1 -1
  206. package/out/translator/index.d.ts +0 -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 +0 -1
  210. package/out/utils/index.js +1 -38
  211. package/out/utils/index.js.map +1 -1
  212. package/out/utils/string.d.ts +2 -15
  213. package/out/utils/string.js +3 -18
  214. package/out/utils/string.js.map +1 -1
  215. package/package.json +2 -2
  216. package/sandbox/stdlib/nasl.auth.ts +1 -1
  217. package/sandbox/stdlib/nasl.core.ts +1 -0
  218. package/sandbox/stdlib/nasl.logging.ts +4 -4
  219. package/sandbox/stdlib/nasl.util.ts +8 -4
  220. package/src/automate/engine/index.js +4 -4
  221. package/src/automate/engine/uniqueName.js +3 -3
  222. package/src/automate/template/myProcess.js +1 -1
  223. package/src/automate/upgrader/2.20.js +41 -0
  224. package/src/bak/translator.js +4 -1
  225. package/src/concepts/AnonymousFunction__.ts +48 -2
  226. package/src/concepts/App__.ts +288 -615
  227. package/src/concepts/BatchAssignment__.ts +45 -1
  228. package/src/concepts/BindAttribute__.ts +18 -25
  229. package/src/concepts/BindDirective__.ts +7 -0
  230. package/src/concepts/BindEvent__.ts +7 -0
  231. package/src/concepts/BindStyle__.ts +7 -0
  232. package/src/concepts/CallFunction__.ts +34 -45
  233. package/src/concepts/CallInterface__.ts +2 -1
  234. package/src/concepts/CallLogic__.ts +61 -44
  235. package/src/concepts/CallQueryComponent__.ts +4 -1
  236. package/src/concepts/Constant__.ts +7 -0
  237. package/src/concepts/DataSource__.ts +57 -5
  238. package/src/concepts/Destination__.ts +8 -21
  239. package/src/concepts/Frontend__.ts +937 -0
  240. package/src/concepts/Identifier__.ts +18 -16
  241. package/src/concepts/LogicItem__.ts +8 -1
  242. package/src/concepts/Logic__.ts +128 -142
  243. package/src/concepts/Match__.ts +13 -29
  244. package/src/concepts/NewComposite__.ts +1357 -0
  245. package/src/concepts/NewList__.ts +440 -0
  246. package/src/concepts/NewMap__.ts +666 -0
  247. package/src/concepts/New__.ts +73 -0
  248. package/src/concepts/Param__.ts +245 -199
  249. package/src/concepts/ProcessElement__.ts +43 -36
  250. package/src/concepts/ProcessOutcomes__.ts +90 -0
  251. package/src/concepts/Process__.ts +1 -23
  252. package/src/concepts/Return__.ts +11 -1
  253. package/src/concepts/SelectMembers__.ts +3 -3
  254. package/src/concepts/Transactional__.ts +7 -0
  255. package/src/concepts/TypeAnnotation__.ts +54 -49
  256. package/src/concepts/ValidationRule__.ts +19 -1
  257. package/src/concepts/Variable__.ts +12 -6
  258. package/src/concepts/ViewElement__.ts +51 -7
  259. package/src/concepts/View__.ts +21 -25
  260. package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
  261. package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
  262. package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
  263. package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
  264. package/src/concepts/index__.ts +7 -0
  265. package/src/enums/KEYWORDS.ts +9 -0
  266. package/src/generator/genBundleFiles.ts +43 -29
  267. package/src/generator/genMetaData.ts +5 -10
  268. package/src/generator/genReleaseBody.ts +77 -41
  269. package/src/generator/index.ts +1 -0
  270. package/src/generator/permission.ts +261 -0
  271. package/src/index.ts +1 -1
  272. package/src/server/entity2LogicNamespace.ts +90 -10
  273. package/src/server/extendBaseNode.ts +29 -3
  274. package/src/server/formatTsUtils.ts +6 -0
  275. package/src/server/getLogics.ts +13 -1
  276. package/src/server/getMemberIdentifier.ts +5 -5
  277. package/src/server/naslServer.ts +235 -58
  278. package/src/server/process2LogicNamespace.ts +8 -0
  279. package/src/server/translator.ts +33 -1
  280. package/src/service/creator/add.configs.js +4 -0
  281. package/src/service/datasource/api.js +11 -0
  282. package/src/service/datasource/index.js +6 -0
  283. package/src/service/storage/init.ts +12 -0
  284. package/src/service/video/VideoTranscribe.js +1 -0
  285. package/src/templator/genEditTableBlock.ts +8 -16
  286. package/src/templator/genGetBlock.ts +18 -19
  287. package/src/templator/genGridViewBlock.ts +18 -18
  288. package/src/templator/genListViewBlock.ts +8 -11
  289. package/src/templator/genTableBlock.ts +6 -10
  290. package/ts-worker/lib/tsserver.js +8 -1
  291. package/out/automate/engine/2.14-components.d.ts +0 -1115
  292. package/out/automate/engine/2.14-components.js +0 -1087
  293. package/out/automate/engine/2.14-components.js.map +0 -1
  294. package/out/concepts/ExternalDestination__.d.ts +0 -73
  295. package/out/concepts/ExternalDestination__.js +0 -264
  296. package/out/concepts/ExternalDestination__.js.map +0 -1
  297. package/out/concepts/MatchExpression__.d.ts +0 -97
  298. package/out/concepts/MatchExpression__.js +0 -281
  299. package/out/concepts/MatchExpression__.js.map +0 -1
  300. package/out/concepts/StringInterpolation__.d.ts +0 -113
  301. package/out/concepts/StringInterpolation__.js +0 -227
  302. package/out/concepts/StringInterpolation__.js.map +0 -1
  303. package/out/generator/genReleaseBody.d.ts +0 -41
  304. package/out/generator/genReleaseBody.js +0 -349
  305. package/out/generator/genReleaseBody.js.map +0 -1
  306. package/out/service/defaultErrorMessage.json +0 -97
  307. package/out/service/logic/api.d.ts +0 -9
  308. package/out/service/logic/api.js +0 -11
  309. package/out/service/logic/api.js.map +0 -1
  310. package/out/service/logic/index.d.ts +0 -2
  311. package/out/service/logic/index.js +0 -10
  312. package/out/service/logic/index.js.map +0 -1
  313. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  314. package/src/automate/engine/dist/index.dev.js +0 -517
  315. package/src/common/dist/BaseNode.js +0 -1101
  316. package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1503
  317. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
  318. package/src/concepts/dist/Anchor__.js +0 -179
  319. package/src/concepts/dist/Assignment__.js +0 -301
  320. package/src/concepts/dist/CallFunction__.js +0 -513
  321. package/src/concepts/dist/CallInterface__.js +0 -533
  322. package/src/concepts/dist/CallLogic__.js +0 -892
  323. package/src/concepts/dist/ForEachStatement__.js +0 -426
  324. package/src/concepts/dist/MatchCase__.js +0 -587
  325. package/src/concepts/dist/Match__.js +0 -631
  326. package/src/concepts/dist/MemberExpression__.js +0 -348
  327. package/src/concepts/dist/Param__.js +0 -538
  328. package/src/concepts/dist/Return__.js +0 -494
  329. package/src/concepts/dist/Variable__.js +0 -537
  330. package/src/concepts/dist/ViewElement__.js +0 -1680
  331. package/src/generator/dist/genBundleFiles.js +0 -261
  332. package/src/generator/dist/genMetaData.js +0 -249
  333. package/src/server/dist/formatTsUtils.js +0 -683
  334. package/src/server/dist/naslServer.js +0 -3474
  335. package/src/service/storage/dist/init.js +0 -572
  336. package/ts-worker/dist/webpack.config.dev.js +0 -108
@@ -1,6 +1,7 @@
1
1
  export * from './App__';
2
2
  export * from './Module__';
3
3
  export * from './Namespace__';
4
+ export * from './Frontend__';
4
5
  export * from './TypeAnnotation__';
5
6
  export * from './TypeParam__';
6
7
  export * from './Structure__';
@@ -65,6 +66,10 @@ export * from './Match__';
65
66
  export * from './UnaryExpression__';
66
67
  export * from './MemberExpression__';
67
68
  export * from './Unparsed__';
69
+ export * from './New__';
70
+ export * from './NewComposite__';
71
+ export * from './NewList__';
72
+ export * from './NewMap__';
68
73
  export * from './CallQueryComponent__';
69
74
  export * from './QueryFromExpression__';
70
75
  export * from './QueryJoinExpression__';
@@ -81,6 +86,7 @@ export * from './ProcessElement__';
81
86
  export * from './ProcessComponent__';
82
87
  export * from './ProcessOutcome__';
83
88
  export * from './Assignee__';
89
+ export * from './ProcessOutcomes__';
84
90
  export * from './Role__';
85
91
  export * from './Configuration__';
86
92
  export * from './ConfigGroup__';
@@ -92,3 +98,4 @@ export * from './Point__';
92
98
  export * from './Rect__';
93
99
  export * from './SelectMembers__';
94
100
  export * from './AssignmentLine__';
101
+ export * from './NewList__';
@@ -1225,4 +1225,13 @@ export const USER_CUSTOM_KEYWORDS_PAGENAME = [
1225
1225
  'getCustomConfig',
1226
1226
  'getCurrentIp',
1227
1227
  'config',
1228
+ 'tenantExpiration',
1229
+ ];
1230
+
1231
+ export const FRONTEND_PATH_KEYWORDS = [
1232
+ 'api',
1233
+ 'rest',
1234
+ 'system',
1235
+ 'getCustomConfig',
1236
+ 'proxy',
1228
1237
  ];
@@ -1,4 +1,4 @@
1
- import { App, Module, View } from '../concepts';
1
+ import { App, Module, View, Frontend } from '../concepts';
2
2
  import * as utils from '../utils';
3
3
  import { genHash, RawOptions } from '.';
4
4
  import { compileComponent } from './compileComponent';
@@ -18,30 +18,32 @@ export interface Route {
18
18
  redirect?: string;
19
19
  }
20
20
 
21
- export function genBundleFiles(app: App,
22
- config: {
23
- tenant: string;
24
- env: string;
25
- nuimsDomain: string;
26
- STATIC_URL: string;
27
- USER_STATIC_URL: string;
28
- extendedConfig: string;
29
- lowcodeDomain: string;
30
- envLcpDomain: any,
31
- envNuimsDomain: any,
32
- tenantType: any,
33
- tenantLevel: any,
34
- appid: string;
35
- devDnsAddr: string;
36
- miniEnable: boolean
37
- }) {
21
+ interface Config {
22
+ tenant: string;
23
+ env: string;
24
+ nuimsDomain: string;
25
+ STATIC_URL: string;
26
+ USER_STATIC_URL: string;
27
+ extendedConfig: string;
28
+ lowcodeDomain: string;
29
+ envLcpDomain: any,
30
+ envNuimsDomain: any,
31
+ tenantType: any,
32
+ tenantLevel: any,
33
+ appid: string;
34
+ devDnsAddr: string;
35
+ miniEnable: boolean
36
+ }
37
+
38
+ export function genBundleFiles(app: App, frontend: Frontend,
39
+ config: Config) {
38
40
  const fnNuimsDomain = config?.envNuimsDomain?.[config?.env] || config?.nuimsDomain;
39
41
  const fnLowcodeDomain = config?.envLcpDomain?.[config?.env]?.lcpDomain || config?.lowcodeDomain;
40
42
  const modules: Module[] = [];
41
43
  const views: View[] = [];
42
44
  app.dependencies && modules.push(...app.dependencies);
43
45
  app.interfaceDependencies && modules.push(...app.interfaceDependencies);
44
- app.views && views.push(...app.views);
46
+ frontend.views && views.push(...frontend.views);
45
47
  modules.forEach((module: Module) => {
46
48
  module.views && views.push(...module.views);
47
49
  });
@@ -209,8 +211,9 @@ export function genBundleFiles(app: App,
209
211
  lowcodeDomain: fnLowcodeDomain,
210
212
  },
211
213
  tenant: config.tenant,
212
- documentTitle: app.documentTitle,
214
+ documentTitle: frontend.documentTitle,
213
215
  rootViewData,
216
+ basePath: frontend.basePath,
214
217
  },
215
218
  dnsAddr: app.dnsAddr,
216
219
  devDnsAddr: config.devDnsAddr,
@@ -223,15 +226,15 @@ export function genBundleFiles(app: App,
223
226
  miniEnable: config.miniEnable,
224
227
  }, null, 4);
225
228
 
226
- const metaData = genMetaData(app);
229
+ const metaData = genMetaData(app, frontend);
227
230
  const metaDataStr = JSON5.stringify(metaData);
228
231
 
229
- const assetsInfo = app.genAllAssetsInfo(config.STATIC_URL);
232
+ const assetsInfo = app.genAllAssetsInfo(config.STATIC_URL, frontend.type);
230
233
  const customNames = JSON5.stringify(assetsInfo.custom.names);
231
234
  let content = `(function(){
232
235
  `;
233
236
 
234
- const themeCSS = app.genThemeCSS();
237
+ const themeCSS = frontend.genThemeCSS();
235
238
  if (themeCSS) {
236
239
  content += `{
237
240
  const el = document.createElement('style');
@@ -242,11 +245,11 @@ export function genBundleFiles(app: App,
242
245
  `;
243
246
  }
244
247
 
245
- if (app.documentIcon) {
248
+ if (frontend.documentIcon) {
246
249
  content += `{
247
250
  const link = document.createElement('link');
248
251
  link.rel = 'shortcut icon';
249
- link.href = \`${app.documentIcon}\`;
252
+ link.href = \`${frontend.documentIcon}\`;
250
253
  document.head.appendChild(link);
251
254
  }`;
252
255
  }
@@ -346,10 +349,14 @@ export function genBundleFiles(app: App,
346
349
  `;
347
350
  content += str;
348
351
  }
349
-
350
- const bundlePath = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/bundle.${genHash(content)}.js`;
352
+ const baseUrl = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}`;
353
+ let bundlePath = `${baseUrl}/bundle.${genHash(content)}.js`;
354
+ let bundleMinPath = `${baseUrl}/bundle.${genHash(content)}.min.js`;
355
+ if (frontend.basePath) {
356
+ bundlePath = `${baseUrl}${frontend.basePath}/bundle.${genHash(content)}.js`;
357
+ bundleMinPath = `${baseUrl}${frontend.basePath}/bundle.${genHash(content)}.min.js`;
358
+ }
351
359
  const bundleSourceMapPath = `${bundlePath}.map`;
352
- const bundleMinPath = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/bundle.${genHash(content)}.min.js`;
353
360
  const otherJsList = config.miniEnable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
354
361
  const assetsContent = `(function() {
355
362
  LazyLoad.js(${JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath]))});
@@ -380,7 +387,7 @@ export function genBundleFiles(app: App,
380
387
  content: minifyObj.code,
381
388
  },
382
389
  {
383
- name: `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/client.js`,
390
+ name: frontend.basePath ? `${baseUrl}${frontend.basePath}/client.js` : `${baseUrl}/client.js`,
384
391
  content: assetsContent,
385
392
  },
386
393
  ];
@@ -397,3 +404,10 @@ export function genBundleFiles(app: App,
397
404
  }
398
405
  return outputs;
399
406
  }
407
+
408
+ export function genFrontendBundleFiles(app: App, frontends: Array<Frontend>,
409
+ config: Config) {
410
+ let outputs:any = [];
411
+ outputs = outputs.concat(...frontends.map((frontend) => genBundleFiles(app, frontend, config)));
412
+ return outputs;
413
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  App, Module, View, Entity, Structure, Enum,
3
3
  uiStructures, collectionStructures, interfaceStructures, processStructures,
4
- Logic, Interface, Process, BaseNode,
4
+ Logic, Interface, Process, BaseNode, Frontend,
5
5
  } from '../concepts';
6
6
  import * as utils from '../utils';
7
7
 
@@ -48,7 +48,7 @@ function genSortedTypeKey(typeAnnotation: any) {
48
48
  return typeKeyArr.join('');
49
49
  }
50
50
 
51
- export function genMetaData(app: App) {
51
+ export function genMetaData(app: App, frontend: Frontend) {
52
52
  const modules: Module[] = [];
53
53
  const views: View[] = [];
54
54
  const entities: Entity[] = [];
@@ -58,7 +58,7 @@ export function genMetaData(app: App) {
58
58
  const interfaces: Interface[] = [];
59
59
  const processes: Process[] = [];
60
60
 
61
- app.views && views.push(...app.views);
61
+ frontend.views && views.push(...frontend.views);
62
62
  if (Array.isArray(app.dataSources)) {
63
63
  app.dataSources.forEach((dataSource) => {
64
64
  if (Array.isArray(dataSource.entities)) {
@@ -93,7 +93,7 @@ export function genMetaData(app: App) {
93
93
  const dataTypesMap: {
94
94
  [id: string]: BaseNode;
95
95
  } = {};
96
- const frontendVariables = app.frontendVariables;
96
+ const frontendVariables = frontend.variables;
97
97
  const enumsMap: {
98
98
  [name: string]: {
99
99
  [label: string]: string;
@@ -217,12 +217,7 @@ export function genMetaData(app: App) {
217
217
 
218
218
  utils.traverse((current) => {
219
219
  const { node } = current || {};
220
- const { concept } = node || {};
221
- let typeAnnotation;
222
- if (['Param', 'Variable', 'Return', 'CallFunction', 'CallInterface', 'CallLogic'].includes(concept)) {
223
- typeAnnotation = node.typeAnnotation || node.__TypeAnnotation;
224
- }
225
- collectTypeAnnotation(typeAnnotation);
220
+ collectTypeAnnotation(node?.typeAnnotation || node?.__TypeAnnotation);
226
221
  }, {
227
222
  node: {
228
223
  children: views,
@@ -1,5 +1,6 @@
1
- import { App, Assignment, BatchAssignment, CallFunction, CallInterface, CallLogic, ForEachStatement, IfStatement, Logic, LogicItem, Match, MatchCase, Role, SwitchCase, SwitchStatement, View, ViewElement, WhileStatement } from '../concepts';
2
- import { genBundleFiles } from './genBundleFiles';
1
+ import { App, Assignment, BatchAssignment, CallFunction, CallInterface, CallLogic, ForEachStatement, IfStatement, Logic, LogicItem, Match, MatchCase, Role, SwitchCase, SwitchStatement, View, ViewElement, WhileStatement, Frontend } from '../concepts';
2
+ import { genFrontendBundleFiles } from './genBundleFiles';
3
+ import { genPermissionData } from './permission';
3
4
 
4
5
  export async function genReleaseBody(app: App, {
5
6
  env,
@@ -8,6 +9,7 @@ export async function genReleaseBody(app: App, {
8
9
  realRelease,
9
10
  appInfo,
10
11
  staticUrl,
12
+ frontends = [],
11
13
  }: {
12
14
  env: string,
13
15
  replicas: number,
@@ -26,15 +28,37 @@ export async function genReleaseBody(app: App, {
26
28
  tenantLabel: string,
27
29
  },
28
30
  staticUrl?: string,
31
+ frontends: Array<Frontend>,
29
32
  }) {
33
+ let authReport: ReturnType<typeof getAuthReport>;
34
+ let logicPageResourceDtoList;
35
+ if (realRelease) {
36
+ authReport = getAuthReport(app, frontends);
37
+ const permissionData = await genPermissionData(app);
38
+ authReport.resourceDataList = authReport.resourceDataList.concat(permissionData.resourceDataList);
39
+ authReport.resourceList = authReport.resourceList.concat(permissionData.resourceList);
40
+
41
+ logicPageResourceDtoList = permissionData.logicPageResourceDtoList;
42
+ }
43
+
44
+ const releaseFrontends = app.frontends.map((frontend) => ({
45
+ name: frontend.name,
46
+ type: frontend.type,
47
+ path: frontend.path,
48
+ selected: frontends.includes(frontend),
49
+ }));
50
+
30
51
  const body = {
31
- ...(realRelease ? getAuthReport(app) : undefined), // 如果发布需要上报权限,导出源码不需要
32
- noAuthApiPathList: getAuthApiPathList(app),
33
- reportIdList: findAllReportIdList(app),
52
+ ...authReport, // 如果发布需要上报权限,导出源码不需要
53
+ logicPageResourceDtoList,
54
+ noAuthApiPathList: getAuthApiPathList(app, frontends),
55
+ reportIdList: findAllReportIdList(app, frontends),
34
56
  appId: app.id,
35
57
  env,
36
58
  replicas,
59
+ callbackLogicsName: app.getExtensionsCallbackLogics(),
37
60
  generateMini,
61
+ frontends: releaseFrontends,
38
62
  files: [] as Array<{ name: string, content: string }>,
39
63
  };
40
64
  let NaslAnnotatedJSON;
@@ -45,7 +69,7 @@ export async function genReleaseBody(app: App, {
45
69
  throw new Error('代码标注失败');
46
70
  }
47
71
 
48
- let files = genBundleFiles(app, Object.assign({}, appInfo, {
72
+ let files = genFrontendBundleFiles(app, frontends, Object.assign({}, appInfo, {
49
73
  env,
50
74
  appid: app.id,
51
75
  devDnsAddr: (app as any).devDnsAddr,
@@ -76,11 +100,11 @@ export async function genReleaseBody(app: App, {
76
100
  /**
77
101
  * 权限上报数据
78
102
  */
79
- function getAuthReport(app: App) {
103
+ function getAuthReport(app: App, frontends: Array<Frontend>) {
80
104
  const result = {
81
105
  roleList: [] as Array<Role>,
82
106
  resourceList: [] as Array<string>,
83
- resourceDataList: [] as Array<{ value: string, description: string }>,
107
+ resourceDataList: [] as Array<{ value: string, description: string, type: 'page' | 'component' | 'logic', clientType?: string }>,
84
108
  roleResourceMappingList: [] as Array<{ roleName: string, resourcePath: string }>,
85
109
  };
86
110
 
@@ -91,12 +115,12 @@ function getAuthReport(app: App) {
91
115
  return authDirective?.value;
92
116
  };
93
117
 
94
- const loopViews = (view: View | ViewElement, isMain: boolean) => {
118
+ const loopViews = (view: View | ViewElement, isMain: boolean, frontend: Frontend) => {
95
119
  if (view.children) {
96
- view.children.forEach((item) => loopViews(item, false));
120
+ view.children.forEach((item) => loopViews(item, false, frontend));
97
121
  }
98
122
  if (view.concept === 'View' && view.elements) {
99
- view.elements.forEach((item) => loopViews(item, false));
123
+ view.elements.forEach((item) => loopViews(item, false, frontend));
100
124
  }
101
125
 
102
126
  if ((view.concept === 'View' && view.auth)
@@ -107,6 +131,8 @@ function getAuthReport(app: App) {
107
131
  result.resourceDataList.push({
108
132
  value: view.authPath,
109
133
  description: view.authDescription,
134
+ type: view.concept === 'View' ? 'page' : 'component',
135
+ clientType: frontend.name,
110
136
  });
111
137
  if (view.bindRoles) {
112
138
  const _arr = view.bindRoles.map((it) => ({
@@ -118,7 +144,9 @@ function getAuthReport(app: App) {
118
144
  }
119
145
  }
120
146
  };
121
- app.views.forEach((view) => loopViews(view, true));
147
+ frontends.forEach((frontend) => {
148
+ frontend.views.forEach((view) => loopViews(view, true, frontend));
149
+ });
122
150
 
123
151
  return result;
124
152
  }
@@ -127,8 +155,8 @@ function getAuthReport(app: App) {
127
155
  /**
128
156
  * 上报白名单
129
157
  */
130
- function getAuthApiPathList(app: App) {
131
- const thisDiffLogicList: Array<string> = [];
158
+ function getAuthApiPathList(app: App, frontends: Array<Frontend>) {
159
+ const thisDiffLogicList: Array<{logicName:string, frontendName: string}> = [];
132
160
 
133
161
  /* 转换Path */
134
162
  function getPathMethods(logicNameSpace: string) {
@@ -220,7 +248,7 @@ function getAuthApiPathList(app: App) {
220
248
  }
221
249
  }
222
250
  /* 获取LogicITEM */
223
- function getStatement(state: LogicItem) {
251
+ function getStatement(state: LogicItem, frontend: Frontend) {
224
252
  let logicItems: Array<LogicItem> = [];
225
253
  if (state instanceof Assignment) {
226
254
  logicItems = [state.left, state.right];
@@ -231,18 +259,18 @@ function getAuthApiPathList(app: App) {
231
259
  } else if (state instanceof ForEachStatement) {
232
260
  logicItems = [...state.body, state.each, state.start, state.end];
233
261
  } else if (state instanceof Match) {
234
- logicItems = state.cases.map(getStatement).flat(1);
262
+ logicItems = state.cases.map((case1) => getStatement(case1, frontend)).flat(1);
235
263
  } else if (state instanceof MatchCase) {
236
264
  logicItems = [...state.patterns as LogicItem[], ...state.body];
237
265
  } else if (state instanceof SwitchStatement) {
238
- logicItems = state.cases.map(getStatement).flat(1);
266
+ logicItems = state.cases.map((case1) => getStatement(case1, frontend)).flat(1);
239
267
  } else if (state instanceof SwitchCase) {
240
268
  logicItems = [state.test, ...state.consequent];
241
269
  } else if (state instanceof WhileStatement) {
242
270
  logicItems = [state.test, ...state.body];
243
271
  } else if (state instanceof CallLogic) {
244
272
  logicItems = state.arguments?.map((item) => item.expression);
245
- getLogic(state.calleewholeKey);
273
+ getLogic(state.calleewholeKey, frontend);
246
274
  } else if (state instanceof CallFunction) {
247
275
  logicItems = state.arguments?.map((item) => item.expression);
248
276
  } else if (state instanceof CallInterface) {
@@ -252,27 +280,27 @@ function getAuthApiPathList(app: App) {
252
280
  return logicItems.filter((item) => !!item);
253
281
  }
254
282
  /* 获取非鉴权全局逻辑 */
255
- function getLogic(key: string) {
256
- if (!thisDiffLogicList.includes(key)) {
257
- thisDiffLogicList.push(key);
283
+ function getLogic(key: string, frontend: Frontend) {
284
+ if (!thisDiffLogicList.find((diffLogic) => diffLogic.logicName === key && diffLogic.frontendName === frontend.name)) {
285
+ thisDiffLogicList.push({ logicName: key, frontendName: frontend.name });
258
286
  const logic: Logic = app.findNodeByCompleteName(key);
259
287
  if (logic && logic.body && logic.body.length > 2) {
260
- logic.body.map((item) => getStatement(item));
288
+ logic.body.map((item) => getStatement(item, frontend));
261
289
  }
262
290
  }
263
291
  }
264
292
 
265
293
  const importList: Array<string> = [];
266
- const itemloop = (state: LogicItem, view: View | ViewElement) => {
267
- const logicItems = getStatement(state);
294
+ const itemloop = (state: LogicItem, view: View | ViewElement, frontend: Frontend) => {
295
+ const logicItems = getStatement(state, frontend);
268
296
  if (logicItems.length) {
269
- logicItems.map((item) => itemloop(item, view));
297
+ logicItems.map((item) => itemloop(item, view, frontend));
270
298
  }
271
299
  };
272
300
 
273
- const loopEle = (view: View | ViewElement) => {
274
- view?.children?.forEach(loopEle);
275
- view.concept === 'View' && view?.elements?.forEach(loopEle);
301
+ const loopEle = (view: View | ViewElement, frontend: Frontend) => {
302
+ view?.children?.forEach((vitem) => loopEle(vitem, frontend));
303
+ view.concept === 'View' && view?.elements?.forEach((ele) => loopEle(ele, frontend));
276
304
  if (!view.parentAuth) {
277
305
  if (view.bindEvents) {
278
306
  view.bindEvents.forEach((item) => {
@@ -280,7 +308,7 @@ function getAuthApiPathList(app: App) {
280
308
  item.logics.forEach((logic) => {
281
309
  if (logic.body.length > 2) {
282
310
  logic.body.forEach((it) => {
283
- itemloop(it, view);
311
+ itemloop(it, view, frontend);
284
312
  });
285
313
  }
286
314
  });
@@ -295,14 +323,14 @@ function getAuthApiPathList(app: App) {
295
323
  }
296
324
  }
297
325
  };
298
- const loopViews = (view: View, isChild: boolean) => {
326
+ const loopViews = (view: View, isChild: boolean, frontend:Frontend) => {
299
327
  // 有权限的页面下的逻辑都不需要上报白名单
300
328
  if (!view.auth) {
301
329
  if (view.logics) {
302
330
  view.logics.forEach((logic) => {
303
331
  if (logic.body.length > 2) {
304
332
  logic.body.forEach((it) => {
305
- itemloop(it, view);
333
+ itemloop(it, view, frontend);
306
334
  });
307
335
  }
308
336
  });
@@ -313,7 +341,7 @@ function getAuthApiPathList(app: App) {
313
341
  item.logics.forEach((logic) => {
314
342
  if (logic.body.length > 2) {
315
343
  logic.body.forEach((it) => {
316
- itemloop(it, view);
344
+ itemloop(it, view, frontend);
317
345
  });
318
346
  }
319
347
  });
@@ -321,27 +349,35 @@ function getAuthApiPathList(app: App) {
321
349
  });
322
350
  }
323
351
 
324
- view.children.forEach((item) => loopViews(item, true));
352
+ view.children.forEach((item) => loopViews(item, true, frontend));
325
353
  }
326
354
  if (!isChild) {
327
- view.children.forEach(loopEle);
328
- view.elements.forEach(loopEle);
355
+ view.children.forEach((vitem) => loopEle(vitem, frontend));
356
+ view.elements.forEach((vele) => loopEle(vele, frontend));
329
357
  }
330
358
  };
331
- app.views.map((item) => loopViews(item, false));
359
+ frontends.forEach((frontend) => {
360
+ frontend.views.forEach((view) => loopViews(view, true, frontend));
361
+ });
332
362
 
333
- const diffLogicList = thisDiffLogicList.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
334
- const authApiList = [...diffLogicList.map(getPathMethods), ...Array.from(new Set(importList.map((item) => item + ':POST')))].filter((item) => !!item);
363
+ const diffLogicList = thisDiffLogicList.filter((item) => item.logicName.startsWith('app') || item.logicName.startsWith('extensions'));
364
+ const authApiList = [
365
+ ...diffLogicList.map((diffLogic) => {
366
+ const path = getPathMethods(diffLogic.logicName);
367
+ return `${path}:${diffLogic.frontendName}`;
368
+ }),
369
+ ...Array.from(new Set(importList.map((item) => item + ':POST'))),
370
+ ].filter((item) => !!item);
335
371
  return authApiList;
336
372
  }
337
373
 
338
374
  /**
339
375
  * 获取页面中所有 分析报告组件 的reportId
340
376
  */
341
- function findAllReportIdList(app: App) {
377
+ function findAllReportIdList(app: App, frontends: Array<Frontend>) {
342
378
  const reportIds: string[] = [];
343
- app?.views.forEach((view) => {
344
- loop(view);
379
+ frontends.forEach((frontend) => {
380
+ frontend.views.forEach((view) => loop(view));
345
381
  });
346
382
 
347
383
  function loop(root: View | ViewElement) {
@@ -4,3 +4,4 @@ export * from './styleReplacer';
4
4
  export * from './genBundleFiles';
5
5
  export * from './genMetaData';
6
6
  export * from './genReleaseBody';
7
+ export * from './permission';