@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
@@ -121,8 +121,6 @@ export class TypeAnnotation extends BaseNode {
121
121
  @property()
122
122
  ruleMap: Object = undefined;
123
123
 
124
-
125
-
126
124
  /**
127
125
  * @param source 需要合并的部分参数
128
126
  */
@@ -159,10 +157,6 @@ export class TypeAnnotation extends BaseNode {
159
157
  });
160
158
  }
161
159
 
162
-
163
-
164
-
165
-
166
160
  /**
167
161
  * 插入类型标注
168
162
  * @internal
@@ -195,8 +189,6 @@ export class TypeAnnotation extends BaseNode {
195
189
  return typeAnnotation;
196
190
  }
197
191
 
198
-
199
-
200
192
  /**
201
193
  * 插入类型标注
202
194
  * @param typeAnnotationOptions 类型标注参数
@@ -219,8 +211,6 @@ export class TypeAnnotation extends BaseNode {
219
211
  return node;
220
212
  }
221
213
 
222
-
223
-
224
214
  /**
225
215
  * 添加类型标注
226
216
  * @internal
@@ -240,8 +230,6 @@ export class TypeAnnotation extends BaseNode {
240
230
  return this._insertTypeAnnotationInTypeArgumentsAt(options as any, index);
241
231
  }
242
232
 
243
-
244
-
245
233
  /**
246
234
  * 添加类型标注
247
235
  * @param typeAnnotationOptions 类型标注参数
@@ -265,8 +253,6 @@ export class TypeAnnotation extends BaseNode {
265
253
  return node;
266
254
  }
267
255
 
268
-
269
-
270
256
  /**
271
257
  * 插入类型标注
272
258
  * @internal
@@ -299,8 +285,6 @@ export class TypeAnnotation extends BaseNode {
299
285
  return typeAnnotation;
300
286
  }
301
287
 
302
-
303
-
304
288
  /**
305
289
  * 插入类型标注
306
290
  * @param typeAnnotationOptions 类型标注参数
@@ -323,8 +307,6 @@ export class TypeAnnotation extends BaseNode {
323
307
  return node;
324
308
  }
325
309
 
326
-
327
-
328
310
  /**
329
311
  * 添加类型标注
330
312
  * @internal
@@ -344,8 +326,6 @@ export class TypeAnnotation extends BaseNode {
344
326
  return this._insertTypeAnnotationInReturnTypeAt(options as any, index);
345
327
  }
346
328
 
347
-
348
-
349
329
  /**
350
330
  * 添加类型标注
351
331
  * @param typeAnnotationOptions 类型标注参数
@@ -369,11 +349,6 @@ export class TypeAnnotation extends BaseNode {
369
349
  return node;
370
350
  }
371
351
 
372
-
373
-
374
-
375
-
376
-
377
352
  /**
378
353
  * 插入数据结构属性
379
354
  * @internal
@@ -406,8 +381,6 @@ export class TypeAnnotation extends BaseNode {
406
381
  return structureProperty;
407
382
  }
408
383
 
409
-
410
-
411
384
  /**
412
385
  * 插入数据结构属性
413
386
  * @param structurePropertyOptions 数据结构属性参数
@@ -430,8 +403,6 @@ export class TypeAnnotation extends BaseNode {
430
403
  return node;
431
404
  }
432
405
 
433
-
434
-
435
406
  /**
436
407
  * 添加数据结构属性
437
408
  * @internal
@@ -451,8 +422,6 @@ export class TypeAnnotation extends BaseNode {
451
422
  return this._insertStructurePropertyAt(options as any, index);
452
423
  }
453
424
 
454
-
455
-
456
425
  /**
457
426
  * 添加数据结构属性
458
427
  * @param structurePropertyOptions 数据结构属性参数
@@ -476,9 +445,6 @@ export class TypeAnnotation extends BaseNode {
476
445
  return node;
477
446
  }
478
447
 
479
-
480
-
481
-
482
448
  /**
483
449
  * 删除类型标注
484
450
  * @param typeAnnotation 已有的类型标注实例
@@ -486,12 +452,10 @@ export class TypeAnnotation extends BaseNode {
486
452
  removeTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): void;
487
453
 
488
454
  removeTypeAnnotationInTypeArguments(options: TypeAnnotation) {
489
- let typeAnnotation: TypeAnnotation = options;
455
+ const typeAnnotation: TypeAnnotation = options;
490
456
  return typeAnnotation.delete();
491
457
  }
492
458
 
493
-
494
-
495
459
  /**
496
460
  * 删除类型标注
497
461
  * @param typeAnnotation 已有的类型标注实例
@@ -499,7 +463,7 @@ export class TypeAnnotation extends BaseNode {
499
463
  removeTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): void;
500
464
 
501
465
  removeTypeAnnotationInReturnType(options: TypeAnnotation) {
502
- let typeAnnotation: TypeAnnotation = options;
466
+ const typeAnnotation: TypeAnnotation = options;
503
467
  return typeAnnotation.delete();
504
468
  }
505
469
 
@@ -526,8 +490,6 @@ export class TypeAnnotation extends BaseNode {
526
490
  return params;
527
491
  }
528
492
 
529
-
530
-
531
493
  /**
532
494
  * 删除数据结构属性
533
495
  * @param structureProperty 已有的数据结构属性实例
@@ -535,7 +497,7 @@ export class TypeAnnotation extends BaseNode {
535
497
  removeStructureProperty(structureProperty: StructureProperty): void;
536
498
 
537
499
  removeStructureProperty(options: StructureProperty) {
538
- let structureProperty: StructureProperty = options;
500
+ const structureProperty: StructureProperty = options;
539
501
  return structureProperty.delete();
540
502
  }
541
503
 
@@ -571,6 +533,24 @@ export class TypeAnnotation extends BaseNode {
571
533
  return this.headTitle;
572
534
  }
573
535
 
536
+ traverse(callback: (arg: TypeAnnotation) => void,
537
+ enter: (arg: TypeAnnotation) => void,
538
+ leave: (arg: TypeAnnotation) => void,
539
+ onJoin: (arg: TypeAnnotation, arg2: TypeAnnotation) => void) {
540
+ enter(this);
541
+ callback(this);
542
+ if (this.typeArguments && ['generic', 'union'].includes(this.typeKind)) {
543
+ const l = this.typeArguments.length;
544
+ this.typeArguments.forEach((arg, idx) => {
545
+ arg.traverse(callback, enter, leave, onJoin);
546
+ if (idx < l - 1) {
547
+ onJoin(this, arg);
548
+ }
549
+ });
550
+ }
551
+ leave(this);
552
+ }
553
+
574
554
  get typeKey(): string {
575
555
  if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
576
556
  return `${this.typeNamespace}.${this.typeName}`;
@@ -578,7 +558,7 @@ export class TypeAnnotation extends BaseNode {
578
558
  return `${this.typeNamespace}.${this.typeName}<${(this.typeArguments || []).map((arg) => arg.typeKey)}>`;
579
559
  } else if (this.typeKind === 'anonymousStructure') {
580
560
  return `{ ${this.properties.map(({ name, typeAnnotation }) =>
581
- (`${name}: ${typeAnnotation.typeKey}`)).join(', ')} }`;
561
+ (`${name}: ${typeAnnotation ? typeAnnotation.typeKey : 'any'}`)).join(', ')} }`;
582
562
  } else if (this.typeKind === 'union') {
583
563
  return `${this.typeArguments.map((arg) => arg.typeKey).join(' | ')}`;
584
564
  } else {
@@ -591,7 +571,7 @@ export class TypeAnnotation extends BaseNode {
591
571
  if (this.typeKind === 'anonymousStructure') {
592
572
  // 按匿名数据结构的key排序
593
573
  return `{${this.properties.sort(({ name: name1 }, { name: name2 }) => name1 > name2 ? 1 : -1).map(({ name, typeAnnotation }) =>
594
- (`${name}: ${typeAnnotation.sortedTypeKey}`)).join(', ')}}`;
574
+ (`${name}: ${typeAnnotation ? typeAnnotation.sortedTypeKey : 'any'}`)).join(', ')}}`;
595
575
  } else if (this.typeKind === 'union') {
596
576
  // 按返回的每个具体项排序
597
577
  return `${this.typeArguments.map((arg) => arg.sortedTypeKey).sort((name1, name2) => name1 > name2 ? 1 : -1).join(' | ')}`;
@@ -606,10 +586,12 @@ export class TypeAnnotation extends BaseNode {
606
586
  const typeKey = typeArr.join('.');
607
587
  if (this.typeKind === 'generic') {
608
588
  let code = typeKey;
589
+ code += '<';
609
590
  if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
610
591
  // 必须按typeArguments定义的顺序,否则实参位置不对
611
- code += `<${(this.typeArguments || []).map((arg) => arg.sortedTypeKey).join(', ')}>`;
592
+ code += `${(this.typeArguments || []).map((arg) => arg.sortedTypeKey).join(', ')}`;
612
593
  }
594
+ code += '>';
613
595
  return code;
614
596
  }
615
597
  return typeKey;
@@ -661,7 +643,7 @@ export class TypeAnnotation extends BaseNode {
661
643
  return `${this.typeName}<${this.typeArguments.map((arg) => arg.typeTitle || arg.name || 'T').join(', ')}>`;
662
644
  } else if (this.typeKind === 'anonymousStructure') {
663
645
  return `{ ${this.properties?.map(({ name, typeAnnotation }) =>
664
- (`${name}: ${typeAnnotation.typeTitle}`)).join(', ')} }`;
646
+ (`${name}: ${typeAnnotation ? typeAnnotation.typeTitle : 'any'}`)).join(', ')} }`;
665
647
  } else if (this.typeKind === 'union') {
666
648
  return `${this.typeArguments.map((arg) => arg.typeTitle || arg.name).join(' 或 ')}`;
667
649
  } else {
@@ -676,9 +658,9 @@ export class TypeAnnotation extends BaseNode {
676
658
  const length = this.properties?.length;
677
659
  this.properties?.forEach(({ name, typeAnnotation }, index) => {
678
660
  if (index === length - 1) {
679
- typeTitleList.push({ key: name, value: typeAnnotation.typeTitle });
661
+ typeTitleList.push({ key: name, value: `${typeAnnotation ? typeAnnotation.typeTitle : 'any'}` });
680
662
  } else {
681
- typeTitleList.push({ key: name, value: typeAnnotation.typeTitle, dot: ',' });
663
+ typeTitleList.push({ key: name, value: `${typeAnnotation ? typeAnnotation.typeTitle : 'any'}`, dot: ',' });
682
664
  }
683
665
  });
684
666
  typeTitleList.push({ key: '}' });
@@ -797,7 +779,7 @@ export class TypeAnnotation extends BaseNode {
797
779
  let code = `{ __name: "AStructure_${this.hash}", `;
798
780
  (this.properties || []).forEach((property, i) => {
799
781
  code += `${property.name}: `;
800
- code += `${property.typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true, tabSize: (state?.tabSize || 0) + 1 }))}`;
782
+ code += `${property.typeAnnotation ? property.typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true, tabSize: (state?.tabSize || 0) + 1 })) : 'any'}`;
801
783
  code += i < this.properties?.length - 1 ? ', ' : ' }';
802
784
  });
803
785
  return code;
@@ -824,7 +806,7 @@ export class TypeAnnotation extends BaseNode {
824
806
  return 1;
825
807
  return aName < bName ? -1 : 0;
826
808
  }).map(({ name, typeAnnotation }) =>
827
- (`${name}: ${typeAnnotation.anonymousStructureTypeDesc}`)).join(', ')} }`;
809
+ (`${name}: ${typeAnnotation ? typeAnnotation.anonymousStructureTypeDesc : 'any'}`)).join(', ')} }`;
828
810
  } else {
829
811
  return this.typeName;
830
812
  }
@@ -907,6 +889,29 @@ export class TypeAnnotation extends BaseNode {
907
889
  }
908
890
  }
909
891
 
892
+ // 是否是复合类型 List|Map|entities|structures
893
+ isComplexType() {
894
+ const namespaceType = this.typeNamespace.split('.').pop();
895
+ return ['Map', 'List'].includes(this.typeName) || (this.typeKind === 'reference' && ['entities', 'structures'].includes(namespaceType));
896
+ }
897
+ /* 类型签名 */
898
+ get sign() {
899
+ let str: string = '';
900
+ if (['Map', 'List'].includes(this.typeName)) {
901
+ str += this.typeName + '<';
902
+ (this.typeArguments || []).forEach((item, index) => {
903
+ str += item.sign;
904
+ if (index + 1 !== this.typeArguments.length) {
905
+ str += ',';
906
+ }
907
+ });
908
+ str += '>';
909
+ } else {
910
+ str += this.typeName;
911
+ }
912
+ return str;
913
+ }
914
+
910
915
  //================================================================================
