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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/out/automate/engine/utils.js +1 -2
  2. package/out/automate/engine/utils.js.map +1 -1
  3. package/out/bak/translator.js +1 -1
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.js +7 -2
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/App__.js +6 -1
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +11 -5
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/AuthLogicForCallInterface__.js +3 -0
  12. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  13. package/out/concepts/BinaryExpression__.js +49 -2
  14. package/out/concepts/BinaryExpression__.js.map +1 -1
  15. package/out/concepts/BindAttribute__.d.ts +4 -3
  16. package/out/concepts/BindAttribute__.js +121 -42
  17. package/out/concepts/BindAttribute__.js.map +1 -1
  18. package/out/concepts/BindEvent__.js +5 -42
  19. package/out/concepts/BindEvent__.js.map +1 -1
  20. package/out/concepts/BusinessComponent__.d.ts +1 -0
  21. package/out/concepts/BusinessComponent__.js +16 -0
  22. package/out/concepts/BusinessComponent__.js.map +1 -1
  23. package/out/concepts/BusinessLogic__.js +3 -0
  24. package/out/concepts/BusinessLogic__.js.map +1 -1
  25. package/out/concepts/CallConnector__.js +1 -1
  26. package/out/concepts/CallConnector__.js.map +1 -1
  27. package/out/concepts/CallFunction__.js +1 -1
  28. package/out/concepts/CallFunction__.js.map +1 -1
  29. package/out/concepts/CallLogic__.d.ts +6 -1
  30. package/out/concepts/CallLogic__.js +58 -17
  31. package/out/concepts/CallLogic__.js.map +1 -1
  32. package/out/concepts/Connection__.d.ts +4 -0
  33. package/out/concepts/Connection__.js +15 -0
  34. package/out/concepts/Connection__.js.map +1 -1
  35. package/out/concepts/DatabaseTypeAnnotation__.d.ts +2 -0
  36. package/out/concepts/DatabaseTypeAnnotation__.js +20 -0
  37. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  38. package/out/concepts/End__.js +5 -1
  39. package/out/concepts/End__.js.map +1 -1
  40. package/out/concepts/EntityProperty__.js +2 -0
  41. package/out/concepts/EntityProperty__.js.map +1 -1
  42. package/out/concepts/Entity__.d.ts +1 -0
  43. package/out/concepts/Entity__.js +24 -1
  44. package/out/concepts/Entity__.js.map +1 -1
  45. package/out/concepts/EnumItem__.d.ts +12 -0
  46. package/out/concepts/EnumItem__.js +49 -5
  47. package/out/concepts/EnumItem__.js.map +1 -1
  48. package/out/concepts/Enum__.js +4 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/ForEachStatement__.js +1 -1
  51. package/out/concepts/ForEachStatement__.js.map +1 -1
  52. package/out/concepts/FrontendLibrary__.d.ts +46 -46
  53. package/out/concepts/FrontendLibrary__.js +34 -36
  54. package/out/concepts/FrontendLibrary__.js.map +1 -1
  55. package/out/concepts/I18nInfo__.d.ts +1 -0
  56. package/out/concepts/I18nInfo__.js +7 -0
  57. package/out/concepts/I18nInfo__.js.map +1 -1
  58. package/out/concepts/IfStatement__.js +2 -2
  59. package/out/concepts/IfStatement__.js.map +1 -1
  60. package/out/concepts/Interface__.js +4 -1
  61. package/out/concepts/Interface__.js.map +1 -1
  62. package/out/concepts/Logic__.d.ts +2 -3
  63. package/out/concepts/Logic__.js +33 -8
  64. package/out/concepts/Logic__.js.map +1 -1
  65. package/out/concepts/MatchCase__.d.ts +2 -2
  66. package/out/concepts/MatchCase__.js +7 -7
  67. package/out/concepts/MatchCase__.js.map +1 -1
  68. package/out/concepts/NewComposite__.js +2 -1
  69. package/out/concepts/NewComposite__.js.map +1 -1
  70. package/out/concepts/NewList__.js +2 -1
  71. package/out/concepts/NewList__.js.map +1 -1
  72. package/out/concepts/NewMap__.js +2 -1
  73. package/out/concepts/NewMap__.js.map +1 -1
  74. package/out/concepts/OqlQueryComponent__.js +3 -11
  75. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  76. package/out/concepts/OverriddenLogic__.js +7 -0
  77. package/out/concepts/OverriddenLogic__.js.map +1 -1
  78. package/out/concepts/Param__.js +2 -1
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElementV2__.d.ts +4 -5
  81. package/out/concepts/ProcessElementV2__.js +12 -17
  82. package/out/concepts/ProcessElementV2__.js.map +1 -1
  83. package/out/concepts/ProcessElement__.d.ts +3 -4
  84. package/out/concepts/ProcessElement__.js +44 -46
  85. package/out/concepts/ProcessElement__.js.map +1 -1
  86. package/out/concepts/ProcessV2__.d.ts +5 -0
  87. package/out/concepts/ProcessV2__.js +30 -2
  88. package/out/concepts/ProcessV2__.js.map +1 -1
  89. package/out/concepts/Process__.d.ts +5 -0
  90. package/out/concepts/Process__.js +28 -0
  91. package/out/concepts/Process__.js.map +1 -1
  92. package/out/concepts/QueryFromExpression__.js +2 -2
  93. package/out/concepts/QueryFromExpression__.js.map +1 -1
  94. package/out/concepts/QueryJoinExpression__.js +2 -2
  95. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  96. package/out/concepts/Return__.d.ts +1 -1
  97. package/out/concepts/Return__.js +2 -1
  98. package/out/concepts/Return__.js.map +1 -1
  99. package/out/concepts/StaticString__.d.ts +4 -0
  100. package/out/concepts/StaticString__.js +11 -0
  101. package/out/concepts/StaticString__.js.map +1 -1
  102. package/out/concepts/StructureProperty__.js +5 -2
  103. package/out/concepts/StructureProperty__.js.map +1 -1
  104. package/out/concepts/Structure__.js +9 -3
  105. package/out/concepts/Structure__.js.map +1 -1
  106. package/out/concepts/SubLogic__.d.ts +1 -3
  107. package/out/concepts/SubLogic__.js +14 -8
  108. package/out/concepts/SubLogic__.js.map +1 -1
  109. package/out/concepts/Transactional__.d.ts +1 -0
  110. package/out/concepts/Transactional__.js +7 -0
  111. package/out/concepts/Transactional__.js.map +1 -1
  112. package/out/concepts/TypeParam__.d.ts +4 -0
  113. package/out/concepts/TypeParam__.js +3 -0
  114. package/out/concepts/TypeParam__.js.map +1 -1
  115. package/out/concepts/ValidationRule__.d.ts +1 -6
  116. package/out/concepts/ValidationRule__.js +9 -6
  117. package/out/concepts/ValidationRule__.js.map +1 -1
  118. package/out/concepts/Variable__.d.ts +1 -1
  119. package/out/concepts/Variable__.js +7 -2
  120. package/out/concepts/Variable__.js.map +1 -1
  121. package/out/concepts/ViewElement__.d.ts +2 -0
  122. package/out/concepts/ViewElement__.js +130 -47
  123. package/out/concepts/ViewElement__.js.map +1 -1
  124. package/out/concepts/View__.d.ts +8 -0
  125. package/out/concepts/View__.js +123 -7
  126. package/out/concepts/View__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/nasl.processV2.js +2 -2
  128. package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.ui.js +1 -1
  130. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  131. package/out/concepts/basics/stdlib/nasl.validation.js +110 -4
  132. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  133. package/out/generator/genBundleFiles.d.ts +2 -0
  134. package/out/generator/genBundleFiles.js +51 -37
  135. package/out/generator/genBundleFiles.js.map +1 -1
  136. package/out/generator/genMetaData.js +20 -26
  137. package/out/generator/genMetaData.js.map +1 -1
  138. package/out/generator/release-body/body.js +8 -6
  139. package/out/generator/release-body/body.js.map +1 -1
  140. package/out/generator/release-body/index.d.ts +1 -0
  141. package/out/generator/release-body/index.js +1 -0
  142. package/out/generator/release-body/index.js.map +1 -1
  143. package/out/generator/release-body/utils.js +1 -1
  144. package/out/generator/release-body/utils.js.map +1 -1
  145. package/out/natural/genNaturalTS.d.ts +56 -24
  146. package/out/natural/genNaturalTS.js +182 -112
  147. package/out/natural/genNaturalTS.js.map +1 -1
  148. package/out/natural/getContext/getUILib.js +4 -2
  149. package/out/natural/getContext/getUILib.js.map +1 -1
  150. package/out/natural/getContext/index.d.ts +34 -25
  151. package/out/natural/getContext/index.js +304 -157
  152. package/out/natural/getContext/index.js.map +1 -1
  153. package/out/natural/index.d.ts +1 -0
  154. package/out/natural/index.js +1 -0
  155. package/out/natural/index.js.map +1 -1
  156. package/out/natural/tools.d.ts +11 -0
  157. package/out/natural/tools.js +155 -0
  158. package/out/natural/tools.js.map +1 -0
  159. package/out/natural/transformTS2UI.js +84 -22
  160. package/out/natural/transformTS2UI.js.map +1 -1
  161. package/out/natural/transformTSCode.js +83 -22
  162. package/out/natural/transformTSCode.js.map +1 -1
  163. package/out/server/formatTsUtils.js +17 -1
  164. package/out/server/formatTsUtils.js.map +1 -1
  165. package/out/server/getLogics.js +1 -4
  166. package/out/server/getLogics.js.map +1 -1
  167. package/out/server/naslServer.js +285 -32
  168. package/out/server/naslServer.js.map +1 -1
  169. package/out/server/translator.js +5 -1
  170. package/out/server/translator.js.map +1 -1
  171. package/out/templator/genCreateBlock.js +5 -18
  172. package/out/templator/genCreateBlock.js.map +1 -1
  173. package/out/templator/genCurdMultipleKeyBlock.js +11 -32
  174. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  175. package/out/templator/genGetBlock.js +1 -2
  176. package/out/templator/genGetBlock.js.map +1 -1
  177. package/out/templator/genListViewBlock.js +6 -4
  178. package/out/templator/genListViewBlock.js.map +1 -1
  179. package/out/templator/genSelectBlock.js +82 -59
  180. package/out/templator/genSelectBlock.js.map +1 -1
  181. package/out/templator/genTableBlock.js +4 -4
  182. package/out/templator/genTableBlock.js.map +1 -1
  183. package/out/templator/genUpdateBlock.js +2 -15
  184. package/out/templator/genUpdateBlock.js.map +1 -1
  185. package/out/templator/utils.d.ts +1 -1
  186. package/out/templator/utils.js +1 -1
  187. package/out/templator/utils.js.map +1 -1
  188. package/out/translator/types.d.ts +4 -0
  189. package/out/translator/utils.d.ts +1 -0
  190. package/out/translator/utils.js +6 -1
  191. package/out/translator/utils.js.map +1 -1
  192. package/out/utils/env.d.ts +4 -0
  193. package/out/utils/env.js +6 -3
  194. package/out/utils/env.js.map +1 -1
  195. package/out/utils/index.d.ts +19 -0
  196. package/out/utils/index.js +61 -1
  197. package/out/utils/index.js.map +1 -1
  198. package/out/utils/language-cache/constant.d.ts +18 -0
  199. package/out/utils/language-cache/constant.js +35 -0
  200. package/out/utils/language-cache/constant.js.map +1 -0
  201. package/out/utils/language-cache/index.d.ts +2 -0
  202. package/out/utils/language-cache/index.js +19 -0
  203. package/out/utils/language-cache/index.js.map +1 -0
  204. package/out/utils/language-cache/nasl.d.ts +10 -0
  205. package/out/utils/language-cache/nasl.js +98 -0
  206. package/out/utils/language-cache/nasl.js.map +1 -0
  207. package/out/utils/language-cache/types.d.ts +44 -0
  208. package/out/utils/language-cache/types.js +4 -0
  209. package/out/utils/language-cache/types.js.map +1 -0
  210. package/out/utils/time-slicing/controller.js.map +1 -1
  211. package/out/utils/types.d.ts +17 -0
  212. package/package.json +3 -2
  213. package/sandbox/stdlib/nasl.core.ts +15 -11
  214. package/sandbox/stdlib/nasl.oql.ts +5 -1
  215. package/sandbox/stdlib/nasl.processV2.ts +5 -4
  216. package/sandbox/stdlib/nasl.ui.components.pc.ts +225 -225
  217. package/sandbox/stdlib/nasl.ui.ts +10 -0
  218. package/sandbox/stdlib/nasl.util.ts +11 -0
  219. package/sandbox/stdlib/nasl.validation.ts +3 -2
  220. package/sandbox-natural/stdlib/nasl.ui.pre.d.ts +1 -1
  221. package/sandbox-natural/stdlib/nasl.ui.ts +2 -2
  222. package/sandbox-natural/stdlib/nasl.util.ts +2 -2
  223. package/src/automate/engine/utils.js +1 -2
  224. package/src/bak/translator.js +1 -1
  225. package/src/common/BaseNode.ts +7 -3
  226. package/src/concepts/App__.ts +9 -1
  227. package/src/concepts/Argument__.ts +10 -5
  228. package/src/concepts/AuthLogicForCallInterface__.ts +3 -0
  229. package/src/concepts/BinaryExpression__.ts +46 -2
  230. package/src/concepts/BindAttribute__.ts +144 -46
  231. package/src/concepts/BindEvent__.ts +8 -47
  232. package/src/concepts/BusinessComponent__.ts +17 -0
  233. package/src/concepts/BusinessLogic__.ts +3 -0
  234. package/src/concepts/CallConnector__.ts +1 -1
  235. package/src/concepts/CallFunction__.ts +1 -1
  236. package/src/concepts/CallLogic__.ts +63 -17
  237. package/src/concepts/Connection__.ts +16 -0
  238. package/src/concepts/DatabaseTypeAnnotation__.ts +11 -0
  239. package/src/concepts/End__.ts +5 -1
  240. package/src/concepts/EntityProperty__.ts +5 -0
  241. package/src/concepts/Entity__.ts +29 -1
  242. package/src/concepts/EnumItem__.ts +64 -1
  243. package/src/concepts/Enum__.ts +6 -1
  244. package/src/concepts/ForEachStatement__.ts +1 -1
  245. package/src/concepts/FrontendLibrary__.ts +78 -80
  246. package/src/concepts/I18nInfo__.ts +5 -0
  247. package/src/concepts/IfStatement__.ts +2 -2
  248. package/src/concepts/Interface__.ts +6 -1
  249. package/src/concepts/Logic__.ts +39 -10
  250. package/src/concepts/MatchCase__.ts +8 -9
  251. package/src/concepts/NewComposite__.ts +2 -1
  252. package/src/concepts/NewList__.ts +2 -1
  253. package/src/concepts/NewMap__.ts +2 -1
  254. package/src/concepts/OqlQueryComponent__.ts +3 -11
  255. package/src/concepts/OverriddenLogic__.ts +7 -0
  256. package/src/concepts/Param__.ts +1 -0
  257. package/src/concepts/ProcessElementV2__.ts +14 -16
  258. package/src/concepts/ProcessElement__.ts +16 -16
  259. package/src/concepts/ProcessV2__.ts +39 -3
  260. package/src/concepts/Process__.ts +36 -0
  261. package/src/concepts/QueryFromExpression__.ts +2 -2
  262. package/src/concepts/QueryJoinExpression__.ts +2 -2
  263. package/src/concepts/Return__.ts +2 -1
  264. package/src/concepts/StaticString__.ts +12 -0
  265. package/src/concepts/StructureProperty__.ts +7 -2
  266. package/src/concepts/Structure__.ts +11 -3
  267. package/src/concepts/SubLogic__.ts +15 -9
  268. package/src/concepts/Transactional__.ts +5 -0
  269. package/src/concepts/TypeParam__.ts +6 -0
  270. package/src/concepts/ValidationRule__.ts +7 -6
  271. package/src/concepts/Variable__.ts +7 -2
  272. package/src/concepts/ViewElement__.ts +130 -47
  273. package/src/concepts/View__.ts +157 -8
  274. package/src/concepts/basics/stdlib/nasl.processV2.ts +2 -2
  275. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -1
  276. package/src/concepts/basics/stdlib/nasl.validation.ts +111 -4
  277. package/src/generator/genBundleFiles.ts +53 -39
  278. package/src/generator/genMetaData.ts +21 -26
  279. package/src/generator/release-body/body.ts +9 -6
  280. package/src/generator/release-body/index.ts +1 -0
  281. package/src/generator/release-body/utils.ts +4 -2
  282. package/src/natural/genNaturalTS.ts +327 -141
  283. package/src/natural/getContext/getUILib.ts +4 -2
  284. package/src/natural/getContext/index.ts +348 -171
  285. package/src/natural/index.ts +1 -0
  286. package/src/natural/tools.ts +130 -0
  287. package/src/natural/transformTS2UI.ts +84 -22
  288. package/src/natural/transformTSCode.ts +83 -22
  289. package/src/server/formatTsUtils.ts +21 -1
  290. package/src/server/getLogics.ts +1 -4
  291. package/src/server/naslServer.ts +302 -33
  292. package/src/server/translator.ts +5 -1
  293. package/src/templator/genCreateBlock.ts +5 -18
  294. package/src/templator/genCurdMultipleKeyBlock.ts +14 -32
  295. package/src/templator/genGetBlock.ts +2 -4
  296. package/src/templator/genListViewBlock.ts +6 -4
  297. package/src/templator/genSelectBlock.ts +88 -61
  298. package/src/templator/genTableBlock.ts +4 -4
  299. package/src/templator/genUpdateBlock.ts +2 -15
  300. package/src/templator/utils.ts +1 -1
  301. package/src/translator/types.ts +4 -0
  302. package/src/translator/utils.ts +6 -0
  303. package/src/utils/env.ts +5 -4
  304. package/src/utils/index.ts +50 -1
  305. package/src/utils/language-cache/constant.ts +37 -0
  306. package/src/utils/language-cache/index.ts +2 -0
  307. package/src/utils/language-cache/nasl.ts +83 -0
  308. package/src/utils/language-cache/types.ts +48 -0
  309. package/src/utils/time-slicing/controller.ts +0 -1
  310. package/src/utils/types.ts +20 -0
  311. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +13 -13
  312. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +12 -12
  313. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -2
  314. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +221 -217
  315. package/ts-worker/bundle.js +1 -1
  316. package/ts-worker/src/index.js +0 -1
  317. package/out/utils/delay/index.d.ts +0 -0
  318. package/out/utils/delay/index.js +0 -1
  319. package/out/utils/delay/index.js.map +0 -1
  320. package/src/utils/delay/index.ts +0 -0
