@lcap/nasl 2.22.0-beta.5 → 3.0.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 (304) hide show
  1. package/README.md +13 -0
  2. package/docs/classes/Module.html +15 -15
  3. package/docs/classes/Namespace.html +15 -15
  4. package/docs/classes/ViewComponent.html +19 -19
  5. package/out/automate/engine/utils.js +4 -0
  6. package/out/automate/engine/utils.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  8. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  9. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  10. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  11. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  12. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  13. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  14. package/out/breakpoint/generator/BreakpointNode.js +166 -0
  15. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  16. package/out/breakpoint/generator/index.d.ts +4 -0
  17. package/out/breakpoint/generator/index.js +98 -0
  18. package/out/breakpoint/generator/index.js.map +1 -0
  19. package/out/breakpoint/index.d.ts +3 -0
  20. package/out/breakpoint/index.js +20 -0
  21. package/out/breakpoint/index.js.map +1 -0
  22. package/out/breakpoint/shared/constants.d.ts +30 -0
  23. package/out/breakpoint/shared/constants.js +87 -0
  24. package/out/breakpoint/shared/constants.js.map +1 -0
  25. package/out/breakpoint/shared/index.d.ts +3 -0
  26. package/out/breakpoint/shared/index.js +33 -0
  27. package/out/breakpoint/shared/index.js.map +1 -0
  28. package/out/breakpoint/shared/operations.d.ts +10 -0
  29. package/out/breakpoint/shared/operations.js +25 -0
  30. package/out/breakpoint/shared/operations.js.map +1 -0
  31. package/out/breakpoint/shared/socket.d.ts +47 -0
  32. package/out/breakpoint/shared/socket.js +210 -0
  33. package/out/breakpoint/shared/socket.js.map +1 -0
  34. package/out/breakpoint/shared/utils.d.ts +20 -0
  35. package/out/breakpoint/shared/utils.js +133 -0
  36. package/out/breakpoint/shared/utils.js.map +1 -0
  37. package/out/breakpoint/store/core.d.ts +30 -0
  38. package/out/breakpoint/store/core.js +341 -0
  39. package/out/breakpoint/store/core.js.map +1 -0
  40. package/out/breakpoint/store/dock.d.ts +1 -0
  41. package/out/breakpoint/store/dock.js +127 -0
  42. package/out/breakpoint/store/dock.js.map +1 -0
  43. package/out/breakpoint/store/index.d.ts +2 -0
  44. package/out/breakpoint/store/index.js +19 -0
  45. package/out/breakpoint/store/index.js.map +1 -0
  46. package/out/common/BaseNode.d.ts +8 -0
  47. package/out/common/BaseNode.js +19 -0
  48. package/out/common/BaseNode.js.map +1 -1
  49. package/out/concepts/App__.d.ts +365 -16
  50. package/out/concepts/App__.js +431 -10
  51. package/out/concepts/App__.js.map +1 -1
  52. package/out/concepts/Assignment__.js +1 -1
  53. package/out/concepts/Assignment__.js.map +1 -1
  54. package/out/concepts/AuthInterface__.d.ts +37 -0
  55. package/out/concepts/AuthInterface__.js +141 -0
  56. package/out/concepts/AuthInterface__.js.map +1 -0
  57. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  58. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  59. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  60. package/out/concepts/AuthLogic__.d.ts +66 -0
  61. package/out/concepts/AuthLogic__.js +206 -0
  62. package/out/concepts/AuthLogic__.js.map +1 -0
  63. package/out/concepts/BackendVariable__.d.ts +137 -0
  64. package/out/concepts/BackendVariable__.js +422 -0
  65. package/out/concepts/BackendVariable__.js.map +1 -0
  66. package/out/concepts/Backend__.d.ts +134 -0
  67. package/out/concepts/Backend__.js +274 -0
  68. package/out/concepts/Backend__.js.map +1 -0
  69. package/out/concepts/BindAttribute__.d.ts +1 -1
  70. package/out/concepts/BindAttribute__.js +3 -1
  71. package/out/concepts/BindAttribute__.js.map +1 -1
  72. package/out/concepts/BindEvent__.d.ts +12 -0
  73. package/out/concepts/BindEvent__.js +68 -0
  74. package/out/concepts/BindEvent__.js.map +1 -1
  75. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  76. package/out/concepts/CallAuthInterface__.js +408 -0
  77. package/out/concepts/CallAuthInterface__.js.map +1 -0
  78. package/out/concepts/CallInterface__.d.ts +6 -1
  79. package/out/concepts/CallInterface__.js +9 -1
  80. package/out/concepts/CallInterface__.js.map +1 -1
  81. package/out/concepts/CallLogic__.js +3 -1
  82. package/out/concepts/CallLogic__.js.map +1 -1
  83. package/out/concepts/CallQueryComponent__.js +9 -7
  84. package/out/concepts/CallQueryComponent__.js.map +1 -1
  85. package/out/concepts/Destination__.js +1 -1
  86. package/out/concepts/Destination__.js.map +1 -1
  87. package/out/concepts/End__.js +29 -2
  88. package/out/concepts/End__.js.map +1 -1
  89. package/out/concepts/EntityProperty__.js.map +1 -1
  90. package/out/concepts/Entity__.d.ts +1 -2
  91. package/out/concepts/Entity__.js +1 -31
  92. package/out/concepts/Entity__.js.map +1 -1
  93. package/out/concepts/ForEachStatement__.js +9 -4
  94. package/out/concepts/ForEachStatement__.js.map +1 -1
  95. package/out/concepts/FrontendLibrary__.d.ts +29 -29
  96. package/out/concepts/FrontendLibrary__.js +2 -2
  97. package/out/concepts/FrontendVariable__.d.ts +21 -0
  98. package/out/concepts/FrontendVariable__.js +64 -0
  99. package/out/concepts/FrontendVariable__.js.map +1 -0
  100. package/out/concepts/Frontend__.d.ts +151 -47
  101. package/out/concepts/Frontend__.js +188 -32
  102. package/out/concepts/Frontend__.js.map +1 -1
  103. package/out/concepts/Function__.js +1 -1
  104. package/out/concepts/Function__.js.map +1 -1
  105. package/out/concepts/Identifier__.js +1 -1
  106. package/out/concepts/Identifier__.js.map +1 -1
  107. package/out/concepts/Interface__.d.ts +1 -1
  108. package/out/concepts/Interface__.js.map +1 -1
  109. package/out/concepts/LogicItem__.d.ts +18 -3
  110. package/out/concepts/LogicItem__.js +22 -4
  111. package/out/concepts/LogicItem__.js.map +1 -1
  112. package/out/concepts/Logic__.d.ts +14 -9
  113. package/out/concepts/Logic__.js +43 -5
  114. package/out/concepts/Logic__.js.map +1 -1
  115. package/out/concepts/Module__.js.map +1 -1
  116. package/out/concepts/Namespace__.d.ts +29 -29
  117. package/out/concepts/Namespace__.js +2 -2
  118. package/out/concepts/NewComposite__.js +2 -2
  119. package/out/concepts/NewComposite__.js.map +1 -1
  120. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  121. package/out/concepts/OverriddenLogic__.js +1602 -0
  122. package/out/concepts/OverriddenLogic__.js.map +1 -0
  123. package/out/concepts/Param__.d.ts +6 -0
  124. package/out/concepts/Param__.js +10 -0
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/QueryFieldExpression__.d.ts +2 -0
  127. package/out/concepts/QueryFieldExpression__.js +9 -0
  128. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  129. package/out/concepts/QuerySelectExpression__.d.ts +2 -2
  130. package/out/concepts/QuerySelectExpression__.js +2 -2
  131. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  132. package/out/concepts/TypeAnnotation__.js +6 -6
  133. package/out/concepts/TypeAnnotation__.js.map +1 -1
  134. package/out/concepts/Variable__.d.ts +10 -0
  135. package/out/concepts/Variable__.js +12 -0
  136. package/out/concepts/Variable__.js.map +1 -1
  137. package/out/concepts/ViewComponent__.d.ts +33 -33
  138. package/out/concepts/ViewComponent__.js +7 -7
  139. package/out/concepts/ViewElement__.d.ts +6 -0
  140. package/out/concepts/ViewElement__.js +104 -1
  141. package/out/concepts/ViewElement__.js.map +1 -1
  142. package/out/concepts/View__.js +2 -2
  143. package/out/concepts/View__.js.map +1 -1
  144. package/out/concepts/basics/stdlib/index.js +2 -1
  145. package/out/concepts/basics/stdlib/index.js.map +1 -1
  146. package/out/concepts/basics/stdlib/nasl.auth.js +24 -0
  147. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  148. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  149. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  150. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  151. package/out/concepts/basics/stdlib/nasl.process.js +68 -0
  152. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.ui.js +4 -19
  154. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.util.js +83 -17
  156. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  157. package/out/concepts/basics/types/index.d.ts +1 -0
  158. package/out/concepts/basics/types/index.js +4 -1
  159. package/out/concepts/basics/types/index.js.map +1 -1
  160. package/out/concepts/index__.d.ts +8 -0
  161. package/out/concepts/index__.js +8 -0
  162. package/out/concepts/index__.js.map +1 -1
  163. package/out/enums/KEYWORDS.js +0 -1
  164. package/out/enums/KEYWORDS.js.map +1 -1
  165. package/out/generator/genBundleFiles.d.ts +1 -0
  166. package/out/generator/genBundleFiles.js +27 -0
  167. package/out/generator/genBundleFiles.js.map +1 -1
  168. package/out/generator/genMetaData.d.ts +4 -1
  169. package/out/generator/genMetaData.js +14 -0
  170. package/out/generator/genMetaData.js.map +1 -1
  171. package/out/generator/genReleaseBody.d.ts +2 -1
  172. package/out/generator/genReleaseBody.js +2 -1
  173. package/out/generator/genReleaseBody.js.map +1 -1
  174. package/out/index.d.ts +2 -1
  175. package/out/index.js +3 -1
  176. package/out/index.js.map +1 -1
  177. package/out/server/extendBaseNode.js +16 -4
  178. package/out/server/extendBaseNode.js.map +1 -1
  179. package/out/server/formatTsUtils.d.ts +2 -1
  180. package/out/server/formatTsUtils.js +39 -4
  181. package/out/server/formatTsUtils.js.map +1 -1
  182. package/out/server/getExtensionModules.d.ts +2 -2
  183. package/out/server/getExtensionModules.js +16 -2
  184. package/out/server/getExtensionModules.js.map +1 -1
  185. package/out/server/getLogics.js +5 -5
  186. package/out/server/getLogics.js.map +1 -1
  187. package/out/server/getMemberIdentifier.d.ts +1 -0
  188. package/out/server/getMemberIdentifier.js +34 -7
  189. package/out/server/getMemberIdentifier.js.map +1 -1
  190. package/out/server/naslServer.d.ts +64 -64
  191. package/out/server/naslServer.js +249 -121
  192. package/out/server/naslServer.js.map +1 -1
  193. package/out/server/naslStdlibMap.js +2 -0
  194. package/out/server/naslStdlibMap.js.map +1 -1
  195. package/out/server/translator.d.ts +1 -0
  196. package/out/server/translator.js +67 -2
  197. package/out/server/translator.js.map +1 -1
  198. package/out/service/defaultErrorMessage.json +1 -0
  199. package/out/service/storage/api.d.ts +10 -1
  200. package/out/service/storage/api.js +6 -0
  201. package/out/service/storage/api.js.map +1 -1
  202. package/out/service/storage/init.d.ts +4 -0
  203. package/out/service/storage/init.js +55 -35
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/service/storage/service.d.ts +3 -0
  206. package/out/service/storage/service.js +14 -0
  207. package/out/service/storage/service.js.map +1 -1
  208. package/out/utils/sortTsString.d.ts +1 -0
  209. package/out/utils/sortTsString.js +36 -0
  210. package/out/utils/sortTsString.js.map +1 -0
  211. package/out/utils/traverse.js +2 -2
  212. package/out/utils/traverse.js.map +1 -1
  213. package/package.json +7 -2
  214. package/sandbox/stdlib/nasl.auth.ts +8 -4
  215. package/sandbox/stdlib/nasl.core.d.ts +206 -0
  216. package/sandbox/stdlib/nasl.core.js +1 -0
  217. package/sandbox/stdlib/nasl.core.js.map +1 -0
  218. package/sandbox/stdlib/nasl.http.ts +35 -0
  219. package/sandbox/stdlib/nasl.process.ts +13 -0
  220. package/sandbox/stdlib/nasl.ui.ts +0 -5
  221. package/src/automate/engine/utils.js +4 -1
  222. package/src/breakpoint/generator/AfterStartNode.ts +27 -0
  223. package/src/breakpoint/generator/BeforeEndNode.ts +27 -0
  224. package/src/breakpoint/generator/BreakpointNode.ts +228 -0
  225. package/src/breakpoint/generator/index.ts +114 -0
  226. package/src/breakpoint/index.ts +3 -0
  227. package/src/breakpoint/shared/constants.ts +95 -0
  228. package/src/breakpoint/shared/index.ts +3 -0
  229. package/src/breakpoint/shared/operations.ts +25 -0
  230. package/src/breakpoint/shared/socket.ts +326 -0
  231. package/src/breakpoint/shared/utils.ts +195 -0
  232. package/src/breakpoint/store/core.ts +411 -0
  233. package/src/breakpoint/store/dock.ts +166 -0
  234. package/src/breakpoint/store/index.ts +2 -0
  235. package/src/breakpoint/types/index.d.ts +19 -0
  236. package/src/common/BaseNode.ts +19 -1
  237. package/src/concepts/App__.ts +828 -26
  238. package/src/concepts/Assignment__.ts +1 -1
  239. package/src/concepts/AuthInterface__.ts +148 -0
  240. package/src/concepts/AuthLogicForCallInterface__.ts +573 -0
  241. package/src/concepts/AuthLogic__.ts +225 -0
  242. package/src/concepts/BackendVariable__.ts +466 -0
  243. package/src/concepts/Backend__.ts +347 -0
  244. package/src/concepts/BindAttribute__.ts +4 -3
  245. package/src/concepts/BindEvent__.ts +71 -2
  246. package/src/concepts/CallAuthInterface__.ts +490 -0
  247. package/src/concepts/CallInterface__.ts +10 -2
  248. package/src/concepts/CallLogic__.ts +3 -1
  249. package/src/concepts/CallQueryComponent__.ts +67 -7
  250. package/src/concepts/Destination__.ts +19 -1
  251. package/src/concepts/End__.ts +31 -3
  252. package/src/concepts/EntityProperty__.ts +6 -0
  253. package/src/concepts/Entity__.ts +8 -31
  254. package/src/concepts/ForEachStatement__.ts +9 -4
  255. package/src/concepts/FrontendLibrary__.ts +30 -30
  256. package/src/concepts/FrontendVariable__.ts +76 -0
  257. package/src/concepts/Frontend__.ts +352 -89
  258. package/src/concepts/Function__.ts +1 -1
  259. package/src/concepts/Identifier__.ts +5 -5
  260. package/src/concepts/Interface__.ts +1 -1
  261. package/src/concepts/LogicItem__.ts +26 -6
  262. package/src/concepts/Logic__.ts +86 -8
  263. package/src/concepts/Module__.ts +32 -2
  264. package/src/concepts/Namespace__.ts +30 -30
  265. package/src/concepts/NewComposite__.ts +2 -3
  266. package/src/concepts/OverriddenLogic__.ts +2165 -0
  267. package/src/concepts/Param__.ts +13 -3
  268. package/src/concepts/QueryFieldExpression__.ts +18 -0
  269. package/src/concepts/QuerySelectExpression__.ts +11 -3
  270. package/src/concepts/TypeAnnotation__.ts +45 -6
  271. package/src/concepts/Variable__.ts +14 -0
  272. package/src/concepts/ViewComponent__.ts +35 -35
  273. package/src/concepts/ViewElement__.ts +104 -1
  274. package/src/concepts/View__.ts +24 -2
  275. package/src/concepts/basics/stdlib/index.ts +2 -1
  276. package/src/concepts/basics/stdlib/nasl.auth.ts +24 -0
  277. package/src/concepts/basics/stdlib/nasl.http.ts +166 -0
  278. package/src/concepts/basics/stdlib/nasl.process.ts +68 -0
  279. package/src/concepts/basics/stdlib/nasl.ui.ts +4 -19
  280. package/src/concepts/basics/stdlib/nasl.util.ts +83 -17
  281. package/src/concepts/basics/types/index.ts +5 -4
  282. package/src/concepts/index__.ts +8 -0
  283. package/src/enums/KEYWORDS.ts +0 -1
  284. package/src/generator/genBundleFiles.ts +36 -2
  285. package/src/generator/genMetaData.ts +16 -1
  286. package/src/generator/genReleaseBody.ts +4 -1
  287. package/src/index.ts +2 -1
  288. package/src/server/extendBaseNode.ts +18 -7
  289. package/src/server/formatTsUtils.ts +37 -5
  290. package/src/server/getExtensionModules.ts +18 -3
  291. package/src/server/getLogics.ts +6 -6
  292. package/src/server/getMemberIdentifier.ts +35 -9
  293. package/src/server/naslServer.ts +250 -124
  294. package/src/server/naslStdlibMap.ts +2 -0
  295. package/src/server/translator.ts +67 -1
  296. package/src/service/defaultErrorMessage.json +1 -0
  297. package/src/service/storage/api.js +7 -1
  298. package/src/service/storage/init.ts +66 -35
  299. package/src/service/storage/service.ts +18 -2
  300. package/src/utils/sortTsString.ts +32 -0
  301. package/src/utils/traverse.ts +2 -2
  302. package/test/examples/app-simple.json +73635 -0
  303. package/ts-worker/lib/tsserver.js +3 -3
  304. package/ts-worker/package.json +1 -1