911
916
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
912
917
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -60,6 +60,8 @@ export class ValidationRule extends LogicItem {
60
60
  @property('LogicItem')
61
61
  errorMessage: LogicItem = undefined;
62
62
 
63
+
64
+
63
65
  /**
64
66
  * @param source 需要合并的部分参数
65
67
  */
@@ -73,6 +75,7 @@ export class ValidationRule extends LogicItem {
73
75
  return super.from(source, parentNode, parentKey) as ValidationRule;
74
76
  }
75
77
 
78
+
76
79
  /**
77
80
  * 设置错误信息
78
81
  */
@@ -88,6 +91,10 @@ export class ValidationRule extends LogicItem {
88
91
  });
89
92
  }
90
93
 
94
+
95
+
96
+
97
+
91
98
  /**
92
99
  * 插入实际参数
93
100
  * @internal
@@ -120,6 +127,8 @@ export class ValidationRule extends LogicItem {
120
127
  return argument;
121
128
  }
122
129
 
130
+
131
+
123
132
  /**
124
133
  * 插入实际参数
125
134
  * @param argumentOptions 实际参数参数
@@ -142,6 +151,8 @@ export class ValidationRule extends LogicItem {
142
151
  return node;
143
152
  }
144
153
 
154
+
155
+
145
156
  /**
146
157
  * 添加实际参数
147
158
  * @internal
@@ -161,6 +172,8 @@ export class ValidationRule extends LogicItem {
161
172
  return this._insertArgumentAt(options as any, index);
162
173
  }
163
174
 
175
+
176
+
164
177
  /**
165
178
  * 添加实际参数
166
179
  * @param argumentOptions 实际参数参数
@@ -184,6 +197,9 @@ export class ValidationRule extends LogicItem {
184
197
  return node;
185
198
  }
186
199
 
200
+
201
+
202
+
187
203
  /**
188
204
  * 删除实际参数
189
205
  * @param argument 已有的实际参数实例
@@ -191,10 +207,12 @@ export class ValidationRule extends LogicItem {
191
207
  removeArgumentInArguments(argument: Argument): void;
192
208
 
193
209
  removeArgumentInArguments(options: Argument) {
194
- const argument: Argument = options;
210
+ let argument: Argument = options;
195
211
  return argument.delete();
196
212
  }
197
213
 
214
+
215
+
198
216
  /**
199
217
  * 删除逻辑项
200
218
  * @param name 逻辑项名称
@@ -32,6 +32,7 @@ import Logic from './Logic__';
32
32
  import View from './View__';
33
33
  import Module from './Module__';
34
34
  import App from './App__';
35
+ import Frontend from './Frontend__';
35
36
  import ProcessElement from './ProcessElement__';
36
37
  import Process from './Process__';
37
38
 
@@ -94,6 +95,12 @@ export class Variable extends BaseNode {
94
95
  get view() {
95
96
  return this.getAncestor('View') as View;
96
97
  }
98
+ /**
99
+ * 祖先 Frontend
100
+ */
101
+ get frontend() {
102
+ return this.getAncestor('Frontend') as Frontend;
103
+ }
97
104
  /**
98
105
  * 祖先 ProcessElement
99
106
  */