@@ -14,6 +14,11 @@ export function initialize() {
14
14
  const Param = getConceptConstructor('Param');
15
15
  const Return = getConceptConstructor('Return');
16
16
  const Function = getConceptConstructor('Function');
17
+ const DefaultValue = getConceptConstructor('DefaultValue');
18
+ const BooleanLiteral = getConceptConstructor('BooleanLiteral');
19
+ const NumericLiteral = getConceptConstructor('NumericLiteral');
20
+ const StringLiteral = getConceptConstructor('StringLiteral');
21
+ const NewList = getConceptConstructor('NewList');
17
22
 
18
23
  const genEmptyParamFunction = function (name: string) {
19
24
  return new Function({
@@ -39,6 +44,9 @@ export function initialize() {
39
44
  name: 'min',
40
45
  typeAnnotation: TypeAnnotation.createPrimitive('Long'),
41
46
  required: true,
47
+ defaultValue: new DefaultValue({
48
+ expression: new NumericLiteral({ value: '0' })
49
+ })
42
50
  }),
43
51
  ],
44
52
  returns: [
@@ -54,6 +62,9 @@ export function initialize() {
54
62
  name: 'max',
55
63
  typeAnnotation: TypeAnnotation.createPrimitive('Long'),
56
64
  required: true,
65
+ defaultValue: new DefaultValue({
66
+ expression: new NumericLiteral({ value: '0' })
67
+ })
57
68
  }),
58
69
  ],
59
70
  returns: [
@@ -69,11 +80,17 @@ export function initialize() {
69
80
  name: 'min',
70
81
  typeAnnotation: TypeAnnotation.createPrimitive('Long'),
71
82
  required: true,
83
+ defaultValue: new DefaultValue({
84
+ expression: new NumericLiteral({ value: '0' })
85
+ })
72
86
  }),
73
87
  new Param({
74
88
  name: 'max',
75
89
  typeAnnotation: TypeAnnotation.createPrimitive('Long'),
76
90
  required: true,
91
+ defaultValue: new DefaultValue({
92
+ expression: new NumericLiteral({ value: '0' })
93
+ })
77
94
  }),
78
95
  ],