@@ -103,6 +103,8 @@ export class CallQueryComponent extends LogicItem {
103
103
  @property()
104
104
  ideVersion: string = undefined;
105
105
 
106
+
107
+
106
108
  /**
107
109
  * @param source 需要合并的部分参数
108
110
  */
@@ -119,6 +121,7 @@ export class CallQueryComponent extends LogicItem {
119
121
  return super.from(source, parentNode, parentKey) as CallQueryComponent;
120
122
  }
121
123
 
124
+
122
125
  /**
123
126
  * 设置select
124
127
  */
@@ -218,6 +221,10 @@ export class CallQueryComponent extends LogicItem {
218
221
  });
219
222
  }
220
223
 
224
+
225
+
226
+
227
+
221
228
  /**
222
229
  * 插入逻辑项
223
230
  * @internal
@@ -250,6 +257,8 @@ export class CallQueryComponent extends LogicItem {
250
257
  return logicItem;
251
258
  }
252
259
 
260
+
261
+
253
262
  /**
254
263
  * 插入逻辑项
255
264
  * @param logicItemOptions 逻辑项参数
@@ -272,6 +281,8 @@ export class CallQueryComponent extends LogicItem {
272
281
  return node;
273
282
  }
274
283
 
284
+
285
+
275
286
  /**
276
287
  * 添加逻辑项
277
288
  * @internal
@@ -291,6 +302,8 @@ export class CallQueryComponent extends LogicItem {
291
302
  return this._insertItemInWherePlaygroundAt(options as any, index);
292
303
  }
293
304
 
305
+
306
+
294
307
  /**
295
308
  * 添加逻辑项
296
309
  * @param logicItemOptions 逻辑项参数
@@ -314,6 +327,8 @@ export class CallQueryComponent extends LogicItem {
314
327
  return node;
315
328
  }
316
329
 
330
+
331
+
317
332
  /**
318
333
  * 插入查询分组
319
334
  * @internal
@@ -346,6 +361,8 @@ export class CallQueryComponent extends LogicItem {
346
361
  return queryGroupByExpression;
347
362
  }
348
363
 
364
+
365
+
349
366
  /**
350
367
  * 插入查询分组
351
368
  * @param queryGroupByExpressionOptions 查询分组参数
@@ -368,6 +385,8 @@ export class CallQueryComponent extends LogicItem {
368
385
  return node;
369
386
  }
370
387
 
388
+
389
+
371
390
  /**
372
391
  * 添加查询分组
373
392
  * @internal
@@ -387,6 +406,8 @@ export class CallQueryComponent extends LogicItem {
387
406
  return this._insertQueryGroupByExpressionInGroupByAt(options as any, index);
388
407
  }
389
408
 
409
+
410
+
390
411
  /**
391
412
  * 添加查询分组
392
413
  * @param queryGroupByExpressionOptions 查询分组参数
@@ -410,6 +431,8 @@ export class CallQueryComponent extends LogicItem {
410
431
  return node;
411
432
  }
412
433
 
434
+
435
+
413
436
  /**
414
437
  * 插入逻辑项
415
438
  * @internal
@@ -442,6 +465,8 @@ export class CallQueryComponent extends LogicItem {
442
465
  return logicItem;
443
466
  }
444
467
 
468
+
469
+
445
470
  /**
446
471
  * 插入逻辑项
447
472
  * @param logicItemOptions 逻辑项参数
@@ -464,6 +489,8 @@ export class CallQueryComponent extends LogicItem {
464
489
  return node;
465
490
  }
466
491
 
492
+
493
+
467
494
  /**
468
495
  * 添加逻辑项
469
496
  * @internal
@@ -483,6 +510,8 @@ export class CallQueryComponent extends LogicItem {
483
510
  return this._insertItemInHavingPlaygroundAt(options as any, index);
484
511
  }
485
512
 
513
+
514
+
486
515
  /**
487
516
  * 添加逻辑项
488
517
  * @param logicItemOptions 逻辑项参数
@@ -506,6 +535,8 @@ export class CallQueryComponent extends LogicItem {
506
535
  return node;
507
536
  }
508
537
 
538
+
539
+
509
540
  /**
510
541
  * 插入查询排序子句
511
542
  * @internal
@@ -538,6 +569,8 @@ export class CallQueryComponent extends LogicItem {
538
569
  return queryOrderByExpression;
539
570
  }
540
571
 
572
+
573
+
541
574
  /**
542
575
  * 插入查询排序子句
543
576
  * @param queryOrderByExpressionOptions 查询排序子句参数
@@ -560,6 +593,8 @@ export class CallQueryComponent extends LogicItem {
560
593
  return node;
561
594
  }
562
595
 
596
+
597
+
563
598
  /**
564
599
  * 添加查询排序子句
565
600
  * @internal
@@ -579,6 +614,8 @@ export class CallQueryComponent extends LogicItem {
579
614
  return this._insertQueryOrderByExpressionInOrderByAt(options as any, index);
580
615
  }
581
616
 
617
+
618
+
582
619
  /**
583
620
  * 添加查询排序子句
584
621
  * @param queryOrderByExpressionOptions 查询排序子句参数
@@ -602,6 +639,9 @@ export class CallQueryComponent extends LogicItem {
602
639
  return node;
603
640
  }
604
641
 
642
+
643
+
644
+
605
645
  /**
606
646
  * 删除类型标注
607
647
  * @param name 类型标注名称
@@ -650,6 +690,8 @@ export class CallQueryComponent extends LogicItem {
650
690
  return params;
651
691
  }
652
692
 
693
+
694
+
653
695
  /**
654
696
  * 删除查询选择子句
655
697
  * @param name 查询选择子句名称
@@ -675,6 +717,8 @@ export class CallQueryComponent extends LogicItem {
675
717
  return select.delete();
676
718
  }
677
719
 
720
+
721
+
678
722
  /**
679
723
  * 删除查询 From 子句
680
724
  * @param name 查询 From 子句名称
@@ -700,6 +744,8 @@ export class CallQueryComponent extends LogicItem {
700
744
  return from.delete();
701
745
  }
702
746
 
747
+
748
+
703
749
  /**
704
750
  * 删除逻辑项
705
751
  * @param name 逻辑项名称
@@ -725,6 +771,8 @@ export class CallQueryComponent extends LogicItem {
725
771
  return where.delete();
726
772
  }
727
773
 
774
+
775
+
728
776
  /**
729
777
  * 删除逻辑项
730
778
  * @param logicItem 已有的逻辑项实例
@@ -732,10 +780,12 @@ export class CallQueryComponent extends LogicItem {
732
780
  removeItemInWherePlayground(logicItem: LogicItem): void;
733
781
 
734
782
  removeItemInWherePlayground(options: LogicItem) {
735
- const logicItem: LogicItem = options;
783
+ let logicItem: LogicItem = options;
736
784
  return logicItem.delete();
737
785
  }
738
786
 
787
+
788
+
739
789
  /**
740
790
  * 删除查询分组
741
791
  * @param queryGroupByExpression 已有的查询分组实例
@@ -743,10 +793,12 @@ export class CallQueryComponent extends LogicItem {
743
793
  removeQueryGroupByExpressionInGroupBy(queryGroupByExpression: QueryGroupByExpression): void;
744
794
 
745
795
  removeQueryGroupByExpressionInGroupBy(options: QueryGroupByExpression) {
746
- const queryGroupByExpression: QueryGroupByExpression = options;
796
+ let queryGroupByExpression: QueryGroupByExpression = options;
747
797
  return queryGroupByExpression.delete();
748
798
  }
749
799
 
800
+
801
+
750
802
  /**
751
803
  * 删除逻辑项
752
804
  * @param name 逻辑项名称
@@ -772,6 +824,8 @@ export class CallQueryComponent extends LogicItem {
772
824
  return having.delete();
773
825
  }
774
826
 
827
+
828
+
775
829
  /**
776
830
  * 删除逻辑项
777
831
  * @param logicItem 已有的逻辑项实例
@@ -779,10 +833,12 @@ export class CallQueryComponent extends LogicItem {
779
833
  removeItemInHavingPlayground(logicItem: LogicItem): void;
780
834
 
781
835
  removeItemInHavingPlayground(options: LogicItem) {
782
- const logicItem: LogicItem = options;
836
+ let logicItem: LogicItem = options;
783
837
  return logicItem.delete();
784
838
  }
785
839
 
840
+
841
+
786
842
  /**
787
843
  * 删除查询排序子句
788
844
  * @param queryOrderByExpression 已有的查询排序子句实例
@@ -790,10 +846,12 @@ export class CallQueryComponent extends LogicItem {
790
846
  removeQueryOrderByExpressionInOrderBy(queryOrderByExpression: QueryOrderByExpression): void;
791
847
 
792
848
  removeQueryOrderByExpressionInOrderBy(options: QueryOrderByExpression) {
793
- const queryOrderByExpression: QueryOrderByExpression = options;
849
+ let queryOrderByExpression: QueryOrderByExpression = options;
794
850
  return queryOrderByExpression.delete();
795
851
  }
796
852
 
853
+
854
+
797
855
  /**
798
856
  * 删除查询分页子句
799
857
  * @param name 查询分页子句名称
@@ -1074,7 +1132,7 @@ export class CallQueryComponent extends LogicItem {
1074
1132
  } else if (this.select.selectFieldElements.some((item) => item.entityAsName === entityName && item.propertyName)) {
1075
1133
  // 2.22 选择字段时,生成选择字段的匿名数据结构 { entity1: { prop1, prop2 } }
1076
1134
  const entity: Entity = this.app.findNodeByCompleteName(entityNamespace + '.' + entityName);
1077
- properties.push(StructureProperty.from({
1135
+ entity && properties.push(StructureProperty.from({
1078
1136
  name: utils.firstLowerCase(entityName),
1079
1137
  typeAnnotation: TypeAnnotation.from({
1080
1138
  concept: 'TypeAnnotation',
@@ -1182,9 +1240,10 @@ export class CallQueryComponent extends LogicItem {
1182
1240
  }
1183
1241
 
1184
1242
  genStructure(structureName?: string, properties: any[] = []) {
1243
+ const logic = this.logic || this.AuthLogic || this.AuthLogicForCallInterface;
1185
1244
  return Structure.from({
1186
1245
  concept: 'Structure',
1187
- name: structureName || this.typeAnnotation?.typeName || `${utils.firstUpperCase(this.logic.name)}Structure`,
1246
+ name: structureName || this.typeAnnotation?.typeName || `${utils.firstUpperCase(logic.name)}Structure`,
1188
1247
  origin: 'CallQueryComponent',
1189
1248
  properties,
1190
1249
  });
@@ -1222,7 +1281,8 @@ export class CallQueryComponent extends LogicItem {
1222
1281
  }
1223
1282
  }
1224
1283
 
1225
- structureName = structureName || utils.unique(`${utils.firstUpperCase(this.logic.name)}Structure`, this.app.getStructureExistingNames());
1284
+ const logic = this.logic || this.AuthLogic || this.AuthLogicForCallInterface;
1285
+ structureName = structureName || utils.unique(`${utils.firstUpperCase(logic.name)}Structure`, this.app.getStructureExistingNames());
1226
1286
  const groupByLength = groupBy.filter((item) => (item.groupElement as QueryFieldExpression)?.propertyName && (item.groupElement as QueryFieldExpression).asName).length;
1227
1287
  const aggregateLength = selectElements.filter((item) => item.aggregateName && item.asName).length;
1228
1288
 
@@ -66,6 +66,8 @@ export class Destination extends LogicItem {
66
66
  @property()
67
67
  target: string = '_self';
68
68
 
69
+
70
+
69
71
  /**
70
72
  * @param source 需要合并的部分参数
71
73
  */