@@ -168,10 +175,6 @@ export class Variable extends BaseNode {
168
175
  });
169
176
  }
170
177
 
171
-
172
-
173
-
174
-
175
178
  /**
176
179
  * 删除类型标注
177
180
  * @param name 类型标注名称
@@ -240,7 +243,10 @@ export class Variable extends BaseNode {
240
243
  toJS(state?: TranslatorState): string {
241
244
  const context = this.view ? 'this' : 'Vue.prototype';
242
245
  const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
243
- const needGenInitFromSchema = typeAnnotation && !['primitive', 'union'].includes(typeAnnotation.typeKind);
246
+ const needGenInitFromSchema = typeAnnotation && (
247
+ !['primitive', 'union'].includes(typeAnnotation.typeKind)
248
+ || typeAnnotation.typeName === 'DateTime'
249
+ );
244
250
  let code = `${this.name} =`;
245
251
  if (needGenInitFromSchema) {
246
252
  code += `${context}.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}',`;
@@ -315,7 +321,7 @@ export class Variable extends BaseNode {
315
321
  * @param name 一般不用传,用于 rename
316
322
  */
317
323
  getEmbeddedFilePath(name = this.name) {
318
- return `/embedded/${this.app.name}/frontendVariables/${name}.ts`;
324
+ return `/embedded/${this.app.name}/frontends/${this.parentNode.name}/variables/${name}.ts`;
319
325
  }