79
96
  returns: [
@@ -89,6 +106,9 @@ export function initialize() {
89
106
  name: 'min',
90
107
  typeAnnotation: TypeAnnotation.createPrimitive('Decimal'),
91
108
  required: true,
109
+ defaultValue: new DefaultValue({
110
+ expression: new NumericLiteral({ value: '0' })
111
+ })
92
112
  }),
93
113
  ],
94
114
  returns: [
@@ -104,6 +124,9 @@ export function initialize() {
104
124
  name: 'max',
105
125
  typeAnnotation: TypeAnnotation.createPrimitive('Decimal'),
106
126
  required: true,
127
+ defaultValue: new DefaultValue({
128
+ expression: new NumericLiteral({ value: '0' })
129
+ })
107
130
  }),
108
131
  ],
109
132
  returns: [
@@ -119,11 +142,17 @@ export function initialize() {
119
142
  name: 'min',
120
143
  typeAnnotation: TypeAnnotation.createPrimitive('Decimal'),
121
144
  required: true,
145
+ defaultValue: new DefaultValue({
146
+ expression: new NumericLiteral({ value: '0' })
147
+ })
122
148
  }),
123
149
  new Param({
124
150
  name: 'max',
125
151
  typeAnnotation: TypeAnnotation.createPrimitive('Decimal'),
126
152
  required: true,
153
+ defaultValue: new DefaultValue({
154
+ expression: new NumericLiteral({ value: '0' })
155
+ })
127
156
  }),