@@ -82,6 +84,7 @@ export class Destination extends LogicItem {
82
84
  return super.from(source, parentNode, parentKey) as Destination;
83
85
  }
84
86
 
87
+
85
88
  /**
86
89
  * 设置viewNamespace
87
90
  */
@@ -133,6 +136,10 @@ export class Destination extends LogicItem {
133
136
  });
134
137
  }
135
138
 
139
+
140
+
141
+
142
+
136
143
  /**
137
144
  * 插入实际参数
138
145
  * @internal
@@ -165,6 +172,8 @@ export class Destination extends LogicItem {
165
172
  return argument;
166
173
  }
167
174
 
175
+
176
+
168
177
  /**
169
178
  * 插入实际参数
170
179
  * @param argumentOptions 实际参数参数
@@ -187,6 +196,8 @@ export class Destination extends LogicItem {
187
196
  return node;
188
197
  }
189
198
 
199
+
200
+
190
201
  /**
191
202
  * 添加实际参数
192
203
  * @internal
@@ -206,6 +217,8 @@ export class Destination extends LogicItem {
206
217
  return this._insertArgumentAt(options as any, index);
207
218
  }
208
219
 
220
+
221
+
209
222
  /**
210
223
  * 添加实际参数
211
224
  * @param argumentOptions 实际参数参数
@@ -229,6 +242,9 @@ export class Destination extends LogicItem {
229
242
  return node;
230
243
  }
231
244
 
245
+
246
+
247
+
232
248
  /**
233
249
  * 删除实际参数
234
250
  * @param argument 已有的实际参数实例
@@ -236,10 +252,12 @@ export class Destination extends LogicItem {
236
252
  removeArgumentInArguments(argument: Argument): void;
237
253
 
238
254
  removeArgumentInArguments(options: Argument) {
239
- const argument: Argument = options;
255
+ let argument: Argument = options;
240
256
  return argument.delete();
241
257
  }
242
258
 
259
+
260
+
243
261
  /**
244
262
  * 删除锚点参数
245
263
  * @param name 锚点参数名称
@@ -1,4 +1,6 @@
1
1
  import { TranslatorState, indent } from '../translator';
2
+ import Return from './Return__';
3
+ import Logic from './Logic__';
2
4
  //================================================================================
3
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
4
6
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -71,9 +73,35 @@ export class End extends LogicItem {
71
73
 
72
74
  toEmbeddedTS(state?: TranslatorState): string {
73
75
  let code = '';
74
- const ret = this.logic.returns[0];
75
- if (ret) {
76
- code += indent((state?.tabSize || 0)) + 'return ' + ret.name + ';';
76
+ let ret;
77
+ let logic;
78
+ switch (this.parentNode.concept) {
79
+ case 'Logic':
80
+ ret = this.logic.returns[0];
81
+ break;
82
+ case 'AuthLogic':
83
+ ret = this.AuthLogic.returns[0];
84
+ break;
85
+ case 'AuthLogicForCallInterface':
86
+ // 导出接口鉴权参数返回值固定为下面逻辑;
87
+ ret = `${indent((state?.tabSize || 0))}let ${this.parentNode.name}Result: ApiReturn; \n ${indent((state?.tabSize || 0))}return ${this.parentNode.name}Result;\n`;
88
+ break;
89
+ case 'OverriddenLogic':
90
+ ret = this.OverriddenLogic.returns[0];
91
+ break;
92
+ default:
93
+ // 旧逻辑默认走这里,
94
+ // 期望后期可以直接走完整的case, default 直接抛出异常好更明确定位错误
95
+ logic = logic = this.parentNode.getAncestor('Logic')
96
+ || this.parentNode.getAncestor('AuthLogic')
97
+ || this.parentNode.getAncestor('AuthLogicForCallInterface')
98
+ || this.parentNode.getAncestor('OverriddenLogic');
99
+ ret = (logic as Logic).returns[0];
100
+ }
101
+ if (ret && this.parentNode.concept === 'AuthLogicForCallInterface') {
102
+ code += ret;
103
+ } else if (ret && this.parentNode.concept !== 'AuthLogicForCallInterface') {
104
+ code += indent((state?.tabSize || 0)) + 'return ' + (ret as Return).name + ';';
77
105
  } else {
78
106
  code += indent((state?.tabSize || 0)) + 'return;';
79
107
  }
@@ -286,6 +286,10 @@ export class EntityProperty extends BaseNode {
286
286
  });
287
287
  }
288
288
 
289
+
290
+
291
+
292
+
289
293
  /**
290
294
  * 删除类型标注
291
295
  * @param name 类型标注名称
@@ -334,6 +338,8 @@ export class EntityProperty extends BaseNode {
334
338
  return params;
335
339
  }
336
340
 
341
+
342
+
337
343
  /**
338
344
  * 删除数据库存储类型
339
345
  * @param name 数据库存储类型名称
@@ -130,7 +130,7 @@ export class Entity extends BaseNode {
130
130
  });
131
131
  }
132
132
 
133
- getPropertyExistingNames(excludedList: Array<EntityProperty> = []) {
133
+ getPropertyExistingNames(excludedList: Array<EntityProperty> = []) {
134
134
  const excludedSet = new Set(excludedList);
135
135
  return ((this.properties as EntityProperty[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
136
136
  }
@@ -271,6 +271,7 @@ export class Entity extends BaseNode {
271
271
  return node;
272
272
  }
273
273
 
274
+
274
275
  getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
275
276
  const excludedSet = new Set(excludedList);
276
277
  return ((this.indexes as EntityIndex[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -412,6 +413,9 @@ export class Entity extends BaseNode {
412
413
  return node;
413
414
  }
414
415
 
416
+
417
+
418
+
415
419
  /**
416
420
  * 删除实体属性
417
421
  * @param name 实体属性名称
@@ -460,6 +464,8 @@ export class Entity extends BaseNode {
460
464
  return params;
461
465
  }
462
466
 
467
+
468
+
463
469
  /**
464
470
  * 删除实体索引
465
471
  * @param name 实体索引名称
@@ -530,7 +536,7 @@ export class Entity extends BaseNode {
530
536
  /**
531
537
  * 设置实体表名并修改表名
532
538
  */