320
326
 
321
327
  toEmbeddedTSFile() {
@@ -191,6 +191,7 @@ import BindStyle from './BindStyle__';
191
191
  import View from './View__';
192
192
  import Module from './Module__';
193
193
  import App from './App__';
194
+ import Frontend from './Frontend__';
194
195
 
195
196
  /**
196
197
  * 页面元素
@@ -305,6 +306,12 @@ export class ViewElement extends BaseNode {
305
306
  get app() {
306
307
  return this.getAncestor('App') as App;
307
308
  }
309
+ /**
310
+ * 祖先 Frontend
311
+ */
312
+ get frontend() {
313
+ return this.getAncestor('Frontend') as Frontend;
314
+ }
308
315
 
309
316
  /**
310
317
  * @param source 需要合并的部分参数
@@ -315,6 +322,8 @@ export class ViewElement extends BaseNode {
315
322
  super.subConstructor(source);
316
323
  }
317
324
 
325
+
326
+
318
327
  /**
319
328
  * 从父级删除该节点
320
329
  * @internal
@@ -363,7 +372,7 @@ export class ViewElement extends BaseNode {
363
372
  });
364
373
  }
365
374
 
366
- getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
375
+ getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
367
376
  const excludedSet = new Set(excludedList);
368
377
  return ((this.bindAttrs as BindAttribute[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
369
378
  }
@@ -504,6 +513,7 @@ export class ViewElement extends BaseNode {
504
513
  return node;
505
514
  }
506
515
 
516
+
507
517
  getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
508
518
  const excludedSet = new Set(excludedList);
509
519
  return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -645,6 +655,7 @@ export class ViewElement extends BaseNode {
645
655
  return node;
646
656
  }
647
657
 
658
+
648
659
  getBindDirectiveExistingNames(excludedList: Array<BindDirective> = []) {
649
660
  const excludedSet = new Set(excludedList);
650
661
  return ((this.bindDirectives as BindDirective[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -786,6 +797,9 @@ export class ViewElement extends BaseNode {
786
797
  return node;
787
798
  }
788
799
 
800
+
801
+
802
+
789
803
  getBindStyleExistingNames(excludedList: Array<BindStyle> = []) {
790
804
  const excludedSet = new Set(excludedList);
791
805
  return ((this.bindStyles as BindStyle[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -927,6 +941,9 @@ export class ViewElement extends BaseNode {
927
941
  return node;
928
942
  }
929
943
 
944
+
945
+
946
+
930
947
  /**
931
948
  * 插入页面元素
932
949
  * @internal
@@ -1060,6 +1077,9 @@ export class ViewElement extends BaseNode {
1060
1077
  return node;
1061
1078
  }
1062
1079
 
1080
+
1081
+
1082
+
1063
1083
  /**
1064
1084
  * 删除元素绑定属性
1065
1085
  * @param name 元素绑定属性名称
@@ -1108,6 +1128,8 @@ export class ViewElement extends BaseNode {
1108
1128
  return params;
1109
1129
  }
1110
1130
 
1131
+
1132
+
1111
1133
  /**
1112
1134
  * 删除元素绑定事件
1113
1135
  * @param name 元素绑定事件名称
@@ -1156,6 +1178,8 @@ export class ViewElement extends BaseNode {
1156
1178
  return params;
1157
1179
  }
1158
1180
 
1181
+
1182
+
1159
1183
  /**
1160
1184
  * 删除元素指令
1161
1185
  * @param name 元素指令名称
@@ -1204,6 +1228,8 @@ export class ViewElement extends BaseNode {
1204
1228
  return params;
1205
1229
  }
1206
1230
 
1231
+
1232
+
1207
1233
  /**
1208
1234
  * 删除元素绑定样式
1209
1235
  * @param name 元素绑定样式名称
@@ -1252,6 +1278,8 @@ export class ViewElement extends BaseNode {
1252
1278
  return params;
1253
1279
  }
1254
1280
 
1281
+
1282
+
1255
1283
  /**
1256
1284
  * 删除页面元素
1257
1285
  * @param name 页面元素名称
@@ -1700,7 +1728,7 @@ export class ViewElement extends BaseNode {
1700
1728
  let element: ViewElement;
1701
1729
  if (astNode.type === 1) {
1702
1730
  if (astNode.tag === 'router-view') {
1703
- if (config.scope === 'h5') {
1731
+ if (view.frontend.type === 'h5') {
1704
1732
  astNode.tag = 'van-router-view';
1705
1733
  } else {
1706
1734
  astNode.tag = 'u-router-view';
@@ -1745,7 +1773,7 @@ export class ViewElement extends BaseNode {
1745
1773
  }
1746
1774
  attr = new BindAttribute(source);
1747
1775
  } catch (e) {
1748
- const expression = <any>this._parseExpression(oldAttr.value);
1776
+ const expression = <any> this._parseExpression(oldAttr.value);
1749
1777
  attr = new BindAttribute({
1750
1778
  type: 'dynamic',
1751
1779
  name: oldAttr.name,
@@ -1802,7 +1830,7 @@ export class ViewElement extends BaseNode {
1802
1830
  if (directive.name === 'model') {
1803
1831
  const valueAttr = astNode.attrs && astNode.attrs.find((attr) => attr.name === 'value');
1804
1832
  if (!valueAttr) {
1805
- const expression = <any>this._parseExpression(directive.value);
1833
+ const expression = <any> this._parseExpression(directive.value);
1806
1834
  element.addBindAttribute(new BindAttribute({
1807
1835
  type: 'dynamic',
1808
1836
  name: 'value',
@@ -1812,7 +1840,7 @@ export class ViewElement extends BaseNode {
1812
1840
  }));
1813
1841
  }
1814
1842
  } else {
1815
- const expression = <any>this._parseExpression(directive.value);
1843
+ const expression = <any> this._parseExpression(directive.value);
1816
1844
  element.addBindDirective(new BindDirective({
1817
1845
  type: expression ? 'string' : 'dynamic',
1818
1846
  name: directive.name,
@@ -1831,7 +1859,7 @@ export class ViewElement extends BaseNode {
1831
1859
  name: 'if',
1832
1860
  rawName: 'v-if',
1833
1861
  value: '',
1834
- expression: <any>this._parseExpression(astNode.if),
1862
+ expression: <any> this._parseExpression(astNode.if),
1835
1863
  }));
1836
1864
  }
1837
1865
  } else if (astNode.type === 2) {
@@ -1842,7 +1870,7 @@ export class ViewElement extends BaseNode {
1842
1870
  name: view.getViewElementUniqueName(`${baseName}1`),
1843
1871
  });
1844
1872
  const value = astNode.text?.match(/{{(.*?)}}/)[1].trim();
1845
- const expression = <any>this._parseExpression(value);
1873
+ const expression = <any> this._parseExpression(value);
1846
1874
  element.addBindAttribute(new BindAttribute({
1847
1875
  type: 'dynamic',
1848
1876
  name: 'text',
@@ -2063,11 +2091,27 @@ export class ViewElement extends BaseNode {
2063
2091
  this.staticClass && parts.push(`class="${this.staticClass}"`);
2064
2092
  this.staticStyle && parts.push(`style="${this.staticStyle}"`);
2065
2093
 
2094
+ const vIfs: string[] = [];
2066
2095
  [].concat(this.bindAttrs, this.bindDirectives, this.bindEvents).forEach((attr: BindAttribute | BindDirective | BindEvent) => {
2067
2096
  const result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
2097
+
2098
+ // v-auth v-if 都翻译成 v-if
2099
+ if(attr instanceof BindDirective && ['if', 'auth'].includes(attr.name) && result !== false) {
2100
+ const expr = result.replace(/v-(if|auth)="(.*)"/, (match, p1, p2) => p2);
2101
+ if(expr)
2102
+ vIfs.push(attr.name === 'if' ? expr : `$auth.has(${expr})`);
2103
+
2104
+ return;
2105
+ }
2106
+
2068
2107
  result && parts.push(result);
2069
2108
  });
2070
2109
 
2110
+ if(vIfs.length === 2)
2111
+ parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
2112
+ else if(vIfs.length === 1)
2113
+ parts.push(`v-if="${vIfs[0]}"`)
2114
+
2071
2115
  const bindStyles = newOptions.bindStylesFormat(this.bindStyles, this);
2072
2116
  if (bindStyles)
2073
2117
  parts.push(bindStyles);