128
157
  ],
129
158
  returns: [
@@ -140,6 +169,22 @@ export function initialize() {
140
169
  typeAnnotation: TypeAnnotation.createPrimitive('String'),
141
170
  required: true,
142
171
  }),
172
+ new Param({
173
+ name: 'strict',
174
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
175
+ required: true,
176
+ defaultValue: new DefaultValue({
177
+ expression: new BooleanLiteral({ value: 'true' })
178
+ }),
179
+ }),
180
+ new Param({
181
+ name: 'matchCase',
182
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
183
+ required: true,
184
+ defaultValue: new DefaultValue({
185
+ expression: new BooleanLiteral({ value: 'true' })
186
+ }),
187
+ }),
143
188
  ],
144
189
  returns: [
145
190
  new Return({
@@ -230,6 +275,9 @@ export function initialize() {
230
275
  typeAnnotation: TypeAnnotation.createGeneric('List', {
231
276
  typeArguments: [TypeAnnotation.createPrimitive('Any')],
232
277
  }),
278
+ defaultValue: new DefaultValue({
279
+ expression: new NewList({ items: [] })
280
+ }),
233
281
  required: true,
234
282
  }),
235
283
  ],
@@ -247,6 +295,9 @@ export function initialize() {
247
295
  typeAnnotation: TypeAnnotation.createGeneric('List', {
248
296
  typeArguments: [TypeAnnotation.createPrimitive('Any')],
249
297
  }),
298
+ defaultValue: new DefaultValue({
299
+ expression: new NewList({ items: [] })
300
+ }),
250
301
  required: true,
251
302
  }),