533
- async setName(name: string) {
539
+ setName(name: string) {
534
540
  const object: any = {
535
541
  name,
536
542
  };
@@ -547,14 +553,10 @@ export class Entity extends BaseNode {
547
553
 
548
554
  this.name = oldName;
549
555
  this.tableName = oldTableName;
550
- this.app?.emit('collect:start', { actionMsg: '修改实体名' });
551
- const refs = await this.findUsage();
552
556
  this.update({
553
557
  ...object,
554
558
  field: 'name',
555
559
  });
556
- this._effect(refs);
557
- this.app?.emit('collect:end');
558
560
  }
559
561
  /**
560
562
  * 设置实体表名
@@ -563,7 +565,6 @@ export class Entity extends BaseNode {
563
565
  const object = {
564
566
  tableName,
565
567
  };
566
- console.log(123123123);
567
568
 
568
569
  const oldTableName = this.tableName;
569
570
  this.tableName = tableName;
@@ -670,30 +671,6 @@ export class Entity extends BaseNode {
670
671
  // 重命名 properties columnName
671
672
  this.formatPropertyColumnName();
672
673
  }
673
- async _effect(refs: any = []) {
674
- // 处理选中的此实体的 CallQueryComponent
675
- const callQueryComponents: Set<CallQueryComponent> = new Set();
676
- refs.forEach((val: any) => {
677
- const loopFindNode = (item: any) => {
678
- if (item.children) {
679
- item.children.forEach((i: any) => loopFindNode(i));
680
- } else {
681
- const target = item.node?.getAncestor('CallQueryComponent');
682
- if (target) {
683
- callQueryComponents.add(target);
684
- }
685
- }
686
- };
687
- loopFindNode(val);
688
- });
689
- callQueryComponents.forEach((node) => {
690
- const targetField = node.select.selectFieldElements.find((item) => item.entityAsName === this.name);
691
- if (targetField) {
692
- // 更新数据结构
693
- node.saveStructure();
694
- }
695
- });
696
- }
697
674
 
698
675
  public static getDefaultOptions() {
699
676
  return {
@@ -511,10 +511,15 @@ export class ForEachStatement extends LogicItem {
511
511
  const list = this.each ? this.each.toJS(shiftState(state, code, {
512
512
  tabSize: 0,
513
513
  })) : '';
514
- code += `if(Array.isArray(${list})) {\n`;
515
- code += `for (let ${this.index.name} = ${this.start && this.start.toJS() ? this.start.toJS() : ''}; `;
516
- code += `${this.index.name} < (${this.end && this.end.toJS() ? this.end.toJS() : ''}); ${this.index.name}++) {\n`;
517
- code += `const ${this.item.name} = (${list})[${this.index.name}];\n`;
514
+ const random = Math.random();
515
+ const number = Math.round(random * 10000);
516
+ code += `var $forEachListVariable${number} = ${list};\n`;
517
+ code += `var $forEachStartVariable${number} = ${this.start && this.start.toJS() ? this.start.toJS() : ''};\n`;
518
+ code += `var $forEachEndVariable${number} = ${this.end && this.end.toJS() ? this.end.toJS() : ''};\n`;
519
+ code += `if(Array.isArray($forEachListVariable${number})) {\n`;
520
+ code += `for (let ${this.index.name} = $forEachStartVariable${number}; `;
521
+ code += `${this.index.name} < $forEachEndVariable${number}; ${this.index.name}++) {\n`;
522
+ code += `const ${this.item.name} = $forEachListVariable${number}[${this.index.name}];\n`;
518
523
  if (Array.isArray(this.body)) {
519
524
  this.body.forEach((logicItem) => {
520
525
  code