252
303
  ],
@@ -264,6 +315,9 @@ export function initialize() {
264
315
  typeAnnotation: TypeAnnotation.createGeneric('List', {
265
316
  typeArguments: [TypeAnnotation.createPrimitive('Any')],
266
317
  }),
318
+ defaultValue: new DefaultValue({
319
+ expression: new NewList({ items: [] })
320
+ }),
267
321
  required: true,
268
322
  }),
269
323
  ],
@@ -281,6 +335,9 @@ export function initialize() {
281
335
  typeAnnotation: TypeAnnotation.createGeneric('List', {
282
336
  typeArguments: [TypeAnnotation.createPrimitive('Any')],
283
337
  }),
338
+ defaultValue: new DefaultValue({
339
+ expression: new NewList({ items: [] })
340
+ }),
284
341
  required: true,
285
342
  }),
286
343
  ],
@@ -344,7 +401,7 @@ export function initialize() {
344
401
  }),
345
402
  new Param({
346
403
  name: 'digits',
347
- typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
404
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
348
405
  required: false,
349
406
  }),
350
407
  ],
@@ -474,9 +531,53 @@ export function initialize() {
474
531
  }),
475
532
  genEmptyParamFunction('hexColor'),
476
533
  genEmptyParamFunction('hex'),
477
- genEmptyParamFunction('creditCard'),
478
534
  genEmptyParamFunction('fqdn'),
479
535
  genEmptyParamFunction('ipOrFQDN'),
536
+ new Function({
537
+ name: 'creditCard',
538
+ params: [
539
+ new Param({
540
+ name: 'types',
541
+ required: true,
542
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
543
+ typeArguments: [TypeAnnotation.createPrimitive('String')],
544
+ }),
545
+ defaultValue: new DefaultValue({
546
+ expression: new NewList({
547
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
548
+ typeArguments: [TypeAnnotation.createPrimitive('String')],
549
+ }),
550
+ items: [
551
+ new StringLiteral({ value: "UnionPay" })
552
+ ]
553
+ }),
554
+
555
+ }),
556
+ useComponent: { type: 's-bidirectional-bind-switch' },
557
+ // defaultExpression: new NewList({
558
+ // // name: 'creditCardTypesDefaultExpression',
559
+ // name:"GetSpecificDaysOfWeekTargetDefaultExpression",
560
+ // typeAnnotation: TypeAnnotation.createGeneric('List', {
561
+ // typeArguments: [TypeAnnotation.createPrimitive('String')],
562
+ // }),
563
+ // }),
564
+ options: [
565
+ { text: '银联', value: 'UnionPay' },
566
+ { text: '维萨', value: 'Visa' },
567
+ { text: '万事达', value: 'Mastercard' },
568
+ { text: '美国运通', value: 'AMEX' },
569
+ { text: '吉士美', value: 'JCB' },
570
+ { text: '发现', value: 'Discover' },
571
+ { text: '大来', value: 'DinersClub' },
572
+ ],
573
+ }),
574
+ ],
575
+ returns: [
576
+ new Return({
577
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
578
+ }),
579
+ ],
580
+ }),
480
581
  new Function({
481
582
  name: 'isbn',
482
583
  params: [
@@ -520,12 +621,18 @@ export function initialize() {
520
621
  new Param({
521
622
  name: 'locale',
522
623
  typeAnnotation: TypeAnnotation.createPrimitive('String'),
523
- required: false,
624
+ required: true,
625
+ defaultValue: new DefaultValue({
626
+ expression: new StringLiteral({ value: "zh-CN" })
627
+ })
524
628
  }),
525
629
  new Param({
526
630
  name: 'strict',
527
631
  typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
528
- required: false,
632
+ required: true,
633
+ defaultValue: new DefaultValue({
634
+ expression: new BooleanLiteral({ value: 'false' })
635
+ }),
529
636
  }),
530
637
  ],
531
638
  returns: [
@@ -40,6 +40,8 @@ interface Config {
40
40
  tenantLevel: any;
41
41
  appid: string;
42
42
  isExport?:string;
43
+ sysPrefixPath?:string;
44
+ realRelease?:string;
43
45
  devDnsAddr: string;
44
46
  miniEnable: boolean;
45
47
  isPreviewFe?: boolean;
@@ -113,7 +115,7 @@ function genExportComponetCode(component: RawOptions) {
113
115
 
114
116
  // 获取文件路径
115
117
  // name 或者 文件 至少有一个必填
116
- const getCompletePath = (name: string, fileContent: string) => {
118
+ const getCompletePath = (name: string, fileContent: string,config?:any) => {
117
119
  let fileName = '';
118
120
  if (name) {
119
121
  fileName += `${name}.`;
@@ -122,6 +124,9 @@ const getCompletePath = (name: string, fileContent: string) => {
122
124
  fileName += `${genHash(fileContent)}.`;
123
125
  }
124
126
  fileName += `min.js`;
127
+ if(config?.isExport){
128
+ fileName =`${config.sysPrefixPath}/${fileName}`
129
+ }
125
130
 
126
131
  return fileName;
127
132
  };
@@ -167,14 +172,14 @@ function genRouterFileContent(routes: Route[], defaultRoute: string) {
167
172
  }
168
173
 
169
174
  // 生成路由文件
170
- function genRouteFiles(routes: Route[], defaultRoute: string) {
175
+ function genRouteFiles(routes: Route[], defaultRoute: string,config?: any) {
171
176
  // 生成路由文件列表
172
177
  const routeFiles: any[] = [];
173
178
  function routeToFile(route: Route) {
174
179
  console.log(route, 'route');
175
180
  if (route?.component?.script) {
176
181
  const content = genExportComponetCode(route.component);
177
- const lazyPath = getCompletePath(null, content);
182
+ const lazyPath = getCompletePath(null, content, config);
178
183
  route.lazyPath = lazyPath;
179
184
  routeFiles.push({
180
185
  name: lazyPath,
@@ -189,7 +194,7 @@ function genRouteFiles(routes: Route[], defaultRoute: string) {
189
194
  routeToFile(route);
190
195
  });
191
196
 
192
- let routerPath = getCompletePath('router', null);
197
+ let routerPath = getCompletePath('router', null, config);
193
198
 
194
199
  routeFiles.push({
195
200
  name: routerPath,
@@ -199,6 +204,7 @@ function genRouteFiles(routes: Route[], defaultRoute: string) {
199
204
  return routeFiles;
200
205
  }
201
206
  export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
207
+ config.sysPrefixPath = app?.sysPrefixPath
202
208
  // 获取端类型
203
209
  const frontendType = frontend.getAncestor('FrontendType') as FrontendType;
204
210
  // 获取业务组件
@@ -234,7 +240,8 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
234
240
  (current) => {
235
241
  if (current.node.toVueOptions) {
236
242
  componentMap[current.node.id] = current.node.toVueOptions({
237
- isExport: !!config.isExport
243
+ isExport: !!config.isExport,
244
+ isRelease: !!config.realRelease,
238
245
  });
239
246
  }
240
247
  },
@@ -269,6 +276,7 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
269
276
  baseUrl = '';
270
277
  // basePath = '';
271
278
  }
279
+ // todo
272
280
  let completePath = `${baseUrl}${basePath || ''}/`;
273
281
 
274
282
  /**
@@ -381,7 +389,7 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
381
389
  }
382
390
  const authResourcePaths: string[] = Object.keys(authResourcePathMap);
383
391
 
384
- const routerFiles = genRouteFiles(routes, defaultRoute);
392
+ const routerFiles = genRouteFiles(routes, defaultRoute, config);
385
393
  routerFiles.forEach(item => {
386
394
  item.name = completePath + item.name;
387
395
  // 在路由文件上存入端的信息,后续页面维度发布时候做标识
@@ -549,7 +557,6 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
549
557
  }
550
558
  `;
551
559
  }
552
-
553
560
  if (frontend.documentIcon) {
554
561
  content += `{
555
562
  const link = document.createElement('link');
@@ -625,7 +632,7 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
625
632
  return importXMLHttpRequestComponent(scriptUrl);
626
633
  }
627
634
 
628
- var routes = await importComponent('${getCompletePath('router', null)}?t=' + Date.now());
635
+ var routes = await importComponent('${getCompletePath('router', null, config)}?t=' + Date.now());
629
636
  `;
630
637
  // 按页面维度发布先不考虑鉴权,页面维度新增的页面都算是不鉴权的数组中
631
638
  // 只有完全页面维度新增的才会进入到这个数组中
@@ -841,9 +848,9 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
841
848
  if (window.annotationAllData) {
842
849
  resolve(window.annotationAllData);
843
850
  } else {
844
- let urlEntity = '/api/system/annotation/entityAll'
845
- let urlLogic = '/api/system/annotation/logicAll'
846
- Promise.all([
851
+ let urlEntity = window.appInfo.sysPrefixPath + '/api/system/annotation/entityAll'
852
+ let urlLogic = window.appInfo.sysPrefixPath + '/api/system/annotation/logicAll'
853
+ Promise.all([
847
854
  fetch(urlEntity).then(response => response.json()),
848
855
  fetch(urlLogic).then(response => response.json())
849
856
  ])
@@ -868,7 +875,8 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
868
875
 
869
876
 
870
877
  console.time('genHash')
871
- let bundleMinPath = completePath + getCompletePath(getBundleFileName(), content);
878
+ // todo
879
+ let bundleMinPath = completePath + getCompletePath(getBundleFileName(), content, config);
872
880
  console.timeEnd('genHash');
873
881
 
874
882
  const otherJsList = (frontend as any)?.appletsConfig?.enable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
@@ -995,33 +1003,6 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
995
1003
  ${microAppIntegration || 'loadAssets();'}
996
1004
  })()
997
1005
  `;
998
- const assets = config.assets;
999
- // 导出源码才处理
1000
- if (config.isExport && Array.isArray(assets) && assets.length) {
1001
- const assetsMap = config.assetsMap;
1002
- const regex = new RegExp(assets.map((asset) => asset.fileUrl?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
1003
- content = content.replace(regex, (url) => {
1004
- const asset = assetsMap.get(url);
1005
- if (asset) {
1006
- const basePath = frontend?.basePath;
1007
- const assetName = encodeURIComponent(asset.name);
1008
- const assetDir = basePath ? `${basePath}/assets/${assetName}` : `/assets/${assetName}`;
1009
- let path = assetDir;
1010
- const sysPrefixPath = frontend?.app?.sysPrefixPath;
1011
- if (sysPrefixPath) {
1012
- path = `${sysPrefixPath}${assetDir}`;
1013
- }
1014
- globalConfig.assets.push({
1015
- path: assetDir,
1016
- isDir: false,
1017
- url,
1018
- });
1019
- return path;
1020
- }
1021
- return url;
1022
- });
1023
- }
1024
-
1025
1006
  const outputs = [
1026
1007
  {
1027
1008
  name: bundleMinPath,
@@ -1033,6 +1014,39 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
1033
1014
  },
1034
1015
  ...routerFiles,
1035
1016
  ];
1017
+ const assets = config.assets;
1018
+ // 导出源码才处理
1019
+ if (config.isExport && Array.isArray(assets) && assets.length) {
1020
+ function replaceContentFilePath(content: string) {
1021
+ const assetsMap = config.assetsMap;
1022
+ // 正则
1023
+ const regex = utils.transAssetsToRegx(assets, 'fileUrl');
1024
+ content = content.replace(regex, (url) => {
1025
+ const asset: Asset = utils.getAssetFromAssetsMap(assetsMap, url);
1026
+ if (asset) {
1027
+ const basePath = frontend?.basePath;
1028
+ const assetName = encodeURIComponent(asset.name);
1029
+ const assetDir = basePath ? `${basePath}/assets/${assetName}` : `/assets/${assetName}`;
1030
+ let path = assetDir;
1031
+ const sysPrefixPath = frontend?.app?.sysPrefixPath;
1032
+ if (sysPrefixPath) {
1033
+ path = `${sysPrefixPath}${assetDir}`;
1034
+ }
1035
+ globalConfig.assets.push({
1036
+ path: assetDir,
1037
+ isDir: false,
1038
+ url,
1039
+ });
1040
+ return path;
1041
+ }
1042
+ return url;
1043
+ });
1044
+ return content;
1045
+ }
1046
+ outputs.forEach((output) => {
1047
+ output.content = replaceContentFilePath(output.content || '');
1048
+ })
1049
+ }
1036
1050
  console.log('outputs', outputs)
1037
1051
  return outputs;
1038
1052
  }
@@ -192,31 +192,11 @@ export function genMetaData(app: App, frontend: Frontend, config: any) {
192
192
  item.value = typeName === 'Long' && typeNamespace === 'nasl.core' ? +item.value : item.value
193
193
  })
194
194
  }
195
-
195
+
196
196
  const nodeJson = newNode.toJSON?.();
197
- if (Array.isArray(nodeJson.properties)) {
198
- const app = node.getAncestor('App') as App
199
- nodeJson.properties.forEach((property: any) => {
200
- const { typeAnnotation = {} } = property;
201
- if (typeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
202
- let originType = {} as TypeAnnotation
203
- if (typeAnnotation.typeNamespace === 'app.metadataTypes') {
204
- originType = app.metadataTypes?.find((metadataType: MetadataType) => metadataType.name === typeAnnotation.typeName)?.typeAnnotation;
205
- } else if (typeAnnotation.typeNamespace?.startsWith('extensions.') && typeAnnotation.typeNamespace?.endsWith('.metadataTypes')) {
206
- const dependencyName = typeAnnotation.typeNamespace?.replace('extensions.', '').replace('.metadataTypes', '')
207
- originType = app.dependencies?.find((dependency: Module) => dependency.name === dependencyName)?.metadataTypes?.find((ele: MetadataType) => ele.name === typeAnnotation.typeName)?.typeAnnotation ?? {} as TypeAnnotation
208
- }
209
- typeAnnotation.typeKind = 'primitive'
210
- typeAnnotation.typeNamespace = 'nasl.core'
211
- typeAnnotation.typeName = originType.typeName
212
- }
213
- });
214
- }
215
- dataTypesMap[id] = nodeJson;
216
197
  // 对存在defaultValue的结构进行翻译储存到defaultCode中
217
198
  if (['Entity', 'Structure'].includes(node.concept)) {
218
- newNode = node.toJSON?.();
219
- newNode.properties.forEach((property: any, index: number) => {
199
+ nodeJson.properties.forEach((property: any, index: number) => {
220
200
  const { defaultValue } = (node as Entity).properties[index];
221
201
  if (defaultValue?.expression) {
222
202
  property.defaultCode = {
@@ -235,11 +215,26 @@ export function genMetaData(app: App, frontend: Frontend, config: any) {
235
215
  property.defaultCode = {};
236
216
  }
237
217
  });
238
- dataTypesMap[id] = newNode;
239
- newNode = BaseNode.from({ ...node.toJSON?.() });
240
- } else {
241
- dataTypesMap[id] = newNode.toJSON?.();
242
218
  }
219
+ if (Array.isArray(nodeJson.properties)) {
220
+ const app = node.getAncestor('App') as App
221
+ nodeJson.properties.forEach((property: any) => {
222
+ const { typeAnnotation = {} } = property;
223
+ if (typeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
224
+ let originType = {} as TypeAnnotation
225
+ if (typeAnnotation.typeNamespace === 'app.metadataTypes') {
226
+ originType = app.metadataTypes?.find((metadataType: MetadataType) => metadataType.name === typeAnnotation.typeName)?.typeAnnotation;
227
+ } else if (typeAnnotation.typeNamespace?.startsWith('extensions.') && typeAnnotation.typeNamespace?.endsWith('.metadataTypes')) {
228
+ const dependencyName = typeAnnotation.typeNamespace?.replace('extensions.', '').replace('.metadataTypes', '')
229
+ originType = app.dependencies?.find((dependency: Module) => dependency.name === dependencyName)?.metadataTypes?.find((ele: MetadataType) => ele.name === typeAnnotation.typeName)?.typeAnnotation ?? {} as TypeAnnotation
230
+ }
231
+ typeAnnotation.typeKind = 'primitive'
232
+ typeAnnotation.typeNamespace = 'nasl.core'
233
+ typeAnnotation.typeName = originType.typeName
234
+ }
235
+ });
236
+ }
237
+ dataTypesMap[id] = nodeJson;
243
238
  const { properties } = node as any;
244
239
  if (Array.isArray(properties)) {
245
240
  properties.forEach((property) => {
@@ -11,6 +11,7 @@ import { getCallLogicData } from './validation';
11
11
 
12
12
  import * as utils from '../../utils';
13
13
  import { config as globalConfig } from '../../config'
14
+ import type { Asset } from '../release-body/internal';
14
15
 
15
16
  /**
16
17
  * 替换端类型中的资源
@@ -74,11 +75,12 @@ async function getNaslAnnotatedJSON(app: App, opt: InternalReleaseData) {
74
75
  // 导出前端源码+后端源码
75
76
  if (opt.isExport && opt.ignoreFiles && Array.isArray(assets) && assets.length) {
76
77
  const assetsMap = opt.assetsMap;
77
- const regex = new RegExp(assets.map((asset) => asset.fileUrl?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join("|"), "g");
78
+ // 正则
79
+ const regex = utils.transAssetsToRegx(assets, 'fileUrl');
78
80
  replaceFrontendTypesAssets(NaslAnnotatedJSON.frontendTypes, (node: any, key: string, url: string) => {
79
81
  if (['staticStyle'].includes(key)) {
80
82
  node[key] = url.replace(regex, (url) => {
81
- const asset = assetsMap.get(url);
83
+ const asset: Asset = utils.getAssetFromAssetsMap(assetsMap, url);
82
84
  if (asset) {
83
85
  const assetName = encodeURIComponent(asset.name);
84
86
  const path = `/assets/${assetName}`;
@@ -92,11 +94,12 @@ async function getNaslAnnotatedJSON(app: App, opt: InternalReleaseData) {
92
94
  return url;
93
95
  });
94
96
  } else {
95
- const asset = assetsMap.get(url);
97
+ const asset: Asset = utils.getAssetFromAssetsMap(assetsMap, url);
96
98
  if (asset) {
97
99
  // 这里是用户上传的图片链接 在导出的时候变为 离线下载的
98
100
  // 上边也是同样的目的 只是处理的css样式里的图片链接
99
- const path = `/assets/${asset.name}`;
101
+ const assetName = encodeURIComponent(asset.name);
102
+ const path = `/assets/${assetName}`;
100
103
  globalConfig.assets.push({
101
104
  path,
102
105
  isDir: false,
@@ -109,14 +112,14 @@ async function getNaslAnnotatedJSON(app: App, opt: InternalReleaseData) {
109
112
  }
110
113
 
111
114
  replaceFrontendTypesAssets(NaslAnnotatedJSON.frontendTypes, (node: any, key: string, url: string) => {
112
- // 增加处理两种情况 1 css 自带图片; 2 src 属性带的图片
115
+ // 增加处理两种情况 1 css 自带图片; 2 src 属性带的图片 3 用户上传的icon name 属性
113
116
  if (['staticStyle'].includes(key)) {
114
117
  // "background: url('/assets/login-bg-1.jpg') no-repeat; background-size: cover; height: 100vh;"
115
118
  if(url.includes(`url('/assets/`) && app.sysPrefixPath?.length > 0 ){
116
119
  node[key] = url.replace(/url\('\/assets\/(.*?)'\)/, `url('${app.sysPrefixPath}/assets/$1')`)
117
120
  }
118
121
  } else {
119
- if(node.name=='src' && /^\/assets\/(.*?)$/.test(url) &&app.sysPrefixPath?.length>0){
122
+ if(['src' ,'name'].includes(node.name)&& /^\/assets\/(.*?)$/.test(url) &&app.sysPrefixPath?.length>0){
120
123
  node[key]= `${app.sysPrefixPath}${url}`
121
124
  }
122
125
  }
@@ -1,2 +1,3 @@
1
1
  export * from './types';
2
2
  export * from './data';
3
+ export * from './utils';
@@ -423,6 +423,10 @@ export function getProcessFormDefinitions(app: App) {
423
423
  `${process.name}.`,
424
424
  'processDetailFormData.'
425
425
  );
426
+ formDefinition = formDefinition.replaceAll(
427
+ `(${process.name} ||`,
428
+ '{processDetailFormData ||'
429
+ );
426
430
  formDefinition = formDefinition.replace(
427
431
  /:ref="([^"]+)"/g,
428
432
  (match: any, p1: string) => {
@@ -433,7 +437,6 @@ export function getProcessFormDefinitions(app: App) {
433
437
 
434
438
  if (process?.composedBy) {
435
439
  const formInfo = genProcessFormCode(view);
436
- console.log('formInfo: ', formInfo);
437
440
  // 往form内塞入内容
438
441
  if (type === 'pc')
439
442
  formDefinition = formDefinition.replace(/<\/u-form>/, `${formInfo}</u-form>`);
@@ -458,6 +461,5 @@ export function getProcessFormDefinitions(app: App) {
458
461
  res.push(itemH5);
459
462
  }
460
463
  });
461
-
462
464
  return res;
463
465
  }